Skip to content

[WIP] repl: use inspector over vm#64034

Draft
avivkeller wants to merge 1 commit into
nodejs:mainfrom
avivkeller:repl-inspector
Draft

[WIP] repl: use inspector over vm#64034
avivkeller wants to merge 1 commit into
nodejs:mainfrom
avivkeller:repl-inspector

Conversation

@avivkeller

@avivkeller avivkeller commented Jun 20, 2026

Copy link
Copy Markdown
Member

This PR switches the REPL from node:vm to node:inspector, moving it from a synchronous evaluator to a async one1:

  1. --experimental-repl-await is no longer required, since top-level await is no longer experimental and is natively supported by the inspector.

  2. Static imports such as import ... from '...' are now transformed into real dynamic imports and executed, instead of throwing Cannot use import statement outside a module with a hint to rewrite the import manually. This is not strictly required by removing node:vm, but it is made easier by the change. I can split this into a separate PR if preferred.

  3. Since we are no longer relying on node:vm, several issues with VM have been resolved (see the list at the bottom of this PR), and users can now attach process listeners without breaking the REPL.

  4. The REPL now gives more details in Errors, for instance, showing the specific line in a .load-ed file where an error was thrown

Opening as a draft for reviews while I work on changing tests to support the async behavior of the new REPL


Failed tests:
out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /Users/avivkeller/Documents/projects/nodejs/node/test/parallel/test-repl-completion-on-getters-disabled.js
out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /Users/avivkeller/Documents/projects/nodejs/node/test/parallel/test-repl-custom-eval-previews.js
out/Release/node --expose-internals /Users/avivkeller/Documents/projects/nodejs/node/test/parallel/test-repl-history-navigation.js
out/Release/node /Users/avivkeller/Documents/projects/nodejs/node/test/parallel/test-repl-preview.mjs
out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /Users/avivkeller/Documents/projects/nodejs/node/test/parallel/test-repl-tab-complete.js

Note on the removed tests:

  1. test/parallel/test-repl-domain.js: The REPL now functions completely independently from the domain module, and, as such, there's no reason to test it's functionality in the REPL
  2. test/parallel/test-repl-uncaught-exception-async.js / test/parallel/test-repl-uncaught-exception.js / test-repl-tab-complete-nested-repls.js: We no longer throw on these cases (yay!)
  3. test/parallel/test-repl-no-terminal-restore-process-listeners.js: We no longer block the setting of listeners on the REPL.
  4. test/parallel/test-repl-preprocess-top-level-await.js / test/parallel/test-repl-top-level-await.js: We no longer have custom logic for Top Level Await, so testing it would be testing code already tested internally by the inspector.

Fixes: #36047
Fixes: #38503
Fixes: #39387
Fixes: #37445
Fixes: #38145
Fixes: #33369
Fixes: #8309

Footnotes

  1. This is a breaking change.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config

@avivkeller avivkeller marked this pull request as draft June 20, 2026 21:46
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 20, 2026
@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jun 20, 2026
@avivkeller avivkeller added the repl Issues and PRs related to the REPL subsystem. label Jun 20, 2026
@avivkeller avivkeller force-pushed the repl-inspector branch 2 times, most recently from a6b73a5 to b00e3d5 Compare June 21, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

3 participants