Skip to main content

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_compiled_file` 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_compiled_file` resolve unchanged.
21pub use bynk_driver::{write_compiled_file, write_output};
22
23// R10.4 residue (#1048, ADR 0312's reasoning applied to the three re-exports
24// T-D1 didn't scope): `bynk_driver::{coverage, test_json}`,
25// `bynk_syntax::{ast, diagnostics, error, keywords, lexer, parser, span}` and
26// `bynk_fmt as fmt` were whole-module/whole-crate re-exports with no in-repo
27// consumer besides `bynkc`'s own integration tests, which now import
28// `bynk_syntax`/`bynk_driver`/`bynk_fmt` directly — the correct import in any
29// case, same as T-D1. `CompileError` stays: `compile`/`compile_with_warnings`
30// below return it, so it is genuinely part of the published API.
31pub use bynk_syntax::CompileError;
32pub use bynk_syntax::error::Severity;
33
34// The diagnostic renderers moved down into the `bynk-render` crate (slice 6):
35// ariadne human + the short/json line forms over `CompileError`. Re-export them
36// so `bynkc`'s binary, the diagnostic transcripts, and the tests resolve
37// unchanged. The `ProjectFailure` flatteners (below) stay here and delegate.
38pub use bynk_render::{
39    print_errors, print_errors_short, print_project_errors, render_errors, render_errors_plain,
40    render_errors_short, render_project_errors,
41};
42
43pub use bynk_check::firstparty::Platform;
44
45// The Node floor moved to `bynk-emit` (slice 7) so the `bynk` driver can read it
46// without depending on the `bynkc` crate. Re-export it so `bynkc::NODE_MAJOR_FLOOR`
47// and the `cli.rs` doc-links resolve unchanged.
48pub use bynk_emit::project::{
49    AttributedError, BuildTarget, CompileOptions, CompiledFile, DiscoveredCase, DiscoveredSuite,
50    ImportExt, ProjectFailure, ProjectOutput, ProjectPaths, ProjectPathsError, Roots, SchemaLock,
51    TestLocation, compile_project, try_read_project_paths,
52};
53pub use bynk_emit::{Compiled, NODE_MAJOR_FLOOR, compile, compile_with_warnings};
54
55// In-browser track (ADR 0137): strip-only TS→JS, re-exported so the CLI, the API,
56// and tests share one entry point. `strip_project_to_js` moved into `bynk-strip`
57// in slice 3 so the wasm entry can reuse it without depending on `bynkc`.
58pub use bynk_strip::{StripError, strip_project_to_js, strip_types};
59
60/// v0.24 (ADR 0052 rider) / ADR 0100: the project-failure flattening layer.
61/// #521: the implementation is shared with the `bynk` driver in
62/// [`bynk_driver`]; these re-exports keep `bynkc`'s public API (and its
63/// callers) unchanged.
64pub use bynk_driver::{
65    ProjectOptionsError, print_project_failure, print_project_failure_short,
66    print_project_warnings, project_failure_short_lines,
67};