@@ -106,14 +106,16 @@ function processPatterns(
106106
107107 const matchPatterns : string [ ] = [ ] ;
108108 const ignorePatterns : string [ ] = [ ] ;
109+ const unignorePatterns : string [ ] = [ ] ;
109110
110111 for ( const pattern of ignore ) {
111112 if ( ! pattern ) {
112113 continue ;
113114 }
114- // don't handle negated patterns here for consistency with fast-glob
115115 if ( pattern [ 0 ] !== '!' || pattern [ 1 ] === '(' ) {
116116 ignorePatterns . push ( normalizePattern ( pattern , expandDirectories , cwd , props , true ) ) ;
117+ } else {
118+ unignorePatterns . push ( pattern . slice ( 1 ) ) ;
117119 }
118120 }
119121
@@ -128,7 +130,7 @@ function processPatterns(
128130 }
129131 }
130132
131- return { match : matchPatterns , ignore : ignorePatterns } ;
133+ return { match : matchPatterns , ignore : ignorePatterns , unignore : unignorePatterns } ;
132134}
133135
134136// TODO: this is slow, find a better way to do this
@@ -182,10 +184,13 @@ function crawl(options: GlobOptions, cwd: string, sync: boolean) {
182184 log ( 'internal processing patterns:' , processed ) ;
183185 }
184186
187+ const unignoreMatcher = processed . unignore . length === 0 ? undefined : picomatch ( processed . unignore ) ;
188+
185189 const matcher = picomatch ( processed . match , {
186190 dot : options . dot ,
187191 nocase,
188- ignore : processed . ignore
192+ ignore : processed . ignore ,
193+ onIgnore : unignoreMatcher ? result => unignoreMatcher ( result . output ) : undefined
189194 } ) ;
190195
191196 const ignore = picomatch ( processed . ignore , {
0 commit comments