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.
6b050ce to
4312021
Compare
|
IIRC semver-major requires at least 2 TSC approvals, so cc @nodejs/TSC |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #64034 +/- ##
==========================================
- Coverage 90.23% 90.14% -0.09%
==========================================
Files 741 741
Lines 241604 241972 +368
Branches 45520 45538 +18
==========================================
+ Hits 218010 218128 +118
- Misses 15120 15357 +237
- Partials 8474 8487 +13
🚀 New features to boost your workflow:
|
**Description:** Adds an independent Rust/WebAssembly binding at `bindings/binding_nodejs_support_wasm`, published as `@swc/nodejs-support-wasm`. The package has its own Rust crate, sources, build scripts, tests, README, Cargo entry, and npm workspace entry. It does not build from `binding_typescript_wasm` and does not add features or exports to the existing `@swc/wasm-typescript` or `@swc/wasm-typescript-esm` packages. The new CommonJS package embeds its wasm binary and exposes these APIs at the top level: - `transform` - `transformSync` - `transformModuleSyntax` - `getFirstExpression` - `isValidSyntax` - `isRecoverableError` It also exports the related `Options`, `TransformOutput`, and `ModuleSyntaxTransformOutput` TypeScript types. The npm publish matrix, wasm CI matrix, release versioning, Cargo lockfile, and pnpm lockfile now reference the standalone `binding_nodejs_support_wasm` crate. Validation performed: - `git submodule update --init --recursive` - `cargo fmt --all -- --check` - `cargo test -p binding_typescript_wasm -p binding_nodejs_support_wasm` - `cargo clippy --all --all-targets -- -D warnings` - `(cd bindings/binding_nodejs_support_wasm && ./scripts/test.sh)` - `(cd bindings/binding_typescript_wasm && ./scripts/test.sh)` - `(cd bindings/binding_core_wasm && ./scripts/test.sh)` - `(cd bindings/binding_minifier_wasm && ./scripts/test.sh)` - `(cd bindings/binding_es_ast_viewer && ./scripts/test.sh)` - `(cd bindings/binding_nodejs_support_wasm/pkg && npm pack --dry-run --json)` - `pnpm install --frozen-lockfile --ignore-scripts` - `go run github.com/rhysd/actionlint/cmd/actionlint@latest .github/workflows/CI.yml .github/workflows/publish-npm-package.yml` **BREAKING CHANGE:** None. The existing TypeScript wasm packages and their public APIs are unchanged. **Related issue (if exists):** - Supports nodejs/node#64034 - Follow-up context from #11973
|
Bump! |
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 <me@aviv.sh> (@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 <me@aviv.sh>
- GitHub <noreply@github.com>
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 <dario.piotrowicz@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
------------------------------ 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 <dario.piotrowicz@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
--------------------------------------------------------------------------------
ℹ 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 <me@aviv.sh>
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 <me@aviv.sh>
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 <me@aviv.sh>
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 |
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.