Use the native node:wasi module when available#11025
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 8829564 The changes in this PR will be included in the next version bump. 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 |
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running Notes:
|
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
c39b635 to
295ddc7
Compare
|
Here is the unenv polyfill: https://github.com/unjs/unenv/blob/6493c25f2fb94b9f2c7dec528a26ac11f7f9b8b0/src/runtime/node/wasi.ts#L2 |
|
Here is the workerd implementation: https://github.com/cloudflare/workerd/blob/6daa2ba8e02a3ea25cc7afd60d70f70bd9a38c7e/src/node/wasi.ts#L22 |
|
Here is the Node.js implementation https://github.com/nodejs/node/blob/0b6ae6df14ac7b6dbec4ad5c0473b63072d98cff/lib/wasi.js#L37 |
3a78787 to
7316bdf
Compare
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
dcebd73 to
55423bc
Compare
|
force push is rebase + format |
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
55423bc to
8829564
Compare
|
rebased (with conflicts resolution) |
Adds support for using the native
node:wasimodule from workerd when available, following the pattern established in previous module conversion PRs.This is part of a series to convert 9 remaining Node.js modules from unenv polyfills to native workerd implementations.
Changes
getWasiOverrides()function to enable/disable the native wasi module based on compatibility flagsexperimentalflag andenable_nodejs_wasi_moduleflag to enabledisable_nodejs_wasi_moduleflagKey Differences: workerd vs unenv
The workerd implementation has complete constructor validation for all WASI options (version, args, env, preopens, stdin, stdout, stderr, returnOnExit), while unenv just throws immediately without validation. Both are non-functional stubs.
Review Focus
enable_nodejs_wasi_module/disable_nodejs_wasi_moduleLink to Devin run: https://app.devin.ai/sessions/f2a8f635e47b47e8baa9bc1b68af0635
Requested by: @petebacondarwin (pbacondarwin@cloudflare.com)