mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
Reapply parcel/watcher adoption
Revert "Revert e7fffbf1c9169087f1098aedfe54c59c079fa3ac"
This reverts commit 6786b0ad7d.
Two changes:
- Lazy import parcel/watcher
- Add `@parcel/watcher` as a dev dep in extensions folder so that we pull in correct version for build os
This commit is contained in:
@@ -18,34 +18,45 @@ 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));
|
||||
|
||||
fse.copySync(
|
||||
path.join(__dirname, 'node_modules', 'katex', 'dist', 'katex.min.css'),
|
||||
path.join(outDir, 'katex.min.css'));
|
||||
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'));
|
||||
|
||||
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) {
|
||||
const watcher = require('@parcel/watcher');
|
||||
watcher.subscribe(srcDir, () => {
|
||||
return build();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user