@@ -48,6 +48,7 @@ export class Walker<TOutput extends Output> {
4848 ) ,
4949 symlinks : new Map ( ) ,
5050 visited : [ "" ] . slice ( 0 , 0 ) ,
51+ controller : new AbortController ( ) ,
5152 } ;
5253
5354 /*
@@ -65,6 +66,7 @@ export class Walker<TOutput extends Output> {
6566 }
6667
6768 start ( ) : TOutput | null {
69+ this . pushDirectory ( this . root , this . state . paths , this . state . options . filters ) ;
6870 this . walkDirectory (
6971 this . state ,
7072 this . root ,
@@ -88,13 +90,16 @@ export class Walker<TOutput extends Output> {
8890 useRealPaths,
8991 pathSeparator,
9092 } ,
93+ controller,
9194 } = this . state ;
9295
93- if ( ( signal && signal . aborted ) || ( maxFiles && paths . length > maxFiles ) )
96+ if (
97+ controller . signal . aborted ||
98+ ( signal && signal . aborted ) ||
99+ ( maxFiles && paths . length > maxFiles )
100+ )
94101 return ;
95102
96- this . pushDirectory ( directoryPath , paths , filters ) ;
97-
98103 const files = this . getArray ( this . state . paths ) ;
99104 for ( let i = 0 ; i < entries . length ; ++ i ) {
100105 const entry = entries [ i ] ;
@@ -112,8 +117,9 @@ export class Walker<TOutput extends Output> {
112117 this . state . options . pathSeparator
113118 ) ;
114119 if ( exclude && exclude ( entry . name , path ) ) continue ;
120+ this . pushDirectory ( path , paths , filters ) ;
115121 this . walkDirectory ( this . state , path , path , depth - 1 , this . walk ) ;
116- } else if ( entry . isSymbolicLink ( ) && this . resolveSymlink ) {
122+ } else if ( this . resolveSymlink && entry . isSymbolicLink ( ) ) {
117123 let path = joinPath . joinPathWithBasePath ( entry . name , directoryPath ) ;
118124 this . resolveSymlink ( path , this . state , ( stat , resolvedPath ) => {
119125 if ( stat . isDirectory ( ) ) {
0 commit comments