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

Moving cloudflare (hybrid node compat) to external preset #2

Open
pi0 opened this issue Oct 15, 2024 · 1 comment
Open

Moving cloudflare (hybrid node compat) to external preset #2

pi0 opened this issue Oct 15, 2024 · 1 comment

Comments

@pi0
Copy link
Owner

pi0 commented Oct 15, 2024

Having both unenv + cloudflare preset for wrangler hybrid node_compat in same repo/versioning has proven to be a tricky process.

The idea of this external preset is to split areas clearly:

  • unenv: The base/polyfill-only source for Node.js compatibility (nodeless)
  • unenv-preset-cloudflare: has full control over hybrid layer composition on top of unenv

Versioning

By this split, unenv versioning focuses mainly on polyfill improvements and bug fixes with both stable channels and nightly channels

I believe unenv-preset-cloudflare might need to also have two channels and stable channel releases making sure the hybrid composition, matches production tag of workerd and is also in sync with wrangler SDK.

Tests

I think the focus of these preset tests would be testing functionality with node_compat.

The focus of unenv would then be polyfill-only coverage.

porting current workerd tests is time-consuming because it was so hacky but as an alternative, since this setup has fewer constraints I think we might directly use vitest-environment-cloudflare somehow.

Ownership

With this split, I would love to have the cloudflare team having full ownership.

I would be more than glad to have cloudflare team oversights on unenv development as well, and also I would love to keep helping on this preset because we might need an extension of it for Nitro/Nuxt support to avoid duplicating efforts.

I made this POC quickly in my personal namespace and invited major contributors, if you want to move it to a better place, please do! (i would personally suggest it being part of SDK monorepo to help saving time!)

Transition

I think we can have as much as time as needed. unenv is not going to break wrangler dependency until we adopt this repository.

I would appreciate any help on making this happen faster btw since it unblocks next steps for unenv v2 release.

@pi0 pi0 changed the title Project goals Moving cloudflare (hybrid node compat) to external preset Oct 15, 2024
@pi0
Copy link
Owner Author

pi0 commented Nov 7, 2024

Notes from quick chat with @vicb

  • We should be aware of any internal/ imports (like this) to avoid breaking changes
  • For tests, workers-sdk need to use the production version of Wrangler (instead of the latest)
  • For tests, we gonna need some major refactors to allow it to run outside of unenv repo (via a standalone npm package)

Next steps

  1. Move external preset to workers-sdk monorepo
  2. Update wrangler tooling to use it
  3. Migrate tests

@vicb is gonna work on it next Tuesday (and later next week i will work on preparing testing util stuff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant