Core Components
The compiler orchestrates through a set of interdependent services. See Architecture Overview for pipeline phases.
System Architecture
Section titled “System Architecture”graph TB
subgraph Discovery["Discovery & IR"]
Program["Program"]
SourceFiles["SourceFiles"]
FileProcessor["FileProcessor"]
end
subgraph Mgmt["IR Management"]
IRRI["IRRI"]
Transformers["Transformers"]
end
subgraph Output["Output"]
Plugins["Plugins"]
FileWriter["FileWriter"]
end
Compiler["Compiler"]
Compiler --> Discovery
Compiler --> Mgmt
Compiler --> Output
FileProcessor --> IRRI
Transformers --> IRRI
style Compiler fill:#fff3e0,stroke:#f57f17,stroke-width:3px,color:#000
style Discovery fill:#e3f2fd,stroke:#01579b,color:#000
style Mgmt fill:#f3e5f5,stroke:#6a1b9a,color:#000
style Output fill:#e8f5e9,stroke:#33691e,color:#000
Component Reference
Section titled “Component Reference”| Component | Purpose |
|---|---|
| Program | Validate tsconfig.json, glob input files |
| SourceFiles | Registry for source and generated files |
| FileProcessor | Build IR for one file |
| IRRI | Collect and query all IRefs by kind |
| Transformers | Sync AST nodes from IR state |
| Plugins | Run generators and derivatives |
| FileWriter | Preprocess, print, write all files |
| Compiler | Orchestrate pipeline |
Compilation Loop
Section titled “Compilation Loop”class Compiler { async compile(): Promise<Map<string, FileIR>> { await this.#program.discover() await this.#sourceFiles.loadSource() this.#sourceFiles.clearGenerated()
const irs = new Map<string, FileIR>() for (const sourceFile of this.#sourceFiles.getAll().values()) { const ir = await this.#fileProcessor.process(sourceFile) if (ir) irs.set(sourceFile.fileName, ir) }
await this.#plugins.runGenerators(irs) await this.#plugins.runDerivatives(irs) await this.#fileWriter.writeEverything()
return irs }}Key Details
Section titled “Key Details”Program – Discovers and validates input. See Compilation Phases.
SourceFiles – Central registry. See File Management.
FileProcessor – Builds FileIR for one source file, dispatches to transformers.
IRRI – Tracks all IRefs by kind. See IRRI & IRRef.
Transformers – Update AST from IR state. Examples: ComponentTransformer, PropertyTransformer.
Plugins – Listen via handle() method. Generators create global files; derivatives create per-file adapters.
FileWriter – Single pass: preprocess → print → postprocess → write. See Symbol Resolution.
All services use Dependency Injection for singleton pattern and automatic wiring.