Expand description
Bynk’s TypeScript emission, plus the per-unit build sequencing that drives
it — the layer above bynk-project (discovery, the dependency graph),
bynk-check (all semantic checking, R3.5), and (since the P7.12 crate
carve) bynk-ir/bynk-lower (the typed IR and its &CheckedProgram → Ir
lowering pass).
project owns compile_project/run_checks: the two-pass sequence over
a project’s units — discover and parse (bynk-project), then resolve,
type-check (bynk-check) and emit each unit with full visibility of what
it uses/consumes. emitter lowers a checked program to TypeScript.
Input: a project tree (or an in-memory overlay). Output: TypeScript files
plus diagnostics — this crate originates none of its own (P5.5,
design/tracks/semantics-in-the-checker.md §3.5, R10.1).
Extracted from bynkc as slice 4 of the crate-decomposition track over
bynk-syntax + bynk-check. Behaviour is unchanged; bynkc depends on this
crate and re-exports its modules so its public API (compile_project,
ProjectOutput, …) and the binary are untouched.
Re-exports§
pub use emitter::wrangler::COMPATIBILITY_DATE;pub use emitter::wrangler::DEFAULT_COMPATIBILITY_FLAGS;pub use emitter::wrangler::WRANGLER_MIN;pub use emitter::wrangler::compatibility_flags;
Modules§
- emitter
- TypeScript emission (spec §7, v0.1 §6, v0.2 §6).
- project
- Multi-file project compilation (v0.3 §3.2 and §3.3, v0.4 §3.5).
- wire_
format - State-migrations S4 (#2259): the call signature and the sweep route’s
names, for
bynk migrate sweep, which signs as the runtime verifies. #1969: the cross-context wire format, version 1, as a published surface.
Structs§
- Compiled
- A single-file compile that also returns the non-failing warnings produced on
success — what a CLI prints (v0.89, ADR 0117).
compileis the warning-discarding convenience over this.
Constants§
- EDGE_
FROM_ PREFIX - I2 (#1971): the edge keys’ names, for the driver (
bynk dev,bynk deploy), which sees the compiler only through this crate. I2 (#1971): the secret a callee holds for the edge from one caller,edge_key_from. - EDGE_
TO_ PREFIX - I2 (#1971): the edge keys’ names, for the driver (
bynk dev,bynk deploy), which sees the compiler only through this crate. I2 (#1971): the secret a caller holds for the edge to one callee,edge_key_to. - LOCAL_
CALL_ KEY - I2 (#1971): the value of every edge key off the deployed path.
bynk devpasses it for each edge a Worker is on (BYNK_CALL_TO_<callee>,BYNK_CALL_FROM_<caller>, named bybynk_check::wire_format), and the generated test harnesses put it in every participant’senv. Fixed rather than random so twobynk dev --contextsessions run side by side still admit each other’s calls. It guards nothing, so it must never reach a deployed Worker:bynk deploymints one key per edge, and none is ever written into a generatedwrangler.toml. - NODE_
MAJOR_ FLOOR - Minimum supported Node.js major version for the
nodeplatform binding and for running Bynk’s emitted TypeScript. - TYPESCRIPT_
MAJOR_ FLOOR - #1672: the oldest TypeScript major the emitted output is verified against.
CI type-checks every positive fixture under it (
tsc_verify, withtypescript@5installed on every test leg). - TYPESCRIPT_
MAJOR_ TESTED - #1672: the newest TypeScript major the emitted output is verified against —
the one users get from
npm install -g typescript. CI type-checks every positive fixture under it too (a secondtsc_verifypass on the Linux leg), thenpxfallbacks provision it, andbynk doctorreports atscnewer than it as untested.
Functions§
- check_
with_ warnings - Check a single-file commons without building it: the same diagnostics as
compile_with_warnings, minus the build-only ones, and no emission. Returns the non-failing warnings on success. The single-file half ofbynk check/bynkc check(bynk_driver::run_check); a directory goes through the project pipeline inMode::Checkinstead. - compile
- Compile a single Bynk source string to a TypeScript string.
- compile_
with_ warnings - The warning-preserving single-file compile behind
compile. SeeCompiled. - edge_
key_ from - I2 (#1971): the edge keys’ names, for the driver (
bynk dev,bynk deploy), which sees the compiler only through this crate. I2 (#1971): the secret the callee holds for calls fromcaller(BYNK_CALL_FROM_SHOP__ORDERS). The callee picks it by the request’sCALLER_HEADER, so an undeclared caller finds no key and is refused. - edge_
key_ to - I2 (#1971): the edge keys’ names, for the driver (
bynk dev,bynk deploy), which sees the compiler only through this crate. I2 (#1971): the secret the caller holds for calls tocallee(BYNK_CALL_TO_SHOP__PAYMENT). Same value as the callee’sedge_key_fromfor the same edge.