Skip to content

repl: integrate experimental repl

Summary

This PR introduces an overhauled REPL for Node.js, building upon the groundwork laid by @devsnek and their team on nodejs/repl. While significant changes have been made to the team's prototype REPL, credit for the concept belongs to them for their initial codebase.

Modifications

Technical

  • Class: This REPL uses an ECMAScript class instead of the REPLServer function prototype.
  • Execution Context: Unlike the current REPL, which uses a mix of an inspector session and a virtual context, and the prototype REPL, which uses child_process and an inspector session, this REPL uses only a virtual context. (This allows for faster execution and less memory usage)

General

  • Syntax Highlighting: Real-time syntax highlighting is now a feature of this REPL using a custom implementation.
  • Runtime Variables: This REPL introduces an _X variable (where X is any line number), differing from the typical _ and _error variables.

Usage

To try out this experimental REPL, users must enable it with the --experimental-repl CLI flag; otherwise, the stable REPL remains unaffected.

Why?

While I love the current REPL, an experimental redesign has been in the works for a while, and in my opinion, it was completable, and while some decent changes and adjustments, it could find a home in Node.js.

Merge request reports

Loading