Make Cloudflare bindings extensible - #6954
Open
c-w-xiaohei wants to merge 2 commits into
Open
Conversation
c-w-xiaohei
force-pushed
the
refactor/cloudflare-extandable
branch
from
July 27, 2026 09:59
4ad82f2 to
939d0b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #6941.
This removes SST's closed, centrally maintained Cloudflare binding model and lets each Cloudflare resource declare its production binding, Wrangler development configuration, and runtime TypeScript type independently.
The production binding helper now accepts the provider-shaped
WorkersScriptBindinginput directly. SST adds the final binding name but otherwise leaves provider fields untouched, allowing bindings supported by the Cloudflare provider to be used without first adding another SST binding-kind mapping.Existing SST binding inputs remain supported and are normalized to the provider shape, so current applications do not need to migrate immediately.
What changed
CloudflareComponentbase class that assembles the production Worker binding, Wrangler development configuration, and runtime TypeScript type.sst.cloudflare.binding()to accept provider-shaped Worker binding inputs.propertiesshape.typescript.typeinclude instead of deriving types from Cloudflare binding names.Compatibility
Existing inputs continue to work:
They are normalized to the provider shape:
New code can use the provider shape directly:
Both forms produce the same production Worker binding after SST assigns the final link name.
Extension example
A custom Cloudflare component can now provide all three projections without adding an SST union member, Worker switch, Wrangler mapping, or Go type mapping:
Design boundaries
cloudflare.bindingdescribes only the production Worker binding.cloudflare.devis consumed only by the Wrangler development path.typescript.typeis consumed only by typegen.Link.Definition.Verification
Passed:
bunx vitest run test/components/cloudflare(94 tests)bunx tsc --noEmit --pretty falsebun run build:platform