diff --git a/scripts/build/project.js b/scripts/build/project.js index 8189ccec4a2..dcda9d63102 100644 --- a/scripts/build/project.js +++ b/scripts/build/project.js @@ -401,6 +401,21 @@ function getOrCreateProjectGraph(projectSpec, paths) { return projectGraph; } +/** + * @param {ResolvedPathOptions} paths + */ +function createParseProject(paths) { + /** + * @param {string} configFilePath + */ + function getProject(configFilePath) { + const projectSpec = resolveProjectSpec(configFilePath, paths, /*referrer*/ undefined); + const projectGraph = getOrCreateProjectGraph(projectSpec, defaultPaths); + return projectGraph && projectGraph.project; + } + return getProject; +} + /** * @param {ProjectGraph} projectGraph * @param {ResolvedProjectOptions} resolvedOptions @@ -473,7 +488,7 @@ function ensureCompileTask(projectGraph, options) { ? tsc.createProject(configFilePath, { typescript: require(options.typescript.typescript) }) : tsc_oop.createProject(configFilePath, {}, { typescript: options.typescript.typescript }); const stream = project.src() - .pipe(gulpif(!options.force, upToDate(projectGraph.project, { verbose: options.verbose }))) + .pipe(gulpif(!options.force, upToDate(projectGraph.project, { verbose: options.verbose, parseProject: createParseProject(options.paths) }))) .pipe(gulpif(sourceMap || inlineSourceMap, sourcemaps.init())) .pipe(project()); const js = (options.js ? options.js(stream.js) : stream.js) diff --git a/scripts/build/upToDate.js b/scripts/build/upToDate.js index 5f23726ed85..6f93b26edc0 100644 --- a/scripts/build/upToDate.js +++ b/scripts/build/upToDate.js @@ -15,6 +15,7 @@ const Vinyl = require("vinyl"); * * @typedef UpToDateOptions * @property {boolean} [verbose] + * @property {(configFilePath: string) => ParsedCommandLine | undefined} [parseProject] */ function upToDate(parsedProject, options) { /** @type {File[]} */ @@ -31,7 +32,8 @@ function upToDate(parsedProject, options) { }, getModifiedTime(fileName) { return getStat(fileName).mtime; - } + }, + parseConfigFile: options && options.parseProject }; const duplex = new Duplex({ objectMode: true, @@ -77,7 +79,6 @@ function upToDate(parsedProject, options) { module.exports = exports = upToDate; /** - * * @param {DiagnosticMessage} message * @param {...string} args */