Update dependency node to v22 #61
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
UI
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: alexandre/PaletteSwitcher#61
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "renovate/node-22.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
16
->22
^17.0.31
->^22.0.0
Release Notes
nodejs/node (node)
v22.11.0
: 2024-10-29, Version 22.11.0 'Jod' (LTS), @richardlauCompare Source
Notable Changes
This release marks the transition of Node.js 22.x into Long Term Support (LTS)
with the codename 'Jod'. The 22.x release line now moves into "Active LTS"
and will remain so until October 2025. After that time, it will move into
"Maintenance" until end of life in April 2027.
Other than updating metadata, such as the
process.release
object, to reflectthat the release is LTS, no further changes from Node.js 22.10.0 are included.
OpenSSL 3.x
Official binaries for Node.js 22.x currently include OpenSSL 3.0.x (more
specifically, the quictls OpenSSL fork).
OpenSSL 3.0.x is the currently designated long term support version that is
scheduled to be supported until 7th September 2026, which is within the expected
lifetime of Node.js 22.x. We are expecting upstream OpenSSL to announce a
successor long term support version prior to that date and since OpenSSL now
follows a semantic versioning-like versioning scheme we expect to be able to
update to the next long term supported version of OpenSSL during the lifetime of
Node.js 22.x.
v22.10.0
: 2024-10-16, Version 22.10.0 (Current), @aduh95Compare Source
Notable Changes
New
"module-sync"
exports conditionThis release introduces a
"module-sync"
exports condition that's enabled whenrequire(esm)
is enabled, so packages can supply a synchronous ES module to theNode.js module loader, no matter if it's being required or imported. This is
similar to the
"module"
condition that bundlers have been using to supportrequire(esm)
in Node.js, and allows dual-package authors to opt into ESM-firstonly on newer versions of Node.js that supports
require(esm)
to avoid thedual-package hazard.
Or if the package is only meant to be run on Node.js and wants to fallback to
CJS on older versions that don't have
require(esm)
:For package authors: this only serves as a feature-detection mechanism for
packages that wish to support both CJS and ESM users during the period when some
active Node.js LTS versions support
require(esm)
while some older ones don't.When all active Node.js LTS lines support
require(esm)
, packages can simplifytheir distributions by bumping the major version, dropping their CJS exports,
and removing the
module-sync
exports condition (with onlymain
ordefault
targetting the ESM exports). If the package needs to support both bundlers and
being run unbundled on Node.js during the transition period, use both
module-sync
andmodule
and point them to the same ESM file. If the packagealready doesn't want to support older versions of Node.js that doesn't support
require(esm)
, don't use this export condition.For bundlers/tools: they should avoid implementing this stop-gap condition.
Most existing bundlers implement the de-facto bundler standard
module
exports condition, and that should be enough to support users who want to bundle
ESM from CJS consumers. Users who want both bundlers and Node.js to recognize
the ESM exports can use both
module
/module-sync
conditions during thetransition period, and can drop
module-sync
+module
when they no longer needto support older versions of Node.js. If tools do want to support this
condition, it's recommended to make the resolution rules in the graph pointed by
this condition match the Node.js native ESM rules to avoid divergence.
We ended up implementing a condition with a different name instead of reusing
"module"
, because existing code in the ecosystem using the"module"
condition sometimes also expect the module resolution for these ESM files to
work in CJS style, which is supported by bundlers, but the native Node.js loader
has intentionally made ESM resolution different from CJS resolution (e.g.
forbidding
import './noext'
orimport './directory'
), so it would bebreaking to implement a
"module"
condition without implementing the forbiddenESM resolution rules. For now, this just implements a new condition as
semver-minor so it can be backported to older LTS.
Contributed by Joyee Cheung in #54648.
node --run
is now stableThis CLI flag runs a specified command from a
package.json
's"scripts"
object.For the following
package.json
:You can run
node --run test
and that would start the test suite.Contributed by Yagiz Nizipli in #53763.
Other notable changes
Commits
v22.9.0
: 2024-09-17, Version 22.9.0 (Current), @RafaelGSSCompare Source
New API to retrieve execution Stack Trace
A new API
getCallSite
has been introduced to theutil
module. This API allows usersto retrieve the stacktrace of the current execution. Example:
Thanks to Rafael Gonzaga for making this work on #54380.
Disable V8 Maglev
We have seen several crashes/unexpected JS behaviors with maglev on v22
(which ships V8 v12.4). The bugs lie in the codegen so it would be difficult for
users to work around them or even figure out where the bugs are coming from.
Some bugs are fixed in the upstream while some others probably remain.
As v22 will get stuck with V8 v12.4 as LTS, it will be increasingly difficult to
backport patches for them even if the bugs are fixed. So disable it by default
on v22 to reduce the churn and troubles for users.
Thanks to Joyee Cheung for making this work on #54384
Exposes X509_V_FLAG_PARTIAL_CHAIN to tls.createSecureContext
This releases introduces a new option to the API
tls.createSecureContext
. Fornow on users can use
tls.createSecureContext({ allowPartialTrustChain: true })
to treat intermediate (non-self-signed) certificates in the trust CA certificate
list as trusted.
Thanks to Anna Henningsen for making this work on #54790
Other Notable Changes
Deprecations
Commits
v22.8.0
: 2024-09-03, Version 22.8.0 (Current), @RafaelGSSCompare Source
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 globalobject 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:
--test-coverage-branches=<threshold>
--test-coverage-functions=<threshold>
--test-coverage-lines=<threshold>
<threshold>
should be an integer between 0 and 100. If an invalid value is provided, aTypeError
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:
Thanks Aviv Keller for working on this.
Other Notable Changes
Commits
v22.7.0
: 2024-08-22, Version 22.7.0 (Current), @RafaelGSSCompare Source
Experimental transform types support
With the new flag
--experimental-transform-types
it is possible to enable thetransformation of TypeScript-only syntax into JavaScript code.
This feature allows Node.js to support TypeScript syntax such as
Enum
andnamespace
.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 nowenabled by default. Use
--no-experimental-detect-module
to disable it ifneeded.
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 parentpackage.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"
tothe 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
andBuffer.write
methods. These are used throughoutthe 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
Commits
v22.6.0
: 2024-08-06, Version 22.6.0 (Current), @RafaelGSSCompare Source
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:
enums
ornamespaces
.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:
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.
http
andhttps
modules only.feature request on the Chrome DevTools side is addressed.
Thanks Kohei Ueno for working on this.
Other Notable Changes
Commits
v22.5.1
: 2024-07-19, Version 22.5.1 (Current), @richardlauCompare Source
Notable Changes
This release fixes a regression introduced in Node.js 22.5.0. The problem is known to display the following symptoms:
FATAL ERROR: v8::Object::GetCreationContextChecked No creation context available
#53902npm error Exit handler never called!
npm/cli#7657Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)
yarnpkg/berry#6398Commits
v22.5.0
: 2024-07-17, Version 22.5.0 (Current), @RafaelGSS prepared by @aduh95Compare Source
Notable Changes
Commits
v22.4.1
: 2024-07-08, Version 22.4.1 (Current), @RafaelGSSCompare Source
This is a security release.
Notable Changes
Commits
v22.4.0
: 2024-07-02, Version 22.4.0 (Current), @targosCompare Source
Notable Changes
Experimental Web Storage API
API stability updates
Other Notable Changes
Commits
v22.3.0
: 2024-06-11, Version 22.3.0 (Current), @RafaelGSSCompare Source
Notable Changes
Commits
v22.2.0
: 2024-05-15, Version 22.2.0 (Current), @targosCompare Source
Notable Changes
Commits
v22.1.0
: 2024-05-02, Version 22.1.0 (Current), @targos prepared by @aduh95Compare Source
module: implement
NODE_COMPILE_CACHE
for automatic on-disk code cachingThis patch implements automatic on-disk code caching that can be enabled
via an environment variable
NODE_COMPILE_CACHE=/path/to/cache/dir
.When set, whenever Node.js compiles a CommonJS or a ECMAScript Module,
it will use on-disk V8 code cache
persisted in the specified directory
to speed up the compilation. This may slow down the first load of a
module graph, but subsequent loads of the same module graph may get
a significant speedup if the contents of the modules do not change.
Locally, this speeds up loading of
test/fixtures/snapshot/typescript.js
from ~130ms to ~80ms.
To clean up the generated code cache, simply remove the directory.
It will be recreated the next time the same directory is used for
NODE_COMPILE_CACHE
.Compilation cache generated by one version of Node.js may not be used
by a different version of Node.js. Cache generated by different versions
of Node.js will be stored separately if the same directory is used
to persist the cache, so they can co-exist.
Caveat: currently when using this with V8 JavaScript code coverage, the
coverage being collected by V8 may be less precise in functions that are
deserialized from the code cache. It's recommended to turn this off when
running tests to generate precise coverage.
Contributed by Joyee Cheung in #52535.
Other Notable Changes
Commits
v22.0.0
: 2024-04-24, Version 22.0.0 (Current), @RafaelGSS and @marco-ippolitoCompare Source
We're excited to announce the release of Node.js 22!
Highlights include require()ing ESM graphs, WebSocket client, updates of the V8 JavaScript engine, and more!
As a reminder, Node.js 22 will enter long-term support (LTS) in October, but until then, it will be the "Current" release for the next six months.
We encourage you to explore the new features and benefits offered by this latest release and evaluate their potential impact on your applications.
Other Notable Changes
Semver-Major Commits
Semver-Minor Commits
Semver-Patch Commits
v20.18.0
: 2024-10-03, Version 20.18.0 'Iron' (LTS), @targosCompare Source
Notable Changes
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:
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.
http
andhttps
modules only.feature request on the Chrome DevTools side is addressed.
Contributed by Kohei Ueno in #53593 and #54246
Exposes X509_V_FLAG_PARTIAL_CHAIN to tls.createSecureContext
This releases introduces a new option to the API
tls.createSecureContext
. Fromnow on,
tls.createSecureContext({ allowPartialTrustChain: true })
can be usedto treat intermediate (non-self-signed) certificates in the trust CA certificate
list as trusted.
Contributed by Anna Henningsen in #54790
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 globalobject 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.
Contributed by Joyee Cheung in #54394
Deprecations
Other Notable Changes
Commits
v20.17.0
: 2024-08-21, Version 20.17.0 'Iron' (LTS), @marco-ippolitoCompare Source
module: support require()ing synchronous ESM graphs
This release adds
require()
support for synchronous ESM graphs underthe flag
--experimental-require-module
.If
--experimental-require-module
is enabled, and the ECMAScriptmodule being loaded by
require()
meets the following requirements:require()
will load the requested module as an ES Module, and returnthe module name space object. In this case it is similar to dynamic
import()
but is run synchronously and returns the name space objectdirectly.
Contributed by Joyee Cheung in #51977
path: add
matchesGlob
methodGlob 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: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
Commits
v20.16.0
: 2024-07-24, Version 20.16.0 'Iron' (LTS), @marco-ippolitoCompare Source
process: add process.getBuiltinModule(id)
process.getBuiltinModule(id)
provides a way to load built-in modulesin 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 orhaving to use dynamic
import()
which either turns the module intoan asynchronous module, or turns a synchronous API into an asynchronous one.
If
id
specifies a built-in module available in the current Node.js process,process.getBuiltinModule(id)
method returns the corresponding built-inmodule. If
id
does not correspond to any built-in module,undefined
is returned.
process.getBuiltinModule(id)
accepts built-in module IDs that are recognizedby
module.isBuiltin(id)
.The references returned by
process.getBuiltinModule(id)
always point tothe built-in module corresponding to
id
even if users modifyrequire.cache
so thatrequire(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 forhttps.request()
,tls.createSecureContext()
, andtls.createServer()
; theprivateKeyEngine
andprivateKeyIdentifier
fortls.createSecureContext();
andcrypto.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 receivingDebugger.setAsyncCallStackDepth
with depth 0.Contributed by Joyee Cheung in #53473
Other Notable Changes
Commits
v20.15.1
: 2024-07-08, Version 20.15.1 'Iron' (LTS), @RafaelGSSCompare Source
This is a security release.
Notable Changes
Commits
v20.15.0
: 2024-06-20, Version 20.15.0 'Iron' (LTS), @marco-ippolitoCompare Source
test_runner: support test plans
It is now possible to count the number of assertions and subtests that are expected to run within a test. If the number of assertions and subtests that run does not match the expected count, the test will fail.
Contributed by Colin Ihrig in #52860
inspector: introduce the
--inspect-wait
flagThis release introduces the
--inspect-wait
flag, which allows debugger to wait for attachement. This flag is useful when you want to debug the code from the beginning. Unlike--inspect-brk
, which breaks on the first line, this flag waits for debugger to be connected and then runs the code as soon as a session is established.Contributed by Kohei Ueno in #52734
zlib: expose zlib.crc32()
This release exposes the crc32() function from zlib to user-land.
It computes a 32-bit Cyclic Redundancy Check checksum of data. If
value is specified, it is used as the starting value of the checksum,
otherwise, 0 is used as the starting value.
The CRC algorithm is designed to compute checksums and to detect error
in data transmission. It's not suitable for cryptographic authentication.
Contributed by Joyee Cheung in #52692
cli: allow running wasm in limited vmem with --disable-wasm-trap-handler
By default, Node.js enables trap-handler-based WebAssembly bound
checks. As a result, V8 does not need to insert inline bound checks
int the code compiled from WebAssembly which may speedup WebAssembly
execution significantly, but this optimization requires allocating
a big virtual memory cage (currently 10GB). If the Node.js process
does not have access to a large enough virtual memory address space
due to system configurations or hardware limitations, users won't
be able to run any WebAssembly that involves allocation in this
virtual memory cage and will see an out-of-memory error.
--disable-wasm-trap-handler
disables this optimization so thatusers can at least run WebAssembly (with a less optimial performance)
when the virtual memory address space available to their Node.js
process is lower than what the V8 WebAssembly memory cage needs.
Contributed by Joyee Cheung in #52766
Other Notable Changes
Commits
v20.14.0
: 2024-05-28, Version 20.14.0 'Iron' (LTS), @marco-ippolitoCompare Source
Notable Changes
Commits
v20.13.1
: 2024-05-09, Version 20.13.1 'Iron' (LTS), @marco-ippolitoCompare Source
2024-05-09, Version 20.13.1 'Iron' (LTS), @marco-ippolito
Revert "tools: install npm PowerShell scripts on Windows"
Due to a regression in the npm installation on Windows, this commit reverts the change that installed npm PowerShell scripts on Windows.
Commits
v20.13.0
: 2024-05-07, Version 20.13.0 'Iron' (LTS), @marco-ippolitoCompare Source
2024-05-07, Version 20.13.0 'Iron' (LTS), @marco-ippolito
buffer: improve
base64
andbase64url
performanceThe performance of the
base64
andbase64url
encoding and decoding functions has been improved significantly.Contributed by Yagiz Nizipli in #52428
crypto: deprecate implicitly shortened GCM tags
This release, introduces a doc-only deprecation of using GCM authentication tags that are shorter than the cipher's block size, unless the user specified the
authTagLength
option.Contributed by Tobias Nießen in #52345
events,doc: mark CustomEvent as stable
From this release
CustomEvent
has been marked stable.Contributed by Daeyeon Jeong in #52618
fs: add stacktrace to fs/promises
Sync functions in fs throwed an error with a stacktrace which is helpful for debugging. But functions in fs/promises throwed an error without a stacktrace. This commit adds stacktraces by calling
Error.captureStacktrace
and re-throwing the error.Contributed by 翠 / green in #49849
report: add
--report-exclude-network
optionNew option
--report-exclude-network
, also available asreport.excludeNetwork
, enables the user to exclude networking interfaces in their diagnostic report. On some systems, this can cause the report to take minutes to generate so this option can be used to optimize that.Contributed by Ethan Arrowood in #51645
src: add uv_get_available_memory to report and process
From this release it is possible to get the available memory in the system by calling
process.getAvailableMemory()
.Contributed by theanarkh #52023
stream: support typed arrays
This commit adds support for typed arrays in streams.
Contributed by IlyasShabi #51866
util: support array of formats in util.styleText
It is now possible to pass an array of format strings to
util.styleText
to apply multiple formats to the same text.Contributed by Marco Ippolito in #52040
v8: implement v8.queryObjects() for memory leak regression testing
This is similar to the queryObjects() console API provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain in the heap after a full garbage collection, which can be useful for memory leak regression tests.
To avoid surprising results, users should avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the application.
To avoid accidental leaks, this API does not return raw references to the objects found. By default, it returns the count of the objects found. If options.format is 'summary', it returns an array containing brief string representations for each object. The visibility provided in this API is similar to what the heap snapshot provides, while users can save the cost of serialization and parsing and directly filer the target objects during the search.
We have been using this API internally for the test suite, which has been more stable than any other leak regression testing strategies in the CI. With a public implementation we can now use the public API instead.
Contributed by Joyee Cheung in #51927
watch: mark as stable
From this release Watch Mode is considered stable.
When in watch mode, changes in the watched files cause the Node.js process to restart.
Contributed by Moshe Atlow in #52074
Other Notable Changes
Commits
v20.12.2
: 2024-04-10, Version 20.12.2 'Iron' (LTS), @RafaelGSSCompare Source
This is a security release.
Notable Changes
child_process.spawn
without shell option enabled on WindowsCommits
v20.12.1
: 2024-04-03, Version 20.12.1 'Iron' (LTS), @RafaelGSSCompare Source
This is a security release
Notable Changes
Commits
v20.12.0
: 2024-03-26, Version 20.12.0 'Iron' (LTS), @richardlauCompare Source
Notable Changes
crypto: implement crypto.hash()
This patch introduces a helper crypto.hash() that computes
a digest from the input at one shot. This can be 1.2-2x faster
than the object-based createHash() for smaller inputs (<= 5MB)
that are readily available (not streamed) and incur less memory
overhead since no intermediate objects will be created.
Contributed by Joyee Cheung in #51044.
Loading and parsing environment variables
process.loadEnvFile(path)
:.env
file. If no path is specified, it automatically loads the .env file in the current directory. Example:process.loadEnvFile()
.process.loadEnvFile('./development.env')
.util.parseEnv(content)
:require('node:util').parseEnv('HELLO=world')
.Contributed by Yagiz Nizipli in #51476.
New connection attempt events
Three new events were added in the
net.createConnection
flow:connectionAttempt
: Emitted when a new connection attempt is established. In case of Happy Eyeballs, this might emitted multiple times.connectionAttemptFailed
: Emitted when a connection attempt failed. In case of Happy Eyeballs, this might emitted multiple times.connectionAttemptTimeout
: Emitted when a connection attempt timed out. In case of Happy Eyeballs, this will not be emitted for the last attempt. This is not emitted at all if Happy Eyeballs is not used.Additionally, a previous bug has been fixed where a new connection attempt could have been started after a previous one failed and after the connection was destroyed by the user.
This led to a failed assertion.
Contributed by Paolo Insogna in #51045.
Permission Model changes
Node.js 20.12.0 comes with several fixes for the experimental permission model and two new semver-minor commits.
We're adding a new flag
--allow-addons
to enable addon usage when using the Permission Model.Contributed by Rafael Gonzaga in #51183
And relative paths are now supported through the
--allow-fs-*
flags.Therefore, with this release one can use:
To give only read access to the entrypoint of the application.
Contributed by Rafael Gonzaga and Carlos Espa in #50758.
sea: support embedding assets
Users can now include assets by adding a key-path dictionary
to the configuration as the
assets
field. At build time, Node.jswould read the assets from the specified paths and bundle them into
the preparation blob. In the generated executable, users can retrieve
the assets using the
sea.getAsset()
andsea.getAssetAsBlob()
API.The single-executable application can access the assets as follows:
Contributed by Joyee Cheung in #50960.
Support configurable snapshot through
--build-snapshot-config
flagWe are adding a new flag
--build-snapshot-config
to configure snapshots through a custom JSON configuration file.When using this flag, additional script files provided on the command line will
not be executed and instead be interpreted as regular command line arguments.
These changes were contributed by Joyee Cheung and Anna Henningsen in #50453
Text Styling
util.styleText(format, text)
: This function returns a formatted text considering theformat
passed.A new API has been created to format text based on
util.inspect.colors
, enabling you to style text in different colors (such as red, blue, ...) and emphasis (italic, bold, ...).Contributed by Rafael Gonzaga in #51850.
vm: support using the default loader to handle dynamic import()
This patch adds support for using
vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
as theimportModuleDynamically
option in all vm APIs that take this option exceptvm.SourceTextModule
. This allows users to have a shortcut to support dynamicimport()
in the compiled code without missing the compilation cache if they don't need customization of the loading process. We emit an experimental warning when theimport()
is actually handled by the default loader through this option instead of requiring--experimental-vm-modules
.Contributed by Joyee Cheung in #51244.
Root certificates updated to NSS 3.98
Certificates added:
Certificates removed:
Updated dependencies
Other notable changes
Commits
v20.11.1
: 2024-02-14, Version 20.11.1 'Iron' (LTS), @RafaelGSS prepared by @marco-ippolitoCompare Source
Notable changes
This is a security release.
Notable changes
Commits
v20.11.0
: 2024-01-09, Version 20.11.0 'Iron' (LTS), @UlisesGasconCompare Source
Notable Changes
Commits
v20.10.0
: 2023-11-22, Version 20.10.0 'Iron' (LTS), @targosCompare Source
Notable Changes
--experimental-default-type
flag to flip module defaultsThe new flag
--experimental-default-type
can be used to flip the defaultmodule system used by Node.js. Input that is already explicitly defined as ES
modules or CommonJS, such as by a
package.json
"type"
field or.mjs
/.cjs
file extension or the
--input-type
flag, is unaffected. What is currentlyimplicitly CommonJS would instead be interpreted as ES modules under
--experimental-default-type=module
:String input provided via
--eval
or STDIN, if--input-type
is unspecified.Files ending in
.js
or with no extension, if there is nopackage.json
filepresent in the same folder or any parent folder.
Files ending in
.js
or with no extension, if the nearest parentpackage.json
field lacks atype
field; unless the folder is inside anode_modules
folder.In addition, extensionless files are interpreted as Wasm if
--experimental-wasm-modules
is passed and the file contains the "magic bytes"Wasm header.
Contributed by Geoffrey Booth in #49869.
Detect ESM syntax in ambiguous JavaScript
The new flag
--experimental-detect-module
can be used to automatically run ESmodules when their syntax can be detected. For “ambiguous” files, which are
.js
or extensionless files with nopackage.json
with atype
field, Node.jswill parse the file to detect ES module syntax; if found, it will run the file
as an ES module, otherwise it will run the file as a CommonJS module. The same
applies to string input via
--eval
orSTDIN
.We hope to make detection enabled by default in a future version of Node.js.
Detection increases startup time, so we encourage everyone—especially package
authors—to add a
type
field topackage.json
, even for the default"type": "commonjs"
. The presence of atype
field, or explicit extensionssuch as
.mjs
or.cjs
, will opt out of detection.Contributed by Geoffrey Booth in #50096.
New
flush
option in file system functionsWhen writing to files, it is possible that data is not immediately flushed to
permanent storage. This allows subsequent read operations to see stale data.
This PR adds a
'flush'
option to thefs.writeFile
family of functions whichforces the data to be flushed at the end of a successful write operation.
Contributed by Colin Ihrig in #50009 and #50095.
Experimental WebSocket client
Adds a
--experimental-websocket
flag that adds aWebSocket
global, as standardized by WHATWG.
Contributed by Matthew Aitken in #49830.
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 tovm.Script
, resulting in a performanceregression 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 thepresence of the
importModuleDynamically
option, so that users affected by theperformance regression can now upgrade. Ongoing work is also being done to
enable compilation cache support for
vm.CompileFunction
.Contributed by Joyee Cheung in #49950
and #50137.
Other notable changes
Commits
v20.9.0
: 2023-10-24, Version 20.9.0 'Iron' (LTS), @richardlauCompare Source
Notable Changes
This release marks the transition of Node.js 20.x into Long Term Support (LTS)
with the codename 'Iron'. The 20.x release line now moves into "Active LTS"
and will remain so until October 2024. After that time, it will move into
"Maintenance" until end of life in April 2026.
Known issue
Collecting code coverage via the
NODE_V8_COVERAGE
environment variable maylead to a hang. This is not thought to be a regression in Node.js 20 (some
reports are on Node.js 18). For more information, including some potential
workarounds, see issue #49344.
v20.8.1
: 2023-10-13, Version 20.8.1 (Current), @RafaelGSSCompare Source
This is a security release.
Notable Changes
The following CVEs are fixed in this release:
nghttp2
Security Release (High)undici
Security Release (High)More detailed information on each of the vulnerabilities can be found in October 2023 Security Releases blog post.
Commits
v20.8.0
: 2023-09-28, Version 20.8.0 (Current), @ruyadornoCompare Source
Notable Changes
Stream performance improvements
Performance improvements to writable and readable streams, improving the creation and destruction by ±15% and reducing the memory overhead each stream takes in Node.js
Contributed by Benjamin Gruenbaum in #49745 and Raz Luvaton in #49834.
Performance improvements for readable webstream, improving readable stream async iterator consumption by ±140% and improving readable stream
pipeTo
consumption by ±60%Contributed by Raz Luvaton in #49662 and #49690.
Rework of memory management in
vm
APIs with theimportModuleDynamically
optionThis rework addressed a series of long-standing memory leaks and use-after-free issues in the following APIs that support
importModuleDynamically
:vm.Script
vm.compileFunction
vm.SyntheticModule
vm.SourceTextModule
This should enable affected users (in particular Jest users) to upgrade from older versions of Node.js.
Contributed by Joyee Cheung in #48510.
Other notable changes
Commits
v20.7.0
: 2023-09-18, Version 20.7.0 (Current), @UlisesGasconCompare Source
Notable Changes
Commits
v20.6.1
: 2023-09-08, Version 20.6.1 (Current), @ruyadorno and @RafaelGSSCompare Source
Commit
v20.6.0
: 2023-09-04, Version 20.6.0 (Current), @juanarbol prepared by @UlisesGasconCompare Source
Notable changes
built-in
.env
file supportStarting from Node.js v20.6.0, Node.js supports
.env
files for configuring environment variables.Your configuration file should follow the INI file format, with each line containing a key-value pair for an environment variable.
To initialize your Node.js application with predefined configurations, use the following CLI command:
node --env-file=config.env index.js
.For example, you can access the following environment variable using
process.env.PASSWORD
when your application is initialized:In addition to environment variables, this change allows you to define your
NODE_OPTIONS
directly in the.env
file, eliminating the need to include it in yourpackage.json
.This feature was contributed by Yagiz Nizipli in #48890.
import.meta.resolve
unflaggedIn ES modules,
import.meta.resolve(specifier)
can be used to get an absolute URL string to whichspecifier
resolves, similar torequire.resolve
in CommonJS. This aligns Node.js with browsers and other server-side runtimes.This feature was contributed by Guy Bedford in #49028
New
node:module
APIregister
for module customization hooks; newinitialize
hookThere is a new API
register
available onnode:module
to specify a file that exports module customization hooks, and pass data to the hooks, and establish communication channels with them. The “define the file with the hooks” part was previously handled by a flag--experimental-loader
, but when the hooks moved into a dedicated thread in 20.0.0 there was a need to provide a way to communicate between the main (application) thread and the hooks thread. This can now be done by callingregister
from the main thread and passing data, includingMessageChannel
instances.We encourage users to migrate to an approach that uses
--import
withregister
, such as:Using
--import
ensures that the customization hooks are registered before any application code runs, even the entry point.This feature was contributed by Izaak Schroeder in #48842 and #48559
Module customization
load
hook can now support CommonJSAuthors of module customization hooks can how handle both ES module and CommonJS sources in the
load
hook. This works for CommonJS modules referenced via eitherimport
orrequire
, so long as the main entry point of the application is handled by the ES module loader (such as because the entry point is an ES module file, or if the--import
flag is passed). This should simplify the customization of the Node.js module loading process, as package authors can customize more of Node.js without relying on deprecated APIs such asrequire.extensions
.This feature was contributed by Antoine du Hamel in #47999
Node.js C++ addons now have experimental support for cppgc (Oilpan), a C++ garbage collection library in V8.
Now when Node.js starts up, it makes sure that there is a
v8::CppHeap
attached to the V8 isolate. This enables users to allocate in thev8::CppHeap
using<cppgc/*>
headers from V8, which are now also included into the Node.js headers available to addons. Note that since Node.js only bundles the cppgc library coming from V8, the ABI stability of cppgc is currently not guaranteed in semver-minor and -patch updates, but we do not expect the ABI to break often, as it has been stable and battle-tested in Chromium for years. We may consider including cppgc into the ABI stability guarantees when it gets enough adoption internally and externally.To help addon authors create JavaScript-to-C++ references of which V8's garbage collector can be aware, a helper function
node::SetCppgcReference(isolate, js_object, cppgc_object)
has been added tonode.h
. V8 may provide a native alternative in the future, which could then replace this Node.js-specific helper. In the mean time, users can use this API to avoid having to hard-code the layout of JavaScript wrapper objects. An example of how to create garbage-collected C++ objects in the unified heap and wrap it in a JavaScript object can be found in the Node.js addon tests.The existing
node::ObjectWrap
helper would continue to work, while cppgc-based object management serves as an alternative with some advantages mentioned in the V8 blog post about Oilpan.This feature was contributed by Daryl Haresign and Joyee Cheung in #48660 and #45704.
Other notable changes
Commits
v20.5.1
: 2023-08-09, Version 20.5.1 (Current), @RafaelGSSCompare Source
This is a security release.
Notable Changes
The following CVEs are fixed in this release:
More detailed information on each of the vulnerabilities can be found in August 2023 Security Releases blog post.
Commits
v20.5.0
: 2023-07-18, Version 20.5.0 (Current), @juanarbolCompare Source
Notable Changes
Commits
v20.4.0
: 2023-07-05, Version 20.4.0 (Current), @RafaelGSSCompare Source
Notable Changes
Mock Timers
The new feature allows developers to write more reliable and predictable tests for time-dependent functionality.
It includes
MockTimers
with the ability to mocksetTimeout
,setInterval
fromglobals
,node:timers
, andnode:timers/promises
.The feature provides a simple API to advance time, enable specific timers, and release all timers.
This feature was contributed by Erick Wendel in #47775.
Support to the explicit resource management proposal
Node is adding support to the explicit resource management
proposal to its resources allowing users of TypeScript/babel to use
using
/await using
withV8 support for everyone else on the way.
This feature was contributed by Moshe Atlow and Benjamin Gruenbaum in #48518.
Other notable changes
Commits
v20.3.1
: 2023-06-20, Version 20.3.1 (Current), @RafaelGSSCompare Source
This is a security release.
Notable Changes
The following CVEs are fixed in this release:
mainModule.__proto__
Bypass Experimental Policy Mechanism (High)More detailed information on each of the vulnerabilities can be found in June 2023 Security Releases blog post.
Commits
v20.3.0
: 2023-06-08, Version 20.3.0 (Current), @targosCompare Source
Notable Changes
Commits
v20.2.0
: 2023-05-16, Version 20.2.0 (Current), @targosCompare Source
Notable Changes
Commits
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR has been generated by Renovate Bot.
5f930c4d3a
tob92a1e8aa8
Checkout
From your project repository, check out a new branch and test the changes.