Path to this page:
Subject: CVS commit: pkgsrc/lang/nodejs18
From: Adam Ciarcinski
Date: 2024-01-11 10:42:46
Message id: 20240111094246.80516FA42@cvs.NetBSD.org
Log Message:
nodejs18: updated to 18.19.0
Version 18.19.0 'Hydrogen' (LTS)
Notable Changes
npm updated to v10
After two months of baking time in Node.js 20, npm 10 is backported, so that all \
release lines include a supported version of npm. This release includes npm \
v10.2.3.
ESM and customization hook changes
Leverage loaders when resolving subsequent loaders
Loaders now apply to subsequent loaders, for example: --experimental-loader \
ts-node --experimental-loader loader-written-in-typescript.
New node:module API register for module customization hooks; new initialize hook
There is a new API register available on node: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 calling register from the main thread and passing data, including \
MessageChannel instances.
We encourage users to migrate to an approach that uses --import with register, \
such as:
node --import ./file-that-calls-register.js ./app.js
Using --import ensures that the customization hooks are registered before any \
application code runs, even the entry point.
import.meta.resolve unflagged
In ES modules, import.meta.resolve(specifier) can be used to get an absolute URL \
string to which specifier resolves, similar to require.resolve in CommonJS. This \
aligns Node.js with browsers and other server-side runtimes.
--experimental-default-type flag to flip module defaults
The new flag --experimental-default-type can be used to flip the default module \
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 currently implicitly \
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 no package.json file \
present in the same folder or any parent folder.
Files ending in .js or with no extension, if the nearest parent package.json \
field lacks a type field; unless the folder is inside a node_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.
Files: