diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f7e219141cf6..6abfebadc97775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,8 @@ release. -20.18.3
+20.19.0
+20.18.3
20.18.2
20.18.1
20.18.0
diff --git a/doc/api/cli.md b/doc/api/cli.md index 21e6df9e4d96bd..85920e71be2cc5 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1001,7 +1001,7 @@ added: - v22.0.0 - v20.17.0 changes: - - version: REPLACEME + - version: v20.19.0 pr-url: https://github.com/nodejs/node/pull/55085 description: This is now true by default. --> @@ -1527,7 +1527,7 @@ added: - v20.10.0 changes: - version: - - REPLACEME + - v20.19.0 pr-url: https://github.com/nodejs/node/pull/53619 description: Syntax detection is enabled by default. --> @@ -1573,7 +1573,7 @@ added: - v22.0.0 - v20.17.0 changes: - - version: REPLACEME + - version: v20.19.0 pr-url: https://github.com/nodejs/node/pull/55085 description: This is now false by default. --> @@ -1686,7 +1686,7 @@ Node.js which is `nodejs_conf` and is default when this option is not used. ### `--env-file-if-exists=config` > Stability: 1.1 - Active development @@ -2407,7 +2407,7 @@ i.e. invoking `process.exit()`. Prints information about usage of [Loading ECMAScript modules using `require()`][]. diff --git a/doc/api/errors.md b/doc/api/errors.md index 59e9168e8b8595..d6ead7e2b07bd7 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2563,7 +2563,7 @@ before looking for the top-level awaits). @@ -3199,7 +3199,7 @@ nor a relative path starting with `./` or `../`. ### `ERR_WORKER_MESSAGING_ERRORED` > Stability: 1.1 - Active development @@ -3211,7 +3211,7 @@ The destination thread threw an error while processing a message sent via [`post ### `ERR_WORKER_MESSAGING_FAILED` > Stability: 1.1 - Active development @@ -3223,7 +3223,7 @@ The thread requested in [`postMessageToThread()`][] is invalid or has no `worker ### `ERR_WORKER_MESSAGING_SAME_THREAD` > Stability: 1.1 - Active development @@ -3235,7 +3235,7 @@ The thread id requested in [`postMessageToThread()`][] is the current thread id. ### `ERR_WORKER_MESSAGING_TIMEOUT` > Stability: 1.1 - Active development diff --git a/doc/api/modules.md b/doc/api/modules.md index c24c457b570f2b..3c0c87ff662014 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -176,15 +176,15 @@ added: - v20.17.0 changes: - version: - - REPLACEME + - v20.19.0 pr-url: https://github.com/nodejs/node/pull/56194 description: This feature no longer emits an experimental warning by default, though the warning can still be emitted by --trace-require-module. - version: - - REPLACEME + - v20.19.0 pr-url: https://github.com/nodejs/node/pull/55085 description: This feature is no longer behind the `--experimental-require-module` CLI flag. - - version: REPLACEME + - version: v20.19.0 pr-url: https://github.com/nodejs/node/pull/54563 description: Support `'module.exports'` interop export in `require(esm)`. --> diff --git a/doc/api/packages.md b/doc/api/packages.md index d130030b0fd82f..fc485d925ca9d4 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -123,7 +123,7 @@ added: - v20.10.0 changes: - version: - - REPLACEME + - v20.19.0 pr-url: https://github.com/nodejs/node/pull/53619 description: Syntax detection is enabled by default. --> diff --git a/doc/api/process.md b/doc/api/process.md index 83e1d222159025..b1542e0be1e23c 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -330,7 +330,7 @@ most convenient for scripts). ### Event: `'workerMessage'` * `value` {any} A value transmitted using [`postMessageToThread()`][]. @@ -1932,7 +1932,7 @@ A boolean value that is `true` if the current Node.js build includes support for ## `process.features.require_module` * {boolean} diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 51bb2bb41b39a7..bd5f0ac507cee1 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -223,7 +223,7 @@ if (isMainThread) { ## `worker.postMessageToThread(threadId, value[, transferList][, timeout])` > Stability: 1.1 - Active development diff --git a/doc/changelogs/CHANGELOG_V20.md b/doc/changelogs/CHANGELOG_V20.md index fc81e35e8264db..b0250f72bfa0ab 100644 --- a/doc/changelogs/CHANGELOG_V20.md +++ b/doc/changelogs/CHANGELOG_V20.md @@ -9,6 +9,7 @@ +20.19.0
20.18.3
20.18.2
20.18.1
@@ -68,6 +69,195 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + + +## 2025-03-13, Version 20.19.0 'Iron' (LTS), @marco-ippolito + +### Notable Changes + +### require(esm) is now enabled by default + +Support for loading native ES modules using require() had been available on v20.x under the command line flag --experimental-require-module, and available by default on v22.x and v23.x. In this release, it is now no longer behind a flag on v20.x. + +This feature is still experimental, and we are looking for user feedback to make more final tweaks before fully stabilizing it. For this reason, on v23.x, when the Node.js instance encounters a native ES module in require() for the first time, it will emit an experimental warning unless `require()` comes from a path that contains `node_modules`. If there happens to be any regressions caused by this feature, users can report it to the Node.js issue tracker. Meanwhile this feature can also be disabled using `--no-experimental-require-module` as a workaround. + +With this feature enabled, Node.js will no longer throw `ERR_REQUIRE_ESM` if `require()` is used to load a ES module. It can, however, throw `ERR_REQUIRE_ASYNC_MODULE` if the ES module being loaded or its dependencies contain top-level `await`. When the ES module is loaded successfully by `require()`, the returned object will either be a ES module namespace object similar to what's returned by `import()`, or what gets exported as `"module.exports"` in the ES module. + +Users can check `process.features.require_module` to see whether `require(esm)` is enabled in the current Node.js instance. For packages, the `"module-sync"` exports condition can be used as a way to detect `require(esm)` support in the current Node.js instance and allow both `require()` and `import` to load the same native ES module. See [the documentation](https://nodejs.org/docs/latest/api/modules.html#loading-ecmascript-modules-using-require) for more details about this feature. + +Contributed by Joyee Cheung in [#55085](https://github.com/nodejs/node/pull/55085) + +### Module syntax detection is now enabled by default + +Module syntax detection (the `--experimental-detect-module` flag) is now +enabled by default. Use `--no-experimental-detect-module` to disable it if +needed. + +Syntax detection attempts to run ambiguous files as CommonJS, and if the module +fails to parse as CommonJS due to ES module syntax, Node.js tries again and runs +the file as an ES module. +Ambiguous files are those with a `.js` or no extension, where the nearest parent +`package.json` has no `"type"` field (either `"type": "module"` or +`"type": "commonjs"`). +Syntax detection should have no performance impact on CommonJS modules, but it +incurs a slight performance penalty for ES modules; add `"type": "module"` to +the nearest parent `package.json` file to eliminate the performance cost. +A use case unlocked by this feature is the ability to use ES module syntax in +extensionless scripts with no nearby `package.json`. + +Thanks to Geoffrey Booth for making this work on [#53619](https://github.com/nodejs/node/pull/53619). + +### Other Notable Changes + +* \[[`285bb4ee14`](https://github.com/nodejs/node/commit/285bb4ee14)] - **crypto**: update root certificates to NSS 3.107 (Node.js GitHub Bot) [#56566](https://github.com/nodejs/node/pull/56566) +* \[[`73b5c16684`](https://github.com/nodejs/node/commit/73b5c16684)] - **(SEMVER-MINOR)** **worker**: add postMessageToThread (Paolo Insogna) [#53682](https://github.com/nodejs/node/pull/53682) +* \[[`de313b2336`](https://github.com/nodejs/node/commit/de313b2336)] - **(SEMVER-MINOR)** **module**: only emit require(esm) warning under --trace-require-module (Joyee Cheung) [#56194](https://github.com/nodejs/node/pull/56194) +* \[[`4fba01911d`](https://github.com/nodejs/node/commit/4fba01911d)] - **(SEMVER-MINOR)** **process**: add process.features.require\_module (Joyee Cheung) [#55241](https://github.com/nodejs/node/pull/55241) +* \[[`df8a045afe`](https://github.com/nodejs/node/commit/df8a045afe)] - **(SEMVER-MINOR)** **module**: implement the "module-sync" exports condition (Joyee Cheung) [#54648](https://github.com/nodejs/node/pull/54648) +* \[[`f9dc1eaef5`](https://github.com/nodejs/node/commit/f9dc1eaef5)] - **(SEMVER-MINOR)** **module**: add \_\_esModule to require()'d ESM (Joyee Cheung) [#52166](https://github.com/nodejs/node/pull/52166) + +### Commits + +* \[[`d84be843e3`](https://github.com/nodejs/node/commit/d84be843e3)] - **benchmark**: add validateStream to styleText bench (Rafael Gonzaga) [#56556](https://github.com/nodejs/node/pull/56556) +* \[[`1ee4bf9690`](https://github.com/nodejs/node/commit/1ee4bf9690)] - **build**: test macos-13 on GitHub actions (Michaël Zasso) [#56307](https://github.com/nodejs/node/pull/56307) +* \[[`1cc8d69882`](https://github.com/nodejs/node/commit/1cc8d69882)] - **build**: build v8 with -fvisibility=hidden on macOS (Joyee Cheung) [#56275](https://github.com/nodejs/node/pull/56275) +* \[[`52f1f7e22b`](https://github.com/nodejs/node/commit/52f1f7e22b)] - **child\_process**: fix parsing messages with splitted length field (Maksim Gorkov) [#56106](https://github.com/nodejs/node/pull/56106) +* \[[`5ef3c3c996`](https://github.com/nodejs/node/commit/5ef3c3c996)] - **crypto**: add missing return value check (Michael Dawson) [#56615](https://github.com/nodejs/node/pull/56615) +* \[[`285bb4ee14`](https://github.com/nodejs/node/commit/285bb4ee14)] - **crypto**: update root certificates to NSS 3.107 (Node.js GitHub Bot) [#56566](https://github.com/nodejs/node/pull/56566) +* \[[`d4ca38fe8e`](https://github.com/nodejs/node/commit/d4ca38fe8e)] - **deps**: macro ENODATA is deprecated in libc++ (Cheng) [#56698](https://github.com/nodejs/node/pull/56698) +* \[[`15214e6508`](https://github.com/nodejs/node/commit/15214e6508)] - **deps**: update simdutf to 6.0.3 (Node.js GitHub Bot) [#56567](https://github.com/nodejs/node/pull/56567) +* \[[`1e44f5d84b`](https://github.com/nodejs/node/commit/1e44f5d84b)] - **deps**: update simdutf to 5.7.2 (Node.js GitHub Bot) [#56388](https://github.com/nodejs/node/pull/56388) +* \[[`b92ff7be38`](https://github.com/nodejs/node/commit/b92ff7be38)] - **deps**: update googletest to 7d76a23 (Node.js GitHub Bot) [#56387](https://github.com/nodejs/node/pull/56387) +* \[[`e1b71a81a9`](https://github.com/nodejs/node/commit/e1b71a81a9)] - **deps**: update googletest to e54519b (Node.js GitHub Bot) [#56370](https://github.com/nodejs/node/pull/56370) +* \[[`c0d45e7f38`](https://github.com/nodejs/node/commit/c0d45e7f38)] - **deps**: update simdutf to 5.7.0 (Node.js GitHub Bot) [#56332](https://github.com/nodejs/node/pull/56332) +* \[[`d69107f5a8`](https://github.com/nodejs/node/commit/d69107f5a8)] - **deps**: update icu to 76.1 (Node.js GitHub Bot) [#55551](https://github.com/nodejs/node/pull/55551) +* \[[`5c9a397699`](https://github.com/nodejs/node/commit/5c9a397699)] - **deps**: V8: backport 9ab40592f697 (Lu Yahan) [#56781](https://github.com/nodejs/node/pull/56781) +* \[[`8342233f6d`](https://github.com/nodejs/node/commit/8342233f6d)] - **deps**: update corepack to 0.31.0 (Node.js GitHub Bot) [#56795](https://github.com/nodejs/node/pull/56795) +* \[[`561493d35e`](https://github.com/nodejs/node/commit/561493d35e)] - **deps,src**: simplify base64 encoding (Daniel Lemire) [#52714](https://github.com/nodejs/node/pull/52714) +* \[[`6207b2936c`](https://github.com/nodejs/node/commit/6207b2936c)] - **doc**: move anatoli to emeritus (Michael Dawson) [#56592](https://github.com/nodejs/node/pull/56592) +* \[[`b0ab483400`](https://github.com/nodejs/node/commit/b0ab483400)] - **doc**: fix styles of the expandable TOC (Antoine du Hamel) [#56755](https://github.com/nodejs/node/pull/56755) +* \[[`53e4dc2a82`](https://github.com/nodejs/node/commit/53e4dc2a82)] - **doc**: add "Skip to content" button (Antoine du Hamel) [#56750](https://github.com/nodejs/node/pull/56750) +* \[[`33ee4645c3`](https://github.com/nodejs/node/commit/33ee4645c3)] - **doc**: improve accessibility of expandable lists (Antoine du Hamel) [#56749](https://github.com/nodejs/node/pull/56749) +* \[[`b514438418`](https://github.com/nodejs/node/commit/b514438418)] - **doc**: add note regarding commit message trailers (Dario Piotrowicz) [#56736](https://github.com/nodejs/node/pull/56736) +* \[[`627f2997e3`](https://github.com/nodejs/node/commit/627f2997e3)] - **doc**: fix typo in example code for util.styleText (Robin Mehner) [#56720](https://github.com/nodejs/node/pull/56720) +* \[[`68548dcb48`](https://github.com/nodejs/node/commit/68548dcb48)] - **doc**: fix inconsistencies in `WeakSet` and `WeakMap` comparison details (Shreyans Pathak) [#56683](https://github.com/nodejs/node/pull/56683) +* \[[`337cfb2549`](https://github.com/nodejs/node/commit/337cfb2549)] - **doc**: add RafaelGSS as latest sec release stewards (Rafael Gonzaga) [#56682](https://github.com/nodejs/node/pull/56682) +* \[[`e890c86d7b`](https://github.com/nodejs/node/commit/e890c86d7b)] - **doc**: clarify cjs/esm diff in `queueMicrotask()` vs `process.nextTick()` (Dario Piotrowicz) [#56659](https://github.com/nodejs/node/pull/56659) +* \[[`978263923f`](https://github.com/nodejs/node/commit/978263923f)] - **doc**: `WeakSet` and `WeakMap` comparison details (Shreyans Pathak) [#56648](https://github.com/nodejs/node/pull/56648) +* \[[`aba280ccd8`](https://github.com/nodejs/node/commit/aba280ccd8)] - **doc**: mention prepare --security (Rafael Gonzaga) [#56617](https://github.com/nodejs/node/pull/56617) +* \[[`0a009a527b`](https://github.com/nodejs/node/commit/0a009a527b)] - **doc**: tweak info on reposts in ambassador program (Michael Dawson) [#56589](https://github.com/nodejs/node/pull/56589) +* \[[`d2f09e2ab3`](https://github.com/nodejs/node/commit/d2f09e2ab3)] - **doc**: add type stripping to ambassadors program (Marco Ippolito) [#56598](https://github.com/nodejs/node/pull/56598) +* \[[`b0b77d7fbe`](https://github.com/nodejs/node/commit/b0b77d7fbe)] - **doc**: improve internal documentation on built-in snapshot (Joyee Cheung) [#56505](https://github.com/nodejs/node/pull/56505) +* \[[`4b3e7fee94`](https://github.com/nodejs/node/commit/4b3e7fee94)] - **doc**: document CLI way to open the nodejs/bluesky PR (Antoine du Hamel) [#56506](https://github.com/nodejs/node/pull/56506) +* \[[`03878b0384`](https://github.com/nodejs/node/commit/03878b0384)] - **doc**: update gcc-version for ubuntu-lts (Kunal Kumar) [#56553](https://github.com/nodejs/node/pull/56553) +* \[[`acbbd7c1a6`](https://github.com/nodejs/node/commit/acbbd7c1a6)] - **doc**: fix parentheses in options (Tobias Nießen) [#56563](https://github.com/nodejs/node/pull/56563) +* \[[`3fe80c30b8`](https://github.com/nodejs/node/commit/3fe80c30b8)] - **doc**: include CVE to EOL lines as sec release process (Rafael Gonzaga) [#56520](https://github.com/nodejs/node/pull/56520) +* \[[`ff8af58046`](https://github.com/nodejs/node/commit/ff8af58046)] - **doc**: add esm examples to node:trace\_events (Alfredo González) [#56514](https://github.com/nodejs/node/pull/56514) +* \[[`27b9cfd135`](https://github.com/nodejs/node/commit/27b9cfd135)] - **doc**: add message for Ambassadors to promote (Michael Dawson) [#56235](https://github.com/nodejs/node/pull/56235) +* \[[`020c939da1`](https://github.com/nodejs/node/commit/020c939da1)] - **doc**: allow request for TSC reviews via the GitHub UI (Antoine du Hamel) [#56493](https://github.com/nodejs/node/pull/56493) +* \[[`1ef9c9a354`](https://github.com/nodejs/node/commit/1ef9c9a354)] - **doc**: add example for piping ReadableStream (Gabriel Schulhof) [#56415](https://github.com/nodejs/node/pull/56415) +* \[[`e675c3a7fc`](https://github.com/nodejs/node/commit/e675c3a7fc)] - **doc**: expand description of `parseArg`'s `default` (Kevin Gibbons) [#54431](https://github.com/nodejs/node/pull/54431) +* \[[`bc756da876`](https://github.com/nodejs/node/commit/bc756da876)] - **doc**: use `