MCPcopy
hub / github.com/webpack/webpack / finalCallback

Method finalCallback

lib/Watching.js:494–529  ·  view source on GitHub ↗
(err, compilation)

Source from the content-addressed store, hash-verified

492 * @param {Compilation=} compilation compilation if any
493 */
494 const finalCallback = (err, compilation) => {
495 this.running = false;
496 this.compiler.running = false;
497 this.compiler.watching = undefined;
498 this.compiler.watchMode = false;
499 this.compiler.modifiedFiles = undefined;
500 this.compiler.removedFiles = undefined;
501 this.compiler.fileTimestamps = undefined;
502 this.compiler.contextTimestamps = undefined;
503 this.compiler.fsStartTime = undefined;
504 /**
505 * Processes the provided err.
506 * @param {Error | null} err error if any
507 */
508 const shutdown = (err) => {
509 this.compiler.hooks.watchClose.call();
510 const closeCallbacks =
511 /** @type {ErrorCallback[]} */
512 (this._closeCallbacks);
513 this._closeCallbacks = undefined;
514 for (const cb of closeCallbacks) cb(err);
515 };
516 if (compilation) {
517 const logger = compilation.getLogger("webpack.Watching");
518 logger.time("storeBuildDependencies");
519 this.compiler.cache.storeBuildDependencies(
520 compilation.buildDependencies,
521 (err2) => {
522 logger.timeEnd("storeBuildDependencies");
523 shutdown(err || err2);
524 }
525 );
526 } else {
527 shutdown(err);
528 }
529 };
530
531 this.closed = true;
532 if (this.watcher) {

Callers

nothing calls this directly

Calls 4

timeMethod · 0.80
timeEndMethod · 0.80
getLoggerMethod · 0.65

Tested by

no test coverage detected