@@ -178,37 +178,34 @@ export function buildUpdate(event: string, filePath: string, context: BuildConte
178
178
}
179
179
180
180
export function queueWatchUpdatesForBuild ( event : string , filePath : string , context : BuildContext ) {
181
- if ( queuedWatchEventsMap . get ( filePath ) ) {
182
-
183
- const changedFile : ChangedFile = {
184
- event : event ,
185
- filePath : filePath ,
186
- ext : extname ( filePath ) . toLowerCase ( )
187
- } ;
181
+ const changedFile : ChangedFile = {
182
+ event : event ,
183
+ filePath : filePath ,
184
+ ext : extname ( filePath ) . toLowerCase ( )
185
+ } ;
188
186
189
- queuedWatchEventsMap . set ( filePath , changedFile ) ;
187
+ queuedWatchEventsMap . set ( filePath , changedFile ) ;
190
188
191
- // debounce our build update incase there are multiple files
192
- clearTimeout ( queuedWatchEventsTimerId ) ;
189
+ // debounce our build update incase there are multiple files
190
+ clearTimeout ( queuedWatchEventsTimerId ) ;
193
191
194
- // run this code in a few milliseconds if another hasn't come in behind it
195
- queuedWatchEventsTimerId = setTimeout ( ( ) => {
192
+ // run this code in a few milliseconds if another hasn't come in behind it
193
+ queuedWatchEventsTimerId = setTimeout ( ( ) => {
196
194
197
- // figure out what actually needs to be rebuilt
198
- const queuedChangeFileList : ChangedFile [ ] = [ ] ;
199
- queuedWatchEventsMap . forEach ( changedFile => queuedChangeFileList . push ( changedFile ) ) ;
195
+ // figure out what actually needs to be rebuilt
196
+ const queuedChangeFileList : ChangedFile [ ] = [ ] ;
197
+ queuedWatchEventsMap . forEach ( changedFile => queuedChangeFileList . push ( changedFile ) ) ;
200
198
201
- const changedFiles = runBuildUpdate ( context , queuedChangeFileList ) ;
199
+ const changedFiles = runBuildUpdate ( context , queuedChangeFileList ) ;
202
200
203
- // clear out all the files that are queued up for the build update
204
- queuedWatchEventsMap . clear ( ) ;
201
+ // clear out all the files that are queued up for the build update
202
+ queuedWatchEventsMap . clear ( ) ;
205
203
206
- if ( changedFiles && changedFiles . length ) {
207
- // cool, we've got some build updating to do ;)
208
- buildTask . buildUpdate ( changedFiles , context ) ;
209
- }
210
- } , BUILD_UPDATE_DEBOUNCE_MS ) ;
211
- }
204
+ if ( changedFiles && changedFiles . length ) {
205
+ // cool, we've got some build updating to do ;)
206
+ queueOrRunBuildUpdate ( changedFiles , context ) ;
207
+ }
208
+ } , BUILD_UPDATE_DEBOUNCE_MS ) ;
212
209
213
210
return Promise . resolve ( ) ;
214
211
}
0 commit comments