@@ -125,16 +125,19 @@ export class MetadataResolver {
125125 }
126126 const type = resolveType ( this . registry ) ( this . tree ) ( fsPath ) ;
127127 if ( type ) {
128- const adapter = new SourceAdapterFactory ( this . registry , this . tree ) . getAdapter ( type , this . forceIgnore ) ;
129128 // short circuit the component resolution unless this is a resolve for a
130129 // source path or allowed content-only path, otherwise the adapter
131130 // 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 ) ;
138141 }
139142
140143 if ( isProbablyPackageManifest ( this . tree ) ( fsPath ) ) return undefined ;
@@ -439,3 +442,9 @@ const pathIncludesDirName =
439442 * @param fsPath File path of a potential metadata xml file
440443 */
441444const 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