9
9
import * as fs from 'fs' ;
10
10
import * as path from 'path' ;
11
11
import { EventEmitter } from 'events' ;
12
- import anymatch from 'anymatch' ;
13
- import { some as micromatchSome } from 'micromatch' ;
12
+ import anymatch , { Matcher } from 'anymatch' ;
13
+ import micromatch from 'micromatch' ;
14
14
// eslint-disable-next-line
15
15
import { Watcher } from 'fsevents' ;
16
16
// @ts -ignore no types
@@ -40,7 +40,7 @@ type FsEventsWatcherEvent =
40
40
*/
41
41
class FSEventsWatcher extends EventEmitter {
42
42
public readonly root : string ;
43
- public readonly ignored ?: anymatch . Matcher ;
43
+ public readonly ignored ?: Matcher ;
44
44
public readonly glob : Array < string > ;
45
45
public readonly dot : boolean ;
46
46
public readonly hasIgnore : boolean ;
@@ -65,7 +65,7 @@ class FSEventsWatcher extends EventEmitter {
65
65
fileCallback : ( normalizedPath : string , stats : fs . Stats ) => void ,
66
66
endCallback : Function ,
67
67
errorCallback : Function ,
68
- ignored ?: anymatch . Matcher ,
68
+ ignored ?: Matcher ,
69
69
) {
70
70
walker ( dir )
71
71
. filterDir (
@@ -83,7 +83,7 @@ class FSEventsWatcher extends EventEmitter {
83
83
dir : string ,
84
84
opts : {
85
85
root : string ;
86
- ignored ?: anymatch . Matcher ;
86
+ ignored ?: Matcher ;
87
87
glob : string | Array < string > ;
88
88
dot : boolean ;
89
89
} ,
@@ -139,8 +139,8 @@ class FSEventsWatcher extends EventEmitter {
139
139
return false ;
140
140
}
141
141
return this . glob . length
142
- ? micromatchSome ( relativePath , this . glob , { dot : this . dot } )
143
- : this . dot || micromatchSome ( relativePath , '**/*' ) ;
142
+ ? micromatch ( [ relativePath ] , this . glob , { dot : this . dot } ) . length > 0
143
+ : this . dot || micromatch ( [ relativePath ] , '**/*' ) . length > 0 ;
144
144
}
145
145
146
146
private handleEvent ( filepath : string ) {
0 commit comments