Perry-WIT

Perry-WIT compiles a static subset of TypeScript into standalone WASI 0.3 components, without bundling a JavaScript engine.

A simple integer add fits in 100 bytes. Components can keep state between calls while the runtime reclaims temporary allocations. 63 conformance contracts compare results with Node.js.

Perry-WIT Personal Component cartridge A software cartridge labelled .wasm, ready to run in a WASI host. PERRY-WIT .wasm PERSONAL COMPONENT
Fewer bytes, more delights.Batteries supplied by the host.

TypeScriptindex.ts

export function greet(name: string): string {
  return "Hello, " + name;
}

WITworld.wit

package example:greeting;
world greeting {
  export greet: func(name: string) -> string;
}

What to build

HTTP services

Serve handle(request) as wasi:http/handler@0.3.0. fetch, streams, timers and Promise combinators suspend through WASI 0.3 callbacks and resume directly from host events.

HTTP handlers

Type-safe components

Generated .d.ts brings editor completion and tsc checks for WIT records, lists, variants and results. Write library functions or CLI commands with top-level await. Start with a Nix template.

Authoring

Integer types

Use ordinary TypeScript syntax for native signed and unsigned arithmetic. WIT ranges let the compiler widen only when needed and eliminate redundant array bounds checks.

Numbers

Compile on the fly

Compile tenant TypeScript in memory through Rust's perry_wit::api, or run the WASI 0.2 compiler with fuel and memory limits. The compiler embeds the precompiled runtime and standard libraries, so compilation needs neither Rust nor LLVM.

Embedding

Artifacts