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

59 Commits

Author SHA1 Message Date
Gabriel Bota
a3abc42587
async_hooks,inspector: implement inspector api without async_wrap
Implementing the inspector session object as an async resource causes
unwanted context change when a breakpoint callback function is being
called. Modelling the inspector api without the AsyncWrap base class
ensures that the callback has access to the AsyncLocalStorage instance
that is active in the affected user function.

See `test-inspector-async-context-brk.js` for an illustration of the
use case.

PR-URL: https://github.com/nodejs/node/pull/51501
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2024-01-24 13:29:28 +00:00
Yagiz Nizipli
0056147a87
src: add process.loadEnvFile and util.parseEnv
PR-URL: https://github.com/nodejs/node/pull/51476
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-01-23 18:46:26 +00:00
James M Snell
c3664227a8 quic: add quic internalBinding, refine Endpoint, add types
PR-URL: https://github.com/nodejs/node/pull/51112
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2023-12-26 16:27:49 -08:00
Yagiz Nizipli
bfa2eebdb2
fs: remove internalModuleReadJSON binding
PR-URL: https://github.com/nodejs/node/pull/51224
Refs: https://github.com/nodejs/node/commit/45e4f82912
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
2023-12-21 21:23:20 +00:00
Yagiz Nizipli
3551dc07eb
fs: throw fchownSync error from c++
PR-URL: https://github.com/nodejs/node/pull/51075
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-12-12 00:34:47 +00:00
Yagiz Nizipli
01dae5f877
lib,src: replace toUSVString with toWellFormed()
PR-URL: https://github.com/nodejs/node/pull/47342
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-11-29 16:00:57 +00:00
CanadaHonk
4466deeb34
fs: add c++ fast path for writeFileSync utf8
PR-URL: https://github.com/nodejs/node/pull/49884
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-11-27 00:01:39 +00:00
CanadaHonk
f11b2061ea
fs: improve error performance for rmdirSync
PR-URL: https://github.com/nodejs/node/pull/49846
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-11-26 19:23:41 +00:00
CanadaHonk
ea88a3e1f2
fs: improve error perf of sync lstat+fstat
PR-URL: https://github.com/nodejs/node/pull/49868
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-11-23 00:25:15 +00:00
Yagiz Nizipli
f13dbfd43a src: move package resolver to c++
Co-authored-by: Daniel Lemire <daniel@lemire.me>
PR-URL: https://github.com/nodejs/node/pull/50322
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-11-17 00:16:38 +00:00
Jungku Lee
506858bf13
fs: improve error performance for readSync
PR-URL: https://github.com/nodejs/node/pull/50033
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-21 02:00:00 +00:00
Jungku Lee
fbd08ec4f3
fs: improve error performance for fsyncSync
PR-URL: https://github.com/nodejs/node/pull/49880
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-20 23:39:14 +00:00
CanadaHonk
c37cf1832c
fs: improve error performance for mkdirSync
PR-URL: https://github.com/nodejs/node/pull/49847
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-20 23:39:03 +00:00
Yagiz Nizipli
1a5db6f173 fs: improve error performance of realpathSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:27 +00:00
Yagiz Nizipli
5f0276d7a0 fs: improve error performance of lchownSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:26 +00:00
Yagiz Nizipli
449dc45691 fs: improve error performance of symlinkSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:25 +00:00
Yagiz Nizipli
7603bf5b81 fs: improve error performance of readlinkSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:24 +00:00
Yagiz Nizipli
d68996538c fs: improve error performance of mkdtempSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:23 +00:00
Yagiz Nizipli
6b566415e8 fs: improve error performance of linkSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:22 +00:00
Yagiz Nizipli
1635366ad4 fs: improve error performance of chownSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:21 +00:00
Yagiz Nizipli
a7e40f5ce5 fs: improve error performance of renameSync
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-18 15:56:20 +00:00
Yagiz Nizipli
18a818744f
fs: improve error performance of readdirSync
PR-URL: https://github.com/nodejs/node/pull/50131
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2023-10-14 19:35:01 +00:00
Niklas Mollenhauer
9df864ddeb
typings: use Symbol.dispose and Symbol.asyncDispose in types
PR-URL: https://github.com/nodejs/node/pull/50123
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
2023-10-14 06:41:59 +00:00
Yagiz Nizipli
d3985296a9
fs: fix unlinkSync typings
PR-URL: https://github.com/nodejs/node/pull/49859
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-12 11:14:37 -04:00
CanadaHonk
6bc7fa7906
fs: improve error perf of sync chmod+fchmod
PR-URL: https://github.com/nodejs/node/pull/49859
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-12 11:14:34 -04:00
CanadaHonk
6bd77db41f
fs: improve error perf of sync *times
PR-URL: https://github.com/nodejs/node/pull/49864
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-12 11:12:19 -04:00
Jungku Lee
f7a160d5b4
fs: improve error performance for fdatasyncSync
PR-URL: https://github.com/nodejs/node/pull/49898
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-10-04 00:19:13 +00:00
Yagiz Nizipli
05be31d5de
esm: improve getFormatOfExtensionlessFile speed
PR-URL: https://github.com/nodejs/node/pull/49965
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-10-01 18:32:07 +00:00
Sam Verschueren
1b96975f27
lib: fix primordials typings
PR-URL: https://github.com/nodejs/node/pull/49895
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-09-29 13:58:42 +00:00
Yagiz Nizipli
da7962fd4d
lib: fix internalBinding typings
PR-URL: https://github.com/nodejs/node/pull/49742
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-09-23 10:48:34 +00:00
Yagiz Nizipli
607a545904 url: overload canParse V8 fast api method
PR-URL: https://github.com/nodejs/node/pull/48993
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-08-12 22:34:46 +00:00
Yagiz Nizipli
e0500d6e88
url: fix canParse false value when v8 optimizes
PR-URL: https://github.com/nodejs/node/pull/48817
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2023-07-17 20:29:05 -04:00
Moshe Atlow
71d7707792
fs, stream: initial Symbol.dispose and Symbol.asyncDispose support
Co-authored-by: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/48518
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-06-25 11:18:54 +00:00
Yagiz Nizipli
4d00da328a
typings: remove unused primordials
PR-URL: https://github.com/nodejs/node/pull/48509
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-06-23 15:45:29 +00:00
Yagiz Nizipli
3867641c14 url: use ada::url_aggregator for parsing urls
PR-URL: https://github.com/nodejs/node/pull/47339
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2023-04-05 09:05:27 -07:00
Tobias Nießen
1640aeb680
crypto: remove obsolete SSL_OP_* constants
None of these constants have any effect in recent OpenSSL versions, not
even in Node.js release lines that still use OpenSSL 1.1.1.

It is likely rare that these options are still used (intentionally), and
removing them is unlikely to break any existing applications. These
constants can only be passed to the secureOptions option of
tls.createSecureContext() and related APIs, and a value of undefined
will be ignored. Similarly, if a bitwise combination of multiple options
is used, undefined constants will not change the behavior because
(a | undefined | b) === (a | b) for (small) integers a and b.

Refs: https://github.com/nodejs/node/pull/46954
Refs: https://github.com/nodejs/node/pull/47066
PR-URL: https://github.com/nodejs/node/pull/47073
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2023-03-21 10:47:49 +00:00
Tobias Nießen
c2e4b1fa9a
crypto: remove ALPN_ENABLED
This constant was likely introduced for feature detection, but it has
been pointless for a long time.

1. I am not aware of any possible Node.js build configuration (on any
   recent/supported release line) that would have crypto.constants but
   not crypto.constants.ALPN_ENABLED.
2. There is no evidence of this constant being used for feature
   detection in the ecosystem. In fact, both internal and external type
   definitions for crypto.constants simply assume that the constant
   exists.
3. There is no good reason for any modern TLS stack to not support ALPN.
   It looks like ALPN might have been optional in much earlier versions
   of OpenSSL, but all recent versions of OpenSSL unconditionally
   support ALPN as far as I can tell.

Refs: https://github.com/nodejs/node/pull/46956
PR-URL: https://github.com/nodejs/node/pull/47028
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-03-13 14:11:35 +00:00
Antoine du Hamel
0c460518e8
typings: improve primordials typings
PR-URL: https://github.com/nodejs/node/pull/46970
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-03-08 10:47:26 +00:00
Antoine du Hamel
e7f172c191
crypto: refactor ArrayBuffer to bigint conversion utils
PR-URL: https://github.com/nodejs/node/pull/45567
Refs: https://github.com/nodejs/performance/issues/16
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-11-27 18:27:21 +00:00
Daeyeon Jeong
deb7710a94
src: remove unused contextify_global_private_symbol
`contextify_global_private_symbol` is no longer used. It was used
to hold a new context's global object, but the approach has been
changed to hold a ContextifyContext wrapper using
`contextify_context_private_symbol`.

Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45128
Refs: https://github.com/nodejs/node/pull/44796
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2022-10-24 18:17:19 +00:00
Ben Noordhuis
fdadea8f6e src: optimize ALPN callback
It doesn't make sense from a performance perspective to retain an
arraybuffer with the ALPN byte string and look it up as a property on
the JS context object for every TLS handshake.

Store the byte string in the C++ TLSWrap object instead. That's both
a lot faster and a lot simpler.

PR-URL: https://github.com/nodejs/node/pull/44875
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-10-19 19:26:43 +00:00
Darshan Sen
42eb2e72de
src: use a typed array internally for process._exiting
This would prevent manual writes to the _exiting JS property on the
process object by passing the data directly via a typed array for
performance.

This change partially addresses this TODO:
3d575a4f1b/src/api/hooks.cc (L68-L71)

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43883
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-07-31 07:32:00 +01:00
Gerhard Stöbich
da399a6c8e
async_hooks: remove destroyed symbol on Promises
Promises are never destroyed manually therefore it's not needed to
attach an object to track if destroy hook was called already.

PR-URL: https://github.com/nodejs/node/pull/42402
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2022-03-21 20:35:05 +00:00
ExE Boss
c93ba41e48
typings: add types for symbol and accessor properties on primordials
PR-URL: https://github.com/nodejs/node/pull/40992
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-12-31 00:47:04 +01:00
Mestery
61a73f80c7
typings: add more bindings typings
PR-URL: https://github.com/nodejs/node/pull/40415
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-10-31 13:41:45 +01:00
Mestery
b66a75a3a4 typings: improve internal bindings typings
PR-URL: https://github.com/nodejs/node/pull/40411
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-10-28 07:52:29 +00:00
Mestery
a397009269 typings: separate internalBinding typings
PR-URL: https://github.com/nodejs/node/pull/40409
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
2021-10-20 12:08:28 +00:00
Michaël Zasso
9467cbadcb
typings: define types for os binding
PR-URL: https://github.com/nodejs/node/pull/40222
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-10-10 11:03:52 +02:00
Michaël Zasso
70a5b86049
typings: add missing types to options and util bindings
PR-URL: https://github.com/nodejs/node/pull/40222
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-10-10 11:03:22 +02:00
Michaël Zasso
3815a21beb
typings: define types for timers binding
PR-URL: https://github.com/nodejs/node/pull/40222
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-10-10 11:03:05 +02:00