Add JS-CATCH-FALLBACK-01 rule and update npm packages

Add PHP-ALIAS-01 rule: prohibit field aliasing in serialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-23 07:36:18 +00:00
parent 3cc590186a
commit 3ce82a924a
1256 changed files with 6491 additions and 3989 deletions

127
node_modules/webpack/lib/util/comparators.js generated vendored Executable file → Normal file
View File

@@ -57,7 +57,7 @@ const createCachedParameterizedComparator = (fn) => {
/**
* @param {T} a first item
* @param {T} b second item
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const result = fn.bind(null, arg);
map.set(/** @type {EXPECTED_OBJECT} */ (arg), result);
@@ -90,7 +90,7 @@ const compareIterables = (elementComparator) => {
/**
* @param {Iterable<T>} a first value
* @param {Iterable<T>} b second value
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const result = (a, b) => {
const aI = a[Symbol.iterator]();
@@ -115,7 +115,7 @@ const compareIterables = (elementComparator) => {
* Compare two locations
* @param {DependencyLocation} a A location node
* @param {DependencyLocation} b A location node
* @returns {-1|0|1} sorting comparator value
* @returns {-1 | 0 | 1} sorting comparator value
*/
const compareLocations = (a, b) => {
const isObjectA = typeof a === "object" && a !== null;
@@ -178,7 +178,7 @@ const compareLocations = (a, b) => {
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {Module} a module
* @param {Module} b module
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareModulesById = (chunkGraph, a, b) =>
compareIds(
@@ -189,7 +189,7 @@ const compareModulesById = (chunkGraph, a, b) =>
/**
* @param {number} a number
* @param {number} b number
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareNumbers = (a, b) => {
if (typeof a !== typeof b) {
@@ -203,7 +203,7 @@ const compareNumbers = (a, b) => {
/**
* @param {string} a string
* @param {string} b string
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareStringsNumeric = (a, b) => {
const aLength = a.length;
@@ -275,7 +275,7 @@ const compareStringsNumeric = (a, b) => {
* @param {ModuleGraph} moduleGraph the module graph
* @param {Module} a module
* @param {Module} b module
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => {
const cmp = compareNumbers(
@@ -290,7 +290,7 @@ const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => {
* @param {ModuleGraph} moduleGraph the module graph
* @param {Module} a module
* @param {Module} b module
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => {
const cmp = compareNumbers(
@@ -305,7 +305,7 @@ const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => {
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {Module} a module
* @param {Module} b module
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => {
const cmp = compareIds(
@@ -327,7 +327,7 @@ const compareChunks = (chunkGraph, a, b) => chunkGraph.compareChunks(a, b);
/**
* @param {string} a first string
* @param {string} b second string
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const compareStrings = (a, b) => {
if (a < b) return -1;
@@ -408,7 +408,7 @@ const concatComparators = (c1, c2, ...cRest) => {
/**
* @param {T} a first value
* @param {T} b second value
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const result = (a, b) => {
const res = c1(a, b);
@@ -440,7 +440,7 @@ const compareSelect = (getter, comparator) => {
/**
* @param {T} a first value
* @param {T} b second value
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
const result = (a, b) => {
const aValue = getter(a);
@@ -511,47 +511,42 @@ const compareChunksNatural = (chunkGraph) => {
* https://github.com/webpack/webpack/pull/19686
* @param {Dependency[]} dependencies dependencies
* @param {WeakMap<Dependency, DependencySourceOrder>} dependencySourceOrderMap dependency source order map
* @param {((dep: Dependency, index: number) => void)=} onDependencyReSort optional callback to set index for each dependency
* @returns {void}
*/
const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => {
/**
* @param {Dependency} dep dependency
* @returns {number} source order
*/
const getSourceOrder = (dep) => {
if (dependencySourceOrderMap.has(dep)) {
const { main } = /** @type {DependencySourceOrder} */ (
dependencySourceOrderMap.get(dep)
);
return main;
}
return /** @type {number} */ (
/** @type {ModuleDependency} */ (dep).sourceOrder
);
};
/**
* If the sourceOrder is a number, it means the dependency needs to be sorted.
* @param {number | undefined} sourceOrder sourceOrder
* @returns {boolean} needReSort
*/
const needReSort = (sourceOrder) => {
if (typeof sourceOrder === "number") {
return true;
}
return false;
};
// Extract dependencies with sourceOrder and sort them
const sortWithSourceOrder = (
dependencies,
dependencySourceOrderMap,
onDependencyReSort
) => {
/** @type {{dep: Dependency, main: number, sub: number}[]} */
const withSourceOrder = [];
/** @type {number[]} */
const positions = [];
// First pass: collect dependencies with sourceOrder
for (let i = 0; i < dependencies.length; i++) {
const dep = dependencies[i];
const sourceOrder = getSourceOrder(dep);
const cached = dependencySourceOrderMap.get(dep);
if (needReSort(sourceOrder)) {
withSourceOrder.push({ dep, sourceOrder, originalIndex: i });
if (cached) {
positions.push(i);
withSourceOrder.push({
dep,
main: cached.main,
sub: cached.sub
});
} else {
const sourceOrder = /** @type {number | undefined} */ (
/** @type {ModuleDependency} */ (dep).sourceOrder
);
if (typeof sourceOrder === "number") {
positions.push(i);
withSourceOrder.push({
dep,
main: sourceOrder,
sub: 0
});
}
}
}
@@ -559,37 +554,19 @@ const sortWithSourceOrder = (dependencies, dependencySourceOrderMap) => {
return;
}
// Sort dependencies with sourceOrder
withSourceOrder.sort((a, b) => {
// Handle both dependencies in map case
if (
dependencySourceOrderMap.has(a.dep) &&
dependencySourceOrderMap.has(b.dep)
) {
const { main: mainA, sub: subA } = /** @type {DependencySourceOrder} */ (
dependencySourceOrderMap.get(a.dep)
);
const { main: mainB, sub: subB } = /** @type {DependencySourceOrder} */ (
dependencySourceOrderMap.get(b.dep)
);
if (mainA === mainB) {
return compareNumbers(subA, subB);
}
return compareNumbers(mainA, mainB);
if (a.main !== b.main) {
return compareNumbers(a.main, b.main);
}
return compareNumbers(a.sourceOrder, b.sourceOrder);
return compareNumbers(a.sub, b.sub);
});
// Second pass: build result array
let sortedIndex = 0;
for (let i = 0; i < dependencies.length; i++) {
const dep = dependencies[i];
const sourceOrder = getSourceOrder(dep);
if (needReSort(sourceOrder)) {
dependencies[i] = withSourceOrder[sortedIndex].dep;
sortedIndex++;
// Second pass: place sorted deps back to original positions
for (let i = 0; i < positions.length; i++) {
const depIndex = positions[i];
dependencies[depIndex] = withSourceOrder[i].dep;
if (onDependencyReSort) {
onDependencyReSort(dependencies[depIndex], depIndex);
}
}
};
@@ -601,7 +578,7 @@ module.exports.compareChunks =
/**
* @param {Chunk} a chunk
* @param {Chunk} b chunk
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
module.exports.compareChunksById = (a, b) =>
compareIds(/** @type {ChunkId} */ (a.id), /** @type {ChunkId} */ (b.id));
@@ -622,7 +599,7 @@ module.exports.compareModulesByIdOrIdentifier =
/**
* @param {Module} a module
* @param {Module} b module
* @returns {-1|0|1} compare result
* @returns {-1 | 0 | 1} compare result
*/
module.exports.compareModulesByIdentifier = (a, b) =>
compareIds(a.identifier(), b.identifier());