mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 22:31:35 +00:00

This patch adds the following API for tools to enable compile cache dynamically and query its status. - module.enableCompileCache(cacheDir) - module.getCompileCacheDir() In addition this adds a NODE_DISABLE_COMPILE_CACHE environment variable to disable the code cache enabled by the APIs as an escape hatch to avoid unexpected/undesired effects of the compile cache (e.g. less precise test coverage). When the module.enableCompileCache() method is invoked without a specified directory, Node.js will use the value of the NODE_COMPILE_CACHE environment variable if it's set, or defaults to `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. Therefore it's recommended for tools to call this method without specifying the directory to allow overrides. PR-URL: https://github.com/nodejs/node/pull/54501 Fixes: https://github.com/nodejs/node/issues/53639 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
20 lines
629 B
JavaScript
20 lines
629 B
JavaScript
'use strict';
|
|
|
|
const { findSourceMap } = require('internal/source_map/source_map_cache');
|
|
const { Module } = require('internal/modules/cjs/loader');
|
|
const { register } = require('internal/modules/esm/loader');
|
|
const { SourceMap } = require('internal/source_map/source_map');
|
|
const {
|
|
constants,
|
|
enableCompileCache,
|
|
getCompileCacheDir,
|
|
} = require('internal/modules/helpers');
|
|
|
|
Module.findSourceMap = findSourceMap;
|
|
Module.register = register;
|
|
Module.SourceMap = SourceMap;
|
|
Module.constants = constants;
|
|
Module.enableCompileCache = enableCompileCache;
|
|
Module.getCompileCacheDir = getCompileCacheDir;
|
|
module.exports = Module;
|