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

79
node_modules/webpack/lib/optimize/ConcatenatedModule.js generated vendored Executable file → Normal file
View File

@@ -16,7 +16,10 @@ const {
const ConcatenationScope = require("../ConcatenationScope");
const { UsageState } = require("../ExportsInfo");
const Module = require("../Module");
const { JS_TYPES } = require("../ModuleSourceTypesConstants");
const {
JAVASCRIPT_TYPE,
JAVASCRIPT_TYPES
} = require("../ModuleSourceTypeConstants");
const { JAVASCRIPT_MODULE_TYPE_ESM } = require("../ModuleTypeConstants");
const RuntimeGlobals = require("../RuntimeGlobals");
const Template = require("../Template");
@@ -132,8 +135,10 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
* @property {ExportName} exportName
*/
/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo } ModuleInfo */
/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */
/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */
/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo} ModuleInfoOrReference */
/** @typedef {Map<string, string>} ExportMap */
/**
* @typedef {object} ConcatenatedModuleInfo
@@ -148,8 +153,8 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
* @property {Scope | undefined} globalScope
* @property {Scope | undefined} moduleScope
* @property {Map<string, string>} internalNames
* @property {Map<string, string> | undefined} exportMap
* @property {Map<string, string> | undefined} rawExportMap
* @property {ExportMap | undefined} exportMap
* @property {ExportMap | undefined} rawExportMap
* @property {string=} namespaceExportSymbol
* @property {string | undefined} namespaceObjectName
* @property {ConcatenationScope | undefined} concatenationScope
@@ -192,7 +197,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
/**
* @template T
* @param {string} property property
* @param {function(T[keyof T], T[keyof T]): 0 | 1 | -1} comparator comparator
* @param {(a: T[keyof T], b: T[keyof T]) => 0 | 1 | -1} comparator comparator
* @returns {Comparator<T>} comparator
*/
@@ -684,7 +689,7 @@ const getFinalName = (
/**
* @typedef {object} ConcatenateModuleHooks
* @property {SyncBailHook<[ConcatenatedModule], boolean>} onDemandExportsGeneration
* @property {SyncBailHook<[ConcatenatedModule, RuntimeSpec[], string, Record<string, string>], boolean>} onDemandExportsGeneration
* @property {SyncBailHook<[Partial<ConcatenatedModuleInfo>, ConcatenatedModuleInfo], boolean | void>} concatenatedModuleInfo
*/
@@ -734,7 +739,12 @@ class ConcatenatedModule extends Module {
let hooks = compilationHooksMap.get(compilation);
if (hooks === undefined) {
hooks = {
onDemandExportsGeneration: new SyncBailHook(["module"]),
onDemandExportsGeneration: new SyncBailHook([
"module",
"runtimes",
"exportsFinalName",
"exportsSource"
]),
concatenatedModuleInfo: new SyncBailHook([
"updatedInfo",
"concatenatedModuleInfo"
@@ -784,7 +794,7 @@ class ConcatenatedModule extends Module {
* @returns {SourceTypes} types available (do not mutate)
*/
getSourceTypes() {
return JS_TYPES;
return JAVASCRIPT_TYPES;
}
get modules() {
@@ -1254,6 +1264,7 @@ class ConcatenatedModule extends Module {
moduleGraph,
chunkGraph,
runtime: generationRuntime,
runtimes,
codeGenerationResults
}) {
const { concatenatedModuleInfo } = ConcatenatedModule.getCompilationHooks(
@@ -1289,6 +1300,7 @@ class ConcatenatedModule extends Module {
moduleGraph,
chunkGraph,
runtime,
runtimes,
/** @type {CodeGenerationResults} */
(codeGenerationResults),
allUsedNames
@@ -1407,7 +1419,7 @@ class ConcatenatedModule extends Module {
* @param {string} name the name to find a new name for
* @param {ConcatenatedModuleInfo} info the info of the module
* @param {Reference[]} references the references to the name
* @returns {string|undefined} the new name or undefined if the name is not found
* @returns {string | undefined} the new name or undefined if the name is not found
*/
const _findNewName = (name, info, references) => {
const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo(
@@ -1441,7 +1453,7 @@ class ConcatenatedModule extends Module {
* @param {string} name the name to find a new name for
* @param {ConcatenatedModuleInfo} info the info of the module
* @param {Reference[]} references the references to the name
* @returns {string|undefined} the new name or undefined if the name is not found
* @returns {string | undefined} the new name or undefined if the name is not found
*/
const _findNewNameForSpecifier = (name, info, references) => {
const { usedNames: moduleUsedNames, alreadyCheckedScopes } =
@@ -1772,9 +1784,6 @@ class ConcatenatedModule extends Module {
);
}
const { onDemandExportsGeneration } =
ConcatenatedModule.getCompilationHooks(this.compilation);
runtimeRequirements.add(RuntimeGlobals.exports);
runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
@@ -1788,21 +1797,24 @@ class ConcatenatedModule extends Module {
);
}
if (onDemandExportsGeneration.call(this)) {
/** @type {BuildMeta} */ (this.buildMeta).factoryExportsBinding =
"\n// EXPORTS\n" +
`${RuntimeGlobals.definePropertyGetters}(${
this.exportsArgument
}, {${definitions.join(",")}\n});\n`;
/** @type {BuildMeta} */ (this.buildMeta).exportsFinalName =
exportsFinalName;
} else {
result.add("\n// EXPORTS\n");
result.add(
`${RuntimeGlobals.definePropertyGetters}(${
this.exportsArgument
}, {${definitions.join(",")}\n});\n`
);
const exportsSource =
"\n// EXPORTS\n" +
`${RuntimeGlobals.definePropertyGetters}(${this.exportsArgument}, {${definitions.join(
","
)}\n});\n`;
const { onDemandExportsGeneration } =
ConcatenatedModule.getCompilationHooks(this.compilation);
if (
!onDemandExportsGeneration.call(
this,
runtimes,
exportsSource,
exportsFinalName
)
) {
result.add(exportsSource);
}
}
@@ -2008,7 +2020,7 @@ ${defineGetters}`
/** @type {CodeGenerationResult} */
const resultEntry = {
sources: new Map([["javascript", new CachedSource(result)]]),
sources: new Map([[JAVASCRIPT_TYPE, new CachedSource(result)]]),
data,
runtimeRequirements
};
@@ -2024,6 +2036,7 @@ ${defineGetters}`
* @param {ModuleGraph} moduleGraph moduleGraph
* @param {ChunkGraph} chunkGraph chunkGraph
* @param {RuntimeSpec} runtime runtime
* @param {RuntimeSpec[]} runtimes runtimes
* @param {CodeGenerationResults} codeGenerationResults codeGenerationResults
* @param {Set<string>} usedNames used names
*/
@@ -2035,6 +2048,7 @@ ${defineGetters}`
moduleGraph,
chunkGraph,
runtime,
runtimes,
codeGenerationResults,
usedNames
) {
@@ -2055,13 +2069,14 @@ ${defineGetters}`
moduleGraph,
chunkGraph,
runtime,
runtimes,
concatenationScope,
codeGenerationResults,
sourceTypes: JS_TYPES
sourceTypes: JAVASCRIPT_TYPES
});
const source =
/** @type {Source} */
(codeGenResult.sources.get("javascript"));
(codeGenResult.sources.get(JAVASCRIPT_TYPE));
const data = codeGenResult.data;
const chunkInitFragments = data && data.get("chunkInitFragments");
const code = source.source().toString();