Remove unused functions

pull/2766/head
Alex Dima 3 years ago
parent 7b371107bf
commit c3ac455fd2
No known key found for this signature in database
GPG Key ID: 39563C1504FDD0C9

@ -6,7 +6,7 @@
//@ts-check //@ts-check
const glob = require('glob'); const glob = require('glob');
const { copyFile, removeDir, tsc, dts, buildESM2, buildAMD2 } = require('../build/utils'); const { copyFile, removeDir, tsc, dts, buildESM, buildAMD } = require('../build/utils');
removeDir(`out`); removeDir(`out`);
@ -35,23 +35,23 @@ dts(
//#region css //#region css
buildESM2({ buildESM({
base: 'css', base: 'css',
entryPoints: ['src/css/monaco.contribution.ts', 'src/css/cssMode.ts', 'src/css/css.worker.ts'], entryPoints: ['src/css/monaco.contribution.ts', 'src/css/cssMode.ts', 'src/css/css.worker.ts'],
external: ['monaco-editor-core', '*/cssMode'] external: ['monaco-editor-core', '*/cssMode']
}); });
buildAMD2({ buildAMD({
base: 'css', base: 'css',
entryPoint: 'src/css/monaco.contribution.ts', entryPoint: 'src/css/monaco.contribution.ts',
amdModuleId: 'vs/language/css/monaco.contribution', amdModuleId: 'vs/language/css/monaco.contribution',
amdDependencies: ['vs/editor/editor.api'] amdDependencies: ['vs/editor/editor.api']
}); });
buildAMD2({ buildAMD({
base: 'css', base: 'css',
entryPoint: 'src/css/cssMode.ts', entryPoint: 'src/css/cssMode.ts',
amdModuleId: 'vs/language/css/cssMode' amdModuleId: 'vs/language/css/cssMode'
}); });
buildAMD2({ buildAMD({
base: 'css', base: 'css',
entryPoint: 'src/css/cssWorker.ts', entryPoint: 'src/css/cssWorker.ts',
amdModuleId: 'vs/language/css/cssWorker' amdModuleId: 'vs/language/css/cssWorker'
@ -61,7 +61,7 @@ buildAMD2({
//#region html //#region html
buildESM2({ buildESM({
base: 'html', base: 'html',
entryPoints: [ entryPoints: [
'src/html/monaco.contribution.ts', 'src/html/monaco.contribution.ts',
@ -70,18 +70,18 @@ buildESM2({
], ],
external: ['monaco-editor-core', '*/htmlMode'] external: ['monaco-editor-core', '*/htmlMode']
}); });
buildAMD2({ buildAMD({
base: 'html', base: 'html',
entryPoint: 'src/html/monaco.contribution.ts', entryPoint: 'src/html/monaco.contribution.ts',
amdModuleId: 'vs/language/html/monaco.contribution', amdModuleId: 'vs/language/html/monaco.contribution',
amdDependencies: ['vs/editor/editor.api'] amdDependencies: ['vs/editor/editor.api']
}); });
buildAMD2({ buildAMD({
base: 'html', base: 'html',
entryPoint: 'src/html/htmlMode.ts', entryPoint: 'src/html/htmlMode.ts',
amdModuleId: 'vs/language/html/htmlMode' amdModuleId: 'vs/language/html/htmlMode'
}); });
buildAMD2({ buildAMD({
base: 'html', base: 'html',
entryPoint: 'src/html/htmlWorker.ts', entryPoint: 'src/html/htmlWorker.ts',
amdModuleId: 'vs/language/html/htmlWorker' amdModuleId: 'vs/language/html/htmlWorker'
@ -91,7 +91,7 @@ buildAMD2({
//#region json //#region json
buildESM2({ buildESM({
base: 'json', base: 'json',
entryPoints: [ entryPoints: [
'src/json/monaco.contribution.ts', 'src/json/monaco.contribution.ts',
@ -100,18 +100,18 @@ buildESM2({
], ],
external: ['monaco-editor-core', '*/jsonMode'] external: ['monaco-editor-core', '*/jsonMode']
}); });
buildAMD2({ buildAMD({
base: 'json', base: 'json',
entryPoint: 'src/json/monaco.contribution.ts', entryPoint: 'src/json/monaco.contribution.ts',
amdModuleId: 'vs/language/json/monaco.contribution', amdModuleId: 'vs/language/json/monaco.contribution',
amdDependencies: ['vs/editor/editor.api'] amdDependencies: ['vs/editor/editor.api']
}); });
buildAMD2({ buildAMD({
base: 'json', base: 'json',
entryPoint: 'src/json/jsonMode.ts', entryPoint: 'src/json/jsonMode.ts',
amdModuleId: 'vs/language/json/jsonMode' amdModuleId: 'vs/language/json/jsonMode'
}); });
buildAMD2({ buildAMD({
base: 'json', base: 'json',
entryPoint: 'src/json/jsonWorker.ts', entryPoint: 'src/json/jsonWorker.ts',
amdModuleId: 'vs/language/json/jsonWorker' amdModuleId: 'vs/language/json/jsonWorker'
@ -126,7 +126,7 @@ copyFile(
`out/amd/typescript/lib/typescriptServices.js` `out/amd/typescript/lib/typescriptServices.js`
); );
buildESM2({ buildESM({
base: 'typescript', base: 'typescript',
entryPoints: [ entryPoints: [
'src/typescript/monaco.contribution.ts', 'src/typescript/monaco.contribution.ts',
@ -135,18 +135,18 @@ buildESM2({
], ],
external: ['monaco-editor-core', '*/tsMode'] external: ['monaco-editor-core', '*/tsMode']
}); });
buildAMD2({ buildAMD({
base: 'typescript', base: 'typescript',
entryPoint: 'src/typescript/monaco.contribution.ts', entryPoint: 'src/typescript/monaco.contribution.ts',
amdModuleId: 'vs/language/typescript/monaco.contribution', amdModuleId: 'vs/language/typescript/monaco.contribution',
amdDependencies: ['vs/editor/editor.api'] amdDependencies: ['vs/editor/editor.api']
}); });
buildAMD2({ buildAMD({
base: 'typescript', base: 'typescript',
entryPoint: 'src/typescript/tsMode.ts', entryPoint: 'src/typescript/tsMode.ts',
amdModuleId: 'vs/language/typescript/tsMode' amdModuleId: 'vs/language/typescript/tsMode'
}); });
buildAMD2({ buildAMD({
base: 'typescript', base: 'typescript',
entryPoint: 'src/typescript/tsWorker.ts', entryPoint: 'src/typescript/tsWorker.ts',
amdModuleId: 'vs/language/typescript/tsWorker' amdModuleId: 'vs/language/typescript/tsWorker'
@ -175,7 +175,7 @@ glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function
external.push(`*/${language}.contribution`); external.push(`*/${language}.contribution`);
external.push(`*/${language}`); external.push(`*/${language}`);
} }
buildESM2({ buildESM({
base: 'basic-languages', base: 'basic-languages',
entryPoints, entryPoints,
external external
@ -184,14 +184,14 @@ glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function
// AMD // AMD
{ {
buildAMD2({ buildAMD({
base: 'basic-languages', base: 'basic-languages',
entryPoint: 'src/basic-languages/monaco.contribution.ts', entryPoint: 'src/basic-languages/monaco.contribution.ts',
amdModuleId: 'vs/basic-languages/monaco.contribution', amdModuleId: 'vs/basic-languages/monaco.contribution',
amdDependencies: ['vs/editor/editor.api'] amdDependencies: ['vs/editor/editor.api']
}); });
for (const language of languages) { for (const language of languages) {
buildAMD2({ buildAMD({
base: 'basic-languages', base: 'basic-languages',
entryPoint: `src/basic-languages/${language}/${language}.ts`, entryPoint: `src/basic-languages/${language}/${language}.ts`,
amdModuleId: `vs/basic-languages/${language}/${language}` amdModuleId: `vs/basic-languages/${language}/${language}`

@ -185,37 +185,6 @@ exports.build = build;
* }} options * }} options
*/ */
function buildESM(options) { function buildESM(options) {
build({
entryPoints: options.entryPoints.map((e) => `${options.base}/${e}`),
bundle: true,
target: 'esnext',
format: 'esm',
define: {
AMD: 'false'
},
banner: {
js: bundledFileHeader
},
external: options.external,
outbase: `${options.base}/src`,
outdir: `${options.base}/release/esm/`,
plugins: [
alias({
'vscode-nls': path.join(__dirname, 'fillers/vscode-nls.ts')
})
]
});
}
exports.buildESM = buildESM;
/**
* @param {{
* base: string;
* entryPoints: string[];
* external: string[];
* }} options
*/
function buildESM2(options) {
build({ build({
entryPoints: options.entryPoints, entryPoints: options.entryPoints,
bundle: true, bundle: true,
@ -237,7 +206,7 @@ function buildESM2(options) {
] ]
}); });
} }
exports.buildESM2 = buildESM2; exports.buildESM = buildESM;
/** /**
* @param {'dev'|'min'} type * @param {'dev'|'min'} type
@ -251,7 +220,7 @@ exports.buildESM2 = buildESM2;
function buildOneAMD(type, options) { function buildOneAMD(type, options) {
/** @type {import('esbuild').BuildOptions} */ /** @type {import('esbuild').BuildOptions} */
const opts = { const opts = {
entryPoints: [`${options.base}/${options.entryPoint}`], entryPoints: [options.entryPoint],
bundle: true, bundle: true,
target: 'esnext', target: 'esnext',
format: 'iife', format: 'iife',
@ -267,8 +236,8 @@ function buildOneAMD(type, options) {
footer: { footer: {
js: 'return moduleExports;\n});' js: 'return moduleExports;\n});'
}, },
outbase: `${options.base}/src`, outbase: `src/${options.base}`,
outdir: `${options.base}/release/${type}/`, outdir: `out/release/${options.base}/${type}/`,
plugins: [ plugins: [
alias({ alias({
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'), 'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
@ -296,63 +265,6 @@ function buildAMD(options) {
} }
exports.buildAMD = buildAMD; exports.buildAMD = buildAMD;
/**
* @param {'dev'|'min'} type
* @param {{
* base: string;
* entryPoint: string;
* amdModuleId: string;
* amdDependencies?: string[];
* }} options
*/
function buildOneAMD2(type, options) {
/** @type {import('esbuild').BuildOptions} */
const opts = {
entryPoints: [options.entryPoint],
bundle: true,
target: 'esnext',
format: 'iife',
define: {
AMD: 'true'
},
globalName: 'moduleExports',
banner: {
js: `${bundledFileHeader}define("${options.amdModuleId}",[${(options.amdDependencies || [])
.map((dep) => `"${dep}"`)
.join(',')}],()=>{`
},
footer: {
js: 'return moduleExports;\n});'
},
outbase: `src/${options.base}`,
outdir: `out/release/${options.base}/${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 {{
* base: string;
* entryPoint: string;
* amdModuleId: string;
* amdDependencies?: string[];
* }} options
*/
function buildAMD2(options) {
buildOneAMD2('dev', options);
buildOneAMD2('min', options);
}
exports.buildAMD2 = buildAMD2;
function getGitVersion() { function getGitVersion() {
const git = path.join(REPO_ROOT, '.git'); const git = path.join(REPO_ROOT, '.git');
const headPath = path.join(git, 'HEAD'); const headPath = path.join(git, 'HEAD');

Loading…
Cancel
Save