0008. Rust compiler using oxc and lightningcss
- Status: Accepted (provisional)
- Date: 2026-11-14
- Decided by: integrator (technical), on Tab 1's compiler section
- Planning item: D27, D28
Context
Tab 1 asks for a compiler in Rust that reuses existing Rust parsers for TypeScript and CSS, runs per file with content caching, and compiles to WebAssembly for the language server.
Decision
The compiler is a Cargo workspace under crates/. TypeScript inside page files is parsed with oxc; CSS with lightningcss. The page-file outer grammar is our own parser in crates/syntax. The TypeScript side is a pnpm workspace under packages/, with no extra task runner until builds are slow enough to need one.
Alternatives considered
| Option | Why not |
|---|---|
swc for TypeScript | Also good; oxc is faster for parsing and has a smaller, cleaner AST for analysis |
| A compiler in TypeScript | Slower, and a second rewrite later; Tab 1 sets Rust |
Consequences
Both libraries are added in WP2 with pinned versions. The wasm crate must keep them WebAssembly-compatible.