Skip to content

Commit 93e346a

Browse files
committed
Merge branch 'main' into joh/swc
2 parents 29d5cd5 + 35b971c commit 93e346a

File tree

109 files changed

+1419
-760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1419
-760
lines changed

.vscode/notebooks/my-endgame.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
{
158158
"kind": 2,
159159
"language": "github-issues",
160-
"value": "$REPOS $MILESTONE -$MINE is:issue is:closed sort:updated-asc label:bug -label:unreleased -label:verified -label:z-author-verified -label:on-testplan -label:*duplicate -label:duplicate -label:invalid -label:*as-designed -label:error-telemetry -label:verification-steps-needed -label:verification-found -author:aeschli -author:alexdima -author:alexr00 -author:AmandaSilver -author:bamurtaugh -author:bpasero -author:chrisdias -author:chrmarti -author:Chuxel -author:claudiaregio -author:connor4312 -author:dbaeumer -author:deepak1556 -author:devinvalenciano -author:digitarald -author:DonJayamanne -author:dynamicwebpaige -author:eamodio -author:egamma -author:fiveisprime -author:greazer -author:gregvanl -author:hediet -author:IanMatthewHuff -author:isidorn -author:ItalyPaleAle -author:JacksonKearl -author:joaomoreno -author:joyceerhl -author:jrieken -author:karrtikr-author:kieferrm -author:lramos15 -author:lszomoru -author:meganrogge -author:misolori -author:mjbvz -author:ornellaalt -author:orta -author:rchiodo -author:rebornix -author:roblourens -author:rzhao271 -author:sana-ajani -author:sandy081 -author:sbatten -author:stevencl -author:tanhakabir -author:TylerLeonhardt -author:Tyriar -author:weinand -author:kimadeline -author:amunger"
160+
"value": "$REPOS $MILESTONE -$MINE is:issue is:closed sort:updated-asc label:bug -label:unreleased -label:verified -label:z-author-verified -label:on-testplan -label:*duplicate -label:duplicate -label:invalid -label:*as-designed -label:error-telemetry -label:verification-steps-needed -label:verification-found -author:aeschli -author:alexdima -author:alexr00 -author:AmandaSilver -author:andreamah -author:bamurtaugh -author:bpasero -author:chrisdias -author:chrmarti -author:Chuxel -author:claudiaregio -author:connor4312 -author:dbaeumer -author:deepak1556 -author:devinvalenciano -author:digitarald -author:DonJayamanne -author:egamma -author:fiveisprime -author:gregvanl -author:hediet -author:IanMatthewHuff -author:isidorn -author:joaomoreno -author:joyceerhl -author:jrieken -author:karrtikr -author:kieferrm -author:lramos15 -author:lszomoru -author:meganrogge -author:misolori -author:mjbvz -author:rebornix -author:roblourens -author:rzhao271 -author:sandy081 -author:sbatten -author:stevencl -author:tanhakabir -author:TylerLeonhardt -author:Tyriar -author:weinand -author:amunger"
161161
},
162162
{
163163
"kind": 1,

build/lib/compilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ function generateApiProposalNames() {
219219
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
220220
'',
221221
'export const allApiProposals = Object.freeze({',
222-
`${names.map(name => `\t${name}: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.${name}.d.ts'`).join(`,${os.EOL}`)}`,
222+
`${names.map(name => `\t${name}: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.${name}.d.ts'`).join(`,${eol}`)}`,
223223
'});',
224224
'export type ApiProposalName = keyof typeof allApiProposals;',
225225
'',

build/lib/compilation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function generateApiProposalNames() {
260260
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
261261
'',
262262
'export const allApiProposals = Object.freeze({',
263-
`${names.map(name => `\t${name}: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.${name}.d.ts'`).join(`,${os.EOL}`)}`,
263+
`${names.map(name => `\t${name}: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.${name}.d.ts'`).join(`,${eol}`)}`,
264264
'});',
265265
'export type ApiProposalName = keyof typeof allApiProposals;',
266266
'',

build/lib/electron.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ exports.config = {
152152
'F# script': ['fsx', 'fsscript'],
153153
'SVG document': ['svg', 'svgz'],
154154
'TOML document': 'toml',
155+
'Swift source code': 'swift',
155156
}, 'default'),
156157
// Default icon with default name
157158
darwinBundleDocumentType([

build/lib/electron.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export const config = {
167167
'F# script': ['fsx', 'fsscript'],
168168
'SVG document': ['svg', 'svgz'],
169169
'TOML document': 'toml',
170+
'Swift source code': 'swift',
170171
}, 'default'),
171172
// Default icon with default name
172173
darwinBundleDocumentType([

build/lib/policies.js

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const Parser = require("tree-sitter");
1313
const node_fetch_1 = require("node-fetch");
1414
const { typescript } = require('tree-sitter-typescript');
1515
const product = require('../../product.json');
16+
const packageJson = require('../../package.json');
1617
function isNlsString(value) {
1718
return value ? typeof value !== 'string' : false;
1819
}
@@ -408,16 +409,11 @@ const Languages = {
408409
'tr': 'tr-tr',
409410
'pl': 'pl-pl',
410411
};
411-
async function getLatestStableVersion(updateUrl) {
412-
const res = await (0, node_fetch_1.default)(`${updateUrl}/api/update/darwin/stable/latest`);
413-
const { name: version } = await res.json();
414-
return version;
415-
}
416412
async function getSpecificNLS(resourceUrlTemplate, languageId, version) {
417413
const resource = {
418414
publisher: 'ms-ceintl',
419415
name: `vscode-language-pack-${languageId}`,
420-
version,
416+
version: `${version[0]}.${version[1]}.${version[2]}`,
421417
path: 'extension/translations/main.i18n.json'
422418
};
423419
const url = resourceUrlTemplate.replace(/\{([^}]+)\}/g, (_, key) => resource[key]);
@@ -428,35 +424,47 @@ async function getSpecificNLS(resourceUrlTemplate, languageId, version) {
428424
const { contents: result } = await res.json();
429425
return result;
430426
}
431-
function previousVersion(version) {
432-
const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
433-
return `${major}.${parseInt(minor) - 1}.${patch}`;
427+
function parseVersion(version) {
428+
const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
429+
return [parseInt(major), parseInt(minor), parseInt(patch)];
434430
}
435-
async function getNLS(resourceUrlTemplate, languageId, version) {
436-
try {
437-
return await getSpecificNLS(resourceUrlTemplate, languageId, version);
438-
}
439-
catch (err) {
440-
if (/\[404\]/.test(err.message)) {
441-
const thePreviousVersion = previousVersion(version);
442-
console.warn(`Language pack ${languageId}@${version} is missing. Downloading previous version ${thePreviousVersion}...`);
443-
try {
444-
return await getSpecificNLS(resourceUrlTemplate, languageId, thePreviousVersion);
445-
}
446-
catch (err) {
447-
if (/\[404\]/.test(err.message)) {
448-
console.warn(`Language pack ${languageId}@${thePreviousVersion} is missing. Downloading previous version...`);
449-
return await getSpecificNLS(resourceUrlTemplate, languageId, previousVersion(thePreviousVersion));
450-
}
451-
else {
452-
throw err;
453-
}
454-
}
455-
}
456-
else {
457-
throw err;
458-
}
431+
function compareVersions(a, b) {
432+
if (a[0] !== b[0]) {
433+
return a[0] - b[0];
434+
}
435+
if (a[1] !== b[1]) {
436+
return a[1] - b[1];
459437
}
438+
return a[2] - b[2];
439+
}
440+
async function queryVersions(serviceUrl, languageId) {
441+
const res = await (0, node_fetch_1.default)(`${serviceUrl}/extensionquery`, {
442+
method: 'POST',
443+
headers: {
444+
'Accept': 'application/json;api-version=3.0-preview.1',
445+
'Content-Type': 'application/json',
446+
'User-Agent': 'VS Code Build',
447+
},
448+
body: JSON.stringify({
449+
filters: [{ criteria: [{ filterType: 7, value: `ms-ceintl.vscode-language-pack-${languageId}` }] }],
450+
flags: 0x1
451+
})
452+
});
453+
if (res.status !== 200) {
454+
throw new Error(`[${res.status}] Error querying for extension: ${languageId}`);
455+
}
456+
const result = await res.json();
457+
return result.results[0].extensions[0].versions.map(v => parseVersion(v.version)).sort(compareVersions);
458+
}
459+
async function getNLS(extensionGalleryServiceUrl, resourceUrlTemplate, languageId, version) {
460+
const versions = await queryVersions(extensionGalleryServiceUrl, languageId);
461+
const nextMinor = [version[0], version[1] + 1, 0];
462+
const compatibleVersions = versions.filter(v => compareVersions(v, nextMinor) < 0);
463+
const latestCompatibleVersion = compatibleVersions.at(-1); // order is newest to oldest
464+
if (!latestCompatibleVersion) {
465+
throw new Error(`No compatible language pack found for ${languageId} for version ${version}`);
466+
}
467+
return await getSpecificNLS(resourceUrlTemplate, languageId, latestCompatibleVersion);
460468
}
461469
async function parsePolicies() {
462470
const parser = new Parser();
@@ -473,19 +481,19 @@ async function parsePolicies() {
473481
return policies;
474482
}
475483
async function getTranslations() {
476-
const updateUrl = product.updateUrl;
477-
if (!updateUrl) {
478-
console.warn(`Skipping policy localization: No 'updateUrl' found in 'product.json'.`);
484+
const extensionGalleryServiceUrl = product.extensionsGallery?.serviceUrl;
485+
if (!extensionGalleryServiceUrl) {
486+
console.warn(`Skipping policy localization: No 'extensionGallery.serviceUrl' found in 'product.json'.`);
479487
return [];
480488
}
481489
const resourceUrlTemplate = product.extensionsGallery?.resourceUrlTemplate;
482490
if (!resourceUrlTemplate) {
483491
console.warn(`Skipping policy localization: No 'resourceUrlTemplate' found in 'product.json'.`);
484492
return [];
485493
}
486-
const version = await getLatestStableVersion(updateUrl);
494+
const version = parseVersion(packageJson.version);
487495
const languageIds = Object.keys(Languages);
488-
return await Promise.all(languageIds.map(languageId => getNLS(resourceUrlTemplate, languageId, version)
496+
return await Promise.all(languageIds.map(languageId => getNLS(extensionGalleryServiceUrl, resourceUrlTemplate, languageId, version)
489497
.then(languageTranslations => ({ languageId, languageTranslations }))));
490498
}
491499
async function main() {

build/lib/policies.ts

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as Parser from 'tree-sitter';
1212
import fetch from 'node-fetch';
1313
const { typescript } = require('tree-sitter-typescript');
1414
const product = require('../../product.json');
15+
const packageJson = require('../../package.json');
1516

1617
type NlsString = { value: string; nlsKey: string };
1718

@@ -587,17 +588,13 @@ const Languages = {
587588
type LanguageTranslations = { [moduleName: string]: { [nlsKey: string]: string } };
588589
type Translations = { languageId: string; languageTranslations: LanguageTranslations }[];
589590

590-
async function getLatestStableVersion(updateUrl: string) {
591-
const res = await fetch(`${updateUrl}/api/update/darwin/stable/latest`);
592-
const { name: version } = await res.json() as { name: string };
593-
return version;
594-
}
591+
type Version = [number, number, number];
595592

596-
async function getSpecificNLS(resourceUrlTemplate: string, languageId: string, version: string) {
593+
async function getSpecificNLS(resourceUrlTemplate: string, languageId: string, version: Version) {
597594
const resource = {
598595
publisher: 'ms-ceintl',
599596
name: `vscode-language-pack-${languageId}`,
600-
version,
597+
version: `${version[0]}.${version[1]}.${version[2]}`,
601598
path: 'extension/translations/main.i18n.json'
602599
};
603600

@@ -612,32 +609,50 @@ async function getSpecificNLS(resourceUrlTemplate: string, languageId: string, v
612609
return result;
613610
}
614611

615-
function previousVersion(version: string): string {
616-
const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)$/.exec(version)!;
617-
return `${major}.${parseInt(minor) - 1}.${patch}`;
618-
}
619-
620-
async function getNLS(resourceUrlTemplate: string, languageId: string, version: string) {
621-
try {
622-
return await getSpecificNLS(resourceUrlTemplate, languageId, version);
623-
} catch (err) {
624-
if (/\[404\]/.test(err.message)) {
625-
const thePreviousVersion = previousVersion(version);
626-
console.warn(`Language pack ${languageId}@${version} is missing. Downloading previous version ${thePreviousVersion}...`);
627-
try {
628-
return await getSpecificNLS(resourceUrlTemplate, languageId, thePreviousVersion);
629-
} catch (err) {
630-
if (/\[404\]/.test(err.message)) {
631-
console.warn(`Language pack ${languageId}@${thePreviousVersion} is missing. Downloading previous version...`);
632-
return await getSpecificNLS(resourceUrlTemplate, languageId, previousVersion(thePreviousVersion));
633-
} else {
634-
throw err;
635-
}
636-
}
637-
} else {
638-
throw err;
639-
}
612+
function parseVersion(version: string): Version {
613+
const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)/.exec(version)!;
614+
return [parseInt(major), parseInt(minor), parseInt(patch)];
615+
}
616+
617+
function compareVersions(a: Version, b: Version): number {
618+
if (a[0] !== b[0]) { return a[0] - b[0]; }
619+
if (a[1] !== b[1]) { return a[1] - b[1]; }
620+
return a[2] - b[2];
621+
}
622+
623+
async function queryVersions(serviceUrl: string, languageId: string): Promise<Version[]> {
624+
const res = await fetch(`${serviceUrl}/extensionquery`, {
625+
method: 'POST',
626+
headers: {
627+
'Accept': 'application/json;api-version=3.0-preview.1',
628+
'Content-Type': 'application/json',
629+
'User-Agent': 'VS Code Build',
630+
},
631+
body: JSON.stringify({
632+
filters: [{ criteria: [{ filterType: 7, value: `ms-ceintl.vscode-language-pack-${languageId}` }] }],
633+
flags: 0x1
634+
})
635+
});
636+
637+
if (res.status !== 200) {
638+
throw new Error(`[${res.status}] Error querying for extension: ${languageId}`);
639+
}
640+
641+
const result = await res.json() as { results: [{ extensions: { versions: { version: string }[] }[] }] };
642+
return result.results[0].extensions[0].versions.map(v => parseVersion(v.version)).sort(compareVersions);
643+
}
644+
645+
async function getNLS(extensionGalleryServiceUrl: string, resourceUrlTemplate: string, languageId: string, version: Version) {
646+
const versions = await queryVersions(extensionGalleryServiceUrl, languageId);
647+
const nextMinor: Version = [version[0], version[1] + 1, 0];
648+
const compatibleVersions = versions.filter(v => compareVersions(v, nextMinor) < 0);
649+
const latestCompatibleVersion = compatibleVersions.at(-1)!; // order is newest to oldest
650+
651+
if (!latestCompatibleVersion) {
652+
throw new Error(`No compatible language pack found for ${languageId} for version ${version}`);
640653
}
654+
655+
return await getSpecificNLS(resourceUrlTemplate, languageId, latestCompatibleVersion);
641656
}
642657

643658
async function parsePolicies(): Promise<Policy[]> {
@@ -659,10 +674,10 @@ async function parsePolicies(): Promise<Policy[]> {
659674
}
660675

661676
async function getTranslations(): Promise<Translations> {
662-
const updateUrl = product.updateUrl;
677+
const extensionGalleryServiceUrl = product.extensionsGallery?.serviceUrl;
663678

664-
if (!updateUrl) {
665-
console.warn(`Skipping policy localization: No 'updateUrl' found in 'product.json'.`);
679+
if (!extensionGalleryServiceUrl) {
680+
console.warn(`Skipping policy localization: No 'extensionGallery.serviceUrl' found in 'product.json'.`);
666681
return [];
667682
}
668683

@@ -673,11 +688,11 @@ async function getTranslations(): Promise<Translations> {
673688
return [];
674689
}
675690

676-
const version = await getLatestStableVersion(updateUrl);
691+
const version = parseVersion(packageJson.version);
677692
const languageIds = Object.keys(Languages);
678693

679694
return await Promise.all(languageIds.map(
680-
languageId => getNLS(resourceUrlTemplate, languageId, version)
695+
languageId => getNLS(extensionGalleryServiceUrl, resourceUrlTemplate, languageId, version)
681696
.then(languageTranslations => ({ languageId, languageTranslations }))
682697
));
683698
}

build/linux/debian/calculate-deps.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ function calculatePackageDeps(binaryPath, arch, sysroot) {
6565
depsStr = line.substring(shlibsDependsPrefix.length);
6666
}
6767
}
68-
const requires = new Set(depsStr.split(', ').sort());
68+
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/3572926
69+
// Chromium depends on libgcc_s, is from the package libgcc1. However, in
70+
// Bullseye, the package was renamed to libgcc-s1. To avoid adding a dep
71+
// on the newer package, this hack skips the dep. This is safe because
72+
// libgcc-s1 is a dependency of libc6. This hack can be removed once
73+
// support for Debian Buster and Ubuntu Bionic are dropped.
74+
const filteredDeps = depsStr.split(', ').filter(dependency => {
75+
return !dependency.startsWith('libgcc-s1');
76+
}).sort();
77+
const requires = new Set(filteredDeps);
6978
return requires;
7079
}

build/linux/debian/calculate-deps.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ function calculatePackageDeps(binaryPath: string, arch: DebianArchString, sysroo
7070
depsStr = line.substring(shlibsDependsPrefix.length);
7171
}
7272
}
73-
const requires = new Set(depsStr.split(', ').sort());
73+
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/3572926
74+
// Chromium depends on libgcc_s, is from the package libgcc1. However, in
75+
// Bullseye, the package was renamed to libgcc-s1. To avoid adding a dep
76+
// on the newer package, this hack skips the dep. This is safe because
77+
// libgcc-s1 is a dependency of libc6. This hack can be removed once
78+
// support for Debian Buster and Ubuntu Bionic are dropped.
79+
const filteredDeps = depsStr.split(', ').filter(dependency => {
80+
return !dependency.startsWith('libgcc-s1');
81+
}).sort();
82+
const requires = new Set(filteredDeps);
7483
return requires;
7584
}

build/linux/debian/dep-lists.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ exports.referenceGeneratedDepsByArch = {
3636
'libdrm2 (>= 2.4.38)',
3737
'libexpat1 (>= 2.0.1)',
3838
'libgbm1 (>= 8.1~0)',
39-
'libgcc-s1 (>= 3.0)',
4039
'libglib2.0-0 (>= 2.16.0)',
4140
'libglib2.0-0 (>= 2.39.4)',
4241
'libgtk-3-0 (>= 3.9.10)',
@@ -73,8 +72,6 @@ exports.referenceGeneratedDepsByArch = {
7372
'libdrm2 (>= 2.4.38)',
7473
'libexpat1 (>= 2.0.1)',
7574
'libgbm1 (>= 8.1~0)',
76-
'libgcc-s1 (>= 3.0)',
77-
'libgcc-s1 (>= 3.5)',
7875
'libglib2.0-0 (>= 2.16.0)',
7976
'libglib2.0-0 (>= 2.39.4)',
8077
'libgtk-3-0 (>= 3.9.10)',

0 commit comments

Comments
 (0)