* Enable on-disk compiled cache for all user modules being compiled in the current Node.js instance * after this method is called. * This method accepts either: * - A string: path to the cache directory. * - An options object `{directory?: string, portable?: boolean}`: * - `directory`: A stri
(options)
| 471 | * @returns {{status: number, message?: string, directory?: string}} |
| 472 | */ |
| 473 | function enableCompileCache(options) { |
| 474 | let portable; |
| 475 | let directory; |
| 476 | |
| 477 | if (typeof options === 'object' && options !== null) { |
| 478 | ({ directory, portable } = options); |
| 479 | } else { |
| 480 | directory = options; |
| 481 | } |
| 482 | if (directory === undefined) { |
| 483 | directory = process.env.NODE_COMPILE_CACHE || join(lazyTmpdir(), 'node-compile-cache'); |
| 484 | } |
| 485 | if (portable === undefined) { |
| 486 | portable = process.env.NODE_COMPILE_CACHE_PORTABLE === '1'; |
| 487 | } |
| 488 | const nativeResult = _enableCompileCache(directory, portable); |
| 489 | const result = { status: nativeResult[0] }; |
| 490 | if (nativeResult[1]) { |
| 491 | result.message = nativeResult[1]; |
| 492 | } |
| 493 | if (nativeResult[2]) { |
| 494 | result.directory = nativeResult[2]; |
| 495 | } |
| 496 | return result; |
| 497 | } |
| 498 | |
| 499 | const compileCacheStatus = { __proto__: null }; |
| 500 | for (let i = 0; i < _compileCacheStatus.length; ++i) { |
no test coverage detected
searching dependent graphs…