Skip to content

Commit 4d413c5

Browse files
authored
Concatenate all VS Code code into a single file (#34)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent eda0e6c commit 4d413c5

3 files changed

Lines changed: 567 additions & 1652 deletions

File tree

vscode/esbuild.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const esbuild = require('esbuild');
2+
const path = require('path');
3+
4+
const production = process.argv.includes('--production');
5+
const watch = process.argv.includes('--watch');
6+
7+
async function main() {
8+
const context = await esbuild.context({
9+
entryPoints: ['src/extension.ts'],
10+
bundle: true,
11+
format: 'cjs',
12+
minify: production,
13+
sourcemap: production ? false : 'inline',
14+
sourcesContent: false,
15+
platform: 'node',
16+
outfile: path.join(__dirname, '../build/vscode/extension.js'),
17+
external: ['vscode'],
18+
logLevel: 'silent',
19+
plugins: [
20+
{
21+
name: 'esbuild-problem-matcher',
22+
setup(build) {
23+
build.onStart(() => {
24+
console.log('[watch] build started');
25+
});
26+
build.onEnd((result) => {
27+
result.errors.forEach(({ text, location }) => {
28+
console.error(`✘ [ERROR] ${text}`);
29+
if (location) {
30+
console.error(` ${location.file}:${location.line}:${location.column}:`);
31+
}
32+
});
33+
console.log('[watch] build finished');
34+
});
35+
}
36+
}
37+
]
38+
});
39+
40+
if (watch) {
41+
await context.watch();
42+
} else {
43+
await context.rebuild();
44+
await context.dispose();
45+
}
46+
}
47+
48+
main().catch((error) => {
49+
console.error(error);
50+
process.exit(1);
51+
});

0 commit comments

Comments
 (0)