@@ -21,7 +21,9 @@ export function getImplementationFactory<T>(
21
21
const [ implementationModulePath , implementationExportName ] =
22
22
implementation . split ( '#' ) ;
23
23
return ( ) => {
24
- console . log ( `Resolving implementation: ${ implementation } from ${ directory } ` ) ;
24
+ console . log (
25
+ `Resolving implementation: ${ implementation } from ${ directory } `
26
+ ) ;
25
27
const modulePath = resolveImplementation (
26
28
implementationModulePath ,
27
29
directory ,
@@ -33,10 +35,10 @@ export function getImplementationFactory<T>(
33
35
registerPluginTSTranspiler ( ) ;
34
36
}
35
37
try {
36
- const module = require ( modulePath ) ;
37
- return implementationExportName
38
- ? module [ implementationExportName ]
39
- : module . default ?? module ;
38
+ const module = require ( modulePath ) ;
39
+ return implementationExportName
40
+ ? module [ implementationExportName ]
41
+ : module . default ?? module ;
40
42
} catch ( e ) {
41
43
console . error ( `Failed to require implementation at ${ modulePath } :` , e ) ;
42
44
throw new Error (
@@ -58,8 +60,9 @@ export function resolveImplementation(
58
60
packageName : string ,
59
61
projects : Record < string , ProjectConfiguration >
60
62
) : string {
61
-
62
- console . log ( `Resolving implementation: ${ implementationModulePath } from ${ directory } ` ) ;
63
+ console . log (
64
+ `Resolving implementation: ${ implementationModulePath } from ${ directory } `
65
+ ) ;
63
66
64
67
const validImplementations = [ '' , '.js' , '.ts' ] . map (
65
68
( x ) => implementationModulePath + x
@@ -96,16 +99,19 @@ export function resolveImplementation(
96
99
} ) ;
97
100
console . log ( `Resolved via require.resolve: ${ resolved } ` ) ;
98
101
return resolved ;
99
- } catch ( e ) {
100
- console . error ( `Failed to resolve "${ maybeImplementation } " from "${ directory } ":` , e ) ;
102
+ } catch ( e ) {
103
+ console . error (
104
+ `Failed to resolve "${ maybeImplementation } " from "${ directory } ":` ,
105
+ e
106
+ ) ;
101
107
// If it fails, we continue to the next valid implementation
102
108
// This is useful for cases where the implementation might be in a different format
103
109
// or if the file is not found in the expected location.
104
110
continue ;
105
111
}
106
112
}
107
113
108
- throw new Error (
114
+ throw new Error (
109
115
`Could not resolve "${ implementationModulePath } " from "${ directory } ".`
110
116
) ;
111
117
}
@@ -148,18 +154,22 @@ function tryResolveFromSource(
148
154
packageName : string ,
149
155
projects : Record < string , ProjectConfiguration >
150
156
) : string | null {
151
- console . log ( `Trying to resolve from source: ${ path } in ${ directory } for package: ${ packageName } ` ) ;
157
+ console . log (
158
+ `Trying to resolve from source: ${ path } in ${ directory } for package: ${ packageName } `
159
+ ) ;
152
160
153
161
packageToProjectMap ??=
154
162
getWorkspacePackagesMetadata ( projects ) . packageToProjectMap ;
155
163
const localProject = packageToProjectMap [ packageName ] ;
156
164
if ( ! localProject ) {
157
165
console . log ( `No local project found for package: ${ packageName } ` ) ;
158
- // it doesn't match any of the package names from the local projects
166
+ // it doesn't match any of the package names from the local projects
159
167
return null ;
160
168
}
161
169
162
- console . log ( `Found local project for package: ${ packageName } at ${ localProject . root } ` ) ;
170
+ console . log (
171
+ `Found local project for package: ${ packageName } at ${ localProject . root } `
172
+ ) ;
163
173
164
174
try {
165
175
const fromExports = resolveExports (
0 commit comments