MCPcopy
hub / github.com/webpack/webpack / watch

Method watch

lib/Watching.js:374–415  ·  lib/Watching.js::Watching.watch

* Processes the provided file. * @param {Iterable<string>} files watched files * @param {Iterable<string>} dirs watched directories * @param {Iterable<string>} missing watched existence entries * @returns {void}

(files, dirs, missing)

Source from the content-addressed store, hash-verified

372 * @returns {void}
373 */
374 watch(files, dirs, missing) {
375 this.pausedWatcher = null;
376 this.watcher =
377 /** @type {WatchFileSystem} */
378 (this.compiler.watchFileSystem).watch(
379 files,
380 dirs,
381 missing,
382 /** @type {number} */ (this.lastWatcherStartTime),
383 this.watchOptions,
384 (
385 err,
386 fileTimeInfoEntries,
387 contextTimeInfoEntries,
388 changedFiles,
389 removedFiles
390 ) => {
391 if (err) {
392 this.compiler.modifiedFiles = undefined;
393 this.compiler.removedFiles = undefined;
394 this.compiler.fileTimestamps = undefined;
395 this.compiler.contextTimestamps = undefined;
396 this.compiler.fsStartTime = undefined;
397 return this.handler(err);
398 }
399 this._invalidate(
400 fileTimeInfoEntries,
401 contextTimeInfoEntries,
402 changedFiles,
403 removedFiles
404 );
405 this._onChange();
406 },
407 (fileName, changeTime) => {
408 if (!this._invalidReported) {
409 this._invalidReported = true;
410 this.compiler.hooks.invalid.call(fileName, changeTime);
411 }
412 this._onInvalid();
413 }
414 );
415 }
416
417 /**
418 * Processes the provided error callback.

Callers 13

_doneMethod · 0.95
webpackFunction · 0.45
WatchClose.test.jsFile · 0.45
runWatchFunction · 0.45
step1Function · 0.45
createStatsFunction · 0.45
Compiler.test.jsFile · 0.45
describeCasesFunction · 0.45

Calls 3

_invalidateMethod · 0.95
handlerMethod · 0.45
callMethod · 0.45

Tested by 2

step1Function · 0.36
createStatsFunction · 0.36