@@ -480,29 +480,48 @@ export function splitLocaleMessages (
480
480
return { sfc : messages , external : metaExternalLocaleMessages }
481
481
}
482
482
483
- export function getIgnore ( target :string , ignoreFileNames : string ) : Ignore {
483
+ export function getIgnore ( target :string , ignoreFileNames : string , ignoreMultipleMode = false ) : Ignore {
484
484
const ig = ignore ( )
485
485
const files = ignoreFileNames . split ( ',' ) . filter ( Boolean )
486
- files . forEach ( file => {
487
- debug ( 'ignore target file' , file )
488
- const ignoreFiles = readIgnoreFile ( target , file )
486
+ files . forEach ( ( file , index ) => {
487
+ debug ( 'ignore target file' , file , index )
488
+ if ( index > 0 && ! ignoreMultipleMode ) {
489
+ return
490
+ }
491
+ const ignoreFiles = readIgnoreFile ( target , file , ignoreMultipleMode )
489
492
returnIgnoreInstance ( ig , ignoreFiles )
490
493
} )
491
494
return ig
492
495
}
493
496
494
- function readIgnoreFile ( target : string , _ignoreFile : string ) : string [ ] {
495
- const ignoreFiles = glob . sync ( `${ target } /**/${ _ignoreFile } ` )
496
- debug ( 'readIgnoreFile: ignoreFiles' , ignoreFiles )
497
+ function readIgnoreFile ( target : string , _ignoreFile : string , ignoreMultipleMode = false ) : string [ ] {
497
498
const ignoreTargets = [ ] as string [ ]
498
- ignoreFiles . forEach ( ignoreFile => {
499
- fs . readFileSync ( ignoreFile , 'utf8' )
499
+ if ( ! ignoreMultipleMode ) {
500
+ const ignoreFiles = glob . sync ( `${ target } /**/${ _ignoreFile } ` )
501
+ debug ( 'readIgnoreFile: ignoreFiles' , ignoreFiles )
502
+ ignoreFiles . forEach ( ignoreFile => {
503
+ fs . readFileSync ( ignoreFile , 'utf8' )
504
+ . split ( / \r ? \n / g)
505
+ . filter ( line => line . trim ( ) && ! line . trim ( ) . startsWith ( '#' ) )
506
+ . filter ( Boolean )
507
+ . forEach ( ignoreTarget => {
508
+ ignoreTargets . push ( formatPath ( ignoreFile , ignoreTarget ) )
509
+ } )
510
+ } )
511
+ } else {
512
+ debug ( `ignoreMultipleMode target: ${ target } , _ignoreFile: ${ _ignoreFile } ` )
513
+ const fullPath = resolve ( path . join ( target , path . normalize ( _ignoreFile ) ) )
514
+ debug ( `ignoreMultipleMode fullpath: ${ fullPath } ` )
515
+ fs . readFileSync ( fullPath , 'utf8' )
500
516
. split ( / \r ? \n / g)
517
+ . filter ( line => line . trim ( ) && ! line . trim ( ) . startsWith ( '#' ) )
501
518
. filter ( Boolean )
502
519
. forEach ( ignoreTarget => {
503
- ignoreTargets . push ( formatPath ( ignoreFile , ignoreTarget ) )
520
+ const igTarget = path . join ( target , ignoreTarget )
521
+ debug ( 'ignore target' , igTarget )
522
+ ignoreTargets . push ( igTarget )
504
523
} )
505
- } )
524
+ }
506
525
debug ( `ignoreTargets ${ ignoreTargets } ` )
507
526
return ignoreTargets
508
527
}
0 commit comments