webpack 5.106.2 → 5.107.0
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/Cache.js +3 -6
- package/lib/CompatibilityPlugin.js +8 -7
- package/lib/Compilation.js +34 -26
- 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 -9
- package/lib/ExternalModule.js +76 -15
- package/lib/ExternalModuleFactoryPlugin.js +5 -0
- 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 +19 -18
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleSourceTypeConstants.js +31 -1
- package/lib/ModuleTypeConstants.js +12 -3
- package/lib/MultiCompiler.js +2 -2
- package/lib/NodeStuffPlugin.js +1 -1
- package/lib/NormalModule.js +13 -31
- package/lib/NormalModuleFactory.js +10 -2
- 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 +11 -0
- 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 +6 -2
- package/lib/asset/AssetGenerator.js +22 -8
- package/lib/asset/AssetModulesPlugin.js +3 -1
- package/lib/asset/AssetSourceGenerator.js +6 -2
- 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 +166 -86
- 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 +4 -3
- 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 +25 -0
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +1 -1
- 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 +318 -0
- package/lib/dependencies/HtmlSourceDependency.js +127 -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/{ModuleNotFoundError.js → errors/ModuleNotFoundError.js} +2 -2
- 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 +433 -0
- package/lib/html/HtmlParser.js +1489 -0
- package/lib/html/walkHtmlTokens.js +2733 -0
- package/lib/ids/IdHelpers.js +2 -1
- package/lib/index.js +34 -15
- package/lib/javascript/JavascriptModulesPlugin.js +89 -8
- 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 +111 -3
- package/lib/optimize/SplitChunksPlugin.js +1 -1
- 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/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 +2 -2
- package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +1 -1
- 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 +2 -2
- 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 +22 -20
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +118 -3
- 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/{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 +810 -101
- 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
|
@@ -6,41 +6,41 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const { OriginalSource, RawSource } = require("webpack-sources");
|
|
9
|
-
const Module = require("
|
|
9
|
+
const Module = require("../Module");
|
|
10
10
|
const {
|
|
11
11
|
JAVASCRIPT_TYPE,
|
|
12
12
|
JAVASCRIPT_TYPES
|
|
13
|
-
} = require("
|
|
14
|
-
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("
|
|
15
|
-
const RuntimeGlobals = require("
|
|
16
|
-
const DelegatedSourceDependency = require("
|
|
17
|
-
const StaticExportsDependency = require("
|
|
18
|
-
const makeSerializable = require("
|
|
13
|
+
} = require("../ModuleSourceTypeConstants");
|
|
14
|
+
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("../ModuleTypeConstants");
|
|
15
|
+
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
16
|
+
const DelegatedSourceDependency = require("../dependencies/DelegatedSourceDependency");
|
|
17
|
+
const StaticExportsDependency = require("../dependencies/StaticExportsDependency");
|
|
18
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
19
19
|
|
|
20
|
-
/** @typedef {import("
|
|
21
|
-
/** @typedef {import("
|
|
22
|
-
/** @typedef {import("
|
|
23
|
-
/** @typedef {import("
|
|
24
|
-
/** @typedef {import("
|
|
20
|
+
/** @typedef {import("../../declarations/plugins/dll/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
|
|
21
|
+
/** @typedef {import("../config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptions */
|
|
22
|
+
/** @typedef {import("../Compilation")} Compilation */
|
|
23
|
+
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
|
24
|
+
/** @typedef {import("../Generator").SourceTypes} SourceTypes */
|
|
25
25
|
/** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */
|
|
26
|
-
/** @typedef {import("
|
|
27
|
-
/** @typedef {import("
|
|
28
|
-
/** @typedef {import("
|
|
29
|
-
/** @typedef {import("
|
|
30
|
-
/** @typedef {import("
|
|
31
|
-
/** @typedef {import("
|
|
32
|
-
/** @typedef {import("
|
|
33
|
-
/** @typedef {import("
|
|
34
|
-
/** @typedef {import("
|
|
35
|
-
/** @typedef {import("
|
|
36
|
-
/** @typedef {import("
|
|
37
|
-
/** @typedef {import("
|
|
38
|
-
/** @typedef {import("
|
|
39
|
-
/** @typedef {import("
|
|
40
|
-
/** @typedef {import("
|
|
41
|
-
/** @typedef {import("
|
|
42
|
-
/** @typedef {import("
|
|
43
|
-
/** @typedef {import("
|
|
26
|
+
/** @typedef {import("../Module").ModuleId} ModuleId */
|
|
27
|
+
/** @typedef {import("../Module").BuildCallback} BuildCallback */
|
|
28
|
+
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
|
29
|
+
/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */
|
|
30
|
+
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
|
31
|
+
/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */
|
|
32
|
+
/** @typedef {import("../Module").LibIdent} LibIdent */
|
|
33
|
+
/** @typedef {import("../Module").NeedBuildCallback} NeedBuildCallback */
|
|
34
|
+
/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */
|
|
35
|
+
/** @typedef {import("../Module").Sources} Sources */
|
|
36
|
+
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
|
37
|
+
/** @typedef {import("../RequestShortener")} RequestShortener */
|
|
38
|
+
/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
|
39
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
40
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
41
|
+
/** @typedef {import("../dependencies/StaticExportsDependency").Exports} Exports */
|
|
42
|
+
/** @typedef {import("../util/Hash")} Hash */
|
|
43
|
+
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
|
44
44
|
|
|
45
45
|
/** @typedef {string} DelegatedModuleSourceRequest */
|
|
46
46
|
|
|
@@ -287,6 +287,6 @@ class DelegatedModule extends Module {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
makeSerializable(DelegatedModule, "webpack/lib/DelegatedModule");
|
|
290
|
+
makeSerializable(DelegatedModule, "webpack/lib/dll/DelegatedModule");
|
|
291
291
|
|
|
292
292
|
module.exports = DelegatedModule;
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
const DelegatedModule = require("./DelegatedModule");
|
|
9
9
|
|
|
10
|
-
/** @typedef {import("
|
|
11
|
-
/** @typedef {import("
|
|
10
|
+
/** @typedef {import("../../declarations/plugins/dll/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
|
|
11
|
+
/** @typedef {import("../../declarations/plugins/dll/DllReferencePlugin").DllReferencePluginOptionsContent} DllReferencePluginOptionsContent */
|
|
12
12
|
/** @typedef {import("./DelegatedModule").DelegatedModuleData} DelegatedModuleData */
|
|
13
13
|
/** @typedef {import("./DelegatedModule").DelegatedModuleSourceRequest} DelegatedModuleSourceRequest */
|
|
14
14
|
/** @typedef {import("./DelegatedModule").DelegatedModuleType} DelegatedModuleType */
|
|
15
|
-
/** @typedef {import("
|
|
16
|
-
/** @typedef {import("
|
|
15
|
+
/** @typedef {import("../NormalModuleFactory")} NormalModuleFactory */
|
|
16
|
+
/** @typedef {import("../util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Defines the options type used by this module.
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const DelegatedSourceDependency = require("../dependencies/DelegatedSourceDependency");
|
|
8
9
|
const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
|
9
|
-
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
|
10
10
|
|
|
11
|
-
/** @typedef {import("
|
|
11
|
+
/** @typedef {import("../Compiler")} Compiler */
|
|
12
12
|
/** @typedef {import("./DelegatedModuleFactoryPlugin").Options} Options */
|
|
13
13
|
|
|
14
14
|
const PLUGIN_NAME = "DelegatedPlugin";
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const DllEntryDependency = require("../dependencies/DllEntryDependency");
|
|
9
|
+
const EntryDependency = require("../dependencies/EntryDependency");
|
|
8
10
|
const DllModuleFactory = require("./DllModuleFactory");
|
|
9
|
-
const DllEntryDependency = require("./dependencies/DllEntryDependency");
|
|
10
|
-
const EntryDependency = require("./dependencies/EntryDependency");
|
|
11
11
|
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
12
|
+
/** @typedef {import("../Compiler")} Compiler */
|
|
13
|
+
/** @typedef {import("../Entrypoint").EntryOptions} EntryOptions */
|
|
14
14
|
|
|
15
15
|
/** @typedef {string[]} Entries */
|
|
16
16
|
/** @typedef {EntryOptions & { name: string }} Options */
|
|
@@ -6,32 +6,32 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const { RawSource } = require("webpack-sources");
|
|
9
|
-
const Module = require("
|
|
9
|
+
const Module = require("../Module");
|
|
10
10
|
const {
|
|
11
11
|
JAVASCRIPT_TYPE,
|
|
12
12
|
JAVASCRIPT_TYPES
|
|
13
|
-
} = require("
|
|
14
|
-
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("
|
|
15
|
-
const RuntimeGlobals = require("
|
|
16
|
-
const makeSerializable = require("
|
|
17
|
-
|
|
18
|
-
/** @typedef {import("
|
|
19
|
-
/** @typedef {import("
|
|
20
|
-
/** @typedef {import("
|
|
21
|
-
/** @typedef {import("
|
|
22
|
-
/** @typedef {import("
|
|
23
|
-
/** @typedef {import("
|
|
24
|
-
/** @typedef {import("
|
|
25
|
-
/** @typedef {import("
|
|
26
|
-
/** @typedef {import("
|
|
27
|
-
/** @typedef {import("
|
|
28
|
-
/** @typedef {import("
|
|
29
|
-
/** @typedef {import("
|
|
30
|
-
/** @typedef {import("
|
|
31
|
-
/** @typedef {import("
|
|
32
|
-
/** @typedef {import("
|
|
33
|
-
/** @typedef {import("
|
|
34
|
-
/** @typedef {import("
|
|
13
|
+
} = require("../ModuleSourceTypeConstants");
|
|
14
|
+
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("../ModuleTypeConstants");
|
|
15
|
+
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
16
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
17
|
+
|
|
18
|
+
/** @typedef {import("../config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptions */
|
|
19
|
+
/** @typedef {import("../Compilation")} Compilation */
|
|
20
|
+
/** @typedef {import("../Dependency")} Dependency */
|
|
21
|
+
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
|
22
|
+
/** @typedef {import("../Generator").SourceTypes} SourceTypes */
|
|
23
|
+
/** @typedef {import("../Module").BuildCallback} BuildCallback */
|
|
24
|
+
/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */
|
|
25
|
+
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
|
26
|
+
/** @typedef {import("../Module").NeedBuildCallback} NeedBuildCallback */
|
|
27
|
+
/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */
|
|
28
|
+
/** @typedef {import("../Module").Sources} Sources */
|
|
29
|
+
/** @typedef {import("../RequestShortener")} RequestShortener */
|
|
30
|
+
/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
|
31
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
32
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
33
|
+
/** @typedef {import("../util/Hash")} Hash */
|
|
34
|
+
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
|
35
35
|
|
|
36
36
|
const RUNTIME_REQUIREMENTS = new Set([
|
|
37
37
|
RuntimeGlobals.require,
|
|
@@ -181,6 +181,6 @@ class DllModule extends Module {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
makeSerializable(DllModule, "webpack/lib/DllModule");
|
|
184
|
+
makeSerializable(DllModule, "webpack/lib/dll/DllModule");
|
|
185
185
|
|
|
186
186
|
module.exports = DllModule;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const ModuleFactory = require("../ModuleFactory");
|
|
8
9
|
const DllModule = require("./DllModule");
|
|
9
|
-
const ModuleFactory = require("./ModuleFactory");
|
|
10
10
|
|
|
11
|
-
/** @typedef {import("
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
11
|
+
/** @typedef {import("../ModuleFactory").ModuleFactoryCallback} ModuleFactoryCallback */
|
|
12
|
+
/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
|
|
13
|
+
/** @typedef {import("../dependencies/DllEntryDependency")} DllEntryDependency */
|
|
14
14
|
|
|
15
15
|
class DllModuleFactory extends ModuleFactory {
|
|
16
16
|
constructor() {
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const FlagAllModulesAsUsedPlugin = require("../FlagAllModulesAsUsedPlugin");
|
|
8
9
|
const DllEntryPlugin = require("./DllEntryPlugin");
|
|
9
|
-
const FlagAllModulesAsUsedPlugin = require("./FlagAllModulesAsUsedPlugin");
|
|
10
10
|
const LibManifestPlugin = require("./LibManifestPlugin");
|
|
11
11
|
|
|
12
|
-
/** @typedef {import("
|
|
13
|
-
/** @typedef {import("
|
|
12
|
+
/** @typedef {import("../../declarations/plugins/dll/DllPlugin").DllPluginOptions} DllPluginOptions */
|
|
13
|
+
/** @typedef {import("../Compiler")} Compiler */
|
|
14
14
|
/** @typedef {import("./DllEntryPlugin").Entries} Entries */
|
|
15
15
|
/** @typedef {import("./DllEntryPlugin").Options} Options */
|
|
16
16
|
|
|
@@ -34,13 +34,14 @@ class DllPlugin {
|
|
|
34
34
|
apply(compiler) {
|
|
35
35
|
compiler.hooks.validate.tap(PLUGIN_NAME, () => {
|
|
36
36
|
compiler.validate(
|
|
37
|
-
() => require("
|
|
37
|
+
() => require("../../schemas/plugins/dll/DllPlugin.json"),
|
|
38
38
|
this.options,
|
|
39
39
|
{
|
|
40
40
|
name: "Dll Plugin",
|
|
41
41
|
baseDataPath: "options"
|
|
42
42
|
},
|
|
43
|
-
(options) =>
|
|
43
|
+
(options) =>
|
|
44
|
+
require("../../schemas/plugins/dll/DllPlugin.check")(options)
|
|
44
45
|
);
|
|
45
46
|
});
|
|
46
47
|
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const ExternalModuleFactoryPlugin = require("../ExternalModuleFactoryPlugin");
|
|
9
|
+
const DelegatedSourceDependency = require("../dependencies/DelegatedSourceDependency");
|
|
10
|
+
const WebpackError = require("../errors/WebpackError");
|
|
11
|
+
const { makePathsRelative } = require("../util/identifier");
|
|
12
|
+
const parseJson = require("../util/parseJson");
|
|
8
13
|
const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
|
9
|
-
const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
|
|
10
|
-
const WebpackError = require("./WebpackError");
|
|
11
|
-
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
|
12
|
-
const { makePathsRelative } = require("./util/identifier");
|
|
13
|
-
const parseJson = require("./util/parseJson");
|
|
14
14
|
|
|
15
|
-
/** @typedef {import("
|
|
16
|
-
/** @typedef {import("
|
|
17
|
-
/** @typedef {import("
|
|
18
|
-
/** @typedef {import("
|
|
19
|
-
/** @typedef {import("
|
|
20
|
-
/** @typedef {import("
|
|
21
|
-
/** @typedef {import("
|
|
15
|
+
/** @typedef {import("../../declarations/WebpackOptions").Externals} Externals */
|
|
16
|
+
/** @typedef {import("../../declarations/plugins/dll/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
|
|
17
|
+
/** @typedef {import("../../declarations/plugins/dll/DllReferencePlugin").DllReferencePluginOptionsContent} DllReferencePluginOptionsContent */
|
|
18
|
+
/** @typedef {import("../../declarations/plugins/dll/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */
|
|
19
|
+
/** @typedef {import("../Compiler")} Compiler */
|
|
20
|
+
/** @typedef {import("../Compiler").CompilationParams} CompilationParams */
|
|
21
|
+
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
|
22
22
|
|
|
23
23
|
/** @typedef {{ path: string, data: DllReferencePluginOptionsManifest | undefined, error: Error | undefined }} CompilationDataItem */
|
|
24
24
|
|
|
@@ -41,14 +41,14 @@ class DllReferencePlugin {
|
|
|
41
41
|
apply(compiler) {
|
|
42
42
|
compiler.hooks.validate.tap(PLUGIN_NAME, () => {
|
|
43
43
|
compiler.validate(
|
|
44
|
-
() => require("
|
|
44
|
+
() => require("../../schemas/plugins/dll/DllReferencePlugin.json"),
|
|
45
45
|
this.options,
|
|
46
46
|
{
|
|
47
47
|
name: "Dll Reference Plugin",
|
|
48
48
|
baseDataPath: "options"
|
|
49
49
|
},
|
|
50
50
|
(options) =>
|
|
51
|
-
require("
|
|
51
|
+
require("../../schemas/plugins/dll/DllReferencePlugin.check")(options)
|
|
52
52
|
);
|
|
53
53
|
});
|
|
54
54
|
compiler.hooks.compilation.tap(
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const asyncLib = require("neo-async");
|
|
9
|
-
const EntryDependency = require("
|
|
10
|
-
const { someInIterable } = require("
|
|
11
|
-
const { compareModulesById } = require("
|
|
12
|
-
const { dirname, mkdirp } = require("
|
|
9
|
+
const EntryDependency = require("../dependencies/EntryDependency");
|
|
10
|
+
const { someInIterable } = require("../util/IterableHelpers");
|
|
11
|
+
const { compareModulesById } = require("../util/comparators");
|
|
12
|
+
const { dirname, mkdirp } = require("../util/fs");
|
|
13
13
|
|
|
14
|
-
/** @typedef {import("
|
|
15
|
-
/** @typedef {import("
|
|
16
|
-
/** @typedef {import("
|
|
17
|
-
/** @typedef {import("
|
|
18
|
-
/** @typedef {import("
|
|
14
|
+
/** @typedef {import("../ChunkGraph").ModuleId} ModuleId */
|
|
15
|
+
/** @typedef {import("../Compiler")} Compiler */
|
|
16
|
+
/** @typedef {import("../Compiler").IntermediateFileSystem} IntermediateFileSystem */
|
|
17
|
+
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
|
18
|
+
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Defines the manifest module data type used by this module.
|
package/lib/{AsyncDependencyToInitialChunkError.js → errors/AsyncDependencyToInitialChunkError.js}
RENAMED
|
@@ -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
|
|
|
13
13
|
/**
|
|
14
14
|
* Error raised when webpack detects an attempt to lazy-load a chunk name that
|
|
@@ -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
|
/**
|
|
14
14
|
* Warning used for comment-related compilation issues, such as malformed magic
|
|
@@ -33,7 +33,7 @@ class CommentCompilationWarning extends WebpackError {
|
|
|
33
33
|
|
|
34
34
|
makeSerializable(
|
|
35
35
|
CommentCompilationWarning,
|
|
36
|
-
"webpack/lib/CommentCompilationWarning"
|
|
36
|
+
"webpack/lib/errors/CommentCompilationWarning"
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
module.exports = CommentCompilationWarning;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const WebpackError = require("./WebpackError");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
class ConcurrentCompilationError extends WebpackError {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(
|
|
13
13
|
"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time."
|
|
@@ -15,4 +15,6 @@ module.exports = class ConcurrentCompilationError extends WebpackError {
|
|
|
15
15
|
|
|
16
16
|
this.name = "ConcurrentCompilationError";
|
|
17
17
|
}
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = ConcurrentCompilationError;
|
package/lib/{EnvironmentNotSupportAsyncWarning.js → errors/EnvironmentNotSupportAsyncWarning.js}
RENAMED
|
@@ -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("../Module")} Module */
|
|
12
|
+
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
|
13
13
|
/** @typedef {"asyncWebAssembly" | "topLevelAwait" | "external promise" | "external script" | "external import" | "external module"} Feature */
|
|
14
14
|
|
|
15
15
|
class EnvironmentNotSupportAsyncWarning extends WebpackError {
|
|
@@ -45,7 +45,7 @@ As a result, the code may not run as expected or may cause runtime errors.`;
|
|
|
45
45
|
|
|
46
46
|
makeSerializable(
|
|
47
47
|
EnvironmentNotSupportAsyncWarning,
|
|
48
|
-
"webpack/lib/EnvironmentNotSupportAsyncWarning"
|
|
48
|
+
"webpack/lib/errors/EnvironmentNotSupportAsyncWarning"
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
module.exports = EnvironmentNotSupportAsyncWarning;
|
|
@@ -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("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
12
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Defines the callback callback.
|
|
@@ -65,7 +65,7 @@ class HookWebpackError extends WebpackError {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
makeSerializable(HookWebpackError, "webpack/lib/HookWebpackError");
|
|
68
|
+
makeSerializable(HookWebpackError, "webpack/lib/errors/HookWebpackError");
|
|
69
69
|
|
|
70
70
|
module.exports = HookWebpackError;
|
|
71
71
|
|
|
@@ -85,7 +85,7 @@ module.exports.makeWebpackError = makeWebpackError;
|
|
|
85
85
|
/**
|
|
86
86
|
* Creates webpack error callback.
|
|
87
87
|
* @template T
|
|
88
|
-
* @param {(err:
|
|
88
|
+
* @param {(err: Error | null, result?: T) => void} callback webpack error callback
|
|
89
89
|
* @param {string} hook name of hook
|
|
90
90
|
* @returns {Callback<T>} generic callback
|
|
91
91
|
*/
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const ModuleFactory = require("
|
|
8
|
+
const ModuleFactory = require("../ModuleFactory");
|
|
9
9
|
|
|
10
|
-
/** @typedef {import("
|
|
11
|
-
/** @typedef {import("
|
|
12
|
-
/** @typedef {import("
|
|
10
|
+
/** @typedef {import("../ModuleFactory").ModuleFactoryCallback} ModuleFactoryCallback */
|
|
11
|
+
/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
|
|
12
|
+
/** @typedef {import("../NormalModuleFactory")} NormalModuleFactory */
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Ignores error when module is unresolved
|
package/lib/{InvalidDependenciesModuleWarning.js → errors/InvalidDependenciesModuleWarning.js}
RENAMED
|
@@ -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("../Module")} Module */
|
|
12
12
|
|
|
13
13
|
class InvalidDependenciesModuleWarning extends WebpackError {
|
|
14
14
|
/**
|
|
@@ -39,7 +39,7 @@ ${depsList.slice(0, 3).join("\n")}${
|
|
|
39
39
|
|
|
40
40
|
makeSerializable(
|
|
41
41
|
InvalidDependenciesModuleWarning,
|
|
42
|
-
"webpack/lib/InvalidDependenciesModuleWarning"
|
|
42
|
+
"webpack/lib/errors/InvalidDependenciesModuleWarning"
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
module.exports = InvalidDependenciesModuleWarning;
|
|
@@ -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;
|