Inside the SWC Compiler Pass & Capabilities-Based Security
How our Rust compiler pipeline strips directives, wires Server Actions, and enforces CSPRNG 256-bit SafeHtml tokens.
The compiler pipeline in Swift Rust does far more than transpile TypeScript. Built on SWC in Rust alongside Bun's ultra-fast bundler, our build pipeline processes a full 12-route application in 2.18 seconds cold and 140 milliseconds warm.
During compilation, the pipeline performs three essential transformations:
1. RSC & Island Boundary Graph: Automatically splits "use client" islands and "use server" action modules into verifiable manifest graphs with HMAC-SHA256 action signatures. 2. Capabilities-Based <SafeHtml>: Replaces raw innerHTML footguns with sanitizeHtml() and mintTrustedHtml(), backed by a per-process 256-bit CSPRNG secret that client bundles can never forge. 3. Structured Error Catalog: Emits deterministic error codes (SR-E0001–SR-E1404) linked directly to actionable fixes.