Update npm packages (73 packages including @jqhtml 2.3.36)
Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
64
node_modules/webpack/lib/optimize/RealContentHashPlugin.js
generated
vendored
64
node_modules/webpack/lib/optimize/RealContentHashPlugin.js
generated
vendored
@@ -20,6 +20,12 @@ const createHash = require("../util/createHash");
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {typeof import("../util/Hash")} Hash */
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../util/comparators").Comparator<T>} Comparator
|
||||
*/
|
||||
|
||||
/** @type {Hashes} */
|
||||
const EMPTY_SET = new Set();
|
||||
|
||||
/**
|
||||
@@ -47,6 +53,7 @@ const mapAndDeduplicateBuffers = (input, fn) => {
|
||||
// Buffer.equals compares size first so this should be efficient enough
|
||||
// If it becomes a performance problem we can use a map and group by size
|
||||
// instead of looping over all assets.
|
||||
/** @type {Buffer[]} */
|
||||
const result = [];
|
||||
outer: for (const value of input) {
|
||||
const buf = fn(value);
|
||||
@@ -65,6 +72,7 @@ const mapAndDeduplicateBuffers = (input, fn) => {
|
||||
*/
|
||||
const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
||||
|
||||
/** @type {WeakMap<Source, CachedSource>} */
|
||||
const cachedSourceMap = new WeakMap();
|
||||
|
||||
/**
|
||||
@@ -82,8 +90,6 @@ const toCachedSource = (source) => {
|
||||
return newSource;
|
||||
};
|
||||
|
||||
/** @typedef {Set<string>} OwnHashes */
|
||||
/** @typedef {Set<string>} ReferencedHashes */
|
||||
/** @typedef {Set<string>} Hashes */
|
||||
|
||||
/**
|
||||
@@ -94,10 +100,10 @@ const toCachedSource = (source) => {
|
||||
* @property {RawSource | undefined} newSource
|
||||
* @property {RawSource | undefined} newSourceWithoutOwn
|
||||
* @property {string} content
|
||||
* @property {OwnHashes | undefined} ownHashes
|
||||
* @property {Hashes | undefined} ownHashes
|
||||
* @property {Promise<void> | undefined} contentComputePromise
|
||||
* @property {Promise<void> | undefined} contentComputeWithoutOwnPromise
|
||||
* @property {ReferencedHashes | undefined} referencedHashes
|
||||
* @property {Hashes | undefined} referencedHashes
|
||||
* @property {Hashes} hashes
|
||||
*/
|
||||
|
||||
@@ -142,7 +148,9 @@ class RealContentHashPlugin {
|
||||
* @param {RealContentHashPluginOptions} options options
|
||||
*/
|
||||
constructor({ hashFunction, hashDigest }) {
|
||||
/** @type {HashFunction} */
|
||||
this._hashFunction = hashFunction;
|
||||
/** @type {HashDigest} */
|
||||
this._hashDigest = hashDigest;
|
||||
}
|
||||
|
||||
@@ -220,7 +228,9 @@ class RealContentHashPlugin {
|
||||
);
|
||||
[asset.referencedHashes, asset.ownHashes] =
|
||||
await cacheAnalyse.providePromise(name, etag, () => {
|
||||
/** @type {Hashes} */
|
||||
const referencedHashes = new Set();
|
||||
/** @type {Hashes} */
|
||||
const ownHashes = new Set();
|
||||
const inContent = content.match(hashRegExp);
|
||||
if (inContent) {
|
||||
@@ -238,15 +248,13 @@ class RealContentHashPlugin {
|
||||
);
|
||||
/**
|
||||
* @param {string} hash the hash
|
||||
* @returns {undefined | ReferencedHashes} the referenced hashes
|
||||
* @returns {undefined | Hashes} the referenced hashes
|
||||
*/
|
||||
const getDependencies = (hash) => {
|
||||
const assets = hashToAssets.get(hash);
|
||||
if (!assets) {
|
||||
const referencingAssets = assetsWithInfo.filter((asset) =>
|
||||
/** @type {ReferencedHashes} */ (asset.referencedHashes).has(
|
||||
hash
|
||||
)
|
||||
/** @type {Hashes} */ (asset.referencedHashes).has(hash)
|
||||
);
|
||||
const err = new WebpackError(`RealContentHashPlugin
|
||||
Some kind of unexpected caching problem occurred.
|
||||
@@ -264,16 +272,15 @@ ${referencingAssets
|
||||
compilation.errors.push(err);
|
||||
return;
|
||||
}
|
||||
/** @type {Hashes} */
|
||||
const hashes = new Set();
|
||||
for (const { referencedHashes, ownHashes } of assets) {
|
||||
if (!(/** @type {OwnHashes} */ (ownHashes).has(hash))) {
|
||||
for (const hash of /** @type {OwnHashes} */ (ownHashes)) {
|
||||
if (!(/** @type {Hashes} */ (ownHashes).has(hash))) {
|
||||
for (const hash of /** @type {Hashes} */ (ownHashes)) {
|
||||
hashes.add(hash);
|
||||
}
|
||||
}
|
||||
for (const hash of /** @type {ReferencedHashes} */ (
|
||||
referencedHashes
|
||||
)) {
|
||||
for (const hash of /** @type {Hashes} */ (referencedHashes)) {
|
||||
hashes.add(hash);
|
||||
}
|
||||
}
|
||||
@@ -290,7 +297,7 @@ ${referencingAssets
|
||||
(a) => a.name
|
||||
)})`;
|
||||
};
|
||||
/** @type {Set<string>} */
|
||||
/** @type {Hashes} */
|
||||
const hashesInOrder = new Set();
|
||||
for (const hash of hashToAssets.keys()) {
|
||||
/**
|
||||
@@ -329,7 +336,7 @@ ${referencingAssets
|
||||
cacheGenerate.mergeEtags(
|
||||
cacheGenerate.getLazyHashedEtag(asset.source),
|
||||
Array.from(
|
||||
/** @type {ReferencedHashes} */ (asset.referencedHashes),
|
||||
/** @type {Hashes} */ (asset.referencedHashes),
|
||||
(hash) => hashToNewHash.get(hash)
|
||||
).join("|")
|
||||
);
|
||||
@@ -341,10 +348,10 @@ ${referencingAssets
|
||||
if (asset.contentComputePromise) return asset.contentComputePromise;
|
||||
return (asset.contentComputePromise = (async () => {
|
||||
if (
|
||||
/** @type {OwnHashes} */ (asset.ownHashes).size > 0 ||
|
||||
[
|
||||
.../** @type {ReferencedHashes} */ (asset.referencedHashes)
|
||||
].some((hash) => hashToNewHash.get(hash) !== hash)
|
||||
/** @type {Hashes} */ (asset.ownHashes).size > 0 ||
|
||||
[.../** @type {Hashes} */ (asset.referencedHashes)].some(
|
||||
(hash) => hashToNewHash.get(hash) !== hash
|
||||
)
|
||||
) {
|
||||
const identifier = asset.name;
|
||||
const etag = getEtag(asset);
|
||||
@@ -372,10 +379,10 @@ ${referencingAssets
|
||||
}
|
||||
return (asset.contentComputeWithoutOwnPromise = (async () => {
|
||||
if (
|
||||
/** @type {OwnHashes} */ (asset.ownHashes).size > 0 ||
|
||||
[
|
||||
.../** @type {ReferencedHashes} */ (asset.referencedHashes)
|
||||
].some((hash) => hashToNewHash.get(hash) !== hash)
|
||||
/** @type {Hashes} */ (asset.ownHashes).size > 0 ||
|
||||
[.../** @type {Hashes} */ (asset.referencedHashes)].some(
|
||||
(hash) => hashToNewHash.get(hash) !== hash
|
||||
)
|
||||
) {
|
||||
const identifier = `${asset.name}|without-own`;
|
||||
const etag = getEtag(asset);
|
||||
@@ -387,7 +394,7 @@ ${referencingAssets
|
||||
hashRegExp,
|
||||
(hash) => {
|
||||
if (
|
||||
/** @type {OwnHashes} */
|
||||
/** @type {Hashes} */
|
||||
(asset.ownHashes).has(hash)
|
||||
) {
|
||||
return "";
|
||||
@@ -401,6 +408,7 @@ ${referencingAssets
|
||||
}
|
||||
})());
|
||||
};
|
||||
/** @type {Comparator<AssetInfoForRealContentHash>} */
|
||||
const comparator = compareSelect((a) => a.name, compareStrings);
|
||||
for (const oldHash of hashesInOrder) {
|
||||
const assets =
|
||||
@@ -409,13 +417,13 @@ ${referencingAssets
|
||||
assets.sort(comparator);
|
||||
await Promise.all(
|
||||
assets.map((asset) =>
|
||||
/** @type {OwnHashes} */ (asset.ownHashes).has(oldHash)
|
||||
/** @type {Hashes} */ (asset.ownHashes).has(oldHash)
|
||||
? computeNewContentWithoutOwn(asset)
|
||||
: computeNewContent(asset)
|
||||
)
|
||||
);
|
||||
const assetsContent = mapAndDeduplicateBuffers(assets, (asset) => {
|
||||
if (/** @type {OwnHashes} */ (asset.ownHashes).has(oldHash)) {
|
||||
if (/** @type {Hashes} */ (asset.ownHashes).has(oldHash)) {
|
||||
return asset.newSourceWithoutOwn
|
||||
? asset.newSourceWithoutOwn.buffer()
|
||||
: asset.source.buffer();
|
||||
@@ -447,7 +455,9 @@ ${referencingAssets
|
||||
);
|
||||
|
||||
const infoUpdate = {};
|
||||
const hash = /** @type {string} */ (asset.info.contenthash);
|
||||
const hash =
|
||||
/** @type {Exclude<AssetInfo["contenthash"], undefined>} */
|
||||
(asset.info.contenthash);
|
||||
infoUpdate.contenthash = Array.isArray(hash)
|
||||
? hash.map(
|
||||
(hash) => /** @type {string} */ (hashToNewHash.get(hash))
|
||||
|
||||
Reference in New Issue
Block a user