API
Function-level reference for Telarel in JavaScript and Rust.
Shared pipeline
Telarel exposes almost same compiler pipeline through a JavaScript package and a Rust crate.
- JavaScript API — the
telarelpackage, with TypeScript types. Backed by a NAPI binding to the Rust core. - Rust API — the
telarelcrate, re-exporting the public facing API.
Both expose the same pipeline entry functions. Each call takes the source (text or an owned AST), an options value, and a list of plugins, and returns either an AST result or a code result with an optional source map.
Both also expose builtin constructors that bypass the plugin chain: createParser and createGenerator in JavaScript, and Parser and Generator in Rust. Use them inside hooks to delegate to the builtin stage, or directly when plugins are not needed.
They also share the same plugin interface. See the Plugin API for the hook semantics, and the JavaScript and Rust pages for the language-specific surface.
Options
Every pipeline entry function accepts the options relevant to the stages it runs. Those options are optional; omitted values are resolved against defaults before the pipeline starts. The builtin constructors instead take fully resolved options. See each page for the exact fields it accepts.
Results
- AST result — the parsed or rewritten AST together with the source text its spans anchor to, and an optional source map.
- Code result — the generated code and an optional source map.
See the individual function pages for the exact shapes.
Types and errors
| Type | Description | Reference |
|---|---|---|
Ast | A program, its source text, language metadata, and an optional input source map. | JavaScript, Rust |
ErrorSource | A source location made of a file, its source text, and a span within it. | JavaScript, Rust |
PluginError | An error reported by a plugin hook, with an optional source location. | JavaScript, Rust |
CompileError | An entry-point failure with an optional source location. | JavaScript, Rust |
Last updated on
Copyright © 2026, Alpheus