WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/Cache.js
@@ -14,11 +14,15 @@
/** @typedef {import("./WebpackError")} WebpackError */
/**
 * Cache validation token whose string representation identifies the build
 * inputs associated with a cached value.
 * @typedef {object} Etag
 * @property {() => string} toString
 */
/**
 * Completion callback used by cache operations that either fail with a
 * `WebpackError` or resolve with a typed result.
 * @template T
 * @callback CallbackCache
 * @param {WebpackError | null} err
@@ -29,6 +33,8 @@
/** @typedef {EXPECTED_ANY} Data */
/**
 * Handler invoked after a cache read succeeds so additional cache layers can
 * react to the retrieved value.
 * @template T
 * @callback GotHandler
 * @param {T} result
@@ -37,6 +43,8 @@
 */
/**
 * Creates a callback wrapper that waits for a fixed number of completions and
 * forwards the first error immediately.
 * @param {number} times times
 * @param {(err?: Error | null) => void} callback callback
 * @returns {(err?: Error | null) => void} callback
@@ -51,7 +59,14 @@
   }
};
/**
 * Abstract cache interface backed by tapable hooks for reading, writing, idle
 * transitions, and shutdown across webpack cache implementations.
 */
class Cache {
   /**
    * Initializes the cache lifecycle hooks implemented by cache backends.
    */
   constructor() {
      this.hooks = {
         /** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler<EXPECTED_ANY>[]], Data>} */
@@ -70,6 +85,8 @@
   }
   /**
    * Retrieves a cached value and lets registered `gotHandlers` observe the
    * result before the caller receives it.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -103,6 +120,8 @@
   }
   /**
    * Stores a cache entry for the identifier and etag through the registered
    * cache backend hooks.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -120,7 +139,8 @@
   }
   /**
    * After this method has succeeded the cache can only be restored when build dependencies are
    * Persists the set of build dependencies required to determine whether the
    * cache can be restored in a future compilation.
    * @param {Iterable<string>} dependencies list of all build dependencies
    * @param {CallbackCache<void>} callback signals when the dependencies are stored
    * @returns {void}
@@ -133,6 +153,8 @@
   }
   /**
    * Signals that webpack is entering an idle phase and cache backends may flush
    * or compact pending work.
    * @returns {void}
    */
   beginIdle() {
@@ -140,6 +162,8 @@
   }
   /**
    * Signals that webpack is leaving the idle phase and waits for cache
    * backends to finish any asynchronous resume work.
    * @param {CallbackCache<void>} callback signals when the call finishes
    * @returns {void}
    */
@@ -150,6 +174,7 @@
   }
   /**
    * Shuts down every registered cache backend and waits for cleanup to finish.
    * @param {CallbackCache<void>} callback signals when the call finishes
    * @returns {void}
    */