marketplaceReference.ts ×7

Frontier kind: Code frontier

unlabeled · c_0333677cde20

103 tests · 22158 LOC · 120 files · introduces 0 tests · 35 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges35 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2485 ranges22158 lines · 120 files · Browse complete extent
All tests (intent)
103 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 35 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.ts 35 introduced LOC · 7 ranges

Open complete file

163
164 export function parseMarketplaceReference(value: string): IMarketplaceReference | undefined {
165 > const rawValue = value.trim(); marketplaceReference.ts
166 > if (!rawValue) {
167 return undefined;
168 }
170 > const uriReference = parseUriMarketplaceReference(rawValue);
171 > if (uriReference) {
172 return uriReference;
173 }
198 }
199
200 > function parseUriMarketplaceReference(rawValue: string): IMarketplaceReference | undefined { marketplaceReference.ts
201 > let uri: URI;
202 > try {
203 > uri = URI.parse(rawValue);
204 > } catch {
205 return undefined;
206 }
208 > const scheme = uri.scheme.toLowerCase();
209 > if (scheme === 'file' && /^file:\/\//i.test(rawValue)) {
210 if (uri.fragment) {
211 return undefined;
223 }
224
225 > if (scheme !== 'http' && scheme !== 'https' && scheme !== 'ssh') { marketplaceReference.ts
226 return undefined;
227 }
232
233 const ref = uri.fragment || undefined;
234 > const cloneUri = uri.fragment ? uri.with({ fragment: '' }) : uri; marketplaceReference.ts
235 > const sanitizedAuthority = sanitizePathSegment(uri.authority.toLowerCase());
236 > const trimmedPath = uri.path.replace(/\/+/g, '/').replace(/\/+$/g, '').replace(/^\/+/, '');
237 >
238 > // Host-only marketplace endpoint (e.g. `https://plugins.internal.example.com`).
239 > // The ADR allows any string for `git.url`, so a URL without a repo path is
240 > // treated as a marketplace registry endpoint identified by host alone.
241 > if (!trimmedPath) {
242 return {
243 rawValue,
253 const gitSuffix = '.git';
254 const pathHasGitSuffix = trimmedPath.toLowerCase().endsWith(gitSuffix);
255 > const pathWithoutGit = pathHasGitSuffix ? trimmedPath.slice(0, trimmedPath.length - gitSuffix.length) : trimmedPath; marketplaceReference.ts
256 > const pathSegments = pathWithoutGit.split('/').map(sanitizePathSegment);
257 > // Always normalize the canonical path to include .git so that URLs with and without the suffix deduplicate.
258 > const canonicalPath = pathHasGitSuffix ? trimmedPath.toLowerCase() : `${trimmedPath.toLowerCase()}${gitSuffix}`;
259 >
260 > // Extract githubRepo for GitHub URLs so the editor can render a clickable link
261 > const githubRepo = extractGitHubRepo(uri.authority, pathWithoutGit);
262 >
263 > // Normalize github.com/<owner>/<repo>[.git] URLs to the same canonical id
264 > // the shorthand parser emits, so policy trust comparisons (which match by
265 > // canonicalId) treat both forms as the same marketplace.
266 > let canonicalId: string;
267 > if (githubRepo) {
268 const [owner, repo] = githubRepo.split('/');
269 canonicalId = getGitHubCanonicalId(owner, repo, ref);