@@ -15,6 +15,18 @@ module.exports = class ModulesPreprocessor {
1515 this . _modulesTree = null ;
1616 this . _modulesBasePath = null ;
1717 this . _modulesBridge = new Bridge ( ) ;
18+
19+ /*
20+ * The addon name we should use to look up modules.
21+ * Uses moduleName if defined, else uses the parent/package name.
22+ */
23+ this . _ownerName = null ;
24+
25+ /*
26+ * The parent/package name. This is used as a fallback to look up
27+ * paths that may reference the package name instead of the
28+ * module name. (See resolve-path.js)
29+ */
1830 this . _parentName = null ;
1931 }
2032
@@ -41,13 +53,14 @@ module.exports = class ModulesPreprocessor {
4153 // If moduleName is defined, that should override the parent's name.
4254 // Otherwise, the template and generated module will disagree as to what the path should be.
4355 let ownerParent = this . owner . getParent ( ) ;
44- let parentName = ownerParent . moduleName ? ownerParent . moduleName ( ) : this . owner . getParentName ( ) ;
45- this . _parentName = parentName ;
56+ this . _parentName = this . owner . getParentName ( ) ;
57+ let ownerName = ownerParent . moduleName ? ownerParent . moduleName ( ) : this . _parentName ;
58+ this . _ownerName = ownerName ;
4659
4760 let modulesSources = new ModuleSourceFunnel ( inputRoot , modulesInput , {
4861 include : [ '**/*.' + this . owner . getFileExtension ( ) ] ,
4962 outputRoot,
50- parentName,
63+ parentName : ownerName ,
5164 } ) ;
5265
5366 let modulesTree = new ( require ( 'broccoli-css-modules' ) ) ( modulesSources , {
@@ -191,10 +204,12 @@ module.exports = class ModulesPreprocessor {
191204
192205 return this . _resolvePath ( importPath , fromFile , {
193206 defaultExtension : this . owner . getFileExtension ( ) ,
194- ownerName : this . _parentName ,
207+ ownerName : this . _ownerName ,
208+ parentName : this . _parentName ,
195209 addonModulesRoot : this . owner . getAddonModulesRoot ( ) ,
196210 root : ensurePosixPath ( this . _modulesTree . inputPaths [ 0 ] ) ,
197- parent : this . owner . getParent ( )
211+ parent : this . owner . getParent ( ) ,
212+ ui : this . owner . ui
198213 } ) ;
199214 }
200215} ;
0 commit comments