Navigation
Recherche
|
Node.js adds built-in API for on-disk caching
mercredi 11 septembre 2024, 22:14 , par InfoWorld
Node.js 22.8.0, the latest release of the event-driven JavaScript runtime, adds a JavaScript API to enable on-disk caching of all modules loaded after the API is called, presenting a caching option for code.
The API is called module.enable.CompileCache(). It overrides the NODE_COMPILE_CACHE environment variable, which only end users could use to enable on-disk caching. The new API lets tool and library authors manage the caching of their own code. The solution is a built-in alternative to v8-compile-cache packages, offering better performance and support for ESM (ECMAScript Modules). Introduced on September 3, Node 22.8.0 can be downloaded from Nodejs.org. It is classified as a current release rather than an LTS (long-term support) release. With this update, Node now supports requiring code coverage to meet a specific threshold before a process successfully exits. Developers who want to use this capability must set the –experimental-test-coverage flag. Thresholds can be set for types of coverage including branch, function, and line coverages. Also in version 22.8.0, a flavor of vm.createContext() has been added to create a context without contextifying its global object when vm.constants.DONT_CONTEXTIFY is used. This is suitable when users want to freeze the context or speed up global access if they do not need the interceptor behavior. Node 22.8.0 follows the August 22 release of Node 22.7.0, which featured experimental transform types support. Node 22 itself was announced April 24, emphasizing ESM and an improved WebSocket client.
https://www.infoworld.com/article/3516346/node-js-adds-built-in-api-for-on-disk-caching.html
Voir aussi |
56 sources (32 en français)
Date Actuelle
sam. 16 nov. - 00:34 CET
|