mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 22:02:55 +01:00
repairs esm and amd build (#4950)
This commit is contained in:
parent
f420968fc9
commit
e56ad4b588
43 changed files with 2302 additions and 856 deletions
|
|
@ -122,66 +122,6 @@ export function buildESM(options: { base: string; entryPoints: string[]; externa
|
|||
});
|
||||
}
|
||||
|
||||
function buildOneAMD(
|
||||
type: 'dev' | 'min',
|
||||
options: {
|
||||
base: string;
|
||||
entryPoint: string;
|
||||
amdModuleId: string;
|
||||
amdDependencies?: string[];
|
||||
external?: string[];
|
||||
}
|
||||
) {
|
||||
if (!options.amdDependencies) {
|
||||
options.amdDependencies = [];
|
||||
}
|
||||
options.amdDependencies.unshift('require');
|
||||
|
||||
const opts: esbuild.BuildOptions = {
|
||||
entryPoints: [options.entryPoint],
|
||||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'iife',
|
||||
drop: ['debugger'],
|
||||
define: {
|
||||
AMD: 'true'
|
||||
},
|
||||
globalName: 'moduleExports',
|
||||
banner: {
|
||||
js: `${bundledFileHeader}define("${options.amdModuleId}", [${(options.amdDependencies || [])
|
||||
.map((dep) => `"${dep}"`)
|
||||
.join(',')}],(require)=>{`
|
||||
},
|
||||
footer: {
|
||||
js: 'return moduleExports;\n});'
|
||||
},
|
||||
outbase: `src/${options.base}`,
|
||||
outdir: `out/languages/bundled/amd-${type}/vs/${options.base}/`,
|
||||
plugins: [
|
||||
alias({
|
||||
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
||||
'monaco-editor-core': path.join(__dirname, '../src/fillers/monaco-editor-core-amd.ts')
|
||||
})
|
||||
],
|
||||
external: ['vs/editor/editor.api', ...(options.external || [])]
|
||||
};
|
||||
if (type === 'min') {
|
||||
opts.minify = true;
|
||||
}
|
||||
build(opts);
|
||||
}
|
||||
|
||||
export function buildAMD(options: {
|
||||
base: string;
|
||||
entryPoint: string;
|
||||
amdModuleId: string;
|
||||
amdDependencies?: string[];
|
||||
external?: string[];
|
||||
}) {
|
||||
buildOneAMD('dev', options);
|
||||
buildOneAMD('min', options);
|
||||
}
|
||||
|
||||
function getGitVersion() {
|
||||
const git = path.join(REPO_ROOT, '.git');
|
||||
const headPath = path.join(git, 'HEAD');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue