Simplify `buildAMD` usages

pull/2766/head
Alexandru Dima 3 years ago
parent 0278fd481d
commit 6b2860b7b0
No known key found for this signature in database
GPG Key ID: 39563C1504FDD0C9

@ -212,7 +212,8 @@ exports.buildESM = buildESM;
* @param {{
* base: string;
* entryPoint: string;
* banner: string;
* amdModuleId: string;
* amdDependencies?: string[];
* }} options
*/
function buildOneAMD(type, options) {
@ -227,7 +228,7 @@ function buildOneAMD(type, options) {
},
globalName: 'moduleExports',
banner: {
js: `${bundledFileHeader}${options.banner}`
js: `${bundledFileHeader}define("${options.amdModuleId}",[${(options.amdDependencies || []).map(dep => (`"${dep}"`)).join(',')}],()=>{`
},
footer: {
js: 'return moduleExports;\n});'
@ -251,7 +252,8 @@ function buildOneAMD(type, options) {
* @param {{
* base: string;
* entryPoint: string;
* banner: string;
* amdModuleId: string;
* amdDependencies?: string[];
* }} options
*/
function buildAMD(options) {

@ -26,15 +26,16 @@ buildESM({
buildAMD({
base: 'monaco-css',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/css/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD({
base: 'monaco-css',
entryPoint: 'src/cssMode.ts',
banner: 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/css/cssMode'
});
buildAMD({
base: 'monaco-css',
entryPoint: 'src/cssWorker.ts',
banner: 'define("vs/language/css/cssWorker",[],()=>{'
amdModuleId: 'vs/language/css/cssWorker'
});

@ -26,15 +26,16 @@ buildESM({
buildAMD({
base: 'monaco-html',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/html/monaco.contribution",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/html/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD({
base: 'monaco-html',
entryPoint: 'src/htmlMode.ts',
banner: 'define("vs/language/html/htmlMode",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/html/htmlMode'
});
buildAMD({
base: 'monaco-html',
entryPoint: 'src/htmlWorker.ts',
banner: 'define("vs/language/html/htmlWorker",[],()=>{'
amdModuleId: 'vs/language/html/htmlWorker'
});

@ -26,15 +26,16 @@ buildESM({
buildAMD({
base: 'monaco-json',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/json/monaco.contribution",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/json/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD({
base: 'monaco-json',
entryPoint: 'src/jsonMode.ts',
banner: 'define("vs/language/json/jsonMode",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/json/jsonMode'
});
buildAMD({
base: 'monaco-json',
entryPoint: 'src/jsonWorker.ts',
banner: 'define("vs/language/json/jsonWorker",[],()=>{'
amdModuleId: 'vs/language/json/jsonWorker'
});

@ -44,13 +44,14 @@ glob('src/*/*.contribution.ts', { cwd: __dirname }, function (err, files) {
buildAMD({
base: 'monaco-languages',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/basic-languages/monaco.contribution",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/basic-languages/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
for (const language of languages) {
buildAMD({
base: 'monaco-languages',
entryPoint: `src/${language}/${language}.ts`,
banner: `define("vs/basic-languages/${language}/${language}",[],()=>{`
amdModuleId: `vs/basic-languages/${language}/${language}`
});
}
}

@ -31,15 +31,17 @@ buildESM({
buildAMD({
base: 'monaco-typescript',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/typescript/monaco.contribution",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/typescript/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD({
base: 'monaco-typescript',
entryPoint: 'src/tsMode.ts',
banner: 'define("vs/language/typescript/tsMode",["vs/editor/editor.api"],()=>{'
amdModuleId: 'vs/language/typescript/tsMode'
});
buildAMD({
base: 'monaco-typescript',
entryPoint: 'src/tsWorker.ts',
banner: 'define("vs/language/typescript/tsWorker",[],()=>{'
amdModuleId: 'vs/language/typescript/tsWorker',
amdDependencies: []
});

Loading…
Cancel
Save