Skip to content
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

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cuddly-pets-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

chore(wrangler): use the unenv preset from `@cloudflare/unenv-preset`
1 change: 1 addition & 0 deletions packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"dependencies": {
"@cloudflare/kv-asset-handler": "workspace:*",
"@cloudflare/unenv-preset": "1.x",
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.)

Copy link
Contributor

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.

"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@esbuild-plugins/node-modules-polyfill": "0.2.2",
"blake3-wasm": "2.1.5",
Expand Down
6 changes: 3 additions & 3 deletions packages/wrangler/scripts/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const EXTERNAL_DEPENDENCIES = [
// @cloudflare/workers-types is an optional peer dependency of wrangler, so users can
// get the types by installing the package (to what version they prefer) themselves
"@cloudflare/workers-types",

// unenv must be external because it contains unenv/runtime code which needs to be resolved
// and read when we are bundling the worker application
// `@cloudflare/unenv-preset` and `unenv` must be external because they contain code
// which needs to be resolved and read when we are bundling the worker application
"@cloudflare/unenv-preset",
"unenv",

// path-to-regexp must be external because it contains runtime code which needs to be resolved
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { builtinModules } from "node:module";
import nodePath from "node:path";
import { cloudflare } from "@cloudflare/unenv-preset";
import dedent from "ts-dedent";
import { cloudflare, defineEnv } from "unenv";
import { defineEnv } from "unenv";
import { getBasePath } from "../../paths";
import type { Plugin, PluginBuild } from "esbuild";

Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading