Antoine du Hamel
602aaf25af
async_hooks: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37125
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-02-02 10:54:29 +01:00
Anna Henningsen
69402522fd
fs: read full size if known in promises.readFile
...
If we have an estimate of the file size available from the previous
stat call, use that for the size of the first chunk to be read.
This increases performance by reading more data (and, most likely,
all data) at once without incurring memory overhead in most situations.
PR-URL: https://github.com/nodejs/node/pull/37127
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:54:28 +01:00
Anna Henningsen
ad12fefcb0
fs: only use Buffer.concat in promises.readFile when necessary
...
PR-URL: https://github.com/nodejs/node/pull/37127
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:54:28 +01:00
Antoine du Hamel
7196ac19c1
http: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37124
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:51:00 +01:00
cjihrig
181719d4c4
esm: update to correct deprecation code
...
https://github.com/nodejs/node/pull/36918 landed with references
to DEP0150, which is already used for a different deprecation.
This commit updates the code to use DEP0151.
PR-URL: https://github.com/nodejs/node/pull/37147
Refs: https://github.com/nodejs/node/pull/36918
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:50:59 +01:00
James M Snell
11dd2672cd
quic: remove quic
...
PR-URL: https://github.com/nodejs/node/pull/37067
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2021-02-02 10:50:12 +01:00
Guy Bedford
02f1d2fda4
esm: deprecate legacy main lookup for modules
...
PR-URL: https://github.com/nodejs/node/pull/36918
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-02-02 10:49:57 +01:00
cjihrig
3187845980
util: add internal createDeferredPromise()
...
The pattern of resolving/rejecting a Promise from outside of its
executor happens numerous times throughout the codebase (more than
what is updated here in fact). This commit abstracts that logic
into an internal utility function.
PR-URL: https://github.com/nodejs/node/pull/37095
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:47:41 +01:00
cjihrig
1714998e2c
readline: replace _questionCancel with a symbol
...
This commit avoids exposing a new underscored property on
readline Interface instances.
PR-URL: https://github.com/nodejs/node/pull/37094
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:47:41 +01:00
cjihrig
3d64d2b5ef
readline: check for null input in question()
...
question() checks for objects passed as the recently added options
argument. This commit improves that logic to also check for null.
PR-URL: https://github.com/nodejs/node/pull/37089
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-02-02 10:47:41 +01:00
ExE Boss
1f819ec47d
test: add tests for bound apply variants of varargs primordials
...
PR-URL: https://github.com/nodejs/node/pull/37005
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:47:40 +01:00
ExE Boss and Antoine du Hamel
ed58065d1f
lib: add bound apply variants of varargs primordials
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/37005
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:47:40 +01:00
67b58f68c9
lib: refactor to use validateObject
...
Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com >
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/37028
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:47:40 +01:00
Darshan Sen
6f54a14cda
fs: add validatePosition and use in read and readSync
...
PR-URL: https://github.com/nodejs/node/pull/37051
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-02-02 10:47:39 +01:00
ZiJian Liu
5227c5e6f5
lib: refactor to use validateFunction
...
add validateFunction and refactor to use validateFunction
PR-URL: https://github.com/nodejs/node/pull/37045
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:47:38 +01:00
Tobias Nießen
c4193ba8ae
crypto: fix encrypted private -> public import
...
PR-URL: https://github.com/nodejs/node/pull/37056
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-02-02 10:42:01 +01:00
Filip Skokan
cb3b0ec4fc
crypto: generateKeyPair('ec') should not support NODE-ED* and NODE-X*
...
Fixes https://github.com/nodejs/node/issues/37055
PR-URL: https://github.com/nodejs/node/pull/37063
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2021-02-02 10:42:01 +01:00
Antoine du Hamel
34adf7f74b
lib: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37029
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-02-02 10:42:01 +01:00
Rich Trott
9c69ca5e54
test,doc,lib: adjust object literal newlines for lint rule
...
Before enabling object-curly-newline for our ESLint rules, adjust files
to comply with it.
Refs: https://eslint.org/docs/rules/object-curly-newline
PR-URL: https://github.com/nodejs/node/pull/37040
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-02-02 10:42:00 +01:00
James M Snell
110063d694
crypto: add generatePrime/checkPrime
...
APIs for generating and checking pseudo-random primes
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36997
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-02-02 10:42:00 +01:00
Nitzan Uziely
2c7ad38c75
dgram: support AbortSignal in createSocket
...
PR-URL: https://github.com/nodejs/node/pull/37026
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:41:59 +01:00
Mattias Runge-Broberg
75124298d5
readline: add history event and option to set initial history
...
Add a history event which is emitted when the history has
been changed. This enables persisting of the history in
some way but also to allows a listener to alter the
history. One use-case could be to prevent passwords from
ending up in the history.
A constructor option is also added to allow for setting
an initial history list when creating a Readline interface.
PR-URL: https://github.com/nodejs/node/pull/33662
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:41:57 +01:00
Antoine du Hamel
175f6f0be3
fs: use throwIfNoEntry option on statSync calls
...
PR-URL: https://github.com/nodejs/node/pull/36975
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:41:57 +01:00
raisinten
4a1fc42178
lib: refactor to use optional chaining in internal/options.js
...
PR-URL: https://github.com/nodejs/node/pull/36939
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:41:57 +01:00
ZiJian Liu
ab64d74791
crypto: throw error on invalid object in diffieHellman()
...
PR-URL: https://github.com/nodejs/node/pull/37016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:41:56 +01:00
ZiJian Liu
b533485f32
quic: remove duplicate checks
...
PR-URL: https://github.com/nodejs/node/pull/37017
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-02 10:41:56 +01:00
Mattias Runge-Broberg
4e757eab96
readline: add support for the AbortController to the question method
...
In some cases a question asked needs to be canceled. For instance
it might be desirable to cancel a question when a user presses
ctrl+c and triggers the SIGINT event.
Also an initial empty string was set for this.line since the
cursor methods fail if line is not initialized.
Added custom promisify support to the question method.
PR-URL: https://github.com/nodejs/node/pull/33676
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-02-02 10:41:55 +01:00
Carlos Fuentes
7b78c6773d
child_process: allow promisified exec to be cancel
...
Using new AbortController, add support for promisified
exec to be cancelled.
PR-URL: https://github.com/nodejs/node/pull/34249
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:41:55 +01:00
ZiJian Liu
d76400a264
lib: refactor to use validateString
...
PR-URL: https://github.com/nodejs/node/pull/37006
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:41:55 +01:00
ZiJian Liu
a29da64b46
lib: refactor to use validateNumber
...
PR-URL: https://github.com/nodejs/node/pull/36993
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:41:55 +01:00
Darshan Sen
97fc7d8396
fs: refactor to remove redundant validation
...
The function makeCallback already calls validateCallback, so the call
inside copyFile can be removed.
PR-URL: https://github.com/nodejs/node/pull/36984
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-02 10:41:55 +01:00
ZiJian Liu
c4cab1f408
lib: refactor to use validateBoolean
...
PR-URL: https://github.com/nodejs/node/pull/36983
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-02-02 10:41:54 +01:00
James M Snell
53a0bdff47
crypto: experimental (Ed/X)25519/(Ed/X)448 support
...
Implements initial experimental support for Curve25519 and
Curve448 support for both ECDH and sign/verify in Web Crypto.
Introduced as a Node.js-specific extension to Web Crypto.
Signed-off-by: James M Snell <jasnell@gmail.com >
Fixes: https://github.com/nodejs/node/issues/36076
PR-URL: https://github.com/nodejs/node/pull/36879
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2021-02-02 10:41:54 +01:00
ZiJian Liu
8aeba3cb92
lib: refactor to use validateArray
...
PR-URL: https://github.com/nodejs/node/pull/36982
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-24 21:43:39 -05:00
ExE Boss
f2704170a3
util: prefer Reflect.ownKeys(…)
...
PR-URL: https://github.com/nodejs/node/pull/36740
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-24 21:43:37 -05:00
Juan José Arboleda
743dd8f89d
lib: remove non used getter in lib/perf_hooks.js
...
PR-URL: https://github.com/nodejs/node/pull/36907
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-24 21:43:36 -05:00
Ian Storm Taylor
70ee7dce62
http: attach request as res.req
...
This change makes it possible for userland http-related modules
to pave over edge cases that require referencing the original request
when handling a response--making a "Lodash for HTTP" library possible.
More information and research in https://github.com/nodejs/node/issues/28673
Fixes: https://github.com/nodejs/node/issues/28673
PR-URL: https://github.com/nodejs/node/pull/36505
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-01-24 21:43:36 -05:00
Robert Nagy
f07e1c9d03
http: abortIncoming only on socket close
...
Don't call abortIncombin twice for same socket, i.e. both during
'end' and 'close'.
PR-URL: https://github.com/nodejs/node/pull/36821
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-24 21:43:35 -05:00
James M Snell
775b34b822
buffer: introduce Blob
...
The `Blob` object is an immutable data buffer. This is a first step
towards alignment with the `Blob` Web API.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36811
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-24 21:43:34 -05:00
ZiJian Liu
3f75a60b51
perf_hooks: throw ERR_INVALID_ARG_VALUE if histogram.percentile param is NaN
...
Fixes: https://github.com/nodejs/node/issues/36936
PR-URL: https://github.com/nodejs/node/pull/36937
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-01-24 21:43:32 -05:00
raisinten
9951daefbd
repl: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36663
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-24 21:43:32 -05:00
Antoine du Hamel
5290d63e7f
module: simplify tryStatSync with throwIfNoEntry option
...
PR-URL: https://github.com/nodejs/node/pull/36971
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-24 21:43:32 -05:00
ZiJian Liu
dc596d0607
events: remove error listener on signal abort
...
Fixes: https://github.com/nodejs/node/issues/36949
PR-URL: https://github.com/nodejs/node/pull/36969
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-24 21:43:31 -05:00
Filip Skokan
832cd015d5
buffer: add base64url encoding option
...
PR-URL: https://github.com/nodejs/node/pull/36952
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-01-21 17:57:33 -05:00
ZiJian Liu
889654d36c
url: align url format behavior with browsers
...
Fixes: https://github.com/nodejs/node/issues/36887
PR-URL: https://github.com/nodejs/node/pull/36903
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2021-01-21 17:48:11 -05:00
Antoine du Hamel
f2ac4bb8e2
lib: expose primordials object
...
Expose the internal `primordials` object to help with Node.js core
development.
```console
$ node --expose-internals -r internal/test/binding lib/fs.js
(node:5299) internal/test/binding: These APIs are for internal testing
only. Do not use them.
(Use `node --trace-warnings ...` to show where the warning was created)
```
PR-URL: https://github.com/nodejs/node/pull/36872
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-21 17:48:10 -05:00
ExE Boss
850d3578b6
lib: refactor primordials.makeSafe to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36865
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-21 17:48:10 -05:00
zhangyongsheng
64fed319ef
url: expose urlToHttpOptions utility
...
PR-URL: https://github.com/nodejs/node/pull/35960
Fixes: https://github.com/nodejs/node/issues/34349
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-01-21 17:48:10 -05:00
Robert Nagy
aa7243e3d4
http: refactor ClientRequest destroy
...
PR-URL: https://github.com/nodejs/node/pull/36863
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-21 17:48:09 -05:00
Robert Nagy
80051abfcb
http: cleanup ClientRequest oncreate
...
PR-URL: https://github.com/nodejs/node/pull/36862
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daniele Belardi <dwon.dnl@gmail.com >
2021-01-21 17:48:09 -05:00