File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1183,6 +1183,9 @@ namespace ts {
1183
1183
function doesStructuralPermitResolutionsReuse ( ) : boolean {
1184
1184
switch ( structuralIsReused ) {
1185
1185
case StructureIsReused . Not : return false ;
1186
+ case StructureIsReused . SafeProjectReferenceModules :
1187
+ return file . resolvedModules !== undefined &&
1188
+ isSourceOfProjectReferenceRedirect ( file . originalFileName ) ;
1186
1189
case StructureIsReused . SafeModules : return true ;
1187
1190
case StructureIsReused . Completely : return true ;
1188
1191
@@ -1255,7 +1258,10 @@ namespace ts {
1255
1258
1256
1259
function tryReuseStructureFromOldProgram ( ) : StructureIsReused {
1257
1260
if ( ! oldProgram ) {
1258
- return StructureIsReused . Not ;
1261
+ // During initial program creation, root files may import files from project
1262
+ // references that were previously loaded. Those resolutions are safe to reuse
1263
+ // since another program instance kept them up to date.
1264
+ return StructureIsReused . SafeProjectReferenceModules ;
1259
1265
}
1260
1266
1261
1267
// check properties that can affect structure of the program or module resolution strategy
Original file line number Diff line number Diff line change @@ -3824,9 +3824,10 @@ namespace ts {
3824
3824
/* @internal */
3825
3825
/** "Structure" refers to the SourceFile graph of a Program linked by module resolutions. */
3826
3826
export const enum StructureIsReused {
3827
- Not = 0 , // The entire Program must be (re)created.
3828
- SafeModules = 1 << 0 , // SourceFile objects need to be rediscovered, but module resolutions can be reused.
3829
- Completely = 1 << 1 , // SourceFile objects and module resolutions can be reused from an old Program.
3827
+ Not = 0 , // The entire Program must be (re)created.
3828
+ SafeProjectReferenceModules = 1 << 0 , // SourceFile objects need to be rediscovered, but module resolutions within project reference sources may be reused.
3829
+ SafeModules = 1 << 1 , // SourceFile objects need to be rediscovered, but module resolutions can be reused.
3830
+ Completely = 1 << 2 , // SourceFile objects and module resolutions can be reused from an old Program.
3830
3831
}
3831
3832
3832
3833
export type CustomTransformerFactory = ( context : TransformationContext ) => CustomTransformer ;
You can’t perform that action at this time.
0 commit comments