File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,28 @@ import serializeError from './serialize-error.js';
24
24
25
25
function resolveModules ( modules ) {
26
26
return arrify ( modules ) . map ( name => {
27
- const modulePath = resolveCwd . silent ( name ) ;
27
+ if ( typeof name === 'string' ) {
28
+ const modulePath = resolveCwd . silent ( name ) ;
28
29
29
- if ( modulePath === undefined ) {
30
- throw new Error ( `Could not resolve required module ’${ name } ’` ) ;
30
+ if ( modulePath === undefined ) {
31
+ throw new Error ( `Could not resolve required module ’${ name } ’` ) ;
32
+ }
33
+
34
+ return modulePath ;
35
+ }
36
+
37
+ if ( Array . isArray ( name ) && name . length > 0 ) {
38
+ const modulePath = resolveCwd . silent ( name [ 0 ] ) ;
39
+
40
+ if ( modulePath === undefined ) {
41
+ throw new Error ( `Could not resolve required module ’${ name [ 0 ] } ’` ) ;
42
+ }
43
+
44
+ name [ 0 ] = modulePath ;
45
+ return name ;
31
46
}
32
47
33
- return modulePath ;
48
+ return name ;
34
49
} ) ;
35
50
}
36
51
Original file line number Diff line number Diff line change @@ -176,7 +176,14 @@ const run = async options => {
176
176
177
177
try {
178
178
for await ( const ref of ( options . require || [ ] ) ) {
179
- await load ( ref ) ;
179
+ if ( typeof ref === 'string' ) {
180
+ await load ( ref ) ;
181
+ } else if ( Array . isArray ( ref ) ) {
182
+ const [ path , options ] = ref ;
183
+
184
+ const mod = await load ( path ) ;
185
+ mod . apply ( null , ...options ) ;
186
+ }
180
187
}
181
188
182
189
// Install dependency tracker after the require configuration has been evaluated
You can’t perform that action at this time.
0 commit comments