@@ -202,7 +202,27 @@ namespace ts {
202
202
scriptKind ?: ScriptKind ) : SourceFile {
203
203
scriptKind = ensureScriptKind ( fileName , scriptKind ) ;
204
204
const scriptTarget = scriptKind === ScriptKind . JSON ? ScriptTarget . JSON : getEmitScriptTarget ( compilationSettings ) ;
205
+
206
+ const oldBucketCount = buckets . size ;
205
207
const bucket = getOrUpdate ( buckets , key , ( ) => new Map ( ) ) ;
208
+ if ( tracing ) {
209
+ if ( buckets . size > oldBucketCount ) {
210
+ // It is interesting, but not definitively problematic if a build requires multiple document registry buckets -
211
+ // perhaps they are for two projects that don't have any overlap.
212
+ // Bonus: these events can help us interpret the more interesting event below.
213
+ tracing . instant ( tracing . Phase . Session , "createdDocumentRegistryBucket" , { configFilePath : compilationSettings . configFilePath , key } ) ;
214
+ }
215
+
216
+ // It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
217
+ // If this occurs unexpectedly, the fix is likely to synchronize the project settings.
218
+ // Skip .d.ts files to reduce noise (should also cover most of node_modules).
219
+ const otherBucketKey = ! fileExtensionIs ( path , Extension . Dts ) &&
220
+ forEachEntry ( buckets , ( bucket , bucketKey ) => bucketKey !== key && bucket . has ( path ) && bucketKey ) ;
221
+ if ( otherBucketKey ) {
222
+ tracing . instant ( tracing . Phase . Session , "documentRegistryBucketOverlap" , { path, key1 : otherBucketKey , key2 : key } ) ;
223
+ }
224
+ }
225
+
206
226
const bucketEntry = bucket . get ( path ) ;
207
227
let entry = bucketEntry && getDocumentRegistryEntry ( bucketEntry , scriptKind ) ;
208
228
if ( ! entry && externalCache ) {
0 commit comments