Goal
Swap bun-plugin-dtsx's dts emit pipeline from the TypeScript @stacksjs/dtsx to the Zig-native @stacksjs/zig-dtsx. Same output, significantly faster.
Background
The Zig implementation has been extracted into a standalone repo at zig-utils/zig-dtsx so it can be released and consumed independently:
- CLI — distributable via pantry (
pantry add zig-dtsx) - TS FFI bridge — Bun FFI wrapper published as
@stacksjs/zig-dtsxon npm, exposesprocessSource()/processBatch() - Parity — vendored fixture suite (199 tests) validates byte-identical output against the reference TS implementation
Acceptance
- Add
@stacksjs/zig-dtsxas a peer/dev dep (or pantry dep for CLI use) - Detect whether the Zig shared library is available (
ZIG_AVAILABLEfrom@stacksjs/zig-dtsx) - When available: route per-file dts emit through
processSource()/processBatch()instead of the TS path - Fall back to the existing
@stacksjs/dtsxTS path when Zig isn't available (CI without the binary, unsupported platform, etc.) - Benchmark before/after on a representative project (target: at least the speedup numbers documented in zig-dtsx's README)
- Update README to mention the optional Zig acceleration
Blocked on
zig-utils/zig-dtsx0.1.0 release cut + published binaries (cross-compile matrix already wired in CI)@stacksjs/zig-dtsxnpm publish- pantry package registration for the CLI
Context
Chris flagged this on 2026-05-13 as a follow-up to the broader own-compiler direction. Pairs with the bundler-mirror task (extract Bun's Zig bundler before the Rust rewrite lands).