diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c467a99..f26d800 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,7 @@ on: env: FORCE_COLOR: 2 + NODE_DISABLE_COMPILE_CACHE: 1 jobs: lint: diff --git a/lib/cjs.cjs b/lib/cjs.cjs index ec98743..5668a20 100644 --- a/lib/cjs.cjs +++ b/lib/cjs.cjs @@ -1,3 +1,8 @@ +const mod = require('node:module') + +// to use V8's code cache to speed up instantiation time +mod.enableCompileCache?.() + const { default: npmRunAll } = require('./esm.mjs') // Didn't manage to get this into the last breaking change, so adding a cjs as the primary export diff --git a/lib/esm.mjs b/lib/esm.mjs index 65b1278..507d726 100644 --- a/lib/esm.mjs +++ b/lib/esm.mjs @@ -9,6 +9,7 @@ // Requirements // ------------------------------------------------------------------------------ +import mod from 'node:module' import shellQuote from 'shell-quote' import matchTasks from './match-tasks.js' import readPackageJson from './read-package-json.js' @@ -18,6 +19,9 @@ import runTasks from './run-tasks.js' // Helpers // ------------------------------------------------------------------------------ +// to use V8's code cache to speed up instantiation time +mod.enableCompileCache?.() + const ARGS_PATTERN = /\{(!)?([*@%]|\d+)([^}]+)?}/g const ARGS_UNPACK_PATTERN = /\{(!)?([%])([^}]+)?}/g diff --git a/lib/run-task.js b/lib/run-task.js index f393dd4..e898e70 100644 --- a/lib/run-task.js +++ b/lib/run-task.js @@ -11,6 +11,7 @@ import fs from 'node:fs' import path from 'node:path' +import mod from 'node:module' import ansiStyles from 'ansi-styles' import { parse as parseArgs } from 'shell-quote' @@ -208,6 +209,8 @@ export default function runTask (task, options) { } Array.prototype.push.apply(spawnArgs, parseArgs(task).map(cleanTaskArg)) + mod.flushCompileCache?.() + cp = await spawn(execPath, spawnArgs, spawnOptions) // Piping stdio.