vercel-labs / vercel-labs/scriptc
Bun host support: TypeScript 7 sync transport crashes on stdout._handle.fd
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 125
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 95
Description
Running scriptc 0.0.36 under Bun 1.4.0 on macOS arm64 fails while starting the TypeScript 7 frontend, before compiling even a minimal input. This also affects installations where the node executable resolves to Bun.
I realize the README currently requires Node.js 24+. This report requests Bun host-runtime support and identifies the current blocker; it is not a report about Bun APIs in compiled programs.
Reproduction
With scriptc 0.0.36 already installed and its CLI executed by Bun (for example, when node resolves to Bun), create hello.ts containing:
console.log(42);
Run:
scriptc build hello.ts --emit=ir
Actual result: exit code 1, with this error (installation prefixes omitted):
TypeError: undefined is not an object (evaluating 'stdout._handle.fd')
at new SyncRpcChannel (typescript/dist/api/syncChannel.js:131:34)
at new Client (typescript/dist/api/sync/client.js:36:25)
at new API (typescript/dist/api/sync/api.js:40:23)
at new Ts7Host (@scriptc/compiler/dist/frontend/ts7/program-adapter.js:81:20)
Expected for Bun support: emit IR successfully. At minimum, an unsupported host should produce an actionable diagnostic instead of an internal dependency stack trace.
Investigation
Ts7Host constructs the synchronous API from typescript/unstable/sync. In TypeScript 7.0.2, SyncRpcChannel obtains POSIX descriptors through the private Node stream properties stdout._handle.fd and stdin._handle.fd. Bun's child-process streams do not provide the required handle in this reproduction. Consequently, changing the native compiler or linker cannot fix this failure: --emit=ir fails too.
The current scriptc frontend uses the TS7 adapter throughout; the existing typescript5 dependency is not a drop-in frontend fallback. Actual Bun support needs a compatible synchronous transport in the dependency or an integration that preserves TS7's synchronous API and filesystem callbacks.
I checked existing issues and PRs for Bun, SyncRpcChannel, and _handle and found no matching report.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided hello.ts command, then inspect @scriptc/compiler/dist/frontend/ts7/program-adapter.js and TypeScript's typescript/dist/api/syncChannel.js around the reported stream-handle access. Determine whether a compatible synchronous transport or an integration preserving TS7's API is feasible; done means Bun emits IR successfully or reports an actionable unsupported-host diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, typescript
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100