Skip to content

[remote-bindings] Extract remote bindings package#14651

Draft
penalosa wants to merge 1 commit into
penalosa/remote-bindings-extraction-take-3from
penalosa/remote-bindings-on-auth
Draft

[remote-bindings] Extract remote bindings package#14651
penalosa wants to merge 1 commit into
penalosa/remote-bindings-extraction-take-3from
penalosa/remote-bindings-on-auth

Conversation

@penalosa

Copy link
Copy Markdown
Contributor

Extracts Wrangler's remote-binding session and shared DevEnv machinery into a new @cloudflare/remote-bindings package, so Vite and Vitest Pool can use remote bindings without going through Wrangler internals.

This PR is stacked on #14630.

The new package owns:

  • remote proxy session lifecycle
  • auth product selection for Wrangler vs cf JSON auth
  • the host-agnostic DevEnv controller kernel
  • embedded proxy Worker templates

Wrangler keeps thin adapters for Wrangler-specific config, bundling, local runtime, logging, preview upload handling, and inspector integration. @cloudflare/vite-plugin and @cloudflare/vitest-pool-workers now consume @cloudflare/remote-bindings directly for remote-binding sessions.


  • 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: this is an internal restructure of local dev implementation; the new package README documents the package boundary, and there is no user-facing docs change.

Validated locally with:

  • pnpm --filter @cloudflare/remote-bindings check:type
  • pnpm --filter @cloudflare/remote-bindings test:ci
  • pnpm --filter wrangler check:type
  • pnpm --filter @cloudflare/vite-plugin check:type
  • pnpm --filter @cloudflare/vitest-pool-workers check:type
  • pnpm check:catalog
  • pnpm check:pinned-deps
  • pnpm check:package-deps
  • pnpm check:format
  • pnpm check:lint
  • pnpm check:private-packages
  • pnpm -w test:ci -F wrangler -- ConfigController.test.ts DevEnv.test.ts LocalRuntimeController.test.ts MultiworkerRuntimeController.test.ts RemoteRuntimeController.test.ts utils.test.ts remote-bindings.test.ts remote-bindings-errors.test.ts dev.test.ts print-bindings.test.ts

Credentialed remote-binding E2Es have not been run.

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 14afe21

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

This PR includes changesets to release 9 packages
Name Type
@cloudflare/remote-bindings Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
@cloudflare/workers-utils Patch
wrangler Patch
@cloudflare/autoconfig Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/workers-auth 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

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/autoconfig@14651

create-cloudflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/create-cloudflare@14651

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/deploy-helpers@14651

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/kv-asset-handler@14651

miniflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/miniflare@14651

@cloudflare/pages-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/pages-shared@14651

@cloudflare/remote-bindings

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/remote-bindings@14651

@cloudflare/unenv-preset

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/unenv-preset@14651

@cloudflare/vite-plugin

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vite-plugin@14651

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

npm i https://pkg.pr.new/cloudflare/workers-sdk/wrangler@14651

commit: 14afe21

@ask-bonk

ask-bonk Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The new package Bundle type declares dependencies: Record<string, { bytesInOutput: number }> while EsbuildBundle uses dependencies: Metafile["outputs"][string]["inputs"]. Metafile["outputs"][string]["inputs"] is { [path: string]: { bytesInOutput: number } } — structurally identical. So they're compatible. The PR author validated with check:type on wrangler, so this holds.

This is a clean, well-tested internal refactor. All the substantive changes I've examined are faithful extractions:

  • DevEnv error handling correctly moved to WranglerDevEnv
  • RemoteRuntimeController abstracted via context, Wrangler adapter preserves realishPrintLogs/TRACE_VERSION
  • ProxyController logger prefix logic preserved in WranglerProxyController
  • InspectorProxyWorker only import-path + lint changes
  • The removed wrangler error test has equivalent coverage in the new package's start-remote-proxy-session.test.ts
  • vitest-pool binding conversion preserves usePreviewIds: true
  • Type changes are structurally compatible

I found no logic bugs, security issues, backward-compat violations, or incorrect API behavior. The minor logger-defaulting difference in the vite-plugin path (console vs wrangler logger) is cosmetic and not actionable.

LGTM

github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants