@@ -480,29 +480,48 @@ export function splitLocaleMessages (
480480 return { sfc : messages , external : metaExternalLocaleMessages }
481481}
482482
483- export function getIgnore ( target :string , ignoreFileNames : string ) : Ignore {
483+ export function getIgnore ( target :string , ignoreFileNames : string , ignoreMultipleMode = false ) : Ignore {
484484 const ig = ignore ( )
485485 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 )
489492 returnIgnoreInstance ( ig , ignoreFiles )
490493 } )
491494 return ig
492495}
493496
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 [ ] {
497498 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' )
500516 . split ( / \r ? \n / g)
517+ . filter ( line => line . trim ( ) && ! line . trim ( ) . startsWith ( '#' ) )
501518 . filter ( Boolean )
502519 . forEach ( ignoreTarget => {
503- ignoreTargets . push ( formatPath ( ignoreFile , ignoreTarget ) )
520+ const igTarget = path . join ( target , ignoreTarget )
521+ debug ( 'ignore target' , igTarget )
522+ ignoreTargets . push ( igTarget )
504523 } )
505- } )
524+ }
506525 debug ( `ignoreTargets ${ ignoreTargets } ` )
507526 return ignoreTargets
508527}
0 commit comments