Link: medium.com/the-node-js…

We are happy to announce the official release of Node.js 16! Highlights include the V8 JS engine upgrade to 9.0, pre-built Apple Silicon binaries, and some additional stable apis.

You can download the latest version here, or run the NVM install 16 command using Node Version Manager on UNIX. The change log included in the Node.js blog can be found here.

Initially, Node.js 16 will replace Node.js 15 as our “current” release. According to the release schedule, Node.js 16 will be a “current” release for the next six months, followed by an upgrade to long-term support (LTS) in October 2021. Once upgraded to long-term support, it will be released under the codename “Gallium.”

A reminder — Node.js 12 will remain in long-term support until April 2022, and Node.js 14 will remain in long-term support until April 2023. Node.js 10 will be dead by the end of this month (April 2021). More details about our release plan or schedule can be found in the Node.js release workgroup repository.

V8 was upgraded to 9.0

As always, the new version of the V8 JavaScript engine brings performance tweaks and improvements, and keeps Node.js up to date with JavaScript language features. In Node.js V16.0.0, the V8 engine was upgraded from 8.6 in Node.js 15 to 9.0.

This update brings the ECMAScript RegExp Match index, which provides the start and end indexes for capturing strings. When the regular expression has the /d flag, the index array can be obtained by matching the.indices property of the object.

> const matchObj = /(Java)(Script)/d.exec('JavaScript');
undefined
> matchObj.indices
[ [ 0, 10 ], [ 0, 4 ], [ 4, 10 ], groups: undefined ]
> matchObj.indices[0]; // Match
[ 0, 10 ]
> matchObj.indices[1]; // First capture group
[ 0, 4 ]
> matchObj.indices[2]; // Second capture group
[ 4, 10 ]
Copy the code

For more new features and updates in V8, check out the V8 blog: v8.dev/.

The Timers Promise API is stable

The Timers Promises API provides another set of timer functions that return Promise objects that no longer require util.promisify().

import { setTimeout } from 'timers/promises';
async function run() {
  await setTimeout(5000);
  console.log('Hello, World! ');
}
run();
Copy the code

James Snell added this feature to Node.js V15.0.0 (github.com/nodejs/node…

Other features

The nature of our release schedule means that new features are released in the “current” release line approximately every two weeks. For this reason, many new additions have been made available in the recent Node.js 15 release, but are still relatively new to the runtime.

Some of the recently released features of Node.js 15 will also be available in Node.js 16, including:

  • Experimental implementation of the standard Web Crypto API
  • NPM 7 (node.js v16.0.0 NPM 7.10.0)
  • Node-API v8
  • Stable Source Map V3
  • Web platform ATOB (buffer.atob(data)) and btoa (buffer.btoa(data)) to be compatible with legacy Web platform apis

New compiler

Node.js provides pre-built binaries for several different platforms. For each major release, a minimum toolchain is evaluated and presented where appropriate.

Node.js V16.0.0 will be the first prebuilt binary to support Apple Silicon. The macOS installer (.pkg) will be released as a “FAT” (multi-architecture) binary, although we will provide separate tarballs for the Intel (Darwina-X64) and ARM (Darwina-ARM64) architectures.

Production versions of these binaries were made possible thanks to MacStadium, which provided the necessary hardware for the project.

On our Linux-based platform, the minimum version of GCC to build Node.js 16 will be GCC 8.3. Details about the supported toolchains and compilers are documented in Node.js build.md.

describe

A new major release is released, and this is when we introduce the new runtime obsolescence. The Node.js project is designed to minimize the damage to the ecosystem from any disruptive changes. The project uses a tool called CITGM (Canary in the Gold Mine) to test the impact of any disruptive changes (including deprecation) on a large number of popular ecosystem modules in order to provide additional insight before these changes are completed.

Notable deprecations in Node.js 16 include the runtime deprecation of process.binding() access to some core modules, such as process.binding(‘http_parser’).