webpack 5.106.2 → 5.107.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/APIPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -4
- package/lib/Cache.js +3 -6
- package/lib/Chunk.js +21 -25
- package/lib/ChunkGroup.js +57 -15
- package/lib/CompatibilityPlugin.js +8 -7
- package/lib/Compilation.js +67 -37
- package/lib/Compiler.js +4 -13
- package/lib/ContextModule.js +2 -2
- package/lib/DefinePlugin.js +2 -2
- package/lib/Dependency.js +22 -1
- package/lib/DependencyTemplate.js +2 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/EvalSourceMapDevToolPlugin.js +8 -10
- package/lib/ExportsInfo.js +30 -34
- package/lib/ExternalModule.js +91 -26
- package/lib/ExternalModuleFactoryPlugin.js +7 -1
- package/lib/FileSystemInfo.js +187 -72
- package/lib/Generator.js +3 -3
- package/lib/HotModuleReplacementPlugin.js +26 -8
- package/lib/IgnorePlugin.js +2 -1
- package/lib/Module.js +20 -19
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleNotFoundError.js +3 -84
- package/lib/ModuleSourceTypeConstants.js +51 -19
- package/lib/ModuleTypeConstants.js +12 -3
- package/lib/MultiCompiler.js +2 -2
- package/lib/NodeStuffPlugin.js +1 -1
- package/lib/NormalModule.js +119 -77
- package/lib/NormalModuleFactory.js +47 -27
- package/lib/Parser.js +1 -1
- package/lib/ProgressPlugin.js +129 -56
- package/lib/RuntimeGlobals.js +5 -5
- package/lib/RuntimeModule.js +9 -7
- package/lib/RuntimePlugin.js +12 -1
- package/lib/SourceMapDevToolPlugin.js +250 -49
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +22 -4
- package/lib/WarnCaseSensitiveModulesPlugin.js +70 -2
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +16 -1
- package/lib/Watching.js +2 -3
- package/lib/WebpackError.js +3 -77
- package/lib/WebpackIsIncludedPlugin.js +1 -1
- package/lib/WebpackOptionsApply.js +13 -1
- package/lib/asset/AssetBytesGenerator.js +12 -8
- package/lib/asset/AssetGenerator.js +36 -22
- package/lib/asset/AssetModulesPlugin.js +6 -8
- package/lib/asset/AssetSourceGenerator.js +12 -8
- package/lib/buildChunkGraph.js +4 -6
- package/lib/cache/PackFileCacheStrategy.js +4 -4
- package/lib/cli.js +3 -1
- package/lib/config/defaults.js +197 -10
- package/lib/config/normalization.js +3 -1
- package/lib/css/CssGenerator.js +320 -105
- package/lib/css/CssInjectStyleRuntimeModule.js +44 -42
- package/lib/css/CssLoadingRuntimeModule.js +22 -4
- package/lib/{CssModule.js → css/CssModule.js} +15 -15
- package/lib/css/CssModulesPlugin.js +168 -88
- package/lib/css/CssParser.js +566 -269
- package/lib/css/walkCssTokens.js +148 -2
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +63 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +54 -10
- package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -1
- package/lib/dependencies/CommonJsFullRequireDependency.js +32 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +112 -4
- package/lib/dependencies/CommonJsRequireDependency.js +67 -4
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +1 -1
- package/lib/dependencies/CreateRequireParserPlugin.js +1 -1
- package/lib/dependencies/CriticalDependencyWarning.js +1 -1
- package/lib/dependencies/CssIcssExportDependency.js +332 -67
- package/lib/dependencies/CssIcssImportDependency.js +49 -7
- package/lib/dependencies/CssIcssSymbolDependency.js +11 -3
- package/lib/dependencies/CssImportDependency.js +8 -0
- package/lib/dependencies/CssUrlDependency.js +28 -2
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +22 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +8 -7
- package/lib/dependencies/HarmonyExportExpressionDependency.js +22 -14
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +110 -3
- package/lib/dependencies/HarmonyImportDependency.js +10 -2
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +22 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +1 -1
- package/lib/{HarmonyLinkingError.js → dependencies/HarmonyLinkingError.js} +5 -3
- package/lib/dependencies/HtmlInlineScriptDependency.js +133 -0
- package/lib/dependencies/HtmlInlineStyleDependency.js +101 -0
- package/lib/dependencies/HtmlScriptSrcDependency.js +557 -0
- package/lib/dependencies/HtmlSourceDependency.js +128 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/ImportParserPlugin.js +2 -2
- package/lib/dependencies/ImportPhase.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +1 -1
- package/lib/{RequireJsStuffPlugin.js → dependencies/RequireJsStuffPlugin.js} +7 -7
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/WebAssemblyImportDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +2 -2
- package/lib/{DelegatedModule.js → dll/DelegatedModule.js} +31 -31
- package/lib/{DelegatedModuleFactoryPlugin.js → dll/DelegatedModuleFactoryPlugin.js} +4 -4
- package/lib/{DelegatedPlugin.js → dll/DelegatedPlugin.js} +2 -2
- package/lib/{DllEntryPlugin.js → dll/DllEntryPlugin.js} +4 -4
- package/lib/{DllModule.js → dll/DllModule.js} +24 -24
- package/lib/{DllModuleFactory.js → dll/DllModuleFactory.js} +4 -4
- package/lib/{DllPlugin.js → dll/DllPlugin.js} +6 -5
- package/lib/{DllReferencePlugin.js → dll/DllReferencePlugin.js} +14 -14
- package/lib/{LibManifestPlugin.js → dll/LibManifestPlugin.js} +9 -9
- package/lib/{AsyncDependencyToInitialChunkError.js → errors/AsyncDependencyToInitialChunkError.js} +2 -2
- package/lib/errors/BuildCycleError.js +1 -1
- package/lib/{ChunkRenderError.js → errors/ChunkRenderError.js} +1 -1
- package/lib/{CodeGenerationError.js → errors/CodeGenerationError.js} +1 -1
- package/lib/{CommentCompilationWarning.js → errors/CommentCompilationWarning.js} +3 -3
- package/lib/{ConcurrentCompilationError.js → errors/ConcurrentCompilationError.js} +4 -2
- package/lib/{EnvironmentNotSupportAsyncWarning.js → errors/EnvironmentNotSupportAsyncWarning.js} +4 -4
- package/lib/{HookWebpackError.js → errors/HookWebpackError.js} +5 -5
- package/lib/{IgnoreErrorModuleFactory.js → errors/IgnoreErrorModuleFactory.js} +4 -4
- package/lib/{InvalidDependenciesModuleWarning.js → errors/InvalidDependenciesModuleWarning.js} +3 -3
- package/lib/errors/JSONParseError.js +114 -0
- package/lib/{ModuleBuildError.js → errors/ModuleBuildError.js} +5 -5
- package/lib/{ModuleDependencyError.js → errors/ModuleDependencyError.js} +2 -2
- package/lib/{ModuleDependencyWarning.js → errors/ModuleDependencyWarning.js} +4 -4
- package/lib/{ModuleError.js → errors/ModuleError.js} +5 -5
- package/lib/{ModuleHashingError.js → errors/ModuleHashingError.js} +1 -1
- package/lib/errors/ModuleNotFoundError.js +91 -0
- package/lib/{ModuleParseError.js → errors/ModuleParseError.js} +8 -6
- package/lib/{ModuleRestoreError.js → errors/ModuleRestoreError.js} +1 -1
- package/lib/{ModuleStoreError.js → errors/ModuleStoreError.js} +1 -1
- package/lib/{ModuleWarning.js → errors/ModuleWarning.js} +5 -5
- package/lib/{NodeStuffInWebError.js → errors/NodeStuffInWebError.js} +4 -4
- package/lib/errors/NonErrorEmittedError.js +28 -0
- package/lib/{UnhandledSchemeError.js → errors/UnhandledSchemeError.js} +2 -2
- package/lib/{UnsupportedFeatureWarning.js → errors/UnsupportedFeatureWarning.js} +3 -3
- package/lib/errors/WebpackError.js +84 -0
- package/lib/html/HtmlGenerator.js +379 -0
- package/lib/html/HtmlModulesPlugin.js +429 -0
- package/lib/html/HtmlParser.js +1489 -0
- package/lib/html/walkHtmlTokens.js +3249 -0
- package/lib/ids/IdHelpers.js +2 -1
- package/lib/index.js +36 -15
- package/lib/javascript/JavascriptModulesPlugin.js +91 -10
- package/lib/javascript/JavascriptParser.js +197 -16
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/json/JsonParser.js +7 -16
- package/lib/library/AbstractLibraryPlugin.js +1 -1
- package/lib/library/EnableLibraryPlugin.js +1 -1
- package/lib/{FalseIIFEUmdWarning.js → library/FalseIIFEUmdWarning.js} +1 -1
- package/lib/library/ModuleLibraryPlugin.js +74 -0
- package/lib/node/NodeEnvironmentPlugin.js +4 -2
- package/lib/node/nodeConsole.js +113 -64
- package/lib/optimize/ConcatenatedModule.js +51 -6
- package/lib/optimize/InnerGraph.js +1 -1
- package/lib/optimize/InnerGraphPlugin.js +11 -1
- package/lib/optimize/MinMaxSizeWarning.js +4 -4
- package/lib/optimize/ModuleConcatenationPlugin.js +15 -7
- package/lib/optimize/RealContentHashPlugin.js +89 -26
- package/lib/optimize/SideEffectsFlagPlugin.js +112 -5
- package/lib/optimize/SplitChunksPlugin.js +5 -5
- package/lib/performance/AssetsOverSizeLimitWarning.js +2 -2
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/NoAsyncChunksWarning.js +5 -3
- package/lib/performance/SizeLimitsPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -1
- package/lib/rules/UseEffectRulePlugin.js +4 -3
- package/lib/runtime/AutoPublicPathRuntimeModule.js +3 -3
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +5 -5
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +119 -13
- package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +35 -0
- package/lib/schemes/DataUriPlugin.js +13 -1
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -10
- package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +5 -5
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +2 -2
- package/lib/stats/DefaultStatsPresetPlugin.js +1 -1
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/stats/StatsFactory.js +1 -1
- package/lib/typescript/TypeScriptPlugin.js +210 -0
- package/lib/url/URLParserPlugin.js +2 -2
- package/lib/util/AsyncQueue.js +2 -2
- package/lib/util/Hash.js +2 -2
- package/lib/util/LocConverter.js +53 -0
- package/lib/util/SortableSet.js +1 -1
- package/lib/util/cleverMerge.js +2 -2
- package/lib/util/comparators.js +3 -3
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +42 -1
- package/lib/util/createMappings.js +118 -0
- package/lib/{formatLocation.js → util/formatLocation.js} +2 -2
- package/lib/{SizeFormatHelpers.js → util/formatSize.js} +3 -1
- package/lib/util/fs.js +8 -8
- package/lib/util/hash/md4.js +1 -1
- package/lib/util/hash/xxhash64.js +1 -1
- package/lib/util/identifier.js +48 -0
- package/lib/util/internalSerializables.js +35 -19
- package/lib/util/magicComment.js +10 -7
- package/lib/util/parseJson.js +2 -73
- package/lib/util/source.js +21 -0
- package/lib/util/topologicalSort.js +69 -0
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -4
- package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -1
- package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +5 -3
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +1 -1
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +5 -3
- package/lib/webpack.js +3 -1
- package/package.json +24 -22
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +129 -12
- package/schemas/plugins/{DllPlugin.check.d.ts → HtmlGeneratorOptions.check.d.ts} +1 -1
- package/schemas/plugins/HtmlGeneratorOptions.check.js +6 -0
- package/schemas/plugins/HtmlGeneratorOptions.json +3 -0
- package/schemas/plugins/ProgressPlugin.check.js +1 -1
- package/schemas/plugins/ProgressPlugin.json +22 -0
- package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
- package/schemas/plugins/container/ExternalsType.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
- package/schemas/plugins/{DllReferencePlugin.check.d.ts → css/CssAutoOrModuleParserOptions.check.d.ts} +1 -1
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.json +3 -0
- package/schemas/plugins/dll/DllPlugin.check.d.ts +7 -0
- package/schemas/plugins/dll/DllReferencePlugin.check.d.ts +7 -0
- package/types.d.ts +1153 -233
- package/lib/CaseSensitiveModulesWarning.js +0 -80
- package/lib/GraphHelpers.js +0 -49
- package/lib/NoModeWarning.js +0 -23
- package/lib/css/CssMergeStyleSheetsRuntimeModule.js +0 -57
- /package/lib/{AbstractMethodError.js → errors/AbstractMethodError.js} +0 -0
- /package/schemas/plugins/{DllPlugin.check.js → dll/DllPlugin.check.js} +0 -0
- /package/schemas/plugins/{DllPlugin.json → dll/DllPlugin.json} +0 -0
- /package/schemas/plugins/{DllReferencePlugin.check.js → dll/DllReferencePlugin.check.js} +0 -0
- /package/schemas/plugins/{DllReferencePlugin.json → dll/DllReferencePlugin.json} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
8
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
9
|
+
|
|
10
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
11
|
+
|
|
12
|
+
const CONTEXT = 20;
|
|
13
|
+
|
|
14
|
+
class JSONParseError extends SyntaxError {
|
|
15
|
+
/**
|
|
16
|
+
* @param {Error} err err
|
|
17
|
+
* @param {EXPECTED_ANY} raw raw
|
|
18
|
+
* @param {string} txt text
|
|
19
|
+
*/
|
|
20
|
+
constructor(err, raw, txt) {
|
|
21
|
+
let originalMessage = err.message;
|
|
22
|
+
/** @type {string} */
|
|
23
|
+
let message;
|
|
24
|
+
/** @type {number} */
|
|
25
|
+
let position;
|
|
26
|
+
|
|
27
|
+
if (typeof raw !== "string") {
|
|
28
|
+
message = `Cannot parse ${Array.isArray(raw) && raw.length === 0 ? "an empty array" : String(raw)}`;
|
|
29
|
+
position = 0;
|
|
30
|
+
} else if (!txt) {
|
|
31
|
+
message = `${originalMessage} while parsing empty string`;
|
|
32
|
+
position = 0;
|
|
33
|
+
} else {
|
|
34
|
+
// Node 20 puts single quotes around the token and a comma after it
|
|
35
|
+
const UNEXPECTED_TOKEN = /^Unexpected token '?(.)'?(,)? /i;
|
|
36
|
+
const badTokenMatch = originalMessage.match(UNEXPECTED_TOKEN);
|
|
37
|
+
const badIndexMatch = originalMessage.match(/ position\s+(\d+)/i);
|
|
38
|
+
|
|
39
|
+
if (badTokenMatch) {
|
|
40
|
+
const h = badTokenMatch[1].charCodeAt(0).toString(16).toUpperCase();
|
|
41
|
+
const hex = `0x${h.length % 2 ? "0" : ""}${h}`;
|
|
42
|
+
|
|
43
|
+
originalMessage = originalMessage.replace(
|
|
44
|
+
UNEXPECTED_TOKEN,
|
|
45
|
+
`Unexpected token ${JSON.stringify(badTokenMatch[1])} (${hex})$2 `
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @type {number | undefined} */
|
|
50
|
+
let errIdx;
|
|
51
|
+
|
|
52
|
+
if (badIndexMatch) {
|
|
53
|
+
errIdx = Number(badIndexMatch[1]);
|
|
54
|
+
} else if (
|
|
55
|
+
// doesn't happen in Node 22+
|
|
56
|
+
/^Unexpected end of JSON.*/i.test(originalMessage)
|
|
57
|
+
) {
|
|
58
|
+
errIdx = txt.length - 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (errIdx === undefined) {
|
|
62
|
+
message = `${originalMessage} while parsing '${txt.slice(0, CONTEXT * 2)}'`;
|
|
63
|
+
position = 0;
|
|
64
|
+
} else {
|
|
65
|
+
const start = errIdx <= CONTEXT ? 0 : errIdx - CONTEXT;
|
|
66
|
+
const end =
|
|
67
|
+
errIdx + CONTEXT >= txt.length ? txt.length : errIdx + CONTEXT;
|
|
68
|
+
const slice = `${start ? "..." : ""}${txt.slice(start, end)}${end === txt.length ? "" : "..."}`;
|
|
69
|
+
|
|
70
|
+
message = `${originalMessage} while parsing ${txt === slice ? "" : "near "}${JSON.stringify(slice)}`;
|
|
71
|
+
position = errIdx;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
super(message);
|
|
76
|
+
|
|
77
|
+
/** @type {string} */
|
|
78
|
+
this.name = "JSONParseError";
|
|
79
|
+
/** @type {string | undefined} */
|
|
80
|
+
this.stack = undefined;
|
|
81
|
+
/** @type {Error} */
|
|
82
|
+
this.systemError = err;
|
|
83
|
+
/** @type {EXPECTED_ANY} */
|
|
84
|
+
this.raw = raw;
|
|
85
|
+
/** @type {string} */
|
|
86
|
+
this.txt = txt;
|
|
87
|
+
/** @type {number} */
|
|
88
|
+
this.position = position;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Serializes this instance into the provided serializer context.
|
|
93
|
+
* @param {ObjectSerializerContext} context context
|
|
94
|
+
*/
|
|
95
|
+
serialize({ write }) {
|
|
96
|
+
write(this.systemError);
|
|
97
|
+
write(this.raw);
|
|
98
|
+
write(this.txt);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Restores this instance from the provided deserializer context.
|
|
103
|
+
* @param {ObjectDeserializerContext} context context
|
|
104
|
+
* @returns {JSONParseError} DelegatedModule
|
|
105
|
+
*/
|
|
106
|
+
static deserialize(context) {
|
|
107
|
+
const { read } = context;
|
|
108
|
+
return new JSONParseError(read(), read(), read());
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
makeSerializable(JSONParseError, "webpack/lib/errors/JSONParseError");
|
|
113
|
+
|
|
114
|
+
module.exports = JSONParseError;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const { cutOffLoaderExecution } = require("
|
|
8
|
+
const { cutOffLoaderExecution } = require("../ErrorHelpers");
|
|
9
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
9
10
|
const WebpackError = require("./WebpackError");
|
|
10
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
11
11
|
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
12
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
13
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
14
14
|
|
|
15
15
|
/** @typedef {Error & { hideStack?: boolean }} ErrorWithHideStack */
|
|
16
16
|
|
|
@@ -81,6 +81,6 @@ class ModuleBuildError extends WebpackError {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
makeSerializable(ModuleBuildError, "webpack/lib/ModuleBuildError");
|
|
84
|
+
makeSerializable(ModuleBuildError, "webpack/lib/errors/ModuleBuildError");
|
|
85
85
|
|
|
86
86
|
module.exports = ModuleBuildError;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
const WebpackError = require("./WebpackError");
|
|
9
9
|
|
|
10
|
-
/** @typedef {import("
|
|
11
|
-
/** @typedef {import("
|
|
10
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
11
|
+
/** @typedef {import("../Module")} Module */
|
|
12
12
|
/** @typedef {import("./ModuleBuildError").ErrorWithHideStack} ErrorWithHideStack */
|
|
13
13
|
|
|
14
14
|
class ModuleDependencyError extends WebpackError {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
8
9
|
const WebpackError = require("./WebpackError");
|
|
9
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
10
10
|
|
|
11
|
-
/** @typedef {import("
|
|
12
|
-
/** @typedef {import("
|
|
11
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
12
|
+
/** @typedef {import("../Module")} Module */
|
|
13
13
|
/** @typedef {import("./ModuleDependencyError").ErrorWithHideStack} ErrorWithHideStack */
|
|
14
14
|
|
|
15
15
|
class ModuleDependencyWarning extends WebpackError {
|
|
@@ -44,7 +44,7 @@ class ModuleDependencyWarning extends WebpackError {
|
|
|
44
44
|
|
|
45
45
|
makeSerializable(
|
|
46
46
|
ModuleDependencyWarning,
|
|
47
|
-
"webpack/lib/ModuleDependencyWarning"
|
|
47
|
+
"webpack/lib/errors/ModuleDependencyWarning"
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
module.exports = ModuleDependencyWarning;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const { cleanUp } = require("
|
|
8
|
+
const { cleanUp } = require("../ErrorHelpers");
|
|
9
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
9
10
|
const WebpackError = require("./WebpackError");
|
|
10
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
11
11
|
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
12
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
13
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
14
14
|
|
|
15
15
|
class ModuleError extends WebpackError {
|
|
16
16
|
/**
|
|
@@ -66,6 +66,6 @@ class ModuleError extends WebpackError {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
makeSerializable(ModuleError, "webpack/lib/ModuleError");
|
|
69
|
+
makeSerializable(ModuleError, "webpack/lib/errors/ModuleError");
|
|
70
70
|
|
|
71
71
|
module.exports = ModuleError;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const WebpackError = require("./WebpackError");
|
|
9
|
+
|
|
10
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
11
|
+
/** @typedef {import("../Module")} Module */
|
|
12
|
+
|
|
13
|
+
const previouslyPolyfilledBuiltinModules = {
|
|
14
|
+
assert: "assert/",
|
|
15
|
+
buffer: "buffer/",
|
|
16
|
+
console: "console-browserify",
|
|
17
|
+
constants: "constants-browserify",
|
|
18
|
+
crypto: "crypto-browserify",
|
|
19
|
+
domain: "domain-browser",
|
|
20
|
+
events: "events/",
|
|
21
|
+
http: "stream-http",
|
|
22
|
+
https: "https-browserify",
|
|
23
|
+
os: "os-browserify/browser",
|
|
24
|
+
path: "path-browserify",
|
|
25
|
+
punycode: "punycode/",
|
|
26
|
+
process: "process/browser",
|
|
27
|
+
querystring: "querystring-es3",
|
|
28
|
+
stream: "stream-browserify",
|
|
29
|
+
_stream_duplex: "readable-stream/duplex",
|
|
30
|
+
_stream_passthrough: "readable-stream/passthrough",
|
|
31
|
+
_stream_readable: "readable-stream/readable",
|
|
32
|
+
_stream_transform: "readable-stream/transform",
|
|
33
|
+
_stream_writable: "readable-stream/writable",
|
|
34
|
+
string_decoder: "string_decoder/",
|
|
35
|
+
sys: "util/",
|
|
36
|
+
timers: "timers-browserify",
|
|
37
|
+
tty: "tty-browserify",
|
|
38
|
+
url: "url/",
|
|
39
|
+
util: "util/",
|
|
40
|
+
vm: "vm-browserify",
|
|
41
|
+
zlib: "browserify-zlib"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
class ModuleNotFoundError extends WebpackError {
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of ModuleNotFoundError.
|
|
47
|
+
* @param {Module | null} module module tied to dependency
|
|
48
|
+
* @param {Error & { details?: string }} err error thrown
|
|
49
|
+
* @param {DependencyLocation} loc location of dependency
|
|
50
|
+
*/
|
|
51
|
+
constructor(module, err, loc) {
|
|
52
|
+
let message = `Module not found: ${err.toString()}`;
|
|
53
|
+
|
|
54
|
+
// TODO remove in webpack 6
|
|
55
|
+
const match = err.message.match(/Can't resolve '([^']+)'/);
|
|
56
|
+
if (match) {
|
|
57
|
+
const request = match[1];
|
|
58
|
+
const alias =
|
|
59
|
+
previouslyPolyfilledBuiltinModules[
|
|
60
|
+
/** @type {keyof previouslyPolyfilledBuiltinModules} */ (request)
|
|
61
|
+
];
|
|
62
|
+
if (alias) {
|
|
63
|
+
const pathIndex = alias.indexOf("/");
|
|
64
|
+
const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias;
|
|
65
|
+
message +=
|
|
66
|
+
"\n\n" +
|
|
67
|
+
"BREAKING CHANGE: " +
|
|
68
|
+
"webpack < 5 used to include polyfills for node.js core modules by default.\n" +
|
|
69
|
+
"This is no longer the case. Verify if you need this module and configure a polyfill for it.\n\n";
|
|
70
|
+
message +=
|
|
71
|
+
"If you want to include a polyfill, you need to:\n" +
|
|
72
|
+
`\t- add a fallback 'resolve.fallback: { "${request}": require.resolve("${alias}") }'\n` +
|
|
73
|
+
`\t- install '${dependency}'\n`;
|
|
74
|
+
message +=
|
|
75
|
+
"If you don't want to include a polyfill, you can use an empty module like this:\n" +
|
|
76
|
+
`\tresolve.fallback: { "${request}": false }`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
super(message);
|
|
81
|
+
|
|
82
|
+
/** @type {string} */
|
|
83
|
+
this.name = "ModuleNotFoundError";
|
|
84
|
+
this.details = err.details;
|
|
85
|
+
this.module = module;
|
|
86
|
+
this.error = err;
|
|
87
|
+
this.loc = loc;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = ModuleNotFoundError;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
8
9
|
const WebpackError = require("./WebpackError");
|
|
9
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
10
10
|
|
|
11
|
-
/** @typedef {import("
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
14
|
-
/** @typedef {import("
|
|
11
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
12
|
+
/** @typedef {import("../Dependency").SourcePosition} SourcePosition */
|
|
13
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
14
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
15
15
|
|
|
16
16
|
const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]);
|
|
17
17
|
|
|
@@ -94,7 +94,9 @@ class ModuleParseError extends WebpackError {
|
|
|
94
94
|
|
|
95
95
|
/** @type {string} */
|
|
96
96
|
this.name = "ModuleParseError";
|
|
97
|
+
/** @type {undefined | DependencyLocation} */
|
|
97
98
|
this.loc = loc;
|
|
99
|
+
/** @type {Error} */
|
|
98
100
|
this.error = err;
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -123,6 +125,6 @@ class ModuleParseError extends WebpackError {
|
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
makeSerializable(ModuleParseError, "webpack/lib/ModuleParseError");
|
|
128
|
+
makeSerializable(ModuleParseError, "webpack/lib/errors/ModuleParseError");
|
|
127
129
|
|
|
128
130
|
module.exports = ModuleParseError;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const { cleanUp } = require("
|
|
8
|
+
const { cleanUp } = require("../ErrorHelpers");
|
|
9
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
9
10
|
const WebpackError = require("./WebpackError");
|
|
10
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
11
11
|
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
12
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
13
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
14
14
|
|
|
15
15
|
class ModuleWarning extends WebpackError {
|
|
16
16
|
/**
|
|
@@ -65,7 +65,7 @@ class ModuleWarning extends WebpackError {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning");
|
|
68
|
+
makeSerializable(ModuleWarning, "webpack/lib/errors/ModuleWarning");
|
|
69
69
|
|
|
70
70
|
/** @type {typeof ModuleWarning} */
|
|
71
71
|
module.exports = ModuleWarning;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
8
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
11
|
+
const WebpackError = require("./WebpackError");
|
|
12
12
|
|
|
13
13
|
class NodeStuffInWebError extends WebpackError {
|
|
14
14
|
/**
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
9
|
+
const WebpackError = require("./WebpackError");
|
|
10
|
+
|
|
11
|
+
class NonErrorEmittedError extends WebpackError {
|
|
12
|
+
/**
|
|
13
|
+
* @param {EXPECTED_ANY} error value which is not an instance of Error
|
|
14
|
+
*/
|
|
15
|
+
constructor(error) {
|
|
16
|
+
super();
|
|
17
|
+
|
|
18
|
+
this.name = "NonErrorEmittedError";
|
|
19
|
+
this.message = `(Emitted value instead of an instance of Error) ${error}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
makeSerializable(
|
|
24
|
+
NonErrorEmittedError,
|
|
25
|
+
"webpack/lib/errors/NonErrorEmittedError"
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
module.exports = NonErrorEmittedError;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
8
9
|
const WebpackError = require("./WebpackError");
|
|
9
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Error raised when webpack encounters a resource URI scheme that no installed
|
|
@@ -33,7 +33,7 @@ class UnhandledSchemeError extends WebpackError {
|
|
|
33
33
|
|
|
34
34
|
makeSerializable(
|
|
35
35
|
UnhandledSchemeError,
|
|
36
|
-
"webpack/lib/UnhandledSchemeError",
|
|
36
|
+
"webpack/lib/errors/UnhandledSchemeError",
|
|
37
37
|
"UnhandledSchemeError"
|
|
38
38
|
);
|
|
39
39
|
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
8
9
|
const WebpackError = require("./WebpackError");
|
|
9
|
-
const makeSerializable = require("./util/makeSerializable");
|
|
10
10
|
|
|
11
|
-
/** @typedef {import("
|
|
11
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
12
12
|
|
|
13
13
|
class UnsupportedFeatureWarning extends WebpackError {
|
|
14
14
|
/**
|
|
@@ -30,7 +30,7 @@ class UnsupportedFeatureWarning extends WebpackError {
|
|
|
30
30
|
|
|
31
31
|
makeSerializable(
|
|
32
32
|
UnsupportedFeatureWarning,
|
|
33
|
-
"webpack/lib/UnsupportedFeatureWarning"
|
|
33
|
+
"webpack/lib/errors/UnsupportedFeatureWarning"
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
module.exports = UnsupportedFeatureWarning;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Jarid Margolin @jaridmargolin
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const inspect = require("util").inspect.custom;
|
|
9
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
10
|
+
|
|
11
|
+
/** @typedef {import("../Chunk")} Chunk */
|
|
12
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
13
|
+
/** @typedef {import("../Module")} Module */
|
|
14
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
15
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
16
|
+
|
|
17
|
+
class WebpackError extends Error {
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of WebpackError.
|
|
20
|
+
* @param {string=} message error message
|
|
21
|
+
* @param {{ cause?: unknown }} options error options
|
|
22
|
+
*/
|
|
23
|
+
constructor(message, options = {}) {
|
|
24
|
+
super(message, options);
|
|
25
|
+
|
|
26
|
+
/** @type {string=} */
|
|
27
|
+
this.details = undefined;
|
|
28
|
+
/** @type {(Module | null)=} */
|
|
29
|
+
this.module = undefined;
|
|
30
|
+
/** @type {DependencyLocation=} */
|
|
31
|
+
this.loc = undefined;
|
|
32
|
+
/** @type {boolean=} */
|
|
33
|
+
this.hideStack = undefined;
|
|
34
|
+
/** @type {Chunk=} */
|
|
35
|
+
this.chunk = undefined;
|
|
36
|
+
/** @type {string=} */
|
|
37
|
+
this.file = undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns inspect message.
|
|
42
|
+
* @returns {string} inspect message
|
|
43
|
+
*/
|
|
44
|
+
[inspect]() {
|
|
45
|
+
return (
|
|
46
|
+
this.stack +
|
|
47
|
+
(this.details ? `\n${this.details}` : "") +
|
|
48
|
+
(this.cause ? `\n${this.cause}` : "")
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Serializes this instance into the provided serializer context.
|
|
54
|
+
* @param {ObjectSerializerContext} context context
|
|
55
|
+
*/
|
|
56
|
+
serialize({ write }) {
|
|
57
|
+
write(this.name);
|
|
58
|
+
write(this.message);
|
|
59
|
+
write(this.stack);
|
|
60
|
+
write(this.cause);
|
|
61
|
+
write(this.details);
|
|
62
|
+
write(this.loc);
|
|
63
|
+
write(this.hideStack);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Restores this instance from the provided deserializer context.
|
|
68
|
+
* @param {ObjectDeserializerContext} context context
|
|
69
|
+
*/
|
|
70
|
+
deserialize({ read }) {
|
|
71
|
+
this.name = read();
|
|
72
|
+
this.message = read();
|
|
73
|
+
this.stack = read();
|
|
74
|
+
this.cause = read();
|
|
75
|
+
this.details = read();
|
|
76
|
+
this.loc = read();
|
|
77
|
+
this.hideStack = read();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
makeSerializable(WebpackError, "webpack/lib/errors/WebpackError");
|
|
82
|
+
|
|
83
|
+
/** @type {typeof WebpackError} */
|
|
84
|
+
module.exports = WebpackError;
|