Tessera Compiler
object TesseraCompiler
Compiles a Tessera script (TypeScript / modern JS) straight to JVM bytecode using swc4j's ByteCodeCompiler. Scripts run as native JVM classes — every export function becomes a static method on the default $ class, and scripts reach the Tessera API by importing our Kotlin objects by package, e.g. import { Tessera, Event } from 'ratph6.tessera.api'.
Because the compiler does not execute top-level statements, the source is first rewritten so any top-level code (e.g. Tessera.register(...)) is moved into a generated __tesseraEntry() function that the engine runs on load — so scripts need neither a main() nor export. Two wrap strategies exist (see compile): a textual one (default; deterministic) and an AST one (fallback).