Drop-in behavior target.
Native parser speed.
Lux keeps the Svelte compiler pipeline explicit: parse, analyze, and transform run as separate Rust crates so we can optimize each stage without losing compatibility focus.
cargo check --workspace
cargo bench -p lux-parser --bench svelte_compare_parser
cargo bench -p lux-analyzer --bench svelte_compare_analyzer
Compile every crate in the workspace.
Source: `benchmarks/criterion/lux-parser/parser`.
Point estimate based on full sample distribution.
Built for compiler iteration loops
Lux splits the compiler into focused crates so parser, analyzer, and transformer work can be benchmarked and evolved independently.
When tight feedback and micro-bench visibility matter.
- Compiler feature parity work against upstream Svelte behavior
- Profiling parser/analyzer hotspots in isolation
- CI checks for parser and analyzer regressions
- Agentic coding workflows that need deterministic CLI output
Official Svelte compiler as the behavior source of truth.
- Upstream compiler design decisions and runtime behavior contracts
- IDE language tooling and editor integrations
- Production apps expecting stable upstream semantics
- Compatibility baselines documented in Svelte reference source
Pipeline architecture
Svelte source under `reference/` stays the behavior baseline. Lux implements phase logic against that baseline rather than diverging API contracts.
Parser, analyzer, and transformer each expose focused crates. That makes per-phase benchmarking and regression checks straightforward in CI.
Zero-copy parsing with winnow for templates/CSS and OXC for JS/TS expressions.
Semantic passes build scopes, bindings, and diagnostics over the parsed AST.
Generates JS/CSS output from analyzed state while preserving compatibility intent.
Contributor workflow
git clone https://github.com/levish0/lux.git
cd lux
cargo check --workspace
cargo bench -p lux-parser --bench svelte_compare_parser
$env:LUX_BENCH_INPUT="benchmarks/assets/benchmark.svelte"
cargo bench -p lux-parser --bench svelte_compare_parser
Workspace crates
| Crate | Role | Phase |
|---|---|---|
lux-ast | AST type definitions + ESTree serialization bridge | Shared Core |
lux-parser | winnow template/CSS parser + OXC JS/TS expression parsing | Parse |
lux-analyzer | Scope/binding validation and semantic analysis | Analyze |
lux-transformer | JS/CSS generation pipeline from analyzed AST | Transform |
lux-utils | Keyword tables, fast maps, and shared helpers | Shared Core |
lux-metadata | Shared Svelte metadata tables | Shared Core |