mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
Move buildAMD to common build script
This commit is contained in:
parent
8944900f86
commit
6bfac402fb
4 changed files with 79 additions and 114 deletions
|
|
@ -14,6 +14,7 @@
|
|||
/monaco-editor/website/lib/
|
||||
/monaco-html/out/
|
||||
/monaco-html/release/
|
||||
/monaco-editor-webpack-plugin/test/dist/*.js
|
||||
/monaco-json/out/
|
||||
/monaco-json/release/
|
||||
/monaco-languages/out/
|
||||
|
|
|
|||
|
|
@ -199,6 +199,56 @@ function buildESM(options) {
|
|||
}
|
||||
exports.buildESM = buildESM;
|
||||
|
||||
/**
|
||||
* @param {'dev'|'min'} type
|
||||
* @param {{
|
||||
* entryPoint: string;
|
||||
* banner: string;
|
||||
* }} options
|
||||
*/
|
||||
function buildOneAMD(type, options) {
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const opts = {
|
||||
entryPoints: [options.entryPoint],
|
||||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'iife',
|
||||
define: {
|
||||
AMD: 'true'
|
||||
},
|
||||
globalName: 'moduleExports',
|
||||
banner: {
|
||||
js: options.banner
|
||||
},
|
||||
footer: {
|
||||
js: 'return moduleExports;\n});'
|
||||
},
|
||||
outdir: `release/${type}/`,
|
||||
plugins: [
|
||||
alias({
|
||||
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
||||
'monaco-editor-core': path.join(__dirname, '../build/fillers/monaco-editor-core-amd.ts')
|
||||
})
|
||||
]
|
||||
};
|
||||
if (type === 'min') {
|
||||
opts.minify = true;
|
||||
}
|
||||
build(opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* entryPoint: string;
|
||||
* banner: string;
|
||||
* }} options
|
||||
*/
|
||||
function buildAMD(options) {
|
||||
buildOneAMD('dev', options);
|
||||
buildOneAMD('min', options);
|
||||
}
|
||||
exports.buildAMD = buildAMD;
|
||||
|
||||
function getGitVersion() {
|
||||
const git = path.join(REPO_ROOT, '.git');
|
||||
const headPath = path.join(git, 'HEAD');
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
|
||||
//@ts-check
|
||||
|
||||
const alias = require('esbuild-plugin-alias');
|
||||
const path = require('path');
|
||||
const { removeDir, tsc, dts, build, buildESM } = require('../build/utils');
|
||||
const { removeDir, tsc, dts, buildESM, buildAMD } = require('../build/utils');
|
||||
|
||||
removeDir(`monaco-css/release`);
|
||||
removeDir(`monaco-css/out`);
|
||||
|
|
@ -22,58 +20,17 @@ dts(
|
|||
|
||||
buildESM({
|
||||
entryPoints: ['src/monaco.contribution.ts', 'src/cssMode.ts', 'src/css.worker.ts'],
|
||||
external: ['monaco-editor-core', '*/cssMode'],
|
||||
external: ['monaco-editor-core', '*/cssMode']
|
||||
});
|
||||
buildAMD({
|
||||
entryPoint: 'src/monaco.contribution.ts',
|
||||
banner: 'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{'
|
||||
});
|
||||
buildAMD({
|
||||
entryPoint: 'src/cssMode.ts',
|
||||
banner: 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{'
|
||||
});
|
||||
buildAMD({
|
||||
entryPoint: 'src/cssWorker.ts',
|
||||
banner: 'define("vs/language/css/cssWorker",[],()=>{'
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {'dev'|'min'} type
|
||||
* @param {string} entryPoint
|
||||
* @param {string} banner
|
||||
*/
|
||||
function buildOneAMD(type, entryPoint, banner) {
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const options = {
|
||||
entryPoints: [entryPoint],
|
||||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'iife',
|
||||
define: {
|
||||
AMD: 'true'
|
||||
},
|
||||
external: ['*/cssMode'],
|
||||
globalName: 'moduleExports',
|
||||
banner: {
|
||||
js: banner
|
||||
},
|
||||
footer: {
|
||||
js: 'return moduleExports;\n});'
|
||||
},
|
||||
outdir: `release/${type}/`,
|
||||
plugins: [
|
||||
alias({
|
||||
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
||||
'monaco-editor-core': path.join(__dirname, '../build/fillers/monaco-editor-core-amd.ts')
|
||||
})
|
||||
]
|
||||
};
|
||||
if (type === 'min') {
|
||||
options.minify = true;
|
||||
}
|
||||
build(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} entryPoint
|
||||
* @param {string} banner
|
||||
*/
|
||||
function buildAMD(entryPoint, banner) {
|
||||
buildOneAMD('dev', entryPoint, banner);
|
||||
buildOneAMD('min', entryPoint, banner);
|
||||
}
|
||||
|
||||
buildAMD(
|
||||
'src/monaco.contribution.ts',
|
||||
'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{'
|
||||
);
|
||||
buildAMD('src/cssMode.ts', 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{');
|
||||
buildAMD('src/cssWorker.ts', 'define("vs/language/css/cssWorker",[],()=>{');
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
|
||||
//@ts-check
|
||||
|
||||
const alias = require('esbuild-plugin-alias');
|
||||
const path = require('path');
|
||||
const { removeDir, tsc, dts, build, buildESM } = require('../build/utils');
|
||||
const { removeDir, tsc, dts, buildESM, buildAMD } = require('../build/utils');
|
||||
|
||||
removeDir(`monaco-html/release`);
|
||||
removeDir(`monaco-html/out`);
|
||||
|
|
@ -22,58 +20,17 @@ dts(
|
|||
|
||||
buildESM({
|
||||
entryPoints: ['src/monaco.contribution.ts', 'src/htmlMode.ts', 'src/html.worker.ts'],
|
||||
external: ['monaco-editor-core', '*/htmlMode'],
|
||||
external: ['monaco-editor-core', '*/htmlMode']
|
||||
});
|
||||
buildAMD({
|
||||
entryPoint: 'src/monaco.contribution.ts',
|
||||
banner: 'define("vs/language/html/monaco.contribution",["vs/editor/editor.api"],()=>{'
|
||||
});
|
||||
buildAMD({
|
||||
entryPoint: 'src/htmlMode.ts',
|
||||
banner: 'define("vs/language/html/htmlMode",["vs/editor/editor.api"],()=>{'
|
||||
});
|
||||
buildAMD({
|
||||
entryPoint: 'src/htmlWorker.ts',
|
||||
banner: 'define("vs/language/html/htmlWorker",[],()=>{'
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {'dev'|'min'} type
|
||||
* @param {string} entryPoint
|
||||
* @param {string} banner
|
||||
*/
|
||||
function buildOneAMD(type, entryPoint, banner) {
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const options = {
|
||||
entryPoints: [entryPoint],
|
||||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'iife',
|
||||
define: {
|
||||
AMD: 'true'
|
||||
},
|
||||
external: ['*/htmlMode'],
|
||||
globalName: 'moduleExports',
|
||||
banner: {
|
||||
js: banner
|
||||
},
|
||||
footer: {
|
||||
js: 'return moduleExports;\n});'
|
||||
},
|
||||
outdir: `release/${type}/`,
|
||||
plugins: [
|
||||
alias({
|
||||
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
||||
'monaco-editor-core': path.join(__dirname, '../build/fillers/monaco-editor-core-amd.ts')
|
||||
})
|
||||
]
|
||||
};
|
||||
if (type === 'min') {
|
||||
options.minify = true;
|
||||
}
|
||||
build(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} entryPoint
|
||||
* @param {string} banner
|
||||
*/
|
||||
function buildAMD(entryPoint, banner) {
|
||||
buildOneAMD('dev', entryPoint, banner);
|
||||
buildOneAMD('min', entryPoint, banner);
|
||||
}
|
||||
|
||||
buildAMD(
|
||||
'src/monaco.contribution.ts',
|
||||
'define("vs/language/html/monaco.contribution",["vs/editor/editor.api"],()=>{'
|
||||
);
|
||||
buildAMD('src/htmlMode.ts', 'define("vs/language/html/htmlMode",["vs/editor/editor.api"],()=>{');
|
||||
buildAMD('src/htmlWorker.ts', 'define("vs/language/html/htmlWorker",[],()=>{');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue