-
Notifications
You must be signed in to change notification settings - Fork 702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add bindingNames
to getPlatformProxy
result
#5229
base: main
Are you sure you want to change the base?
Conversation
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-wrangler-5229 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5229/npm-package-wrangler-5229 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-wrangler-5229 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-create-cloudflare-5229 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-cloudflare-kv-asset-handler-5229 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-miniflare-5229 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-cloudflare-pages-shared-5229 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8300311688/npm-package-cloudflare-vitest-pool-workers-5229 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5229 +/- ##
==========================================
+ Coverage 70.47% 71.27% +0.79%
==========================================
Files 298 311 +13
Lines 15539 16156 +617
Branches 3999 4121 +122
==========================================
+ Hits 10951 11515 +564
- Misses 4588 4641 +53
|
6bb9669
to
8ff4604
Compare
@dario-piotrowicz thanks for letting me know of this PR. Just want to give some insights from Astro's side. We would love to see this introduced to the API. We are currently building a DevToolbarApp, which will allow users to interact with the bindings directly from the browser without going back to the terminal, this is a significant improvement in DX. Currently there is no way for us to know which binding is of which type. We would love to know which bindings are of a specific type. We also believe this feature could be useful for other frameworks and users, even if they don't have it requested yet. I'm happy to discuss this further in any of our dedicated communication channels, just let me know! |
What this PR solves / how to test
This PR adds a new
bindingNames
field in thegetPlatformProxy
result that users can use to get the names of their bindings grouped by type.For example they can use it to get all the bindings of a specific type in the following way:
Notes:
getPlatformProxy
utility, but in the future if beneficial it could be exposed to users as a generic (also usable in workerd) utility?bindingNames
which only returns the names because I found this to be the simplest/cleanestway not to have issues with types, alternatively I could have had something like
bindingsByType
orgroupedEnv
,etc... but with such solutions they binding types would come from a specific
@cloudflare/workers-types
entrypointwhich might not be what the user wants/expects...
fixes #4792
Author has addressed the following