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

84
node_modules/webpack/lib/util/compileBooleanMatcher.js generated vendored Executable file → Normal file
View File

@@ -11,6 +11,79 @@
*/
const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
/**
* @param {string} char character to escape for use in character class
* @returns {string} escaped character
*/
const quoteMetaInCharClass = (char) => {
// In character class, only these need escaping: ] \ ^ -
if (char === "]" || char === "\\" || char === "^" || char === "-") {
return `\\${char}`;
}
return char;
};
/**
* Converts an array of single characters into an optimized character class string
* using ranges where possible. E.g., ["1","2","3","4","a"] => "1-4a"
* @param {string[]} chars array of single characters (should be sorted)
* @returns {string} optimized character class content (without the brackets)
*/
const charsToCharClassContent = (chars) => {
if (chars.length === 0) return "";
if (chars.length === 1) return quoteMetaInCharClass(chars[0]);
// Sort by char code
const sorted = [...chars].sort((a, b) => a.charCodeAt(0) - b.charCodeAt(0));
/** @type {string[]} */
const parts = [];
let rangeStart = sorted[0];
let rangeEnd = sorted[0];
for (let i = 1; i < sorted.length; i++) {
const char = sorted[i];
const prevCode = rangeEnd.charCodeAt(0);
const currCode = char.charCodeAt(0);
if (currCode === prevCode + 1) {
// Extend the range
rangeEnd = char;
} else {
// Flush the current range
parts.push(formatRange(rangeStart, rangeEnd));
rangeStart = char;
rangeEnd = char;
}
}
// Flush the last range
parts.push(formatRange(rangeStart, rangeEnd));
return parts.join("");
};
/**
* Formats a range of characters for use in a character class
* @param {string} start start character
* @param {string} end end character
* @returns {string} formatted range
*/
const formatRange = (start, end) => {
const startCode = start.charCodeAt(0);
const endCode = end.charCodeAt(0);
const length = endCode - startCode + 1;
if (length === 1) {
return quoteMetaInCharClass(start);
}
if (length === 2) {
// For 2 chars, just list them (e.g., "ab" instead of "a-b")
return quoteMetaInCharClass(start) + quoteMetaInCharClass(end);
}
// For 3+ chars, use range notation
return `${quoteMetaInCharClass(start)}-${quoteMetaInCharClass(end)}`;
};
/**
* @param {string} str string
* @returns {string} string
@@ -148,19 +221,20 @@ const itemsToRegexp = (itemsArr) => {
}
// special case for only single char items
if (countOfSingleCharItems === itemsArr.length) {
return `[${quoteMeta(itemsArr.sort().join(""))}]`;
return `[${charsToCharClassContent(itemsArr)}]`;
}
/** @type {Set<string>} */
const items = new Set(itemsArr.sort());
if (countOfSingleCharItems > 2) {
let singleCharItems = "";
/** @type {string[]} */
const singleCharItems = [];
for (const item of items) {
if (item.length === 1) {
singleCharItems += item;
singleCharItems.push(item);
items.delete(item);
}
}
finishedItems.push(`[${quoteMeta(singleCharItems)}]`);
finishedItems.push(`[${charsToCharClassContent(singleCharItems)}]`);
}
// special case for 2 items with common prefix/suffix
@@ -227,8 +301,6 @@ const itemsToRegexp = (itemsArr) => {
);
}
// TODO further optimize regexp, i. e.
// use ranges: (1|2|3|4|a) => [1-4a]
/** @type {string[]} */
const conditional = [...finishedItems, ...Array.from(items, quoteMeta)];
if (conditional.length === 1) return conditional[0];