feat(unenv-preset): add native node:repl module support#12007
Merged
petebacondarwin merged 3 commits intomainfrom Jan 27, 2026
Merged
feat(unenv-preset): add native node:repl module support#12007petebacondarwin merged 3 commits intomainfrom
petebacondarwin merged 3 commits intomainfrom
Conversation
Contributor
🤖 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: 9ef23b8 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 |
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: |
vicb
reviewed
Jan 21, 2026
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
14425eb to
8cad740
Compare
vicb
approved these changes
Jan 21, 2026
| const repl = await import("node:repl"); | ||
|
|
||
| // Common exports (both unenv stub and native workerd) | ||
| assertTypeOfProperties(repl, { |
Contributor
There was a problem hiding this comment.
nit: we could factor code
for (const target of [repl, repl.default]) {
assertTypeOfProperties(target, { ... });
}we could also do that across the file
Contributor
Author
There was a problem hiding this comment.
I can do that in a general refactor PR afterwards?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Devin PR requested by @petebacondarwin
Adds support for the native
node:replmodule from workerd when theenable_nodejs_repl_moduleandexperimentalcompatibility flags are enabled. This follows the same pattern as other experimental modules (inspector, sqlite, dgram, stream_wrap).The native code appears in workerd as of https://github.com/cloudflare/workerd/blob/main/src/node/repl.ts. It is currently experimental with no default enable date.
Implementation Comparison
writerERR_METHOD_NOT_IMPLEMENTEDstartERR_METHOD_NOT_IMPLEMENTEDRecoverableREPLServerREPL_MODE_SLOPPYREPL_MODE_STRICTbuiltinModules_builtinLibsBreaking change analysis: There are no breaking changes when moving from unenv to workerd. Both implementations throw errors for the main functions (
writer,start,REPLServer,Recoverable). The only difference is the error type/message - workerd throwsERR_METHOD_NOT_IMPLEMENTED(Node.js style) while unenv throws a generic "not implemented" error. The workerd implementation is moving closer to Node.js by using proper Node.js error codes.Updates since last revision
assertTypeOfPropertiesfor symbol assertions (REPL_MODE_SLOPPY,REPL_MODE_STRICT) per review feedbackHuman Review Checklist
getReplOverrides()function follows the same pattern as other experimental modules/not implemented|ERR_METHOD_NOT_IMPLEMENTED/correctly handles both error typesLink to Devin run