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/hash/wasm-hash.js | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/node_modules/webpack/lib/util/hash/wasm-hash.js b/node_modules/webpack/lib/util/hash/wasm-hash.js
index 75e6be8..0a0a9bd 100644
--- a/node_modules/webpack/lib/util/hash/wasm-hash.js
+++ b/node_modules/webpack/lib/util/hash/wasm-hash.js
@@ -13,8 +13,18 @@
// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64
const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3;
+/**
+ * Represents the wasm hash runtime component.
+ * @typedef {object} WasmExports
+ * @property {WebAssembly.Memory} memory
+ * @property {() => void} init
+ * @property {(length: number) => void} update
+ * @property {(length: number) => void} final
+ */
+
class WasmHash extends Hash {
/**
+ * Creates an instance of WasmHash.
* @param {WebAssembly.Instance} instance wasm instance
* @param {WebAssembly.Instance[]} instancesPool pool of instances
* @param {number} chunkSize size of data chunks passed to wasm
@@ -23,13 +33,19 @@
constructor(instance, instancesPool, chunkSize, digestSize) {
super();
- const exports = /** @type {EXPECTED_ANY} */ (instance.exports);
+ const exports = /** @type {WasmExports} */ (instance.exports);
exports.init();
+ /** @type {WasmExports} */
this.exports = exports;
+ /** @type {Buffer} */
this.mem = Buffer.from(exports.memory.buffer, 0, 65536);
+ /** @type {number} */
this.buffered = 0;
+ /** @type {WebAssembly.Instance[]} */
this.instancesPool = instancesPool;
+ /** @type {number} */
this.chunkSize = chunkSize;
+ /** @type {number} */
this.digestSize = digestSize;
}
@@ -79,12 +95,14 @@
}
/**
+ * Update with short string.
* @param {string} data data
* @param {BufferEncoding=} encoding encoding
* @returns {void}
*/
_updateWithShortString(data, encoding) {
const { exports, buffered, mem, chunkSize } = this;
+ /** @type {number} */
let endPos;
if (data.length < 70) {
// eslint-disable-next-line unicorn/text-encoding-identifier-case
@@ -128,6 +146,7 @@
}
/**
+ * Update with buffer.
* @param {Buffer} data data
* @returns {void}
*/
@@ -191,6 +210,7 @@
}
/**
+ * Returns wasm hash.
* @param {WebAssembly.Module} wasmModule wasm module
* @param {WasmHash[]} instancesPool pool of instances
* @param {number} chunkSize size of data chunks passed to wasm
@@ -212,5 +232,6 @@
);
};
+create.MAX_SHORT_STRING = MAX_SHORT_STRING;
+
module.exports = create;
-module.exports.MAX_SHORT_STRING = MAX_SHORT_STRING;
--
Gitblit v1.9.3