| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4a664b5 commit 4baf463
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2868,25 +2868,8 @@ added: v22.1.0 | |||
| 2868 | 2868 | ||
| 2869 | 2869 | > Stability: 1.1 - Active Development | |
| 2870 | 2870 | ||
| 2871 | - When set, whenever Node.js compiles a CommonJS or a ECMAScript Module, | ||
| 2872 | - it will use on-disk [V8 code cache][] persisted in the specified directory | ||
| 2873 | - to speed up the compilation. This may slow down the first load of a | ||
| 2874 | - module graph, but subsequent loads of the same module graph may get | ||
| 2875 | - a significant speedup if the contents of the modules do not change. | ||
| 2876 | - | ||
| 2877 | - To clean up the generated code cache, simply remove the directory. | ||
| 2878 | - It will be recreated the next time the same directory is used for | ||
| 2879 | - `NODE_COMPILE_CACHE`. | ||
| 2880 | - | ||
| 2881 | - Compilation cache generated by one version of Node.js may not be used | ||
| 2882 | - by a different version of Node.js. Cache generated by different versions | ||
| 2883 | - of Node.js will be stored separately if the same directory is used | ||
| 2884 | - to persist the cache, so they can co-exist. | ||
| 2885 | - | ||
| 2886 | - Caveat: currently when using this with [V8 JavaScript code coverage][], the | ||
| 2887 | - coverage being collected by V8 may be less precise in functions that are | ||
| 2888 | - deserialized from the code cache. It's recommended to turn this off when | ||
| 2889 | - running tests to generate precise coverage. | ||
| 2871 | + Enable the [module compile cache][] for the Node.js instance. See the documentation of | ||
| 2872 | + [module compile cache][] for details. | ||
| 2890 | 2873 | ||
| 2891 | 2874 | ### `NODE_DEBUG=module[,…]` | |
| 2892 | 2875 | ||
@@ -2908,6 +2891,17 @@ added: v0.3.0 | |||
| 2908 | 2891 | ||
| 2909 | 2892 | When set, colors will not be used in the REPL. | |
| 2910 | 2893 | ||
| 2894 | + ### `NODE_DISABLE_COMPILE_CACHE=1` | ||
| 2895 | + | ||
| 2896 | + <!-- YAML | ||
| 2897 | + added: REPLACEME | ||
| 2898 | + --> | ||
| 2899 | + | ||
| 2900 | + > Stability: 1.1 - Active Development | ||
| 2901 | + | ||
| 2902 | + Disable the [module compile cache][] for the Node.js instance. See the documentation of | ||
| 2903 | + [module compile cache][] for details. | ||
| 2904 | + | ||
| 2911 | 2905 | ### `NODE_EXTRA_CA_CERTS=file` | |
| 2912 | 2906 | ||
| 2913 | 2907 | <!-- YAML | |
@@ -3559,7 +3553,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | |||
| 3559 | 3553 | [TypeScript type-stripping]: typescript.md#type-stripping | |
| 3560 | 3554 | [V8 Inspector integration for Node.js]: debugger.md#v8-inspector-integration-for-nodejs | |
| 3561 | 3555 | [V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html | |
| 3562 | - [V8 code cache]: https://v8.dev/blog/code-caching-for-devs | ||
| 3563 | 3556 | [Web Crypto API]: webcrypto.md | |
| 3564 | 3557 | [`"type"`]: packages.md#type | |
| 3565 | 3558 | [`--allow-child-process`]: #--allow-child-process | |
@@ -3616,6 +3609,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | |||
| 3616 | 3609 | [filtering tests by name]: test.md#filtering-tests-by-name | |
| 3617 | 3610 | [jitless]: https://v8.dev/blog/jitless | |
| 3618 | 3611 | [libuv threadpool documentation]: https://docs.libuv.org/en/latest/threadpool.html | |
| 3612 | + [module compile cache]: module.md#module-compile-cache | ||
| 3619 | 3613 | [remote code execution]: https://www.owasp.org/index.php/Code_Injection | |
| 3620 | 3614 | [running tests from the command line]: test.md#running-tests-from-the-command-line | |
| 3621 | 3615 | [scavenge garbage collector]: https://v8.dev/blog/orinoco-parallel-scavenger | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,152 @@ const require = createRequire(import.meta.url); | |||
| 64 | 64 | const siblingModule = require('./sibling-module'); | |
| 65 | 65 | ``` | |
| 66 | 66 | ||
| 67 | + ### `module.constants.compileCacheStatus` | ||
| 68 | + | ||
| 69 | + <!-- YAML | ||
| 70 | + added: REPLACEME | ||
| 71 | + --> | ||
| 72 | + | ||
| 73 | + > Stability: 1.1 - Active Development | ||
| 74 | + | ||
| 75 | + The following constants are returned as the `status` field in the object returned by | ||
| 76 | + [`module.enableCompileCache()`][] to indicate the result of the attempt to enable the | ||
| 77 | + [module compile cache][]. | ||
| 78 | + | ||
| 79 | + <table> | ||
| 80 | + <tr> | ||
| 81 | + <th>Constant</th> | ||
| 82 | + <th>Description</th> | ||
| 83 | + </tr> | ||
| 84 | + <tr> | ||
| 85 | + <td><code>ENABLED</code></td> | ||
| 86 | + <td> | ||
| 87 | + Node.js has enabled the compile cache successfully. The directory used to store the | ||
| 88 | + compile cache will be returned in the <code>directory</code> field in the | ||
| 89 | + returned object. | ||
| 90 | + </td> | ||
| 91 | + </tr> | ||
| 92 | + <tr> | ||
| 93 | + <td><code>ALREADY_ENABLED</code></td> | ||
| 94 | + <td> | ||
| 95 | + The compile cache has already been enabled before, either by a previous call to | ||
| 96 | + <code>module.enableCompileCache()</code>, or by the <code>NODE_COMPILE_CACHE=dir</code> | ||
| 97 | + environment variable. The directory used to store the | ||
| 98 | + compile cache will be returned in the <code>directory</code> field in the | ||
| 99 | + returned object. | ||
| 100 | + </td> | ||
| 101 | + </tr> | ||
| 102 | + <tr> | ||
| 103 | + <td><code>FAILED</code></td> | ||
| 104 | + <td> | ||
| 105 | + Node.js fails to enable the compile cache. This can be caused by the lack of | ||
| 106 | + permission to use the specified directory, or various kinds of file system errors. | ||
| 107 | + The detail of the failure will be returned in the <code>message</code> field in the | ||
| 108 | + returned object. | ||
| 109 | + </td> | ||
| 110 | + </tr> | ||
| 111 | + <tr> | ||
| 112 | + <td><code>DISABLED</code></td> | ||
| 113 | + <td> | ||
| 114 | + Node.js cannot enable the compile cache because the environment variable | ||
| 115 | + <code>NODE_DISABLE_COMPILE_CACHE=1</code> has been set. | ||
| 116 | + </td> | ||
| 117 | + </tr> | ||
| 118 | + </table> | ||
| 119 | + | ||
| 120 | + ### `module.enableCompileCache([cacheDir])` | ||
| 121 | + | ||
| 122 | + <!-- YAML | ||
| 123 | + added: REPLACEME | ||
| 124 | + --> | ||
| 125 | + | ||
| 126 | + > Stability: 1.1 - Active Development | ||
| 127 | + | ||
| 128 | + * `cacheDir` {string|undefined} Optional path to specify the directory where the compile cache | ||
| 129 | + will be stored/retrieved. | ||
| 130 | + * Returns: {Object} | ||
| 131 | + * `status` {integer} One of the [`module.constants.compileCacheStatus`][] | ||
| 132 | + * `message` {string|undefined} If Node.js cannot enable the compile cache, this contains | ||
| 133 | + the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`. | ||
| 134 | + * `directory` {string|undefined} If the compile cache is enabled, this contains the directory | ||
| 135 | + where the compile cache is stored. Only set if `status` is | ||
| 136 | + `module.constants.compileCacheStatus.ENABLED` or | ||
| 137 | + `module.constants.compileCacheStatus.ALREADY_ENABLED`. | ||
| 138 | + | ||
| 139 | + Enable [module compile cache][] in the current Node.js instance. | ||
| 140 | + | ||
| 141 | + If `cacheDir` is not specified, Node.js will either use the directory specified by the | ||
| 142 | + [`NODE_COMPILE_CACHE=dir`][] environment variable if it's set, or use | ||
| 143 | + `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's | ||
| 144 | + recommended to call `module.enableCompileCache()` without specifying the `cacheDir`, | ||
| 145 | + so that the directory can be overriden by the `NODE_COMPILE_CACHE` environment | ||
| 146 | + variable when necessary. | ||
| 147 | + | ||
| 148 | + Since compile cache is supposed to be a quiet optimization that is not required for the | ||
| 149 | + application to be functional, this method is designed to not throw any exception when the | ||
| 150 | + compile cache cannot be enabled. Instead, it will return an object containing an error | ||
| 151 | + message in the `message` field to aid debugging. | ||
| 152 | + If compile cache is enabled successefully, the `directory` field in the returned object | ||
| 153 | + contains the path to the directory where the compile cache is stored. The `status` | ||
| 154 | + field in the returned object would be one of the `module.constants.compileCacheStatus` | ||
| 155 | + values to indicate the result of the attempt to enable the [module compile cache][]. | ||
| 156 | + | ||
| 157 | + This method only affects the current Node.js instance. To enable it in child worker threads, | ||
| 158 | + either call this method in child worker threads too, or set the | ||
| 159 | + `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can | ||
| 160 | + be inheritend into the child workers. The directory can be obtained either from the | ||
| 161 | + `directory` field returned by this method, or with [`module.getCompileCacheDir()`][]. | ||
| 162 | + | ||
| 163 | + #### Module compile cache | ||
| 164 | + | ||
| 165 | + <!-- YAML | ||
| 166 | + added: v22.1.0 | ||
| 167 | + changes: | ||
| 168 | + - version: REPLACEME | ||
| 169 | + pr-url: https://github.com/nodejs/node/pull/54501 | ||
| 170 | + description: add initial JavaScript APIs for runtime access. | ||
| 171 | + --> | ||
| 172 | + | ||
| 173 | + The module compile cache can be enabled either using the [`module.enableCompileCache()`][] | ||
| 174 | + method or the [`NODE_COMPILE_CACHE=dir`][] environemnt variable. After it's enabled, | ||
| 175 | + whenever Node.js compiles a CommonJS or a ECMAScript Module, it will use on-disk | ||
| 176 | + [V8 code cache][] persisted in the specified directory to speed up the compilation. | ||
| 177 | + This may slow down the first load of a module graph, but subsequent loads of the same module | ||
| 178 | + graph may get a significant speedup if the contents of the modules do not change. | ||
| 179 | + | ||
| 180 | + To clean up the generated compile cache on disk, simply remove the cache directory. The cache | ||
| 181 | + directory will be recreated the next time the same directory is used for for compile cache | ||
| 182 | + storage. To avoid filling up the disk with stale cache, it is recommended to use a directory | ||
| 183 | + under the [`os.tmpdir()`][]. If the compile cache is enabled by a call to | ||
| 184 | + [`module.enableCompileCache()`][] without specifying the directory, Node.js will use | ||
| 185 | + the [`NODE_DISABLE_COMPILE_CACHE=1`][] environment variable if it's set, or defaults | ||
| 186 | + to `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. To locate the compile cache | ||
| 187 | + directory used by a running Node.js instance, use [`module.getCompileCacheDir()`][]. | ||
| 188 | + | ||
| 189 | + Currently when using the compile cache with [V8 JavaScript code coverage][], the | ||
| 190 | + coverage being collected by V8 may be less precise in functions that are | ||
| 191 | + deserialized from the code cache. It's recommended to turn this off when | ||
| 192 | + running tests to generate precise coverage. | ||
| 193 | + | ||
| 194 | + The enabled module compile cache can be disabled by the [`NODE_DISABLE_COMPILE_CACHE=1`][] | ||
| 195 | + environment variable. This can be useful when the compile cache leads to unexpected or | ||
| 196 | + undesired behaviors (e.g. less precise test coverage). | ||
| 197 | + | ||
| 198 | + Compilation cache generated by one version of Node.js can not be reused by a different | ||
| 199 | + version of Node.js. Cache generated by different versions of Node.js will be stored | ||
| 200 | + separately if the same base directory is used to persist the cache, so they can co-exist. | ||
| 201 | + | ||
| 202 | + ### `module.getCompileCacheDir()` | ||
| 203 | + | ||
| 204 | + <!-- YAML | ||
| 205 | + added: REPLACEME | ||
| 206 | + --> | ||
| 207 | + | ||
| 208 | + > Stability: 1.1 - Active Development | ||
| 209 | + | ||
| 210 | + * Returns: {string|undefined} Path to the [module compile cache][] directory if it is enabled, | ||
| 211 | + or `undefined` otherwise. | ||
| 212 | + | ||
| 67 | 213 | ### `module.isBuiltin(moduleName)` | |
| 68 | 214 | ||
| 69 | 215 | <!-- YAML | |
@@ -1055,22 +1201,31 @@ returned object contains the following keys: | |||
| 1055 | 1201 | [Customization hooks]: #customization-hooks | |
| 1056 | 1202 | [ES Modules]: esm.md | |
| 1057 | 1203 | [Source map v3 format]: https://sourcemaps.info/spec.html#h.mofvlxcwqzej | |
| 1204 | + [V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html | ||
| 1205 | + [V8 code cache]: https://v8.dev/blog/code-caching-for-devs | ||
| 1058 | 1206 | [`"exports"`]: packages.md#exports | |
| 1059 | 1207 | [`--enable-source-maps`]: cli.md#--enable-source-maps | |
| 1060 | 1208 | [`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | |
| 1209 | + [`NODE_COMPILE_CACHE=dir`]: cli.md#node_compile_cachedir | ||
| 1210 | + [`NODE_DISABLE_COMPILE_CACHE=1`]: cli.md#node_disable_compile_cache1 | ||
| 1061 | 1211 | [`NODE_V8_COVERAGE=dir`]: cli.md#node_v8_coveragedir | |
| 1062 | 1212 | [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer | |
| 1063 | 1213 | [`SourceMap`]: #class-modulesourcemap | |
| 1064 | 1214 | [`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | |
| 1065 | 1215 | [`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array | |
| 1066 | 1216 | [`initialize`]: #initialize | |
| 1067 | - [`module`]: modules.md#the-module-object | ||
| 1217 | + [`module.constants.compileCacheStatus`]: #moduleconstantscompilecachestatus | ||
| 1218 | + [`module.enableCompileCache()`]: #moduleenablecompilecachecachedir | ||
| 1219 | + [`module.getCompileCacheDir()`]: #modulegetcompilecachedir | ||
| 1220 | + [`module`]: #the-module-object | ||
| 1221 | + [`os.tmpdir()`]: os.md#ostmpdir | ||
| 1068 | 1222 | [`register`]: #moduleregisterspecifier-parenturl-options | |
| 1069 | 1223 | [`string`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String | |
| 1070 | 1224 | [`util.TextDecoder`]: util.md#class-utiltextdecoder | |
| 1071 | 1225 | [chain]: #chaining | |
| 1072 | 1226 | [hooks]: #customization-hooks | |
| 1073 | 1227 | [load hook]: #loadurl-context-nextload | |
| 1228 | + [module compile cache]: #module-compile-cache | ||
| 1074 | 1229 | [module wrapper]: modules.md#the-module-wrapper | |
| 1075 | 1230 | [prefix-only modules]: modules.md#built-in-modules-with-mandatory-node-prefix | |
| 1076 | 1231 | [realm]: https://tc39.es/ecma262/#realm | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ const { | |||
| 4 | 4 | ArrayPrototypeForEach, | |
| 5 | 5 | ArrayPrototypeIncludes, | |
| 6 | 6 | ObjectDefineProperty, | |
| 7 | + ObjectFreeze, | ||
| 7 | 8 | ObjectPrototypeHasOwnProperty, | |
| 8 | 9 | SafeMap, | |
| 9 | 10 | SafeSet, | |
@@ -27,10 +28,18 @@ const assert = require('internal/assert'); | |||
| 27 | 28 | ||
| 28 | 29 | const { Buffer } = require('buffer'); | |
| 29 | 30 | const { getOptionValue } = require('internal/options'); | |
| 30 | - const { setOwnProperty } = require('internal/util'); | ||
| 31 | + const { setOwnProperty, getLazy } = require('internal/util'); | ||
| 31 | 32 | const { inspect } = require('internal/util/inspect'); | |
| 32 | 33 | ||
| 34 | + const lazyTmpdir = getLazy(() => require('os').tmpdir()); | ||
| 35 | + const { join } = path; | ||
| 36 | + | ||
| 33 | 37 | const { canParse: URLCanParse } = internalBinding('url'); | |
| 38 | + const { | ||
| 39 | + enableCompileCache: _enableCompileCache, | ||
| 40 | + getCompileCacheDir: _getCompileCacheDir, | ||
| 41 | + compileCacheStatus: _compileCacheStatus, | ||
| 42 | + } = internalBinding('modules'); | ||
| 34 | 43 | ||
| 35 | 44 | let debug = require('internal/util/debuglog').debuglog('module', (fn) => { | |
| 36 | 45 | debug = fn; | |
@@ -380,10 +389,53 @@ function isUnderNodeModules(filename) { | |||
| 380 | 389 | return ArrayPrototypeIncludes(splitPath, 'node_modules'); | |
| 381 | 390 | } | |
| 382 | 391 | ||
| 392 | + /** | ||
| 393 | + * Enable on-disk compiled cache for all user modules being complied in the current Node.js instance | ||
| 394 | + * after this method is called. | ||
| 395 | + * If cacheDir is undefined, defaults to the NODE_MODULE_CACHE environment variable. | ||
| 396 | + * If NODE_MODULE_CACHE isn't set, default to path.join(os.tmpdir(), 'node-compile-cache'). | ||
| 397 | + * @param {string|undefined} cacheDir | ||
| 398 | + * @returns {{status: number, message?: string, directory?: string}} | ||
| 399 | + */ | ||
| 400 | + function enableCompileCache(cacheDir) { | ||
| 401 | + if (cacheDir === undefined) { | ||
| 402 | + cacheDir = join(lazyTmpdir(), 'node-compile-cache'); | ||
| 403 | + } | ||
| 404 | + const nativeResult = _enableCompileCache(cacheDir); | ||
| 405 | + const result = { status: nativeResult[0] }; | ||
| 406 | + if (nativeResult[1]) { | ||
| 407 | + result.message = nativeResult[1]; | ||
| 408 | + } | ||
| 409 | + if (nativeResult[2]) { | ||
| 410 | + result.directory = nativeResult[2]; | ||
| 411 | + } | ||
| 412 | + return result; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + const compileCacheStatus = { __proto__: null }; | ||
| 416 | + for (let i = 0; i < _compileCacheStatus.length; ++i) { | ||
| 417 | + compileCacheStatus[_compileCacheStatus[i]] = i; | ||
| 418 | + } | ||
| 419 | + ObjectFreeze(compileCacheStatus); | ||
| 420 | + const constants = { __proto__: null, compileCacheStatus }; | ||
| 421 | + ObjectFreeze(constants); | ||
| 422 | + | ||
| 423 | + /** | ||
| 424 | + * Get the compile cache directory if on-disk compile cache is enabled. | ||
| 425 | + * @returns {string|undefined} Path to the module compile cache directory if it is enabled, | ||
| 426 | + * or undefined otherwise. | ||
| 427 | + */ | ||
| 428 | + function getCompileCacheDir() { | ||
| 429 | + return _getCompileCacheDir() || undefined; | ||
| 430 | + } | ||
| 431 | + | ||
| 383 | 432 | module.exports = { | |
| 384 | 433 | addBuiltinLibsToObject, | |
| 434 | + constants, | ||
| 435 | + enableCompileCache, | ||
| 385 | 436 | getBuiltinModule, | |
| 386 | 437 | getCjsConditions, | |
| 438 | + getCompileCacheDir, | ||
| 387 | 439 | initializeCjsConditions, | |
| 388 | 440 | isUnderNodeModules, | |
| 389 | 441 | loadBuiltinModule, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,8 +4,16 @@ const { findSourceMap } = require('internal/source_map/source_map_cache'); | |||
| 4 | 4 | const { Module } = require('internal/modules/cjs/loader'); | |
| 5 | 5 | const { register } = require('internal/modules/esm/loader'); | |
| 6 | 6 | const { SourceMap } = require('internal/source_map/source_map'); | |
| 7 | + const { | ||
| 8 | + constants, | ||
| 9 | + enableCompileCache, | ||
| 10 | + getCompileCacheDir, | ||
| 11 | + } = require('internal/modules/helpers'); | ||
| 7 | 12 | ||
| 8 | 13 | Module.findSourceMap = findSourceMap; | |
| 9 | 14 | Module.register = register; | |
| 10 | 15 | Module.SourceMap = SourceMap; | |
| 16 | + Module.constants = constants; | ||
| 17 | + Module.enableCompileCache = enableCompileCache; | ||
| 18 | + Module.getCompileCacheDir = getCompileCacheDir; | ||
| 11 | 19 | module.exports = Module; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -381,7 +381,7 @@ CompileCacheEnableResult CompileCacheHandler::Enable(Environment* env, | |||
| 381 | 381 | cache_dir_with_tag_str))) { | |
| 382 | 382 | result.message = "Skipping compile cache because write permission for " + | |
| 383 | 383 | cache_dir_with_tag_str + " is not granted"; | |
| 384 | - result.status = CompileCacheEnableStatus::kFailed; | ||
| 384 | + result.status = CompileCacheEnableStatus::FAILED; | ||
| 385 | 385 | return result; | |
| 386 | 386 | } | |
| 387 | 387 | ||
@@ -391,7 +391,7 @@ CompileCacheEnableResult CompileCacheHandler::Enable(Environment* env, | |||
| 391 | 391 | cache_dir_with_tag_str))) { | |
| 392 | 392 | result.message = "Skipping compile cache because read permission for " + | |
| 393 | 393 | cache_dir_with_tag_str + " is not granted"; | |
| 394 | - result.status = CompileCacheEnableStatus::kFailed; | ||
| 394 | + result.status = CompileCacheEnableStatus::FAILED; | ||
| 395 | 395 | return result; | |
| 396 | 396 | } | |
| 397 | 397 | ||
@@ -406,14 +406,14 @@ CompileCacheEnableResult CompileCacheHandler::Enable(Environment* env, | |||
| 406 | 406 | if (err != 0 && err != UV_EEXIST) { | |
| 407 | 407 | result.message = | |
| 408 | 408 | "Cannot create cache directory: " + std::string(uv_strerror(err)); | |
| 409 | - result.status = CompileCacheEnableStatus::kFailed; | ||
| 409 | + result.status = CompileCacheEnableStatus::FAILED; | ||
| 410 | 410 | return result; | |
| 411 | 411 | } | |
| 412 | 412 | ||
| 413 | 413 | compile_cache_dir_str_ = absolute_cache_dir_base; | |
| 414 | 414 | result.cache_directory = absolute_cache_dir_base; | |
| 415 | 415 | compile_cache_dir_ = cache_dir_with_tag; | |
| 416 | - result.status = CompileCacheEnableStatus::kEnabled; | ||
| 416 | + result.status = CompileCacheEnableStatus::ENABLED; | ||
| 417 | 417 | return result; | |
| 418 | 418 | } | |
| 419 | 419 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,10 @@ struct CompileCacheEntry { | |||
| 36 | 36 | }; | |
| 37 | 37 | ||
| 38 | 38 | #define COMPILE_CACHE_STATUS(V) \ | |
| 39 | - V(kFailed) /* Failed to enable the cache */ \ | ||
| 40 | - V(kEnabled) /* Was not enabled before, and now enabled. */ \ | ||
| 41 | - V(kAlreadyEnabled) /* Was already enabled. */ | ||
| 39 | + V(FAILED) /* Failed to enable the cache */ \ | ||
| 40 | + V(ENABLED) /* Was not enabled before, and now enabled. */ \ | ||
| 41 | + V(ALREADY_ENABLED) /* Was already enabled. */ \ | ||
| 42 | + V(DISABLED) /* Has been disabled by NODE_DISABLE_COMPILE_CACHE. */ | ||
| 42 | 43 | ||
| 43 | 44 | enum class CompileCacheEnableStatus : uint8_t { | |
| 44 | 45 | #define V(status) status, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments