0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

440 Commits

Author SHA1 Message Date
Luigi Pinca
b533fb3508 tools: enable no-else-return lint rule
Refs: https://github.com/nodejs/node/pull/32644
Refs: https://github.com/nodejs/node/pull/32662

PR-URL: https://github.com/nodejs/node/pull/32667
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-05-16 06:42:16 +02:00
Ruben Bridgewater
50ba066921 repl: improve repl autocompletion for require calls
This improves the autocompletion for require calls. It had multiple
small issues so far. Most important: it won't suggest completions for
require statements that are fully written out. Second, it'll detect
require calls that have whitespace behind the opening bracket. Third,
it makes sure node modules are detected as such instead of only
suggesting them as folders. Last, it adds suggestions for input that
starts with backticks.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33282
Fixes: https://github.com/nodejs/node/issues/33238
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2020-05-15 01:48:40 +02:00
Ruben Bridgewater
900daedbfe repl: replace hard coded core module list with actual list
This replaces the internally used hard coded Node.js core module
list with the actual internal existent modules. That way all modules
are automatically picked up instead of having to update the list
manually.

This currently only applies to the REPL and to the Node.js `eval`
functionality (User passed `-e` or `--eval` arguments to Node without
`-i` or `--interactive`).

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33282
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2020-05-15 01:48:17 +02:00
Ruben Bridgewater
b38d26a168 repl: show reference errors during preview
This aligns the behavior with the one in the Firefox console.
It will visualize ReferenceErrors in case the input has no possible
completion and no buffered input. That way typos can already be
highlighted before being evaluated.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33282
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2020-05-15 01:48:13 +02:00
Ruben Bridgewater
80913e655f repl: improve repl preview
This aligns the REPL preview with the one used in the Chrome
DevTools console. It will now preview the output for the input
including the completion suffix as input. When pressing enter while
previewing such data, it will automatically insert the suffix
before evaluating the input. When pressing escape, that behavior
is deactivated until the input is changed.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33282
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2020-05-15 01:48:08 +02:00
James M Snell
a0578714bf
repl: fixup error message
Use "cmd.action" instead of just "action" for ERR_INVALID_ARG_TYPE

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/32474
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-03-27 15:59:43 +01:00
Shelley Vohr
20a51b9dff
repl: eager-evaluate input in parens
PR-URL: https://github.com/nodejs/node/pull/31943
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-02-26 21:10:36 -08:00
Ruben Bridgewater
c3b702f9b4
repl: do not preview while pasting code
This makes sure no previews are triggered while pasting code. The
very last character is allowed to trigger the preview. The output
should be completely identical to the user.

PR-URL: https://github.com/nodejs/node/pull/31315
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-01-13 08:59:45 +01:00
Ruben Bridgewater
fe058188a1 repl,readline: clean up code
This simplifies code that was more complicated than it had to be
and removes code that should never be reached.

PR-URL: https://github.com/nodejs/node/pull/31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-11 14:06:45 -08:00
Ruben Bridgewater
95303629a4 repl: change preview default in case of custom eval functions
Custom eval functions might have a very different behavior than the
current implementation and having a preview in such case might be
confusing. This changes the preview default to `false` in case a
custom eval function is used. It is still possible to opt into using
the previews in case that's still desirable.

PR-URL: https://github.com/nodejs/node/pull/31259
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-01-10 04:35:37 -08:00
Sebastien Ahkrin
a494d12723 lib: add RegExp primordials
PR-URL: https://github.com/nodejs/node/pull/31208
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-01-07 19:26:15 -08:00
Sebastien Ahkrin
c9b93e2344 lib: replace use of Error with primordials
PR-URL: https://github.com/nodejs/node/pull/31163
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-01-04 14:50:18 -08:00
Sebastien Ahkrin
256c9a43f4 lib: replace Set global by the primordials
PR-URL: https://github.com/nodejs/node/pull/31154
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-01-04 12:41:09 -08:00
Sebastien Ahkrin
5dc55ede67 lib: replace WeakSet global by the primordials
PR-URL: https://github.com/nodejs/node/pull/31157
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-01-04 12:35:45 -08:00
Ruben Bridgewater
84c426cb60
repl: properly handle repl.repl
The repl property is set so that it's possible to inspect the
instances own properties during runtime. This was never tested and
it was also only exported in case the instance was started with
`.start()` instead of using the constructor directly. In case that
more than a single instance was created, all instances got access
to the first instance.

From now on the repl property is only exported in case the repl is
starte as standalone program.

PR-URL: https://github.com/nodejs/node/pull/30981
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-03 16:37:38 +01:00
Ruben Bridgewater
9e4349e797
repl: implement reverse search
Add a reverse search that works similar to the ZSH one. It is
triggered with <ctrl> + r and <ctrl> + s. It skips duplicated history
entries and works with multiline statements. Matching entries indicate
the search parameter with an underscore and cancelling with <ctrl> + c
or escape brings back the original line.
Multiple matches in a single history entry work as well and are
matched in the order of the current search direction. The cursor is
positioned at the current match position of the history entry.
Changing the direction immediately checks for the next entry in the
expected direction from the current position on.
Entries are accepted as soon any button is pressed that doesn't
correspond with the reverse search.
The behavior is deactivated for simple terminals. They do not support
most ANSI escape codes that are necessary for this feature.

PR-URL: https://github.com/nodejs/node/pull/31006
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-25 11:16:38 +01:00
Michaël Zasso
7e5bf80fd1
lib: enforce use of Promise from primordials
PR-URL: https://github.com/nodejs/node/pull/30936
Refs: https://github.com/nodejs/node/issues/30697
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-12-16 08:40:14 +01:00
Ruben Bridgewater
21ecaa47ee
repl: add completion preview
This improves the already existing preview functionality by also
checking for the input completion. In case there's only a single
completion, it will automatically be visible to the user in grey.
If colors are deactivated, it will be visible as comment.

This also changes some keys by automatically accepting the preview
by moving the cursor behind the current input end.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:26:35 +01:00
Ruben Bridgewater
6c542d1c26
repl: improve completion
This improves the completion output by removing the nested special
handling. It never fully worked as expected and required a lot of
hacks to even keep it working halfway reliable. Our tests did not
cover syntax errors though and those can not be handled by this
implementation. Those break the layout and confuse the REPL.

Besides that the completion now also works in case the current line
has leading whitespace.

Also improve the error output in case the completion fails.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:24:00 +01:00
Ruben Bridgewater
af5c8af5e9
repl,readline: refactor for simplicity
This just refactors code without changing the behavior. Especially
the REPL code is difficult to read and deeply indented. This reduces
the indentation to improve that.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:23:59 +01:00
Ruben Bridgewater
52e5eb7e52
repl,readline: refactor common code
This renames some variables for clarity and moves the common substring
part into a shared file. One algorithm was more efficient than the
other but the functionality itself was identical.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:23:59 +01:00
Ruben Bridgewater
1aab392cf3
repl: simplify code
This simplifies some repl code and removes a code branch that is
unreachable.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:23:53 +01:00
Ruben Bridgewater
37f6a42f72
repl: simplify repl autocompletion
This simplifies calling `filteredOwnPropertyNames()`. The context
is not used in that function, so there's no need to call the function
as such.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:22:26 +01:00
Ruben Bridgewater
7327f390f6
repl: remove dead code
The .scope command was used only in the old debugger. Since that's
not part of core anymore it's does not have any use. I tried to
replicate the expected behavior but it even results in just exiting
the repl immediately when using the completion similar to the removed
test case.

PR-URL: https://github.com/nodejs/node/pull/30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-15 16:22:24 +01:00
Michaël Zasso
8e58c7557b repl: fix autocomplete when useGlobal is false
This fixes two issues in the REPL when it is started with a new context
(useGlobal option set to `false`):
- The `primordials` object does not contain all builtins, so the
  filtering based on property names from `primordials` was wrong.
- The autocompleter did not take builtin names into account because
  they are not properties of the context object.

A list of all global builtin names is created lazily when needed. It is
used for filtering for the copy and for adding those names to the
autocompleter list.

Fixes: https://github.com/nodejs/node/issues/30792

PR-URL: https://github.com/nodejs/node/pull/30883
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-12-13 20:51:48 -05:00
Ruben Bridgewater
6bdf8d1060
repl: support previews by eager evaluating input
This adds input previews by using the inspectors eager evaluation
functionality.
It is implemented as additional line that is not counted towards
the actual input. In case no colors are supported, it will be visible
as comment. Otherwise it's grey.
It will be triggered on any line change. It is heavily tested against
edge cases and adheres to "dumb" terminals (previews are deactived
in that case).

PR-URL: https://github.com/nodejs/node/pull/30811
Fixes: https://github.com/nodejs/node/issues/20977
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-12-10 00:23:23 +01:00
Sebastien Ahkrin
eac3f0adc4
lib: replace Symbol global by the primordials Symbol
PR-URL: https://github.com/nodejs/node/pull/30737
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-12-08 13:38:58 +01:00
Ruben Bridgewater
6c40cb2aca
repl: use better uncaught exceptions indicator
This switches "Thrown:" with "Uncaught" to outline clearer that the
thrown error is not caught.

PR-URL: https://github.com/nodejs/node/pull/29676
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-12-06 02:10:58 +01:00
Corey Farrell
49fb529139
repl: fix referrer for dynamic import
The ESM loader does not accept a directory as the referrer, it requires
a path within the directory.  Add `/repl` to ensure relative dynamic
imports can succeed.

Fixes: https://github.com/nodejs/node/issues/19570

PR-URL: https://github.com/nodejs/node/pull/30609
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
2019-11-30 20:07:52 -08:00
Rich Trott
359766b2c3 benchmark,doc,lib,test: prepare for padding lint rule
Upcoming lint rule will require a blank line between consecutive
functions. Add it in the places where we don't have it already.

PR-URL: https://github.com/nodejs/node/pull/30696
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-11-30 06:28:29 -08:00
Michaël Zasso
1f9a5ae7aa
lib: use static Number properties from primordials
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-11-30 13:45:38 +01:00
Michaël Zasso
141a6e34ee
lib: enforce use of Array from primordials
PR-URL: https://github.com/nodejs/node/pull/30635
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-11-27 19:29:01 +01:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.

PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-25 10:28:15 +01:00
Guy Bedford
796f3d0af4
esm: unflag --experimental-modules
PR-URL: https://github.com/nodejs/node/pull/29866
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2019-11-12 14:04:55 -08:00
Bradley Farias
a6b030d5ac module: refactor modules bootstrap
PR-URL: https://github.com/nodejs/node/pull/29937
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-10-16 21:50:05 -04:00
Gus Caplan
70c2444155 lib: stop using prepareStackTrace
PR-URL: https://github.com/nodejs/node/pull/29777
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-10-02 16:17:01 -07:00
Lucas Holmquist
ac41959922 repl: convert var to let and const
Refs: https://github.com/nodejs/node/pull/29535

This PR replaces the instances of var with let/const.

PR-URL: https://github.com/nodejs/node/pull/29575
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-09-18 17:04:55 -07:00
zhangyongsheng
2f497a67ad repl: fix bug in fs module autocompletion
PR-URL: https://github.com/nodejs/node/pull/29555
Fixes: https://github.com/nodejs/node/issues/29424
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-09-18 09:58:59 +08:00
antsmartian
ed0e5c8c74 repl: add autocomplete support for fs.promises
PR-URL: https://github.com/nodejs/node/pull/29400
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-09-15 21:45:41 -07:00
Lucas Holmquist
30e919a3cf repl: add missing variable declaration
* Adds `let` to a variable declaration in a for loop
  that wasn't using anything.

* Declare the for initial expression in the for loop.

* Remove hoisted variables for loops.

PR-URL: https://github.com/nodejs/node/pull/29535
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-09-14 06:18:00 -07:00
Bradley Farias
cdebd32461 esm: make dynamic import work in the REPL
PR-URL: https://github.com/nodejs/node/pull/29437
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-09-06 11:47:32 -05:00
Ruben Bridgewater
7e977d7cd4 repl: fix some repl context issues
This partially fixes contexts like `{} instanceof Object === false`
in the REPL. This does not fix all cases, since it's something
fundamental from the REPL's design that things like these can happen.

Refs: https://github.com/nodejs/node/issues/27859

PR-URL: https://github.com/nodejs/node/pull/28561
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-07-17 20:59:12 -07:00
Ruben Bridgewater
6874aa1fb1 repl: fix autocomplete while using .load
This makes sure that complete functions work as expected after using
the REPL's `.load` command.

It also fixes the corresponding test. So far the assertion where
swallowed and the test passed even though it should not have.

Fixes: https://github.com/nodejs/node/issues/28546
PR-URL: https://github.com/nodejs/node/pull/28608
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-07-17 20:57:51 -07:00
Gus Caplan
e2c0c0c680
lib: rework logic of stripping BOM+Shebang from commonjs
Fixes https://github.com/nodejs/node/issues/27767

PR-URL: https://github.com/nodejs/node/pull/27768
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-05-26 13:04:29 -05:00
Ruben Bridgewater
422e8f7628
repl: handle uncaughtException properly
When running the REPL as standalone program it's now possible to use
`process.on('uncaughtException', listener)`. It is going to use those
listeners from now on and the regular error output is suppressed.

It also fixes the issue that REPL instances started inside of an
application would silence all application errors. It is now prohibited
to add the exception listener in such REPL instances. Trying to add
such listeners throws an `ERR_INVALID_REPL_INPUT` error.

Fixes: https://github.com/nodejs/node/issues/19998

PR-URL: https://github.com/nodejs/node/pull/27151
Fixes: https://github.com/nodejs/node/issues/19998
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-05-08 08:15:15 +02:00
Anto Aravinth
d69f004657 repl: add autocomplete for filesystem modules
PR-URL: https://github.com/nodejs/node/pull/26648
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-29 07:28:27 +05:30
Joyee Cheung
19e3e02a2d
src: move SIGINT watchdog utils to the contextify binding
These are used when evaluating scripts so it makes more sense
to put them in the contextify binding whose other methods are
going to be used together.

PR-URL: https://github.com/nodejs/node/pull/27290
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-22 18:43:40 +08:00
Michaël Zasso
908292cf1f lib: enforce the use of Object from primordials
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2019-04-12 05:38:45 +02:00
Ruben Bridgewater
d11c4beb4b
module: remove dead code
This removes a lot of code that has no functionality anymore. All
Node.js internal code calls `_resolveLookupPaths` with two arguments.

The code that validates `index.js` is not required at all as we check
for these files anyway, so it's just redundant code that should be
removed.

PR-URL: https://github.com/nodejs/node/pull/26983
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-04-08 18:56:17 +02:00
Michaël Zasso
0817840f77 lib: force using primordials for JSON, Math and Reflect
Use the "no-restricted-globals" ESLint rule to lint for it.

PR-URL: https://github.com/nodejs/node/pull/27027
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-04-03 21:36:08 +08:00