Use the native node:tty, node:repl, node:readline, node:inspector, node:v8, and node:dgram modules when available#11026
Conversation
…de:v8, and node:dgram modules when available Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
🦋 Changeset detectedLatest commit: 6265ecb 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 |
🤖 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:
|
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running Notes:
|
Adds support for using the native
node:tty,node:repl,node:readline,node:inspector,node:v8, andnode:dgrammodules 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. This PR combines 6 modules that follow the same conversion pattern.
Changes
getTtyOverrides(),getReplOverrides(),getReadlineOverrides(),getInspectorOverrides(),getV8Overrides(),getDgramOverrides()experimentalflag and its respectiveenable_nodejs_*_moduleflagdisable_nodejs_*_moduleflagKey Differences: workerd vs unenv
node:tty - Workerd extends Socket with complete WriteStream methods (getColorDepth, hasColors, getWindowSize) and throws proper errors. Unenv has simpler stubs.
node:repl - Workerd has proper class structures with all properties defined. Unenv uses notImplemented helpers. Both non-functional.
node:readline (+ promises) - Very similar implementations. Both are mostly no-ops. Workerd is more consistent.
node:inspector (+ promises) - Workerd has proper Session class extending EventEmitter. Unenv uses helper functions.
node:v8 - Workerd throws ERR_METHOD_NOT_IMPLEMENTED explicitly and validates inputs. Unenv returns mock data silently. Workerd has additional methods (getCppHeapStatistics, isStringOneByteRepresentation).
node:dgram - Workerd has complete Socket API with all methods (bind, connect, send, close) and Symbol.asyncDispose support. Unenv has basic implementation.
Review Focus
Link to Devin run: https://app.devin.ai/sessions/f2a8f635e47b47e8baa9bc1b68af0635
Requested by: @petebacondarwin (pbacondarwin@cloudflare.com)