-
Notifications
You must be signed in to change notification settings - Fork 761
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
chore(wrangler): use the unenv preset from @cloudflare/unenv-preset
#7720
Conversation
🦋 Changeset detectedLatest commit: 8523cbf 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 |
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/12788368201/npm-package-wrangler-7720 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7720/npm-package-wrangler-7720 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-wrangler-7720 dev path/to/script.js Additional artifacts:cloudflare-workers-bindings-extension: wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-workers-bindings-extension-7720 -O ./cloudflare-workers-bindings-extension.0.0.0-v4bec158fa.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v4bec158fa.vsix create-cloudflare: npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-create-cloudflare-7720 --no-auto-update @cloudflare/kv-asset-handler: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-kv-asset-handler-7720 miniflare: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-miniflare-7720 @cloudflare/pages-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-pages-shared-7720 @cloudflare/unenv-preset: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-unenv-preset-7720 @cloudflare/vitest-pool-workers: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-vitest-pool-workers-7720 @cloudflare/workers-editor-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-workers-editor-shared-7720 @cloudflare/workers-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-workers-shared-7720 @cloudflare/workflows-shared: npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12788368201/npm-package-cloudflare-workflows-shared-7720 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
16f9044
to
4506f5b
Compare
I generated https://github.com/opennextjs/opennextjs-cloudflare/tree/main/examples/vercel-blog-starter with both wrangler 3.101.0 and a dev version of wrangler built from this PR to see if there are any differences. The differences are: Better names // stable
// ../../../../../.nvm/versions/node/v22.11.0/lib/node_modules/wrangler/_virtual_unenv_global_polyfill-clear$immediate.js
var init_virtual_unenv_global_polyfill_clear_immediate = __esm({
"../../../../../.nvm/versions/node/v22.11.0/lib/node_modules/wrangler/_virtual_unenv_global_polyfill-clear$immediate.js"() {
init_cloudflare();
globalThis.clearImmediate = clearImmediateFallback;
}
});
// dev
// ../../../workers-sdk/packages/wrangler/_virtual_unenv_global_polyfill-clear$immediate.js
var init_virtual_unenv_global_polyfill_clear_immediate = __esm({
"../../../workers-sdk/packages/wrangler/_virtual_unenv_global_polyfill-clear$immediate.js"() {
init_timers();
globalThis.clearImmediate = clearImmediateFallback;
}
});
Path are different (expected) // Stable
// ../../../../../.nvm/versions/node/v22.11.0/lib/node_modules/wrangler/node_modules/unenv/runtime/node/timers/internal/immediate.mjs
var Immediate;
var init_immediate = __esm({
"../../../../../.nvm/versions/node/v22.11.0/lib/node_modules/wrangler/node_modules/unenv/runtime/node/timers/internal/immediate.mjs"() {
init_virtual_unenv_global_polyfill_process();
// Dev
// ../../../workers-sdk/node_modules/.pnpm/unenv-nightly@2.0.0-20241218-183400-5d6aec3/node_modules/unenv-nightly/runtime/node/timers/internal/immediate.mjs
var Immediate;
var init_immediate = __esm({
"../../../workers-sdk/node_modules/.pnpm/unenv-nightly@2.0.0-20241218-183400-5d6aec3/node_modules/unenv-nightly/runtime/node/timers/internal/immediate.mjs"() { So no functional changes between the current (stable) and PR state. |
It is pleasing that you didn't need to change much inside Wrangler to get this to work. |
709191c
to
ebd9626
Compare
eaa9fc9
to
7540513
Compare
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
@cloudflare/unenv-preset
@cloudflare/unenv-preset
@@ -70,6 +70,7 @@ | |||
}, | |||
"dependencies": { | |||
"@cloudflare/kv-asset-handler": "workspace:*", | |||
"@cloudflare/unenv-preset": "1.x", |
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.
Don't we want to lock this down to a specific version?
Similar to the unenv, miniflare and workerd versions we want to explicitly lock these into Wrangler, and then bump them all at the same time, right?
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.
We want the latest version of the preset.
I hope that the peerDep on workerd in the preset will constrain the version (via the local workerd)
Maybe we can pin to 1.0.x or even 1.0.0 until we make sure that works correctly?
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.
I hope that the peerDep on workerd in the preset will constrain the version (via the local workerd)
Interesting... I hope it works that way (for all package managers.)
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.
Let's try not pinning for now and then see if it works as expected for our first few releases.
The cloudflare preset was migrated to this mono-repo (
@cloudflare/unenv-preset
)This PR is switching to using this version
To do before merging:
[ ] make sure the Vite plugin works with(from discussion with @vicb and @petebacondarwin : not actually needed for this PR as it doesn't touch vite plugin)@cloudflare/unenv-preset
@cloudflare/unenv-preset@1.0.0
and use that version/cc @petebacondarwin @pi0 @dario-piotrowicz