@@ -53,7 +53,7 @@ type WorkspaceManagerOptions = {
53
53
allConfigFilesMap : Map < string , Map < PluginName , Set < string > > > ;
54
54
} ;
55
55
56
- type CacheItem = { resolveEntryPaths ?: Input [ ] ; resolveConfig ?: Input [ ] } ;
56
+ type CacheItem = { resolveEntryPaths ?: Input [ ] ; resolveConfig ?: Input [ ] ; resolveFromAST ?: Input [ ] } ;
57
57
58
58
const nullConfig : EnsuredPluginConfiguration = { config : null , entry : null , project : null } ;
59
59
@@ -288,8 +288,13 @@ export class WorkspaceWorker {
288
288
const inputs : Input [ ] = [ ] ;
289
289
const remainingPlugins = new Set ( this . enabledPlugins ) ;
290
290
291
- const addInput = ( input : Input , containingFilePath = input . containingFilePath ) =>
292
- inputs . push ( { ...input , containingFilePath } ) ;
291
+ const addInput = ( input : Input , containingFilePath = input . containingFilePath ) => {
292
+ if ( isConfig ( input ) ) {
293
+ handleConfigInput ( input . pluginName , { ...input , containingFilePath } ) ;
294
+ } else {
295
+ inputs . push ( { ...input , containingFilePath } ) ;
296
+ }
297
+ } ;
293
298
294
299
const handleConfigInput = ( pluginName : PluginName , input : ConfigInput ) => {
295
300
const configFilePath = this . getReferencedInternalFilePath ( input ) ;
@@ -351,6 +356,17 @@ export class WorkspaceWorker {
351
356
}
352
357
353
358
for ( const configFilePath of remainingConfigFilePaths ) {
359
+ const isManifest = basename ( configFilePath ) === 'package.json' ;
360
+ const fd = isManifest ? undefined : this . cache . getFileDescriptor ( configFilePath ) ;
361
+
362
+ if ( fd ?. meta ?. data && ! fd . changed ) {
363
+ const data = fd . meta . data ;
364
+ if ( data . resolveEntryPaths ) for ( const id of data . resolveEntryPaths ) addInput ( id , configFilePath ) ;
365
+ if ( data . resolveConfig ) for ( const id of data . resolveConfig ) addInput ( id , configFilePath ) ;
366
+ if ( data . resolveFromAST ) for ( const id of data . resolveFromAST ) addInput ( id , configFilePath ) ;
367
+ continue ;
368
+ }
369
+
354
370
const resolveOpts = {
355
371
...options ,
356
372
getInputsFromScripts : createGetInputsFromScripts ( configFilePath ) ,
@@ -359,27 +375,24 @@ export class WorkspaceWorker {
359
375
configFileName : basename ( configFilePath ) ,
360
376
} ;
361
377
378
+ const cache : CacheItem = { } ;
362
379
let loadedConfig : unknown ;
363
380
364
381
if ( plugin . resolveEntryPaths ) {
365
382
if ( ! loadedConfig ) loadedConfig = await loadConfigForPlugin ( configFilePath , plugin , resolveOpts , pluginName ) ;
366
383
if ( loadedConfig ) {
367
384
const inputs = await plugin . resolveEntryPaths ( loadedConfig , resolveOpts ) ;
368
385
for ( const input of inputs ) addInput ( input , configFilePath ) ;
386
+ cache . resolveEntryPaths = inputs ;
369
387
}
370
388
}
371
389
372
390
if ( plugin . resolveConfig ) {
373
391
if ( ! loadedConfig ) loadedConfig = await loadConfigForPlugin ( configFilePath , plugin , resolveOpts , pluginName ) ;
374
392
if ( loadedConfig ) {
375
393
const inputs = await plugin . resolveConfig ( loadedConfig , resolveOpts ) ;
376
- for ( const input of inputs ?? [ ] ) {
377
- if ( isConfig ( input ) ) {
378
- handleConfigInput ( input . pluginName , { ...input , containingFilePath : configFilePath } ) ;
379
- } else {
380
- addInput ( input , configFilePath ) ;
381
- }
382
- }
394
+ for ( const input of inputs ) addInput ( input , configFilePath ) ;
395
+ cache . resolveConfig = inputs ;
383
396
}
384
397
}
385
398
@@ -393,8 +406,11 @@ export class WorkspaceWorker {
393
406
if ( sourceFile ) {
394
407
const inputs = plugin . resolveFromAST ( sourceFile , resolveASTOpts ) ;
395
408
for ( const input of inputs ) addInput ( input , configFilePath ) ;
409
+ cache . resolveFromAST = inputs ;
396
410
}
397
411
}
412
+
413
+ if ( ! isManifest && fd ?. changed && fd . meta ) fd . meta . data = cache ;
398
414
}
399
415
400
416
if ( plugin . resolve ) {
0 commit comments