webpack 5.93.0 → 5.95.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 +8 -5
- package/bin/webpack.js +6 -7
- package/hot/log.js +1 -2
- package/hot/only-dev-server.js +1 -1
- package/hot/poll.js +1 -1
- package/hot/signal.js +1 -1
- package/lib/APIPlugin.js +4 -3
- package/lib/AbstractMethodError.js +10 -5
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +12 -6
- package/lib/Cache.js +8 -10
- package/lib/CacheFacade.js +3 -3
- package/lib/CaseSensitiveModulesWarning.js +5 -7
- package/lib/Chunk.js +14 -11
- package/lib/ChunkGraph.js +58 -36
- package/lib/ChunkGroup.js +2 -3
- package/lib/ChunkTemplate.js +43 -0
- package/lib/CleanPlugin.js +10 -11
- package/lib/CodeGenerationResults.js +6 -5
- package/lib/CommentCompilationWarning.js +0 -1
- package/lib/Compilation.js +223 -191
- package/lib/Compiler.js +81 -82
- package/lib/ConcatenationScope.js +3 -6
- package/lib/ConditionalInitFragment.js +6 -7
- package/lib/ConstPlugin.js +7 -15
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +33 -20
- package/lib/ContextModuleFactory.js +89 -44
- package/lib/ContextReplacementPlugin.js +10 -9
- package/lib/DefinePlugin.js +75 -68
- package/lib/DelegatedModule.js +7 -3
- package/lib/DelegatedModuleFactoryPlugin.js +36 -22
- package/lib/DelegatedPlugin.js +4 -0
- package/lib/DependenciesBlock.js +0 -1
- package/lib/Dependency.js +10 -14
- package/lib/DllEntryPlugin.js +4 -2
- package/lib/DllModuleFactory.js +1 -0
- package/lib/DllPlugin.js +9 -7
- package/lib/DllReferencePlugin.js +30 -15
- package/lib/EntryPlugin.js +1 -3
- package/lib/EnvironmentPlugin.js +6 -2
- package/lib/ErrorHelpers.js +11 -12
- package/lib/EvalDevToolModulePlugin.js +10 -12
- package/lib/EvalSourceMapDevToolPlugin.js +15 -13
- package/lib/ExportsInfo.js +185 -120
- package/lib/ExternalModule.js +41 -15
- package/lib/ExternalModuleFactoryPlugin.js +23 -10
- package/lib/FileSystemInfo.js +791 -422
- package/lib/FlagAllModulesAsUsedPlugin.js +1 -1
- package/lib/FlagDependencyExportsPlugin.js +12 -11
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +2 -5
- package/lib/GraphHelpers.js +3 -2
- package/lib/HookWebpackError.js +8 -10
- package/lib/HotModuleReplacementPlugin.js +78 -64
- package/lib/IgnoreErrorModuleFactory.js +3 -3
- package/lib/IgnorePlugin.js +1 -3
- package/lib/IgnoreWarningsPlugin.js +6 -9
- package/lib/InitFragment.js +2 -3
- package/lib/LibManifestPlugin.js +4 -3
- package/lib/MainTemplate.js +72 -19
- package/lib/Module.js +25 -9
- package/lib/ModuleBuildError.js +4 -11
- package/lib/ModuleDependencyError.js +5 -5
- package/lib/ModuleDependencyWarning.js +5 -5
- package/lib/ModuleError.js +1 -5
- package/lib/ModuleFilenameHelpers.js +29 -46
- package/lib/ModuleGraph.js +7 -6
- package/lib/ModuleGraphConnection.js +6 -6
- package/lib/ModuleInfoHeaderPlugin.js +82 -30
- package/lib/ModuleParseError.js +8 -9
- package/lib/ModuleRestoreError.js +1 -1
- package/lib/ModuleStoreError.js +1 -1
- package/lib/ModuleTemplate.js +33 -1
- package/lib/ModuleTypeConstants.js +21 -22
- package/lib/ModuleWarning.js +1 -5
- package/lib/MultiCompiler.js +24 -26
- package/lib/MultiStats.js +73 -31
- package/lib/MultiWatching.js +1 -1
- package/lib/NormalModule.js +130 -69
- package/lib/NormalModuleFactory.js +53 -49
- package/lib/OptimizationStages.js +3 -3
- package/lib/ProgressPlugin.js +9 -9
- package/lib/ProvidePlugin.js +4 -4
- package/lib/RuntimeGlobals.js +71 -70
- package/lib/RuntimeModule.js +1 -1
- package/lib/RuntimePlugin.js +24 -12
- package/lib/RuntimeTemplate.js +40 -44
- package/lib/SizeFormatHelpers.js +2 -4
- package/lib/SourceMapDevToolPlugin.js +42 -34
- package/lib/Stats.js +5 -11
- package/lib/Template.js +18 -24
- package/lib/TemplatedPathPlugin.js +21 -13
- package/lib/WarnDeprecatedOptionPlugin.js +0 -1
- package/lib/WatchIgnorePlugin.js +26 -9
- package/lib/Watching.js +10 -5
- package/lib/WebpackOptionsApply.js +84 -62
- package/lib/asset/AssetGenerator.js +107 -42
- package/lib/asset/AssetModulesPlugin.js +29 -23
- package/lib/asset/AssetSourceGenerator.js +2 -7
- package/lib/async-modules/AwaitDependenciesInitFragment.js +6 -7
- package/lib/buildChunkGraph.js +93 -81
- package/lib/cache/IdleFileCachePlugin.js +4 -4
- package/lib/cache/MemoryWithGcCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +51 -50
- package/lib/cache/ResolverCachePlugin.js +6 -6
- package/lib/cache/mergeEtags.js +16 -21
- package/lib/cli.js +148 -104
- package/lib/config/browserslistTargetHandler.js +16 -13
- package/lib/config/defaults.js +32 -28
- package/lib/config/normalization.js +335 -344
- package/lib/config/target.js +42 -52
- package/lib/container/ContainerEntryModule.js +2 -2
- package/lib/container/ContainerPlugin.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +11 -8
- package/lib/container/options.js +18 -4
- package/lib/css/CssExportsGenerator.js +26 -24
- package/lib/css/CssGenerator.js +9 -4
- package/lib/css/CssLoadingRuntimeModule.js +10 -10
- package/lib/css/CssModulesPlugin.js +127 -47
- package/lib/css/CssParser.js +20 -18
- package/lib/css/walkCssTokens.js +80 -95
- package/lib/debug/ProfilingPlugin.js +19 -20
- package/lib/dependencies/AMDDefineDependency.js +1 -1
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +83 -47
- package/lib/dependencies/AMDRequireArrayDependency.js +9 -10
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +22 -16
- package/lib/dependencies/AMDRuntimeModules.js +2 -2
- package/lib/dependencies/CommonJsDependencyHelpers.js +6 -2
- package/lib/dependencies/CommonJsExportRequireDependency.js +37 -41
- package/lib/dependencies/CommonJsExportsDependency.js +0 -1
- package/lib/dependencies/CommonJsExportsParserPlugin.js +19 -23
- package/lib/dependencies/CommonJsFullRequireDependency.js +1 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +52 -61
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +6 -8
- package/lib/dependencies/ConstDependency.js +1 -1
- package/lib/dependencies/ContextDependency.js +7 -2
- package/lib/dependencies/ContextDependencyHelpers.js +31 -34
- package/lib/dependencies/ContextElementDependency.js +35 -8
- package/lib/dependencies/CriticalDependencyWarning.js +1 -1
- package/lib/dependencies/CssExportDependency.js +7 -7
- package/lib/dependencies/CssImportDependency.js +0 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +3 -3
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/CssUrlDependency.js +4 -5
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/ExportsInfoDependency.js +1 -2
- package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -5
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +27 -16
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +107 -64
- package/lib/dependencies/HarmonyExports.js +2 -2
- package/lib/dependencies/HarmonyImportDependency.js +2 -4
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +40 -15
- package/lib/dependencies/ImportDependency.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +5 -5
- package/lib/dependencies/ImportMetaPlugin.js +11 -13
- package/lib/dependencies/ImportParserPlugin.js +39 -44
- package/lib/dependencies/JsonExportsDependency.js +22 -18
- package/lib/dependencies/LoaderPlugin.js +47 -36
- package/lib/dependencies/LocalModule.js +1 -1
- package/lib/dependencies/LocalModulesHelpers.js +4 -4
- package/lib/dependencies/ModuleDecoratorDependency.js +1 -1
- package/lib/dependencies/ProvidedDependency.js +1 -1
- package/lib/dependencies/PureExpressionDependency.js +6 -6
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/URLDependency.js +3 -3
- package/lib/dependencies/URLPlugin.js +66 -12
- package/lib/dependencies/WorkerPlugin.js +25 -24
- package/lib/dependencies/processExportInfo.js +3 -1
- package/lib/electron/ElectronTargetPlugin.js +1 -0
- package/lib/esm/ModuleChunkFormatPlugin.js +3 -3
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -3
- package/lib/formatLocation.js +1 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +4 -5
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -0
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +9 -12
- package/lib/hmr/LazyCompilationPlugin.js +27 -12
- package/lib/hmr/lazyCompilationBackend.js +64 -40
- package/lib/ids/ChunkModuleIdRangePlugin.js +1 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +2 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/ids/HashedModuleIdsPlugin.js +5 -1
- package/lib/ids/IdHelpers.js +29 -39
- package/lib/ids/SyncModuleIdsPlugin.js +7 -2
- package/lib/index.js +1 -5
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +5 -4
- package/lib/javascript/BasicEvaluatedExpression.js +4 -19
- package/lib/javascript/ChunkHelpers.js +1 -1
- package/lib/javascript/CommonJsChunkFormatPlugin.js +3 -2
- package/lib/javascript/EnableChunkLoadingPlugin.js +7 -6
- package/lib/javascript/JavascriptGenerator.js +23 -7
- package/lib/javascript/JavascriptModulesPlugin.js +133 -86
- package/lib/javascript/JavascriptParser.js +179 -200
- package/lib/javascript/JavascriptParserHelpers.js +20 -21
- package/lib/javascript/StartupHelpers.js +41 -13
- package/lib/json/JsonGenerator.js +7 -13
- package/lib/json/JsonModulesPlugin.js +1 -4
- package/lib/json/JsonParser.js +5 -3
- package/lib/library/AmdLibraryPlugin.js +12 -16
- package/lib/library/AssignLibraryPlugin.js +8 -10
- package/lib/library/EnableLibraryPlugin.js +15 -14
- package/lib/library/JsonpLibraryPlugin.js +2 -1
- package/lib/library/ModernModuleLibraryPlugin.js +8 -6
- package/lib/library/ModuleLibraryPlugin.js +2 -1
- package/lib/library/SystemLibraryPlugin.js +2 -1
- package/lib/library/UmdLibraryPlugin.js +66 -92
- package/lib/logging/Logger.js +32 -4
- package/lib/logging/createConsoleLogger.js +12 -13
- package/lib/logging/runtime.js +7 -8
- package/lib/logging/truncateArgs.js +5 -8
- package/lib/node/NodeWatchFileSystem.js +3 -18
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -0
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/nodeConsole.js +22 -22
- package/lib/optimize/AggressiveMergingPlugin.js +2 -4
- package/lib/optimize/AggressiveSplittingPlugin.js +16 -19
- package/lib/optimize/ConcatenatedModule.js +81 -51
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -3
- package/lib/optimize/InnerGraph.js +17 -17
- package/lib/optimize/InnerGraphPlugin.js +8 -7
- package/lib/optimize/LimitChunkCountPlugin.js +2 -3
- package/lib/optimize/MangleExportsPlugin.js +1 -0
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinMaxSizeWarning.js +1 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +54 -78
- package/lib/optimize/RealContentHashPlugin.js +7 -10
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/SideEffectsFlagPlugin.js +6 -2
- package/lib/optimize/SplitChunksPlugin.js +34 -30
- package/lib/performance/SizeLimitsPlugin.js +2 -2
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -1
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -1
- package/lib/rules/BasicEffectRulePlugin.js +3 -1
- package/lib/rules/BasicMatcherRulePlugin.js +3 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +4 -1
- package/lib/rules/RuleSetCompiler.js +41 -22
- package/lib/rules/UseEffectRulePlugin.js +36 -32
- package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
- package/lib/runtime/AutoPublicPathRuntimeModule.js +8 -3
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +2 -2
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +1 -1
- package/lib/runtime/EnsureChunkRuntimeModule.js +10 -11
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +11 -17
- package/lib/runtime/LoadScriptRuntimeModule.js +17 -18
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -3
- package/lib/schemes/DataUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +241 -126
- package/lib/serialization/BinaryMiddleware.js +44 -28
- package/lib/serialization/DateObjectSerializer.js +1 -0
- package/lib/serialization/ErrorObjectSerializer.js +2 -0
- package/lib/serialization/FileMiddleware.js +154 -106
- package/lib/serialization/MapObjectSerializer.js +2 -1
- package/lib/serialization/NullPrototypeObjectSerializer.js +3 -2
- package/lib/serialization/ObjectMiddleware.js +52 -56
- package/lib/serialization/PlainObjectSerializer.js +32 -6
- package/lib/serialization/RegExpObjectSerializer.js +1 -0
- package/lib/serialization/Serializer.js +4 -5
- package/lib/serialization/SerializerMiddleware.js +6 -6
- package/lib/serialization/SetObjectSerializer.js +2 -1
- package/lib/sharing/ConsumeSharedPlugin.js +116 -97
- package/lib/sharing/ConsumeSharedRuntimeModule.js +4 -4
- package/lib/sharing/ProvideForSharedDependency.js +0 -1
- package/lib/sharing/ProvideSharedPlugin.js +2 -2
- package/lib/sharing/resolveMatchedConfigs.js +2 -1
- package/lib/sharing/utils.js +15 -27
- package/lib/stats/DefaultStatsFactoryPlugin.js +424 -281
- package/lib/stats/DefaultStatsPresetPlugin.js +73 -18
- package/lib/stats/DefaultStatsPrinterPlugin.js +370 -101
- package/lib/stats/StatsFactory.js +127 -56
- package/lib/stats/StatsPrinter.js +75 -44
- package/lib/util/ArrayHelpers.js +8 -4
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +31 -12
- package/lib/util/IterableHelpers.js +3 -4
- package/lib/util/LazyBucketSortedSet.js +60 -44
- package/lib/util/LazySet.js +13 -0
- package/lib/util/MapHelpers.js +1 -3
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/Queue.js +1 -1
- package/lib/util/Semaphore.js +4 -7
- package/lib/util/SetHelpers.js +5 -5
- package/lib/util/SortableSet.js +4 -3
- package/lib/util/StackedCacheMap.js +4 -6
- package/lib/util/StackedMap.js +1 -3
- package/lib/util/StringXor.js +0 -5
- package/lib/util/TupleQueue.js +1 -1
- package/lib/util/TupleSet.js +15 -5
- package/lib/util/URLAbsoluteSpecifier.js +7 -7
- package/lib/util/WeakTupleMap.js +19 -21
- package/lib/util/binarySearchBounds.js +5 -12
- package/lib/util/chainedImports.js +1 -1
- package/lib/util/cleverMerge.js +21 -19
- package/lib/util/comparators.js +57 -52
- package/lib/util/compileBooleanMatcher.js +3 -6
- package/lib/util/conventions.js +8 -11
- package/lib/util/createHash.js +9 -6
- package/lib/util/deprecation.js +22 -12
- package/lib/util/deterministicGrouping.js +19 -26
- package/lib/util/findGraphRoots.js +2 -2
- package/lib/util/fs.js +32 -32
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/wasm-hash.js +7 -7
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/identifier.js +81 -59
- package/lib/util/memoize.js +8 -10
- package/lib/util/mergeScope.js +6 -9
- package/lib/util/nonNumericOnlyHash.js +2 -2
- package/lib/util/numberHash.js +1 -6
- package/lib/util/objectToMap.js +0 -1
- package/lib/util/propertyAccess.js +2 -5
- package/lib/util/propertyName.js +1 -3
- package/lib/util/registerExternalSerializer.js +1 -1
- package/lib/util/runtime.js +109 -113
- package/lib/util/semver.js +29 -27
- package/lib/util/serialization.js +16 -1
- package/lib/util/smartGrouping.js +5 -5
- package/lib/util/source.js +1 -1
- package/lib/wasm/EnableWasmLoadingPlugin.js +5 -4
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -6
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +20 -19
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -29
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -3
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +18 -17
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +5 -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/types.d.ts +681 -355
package/lib/Compilation.js
CHANGED
@@ -94,6 +94,7 @@ const { isSourceEqual } = require("./util/source");
|
|
94
94
|
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
|
95
95
|
/** @typedef {import("./Cache")} Cache */
|
96
96
|
/** @typedef {import("./CacheFacade")} CacheFacade */
|
97
|
+
/** @typedef {import("./Chunk").ChunkId} ChunkId */
|
97
98
|
/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
|
98
99
|
/** @typedef {import("./Compiler")} Compiler */
|
99
100
|
/** @typedef {import("./Compiler").CompilationParams} CompilationParams */
|
@@ -116,6 +117,7 @@ const { isSourceEqual } = require("./util/source");
|
|
116
117
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
|
117
118
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
|
118
119
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
|
120
|
+
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
|
119
121
|
/** @typedef {import("./util/Hash")} Hash */
|
120
122
|
/**
|
121
123
|
* @template T
|
@@ -133,7 +135,7 @@ const { isSourceEqual } = require("./util/source");
|
|
133
135
|
/**
|
134
136
|
* @callback ModuleCallback
|
135
137
|
* @param {(WebpackError | null)=} err
|
136
|
-
* @param {Module=} result
|
138
|
+
* @param {(Module | null)=} result
|
137
139
|
* @returns {void}
|
138
140
|
*/
|
139
141
|
|
@@ -153,7 +155,7 @@ const { isSourceEqual } = require("./util/source");
|
|
153
155
|
|
154
156
|
/**
|
155
157
|
* @callback ExecuteModuleCallback
|
156
|
-
* @param {
|
158
|
+
* @param {WebpackError | null} err
|
157
159
|
* @param {ExecuteModuleResult=} result
|
158
160
|
* @returns {void}
|
159
161
|
*/
|
@@ -246,7 +248,7 @@ const { isSourceEqual } = require("./util/source");
|
|
246
248
|
/**
|
247
249
|
* @typedef {object} LogEntry
|
248
250
|
* @property {string} type
|
249
|
-
* @property {any[]} args
|
251
|
+
* @property {any[]=} args
|
250
252
|
* @property {number} time
|
251
253
|
* @property {string[]=} trace
|
252
254
|
*/
|
@@ -269,6 +271,8 @@ const { isSourceEqual } = require("./util/source");
|
|
269
271
|
|
270
272
|
/** @typedef {KnownAssetInfo & Record<string, any>} AssetInfo */
|
271
273
|
|
274
|
+
/** @typedef {{ path: string, info: AssetInfo }} InterpolatedPathAndAssetInfo */
|
275
|
+
|
272
276
|
/**
|
273
277
|
* @typedef {object} Asset
|
274
278
|
* @property {string} name the filename of the asset
|
@@ -350,7 +354,7 @@ const { isSourceEqual } = require("./util/source");
|
|
350
354
|
* @property {boolean=} forToString
|
351
355
|
*/
|
352
356
|
|
353
|
-
/** @typedef {
|
357
|
+
/** @typedef {Record<string, any> & KnownCreateStatsOptionsContext} CreateStatsOptionsContext */
|
354
358
|
|
355
359
|
/** @typedef {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} CodeGenerationJobs */
|
356
360
|
|
@@ -358,6 +362,8 @@ const { isSourceEqual } = require("./util/source");
|
|
358
362
|
|
359
363
|
/** @typedef {Set<Module>} NotCodeGeneratedModules */
|
360
364
|
|
365
|
+
/** @typedef {string | Set<string> | undefined} ValueCacheVersion */
|
366
|
+
|
361
367
|
/** @type {AssetInfo} */
|
362
368
|
const EMPTY_ASSET_INFO = Object.freeze({});
|
363
369
|
|
@@ -369,9 +375,8 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
|
|
369
375
|
* @param {Compilation} compilation compilation
|
370
376
|
* @returns {NormalModuleCompilationHooks["loader"]} hooks
|
371
377
|
*/
|
372
|
-
compilation =>
|
373
|
-
|
374
|
-
},
|
378
|
+
compilation =>
|
379
|
+
require("./NormalModule").getCompilationHooks(compilation).loader,
|
375
380
|
"Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader",
|
376
381
|
"DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK"
|
377
382
|
);
|
@@ -448,7 +453,7 @@ class Compilation {
|
|
448
453
|
* @returns {CompilationAssets} new assets
|
449
454
|
*/
|
450
455
|
const popNewAssets = assets => {
|
451
|
-
let newAssets
|
456
|
+
let newAssets;
|
452
457
|
for (const file of Object.keys(assets)) {
|
453
458
|
if (savedAssets.has(file)) continue;
|
454
459
|
if (newAssets === undefined) {
|
@@ -484,8 +489,8 @@ class Compilation {
|
|
484
489
|
fn: (assets, callback) => {
|
485
490
|
try {
|
486
491
|
fn(assets);
|
487
|
-
} catch (
|
488
|
-
return callback(
|
492
|
+
} catch (err) {
|
493
|
+
return callback(err);
|
489
494
|
}
|
490
495
|
if (processedAssets !== undefined)
|
491
496
|
processedAssets.add(this.assets);
|
@@ -571,7 +576,11 @@ class Compilation {
|
|
571
576
|
* @returns {FakeHook<Pick<AsyncSeriesHook<T>, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects
|
572
577
|
*/
|
573
578
|
const createProcessAssetsHook = (name, stage, getArgs, code) => {
|
574
|
-
if (!this._backCompat && code) return
|
579
|
+
if (!this._backCompat && code) return;
|
580
|
+
/**
|
581
|
+
* @param {string} reason reason
|
582
|
+
* @returns {string} error message
|
583
|
+
*/
|
575
584
|
const errorMessage =
|
576
585
|
reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
|
577
586
|
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
|
@@ -580,7 +589,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
580
589
|
if (options.stage) {
|
581
590
|
throw new Error(errorMessage("it's using the 'stage' option"));
|
582
591
|
}
|
583
|
-
return { ...options, stage
|
592
|
+
return { ...options, stage };
|
584
593
|
};
|
585
594
|
return createFakeHook(
|
586
595
|
{
|
@@ -662,14 +671,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
662
671
|
*/
|
663
672
|
afterChunks: new SyncHook(["chunks"]),
|
664
673
|
|
665
|
-
/** @type {SyncBailHook<[Iterable<Module>]>} */
|
674
|
+
/** @type {SyncBailHook<[Iterable<Module>], boolean | void>} */
|
666
675
|
optimizeDependencies: new SyncBailHook(["modules"]),
|
667
676
|
/** @type {SyncHook<[Iterable<Module>]>} */
|
668
677
|
afterOptimizeDependencies: new SyncHook(["modules"]),
|
669
678
|
|
670
679
|
/** @type {SyncHook<[]>} */
|
671
680
|
optimize: new SyncHook([]),
|
672
|
-
/** @type {SyncBailHook<[Iterable<Module>]>} */
|
681
|
+
/** @type {SyncBailHook<[Iterable<Module>], boolean | void>} */
|
673
682
|
optimizeModules: new SyncBailHook(["modules"]),
|
674
683
|
/** @type {SyncHook<[Iterable<Module>]>} */
|
675
684
|
afterOptimizeModules: new SyncHook(["modules"]),
|
@@ -707,7 +716,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
707
716
|
"runtimeRequirements",
|
708
717
|
"context"
|
709
718
|
]),
|
710
|
-
/** @type {HookMap<SyncBailHook<[Module, Set<string>, RuntimeRequirementsContext]>>} */
|
719
|
+
/** @type {HookMap<SyncBailHook<[Module, Set<string>, RuntimeRequirementsContext], void>>} */
|
711
720
|
runtimeRequirementInModule: new HookMap(
|
712
721
|
() => new SyncBailHook(["module", "runtimeRequirements", "context"])
|
713
722
|
),
|
@@ -717,7 +726,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
717
726
|
"runtimeRequirements",
|
718
727
|
"context"
|
719
728
|
]),
|
720
|
-
/** @type {HookMap<SyncBailHook<[Chunk, Set<string>, RuntimeRequirementsContext]>>} */
|
729
|
+
/** @type {HookMap<SyncBailHook<[Chunk, Set<string>, RuntimeRequirementsContext], void>>} */
|
721
730
|
runtimeRequirementInTree: new HookMap(
|
722
731
|
() => new SyncBailHook(["chunk", "runtimeRequirements", "context"])
|
723
732
|
),
|
@@ -912,7 +921,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
912
921
|
true
|
913
922
|
);
|
914
923
|
}
|
915
|
-
/** @type {Map<string,
|
924
|
+
/** @type {Map<string, ValueCacheVersion>} */
|
916
925
|
this.valueCacheVersions = new Map();
|
917
926
|
this.requestShortener = compiler.requestShortener;
|
918
927
|
this.compilerPath = compiler.compilerPath;
|
@@ -1047,6 +1056,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1047
1056
|
this.dependencyTemplates = new DependencyTemplates(
|
1048
1057
|
this.outputOptions.hashFunction
|
1049
1058
|
);
|
1059
|
+
/** @type {Record<string, number>} */
|
1050
1060
|
this.childrenCounters = {};
|
1051
1061
|
/** @type {Set<number|string>} */
|
1052
1062
|
this.usedChunkIds = null;
|
@@ -1099,7 +1109,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1099
1109
|
this._codeGenerationCache = this.getCache("Compilation/codeGeneration");
|
1100
1110
|
|
1101
1111
|
const unsafeCache = options.module.unsafeCache;
|
1102
|
-
this._unsafeCache =
|
1112
|
+
this._unsafeCache = Boolean(unsafeCache);
|
1103
1113
|
this._unsafeCachePredicate =
|
1104
1114
|
typeof unsafeCache === "function" ? unsafeCache : () => true;
|
1105
1115
|
}
|
@@ -1110,14 +1120,15 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1110
1120
|
|
1111
1121
|
/**
|
1112
1122
|
* @param {string | boolean | StatsOptions | undefined} optionsOrPreset stats option value
|
1113
|
-
* @param {CreateStatsOptionsContext} context context
|
1123
|
+
* @param {CreateStatsOptionsContext=} context context
|
1114
1124
|
* @returns {NormalizedStatsOptions} normalized options
|
1115
1125
|
*/
|
1116
1126
|
createStatsOptions(optionsOrPreset, context = {}) {
|
1117
|
-
if (
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1127
|
+
if (typeof optionsOrPreset === "boolean") {
|
1128
|
+
optionsOrPreset = {
|
1129
|
+
preset: optionsOrPreset === false ? "none" : "normal"
|
1130
|
+
};
|
1131
|
+
} else if (typeof optionsOrPreset === "string") {
|
1121
1132
|
optionsOrPreset = { preset: optionsOrPreset };
|
1122
1133
|
}
|
1123
1134
|
if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) {
|
@@ -1125,20 +1136,20 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1125
1136
|
// properties in the prototype chain
|
1126
1137
|
/** @type {Partial<NormalizedStatsOptions>} */
|
1127
1138
|
const options = {};
|
1139
|
+
// eslint-disable-next-line guard-for-in
|
1128
1140
|
for (const key in optionsOrPreset) {
|
1129
|
-
options[key] = optionsOrPreset[key];
|
1141
|
+
options[key] = optionsOrPreset[/** @type {keyof StatsOptions} */ (key)];
|
1130
1142
|
}
|
1131
1143
|
if (options.preset !== undefined) {
|
1132
1144
|
this.hooks.statsPreset.for(options.preset).call(options, context);
|
1133
1145
|
}
|
1134
1146
|
this.hooks.statsNormalize.call(options, context);
|
1135
1147
|
return /** @type {NormalizedStatsOptions} */ (options);
|
1136
|
-
} else {
|
1137
|
-
/** @type {Partial<NormalizedStatsOptions>} */
|
1138
|
-
const options = {};
|
1139
|
-
this.hooks.statsNormalize.call(options, context);
|
1140
|
-
return /** @type {NormalizedStatsOptions} */ (options);
|
1141
1148
|
}
|
1149
|
+
/** @type {Partial<NormalizedStatsOptions>} */
|
1150
|
+
const options = {};
|
1151
|
+
this.hooks.statsNormalize.call(options, context);
|
1152
|
+
return /** @type {NormalizedStatsOptions} */ (options);
|
1142
1153
|
}
|
1143
1154
|
|
1144
1155
|
/**
|
@@ -1209,10 +1220,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1209
1220
|
trace
|
1210
1221
|
};
|
1211
1222
|
if (this.hooks.log.call(name, logEntry) === undefined) {
|
1212
|
-
if (
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1223
|
+
if (
|
1224
|
+
logEntry.type === LogType.profileEnd &&
|
1225
|
+
typeof console.profileEnd === "function"
|
1226
|
+
) {
|
1227
|
+
console.profileEnd(
|
1228
|
+
`[${name}] ${/** @type {NonNullable<LogEntry["args"]>} */ (logEntry.args)[0]}`
|
1229
|
+
);
|
1216
1230
|
}
|
1217
1231
|
if (logEntries === undefined) {
|
1218
1232
|
logEntries = this.logging.get(name);
|
@@ -1222,10 +1236,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1222
1236
|
}
|
1223
1237
|
}
|
1224
1238
|
logEntries.push(logEntry);
|
1225
|
-
if (
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1239
|
+
if (
|
1240
|
+
logEntry.type === LogType.profile &&
|
1241
|
+
typeof console.profile === "function"
|
1242
|
+
) {
|
1243
|
+
console.profile(
|
1244
|
+
`[${name}] ${/** @type {NonNullable<LogEntry["args"]>} */ (logEntry.args)[0]}`
|
1245
|
+
);
|
1229
1246
|
}
|
1230
1247
|
}
|
1231
1248
|
},
|
@@ -1251,36 +1268,33 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1251
1268
|
}
|
1252
1269
|
return `${name}/${childName}`;
|
1253
1270
|
});
|
1254
|
-
} else {
|
1255
|
-
return this.getLogger(() => {
|
1256
|
-
if (typeof name === "function") {
|
1257
|
-
name = name();
|
1258
|
-
if (!name) {
|
1259
|
-
throw new TypeError(
|
1260
|
-
"Compilation.getLogger(name) called with a function not returning a name"
|
1261
|
-
);
|
1262
|
-
}
|
1263
|
-
}
|
1264
|
-
return `${name}/${childName}`;
|
1265
|
-
});
|
1266
1271
|
}
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
if (
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
"Logger.getChildLogger(name) called with a function not returning a name"
|
1275
|
-
);
|
1276
|
-
}
|
1272
|
+
return this.getLogger(() => {
|
1273
|
+
if (typeof name === "function") {
|
1274
|
+
name = name();
|
1275
|
+
if (!name) {
|
1276
|
+
throw new TypeError(
|
1277
|
+
"Compilation.getLogger(name) called with a function not returning a name"
|
1278
|
+
);
|
1277
1279
|
}
|
1278
|
-
|
1279
|
-
}
|
1280
|
-
}
|
1281
|
-
return this.getLogger(`${name}/${childName}`);
|
1282
|
-
}
|
1280
|
+
}
|
1281
|
+
return `${name}/${childName}`;
|
1282
|
+
});
|
1283
1283
|
}
|
1284
|
+
if (typeof childName === "function") {
|
1285
|
+
return this.getLogger(() => {
|
1286
|
+
if (typeof childName === "function") {
|
1287
|
+
childName = childName();
|
1288
|
+
if (!childName) {
|
1289
|
+
throw new TypeError(
|
1290
|
+
"Logger.getChildLogger(name) called with a function not returning a name"
|
1291
|
+
);
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
return `${name}/${childName}`;
|
1295
|
+
});
|
1296
|
+
}
|
1297
|
+
return this.getLogger(`${name}/${childName}`);
|
1284
1298
|
}
|
1285
1299
|
);
|
1286
1300
|
}
|
@@ -1360,7 +1374,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1360
1374
|
|
1361
1375
|
/**
|
1362
1376
|
* Schedules a build of the module object
|
1363
|
-
*
|
1364
1377
|
* @param {Module} module module to be built
|
1365
1378
|
* @param {ModuleCallback} callback the callback
|
1366
1379
|
* @returns {void}
|
@@ -1371,7 +1384,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1371
1384
|
|
1372
1385
|
/**
|
1373
1386
|
* Builds the module object
|
1374
|
-
*
|
1375
1387
|
* @param {Module} module module to be built
|
1376
1388
|
* @param {ModuleCallback} callback the callback
|
1377
1389
|
* @returns {void}
|
@@ -1518,6 +1530,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1518
1530
|
|
1519
1531
|
for (const item of sortedDependencies) {
|
1520
1532
|
inProgressTransitive++;
|
1533
|
+
// eslint-disable-next-line no-loop-func
|
1521
1534
|
this.handleModuleCreation(item, err => {
|
1522
1535
|
// In V8, the Error objects keep a reference to the functions on the stack. These warnings &
|
1523
1536
|
// errors are created inside closures that keep a reference to the Compilation, so errors are
|
@@ -1649,8 +1662,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1649
1662
|
});
|
1650
1663
|
return;
|
1651
1664
|
}
|
1652
|
-
} catch (
|
1653
|
-
console.error(
|
1665
|
+
} catch (err) {
|
1666
|
+
console.error(err);
|
1654
1667
|
}
|
1655
1668
|
}
|
1656
1669
|
processDependencyForResolving(dep);
|
@@ -1742,8 +1755,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1742
1755
|
for (const b of block.blocks) queue.push(b);
|
1743
1756
|
}
|
1744
1757
|
} while (queue.length !== 0);
|
1745
|
-
} catch (
|
1746
|
-
return callback(
|
1758
|
+
} catch (err) {
|
1759
|
+
return callback(err);
|
1747
1760
|
}
|
1748
1761
|
|
1749
1762
|
if (--inProgressSorting === 0) onDependenciesSorted();
|
@@ -1855,10 +1868,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1855
1868
|
if (dependencies.every(d => d.optional)) {
|
1856
1869
|
this.warnings.push(err);
|
1857
1870
|
return callback();
|
1858
|
-
} else {
|
1859
|
-
this.errors.push(err);
|
1860
|
-
return callback(err);
|
1861
1871
|
}
|
1872
|
+
this.errors.push(err);
|
1873
|
+
return callback(err);
|
1862
1874
|
}
|
1863
1875
|
|
1864
1876
|
const newModule = factoryResult.module;
|
@@ -1927,14 +1939,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1927
1939
|
module,
|
1928
1940
|
originModule !== undefined ? originModule : null
|
1929
1941
|
);
|
1930
|
-
if (module !== newModule) {
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
moduleGraph.setProfile(module, currentProfile);
|
1937
|
-
}
|
1942
|
+
if (module !== newModule && currentProfile !== undefined) {
|
1943
|
+
const otherProfile = moduleGraph.getProfile(module);
|
1944
|
+
if (otherProfile !== undefined) {
|
1945
|
+
currentProfile.mergeInto(otherProfile);
|
1946
|
+
} else {
|
1947
|
+
moduleGraph.setProfile(module, currentProfile);
|
1938
1948
|
}
|
1939
1949
|
}
|
1940
1950
|
|
@@ -1967,7 +1977,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1967
1977
|
callback
|
1968
1978
|
) {
|
1969
1979
|
// Check for cycles when build is trigger inside another build
|
1970
|
-
|
1980
|
+
/** @type {Set<Module> | undefined} */
|
1981
|
+
let creatingModuleDuringBuildSet;
|
1971
1982
|
if (checkCycle && this.buildQueue.isProcessing(originModule)) {
|
1972
1983
|
// Track build dependency
|
1973
1984
|
creatingModuleDuringBuildSet =
|
@@ -2063,12 +2074,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2063
2074
|
...contextInfo
|
2064
2075
|
},
|
2065
2076
|
resolveOptions: originModule ? originModule.resolveOptions : undefined,
|
2066
|
-
context:
|
2067
|
-
|
2068
|
-
:
|
2069
|
-
|
2070
|
-
: this.compiler.context,
|
2071
|
-
dependencies: dependencies
|
2077
|
+
context:
|
2078
|
+
context ||
|
2079
|
+
(originModule ? originModule.context : this.compiler.context),
|
2080
|
+
dependencies
|
2072
2081
|
},
|
2073
2082
|
(err, result) => {
|
2074
2083
|
if (result) {
|
@@ -2100,7 +2109,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2100
2109
|
const notFoundError = new ModuleNotFoundError(
|
2101
2110
|
originModule,
|
2102
2111
|
err,
|
2103
|
-
dependencies.map(d => d.loc).
|
2112
|
+
dependencies.map(d => d.loc).find(Boolean)
|
2104
2113
|
);
|
2105
2114
|
return callback(notFoundError, factoryResult ? result : undefined);
|
2106
2115
|
}
|
@@ -2368,7 +2377,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2368
2377
|
*/
|
2369
2378
|
const computeReferences = module => {
|
2370
2379
|
/** @type {References | undefined} */
|
2371
|
-
let references
|
2380
|
+
let references;
|
2372
2381
|
for (const connection of moduleGraph.getOutgoingConnections(module)) {
|
2373
2382
|
const d = connection.dependency;
|
2374
2383
|
const m = connection.module;
|
@@ -2537,9 +2546,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2537
2546
|
const computeReferences = module => {
|
2538
2547
|
const id = chunkGraph.getModuleId(module);
|
2539
2548
|
/** @type {Map<Module, string | number | undefined> | undefined} */
|
2540
|
-
let modules
|
2549
|
+
let modules;
|
2541
2550
|
/** @type {(string | number | null)[] | undefined} */
|
2542
|
-
let blocks
|
2551
|
+
let blocks;
|
2543
2552
|
const outgoing = moduleGraph.getOutgoingConnectionsByModule(module);
|
2544
2553
|
if (outgoing !== undefined) {
|
2545
2554
|
for (const m of outgoing.keys()) {
|
@@ -2560,6 +2569,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2560
2569
|
} else {
|
2561
2570
|
blocks.push(null);
|
2562
2571
|
}
|
2572
|
+
// eslint-disable-next-line prefer-spread
|
2563
2573
|
queue.push.apply(queue, block.blocks);
|
2564
2574
|
}
|
2565
2575
|
}
|
@@ -2589,9 +2599,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2589
2599
|
for (const chunk of chunkGroup.chunks) {
|
2590
2600
|
if (i >= blocks.length || blocks[i++] !== chunk.id) return false;
|
2591
2601
|
}
|
2592
|
-
} else {
|
2593
|
-
|
2602
|
+
} else if (i >= blocks.length || blocks[i++] !== null) {
|
2603
|
+
return false;
|
2594
2604
|
}
|
2605
|
+
// eslint-disable-next-line prefer-spread
|
2595
2606
|
queue.push.apply(queue, block.blocks);
|
2596
2607
|
}
|
2597
2608
|
if (i !== blocks.length) return false;
|
@@ -2686,6 +2697,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2686
2697
|
|
2687
2698
|
const logger = this.getLogger("webpack.Compilation.ModuleProfile");
|
2688
2699
|
// Avoid coverage problems due indirect changes
|
2700
|
+
/**
|
2701
|
+
* @param {number} value value
|
2702
|
+
* @param {string} msg message
|
2703
|
+
*/
|
2689
2704
|
/* istanbul ignore next */
|
2690
2705
|
const logByValue = (value, msg) => {
|
2691
2706
|
if (value > 1000) {
|
@@ -2739,7 +2754,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2739
2754
|
for (const [module, profile] of modulesWithProfiles) {
|
2740
2755
|
const list = getOrInsert(
|
2741
2756
|
map,
|
2742
|
-
module.type
|
2757
|
+
`${module.type}!${module.identifier().replace(/(!|^)[^!]*$/, "")}`,
|
2743
2758
|
() => []
|
2744
2759
|
);
|
2745
2760
|
list.push({ module, profile });
|
@@ -2897,6 +2912,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2897
2912
|
* @returns {void}
|
2898
2913
|
*/
|
2899
2914
|
seal(callback) {
|
2915
|
+
/**
|
2916
|
+
* @param {WebpackError=} err err
|
2917
|
+
* @returns {void}
|
2918
|
+
*/
|
2900
2919
|
const finalCallback = err => {
|
2901
2920
|
this.factorizeQueue.clear();
|
2902
2921
|
this.buildQueue.clear();
|
@@ -2966,11 +2985,15 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2966
2985
|
|
2967
2986
|
this.assignDepths(entryModules);
|
2968
2987
|
|
2988
|
+
/**
|
2989
|
+
* @param {Dependency[]} deps deps
|
2990
|
+
* @returns {Module[]} sorted deps
|
2991
|
+
*/
|
2969
2992
|
const mapAndSort = deps =>
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2993
|
+
/** @type {Module[]} */
|
2994
|
+
(deps.map(dep => this.moduleGraph.getModule(dep)).filter(Boolean)).sort(
|
2995
|
+
compareModulesByIdentifier
|
2996
|
+
);
|
2974
2997
|
const includedModules = [
|
2975
2998
|
...mapAndSort(this.globalEntry.includeDependencies),
|
2976
2999
|
...mapAndSort(includeDependencies)
|
@@ -3335,20 +3358,21 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3335
3358
|
/** @type {WebpackError[]} */
|
3336
3359
|
const errors = [];
|
3337
3360
|
/** @type {NotCodeGeneratedModules | undefined} */
|
3338
|
-
let notCodeGeneratedModules
|
3361
|
+
let notCodeGeneratedModules;
|
3339
3362
|
const runIteration = () => {
|
3340
3363
|
/** @type {CodeGenerationJobs} */
|
3341
3364
|
let delayedJobs = [];
|
3342
3365
|
let delayedModules = new Set();
|
3343
3366
|
asyncLib.eachLimit(
|
3344
3367
|
jobs,
|
3345
|
-
|
3368
|
+
/** @type {number} */
|
3369
|
+
(this.options.parallelism),
|
3346
3370
|
(job, callback) => {
|
3347
3371
|
const { module } = job;
|
3348
3372
|
const { codeGenerationDependencies } = module;
|
3349
|
-
if (
|
3350
|
-
|
3351
|
-
|
3373
|
+
if (
|
3374
|
+
codeGenerationDependencies !== undefined &&
|
3375
|
+
(notCodeGeneratedModules === undefined ||
|
3352
3376
|
codeGenerationDependencies.some(dep => {
|
3353
3377
|
const referencedModule = /** @type {Module} */ (
|
3354
3378
|
moduleGraph.getModule(dep)
|
@@ -3356,12 +3380,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3356
3380
|
return /** @type {NotCodeGeneratedModules} */ (
|
3357
3381
|
notCodeGeneratedModules
|
3358
3382
|
).has(referencedModule);
|
3359
|
-
})
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
}
|
3383
|
+
}))
|
3384
|
+
) {
|
3385
|
+
delayedJobs.push(job);
|
3386
|
+
delayedModules.add(module);
|
3387
|
+
return callback();
|
3365
3388
|
}
|
3366
3389
|
const { hash, runtime, runtimes } = job;
|
3367
3390
|
this._codeGenerationModule(
|
@@ -3585,21 +3608,19 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3585
3608
|
null
|
3586
3609
|
);
|
3587
3610
|
}
|
3611
|
+
} else if (memCache) {
|
3612
|
+
memCache.set(
|
3613
|
+
`moduleRuntimeRequirements-${getRuntimeKey(runtime)}`,
|
3614
|
+
set
|
3615
|
+
);
|
3616
|
+
chunkGraph.addModuleRuntimeRequirements(
|
3617
|
+
module,
|
3618
|
+
runtime,
|
3619
|
+
set,
|
3620
|
+
false
|
3621
|
+
);
|
3588
3622
|
} else {
|
3589
|
-
|
3590
|
-
memCache.set(
|
3591
|
-
`moduleRuntimeRequirements-${getRuntimeKey(runtime)}`,
|
3592
|
-
set
|
3593
|
-
);
|
3594
|
-
chunkGraph.addModuleRuntimeRequirements(
|
3595
|
-
module,
|
3596
|
-
runtime,
|
3597
|
-
set,
|
3598
|
-
false
|
3599
|
-
);
|
3600
|
-
} else {
|
3601
|
-
chunkGraph.addModuleRuntimeRequirements(module, runtime, set);
|
3602
|
-
}
|
3623
|
+
chunkGraph.addModuleRuntimeRequirements(module, runtime, set);
|
3603
3624
|
}
|
3604
3625
|
}
|
3605
3626
|
}
|
@@ -3724,13 +3745,24 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3724
3745
|
if (chunkGroup !== undefined) {
|
3725
3746
|
chunkGroup.addOptions(groupOptions);
|
3726
3747
|
if (module) {
|
3727
|
-
chunkGroup.addOrigin(
|
3748
|
+
chunkGroup.addOrigin(
|
3749
|
+
module,
|
3750
|
+
/** @type {DependencyLocation} */
|
3751
|
+
(loc),
|
3752
|
+
request
|
3753
|
+
);
|
3728
3754
|
}
|
3729
3755
|
return chunkGroup;
|
3730
3756
|
}
|
3731
3757
|
}
|
3732
3758
|
const chunkGroup = new ChunkGroup(groupOptions);
|
3733
|
-
if (module)
|
3759
|
+
if (module)
|
3760
|
+
chunkGroup.addOrigin(
|
3761
|
+
module,
|
3762
|
+
/** @type {DependencyLocation} */
|
3763
|
+
(loc),
|
3764
|
+
request
|
3765
|
+
);
|
3734
3766
|
const chunk = this.addChunk(name);
|
3735
3767
|
|
3736
3768
|
connectChunkGroupAndChunk(chunkGroup, chunk);
|
@@ -3788,7 +3820,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3788
3820
|
/**
|
3789
3821
|
* This method first looks to see if a name is provided for a new chunk,
|
3790
3822
|
* and first looks to see if any named chunks already exist and reuse that chunk instead.
|
3791
|
-
*
|
3792
3823
|
* @param {string=} name optional chunk name to be provided
|
3793
3824
|
* @returns {Chunk} create a chunk (invoked during seal event)
|
3794
3825
|
*/
|
@@ -3818,6 +3849,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3818
3849
|
const moduleGraph = this.moduleGraph;
|
3819
3850
|
|
3820
3851
|
const queue = new Set([module]);
|
3852
|
+
/** @type {number} */
|
3821
3853
|
let depth;
|
3822
3854
|
|
3823
3855
|
moduleGraph.setDepth(module, 0);
|
@@ -3833,7 +3865,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3833
3865
|
|
3834
3866
|
for (module of queue) {
|
3835
3867
|
queue.delete(module);
|
3836
|
-
depth = moduleGraph.getDepth(module) + 1;
|
3868
|
+
depth = /** @type {number} */ (moduleGraph.getDepth(module)) + 1;
|
3837
3869
|
|
3838
3870
|
for (const connection of moduleGraph.getOutgoingConnections(module)) {
|
3839
3871
|
const refModule = connection.module;
|
@@ -3894,7 +3926,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3894
3926
|
}
|
3895
3927
|
|
3896
3928
|
/**
|
3897
|
-
*
|
3898
3929
|
* @param {Module} module module relationship for removal
|
3899
3930
|
* @param {DependenciesBlockLike} block //TODO: good description
|
3900
3931
|
* @returns {void}
|
@@ -3933,16 +3964,16 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3933
3964
|
if (!module.hasReasons(this.moduleGraph, chunk.runtime)) {
|
3934
3965
|
this.removeReasonsOfDependencyBlock(module, module);
|
3935
3966
|
}
|
3936
|
-
if (
|
3937
|
-
|
3938
|
-
|
3939
|
-
|
3940
|
-
|
3967
|
+
if (
|
3968
|
+
!module.hasReasonForChunk(chunk, this.moduleGraph, this.chunkGraph) &&
|
3969
|
+
this.chunkGraph.isModuleInChunk(module, chunk)
|
3970
|
+
) {
|
3971
|
+
this.chunkGraph.disconnectChunkAndModule(chunk, module);
|
3972
|
+
this.removeChunkFromDependencies(module, chunk);
|
3941
3973
|
}
|
3942
3974
|
}
|
3943
3975
|
|
3944
3976
|
/**
|
3945
|
-
*
|
3946
3977
|
* @param {DependenciesBlock} block block tie for Chunk
|
3947
3978
|
* @param {Chunk} chunk chunk to remove from dep
|
3948
3979
|
* @returns {void}
|
@@ -4247,7 +4278,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
4247
4278
|
}
|
4248
4279
|
// If there are still remaining references we have cycles and want to create a warning
|
4249
4280
|
if (remaining > 0) {
|
4250
|
-
|
4281
|
+
const circularRuntimeChunkInfo = [];
|
4251
4282
|
for (const info of runtimeChunksMap.values()) {
|
4252
4283
|
if (info.remaining !== 0) {
|
4253
4284
|
circularRuntimeChunkInfo.push(info);
|
@@ -4342,11 +4373,13 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4342
4373
|
this.hooks.contentHash.call(chunk);
|
4343
4374
|
}
|
4344
4375
|
} catch (err) {
|
4345
|
-
this.errors.push(
|
4376
|
+
this.errors.push(
|
4377
|
+
new ChunkRenderError(chunk, "", /** @type {Error} */ (err))
|
4378
|
+
);
|
4346
4379
|
}
|
4347
4380
|
this.logger.timeAggregate("hashing: hash chunks");
|
4348
4381
|
};
|
4349
|
-
otherChunks
|
4382
|
+
for (const chunk of otherChunks) processChunk(chunk);
|
4350
4383
|
for (const chunk of runtimeChunks) processChunk(chunk);
|
4351
4384
|
if (errors.length > 0) {
|
4352
4385
|
errors.sort(compareSelect(err => err.module, compareModulesByIdentifier));
|
@@ -4389,9 +4422,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4389
4422
|
const chunkHash = createHash(hashFunction);
|
4390
4423
|
chunkHash.update(chunk.hash);
|
4391
4424
|
chunkHash.update(this.hash);
|
4392
|
-
const chunkHashDigest =
|
4393
|
-
|
4394
|
-
|
4425
|
+
const chunkHashDigest =
|
4426
|
+
/** @type {string} */
|
4427
|
+
(chunkHash.digest(hashDigest));
|
4395
4428
|
chunk.hash = chunkHashDigest;
|
4396
4429
|
chunk.renderedHash = chunk.hash.slice(0, hashDigestLength);
|
4397
4430
|
this.hooks.contentHash.call(chunk);
|
@@ -4423,7 +4456,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4423
4456
|
return;
|
4424
4457
|
}
|
4425
4458
|
const oldInfo = this.assetsInfo.get(file);
|
4426
|
-
const newInfo =
|
4459
|
+
const newInfo = { ...oldInfo, ...assetInfo };
|
4427
4460
|
this._setAssetInfo(file, newInfo, oldInfo);
|
4428
4461
|
return;
|
4429
4462
|
}
|
@@ -4456,7 +4489,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4456
4489
|
};
|
4457
4490
|
const entry = oldRelated[key];
|
4458
4491
|
if (Array.isArray(entry)) {
|
4459
|
-
entry
|
4492
|
+
for (const name of entry) {
|
4493
|
+
remove(name);
|
4494
|
+
}
|
4460
4495
|
} else if (entry) {
|
4461
4496
|
remove(entry);
|
4462
4497
|
}
|
@@ -4480,7 +4515,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4480
4515
|
};
|
4481
4516
|
const entry = newRelated[key];
|
4482
4517
|
if (Array.isArray(entry)) {
|
4483
|
-
entry
|
4518
|
+
for (const name of entry) {
|
4519
|
+
add(name);
|
4520
|
+
}
|
4484
4521
|
} else if (entry) {
|
4485
4522
|
add(entry);
|
4486
4523
|
}
|
@@ -4503,11 +4540,10 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4503
4540
|
`Called Compilation.updateAsset for not existing filename ${file}`
|
4504
4541
|
);
|
4505
4542
|
}
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
}
|
4543
|
+
this.assets[file] =
|
4544
|
+
typeof newSourceOrFunction === "function"
|
4545
|
+
? newSourceOrFunction(this.assets[file])
|
4546
|
+
: newSourceOrFunction;
|
4511
4547
|
if (assetInfoUpdateOrFunction !== undefined) {
|
4512
4548
|
const oldInfo = this.assetsInfo.get(file) || EMPTY_ASSET_INFO;
|
4513
4549
|
if (typeof assetInfoUpdateOrFunction === "function") {
|
@@ -4533,14 +4569,12 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4533
4569
|
`Called Compilation.renameAsset for not existing filename ${file}`
|
4534
4570
|
);
|
4535
4571
|
}
|
4536
|
-
if (this.assets[newFile]) {
|
4537
|
-
|
4538
|
-
|
4539
|
-
|
4540
|
-
|
4541
|
-
|
4542
|
-
);
|
4543
|
-
}
|
4572
|
+
if (this.assets[newFile] && !isSourceEqual(this.assets[file], source)) {
|
4573
|
+
this.errors.push(
|
4574
|
+
new WebpackError(
|
4575
|
+
`Conflict: Called Compilation.renameAsset for already existing filename ${newFile} with different content`
|
4576
|
+
)
|
4577
|
+
);
|
4544
4578
|
}
|
4545
4579
|
const assetInfo = this.assetsInfo.get(file);
|
4546
4580
|
// Update related in all other assets
|
@@ -4604,6 +4638,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4604
4638
|
const related = assetInfo && assetInfo.related;
|
4605
4639
|
if (related) {
|
4606
4640
|
for (const key of Object.keys(related)) {
|
4641
|
+
/**
|
4642
|
+
* @param {string} file file
|
4643
|
+
*/
|
4607
4644
|
const checkUsedAndDelete = file => {
|
4608
4645
|
if (!this._assetsRelatedIn.has(file)) {
|
4609
4646
|
this.deleteAsset(file);
|
@@ -4611,7 +4648,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4611
4648
|
};
|
4612
4649
|
const items = related[key];
|
4613
4650
|
if (Array.isArray(items)) {
|
4614
|
-
items
|
4651
|
+
for (const file of items) {
|
4652
|
+
checkUsedAndDelete(file);
|
4653
|
+
}
|
4615
4654
|
} else if (items) {
|
4616
4655
|
checkUsedAndDelete(items);
|
4617
4656
|
}
|
@@ -4645,8 +4684,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4645
4684
|
* @returns {Readonly<Asset> | undefined} the asset or undefined when not found
|
4646
4685
|
*/
|
4647
4686
|
getAsset(name) {
|
4648
|
-
if (!Object.prototype.hasOwnProperty.call(this.assets, name))
|
4649
|
-
return undefined;
|
4687
|
+
if (!Object.prototype.hasOwnProperty.call(this.assets, name)) return;
|
4650
4688
|
return {
|
4651
4689
|
name,
|
4652
4690
|
source: this.assets[name],
|
@@ -4729,7 +4767,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4729
4767
|
);
|
4730
4768
|
return callback();
|
4731
4769
|
}
|
4732
|
-
asyncLib.
|
4770
|
+
asyncLib.each(
|
4733
4771
|
manifest,
|
4734
4772
|
(fileManifest, callback) => {
|
4735
4773
|
const ident = fileManifest.identifier;
|
@@ -4741,7 +4779,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4741
4779
|
);
|
4742
4780
|
|
4743
4781
|
assetCacheItem.get((err, sourceFromCache) => {
|
4744
|
-
/** @type {
|
4782
|
+
/** @type {TemplatePath} */
|
4745
4783
|
let filenameTemplate;
|
4746
4784
|
/** @type {string} */
|
4747
4785
|
let file;
|
@@ -4803,9 +4841,8 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4803
4841
|
` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})`
|
4804
4842
|
)
|
4805
4843
|
);
|
4806
|
-
} else {
|
4807
|
-
source = alreadyWritten.source;
|
4808
4844
|
}
|
4845
|
+
source = alreadyWritten.source;
|
4809
4846
|
} else if (!source) {
|
4810
4847
|
// render the asset
|
4811
4848
|
source = fileManifest.render();
|
@@ -4846,7 +4883,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4846
4883
|
}
|
4847
4884
|
} catch (err) {
|
4848
4885
|
if (!inTry) throw err;
|
4849
|
-
errorAndCallback(err);
|
4886
|
+
errorAndCallback(/** @type {Error} */ (err));
|
4850
4887
|
}
|
4851
4888
|
});
|
4852
4889
|
},
|
@@ -4858,7 +4895,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4858
4895
|
}
|
4859
4896
|
|
4860
4897
|
/**
|
4861
|
-
* @param {
|
4898
|
+
* @param {TemplatePath} filename used to get asset path with hash
|
4862
4899
|
* @param {PathData} data context data
|
4863
4900
|
* @returns {string} interpolated path
|
4864
4901
|
*/
|
@@ -4873,9 +4910,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4873
4910
|
}
|
4874
4911
|
|
4875
4912
|
/**
|
4876
|
-
* @param {
|
4913
|
+
* @param {TemplatePath} filename used to get asset path with hash
|
4877
4914
|
* @param {PathData} data context data
|
4878
|
-
* @returns {
|
4915
|
+
* @returns {InterpolatedPathAndAssetInfo} interpolated path and asset info
|
4879
4916
|
*/
|
4880
4917
|
getPathWithInfo(filename, data = {}) {
|
4881
4918
|
if (!data.hash) {
|
@@ -4888,7 +4925,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4888
4925
|
}
|
4889
4926
|
|
4890
4927
|
/**
|
4891
|
-
* @param {
|
4928
|
+
* @param {TemplatePath} filename used to get asset path with hash
|
4892
4929
|
* @param {PathData} data context data
|
4893
4930
|
* @returns {string} interpolated path
|
4894
4931
|
*/
|
@@ -4901,9 +4938,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4901
4938
|
}
|
4902
4939
|
|
4903
4940
|
/**
|
4904
|
-
* @param {
|
4941
|
+
* @param {TemplatePath} filename used to get asset path with hash
|
4905
4942
|
* @param {PathData} data context data
|
4906
|
-
* @returns {
|
4943
|
+
* @returns {InterpolatedPathAndAssetInfo} interpolated path and asset info
|
4907
4944
|
*/
|
4908
4945
|
getAssetPathWithInfo(filename, data) {
|
4909
4946
|
const assetInfo = {};
|
@@ -4928,7 +4965,6 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4928
4965
|
* This function allows you to run another instance of webpack inside of webpack however as
|
4929
4966
|
* a child with different settings and configurations (if desired) applied. It copies all hooks, plugins
|
4930
4967
|
* from parent (or top level compiler) and creates a child Compilation
|
4931
|
-
*
|
4932
4968
|
* @param {string} name name of the child compiler
|
4933
4969
|
* @param {OutputOptions=} outputOptions // Need to convert config schema to types for this
|
4934
4970
|
* @param {Array<WebpackPluginInstance | WebpackPluginFunction>=} plugins webpack plugins that will be applied
|
@@ -4957,12 +4993,6 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4957
4993
|
processAsyncTree(
|
4958
4994
|
modules,
|
4959
4995
|
10,
|
4960
|
-
/**
|
4961
|
-
* @param {Module} module the module
|
4962
|
-
* @param {function(Module): void} push push more jobs
|
4963
|
-
* @param {Callback} callback callback
|
4964
|
-
* @returns {void}
|
4965
|
-
*/
|
4966
4996
|
(module, push, callback) => {
|
4967
4997
|
this.buildQueue.waitFor(module, err => {
|
4968
4998
|
if (err) return callback(err);
|
@@ -4993,7 +5023,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4993
5023
|
const runtimeTemplate = this.runtimeTemplate;
|
4994
5024
|
|
4995
5025
|
const chunk = new Chunk("build time chunk", this._backCompat);
|
4996
|
-
chunk.id = chunk.name;
|
5026
|
+
chunk.id = /** @type {ChunkId} */ (chunk.name);
|
4997
5027
|
chunk.ids = [chunk.id];
|
4998
5028
|
chunk.runtime = runtime;
|
4999
5029
|
|
@@ -5223,7 +5253,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
5223
5253
|
* @returns {any} exports
|
5224
5254
|
*/
|
5225
5255
|
const __webpack_require_module__ = (moduleArgument, id) => {
|
5226
|
-
|
5256
|
+
const execOptions = {
|
5227
5257
|
id,
|
5228
5258
|
module: {
|
5229
5259
|
id,
|
@@ -5233,9 +5263,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
5233
5263
|
},
|
5234
5264
|
require: __webpack_require__
|
5235
5265
|
};
|
5236
|
-
|
5237
|
-
handler(execOptions)
|
5238
|
-
|
5266
|
+
for (const handler of interceptModuleExecution) {
|
5267
|
+
handler(execOptions);
|
5268
|
+
}
|
5239
5269
|
const module = moduleArgument.module;
|
5240
5270
|
this.buildTimeExecutedModules.add(module);
|
5241
5271
|
const moduleObject = execOptions.module;
|
@@ -5253,14 +5283,14 @@ This prevents using hashes of each other and should be avoided.`);
|
|
5253
5283
|
);
|
5254
5284
|
moduleObject.loaded = true;
|
5255
5285
|
return moduleObject.exports;
|
5256
|
-
} catch (
|
5286
|
+
} catch (execErr) {
|
5257
5287
|
if (strictModuleExceptionHandling) {
|
5258
5288
|
if (id) delete moduleCache[id];
|
5259
5289
|
} else if (strictModuleErrorHandling) {
|
5260
|
-
moduleObject.error =
|
5290
|
+
moduleObject.error = execErr;
|
5261
5291
|
}
|
5262
|
-
if (!
|
5263
|
-
throw
|
5292
|
+
if (!execErr.module) execErr.module = module;
|
5293
|
+
throw execErr;
|
5264
5294
|
}
|
5265
5295
|
};
|
5266
5296
|
|
@@ -5273,14 +5303,14 @@ This prevents using hashes of each other and should be avoided.`);
|
|
5273
5303
|
);
|
5274
5304
|
}
|
5275
5305
|
exports = __webpack_require__(module.identifier());
|
5276
|
-
} catch (
|
5306
|
+
} catch (execErr) {
|
5277
5307
|
const err = new WebpackError(
|
5278
5308
|
`Execution of module code from module graph (${module.readableIdentifier(
|
5279
5309
|
this.requestShortener
|
5280
|
-
)}) failed: ${
|
5310
|
+
)}) failed: ${execErr.message}`
|
5281
5311
|
);
|
5282
|
-
err.stack =
|
5283
|
-
err.module =
|
5312
|
+
err.stack = execErr.stack;
|
5313
|
+
err.module = execErr.module;
|
5284
5314
|
return callback(err);
|
5285
5315
|
}
|
5286
5316
|
|
@@ -5360,6 +5390,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
5360
5390
|
*/
|
5361
5391
|
|
5362
5392
|
// Workaround for typescript as it doesn't support function overloading in jsdoc within a class
|
5393
|
+
/* eslint-disable jsdoc/require-asterisk-prefix */
|
5363
5394
|
Compilation.prototype.factorizeModule = /**
|
5364
5395
|
@type {{
|
5365
5396
|
(options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void;
|
@@ -5369,6 +5400,7 @@ Compilation.prototype.factorizeModule = /**
|
|
5369
5400
|
this.factorizeQueue.add(options, callback);
|
5370
5401
|
}
|
5371
5402
|
);
|
5403
|
+
/* eslint-enable jsdoc/require-asterisk-prefix */
|
5372
5404
|
|
5373
5405
|
// Hide from typescript
|
5374
5406
|
const compilationPrototype = Compilation.prototype;
|