src/vs/platform/extensionManagement/common/configRemotes.ts

114 LOC · 108 covered · 6 uncovered · 34 ranges · 19 concepts · 15 introducers · 13 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the fileworkspaceTags.test|title=Telemetry - WorkspaceTags Single remote hashed|occurrence=1 · 0 introduced LOCworkspaceTags.test|title…workspaceTags.ts ×1 · 31 introduced LOCworkspaceTags.ts ×1configRemotes.ts ×2 · 4 introduced LOCconfigRemotes.ts ×2configRemotes.ts ×1 · 2 introduced LOCconfigRemotes.ts ×1configRemotes.test|title=Config Remotes HTTPS remotes to be hashed|occurrence=1, configRemotes.test|title=Config Remotes Multiple remotes to be hashed|occurrence=1 · 0 introduced LOCconfigRemotes.test|title…configRemotes.test|title=Config Remotes HTTPS remotes|occurrence=1, configRemotes.test|title=Config Remotes Multiple remotes|occurrence=1, +1 · 0 introduced LOCconfigRemotes.test|title…configRemotes.ts ×2 · 6 introduced LOCconfigRemotes.ts ×2configRemotes.ts ×1 · 2 introduced LOCconfigRemotes.ts ×1configRemotes.ts ×1 · 3 introduced LOCconfigRemotes.ts ×1configRemotes.ts ×1 · 3 introduced LOCconfigRemotes.ts ×1configRemotes.ts ×1 · 1 introduced LOCconfigRemotes.ts ×1configRemotes.ts ×1 · 2 introduced LOCconfigRemotes.ts ×1configRemotes.ts ×3 · 4 introduced LOCconfigRemotes.ts ×3configRemotes.ts ×2 · 3 introduced LOCconfigRemotes.ts ×2configRemotes.ts ×2 · 9 introduced LOCconfigRemotes.ts ×2configRemotes.ts ×2 · 6 introduced LOCconfigRemotes.ts ×2configRemotes.ts ×4 · 14 introduced LOCconfigRemotes.ts ×4configRemotes.ts ×4 · 11 introduced LOCconfigRemotes.ts ×4configRemotes.ts ×7 · 38 introduced LOCconfigRemotes.ts ×7configRemotes.test|title=Config Remotes HTTPS remotes to be hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes HTTPS remotes to be hashed|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes HTTPS remotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes HTTPS remotes|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes Local remotes to be hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes Local remotes to be hashed|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes Local remotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes Local remotes|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes Multiple remotes to be hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes Multiple remotes to be hashed|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes Multiple remotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes Multiple remotes|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes Non allowed domains are anonymized|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes Non allowed domains are anonymized|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes SCP-like remotes to be hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes SCP-like remotes to be hashed|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes SCP-like remotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes SCP-like remotes|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes SSH remotes to be hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes SSH remotes to be hashed|occurrence=1configRemotes.test|title…configRemotes.test|title=Config Remotes SSH remotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/extensionManagement/test/common/configRemotes.test|title=Config Remotes SSH remotes|occurrence=1configRemotes.test|title…workspaceTags.test|title=Telemetry - WorkspaceTags Multiple remotes hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/tags/test/node/workspaceTags.test|title=Telemetry - WorkspaceTags Multiple remotes hashed|occurrence=1workspaceTags.test|title…workspaceTags.test|title=Telemetry - WorkspaceTags Single remote hashed|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/tags/test/node/workspaceTags.test|title=Telemetry - WorkspaceTags Single remote hashed|occurrence=1workspaceTags.test|title…Focused file · src/vs/platform/extensionManagement/common/configRemotes.ts · 114 LOCcommon/configRemotes.ts

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- configRemotes.ts ×7
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { URI } from '../../../base/common/uri.js';
7 >
8 > const SshProtocolMatcher = /^([^@:]+@)?([^:]+):/;
9 > const SshUrlMatcher = /^([^@:]+@)?([^:]+):(.+)$/;
10 > const AuthorityMatcher = /^([^@]+@)?([^:]+)(:\d+)?$/;
11 > const SecondLevelDomainMatcher = /([^@:.]+\.[^@:.]+)(:\d+)?$/;
12 > const RemoteMatcher = /^\s*url\s*=\s*(.+\S)\s*$/mg;
13 > const AnyButDot = /[^.]/g;
14 >
15 > export const AllowedSecondLevelDomains = [
16 > 'github.com',
17 > 'bitbucket.org',
18 > 'visualstudio.com',
19 > 'gitlab.com',
20 > 'heroku.com',
21 > 'azurewebsites.net',
22 > 'ibm.com',
23 > 'amazon.com',
24 > 'amazonaws.com',
25 > 'cloudapp.net',
26 > 'rhcloud.com',
27 > 'google.com',
28 > 'azure.com'
29 > ];
30 >
31 > function stripLowLevelDomains(domain: string): string | null { configRemotes.ts ×2
32 > const match = domain.match(SecondLevelDomainMatcher);
33 > return match ? match[1] : null;
34 > }
36 > function extractDomain(url: string): string | null { configRemotes.ts ×4
37 > if (url.indexOf('://') === -1) {
38 > const match = url.match(SshProtocolMatcher); configRemotes.ts ×3
39 > if (match) {
40 > return stripLowLevelDomains(match[2]); configRemotes.ts ×1
41 > } else { configRemotes.ts ×3
42 > return null; configRemotes.ts ×2
43 > }
46 > const uri = URI.parse(url);
47 > if (uri.authority) {
48 > return stripLowLevelDomains(uri.authority); configRemotes.ts ×1
49 > }
50 > } catch (e) { configRemotes.ts ×4
51 // ignore invalid URIs
52 }
53 > return null; configRemotes.ts ×2
54 > }
56 > export function getDomainsOfRemotes(text: string, allowedDomains: readonly string[]): string[] {
57 > const domains = new Set<string>(); configRemotes.ts ×4
58 > let match: RegExpExecArray | null;
59 > while (match = RemoteMatcher.exec(text)) {
60 > const domain = extractDomain(match[1]);
61 > if (domain) {
62 > domains.add(domain); configRemotes.ts ×2
63 > }
65 >
66 > const allowedDomainsSet = new Set(allowedDomains);
67 > return Array.from(domains)
68 > .map(key => allowedDomainsSet.has(key) ? key : key.replace(AnyButDot, 'a'));
69 > }
71 > function stripPort(authority: string): string | null { configRemotes.ts ×2
72 > const match = authority.match(AuthorityMatcher);
73 > return match ? match[2] : null;
74 > }
76 > function normalizeRemote(host: string | null, path: string, stripEndingDotGit: boolean): string | null { configRemotes.ts ×2
77 > if (host && path) {
78 > if (stripEndingDotGit && path.endsWith('.git')) {
79 > path = path.substr(0, path.length - 4);
80 > }
81 > return (path.indexOf('/') === 0) ? `${host}${path}` : `${host}/${path}`;
82 > }
83 return null;
84 }
86 > function extractRemote(url: string, stripEndingDotGit: boolean): string | null { configRemotes.ts ×4
87 > if (url.indexOf('://') === -1) {
88 > const match = url.match(SshUrlMatcher); configRemotes.ts ×2
89 > if (match) {
90 > return normalizeRemote(match[2], match[3], stripEndingDotGit); configRemotes.ts ×1
91 > }
94 > const uri = URI.parse(url);
95 > if (uri.authority) {
96 > return normalizeRemote(stripPort(uri.authority), uri.path, stripEndingDotGit); configRemotes.ts ×2
97 > }
98 > } catch (e) { configRemotes.ts ×4
99 // ignore invalid URIs
100 }
101 > return null; configRemotes.ts ×1
102 > }
104 > export function getRemotes(text: string, stripEndingDotGit: boolean = false): string[] {
105 > const remotes: string[] = []; configRemotes.ts ×4
106 > let match: RegExpExecArray | null;
107 > while (match = RemoteMatcher.exec(text)) {
108 > const remote = extractRemote(match[1], stripEndingDotGit);
109 > if (remote) {
110 > remotes.push(remote); configRemotes.ts ×2
111 > }
113 > return remotes;
114 > }