1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! `ts-gen`: Generate `wasm-bindgen` Rust bindings from TypeScript `.d.ts` files.
//!
//! This crate provides both a library API and a CLI tool for converting
//! TypeScript declaration files into Rust `#[wasm_bindgen]` extern blocks.
//!
//! # Pipeline
//!
//! ```text
//! .d.ts files
//! → oxc_parser (AST)
//! → First Pass phase 1: collect all type names into TypeRegistry
//! → First Pass phase 2: populate full IR (resolve references, merge var+interface patterns)
//! → Assembly: group by ModuleContext, resolve inheritance chains, classify types
//! → Code Generation: IR → syn::File → prettyplease → .rs files
//! ```
use Path;
use Result;
use crateGlobalContext;
/// Parse `.d.ts` files and return the module + global context.
///
/// Diagnostics are collected on `GlobalContext.diagnostics` — callers should
/// inspect or display them as needed (e.g., `ctx.diagnostics.emit()`).
///
/// External type mappings can be configured on the returned `GlobalContext`
/// before passing it to `codegen::generate`.
/// Parse a single `.d.ts` source string and return the module + global context.
///
/// Diagnostics are collected on `GlobalContext.diagnostics` — callers should
/// inspect or display them as needed (e.g., `ctx.diagnostics.emit()`).