Skip to content

refactor(wrangler): switch getPlatformProxy() to use Miniflare's dev registry implementation#10060

Merged
edmundhung merged 3 commits intomainfrom
edmundhung/DEVX-2122
Aug 7, 2025
Merged

refactor(wrangler): switch getPlatformProxy() to use Miniflare's dev registry implementation#10060
edmundhung merged 3 commits intomainfrom
edmundhung/DEVX-2122

Conversation

@edmundhung
Copy link
Copy Markdown
Member

@edmundhung edmundhung commented Jul 24, 2025

Fixes DEVX-2122


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: no new feature
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: miniflare registry is v4 only

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jul 24, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@10060

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@10060

miniflare

npm i https://pkg.pr.new/miniflare@10060

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@10060

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@10060

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@10060

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

npm i https://pkg.pr.new/wrangler@10060

commit: 88c583b

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 24, 2025

🦋 Changeset detected

Latest commit: 88c583b

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

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@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

@edmundhung edmundhung force-pushed the edmundhung/DEVX-2122 branch from 21a2b9e to e6ee2b6 Compare July 28, 2025 10:47
@edmundhung edmundhung force-pushed the edmundhung/DEVX-2122 branch 2 times, most recently from 82f443f to 7a47644 Compare August 5, 2025 11:04
@edmundhung edmundhung changed the title feat: migrate getPlatformProxy API to use miniflare dev registry refactor(wrangler): switch getPlatformProxy() to use Miniflare's dev registry implementation Aug 5, 2025
@edmundhung edmundhung force-pushed the edmundhung/DEVX-2122 branch from 4418341 to bedb0c5 Compare August 7, 2025 16:00
@edmundhung edmundhung marked this pull request as ready for review August 7, 2025 16:01
@edmundhung edmundhung requested a review from a team as a code owner August 7, 2025 16:01
async function setupPlatformProxy(config: string, devRegistryPath?: string) {
vi.stubEnv("WRANGLER_REGISTRY_PATH", devRegistryPath);
try {
// @ts-expect-error It works
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm. Can we have a more accurate comment here?
Is it that TS complains that the import will have type any?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

haha 😅 I wrote this when I am trying very hard to figure out the deadlock issue.

Fixed in 88c583b

return proxy;
} finally {
// Unset the environment variable to avoid affecting other tests
vi.stubEnv("WRANGLER_REGISTRY_PATH", undefined);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't stub env automatically revert the change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Or if not, perhaps call vi.unstubAllEnvs() in the onTestFinished() hook

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Called vi.unstubAllEnvs() in the onTestFinished() hook in 88c583b

Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Some nits.

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Aug 7, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 7, 2025

Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the v3-maintenance branch with your changes. Thank you for helping us keep Wrangler v3 supported!

Depending on your changes, running git rebase --onto v3-maintenance main edmundhung/DEVX-2122 might be a good starting point.

Notes:

  • your PR branch should be named v3-backport-10060
  • add the skip-v3-pr label to the current PR to stop this workflow from failing

@edmundhung edmundhung merged commit 9aad334 into main Aug 7, 2025
62 of 67 checks passed
@edmundhung edmundhung deleted the edmundhung/DEVX-2122 branch August 7, 2025 19:02
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants