@@ -25,21 +25,28 @@ export default ({input, flags = {}}) => {
2525 use = [ ] . concat ( use ) . reduce ( ( cfg , name ) => {
2626 let cliOptions = flags [ toCamelCase ( name ) ] ;
2727 let configOptions = configPluginOptions [ name ] ;
28+
2829 // We merge this way because options can be both strings and objects.
29- const merged = mergeOptions ( { [ name ] : configOptions } , { [ name ] : cliOptions || { } } ) ;
30+ const merged = mergeOptions ( { [ name ] : configOptions } , { [ name ] : cliOptions || { } } ) ;
31+
3032 // Assigning as we loop `use` makes sure that the order in cfg.plugins is correct.
3133 cfg . plugins [ name ] = merged [ name ] ;
34+
3235 if ( configOptions ) {
3336 delete configPluginOptions [ name ] ;
3437 }
38+
3539 return cfg ;
36- } , { plugins : { } } ) ;
40+ } , { plugins : { } } ) ;
3741
3842 // Add the remaining plugins if there is any.
3943 if ( config && config . plugins ) {
4044 for ( let name in configPluginOptions ) {
41- use . plugins [ name ] = configPluginOptions [ name ] ;
45+ if ( configPluginOptions [ name ] ) {
46+ use . plugins [ name ] = configPluginOptions [ name ] ;
47+ }
4248 }
49+
4350 // Now all the plugins are in `use.plugins`.
4451 // Delete `config.plugins` for correct merging later: mergeOptions(config, {...}, use)
4552 delete config . plugins ;
@@ -53,7 +60,17 @@ export default ({input, flags = {}}) => {
5360 input = [ ]
5461 . concat ( input && input . length > 0 ? input : config ?. input )
5562 . filter ( Boolean )
56- . map ( file => path . join ( path . resolve ( root ) , file ) ) ;
63+ . map ( file => {
64+ const ignoreFile = file . startsWith ( '!' ) ;
65+ let ignoreSymbol = '' ;
66+
67+ if ( ignoreFile ) {
68+ ignoreSymbol = '!' ;
69+ file = file . slice ( 1 ) ;
70+ }
71+
72+ return path . join ( ignoreSymbol , path . resolve ( root ) , file ) ;
73+ } ) ;
5774
5875 if ( input . length === 0 ) {
5976 throw new TypeError ( 'input files not found' ) ;
0 commit comments