Files
scriptc/packages/cli
Chris Tate 6c07441c24 Check programs with tsc-ts by default
scriptc's frontend talks to a TypeScript 7 API server. tsc-ts serves the
same API as tsgo, and it is now the default checker; SCRIPTC_CHECKER=tsgo
selects tsgo, which scriptc still includes.

- @scriptc/compiler depends on tsc-ts 0.0.3. The native distribution
  ships its platform package as lib/tsc-ts, named by a new tsc_ts field
  of the toolchain manifest; a manifest without it takes the executable
  of an installed tsc-ts package.
- The executable cache key includes the tsc-ts executable's identity, in
  the compiler and in the CLI's startup route.
- tsc-ts keeps the syntax trees it builds for the life of its process,
  so the source parser starts a new server after 256 KB of parsed
  source instead of letting one server grow with every file.
- A CI job compiles every corpus program with both checkers, in release
  and dev, and requires the same LLVM IR and diagnostics
  (scripts/checker-identity.mjs).
- Tests that compare with the TypeScript 7 SDK, the checker-panic
  diagnostics, and the protocol tests run against tsgo.
2026-10-18 19:55:52 -05:00
..
2026-10-18 19:55:52 -05:00
2026-10-16 10:33:14 -05:00
2026-07-22 18:08:04 -05:00
2026-10-17 13:47:41 -05:00
2026-07-22 18:08:04 -05:00

scriptc

Compile TypeScript and JavaScript to native executables or WASI WebAssembly modules that run without Node.js installed.

$ cat fib.ts
function fib(n: number): number {
  return n < 2 ? n : fib(n - 1) + fib(n - 2);
}
console.log(fib(30));

$ scriptc run fib.ts
832040

$ scriptc build fib.ts -o fib >/dev/null && ./fib
832040

scriptc compiles the same TypeScript you run on Node.js, type-checked by the TypeScript compiler. npm packages your program imports compile along with it. Code scriptc can't compile fails the build with an error code and, where available, a rewrite hint.

scriptc is experimental. See the limitations and the Node.js compatibility reference.

Install

$ npm install -g scriptc

npm installs the native compiler for your platform (macOS, Linux, or Windows). Node.js 24 or later is needed to install it and to run WASI modules with scriptc run; compiling and running executables doesn't need Node.js.

Building executables needs a linker and the platform SDK or sysroot, such as the Xcode Command Line Tools on macOS. Set SCRIPTC_LINKER to choose the linker driver. --emit=ir|llvm|asm|obj needs no external tools. See the quickstart for details.

Commands

  • scriptc build <file.ts>: compile to a native executable or another artifact selected with --emit.
  • scriptc run <file.ts>: compile and run.
  • scriptc coverage <file.ts>: report what compiles, and explain what doesn't.
  • scriptc build --lib --profile <profile.json>: compile a static library, or a Wasm reactor on wasm32-wasi.

See the CLI reference for every option.

Cross-compilation and WebAssembly

Set SCRIPTC_TARGET to build for another platform, for example SCRIPTC_TARGET=aarch64-linux-gnu.2.36 or SCRIPTC_TARGET=wasm32-wasi. Install the matching @scriptc/runtime-<target> package in your project, at the same version as scriptc --version, or set SCRIPTC_RUNTIME_PACK to a runtime pack directory. See platform support and WebAssembly modules.

Native code

Call C functions by declaring their signatures in TypeScript and binding them to C symbols in a manifest passed with --ffi <manifest.json>. See the Native FFI guide.

Build cache

Builds reuse a bounded persistent cache. Set SCRIPTC_NO_CACHE=1 to bypass it or SCRIPTC_CACHE_DIR to choose its location.

Docs: scriptc.dev