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/util/WeakTupleMap.js | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/node_modules/webpack/lib/util/WeakTupleMap.js b/node_modules/webpack/lib/util/WeakTupleMap.js
index 976c287..5a4d55f 100644
--- a/node_modules/webpack/lib/util/WeakTupleMap.js
+++ b/node_modules/webpack/lib/util/WeakTupleMap.js
@@ -6,33 +6,44 @@
"use strict";
/**
+ * Strong-key child map used for tuple elements that cannot be stored in a
+ * `WeakMap`.
* @template {EXPECTED_ANY[]} T
* @template V
* @typedef {Map<EXPECTED_ANY, WeakTupleMap<T, V>>} M
*/
/**
+ * Weak-key child map used for tuple elements that are objects and can be held
+ * without preventing garbage collection.
* @template {EXPECTED_ANY[]} T
* @template V
* @typedef {WeakMap<EXPECTED_OBJECT, WeakTupleMap<T, V>>} W
*/
/**
+ * Reports whether a tuple element can be stored in a `WeakMap`.
* @param {EXPECTED_ANY} thing thing
* @returns {boolean} true if is weak
*/
const isWeakKey = (thing) => typeof thing === "object" && thing !== null;
/**
+ * Extracts the element type from a tuple-like array.
* @template {unknown[]} T
* @typedef {T extends ReadonlyArray<infer ElementType> ? ElementType : never} ArrayElement
*/
/**
+ * Stores values by tuple keys while using `WeakMap` for object elements so the
+ * cache can release entries when those objects are collected.
* @template {EXPECTED_ANY[]} K
* @template V
*/
class WeakTupleMap {
+ /**
+ * Initializes an empty tuple trie node with optional value and child maps.
+ */
constructor() {
/** @private */
this.f = 0;
@@ -54,6 +65,7 @@
}
/**
+ * Stores a value at the node identified by the provided tuple key.
* @param {[...K, V]} args tuple
* @returns {void}
*/
@@ -67,6 +79,7 @@
}
/**
+ * Checks whether the exact tuple key has a stored value.
* @param {K} args tuple
* @returns {boolean} true, if the tuple is in the Set
*/
@@ -81,6 +94,7 @@
}
/**
+ * Returns the value stored for the exact tuple key, if any.
* @param {K} args tuple
* @returns {V | undefined} the value
*/
@@ -95,6 +109,8 @@
}
/**
+ * Returns an existing value for the tuple or computes, stores, and returns a
+ * new one when the tuple is missing.
* @param {[...K, (...args: K) => V]} args tuple
* @returns {V} the value
*/
@@ -112,6 +128,7 @@
}
/**
+ * Removes the value stored for the tuple key without pruning the trie.
* @param {K} args tuple
* @returns {void}
*/
@@ -126,6 +143,7 @@
}
/**
+ * Clears the stored value and all strong and weak child maps from this node.
* @returns {void}
*/
clear() {
@@ -135,15 +153,24 @@
this.m = undefined;
}
+ /**
+ * Returns the value stored directly on this trie node.
+ * @returns {V | undefined} stored value
+ */
_getValue() {
return this.v;
}
+ /**
+ * Reports whether this trie node currently stores a value.
+ * @returns {boolean} true when a value is present
+ */
_hasValue() {
return (this.f & 1) === 1;
}
/**
+ * Stores a value directly on this trie node.
* @param {V} v value
* @private
*/
@@ -152,12 +179,16 @@
this.v = v;
}
+ /**
+ * Removes the value stored directly on this trie node.
+ */
_deleteValue() {
this.f &= 6;
this.v = undefined;
}
/**
+ * Returns the child node for a tuple element without creating one.
* @param {ArrayElement<K>} thing thing
* @returns {WeakTupleMap<K, V> | undefined} thing
* @private
@@ -176,6 +207,8 @@
}
/**
+ * Returns the child node for a tuple element, creating and storing it when
+ * necessary.
* @private
* @param {ArrayElement<K>} thing thing
* @returns {WeakTupleMap<K, V>} value
--
Gitblit v1.9.3