mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-14 16:56:06 -05:00
More updates to program reuse with different option changes (#44276)
This commit is contained in:
@@ -745,9 +745,7 @@ namespace ts {
|
||||
if (!program) return false;
|
||||
// If any compiler options change, we can't reuse old source file even if version match
|
||||
// The change in options like these could result in change in syntax tree or `sourceFile.bindDiagnostics`.
|
||||
const oldOptions = program.getCompilerOptions();
|
||||
return !!sourceFileAffectingCompilerOptions.some(option =>
|
||||
!isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)));
|
||||
return optionsHaveChanges(program.getCompilerOptions(), newOptions, sourceFileAffectingCompilerOptions);
|
||||
}
|
||||
|
||||
function createCreateProgramOptions(rootNames: readonly string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: readonly Diagnostic[]): CreateProgramOptions {
|
||||
@@ -1421,10 +1419,6 @@ namespace ts {
|
||||
return StructureIsReused.Not;
|
||||
}
|
||||
|
||||
if (!arrayIsEqualTo(options.types, oldOptions.types)) {
|
||||
return StructureIsReused.Not;
|
||||
}
|
||||
|
||||
// Check if any referenced project tsconfig files are different
|
||||
if (!canReuseProjectReferences()) {
|
||||
return StructureIsReused.Not;
|
||||
@@ -1505,7 +1499,7 @@ namespace ts {
|
||||
|
||||
if (!arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
||||
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
||||
return StructureIsReused.Not;
|
||||
structureIsReused = StructureIsReused.SafeModules;
|
||||
}
|
||||
|
||||
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
||||
@@ -1598,7 +1592,7 @@ namespace ts {
|
||||
return structureIsReused;
|
||||
}
|
||||
|
||||
if (host.hasChangedAutomaticTypeDirectiveNames?.()) {
|
||||
if (changesAffectingProgramStructure(oldOptions, options) || host.hasChangedAutomaticTypeDirectiveNames?.()) {
|
||||
return StructureIsReused.SafeModules;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user