Skip to main content

Crate bynk_emit

Crate bynk_emit 

Source
Expand description

Bynk’s build orchestration and TypeScript emission — the layer above bynk-check.

project is the build driver: it conducts discovery, the dependency graph, consistency, validation, symbols, and paths, and owns compile_project. emitter lowers a checked program to TypeScript. Read the crate as “build orchestration + TS emission” — orchestration drives emission.

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.

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).

Constants§

NODE_MAJOR_FLOOR
Minimum supported Node.js major version for the node platform binding and for running Bynk’s emitted TypeScript.

Functions§

write_compiled_file
Write a single CompiledFile under dir, map-aware: a .bynk-sourced file gets a sibling .ts.map and a //# sourceMappingURL trailer (slice 1, ADR 0103); a file with no map is written verbatim. Shared by write_output and bynkc test’s output loops, so every disk-writing path emits maps uniformly (slice 2 — bynkc test --inspect runs the emitted .ts directly and needs the maps on disk). The trailer lives only on the on-disk artefact; the in-memory file.typescript stays trailer-free, so golden comparisons are unaffected. The map name appends .map to the output file name.
write_output
Write a ProjectOutput’s files under dir, creating parent directories as needed. The shared writer behind both bynkc’s compile/test paths and bynk dev’s in-process build (slice 7) — so the on-disk result is identical however the build was driven.