Skip to content

Commit

Permalink
Non composite projects dont need to track declaration change time
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Apr 19, 2022
1 parent fcf07f8 commit 2f2e370
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
17 changes: 5 additions & 12 deletions src/compiler/tsbuildPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,9 @@ namespace ts {
if (resultFlags === BuildResultFlags.DeclarationOutputUnchanged && isDeclarationFileName(name)) {
// Check for unchanged .d.ts files
if (state.readFileWithCache(name) === text) {
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, ts.getModifiedTime(host, name));
if (config.options.composite) {
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, ts.getModifiedTime(host, name));
}
}
else {
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
Expand Down Expand Up @@ -1506,7 +1508,6 @@ namespace ts {
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
let oldestOutputFileName = "(none)";
let oldestOutputFileTime = maximumDate;
let newestDeclarationFileContentChangedTime;
let buildInfoTime: Date | undefined;
if (buildInfoPath) {
const buildInfoCacheEntry = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
Expand Down Expand Up @@ -1599,14 +1600,6 @@ namespace ts {
newerInputFileName: newestInputFileName
};
}

// Keep track of when the most recent time a .d.ts file was changed.
// In addition to file timestamps, we also keep track of when a .d.ts file
// had its file touched but not had its contents changed - this allows us
// to skip a downstream typecheck
if (isDeclarationFileName(output)) {
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputTime);
}
}
}

Expand Down Expand Up @@ -1666,7 +1659,7 @@ namespace ts {
// Up to date
return {
type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate,
newestDeclarationFileContentChangedTime,
newestDeclarationFileContentChangedTime: undefined,
newestInputFileTime,
newestInputFileName,
oldestOutputFileName
Expand Down Expand Up @@ -1706,7 +1699,7 @@ namespace ts {
continue;
}

if (!anyDtsChange && isDeclarationFileName(file)) {
if (proj.options.composite && !anyDtsChange && isDeclarationFileName(file)) {
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, ts.getModifiedTime(host, file));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ exitCode:: ExitStatus.Success

getModifiedTime:: {
"/src/obj/tsconfig.tsbuildinfo": 1,
"/src/bar.ts": 1,
"/src/obj/lazyIndex.d.ts": 1
"/src/bar.ts": 1
}

setModifiedTime:: {}
Expand Down Expand Up @@ -440,8 +439,7 @@ exitCode:: ExitStatus.Success

getModifiedTime:: {
"/src/obj/tsconfig.tsbuildinfo": 1,
"/src/bar.ts": 1,
"/src/obj/lazyIndex.d.ts": 1
"/src/bar.ts": 1
}

setModifiedTime:: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,7 @@ Output::
exitCode:: ExitStatus.Success

getModifiedTime:: {
"/src/obj/tsconfig.tsbuildinfo": 1,
"/src/obj/bar.d.ts": 1,
"/src/obj/index.d.ts": 1,
"/src/obj/lazyIndex.d.ts": 1,
"/src/obj/bundling.d.ts": 1
"/src/obj/tsconfig.tsbuildinfo": 1
}

setModifiedTime:: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ getModifiedTime:: {
"/src/third/third_part1.ts": 1,
"/src/third/thirdjs/output/third-output.js": 1,
"/src/third/thirdjs/output/third-output.js.map": 1,
"/src/third/thirdjs/output/third-output.d.ts": 2,
"/src/third/thirdjs/output/third-output.d.ts": 1,
"/src/third/thirdjs/output/third-output.d.ts.map": 1,
"/src/third/tsconfig.json": 1
}
Expand Down Expand Up @@ -808,8 +808,7 @@ getModifiedTime:: {
"/src/second/second_part2.ts": 1,
"/src/second/tsconfig.json": 1,
"/src/third/thirdjs/output/third-output.tsbuildinfo": 1,
"/src/third/third_part1.ts": 1,
"/src/third/thirdjs/output/third-output.d.ts": 1
"/src/third/third_part1.ts": 1
}

setModifiedTime:: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ getModifiedTime:: {
"/src/third/third_part1.ts": 1,
"/src/third/thirdjs/output/third-output.js": 1,
"/src/third/thirdjs/output/third-output.js.map": 1,
"/src/third/thirdjs/output/third-output.d.ts": 2,
"/src/third/thirdjs/output/third-output.d.ts": 1,
"/src/third/thirdjs/output/third-output.d.ts.map": 1,
"/src/third/tsconfig.json": 1
}
Expand Down

0 comments on commit 2f2e370

Please sign in to comment.