From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送
---
node_modules/webpack/lib/cache/getLazyHashedEtag.js | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/node_modules/webpack/lib/cache/getLazyHashedEtag.js b/node_modules/webpack/lib/cache/getLazyHashedEtag.js
index 963b917..cdb9afb 100644
--- a/node_modules/webpack/lib/cache/getLazyHashedEtag.js
+++ b/node_modules/webpack/lib/cache/getLazyHashedEtag.js
@@ -10,24 +10,31 @@
/** @typedef {import("../util/Hash")} Hash */
/** @typedef {typeof import("../util/Hash")} HashConstructor */
+/** @typedef {import("../util/Hash").HashFunction} HashFunction */
/**
+ * Represents the lazy hashed etag runtime component.
* @typedef {object} HashableObject
* @property {(hash: Hash) => void} updateHash
*/
class LazyHashedEtag {
/**
+ * Creates an instance of LazyHashedEtag.
* @param {HashableObject} obj object with updateHash method
- * @param {string | HashConstructor} hashFunction the hash function to use
+ * @param {HashFunction} hashFunction the hash function to use
*/
constructor(obj, hashFunction = DEFAULTS.HASH_FUNCTION) {
+ /** @type {HashableObject} */
this._obj = obj;
+ /** @type {undefined | string} */
this._hash = undefined;
+ /** @type {HashFunction} */
this._hashFunction = hashFunction;
}
/**
+ * Returns a string representation.
* @returns {string} hash of object
*/
toString() {
@@ -40,23 +47,28 @@
}
}
-/** @type {Map<string | HashConstructor, WeakMap<HashableObject, LazyHashedEtag>>} */
+/** @typedef {WeakMap<HashableObject, LazyHashedEtag>} InnerCache */
+
+/** @type {Map<HashFunction, InnerCache>} */
const mapStrings = new Map();
-/** @type {WeakMap<HashConstructor, WeakMap<HashableObject, LazyHashedEtag>>} */
+/** @type {WeakMap<HashConstructor, InnerCache>} */
const mapObjects = new WeakMap();
/**
+ * Returns etag.
* @param {HashableObject} obj object with updateHash method
- * @param {(string | HashConstructor)=} hashFunction the hash function to use
+ * @param {HashFunction=} hashFunction the hash function to use
* @returns {LazyHashedEtag} etag
*/
const getter = (obj, hashFunction = DEFAULTS.HASH_FUNCTION) => {
+ /** @type {undefined | InnerCache} */
let innerMap;
if (typeof hashFunction === "string") {
innerMap = mapStrings.get(hashFunction);
if (innerMap === undefined) {
const newHash = new LazyHashedEtag(obj, hashFunction);
+ /** @type {InnerCache} */
innerMap = new WeakMap();
innerMap.set(obj, newHash);
mapStrings.set(hashFunction, innerMap);
@@ -66,6 +78,7 @@
innerMap = mapObjects.get(hashFunction);
if (innerMap === undefined) {
const newHash = new LazyHashedEtag(obj, hashFunction);
+ /** @type {InnerCache} */
innerMap = new WeakMap();
innerMap.set(obj, newHash);
mapObjects.set(hashFunction, innerMap);
--
Gitblit v1.9.3