Skip to content
Prev Previous commit
Next Next commit
fixup! fixup! src: add JS APIs for compile cache and NODE_DISABLE_COM…
…PILE_CACHE
  • Loading branch information
joyeecheung committed Aug 23, 2024
commit 3bd39dd1e2e3afe5404c0c10c52253b5b03436aa
7 changes: 4 additions & 3 deletions lib/internal/modules/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ const assert = require('internal/assert');

const { Buffer } = require('buffer');
const { getOptionValue } = require('internal/options');
const { setOwnProperty } = require('internal/util');
const { setOwnProperty, getLazy } = require('internal/util');
const { inspect } = require('internal/util/inspect');
const { tmpdir } = require('os');

const lazyTmpdir = getLazy(() => require('os').tmpdir());
const { join } = path;

const { canParse: URLCanParse } = internalBinding('url');
Expand Down Expand Up @@ -453,7 +454,7 @@ function stringify(body) {
*/
function enableCompileCache(cacheDir) {
if (cacheDir === undefined) {
cacheDir = join(tmpdir(), 'node-compile-cache');
cacheDir = join(lazyTmpdir(), 'node-compile-cache');
}
const nativeResult = _enableCompileCache(cacheDir);
const result = { status: nativeResult[0] };
Comment thread
joyeecheung marked this conversation as resolved.
Expand Down