Latest Version of Node.js 22.0.0 Now Accessible on JavaScript Platform

Held release Node.js 22.0,platforms for running network applications in JavaScript. Node.js 22.0 attributed to branches with a long period of support, but this status will be assigned only in October, after stabilization. Node.js 22.x will be supported until April 30, 2027. Maintenance of the previous LTS branch of Node.js 20.x will last until April 2026, and the year before last LTS branch 18.x until April 2025. The staging branch of Node.js 21.x will be discontinued on June 1, 2024.

Basic improvements:

Advertisement

  • The V8 engine has been updated to version 12.4, used in Chromium 124. Among the changes compared to the Node.js 21 branch, which used the V8 11.8 engine), it is noted:
    • Extension support WasmGC, which simplifies the porting of programs written in programming languages ​​that use a garbage collector (Kotlin, PHP, Java, etc.) to WebAssembly. WasmGC adds new types of structures and arrays that can use non-linear memory allocation.
    • Method support Array.fromAsync()which asynchronously returns a new instance of the Array object copied from the objects resembling an arraylisted (iterable) or asynchronously enumerated (async iterable).
    • Support methods for working with iterators such as .map, .filter, .find, .take, .drop, .forEach and .reduce.
    • Support object Setwhich defines a collection of values ​​and offers methods that implement typical operations with sets, such as intersections, unions, difference, and addition.
  • The Maglev optimizing JIT compiler is enabled by default, aimed at quickly generating high-performance machine code for heavily used JavaScript code. Enabling Maglev can significantly speed up short-lived CLI applications that do not perform long-term operations, for example, the time to complete the Jetstrea test is reduced by 7.5%, and the Speedometer test by 5%.
  • Work with streams has been accelerated by increasing the value of the highWaterMark option from 16 KB to 65 KB (defines the limit up to which recording is buffered). The change results in increased memory consumption, so applications designed to run on limited RAM may need to revert to the old value via a call to setDefaultHighWaterMark().
  • Improved performance of the fetch() and test runner APIs by making AbortSignal instantiation more efficient. The performance of APIs related to synchronous work with file systems has been improved.
  • An experimental feature has been provided to use the “require()” call to load JavaScript ESM modules (ECMAScript Modules) in synchronous mode. ESM modules are used in browsers and replace CommonJS modules specific to Node.js. To load via “require()”, the ESM module must be executed in synchronous mode (without await at the top level). Support is enabled via the “–experimental-require-module” flag.
  • Added an experimental ability to run scripts defined in the package.json file using the “–run ‹script-in-package-json›” command.
  • The “node –watch” command has been moved to the stable category with the implementation of a watch mode that ensures that the process is restarted when the imported file changes (for example, if “node –watch index.js” is executed, the process will be automatically restarted when index.js changes).
  • Stabilized native API implementation WebSocketwhich allows you to use WebSocket in client mode without installing additional dependencies.
  • Added partial API support Navigator.
  • In API Webstreams added support for deflate-raw compression format.
  • Added glob and globSync functions to node:fsmodule for pattern matching of file paths.
  • Improved handling of incorrectly configured IPv6 stacks. Algorithm implemented Happy Eyeballs for quick rollback in case of problems with IPv6 operation.
  • The util API has been deprecated.
  • Updated dependency versions: npm 10.5.1, libuv 1.48.0, simdutf 5.2.3, c-ares 1.28.1, zlib 1.3.0.1-motley-24c07df, simdjson to 3.8.0, ada 2.7.7 and undici 6.6.0 .

The Node.js platform can be used both for server-side support of Web applications, and for creating ordinary client and server network programs. To expand the functionality of applications for Node.js, a large number of collection of modulesin which you can find modules with the implementation of servers and clients HTTP, SMTP, XMPP, DNS, FTP, IMAP, POP3, modules for integration with various web frameworks, WebSocket and Ajax handlers, connectors to DBMS (MySQL, PostgreSQL, SQLite, MongoDB ), template engines, CSS engines, implementations of cryptographic algorithms and authorization systems (OAuth), XML parsers.

To handle large numbers of parallel requests, Node.js uses an asynchronous code execution model based on non-blocking event processing and defining callback handlers. Supported methods for multiplexing connections include epoll, kqueue, /dev/poll, and select. The library is used to multiplex connections libuvwhich is a superstructure over libev on Unix systems and over IOCP on Windows. A library is used to create a thread pool libeiofor performing DNS queries in non-blocking mode is integrated c-ares. All system calls that cause blocking are executed within the thread pool and then, like signal handlers, pass the result of their work back through an unnamed pipe.

Execution of JavaScript code is ensured through the use of an engine developed by Google V8 (In addition, Microsoft is developing a version of Node.js with the Chakra-Core engine). At its core, Node.js is similar to frameworks Perl AnyEvent, Ruby Event Machine, Python Twisted And implementation events in Tcl, but the event loop in Node.js is hidden from the developer and resembles event handling in a web application running in a browser.

Thanks for reading:

Advertisement

Advertisement