@@ -109,21 +109,27 @@ interface ResolutionInfo {
109
109
mode : ts . ResolutionMode ;
110
110
}
111
111
112
- function getResolutionCacheDetails < T extends ts . ResolutionWithFailedLookupLocations > (
112
+ function getResolutionCacheDetails < File , T extends ts . ResolutionWithFailedLookupLocations > (
113
113
baseline : string [ ] ,
114
114
cacheType : string ,
115
- cache : ts . ModeAwareCache < T > | undefined ,
115
+ file : File ,
116
+ forEach :
117
+ | ( (
118
+ callback : ( resolvedModule : T , moduleName : string , mode : ts . ResolutionMode ) => void ,
119
+ file : File ,
120
+ ) => void )
121
+ | undefined ,
116
122
getResolvedFileName : ( resolution : T ) => string | undefined ,
117
123
indent : string ,
118
124
) {
119
125
let addedCacheType = false ;
120
- cache ?. forEach ( ( resolved , key , mode ) => {
126
+ forEach ?. ( ( resolved , key , mode ) => {
121
127
if ( ! addedCacheType ) {
122
128
addedCacheType = true ;
123
129
baseline . push ( `${ indent } ${ cacheType } :` ) ;
124
130
}
125
131
baseline . push ( `${ indent } ${ key } : ${ mode ? ts . getNameOfCompilerOptionValue ( mode , ts . moduleOptionDeclaration . type ) + ":" : "" } ${ getResolvedFileName ( resolved ) } ` ) ;
126
- } ) ;
132
+ } , file ) ;
127
133
}
128
134
129
135
function getResolvedModuleFileName ( r : ts . ResolvedModuleWithFailedLookupLocations ) {
@@ -157,22 +163,25 @@ function getProgramStructure(program: ts.Program | undefined) {
157
163
getResolutionCacheDetails (
158
164
baseline ,
159
165
"Modules" ,
160
- program . resolvedModules ?. get ( f . path ) ,
166
+ f ,
167
+ program . forEachResolvedModule ,
161
168
getResolvedModuleFileName ,
162
169
" " ,
163
170
) ;
164
171
getResolutionCacheDetails (
165
172
baseline ,
166
173
"TypeRefs" ,
167
- program . resolvedTypeReferenceDirectiveNames ?. get ( f . path ) ,
174
+ f ,
175
+ program . forEachResolvedTypeReferenceDirective ,
168
176
getResolvedTypeRefFileName ,
169
177
" " ,
170
178
) ;
171
179
} ) ;
172
180
getResolutionCacheDetails (
173
181
baseline ,
174
182
"AutoTypeRefs" ,
175
- program ?. getAutomaticTypeDirectiveResolutions ( ) ,
183
+ /*file*/ undefined ,
184
+ program ?. getAutomaticTypeDirectiveResolutions ( ) . forEach ,
176
185
getResolvedTypeRefFileName ,
177
186
" " ,
178
187
) ;
0 commit comments