@@ -51,7 +51,6 @@ export class DecomposedSourceAdapter extends MixedContentSourceAdapter {
51
51
rootMetadata = parseMetadataXml ( rootMetadataPath ) ;
52
52
}
53
53
}
54
-
55
54
let component : SourceComponent ;
56
55
if ( rootMetadata ) {
57
56
const componentName = this . type . folderType
@@ -81,40 +80,42 @@ export class DecomposedSourceAdapter extends MixedContentSourceAdapter {
81
80
if ( metaXml ) {
82
81
const pathToContent = this . trimPathToContent ( trigger ) ;
83
82
const childTypeId = this . type . children . suffixes [ metaXml . suffix ] ;
84
-
85
- // If the child is explicitly not addressable, return the parent SourceComponent.
86
- const triggerIsAChild = ! ! childTypeId && this . type . children . types [ childTypeId ] . isAddressable !== false ;
83
+ const triggerIsAChild = ! ! childTypeId ;
87
84
const strategy = this . type . strategies . decomposition ;
88
- if ( triggerIsAChild && ( strategy === DecompositionStrategy . FolderPerType || isResolvingSource ) ) {
89
- let parent = component ;
90
- if ( ! parent ) {
91
- parent = new SourceComponent (
85
+
86
+ if ( triggerIsAChild ) {
87
+ if ( strategy === DecompositionStrategy . FolderPerType || isResolvingSource ) {
88
+ let parent = component ;
89
+ if ( ! parent ) {
90
+ parent = new SourceComponent (
91
+ {
92
+ name : baseName ( pathToContent ) ,
93
+ type : this . type ,
94
+ } ,
95
+ this . tree ,
96
+ this . forceIgnore
97
+ ) ;
98
+ }
99
+ parent . content = pathToContent ;
100
+ return new SourceComponent (
92
101
{
93
- name : baseName ( pathToContent ) ,
94
- type : this . type ,
102
+ name : metaXml . fullName ,
103
+ type : this . type . children . types [ childTypeId ] ,
104
+ xml : trigger ,
105
+ parent,
95
106
} ,
96
107
this . tree ,
97
108
this . forceIgnore
98
109
) ;
99
110
}
100
- parent . content = pathToContent ;
101
- return new SourceComponent (
102
- {
103
- name : metaXml . fullName ,
104
- type : this . type . children . types [ childTypeId ] ,
105
- xml : trigger ,
106
- parent,
107
- } ,
108
- this . tree ,
109
- this . forceIgnore
110
- ) ;
111
- }
112
- if ( ! triggerIsAChild ) {
111
+ } else {
113
112
if ( ! component ) {
114
113
// This is most likely metadata found within a CustomObject folder that is not a
115
114
// child type of CustomObject. E.g., Layout, SharingRules, ApexClass.
116
115
throw new TypeInferenceError ( 'error_unexpected_child_type' , [ trigger , this . type . name ] ) ;
117
116
}
117
+ }
118
+ if ( component ) {
118
119
component . content = pathToContent ;
119
120
}
120
121
}
0 commit comments