mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-24 17:31:37 +01:00
Merge pull request #226171 from microsoft/joh/crooked-earwig
support for `export` "dependency" in amdX, also copy for non-source files
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ const srcFolder = fileURLToPath(new URL('src', import.meta.url));
|
||||
const dstFolder = fileURLToPath(new URL('src2', import.meta.url));
|
||||
|
||||
const binaryFileExtensions = new Set([
|
||||
'.svg', '.ttf', '.png', '.sh', '.html', '.json', '.zsh', '.scpt', '.mp3', '.fish', '.ps1', '.psm1', '.md', '.txt', '.zip', '.pdf', '.qwoff', '.jxs', '.tst', '.wuff', '.less', '.utf16le', '.snap', '.tsx'
|
||||
'.svg', '.ttf', '.png', '.sh', '.html', '.json', '.zsh', '.scpt', '.mp3', '.fish', '.ps1', '.psm1', '.md', '.txt', '.zip', '.pdf', '.qwoff', '.jxs', '.tst', '.wuff', '.less', '.utf16le', '.snap', '.actual', '.tsx', '.scm'
|
||||
]);
|
||||
|
||||
function migrate() {
|
||||
|
||||
+19
-4
@@ -92,12 +92,27 @@ class AMDModuleImporter {
|
||||
console.warn(`Did not receive a define call from script ${scriptSrc}`);
|
||||
return <T>undefined;
|
||||
}
|
||||
// TODO require, exports, module
|
||||
if (Array.isArray(defineCall.dependencies) && defineCall.dependencies.length > 0) {
|
||||
throw new Error(`Cannot resolve dependencies for script ${scriptSrc}. The dependencies are: ${defineCall.dependencies.join(', ')}`);
|
||||
// TODO require, module
|
||||
const exports = {};
|
||||
const dependencyObjs: any[] = [];
|
||||
const dependencyModules: string[] = [];
|
||||
|
||||
if (Array.isArray(defineCall.dependencies)) {
|
||||
|
||||
for (const mod of defineCall.dependencies) {
|
||||
if (mod === 'exports') {
|
||||
dependencyObjs.push(exports);
|
||||
} else {
|
||||
dependencyModules.push(mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dependencyModules.length > 0) {
|
||||
throw new Error(`Cannot resolve dependencies for script ${scriptSrc}. The dependencies are: ${dependencyModules.join(', ')}`);
|
||||
}
|
||||
if (typeof defineCall.callback === 'function') {
|
||||
return defineCall.callback([]);
|
||||
return defineCall.callback(...dependencyObjs) ?? exports;
|
||||
} else {
|
||||
return defineCall.callback;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user