fix(compiler-cli): correct incremental behavior even with broken impo… · angular/angular@adeeb84
@@ -53,6 +53,10 @@ export class FileDependencyGraph<T extends {fileName: string} = ts.SourceFile> i
5353}
5454}
555556+recordDependencyAnalysisFailure(file: T): void {
57+this.nodeFor(file).failedAnalysis = true;
58+}
59+5660getResourceDependencies(from: T): AbsoluteFsPath[] {
5761const node = this.nodes.get(from);
5862@@ -97,6 +101,7 @@ export class FileDependencyGraph<T extends {fileName: string} = ts.SourceFile> i
97101this.nodes.set(sf, {
98102dependsOn: new Set(node.dependsOn),
99103usesResources: new Set(node.usesResources),
104+failedAnalysis: false,
100105});
101106}
102107}
@@ -109,6 +114,7 @@ export class FileDependencyGraph<T extends {fileName: string} = ts.SourceFile> i
109114this.nodes.set(sf, {
110115dependsOn: new Set<string>(),
111116usesResources: new Set<AbsoluteFsPath>(),
117+failedAnalysis: false,
112118});
113119}
114120return this.nodes.get(sf)!;
@@ -122,6 +128,12 @@ export class FileDependencyGraph<T extends {fileName: string} = ts.SourceFile> i
122128function isLogicallyChanged<T extends {fileName: string}>(
123129sf: T, node: FileNode, changedTsPaths: ReadonlySet<string>, deletedTsPaths: ReadonlySet<string>,
124130changedResources: ReadonlySet<AbsoluteFsPath>): boolean {
131+// A file is assumed to have logically changed if its dependencies could not be determined
132+// accurately.
133+if (node.failedAnalysis) {
134+return true;
135+}
136+125137// A file is logically changed if it has physically changed itself (including being deleted).
126138if (changedTsPaths.has(sf.fileName) || deletedTsPaths.has(sf.fileName)) {
127139return true;
@@ -146,6 +158,7 @@ function isLogicallyChanged<T extends {fileName: string}>(
146158interface FileNode {
147159dependsOn: Set<string>;
148160usesResources: Set<AbsoluteFsPath>;
161+failedAnalysis: boolean;
149162}
150163151164const EMPTY_SET: ReadonlySet<any> = new Set<any>();