Skip to main content

Module output

Module output 

Source
Expand description

Writing a compiled project’s output to disk.

Moved down from bynk-emit (#1047, R2.3/T0.7 residue): every caller was already at driver level (bynkc’s CLI/test paths, bynk dev’s in-process build) — bynk-emit never called this itself, so relocating it here is a pure move, not a design change. bynk-emit stays a pure, in-memory library; disk writes are the driver’s job, as R2.3 says they should be.

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.