repl: use inspector over vm - #64034
Conversation
|
Review requested:
|
9fdad96 to
56ebb41
Compare
3f34721 to
d7534b9
Compare
|
cc @nodejs/repl @nodejs/inspector |
|
The
notable-change
Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section. |
012ec64 to
e428a2e
Compare
33e1f17 to
a949698
Compare
|
Does this change make tab-completions side-effect free in all cases? await $`echo hello`.sometextwas printing hello whilst tab completing. |
|
Hi @qwitwa! Unfortunately, that specific case is not resolved by this PR. Although, that might be an issue with V8, since the REPL relies on CDP's |
|
Bump @nodejs/repl @nodejs/vm @nodejs/inspector |
a949698 to
ff79eed
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
Commit Queue failed- Loading data for nodejs/node/pull/64034 ✔ Done loading data for nodejs/node/pull/64034 ----------------------------------- PR info ------------------------------------ Title repl: use inspector over vm (#64034) Author Aviv Keller <[email protected]> (@avivkeller) Branch avivkeller:repl-inspector -> nodejs:main Labels c++, repl, semver-major, lib / src, notable-change, author ready, needs-ci, review wanted, commit-queue-squash Commits 9 - repl: use inspector over vm - fixup! - fixup! - fixup! - fixup! remove file from testing - fixup! - fixup! - fixup! - fixup! Committers 2 - avivkeller <[email protected]> - GitHub <[email protected]> PR-URL: https://github.com/nodejs/node/pull/64034 Fixes: https://github.com/nodejs/node/issues/64523 Fixes: https://github.com/nodejs/node/pull/64534 Fixes: https://github.com/nodejs/node/issues/39387 Fixes: https://github.com/nodejs/node/pull/39392 Fixes: https://github.com/nodejs/node/issues/61390 Fixes: https://github.com/nodejs/node/issues/63126 Fixes: https://github.com/nodejs/node/issues/38503 Fixes: https://github.com/nodejs/node/issues/37445 Fixes: https://github.com/nodejs/node/issues/38145 Fixes: https://github.com/nodejs/node/issues/33369 Fixes: https://github.com/nodejs/node/issues/48131 Fixes: https://github.com/nodejs/node/issues/8309 Fixes: https://github.com/nodejs/node/issues/39689 Fixes: https://github.com/nodejs/node/issues/18931 Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Filip Skokan <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/64034 Fixes: https://github.com/nodejs/node/issues/64523 Fixes: https://github.com/nodejs/node/pull/64534 Fixes: https://github.com/nodejs/node/issues/39387 Fixes: https://github.com/nodejs/node/pull/39392 Fixes: https://github.com/nodejs/node/issues/61390 Fixes: https://github.com/nodejs/node/issues/63126 Fixes: https://github.com/nodejs/node/issues/38503 Fixes: https://github.com/nodejs/node/issues/37445 Fixes: https://github.com/nodejs/node/issues/38145 Fixes: https://github.com/nodejs/node/issues/33369 Fixes: https://github.com/nodejs/node/issues/48131 Fixes: https://github.com/nodejs/node/issues/8309 Fixes: https://github.com/nodejs/node/issues/39689 Fixes: https://github.com/nodejs/node/issues/18931 Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Filip Skokan <[email protected]> -------------------------------------------------------------------------------- ℹ This PR was created on Sat, 20 Jun 2026 21:46:39 GMT ✔ Approvals: 3 ✔ - Dario Piotrowicz (@dario-piotrowicz): https://github.com/nodejs/node/pull/64034#pullrequestreview-4675448876 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/64034#pullrequestreview-4729043601 ✔ - Filip Skokan (@panva) (TSC): https://github.com/nodejs/node/pull/64034#pullrequestreview-4728817049 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2026-07-18T17:54:29Z: https://ci.nodejs.org/job/node-test-pull-request/74881/ - Querying data for job/node-test-pull-request/74881/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 64034 From https://github.com/nodejs/node * branch refs/pull/64034/merge -> FETCH_HEAD ✔ Fetched commits as 9df0e9b4d4a5..e90cd833579c -------------------------------------------------------------------------------- Auto-merging doc/api/errors.md Auto-merging lib/repl.js [main a796734305] repl: use inspector over vm Author: avivkeller <[email protected]> Date: Sat Jun 20 17:45:59 2026 -0400 126 files changed, 3119 insertions(+), 4299 deletions(-) delete mode 100644 lib/internal/repl/await.js create mode 100644 lib/internal/repl/eval.js create mode 100644 lib/internal/repl/inspector.js create mode 100644 lib/internal/repl/transform.js delete mode 100644 test/addons/repl-domain-abort/binding.cc delete mode 100644 test/addons/repl-domain-abort/binding.gyp delete mode 100644 test/addons/repl-domain-abort/test.js delete mode 100644 test/fixtures/repl-tab-completion-nested-repls.js delete mode 100644 test/known_issues/test-repl-require-context.js delete mode 100644 test/parallel/test-repl-autolibs.js create mode 100644 test/parallel/test-repl-autolibs.mjs rename test/parallel/{test-repl-context.js => test-repl-context.mjs} (83%) delete mode 100644 test/parallel/test-repl-definecommand.js create mode 100644 test/parallel/test-repl-definecommand.mjs delete mode 100644 test/parallel/test-repl-domain.js rename test/parallel/{test-repl-editor.js => test-repl-editor.mjs} (78%) delete mode 100644 test/parallel/test-repl-function-definition-edge-case.js create mode 100644 test/parallel/test-repl-function-definition-edge-case.mjs rename test/parallel/{test-repl-inspector.js => test-repl-inspector.mjs} (64%) rename test/parallel/{test-repl-load-multiline-no-trailing-newline.js => test-repl-load-multiline-no-trailing-newline.mjs} (56%) rename test/parallel/{test-repl-load-multiline.js => test-repl-load-multiline.mjs} (52%) delete mode 100644 test/parallel/test-repl-no-terminal-restore-process-listeners.js delete mode 100644 test/parallel/test-repl-preprocess-top-level-await.js delete mode 100644 test/parallel/test-repl-pretty-custom-stack.js create mode 100644 test/parallel/test-repl-pretty-custom-stack.mjs delete mode 100644 test/parallel/test-repl-pretty-stack-custom-writer.js create mode 100644 test/parallel/test-repl-pretty-stack-custom-writer.mjs delete mode 100644 test/parallel/test-repl-pretty-stack.js create mode 100644 test/parallel/test-repl-pretty-stack.mjs delete mode 100644 test/parallel/test-repl-preview-newlines.js create mode 100644 test/parallel/test-repl-preview-newlines.mjs delete mode 100644 test/parallel/test-repl-preview-without-inspector.js rename test/parallel/{test-repl-preview.js => test-repl-preview.mjs} (65%) delete mode 100644 test/parallel/test-repl-recoverable.js create mode 100644 test/parallel/test-repl-recoverable.mjs delete mode 100644 test/parallel/test-repl-sigint-nested-eval.js delete mode 100644 test/parallel/test-repl-tab-complete-buffer.js create mode 100644 test/parallel/test-repl-tab-complete-buffer.mjs delete mode 100644 test/parallel/test-repl-tab-complete-nested-repls.js delete mode 100644 test/parallel/test-repl-top-level-await.js delete mode 100644 test/parallel/test-repl-uncaught-exception-async.js delete mode 100644 test/parallel/test-repl-uncaught-exception-standalone.js create mode 100644 test/parallel/test-repl-uncaught-exception-standalone.mjs delete mode 100644 test/parallel/test-repl-uncaught-exception.js delete mode 100644 test/parallel/test-repl-underscore.js create mode 100644 test/parallel/test-repl-underscore.mjs delete mode 100644 test/parallel/test-repl-use-global.js create mode 100644 test/parallel/test-repl-use-global.mjs delete mode 100644 test/parallel/test-util-sigint-watchdog.js delete mode 100644 test/pseudo-tty/repl-dumb-tty.js delete mode 100644 test/pseudo-tty/repl-dumb-tty.out [main f5a0f14734] fixup! Author: avivkeller <[email protected]> Date: Mon Jul 13 18:03:34 2026 -0700 5 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 test/parallel/test-repl-promise-gc.mjs error: The following untracked working tree files would be overwritten by merge: output Please move or remove them before you merge. Aborting fatal: cherry-pick failed [main 065e945eaa] fixup! Author: avivkeller <[email protected]> Date: Mon Jul 13 18:07:27 2026 -0700 2 files changed, 4 insertions(+), 1 deletion(-) ✘ Failed to apply patcheshttps://github.com/nodejs/node/actions/runs/29658096987 |
Signed-off-by: Aviv Keller <[email protected]> PR-URL: #64034 Fixes: #64523 Closes: #64534 Fixes: #39387 Closes: #39392 Fixes: #61390 Fixes: #63126 Fixes: #38503 Fixes: #37445 Fixes: #38145 Fixes: #33369 Fixes: #48131 Fixes: #8309 Fixes: #39689 Fixes: #18931 Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
|
Landed in 4f844f4 Auto commit queue failed because:
|
| AddOption("--experimental-repl-await", | ||
| "experimental await keyword support in REPL", | ||
| &EnvironmentOptions::experimental_repl_await, | ||
| kAllowedInEnvvar, | ||
| true); |
There was a problem hiding this comment.
We need to reintroduce this flag as a no-op
There was a problem hiding this comment.
Why? This is semver-major, isn't it fine to make flags stop working?
There was a problem hiding this comment.
Nope, when a feature is unflagged, we always keep the flag: the cost of keeping a flag is marginal, while for the ecosystem it's unnecessary churn
Two doc-only improvements to `doc/api/repl.md`, both filling gaps left by recent semver-major REPL changes: 1. `repl.REPLServer` is an ES class; calling it without `new` is End-of-Life (DEP0185) and throws a native V8 `TypeError`. The "Class: REPLServer" section now notes this and links to the DEP0185 entry in `doc/api/deprecations.md`. No `Stability: 0` banner is added because the class itself is not deprecated — only the `new`-less invocation is — matching the parallel DEP0184/DEP0195 "classes without `new`" convention. 2. PR nodejs#64034 ("repl: use inspector over vm") removed the old "Global uncaught exceptions" subsection because the `domain`-based restrictions it documented no longer exist. A new top-level `### Error handling` section documents the current model (mirroring the `### Error handling` convention in async_hooks/http2/quic), anchored to the existing `Uncaught Error: REPL await` example. Refs: nodejs#59495 Refs: nodejs#54869 Refs: nodejs#54842 Refs: nodejs#64034 PR-URL: nodejs#64993 Signed-off-by: Adrian Estrada <[email protected]>
Two doc-only improvements to `doc/api/repl.md`, both filling gaps left by recent semver-major REPL changes: 1. `repl.REPLServer` is an ES class; calling it without `new` is End-of-Life (DEP0185) and throws a native V8 `TypeError`. The "Class: REPLServer" section now notes this and links to the DEP0185 entry in `doc/api/deprecations.md`. No `Stability: 0` banner is added because the class itself is not deprecated — only the `new`-less invocation is — matching the parallel DEP0184/DEP0195 "classes without `new`" convention. 2. PR nodejs#64034 ("repl: use inspector over vm") removed the old "Global uncaught exceptions" subsection because the `domain`-based restrictions it documented no longer exist. A new top-level `### Error handling` section documents the current model (mirroring the `### Error handling` convention in async_hooks/http2/quic), anchored to the existing `Uncaught Error: REPL await` example. Refs: nodejs#59495 Refs: nodejs#54869 Refs: nodejs#54842 Refs: nodejs#64034 PR-URL: nodejs#64993 Signed-off-by: Adrian Estrada <[email protected]>
Two doc-only improvements to `doc/api/repl.md`, both filling gaps left by recent semver-major REPL changes: 1. `repl.REPLServer` is an ES class; calling it without `new` is End-of-Life (DEP0185) and throws a native V8 `TypeError`. The "Class: REPLServer" section now notes this and links to the DEP0185 entry in `doc/api/deprecations.md`. No `Stability: 0` banner is added because the class itself is not deprecated — only the `new`-less invocation is — matching the parallel DEP0184/DEP0195 "classes without `new`" convention. 2. PR #64034 ("repl: use inspector over vm") removed the old "Global uncaught exceptions" subsection because the `domain`-based restrictions it documented no longer exist. A new top-level `### Error handling` section documents the current model (mirroring the `### Error handling` convention in async_hooks/http2/quic), anchored to the existing `Uncaught Error: REPL await` example. Refs: #59495 Refs: #54869 Refs: #54842 Refs: #64034 Signed-off-by: Adrian Estrada <[email protected]> PR-URL: #64993 Reviewed-By: Erick Wendel <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
Two doc-only improvements to `doc/api/repl.md`, both filling gaps left by recent semver-major REPL changes: 1. `repl.REPLServer` is an ES class; calling it without `new` is End-of-Life (DEP0185) and throws a native V8 `TypeError`. The "Class: REPLServer" section now notes this and links to the DEP0185 entry in `doc/api/deprecations.md`. No `Stability: 0` banner is added because the class itself is not deprecated — only the `new`-less invocation is — matching the parallel DEP0184/DEP0195 "classes without `new`" convention. 2. PR #64034 ("repl: use inspector over vm") removed the old "Global uncaught exceptions" subsection because the `domain`-based restrictions it documented no longer exist. A new top-level `### Error handling` section documents the current model (mirroring the `### Error handling` convention in async_hooks/http2/quic), anchored to the existing `Uncaught Error: REPL await` example. Refs: #59495 Refs: #54869 Refs: #54842 Refs: #64034 Signed-off-by: Adrian Estrada <[email protected]> PR-URL: #64993 Reviewed-By: Erick Wendel <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
This PR switches the REPL from
node:vmtonode:inspector, moving it from a synchronous to an asynchronous evaluator. This brings the following improvements:awaitis now natively supported by the inspector, so--no-experimental-repl-awaitis no longer accepted. This also resolves a known limitation where TLA would invalidate the lexical scoping ofconstdeclarations.import ... from '...'are now transformed into real dynamic imports and executed, rather than throwingCannot use import statement outside a modulewith a hint to rewrite the import manually. This isn't strictly required by removingnode:vm, but the change makes it easier. I can split this into a separate PR if preferred.node:vmissues are resolved (see the list below), and users can now attach process listeners without breaking the REPL..load-ed file where an error was thrown.This is a semver-major change; see the reasons listed in the notable changes section.
Removed Tests
addons/repl-domain-abort,parallel/test-repl-domain.js: We no longer rely on thedomainmodule, so testing it is no longer needed.parallel/test-repl-no-terminal-restore-process-listeners.js: An extension of the above — we no longer modify the ability to set process listeners.parallel/test-repl-uncaught-exception-async.js/parallel/test-repl-uncaught-exception.js/parallel/test-repl-tab-complete-nested-repls.js: An extension of the above; this test case no longer throws an error.known_issues/test-repl-require-context.js: This known issue has been resolved.parallel/test-repl-top-level-await.js: No need to test TLA — it's supported natively by the inspector.parallel/test-repl-preprocess-top-level-await.js: An extension of the above; the REPL no longer pre-processes top-level await.parallel/test-repl-preview-without-inspector.js: The REPL no longer works without the inspector.parallel/test-util-sigint-watchdog.js: This tested code that has been removed as part of this migration.pseudo-tty/repl-dumb-tty.js: There's currently no way to conditionally run these tests (run only when inspector is available).Fixes: #64523
Closes: #64534
Fixes: #39387
Closes: #39392
Fixes: #61390
Fixes: #63126
Fixes: #38503
Fixes: #37445
Fixes: #38145
Fixes: #33369
Fixes: #48131
Fixes: #8309
Fixes: #39689
Fixes: #18931
Notable Change
The REPL has been re-implemented on top of the V8 Inspector (
node:inspector) rather thannode:vm. This moves the REPL from a synchronous to an asynchronous evaluator and resolves long-standing design quirks that stemmed from thevm-based design:await, the--no-experimental-repl-awaitflag is no longer accepted, and top-levelawaitno longer corrupts the lexical scoping ofconst/letdeclarations. Additionally, statements that would normally return aPromiseare now awaited until they settle.import { readFile } from 'node:fs/promises'are now transformed into real dynamic imports and executed._and_errorare available even in REPLs with a modified context.uncaughtException) without disrupting evaluation.queueMicrotask/timer callbacks, andvmasync timeouts, no longer take down the process.Breaking changes
In addition to the removal of
--no-experimental-repl-awaitand similarawaitchanges noted above:SyntaxErroris no longer emitted in the main REPL; this information is still available programmatically in the stack trace.