Repository navigation
Expand file tree
/
Copy pathesbuild.config.js
More file actions
69 lines (65 loc) · 1.66 KB
/
Copy pathesbuild.config.js
File metadata and controls
69 lines (65 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const esbuild = require('esbuild');
const isProduction = process.argv.includes('--production');
const isWatch = process.argv.includes('--watch');
/** @type {esbuild.BuildOptions[]} */
const buildConfigs = [
// Core Verification Engine (Heavy bundle with TypeScript compiler, lazy-loaded on demand)
{
entryPoints: ['src/engine/proofCodeEngine.ts'],
bundle: true,
outfile: 'dist/proofCodeEngine.js',
external: ['vscode'],
format: 'cjs',
platform: 'node',
target: 'node18',
sourcemap: !isProduction,
minify: isProduction,
logLevel: 'info'
},
// VS Code Extension Entrypoint (Ultra-lightweight ~50KB bundle for sub-15ms activation)
{
entryPoints: ['src/extension/index.ts'],
bundle: true,
outfile: 'dist/extension.js',
external: ['vscode', './proofCodeEngine'],
format: 'cjs',
platform: 'node',
target: 'node18',
sourcemap: !isProduction,
minify: isProduction,
logLevel: 'info'
},
// Standalone CLI Bundle
{
entryPoints: ['src/cli.ts'],
bundle: true,
outfile: 'dist/cli.js',
external: ['vscode'],
format: 'cjs',
platform: 'node',
target: 'node18',
banner: {
js: '#!/usr/bin/env node\n'
},
sourcemap: !isProduction,
minify: isProduction,
logLevel: 'info'
}
];
async function main() {
try {
for (const config of buildConfigs) {
if (isWatch) {
const ctx = await esbuild.context(config);
await ctx.watch();
console.log(`Watching ${config.entryPoints[0]} -> ${config.outfile}`);
} else {
await esbuild.build(config);
}
}
} catch (e) {
console.error(e);
process.exit(1);
}
}
main();