feat(coding-agent): reduce bundled startup work

This commit is contained in:
Armin Ronacher
2026-08-23 00:03:19 +02:00
parent 62bcbf6be0
commit faecac2ca8
3 changed files with 20 additions and 18 deletions
+12
View File
@@ -17,6 +17,7 @@ const banner = {
};
const allowedExternalPackages = new Set([
"@silvia-odwyer/photon-node",
"jiti",
// Optional native accelerators. Their callers fall back to JavaScript when absent.
"bufferutil",
"utf-8-validate",
@@ -24,6 +25,13 @@ const allowedExternalPackages = new Set([
"supports-color",
]);
const lazyJitiPlugin = {
name: "lazy-jiti-transform",
setup(build) {
build.onResolve({ filter: /^jiti\/static$/ }, () => ({ external: true, path: "jiti" }));
},
};
function commonBuildOptions() {
return {
absWorkingDir: repoRoot,
@@ -38,6 +46,10 @@ function commonBuildOptions() {
minifySyntax: true,
minifyWhitespace: true,
platform: "node",
// The source uses jiti/static so Bun embeds its Babel transform. The Node
// package can use regular jiti from its direct dependency and load Babel
// only when an extension actually needs transformation.
plugins: [lazyJitiPlugin],
sourcemap: false,
target: "node22.19",
// Do not apply the monorepo's source-oriented path aliases while bundling