Node.js platform 23.0 released with initial support for TypeScript

The release of Node.js 23.0.0 has occurred, a platform for executing network applications in JavaScript. Node.js 23.0 is classified as an intermediate branch, which will be maintained for 7 months (until June 2025). In the coming days, stabilization of the Node.js 22 branch will be completed, which will gain LTS status on October 29 and will be supported until April 2027. Support for the previous LTS branches Node.js 20.x and 18.x will continue until April 2026 and 2025 respectively.

Key Improvements:

  • Experimental support for TypeScript, which allows explicit type definitions, has been added. Support is enabled using the options "--experimental-strip-types" and "--experimental-transform-types". With the first option, working with TypeScript reduces to cleaning type definitions specific to the language (type checking is not performed, the code is simply converted to a JavaScript format without types). The second option transforms some elements of TypeScript syntax, such as enums and namespaces, into JavaScript code.
  • By default, the ability to use the "require()" call to load ESM (ECMAScript Modules) JavaScript modules in synchronous mode is included. ESM modules are used in browsers and replace CommonJS modules, which are specific to Node.js. To load an ESM module via "require()", it must execute in synchronous mode (without await at the top level).
  • Automatic detection of ESM modules in files without an extension or with a ".js" extension has been ensured. Previously, such files were treated as CommonJS modules unless their type was explicitly specified in a package.json file located in the same directory ("type": "module"). In the new version, for files whose type is not designated in package.json, an attempt is first made to load them as CommonJS modules, and if that fails, as ESM modules.
  • An experimental implementation has been added compatible with browsers API Web Storage, intended for permanent (localStorage class) or temporary (sessionStorage class) data storage in key/value format. To enable Web Storage support, it is necessary to run with the flag "--experimental-webstorage" and specify the path to the storage file using the flag "--localstorage-file".
  • An experimental SQLite API has been added for working with databases using the SQL query language and storage based on the SQLite library. In addition to storing the database in a file on disk, it can also be placed in memory by specifying ":memory:" instead of a file name. The aforementioned Web Storage API has also been implemented on top of SQLite, which has led to the addition of SQLite as a dependency for Node.js.
  • The stable command "node --run" has been announced, designed for executing scripts defined in the package.json file.
  • Optional support for caching compiled code on disk has been implemented to significantly speed up module startup. Caching can be enabled through the environment variable NODE_COMPILE_CACHE. This feature is similar to the v8-compile-cache package but offers higher performance and support for ESM modules.
  • The Buffer object has been optimized, greatly increasing the performance of the Buffer.copy() and Buffer.write() methods.
  • The performance of the node:fs module has been improved, reducing the number of C++ code calls during operation.
  • The V8 engine has been updated to version 12.9, used in Chromium 129.
  • Support for 32-bit systems running Windows has been removed.
  • Due to the integration of features defined in the C++20 standard into Node.js and the V8 engine, the requirements for the GCC compiler version have been increased. Now, at least GCC version 12 is required to build Node.js.

The Node.js platform can be used for both server-side support of web applications and for creating standard client and server network applications. A large collection of modules has been prepared to extend the functionality of Node.js applications, where modules with implementations can be found. servers and clients for HTTP, SMTP, XMPP, DNS, FTP, IMAP, POP3, modules for integration with various web frameworks, WebSocket and Ajax handlers, connectors to databases (MySQL, PostgreSQL, SQLite, MongoDB), templating engines, CSS engines, implementations of cryptographic algorithms and authorization systems (OAuth), XML parsers.

To handle a large number of concurrent requests, Node.js employs an asynchronous code execution model based on event-driven, non-blocking I/O and the use of callback handlers. Connection multiplexing methods such as epoll, kqueue, /dev/poll, and select are supported. The libuv library, which acts as a wrapper around libev on Unix systems and IOCP on Windows, is used for connection multiplexing. A thread pool is created using the libeio library, and for non-blocking DNS queries, c-ares is integrated. All blocking system calls are executed within the thread pool and then return their results through an anonymous pipe, just like signal handlers.

JavaScript code execution is facilitated by the V8 engine developed by Google (Microsoft also develops a version of Node.js with the Chakra-Core engine). Essentially, Node.js is similar to the Perl AnyEvent, Ruby Event Machine, Python Twisted frameworks, and event implementations in Tcl, but the event loop in Node.js is abstracted away from the developer and resembles event handling in a web application running in a browser.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster