Skip to content

Sync unenv-preset with unenv@2.0.0-rc.8#7915

Merged
vicb merged 2 commits intomainfrom
uennv-rc
Feb 28, 2025
Merged

Sync unenv-preset with unenv@2.0.0-rc.8#7915
vicb merged 2 commits intomainfrom
uennv-rc

Conversation

@vicb
Copy link
Copy Markdown
Contributor

@vicb vicb commented Jan 27, 2025

Sync @cloudflare/unenv-preset with unenv@2.0.0-rc.8

Changelog:

Notes:

The ESBuild plugin needs to be updated because

  • The preset now only publish ESM
  • To support the polyfill property of the preset Environment

You can check the WIP/test-preset branch that includes the updates and test the preset.

I have deliberately not include included a changelog because this package should not be released before 2.0 is ready

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: already tested
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: the preset is not used yet in wrangler
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: no user facing change

This is part 1 of 2 in a stack made with GitButler:

@vicb vicb requested a review from a team as a code owner January 27, 2025 10:24
@vicb vicb requested a review from a team January 27, 2025 10:24
@vicb vicb marked this pull request as draft January 27, 2025 10:25
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 27, 2025

⚠️ No Changeset found

Latest commit: 36d0036

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment thread packages/unenv-preset/package.json Outdated
@anonrig
Copy link
Copy Markdown
Contributor

anonrig commented Jan 27, 2025

@vicb Can you rebase?

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Jan 27, 2025

@vicb Can you rebase?

I will, probably tomorrow. For now this is only a preview syncing with the next version of unenv

edit Jan 28: rebased and tested locally using pnpm link - added details in the description

@vicb vicb force-pushed the uennv-rc branch 2 times, most recently from 631bbf7 to ce8b989 Compare January 29, 2025 08:02
@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Jan 29, 2025

Drop timers + rebased

Comment thread pnpm-lock.yaml
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 10, 2025

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/13585800010/npm-package-wrangler-7915

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7915/npm-package-wrangler-7915

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-wrangler-7915 dev path/to/script.js
Additional artifacts:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-workers-bindings-extension-7915 -O ./cloudflare-workers-bindings-extension.0.0.0-vac7291578.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-vac7291578.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-create-cloudflare-7915 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-kv-asset-handler-7915

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-miniflare-7915

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-pages-shared-7915

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-unenv-preset-7915

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-vite-plugin-7915

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-vitest-pool-workers-7915

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-workers-editor-shared-7915

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-workers-shared-7915

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13585800010/npm-package-cloudflare-workflows-shared-7915

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.111.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20250214.1
workerd 1.20250214.0 1.20250214.0
workerd --version 1.20250214.0 2025-02-14

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Feb 10, 2025

@petebacondarwin I have started to sync with unenv - there are still a few changes to sync. I also have 2 PRs on unenv that are pendings.

This PR also needs to be tested with a version of wrangler actually using the preset - currently wrangler (then also pnpm -F @cloudflare/unenv-preset test:ci) is using unjs/unenv.

I hope to be done with that later today so that we can release @cloudflare/unenv-preset@2 this week. This would be a prerequisite before switching wrangler back to the preset.

@vicb vicb force-pushed the uennv-rc branch 7 times, most recently from 778b8e4 to fe14753 Compare February 13, 2025 16:12
@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Feb 13, 2025

@petebacondarwin we need to fix performance (see #8111, it was broken before but with the changes to unenv we have to fix this now and it's a good time anyway) but the rest should be ~ready.

The PR should be ready by tomorrow but feel free to take a look before.

Thanks!

@vicb vicb force-pushed the uennv-rc branch 2 times, most recently from 8ede4cb to b557544 Compare February 27, 2025 10:17
@vicb vicb force-pushed the uennv-rc branch 5 times, most recently from fa6a903 to 40a3a2b Compare February 27, 2025 11:05
@vicb vicb changed the title refactor(unenv-preset): sync directory structure with unenv Sync unenv-preset with unenv@2.0.0-rc.8 Feb 27, 2025
@vicb vicb requested review from petebacondarwin and pi0 February 27, 2025 12:28
@vicb vicb marked this pull request as ready for review February 27, 2025 12:44
@vicb vicb added the e2e Run wrangler + vite-plugin e2e tests on a PR label Feb 27, 2025
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.

Nice work! Got there finally!
As well as updating Wrangler, we'll need to update Vite plugin.

@@ -64,29 +65,25 @@ export const cloudflare: Preset = {
),
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.

Out of curiosity, why do we create all these identity aliases? It seems a bit pointless?
Shouldn't we only add aliases for things that need to be mapped to polyfills?
(I could understand creating ${p} -> node:${p} perhaps?)

Copy link
Copy Markdown
Contributor Author

@vicb vicb Feb 28, 2025

Choose a reason for hiding this comment

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

I have added this comment:

		// `nodeCompatModules` are implemented in workerd.
		// Create aliases to override polyfills defined in based environments.

Does it help?

Comment thread packages/unenv-preset/src/preset.ts
Comment thread packages/unenv-preset/src/preset.ts
Comment thread packages/unenv-preset/src/runtime/node/module.ts
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Feb 28, 2025
@petebacondarwin
Copy link
Copy Markdown
Contributor

Is it worth adding a changeset now?

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Feb 28, 2025

Is it worth adding a changeset now?

I'll first merge the PR, test the PR releases and if that looks good we can add a changeset

Comment thread packages/unenv-preset/src/runtime/node/async_hooks.ts
Comment thread packages/unenv-preset/src/runtime/node/module.ts
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.

(might be worth to add a test if you can o make sure it will exist in dist -- had a tough time to investigate issue in unenv when we changed bundler)

@vicb vicb removed the e2e Run wrangler + vite-plugin e2e tests on a PR label Feb 28, 2025
@vicb vicb merged commit 0630d9b into main Feb 28, 2025
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Feb 28, 2025
@vicb vicb deleted the uennv-rc branch February 28, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

🚀 Feature Request: [unenv-preset] implement globalThis.performance in nodejs_compat mode

4 participants