WXL
4 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/CacheFacade.js
@@ -13,9 +13,10 @@
/** @typedef {import("./Cache")} Cache */
/** @typedef {import("./Cache").Etag} Etag */
/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */
/** @typedef {typeof import("./util/Hash")} HashConstructor */
/** @typedef {import("./util/Hash").HashFunction} HashFunction */
/**
 * Defines the callback cache callback.
 * @template T
 * @callback CallbackCache
 * @param {(Error | null)=} err
@@ -24,6 +25,7 @@
 */
/**
 * Defines the callback normal error cache callback.
 * @template T
 * @callback CallbackNormalErrorCache
 * @param {(Error | null)=} err
@@ -33,6 +35,7 @@
class MultiItemCache {
   /**
    * Creates an instance of MultiItemCache.
    * @param {ItemCacheFacade[]} items item caches
    */
   constructor(items) {
@@ -43,6 +46,7 @@
   }
   /**
    * Returns value.
    * @template T
    * @param {CallbackCache<T>} callback signals when the value is retrieved
    * @returns {void}
@@ -52,11 +56,13 @@
   }
   /**
    * Returns promise with the data.
    * @template T
    * @returns {Promise<T>} promise with the data
    */
   getPromise() {
      /**
       * Returns promise with the data.
       * @param {number} i index
       * @returns {Promise<T>} promise with the data
       */
@@ -69,6 +75,7 @@
   }
   /**
    * Processes the provided data.
    * @template T
    * @param {T} data the value to store
    * @param {CallbackCache<void>} callback signals when the value is stored
@@ -83,6 +90,7 @@
   }
   /**
    * Stores the provided data.
    * @template T
    * @param {T} data the value to store
    * @returns {Promise<void>} promise signals when the value is stored
@@ -96,6 +104,7 @@
class ItemCacheFacade {
   /**
    * Creates an instance of ItemCacheFacade.
    * @param {Cache} cache the root cache
    * @param {string} name the child cache item name
    * @param {Etag | null} etag the etag
@@ -107,6 +116,7 @@
   }
   /**
    * Returns value.
    * @template T
    * @param {CallbackCache<T>} callback signals when the value is retrieved
    * @returns {void}
@@ -116,6 +126,7 @@
   }
   /**
    * Returns promise with the data.
    * @template T
    * @returns {Promise<T>} promise with the data
    */
@@ -132,6 +143,7 @@
   }
   /**
    * Processes the provided data.
    * @template T
    * @param {T} data the value to store
    * @param {CallbackCache<void>} callback signals when the value is stored
@@ -142,6 +154,7 @@
   }
   /**
    * Stores the provided data.
    * @template T
    * @param {T} data the value to store
    * @returns {Promise<void>} promise signals when the value is stored
@@ -159,6 +172,7 @@
   }
   /**
    * Processes the provided computer.
    * @template T
    * @param {(callback: CallbackNormalErrorCache<T>) => void} computer function to compute the value if not cached
    * @param {CallbackNormalErrorCache<T>} callback signals when the value is retrieved
@@ -179,6 +193,7 @@
   }
   /**
    * Returns promise with the data.
    * @template T
    * @param {() => Promise<T> | T} computer function to compute the value if not cached
    * @returns {Promise<T>} promise with the data
@@ -194,9 +209,10 @@
class CacheFacade {
   /**
    * Creates an instance of CacheFacade.
    * @param {Cache} cache the root cache
    * @param {string} name the child cache name
    * @param {(string | HashConstructor)=} hashFunction the hash function to use
    * @param {HashFunction=} hashFunction the hash function to use
    */
   constructor(cache, name, hashFunction) {
      this._cache = cache;
@@ -205,6 +221,7 @@
   }
   /**
    * Returns child cache.
    * @param {string} name the child cache name#
    * @returns {CacheFacade} child cache
    */
@@ -217,6 +234,7 @@
   }
   /**
    * Returns item cache.
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
    * @returns {ItemCacheFacade} item cache
@@ -230,6 +248,7 @@
   }
   /**
    * Gets lazy hashed etag.
    * @param {HashableObject} obj an hashable object
    * @returns {Etag} an etag that is lazy hashed
    */
@@ -238,6 +257,7 @@
   }
   /**
    * Merges the provided values into a single result.
    * @param {Etag} a an etag
    * @param {Etag} b another etag
    * @returns {Etag} an etag that represents both
@@ -247,6 +267,7 @@
   }
   /**
    * Returns value.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -258,6 +279,7 @@
   }
   /**
    * Returns promise with the data.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -276,6 +298,7 @@
   }
   /**
    * Processes the provided identifier.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -288,6 +311,7 @@
   }
   /**
    * Stores the provided identifier.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -307,6 +331,7 @@
   }
   /**
    * Processes the provided identifier.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag
@@ -329,6 +354,7 @@
   }
   /**
    * Returns promise with the data.
    * @template T
    * @param {string} identifier the cache identifier
    * @param {Etag | null} etag the etag