Yagiz Nizipli
1a21e0f61e
esm: improve defaultResolve performance
...
PR-URL: https://github.com/nodejs/node/pull/53711
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-07-16 12:01:11 +02:00
Antoine du Hamel and Yagiz Nizipli
7debb6c36e
http: remove prototype primordials
...
Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com >
PR-URL: https://github.com/nodejs/node/pull/53698
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-07-16 12:01:11 +02:00
Joyee Cheung
a9db553935
src: refactor embedded entrypoint loading
...
This patch:
1. Refactor the routines used to compile and run an embedder
entrypoint. In JS land special handling for SEA is done
directly in main/embedding.js instead of clobbering the CJS
loader. Add warnings to remind users that currently the
require() in SEA bundled scripts only supports loading builtins.
2. Don't use the bundled SEA code cache when compiling CJS
loaded from disk, since in that case we are certainly not
compiling the code bundled into the SEA. Use a is_sea_main
flag in CompileFunctionForCJSLoader() (which replaces an unused
argument) to pass this into the C++ land - the code cache is
still read directly from C++ to avoid the overhead of
ArrayBuffer creation.
3. Move SEA loading code into
MaybeLoadSingleExecutableApplication() which calls
LoadEnvironment() with its own StartExecutionCallback().
This avoids more hidden switches in StartExecution() and
make them explicit. Also add some TODOs about how to support
ESM in embedded applications.
4. Add more comments
PR-URL: https://github.com/nodejs/node/pull/53573
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-07-16 12:01:11 +02:00
Antoine du Hamel and Yagiz Nizipli
1397f5d9f4
http2: remove prototype primordials
...
Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com >
PR-URL: https://github.com/nodejs/node/pull/53696
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-07-16 12:01:10 +02:00
Yagiz Nizipli
262f2cb3b6
esm: remove unnecessary toNamespacedPath calls
...
PR-URL: https://github.com/nodejs/node/pull/53656
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-07-16 12:01:09 +02:00
Yagiz Nizipli
cbe77b30ca
lib: move ToNamespacedPath call to c++
...
PR-URL: https://github.com/nodejs/node/pull/53654
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-07-16 12:01:09 +02:00
James M Snell
0f146aac2c
lib: make navigator properties lazy
...
Noticed in some benchmarking/profiling that the Navigator object
constructor was rather expensive and slow due to initialization
of properties during construction. It makes more sense for these
to be lazily initialized on first access.
PR-URL: https://github.com/nodejs/node/pull/53649
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-07-16 12:01:08 +02:00
Geoffrey Booth
e6a1eeb73d
test_runner: support module detection in module mocks
...
PR-URL: https://github.com/nodejs/node/pull/53642
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-07-16 12:01:08 +02:00
theanarkh
0540308bd7
lib: add toJSON to PerformanceMeasure
...
PR-URL: https://github.com/nodejs/node/pull/53603
Refs: https://github.com/nodejs/node/issues/53570
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-07-16 12:01:05 +02:00
Filip Skokan
3cc01aa314
crypto: make deriveBits length parameter optional and nullable
...
PR-URL: https://github.com/nodejs/node/pull/53601
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-07-16 12:01:05 +02:00
jakecastelli and wh0
82d88a83f8
stream: pipeline wait for close before calling the callback
...
The pipeline should wait for close event to finish before calling
the callback.
The `finishCount` should not below 0 when calling finish function.
Fixes: https://github.com/nodejs/node/issues/51540
Co-authored-by: wh0 <wh0@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/53462
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2024-07-16 12:01:04 +02:00
RafaelGSS
0a0de3d491
lib,permission: support fs.lstat
...
PR-URL: https://github.com/nodejs-private/node-private/pull/486/
Fixes: https://hackerone.com/bugs?subject=nodejs&report_id=2145862
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
CVE-ID: CVE-2024-22018
2024-07-06 13:30:12 -03:00
RafaelGSS
110902ff5e
lib,esm: handle bypass network-import via data:
...
PR-URL: https://github.com/nodejs-private/node-private/pull/522
Fixes: https://hackerone.com/bugs?subject=nodejs&report_id=2092749
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
CVE-ID: CVE-2024-22020
2024-07-06 13:29:23 -03:00
codediverdev
b5fc227344
lib: fix typo in comment
...
Small update in a realm.js documentation comment to correct `js2c.py`
which was ported to `js2c.cc` and removed.
PR-URL: https://github.com/nodejs/node/pull/53543
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-06-25 11:17:06 +02:00
RafaelGSS and Stephen Belanger
e95af740fc
lib: add diagnostics_channel events to module loading
...
This commit adds a tracing channel for module loading
through `import()` and `require()`.
Co-Authored-By: Stephen Belanger <admin@stephenbelanger.com >
PR-URL: https://github.com/nodejs/node/pull/44340
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2024-06-21 11:05:40 +02:00
ehsankhfr
41100b65f6
http2: reject failed http2.connect when used with promisify
...
PR-URL: https://github.com/nodejs/node/pull/53475
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-06-20 15:38:30 +02:00
cjihrig
9e30724b53
deps,lib,src: add experimental web storage
...
This commit introduces an experimental implementation of the Web
Storage API using SQLite as the backing data store.
PR-URL: https://github.com/nodejs/node/pull/52435
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-06-20 15:38:01 +02:00
Yagiz Nizipli and Daniel Lemire
105b006fd2
fs: move ToNamespacedPath to c++
...
Co-Authored-By: Daniel Lemire <daniel@lemire.me >
PR-URL: https://github.com/nodejs/node/pull/52135
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-06-20 14:45:27 +02:00
Zhenwei Jin
50733a1abe
util: support --no- for argument with boolean type for parseArgs
...
PR-URL: https://github.com/nodejs/node/pull/53107
Refs: https://github.com/nodejs/node/issues/53095
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-06-20 14:45:26 +02:00
theanarkh
123910f1de
lib: remove the unused code
...
PR-URL: https://github.com/nodejs/node/pull/53463
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-06-20 14:45:17 +02:00
Matteo Collina
568377f7f0
fs: do not crash if the watched file is removed while setting up watch
...
Signed-off-by: Matteo Collina <hello@matteocollina.com >
PR-URL: https://github.com/nodejs/node/pull/53452
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
2024-06-20 14:45:16 +02:00
Daniel Lemire and Chris Harvey
9f32002397
assert,util: correct comparison when both contain same reference
...
Co-authored-by: Chris Harvey <1362083+chharvey@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/53431
Refs: https://github.com/nodejs/node/issues/53423
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-06-20 14:45:16 +02:00
Yagiz Nizipli
fad179307c
fs: add fast api for InternalModuleStat
...
PR-URL: https://github.com/nodejs/node/pull/51344
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-20 14:45:15 +02:00
Khafra
452011b719
lib: speed up MessageEvent creation internally
...
PR-URL: https://github.com/nodejs/node/pull/52951
Refs: https://github.com/nodejs/undici/pull/3170
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-20 14:45:15 +02:00
eded1e9768
stream: support dispose in writable
...
Add support to Symbol.asyncDispose in writable streams.
Additionally add a test for writable, transform and duplex streams
who inherit from readable/writable to avoid breakage.
Co-authored-by: Robert Nagy <ronagy@icloud.com >
Co-authored-by: atlowChemi <chemi@atlow.co.il >
PR-URL: https://github.com/nodejs/node/pull/48547
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-20 14:45:15 +02:00
jakecastelli
b3372a8b0e
stream: callback should be called when pendingcb is 0
...
Fixes: https://github.com/nodejs/node/issues/46170
PR-URL: https://github.com/nodejs/node/pull/53438
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-20 14:45:14 +02:00
Yagiz Nizipli
710cf7758c
lib: reduce amount of caught URL errors
...
PR-URL: https://github.com/nodejs/node/pull/52658
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
2024-06-20 14:40:45 +02:00
Deokjin Kim
45b59e58d1
lib: fix naming convention of Symbol
...
`node.js` prefix is used for global symbol(`Symbol.for`).
So remove `node.js` prefix from `Symbol` usage.
Refs: https://github.com/nodejs/node/blob/main/doc/contributing/using-symbols.md#symbolforstring
PR-URL: https://github.com/nodejs/node/pull/53387
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-06-20 14:40:40 +02:00
jakecastelli
f4efb7f625
stream: make sure _destroy is called
...
PR-URL: https://github.com/nodejs/node/pull/53213
Fixes: https://github.com/nodejs/node/issues/51987
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-06-20 14:40:40 +02:00
jakecastelli and Robert Nagy
7dde37591c
stream: prevent stream unexpected pause when highWaterMark set to 0
...
Co-authored-by: Robert Nagy <ronagy@icloud.com >
PR-URL: https://github.com/nodejs/node/pull/53261
Fixes: https://github.com/nodejs/node/issues/51930
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-20 14:40:38 +02:00
theanarkh
515dd24ee7
lib: fix timer leak
...
PR-URL: https://github.com/nodejs/node/pull/53337
Fixes: https://github.com/nodejs/node/issues/53335
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
2024-06-20 14:40:37 +02:00
Luke Haas
e66eb376a0
repl: fix await object patterns without values
...
fix lint issue
PR-URL: https://github.com/nodejs/node/pull/53331
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com >
2024-06-07 10:37:16 -03:00
Tobias Nießen
505e9a425b
lib: fix misleading argument of validateUint32
...
The type of the argument `positive` was declared as `boolean|number`,
which is misleading because the function treats it as a boolean only.
Some call sites even passed numbers, specifically, either `0` or `1`,
which happen to work as expected because they are interpreted as `false`
and `true`, respectively. However, passing `2` would silently lead to
unexpected behavior. Thus, strictly make the argument a boolean.
PR-URL: https://github.com/nodejs/node/pull/53307
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-06-07 10:37:16 -03:00
Moshe Atlow
2d1ecbf827
test_runner: calculate executed lines using source map
...
PR-URL: https://github.com/nodejs/node/pull/53315
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2024-06-07 10:37:16 -03:00
Orgad Shaneh
7c66b27407
stream: micro-optimize writable condition
...
PR-URL: https://github.com/nodejs/node/pull/53189
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-07 10:37:15 -03:00
Khafra
1d5934524b
buffer: add .bytes() method to Blob
...
PR-URL: https://github.com/nodejs/node/pull/53221
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2024-06-07 10:37:15 -03:00
Matteo Collina
4b9cdea8a6
Revert "module: have a single hooks thread for all workers"
...
This reverts commit 22cb99d073 .
PR-URL: https://github.com/nodejs/node/pull/53183
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2024-06-03 08:48:35 +02:00
Gabriel Bota
98ae1ebdd6
lib: fix the name of the fetch global function
...
PR-URL: https://github.com/nodejs/node/pull/53227
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-06-03 08:48:34 +02:00
jakecastelli
d4f5f80f6c
test_runner: handle file rename and deletion under watch mode
...
Fixes: https://github.com/nodejs/node/issues/53113
PR-URL: https://github.com/nodejs/node/pull/53114
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Raz Luvaton <rluvaton@gmail.com >
2024-06-03 08:48:34 +02:00
Orgad Shaneh
a656cf6bc8
stream: fix memory usage regression in writable
...
Setting writecb and afterWriteTickInfo to null did not clear the value
in the state object.
Amends 35ec93115d (stream: writable state bitmap).
Fixes #52228 .
PR-URL: https://github.com/nodejs/node/pull/53188
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2024-06-03 08:48:33 +02:00
Deokjin Kim
07c601e32f
test_runner: refactor to use min/max of validateInteger
...
Instead of additional `if` statement, use min/max of
`validateInteger` for `shard.index`.
PR-URL: https://github.com/nodejs/node/pull/53148
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-06-03 08:48:33 +02:00
Rafael Gonzaga
75e5612fae
src,permission: --allow-wasi & prevent WASI exec
...
PR-URL: https://github.com/nodejs/node/pull/53124
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-06-03 08:48:32 +02:00
Mathis Wiehl
6708536b03
fs: fix cp dir/non-dir mismatch error messages
...
The error messages for `ERR_FS_CP_DIR_TO_NON_DIR` and
`ERR_FS_CP_NON_DIR_TO_DIR` were the inverse of the copy direction
actually performed.
Refs: https://github.com/nodejs/node/issues/44598#issuecomment-1562522423
PR-URL: https://github.com/nodejs/node/pull/53150
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2024-06-01 10:55:11 +02:00
Vinicius Lourenço
b5c30e2f5e
module: print amount of load time of a cjs module
...
PR-URL: https://github.com/nodejs/node/pull/52213
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-06-01 10:55:10 +02:00
cjihrig
8c6dffc269
test_runner: add snapshot testing
...
This commit adds a t.assert.snapshot() method that implements
snapshot testing. Serialization uses JSON.stringify() by default,
but users can configure the serialization to meet their needs.
PR-URL: https://github.com/nodejs/node/pull/53169
Fixes: https://github.com/nodejs/node/issues/48260
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2024-06-01 10:55:09 +02:00
cjihrig and Jacob Smith
f6d2af8ee7
test_runner: add context.fullName
...
This commit adds a fullName getter to the TestContext and
SuiteContext classes. This is similar to the existing name getter,
but also includes the name of all ancestor tests/suites.
PR-URL: https://github.com/nodejs/node/pull/53169
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Co-authored-by: Jacob Smith <jacob@frende.me >
2024-06-01 10:55:09 +02:00
Chengzhong Wu
fe007cd1b4
lib: allow CJS source map cache to be reclaimed
...
Unifies the CJS and ESM source map cache map with SourceMapCacheMap
and allows the CJS cache entries to be queried more efficiently with
a source url without iteration on an IterableWeakMap.
Add a test to verify that the CJS source map cache entry can be
reclaimed.
PR-URL: https://github.com/nodejs/node/pull/51711
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-06-01 10:55:07 +02:00
Joyee Cheung
374743cd4e
process: add process.getBuiltinModule(id)
...
`process.getBuiltinModule(id)` provides a way to load built-in modules
in a globally available function. ES Modules that need to support
other environments can use it to conditionally load a Node.js built-in
when it is run in Node.js, without having to deal with the resolution
error that can be thrown by `import` in a non-Node.js environment or
having to use dynamic `import()` which either turns the module into an
asynchronous module, or turns a synchronous API into an asynchronous
one.
```mjs
if (globalThis.process.getBuiltinModule) {
// Run in Node.js, use the Node.js fs module.
const fs = globalThis.process.getBuiltinModule('fs');
// If `require()` is needed to load user-modules, use
// createRequire()
const module = globalThis.process.getBuiltinModule('module');
const require = module.createRequire(import.meta.url);
const foo = require('foo');
}
```
If `id` specifies a built-in module available in the current Node.js
process, `process.getBuiltinModule(id)` method returns the
corresponding built-in module. If `id` does not correspond to any
built-in module, `undefined` is returned.
`process.getBuiltinModule(id)` accept built-in module IDs that are
recognized by `module.isBuiltin(id)`. Some built-in modules must be
loaded with the `node:` prefix.
The built-in modules returned by `process.getBuiltinModule(id)` are
always the original modules - that is, it's not affected by
`require.cache`.
PR-URL: https://github.com/nodejs/node/pull/52762
Fixes: https://github.com/nodejs/node/issues/52599
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2024-06-01 10:55:06 +02:00
Moshe Atlow
c249289121
test_runner,doc: align documentation with actual stdout/stderr behavior
...
PR-URL: https://github.com/nodejs/node/pull/53131
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-06-01 10:55:06 +02:00
Antoine du Hamel
4cdb05a7a2
module: do not set CJS variables for Worker eval
...
PR-URL: https://github.com/nodejs/node/pull/53050
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-06-01 10:55:01 +02:00