@@ -125,16 +125,19 @@ export class MetadataResolver {
125
125
}
126
126
const type = resolveType ( this . registry ) ( this . tree ) ( fsPath ) ;
127
127
if ( type ) {
128
- const adapter = new SourceAdapterFactory ( this . registry , this . tree ) . getAdapter ( type , this . forceIgnore ) ;
129
128
// short circuit the component resolution unless this is a resolve for a
130
129
// source path or allowed content-only path, otherwise the adapter
131
130
// knows how to handle it
132
- const shouldResolve =
133
- isResolvingSource ||
134
- parseAsRootMetadataXml ( fsPath ) ||
135
- ! parseAsContentMetadataXml ( this . registry ) ( fsPath ) ||
136
- ! adapter . allowMetadataWithContent ( ) ;
137
- return shouldResolve ? adapter . getComponent ( fsPath , isResolvingSource ) : undefined ;
131
+ if (
132
+ ! isResolvingSource &&
133
+ ! parseAsRootMetadataXml ( fsPath ) &&
134
+ parseAsContentMetadataXml ( this . registry ) ( fsPath ) &&
135
+ typeAllowsMetadataWithContent ( type )
136
+ ) {
137
+ return ;
138
+ }
139
+ const adapter = new SourceAdapterFactory ( this . registry , this . tree ) . getAdapter ( type , this . forceIgnore ) ;
140
+ return adapter . getComponent ( fsPath , isResolvingSource ) ;
138
141
}
139
142
140
143
if ( isProbablyPackageManifest ( this . tree ) ( fsPath ) ) return undefined ;
@@ -439,3 +442,9 @@ const pathIncludesDirName =
439
442
* @param fsPath File path of a potential metadata xml file
440
443
*/
441
444
const parseAsRootMetadataXml = ( fsPath : string ) : boolean => Boolean ( parseMetadataXml ( fsPath ) ) ;
445
+
446
+ /** decomposed and default types are `false`, everything else is true */
447
+ const typeAllowsMetadataWithContent = ( type : MetadataType ) : boolean =>
448
+ type . strategies ?. adapter !== undefined && // another way of saying default
449
+ type . strategies . adapter !== 'decomposed' &&
450
+ type . strategies . adapter !== 'default' ;
0 commit comments