webpack 5.104.1 → 5.105.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/webpack.js +6 -3
- package/lib/APIPlugin.js +85 -15
- package/lib/AbstractMethodError.js +1 -0
- package/lib/AsyncDependenciesBlock.js +17 -2
- package/lib/AsyncDependencyToInitialChunkError.js +3 -0
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +5 -1
- package/lib/CacheFacade.js +2 -2
- package/lib/CaseSensitiveModulesWarning.js +1 -0
- package/lib/Chunk.js +9 -5
- package/lib/ChunkGraph.js +30 -9
- package/lib/ChunkGroup.js +6 -3
- package/lib/ChunkRenderError.js +9 -2
- package/lib/CleanPlugin.js +4 -1
- package/lib/CodeGenerationError.js +7 -1
- package/lib/CodeGenerationResults.js +10 -3
- package/lib/CommentCompilationWarning.js +2 -1
- package/lib/Compilation.js +284 -236
- package/lib/Compiler.js +4 -3
- package/lib/ConcatenationScope.js +2 -1
- package/lib/ConcurrentCompilationError.js +3 -3
- package/lib/ContextModule.js +248 -111
- package/lib/ContextModuleFactory.js +14 -2
- package/lib/DefinePlugin.js +15 -8
- package/lib/DelegatedModule.js +6 -0
- package/lib/DelegatedModuleFactoryPlugin.js +2 -0
- package/lib/Dependency.js +6 -1
- package/lib/DependencyTemplates.js +3 -2
- package/lib/DllModule.js +2 -0
- package/lib/DllReferencePlugin.js +1 -0
- package/lib/DotenvPlugin.js +11 -5
- package/lib/DynamicEntryPlugin.js +8 -1
- package/lib/EnvironmentNotSupportAsyncWarning.js +1 -0
- package/lib/EvalSourceMapDevToolPlugin.js +17 -13
- package/lib/ExportsInfo.js +8 -4
- package/lib/ExternalModule.js +16 -0
- package/lib/ExternalModuleFactoryPlugin.js +9 -2
- package/lib/ExternalsPlugin.js +2 -1
- package/lib/FalseIIFEUmdWarning.js +1 -0
- package/lib/FileSystemInfo.js +49 -25
- package/lib/FlagDependencyExportsPlugin.js +8 -1
- package/lib/FlagDependencyUsagePlugin.js +9 -7
- package/lib/HarmonyLinkingError.js +1 -0
- package/lib/HookWebpackError.js +2 -0
- package/lib/HotModuleReplacementPlugin.js +16 -2
- package/lib/IgnoreWarningsPlugin.js +5 -2
- package/lib/InitFragment.js +1 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -0
- package/lib/LibManifestPlugin.js +1 -0
- package/lib/ManifestPlugin.js +8 -1
- package/lib/Module.js +7 -4
- package/lib/ModuleBuildError.js +3 -1
- package/lib/ModuleDependencyError.js +1 -0
- package/lib/ModuleDependencyWarning.js +1 -0
- package/lib/ModuleError.js +4 -1
- package/lib/ModuleFilenameHelpers.js +4 -2
- package/lib/ModuleGraph.js +3 -0
- package/lib/ModuleGraphConnection.js +10 -1
- package/lib/ModuleHashingError.js +2 -0
- package/lib/ModuleInfoHeaderPlugin.js +6 -1
- package/lib/ModuleNotFoundError.js +1 -0
- package/lib/ModuleParseError.js +5 -1
- package/lib/ModuleProfile.js +1 -1
- package/lib/ModuleRestoreError.js +2 -0
- package/lib/ModuleSourceTypeConstants.js +1 -11
- package/lib/ModuleStoreError.js +2 -0
- package/lib/ModuleWarning.js +3 -1
- package/lib/MultiCompiler.js +11 -7
- package/lib/MultiWatching.js +2 -2
- package/lib/NoModeWarning.js +1 -0
- package/lib/NodeStuffInWebError.js +1 -0
- package/lib/NormalModule.js +28 -5
- package/lib/NormalModuleFactory.js +20 -4
- package/lib/OptionsApply.js +3 -1
- package/lib/ProgressPlugin.js +4 -0
- package/lib/RawModule.js +2 -0
- package/lib/RuntimeModule.js +10 -0
- package/lib/RuntimePlugin.js +7 -9
- package/lib/RuntimeTemplate.js +14 -7
- package/lib/SourceMapDevToolPlugin.js +30 -23
- package/lib/Template.js +10 -5
- package/lib/TemplatedPathPlugin.js +4 -2
- package/lib/UnhandledSchemeError.js +1 -0
- package/lib/UnsupportedFeatureWarning.js +3 -0
- package/lib/WarnDeprecatedOptionPlugin.js +1 -0
- package/lib/WatchIgnorePlugin.js +1 -1
- package/lib/Watching.js +5 -0
- package/lib/WebpackError.js +4 -0
- package/lib/WebpackOptionsApply.js +61 -41
- package/lib/asset/AssetBytesGenerator.js +1 -0
- package/lib/asset/AssetGenerator.js +18 -3
- package/lib/asset/AssetModulesPlugin.js +33 -2
- package/lib/asset/AssetParser.js +4 -0
- package/lib/asset/AssetSourceGenerator.js +1 -0
- package/lib/asset/RawDataUrlModule.js +4 -0
- package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -1
- package/lib/buildChunkGraph.js +31 -2
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +41 -8
- package/lib/cache/getLazyHashedEtag.js +13 -4
- package/lib/cache/mergeEtags.js +3 -1
- package/lib/cli.js +3 -1
- package/lib/config/defaults.js +65 -44
- package/lib/config/normalization.js +96 -0
- package/lib/container/ContainerEntryDependency.js +3 -0
- package/lib/container/ContainerEntryModule.js +7 -0
- package/lib/container/ContainerExposedDependency.js +1 -0
- package/lib/container/FallbackDependency.js +1 -0
- package/lib/container/FallbackItemDependency.js +1 -0
- package/lib/container/FallbackModule.js +4 -0
- package/lib/container/HoistContainerReferencesPlugin.js +6 -0
- package/lib/container/ModuleFederationPlugin.js +1 -1
- package/lib/container/RemoteModule.js +24 -0
- package/lib/css/CssGenerator.js +31 -4
- package/lib/css/CssModulesPlugin.js +26 -30
- package/lib/css/CssParser.js +12 -9
- package/lib/debug/ProfilingPlugin.js +1 -0
- package/lib/dependencies/AMDDefineDependency.js +3 -1
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +6 -0
- package/lib/dependencies/AMDPlugin.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +7 -1
- package/lib/dependencies/CachedConstDependency.js +1 -0
- package/lib/dependencies/CommonJsDependencyHelpers.js +2 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +1 -0
- package/lib/dependencies/CommonJsFullRequireDependency.js +2 -0
- package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -0
- package/lib/dependencies/CommonJsRequireContextDependency.js +2 -2
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +1 -0
- package/lib/dependencies/ConstDependency.js +1 -0
- package/lib/dependencies/ContextDependencyHelpers.js +11 -4
- package/lib/dependencies/ContextElementDependency.js +1 -0
- package/lib/dependencies/CriticalDependencyWarning.js +1 -0
- package/lib/dependencies/CssIcssExportDependency.js +7 -4
- package/lib/dependencies/CssIcssSymbolDependency.js +1 -0
- package/lib/dependencies/CssUrlDependency.js +2 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +4 -1
- package/lib/dependencies/ExternalModuleInitFragmentDependency.js +0 -9
- package/lib/dependencies/HarmonyAcceptDependency.js +3 -0
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +3 -1
- package/lib/dependencies/HarmonyExportExpressionDependency.js +4 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +8 -1
- package/lib/dependencies/HarmonyExportInitFragment.js +17 -3
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +4 -0
- package/lib/dependencies/HarmonyImportDependency.js +1 -1
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +269 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +22 -3
- package/lib/dependencies/ImportDependency.js +1 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
- package/lib/dependencies/ImportMetaPlugin.js +53 -11
- package/lib/dependencies/ImportParserPlugin.js +7 -12
- package/lib/dependencies/LoaderPlugin.js +3 -0
- package/lib/dependencies/ModuleDecoratorDependency.js +1 -0
- package/lib/dependencies/ModuleDependency.js +1 -0
- package/lib/dependencies/ModuleInitFragmentDependency.js +87 -0
- package/lib/dependencies/ProvidedDependency.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +1 -0
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +7 -2
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -0
- package/lib/dependencies/WorkerDependency.js +9 -3
- package/lib/dependencies/WorkerPlugin.js +1 -0
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/electron/ElectronTargetPlugin.js +3 -1
- package/lib/errors/BuildCycleError.js +4 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +6 -4
- package/lib/esm/ModuleChunkLoadingPlugin.js +1 -0
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +1 -0
- package/lib/hmr/LazyCompilationPlugin.js +5 -0
- package/lib/hmr/lazyCompilationBackend.js +3 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +9 -7
- package/lib/ids/DeterministicChunkIdsPlugin.js +1 -0
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -0
- package/lib/ids/HashedModuleIdsPlugin.js +3 -8
- package/lib/ids/IdHelpers.js +10 -8
- package/lib/ids/NamedChunkIdsPlugin.js +7 -5
- package/lib/ids/NamedModuleIdsPlugin.js +1 -0
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +18 -10
- package/lib/ids/SyncModuleIdsPlugin.js +30 -20
- package/lib/index.js +2 -2
- package/lib/javascript/BasicEvaluatedExpression.js +1 -0
- package/lib/javascript/EnableChunkLoadingPlugin.js +5 -2
- package/lib/javascript/JavascriptModulesPlugin.js +29 -8
- package/lib/javascript/JavascriptParser.js +47 -14
- package/lib/json/JsonGenerator.js +1 -0
- package/lib/json/JsonParser.js +9 -2
- package/lib/library/AbstractLibraryPlugin.js +4 -1
- package/lib/library/AmdLibraryPlugin.js +2 -1
- package/lib/library/AssignLibraryPlugin.js +6 -2
- package/lib/library/EnableLibraryPlugin.js +1 -0
- package/lib/library/ExportPropertyLibraryPlugin.js +1 -1
- package/lib/library/JsonpLibraryPlugin.js +1 -1
- package/lib/library/ModuleLibraryPlugin.js +130 -13
- package/lib/library/SystemLibraryPlugin.js +4 -1
- package/lib/library/UmdLibraryPlugin.js +4 -3
- package/lib/logging/Logger.js +9 -5
- package/lib/logging/createConsoleLogger.js +4 -0
- package/lib/logging/truncateArgs.js +1 -1
- package/lib/node/CommonJsChunkLoadingPlugin.js +6 -4
- package/lib/node/NodeEnvironmentPlugin.js +1 -0
- package/lib/node/NodeTargetPlugin.js +10 -1
- package/lib/node/NodeTemplatePlugin.js +1 -0
- package/lib/node/NodeWatchFileSystem.js +6 -0
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +1 -0
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -0
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -0
- package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -0
- package/lib/node/nodeConsole.js +18 -1
- package/lib/optimize/AggressiveMergingPlugin.js +2 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +15 -6
- package/lib/optimize/ConcatenatedModule.js +33 -19
- package/lib/optimize/FlagIncludedChunksPlugin.js +11 -1
- package/lib/optimize/InnerGraph.js +5 -3
- package/lib/optimize/InnerGraphPlugin.js +25 -25
- package/lib/optimize/LimitChunkCountPlugin.js +3 -2
- package/lib/optimize/MangleExportsPlugin.js +14 -2
- package/lib/optimize/MergeDuplicateChunksPlugin.js +5 -1
- package/lib/optimize/MinChunkSizePlugin.js +5 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +19 -4
- package/lib/optimize/RealContentHashPlugin.js +37 -27
- package/lib/optimize/RemoveParentModulesPlugin.js +12 -3
- package/lib/optimize/RuntimeChunkPlugin.js +3 -5
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -0
- package/lib/optimize/SplitChunksPlugin.js +23 -5
- package/lib/performance/AssetsOverSizeLimitWarning.js +6 -2
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +6 -2
- package/lib/performance/NoAsyncChunksWarning.js +1 -0
- package/lib/performance/SizeLimitsPlugin.js +6 -6
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +2 -0
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -1
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -0
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -0
- package/lib/rules/BasicEffectRulePlugin.js +2 -0
- package/lib/rules/BasicMatcherRulePlugin.js +3 -0
- package/lib/rules/ObjectMatcherRulePlugin.js +5 -1
- package/lib/rules/RuleSetCompiler.js +6 -0
- package/lib/runtime/AsyncModuleRuntimeModule.js +1 -0
- package/lib/runtime/ChunkNameRuntimeModule.js +1 -0
- package/lib/runtime/CompatRuntimeModule.js +1 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +1 -0
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +5 -0
- package/lib/runtime/GetFullHashRuntimeModule.js +1 -0
- package/lib/runtime/GetMainFilenameRuntimeModule.js +2 -0
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -0
- package/lib/runtime/LoadScriptRuntimeModule.js +2 -0
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +16 -32
- package/lib/runtime/PublicPathRuntimeModule.js +1 -0
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -0
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -0
- package/lib/runtime/StartupEntrypointRuntimeModule.js +1 -0
- package/lib/schemes/HttpUriPlugin.js +39 -20
- package/lib/schemes/VirtualUrlPlugin.js +28 -2
- package/lib/serialization/BinaryMiddleware.js +4 -0
- package/lib/serialization/FileMiddleware.js +9 -4
- package/lib/serialization/ObjectMiddleware.js +34 -11
- package/lib/serialization/PlainObjectSerializer.js +2 -0
- package/lib/sharing/ConsumeSharedModule.js +60 -0
- package/lib/sharing/ConsumeSharedPlugin.js +5 -4
- package/lib/sharing/ProvideSharedModule.js +4 -0
- package/lib/sharing/ProvideSharedPlugin.js +24 -25
- package/lib/sharing/resolveMatchedConfigs.js +2 -2
- package/lib/sharing/utils.js +8 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +20 -12
- package/lib/stats/DefaultStatsPrinterPlugin.js +6 -5
- package/lib/stats/StatsFactory.js +2 -2
- package/lib/url/URLParserPlugin.js +5 -3
- package/lib/util/AppendOnlyStackedSet.js +57 -0
- package/lib/util/Hash.js +1 -0
- package/lib/util/IterableHelpers.js +1 -0
- package/lib/util/LazyBucketSortedSet.js +1 -0
- package/lib/util/LazySet.js +1 -0
- package/lib/util/ParallelismFactorCalculator.js +1 -0
- package/lib/util/SortableSet.js +1 -0
- package/lib/util/StringXor.js +1 -0
- package/lib/util/binarySearchBounds.js +15 -8
- package/lib/util/chainedImports.js +1 -1
- package/lib/util/cleverMerge.js +6 -1
- package/lib/util/comparators.js +21 -1
- package/lib/util/compileBooleanMatcher.js +3 -3
- package/lib/util/concatenate.js +3 -2
- package/lib/util/conventions.js +3 -2
- package/lib/util/deterministicGrouping.js +13 -1
- package/lib/util/extractSourceMap.js +12 -13
- package/lib/util/fs.js +15 -19
- package/lib/util/hash/BatchedHash.js +4 -0
- package/lib/util/hash/BulkUpdateHash.js +8 -1
- package/lib/util/hash/hash-digest.js +1 -0
- package/lib/util/hash/wasm-hash.js +18 -2
- package/lib/util/identifier.js +7 -2
- package/lib/util/magicComment.js +1 -1
- package/lib/util/propertyName.js +1 -1
- package/lib/util/registerExternalSerializer.js +1 -0
- package/lib/util/runtime.js +15 -1
- package/lib/util/semver.js +1 -0
- package/lib/util/serialization.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +2 -0
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +11 -3
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +1 -0
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -2
- package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +5 -1
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +3 -0
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +2 -0
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +7 -3
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyParser.js +3 -1
- package/lib/web/FetchCompileWasmPlugin.js +1 -0
- package/lib/web/JsonpChunkLoadingPlugin.js +1 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -0
- package/lib/webpack.js +16 -4
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -0
- package/package.json +33 -36
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +121 -55
- package/schemas/plugins/BannerPlugin.json +2 -2
- package/schemas/plugins/IgnorePlugin.json +1 -1
- package/schemas/plugins/ManifestPlugin.json +3 -3
- package/schemas/plugins/ProgressPlugin.json +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +2 -2
- package/schemas/plugins/schemes/HttpUriPlugin.json +1 -1
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +3 -3
- package/types.d.ts +440 -137
package/lib/Compilation.js
CHANGED
|
@@ -286,7 +286,7 @@ const { isSourceEqual } = require("./util/source");
|
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
288
|
* @typedef {object} LogEntry
|
|
289
|
-
* @property {
|
|
289
|
+
* @property {keyof LogType} type
|
|
290
290
|
* @property {EXPECTED_ANY[]=} args
|
|
291
291
|
* @property {number} time
|
|
292
292
|
* @property {string[]=} trace
|
|
@@ -403,11 +403,11 @@ const { isSourceEqual } = require("./util/source");
|
|
|
403
403
|
|
|
404
404
|
/** @typedef {KnownCreateStatsOptionsContext & Record<string, EXPECTED_ANY>} CreateStatsOptionsContext */
|
|
405
405
|
|
|
406
|
-
/** @typedef {{ module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}} CodeGenerationJob */
|
|
406
|
+
/** @typedef {{ module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[] }} CodeGenerationJob */
|
|
407
407
|
|
|
408
408
|
/** @typedef {CodeGenerationJob[]} CodeGenerationJobs */
|
|
409
409
|
|
|
410
|
-
/** @typedef {{javascript: ModuleTemplate}} ModuleTemplates */
|
|
410
|
+
/** @typedef {{ javascript: ModuleTemplate }} ModuleTemplates */
|
|
411
411
|
|
|
412
412
|
/** @typedef {Set<Module>} NotCodeGeneratedModules */
|
|
413
413
|
|
|
@@ -491,6 +491,8 @@ const compareErrors = concatComparators(byModule, byLocation, byMessage);
|
|
|
491
491
|
* @typedef {Module & { restoreFromUnsafeCache?: (unsafeCacheData: UnsafeCacheData, moduleFactory: ModuleFactory, compilationParams: CompilationParams) => void }} ModuleWithRestoreFromUnsafeCache
|
|
492
492
|
*/
|
|
493
493
|
|
|
494
|
+
/** @typedef {(module: Module) => boolean} UnsafeCachePredicate */
|
|
495
|
+
|
|
494
496
|
/** @type {WeakMap<Dependency, ModuleWithRestoreFromUnsafeCache | null>} */
|
|
495
497
|
const unsafeCacheDependencies = new WeakMap();
|
|
496
498
|
|
|
@@ -514,22 +516,25 @@ class Compilation {
|
|
|
514
516
|
/** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */
|
|
515
517
|
const processAssetsHook = new AsyncSeriesHook(["assets"]);
|
|
516
518
|
|
|
519
|
+
/** @type {Set<string>} */
|
|
517
520
|
let savedAssets = new Set();
|
|
518
521
|
/**
|
|
519
522
|
* @param {CompilationAssets} assets assets
|
|
520
523
|
* @returns {CompilationAssets} new assets
|
|
521
524
|
*/
|
|
522
525
|
const popNewAssets = (assets) => {
|
|
526
|
+
/** @type {undefined | CompilationAssets} */
|
|
523
527
|
let newAssets;
|
|
524
528
|
for (const file of Object.keys(assets)) {
|
|
525
529
|
if (savedAssets.has(file)) continue;
|
|
526
530
|
if (newAssets === undefined) {
|
|
527
531
|
newAssets = Object.create(null);
|
|
528
532
|
}
|
|
529
|
-
|
|
533
|
+
/** @type {CompilationAssets} */
|
|
534
|
+
(newAssets)[file] = assets[file];
|
|
530
535
|
savedAssets.add(file);
|
|
531
536
|
}
|
|
532
|
-
return newAssets;
|
|
537
|
+
return /** @type {CompilationAssets} */ (newAssets);
|
|
533
538
|
};
|
|
534
539
|
processAssetsHook.intercept({
|
|
535
540
|
name: "Compilation",
|
|
@@ -1257,7 +1262,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1257
1262
|
this._codeGenerationCache = this.getCache("Compilation/codeGeneration");
|
|
1258
1263
|
|
|
1259
1264
|
const unsafeCache = options.module.unsafeCache;
|
|
1265
|
+
/** @type {boolean} */
|
|
1260
1266
|
this._unsafeCache = Boolean(unsafeCache);
|
|
1267
|
+
/** @type {UnsafeCachePredicate} */
|
|
1261
1268
|
this._unsafeCachePredicate =
|
|
1262
1269
|
typeof unsafeCache === "function" ? unsafeCache : () => true;
|
|
1263
1270
|
}
|
|
@@ -1347,6 +1354,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1347
1354
|
);
|
|
1348
1355
|
}
|
|
1349
1356
|
}
|
|
1357
|
+
/** @type {LogEntry["trace"]} */
|
|
1350
1358
|
let trace;
|
|
1351
1359
|
switch (type) {
|
|
1352
1360
|
case LogType.warn:
|
|
@@ -1519,7 +1527,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
1519
1527
|
/**
|
|
1520
1528
|
* Attempts to search for a module by its identifier
|
|
1521
1529
|
* @param {string} identifier identifier (usually path) for module
|
|
1522
|
-
* @returns {Module|undefined} attempt to search for module and return it, else undefined
|
|
1530
|
+
* @returns {Module | undefined} attempt to search for module and return it, else undefined
|
|
1523
1531
|
*/
|
|
1524
1532
|
findModule(identifier) {
|
|
1525
1533
|
return this._modules.get(identifier);
|
|
@@ -2292,6 +2300,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2292
2300
|
(originModule)
|
|
2293
2301
|
);
|
|
2294
2302
|
if (creatingModuleDuringBuildSet === undefined) {
|
|
2303
|
+
/** @type {Set<Module>} */
|
|
2295
2304
|
creatingModuleDuringBuildSet = new Set();
|
|
2296
2305
|
this.creatingModuleDuringBuild.set(
|
|
2297
2306
|
/** @type {Module} */
|
|
@@ -2598,7 +2607,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2598
2607
|
this.moduleGraph.setModuleMemCaches(this.moduleMemCaches);
|
|
2599
2608
|
}
|
|
2600
2609
|
const { moduleGraph, moduleMemCaches } = this;
|
|
2610
|
+
/** @type {Set<Module>} */
|
|
2601
2611
|
const affectedModules = new Set();
|
|
2612
|
+
/** @type {Set<Module>} */
|
|
2602
2613
|
const infectedModules = new Set();
|
|
2603
2614
|
let statNew = 0;
|
|
2604
2615
|
let statChanged = 0;
|
|
@@ -2714,6 +2725,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2714
2725
|
}
|
|
2715
2726
|
return affected;
|
|
2716
2727
|
};
|
|
2728
|
+
/** @type {Set<Module>} */
|
|
2717
2729
|
const directOnlyInfectedModules = new Set();
|
|
2718
2730
|
for (const module of infectedModules) {
|
|
2719
2731
|
for (const [
|
|
@@ -2732,6 +2744,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2732
2744
|
}
|
|
2733
2745
|
}
|
|
2734
2746
|
for (const module of directOnlyInfectedModules) infectedModules.add(module);
|
|
2747
|
+
/** @type {Set<Module>} */
|
|
2735
2748
|
const directOnlyAffectModules = new Set();
|
|
2736
2749
|
for (const module of affectedModules) {
|
|
2737
2750
|
for (const [
|
|
@@ -2994,6 +3007,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2994
3007
|
* @param {(profile: ModuleProfile) => number} getParallelism get parallelism callback
|
|
2995
3008
|
*/
|
|
2996
3009
|
const logByLoadersSummary = (category, getDuration, getParallelism) => {
|
|
3010
|
+
/** @type {Map<string, { module: Module, profile: ModuleProfile }[]>} */
|
|
2997
3011
|
const map = new Map();
|
|
2998
3012
|
for (const [module, profile] of modulesWithProfiles) {
|
|
2999
3013
|
const list = getOrInsert(
|
|
@@ -3205,6 +3219,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
3205
3219
|
this.chunkGroups.push(entrypoint);
|
|
3206
3220
|
connectChunkGroupAndChunk(entrypoint, chunk);
|
|
3207
3221
|
|
|
3222
|
+
/** @type {Set<Module>} */
|
|
3208
3223
|
const entryModules = new Set();
|
|
3209
3224
|
for (const dep of [...this.globalEntry.dependencies, ...dependencies]) {
|
|
3210
3225
|
entrypoint.addOrigin(
|
|
@@ -3252,6 +3267,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
3252
3267
|
modulesList.push(module);
|
|
3253
3268
|
}
|
|
3254
3269
|
}
|
|
3270
|
+
/** @type {Set<Chunk>} */
|
|
3255
3271
|
const runtimeChunks = new Set();
|
|
3256
3272
|
outer: for (const [
|
|
3257
3273
|
name,
|
|
@@ -3625,6 +3641,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3625
3641
|
const runIteration = () => {
|
|
3626
3642
|
/** @type {CodeGenerationJobs} */
|
|
3627
3643
|
let delayedJobs = [];
|
|
3644
|
+
/** @type {Set<Module>} */
|
|
3628
3645
|
let delayedModules = new Set();
|
|
3629
3646
|
asyncLib.eachLimit(
|
|
3630
3647
|
jobs,
|
|
@@ -3668,7 +3685,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3668
3685
|
);
|
|
3669
3686
|
},
|
|
3670
3687
|
(err) => {
|
|
3671
|
-
if (err) return callback(err);
|
|
3688
|
+
if (err) return callback(/** @type {WebpackError} */ (err));
|
|
3672
3689
|
if (delayedJobs.length > 0) {
|
|
3673
3690
|
if (delayedJobs.length === jobs.length) {
|
|
3674
3691
|
return callback(
|
|
@@ -3746,6 +3763,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3746
3763
|
);
|
|
3747
3764
|
cache.get((err, cachedResult) => {
|
|
3748
3765
|
if (err) return callback(/** @type {WebpackError} */ (err));
|
|
3766
|
+
/** @type {CodeGenerationResult} */
|
|
3749
3767
|
let result;
|
|
3750
3768
|
if (!cachedResult) {
|
|
3751
3769
|
try {
|
|
@@ -3845,6 +3863,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
3845
3863
|
continue;
|
|
3846
3864
|
}
|
|
3847
3865
|
}
|
|
3866
|
+
/** @type {RuntimeRequirements} */
|
|
3848
3867
|
let set;
|
|
3849
3868
|
const runtimeRequirements =
|
|
3850
3869
|
codeGenerationResults.getRuntimeRequirements(module, runtime);
|
|
@@ -4407,6 +4426,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4407
4426
|
hashDigestLength,
|
|
4408
4427
|
errors
|
|
4409
4428
|
) {
|
|
4429
|
+
/** @type {string} */
|
|
4410
4430
|
let moduleHashDigest;
|
|
4411
4431
|
try {
|
|
4412
4432
|
const moduleHash = createHash(hashFunction);
|
|
@@ -4529,6 +4549,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4529
4549
|
// If there are any references between chunks
|
|
4530
4550
|
// make sure to follow these chains
|
|
4531
4551
|
if (remaining > 0) {
|
|
4552
|
+
/** @type {Chunk[]} */
|
|
4532
4553
|
const readyChunks = [];
|
|
4533
4554
|
for (const chunk of runtimeChunks) {
|
|
4534
4555
|
const hasFullHashModules =
|
|
@@ -4555,6 +4576,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
|
4555
4576
|
}
|
|
4556
4577
|
// If there are still remaining references we have cycles and want to create a warning
|
|
4557
4578
|
if (remaining > 0) {
|
|
4579
|
+
/** @type {RuntimeChunkInfo[]} */
|
|
4558
4580
|
const circularRuntimeChunkInfo = [];
|
|
4559
4581
|
for (const info of runtimeChunksMap.values()) {
|
|
4560
4582
|
if (info.remaining !== 0) {
|
|
@@ -4574,6 +4596,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4574
4596
|
}
|
|
4575
4597
|
this.logger.timeEnd("hashing: sort chunks");
|
|
4576
4598
|
|
|
4599
|
+
/** @type {Set<Chunk>} */
|
|
4577
4600
|
const fullHashChunks = new Set();
|
|
4578
4601
|
/** @type {CodeGenerationJobs} */
|
|
4579
4602
|
const codeGenerationJobs = [];
|
|
@@ -4702,7 +4725,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4702
4725
|
).hash = moduleHashDigest;
|
|
4703
4726
|
}
|
|
4704
4727
|
const chunkHash = createHash(hashFunction);
|
|
4705
|
-
chunkHash.update(chunk.hash);
|
|
4728
|
+
chunkHash.update(/** @type {string} */ (chunk.hash));
|
|
4706
4729
|
chunkHash.update(this.hash);
|
|
4707
4730
|
const chunkHashDigest = chunkHash.digest(hashDigest);
|
|
4708
4731
|
chunk.hash = chunkHashDigest;
|
|
@@ -4873,6 +4896,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
4873
4896
|
const related = info.related;
|
|
4874
4897
|
if (!related) continue;
|
|
4875
4898
|
const entry = related[key];
|
|
4899
|
+
/** @type {string | string[]} */
|
|
4876
4900
|
let newEntry;
|
|
4877
4901
|
if (Array.isArray(entry)) {
|
|
4878
4902
|
newEntry = entry.map((x) => (x === file ? newFile : x));
|
|
@@ -5026,8 +5050,9 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5026
5050
|
*/
|
|
5027
5051
|
createChunkAssets(callback) {
|
|
5028
5052
|
const outputOptions = this.outputOptions;
|
|
5053
|
+
/** @type {WeakMap<Source, CachedSource>} */
|
|
5029
5054
|
const cachedSourceMap = new WeakMap();
|
|
5030
|
-
/** @type {Map<string, {hash: string, source: Source, chunk: Chunk}>} */
|
|
5055
|
+
/** @type {Map<string, { hash: string, source: Source, chunk: Chunk }>} */
|
|
5031
5056
|
const alreadyWrittenFiles = new Map();
|
|
5032
5057
|
|
|
5033
5058
|
asyncLib.forEachLimit(
|
|
@@ -5392,254 +5417,277 @@ This prevents using hashes of each other and should be avoided.`);
|
|
|
5392
5417
|
};
|
|
5393
5418
|
|
|
5394
5419
|
// Generate code for all aggregated modules
|
|
5395
|
-
asyncLib.eachLimit(
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
chunkGraph,
|
|
5405
|
-
modules,
|
|
5406
|
-
chunks,
|
|
5407
|
-
codeGenerationResults,
|
|
5408
|
-
chunkGraphEntries: chunks
|
|
5409
|
-
});
|
|
5410
|
-
this.chunkGraph = old;
|
|
5411
|
-
|
|
5412
|
-
const runtimeModules =
|
|
5413
|
-
chunkGraph.getChunkRuntimeModulesIterable(chunk);
|
|
5420
|
+
asyncLib.eachLimit(
|
|
5421
|
+
/** @type {import("neo-async").IterableCollection<Module>} */ (
|
|
5422
|
+
/** @type {unknown} */ (modules)
|
|
5423
|
+
),
|
|
5424
|
+
10,
|
|
5425
|
+
codeGen,
|
|
5426
|
+
(err) => {
|
|
5427
|
+
if (err) return callback(err);
|
|
5428
|
+
reportErrors();
|
|
5414
5429
|
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
this.
|
|
5419
|
-
|
|
5430
|
+
// for backward-compat temporary set the chunk graph
|
|
5431
|
+
// TODO webpack 6
|
|
5432
|
+
const old = this.chunkGraph;
|
|
5433
|
+
this.chunkGraph = chunkGraph;
|
|
5434
|
+
this.processRuntimeRequirements({
|
|
5420
5435
|
chunkGraph,
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
);
|
|
5428
|
-
}
|
|
5436
|
+
modules,
|
|
5437
|
+
chunks,
|
|
5438
|
+
codeGenerationResults,
|
|
5439
|
+
chunkGraphEntries: chunks
|
|
5440
|
+
});
|
|
5441
|
+
this.chunkGraph = old;
|
|
5429
5442
|
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
if (err) return callback(err);
|
|
5433
|
-
reportErrors();
|
|
5443
|
+
const runtimeModules =
|
|
5444
|
+
chunkGraph.getChunkRuntimeModulesIterable(chunk);
|
|
5434
5445
|
|
|
5435
|
-
|
|
5436
|
-
const
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
/** @type {ExecuteModuleResult["assets"]} */
|
|
5450
|
-
const assets = new Map();
|
|
5451
|
-
|
|
5452
|
-
let cacheable = true;
|
|
5453
|
-
|
|
5454
|
-
/** @type {ExecuteModuleContext} */
|
|
5455
|
-
const context = {
|
|
5456
|
-
assets,
|
|
5457
|
-
__webpack_require__: undefined,
|
|
5458
|
-
chunk,
|
|
5459
|
-
chunkGraph
|
|
5460
|
-
};
|
|
5446
|
+
// Hash runtime modules
|
|
5447
|
+
for (const module of runtimeModules) {
|
|
5448
|
+
modules.add(module);
|
|
5449
|
+
this._createModuleHash(
|
|
5450
|
+
module,
|
|
5451
|
+
chunkGraph,
|
|
5452
|
+
runtime,
|
|
5453
|
+
hashFunction,
|
|
5454
|
+
runtimeTemplate,
|
|
5455
|
+
hashDigest,
|
|
5456
|
+
hashDigestLength,
|
|
5457
|
+
errors
|
|
5458
|
+
);
|
|
5459
|
+
}
|
|
5461
5460
|
|
|
5462
|
-
//
|
|
5461
|
+
// Generate code for all runtime modules
|
|
5463
5462
|
asyncLib.eachLimit(
|
|
5464
|
-
|
|
5463
|
+
/** @type {import("neo-async").IterableCollection<RuntimeModule>} */ (
|
|
5464
|
+
runtimeModules
|
|
5465
|
+
),
|
|
5465
5466
|
10,
|
|
5466
|
-
|
|
5467
|
-
const codeGenerationResult = codeGenerationResults.get(
|
|
5468
|
-
module,
|
|
5469
|
-
runtime
|
|
5470
|
-
);
|
|
5471
|
-
/** @type {ExecuteModuleArgument} */
|
|
5472
|
-
const moduleArgument = {
|
|
5473
|
-
module,
|
|
5474
|
-
codeGenerationResult,
|
|
5475
|
-
moduleObject: undefined
|
|
5476
|
-
};
|
|
5477
|
-
moduleArgumentsMap.set(module, moduleArgument);
|
|
5478
|
-
moduleArgumentsById.set(module.identifier(), moduleArgument);
|
|
5479
|
-
module.addCacheDependencies(
|
|
5480
|
-
fileDependencies,
|
|
5481
|
-
contextDependencies,
|
|
5482
|
-
missingDependencies,
|
|
5483
|
-
buildDependencies
|
|
5484
|
-
);
|
|
5485
|
-
if (
|
|
5486
|
-
/** @type {BuildInfo} */ (module.buildInfo).cacheable ===
|
|
5487
|
-
false
|
|
5488
|
-
) {
|
|
5489
|
-
cacheable = false;
|
|
5490
|
-
}
|
|
5491
|
-
if (module.buildInfo && module.buildInfo.assets) {
|
|
5492
|
-
const { assets: moduleAssets, assetsInfo } = module.buildInfo;
|
|
5493
|
-
for (const assetName of Object.keys(moduleAssets)) {
|
|
5494
|
-
assets.set(assetName, {
|
|
5495
|
-
source: moduleAssets[assetName],
|
|
5496
|
-
info: assetsInfo ? assetsInfo.get(assetName) : undefined
|
|
5497
|
-
});
|
|
5498
|
-
}
|
|
5499
|
-
}
|
|
5500
|
-
this.hooks.prepareModuleExecution.callAsync(
|
|
5501
|
-
moduleArgument,
|
|
5502
|
-
context,
|
|
5503
|
-
callback
|
|
5504
|
-
);
|
|
5505
|
-
},
|
|
5467
|
+
codeGen,
|
|
5506
5468
|
(err) => {
|
|
5507
5469
|
if (err) return callback(err);
|
|
5470
|
+
reportErrors();
|
|
5508
5471
|
|
|
5509
|
-
/** @type {
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
strictModuleErrorHandling,
|
|
5514
|
-
strictModuleExceptionHandling
|
|
5515
|
-
} = this.outputOptions;
|
|
5516
|
-
|
|
5517
|
-
/** @type {WebpackRequire} */
|
|
5518
|
-
const __webpack_require__ = (id) => {
|
|
5519
|
-
const cached = moduleCache[id];
|
|
5520
|
-
if (cached !== undefined) {
|
|
5521
|
-
if (cached.error) throw cached.error;
|
|
5522
|
-
return cached.exports;
|
|
5523
|
-
}
|
|
5524
|
-
const moduleArgument = moduleArgumentsById.get(id);
|
|
5525
|
-
return __webpack_require_module__(
|
|
5526
|
-
/** @type {ExecuteModuleArgument} */
|
|
5527
|
-
(moduleArgument),
|
|
5528
|
-
id
|
|
5529
|
-
);
|
|
5530
|
-
};
|
|
5531
|
-
const interceptModuleExecution = (__webpack_require__[
|
|
5532
|
-
/** @type {"i"} */
|
|
5533
|
-
(
|
|
5534
|
-
RuntimeGlobals.interceptModuleExecution.replace(
|
|
5535
|
-
`${RuntimeGlobals.require}.`,
|
|
5536
|
-
""
|
|
5537
|
-
)
|
|
5538
|
-
)
|
|
5539
|
-
] = /** @type {NonNullable<WebpackRequire["i"]>} */ ([]));
|
|
5540
|
-
const moduleCache = (__webpack_require__[
|
|
5541
|
-
/** @type {"c"} */ (
|
|
5542
|
-
RuntimeGlobals.moduleCache.replace(
|
|
5543
|
-
`${RuntimeGlobals.require}.`,
|
|
5544
|
-
""
|
|
5545
|
-
)
|
|
5546
|
-
)
|
|
5547
|
-
] = /** @type {NonNullable<WebpackRequire["c"]>} */ ({}));
|
|
5472
|
+
/** @type {Map<Module, ExecuteModuleArgument>} */
|
|
5473
|
+
const moduleArgumentsMap = new Map();
|
|
5474
|
+
/** @type {Map<string, ExecuteModuleArgument>} */
|
|
5475
|
+
const moduleArgumentsById = new Map();
|
|
5548
5476
|
|
|
5549
|
-
|
|
5477
|
+
/** @type {ExecuteModuleResult["fileDependencies"]} */
|
|
5478
|
+
const fileDependencies = new LazySet();
|
|
5479
|
+
/** @type {ExecuteModuleResult["contextDependencies"]} */
|
|
5480
|
+
const contextDependencies = new LazySet();
|
|
5481
|
+
/** @type {ExecuteModuleResult["missingDependencies"]} */
|
|
5482
|
+
const missingDependencies = new LazySet();
|
|
5483
|
+
/** @type {ExecuteModuleResult["buildDependencies"]} */
|
|
5484
|
+
const buildDependencies = new LazySet();
|
|
5550
5485
|
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5486
|
+
/** @type {ExecuteModuleResult["assets"]} */
|
|
5487
|
+
const assets = new Map();
|
|
5488
|
+
|
|
5489
|
+
let cacheable = true;
|
|
5490
|
+
|
|
5491
|
+
/** @type {ExecuteModuleContext} */
|
|
5492
|
+
const context = {
|
|
5493
|
+
assets,
|
|
5494
|
+
__webpack_require__: undefined,
|
|
5495
|
+
chunk,
|
|
5496
|
+
chunkGraph
|
|
5497
|
+
};
|
|
5498
|
+
|
|
5499
|
+
// Prepare execution
|
|
5500
|
+
asyncLib.eachLimit(
|
|
5501
|
+
modules,
|
|
5502
|
+
10,
|
|
5503
|
+
(module, callback) => {
|
|
5504
|
+
const codeGenerationResult = codeGenerationResults.get(
|
|
5505
|
+
module,
|
|
5506
|
+
runtime
|
|
5507
|
+
);
|
|
5508
|
+
/** @type {ExecuteModuleArgument} */
|
|
5509
|
+
const moduleArgument = {
|
|
5510
|
+
module,
|
|
5511
|
+
codeGenerationResult,
|
|
5512
|
+
moduleObject: undefined
|
|
5567
5513
|
};
|
|
5568
|
-
|
|
5569
|
-
|
|
5514
|
+
moduleArgumentsMap.set(module, moduleArgument);
|
|
5515
|
+
moduleArgumentsById.set(
|
|
5516
|
+
module.identifier(),
|
|
5517
|
+
moduleArgument
|
|
5518
|
+
);
|
|
5519
|
+
module.addCacheDependencies(
|
|
5520
|
+
fileDependencies,
|
|
5521
|
+
contextDependencies,
|
|
5522
|
+
missingDependencies,
|
|
5523
|
+
buildDependencies
|
|
5524
|
+
);
|
|
5525
|
+
if (
|
|
5526
|
+
/** @type {BuildInfo} */ (module.buildInfo).cacheable ===
|
|
5527
|
+
false
|
|
5528
|
+
) {
|
|
5529
|
+
cacheable = false;
|
|
5570
5530
|
}
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
moduleArgument,
|
|
5582
|
-
context
|
|
5583
|
-
),
|
|
5584
|
-
"Compilation.hooks.executeModule"
|
|
5585
|
-
);
|
|
5586
|
-
moduleObject.loaded = true;
|
|
5587
|
-
return moduleObject.exports;
|
|
5588
|
-
} catch (execErr) {
|
|
5589
|
-
if (strictModuleExceptionHandling) {
|
|
5590
|
-
if (id) delete moduleCache[id];
|
|
5591
|
-
} else if (strictModuleErrorHandling) {
|
|
5592
|
-
moduleObject.error =
|
|
5593
|
-
/** @type {WebpackError} */
|
|
5594
|
-
(execErr);
|
|
5595
|
-
}
|
|
5596
|
-
if (!(/** @type {WebpackError} */ (execErr).module)) {
|
|
5597
|
-
/** @type {WebpackError} */
|
|
5598
|
-
(execErr).module = module;
|
|
5531
|
+
if (module.buildInfo && module.buildInfo.assets) {
|
|
5532
|
+
const { assets: moduleAssets, assetsInfo } =
|
|
5533
|
+
module.buildInfo;
|
|
5534
|
+
for (const assetName of Object.keys(moduleAssets)) {
|
|
5535
|
+
assets.set(assetName, {
|
|
5536
|
+
source: moduleAssets[assetName],
|
|
5537
|
+
info: assetsInfo
|
|
5538
|
+
? assetsInfo.get(assetName)
|
|
5539
|
+
: undefined
|
|
5540
|
+
});
|
|
5599
5541
|
}
|
|
5600
|
-
throw execErr;
|
|
5601
5542
|
}
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
)) {
|
|
5607
|
-
__webpack_require_module__(
|
|
5608
|
-
/** @type {ExecuteModuleArgument} */
|
|
5609
|
-
(moduleArgumentsMap.get(runtimeModule))
|
|
5543
|
+
this.hooks.prepareModuleExecution.callAsync(
|
|
5544
|
+
moduleArgument,
|
|
5545
|
+
context,
|
|
5546
|
+
callback
|
|
5610
5547
|
);
|
|
5611
|
-
}
|
|
5548
|
+
},
|
|
5549
|
+
(err) => {
|
|
5550
|
+
if (err) return callback(/** @type {WebpackError} */ (err));
|
|
5612
5551
|
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5552
|
+
/** @type {ExecuteModuleExports | undefined} */
|
|
5553
|
+
let exports;
|
|
5554
|
+
try {
|
|
5555
|
+
const {
|
|
5556
|
+
strictModuleErrorHandling,
|
|
5557
|
+
strictModuleExceptionHandling
|
|
5558
|
+
} = this.outputOptions;
|
|
5559
|
+
|
|
5560
|
+
/** @type {WebpackRequire} */
|
|
5561
|
+
const __webpack_require__ = (id) => {
|
|
5562
|
+
const cached = moduleCache[id];
|
|
5563
|
+
if (cached !== undefined) {
|
|
5564
|
+
if (cached.error) throw cached.error;
|
|
5565
|
+
return cached.exports;
|
|
5566
|
+
}
|
|
5567
|
+
const moduleArgument = moduleArgumentsById.get(id);
|
|
5568
|
+
return __webpack_require_module__(
|
|
5569
|
+
/** @type {ExecuteModuleArgument} */
|
|
5570
|
+
(moduleArgument),
|
|
5571
|
+
id
|
|
5572
|
+
);
|
|
5573
|
+
};
|
|
5574
|
+
const interceptModuleExecution = (__webpack_require__[
|
|
5575
|
+
/** @type {"i"} */
|
|
5576
|
+
(
|
|
5577
|
+
RuntimeGlobals.interceptModuleExecution.replace(
|
|
5578
|
+
`${RuntimeGlobals.require}.`,
|
|
5579
|
+
""
|
|
5580
|
+
)
|
|
5581
|
+
)
|
|
5582
|
+
] = /** @type {NonNullable<WebpackRequire["i"]>} */ ([]));
|
|
5583
|
+
const moduleCache = (__webpack_require__[
|
|
5584
|
+
/** @type {"c"} */ (
|
|
5585
|
+
RuntimeGlobals.moduleCache.replace(
|
|
5586
|
+
`${RuntimeGlobals.require}.`,
|
|
5587
|
+
""
|
|
5588
|
+
)
|
|
5589
|
+
)
|
|
5590
|
+
] = /** @type {NonNullable<WebpackRequire["c"]>} */ ({}));
|
|
5591
|
+
|
|
5592
|
+
context.__webpack_require__ = __webpack_require__;
|
|
5593
|
+
|
|
5594
|
+
/**
|
|
5595
|
+
* @param {ExecuteModuleArgument} moduleArgument the module argument
|
|
5596
|
+
* @param {string=} id id
|
|
5597
|
+
* @returns {ExecuteModuleExports} exports
|
|
5598
|
+
*/
|
|
5599
|
+
const __webpack_require_module__ = (
|
|
5600
|
+
moduleArgument,
|
|
5601
|
+
id
|
|
5602
|
+
) => {
|
|
5603
|
+
/** @type {ExecuteOptions} */
|
|
5604
|
+
const execOptions = {
|
|
5605
|
+
id,
|
|
5606
|
+
module: {
|
|
5607
|
+
id,
|
|
5608
|
+
exports: {},
|
|
5609
|
+
loaded: false,
|
|
5610
|
+
error: undefined
|
|
5611
|
+
},
|
|
5612
|
+
require: __webpack_require__
|
|
5613
|
+
};
|
|
5614
|
+
for (const handler of interceptModuleExecution) {
|
|
5615
|
+
handler(execOptions);
|
|
5616
|
+
}
|
|
5617
|
+
const module = moduleArgument.module;
|
|
5618
|
+
this.buildTimeExecutedModules.add(module);
|
|
5619
|
+
const moduleObject = execOptions.module;
|
|
5620
|
+
moduleArgument.moduleObject = moduleObject;
|
|
5621
|
+
try {
|
|
5622
|
+
if (id) moduleCache[id] = moduleObject;
|
|
5623
|
+
|
|
5624
|
+
tryRunOrWebpackError(
|
|
5625
|
+
() =>
|
|
5626
|
+
this.hooks.executeModule.call(
|
|
5627
|
+
moduleArgument,
|
|
5628
|
+
context
|
|
5629
|
+
),
|
|
5630
|
+
"Compilation.hooks.executeModule"
|
|
5631
|
+
);
|
|
5632
|
+
moduleObject.loaded = true;
|
|
5633
|
+
return moduleObject.exports;
|
|
5634
|
+
} catch (execErr) {
|
|
5635
|
+
if (strictModuleExceptionHandling) {
|
|
5636
|
+
if (id) delete moduleCache[id];
|
|
5637
|
+
} else if (strictModuleErrorHandling) {
|
|
5638
|
+
moduleObject.error =
|
|
5639
|
+
/** @type {WebpackError} */
|
|
5640
|
+
(execErr);
|
|
5641
|
+
}
|
|
5642
|
+
if (!(/** @type {WebpackError} */ (execErr).module)) {
|
|
5643
|
+
/** @type {WebpackError} */
|
|
5644
|
+
(execErr).module = module;
|
|
5645
|
+
}
|
|
5646
|
+
throw execErr;
|
|
5647
|
+
}
|
|
5648
|
+
};
|
|
5649
|
+
|
|
5650
|
+
for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder(
|
|
5651
|
+
chunk
|
|
5652
|
+
)) {
|
|
5653
|
+
__webpack_require_module__(
|
|
5654
|
+
/** @type {ExecuteModuleArgument} */
|
|
5655
|
+
(moduleArgumentsMap.get(runtimeModule))
|
|
5656
|
+
);
|
|
5657
|
+
}
|
|
5629
5658
|
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5659
|
+
exports = __webpack_require__(module.identifier());
|
|
5660
|
+
} catch (execErr) {
|
|
5661
|
+
const { message, stack, module } =
|
|
5662
|
+
/** @type {WebpackError} */
|
|
5663
|
+
(execErr);
|
|
5664
|
+
const err = new WebpackError(
|
|
5665
|
+
`Execution of module code from module graph (${
|
|
5666
|
+
/** @type {Module} */
|
|
5667
|
+
(module).readableIdentifier(this.requestShortener)
|
|
5668
|
+
}) failed: ${message}`,
|
|
5669
|
+
{ cause: execErr }
|
|
5670
|
+
);
|
|
5671
|
+
err.stack = stack;
|
|
5672
|
+
err.module = module;
|
|
5673
|
+
return callback(err);
|
|
5674
|
+
}
|
|
5675
|
+
|
|
5676
|
+
callback(null, {
|
|
5677
|
+
exports,
|
|
5678
|
+
assets,
|
|
5679
|
+
cacheable,
|
|
5680
|
+
fileDependencies,
|
|
5681
|
+
contextDependencies,
|
|
5682
|
+
missingDependencies,
|
|
5683
|
+
buildDependencies
|
|
5684
|
+
});
|
|
5685
|
+
}
|
|
5686
|
+
);
|
|
5639
5687
|
}
|
|
5640
5688
|
);
|
|
5641
|
-
}
|
|
5642
|
-
|
|
5689
|
+
}
|
|
5690
|
+
);
|
|
5643
5691
|
}
|
|
5644
5692
|
);
|
|
5645
5693
|
}
|