File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,21 @@ function resolve (plugins, emitter) {
32
32
return
33
33
}
34
34
const pluginDirectory = path . normalize ( path . join ( __dirname , '/../..' ) )
35
- const regexp = new RegExp ( `^${ plugin . replace ( '*' , '.*' ) } ` )
35
+ const regexp = new RegExp ( `^${ plugin . replace ( / \* / g , '.*' ) . replace ( / \/ / g , '[/\\\\] ') } ` )
36
36
37
37
log . debug ( `Loading ${ plugin } from ${ pluginDirectory } ` )
38
38
fs . readdirSync ( pluginDirectory )
39
- . filter ( ( pluginName ) => ! IGNORED_PACKAGES . includes ( pluginName ) && regexp . test ( pluginName ) )
40
- . forEach ( ( pluginName ) => requirePlugin ( `${ pluginDirectory } /${ pluginName } ` ) )
39
+ . map ( ( e ) => {
40
+ const modulePath = path . join ( pluginDirectory , e )
41
+ if ( e [ 0 ] === '@' ) {
42
+ return fs . readdirSync ( modulePath ) . map ( ( e ) => path . join ( modulePath , e ) )
43
+ }
44
+ return modulePath
45
+ } )
46
+ . reduce ( ( a , x ) => a . concat ( x ) , [ ] )
47
+ . map ( ( modulePath ) => path . relative ( pluginDirectory , modulePath ) )
48
+ . filter ( ( moduleName ) => ! IGNORED_PACKAGES . includes ( moduleName ) && regexp . test ( moduleName ) )
49
+ . forEach ( ( pluginName ) => requirePlugin ( path . join ( pluginDirectory , pluginName ) ) )
41
50
} else if ( helper . isObject ( plugin ) ) {
42
51
log . debug ( `Loading inline plugin defining ${ Object . keys ( plugin ) . join ( ', ' ) } .` )
43
52
modules . push ( plugin )
You can’t perform that action at this time.
0 commit comments