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

6946 Commits

Author SHA1 Message Date
Brian White
7d0e50dcfe
crypto: add crypto.sign() and crypto.verify()
These methods are added primarily to allow signing and verifying
using Ed25519 and Ed448 keys, which do not support streaming of
input data. However, any key type can be used with these new
APIs, to allow better performance when only signing/verifying
a single chunk.

Fixes: https://github.com/nodejs/node/issues/26320
PR-URL: https://github.com/nodejs/node/pull/26611
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-03-28 21:57:53 -04:00
Sam Roberts
8c69e06972 tls: return an OpenSSL error from renegotiate
A generic error lacks any of the context or detail of the underlying
OpenSSL error, so throw from C++, and report the OpenSSL error to the
callback.

PR-URL: https://github.com/nodejs/node/pull/26868
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-03-28 14:03:25 -07:00
Ruben Bridgewater
805e614ba7
errors: make range mandatory in ERR_OUT_OF_RANGE
So far the range argument was allowed to be undefined. This is not
used in the codebase anymore and therefore it is best to make it
mandatory for the best user experience.

PR-URL: https://github.com/nodejs/node/pull/26924
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-03-28 21:45:18 +01:00
Simon Zünd
63e13fd220 util: only the first line of the error message
V8 extends the error message for JSON#stringify when encountering
circular structures. The first line of the new error message
is equivalent to the old error message and stays the same across
all circular structure errors.

PR-URL: https://github.com/nodejs/node/pull/26685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 16:39:25 -04:00
Tobias Nießen
c35acc0260
crypto: allow undefined for saltLength and padding
PR-URL: https://github.com/nodejs/node/pull/26921
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-03-28 14:33:03 +01:00
Matteo Collina
d4eda4d876 process: remove protection for SyncWriteStream destroy in stdio
https://github.com/nodejs/node/pull/26691 introduced an if to protect
against SyncWriteStream not using the default .destroy() mechanism.
This change removes that as SyncWriteStream now use standard .destroy().

See: https://github.com/nodejs/node/pull/26691

PR-URL: https://github.com/nodejs/node/pull/26902
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-03-28 13:54:15 +01:00
Ruben Bridgewater
4bfc06f6b5
util: improve proxy inspection
This makes sure the brace is actually handled as any other brace.
It was handled differently so far than any other brace and that had
an impact on how the output would be formatted.

PR-URL: https://github.com/nodejs/node/pull/26919
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-28 12:24:51 +01:00
Ruben Bridgewater
3cf1ffebab
path: fix win32 parse regression
This fixes the parse function for single character input that are not
a path separator.

PR-URL: https://github.com/nodejs/node/pull/26912
Fixes: https://github.com/nodejs/node/issues/26911
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-28 12:22:21 +01:00
Tobias Nießen
df1c9eb975
crypto: rename generateKeyPairEdDSA
Now that support for X25519 and X448 has been added, this function is
not used exclusively for EdDSA keys anymore.

PR-URL: https://github.com/nodejs/node/pull/26900
Refs: https://github.com/nodejs/node/pull/26774
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2019-03-28 11:13:08 +01:00
Rich Trott
86517c9f8f console: remove unreachable code
In the current code, line 497 checks if `item` is `null` or `undefined`.
However, `item` is guaranteed to be a non-null object or function at
that point.

* Lines 484/485 set `primitive` to `true` if `item` is null or
  undefined.
* Line 486 skips line 497 if `primitive` is true (which it will always
  be if `item` is null or undefined) and `properties` is undefined. So
  the only way to get to line 497 when `item` is null or undefined is if
  `properties` is specified.
* Line 494 skips line 497 if `primitive` is true (which it will always
  be if `item` is null or undefined) and `properties` are specified
  (which will always be the case or else this `else` block is skipped.)

Here are the current lines 484 through 497:

      const primitive = item === null ||
          (typeof item !== 'function' && typeof item !== 'object');
      if (properties === undefined && primitive) {
        hasPrimitives = true;
        valuesKeyArray[i] = _inspect(item);
      } else {
        const keys = properties || ObjectKeys(item);
        for (const key of keys) {
          if (map[key] === undefined)
            map[key] = [];
          if ((primitive && properties) || !hasOwnProperty(item, key))
            map[key][i] = '';
          else
            map[key][i] = item == null ? item : _inspect(item[key]);

This change removes the unnecessary ternary in that final line,
simplifying it to:

            map[key][i] = _inspect(item[key]);

PR-URL: https://github.com/nodejs/node/pull/26906
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-27 17:22:36 -07:00
Ruben Bridgewater
b5ea925c8e
util: don't set the prototype of callbackified functions
Using `util.callbackify()` should not set the prototype for the
returned function to the one from the input function. It could cause
confusion while debugging otherwise.

PR-URL: https://github.com/nodejs/node/pull/26893
Fixes: https://github.com/nodejs/node/issues/26890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-27 22:45:20 +01:00
Ruben Bridgewater
46bf0d0f4f
util: rename callbackified function
This makes sure the function returned by `util.callbackify()` has a
new name that is not identical to the inputs function name.

PR-URL: https://github.com/nodejs/node/pull/26893
Fixes: https://github.com/nodejs/node/issues/26890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-27 22:42:13 +01:00
Ruben Bridgewater
61d1334e5b
util: increase function length when using callbackify()
The returned function from `util.callbackify()` should increase the
`length` property by one due to the added callback.

PR-URL: https://github.com/nodejs/node/pull/26893
Fixes: https://github.com/nodejs/node/issues/26890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-27 22:42:12 +01:00
guybedford
b1094dbe19
esm: phase two of new esm implementation
This PR updates the current `--experimental-modules` implementation
based on the work of the modules team  and reflects Phase 2 of our
new modules plan.

The largest differences from the current implementation include

* `packge.type` which can be either `module` or `commonjs`
  - `type: "commonjs"`:
    - `.js` is parsed as commonjs
    - default for entry point without an extension is commonjs
  - `type: "module"`:
    - `.js` is parsed as esm
    - does not support loading JSON or Native Module by default
    - default for entry point without an extension is esm
* `--entry-type=[mode]`
  - allows you set the type on entry point.
* A new file extension `.cjs`.
  - this is specifically to support importing commonjs in the
    `module` mode.
  - this is only in the esm loader, the commonjs loader remains
    untouched, but the extension will work in the old loader if you use
    the full file path.
* `--es-module-specifier-resolution=[type]`
  - options are `explicit` (default) and `node`
  - by default our loader will not allow for optional extensions in
    the import, the path for a module must include the extension if
    there is one
  - by default our loader will not allow for importing directories that
    have an index file
  - developers can use `--es-module-specifier-resolution=node` to
    enable the commonjs specifier resolution algorithm
  - This is not a “feature” but rather an implementation for
    experimentation. It is expected to change before the flag is
    removed
* `--experimental-json-loader`
  - the only way to import json when `"type": "module"`
  - when enable all `import 'thing.json'` will go through the
    experimental loader independent of mode
  - based on https://github.com/whatwg/html/issues/4315
* You can use `package.main` to set an entry point for a module
  - the file extensions used in main will be resolved based on the
    `type` of the module

Refs: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
Refs: https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal
Refs: https://github.com/nodejs/modules/pull/180
Refs: https://github.com/nodejs/ecmascript-modules/pull/6
Refs: https://github.com/nodejs/ecmascript-modules/pull/12
Refs: https://github.com/nodejs/ecmascript-modules/pull/28
Refs: https://github.com/nodejs/modules/issues/255
Refs: https://github.com/whatwg/html/issues/4315
Refs: https://github.com/w3c/webcomponents/issues/770
Co-authored-by: Myles Borins <MylesBorins@google.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Evan Plaice <evanplaice@gmail.com>
Co-authored-by: Geoffrey Booth <webmaster@geoffreybooth.com>
Co-authored-by: Michaël Zasso <targos@protonmail.com>

PR-URL: https://github.com/nodejs/node/pull/26745
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2019-03-27 15:52:11 -04:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-27 17:20:06 +01:00
Ruben Bridgewater
115f0f5a57
module: throw an error for invalid package.json main entries
We currently ignore invalid `main` entries in package.json files.
This does not seem to be very user friendly as it's certainly an
error if the `main` entry is not a valid file name. So instead of
trying to resolve the file otherwise, throw an error immediately to
improve the user experience.
To keep it backwards compatible `index.js` files in the same directory
as the `package.json` will continue to be resolved instead but that
behavior is now deprecated.

PR-URL: https://github.com/nodejs/node/pull/26823
Fixes: https://github.com/nodejs/node/issues/26588
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-03-27 17:11:53 +01:00
Ruben Bridgewater
7bddfcc61a
lib: consolidate arrayBufferView validation
There are lots of places that validate for arrayBufferView and we
have multiple functions that do the same thing. Instead, move the
validation into `internal/validators` so all files can use that
instead.

There are more functions throughout the code that do the same but
it takes some more work to fully consolidate all of those.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:19 +01:00
Ruben Bridgewater
751c92d972
crypto: remove obsolete encoding check
This renames the parameters for clarity and removes the check for
undefined encoding. That will always default to `utf8`.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:18 +01:00
Ruben Bridgewater
92db780d9e
http2: rename function for clarity
The function does not only validate the input but it causes side
effects by adding default options to the input object in case the
option is not set.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:17 +01:00
Ruben Bridgewater
bbfa93af3d
url: refactor validateHostname
This function did not only validate the input but it returned a new
value in case the hostname was valid. This simplifies the function
by always returning the required value, no matter if it is valid or
invalid, so the callee site does not have to check that anymore. On
top the function is renamed to `getHostname` to make clear that the
function does not only validate the input but it also returns a new
value.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:17 +01:00
Ruben Bridgewater
ce265908eb
http2: remove side effects from validateSettings
The function did not only validate the input so far but it also made
a copy of the input object and returned that copy to the callee
function. That copy was not necessary for all call sites and it was
not obvious that the function did not only validate the input but
that it also returned a copy of it. This makes sure the function does
nothing more than validation and copying is happening in the callee
function when required.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:16 +01:00
Ruben Bridgewater
28e2c3771d
child_process: rename _validateStdtio to getValidStdio
The name indicated only validation while it did much more and it
returned a different value to the callee function. The underscore
was also not necessary as the function is internal one way or the
other.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:15 +01:00
Ruben Bridgewater
9e8c9be3ff
timers: rename validateTimerDuration to getTimerDuration
The function did not only validate the timer but it caused side
effects like a warning and potentially returned a different value
than the input value. Thus the name `validate` did not seem to be
appropriate.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:14 +01:00
Ruben Bridgewater
6c913fb028
lib: remove return values from validation functions
This makes sure the validation functions do not cause any side
effects. Validation functions should ideally only validate the input
without any other effect. Since the input value must be known from
the callee, there is no reason to return the input value.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:13 +01:00
Ruben Bridgewater
50a3fe20ea
lib: rename validateMode to parseMode
The function did not only validate the mode but it returns a new
value depending on the input. Thus `validate` did not seem to be an
appropriate name.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:12 +01:00
Daniel Bevenius
a8eac78f8d Revert "console: use consolePropAttributes for k-bind properties in constructor"
This reverts commit ed5e69d7e6.

PR-URL: https://github.com/nodejs/node/pull/26943
Refs: https://github.com/nodejs/node/pull/26850#issuecomment-477089697
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-27 13:59:33 +01:00
Beni von Cheni
ed5e69d7e6 console: use consolePropAttributes for k-bind properties in constructor
PR-URL: https://github.com/nodejs/node/pull/26850
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-27 05:59:43 +01:00
Joyee Cheung
83972ff6ac
process: handle --expose-internals during pre-execution
Instead of relying on the value of the CLI option when
executing bootstrap/loaders.js.

PR-URL: https://github.com/nodejs/node/pull/26759
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-26 13:53:36 -04:00
gengjiawen
8209caec39 tools: remove eslint rule no-let-in-for-declaration
PR-URL: https://github.com/nodejs/node/pull/26715
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-26 09:46:41 -07:00
Guy Bedford
53ebd3311d process: global.process, global.Buffer getters
PR-URL: https://github.com/nodejs/node/pull/26882
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-26 15:26:07 +02:00
dnlup
553c876a24 errors: remove usage of require('util')
Remove internal usage of `require('util').inspect`.

PR-URL: https://github.com/nodejs/node/pull/26781
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-03-26 07:26:08 +01:00
dnlup
b51a546488 lib: reduce usage of require('util')
Replace `require('util').inspect` and `require('util').format` with
`require('util/internal/inspect').inspect` and
`require('util/internal/inspect').format` in `lib/internal/errors.js`.

PR-URL: https://github.com/nodejs/node/pull/26782
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-26 06:23:23 +01:00
toshi1127
51256e5d78 fs: reduce usage of require('util')
PR-URL: https://github.com/nodejs/node/pull/26783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-26 09:08:37 +08:00
cjihrig
5de804e636
tools: enable getter-return lint rule
PR-URL: https://github.com/nodejs/node/pull/26615
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-25 20:02:10 -04:00
Ruben Bridgewater
97737fd5fb
repl: fix terminal default setting
This makes sure that the described default behavior for the
`terminal` option is actually always used and not only when running
the REPL as standalone program.

The options code is now logically combined instead of being spread
out in the big REPL constructor.

PR-URL: https://github.com/nodejs/node/pull/26518
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-25 16:28:07 +01:00
Ruben Bridgewater
96204c3c71
net: do not manipulate potential user code
The error provided in this function could come from user code. Thus
the error should not be manipulated in any way. The added properties
do not seem to provide any actual value either as can not be part
of the error. The `hostname` is already set on the error and adding
the `host` property with the identical value does not seem right in
this case.

PR-URL: https://github.com/nodejs/node/pull/26751
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-03-25 16:13:33 +01:00
Matteo Collina
bdea725bdc process: make stdout and stderr emit 'close' on destroy
Fix: https://github.com/nodejs/node/issues/26550

PR-URL: https://github.com/nodejs/node/pull/26691
Fixes: https://github.com/false
Fixes: https://github.com/nodejs/node/issues/26550
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-03-25 12:29:16 +01:00
Rich Trott
3f41fcbe83 Revert "net: remove usage of require('util')"
This reverts commit e112fb4c22.
This commit broke parallel/test-net-access-byteswritten.

PR-URL: https://github.com/nodejs/node/pull/26896
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-24 19:42:58 -07:00
Filip Skokan
85fda7e848
crypto: add support for x25119 and x448 KeyObjects
PR-URL: https://github.com/nodejs/node/pull/26774
Refs: https://github.com/nodejs/node/issues/26626
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-25 01:40:54 +01:00
dnlup
4a07a62d04
process: remove usage of require('util') in per_thread.js
Use `require('internal/util/inspect').format` instead of
`require('util').format`.

PR-URL: https://github.com/nodejs/node/pull/26817
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-25 00:37:12 +01:00
dnlup
e112fb4c22
net: remove usage of require('util')
Use `require('internal/util/inspect').inspect` and
`require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` and `require('util').inspect`.

PR-URL: https://github.com/nodejs/node/pull/26807
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-25 00:35:53 +01:00
dnlup
0f2bf72604
module: remove usage of require('util') in esm/translators.js
Use `require('internal/util/debuglog').debuglog` and
`require('internal/util').promisify`
instead of `require('util').debuglog` and `require('util').promisify` in
`lib/internal/modules/translators.js`.

PR-URL: https://github.com/nodejs/node/pull/26806
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-25 00:34:17 +01:00
dnlup
ad661ca209
module: remove usage of require('util') in esm/loader.js
Use `require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` in `lib/internal/modules/esm/loader.js`.

PR-URL: https://github.com/nodejs/node/pull/26804
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-25 00:33:06 +01:00
dnlup
005528ac82
module: remove usage of require('util') in cjs/loader.js
Use `require('internal/util').deprecate` instead of
`require('util').deprecate` in `lib/internal/modules/cjs/loader.js`.

PR-URL: https://github.com/nodejs/node/pull/26802
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-25 00:29:36 +01:00
nd-02110114
55e6c68170
tty: remove util.inherits usage
PR-URL: https://github.com/nodejs/node/pull/26797
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-25 00:26:49 +01:00
dnlup
e5383adb25
lib: remove usage of require('util')
Remove the usage of `require('util').inspect`.

PR-URL: https://github.com/nodejs/node/pull/26779
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-25 00:20:03 +01:00
dnlup
cf1b9d395d
lib: remove usage of require('util')
Remove usage of public `require('util').inspect` and
`require('util').formatWithOptions`.

PR-URL: https://github.com/nodejs/node/pull/26777
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-25 00:17:52 +01:00
dnlup
a1330af6a3
tls: remove usage of public require('util')
Remove the usage of public require('util'), as described in:
https://github.com/nodejs/node/issues/26546

PR-URL: https://github.com/nodejs/node/pull/26747
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-25 00:15:39 +01:00
Rich Trott
26f8af9feb console: remove unreachable code
The current version of lib/internal/console/constructor.js includes this
as part of line 470:

  setlike ? iterKey : indexKey

However, `setlike` is guaranteed to be true because we are inside of an
`if` block (starting on line 463) that explicitly checks that `setlike`
is true.

Coverage reporting confirms that `setliked` is always true when it is
reached in our tests.

Remove the ternary as the value provided will always be `iterKey`.

PR-URL: https://github.com/nodejs/node/pull/26863
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-24 14:58:18 -07:00
toshi1127
5b59b5f525 url: remove usage of require('util')
PR-URL: https://github.com/nodejs/node/pull/26808
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-24 22:09:47 +08:00