netlify-cli
Version:
Netlify command line tool
24 lines • 1.7 kB
TypeScript
export declare let didEnableCompileCache: boolean;
/**
* This enables the Node.js compile cache (aka the V8 code cache or bytecode cache), if it is available and if we
* detect that we are not running in a CI environment.
*
* This feature is a performance optimization that allows the V8 JS engine to cache some (parse/compile) work from one
* execution on disk and reuse it on subsequent executions. There's a performance hit on the first (cold) run, but all
* subsequent (warm) runs get performance savings. As the CLI is generally run hundreds of times, it is worth a small
* overhead on the occasional cold run to shave tens to hundreds of milliseconds on several subsequent warm runs.
*
* Keep in mind that the cache is specific to a version of netlify-cli and a version of node.js and it is stored on the
* user's disk in a temp dir. If any of these changes or the temp dir is cleared, the next run is a cold run.
*
* The programmatic API to enable this (`enableCompileCache()`) was added in node 22.8.0, but we currently support
* >=18.14.0, hence the conditional below. (For completeness, note that support via the env var was added in 22.1.0.)
*
* The Netlify CLI is often used in CI workflows. In this context, we wouldn't want the overhead of the first run
* because we almost certainly would not get any benefits on "subsequent runs". Even if the user has configured caching
* of the CLI itself, there's no chance they've configured the V8 compile cache directory to be cached.
*
* @see https://nodejs.org/api/module.html#moduleenablecompilecachecachedir
*/
export declare const maybeEnableCompileCache: () => void;
//# sourceMappingURL=nodejs-compile-cache.d.ts.map