bynkc/lib.rs
1//! Bynk v0.3 compiler library.
2//!
3//! Compiles `.bynk` commons source into TypeScript modules.
4//!
5//! Pipeline: lex → parse → resolve → check → emit.
6//!
7//! v0.3 introduces multi-file commons and the `uses` mechanism. A "project"
8//! is a directory containing one or more commons; a commons is either a
9//! single `.bynk` file or a directory of `.bynk` files that share a
10//! `commons name` header. See [`compile_project`].
11//!
12//! The single-string entrypoint [`compile`] remains for v0–v0.2 fixtures
13//! and any single-file commons that does not declare `uses` against another
14//! commons.
15
16pub mod cli;
17
18// `write_output`/`write_document` moved down into `bynk-driver` (#1047,
19// R2.3/T0.7 residue) — every caller was already at driver level. Re-exported
20// here so `bynkc::write_output`/`bynkc::write_document` resolve. (`write_document`
21// was `write_compiled_file` until P7.6, #1309/#1310 — renamed once `CompiledFile`
22// itself was gone, so the name it takes now, `Document`, stayed true.)
23pub use bynk_driver::{write_document, write_output};
24
25// R10.4 residue (#1048, ADR 0312's reasoning applied to the three re-exports
26// T-D1 didn't scope): `bynk_driver::{coverage, test_json}`,
27// `bynk_syntax::{ast, diagnostics, error, keywords, lexer, parser, span}` and
28// `bynk_fmt as fmt` were whole-module/whole-crate re-exports with no in-repo
29// consumer besides `bynkc`'s own integration tests, which now import
30// `bynk_syntax`/`bynk_driver`/`bynk_fmt` directly — the correct import in any
31// case, same as T-D1. `CompileError` stays: `compile`/`compile_with_warnings`
32// below return it, so it is genuinely part of the published API.
33pub use bynk_syntax::CompileError;
34pub use bynk_syntax::error::Severity;
35
36// The diagnostic renderers moved down into the `bynk-render` crate (slice 6):
37// ariadne human + the short/json line forms over `CompileError`. Re-export them
38// so `bynkc`'s binary, the diagnostic transcripts, and the tests resolve
39// unchanged. The `ProjectFailure` flatteners (below) stay here and delegate.
40pub use bynk_render::{
41 print_errors, print_errors_short, print_project_errors, render_errors, render_errors_plain,
42 render_errors_short, render_project_errors,
43};
44
45pub use bynk_check::firstparty::Platform;
46
47// The Node floor moved to `bynk-emit` (slice 7) so the `bynk` driver can read it
48// without depending on the `bynkc` crate. Re-export it so `bynkc::NODE_MAJOR_FLOOR`
49// and the `cli.rs` doc-links resolve unchanged.
50pub use bynk_emit::project::{
51 Artefacts, AttributedError, BuildTarget, CompileOptions, DiscoveredCase, DiscoveredSuite,
52 Document, ImportExt, ProjectFailure, ProjectOutput, ProjectPaths, ProjectPathsError, Roots,
53 SchemaLock, TestLocation, compile_project, sibling_path, try_read_project_paths,
54};
55pub use bynk_emit::{Compiled, NODE_MAJOR_FLOOR, compile, compile_with_warnings};
56
57// In-browser track (ADR 0137): strip-only TS→JS, re-exported so the CLI, the API,
58// and tests share one entry point. `strip_project_to_js` moved into `bynk-strip`
59// in slice 3 so the wasm entry can reuse it without depending on `bynkc`.
60pub use bynk_strip::{StripError, strip_project_to_js, strip_types};
61
62/// v0.24 (ADR 0052 rider) / ADR 0100: the project-failure flattening layer.
63/// #521: the implementation is shared with the `bynk` driver in
64/// [`bynk_driver`]; these re-exports keep `bynkc`'s public API (and its
65/// callers) unchanged.
66pub use bynk_driver::{
67 ProjectOptionsError, print_project_failure, print_project_failure_short,
68 print_project_warnings, project_failure_short_lines,
69};