bynk_ts/lib.rs
1//! The TypeScript tree and printer (phase 7 of the compiler trajectory,
2//! `design/bynk-compiler-trajectory.md`). Emission produces nodes
3//! ([`TsProgram`]/[`TsStmt`]); [`printer::print`] is the only code in the
4//! compiler that writes a character (R7.3).
5//!
6//! **Invariant:** this crate depends on `bynk-syntax` **only** (for
7//! [`bynk_syntax::span::Span`], reused unchanged rather than redefined —
8//! `bynk-emit`'s own `TypeRef`/`Ir`
9//! machinery is not visible here, and never will be: a function taking one
10//! would not compile, the dependency isn't present, by design). `cargo tree
11//! -p bynk-ts` shows `bynk-syntax` and nothing else. Matches the same
12//! load-bearing shape `bynk-render`'s own module doc states for itself
13//! (`bynk-render/src/lib.rs`).
14//!
15//! **What exists here today (P7.5, #1307 → P7.8, #1313).** The reference's
16//! own §7.1 sketch names four tree enums (`TsStmt`/`TsExpr`/`TsType`/
17//! `TsDecl`) with real variants (`Const`, `Let`, `Binary`, `Named`, `Class`,
18//! …), but only as a variant-name list, not a field-level design. P7.5
19//! built only [`TsStmt`]'s `Verbatim` escape hatch ([`VerbatimOrigin`]-
20//! tagged text, Q2, `design/tracks/the-typescript-tree.md` §3.2). P7.8
21//! (#1313) adds the rest — [`TsExpr`]/[`TsType`]/[`TsDecl`], plus real
22//! `TsStmt` kinds — but not the sketch's full variant list: only what
23//! `bynk-emit/src/emitter/events_fanout.rs` (Arc C's real next file —
24//! P7.8's own accepted proposal corrected the track doc's stale schedule,
25//! `design/tracks/the-typescript-tree.md` §6/§9) concretely needs, grounded
26//! against that file's own real shape. `bynk-emit` still builds no
27//! [`TsProgram`] beyond `Verbatim` — Arc C's own first slice is what starts
28//! converting real emission into real nodes, file by file; this crate
29//! exists so that conversion has somewhere to land, following R10.3's own
30//! "carve prospectively, at the moment the dependency appears" precedent
31//! (`bynk-strip`'s own carve is the control case cited for this).
32
33mod lint;
34mod printer;
35mod program;
36mod source_map;
37
38pub use lint::{Violation, verbatim_violations};
39pub use printer::{
40 Printed, print, print_class_method, print_class_method_and_merge, print_expr,
41 print_object_entry, print_object_entry_and_merge, print_stmt, print_stmt_and_merge, print_type,
42};
43pub use program::{
44 TsArrowBody, TsBinaryOp, TsBindingName, TsClassCtor, TsClassField, TsClassMethod, TsDecl,
45 TsExpr, TsLit, TsObjectEntry, TsParam, TsProgram, TsStmt, TsSwitchCase, TsType, TsTypeMember,
46 TsUnaryOp, VerbatimOrigin,
47};
48pub use source_map::SourceMapBuilder;