diff --git a/migrate.mjs b/migrate.mjs index 13ef3a6f641..090396c8fb4 100644 --- a/migrate.mjs +++ b/migrate.mjs @@ -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() { diff --git a/src/vs/amdX.ts b/src/vs/amdX.ts index a34d6dde01c..e3f48aeb1c2 100644 --- a/src/vs/amdX.ts +++ b/src/vs/amdX.ts @@ -92,12 +92,27 @@ class AMDModuleImporter { console.warn(`Did not receive a define call from script ${scriptSrc}`); return 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; }