Skip to main content

Module workers

Module workers 

Source
Expand description

Shared Workers-build plumbing for bynk dev and bynk deploy.

Both commands do the same four things before they diverge: prepare a managed build directory, compile the project into it, discover the worker directories that came out, and shell wrangler. That machinery grew up inside dev.rs and deploy.rs reached across for it, which left dev reading as deploy’s utility library. It lives here instead — a sibling of both, owned by neither.

Structs§

Build
How a build is made: whether it reconciles bynk.schema.lock, whether it only reports what a deploy would do (--dry-run), which never installs, and whether a missing npm package stops it instead of being installed (#3350).
ScratchBuildDir
#3796: where a bynk deploy --dry-run builds: a fresh directory under the system’s temporary directory, removed when this is dropped, so previewing a deploy leaves the project as it found it.

Enums§

SelectError
Why context selection failed — rendered to the user with the next step.

Functions§

compile_built
compile_once_reporting, handing back the binding model the build wrote its Workers from (1C.3a, #4040), or None when the build failed (already reported). The commands that act on a Worker’s bindings read this rather than reading them back out of the files.
compile_once
One compile of the project into build_dir, in-process, on the same rooting rule as bynk compile <project_root> (#524, via bynk_driver::project_options). Returns false on failure with the diagnostics already rendered.
compile_once_reporting
compile_once, reporting each context to progress as it compiles (#3100).
discover_workers
The worker directories under <build>/workers/ that carry a wrangler.toml (the unit wrangler dev can serve), sorted for deterministic messages.
prepare_build_dir
Ensure .bynk/ is gitignored on first build (cargo’s target/.gitignore precedent — a dev run never dirties git status), then clear the workers/ tree so selection only ever sees this build’s contexts (D1).
select_contexts
Pick the workers dev will serve together (#552). No --context serves every context in the project — the whole point of the increment, since a cross-context call only resolves when its callee is up too. --context is repeatable and narrows to a subset, in available’s deterministic order rather than the order they were typed, and duplicates collapse.