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:
26
node_modules/webpack/lib/asset/AssetBytesGenerator.js
generated
vendored
Executable file → Normal file
26
node_modules/webpack/lib/asset/AssetBytesGenerator.js
generated
vendored
Executable file → Normal file
@@ -9,16 +9,20 @@ const { RawSource } = require("webpack-sources");
|
||||
const ConcatenationScope = require("../ConcatenationScope");
|
||||
const Generator = require("../Generator");
|
||||
const {
|
||||
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 RuntimeGlobals = require("../RuntimeGlobals");
|
||||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
||||
/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
|
||||
/** @typedef {import("../Module").SourceType} SourceType */
|
||||
/** @typedef {import("../Module").SourceTypes} SourceTypes */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../NormalModule")} NormalModule */
|
||||
@@ -46,7 +50,7 @@ class AssetSourceGenerator extends Generator {
|
||||
const data = getData ? getData() : undefined;
|
||||
|
||||
switch (type) {
|
||||
case "javascript": {
|
||||
case JAVASCRIPT_TYPE: {
|
||||
if (!originalSource) {
|
||||
return new RawSource("");
|
||||
}
|
||||
@@ -72,7 +76,7 @@ class AssetSourceGenerator extends Generator {
|
||||
}
|
||||
return new RawSource(sourceContent);
|
||||
}
|
||||
case "css-url": {
|
||||
case CSS_URL_TYPE: {
|
||||
if (!originalSource) {
|
||||
return null;
|
||||
}
|
||||
@@ -99,7 +103,7 @@ class AssetSourceGenerator extends Generator {
|
||||
*/
|
||||
generateError(error, module, generateContext) {
|
||||
switch (generateContext.type) {
|
||||
case "javascript": {
|
||||
case JAVASCRIPT_TYPE: {
|
||||
return new RawSource(
|
||||
`throw new Error(${JSON.stringify(error.message)});`
|
||||
);
|
||||
@@ -136,12 +140,12 @@ class AssetSourceGenerator extends Generator {
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -149,7 +153,7 @@ class AssetSourceGenerator 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) {
|
||||
|
||||
0
node_modules/webpack/lib/asset/AssetBytesParser.js
generated
vendored
Executable file → Normal file
0
node_modules/webpack/lib/asset/AssetBytesParser.js
generated
vendored
Executable file → Normal file
54
node_modules/webpack/lib/asset/AssetGenerator.js
generated
vendored
Executable file → Normal file
54
node_modules/webpack/lib/asset/AssetGenerator.js
generated
vendored
Executable file → Normal 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) {
|
||||
|
||||
0
node_modules/webpack/lib/asset/AssetModulesPlugin.js
generated
vendored
Executable file → Normal file
0
node_modules/webpack/lib/asset/AssetModulesPlugin.js
generated
vendored
Executable file → Normal file
0
node_modules/webpack/lib/asset/AssetParser.js
generated
vendored
Executable file → Normal file
0
node_modules/webpack/lib/asset/AssetParser.js
generated
vendored
Executable file → Normal file
26
node_modules/webpack/lib/asset/AssetSourceGenerator.js
generated
vendored
Executable file → Normal file
26
node_modules/webpack/lib/asset/AssetSourceGenerator.js
generated
vendored
Executable file → Normal file
@@ -9,16 +9,20 @@ const { RawSource } = require("webpack-sources");
|
||||
const ConcatenationScope = require("../ConcatenationScope");
|
||||
const Generator = require("../Generator");
|
||||
const {
|
||||
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 RuntimeGlobals = require("../RuntimeGlobals");
|
||||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
||||
/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
|
||||
/** @typedef {import("../Module").SourceType} SourceType */
|
||||
/** @typedef {import("../Module").SourceTypes} SourceTypes */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../NormalModule")} NormalModule */
|
||||
@@ -46,7 +50,7 @@ class AssetSourceGenerator extends Generator {
|
||||
const data = getData ? getData() : undefined;
|
||||
|
||||
switch (type) {
|
||||
case "javascript": {
|
||||
case JAVASCRIPT_TYPE: {
|
||||
if (!originalSource) {
|
||||
return new RawSource("");
|
||||
}
|
||||
@@ -71,7 +75,7 @@ class AssetSourceGenerator extends Generator {
|
||||
}
|
||||
return new RawSource(sourceContent);
|
||||
}
|
||||
case "css-url": {
|
||||
case CSS_URL_TYPE: {
|
||||
if (!originalSource) {
|
||||
return null;
|
||||
}
|
||||
@@ -98,7 +102,7 @@ class AssetSourceGenerator extends Generator {
|
||||
*/
|
||||
generateError(error, module, generateContext) {
|
||||
switch (generateContext.type) {
|
||||
case "javascript": {
|
||||
case JAVASCRIPT_TYPE: {
|
||||
return new RawSource(
|
||||
`throw new Error(${JSON.stringify(error.message)});`
|
||||
);
|
||||
@@ -135,12 +139,12 @@ class AssetSourceGenerator extends Generator {
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -148,7 +152,7 @@ class AssetSourceGenerator 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) {
|
||||
|
||||
0
node_modules/webpack/lib/asset/AssetSourceParser.js
generated
vendored
Executable file → Normal file
0
node_modules/webpack/lib/asset/AssetSourceParser.js
generated
vendored
Executable file → Normal file
9
node_modules/webpack/lib/asset/RawDataUrlModule.js
generated
vendored
9
node_modules/webpack/lib/asset/RawDataUrlModule.js
generated
vendored
@@ -7,7 +7,10 @@
|
||||
|
||||
const { RawSource } = require("webpack-sources");
|
||||
const Module = require("../Module");
|
||||
const { JS_TYPES } = require("../ModuleSourceTypesConstants");
|
||||
const {
|
||||
JAVASCRIPT_TYPE,
|
||||
JAVASCRIPT_TYPES
|
||||
} = require("../ModuleSourceTypeConstants");
|
||||
const { ASSET_MODULE_TYPE_RAW_DATA_URL } = require("../ModuleTypeConstants");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
@@ -47,7 +50,7 @@ class RawDataUrlModule extends Module {
|
||||
* @returns {SourceTypes} types available (do not mutate)
|
||||
*/
|
||||
getSourceTypes() {
|
||||
return JS_TYPES;
|
||||
return JAVASCRIPT_TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +116,7 @@ class RawDataUrlModule extends Module {
|
||||
}
|
||||
const sources = new Map();
|
||||
sources.set(
|
||||
"javascript",
|
||||
JAVASCRIPT_TYPE,
|
||||
new RawSource(`module.exports = ${JSON.stringify(this.url)};`)
|
||||
);
|
||||
const data = new Map();
|
||||
|
||||
Reference in New Issue
Block a user