8860 Commits
Author SHA1 Message Date
Richard Lau a0a69f5e4a Working on v18.20.9
PR-URL: https://github.com/nodejs/node/pull/57631
2025-03-27 12:59:20 +00:00
Richard Lau 4d0b4e7077 2025-03-27, Version 18.20.8 'Hydrogen' (LTS)
Notable changes:

This release updates OpenSSL to 3.0.16 and root certificates to NSS 3.108.

PR-URL: https://github.com/nodejs/node/pull/57631
2025-03-26 01:18:22 +00:00
Matteo Collina 69d661d591 deps: update undici to v5.29.0
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/57557
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-03-26 00:39:38 +00:00
Gabriel Bota f737a79073 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>
2025-03-19 16:03:51 +00:00
Node.js GitHub Bot ee9a343413 crypto: update root certificates to NSS 3.108
This is the certdata.txt[0] from NSS 3.108.

This is the version of NSS that shipped in Firefox 136.0 on 2025-03-04.

Certificates added:
- D-TRUST BR Root CA 2 2023
- D-TRUST EV Root CA 2 2023

Certificates removed:
- SwissSign Silver CA - G2

[0] https://raw.githubusercontent.com/nss-dev/nss/refs/tags/NSS_3_108_RTM/lib/ckfw/builtins/certdata.txt

PR-URL: https://github.com/nodejs/node/pull/57381
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-03-13 17:54:25 +00:00
Richard Lau 738bf8aea4 crypto: update root certificates to NSS 3.104
This is the certdata.txt[0] from NSS 3.104.

This is the version of NSS that shipped in Firefox 131.0 on 2024-10-01.

Certificates added:
- FIRMAPROFESIONAL CA ROOT-A WEB
- TWCA CYBER Root CA
- SecureSign Root CA12
- SecureSign Root CA14
- SecureSign Root CA15

[0] https://raw.githubusercontent.com/nss-dev/nss/refs/tags/NSS_3_104_RTM/lib/ckfw/builtins/certdata.txt

PR-URL: https://github.com/nodejs/node/pull/55681
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-03-13 17:54:16 +00:00
Antoine du Hamel 038ed42fa2 Working on v18.20.8
PR-URL: https://github.com/nodejs/node/pull/57122
2025-02-20 10:54:29 +01:00
Node.js GitHub Bot 86458c7723 2025-02-20, Version 18.20.7 'Hydrogen' (LTS)
Notable changes:

crypto:
  * update root certificates to NSS 3.107 (Node.js GitHub Bot) https://github.com/nodejs/node/pull/56566

PR-URL: https://github.com/nodejs/node/pull/57122
2025-02-18 10:34:24 -05:00
Node.js GitHub Bot ea5eb0e98b crypto: update root certificates to NSS 3.107
This is the certdata.txt[0] from NSS 3.107.

This is the version of NSS that shipped in Firefox 134.0 on 2025-01-07.

Certificates removed:
- SecureSign RootCA11
- Entrust Root Certification Authority - G4
- Security Communication RootCA3

[0] https://raw.githubusercontent.com/nss-dev/nss/refs/tags/NSS_3_107_RTM/lib/ckfw/builtins/certdata.txt

PR-URL: https://github.com/nodejs/node/pull/56566
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-02-10 19:29:45 +01:00
Node.js GitHub Bot ade37ee0b3 deps: update acorn to 8.14.0
PR-URL: https://github.com/nodejs/node/pull/55699
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2025-02-10 17:00:19 +01:00
RafaelGSS 614d476877 Working on v18.20.7
PR-URL: https://github.com/nodejs-private/node-private/pull/659
2025-01-21 09:22:30 -03:00
RafaelGSS 6022476246 2025-01-21, Version 18.20.6 'Hydrogen' (LTS)
This is a security release.

Notable changes:

* CVE-2025-23084 - fix path traversal in normalize() on Windows (Medium)
* CVE-2025-23085 - fix HTTP2 mem leak on premature close and ERR_PROTO
* CVE-2025-22150 - Use of Insufficiently Random Values in undici fetch() (Medium)
  (Medium)

PR-URL: https://github.com/nodejs-private/node-private/pull/659
2025-01-20 14:50:05 -03:00
RafaelGSS 6cc8d58e6f src: fix HTTP2 mem leak on premature close and ERR_PROTO
This commit fixes a memory leak when the socket is
suddenly closed by the peer (without GOAWAY notification)
and when invalid header (by nghttp2) is identified and the
connection is terminated by peer.

Refs: https://hackerone.com/reports/2841362
PR-URL: https://github.com/nodejs-private/node-private/pull/650
Reviewed-By: James M Snell <jasnell@gmail.com>
CVE-ID: CVE-2025-23085
2025-01-20 14:49:43 -03:00
Matteo Collina a63e9372ed deps: update undici to v5.28.5
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/657
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
CVE-ID: CVE-2025-22150
2025-01-19 20:28:12 -03:00
Antoine du Hamel 14b6317641 Working on v18.20.6
PR-URL: https://github.com/nodejs/node/pull/55768
2024-11-12 22:33:59 +01:00
Antoine du Hamel f73db8f477 2024-11-12, Version 18.20.5 'Hydrogen' (LTS)
Notable changes:

esm:
  * mark import attributes and JSON module as stable (Nicolò Ribaudo) https://github.com/nodejs/node/pull/55333

PR-URL: https://github.com/nodejs/node/pull/55768
2024-11-07 17:52:35 +01:00
Node.js GitHub Bot d577321877 deps: update acorn to 8.13.0
PR-URL: https://github.com/nodejs/node/pull/55558
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-11-03 12:33:09 +01:00
Node.js GitHub Bot f56cfe776b deps: update acorn to 8.12.1
PR-URL: https://github.com/nodejs/node/pull/53465
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2024-11-03 12:33:07 +01:00
Shelley Vohr d814fe935c src: account for OpenSSL unexpected version
PR-URL: https://github.com/nodejs/node/pull/54038
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-09-27 14:28:50 +00:00
Huáng Jùnliàng 6e7274fa53 crypto: reject dh,x25519,x448 in {Sign,Verify}Final
Fixes: https://github.com/nodejs/node/issues/53742
PR-URL: https://github.com/nodejs/node/pull/53774
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2024-09-27 14:05:57 +00:00
Filip Skokan d2442044db crypto: reject Ed25519/Ed448 in Sign/Verify prototypes
fixes: #52097
PR-URL: https://github.com/nodejs/node/pull/52340
Fixes: https://github.com/nodejs/node/issues/52097
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-09-27 14:05:55 +00:00
Richard Lau 6615fe5db1 src: fix dynamically linked OpenSSL version
Report the version of OpenSSL that Node.js is running with instead
of the version of OpenSSL that Node.js was compiled against.

PR-URL: https://github.com/nodejs/node/pull/53456
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2024-09-27 14:05:36 +00:00
RafaelGSS e578c0b1e8 Working on v18.20.5
PR-URL: https://github.com/nodejs-private/node-private/pull/609
2024-07-08 13:04:19 -03:00
RafaelGSS e922fb64b5 2024-07-08, Version 18.20.4 'Hydrogen' (LTS)
This is a security release.

Notable changes:

* CVE-2024-36138 - Bypass incomplete fix of CVE-2024-27980 (High)
* CVE-2024-22020 - Bypass network import restriction via data URL (Medium)

PR-URL: https://github.com/nodejs-private/node-private/pull/609
2024-07-03 16:15:26 -03:00
RafaelGSS eccd63b865 src: handle permissive extension on cmd check
PR-URL: https://github.com/nodejs-private/node-private/pull/596
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/603
CVE-ID: CVE-2024-36138
2024-07-02 16:15:24 -03:00
Richard Lau dc9eed94f7 Working on v18.20.4
PR-URL: https://github.com/nodejs/node/pull/53028
2024-05-21 11:53:02 +00:00
Richard Lau 64903b1ca0 2024-05-21, Version 18.20.3 'Hydrogen' (LTS)
Notable changes:

This release fixes a regression introduced in Node.js 18.19.0 where
`http.server.close()` was incorrectly closing idle connections.

A fix has also been included for compiling Node.js from source with
newer versions of Clang.

The list of keys used to sign releases has been synchronized with the
current list from the `main` branch.

Updated dependencies:

- acorn updated to 8.11.3.
- acorn-walk updated to 8.3.2.
- ada updated to 2.7.8.
- c-ares updated to 1.28.1.
- corepack updated to 0.28.0.
- nghttp2 updated to 1.61.0.
- ngtcp2 updated to 1.3.0.
- npm updated to 10.7.0. Includes a fix from npm@10.5.1 to limit the
  number of open connections.
- simdutf updated to 5.2.4.
- zlib updated to 1.3.0.1-motley-7d77fb7.

PR-URL: https://github.com/nodejs/node/pull/53028
2024-05-16 22:36:39 +00:00
Chengzhong Wu d9d9e62474 src: avoid draining platform tasks at FreeEnvironment
At the point of `FreeEnvironment` and onwards, no JavaScript execution
associated with the Environment should be triggered.

Avoid draining platform tasks that can trigger JavaScript execution in
`FreeEnvironment`. The holder of `node::Environment` should immediately
call `node::MultiIsolatePlatform::UnregisterIsolate` and
`v8::Isolate::Dispose` to cancel pending foreground tasks and join
concurrent tasks after the environment was freed.

`NodePlatform` can properly handle the case in `RunForegroundTask` when
an Isolate out-lives its associated `node::Environment`.

PR-URL: https://github.com/nodejs/node/pull/51290
Fixes: https://github.com/nodejs/node/issues/47748
Fixes: https://github.com/nodejs/node/issues/49344
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-05-16 22:20:48 +00:00
Gabriel Schulhof 71616e8a8a node-api: make tsfn accept napi_finalize once more
The thread-safe function's finalizer is not called in conjunction with
the garbage collection of a JS value. In fact, it keeps a strong
reference to the JS function it is expected to call. Thus, it is safe
to make calls that affect GC state from its body.

PR-URL: https://github.com/nodejs/node/pull/51801
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-05-07 17:03:26 +00:00
Node.js GitHub Bot 12f28f33c2 deps: update acorn to 8.11.3
PR-URL: https://github.com/nodejs/node/pull/51317
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-04-26 14:17:33 +00:00
Node.js GitHub Bot 9500817f66 deps: update acorn to 8.11.2
PR-URL: https://github.com/nodejs/node/pull/50460
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-04-26 14:16:57 +00:00
RafaelGSS a90f5d5a3d Working on v18.20.3
PR-URL: https://github.com/nodejs-private/node-private/pull/578
2024-04-10 13:24:12 -03:00
RafaelGSS 9aedf16f8f 2024-04-10, Version 18.20.2 'Hydrogen' (LTS)
This is a security release.

Notable changes:

src:
  * disallow direct .bat and .cmd file spawning (Ben Noordhuis) https://github.com/nodejs-private/node-private/pull/564

PR-URL: https://github.com/nodejs-private/node-private/pull/578
2024-04-10 09:12:07 -03:00
Ben Noordhuis 6627222409 src: disallow direct .bat and .cmd file spawning
An undocumented feature of the Win32 CreateProcess API allows spawning
batch files directly but is potentially insecure because arguments are
not escaped (and sometimes cannot be unambiguously escaped), hence why
they are refused starting today.

PR-URL: https://github.com/nodejs-private/node-private/pull/564
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
CVE-ID: CVE-2024-27980
2024-04-10 09:09:35 -03:00
RafaelGSS 380e55765b Working on v18.20.2
PR-URL: https://github.com/nodejs-private/node-private/pull/573
2024-04-03 10:56:50 -03:00
RafaelGSS 1d526a47af 2024-04-03, Version 18.20.1 'Hydrogen' (LTS)
This is a security release.

Notable changes:

* CVE-2024-27983 - Assertion failed in node::http2::Http2Session::\~Http2Session() leads to HTTP/2 server crash- (High)
* CVE-2024-27982 - HTTP Request Smuggling via Content Length Obfuscation - (Medium)
* llhttp version 9.2.1
* undici version 5.28.4

PR-URL: https://github.com/nodejs-private/node-private/pull/573
2024-04-02 17:07:29 -03:00
Matteo Collina 60d24938de deps: update undici to v5.28.4
Signed-off-by: Matteo Collina <hello@matteocollina.com>

PR-URL: https://github.com/nodejs-private/node-private/pull/577
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-04-02 17:05:53 -03:00
RafaelGSSandAnna Henningsen 0fb816dbcc src: ensure to close stream when destroying session
Co-Authored-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs-private/node-private/pull/561
Fixes: https://hackerone.com/reports/2319584
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
CVE-ID: CVE-2024-27983
2024-04-02 17:05:53 -03:00
Richard Lau 8c8961da05 Working on v18.20.1
PR-URL: https://github.com/nodejs/node/pull/52165
2024-03-26 17:22:01 +00:00
Richard Lau f75dc4193e 2024-03-26, Version 18.20.0 'Hydrogen' (LTS)
Notable changes:

Added support for import attributes:

Support has been added for import attributes, to replace the old import
assertions syntax. This will aid migration by making the new syntax
available across all currently supported Node.js release lines.

For more details, see

* [#50134](https://github.com/nodejs/node/issues/50134)
* [#51622](https://github.com/nodejs/node/issues/51622)

Doc deprecation for `dirent.path`:

Please use newly added `dirent.parentPath` instead.

Experimental node-api feature flags

Introduces an experimental feature to segregate finalizers that affect GC state.
A new type called `node_api_nogc_env` has been introduced as the const version
of `napi_env` and `node_api_nogc_finalize` as a variant of `napi_finalize` that
accepts a `node_api_nogc_env` as its first argument.

This feature can be turned off by defining
`NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT`.

Root certificates updated to NSS 3.98:

Certificates added:

* Telekom Security TLS ECC Root 2020
* Telekom Security TLS RSA Root 2023

Certificates removed:

* Security Communication Root CA

Updated dependencies:

* ada updated to 2.7.6.
* base64 updated to 0.5.2.
* c-ares updated to 1.27.0.
* corepack updated to 0.25.2.
* ICU updated to 74.2. Includes CLDR 44.1 and Unicode 15.1.
* npm updated to 10.5.0. Fixes a regression in signals not being passed onto child processes.
* simdutf8 updated to 4.0.8.
* Timezone updated to 2024a.
* zlib updated to 1.3.0.1-motley-40e35a7.

vm: fix V8 compilation cache support for vm.Script:

Previously repeated compilation of the same source code using `vm.Script`
stopped hitting the V8 compilation cache after v16.x when support for
`importModuleDynamically` was added to `vm.Script`, resulting in a performance
regression that blocked users (in particular Jest users) from upgrading from
v16.x.

The recent fixes allow the compilation cache to be hit again
for `vm.Script` when `--experimental-vm-modules` is not used even in the
presence of the `importModuleDynamically` option, so that users affected by the
performance regression can now upgrade. Ongoing work is also being done to
enable compilation cache support for `vm.CompileFunction`.

PR-URL: https://github.com/nodejs/node/pull/52165
2024-03-23 18:56:11 +00:00
Gabriel Schulhof 32906ddcac node-api: segregate nogc APIs from rest via type system
We define a new type called `node_api_nogc_env` as the `const` version
of `napi_env` and `node_api_nogc_finalize` as a variant of
`napi_finalize` that accepts a `node_api_nogc_env` as its first
argument.

We then modify those APIs which do not affect GC state as accepting a
`node_api_nogc_env`. APIs accepting finalizer callbacks are modified to
accept `node_api_nogc_finalize` callbacks. Thus, the only way to attach
a `napi_finalize` callback, wherein Node-APIs affecting GC state may be
called is to call `node_api_post_finalizer` from a
`node_api_nogc_finalize` callback.

In keeping with the process of introducing new Node-APIs, this feature
is guarded by `NAPI_EXPERIMENTAL`. Since this feature modifies APIs
already marked as stable, it is additionally guared by
`NODE_API_EXPERIMENTAL_NOGC_ENV`, so as to provide a further buffer to
adoption. Nevertheless, both guards must be removed upon releasing a
new version of Node-API.

PR-URL: https://github.com/nodejs/node/pull/50060
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/51804
(cherry picked from commit 7a216d5fd6)
2024-03-22 16:04:52 +00:00
Gabriel Schulhof 1aa71c26ff node-api: factor out common code into macros
* Create macro for checking new string arguments.
    * Create macro for combining env check and inside-gc check.

PR-URL: https://github.com/nodejs/node/pull/50664
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/51804
(cherry picked from commit 5e250bd726)
2024-03-22 16:04:43 +00:00
Gabriel Schulhof 3d0b233f52 node-api: introduce experimental feature flags
Add a flag for each experimental feature to indicate its presence.
That way, if we compile with `NAPI_EXPERIMENTAL` turned on, we'll be
able to distinguish between what `NAPI_EXPERIMENTAL` used to mean on an
old version of the headers when compiling against such an old version,
and what it means on a new version of Node.js.

PR-URL: https://github.com/nodejs/node/pull/50991
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/51804
(cherry picked from commit 727dd28e47)
2024-03-22 16:04:36 +00:00
Node.js GitHub Bot 16d28a883a deps: update base64 to 0.5.2
PR-URL: https://github.com/nodejs/node/pull/51455
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
2024-03-20 13:45:45 +00:00
Node.js GitHub Bot 13a9e81cb6 deps: update base64 to 0.5.1
PR-URL: https://github.com/nodejs/node/pull/50629
Fixes: https://github.com/nodejs/node/issues/50561
Fixes: https://github.com/nodejs/node/pull/45091
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2024-03-20 13:45:25 +00:00
Node.js GitHub Bot 8fdea67694 crypto: update root certificates to NSS 3.98
This is the certdata.txt[0] from NSS 3.98, released on 2024-02-15.

This is the version of NSS that will ship in Firefox 124 on
2024-03-19.

Certificates added:
- Telekom Security TLS ECC Root 2020
- Telekom Security TLS RSA Root 2023

Certificates removed:
- Security Communication Root CA

[0] https://hg.mozilla.org/projects/nss/raw-file/NSS_3_98_RTM/lib/ckfw/builtins/certdata.txt

PR-URL: https://github.com/nodejs/node/pull/51794
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2024-03-19 17:15:18 +00:00
Michaël Zasso 96514a8b9f src: iterate on import attributes array correctly
The array's length is supposed to be a multiple of two for dynamic
import callbacks.

Fixes: https://github.com/nodejs/node/issues/50700
PR-URL: https://github.com/nodejs/node/pull/50703
Backport-PR-URL: https://github.com/nodejs/node/pull/51136
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-03-18 16:33:12 +00:00
Antoine du Hamel a193be3dc2 esm: use import attributes instead of import assertions
The old import assertions proposal has been
renamed to "import attributes" with the follwing major changes:

1. The keyword is now `with` instead of `assert`.
2. Unknown assertions cause an error rather than being ignored,

This commit updates the documentation to encourage folks to use the new
syntax, and add aliases for module customization hooks.

PR-URL: https://github.com/nodejs/node/pull/50140
Backport-PR-URL: https://github.com/nodejs/node/pull/51136
Fixes: https://github.com/nodejs/node/issues/50134
Refs: https://github.com/v8/v8/commit/159c82c5e6392e78b9bba7161b1bed6e23758984
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-03-18 16:31:27 +00:00
Joyee Cheung fe66e9d06e vm: reject in importModuleDynamically without --experimental-vm-modules
Users cannot access any API that can be used to return a module or
module namespace in this callback without --experimental-vm-modules
anyway, so this would eventually lead to a rejection. This patch
rejects in this case with our own error message and use a constant
host-defined option for the rejection, so that scripts with the
same source can still be compiled using the compilation cache
if no `import()` is actually called in the script.

PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-03-15 17:56:10 +00:00
Joyee Cheung 9f7899ed0a vm: unify host-defined option generation in vm.compileFunction
Set a default host-defined option for vm.compileFunction so that
it's consistent with vm.Script.

PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-03-15 17:56:02 +00:00