Commit Graph

12085 Commits

Author SHA1 Message Date
Sebastian Beltran
93c25815ee
http: move writeHeader to end-of-life
PR-URL: https://github.com/nodejs/node/pull/60635
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2025-11-21 19:49:23 +00:00
Đỗ Trọng Hải
d729bec976
repl: tab completion targets <class> instead of new <class>
Signed-off-by: hainenber <dotronghai96@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/60319
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2025-11-20 22:04:36 +00:00
Antoine du Hamel
5e6ac7ede6
test_runner: simplify code and make it more consistent
PR-URL: https://github.com/nodejs/node/pull/60777
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
2025-11-20 14:16:04 +00:00
Antoine du Hamel
3330e5caf1
doc,src,lib: clarify experimental status of Web Storage support
PR-URL: https://github.com/nodejs/node/pull/60708
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2025-11-16 15:03:06 +00:00
Hans Klunder
33b1574cbf
lib: add support for readable byte streams to .toWeb()
Add support for the creation of ReadableByteStream to Readable.toWeb()
and Duplex.toWeb()
This enables the use of .getReader({ mode: "byob" }) on
e.g. socket().toWeb()

Refs: https://github.com/nodejs/node/issues/56004#issuecomment-2908265316
Refs: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_byte_streams
PR-URL: https://github.com/nodejs/node/pull/58664
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-11-16 06:51:24 +00:00
Gürgün Dayıoğlu
2271d2dc10
lib: use FastBuffer for empty buffer allocation
PR-URL: https://github.com/nodejs/node/pull/60558
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-11-15 21:39:32 +01:00
Shima Ryuhei
2e944d7de1
http,https: fix double ERR_PROXY_TUNNEL emission
Fixes: https://github.com/nodejs/node/issues/60697
PR-URL: https://github.com/nodejs/node/pull/60699
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2025-11-15 09:29:08 +00:00
Nikita Skovoroda
fc32ac242b
buffer: let Buffer.of use heap
PR-URL: https://github.com/nodejs/node/pull/60503
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-11-13 23:34:12 +00:00
Filip Skokan
537df2eeb3
lib: refactor JWK import PQC support check
PR-URL: https://github.com/nodejs/node/pull/60586
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-11-13 21:45:28 +00:00
Joyee Cheung
04a086a1f4 esm: use wasm version of cjs-module-lexer
The synchronous version has been available since 1.4.0.

PR-URL: https://github.com/nodejs/node/pull/60663
Refs: https://github.com/nodejs/node/issues/59913
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-11-12 18:34:59 +00:00
Filip Skokan
238899169f
crypto: ensure documented RSA-PSS saltLength default is used
PR-URL: https://github.com/nodejs/node/pull/60662
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2025-11-12 11:53:01 +00:00
Joyee Cheung
12fad1bd7b
src: build v8 tick processor as built-in source text modules
Instead of polyfilling it with vm.SourceTextModule,
use a built-in source text module loader so that we can
also build the code cache for it at build tiem to
embed the code cache for them in the binary.

Drive-by: instead of inferring how to compile a particular
built-in at run time, do the inferring at build time,
so the function-based built-ins can be compiled using
parameters quickly looked up from a static map, and
the builtins that should be compiled as source text
modules are known internally based on extension in
the source code (at run time, the extensions are all
removed).

PR-URL: https://github.com/nodejs/node/pull/60518
Reviewed-By: Aditi Singh <aditisingh1400@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-11-11 02:53:13 +00:00
Joyee Cheung
1d6a62662c src: move import.meta initializer to native land
When the source text module is compiled without custom callbacks,
instead of calling into JS land from the per-isolate import.meta
initializer and then back to C++ land to set up lazy data
properties, just do the initialization all in C++ land.
Only import.meta.resolve initialization will call back
into JS land to generate a closure that call the cascaded loader
for resolution.

In addition, simplify the loader structure by merging
allowImportMetaResolve into isForAsyncLoaderHookWorker - the two
are essentially equivalent, as import.meta.resolve is only
allowed in a non-loader-hook worker thread's loader.

PR-URL: https://github.com/nodejs/node/pull/60603
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2025-11-08 16:33:34 +00:00
Marco Ippolito
4e7f9c997d
watch: fix interaction with multiple env files
PR-URL: https://github.com/nodejs/node/pull/60605
Fixes: https://github.com/nodejs/node/issues/60599
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-11-08 14:35:07 +00:00
Marco Ippolito
8e5c80d108
module: mark type stripping as stable
PR-URL: https://github.com/nodejs/node/pull/60600
Refs: https://github.com/nodejs/typescript/issues/24
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruy Adorno <ruy@vlt.sh>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2025-11-08 09:36:45 +00:00
Caio Lima
ed6569c753
v8: adding total_allocated_bytes to HeapStatistics
PR-URL: https://github.com/nodejs/node/pull/60573
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-11-07 15:56:41 +00:00
Joyee Cheung
9495906f8b
debugger: fix event listener leak in the run command
It should remove both the error and the ready event listeners
attached when either of them fires, instead of removing only
the one whose corresponding event fires, otherwise the other
event listener will always get leaked.

PR-URL: https://github.com/nodejs/node/pull/60464
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-11-07 13:28:03 +00:00
Chengzhong Wu
a78f7d9e02
inspector: inspect HTTP response body
PR-URL: https://github.com/nodejs/node/pull/60572
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-11-06 22:31:30 +00:00
Ruben Bridgewater
525c4fb316
repl: fix pasting after moving the cursor to the left
Fixes: https://github.com/nodejs/node/issues/60446
PR-URL: https://github.com/nodejs/node/pull/60470
Reviewed-By: Jordan Harband <ljharb@gmail.com>
2025-11-05 20:36:59 +00:00
Rafael Gonzaga
cfa11ba893
lib: add options to util.deprecate
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/59982
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-11-05 02:52:26 +00:00
Darshan Sen
c63e88e9a6
inspector: support inspecting HTTP/2 request and response bodies
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/60483
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-11-04 08:35:00 +00:00
Tim Perry
4346c0f7a7
http: fix handling of HTTP upgrades with bodies
Previously, we ignored all indicators of the body (content-length or
transfer-encoding headers) and treated any information following
the headers as part of the upgraded stream. We now fully process the
requests bodies separately instead, allowing us to automatically handle
correct parsing of the body like any other HTTP request.

This is a breaking change if you are currently accepting HTTP Upgrade
requests with request bodies successfully, or if you use
socket-specific fields & methods on the upgraded stream argument.

In the former case, before now you will have received the request body
and then the upgraded data on the same stream without any distinction
or HTTP parsing applied. Now, you will need to separately read the
request body from the request (the 1st argument) and the upgraded
data from the upgrade stream (the 2nd argument). If you're not
interested in request bodies, you can continue to just read from the
upgrade stream directly.

In the latter case, if you want to access the raw socket, you should do
so via request.socket, instead of expecting the 2nd argument to be a
socket.

PR-URL: https://github.com/nodejs/node/pull/60016
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-11-03 17:19:33 +00:00
Renegade334
21b0fe4b28 lib: replace global SharedArrayBuffer constructor with bound method
PR-URL: https://github.com/nodejs/node/pull/60497
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-11-03 13:23:20 +00:00
Renegade334
48d0cd7fdc src: add internal binding for constructing SharedArrayBuffers
PR-URL: https://github.com/nodejs/node/pull/60497
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-11-03 13:23:20 +00:00
Gürgün Dayıoğlu
c2a4acb100
console: optimize single-string logging
PR-URL: https://github.com/nodejs/node/pull/60422
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-11-02 23:33:58 +00:00
Gürgün Dayıoğlu
24bebd01a7
buffer: speed up concat via TypedArray#set
PR-URL: https://github.com/nodejs/node/pull/60399
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-11-01 22:51:55 +00:00
Darshan Sen
f46152fdb3
http2: add diagnostics channels for client stream request body
These would allow inspection of HTTP/2 client stream request bodies.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/60480
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2025-11-01 19:56:44 +05:30
Joyee Cheung
3e31baeda6
esm: use sync loading/resolving on non-loader-hook thread
ESM resolution and loading is now always synchronous from a
non-loader-hook thread. If no asynchrnous loader hooks are
registered, the resolution/loading is entirely synchronous.
If asynchronous loader hooks are registered, these would be
synchronous on the non-loader-hook thread, and asynchronous
on the loader hook thread.

This avoids several races caused by async/sync loading sharing
the same cache. In particular, asynchronous loader hooks
now works with `require(esm)` - previously it tends to break
due to races.

In addition, when an asynchronous loader hook
returns a promise that never settles, the main thread no longer
silently exits with exit code 13, leaving the code below
any module loading calls silently ignored without being executed.
Instead, it now throws ERR_ASYNC_LOADER_REQUEST_NEVER_SETTLED
which can be caught and handled by the main thread. If the module
request comes from `import()`, the never-settling promise is
now relayed to the result returned by `import()`.

Drive-by: when annotating the error about importing undetectable
named exports from CommonJS, it now no longer reload the source
code of the CommonJS module, and instead reuses format information
cached when the module was loaded for linking.

PR-URL: https://github.com/nodejs/node/pull/60380
Fixes: https://github.com/nodejs/node/issues/59666
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2025-10-31 20:45:10 +00:00
René
2fb3c7eef5
lib: throw from localStorage getter on missing storage path
PR-URL: https://github.com/nodejs/node/pull/60351
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
2025-10-31 19:48:29 +00:00
Ge Gao
fbef1cf438
util: fix stylize of special properties in inspect
Previously, formatExtraProperties applied ctx.stylize to the entire
'[key]: value' string. This caused the colon and space to be styled,
making the output inconsistent with normal object properties.

Now, only the key itself is stylized, and the colon and space remain
unstyled, aligning with the formatting of regular properties.

Refs: https://github.com/nodejs/node/pull/60131
PR-URL: https://github.com/nodejs/node/pull/60479
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-10-31 08:33:38 +00:00
btea
bdf03bfcd5
http: replace startsWith with strict equality
PR-URL: https://github.com/nodejs/node/pull/59394
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2025-10-30 14:43:31 +00:00
Robert Nagy
3dba25fbd2
stream: don't try to read more if reading
Avoid unnecessary nextTick.

PR-URL: https://github.com/nodejs/node/pull/60454
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2025-10-30 08:55:51 +00:00
Joyee Cheung
1f6b681bf2 src: fix timing of snapshot serialize callback
Previously the addAfterUserSerailizeCallback() wasn't
ready to be used for building the built-in snapshot.
This patch initializes the callbacks at the time
lib/internal/v8/start_snapshot.js is loaded, so that
these callbacks get run correctly when building the
built-in snapshot.

Currently when building the built-in snapshot,
addAfterUserSerializeCallback() is only used by createUnsafeBuffer(),
other usages can only come from user-land snapshots,
which is covered by tests, but what gets run by the
built-in snapshot building process is less visible, and the
path used by createUnsafeBuffer() isn't reliably visible in user
land either. This adds an internal usage counter in debug builds
to verify this path when building the built-in snapshot.

PR-URL: https://github.com/nodejs/node/pull/60434
Fixes: https://github.com/nodejs/node/issues/60423
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
2025-10-28 00:15:55 +00:00
Chengzhong Wu
51a57f2b36
perf_hooks: move non-standard performance properties to perf_hooks
`performance.eventLoopUtilization` and `performance.timerify` are not
part of the Web API. Expose these two functions directly on the
`perf_hooks` module.

PR-URL: https://github.com/nodejs/node/pull/60370
Fixes: https://github.com/nodejs/node/issues/60368
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-28 00:23:50 +01:00
avcribl
4fe325d93d
stream: preserve AsyncLocalStorage on finished only when needed
PR-URL: https://github.com/nodejs/node/pull/59873
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-10-27 19:23:34 +00:00
SeokHun
d9cf867a9d
lib: fix typo in createBlobReaderStream
Corrects the misspelling of "proecss" to "process".

PR-URL: https://github.com/nodejs/node/pull/60132
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-10-27 14:14:15 +00:00
Robert Nagy
1f2c9f82b7
http: lazy allocate cookies array
PR-URL: https://github.com/nodejs/node/pull/59734
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-10-27 14:01:06 +00:00
Shelley Vohr
fb84f35fec
tls: avoid external memory leak on invalid protocol versions
PR-URL: https://github.com/nodejs/node/pull/60390
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-10-26 16:29:49 +00:00
Yagiz Nizipli
ddbe1365ff
util: reduce TextEncoder.encodeInto function size
PR-URL: https://github.com/nodejs/node/pull/60339
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-10-23 14:38:22 +00:00
Joyee Cheung
b19525a33c
module: refactor and clarify async loader hook customizations
- This updates the comments that assume loader hooks must be async
- Differentiate the sync/async loader hook paths in naming
  `#customizations` is now `#asyncLoaderHooks` to make it clear
  it's from the async APIs.
- Differentiate the paths running on the loader hook thread
  (affects the loading of async other loader hooks and are async)
  v.s. paths on the main thread calling out to code on the loader
  hook thread (do not handle loading of other async loader hooks, and
  can be sync by blocking).
  - `Hooks` is now `AsyncLoaderHooksOnLoaderHookWorker`
  - `CustomizedModuleLoader` is now
    `AsyncLoaderHooksProxiedToLoaderHookWorker` and moved into
    `lib/internal/modules/esm/hooks.js` as it implements the same
    interface as `AsyncLoaderHooksOnLoaderHookWorker`
  - `HooksProxy` is now `AsyncLoaderHookWorker`
  - Adjust the JSDoc accordingly
- Clarify the "loader worker" as the "async loader hook worker"
  i.e. when there's no _async_ loader hook registered, there won't
  be this worker, to avoid the misconception that this worker
  is spawned unconditionally.
- The code run on the loader hook worker to process
  `--experimental-loader` is moved into
  `lib/internal/modules/esm/worker.js` for clarity.
- The initialization configuration `forceDefaultLoader` is split
  into `shouldSpawnLoaderHookWorker` and `shouldPreloadModules`
  as those can be separate.
- `--experimental-vm-modules` is now processed during pre-execution
  and no longer part of the initialization of the built-in ESM
  loader, as it only exposes the vm APIs of ESM, and is unrelated
  to built-in ESM loading.

PR-URL: https://github.com/nodejs/node/pull/60278
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2025-10-23 13:42:23 +00:00
Joyee Cheung
f46d501b7f
test_runner: use module.registerHooks in module mocks
Migrate away from module.register(). This no longer needs to
deal with the worker synchronization.

PR-URL: https://github.com/nodejs/node/pull/60326
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2025-10-22 11:05:39 +00:00
Antoine du Hamel
2fb82c8c28
util: use more defensive code when inspecting error objects
PR-URL: https://github.com/nodejs/node/pull/60139
Fixes: https://github.com/nodejs/node/issues/60107
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-10-20 18:14:39 +00:00
Marco Ippolito
cec1bd5498
src: add watch config namespace
PR-URL: https://github.com/nodejs/node/pull/60178
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2025-10-20 13:53:29 +02:00
Ruben Bridgewater
70e7c1511f
util: mark special properties when inspecting them
This makes sure special properties (such as a byteLength, buffer,
and more) are marked that they are not regular properties. They
are mostly getters, that just seemed even more of a breaking change.
Thus, they just use square brackets for now.

On top of that, it makes inspecting detached DataViews robust.
Inspecting those failed so far.

PR-URL: https://github.com/nodejs/node/pull/60131
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2025-10-18 21:29:35 +02:00
Joyee Cheung
38bf955937 vm: make vm.Module.evaluate() conditionally synchronous
- Make sure that the vm.Module.evaluate() method is conditionally
  synchronous based on the specification. Previously, the returned
  promise is unconditionally pending (even for synthetic modules and
  source text modules without top-level await) instead of immediately
  fulfilled, making it harder to debug as it deviates from the
  specified behavior.
- Clarify the synchronicity of this method in the documentation
- Add more tests for the synchronicity of this method.

PR-URL: https://github.com/nodejs/node/pull/60205
Refs: https://github.com/nodejs/node/issues/59656
Refs: https://github.com/nodejs/node/issues/37648
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-10-18 08:20:47 +00:00
Ruben Bridgewater
d3f79aa65d
assert: allow printf-style messages as assertion error
Also add functions as allowed message input.
This allows to have leavy message computation to become cheaper.

PR-URL: https://github.com/nodejs/node/pull/58849
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-10-17 20:15:17 +00:00
Joyee Cheung
170848bc18
module: handle null source from async loader hooks in sync hooks
This relaxes the validation in sync hooks so that it accepts
the quirky nullish source returned by the default step of the
async loader when the module being loaded is CommonJS.
When there are no customization hooks registered, a saner
synchronous default load step is used to use a property
instead of a reset nullish source to signify that the module
should go through the CJS monkey patching routes and reduce
excessive reloading from disk.

PR-URL: https://github.com/nodejs/node/pull/59929
Fixes: https://github.com/nodejs/node/issues/59384
Fixes: https://github.com/nodejs/node/issues/57327
Refs: https://github.com/nodejs/node/issues/59666
Refs: https://github.com/dygabo/load_module_test
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2025-10-14 16:28:22 +00:00
Rafael Gonzaga
0c35aaf55f
http: add optimizeEmptyRequests server option
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
Co-Authored-By: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/59778
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-10-14 12:17:53 +00:00
Shima Ryuhei
1072295d26
inspector: support handshake response for websocket inspection
PR-URL: https://github.com/nodejs/node/pull/60225
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-14 07:06:15 +00:00
theanarkh
59b70e5fe3
http: fix http client leaky with double response
PR-URL: https://github.com/nodejs/node/pull/60062
Fixes: https://github.com/nodejs/node/issues/60025
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-10-13 15:58:26 +00:00