Fix Bun .d.ts bundle broken by TypeScript 7 resolution - #159
Conversation
dts-bundle-generator@9.5.1 reads ts.sys at module load. With no local package.json, Bun resolves its 'typescript: >=5.0.2' range to TypeScript 7 (native rewrite, no legacy JS API), so ts.sys is undefined and the bundle crashes. Add a build-only package.json pinning typescript ^5.9.3 and run bun install --cwd ./build before bundling.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72af49d188
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // plugin, in particular ts.sys), breaking the .d.ts bundle step. | ||
| console.time('Bun install time') | ||
| const bunInstall = new Deno.Command('bun', { | ||
| args: ['install', '--cwd', './build', '--silent'], |
There was a problem hiding this comment.
Preserve diagnostics from failed Bun installs
When the registry is unavailable or a package fails verification, --silent suppresses the diagnostic output that this error path attempts to decode. bun install --help defines this flag as “Don't log anything”; with Bun 1.2.14, a failed silent install exits nonzero with zero-byte stderr, so CI reports only Bun install failed: and hides the package or network error. Use narrower output controls such as --no-progress/--no-summary, or otherwise preserve failure diagnostics.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b16aabe: --silent → --no-progress --no-summary (preserves install error diagnostics).
Replace --silent (suppresses all output) with --no-progress --no-summary so a failed build-dependency install still surfaces the registry/network error the catch block decodes, instead of an empty 'Bun install failed:'.
|



Problem
deno task bundlefails onmaster(independent of any dependency PR):Root cause
build/bun-build.tsloadsbun-plugin-dts@0.4.0→dts-bundle-generator@9.5.1, which readsts.sysat module-evaluation time.dts-bundle-generatordeclarestypescript: ">=5.0.2", and since the repo has no rootpackage.json/lockfile, Bun resolves that range to TypeScript 7 (the nativetsgorewrite), which does not expose the legacy JS compiler API — sots.sysisundefined.Verified: without a local
package.json,require('typescript').version === '7.0.2'andts.sys === undefined; pinned to^5,ts.version === '5.9.3'andts.sys.getCurrentDirectoryis a function.Fix
Add a build-only
build/package.json(private: true) pinningtypescript: ^5.9.3, and runbun install --cwd ./buildinbundle.tsbefore the Bun build. No source code touched; the Deno-first publish flow is unchanged (deno.jsonpublish.includedoes not includepackage.json).Verification
deno task bundle(cold + warm)dist/esm/mod.d.ts(2288 lines) regenerated5.9.3deno fmt --check/deno lint