-
Notifications
You must be signed in to change notification settings - Fork 613
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
fix(wrangler): avoid path collisions between performance and Performance polyfills #6025
fix(wrangler): avoid path collisions between performance and Performance polyfills #6025
Conversation
…nce polyfills It turns out that ESBuild paths are case insensitive, which can result in path collisions between polyfills for globalThis.performance and globalThis.Performance. This change ensures that we encode all global names to lowercase and decode them appropriately. The version of unenv used at HEAD currently doesn't suffer from this path collision, but if not fixed the change introduced in https://github.com/unjs/unenv/pull/257/files would result in Node.js API coverage regressions. This change prevents those regressions from happening.
🦋 Changeset detectedLatest commit: 6effdba The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
…erformance polyfills
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/9498249323/npm-package-wrangler-6025 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6025/npm-package-wrangler-6025 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9498249323/npm-package-wrangler-6025 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9498249323/npm-package-create-cloudflare-6025 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9498249323/npm-package-cloudflare-kv-asset-handler-6025 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9498249323/npm-package-miniflare-6025 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9498249323/npm-package-cloudflare-pages-shared-6025 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9498249323/npm-package-cloudflare-vitest-pool-workers-6025 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix looks fine to land.
But I think that actually this is not the best approach for these virtual files.
Rather than using virtual fake paths (which in extreme cases could collide with real paths), I think the correct approach is to use esbuild namespaces here to filter these resolves to loaders.
We might still need to encode/decode upper case letters from globals to distinguish between globals that only differ in case, but we could avoid having to use getBasePath()
and the concern of path collision.
It needs a changeset before I merge... |
…erformance polyfills
Congratulations @IgorMinar, you just earned a holobyte! Here it is: https://holopin.io/holobyte/clxd6dfbz31420cmgnkzuoc3x 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. |
Follow up on #6025 that makes the code a bit more resilient.
Follow up on #6025 that makes the code a bit more resilient.
Follow up on #6025 that makes the code a bit more resilient.
* fix(node_compat): support $ characters in unenv inject preset Follow up on #6025 that makes the code a bit more resilient. * fixup! fix(node_compat): support $ characters in unenv inject preset * fixup! fix(node_compat): support $ characters in unenv inject preset * fixup! fix(node_compat): support $ characters in unenv inject preset --------- Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
It turns out that ESBuild paths are case insensitive, which can result in path collisions between polyfills for globalThis.performance and globalThis.Performance.
This change ensures that we encode all global names to lowercase and decode them appropriately.
The version of unenv used at HEAD currently doesn't suffer from this path collision, but if not fixed the change introduced in https://github.com/unjs/unenv/pull/257/files would result in Node.js API coverage regressions. This change prevents those regressions from happening.
What this PR solves / how to test
Fixes #[insert GH or internal issue number(s)].
Author has addressed the following