WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/Watching.js
@@ -15,8 +15,10 @@
/** @typedef {import("./logging/Logger").Logger} Logger */
/** @typedef {import("./util/fs").TimeInfoEntries} TimeInfoEntries */
/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */
/** @typedef {import("./util/fs").Watcher} Watcher */
/**
 * Defines the callback type used by this module.
 * @template T
 * @template [R=void]
 * @typedef {import("./webpack").Callback<T, R>} Callback
@@ -26,13 +28,16 @@
class Watching {
   /**
    * Creates an instance of Watching.
    * @param {Compiler} compiler the compiler
    * @param {WatchOptions} watchOptions options
    * @param {Callback<Stats>} handler completion handler
    */
   constructor(compiler, watchOptions, handler) {
      /** @type {null | number} */
      this.startTime = null;
      this.invalid = false;
      /** @type {Callback<Stats>} */
      this.handler = handler;
      /** @type {ErrorCallback[]} */
      this.callbacks = [];
@@ -64,7 +69,9 @@
      this._initial = true;
      this._invalidReported = true;
      this._needRecords = true;
      /** @type {undefined | null | Watcher} */
      this.watcher = undefined;
      /** @type {undefined | null | Watcher} */
      this.pausedWatcher = undefined;
      /** @type {CollectedFiles | undefined} */
      this._collectedChangedFiles = undefined;
@@ -77,6 +84,7 @@
   }
   /**
    * Merge with collected.
    * @param {ReadonlySet<string> | undefined | null} changedFiles changed files
    * @param {ReadonlySet<string> | undefined | null} removedFiles removed files
    */
@@ -100,6 +108,7 @@
   }
   /**
    * Processes the provided file time info entries.
    * @param {TimeInfoEntries=} fileTimeInfoEntries info for files
    * @param {TimeInfoEntries=} contextTimeInfoEntries info for directories
    * @param {ReadonlySet<string>=} changedFiles changed files
@@ -178,6 +187,7 @@
         this.compiler.hooks.watchRun.callAsync(this.compiler, (err) => {
            if (err) return this._done(err);
            /**
             * Processes the provided err.
             * @param {Error | null} err error
             * @param {Compilation=} _compilation compilation
             * @returns {void}
@@ -237,6 +247,7 @@
   }
   /**
    * Returns the compilation stats.
    * @param {Compilation} compilation the compilation
    * @returns {Stats} the compilation stats
    */
@@ -246,6 +257,7 @@
   }
   /**
    * Processes the provided err.
    * @param {(Error | null)=} err an optional error
    * @param {Compilation=} compilation the compilation
    * @returns {void}
@@ -261,6 +273,7 @@
      let stats;
      /**
       * Processes the provided err.
       * @param {Error} err error
       * @param {ErrorCallback[]=} cbs callbacks
       */
@@ -344,6 +357,7 @@
   }
   /**
    * Processes the provided file.
    * @param {Iterable<string>} files watched files
    * @param {Iterable<string>} dirs watched directories
    * @param {Iterable<string>} missing watched existence entries
@@ -393,6 +407,7 @@
   }
   /**
    * Processes the provided error callback.
    * @param {ErrorCallback=} callback signals when the build has completed again
    * @returns {void}
    */
@@ -409,6 +424,7 @@
   }
   /**
    * Processes the provided file time info entries.
    * @param {TimeInfoEntries=} fileTimeInfoEntries info for files
    * @param {TimeInfoEntries=} contextTimeInfoEntries info for directories
    * @param {ReadonlySet<string>=} changedFiles changed files
@@ -451,6 +467,7 @@
   }
   /**
    * Processes the provided error callback.
    * @param {ErrorCallback} callback signals when the watcher is closed
    * @returns {void}
    */
@@ -462,6 +479,7 @@
         return;
      }
      /**
       * Processes the provided err.
       * @param {WebpackError | null} err error if any
       * @param {Compilation=} compilation compilation if any
       */
@@ -476,6 +494,7 @@
         this.compiler.contextTimestamps = undefined;
         this.compiler.fsStartTime = undefined;
         /**
          * Processes the provided err.
          * @param {WebpackError | null} err error if any
          */
         const shutdown = (err) => {