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

54
node_modules/webpack/lib/asset/AssetGenerator.js generated vendored Executable file → Normal file
View File

@@ -11,14 +11,17 @@ const ConcatenationScope = require("../ConcatenationScope");
const Generator = require("../Generator");
const {
ASSET_AND_CSS_URL_TYPES,
ASSET_AND_JS_AND_CSS_URL_TYPES,
ASSET_AND_JS_TYPES,
ASSET_AND_JAVASCRIPT_AND_CSS_URL_TYPES,
ASSET_AND_JAVASCRIPT_TYPES,
ASSET_TYPES,
CSS_TYPE,
CSS_URL_TYPE,
CSS_URL_TYPES,
JS_AND_CSS_URL_TYPES,
JS_TYPES,
JAVASCRIPT_AND_CSS_URL_TYPES,
JAVASCRIPT_TYPE,
JAVASCRIPT_TYPES,
NO_TYPES
} = require("../ModuleSourceTypesConstants");
} = require("../ModuleSourceTypeConstants");
const { ASSET_MODULE_TYPE } = require("../ModuleTypeConstants");
const RuntimeGlobals = require("../RuntimeGlobals");
const CssUrlDependency = require("../dependencies/CssUrlDependency");
@@ -43,6 +46,7 @@ const getMimeTypes = memoize(() => require("mime-types"));
/** @typedef {import("../Module").NameForCondition} NameForCondition */
/** @typedef {import("../Module").BuildInfo} BuildInfo */
/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
/** @typedef {import("../Module").SourceType} SourceType */
/** @typedef {import("../Module").SourceTypes} SourceTypes */
/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../NormalModule")} NormalModule */
@@ -331,7 +335,7 @@ class AssetGenerator extends Generator {
let assetPath;
if (generatorOptions.publicPath !== undefined && type === "javascript") {
if (generatorOptions.publicPath !== undefined && type === JAVASCRIPT_TYPE) {
const { path, info } = runtimeTemplate.compilation.getAssetPathWithInfo(
generatorOptions.publicPath,
{
@@ -346,7 +350,7 @@ class AssetGenerator extends Generator {
assetPath = JSON.stringify(path + filename);
} else if (
generatorOptions.publicPath !== undefined &&
type === "css-url"
type === CSS_URL_TYPE
) {
const { path, info } = runtimeTemplate.compilation.getAssetPathWithInfo(
generatorOptions.publicPath,
@@ -360,14 +364,14 @@ class AssetGenerator extends Generator {
);
assetInfo = mergeAssetInfo(assetInfo, info);
assetPath = path + filename;
} else if (type === "javascript") {
} else if (type === JAVASCRIPT_TYPE) {
// add __webpack_require__.p
runtimeRequirements.add(RuntimeGlobals.publicPath);
assetPath = runtimeTemplate.concatenation(
{ expr: RuntimeGlobals.publicPath },
filename
);
} else if (type === "css-url") {
} else if (type === CSS_URL_TYPE) {
const compilation = runtimeTemplate.compilation;
const path =
compilation.outputOptions.publicPath === "auto"
@@ -518,7 +522,7 @@ class AssetGenerator extends Generator {
let content;
const needContent = type === "javascript" || type === "css-url";
const needContent = type === JAVASCRIPT_TYPE || type === CSS_URL_TYPE;
const data = getData ? getData() : undefined;
@@ -529,7 +533,9 @@ class AssetGenerator extends Generator {
) {
const encodedSource = this.generateDataUri(module);
content =
type === "javascript" ? JSON.stringify(encodedSource) : encodedSource;
type === JAVASCRIPT_TYPE
? JSON.stringify(encodedSource)
: encodedSource;
if (data) {
data.set("url", { [type]: content, ...data.get("url") });
@@ -570,7 +576,7 @@ class AssetGenerator extends Generator {
contentHash
);
if (data && (type === "javascript" || type === "css-url")) {
if (data && (type === JAVASCRIPT_TYPE || type === CSS_URL_TYPE)) {
data.set("url", { [type]: assetPath, ...data.get("url") });
}
@@ -598,7 +604,7 @@ class AssetGenerator extends Generator {
content = assetPath;
}
if (type === "javascript") {
if (type === JAVASCRIPT_TYPE) {
if (concatenationScope) {
concatenationScope.registerNamespaceExport(
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
@@ -614,7 +620,7 @@ class AssetGenerator extends Generator {
runtimeRequirements.add(RuntimeGlobals.module);
return new RawSource(`${module.moduleArgument}.exports = ${content};`);
} else if (type === "css-url") {
} else if (type === CSS_URL_TYPE) {
return null;
}
@@ -632,7 +638,7 @@ class AssetGenerator extends Generator {
case "asset": {
return new RawSource(error.message);
}
case "javascript": {
case JAVASCRIPT_TYPE: {
return new RawSource(
`throw new Error(${JSON.stringify(error.message)});`
);
@@ -661,24 +667,24 @@ class AssetGenerator extends Generator {
if ((module.buildInfo && module.buildInfo.dataUrl) || this.emit === false) {
if (sourceTypes.size > 0) {
if (sourceTypes.has("javascript") && sourceTypes.has("css")) {
return JS_AND_CSS_URL_TYPES;
} else if (sourceTypes.has("css")) {
if (sourceTypes.has(JAVASCRIPT_TYPE) && sourceTypes.has(CSS_TYPE)) {
return JAVASCRIPT_AND_CSS_URL_TYPES;
} else if (sourceTypes.has(CSS_TYPE)) {
return CSS_URL_TYPES;
}
return JS_TYPES;
return JAVASCRIPT_TYPES;
}
return NO_TYPES;
}
if (sourceTypes.size > 0) {
if (sourceTypes.has("javascript") && sourceTypes.has("css")) {
return ASSET_AND_JS_AND_CSS_URL_TYPES;
} else if (sourceTypes.has("css")) {
if (sourceTypes.has(JAVASCRIPT_TYPE) && sourceTypes.has(CSS_TYPE)) {
return ASSET_AND_JAVASCRIPT_AND_CSS_URL_TYPES;
} else if (sourceTypes.has(CSS_TYPE)) {
return ASSET_AND_CSS_URL_TYPES;
}
return ASSET_AND_JS_TYPES;
return ASSET_AND_JAVASCRIPT_TYPES;
}
return ASSET_TYPES;
@@ -686,7 +692,7 @@ class AssetGenerator 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) {