Research compiler · no release yet GPLv3, royalty-free or commercial — your choice

Stator.

TypeScript and JavaScript to native binaries — an ahead-of-time compiler where typed code becomes unboxed machine values.

mise install && pnpm install --frozen-lockfile && pnpm run runtime
The stator mark: an indigo stator ring with a type bracket on the left and machine-code bit ticks on the right.

See it run

Stator, in the terminal.

Stator — zsh
$ node packages/compiler/src/cli/main.ts build app.ts -o app
$ node packages/compiler/src/cli/main.ts build app.js -o app --mode=js
$ node packages/compiler/src/cli/main.ts explain app.ts --json
Commands from the Stator usage examples.

Overview

What Stator does.

Stator is an ahead-of-time compiler from TypeScript and JavaScript to native binaries.

Typed code compiles to unboxed machine values. Untyped code compiles too, through a dynamic representation (NaN-boxed values, shape tables, inline caches), instead of being rejected or heroically analyzed. One pipeline; the mode is a policy layer on top.

Stator is a research compiler under active construction. It is not an npm-ecosystem drop-in, and it is not a production JS runtime.

Features

Built for real workflows.

Install

Up and running in a minute.

Install

There is no release yet. Set up the pinned toolchain (Node, pnpm, LLVM clang, just) and build the runtime from a checkout:

git clone https://github.com/pyrlyn/stator
cd stator
mise install
pnpm install --frozen-lockfile
pnpm run runtime

Usage

Build a native binary from TypeScript, straight from the sources on the pinned Node.

node packages/compiler/src/cli/main.ts build app.ts -o app

More examples below.

Usage examples

Real commands, straight from the docs.

Compile mixed JavaScript in js mode.

node packages/compiler/src/cli/main.ts build app.js -o app --mode=js

Ask what each construct compiles to.

node packages/compiler/src/cli/main.ts explain app.ts --json

Links

License

You can use Stator under any of the following licenses, at your choice:

  1. GNU GPLv3 — free for open-source applications on any platform, including embedded systems.
  2. Royalty-free license — free for proprietary desktop, mobile and web applications, as long as you disclose that your application uses the project. Embedded systems are not covered.
  3. Commercial license — for proprietary applications, including embedded systems, without the attribution requirement.

Pricing

Pro is a placeholder

Free forever. Pro when you need it.

Free · open source

GPLv3, royalty-free or commercial — your choice

$0forever

  • ts and js modes
  • stator explain verdicts
  • vite-stator bundler for js mode
Install free

Try Stator today.

Free and open source. Star it, file an issue, or send a pull request.