Skip to content

Conversation

@eastlondoner
Copy link
Contributor

@eastlondoner eastlondoner commented Apr 4, 2025

I created this based on some DMs with Cloudflare Team members. Apologies for not creating an issue or discussion.

what this does

If extra wrangler configs are provided to wrangler types as:

wrangler types --service-config path/to/worker-a/wrangler.toml --service-config path/to/worker-b/wrangler.toml

This will use those to find the type definitions for the bound service, matching on the service name where it exists.

I took inspiration from the wrangler dev command which already allows passing in multiple wrangler files to then determine the locations of the implementations of each of the bound services on Env.

and I took inspiration from the DurableObject binding code already in the type generation

image

Now my generated types have all the correct methods attached.


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: covered by unit tests
  • Public documentation
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: not a patch change

@eastlondoner eastlondoner requested a review from a team as a code owner April 4, 2025 19:41
@changeset-bot
Copy link

changeset-bot bot commented Apr 4, 2025

🦋 Changeset detected

Latest commit: 554116d

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

This PR includes changesets to release 2 packages
Name Type
wrangler Minor
@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-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Apr 5, 2025
@petebacondarwin petebacondarwin added the enhancement New feature or request label Apr 5, 2025
@penalosa
Copy link
Contributor

penalosa commented May 1, 2025

@eastlondoner Thanks for this PR! I've modified it slightly to support Durable Objects, add tests, and to use the Service type for entrypoint bindings.

@petebacondarwin
Copy link
Contributor

Also there are some lint checks failing

@eastlondoner
Copy link
Contributor Author

Thanks so much @petebacondarwin and @penalosa, this is amazing!
It looks like you've done everything - is there anything else that you'd like from me?

@petebacondarwin
Copy link
Contributor

Thanks so much @petebacondarwin and @penalosa, this is amazing! It looks like you've done everything - is there anything else that you'd like from me?

Thanks to you @eastlondoner for kicking this off. Given that @penalosa has added quite a lot, it would be good if you could try it out for yourself to check we have covered everything from your side.

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2025

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/14904858056/npm-package-wrangler-8794
Prereleases for other packages:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workers-bindings-extension-8794 -O ./cloudflare-workers-bindings-extension.0.0.0-va789e6b4d.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-va789e6b4d.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-create-cloudflare-8794 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-kv-asset-handler-8794

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-miniflare-8794

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-pages-shared-8794

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-unenv-preset-8794

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-vite-plugin-8794

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-vitest-pool-workers-8794

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workers-editor-shared-8794

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workers-shared-8794

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workflows-shared-8794

Note that these links will no longer work once the GitHub Actions artifact expires.

Copy link
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

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

🎉

(and thank you @eastlondoner for getting this started, really appreciate it!)

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk May 7, 2025
@penalosa penalosa enabled auto-merge May 8, 2025 10:57
@penalosa penalosa added this pull request to the merge queue May 8, 2025
Merged via the queue into cloudflare:main with commit 02f0699 May 8, 2025
15 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk May 8, 2025
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes an open-source contribution, big or small label May 8, 2025
@holopin-bot
Copy link

holopin-bot bot commented May 8, 2025

Congratulations @eastlondoner, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cmaf9z4fq16900djyoz9tkga1

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

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

Labels

contribution [Holopin] Recognizes an open-source contribution, big or small enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants