From 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 21 四月 2026 11:46:41 +0800
Subject: [PATCH] 推送

---
 node_modules/webpack/lib/util/LazySet.js |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/node_modules/webpack/lib/util/LazySet.js b/node_modules/webpack/lib/util/LazySet.js
index 87d6327..2aa178f 100644
--- a/node_modules/webpack/lib/util/LazySet.js
+++ b/node_modules/webpack/lib/util/LazySet.js
@@ -8,6 +8,7 @@
 const makeSerializable = require("./makeSerializable");
 
 /**
+ * Merges every queued iterable directly into the concrete backing set.
  * @template T
  * @param {Set<T>} targetSet set where items should be added
  * @param {Set<Iterable<T>>} toMerge iterables to be merged
@@ -22,6 +23,8 @@
 };
 
 /**
+ * Flattens nested `LazySet` instances into a single collection of iterables
+ * that can later be merged into the backing set.
  * @template T
  * @param {Set<Iterable<T>>} targetSet set where iterables should be added
  * @param {LazySet<T>[]} toDeepMerge lazy sets to be flattened
@@ -40,6 +43,7 @@
 };
 
 /**
+ * Defines the set iterator type used by this module.
  * @template T
  * @typedef {import("typescript-iterable").SetIterator<T>} SetIterator
  */
@@ -52,6 +56,8 @@
  */
 class LazySet {
 	/**
+	 * Seeds the set with an optional iterable while preparing internal queues for
+	 * deferred merges.
 	 * @param {Iterable<T>=} iterable init iterable
 	 */
 	constructor(iterable) {
@@ -65,11 +71,17 @@
 		this._deopt = false;
 	}
 
+	/**
+	 * Flattens any nested lazy sets that were queued for merging.
+	 */
 	_flatten() {
 		flatten(this._toMerge, this._toDeepMerge);
 		this._toDeepMerge.length = 0;
 	}
 
+	/**
+	 * Materializes all deferred additions into the backing set.
+	 */
 	_merge() {
 		this._flatten();
 		merge(this._set, this._toMerge);
@@ -77,6 +89,10 @@
 		this._needMerge = false;
 	}
 
+	/**
+	 * Reports whether the set is empty without forcing a full merge.
+	 * @returns {boolean} true when no items have been stored or queued
+	 */
 	_isEmpty() {
 		return (
 			this._set.size === 0 &&
@@ -85,12 +101,17 @@
 		);
 	}
 
+	/**
+	 * Returns the number of items after applying any deferred merges.
+	 * @returns {number} number of items in the set
+	 */
 	get size() {
 		if (this._needMerge) this._merge();
 		return this._set.size;
 	}
 
 	/**
+	 * Adds a single item immediately to the concrete backing set.
 	 * @param {T} item an item
 	 * @returns {LazySet<T>} itself
 	 */
@@ -100,6 +121,8 @@
 	}
 
 	/**
+	 * Queues another iterable or lazy set for later merging so large bulk adds
+	 * can stay cheap until the set is read.
 	 * @param {Iterable<T> | LazySet<T>} iterable a immutable iterable or another immutable LazySet which will eventually be merged into the Set
 	 * @returns {LazySet<T>} itself
 	 */
@@ -126,6 +149,9 @@
 		return this;
 	}
 
+	/**
+	 * Removes all items and clears every deferred merge queue.
+	 */
 	clear() {
 		this._set.clear();
 		this._toMerge.clear();
@@ -135,6 +161,8 @@
 	}
 
 	/**
+	 * Deletes an item after first materializing any deferred additions that may
+	 * contain it.
 	 * @param {T} value an item
 	 * @returns {boolean} true, if the value was in the Set before
 	 */
@@ -144,6 +172,8 @@
 	}
 
 	/**
+	 * Returns the set's entry iterator and permanently switches future
+	 * operations to eager merge mode to preserve iterator correctness.
 	 * @returns {SetIterator<[T, T]>} entries
 	 */
 	entries() {
@@ -153,6 +183,8 @@
 	}
 
 	/**
+	 * Iterates over every item after forcing pending merges and switching to
+	 * eager mode for correctness during iteration.
 	 * @template K
 	 * @param {(value: T, value2: T, set: Set<T>) => void} callbackFn function called for each entry
 	 * @param {K} thisArg this argument for the callbackFn
@@ -166,6 +198,7 @@
 	}
 
 	/**
+	 * Checks whether an item is present after applying any deferred merges.
 	 * @param {T} item an item
 	 * @returns {boolean} true, when the item is in the Set
 	 */
@@ -175,6 +208,7 @@
 	}
 
 	/**
+	 * Returns the key iterator, eagerly materializing pending merges first.
 	 * @returns {SetIterator<T>} keys
 	 */
 	keys() {
@@ -184,6 +218,7 @@
 	}
 
 	/**
+	 * Returns the value iterator, eagerly materializing pending merges first.
 	 * @returns {SetIterator<T>} values
 	 */
 	values() {
@@ -193,6 +228,7 @@
 	}
 
 	/**
+	 * Returns the default iterator over values after forcing pending merges.
 	 * @returns {SetIterator<T>} iterable iterator
 	 */
 	[Symbol.iterator]() {
@@ -207,6 +243,8 @@
 	}
 
 	/**
+	 * Serializes the fully materialized set contents into webpack's object
+	 * serialization stream.
 	 * @param {import("../serialization/ObjectMiddleware").ObjectSerializerContext} context context
 	 */
 	serialize({ write }) {
@@ -216,12 +254,14 @@
 	}
 
 	/**
+	 * Restores a `LazySet` from serialized item data.
 	 * @template T
 	 * @param {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} context context
 	 * @returns {LazySet<T>} lazy set
 	 */
 	static deserialize({ read }) {
 		const count = read();
+		/** @type {T[]} */
 		const items = [];
 		for (let i = 0; i < count; i++) {
 			items.push(read());

--
Gitblit v1.9.3