fix(ivy): support older CLI versions that do not pass a list of changed files (#31322)
Versions of CLI prior to angular/angular-cli@0e339ee did not expose the host.getModifiedResourceFiles() method. This meant that null was being passed through to the IncrementalState.reconcile() method to indicate that there were either no changes or the host didn't support that method. This commit fixes a bug where we were checking for undefined rather than null when deciding whether any resource files had changed, causing a null reference error to be thrown. This bug was not caught by the unit testing because the tests set up the changed files via a slightly different process, not having access to the CompilerHost, and these test were making the erroneous assumption that undefined indicated that there were no changed files. PR Close #31322
This commit is contained in:
@ -224,7 +224,7 @@ export function exitCodeFromResult(diags: Diagnostics | undefined): number {
|
||||
export function performCompilation(
|
||||
{rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback,
|
||||
gatherDiagnostics = defaultGatherDiagnostics, customTransformers,
|
||||
emitFlags = api.EmitFlags.Default, modifiedResourceFiles}: {
|
||||
emitFlags = api.EmitFlags.Default, modifiedResourceFiles = null}: {
|
||||
rootNames: string[],
|
||||
options: api.CompilerOptions,
|
||||
host?: api.CompilerHost,
|
||||
@ -234,7 +234,7 @@ export function performCompilation(
|
||||
gatherDiagnostics?: (program: api.Program) => Diagnostics,
|
||||
customTransformers?: api.CustomTransformers,
|
||||
emitFlags?: api.EmitFlags,
|
||||
modifiedResourceFiles?: Set<string>,
|
||||
modifiedResourceFiles?: Set<string>| null,
|
||||
}): PerformCompilationResult {
|
||||
let program: api.Program|undefined;
|
||||
let emitResult: ts.EmitResult|undefined;
|
||||
|
Reference in New Issue
Block a user