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

View File

@@ -5,6 +5,8 @@
"use strict";
const { JAVASCRIPT_TYPE } = require("./ModuleSourceTypeConstants");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
@@ -13,6 +15,7 @@
/** @typedef {import("./Module").CodeGenerationResultData} CodeGenerationResultData */
/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
/** @typedef {import("./Module").SourceType} SourceType */
/** @typedef {import("./Module").SourceTypes} SourceTypes */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./NormalModule")} NormalModule */
@@ -30,7 +33,7 @@
* @property {RuntimeSpec} runtime the runtime
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
* @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
* @property {string} type which kind of code should be generated
* @property {SourceType} type which kind of code should be generated
* @property {() => CodeGenerationResultData=} getData get access to the code generation data
*/
@@ -52,7 +55,7 @@
class Generator {
/**
* @param {Record<string, Generator>} map map of types
* @param {{ [key in SourceType]?: Generator }} map map of types
* @returns {ByTypeGenerator} generator by type
*/
static byType(map) {
@@ -75,7 +78,7 @@ class Generator {
/**
* @abstract
* @param {NormalModule} module the module
* @param {string=} type source type
* @param {SourceType=} type source type
* @returns {number} estimate size of the module
*/
getSize(module, type) {
@@ -138,12 +141,12 @@ function generateError(error, module, generateContext) {
class ByTypeGenerator extends Generator {
/**
* @param {Record<string, Generator>} map map of types
* @param {{ [key in SourceType]?: Generator }} map map of types
*/
constructor(map) {
super();
this.map = map;
this._types = new Set(Object.keys(map));
this._types = /** @type {SourceTypes} */ (new Set(Object.keys(map)));
/** @type {GenerateErrorFn | undefined} */
this.generateError = generateError.bind(this);
}
@@ -158,10 +161,10 @@ class ByTypeGenerator extends Generator {
/**
* @param {NormalModule} module the module
* @param {string=} type source type
* @param {SourceType=} type source type
* @returns {number} estimate size of the module
*/
getSize(module, type = "javascript") {
getSize(module, type = JAVASCRIPT_TYPE) {
const t = type;
const generator = this.map[t];
return generator ? generator.getSize(module, t) : 0;