Releases: nodejs/node
2024-09-03, Version 22.8.0 (Current), @RafaelGSS
New JS API for compile cache
This release adds a new API module.enableCompileCache()
that can be used to enable on-disk code caching of all modules loaded after this API is called.
Previously this could only be enabled by the NODE_COMPILE_CACHE
environment variable, so it could only set by end-users.
This API allows tooling and library authors to enable caching of their own code.
This is a built-in alternative to the v8-compile-cache/v8-compile-cache-lib packages,
but have better performance and supports ESM.
Thanks to Joyee Cheung for working on this.
New option for vm.createContext() to create a context with a freezable globalThis
Node.js implements a flavor of vm.createContext()
and friends that creates a context without contextifying its global
object when vm.constants.DONT_CONTEXTIFY is used. This is suitable when users want to freeze the context
(impossible when the global is contextified i.e. has interceptors installed) or speed up the global access if they
don't need the interceptor behavior.
Thanks to Joyee Cheung for working on this.
Support for coverage thresholds
Node.js now supports requiring code coverage to meet a specific threshold before the process exits successfully.
To use this feature, you need to enable the --experimental-test-coverage
flag.
You can set thresholds for the following types of coverage:
- Branch coverage: Use
--test-coverage-branches=<threshold>
- Function coverage: Use
--test-coverage-functions=<threshold>
- Line coverage: Use
--test-coverage-lines=<threshold>
<threshold>
should be an integer between 0 and 100. If an invalid value is provided, a TypeError
will be thrown.
If the code coverage fails to meet the specified thresholds for any category, the process will exit with code 1
.
For instance, to enforce a minimum of 80% line coverage and 60% branch coverage, you can run:
$ node --experimental-test-coverage --test-coverage-lines=80 --test-coverage-branches=60 example.js
Thanks Aviv Keller for working on this.
Other Notable Changes
- [
1f2cc2fa47
] - (SEMVER-MINOR) src,lib: add performance.uvMetricsInfo (Rafael Gonzaga) #54413 - [
1e01bdc0d0
] - (SEMVER-MINOR) net: exclude ipv6 loopback addresses from server.listen (Giovanni Bucci) #54264 - [
97fa075c2e
] - (SEMVER-MINOR) test_runner: support running tests in process (Colin Ihrig) #53927 - [
858b583c88
] - (SEMVER-MINOR) test_runner: defer inheriting hooks until run() (Colin Ihrig) #53927
Commits
- [
94985df9d6
] - benchmark: fix benchmark for file path and URL conversion (Early Riser) #54190 - [
ac178b094b
] - buffer: truncate instead of throw when writing beyond buffer (Robert Nagy) #54524 - [
afd8c1eb4f
] - buffer: allow invalid encoding in from (Robert Nagy) #54533 - [
6f0cf35cd3
] - build: reclaim disk space on macOS GHA runner (jakecastelli) #54658 - [
467ac3aec4
] - build: don't clean obj.target directory if it doesn't exist (Joyee Cheung) #54337 - [
71fdf961df
] - build: update required python version to 3.8 (Aviv Keller) #54358 - [
73604cf1c5
] - deps: update nghttp2 to 1.63.0 (Node.js GitHub Bot) #54589 - [
b00c087285
] - deps: V8: cherry-pick e74d0f437fcd (Joyee Cheung) #54279 - [
33a6b3c7a9
] - deps: backport ICU-22787 to fix ClangCL on Windows (Stefan Stojanovic) #54502 - [
fe56949cbb
] - deps: update c-ares to v1.33.1 (Node.js GitHub Bot) #54549 - [
290f6ce619
] - deps: update amaro to 0.1.8 (Node.js GitHub Bot) #54520 - [
b5843568b4
] - deps: update amaro to 0.1.7 (Node.js GitHub Bot) #54473 - [
9c709209b4
] - deps: update undici to 6.19.8 (Node.js GitHub Bot) #54456 - [
a5ce24181b
] - deps: sqlite: fix Windows compilation (Colin Ihrig) #54433 - [
3caf29ea88
] - deps: update sqlite to 3.46.1 (Node.js GitHub Bot) #54433 - [
68758d4b08
] - doc: add support me link for anonrig (Yagiz Nizipli) #54611 - [
f5c5529266
] - doc: add alert on REPL from TCP socket (Rafael Gonzaga) #54594 - [
bf824483cd
] - doc: fix typo in styleText description (Rafael Gonzaga) #54616 - [
825d933fd4
] - doc: add getHeapStatistics() property descriptions (Benji Marinacci) #54584 - [
80e5150160
] - doc: fix module compile cache description (ζ²ιΈΏι£) #54625 - [
7fd033fe56
] - doc: run license-builder (github-actions[bot]) #54562 - [
c499913732
] - doc: fix information about including coverage files (Aviv Keller) #54527 - [
c3dc83befc
] - doc: support collaborators - talk amplification (Michael Dawson) #54508 - [
fc57beaad3
] - doc: add note about shasum generation failure (Marco Ippolito) #54487 - [
1800a58f49
] - doc: update websocket flag description to reflect stable API status (Yelim Koo) #54482 - [
61affd77a7
] - doc: fix capitalization in module.md (shallow-beach) #54488 - [
25419915c7
] - doc: add esm examples to node:https (Alfredo GonzΓ‘lez) #54399 - [
83b5efeb54
] - doc: reserve ABI 130 for Electron 33 (Calvin) #54383 - [
6ccbd32ae8
] - doc, meta: add missing,
toBUILDING.md
(Aviv Keller) #54409 - [
fc08a9b0cd
] - fs: refactor handleTimestampsAndMode to remove redundant call (HEESEUNG) #54369 - [
4a664b5fcb
] - lib: respect terminal capabilities on styleText (Rafael Gonzaga) #54389 - [
a9ce2b6a28
] - lib: fix emit warning for debuglog.time when disabled (Vinicius Lourenço) #54275 - [
b5a23c9783
] - meta: remind users to use a supported version in bug reports (Aviv Keller) #54481 - [
0d7171d8e9
] - meta: add more labels to dep-updaters (Aviv Keller) #54454 - [
c4996c189f
] - meta: run coverage-windows whenvcbuild.bat
updated (Aviv Keller) #54412 - [
3cf645768e
] - module: use amaro default transform values (Marco Ippolito) #54517 - [
336496b90e
] - module: add sourceURL magic comment hint...
2024-08-22, Version 22.7.0 (Current), @RafaelGSS
Experimental transform types support
With the new flag --experimental-transform-types
it is possible to enable the
transformation of TypeScript-only syntax into JavaScript code.
This feature allows Node.js to support TypeScript syntax such as Enum
and namespace
.
Thanks to Marco Ippolito for making this work on #54283.
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.
Performance Improvements to Buffer
Performance of Node.js Buffers have been optimized through multiple PR's with significant
improvements to the Buffer.copy
and Buffer.write
methods. These are used throughout
the codebase and should give a nice boost across the board.
Thanks to Robert Nagy for making this work on #54311,
#54324, and #54087.
Other Notable Changes
- [
911de7dd6d
] - (SEMVER-MINOR) inspector: supportNetwork.loadingFailed
event (Kohei Ueno) #54246 - [
9ee4b16bd8
] - (SEMVER-MINOR) lib: rewrite AsyncLocalStorage without async_hooks (Stephen Belanger) #48528
Commits
- [
c6544ff5a6
] - benchmark: use assert.ok searchparams (Rafael Gonzaga) #54334 - [
51b8576897
] - benchmark: add stream.compose benchmark (jakecastelli) #54308 - [
c166036515
] - benchmark: rename count to n (Rafael Gonzaga) #54271 - [
1be0ee76ef
] - benchmark: change assert() to assert.ok() (Rafael Gonzaga) #54254 - [
4dd229f546
] - benchmark: support --help in CLI (Aviv Keller) #53358 - [
a5a320cd5b
] - benchmark: remove force option as force defaults to true (Yelim Koo) #54203 - [
db0a80a0eb
] - benchmark: use assert.ok instead of assert (Rafael Gonzaga) #54176 - [
8ba53ae7b7
] - buffer: properly apply dst offset and src length on fast path (Robert Nagy) #54391 - [
a5a60e6823
] - buffer: use fast API for writing one-byte strings (Robert Nagy) #54311 - [
7b641bc2bd
] - buffer: optimize byteLength for short strings (Robert Nagy) #54345 - [
28ca678f81
] - buffer: optimize byteLength for common encodings (Robert Nagy) #54342 - [
12785559be
] - buffer: optimize createFromString (Robert Nagy) #54324 - [
f7f7b0c498
] - buffer: optimize for common encodings (Robert Nagy) #54319 - [
37631f826b
] - buffer: add JSDoc to blob bytes method (Roberto Simonini) #54117 - [
ab6fae9dbf
] - buffer: faster type check (Robert Nagy) #54088 - [
9f8f26eb2f
] - buffer: use native copy impl (Robert Nagy) #54087 - [
019ebf03c1
] - buffer: use faster integer argument check (Robert Nagy) #54089 - [
c640a2f24c
] - build: always disable strict aliasing (MichaΓ«l Zasso) #54339 - [
6aa1d9e855
] - build: updateruff
to0.5.2
(Aviv Keller) #53909 - [
350e699443
] - build: supportlint-js-fix
invcbuild.bat
(Aviv Keller) #53695 - [
98fed763f7
] - build: add--without-amaro
build flag (Antoine du Hamel) #54136 - [
1ca598c5ce
] - cli: allow--test-[name/skip]-pattern
inNODE_OPTIONS
(Aviv Keller) #53001 - [
37960a67ae
] - console: use validateOneOf for colorMode validation (HEESEUNG) #54245 - [
d52f515bab
] - crypto: include NODE_EXTRA_CA_CERTS in all secure contexts by default (Eric Bickle) #44529 - [
b6a3e61353
] - deps: update amaro to 0.1.6 (Node.js GitHub Bot) #54374 - [
0d716ad3f3
] - deps: update simdutf to 5.3.4 (Node.js GitHub Bot) #54312 - [
18bfea5f33
] - deps: update zlib to 1.3.0.1-motley-71660e1 (Node.js GitHub Bot) #53464 - [
d0c23f332f
] - deps: update zlib to 1.3.0.1-motley-c2469fd (Node.js GitHub Bot) #53464 - [
e7db63972c
] - deps: update zlib to 1.3.0.1-motley-68e57e6 (Node.js GitHub Bot) #53464 - [
713ae95555
] - deps: update zlib to 1.3.0.1-motley-8b7eff8 (Node.js GitHub Bot) #53464 - [
758c9df36e
] - deps: update zlib to 1.3.0.1-motley-e432200 (Node.js GitHub Bot) #53464 - [
fe7e6c9563
] - deps: update zlib to 1.3.0.1-motley-887bb57 (Node.js GitHub Bot) #53464 - [
35722b7bca
] - deps: update simdjson to 3.10.0 (Node.js GitHub Bot) #54197 - [
a2a41557db
] - deps: fix GN build warning in ncrypto (Cheng) #54222 - [
869da204d7
] - deps: update c-ares to v1.33.0 (Node.js GitHub Bot) #54198 - [
e0d503a715
] - deps: update nbytes to 0.1.1 (Node.js GitHub Bot) #54277 - [
b0c768dae1
] - deps: update undici to 6.19.7 (Node.js GitHub Bot) #54286 - [
ef9a950cb9
] - deps: update acorn to 8.12.1 (Node.js GitHub Bot) #53465 - [
1597a1139a
] - deps: update undici to 6.19.5 (Node.js GitHub Bot) #54076 - [
103e4db3e0
] - deps: update simdutf to 5.3.1 (Node.js GitHub Bot) #54196 - [
9f115ba9e9
] - doc: fix error description of the max header size (Egawa Ryo) #54125 - [[
f967ab3810
](https:...
2024-08-21, Version 20.17.0 'Iron' (LTS), @marco-ippolito
module: support require()ing synchronous ESM graphs
This release adds require()
support for synchronous ESM graphs under
the flag --experimental-require-module
.
If --experimental-require-module
is enabled, and the ECMAScript
module being loaded by require()
meets the following requirements:
- Explicitly marked as an ES module with a "type": "module" field in the closest package.json or a .mjs extension.
- Fully synchronous (contains no top-level await).
require()
will load the requested module as an ES Module, and return
the module name space object. In this case it is similar to dynamic
import()
but is run synchronously and returns the name space object
directly.
Contributed by Joyee Cheung in #51977
path: add matchesGlob
method
Glob patterns can now be tested against individual paths via the path.matchesGlob(path, pattern)
method.
Contributed by Aviv Keller in #52881
stream: expose DuplexPair API
The function duplexPair
returns an array with two items,
each being a Duplex
stream connected to the other side:
const [ sideA, sideB ] = duplexPair();
Whatever is written to one stream is made readable on the other. It provides
behavior analogous to a network connection, where the data written by the client
becomes readable by the server, and vice-versa.
Contributed by Austin Wright in #34111
Other Notable Changes
- [
8e64c02b19
] - (SEMVER-MINOR) http: add diagnostics channelhttp.client.request.error
(Kohei Ueno) #54054 - [
ae30674991
] - meta: add jake to collaborators (jakecastelli) #54004 - [
4a3ecbfc9b
] - (SEMVER-MINOR) stream: implementmin
option forReadableStreamBYOBReader.read
(Mattias Buelens) #50888
Commits
- [
b3a2726cbc
] - assert: use isError instead of instanceof in innerOk (Pietro Marchini) #53980 - [
c7e4c3daf4
] - benchmark: add cpSync benchmark (Yagiz Nizipli) #53612 - [
a52de8c5ff
] - bootstrap: print--help
message usingconsole.log
(Jacob Hummer) #51463 - [
61b90e7c5e
] - build: update gcovr to 7.2 and codecov config (Benjamin E. Coe) #54019 - [
a9c04eaa27
] - build: ensure v8_pointer_compression_sandbox is enabled on 64bit (Shelley Vohr) #53884 - [
342a663d7a
] - build: trigger coverage ci when updating codecov (Yagiz Nizipli) #53929 - [
5727b4d129
] - build: update codecov coverage build count (Yagiz Nizipli) #53929 - [
977af25870
] - build: disable test-asan workflow (MichaΓ«l Zasso) #53844 - [
04798fb104
] - build: fix build warning of c-ares under GN build (Cheng) #53750 - [
5ec5e78574
] - build: fix mac build error of c-ares under GN (Cheng) #53687 - [
3d8721f0a4
] - build: add version-specific library path for AIX (Richard Lau) #53585 - [
ffb0bd344d
] - build, tools: drop leading/
fromr2dir
(Richard Lau) #53951 - [
a2d74f4c31
] - build,tools: simplify upload of shasum signatures (MichaΓ«l Zasso) #53892 - [
993bb3b6e7
] - child_process: fix incomplete prototype pollution hardening (Liran Tal) #53781 - [
137a2e5766
] - cli: document--inspect
port0
behavior (Aviv Keller) #53782 - [
820e6e1737
] - cli: updatenode.1
to reflect Atom's sunset (Aviv Keller) #53734 - [
fa0e8d7b3b
] - crypto: avoid std::function (Tobias NieΓen) #53683 - [
460240c368
] - crypto: make deriveBits length parameter optional and nullable (Filip Skokan) #53601 - [
ceb1d5e00a
] - crypto: avoid taking ownership of OpenSSL objects (Tobias NieΓen) #53460 - [
44268c27eb
] - deps: update corepack to 0.29.3 (Node.js GitHub Bot) #54072 - [
496975ece0
] - deps: update c-ares to v1.32.3 (Node.js GitHub Bot) #54020 - [
5eea419349
] - deps: update c-ares to v1.32.2 (Node.js GitHub Bot) #53865 - [
8c8e3688c5
] - deps: update googletest to 4b21f1a (Node.js GitHub Bot) #53842 - [
78f6b34c77
] - deps: update minimatch to 10.0.1 (Node.js GitHub Bot) #53841 - [
398f7acca3
] - deps: update corepack to 0.29.2 (Node.js GitHub Bot) #53838 - [
fa8f99d90b
] - deps: update simdutf to 5.3.0 (Node.js GitHub Bot) #53837 - [
a19b28336b
] - deps: update ada to 2.9.0 (Node.js GitHub Bot) #53748 - [
2f66c7e707
] - deps: upgrade npm to 10.8.2 (npm team) #53799 - [
2a2620e7c0
] - deps: update googletest to 34ad51b (Node.js GitHub Bot) #53157 - [
c01ce60ce7
] - deps: update googletest to 305e5a2 (Node.js GitHub Bot) #53157 - [
832328ea01
] - deps: update c-ares to v1.32.1 (Node.js GitHub Bot) #53753 - [
878e9a4ae7
] - deps: update minimatch to 9.0.5 (Node.js GitHub Bot) #53646 - [
4647e6b5c5
] - deps: update c-ares to v1.32.0 (Node.js GitHub Bot) #53722 - [
30310bf887
] - doc: move numCPUs require to top of file in cluster CJS example (Alfredo GonzΓ‘lez) #53932 - [
36170eddca
] - doc: update security-release process to automated one (Rafael Gonzaga) #53877 - [
55f5e76ba7
] - doc: fix typo in technical-priorities.md (YoonSoo_Shin) #54094 - [
1c0ccc0ca8
] - doc: fix typo in diagnostic tooling support tiers document (Taejin Kim) #54058 - [
6a5120ff0f
] - doc: move GeoffreyBooth to TSC regular member (Geoffrey Booth) #54047 - [
ead05aad2a
] - doc: fix typo in recognizing-contributors (Marco Ippolito) #53990 - [
25e59aebac
] - doc: update boxstarter README (Aviv Keller) #53785 - [
a3183fb927
] - doc: add info about prefix-only modules tomodule.builtinModules
(Grigory) #53954 - [[
89599e025f
](https://github.com/nodejs/node/commit...
2024-08-06, Version 22.6.0 (Current), @RafaelGSS
Experimental TypeScript support via strip types
Node.js introduces the --experimental-strip-types
flag for initial TypeScript support.
This feature strips type annotations from .ts files, allowing them to run
without transforming TypeScript-specific syntax. Current limitations include:
- Supports only inline type annotations, not features like
enums
ornamespaces
. - Requires explicit file extensions in import and require statements.
- Enforces the use of the type keyword for type imports to avoid runtime errors.
- Disabled for TypeScript in node_modules by default.
Thanks Marco Ippolito for working on this.
Experimental Network Inspection Support in Node.js
This update introduces the initial support for network inspection in Node.js.
Currently, this is an experimental feature, so you need to enable it using the --experimental-network-inspection
flag.
With this feature enabled, you can inspect network activities occurring within a JavaScript application.
To use network inspection, start your Node.js application with the following command:
$ node --inspect-wait --experimental-network-inspection index.js
Please note that the network inspection capabilities are in active development.
We are actively working on enhancing this feature and will continue to expand its functionality in future updates.
- Network inspection is limited to the
http
andhttps
modules only. - The Network tab in Chrome DevTools will not be available until the
feature request on the Chrome DevTools side is addressed.
Thanks Kohei Ueno for working on this.
Other Notable Changes
- [
15a94e67b1
] - lib,src: drop --experimental-network-imports (Rafael Gonzaga) #53822 - [
68e444d2d8
] - (SEMVER-MINOR) http: add diagnostics channelhttp.client.request.error
(Kohei Ueno) #54054 - [
2d982d3dee
] - (SEMVER-MINOR) deps: V8: backport 7857eb34db42 (Stephen Belanger) #53997 - [
15816bd0dd
] - (SEMVER-MINOR) stream: expose DuplexPair API (Austin Wright) #34111 - [
893c864542
] - (SEMVER-MINOR) test_runner: fix support watch with run(), add globPatterns option (Matteo Collina) #53866 - [
048d421ad1
] - meta: add jake to collaborators (jakecastelli) #54004 - [
6ad6e01bf3
] - (SEMVER-MINOR) test_runner: refactor snapshots to get file from context (Colin Ihrig) #53853 - [
698e44f8e7
] - (SEMVER-MINOR) test_runner: add context.filePath (Colin Ihrig) #53853
Commits
- [
063f46dc2a
] - assert: use isError instead of instanceof in innerOk (Pietro Marchini) #53980 - [
10bea42f81
] - build: update gcovr to 7.2 and codecov config (Benjamin E. Coe) #54019 - [
7c417c6cf4
] - build: avoid compiling with VS v17.10 (Hüseyin Açacak) #53863 - [
ee97c045b4
] - build: ensure v8_pointer_compression_sandbox is enabled on 64bit (Shelley Vohr) #53884 - [
bfbed0afd5
] - build: fix conflict gyp configs (Chengzhong Wu) #53605 - [
0f1fe63e32
] - build: trigger coverage ci when updating codecov (Yagiz Nizipli) #53929 - [
ad62b945f0
] - build: update codecov coverage build count (Yagiz Nizipli) #53929 - [
3c40868fd3
] - build: disable test-asan workflow (MichaΓ«l Zasso) #53844 - [
2a62d6ca57
] - build, tools: drop leading/
fromr2dir
(Richard Lau) #53951 - [
9c7b009f47
] - build,tools: simplify upload of shasum signatures (MichaΓ«l Zasso) #53892 - [
057bd44f9f
] - child_process: fix incomplete prototype pollution hardening (Liran Tal) #53781 - [
66f7c595c7
] - cli: document--inspect
port0
behavior (Aviv Keller) #53782 - [
fad3e74b47
] - console: fix issues with frozen intrinsics (Vinicius Lourenço) #54070 - [
e685ecd7ae
] - deps: update corepack to 0.29.3 (Node.js GitHub Bot) #54072 - [
e5f7250e6d
] - deps: update amaro to 0.0.6 (Node.js GitHub Bot) #54199 - [
2c1e9082e8
] - deps: update amaro to 0.0.5 (Node.js GitHub Bot) #54199 - [
2d982d3dee
] - (SEMVER-MINOR) deps: V8: backport 7857eb34db42 (Stephen Belanger) #53997 - [
1061898462
] - deps: update c-ares to v1.32.3 (Node.js GitHub Bot) #54020 - [
f4a7ac5e18
] - deps: V8: cherry-pick 35888fee7bba (Joyee Cheung) #53728 - [
1176310226
] - deps: add gn build files for ncrypto (Cheng) #53940 - [
7a1d5a4f84
] - deps: update c-ares to v1.32.2 (Node.js GitHub Bot) #53865 - [
66f6a2aec9
] - deps: V8: cherry-pick 9812cb486e2b (MichaΓ«l Zasso) #53966 - [
8e66a18ef0
] - deps: start working on ncrypto dep (James M Snell) #53803 - [
c114082b12
] - deps: fix include_dirs of nbytes (Cheng) #53862 - [
b7315281be
] - doc: move numCPUs require to top of file in cluster CJS example (Alfredo GonzΓ‘lez) #53932 - [
8e7c30c2a4
] - doc: update security-release process to automated one (Rafael Gonzaga) #53877 - [
52a4206be2
] - doc: fix typo in technical-priorities.md (YoonSoo_Shin) #54094 - [
30e18a04a3
] - doc: fix typo in diagnostic tooling support tiers document (Taejin Kim) #54058 - [
58aebfd31e
] - doc: move GeoffreyBooth to TSC regular member (Geoffrey Booth) #54047 - [
c1634c7213
] - doc: correct typescript stdin support (Marco Ippolito) #54036 - [
64812d5c22
] - doc: fix typo in recognizing-contributors (Marco Ippolito) #53990 - [
6b35994b6f
] - doc: fix documentation for--run
(Aviv Keller) #53976 - [
04d203a233
] - doc: update boxstarter README (Aviv Keller) #53785 - [
86fa46db1c
] - doc: add info about prefix-only modules tomodule.builtinModules
(Grigory) #53954 - [
defdc3c568
] - doc: removescroll-behavior: smooth;
(Cloyd Lau) #53942
*...
2024-07-24, Version 20.16.0 'Iron' (LTS), @marco-ippolito
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.
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)
accepts built-in module IDs that are recognized
by module.isBuiltin(id)
.
The references returned by process.getBuiltinModule(id)
always point to
the built-in module corresponding to id
even if users modify
require.cache
so that require(id)
returns something else.
Contributed by Joyee Cheung in #52762
doc: doc-only deprecate OpenSSL engine-based APIs
OpenSSL 3 deprecated support for custom engines with a recommendation to switch to its new provider model.
The clientCertEngine
option for https.request()
, tls.createSecureContext()
, and tls.createServer()
; the privateKeyEngine
and privateKeyIdentifier
for tls.createSecureContext();
and crypto.setEngine()
all depend on this functionality from OpenSSL.
Contributed by Richard Lau in #53329
inspector: fix disable async hooks on Debugger.setAsyncCallStackDepth
Debugger.setAsyncCallStackDepth
was previously calling the enable function by mistake. As a result, when profiling using Chrome DevTools, the async hooks won't be turned off properly after receiving Debugger.setAsyncCallStackDepth
with depth 0.
Contributed by Joyee Cheung in #53473
Other Notable Changes
- [
09e2191432
] - (SEMVER-MINOR) buffer: add .bytes() method to Blob (Matthew Aitken) #53221 - [
394e00f41c
] - (SEMVER-MINOR) doc: add context.assert docs (Colin Ihrig) #53169 - [
a8601efa5e
] - (SEMVER-MINOR) doc: improve explanation about built-in modules (Joyee Cheung) #52762 - [
5e76c258f7
] - doc: add StefanStojanovic to collaborators (StefanStojanovic) #53118 - [
5e694026f1
] - doc: add Marco Ippolito to TSC (Rafael Gonzaga) #53008 - [
f3ba1eb72f
] - (SEMVER-MINOR) net: add new net.server.listen tracing channel (Paolo Insogna) #53136 - [
2bcce3255b
] - (SEMVER-MINOR) src,permission: --allow-wasi & prevent WASI exec (Rafael Gonzaga) #53124 - [
a03a4c7bdd
] - (SEMVER-MINOR) test_runner: add context.fullName (Colin Ihrig) #53169 - [
69b828f5a5
] - (SEMVER-MINOR) util: support--no-
for argument with boolean type for parseArgs (Zhenwei Jin) #53107
Commits
- [
76fd0ea92e
] - assert,util: correct comparison when both contain same reference (Daniel Lemire) #53431 - [
65308b6692
] - benchmark: fix api restriction for the permission category (Ryan Tsien) #51528 - [
1e2bc2c2d0
] - benchmark: fix napi/ref addon (MichaΓ«l Zasso) #53233 - [
09e2191432
] - (SEMVER-MINOR) buffer: add .bytes() method to Blob (Matthew Aitken) #53221 - [
e1951a4804
] - build: fix spacing before NINJA_ARGS (jakecastelli) #53181 - [
76f3bb3460
] - build: generate binlog in out directories (Chengzhong Wu) #53325 - [
eded0c187b
] - build: support python 3.13 (Chengzhong Wu) #53190 - [
1e57c67fdb
] - build: update ruff to v0.4.5 (Yagiz Nizipli) #53180 - [
28e71ede63
] - build: add--skip-tests
totest-ci-js
target (Antoine du Hamel) #53105 - [
bb06778a65
] - build: fix building embedtest in GN build (Cheng) #53145 - [
117ff5f139
] - build: use broader detection for 'help' (Aviv Keller) #53045 - [
9aa896e7f5
] - build: fix -j propagation to ninja (Tobias NieΓen) #53088 - [
acdbc78955
] - build: exit on unsupported host OS for Android (Mohammed Keyvanzadeh) #52882 - [
bf3d94478e
] - build: fix--enable-d8
builds (Richard Lau) #53106 - [
99da7d7237
] - build: set "clang" in config.gypi in GN build (Cheng) #53004 - [
9446278f03
] - crypto: improve GetECGroupBits signature (Tobias NieΓen) #53364 - [
dc2a4af68d
] - crypto: fix propagation of "memory limit exceeded" (Tobias NieΓen) #53300 - [
c5174f5e60
] - deps: update c-ares to v1.31.0 (Node.js GitHub Bot) #53554 - [
28e932dc7a
] - deps: update undici to 6.19.2 (Node.js GitHub Bot) #53468 - [
e4f9c663c4
] - deps: update undici to 6.19.1 (Node.js GitHub Bot) #53468 - [
171dc50fdc
] - deps: update undici to 6.19.1 (Node.js GitHub Bot) #53468 - [
6bb6a9100d
] - deps: update undici to 6.19.0 (Node.js GitHub Bot) #53468 - [
815d71b4cd
] - deps: update acorn-walk to 8.3.3 (Node.js GitHub Bot) #53466 - [
8b5f1d765a
] - deps: update zlib to 1.3.0.1-motley-209717d (Node.js GitHub Bot) #53156 - [
fc73da6f50
] - deps: update c-ares to v1.30.0 (Node.js GitHub Bot) #53416 - [
a6b803abd6
] - deps: update undici to 6.18.2 (Node.js GitHub Bot) #53255 - [
0f235535bb
] - deps: update ada to 2.8.0 (Node.js GitHub Bot) #53254 - [
63407269a8
] - deps: update corepack to 0.28.2 (Node.js GitHub Bot) #53253 - [
7a126e8773
] - deps: update c-ares to 1.29.0 (Node.js GitHub Bot) #53155 - [
0c8fcceefa
] - deps: upgrade npm to 10.8.1 (npm team) #53207 - [
23866979f2
] - deps: upd...
2024-07-19, Version 22.5.1 (Current), @richardlau
Notable Changes
This release fixes a regression introduced in Node.js 22.5.0. The problem is known to display the following symptoms:
- Crash with
FATAL ERROR: v8::Object::GetCreationContextChecked No creation context available
#53902 - npm errors with
npm error Exit handler never called!
npm/cli#7657 - yarn hangs or outputs
Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)
yarnpkg/berry#6398
Commits
- [
e2deeedc6e
] - Revert "fs: add v8 fast api to closeSync" (Aviv Keller) #53904
2024-07-17, Version 22.5.0 (Current), @RafaelGSS prepared by @aduh95
Notable Changes
- [
1367c5558e
] - (SEMVER-MINOR) http: expose websockets (Natalia Venditto) #53721 - [
b31394920d
] - (SEMVER-MINOR) lib: addnode:sqlite
module (Colin Ihrig) #53752 - [
aa7df9551d
] - module: add__esModule
torequire()
'd ESM (Joyee Cheung) #52166 - [
8743c4d65a
] - (SEMVER-MINOR) path: addmatchesGlob
method (Aviv Keller) #52881 - [
77936c3d24
] - (SEMVER-MINOR) process: port on-exit-leak-free to core (Vinicius Lourenço) #53239 - [
82d88a83f8
] - (SEMVER-MINOR) stream: pipeline wait for close before calling the callback (jakecastelli) #53462 - [
3a0fcbb17a
] - test_runner: support glob matching coverage files (Aviv Keller) #53553 - [
22ca334090
] - (SEMVER-MINOR) worker: addpostMessageToThread
(Paolo Insogna) #53682
Commits
- [
eb4e370933
] - benchmark: add require-esm benchmark (Joyee Cheung) #52166 - [
4d4a8338db
] - benchmark: add cpSync benchmark (Yagiz Nizipli) #53612 - [
3d60b38afa
] - build: fix build warning of c-ares under GN build (Cheng) #53750 - [
a45c801048
] - build: fix build error in sqlite under GN build (Cheng) #53686 - [
40032eb623
] - build: add gn files for deps/nbytes (Cheng) #53685 - [
082799debb
] - build: fix mac build error of c-ares under GN (Cheng) #53687 - [
b05394ea6a
] - build: add version-specific library path for AIX (Richard Lau) #53585 - [
6237172eaf
] - cli: updatenode.1
to reflect Atom's sunset (Aviv Keller) #53734 - [
5697938cb7
] - crypto: avoid std::function (Tobias NieΓen) #53683 - [
3cc01aa314
] - crypto: make deriveBits length parameter optional and nullable (Filip Skokan) #53601 - [
f82e20fdea
] - crypto: avoid taking ownership of OpenSSL objects (Tobias NieΓen) #53460 - [
ad1e5610ec
] - deps: update googletest to 4b21f1a (Node.js GitHub Bot) #53842 - [
d285d610a0
] - deps: update minimatch to 10.0.1 (Node.js GitHub Bot) #53841 - [
70f5209c9f
] - deps: update corepack to 0.29.2 (Node.js GitHub Bot) #53838 - [
4930e12a45
] - deps: update simdutf to 5.3.0 (Node.js GitHub Bot) #53837 - [
d346833364
] - deps: update ada to 2.9.0 (Node.js GitHub Bot) #53748 - [
ab8abb5367
] - deps: upgrade npm to 10.8.2 (npm team) #53799 - [
1ad664905a
] - deps: update nbytes and add update script (Yagiz Nizipli) #53790 - [
a66f11e798
] - deps: update googletest to 34ad51b (Node.js GitHub Bot) #53157 - [
9bf61d6a0d
] - deps: update googletest to 305e5a2 (Node.js GitHub Bot) #53157 - [
8542ace488
] - deps: V8: cherry-pick 9ebca66a5740 (Chengzhong Wu) #53755 - [
29a734c21d
] - deps: V8: cherry-pick e061cf9970d9 (Joyee Cheung) #53755 - [
c7624af44a
] - deps: update c-ares to v1.32.1 (Node.js GitHub Bot) #53753 - [
bbcec9e129
] - deps: update minimatch to 9.0.5 (Node.js GitHub Bot) #53646 - [
76032fd980
] - deps: update c-ares to v1.32.0 (Node.js GitHub Bot) #53722 - [
26386046ad
] - doc: move MylesBorins to emeritus (Myles Borins) #53760 - [
362875bda0
] - doc: add Rafael to the last security release (Rafael Gonzaga) #53769 - [
a1a5ad848d
] - doc: use mock.callCount() in examples (Sébastien Règne) #53754 - [
bb960c5471
] - doc: clarify authenticity of plaintexts in update (Tobias NieΓen) #53784 - [
5dd3018eb4
] - doc: add option to have support me link (Michael Dawson) #53312 - [
0f95ad3d7d
] - doc: add OpenSSL security level to TLS docs (Afanasii Kurakin) #53647 - [
2d92ec2831
] - doc: updatescroll-padding-top
to 4rem (Cloyd Lau) #53662 - [
933359a786
] - doc: mention v8.setFlagsFromString to pm (Rafael Gonzaga) #53731 - [
e17c2618e3
] - doc: remove the last <pre> tag (Claudio W) #53741 - [
7f18a5f47a
] - doc: exclude voting and regular TSC from spotlight (Michael Dawson) #53694 - [
df3dcd1bd1
] - doc: fix releases guide for recent Git versions (MichaΓ«l Zasso) #53709 - [
50987ea833
] - doc: requirenode:process
in assert doc examples (Alfredo GonzΓ‘lez) #53702 - [
fa58d01497
] - doc: add additional explanation to the wildcard section in permissions (jakecastelli) #53664 - [
28bf1e48ef
] - doc: mark NODE_MODULE_VERSION for Node.js 22.0.0 (MichaΓ«l Zasso) #53650 - [
1cc0b41f00
] - doc: include node.module_timer on available categories (Vinicius Lourenço) #53638 - [
d224e9eab5
] - doc: fix module customization hook examples (Elliot Goodrich) #53637 - [
2cf60964e6
] - doc: fix doc for correct usage with plan & TestContext (Emil Tayeb) #53615 - [
6df86ae056
] - doc: remove some news issues that are no longer (Michael Dawson) #53608 - [
42b9408f3e
] - doc: add issue for news from ambassadors (Michael Dawson) #53607 - [
2d1ff91953
] - doc: add esm example for os (Leonardo Peixoto) [#53604](https://github.co...
2024-07-08, Version 22.4.1 (Current), @RafaelGSS
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)
- CVE-2024-22018 - fs.lstat bypasses permission model (Low)
- CVE-2024-36137 - fs.fchown/fchmod bypasses permission model (Low)
- CVE-2024-37372 - Permission model improperly processes UNC paths (Low)
Commits
- [
110902ff5e
] - lib,esm: handle bypass network-import via data: (RafaelGSS) nodejs-private/node-private#522 - [
0a0de3d491
] - lib,permission: support fs.lstat (RafaelGSS) - [
93574335ff
] - lib,permission: disable fchmod/fchown when pm enabled (RafaelGSS) nodejs-private/node-private#584 - [
09899e6302
] - src: handle permissive extension on cmd check (RafaelGSS) nodejs-private/node-private#596 - [
5d9c811634
] - src,permission: fix UNC path resolution (RafaelGSS) nodejs-private/node-private#581
2024-07-08, Version 20.15.1 'Iron' (LTS), @RafaelGSS
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)
- CVE-2024-22018 - fs.lstat bypasses permission model (Low)
- CVE-2024-36137 - fs.fchown/fchmod bypasses permission model (Low)
- CVE-2024-37372 - Permission model improperly processes UNC paths (Low)
Commits
- [
60e184a6e4
] - lib,esm: handle bypass network-import via data: (RafaelGSS) nodejs-private/node-private#522 - [
025cbd6936
] - lib,permission: support fs.lstat (RafaelGSS) nodejs-private/node-private#486 - [
d38ea17341
] - lib,permission: disable fchmod/fchown when pm enabled (RafaelGSS) nodejs-private/node-private#584 - [
1ba624cd3b
] - src: handle permissive extension on cmd check (RafaelGSS) nodejs-private/node-private#596 - [
2524d00c3d
] - src,permission: fix UNC path resolution (RafaelGSS) nodejs-private/node-private#581 - [
484cb0f13c
] - src,permission: resolve path on fs_permission (Rafael Gonzaga) #52761
2024-07-08, Version 18.20.4 'Hydrogen' (LTS), @RafaelGSS
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)
Commits
- [
85abedf1ff
] - lib,esm: handle bypass network-import via data: (RafaelGSS) nodejs-private/node-private#522 - [
eccd63b865
] - src: handle permissive extension on cmd check (RafaelGSS) nodejs-private/node-private#596