Skip to main content

Module dev

Module dev 

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

Structs§

DevOptions
Parsed bynk dev flags (the project PATH is resolved into project_root before we get here).

Enums§

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

Functions§

preflight_failure_message
The text bynk dev prints when the deploy pre-flight fails: a lead line plus doctor’s own human report, so the remedy lines are identical to bynk doctor. Pure (no I/O) so this deterministic surface is pinned by a golden (§5), unlike the non-deterministic wrangler dev stream.
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.
select_context
Pick the worker dir to serve. Pure (the FS scan is done by the caller) so the select-or-default rule (D3) is unit-tested directly.