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:
root
2026-02-20 11:31:28 +00:00
parent d01a6179aa
commit b5eb27a827
1690 changed files with 47348 additions and 16848 deletions

View File

@@ -13,6 +13,7 @@ const {
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../ChunkGraph").ModuleComparator} ModuleComparator */
/**
* @typedef {object} ChunkModuleIdRangePluginOptions
@@ -29,6 +30,7 @@ class ChunkModuleIdRangePlugin {
* @param {ChunkModuleIdRangePluginOptions} options options object
*/
constructor(options) {
/** @type {ChunkModuleIdRangePluginOptions} */
this.options = options;
}
@@ -38,26 +40,26 @@ class ChunkModuleIdRangePlugin {
* @returns {void}
*/
apply(compiler) {
const options = this.options;
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.moduleIds.tap(PLUGIN_NAME, (modules) => {
const chunkGraph = compilation.chunkGraph;
const chunk = find(
compilation.chunks,
(chunk) => chunk.name === options.name
(chunk) => chunk.name === this.options.name
);
if (!chunk) {
throw new Error(
`${PLUGIN_NAME}: Chunk with name '${options.name}"' was not found`
`${PLUGIN_NAME}: Chunk with name '${this.options.name}"' was not found`
);
}
/** @type {Module[]} */
let chunkModules;
if (options.order) {
if (this.options.order) {
/** @type {ModuleComparator} */
let cmpFn;
switch (options.order) {
switch (this.options.order) {
case "index":
case "preOrderIndex":
cmpFn = compareModulesByPreOrderIndexOrIdentifier(moduleGraph);
@@ -76,13 +78,13 @@ class ChunkModuleIdRangePlugin {
.sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph));
}
let currentId = options.start || 0;
let currentId = this.options.start || 0;
for (let i = 0; i < chunkModules.length; i++) {
const m = chunkModules[i];
if (m.needId && chunkGraph.getModuleId(m) === null) {
chunkGraph.setModuleId(m, currentId++);
}
if (options.end && currentId > options.end) break;
if (this.options.end && currentId > this.options.end) break;
}
});
});

View File

@@ -27,6 +27,7 @@ class DeterministicChunkIdsPlugin {
* @param {DeterministicChunkIdsPluginOptions=} options options
*/
constructor(options = {}) {
/** @type {DeterministicChunkIdsPluginOptions} */
this.options = options;
}

View File

@@ -34,6 +34,7 @@ class DeterministicModuleIdsPlugin {
* @param {DeterministicModuleIdsPluginOptions=} options options
*/
constructor(options = {}) {
/** @type {DeterministicModuleIdsPluginOptions} */
this.options = options;
}

View File

@@ -53,7 +53,6 @@ class HashedModuleIdsPlugin {
* @returns {void}
*/
apply(compiler) {
const options = this.options;
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => {
const chunkGraph = compilation.chunkGraph;
@@ -67,14 +66,10 @@ class HashedModuleIdsPlugin {
);
for (const module of modulesInNaturalOrder) {
const ident = getFullModuleName(module, context, compiler.root);
const hash = createHash(
/** @type {NonNullable<HashedModuleIdsPluginOptions["hashFunction"]>} */ (
options.hashFunction
)
);
const hash = createHash(this.options.hashFunction);
hash.update(ident || "");
const hashId = hash.digest(options.hashDigest);
let len = options.hashDigestLength;
const hashId = hash.digest(this.options.hashDigest);
let len = this.options.hashDigestLength;
while (usedIds.has(hashId.slice(0, len))) {
/** @type {number} */ (len)++;
}

View File

@@ -13,14 +13,14 @@ const numberHash = require("../util/numberHash");
/** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Compilation")} Compilation */
/** @typedef {import("../Module")} Module */
/** @typedef {typeof import("../util/Hash")} Hash */
/** @typedef {import("../util/Hash").HashFunction} HashFunction */
/** @typedef {import("../util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/**
* @param {string} str string to hash
* @param {number} len max length of the hash
* @param {string | Hash} hashFunction hash function to use
* @param {HashFunction} hashFunction hash function to use
* @returns {string} hash
*/
const getHash = (str, len, hashFunction) => {
@@ -56,12 +56,12 @@ const avoidNumber = (str) => {
* @returns {string} id representation
*/
const requestToId = (request) =>
request.replace(/^(\.\.?\/)+/, "").replace(/(^[.-]|[^a-zA-Z0-9_-])+/g, "_");
request.replace(/^(\.\.?\/)+/, "").replace(/(^[.-]|[^a-z0-9_-])+/gi, "_");
/**
* @param {string} string the string
* @param {string} delimiter separator for string and hash
* @param {string | Hash} hashFunction hash function to use
* @param {HashFunction} hashFunction hash function to use
* @returns {string} string with limited max length to 100 chars
*/
const shortenLongString = (string, delimiter, hashFunction) => {
@@ -95,7 +95,7 @@ const getShortModuleName = (module, context, associatedObjectForCache) => {
* @param {string} shortName the short name
* @param {Module} module the module
* @param {string} context context directory
* @param {string | Hash} hashFunction hash function to use
* @param {HashFunction} hashFunction hash function to use
* @param {AssociatedObjectForCache=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} long module name
*/
@@ -124,7 +124,7 @@ const getFullModuleName = (module, context, associatedObjectForCache) =>
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} context context directory
* @param {string} delimiter delimiter for names
* @param {string | Hash} hashFunction hash function to use
* @param {HashFunction} hashFunction hash function to use
* @param {AssociatedObjectForCache=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} short chunk name
*/
@@ -152,7 +152,7 @@ const getShortChunkName = (
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} context context directory
* @param {string} delimiter delimiter for names
* @param {string | Hash} hashFunction hash function to use
* @param {HashFunction} hashFunction hash function to use
* @param {AssociatedObjectForCache=} associatedObjectForCache an object to which the cache will be attached
* @returns {string} short chunk name
*/
@@ -231,7 +231,7 @@ const addToMapOfItems = (map, key, value) => {
*/
const getUsedModuleIdsAndModules = (compilation, filter) => {
const chunkGraph = compilation.chunkGraph;
/** @type {Module[]} */
const modules = [];
/** @type {UsedModuleIds} */
@@ -402,6 +402,7 @@ const assignDeterministicIds = (
for (const item of items) {
const ident = getName(item);
/** @type {number} */
let id;
let i = salt;
do {
@@ -420,6 +421,7 @@ const assignAscendingModuleIds = (usedIds, modules, compilation) => {
const chunkGraph = compilation.chunkGraph;
let nextId = 0;
/** @type {(mod: Module) => void} */
let assignId;
if (usedIds.size > 0) {
/**

View File

@@ -28,9 +28,9 @@ class NamedChunkIdsPlugin {
/**
* @param {NamedChunkIdsPluginOptions=} options options
*/
constructor(options) {
this.delimiter = (options && options.delimiter) || "-";
this.context = options && options.context;
constructor(options = {}) {
/** @type {NamedChunkIdsPluginOptions} */
this.options = options;
}
/**
@@ -43,8 +43,10 @@ class NamedChunkIdsPlugin {
const hashFunction = compilation.outputOptions.hashFunction;
compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => {
const chunkGraph = compilation.chunkGraph;
const context = this.context ? this.context : compiler.context;
const delimiter = this.delimiter;
const context = this.options.context
? this.options.context
: compiler.context;
const delimiter = this.options.delimiter || "-";
const unnamedChunks = assignNames(
[...chunks].filter((chunk) => {

View File

@@ -28,6 +28,7 @@ class NamedModuleIdsPlugin {
* @param {NamedModuleIdsPluginOptions=} options options
*/
constructor(options = {}) {
/** @type {NamedModuleIdsPluginOptions} */
this.options = options;
}

View File

@@ -30,6 +30,7 @@ class OccurrenceChunkIdsPlugin {
*/
constructor(options = {}) {
validate(options);
/** @type {OccurrenceChunkIdsPluginOptions} */
this.options = options;
}
@@ -39,7 +40,6 @@ class OccurrenceChunkIdsPlugin {
* @returns {void}
*/
apply(compiler) {
const prioritiseInitial = this.options.prioritiseInitial;
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.chunkIds.tap(PLUGIN_NAME, (chunks) => {
const chunkGraph = compilation.chunkGraph;
@@ -61,7 +61,7 @@ class OccurrenceChunkIdsPlugin {
/** @type {Chunk[]} */
const chunksInOccurrenceOrder = [...chunks].sort((a, b) => {
if (prioritiseInitial) {
if (this.options.prioritiseInitial) {
const aEntryOccurs =
/** @type {number} */
(occursInInitialChunksMap.get(a));

View File

@@ -35,6 +35,7 @@ class OccurrenceModuleIdsPlugin {
*/
constructor(options = {}) {
validate(options);
/** @type {OccurrenceModuleIdsPluginOptions} */
this.options = options;
}
@@ -44,7 +45,6 @@ class OccurrenceModuleIdsPlugin {
* @returns {void}
*/
apply(compiler) {
const prioritiseInitial = this.options.prioritiseInitial;
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
@@ -54,10 +54,14 @@ class OccurrenceModuleIdsPlugin {
const [usedIds, modulesInOccurrenceOrder] =
getUsedModuleIdsAndModules(compilation);
/** @type {Map<Module, number>} */
const occursInInitialChunksMap = new Map();
/** @type {Map<Module, number>} */
const occursInAllChunksMap = new Map();
/** @type {Map<Module, number>} */
const initialChunkChunkMap = new Map();
/** @type {Map<Module, number>} */
const entryCountMap = new Map();
for (const m of modulesInOccurrenceOrder) {
let initial = 0;
@@ -111,12 +115,12 @@ class OccurrenceModuleIdsPlugin {
return sum;
};
if (prioritiseInitial) {
if (this.options.prioritiseInitial) {
for (const m of modulesInOccurrenceOrder) {
const result =
countOccursInEntry(m) +
initialChunkChunkMap.get(m) +
entryCountMap.get(m);
/** @type {number} */ (initialChunkChunkMap.get(m)) +
/** @type {number} */ (entryCountMap.get(m));
occursInInitialChunksMap.set(m, result);
}
}
@@ -125,7 +129,7 @@ class OccurrenceModuleIdsPlugin {
const result =
countOccurs(m) +
chunkGraph.getNumberOfModuleChunks(m) +
entryCountMap.get(m);
/** @type {number} */ (entryCountMap.get(m));
occursInAllChunksMap.set(m, result);
}
@@ -134,14 +138,18 @@ class OccurrenceModuleIdsPlugin {
);
modulesInOccurrenceOrder.sort((a, b) => {
if (prioritiseInitial) {
const aEntryOccurs = occursInInitialChunksMap.get(a);
const bEntryOccurs = occursInInitialChunksMap.get(b);
if (this.options.prioritiseInitial) {
const aEntryOccurs =
/** @type {number} */
(occursInInitialChunksMap.get(a));
const bEntryOccurs =
/** @type {number} */
(occursInInitialChunksMap.get(b));
if (aEntryOccurs > bEntryOccurs) return -1;
if (aEntryOccurs < bEntryOccurs) return 1;
}
const aOccurs = occursInAllChunksMap.get(a);
const bOccurs = occursInAllChunksMap.get(b);
const aOccurs = /** @type {number} */ (occursInAllChunksMap.get(a));
const bOccurs = /** @type {number} */ (occursInAllChunksMap.get(b));
if (aOccurs > bOccurs) return -1;
if (aOccurs < bOccurs) return 1;
return naturalCompare(a, b);

View File

@@ -13,6 +13,8 @@ const { getUsedModuleIdsAndModules } = require("./IdHelpers");
/** @typedef {import("../Module").ModuleId} ModuleId */
/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */
/** @typedef {{ [key: string]: ModuleId }} JSONContent */
const plugin = "SyncModuleIdsPlugin";
/**
@@ -27,14 +29,9 @@ class SyncModuleIdsPlugin {
/**
* @param {SyncModuleIdsPluginOptions} options options
*/
constructor({ path, context, test, mode }) {
this._path = path;
this._context = context;
this._test = test || (() => true);
const readAndWrite = !mode || mode === "merge" || mode === "update";
this._read = readAndWrite || mode === "read";
this._write = readAndWrite || mode === "create";
this._prune = mode === "update";
constructor(options) {
/** @type {SyncModuleIdsPluginOptions} */
this.options = options;
}
/**
@@ -46,19 +43,31 @@ class SyncModuleIdsPlugin {
/** @type {Map<string, ModuleId>} */
let data;
let dataChanged = false;
if (this._read) {
const readAndWrite =
!this.options.mode ||
this.options.mode === "merge" ||
this.options.mode === "update";
const needRead = readAndWrite || this.options.mode === "read";
const needWrite = readAndWrite || this.options.mode === "create";
const needPrune = this.options.mode === "update";
if (needRead) {
compiler.hooks.readRecords.tapAsync(plugin, (callback) => {
const fs =
/** @type {IntermediateFileSystem} */
(compiler.intermediateFileSystem);
fs.readFile(this._path, (err, buffer) => {
fs.readFile(this.options.path, (err, buffer) => {
if (err) {
if (err.code !== "ENOENT") {
return callback(err);
}
return callback();
}
/** @type {JSONContent} */
const json = JSON.parse(/** @type {Buffer} */ (buffer).toString());
/** @type {Map<string, string | number | null>} */
data = new Map();
for (const key of Object.keys(json)) {
data.set(key, json[key]);
@@ -68,10 +77,10 @@ class SyncModuleIdsPlugin {
});
});
}
if (this._write) {
if (needWrite) {
compiler.hooks.emitRecords.tapAsync(plugin, (callback) => {
if (!data || !dataChanged) return callback();
/** @type {{[key: string]: ModuleId}} */
/** @type {JSONContent} */
const json = {};
const sorted = [...data].sort(([a], [b]) => (a < b ? -1 : 1));
for (const [key, value] of sorted) {
@@ -80,19 +89,20 @@ class SyncModuleIdsPlugin {
const fs =
/** @type {IntermediateFileSystem} */
(compiler.intermediateFileSystem);
fs.writeFile(this._path, JSON.stringify(json), callback);
fs.writeFile(this.options.path, JSON.stringify(json), callback);
});
}
compiler.hooks.thisCompilation.tap(plugin, (compilation) => {
const associatedObjectForCache = compiler.root;
const context = this._context || compiler.context;
if (this._read) {
const context = this.options.context || compiler.context;
const test = this.options.test || (() => true);
if (needRead) {
compilation.hooks.reviveModules.tap(plugin, (_1, _2) => {
if (!data) return;
const { chunkGraph } = compilation;
const [usedIds, modules] = getUsedModuleIdsAndModules(
compilation,
this._test
test
);
for (const module of modules) {
const name = module.libIdent({
@@ -104,7 +114,7 @@ class SyncModuleIdsPlugin {
const idAsString = `${id}`;
if (usedIds.has(idAsString)) {
const err = new WebpackError(
`SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this._path}' as it's already used.`
`SyncModuleIdsPlugin: Unable to restore id '${id}' from '${this.options.path}' as it's already used.`
);
err.module = module;
compilation.errors.push(err);
@@ -114,17 +124,17 @@ class SyncModuleIdsPlugin {
}
});
}
if (this._write) {
if (needWrite) {
compilation.hooks.recordModules.tap(plugin, (modules) => {
const { chunkGraph } = compilation;
let oldData = data;
if (!oldData) {
oldData = data = new Map();
} else if (this._prune) {
} else if (needPrune) {
data = new Map();
}
for (const module of modules) {
if (this._test(module)) {
if (test(module)) {
const name = module.libIdent({
context,
associatedObjectForCache