webpack 5.100.2 → 5.101.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.
Files changed (309) hide show
  1. package/README.md +12 -10
  2. package/bin/webpack.js +7 -7
  3. package/lib/APIPlugin.js +12 -14
  4. package/lib/AutomaticPrefetchPlugin.js +2 -2
  5. package/lib/BannerPlugin.js +4 -4
  6. package/lib/Cache.js +1 -1
  7. package/lib/CacheFacade.js +7 -7
  8. package/lib/CaseSensitiveModulesWarning.js +2 -2
  9. package/lib/Chunk.js +3 -3
  10. package/lib/ChunkGraph.js +63 -18
  11. package/lib/ChunkGroup.js +4 -4
  12. package/lib/CleanPlugin.js +19 -53
  13. package/lib/CodeGenerationResults.js +3 -3
  14. package/lib/CompatibilityPlugin.js +6 -6
  15. package/lib/Compilation.js +168 -116
  16. package/lib/Compiler.js +37 -37
  17. package/lib/ConcatenationScope.js +39 -1
  18. package/lib/ConstPlugin.js +11 -11
  19. package/lib/ContextExclusionPlugin.js +3 -3
  20. package/lib/ContextModule.js +12 -11
  21. package/lib/ContextModuleFactory.js +11 -11
  22. package/lib/ContextReplacementPlugin.js +5 -5
  23. package/lib/DefinePlugin.js +24 -22
  24. package/lib/DelegatedModuleFactoryPlugin.js +1 -1
  25. package/lib/Dependency.js +2 -1
  26. package/lib/DllEntryPlugin.js +1 -1
  27. package/lib/DllReferencePlugin.js +1 -1
  28. package/lib/DynamicEntryPlugin.js +3 -3
  29. package/lib/EntryPlugin.js +1 -1
  30. package/lib/EnvironmentPlugin.js +1 -1
  31. package/lib/ErrorHelpers.js +2 -2
  32. package/lib/EvalDevToolModulePlugin.js +2 -2
  33. package/lib/EvalSourceMapDevToolPlugin.js +5 -5
  34. package/lib/ExportsInfo.js +9 -9
  35. package/lib/ExportsInfoApiPlugin.js +2 -2
  36. package/lib/ExternalModule.js +163 -48
  37. package/lib/ExternalModuleFactoryPlugin.js +2 -2
  38. package/lib/ExternalsPlugin.js +45 -0
  39. package/lib/FileSystemInfo.js +64 -61
  40. package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
  41. package/lib/FlagDependencyExportsPlugin.js +7 -7
  42. package/lib/FlagDependencyUsagePlugin.js +4 -4
  43. package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
  44. package/lib/HotModuleReplacementPlugin.js +27 -27
  45. package/lib/IgnorePlugin.js +3 -3
  46. package/lib/IgnoreWarningsPlugin.js +4 -4
  47. package/lib/InitFragment.js +6 -0
  48. package/lib/InvalidDependenciesModuleWarning.js +1 -1
  49. package/lib/JavascriptMetaInfoPlugin.js +1 -1
  50. package/lib/LibManifestPlugin.js +2 -2
  51. package/lib/LoaderOptionsPlugin.js +1 -1
  52. package/lib/LoaderTargetPlugin.js +2 -2
  53. package/lib/MainTemplate.js +1 -1
  54. package/lib/Module.js +3 -2
  55. package/lib/ModuleFilenameHelpers.js +3 -3
  56. package/lib/ModuleGraph.js +23 -38
  57. package/lib/ModuleInfoHeaderPlugin.js +3 -3
  58. package/lib/ModuleParseError.js +5 -3
  59. package/lib/ModuleTemplate.js +3 -2
  60. package/lib/MultiCompiler.js +29 -24
  61. package/lib/MultiStats.js +18 -13
  62. package/lib/MultiWatching.js +1 -1
  63. package/lib/NoEmitOnErrorsPlugin.js +2 -2
  64. package/lib/NodeStuffPlugin.js +27 -15
  65. package/lib/NormalModule.js +23 -23
  66. package/lib/NormalModuleFactory.js +23 -21
  67. package/lib/NormalModuleReplacementPlugin.js +3 -3
  68. package/lib/PrefetchPlugin.js +1 -1
  69. package/lib/ProgressPlugin.js +11 -11
  70. package/lib/ProvidePlugin.js +2 -2
  71. package/lib/RecordIdsPlugin.js +3 -3
  72. package/lib/ResolverFactory.js +3 -3
  73. package/lib/RuntimeGlobals.js +20 -0
  74. package/lib/RuntimePlugin.js +16 -16
  75. package/lib/RuntimeTemplate.js +35 -26
  76. package/lib/SizeFormatHelpers.js +1 -1
  77. package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
  78. package/lib/SourceMapDevToolPlugin.js +9 -9
  79. package/lib/Stats.js +2 -2
  80. package/lib/Template.js +1 -1
  81. package/lib/TemplatedPathPlugin.js +2 -2
  82. package/lib/UseStrictPlugin.js +1 -1
  83. package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
  84. package/lib/WarnDeprecatedOptionPlugin.js +1 -1
  85. package/lib/WarnNoModeSetPlugin.js +1 -1
  86. package/lib/WatchIgnorePlugin.js +2 -2
  87. package/lib/Watching.js +12 -14
  88. package/lib/WebpackIsIncludedPlugin.js +2 -2
  89. package/lib/WebpackOptionsApply.js +3 -3
  90. package/lib/asset/AssetGenerator.js +1 -1
  91. package/lib/asset/AssetModulesPlugin.js +6 -6
  92. package/lib/async-modules/AsyncModuleHelpers.js +1 -1
  93. package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
  94. package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
  95. package/lib/buildChunkGraph.js +5 -5
  96. package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
  97. package/lib/cache/IdleFileCachePlugin.js +5 -5
  98. package/lib/cache/PackFileCacheStrategy.js +20 -20
  99. package/lib/cache/ResolverCachePlugin.js +4 -4
  100. package/lib/cli.js +196 -14
  101. package/lib/config/browserslistTargetHandler.js +6 -6
  102. package/lib/config/defaults.js +23 -14
  103. package/lib/config/normalization.js +41 -38
  104. package/lib/config/target.js +4 -4
  105. package/lib/container/ContainerEntryModule.js +3 -3
  106. package/lib/container/ContainerPlugin.js +3 -3
  107. package/lib/container/ContainerReferencePlugin.js +3 -3
  108. package/lib/container/FallbackModule.js +1 -1
  109. package/lib/container/HoistContainerReferencesPlugin.js +7 -7
  110. package/lib/container/options.js +4 -4
  111. package/lib/css/CssGenerator.js +5 -3
  112. package/lib/css/CssLoadingRuntimeModule.js +1 -1
  113. package/lib/css/CssModulesPlugin.js +25 -22
  114. package/lib/css/CssParser.js +5 -5
  115. package/lib/css/walkCssTokens.js +9 -9
  116. package/lib/debug/ProfilingPlugin.js +5 -5
  117. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
  118. package/lib/dependencies/AMDPlugin.js +3 -3
  119. package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
  120. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
  121. package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
  122. package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
  123. package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
  124. package/lib/dependencies/CommonJsPlugin.js +2 -2
  125. package/lib/dependencies/ContextDependency.js +1 -1
  126. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  127. package/lib/dependencies/CssIcssExportDependency.js +2 -2
  128. package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
  129. package/lib/dependencies/CssUrlDependency.js +4 -4
  130. package/lib/dependencies/DynamicExports.js +5 -5
  131. package/lib/dependencies/HarmonyAcceptDependency.js +91 -5
  132. package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
  133. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
  134. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
  135. package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
  136. package/lib/dependencies/HarmonyExports.js +1 -1
  137. package/lib/dependencies/HarmonyImportDependency.js +28 -9
  138. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
  139. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
  140. package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
  141. package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
  142. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
  143. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
  144. package/lib/dependencies/ImportMetaPlugin.js +7 -7
  145. package/lib/dependencies/ImportParserPlugin.js +4 -4
  146. package/lib/dependencies/JsonExportsDependency.js +7 -2
  147. package/lib/dependencies/LoaderPlugin.js +4 -4
  148. package/lib/dependencies/ModuleDependency.js +2 -1
  149. package/lib/dependencies/ProvidedDependency.js +2 -2
  150. package/lib/dependencies/PureExpressionDependency.js +1 -1
  151. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  152. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
  153. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
  154. package/lib/dependencies/SystemPlugin.js +3 -3
  155. package/lib/dependencies/WorkerPlugin.js +5 -5
  156. package/lib/dependencies/getFunctionExpression.js +1 -1
  157. package/lib/esm/ExportWebpackRequireRuntimeModule.js +8 -1
  158. package/lib/esm/ModuleChunkFormatPlugin.js +35 -69
  159. package/lib/esm/ModuleChunkLoadingPlugin.js +3 -6
  160. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
  161. package/lib/formatLocation.js +2 -2
  162. package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
  163. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
  164. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
  165. package/lib/hmr/LazyCompilationPlugin.js +6 -6
  166. package/lib/hmr/lazyCompilationBackend.js +6 -6
  167. package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
  168. package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
  169. package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
  170. package/lib/ids/HashedModuleIdsPlugin.js +1 -1
  171. package/lib/ids/IdHelpers.js +9 -9
  172. package/lib/ids/NamedChunkIdsPlugin.js +5 -5
  173. package/lib/ids/NamedModuleIdsPlugin.js +2 -2
  174. package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
  175. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  176. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
  177. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
  178. package/lib/ids/SyncModuleIdsPlugin.js +4 -4
  179. package/lib/index.js +18 -6
  180. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
  181. package/lib/javascript/BasicEvaluatedExpression.js +3 -3
  182. package/lib/javascript/ChunkFormatHelpers.js +70 -0
  183. package/lib/javascript/CommonJsChunkFormatPlugin.js +10 -21
  184. package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
  185. package/lib/javascript/JavascriptGenerator.js +1 -1
  186. package/lib/javascript/JavascriptModulesPlugin.js +108 -54
  187. package/lib/javascript/JavascriptParser.js +80 -78
  188. package/lib/javascript/JavascriptParserHelpers.js +3 -3
  189. package/lib/javascript/StartupHelpers.js +2 -2
  190. package/lib/json/JsonGenerator.js +2 -2
  191. package/lib/json/JsonModulesPlugin.js +2 -2
  192. package/lib/library/AbstractLibraryPlugin.js +30 -3
  193. package/lib/library/AmdLibraryPlugin.js +3 -3
  194. package/lib/library/AssignLibraryPlugin.js +2 -2
  195. package/lib/library/EnableLibraryPlugin.js +2 -2
  196. package/lib/library/ModuleLibraryPlugin.js +49 -31
  197. package/lib/library/SystemLibraryPlugin.js +6 -4
  198. package/lib/library/UmdLibraryPlugin.js +14 -14
  199. package/lib/logging/createConsoleLogger.js +4 -4
  200. package/lib/logging/runtime.js +3 -3
  201. package/lib/logging/truncateArgs.js +4 -4
  202. package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
  203. package/lib/node/NodeEnvironmentPlugin.js +1 -1
  204. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
  205. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
  206. package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
  207. package/lib/node/RequireChunkLoadingRuntimeModule.js +13 -6
  208. package/lib/node/nodeConsole.js +2 -2
  209. package/lib/optimize/AggressiveMergingPlugin.js +2 -2
  210. package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
  211. package/lib/optimize/ConcatenatedModule.js +186 -77
  212. package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
  213. package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
  214. package/lib/optimize/InnerGraph.js +5 -5
  215. package/lib/optimize/InnerGraphPlugin.js +14 -12
  216. package/lib/optimize/LimitChunkCountPlugin.js +5 -5
  217. package/lib/optimize/MangleExportsPlugin.js +5 -5
  218. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
  219. package/lib/optimize/MinChunkSizePlugin.js +3 -3
  220. package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
  221. package/lib/optimize/RealContentHashPlugin.js +23 -23
  222. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
  223. package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
  224. package/lib/optimize/RuntimeChunkPlugin.js +2 -2
  225. package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
  226. package/lib/optimize/SplitChunksPlugin.js +20 -20
  227. package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
  228. package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
  229. package/lib/performance/SizeLimitsPlugin.js +4 -4
  230. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
  231. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
  232. package/lib/rules/BasicMatcherRulePlugin.js +1 -1
  233. package/lib/rules/RuleSetCompiler.js +10 -10
  234. package/lib/rules/UseEffectRulePlugin.js +2 -2
  235. package/lib/runtime/GetChunkFilenameRuntimeModule.js +19 -15
  236. package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
  237. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
  238. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
  239. package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
  240. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
  241. package/lib/schemes/DataUriPlugin.js +3 -3
  242. package/lib/schemes/FileUriPlugin.js +1 -1
  243. package/lib/schemes/HttpUriPlugin.js +40 -36
  244. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  245. package/lib/serialization/BinaryMiddleware.js +11 -11
  246. package/lib/serialization/FileMiddleware.js +18 -17
  247. package/lib/serialization/ObjectMiddleware.js +8 -8
  248. package/lib/serialization/Serializer.js +2 -2
  249. package/lib/serialization/SerializerMiddleware.js +2 -2
  250. package/lib/sharing/ConsumeSharedPlugin.js +4 -4
  251. package/lib/sharing/ProvideSharedPlugin.js +4 -4
  252. package/lib/sharing/SharePlugin.js +1 -1
  253. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  254. package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
  255. package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
  256. package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
  257. package/lib/stats/StatsFactory.js +7 -7
  258. package/lib/stats/StatsPrinter.js +9 -9
  259. package/lib/url/URLParserPlugin.js +5 -5
  260. package/lib/util/AsyncQueue.js +4 -4
  261. package/lib/util/IterableHelpers.js +2 -2
  262. package/lib/util/LazyBucketSortedSet.js +3 -3
  263. package/lib/util/SetHelpers.js +2 -2
  264. package/lib/util/StackedCacheMap.js +1 -1
  265. package/lib/util/StackedMap.js +1 -1
  266. package/lib/util/TupleSet.js +1 -1
  267. package/lib/util/WeakTupleMap.js +1 -1
  268. package/lib/util/cleverMerge.js +8 -8
  269. package/lib/util/comparators.js +10 -10
  270. package/lib/util/compileBooleanMatcher.js +20 -20
  271. package/lib/util/concatenate.js +3 -3
  272. package/lib/util/conventions.js +4 -4
  273. package/lib/util/create-schema-validation.js +1 -1
  274. package/lib/util/createHash.js +1 -1
  275. package/lib/util/deprecation.js +4 -4
  276. package/lib/util/deterministicGrouping.js +7 -7
  277. package/lib/util/findGraphRoots.js +1 -1
  278. package/lib/util/fs.js +4 -4
  279. package/lib/util/identifier.js +14 -14
  280. package/lib/util/magicComment.js +5 -1
  281. package/lib/util/memoize.js +1 -1
  282. package/lib/util/processAsyncTree.js +2 -2
  283. package/lib/util/propertyName.js +1 -1
  284. package/lib/util/removeBOM.js +1 -1
  285. package/lib/util/runtime.js +6 -6
  286. package/lib/util/semver.js +16 -16
  287. package/lib/util/serialization.js +5 -5
  288. package/lib/util/smartGrouping.js +1 -1
  289. package/lib/validateSchema.js +2 -2
  290. package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
  291. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
  292. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
  293. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
  294. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
  295. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
  296. package/lib/wasm-sync/WebAssemblyGenerator.js +16 -17
  297. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
  298. package/lib/wasm-sync/WebAssemblyParser.js +2 -2
  299. package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
  300. package/lib/web/FetchCompileWasmPlugin.js +4 -4
  301. package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
  302. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
  303. package/lib/webpack.js +17 -12
  304. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
  305. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  306. package/package.json +16 -16
  307. package/schemas/WebpackOptions.check.js +1 -1
  308. package/schemas/WebpackOptions.json +4 -0
  309. package/types.d.ts +275 -64
@@ -372,7 +372,7 @@ const { isSourceEqual } = require("./util/source");
372
372
  * @property {false | "none" | "error" | "warn" | "info" | "log" | "verbose"} logging
373
373
  * @property {((value: string) => boolean)[]} loggingDebug
374
374
  * @property {boolean} loggingTrace
375
- * @property {TODO} _env
375
+ * @property {EXPECTED_ANY} _env
376
376
  */
377
377
 
378
378
  /** @typedef {KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, EXPECTED_ANY>} NormalizedStatsOptions */
@@ -403,7 +403,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
403
403
  * @param {Compilation} compilation compilation
404
404
  * @returns {NormalModuleCompilationHooks["loader"]} hooks
405
405
  */
406
- compilation =>
406
+ (compilation) =>
407
407
  require("./NormalModule").getCompilationHooks(compilation).loader,
408
408
  "Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader",
409
409
  "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK"
@@ -413,7 +413,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
413
413
  /**
414
414
  * @param {ModuleTemplates | undefined} moduleTemplates module templates
415
415
  */
416
- const defineRemovedModuleTemplates = moduleTemplates => {
416
+ const defineRemovedModuleTemplates = (moduleTemplates) => {
417
417
  Object.defineProperties(moduleTemplates, {
418
418
  asset: {
419
419
  enumerable: false,
@@ -437,21 +437,24 @@ const defineRemovedModuleTemplates = moduleTemplates => {
437
437
  moduleTemplates = undefined;
438
438
  };
439
439
 
440
- const byId = compareSelect(c => c.id, compareIds);
440
+ const byId = compareSelect((c) => c.id, compareIds);
441
441
 
442
442
  const byNameOrHash = concatComparators(
443
- compareSelect(c => c.name, compareIds),
444
- compareSelect(c => c.fullHash, compareIds)
443
+ compareSelect((c) => c.name, compareIds),
444
+ compareSelect((c) => c.fullHash, compareIds)
445
445
  );
446
446
 
447
- const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric);
447
+ const byMessage = compareSelect(
448
+ (err) => `${err.message}`,
449
+ compareStringsNumeric
450
+ );
448
451
 
449
452
  const byModule = compareSelect(
450
- err => (err.module && err.module.identifier()) || "",
453
+ (err) => (err.module && err.module.identifier()) || "",
451
454
  compareStringsNumeric
452
455
  );
453
456
 
454
- const byLocation = compareSelect(err => err.loc, compareLocations);
457
+ const byLocation = compareSelect((err) => err.loc, compareLocations);
455
458
 
456
459
  const compareErrors = concatComparators(byModule, byLocation, byMessage);
457
460
 
@@ -497,7 +500,7 @@ class Compilation {
497
500
  * @param {CompilationAssets} assets assets
498
501
  * @returns {CompilationAssets} new assets
499
502
  */
500
- const popNewAssets = assets => {
503
+ const popNewAssets = (assets) => {
501
504
  let newAssets;
502
505
  for (const file of Object.keys(assets)) {
503
506
  if (savedAssets.has(file)) continue;
@@ -514,7 +517,7 @@ class Compilation {
514
517
  call: () => {
515
518
  savedAssets = new Set(Object.keys(this.assets));
516
519
  },
517
- register: tap => {
520
+ register: (tap) => {
518
521
  const { type, name } = tap;
519
522
  const { fn, additionalAssets, ...remainingTap } = tap;
520
523
  const additionalAssetsFn =
@@ -523,15 +526,30 @@ class Compilation {
523
526
 
524
527
  /** @type {ProcessedAssets | undefined} */
525
528
  const processedAssets = additionalAssetsFn ? new WeakSet() : undefined;
529
+ /**
530
+ * @param {CompilationAssets} assets to be processed by additionalAssetsFn
531
+ * @returns {CompilationAssets} available assets
532
+ */
533
+ const getAvailableAssets = (assets) => {
534
+ /** @type {CompilationAssets} */
535
+ const availableAssets = {};
536
+ for (const file of Object.keys(assets)) {
537
+ // https://github.com/webpack-contrib/compression-webpack-plugin/issues/390
538
+ if (this.assets[file]) {
539
+ availableAssets[file] = assets[file];
540
+ }
541
+ }
542
+ return availableAssets;
543
+ };
526
544
  switch (type) {
527
545
  case "sync":
528
546
  if (additionalAssetsFn) {
529
- this.hooks.processAdditionalAssets.tap(name, assets => {
547
+ this.hooks.processAdditionalAssets.tap(name, (assets) => {
530
548
  if (
531
549
  /** @type {ProcessedAssets} */
532
550
  (processedAssets).has(this.assets)
533
551
  ) {
534
- additionalAssetsFn(assets);
552
+ additionalAssetsFn(getAvailableAssets(assets));
535
553
  }
536
554
  });
537
555
  }
@@ -572,7 +590,10 @@ class Compilation {
572
590
  /** @type {ProcessedAssets} */
573
591
  (processedAssets).has(this.assets)
574
592
  ) {
575
- return additionalAssetsFn(assets, callback);
593
+ return additionalAssetsFn(
594
+ getAvailableAssets(assets),
595
+ callback
596
+ );
576
597
  }
577
598
  callback();
578
599
  }
@@ -592,7 +613,7 @@ class Compilation {
592
613
  * @param {Error} err err
593
614
  * @returns {void}
594
615
  */
595
- err => {
616
+ (err) => {
596
617
  if (err) return callback(err);
597
618
  if (processedAssets !== undefined) {
598
619
  processedAssets.add(this.assets);
@@ -612,12 +633,12 @@ class Compilation {
612
633
  };
613
634
  case "promise":
614
635
  if (additionalAssetsFn) {
615
- this.hooks.processAdditionalAssets.tapPromise(name, assets => {
636
+ this.hooks.processAdditionalAssets.tapPromise(name, (assets) => {
616
637
  if (
617
638
  /** @type {ProcessedAssets} */
618
639
  (processedAssets).has(this.assets)
619
640
  ) {
620
- return additionalAssetsFn(assets);
641
+ return additionalAssetsFn(getAvailableAssets(assets));
621
642
  }
622
643
  return Promise.resolve();
623
644
  });
@@ -628,7 +649,7 @@ class Compilation {
628
649
  * @param {CompilationAssets} assets assets
629
650
  * @returns {Promise<CompilationAssets>} result
630
651
  */
631
- fn: assets => {
652
+ fn: (assets) => {
632
653
  const p = fn(assets);
633
654
  if (!p || !p.then) return p;
634
655
  return p.then(() => {
@@ -665,14 +686,15 @@ class Compilation {
665
686
  * @param {string} reason reason
666
687
  * @returns {string} error message
667
688
  */
668
- const errorMessage =
669
- reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
689
+ const errorMessage = (
690
+ reason
691
+ ) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
670
692
  BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
671
693
  /**
672
694
  * @param {string | (import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions)} options hook options
673
695
  * @returns {import("tapable").TapOptions & { name: string; } & ProcessAssetsAdditionalOptions} modified options
674
696
  */
675
- const getOptions = options => {
697
+ const getOptions = (options) => {
676
698
  if (typeof options === "string") options = { name: options };
677
699
  if (options.stage) {
678
700
  throw new Error(errorMessage("it's using the 'stage' option"));
@@ -1075,7 +1097,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1075
1097
  this.addModuleQueue = new AsyncQueue({
1076
1098
  name: "addModule",
1077
1099
  parent: this.processDependenciesQueue,
1078
- getKey: module => module.identifier(),
1100
+ getKey: (module) => module.identifier(),
1079
1101
  processor: this._addModule.bind(this)
1080
1102
  });
1081
1103
  /** @type {AsyncQueue<FactorizeModuleOptions, string, Module | ModuleFactoryResult>} */
@@ -1199,7 +1221,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1199
1221
  * @param {string} item item
1200
1222
  * @returns {LazySet<string>} file dependencies
1201
1223
  */
1202
- item => this.fileDependencies.add(item),
1224
+ (item) => this.fileDependencies.add(item),
1203
1225
  "Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)",
1204
1226
  "DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES"
1205
1227
  )
@@ -1351,7 +1373,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1351
1373
  /* eslint-enable no-console */
1352
1374
  }
1353
1375
  },
1354
- childName => {
1376
+ (childName) => {
1355
1377
  if (typeof name === "function") {
1356
1378
  if (typeof childName === "function") {
1357
1379
  return this.getLogger(() => {
@@ -1527,7 +1549,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1527
1549
  this.resolverFactory.get("normal", module.resolveOptions),
1528
1550
  /** @type {InputFileSystem} */
1529
1551
  (this.inputFileSystem),
1530
- err => {
1552
+ (err) => {
1531
1553
  if (currentProfile !== undefined) {
1532
1554
  currentProfile.markBuildingEnd();
1533
1555
  }
@@ -1538,20 +1560,25 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1538
1560
  if (currentProfile !== undefined) {
1539
1561
  currentProfile.markStoringStart();
1540
1562
  }
1541
- this._modulesCache.store(module.identifier(), null, module, err => {
1542
- if (currentProfile !== undefined) {
1543
- currentProfile.markStoringEnd();
1544
- }
1545
- if (err) {
1546
- this.hooks.failedModule.call(
1547
- module,
1548
- /** @type {WebpackError} */ (err)
1549
- );
1550
- return callback(new ModuleStoreError(module, err));
1563
+ this._modulesCache.store(
1564
+ module.identifier(),
1565
+ null,
1566
+ module,
1567
+ (err) => {
1568
+ if (currentProfile !== undefined) {
1569
+ currentProfile.markStoringEnd();
1570
+ }
1571
+ if (err) {
1572
+ this.hooks.failedModule.call(
1573
+ module,
1574
+ /** @type {WebpackError} */ (err)
1575
+ );
1576
+ return callback(new ModuleStoreError(module, err));
1577
+ }
1578
+ this.hooks.succeedModule.call(module);
1579
+ return callback();
1551
1580
  }
1552
- this.hooks.succeedModule.call(module);
1553
- return callback();
1554
- });
1581
+ );
1555
1582
  }
1556
1583
  );
1557
1584
  }
@@ -1575,7 +1602,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1575
1602
  /**
1576
1603
  * @param {DependenciesBlock} block block
1577
1604
  */
1578
- const processDependenciesBlock = block => {
1605
+ const processDependenciesBlock = (block) => {
1579
1606
  if (block.dependencies) {
1580
1607
  let i = 0;
1581
1608
  for (const dep of block.dependencies) {
@@ -1625,7 +1652,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1625
1652
  * @param {WebpackError=} err error
1626
1653
  * @returns {void}
1627
1654
  */
1628
- const onDependenciesSorted = err => {
1655
+ const onDependenciesSorted = (err) => {
1629
1656
  if (err) return callback(err);
1630
1657
 
1631
1658
  // early exit without changing parallelism back and forth
@@ -1639,7 +1666,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1639
1666
  for (const item of sortedDependencies) {
1640
1667
  inProgressTransitive++;
1641
1668
  // eslint-disable-next-line no-loop-func
1642
- this.handleModuleCreation(item, err => {
1669
+ this.handleModuleCreation(item, (err) => {
1643
1670
  // In V8, the Error objects keep a reference to the functions on the stack. These warnings &
1644
1671
  // errors are created inside closures that keep a reference to the Compilation, so errors are
1645
1672
  // leaking the Compilation object.
@@ -1661,7 +1688,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1661
1688
  * @param {WebpackError=} err error
1662
1689
  * @returns {void}
1663
1690
  */
1664
- const onTransitiveTasksFinished = err => {
1691
+ const onTransitiveTasksFinished = (err) => {
1665
1692
  if (err) return callback(err);
1666
1693
  this.processDependenciesQueue.decreaseParallelism();
1667
1694
 
@@ -1738,7 +1765,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1738
1765
  module,
1739
1766
  dep,
1740
1767
  cachedModule,
1741
- err => {
1768
+ (err) => {
1742
1769
  if (err) {
1743
1770
  if (inProgressTransitive <= 0) return;
1744
1771
  inProgressTransitive = -1;
@@ -1783,7 +1810,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1783
1810
  * @param {Dependency} dep dependency
1784
1811
  * @returns {void}
1785
1812
  */
1786
- const processDependencyForResolving = dep => {
1813
+ const processDependencyForResolving = (dep) => {
1787
1814
  const resourceIdent = dep.getResourceIdentifier();
1788
1815
  if (resourceIdent !== undefined && resourceIdent !== null) {
1789
1816
  const category = dep.category;
@@ -1982,7 +2009,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1982
2009
  };
1983
2010
  if (err) {
1984
2011
  if (factoryResult) applyFactoryResultDependencies();
1985
- if (dependencies.every(d => d.optional)) {
2012
+ if (dependencies.every((d) => d.optional)) {
1986
2013
  this.warnings.push(err);
1987
2014
  return callback();
1988
2015
  }
@@ -2136,7 +2163,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2136
2163
  }
2137
2164
  }
2138
2165
 
2139
- this.buildModule(module, err => {
2166
+ this.buildModule(module, (err) => {
2140
2167
  if (creatingModuleDuringBuildSet !== undefined) {
2141
2168
  creatingModuleDuringBuildSet.delete(module);
2142
2169
  }
@@ -2160,7 +2187,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2160
2187
  return callback(null, module);
2161
2188
  }
2162
2189
 
2163
- this.processModuleDependencies(module, err => {
2190
+ this.processModuleDependencies(module, (err) => {
2164
2191
  if (err) {
2165
2192
  return callback(err);
2166
2193
  }
@@ -2238,7 +2265,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2238
2265
  originModule,
2239
2266
  err,
2240
2267
  /** @type {DependencyLocation} */
2241
- (dependencies.map(d => d.loc).find(Boolean))
2268
+ (dependencies.map((d) => d.loc).find(Boolean))
2242
2269
  );
2243
2270
  return callback(notFoundError, factoryResult ? result : undefined);
2244
2271
  }
@@ -2453,9 +2480,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2453
2480
  const oldBlocks = [...module.blocks];
2454
2481
  module.invalidateBuild();
2455
2482
  this.buildQueue.invalidate(module);
2456
- this.buildModule(module, err => {
2483
+ this.buildModule(module, (err) => {
2457
2484
  if (err) {
2458
- return this.hooks.finishRebuildingModule.callAsync(module, err2 => {
2485
+ return this.hooks.finishRebuildingModule.callAsync(module, (err2) => {
2459
2486
  if (err2) {
2460
2487
  callback(
2461
2488
  makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule")
@@ -2468,13 +2495,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2468
2495
 
2469
2496
  this.processDependenciesQueue.invalidate(module);
2470
2497
  this.moduleGraph.unfreeze();
2471
- this.processModuleDependencies(module, err => {
2498
+ this.processModuleDependencies(module, (err) => {
2472
2499
  if (err) return callback(err);
2473
2500
  this.removeReasonsOfDependencyBlock(module, {
2474
2501
  dependencies: oldDependencies,
2475
2502
  blocks: oldBlocks
2476
2503
  });
2477
- this.hooks.finishRebuildingModule.callAsync(module, err2 => {
2504
+ this.hooks.finishRebuildingModule.callAsync(module, (err2) => {
2478
2505
  if (err2) {
2479
2506
  callback(
2480
2507
  makeWebpackError(err2, "Compilation.hooks.finishRebuildingModule")
@@ -2511,7 +2538,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2511
2538
  * @param {Module} module module
2512
2539
  * @returns {WeakReferences | undefined} references
2513
2540
  */
2514
- const computeReferences = module => {
2541
+ const computeReferences = (module) => {
2515
2542
  /** @type {WeakReferences | undefined} */
2516
2543
  let references;
2517
2544
  for (const connection of moduleGraph.getOutgoingConnections(module)) {
@@ -2604,7 +2631,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2604
2631
  * @param {readonly ModuleGraphConnection[]} connections connections
2605
2632
  * @returns {symbol|boolean} result
2606
2633
  */
2607
- const reduceAffectType = connections => {
2634
+ const reduceAffectType = (connections) => {
2608
2635
  let affected = false;
2609
2636
  for (const { dependency } of connections) {
2610
2637
  if (!dependency) continue;
@@ -2684,7 +2711,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2684
2711
  * @param {Module} module module
2685
2712
  * @returns {References} references
2686
2713
  */
2687
- const computeReferences = module => {
2714
+ const computeReferences = (module) => {
2688
2715
  const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module));
2689
2716
  /** @type {Map<Module, string | number | undefined> | undefined} */
2690
2717
  let modules;
@@ -2804,27 +2831,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2804
2831
  p.range(
2805
2832
  profile.buildingStartTime,
2806
2833
  profile.buildingEndTime,
2807
- f => (profile.buildingParallelismFactor = f)
2834
+ (f) => (profile.buildingParallelismFactor = f)
2808
2835
  );
2809
2836
  p.range(
2810
2837
  profile.factoryStartTime,
2811
2838
  profile.factoryEndTime,
2812
- f => (profile.factoryParallelismFactor = f)
2839
+ (f) => (profile.factoryParallelismFactor = f)
2813
2840
  );
2814
2841
  p.range(
2815
2842
  profile.integrationStartTime,
2816
2843
  profile.integrationEndTime,
2817
- f => (profile.integrationParallelismFactor = f)
2844
+ (f) => (profile.integrationParallelismFactor = f)
2818
2845
  );
2819
2846
  p.range(
2820
2847
  profile.storingStartTime,
2821
2848
  profile.storingEndTime,
2822
- f => (profile.storingParallelismFactor = f)
2849
+ (f) => (profile.storingParallelismFactor = f)
2823
2850
  );
2824
2851
  p.range(
2825
2852
  profile.restoringStartTime,
2826
2853
  profile.restoringEndTime,
2827
- f => (profile.restoringParallelismFactor = f)
2854
+ (f) => (profile.restoringParallelismFactor = f)
2828
2855
  );
2829
2856
  if (profile.additionalFactoryTimes) {
2830
2857
  for (const { start, end } of profile.additionalFactoryTimes) {
@@ -2832,7 +2859,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2832
2859
  p.range(
2833
2860
  start,
2834
2861
  end,
2835
- f =>
2862
+ (f) =>
2836
2863
  (profile.additionalFactoriesParallelismFactor += f * influence)
2837
2864
  );
2838
2865
  }
@@ -2955,33 +2982,33 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2955
2982
  };
2956
2983
  logNormalSummary(
2957
2984
  "resolve to new modules",
2958
- p => p.factory,
2959
- p => p.factoryParallelismFactor
2985
+ (p) => p.factory,
2986
+ (p) => p.factoryParallelismFactor
2960
2987
  );
2961
2988
  logNormalSummary(
2962
2989
  "resolve to existing modules",
2963
- p => p.additionalFactories,
2964
- p => p.additionalFactoriesParallelismFactor
2990
+ (p) => p.additionalFactories,
2991
+ (p) => p.additionalFactoriesParallelismFactor
2965
2992
  );
2966
2993
  logNormalSummary(
2967
2994
  "integrate modules",
2968
- p => p.restoring,
2969
- p => p.restoringParallelismFactor
2995
+ (p) => p.restoring,
2996
+ (p) => p.restoringParallelismFactor
2970
2997
  );
2971
2998
  logByLoadersSummary(
2972
2999
  "build modules",
2973
- p => p.building,
2974
- p => p.buildingParallelismFactor
3000
+ (p) => p.building,
3001
+ (p) => p.buildingParallelismFactor
2975
3002
  );
2976
3003
  logNormalSummary(
2977
3004
  "store modules",
2978
- p => p.storing,
2979
- p => p.storingParallelismFactor
3005
+ (p) => p.storing,
3006
+ (p) => p.storingParallelismFactor
2980
3007
  );
2981
3008
  logNormalSummary(
2982
3009
  "restore modules",
2983
- p => p.restoring,
2984
- p => p.restoringParallelismFactor
3010
+ (p) => p.restoring,
3011
+ (p) => p.restoringParallelismFactor
2985
3012
  );
2986
3013
  this.logger.timeEnd("finish module profiles");
2987
3014
  }
@@ -2990,7 +3017,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2990
3017
  this.logger.timeEnd("compute affected modules");
2991
3018
  this.logger.time("finish modules");
2992
3019
  const { modules, moduleMemCaches } = this;
2993
- this.hooks.finishModules.callAsync(modules, err => {
3020
+ this.hooks.finishModules.callAsync(modules, (err) => {
2994
3021
  this.logger.timeEnd("finish modules");
2995
3022
  if (err) return callback(/** @type {WebpackError} */ (err));
2996
3023
 
@@ -3061,7 +3088,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3061
3088
  * @param {WebpackError=} err err
3062
3089
  * @returns {void}
3063
3090
  */
3064
- const finalCallback = err => {
3091
+ const finalCallback = (err) => {
3065
3092
  this.factorizeQueue.clear();
3066
3093
  this.buildQueue.clear();
3067
3094
  this.rebuildQueue.clear();
@@ -3139,11 +3166,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3139
3166
  * @param {Dependency[]} deps deps
3140
3167
  * @returns {Module[]} sorted deps
3141
3168
  */
3142
- const mapAndSort = deps =>
3169
+ const mapAndSort = (deps) =>
3143
3170
  /** @type {Module[]} */
3144
- (deps.map(dep => this.moduleGraph.getModule(dep)).filter(Boolean)).sort(
3145
- compareModulesByIdentifier
3146
- );
3171
+ (
3172
+ deps.map((dep) => this.moduleGraph.getModule(dep)).filter(Boolean)
3173
+ ).sort(compareModulesByIdentifier);
3147
3174
  const includedModules = [
3148
3175
  ...mapAndSort(this.globalEntry.includeDependencies),
3149
3176
  ...mapAndSort(includeDependencies)
@@ -3233,6 +3260,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3233
3260
  entry.setRuntimeChunk(chunk);
3234
3261
  }
3235
3262
  }
3263
+
3236
3264
  buildChunkGraph(this, chunkGraphInit);
3237
3265
  this.hooks.afterChunks.call(this.chunks);
3238
3266
  this.logger.timeEnd("create chunks");
@@ -3250,7 +3278,27 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3250
3278
  }
3251
3279
  this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups);
3252
3280
 
3253
- this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => {
3281
+ for (const [
3282
+ name,
3283
+ {
3284
+ options: { dependOn }
3285
+ }
3286
+ ] of this.entries) {
3287
+ if (dependOn) {
3288
+ const entry = /** @type {Entrypoint} */ (this.entrypoints.get(name));
3289
+ for (const dep of dependOn) {
3290
+ const depEntry = /** @type {Entrypoint} */ (
3291
+ this.entrypoints.get(dep)
3292
+ );
3293
+ const runtimeChunk = depEntry.getRuntimeChunk();
3294
+ if (runtimeChunk) {
3295
+ runtimeChunk.addGroup(entry);
3296
+ }
3297
+ }
3298
+ }
3299
+ }
3300
+
3301
+ this.hooks.optimizeTree.callAsync(this.chunks, this.modules, (err) => {
3254
3302
  if (err) {
3255
3303
  return finalCallback(
3256
3304
  makeWebpackError(err, "Compilation.hooks.optimizeTree")
@@ -3262,7 +3310,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3262
3310
  this.hooks.optimizeChunkModules.callAsync(
3263
3311
  this.chunks,
3264
3312
  this.modules,
3265
- err => {
3313
+ (err) => {
3266
3314
  if (err) {
3267
3315
  return finalCallback(
3268
3316
  makeWebpackError(err, "Compilation.hooks.optimizeChunkModules")
@@ -3325,7 +3373,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3325
3373
 
3326
3374
  this.logger.time("code generation");
3327
3375
  this.hooks.beforeCodeGeneration.call();
3328
- this.codeGeneration(err => {
3376
+ this.codeGeneration((err) => {
3329
3377
  if (err) {
3330
3378
  return finalCallback(err);
3331
3379
  }
@@ -3344,7 +3392,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3344
3392
  this.hooks.afterHash.call();
3345
3393
  this.logger.timeEnd("hashing");
3346
3394
 
3347
- this._runCodeGenerationJobs(codeGenerationJobs, err => {
3395
+ this._runCodeGenerationJobs(codeGenerationJobs, (err) => {
3348
3396
  if (err) {
3349
3397
  return finalCallback(err);
3350
3398
  }
@@ -3367,7 +3415,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3367
3415
 
3368
3416
  const cont = () => {
3369
3417
  this.logger.time("process assets");
3370
- this.hooks.processAssets.callAsync(this.assets, err => {
3418
+ this.hooks.processAssets.callAsync(this.assets, (err) => {
3371
3419
  if (err) {
3372
3420
  return finalCallback(
3373
3421
  makeWebpackError(err, "Compilation.hooks.processAssets")
@@ -3403,7 +3451,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3403
3451
  this.unseal();
3404
3452
  return this.seal(callback);
3405
3453
  }
3406
- return this.hooks.afterSeal.callAsync(err => {
3454
+ return this.hooks.afterSeal.callAsync((err) => {
3407
3455
  if (err) {
3408
3456
  return finalCallback(
3409
3457
  makeWebpackError(err, "Compilation.hooks.afterSeal")
@@ -3418,7 +3466,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3418
3466
  this.logger.time("create chunk assets");
3419
3467
  if (this.hooks.shouldGenerateChunkAssets.call() !== false) {
3420
3468
  this.hooks.beforeChunkAssets.call();
3421
- this.createChunkAssets(err => {
3469
+ this.createChunkAssets((err) => {
3422
3470
  this.logger.timeEnd("create chunk assets");
3423
3471
  if (err) {
3424
3472
  return finalCallback(err);
@@ -3542,7 +3590,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3542
3590
  if (
3543
3591
  codeGenerationDependencies !== undefined &&
3544
3592
  (notCodeGeneratedModules === undefined ||
3545
- codeGenerationDependencies.some(dep => {
3593
+ codeGenerationDependencies.some((dep) => {
3546
3594
  const referencedModule = /** @type {Module} */ (
3547
3595
  moduleGraph.getModule(dep)
3548
3596
  );
@@ -3574,7 +3622,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3574
3622
  }
3575
3623
  );
3576
3624
  },
3577
- err => {
3625
+ (err) => {
3578
3626
  if (err) return callback(err);
3579
3627
  if (delayedJobs.length > 0) {
3580
3628
  if (delayedJobs.length === jobs.length) {
@@ -3583,7 +3631,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3583
3631
  new Error(
3584
3632
  `Unable to make progress during code generation because of circular code generation dependency: ${Array.from(
3585
3633
  delayedModules,
3586
- m => m.identifier()
3634
+ (m) => m.identifier()
3587
3635
  ).join(", ")}`
3588
3636
  )
3589
3637
  )
@@ -3597,7 +3645,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3597
3645
  }
3598
3646
  if (errors.length > 0) {
3599
3647
  errors.sort(
3600
- compareSelect(err => err.module, compareModulesByIdentifier)
3648
+ compareSelect((err) => err.module, compareModulesByIdentifier)
3601
3649
  );
3602
3650
  for (const error of errors) {
3603
3651
  this.errors.push(error);
@@ -3644,7 +3692,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3644
3692
  ) {
3645
3693
  let codeGenerated = false;
3646
3694
  const cache = new MultiItemCache(
3647
- runtimes.map(runtime =>
3695
+ runtimes.map((runtime) =>
3648
3696
  this._codeGenerationCache.getItemCache(
3649
3697
  `${module.identifier()}|${getRuntimeKey(runtime)}`,
3650
3698
  `${hash}|${dependencyTemplates.getHash()}`
@@ -3683,7 +3731,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3683
3731
  results.add(module, runtime, result);
3684
3732
  }
3685
3733
  if (!cachedResult) {
3686
- cache.store(result, err =>
3734
+ cache.store(result, (err) =>
3687
3735
  callback(/** @type {WebpackError} */ (err), codeGenerated)
3688
3736
  );
3689
3737
  } else {
@@ -4031,7 +4079,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4031
4079
  * @param {Module} module module for processing
4032
4080
  * @returns {void}
4033
4081
  */
4034
- const processModule = module => {
4082
+ const processModule = (module) => {
4035
4083
  if (!moduleGraph.setDepthIfLower(module, depth)) return;
4036
4084
  queue.add(module);
4037
4085
  };
@@ -4157,7 +4205,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4157
4205
  /**
4158
4206
  * @param {Dependency} d dependency to (maybe) patch up
4159
4207
  */
4160
- const iteratorDependency = d => {
4208
+ const iteratorDependency = (d) => {
4161
4209
  const depModule = this.moduleGraph.getModule(d);
4162
4210
  if (!depModule) {
4163
4211
  return;
@@ -4190,7 +4238,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4190
4238
  /**
4191
4239
  * @param {Entrypoint} ep an entrypoint
4192
4240
  */
4193
- const processEntrypoint = ep => {
4241
+ const processEntrypoint = (ep) => {
4194
4242
  const runtime = /** @type {string} */ (ep.options.runtime || ep.name);
4195
4243
  const chunk = /** @type {Chunk} */ (ep.getRuntimeChunk());
4196
4244
  chunkGraph.setRuntimeId(runtime, /** @type {ChunkId} */ (chunk.id));
@@ -4273,7 +4321,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4273
4321
  }
4274
4322
  }
4275
4323
  if (errors.length > 0) {
4276
- errors.sort(compareSelect(err => err.module, compareModulesByIdentifier));
4324
+ errors.sort(
4325
+ compareSelect((err) => err.module, compareModulesByIdentifier)
4326
+ );
4277
4327
  for (const error of errors) {
4278
4328
  this.errors.push(error);
4279
4329
  }
@@ -4410,7 +4460,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4410
4460
  for (const info of runtimeChunksMap.values()) {
4411
4461
  for (const other of new Set(
4412
4462
  [...info.chunk.getAllReferencedAsyncEntrypoints()].map(
4413
- e => e.chunks[e.chunks.length - 1]
4463
+ (e) => e.chunks[e.chunks.length - 1]
4414
4464
  )
4415
4465
  )) {
4416
4466
  const otherInfo =
@@ -4463,11 +4513,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4463
4513
  circularRuntimeChunkInfo.push(info);
4464
4514
  }
4465
4515
  }
4466
- circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId));
4516
+ circularRuntimeChunkInfo.sort(compareSelect((i) => i.chunk, byId));
4467
4517
  const err =
4468
4518
  new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
4469
4519
  circularRuntimeChunkInfo,
4470
- c => c.chunk.name || c.chunk.id
4520
+ (c) => c.chunk.name || c.chunk.id
4471
4521
  ).join(", ")})
4472
4522
  This prevents using hashes of each other and should be avoided.`);
4473
4523
  err.chunk = circularRuntimeChunkInfo[0].chunk;
@@ -4487,7 +4537,7 @@ This prevents using hashes of each other and should be avoided.`);
4487
4537
  /**
4488
4538
  * @param {Chunk} chunk chunk
4489
4539
  */
4490
- const processChunk = chunk => {
4540
+ const processChunk = (chunk) => {
4491
4541
  // Last minute module hash generation for modules that depend on chunk hashes
4492
4542
  this.logger.time("hashing: hash runtime modules");
4493
4543
  const runtime = chunk.runtime;
@@ -4564,7 +4614,9 @@ This prevents using hashes of each other and should be avoided.`);
4564
4614
  for (const chunk of runtimeChunks) processChunk(chunk);
4565
4615
  for (const chunk of initialChunks) processChunk(chunk);
4566
4616
  if (errors.length > 0) {
4567
- errors.sort(compareSelect(err => err.module, compareModulesByIdentifier));
4617
+ errors.sort(
4618
+ compareSelect((err) => err.module, compareModulesByIdentifier)
4619
+ );
4568
4620
  for (const error of errors) {
4569
4621
  this.errors.push(error);
4570
4622
  }
@@ -4671,7 +4723,7 @@ This prevents using hashes of each other and should be avoided.`);
4671
4723
  /**
4672
4724
  * @param {string} name name
4673
4725
  */
4674
- const remove = name => {
4726
+ const remove = (name) => {
4675
4727
  const relatedIn = this._assetsRelatedIn.get(name);
4676
4728
  if (relatedIn === undefined) return;
4677
4729
  const entry = relatedIn.get(key);
@@ -4696,7 +4748,7 @@ This prevents using hashes of each other and should be avoided.`);
4696
4748
  /**
4697
4749
  * @param {string} name name
4698
4750
  */
4699
- const add = name => {
4751
+ const add = (name) => {
4700
4752
  let relatedIn = this._assetsRelatedIn.get(name);
4701
4753
  if (relatedIn === undefined) {
4702
4754
  this._assetsRelatedIn.set(name, (relatedIn = new Map()));
@@ -4783,7 +4835,7 @@ This prevents using hashes of each other and should be avoided.`);
4783
4835
  const entry = related[key];
4784
4836
  let newEntry;
4785
4837
  if (Array.isArray(entry)) {
4786
- newEntry = entry.map(x => (x === file ? newFile : x));
4838
+ newEntry = entry.map((x) => (x === file ? newFile : x));
4787
4839
  } else if (entry === file) {
4788
4840
  newEntry = newFile;
4789
4841
  } else {
@@ -4837,7 +4889,7 @@ This prevents using hashes of each other and should be avoided.`);
4837
4889
  /**
4838
4890
  * @param {string} file file
4839
4891
  */
4840
- const checkUsedAndDelete = file => {
4892
+ const checkUsedAndDelete = (file) => {
4841
4893
  if (!this._assetsRelatedIn.has(file)) {
4842
4894
  this.deleteAsset(file);
4843
4895
  }
@@ -4987,7 +5039,7 @@ This prevents using hashes of each other and should be avoided.`);
4987
5039
  * @param {Error} err error
4988
5040
  * @returns {void}
4989
5041
  */
4990
- const errorAndCallback = err => {
5042
+ const errorAndCallback = (err) => {
4991
5043
  const filename =
4992
5044
  file ||
4993
5045
  (typeof file === "string"
@@ -5068,7 +5120,7 @@ This prevents using hashes of each other and should be avoided.`);
5068
5120
  chunk
5069
5121
  });
5070
5122
  if (source !== sourceFromCache) {
5071
- assetCacheItem.store(source, err => {
5123
+ assetCacheItem.store(source, (err) => {
5072
5124
  if (err) return errorAndCallback(err);
5073
5125
  inTry = false;
5074
5126
  return callback();
@@ -5190,9 +5242,9 @@ This prevents using hashes of each other and should be avoided.`);
5190
5242
  modules,
5191
5243
  10,
5192
5244
  (module, push, callback) => {
5193
- this.buildQueue.waitFor(module, err => {
5245
+ this.buildQueue.waitFor(module, (err) => {
5194
5246
  if (err) return callback(err);
5195
- this.processDependenciesQueue.waitFor(module, err => {
5247
+ this.processDependenciesQueue.waitFor(module, (err) => {
5196
5248
  if (err) return callback(err);
5197
5249
  for (const { module: m } of this.moduleGraph.getOutgoingConnections(
5198
5250
  module
@@ -5205,7 +5257,7 @@ This prevents using hashes of each other and should be avoided.`);
5205
5257
  });
5206
5258
  });
5207
5259
  },
5208
- err => {
5260
+ (err) => {
5209
5261
  if (err) return callback(/** @type {WebpackError} */ (err));
5210
5262
 
5211
5263
  // Create new chunk graph, chunk and entrypoint for the build time execution
@@ -5288,7 +5340,7 @@ This prevents using hashes of each other and should be avoided.`);
5288
5340
  const reportErrors = () => {
5289
5341
  if (errors.length > 0) {
5290
5342
  errors.sort(
5291
- compareSelect(err => err.module, compareModulesByIdentifier)
5343
+ compareSelect((err) => err.module, compareModulesByIdentifier)
5292
5344
  );
5293
5345
  for (const error of errors) {
5294
5346
  this.errors.push(error);
@@ -5298,7 +5350,7 @@ This prevents using hashes of each other and should be avoided.`);
5298
5350
  };
5299
5351
 
5300
5352
  // Generate code for all aggregated modules
5301
- asyncLib.eachLimit(modules, 10, codeGen, err => {
5353
+ asyncLib.eachLimit(modules, 10, codeGen, (err) => {
5302
5354
  if (err) return callback(err);
5303
5355
  reportErrors();
5304
5356
 
@@ -5334,7 +5386,7 @@ This prevents using hashes of each other and should be avoided.`);
5334
5386
  }
5335
5387
 
5336
5388
  // Generate code for all runtime modules
5337
- asyncLib.eachLimit(runtimeModules, 10, codeGen, err => {
5389
+ asyncLib.eachLimit(runtimeModules, 10, codeGen, (err) => {
5338
5390
  if (err) return callback(err);
5339
5391
  reportErrors();
5340
5392
 
@@ -5410,7 +5462,7 @@ This prevents using hashes of each other and should be avoided.`);
5410
5462
  callback
5411
5463
  );
5412
5464
  },
5413
- err => {
5465
+ (err) => {
5414
5466
  if (err) return callback(err);
5415
5467
 
5416
5468
  /** @type {ExecuteModuleExports | undefined} */
@@ -5422,7 +5474,7 @@ This prevents using hashes of each other and should be avoided.`);
5422
5474
  } = this.outputOptions;
5423
5475
 
5424
5476
  /** @type {WebpackRequire} */
5425
- const __webpack_require__ = id => {
5477
+ const __webpack_require__ = (id) => {
5426
5478
  const cached = moduleCache[id];
5427
5479
  if (cached !== undefined) {
5428
5480
  if (cached.error) throw cached.error;
@@ -5656,7 +5708,7 @@ Object.defineProperty(compilationPrototype, "cache", {
5656
5708
  /**
5657
5709
  * @param {EXPECTED_ANY} _v value
5658
5710
  */
5659
- _v => {},
5711
+ (_v) => {},
5660
5712
  "Compilation.cache was removed in favor of Compilation.getCache()",
5661
5713
  "DEP_WEBPACK_COMPILATION_CACHE"
5662
5714
  )