monaco-editor/build/build.js

155 lines
3.5 KiB
JavaScript
Raw Normal View History

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
2021-11-12 18:22:26 +08:00
//@ts-check
2021-11-14 03:06:41 +08:00
const { copyFile, removeDir, tsc, dts, buildESM2, buildAMD2 } = require('../build/utils');
2021-11-13 07:04:23 +08:00
removeDir(`out`);
2021-11-13 07:04:23 +08:00
tsc(`src/tsconfig.json`);
2021-11-14 03:06:41 +08:00
//#region Type Defintion
2021-11-14 02:40:20 +08:00
dts(`out/amd/css/monaco.contribution.d.ts`, `out/release/css/monaco.d.ts`, 'monaco.languages.css');
2021-11-12 08:02:23 +08:00
dts(
2021-11-14 02:40:20 +08:00
`out/amd/html/monaco.contribution.d.ts`,
`out/release/html/monaco.d.ts`,
'monaco.languages.html'
2021-11-12 08:02:23 +08:00
);
2021-11-14 02:46:33 +08:00
dts(
`out/amd/json/monaco.contribution.d.ts`,
`out/release/json/monaco.d.ts`,
'monaco.languages.json'
);
2021-11-14 03:06:41 +08:00
dts(
`out/amd/typescript/monaco.contribution.d.ts`,
`out/release/typescript/monaco.d.ts`,
'monaco.languages.typescript'
);
//#endregion
//#region css
2021-11-13 07:04:23 +08:00
buildESM2({
base: 'css',
entryPoints: ['src/css/monaco.contribution.ts', 'src/css/cssMode.ts', 'src/css/css.worker.ts'],
2021-11-12 18:31:25 +08:00
external: ['monaco-editor-core', '*/cssMode']
});
2021-11-13 07:04:23 +08:00
buildAMD2({
base: 'css',
entryPoint: 'src/css/monaco.contribution.ts',
2021-11-12 21:39:56 +08:00
amdModuleId: 'vs/language/css/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
2021-11-12 18:31:25 +08:00
});
2021-11-13 07:04:23 +08:00
buildAMD2({
base: 'css',
entryPoint: 'src/css/cssMode.ts',
2021-11-12 21:39:56 +08:00
amdModuleId: 'vs/language/css/cssMode'
2021-11-12 18:31:25 +08:00
});
2021-11-13 07:04:23 +08:00
buildAMD2({
base: 'css',
entryPoint: 'src/css/cssWorker.ts',
2021-11-12 21:39:56 +08:00
amdModuleId: 'vs/language/css/cssWorker'
});
2021-11-14 02:40:20 +08:00
2021-11-14 03:06:41 +08:00
//#endregion
//#region html
2021-11-14 02:40:20 +08:00
buildESM2({
base: 'html',
entryPoints: [
'src/html/monaco.contribution.ts',
'src/html/htmlMode.ts',
'src/html/html.worker.ts'
],
external: ['monaco-editor-core', '*/htmlMode']
});
buildAMD2({
base: 'html',
entryPoint: 'src/html/monaco.contribution.ts',
amdModuleId: 'vs/language/html/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
base: 'html',
entryPoint: 'src/html/htmlMode.ts',
amdModuleId: 'vs/language/html/htmlMode'
});
buildAMD2({
base: 'html',
entryPoint: 'src/html/htmlWorker.ts',
amdModuleId: 'vs/language/html/htmlWorker'
});
2021-11-14 02:46:33 +08:00
2021-11-14 03:06:41 +08:00
//#endregion
//#region json
2021-11-14 02:46:33 +08:00
buildESM2({
base: 'json',
2021-11-14 03:06:41 +08:00
entryPoints: [
'src/json/monaco.contribution.ts',
'src/json/jsonMode.ts',
'src/json/json.worker.ts'
],
2021-11-14 02:46:33 +08:00
external: ['monaco-editor-core', '*/jsonMode']
});
buildAMD2({
base: 'json',
entryPoint: 'src/json/monaco.contribution.ts',
amdModuleId: 'vs/language/json/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
base: 'json',
entryPoint: 'src/json/jsonMode.ts',
amdModuleId: 'vs/language/json/jsonMode'
});
buildAMD2({
base: 'json',
entryPoint: 'src/json/jsonWorker.ts',
amdModuleId: 'vs/language/json/jsonWorker'
});
2021-11-14 03:06:41 +08:00
//#endregion
//#region typescript
copyFile(
`src/typescript/lib/typescriptServices-amd.js`,
`out/amd/typescript/lib/typescriptServices.js`
);
buildESM2({
base: 'typescript',
entryPoints: [
'src/typescript/monaco.contribution.ts',
'src/typescript/tsMode.ts',
'src/typescript/ts.worker.ts'
],
external: ['monaco-editor-core', '*/tsMode']
});
buildAMD2({
base: 'typescript',
entryPoint: 'src/typescript/monaco.contribution.ts',
amdModuleId: 'vs/language/typescript/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
base: 'typescript',
entryPoint: 'src/typescript/tsMode.ts',
amdModuleId: 'vs/language/typescript/tsMode'
});
buildAMD2({
base: 'typescript',
entryPoint: 'src/typescript/tsWorker.ts',
amdModuleId: 'vs/language/typescript/tsWorker'
});
//#endregion