@@ -32,19 +32,20 @@ function watch() {
32
32
var dirs = [ ] . slice . call ( config . dirs ) ;
33
33
34
34
debugRoot ( 'start watch on: %s' , dirs . join ( ', ' ) ) ;
35
- debugRoot ( 'ignore dirs regex(%s)' , config . options . ignore . re ) ;
35
+ const rootIgnored = config . options . ignore ;
36
+ debugRoot ( 'ignored' , rootIgnored ) ;
36
37
37
38
var promises = [ ] ;
38
39
var watchedFiles = [ ] ;
39
40
40
41
dirs . forEach ( function ( dir ) {
41
42
var promise = new Promise ( function ( resolve ) {
42
- var ignored = config . options . ignore . re ;
43
- var dotFilePattern = / [ \/ \\ ] \. / ;
43
+ var dotFilePattern = / [ / \\ ] \. / ;
44
+ var ignored = Array . from ( rootIgnored ) ;
44
45
45
46
// don't ignore dotfiles if explicitly watched.
46
47
if ( ! dir . match ( dotFilePattern ) ) {
47
- ignored = [ ignored , dotFilePattern ] ;
48
+ ignored . push ( dotFilePattern ) ;
48
49
}
49
50
50
51
var watchOptions = {
@@ -62,7 +63,8 @@ function watch() {
62
63
watchOptions . useFsEvents = false ;
63
64
}
64
65
65
- var watcher = chokidar . watch ( dir ,
66
+ var watcher = chokidar . watch (
67
+ dir ,
66
68
Object . assign ( { } , watchOptions , config . watchOptions || { } )
67
69
) ;
68
70
@@ -89,9 +91,11 @@ function watch() {
89
91
90
92
watcher . on ( 'error' , function ( error ) {
91
93
if ( error . code === 'EINVAL' ) {
92
- utils . log . error ( 'Internal watch failed. Likely cause: too many ' +
94
+ utils . log . error (
95
+ 'Internal watch failed. Likely cause: too many ' +
93
96
'files being watched (perhaps from the root of a drive?\n' +
94
- 'See https://github.com/paulmillr/chokidar/issues/229 for details' ) ;
97
+ 'See https://github.com/paulmillr/chokidar/issues/229 for details'
98
+ ) ;
95
99
} else {
96
100
utils . log . error ( 'Internal watch failed: ' + error . message ) ;
97
101
process . exit ( 1 ) ;
@@ -128,10 +132,14 @@ function filterAndRestart(files) {
128
132
}
129
133
130
134
var cwd = process . cwd ( ) ;
131
- utils . log . detail ( 'files triggering change check: ' +
132
- files . map ( function ( file ) {
133
- return path . relative ( cwd , file ) ;
134
- } ) . join ( ', ' ) ) ;
135
+ utils . log . detail (
136
+ 'files triggering change check: ' +
137
+ files
138
+ . map ( function ( file ) {
139
+ return path . relative ( cwd , file ) ;
140
+ } )
141
+ . join ( ', ' )
142
+ ) ;
135
143
136
144
var matched = match (
137
145
files ,
@@ -150,15 +158,17 @@ function filterAndRestart(files) {
150
158
matched = {
151
159
result : [ file ] ,
152
160
total : 1 ,
153
- }
161
+ } ;
154
162
return true ;
155
163
}
156
- } )
164
+ } ) ;
157
165
}
158
166
}
159
167
160
- utils . log . detail ( 'changes after filters (before/after): ' +
161
- [ files . length , matched . result . length ] . join ( '/' ) ) ;
168
+ utils . log . detail (
169
+ 'changes after filters (before/after): ' +
170
+ [ files . length , matched . result . length ] . join ( '/' )
171
+ ) ;
162
172
163
173
// reset the last check so we're only looking at recently modified files
164
174
config . lastStarted = Date . now ( ) ;
@@ -177,7 +187,6 @@ function filterAndRestart(files) {
177
187
}
178
188
}
179
189
180
-
181
190
function restartBus ( matched ) {
182
191
utils . log . status ( 'restarting due to changes...' ) ;
183
192
matched . result . map ( function ( file ) {
0 commit comments