Skip to content

[wrangler] Add cf-wrangler delegate entrypoint; remove @cloudflare/wrangler-bundler#14184

Merged
penalosa merged 6 commits into
mainfrom
penalosa/cf-wrangler
Jun 10, 2026
Merged

[wrangler] Add cf-wrangler delegate entrypoint; remove @cloudflare/wrangler-bundler#14184
penalosa merged 6 commits into
mainfrom
penalosa/cf-wrangler

Conversation

@penalosa

@penalosa penalosa commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Adds an experimental cf-wrangler delegate entrypoint to wrangler and removes the separate @cloudflare/wrangler-bundler package, which it replaces.

cf-wrangler dev is spawned by Cloudflare's "cf-dev" parent process for projects that can't use @cloudflare/vite-plugin (service workers, old compatibility dates, Python, Rust, etc.). It sits directly on wrangler's internal startDev — the exact function wrangler dev runs — so bundling and runtime behaviour are identical to wrangler dev, with no unstable_dev test-harness defaults to keep in sync.

  • The cf-wrangler bin calls runCfWrangler (exported from the existing wrangler-dist/cli.js bundle) in-process — no re-spawn, no Node version check (the parent tool owns the Node runtime) — so it reaches the internal startDev without a second build artifact.
  • Narrow, stable spawn contract: a single dev verb + four flags (--mode, --port, --host, --local); the wrangler config file is found via wrangler's standard discovery. Unknown verbs/flags exit 2 (the parent's feature-detection signal).
  • Drops the --config flag from both cf-wrangler and the sibling cf-vite delegate (in @cloudflare/vite-plugin) so the shared spawn contract stays in sync; config is now found via discovery on both sides.
  • Removes the published @cloudflare/wrangler-bundler package — it was a thin unstable_dev shim that cf-wrangler supersedes.

How the old package maps to this change

The standalone @cloudflare/wrangler-bundler is deleted; its logic moves into packages/wrangler/src/cf-wrangler/. Git only detects some of these as renames because the dev runner was rewritten:

Old (packages/wrangler-bundler/) New (packages/wrangler/) Relationship
src/args.ts src/cf-wrangler/args.ts moved (now 4 flags, no --config)
src/__tests__/args.test.ts src/__tests__/cf-wrangler/args.test.ts moved
src/cli.ts (runDev via unstable_dev) src/cf-wrangler/dev.ts (runDev via startDev) rewritten
src/index.ts (re-exports) src/cf-wrangler/index.ts (runCfWrangler verb dispatch) rewritten
bin/cf-wrangler bin/cf-wrangler.js rewritten (in-process shim that calls cli.js's runCfWrangler)

Note: the already-published @cloudflare/wrangler-bundler@0.1.2 should be npm deprecated separately (removing it from the repo only stops future releases).

Validated locally: type-check (0 errors), lint, 21 unit tests, and an end-to-end smoke test (boots via startDev, serves 200, tears down on signal; config discovery works with no --config).


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: cf-wrangler and cf-vite are experimental, internal delegate binaries spawned by Cloudflare tooling — not part of any package's public API and not intended for direct end-user invocation.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4579602

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@cloudflare/vite-plugin Patch
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Jun 4, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14184

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14184

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14184

miniflare

npm i https://pkg.pr.new/miniflare@14184

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14184

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14184

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14184

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14184

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14184

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14184

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14184

wrangler

npm i https://pkg.pr.new/wrangler@14184

commit: 4579602

@penalosa penalosa force-pushed the penalosa/cf-wrangler branch from 7fcd717 to 1a24d09 Compare June 4, 2026 17:35
@ask-bonk

ask-bonk Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@penalosa Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@penalosa penalosa force-pushed the penalosa/cf-wrangler branch from 1a24d09 to a88b1ef Compare June 4, 2026 17:55
Comment thread .changeset/cf-vite-drop-config-flag.md Outdated
Comment thread .changeset/cf-wrangler-delegate-entrypoint.md Outdated
Comment thread packages/vite-plugin-cloudflare/src/cf-vite.ts Outdated
Comment thread packages/wrangler/bin/cf-wrangler.js Outdated
@penalosa penalosa force-pushed the penalosa/cf-wrangler branch from a88b1ef to a88656a Compare June 9, 2026 17:15
@penalosa penalosa marked this pull request as ready for review June 9, 2026 17:34
@penalosa penalosa requested a review from workers-devprod as a code owner June 9, 2026 17:34
@workers-devprod workers-devprod requested review from a team and dario-piotrowicz and removed request for a team June 9, 2026 17:34
@workers-devprod

workers-devprod commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread .changeset/cf-wrangler-delegate-entrypoint.md Outdated
penalosa added 4 commits June 10, 2026 14:02
…angler-bundler

Adds an experimental cf-wrangler delegate binary to wrangler, backed directly by the internal startDev (the same function wrangler dev runs) for 1:1 parity, reusing the existing cli.js bundle via CF_WRANGLER_BUNDLER=1. Replaces and removes the separate @cloudflare/wrangler-bundler package. Drops the --config flag from both the cf-wrangler and cf-vite delegates so the wrangler config is found via discovery, keeping the shared spawn contract in sync.

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jun 10, 2026
Co-authored-by: emily-shen <69125074+emily-shen@users.noreply.github.com>
@penalosa penalosa force-pushed the penalosa/cf-wrangler branch from 34a8c2e to 73f722c Compare June 10, 2026 13:04
@penalosa penalosa enabled auto-merge (squash) June 10, 2026 13:05
devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/wrangler/src/cf-wrangler/dev.ts
@penalosa penalosa merged commit e305126 into main Jun 10, 2026
70 of 71 checks passed
@penalosa penalosa deleted the penalosa/cf-wrangler branch June 10, 2026 14:34
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants