A Blazing-Fast Compiler for Svelte 5

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
		

Compile every crate in the workspace.

Parser benchmark snapshot

Source: `benchmarks/criterion/lux-parser/parser`.

svelte parser path
2.4075ms
lux-parser
0.0155ms
155.7x faster

Point estimate based on full sample distribution.

Mean Criterion new/estimates.json

Built for compiler iteration loops

Lux splits the compiler into focused crates so parser, analyzer, and transformer work can be benchmarked and evolved independently.

Good fit

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
Not trying to replace

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

Reference-first

Svelte source under `reference/` stays the behavior baseline. Lux implements phase logic against that baseline rather than diverging API contracts.

vs
Rust phase isolation

Parser, analyzer, and transformer each expose focused crates. That makes per-phase benchmarking and regression checks straightforward in CI.

01 Parse
lux-parser

Zero-copy parsing with winnow for templates/CSS and OXC for JS/TS expressions.

02 Analyze
lux-analyzer

Semantic passes build scopes, bindings, and diagnostics over the parsed AST.

03 Transform
lux-transformer

Generates JS/CSS output from analyzed state while preserving compatibility intent.

Contributor workflow

Clone and verify
			git clone https://github.com/levish0/lux.git
		
			cd lux
		
			cargo check --workspace
		
Parser benchmark
			cargo bench -p lux-parser --bench svelte_compare_parser
		
Benchmark custom input
			$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