import esbuild from 'esbuild'; const watch = process.argv.includes('--watch'); const gjsOpts = { entryPoints: ['src/main.ts'], bundle: true, outfile: 'dist/main.js', format: 'esm', target: 'firefox128', platform: 'neutral', external: ['gi://*', 'system', 'cairo', 'gettext'], sourcemap: 'inline', logLevel: 'info', }; const runtimeOpts = { entryPoints: ['runtime/runtime.ts'], bundle: true, outfile: 'dist/runtime.js', format: 'esm', target: 'es2022', platform: 'browser', sourcemap: 'inline', logLevel: 'info', }; if (watch) { const c1 = await esbuild.context(gjsOpts); const c2 = await esbuild.context(runtimeOpts); await Promise.all([c1.watch(), c2.watch()]); } else { await Promise.all([esbuild.build(gjsOpts), esbuild.build(runtimeOpts)]); }