@@ -90,9 +90,25 @@ export interface HasInvalidatedFromResolutionCache {
90
90
* @internal
91
91
*/
92
92
export interface ResolutionCache {
93
+ resolvedModuleNames : Map < Path , ModeAwareCache < CachedResolvedModuleWithFailedLookupLocations > > ;
94
+ resolvedTypeReferenceDirectives : Map < Path , ModeAwareCache < CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations > > ;
95
+ resolvedLibraries : Map < string , CachedResolvedModuleWithFailedLookupLocations > ;
96
+ resolvedFileToResolution : Map < Path , Set < ResolutionWithFailedLookupLocations > > ;
97
+ resolutionsWithFailedLookups : Set < ResolutionWithFailedLookupLocations > ;
98
+ resolutionsWithOnlyAffectingLocations : Set < ResolutionWithFailedLookupLocations > ;
99
+ directoryWatchesOfFailedLookups : Map < string , DirectoryWatchesOfFailedLookup > ;
100
+ fileWatchesOfAffectingLocations : Map < string , FileWatcherOfAffectingLocation > ;
93
101
startRecordingFilesWithChangedResolutions ( ) : void ;
94
102
finishRecordingFilesWithChangedResolutions ( ) : Path [ ] | undefined ;
95
103
104
+ watchFailedLookupLocationsOfExternalModuleResolutions < T extends ResolutionWithFailedLookupLocations , R extends ResolutionWithResolvedFileName > (
105
+ name : string ,
106
+ resolution : T ,
107
+ filePath : Path ,
108
+ getResolutionWithResolvedFileName : GetResolutionWithResolvedFileName < T , R > ,
109
+ deferWatchingNonRelativeResolution : boolean ,
110
+ ) : void ;
111
+
96
112
resolveModuleNameLiterals (
97
113
moduleLiterals : readonly StringLiteralLike [ ] ,
98
114
containingFile : string ,
@@ -156,7 +172,8 @@ export interface ResolutionWithFailedLookupLocations {
156
172
node10Result ?: string ;
157
173
}
158
174
159
- interface ResolutionWithResolvedFileName {
175
+ /** @internal */
176
+ export interface ResolutionWithResolvedFileName {
160
177
resolvedFileName : string | undefined ;
161
178
packageId ?: PackageId ;
162
179
}
@@ -165,7 +182,8 @@ interface ResolutionWithResolvedFileName {
165
182
export interface CachedResolvedModuleWithFailedLookupLocations extends ResolvedModuleWithFailedLookupLocations , ResolutionWithFailedLookupLocations {
166
183
}
167
184
168
- interface CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations extends ResolvedTypeReferenceDirectiveWithFailedLookupLocations , ResolutionWithFailedLookupLocations {
185
+ /** @internal */
186
+ export interface CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations extends ResolvedTypeReferenceDirectiveWithFailedLookupLocations , ResolutionWithFailedLookupLocations {
169
187
}
170
188
171
189
/** @internal */
@@ -189,15 +207,17 @@ export interface ResolutionCacheHost extends MinimalResolutionCacheHost {
189
207
onDiscoveredSymlink ?( ) : void ;
190
208
}
191
209
192
- interface FileWatcherOfAffectingLocation {
210
+ /** @internal */
211
+ export interface FileWatcherOfAffectingLocation {
193
212
/** watcher for the lookup */
194
213
watcher : FileWatcher ;
195
214
resolutions : number ;
196
215
files : number ;
197
216
paths : Set < string > ;
198
217
}
199
218
200
- interface DirectoryWatchesOfFailedLookup {
219
+ /** @internal */
220
+ export interface DirectoryWatchesOfFailedLookup {
201
221
/** watcher for the lookup */
202
222
watcher : FileWatcher ;
203
223
/** ref count keeping this watch alive */
@@ -467,7 +487,8 @@ function resolveModuleNameUsingGlobalCache(
467
487
return result ;
468
488
}
469
489
470
- type GetResolutionWithResolvedFileName < T extends ResolutionWithFailedLookupLocations = ResolutionWithFailedLookupLocations , R extends ResolutionWithResolvedFileName = ResolutionWithResolvedFileName > =
490
+ /** @internal */
491
+ export type GetResolutionWithResolvedFileName < T extends ResolutionWithFailedLookupLocations = ResolutionWithFailedLookupLocations , R extends ResolutionWithResolvedFileName = ResolutionWithResolvedFileName > =
471
492
( resolution : T ) => R | undefined ;
472
493
473
494
/** @internal */
@@ -479,7 +500,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
479
500
480
501
const resolutionsWithFailedLookups = new Set < ResolutionWithFailedLookupLocations > ( ) ;
481
502
const resolutionsWithOnlyAffectingLocations = new Set < ResolutionWithFailedLookupLocations > ( ) ;
482
- const resolvedFileToResolution = new Map < string , Set < ResolutionWithFailedLookupLocations > > ( ) ;
503
+ const resolvedFileToResolution = new Map < Path , Set < ResolutionWithFailedLookupLocations > > ( ) ;
483
504
const impliedFormatPackageJsons = new Map < Path , readonly string [ ] > ( ) ;
484
505
485
506
let hasChangedAutomaticTypeDirectiveNames = false ;
@@ -529,6 +550,15 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
529
550
const typeRootsWatches = new Map < string , FileWatcher > ( ) ;
530
551
531
552
return {
553
+ resolvedModuleNames,
554
+ resolvedTypeReferenceDirectives,
555
+ resolvedLibraries,
556
+ resolvedFileToResolution,
557
+ resolutionsWithFailedLookups,
558
+ resolutionsWithOnlyAffectingLocations,
559
+ directoryWatchesOfFailedLookups,
560
+ fileWatchesOfAffectingLocations,
561
+ watchFailedLookupLocationsOfExternalModuleResolutions,
532
562
getModuleResolutionCache : ( ) => moduleResolutionCache ,
533
563
startRecordingFilesWithChangedResolutions,
534
564
finishRecordingFilesWithChangedResolutions,
@@ -649,7 +679,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
649
679
if ( ! newProgram ?. resolvedLibReferences ?. has ( libFileName ) ) {
650
680
stopWatchFailedLookupLocationOfResolution (
651
681
resolution ,
652
- resolutionHost . toPath ( getInferredLibraryNameResolveFrom ( newProgram ! . getCompilerOptions ( ) , getCurrentDirectory ( ) , libFileName ) ) ,
682
+ resolutionHost . toPath ( getInferredLibraryNameResolveFrom ( resolutionHost . getCompilationSettings ( ) , getCurrentDirectory ( ) , libFileName ) ) ,
653
683
getResolvedModule ,
654
684
) ;
655
685
resolvedLibraries . delete ( libFileName ) ;
0 commit comments