From 349392353be06766262f06cc5b5a295260605b65 Mon Sep 17 00:00:00 2001 From: Jamie Nelson Date: Sun, 11 Oct 2026 07:58:46 +1100 Subject: [PATCH 1/3] build: separate CLI error boundary from library entry --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 6f31423a..12a926ef 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -52,7 +52,7 @@ const config: ReturnType = defineConfig({ // integration-bundled-binary.test.ts copies only this file into an // isolated tempdir with no node_modules, so every runtime `dependency` // has to be bundled in, not left external. - entry: "src/index.ts", + entry: "src/cli.ts", platform: "node", outDir: "dist/bin", // tsdown auto-enables declaration output repo-wide because From b856af2892d1cb90f5ea8f7c19a7c9d6a99944fb Mon Sep 17 00:00:00 2001 From: Jamie Nelson Date: Sun, 11 Oct 2026 07:58:51 +1100 Subject: [PATCH 2/3] fix: report CLI failures without bundled stack traces --- src/cli.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/cli.ts diff --git a/src/cli.ts b/src/cli.ts new file mode 100644 index 00000000..a2cb16ce --- /dev/null +++ b/src/cli.ts @@ -0,0 +1,8 @@ +// The library entry retains its existing import-time execution and rejection behaviour. +// This CLI-only boundary reports a concise diagnostic and a nonzero exit status. +try { + await import('./index.js'); +} catch (error) { + console.error(error instanceof Error ? error.message : String(error)); + process.exitCode = 1; +} From 8fe5e85567b50ef05158f201722e847e2c06b851 Mon Sep 17 00:00:00 2001 From: Jamie Nelson Date: Sun, 11 Oct 2026 09:43:14 +1100 Subject: [PATCH 3/3] fix: preserve dist/bin/index.js for CLI package and action --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 12a926ef..71fef02f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -53,6 +53,7 @@ const config: ReturnType = defineConfig({ // isolated tempdir with no node_modules, so every runtime `dependency` // has to be bundled in, not left external. entry: "src/cli.ts", + outputOptions: { entryFileNames: "index.js", codeSplitting: false }, platform: "node", outDir: "dist/bin", // tsdown auto-enables declaration output repo-wide because @@ -70,7 +71,6 @@ const config: ReturnType = defineConfig({ // binary with no node_modules to resolve sibling chunks from. Keep this // off even when no current dependency lazy-loads: it is what stops the // single-file invariant from depending on which packages happen to. - outputOptions: { codeSplitting: false }, // Preserves the shebang + __filename/__dirname/require ESM-interop // shim scripts/esbuild.mjs's banner used to inject. banner: `#!/usr/bin/env node