@bext-stack/tsc-rs
v0.1.1
Published
tsc-rs — TypeScript compiler in Rust. Drop-in replacement for tsc + a long-running stdin/stdout pipe API used by bext's PRISM dispatcher. Ships prebuilt binaries via per-platform optionalDependencies.
Maintainers
Readme
@bext-stack/tsc-rs
tsc-rs is a TypeScript compiler in Rust. It implements the parts of tsc
needed by bext's PRISM dispatcher (parse, typecheck, JSX → JS emit, source
maps), plus a long-running stdin/stdout pipe API used for per-module
transforms during PRISM compile.
This package ships prebuilt binaries for major platforms via per-platform
optionalDependencies. npm/pnpm/yarn install only the one matching your
host's process.platform/process.arch.
Install
npm install @bext-stack/tsc-rsUse as a CLI
npx tsc-rs --target es2022 --outDir dist src/index.tsUse programmatically
import { resolveBinaryPath } from "@bext-stack/tsc-rs/lib/resolve.mjs";
import { spawn } from "node:child_process";
const tscrs = resolveBinaryPath();
const child = spawn(tscrs, ["--noEmit", "src/index.ts"], { stdio: "inherit" });bext-server's find_tscrs_binary() walks up from CWD looking for
./node_modules/.bin/tsc-rs first — installing this package makes the
binary discoverable without the TSCRS_PATH env var or hardcoded
$HOME/ts-rs/target/release/tsc-rs paths.
Override
If you have a locally-built binary you want to use instead, set
TSCRS_PATH to its absolute path. Both the npm shim (bin/tsc-rs.mjs)
and bext-server's Rust resolver respect it.
Supported platforms
| platform | arch | package |
|---|---|---|
| linux | x64 | @bext-stack/tsc-rs-linux-x64 |
| linux | arm64 | @bext-stack/tsc-rs-linux-arm64 (planned) |
| darwin | x64 | @bext-stack/tsc-rs-darwin-x64 (planned) |
| darwin | arm64 | @bext-stack/tsc-rs-darwin-arm64 (planned) |
| win32 | x64 | @bext-stack/tsc-rs-win32-x64 (planned) |
Other platforms throw a clear error with a TSCRS_PATH workaround. The
optionalDependencies list reserves the package names so the cross-platform
publish flow can drop a binary at the same name.
License
MIT
