Add Miniflare & Wrangler support for unbound Durable Objects#10596
Add Miniflare & Wrangler support for unbound Durable Objects#10596
Conversation
🦋 Changeset detectedLatest commit: f1105de The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
654af9f to
21d5739
Compare
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running Notes:
|
9829be6 to
eb271e3
Compare
jamesopstad
left a comment
There was a problem hiding this comment.
Looks good to me. Non-blocking question: The alternative approach would be to collect all the DOs in the same way (by storage) and then collect the bindings for those that have them. Would that also work or not?
packages/miniflare/src/index.ts
Outdated
There was a problem hiding this comment.
This is exactly the same as the map callback above. Could we combine before mapping e.g. [...Object.values(workerOpts.do.durableObjects ?? {}), ...(workerOpts.do.additionalUnboundDurableObjects ?? [])].map(). Either that or extract the callback into a function that's reused.
In theory, yes, and I initially tried that approach. However, it ended up being much more invasive across Miniflare/Vite/Vitest since all of those assume in various places that the durable object config is a record of binding name to config. This approach seemed like a much simpler option to reduce the added complexity |
2fd34ff to
d9477b7
Compare
Co-authored-by: James Opstad <13586373+jamesopstad@users.noreply.github.com>
Co-authored-by: James Opstad <13586373+jamesopstad@users.noreply.github.com>
Co-authored-by: James Opstad <13586373+jamesopstad@users.noreply.github.com>
Fixes #10294