Skip to content

Commit

Permalink
Remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Nov 13, 2021
1 parent 7b37110 commit c3ac455
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 112 deletions.
40 changes: 20 additions & 20 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//@ts-check

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`);

Expand Down Expand Up @@ -35,23 +35,23 @@ dts(

//#region css

buildESM2({
buildESM({
base: 'css',
entryPoints: ['src/css/monaco.contribution.ts', 'src/css/cssMode.ts', 'src/css/css.worker.ts'],
external: ['monaco-editor-core', '*/cssMode']
});
buildAMD2({
buildAMD({
base: 'css',
entryPoint: 'src/css/monaco.contribution.ts',
amdModuleId: 'vs/language/css/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
buildAMD({
base: 'css',
entryPoint: 'src/css/cssMode.ts',
amdModuleId: 'vs/language/css/cssMode'
});
buildAMD2({
buildAMD({
base: 'css',
entryPoint: 'src/css/cssWorker.ts',
amdModuleId: 'vs/language/css/cssWorker'
Expand All @@ -61,7 +61,7 @@ buildAMD2({

//#region html

buildESM2({
buildESM({
base: 'html',
entryPoints: [
'src/html/monaco.contribution.ts',
Expand All @@ -70,18 +70,18 @@ buildESM2({
],
external: ['monaco-editor-core', '*/htmlMode']
});
buildAMD2({
buildAMD({
base: 'html',
entryPoint: 'src/html/monaco.contribution.ts',
amdModuleId: 'vs/language/html/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
buildAMD({
base: 'html',
entryPoint: 'src/html/htmlMode.ts',
amdModuleId: 'vs/language/html/htmlMode'
});
buildAMD2({
buildAMD({
base: 'html',
entryPoint: 'src/html/htmlWorker.ts',
amdModuleId: 'vs/language/html/htmlWorker'
Expand All @@ -91,7 +91,7 @@ buildAMD2({

//#region json

buildESM2({
buildESM({
base: 'json',
entryPoints: [
'src/json/monaco.contribution.ts',
Expand All @@ -100,18 +100,18 @@ buildESM2({
],
external: ['monaco-editor-core', '*/jsonMode']
});
buildAMD2({
buildAMD({
base: 'json',
entryPoint: 'src/json/monaco.contribution.ts',
amdModuleId: 'vs/language/json/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
buildAMD({
base: 'json',
entryPoint: 'src/json/jsonMode.ts',
amdModuleId: 'vs/language/json/jsonMode'
});
buildAMD2({
buildAMD({
base: 'json',
entryPoint: 'src/json/jsonWorker.ts',
amdModuleId: 'vs/language/json/jsonWorker'
Expand All @@ -126,7 +126,7 @@ copyFile(
`out/amd/typescript/lib/typescriptServices.js`
);

buildESM2({
buildESM({
base: 'typescript',
entryPoints: [
'src/typescript/monaco.contribution.ts',
Expand All @@ -135,18 +135,18 @@ buildESM2({
],
external: ['monaco-editor-core', '*/tsMode']
});
buildAMD2({
buildAMD({
base: 'typescript',
entryPoint: 'src/typescript/monaco.contribution.ts',
amdModuleId: 'vs/language/typescript/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
buildAMD2({
buildAMD({
base: 'typescript',
entryPoint: 'src/typescript/tsMode.ts',
amdModuleId: 'vs/language/typescript/tsMode'
});
buildAMD2({
buildAMD({
base: 'typescript',
entryPoint: 'src/typescript/tsWorker.ts',
amdModuleId: 'vs/language/typescript/tsWorker'
Expand Down Expand Up @@ -175,7 +175,7 @@ glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function
external.push(`*/${language}.contribution`);
external.push(`*/${language}`);
}
buildESM2({
buildESM({
base: 'basic-languages',
entryPoints,
external
Expand All @@ -184,14 +184,14 @@ glob('../src/basic-languages/*/*.contribution.ts', { cwd: __dirname }, function

// AMD
{
buildAMD2({
buildAMD({
base: 'basic-languages',
entryPoint: 'src/basic-languages/monaco.contribution.ts',
amdModuleId: 'vs/basic-languages/monaco.contribution',
amdDependencies: ['vs/editor/editor.api']
});
for (const language of languages) {
buildAMD2({
buildAMD({
base: 'basic-languages',
entryPoint: `src/basic-languages/${language}/${language}.ts`,
amdModuleId: `vs/basic-languages/${language}/${language}`
Expand Down
96 changes: 4 additions & 92 deletions build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,37 +185,6 @@ exports.build = build;
* }} 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({
entryPoints: options.entryPoints,
bundle: true,
Expand All @@ -237,7 +206,7 @@ function buildESM2(options) {
]
});
}
exports.buildESM2 = buildESM2;
exports.buildESM = buildESM;

/**
* @param {'dev'|'min'} type
Expand All @@ -251,7 +220,7 @@ exports.buildESM2 = buildESM2;
function buildOneAMD(type, options) {
/** @type {import('esbuild').BuildOptions} */
const opts = {
entryPoints: [`${options.base}/${options.entryPoint}`],
entryPoints: [options.entryPoint],
bundle: true,
target: 'esnext',
format: 'iife',
Expand All @@ -267,8 +236,8 @@ function buildOneAMD(type, options) {
footer: {
js: 'return moduleExports;\n});'
},
outbase: `${options.base}/src`,
outdir: `${options.base}/release/${type}/`,
outbase: `src/${options.base}`,
outdir: `out/release/${options.base}/${type}/`,
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
Expand Down Expand Up @@ -296,63 +265,6 @@ function buildAMD(options) {
}
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() {
const git = path.join(REPO_ROOT, '.git');
const headPath = path.join(git, 'HEAD');
Expand Down
File renamed without changes.

0 comments on commit c3ac455

Please sign in to comment.