Expand description
bynk dev — build a project and serve it locally in one step.
Collapses the manual recipe (compile → cd into the generated worker dir →
wrangler dev) into a single command (proposal v0.57). The orchestration is
pre-flight → compile → select → serve, and almost every piece is reused:
compiler::resolve for bynkc, the doctor Deploy
capability for the Node + wrangler gate, and probe for locating
wrangler with the same provenance ordering doctor reports.
The serve step runs wrangler dev in local mode (Miniflare), which
simulates KV / Durable Objects / queues keyed by binding name — so no
namespace provisioning is needed and the generated wrangler.toml is served
untouched (proposal §1, D4). Everything wrangler-specific is encapsulated
here so the serve step can later be swapped for a first-party workerd
server without touching the rest (proposal §4).
Since #552 the step is one wrangler dev per context, not one per
project: the processes discover each other through wrangler’s dev registry
and wire the emitted [[services]] bindings between themselves, so a
cross-context call resolves locally. That makes the driver a supervisor of N
children rather than a hand-off to one — hence the port allocation
(allocate), the joint teardown (terminate, private), and the plural
selection rule (select_contexts) that replaced ADR 0096 D3’s ambiguity
error.
Re-exports§
pub use crate::workers::SelectError;pub use crate::workers::compile_once;pub use crate::workers::discover_workers;pub use crate::workers::prepare_build_dir;pub use crate::workers::select_contexts;pub use crate::workers::wrangler_command;
Structs§
- DevOptions
- Parsed
bynk devflags (the projectPATHis resolved intoproject_rootbefore we get here). - Serving
- One worker to serve: its dasherised context dir, its HTTP port (
None= let wrangler choose, the lone-worker default), and its inspector port.
Functions§
- allocate
- Allocate a port per worker (#552):
wrangler devbinds one port per process, so serving N contexts means N distinct ports, assignedbase + iover the deterministic worker order. - preflight_
failure_ message - The text
bynk devprints when the deploy pre-flight fails: a lead line plus doctor’s own human report, so the remedy lines are identical tobynk doctor. Pure (no I/O) so this deterministic surface is pinned by a golden (§5), unlike the non-deterministicwrangler devstream. - run
- Orchestrate a local dev session: pre-flight, compile, select the worker, and
hand off to
wrangler dev. Returns wrangler’s own exit code on a clean hand-off, or a pre-flight/build failure code before serving. - serving_
report - The start-up report: which context answers on which URL, plus the inspector
notice under
--inspect. Pure and deterministic, so it is golden-pinned in the style of ADR 0096 §Exit — unlike thewrangler devstreams it precedes.