-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repl: integrate experimental repl #52593
Conversation
b3dcdfc
to
66b08ec
Compare
Note that a few 'little' bugs have been patched locally, but I don't want to force push for a little bit (so I can fix and test even more :-) ) |
REPL is a place where reliability is more important than speed, so definitely a part of the codebase where we'd want to avoid prototype pollution as much as possible. A solution that have been suggested was to run user code on a different realm, so the UI and user code can't interfere with one another. I think this is going to be a necessary condition before we can replace the current REPL and/or call it stable.
(Off topic, but removal of primordials is not realistic nor desirable any time soon IMO. Anyways, let's not discuss that here) |
Currently, I have this REPL running in it's own
Oh! I must've heard wrong information, I'll add primordials |
More accurately, you heard a different opinion :) It doesn't mean that my opinion is the correct one / the other opinion you heard is "wrong", deciding if primordials are worth it is subjective, so it should not be surprising there's no consensus on how/if they should be used. In the end, you are free to do as you please as long as the linter is happy (and the code is not on an error path / does not introduce perf regression). |
a0ee2b7
to
c09f639
Compare
Note In my latest commit, I changed the |
Well... I have my work cut out for me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
0a6d558
to
f5cf21a
Compare
All tests passed! CCing @nodejs/repl for review |
Requesting a CI test so verify all is in working order |
@aduh95 WDYT can be done about the dependencies? |
Like I said, it needs to be moved to |
Sure thing! I'll move the dependencies today :-) |
Once local linting and building is complete, I'll update the PR. Adding |
Added labels based on what the would've been if this PR opened with these changes. |
Sorry if you missed it, but like I said in my other comment, the censoring should happen in a separate PR so we can discuss whether we’re OK with taking a new dependency. |
Got it. |
I'll open a PR shortly, which will block this, so I added the 'blocked' label. |
@aduh95 I've implemented a basic syntax highlighter (I haven't decided on colors, right now it's all |
The ReGexes used are inspired from a variety of sources, so I need to condense them a bit |
[re-opened due to merge conflicts] |
Summary
This PR introduces an overhauled REPL for Node.js, inspired by 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
child_process
and an inspector session, this REPL uses only a virtual context.General
_
and_error
variables, this REPL has an_X
variable (whereX
is any line number)Upcoming Features
These features are under development but are not included in this integration (as they are incomplete)
Usage
To try out this experimental REPL, users must enable it with the
--experimental-repl
CLI flag; otherwise, the stable REPL remains unaffected.Limitations
While this iteration shows promise, it comes with certain limitations due to its experimental nature:
Why?
The Node.js REPL has remained unchanged for years, and it's time for a makeover.
Caution
This REPL is highly experimental, and its use may lead to unintended side effects.