diff --git a/extensions/markdown-language-features/esbuild-notebook.js b/extensions/markdown-language-features/esbuild-notebook.js index 82b2451e0e3..bd5a325438d 100644 --- a/extensions/markdown-language-features/esbuild-notebook.js +++ b/extensions/markdown-language-features/esbuild-notebook.js @@ -2,10 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// @ts-check const path = require('path'); const esbuild = require('esbuild'); -const watcher = require('@parcel/watcher'); const args = process.argv.slice(2); @@ -17,29 +15,19 @@ if (outputRootIndex >= 0) { outputRoot = args[outputRootIndex + 1]; } -const srcDir = path.join(__dirname, 'notebook'); const outDir = path.join(outputRoot, 'notebook-out'); -function build() { - return esbuild.build({ - entryPoints: [ - path.join(__dirname, 'notebook', 'index.ts'), - ], - bundle: true, - minify: true, - sourcemap: false, - format: 'esm', - outdir: outDir, - platform: 'browser', - target: ['es2020'], - }); -} - - -build().catch(() => process.exit(1)); - -if (isWatch) { - watcher.subscribe(srcDir, () => { - return build(); - }); -} +esbuild.build({ + entryPoints: [ + path.join(__dirname, 'notebook', 'index.ts'), + ], + bundle: true, + minify: true, + sourcemap: false, + format: 'esm', + outdir: outDir, + platform: 'browser', + target: ['es2020'], + watch: isWatch, + incremental: isWatch, +}).catch(() => process.exit(1)); diff --git a/extensions/markdown-language-features/esbuild-preview.js b/extensions/markdown-language-features/esbuild-preview.js index d570e5a97a3..727353c6e44 100644 --- a/extensions/markdown-language-features/esbuild-preview.js +++ b/extensions/markdown-language-features/esbuild-preview.js @@ -2,10 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// @ts-check const path = require('path'); const esbuild = require('esbuild'); -const watcher = require('@parcel/watcher'); const args = process.argv.slice(2); @@ -17,29 +15,20 @@ if (outputRootIndex >= 0) { outputRoot = args[outputRootIndex + 1]; } -const srcDir = path.join(__dirname, 'preview-src'); const outDir = path.join(outputRoot, 'media'); -function build() { - return esbuild.build({ - entryPoints: [ - path.join(srcDir, 'index.ts'), - path.join(srcDir, 'pre'), - ], - bundle: true, - minify: true, - sourcemap: false, - format: 'esm', - outdir: outDir, - platform: 'browser', - target: ['es2020'], - }); -} - -build().catch(() => process.exit(1)); - -if (isWatch) { - watcher.subscribe(srcDir, () => { - return build(); - }); -} +esbuild.build({ + entryPoints: [ + path.join(__dirname, 'preview-src', 'index.ts'), + path.join(__dirname, 'preview-src', 'pre'), + ], + bundle: true, + minify: true, + sourcemap: false, + format: 'esm', + outdir: outDir, + platform: 'browser', + target: ['es2020'], + watch: isWatch, + incremental: isWatch, +}).catch(() => process.exit(1)); diff --git a/extensions/markdown-math/esbuild.js b/extensions/markdown-math/esbuild.js index 1dcd8b8c61a..dd94d2e1eed 100644 --- a/extensions/markdown-math/esbuild.js +++ b/extensions/markdown-math/esbuild.js @@ -7,7 +7,6 @@ const path = require('path'); const fse = require('fs-extra'); const esbuild = require('esbuild'); -const watcher = require('@parcel/watcher'); const args = process.argv.slice(2); @@ -19,44 +18,34 @@ if (outputRootIndex >= 0) { outputRoot = args[outputRootIndex + 1]; } -const srcDir = path.join(__dirname, 'notebook'); const outDir = path.join(outputRoot, 'notebook-out'); +esbuild.build({ + entryPoints: [ + path.join(__dirname, 'notebook', 'katex.ts'), + ], + bundle: true, + minify: true, + sourcemap: false, + format: 'esm', + outdir: outDir, + platform: 'browser', + target: ['es2020'], + watch: isWatch, + incremental: isWatch, +}).catch(() => process.exit(1)); -async function build() { - await esbuild.build({ - entryPoints: [ - path.join(srcDir, 'katex.ts'), - ], - bundle: true, - minify: true, - sourcemap: false, - format: 'esm', - outdir: outDir, - platform: 'browser', - target: ['es2020'], - }); +fse.copySync( + path.join(__dirname, 'node_modules', 'katex', 'dist', 'katex.min.css'), + path.join(outDir, 'katex.min.css')); - fse.copySync( - path.join(__dirname, 'node_modules', 'katex', 'dist', 'katex.min.css'), - path.join(outDir, 'katex.min.css')); - const fontsDir = path.join(__dirname, 'node_modules', 'katex', 'dist', 'fonts'); - const fontsOutDir = path.join(outDir, 'fonts/'); +const fontsDir = path.join(__dirname, 'node_modules', 'katex', 'dist', 'fonts'); +const fontsOutDir = path.join(outDir, 'fonts/'); - fse.mkdirSync(fontsOutDir, { recursive: true }); +fse.mkdirSync(fontsOutDir, { recursive: true }); - for (const file of fse.readdirSync(fontsDir)) { - if (file.endsWith('.woff2')) { - fse.copyFileSync(path.join(fontsDir, file), path.join(fontsOutDir, file)); - } +for (const file of fse.readdirSync(fontsDir)) { + if (file.endsWith('.woff2')) { + fse.copyFileSync(path.join(fontsDir, file), path.join(fontsOutDir, file)); } } - - -build().catch(() => process.exit(1)); - -if (isWatch) { - watcher.subscribe(srcDir, () => { - return build(); - }); -} diff --git a/extensions/notebook-renderers/esbuild.js b/extensions/notebook-renderers/esbuild.js index 7200fd2c24e..11a04a0a982 100644 --- a/extensions/notebook-renderers/esbuild.js +++ b/extensions/notebook-renderers/esbuild.js @@ -2,10 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// @ts-check const path = require('path'); const esbuild = require('esbuild'); -const watcher = require('@parcel/watcher'); const args = process.argv.slice(2); @@ -17,28 +15,19 @@ if (outputRootIndex >= 0) { outputRoot = args[outputRootIndex + 1]; } -const srcDir = path.join(__dirname, 'src'); const outDir = path.join(outputRoot, 'renderer-out'); -function build() { - return esbuild.build({ - entryPoints: [ - path.join(srcDir, 'index.ts'), - ], - bundle: true, - minify: false, - sourcemap: false, - format: 'esm', - outdir: outDir, - platform: 'browser', - target: ['es2020'], - }); -} - -build().catch(() => process.exit(1)); - -if (isWatch) { - watcher.subscribe(srcDir, () => { - return build(); - }); -} +esbuild.build({ + entryPoints: [ + path.join(__dirname, 'src', 'index.ts'), + ], + bundle: true, + minify: false, + sourcemap: false, + format: 'esm', + outdir: outDir, + platform: 'browser', + target: ['es2020'], + watch: isWatch, + incremental: isWatch, +}).catch(() => process.exit(1)); diff --git a/extensions/simple-browser/esbuild-preview.js b/extensions/simple-browser/esbuild-preview.js index b6fc9d0699a..d6447532501 100644 --- a/extensions/simple-browser/esbuild-preview.js +++ b/extensions/simple-browser/esbuild-preview.js @@ -2,11 +2,9 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// @ts-check const path = require('path'); const fs = require('fs'); const esbuild = require('esbuild'); -const watcher = require('@parcel/watcher'); const args = process.argv.slice(2); @@ -18,36 +16,27 @@ if (outputRootIndex >= 0) { outputRoot = args[outputRootIndex + 1]; } -const srcDir = path.join(__dirname, 'preview-src'); const outDir = path.join(outputRoot, 'media'); -async function build() { - fs.copyFileSync( - path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'), - path.join(outDir, 'codicon.css')); +fs.copyFileSync( + path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'), + path.join(outDir, 'codicon.css')); - fs.copyFileSync( - path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'), - path.join(outDir, 'codicon.ttf')); +fs.copyFileSync( + path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'), + path.join(outDir, 'codicon.ttf')); - await esbuild.build({ - entryPoints: [ - path.join(srcDir, 'index.ts') - ], - bundle: true, - minify: true, - sourcemap: false, - format: 'esm', - outdir: outDir, - platform: 'browser', - target: ['es2020'], - }); -} - -build().catch(() => process.exit(1)); - -if (isWatch) { - watcher.subscribe(srcDir, () => { - return build(); - }); -} +esbuild.build({ + entryPoints: [ + path.join(__dirname, 'preview-src', 'index.ts') + ], + bundle: true, + minify: true, + sourcemap: false, + format: 'esm', + outdir: outDir, + platform: 'browser', + target: ['es2020'], + watch: isWatch, + incremental: isWatch, +}).catch(() => process.exit(1));