@@ -29,6 +29,7 @@ type ItemType = 'Model' | 'Transform' | 'Service';
29
29
// eslint-disable-line
30
30
type LayoutCollectorFn = ( root : string , itemName : string , podModulePrefix ?: string ) => string [ ] ;
31
31
type AsyncLayoutCollectorFn = ( root : string , itemName : string , podModulePrefix ?: string ) => Promise < string [ ] > ;
32
+ type ProjectAwareCollectionFn = ( project : Project , itemName : string , podModulePrefix ?: string ) => Promise < string [ ] > ;
32
33
33
34
function joinPaths ( ...args : string [ ] ) {
34
35
return [ '.ts' , '.js' ] . map ( ( extName : string ) => {
@@ -40,7 +41,8 @@ function joinPaths(...args: string[]) {
40
41
}
41
42
42
43
class PathResolvers {
43
- [ key : string ] : LayoutCollectorFn | AsyncLayoutCollectorFn ;
44
+ [ key : string ] : LayoutCollectorFn | AsyncLayoutCollectorFn | ProjectAwareCollectionFn ;
45
+
44
46
muModelPaths ( root : string , modelName : string ) {
45
47
return joinPaths ( root , 'src' , 'data' , 'models' , modelName , 'model' ) ;
46
48
}
@@ -68,11 +70,11 @@ class PathResolvers {
68
70
podServicePaths ( root : string , modelName : string , podPrefix : string ) {
69
71
return joinPaths ( root , 'app' , podPrefix , modelName , 'service' ) ;
70
72
}
71
- async addonServicePaths ( root : string , serviceName : string ) : Promise < string [ ] > {
72
- return await getAddonPathsForType ( root , 'services' , serviceName ) ;
73
+ async addonServicePaths ( project : Project , serviceName : string ) : Promise < string [ ] > {
74
+ return await getAddonPathsForType ( project , 'services' , serviceName ) ;
73
75
}
74
- async addonImportPaths ( root : string , pathName : string ) {
75
- return await getAddonImport ( root , pathName ) ;
76
+ async addonImportPaths ( project : Project , pathName : string ) {
77
+ return await getAddonImport ( project , pathName ) ;
76
78
}
77
79
classicImportPaths ( root : string , pathName : string ) {
78
80
const pathParts = pathName . split ( '/' ) ;
@@ -123,7 +125,7 @@ export default class CoreScriptDefinitionProvider {
123
125
guessedPaths . push ( pathLocation ) ;
124
126
} ) ;
125
127
126
- const addonImports = await this . resolvers . addonImportPaths ( root , importPath ) ;
128
+ const addonImports = await this . resolvers . addonImportPaths ( this . project , importPath ) ;
127
129
128
130
addonImports . forEach ( ( pathLocation : string ) => {
129
131
guessedPaths . push ( pathLocation ) ;
@@ -148,7 +150,7 @@ export default class CoreScriptDefinitionProvider {
148
150
}
149
151
150
152
if ( fnName === 'Service' ) {
151
- const paths = await this . resolvers . addonServicePaths ( root , typeName ) ;
153
+ const paths = await this . resolvers . addonServicePaths ( this . project , typeName ) ;
152
154
153
155
paths . forEach ( ( item : string ) => {
154
156
guessedPaths . push ( item ) ;
0 commit comments