@depup/webpack 5.106.1-depup.0 → 5.109.2-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (669) hide show
  1. package/README.md +9 -11
  2. package/bin/webpack.js +12 -0
  3. package/changes.json +16 -24
  4. package/hot/dev-server.js +2 -0
  5. package/lib/APIPlugin.js +60 -35
  6. package/lib/AsyncDependenciesBlock.js +3 -0
  7. package/lib/AutomaticPrefetchPlugin.js +6 -1
  8. package/lib/BannerPlugin.js +13 -5
  9. package/lib/Cache.js +27 -5
  10. package/lib/CacheFacade.js +41 -0
  11. package/lib/Chunk.js +71 -25
  12. package/lib/ChunkGraph.js +153 -19
  13. package/lib/ChunkGroup.js +115 -28
  14. package/lib/ChunkTemplate.js +9 -0
  15. package/lib/CircularModulesPlugin.js +190 -0
  16. package/lib/CleanPlugin.js +27 -28
  17. package/lib/CodeGenerationResults.js +19 -0
  18. package/lib/CompatibilityPlugin.js +85 -37
  19. package/lib/Compilation.js +656 -112
  20. package/lib/Compiler.js +109 -35
  21. package/lib/ConcatenationScope.js +34 -4
  22. package/lib/ConditionalInitFragment.js +6 -0
  23. package/lib/ConstPlugin.js +15 -12
  24. package/lib/ContextExclusionPlugin.js +3 -1
  25. package/lib/ContextModule.js +345 -55
  26. package/lib/ContextModuleFactory.js +193 -51
  27. package/lib/ContextReplacementPlugin.js +8 -1
  28. package/lib/DefinePlugin.js +537 -139
  29. package/lib/DependenciesBlock.js +6 -1
  30. package/lib/Dependency.js +159 -11
  31. package/lib/DependencyTemplate.js +7 -1
  32. package/lib/DependencyTemplates.js +4 -0
  33. package/lib/DotenvPlugin.js +3 -0
  34. package/lib/DynamicEntryPlugin.js +3 -1
  35. package/lib/EntryOptionPlugin.js +42 -2
  36. package/lib/EntryPlugin.js +4 -1
  37. package/lib/Entrypoint.js +5 -1
  38. package/lib/EnvironmentPlugin.js +3 -2
  39. package/lib/ErrorHelpers.js +7 -0
  40. package/lib/EvalDevToolModulePlugin.js +3 -1
  41. package/lib/EvalSourceMapDevToolPlugin.js +11 -11
  42. package/lib/ExportsInfo.js +421 -113
  43. package/lib/ExportsInfoApiPlugin.js +4 -3
  44. package/lib/ExternalModule.js +381 -80
  45. package/lib/ExternalModuleFactoryPlugin.js +75 -3
  46. package/lib/ExternalsPlugin.js +3 -1
  47. package/lib/FileSystemInfo.js +701 -175
  48. package/lib/FlagAllModulesAsUsedPlugin.js +3 -6
  49. package/lib/FlagDependencyExportsPlugin.js +82 -9
  50. package/lib/FlagDependencyUsagePlugin.js +115 -8
  51. package/lib/FlagEntryExportAsUsedPlugin.js +4 -1
  52. package/lib/Generator.js +24 -3
  53. package/lib/HotModuleReplacementPlugin.js +110 -44
  54. package/lib/IgnorePlugin.js +5 -2
  55. package/lib/IgnoreWarningsPlugin.js +2 -1
  56. package/lib/InitFragment.js +33 -30
  57. package/lib/JavascriptMetaInfoPlugin.js +9 -6
  58. package/lib/LazyBarrel.js +389 -0
  59. package/lib/LibraryTemplatePlugin.js +2 -1
  60. package/lib/LoaderOptionsPlugin.js +3 -1
  61. package/lib/LoaderTargetPlugin.js +3 -1
  62. package/lib/MainTemplate.js +15 -0
  63. package/lib/ManifestPlugin.js +9 -2
  64. package/lib/Module.js +121 -57
  65. package/lib/ModuleFactory.js +6 -1
  66. package/lib/ModuleFilenameHelpers.js +18 -4
  67. package/lib/ModuleGraph.js +69 -2
  68. package/lib/ModuleGraphConnection.js +9 -0
  69. package/lib/ModuleInfoHeaderPlugin.js +5 -0
  70. package/lib/ModuleNotFoundError.js +3 -83
  71. package/lib/ModuleProfile.js +27 -1
  72. package/lib/ModuleSourceTypeConstants.js +52 -19
  73. package/lib/ModuleTemplate.js +10 -0
  74. package/lib/ModuleTypeConstants.js +20 -4
  75. package/lib/MultiCompiler.js +59 -4
  76. package/lib/MultiStats.js +9 -0
  77. package/lib/MultiWatching.js +6 -0
  78. package/lib/NoEmitOnErrorsPlugin.js +1 -1
  79. package/lib/NodeStuffPlugin.js +78 -46
  80. package/lib/NormalModule.js +519 -206
  81. package/lib/NormalModuleFactory.js +156 -31
  82. package/lib/NormalModuleReplacementPlugin.js +3 -1
  83. package/lib/NullFactory.js +1 -0
  84. package/lib/OptionsApply.js +1 -0
  85. package/lib/Parser.js +3 -1
  86. package/lib/PlatformPlugin.js +2 -1
  87. package/lib/PrefetchPlugin.js +4 -1
  88. package/lib/ProgressPlugin.js +351 -161
  89. package/lib/ProvidePlugin.js +6 -3
  90. package/lib/RawModule.js +32 -16
  91. package/lib/RecordIdsPlugin.js +9 -0
  92. package/lib/RequestShortener.js +8 -0
  93. package/lib/ResolverFactory.js +5 -0
  94. package/lib/RuntimeGlobals.js +58 -5
  95. package/lib/RuntimeModule.js +22 -7
  96. package/lib/RuntimePlugin.js +123 -118
  97. package/lib/RuntimeTemplate.js +616 -37
  98. package/lib/SelfModuleFactory.js +3 -0
  99. package/lib/SourceMapDevToolModuleOptionsPlugin.js +2 -0
  100. package/lib/SourceMapDevToolPlugin.js +341 -63
  101. package/lib/Stats.js +6 -0
  102. package/lib/Template.js +52 -6
  103. package/lib/TemplatedPathPlugin.js +505 -138
  104. package/lib/UseStrictPlugin.js +3 -2
  105. package/lib/WarnCaseSensitiveModulesPlugin.js +72 -3
  106. package/lib/WarnDeprecatedOptionPlugin.js +6 -2
  107. package/lib/WarnNoModeSetPlugin.js +18 -2
  108. package/lib/WatchIgnorePlugin.js +5 -1
  109. package/lib/Watching.js +25 -3
  110. package/lib/WebpackError.js +3 -74
  111. package/lib/WebpackIsIncludedPlugin.js +4 -2
  112. package/lib/WebpackOptionsApply.js +88 -25
  113. package/lib/WebpackOptionsDefaulter.js +1 -0
  114. package/lib/asset/AssetBytesGenerator.js +28 -10
  115. package/lib/asset/AssetBytesParser.js +1 -0
  116. package/lib/asset/AssetGenerator.js +199 -60
  117. package/lib/asset/AssetModule.js +47 -0
  118. package/lib/asset/AssetModulesPlugin.js +115 -24
  119. package/lib/asset/AssetParser.js +4 -2
  120. package/lib/asset/AssetSourceGenerator.js +26 -8
  121. package/lib/asset/AssetSourceParser.js +1 -0
  122. package/lib/asset/RawDataUrlModule.js +23 -13
  123. package/lib/asset/WebManifestGenerator.js +164 -0
  124. package/lib/asset/WebManifestParser.js +130 -0
  125. package/lib/async-modules/AsyncModuleHelpers.js +1 -0
  126. package/lib/async-modules/AwaitDependenciesInitFragment.js +18 -4
  127. package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
  128. package/lib/async-modules/isGeneratorLowered.js +26 -0
  129. package/lib/buildChunkGraph.js +107 -15
  130. package/lib/bun/BunTargetPlugin.js +42 -0
  131. package/lib/cache/AddBuildDependenciesPlugin.js +3 -1
  132. package/lib/cache/AddManagedPathsPlugin.js +5 -1
  133. package/lib/cache/IdleFileCachePlugin.js +6 -1
  134. package/lib/cache/MemoryCachePlugin.js +1 -1
  135. package/lib/cache/MemoryWithGcCachePlugin.js +4 -1
  136. package/lib/cache/PackFileCacheStrategy.js +302 -12
  137. package/lib/cache/ResolverCachePlugin.js +12 -1
  138. package/lib/cache/getLazyHashedEtag.js +13 -2
  139. package/lib/cache/mergeEtags.js +4 -0
  140. package/lib/cli.js +142 -20
  141. package/lib/config/browserslistTargetHandler.js +141 -0
  142. package/lib/config/defaults.js +612 -43
  143. package/lib/config/defineConfig.js +31 -0
  144. package/lib/config/normalization.js +46 -1
  145. package/lib/config/target.js +200 -2
  146. package/lib/container/ContainerEntryDependency.js +2 -0
  147. package/lib/container/ContainerEntryModule.js +27 -14
  148. package/lib/container/ContainerEntryModuleFactory.js +1 -0
  149. package/lib/container/ContainerExposedDependency.js +6 -2
  150. package/lib/container/ContainerPlugin.js +2 -1
  151. package/lib/container/ContainerReferencePlugin.js +3 -2
  152. package/lib/container/FallbackDependency.js +9 -7
  153. package/lib/container/FallbackItemDependency.js +1 -0
  154. package/lib/container/FallbackModule.js +22 -9
  155. package/lib/container/FallbackModuleFactory.js +1 -0
  156. package/lib/container/HoistContainerReferencesPlugin.js +47 -55
  157. package/lib/container/ModuleFederationPlugin.js +21 -29
  158. package/lib/container/RemoteModule.js +33 -10
  159. package/lib/container/RemoteRuntimeModule.js +15 -12
  160. package/lib/container/RemoteToExternalDependency.js +1 -0
  161. package/lib/container/options.js +7 -0
  162. package/lib/css/CssGenerator.js +540 -272
  163. package/lib/css/CssInjectStyleRuntimeModule.js +86 -70
  164. package/lib/css/CssLoadingRuntimeModule.js +173 -81
  165. package/lib/{CssModule.js → css/CssModule.js} +72 -37
  166. package/lib/css/CssModulesPlugin.js +371 -208
  167. package/lib/css/CssParser.js +3538 -1963
  168. package/lib/css/syntax.js +4155 -0
  169. package/lib/debug/ProfilingPlugin.js +33 -2
  170. package/lib/deno/DenoTargetPlugin.js +41 -0
  171. package/lib/dependencies/AMDDefineDependency.js +29 -17
  172. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +19 -6
  173. package/lib/dependencies/AMDPlugin.js +6 -3
  174. package/lib/dependencies/AMDRequireArrayDependency.js +13 -11
  175. package/lib/dependencies/AMDRequireContextDependency.js +10 -11
  176. package/lib/dependencies/AMDRequireDependenciesBlock.js +1 -0
  177. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +28 -14
  178. package/lib/dependencies/AMDRequireDependency.js +28 -20
  179. package/lib/dependencies/AMDRequireItemDependency.js +1 -0
  180. package/lib/dependencies/AMDRuntimeModules.js +3 -0
  181. package/lib/dependencies/CachedConstDependency.js +9 -1
  182. package/lib/dependencies/CommonJsDependencyHelpers.js +104 -0
  183. package/lib/dependencies/CommonJsExportRequireDependency.js +157 -38
  184. package/lib/dependencies/CommonJsExportsDependency.js +74 -20
  185. package/lib/dependencies/CommonJsExportsParserPlugin.js +246 -15
  186. package/lib/dependencies/CommonJsFullRequireDependency.js +91 -27
  187. package/lib/dependencies/CommonJsImportsParserPlugin.js +189 -24
  188. package/lib/dependencies/CommonJsPlugin.js +7 -4
  189. package/lib/dependencies/CommonJsRequireContextDependency.js +13 -13
  190. package/lib/dependencies/CommonJsRequireDependency.js +135 -13
  191. package/lib/dependencies/CommonJsSelfReferenceDependency.js +60 -16
  192. package/lib/dependencies/ConstDependency.js +22 -12
  193. package/lib/dependencies/ContextDependency.js +13 -2
  194. package/lib/dependencies/ContextDependencyHelpers.js +7 -4
  195. package/lib/dependencies/ContextDependencyTemplateAsId.js +2 -1
  196. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
  197. package/lib/dependencies/ContextElementDependency.js +27 -14
  198. package/lib/dependencies/CreateRequireParserPlugin.js +14 -7
  199. package/lib/dependencies/CreateScriptUrlDependency.js +9 -7
  200. package/lib/dependencies/CriticalDependencyWarning.js +3 -1
  201. package/lib/dependencies/CssIcssExportDependency.js +681 -367
  202. package/lib/dependencies/CssIcssImportDependency.js +62 -17
  203. package/lib/dependencies/CssIcssSymbolDependency.js +36 -17
  204. package/lib/dependencies/CssImportDependency.js +37 -1
  205. package/lib/dependencies/CssUrlDependency.js +87 -14
  206. package/lib/dependencies/DelegatedSourceDependency.js +1 -0
  207. package/lib/dependencies/DllEntryDependency.js +12 -13
  208. package/lib/dependencies/DynamicExports.js +5 -0
  209. package/lib/dependencies/EntryDependency.js +1 -0
  210. package/lib/dependencies/ExportBindingInitFragment.js +164 -0
  211. package/lib/dependencies/ExportsInfoDependency.js +18 -12
  212. package/lib/dependencies/ExternalModuleDependency.js +13 -5
  213. package/lib/dependencies/ExternalModuleInitFragment.js +10 -5
  214. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +19 -12
  215. package/lib/dependencies/HarmonyAcceptDependency.js +24 -26
  216. package/lib/dependencies/HarmonyAcceptImportDependency.js +2 -0
  217. package/lib/dependencies/HarmonyCompatibilityDependency.js +33 -14
  218. package/lib/dependencies/HarmonyDetectionParserPlugin.js +108 -30
  219. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +34 -3
  220. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +70 -33
  221. package/lib/dependencies/HarmonyExportExpressionDependency.js +133 -43
  222. package/lib/dependencies/HarmonyExportHeaderDependency.js +11 -9
  223. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +268 -44
  224. package/lib/dependencies/HarmonyExportInitFragment.js +28 -20
  225. package/lib/dependencies/HarmonyExportSpecifierDependency.js +88 -18
  226. package/lib/dependencies/HarmonyExports.js +6 -1
  227. package/lib/dependencies/HarmonyImportDependency.js +60 -4
  228. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +139 -146
  229. package/lib/dependencies/HarmonyImportGuard.js +427 -0
  230. package/lib/dependencies/HarmonyImportSideEffectDependency.js +22 -1
  231. package/lib/dependencies/HarmonyImportSpecifierDependency.js +146 -24
  232. package/lib/{HarmonyLinkingError.js → dependencies/HarmonyLinkingError.js} +6 -3
  233. package/lib/dependencies/HarmonyModulesPlugin.js +11 -1
  234. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +2 -1
  235. package/lib/dependencies/HtmlEntryDependency.js +1295 -0
  236. package/lib/dependencies/HtmlInlineHtmlDependency.js +107 -0
  237. package/lib/dependencies/HtmlInlineScriptDependency.js +126 -0
  238. package/lib/dependencies/HtmlInlineStyleDependency.js +152 -0
  239. package/lib/dependencies/HtmlSourceDependency.js +172 -0
  240. package/lib/dependencies/ImportContextDependency.js +9 -9
  241. package/lib/dependencies/ImportDependency.js +92 -3
  242. package/lib/dependencies/ImportEagerDependency.js +2 -0
  243. package/lib/dependencies/ImportMetaContextDependency.js +1 -0
  244. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +35 -19
  245. package/lib/dependencies/ImportMetaContextPlugin.js +40 -8
  246. package/lib/dependencies/ImportMetaGlobDependency.js +81 -0
  247. package/lib/dependencies/ImportMetaGlobDependencyParserPlugin.js +78 -0
  248. package/lib/dependencies/ImportMetaGlobHelpers.js +660 -0
  249. package/lib/dependencies/ImportMetaHotAcceptDependency.js +2 -0
  250. package/lib/dependencies/ImportMetaHotDeclineDependency.js +2 -0
  251. package/lib/dependencies/ImportMetaPlugin.js +595 -209
  252. package/lib/dependencies/ImportMetaResolveDependency.js +90 -0
  253. package/lib/dependencies/ImportParserPlugin.js +114 -27
  254. package/lib/dependencies/ImportPhase.js +17 -11
  255. package/lib/dependencies/ImportPlugin.js +2 -1
  256. package/lib/dependencies/ImportWeakDependency.js +3 -0
  257. package/lib/dependencies/JsonExportsDependency.js +15 -10
  258. package/lib/dependencies/LoaderDependency.js +2 -0
  259. package/lib/dependencies/LoaderImportDependency.js +3 -0
  260. package/lib/dependencies/LoaderPlugin.js +9 -2
  261. package/lib/dependencies/LocalModule.js +15 -12
  262. package/lib/dependencies/LocalModuleDependency.js +15 -13
  263. package/lib/dependencies/LocalModulesHelpers.js +3 -0
  264. package/lib/dependencies/ModuleDecoratorDependency.js +16 -10
  265. package/lib/dependencies/ModuleDependency.js +14 -0
  266. package/lib/dependencies/ModuleDependencyTemplateAsId.js +1 -0
  267. package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
  268. package/lib/dependencies/ModuleHotAcceptDependency.js +2 -0
  269. package/lib/dependencies/ModuleHotDeclineDependency.js +2 -0
  270. package/lib/dependencies/ModuleInitFragmentDependency.js +19 -11
  271. package/lib/dependencies/NullDependency.js +2 -0
  272. package/lib/dependencies/PrefetchDependency.js +1 -0
  273. package/lib/dependencies/ProvidedDependency.js +36 -27
  274. package/lib/dependencies/PureExpressionDependency.js +14 -10
  275. package/lib/dependencies/RequireContextDependency.js +1 -0
  276. package/lib/dependencies/RequireContextDependencyParserPlugin.js +2 -1
  277. package/lib/dependencies/RequireContextPlugin.js +2 -1
  278. package/lib/dependencies/RequireEnsureDependenciesBlock.js +1 -0
  279. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +4 -6
  280. package/lib/dependencies/RequireEnsureDependency.js +16 -13
  281. package/lib/dependencies/RequireEnsureItemDependency.js +1 -0
  282. package/lib/dependencies/RequireEnsurePlugin.js +2 -1
  283. package/lib/dependencies/RequireHeaderDependency.js +7 -4
  284. package/lib/dependencies/RequireIncludeDependency.js +2 -0
  285. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +11 -12
  286. package/lib/dependencies/RequireIncludePlugin.js +2 -1
  287. package/lib/{RequireJsStuffPlugin.js → dependencies/RequireJsStuffPlugin.js} +9 -8
  288. package/lib/dependencies/RequireResolveContextDependency.js +10 -11
  289. package/lib/dependencies/RequireResolveDependency.js +2 -0
  290. package/lib/dependencies/RequireResolveHeaderDependency.js +8 -5
  291. package/lib/dependencies/RuntimeRequirementsDependency.js +11 -8
  292. package/lib/dependencies/StaticExportsDependency.js +13 -10
  293. package/lib/dependencies/SystemPlugin.js +9 -6
  294. package/lib/dependencies/SystemRuntimeModule.js +1 -0
  295. package/lib/dependencies/TopLevelAwaitDependency.js +93 -0
  296. package/lib/dependencies/URLContextDependency.js +8 -7
  297. package/lib/dependencies/URLDependency.js +157 -33
  298. package/lib/dependencies/URLPlugin.js +2 -0
  299. package/lib/dependencies/UnsupportedDependency.js +12 -13
  300. package/lib/dependencies/WebAssemblyExportImportedDependency.js +15 -16
  301. package/lib/dependencies/WebAssemblyImportDependency.js +19 -18
  302. package/lib/dependencies/WebpackIsIncludedDependency.js +3 -0
  303. package/lib/dependencies/{WorkerPlugin.js → WorkerAndWorkletPlugin.js} +364 -114
  304. package/lib/dependencies/WorkerDependency.js +111 -27
  305. package/lib/dependencies/WorkletDependency.js +278 -0
  306. package/lib/dependencies/getFunctionExpression.js +1 -0
  307. package/lib/dependencies/processExportInfo.js +14 -11
  308. package/lib/{DelegatedModule.js → dll/DelegatedModule.js} +71 -44
  309. package/lib/{DelegatedModuleFactoryPlugin.js → dll/DelegatedModuleFactoryPlugin.js} +27 -4
  310. package/lib/{DelegatedPlugin.js → dll/DelegatedPlugin.js} +5 -3
  311. package/lib/{DllEntryPlugin.js → dll/DllEntryPlugin.js} +9 -5
  312. package/lib/{DllModule.js → dll/DllModule.js} +36 -24
  313. package/lib/{DllModuleFactory.js → dll/DllModuleFactory.js} +5 -4
  314. package/lib/{DllPlugin.js → dll/DllPlugin.js} +24 -6
  315. package/lib/{DllReferencePlugin.js → dll/DllReferencePlugin.js} +26 -18
  316. package/lib/{LibManifestPlugin.js → dll/LibManifestPlugin.js} +14 -10
  317. package/lib/electron/ElectronTargetPlugin.js +24 -5
  318. package/lib/{AbstractMethodError.js → errors/AbstractMethodError.js} +10 -1
  319. package/lib/{AsyncDependencyToInitialChunkError.js → errors/AsyncDependencyToInitialChunkError.js} +8 -3
  320. package/lib/errors/BuildCycleError.js +1 -1
  321. package/lib/{ChunkRenderError.js → errors/ChunkRenderError.js} +1 -1
  322. package/lib/{CodeGenerationError.js → errors/CodeGenerationError.js} +1 -1
  323. package/lib/{CommentCompilationWarning.js → errors/CommentCompilationWarning.js} +9 -3
  324. package/lib/{ConcurrentCompilationError.js → errors/ConcurrentCompilationError.js} +5 -2
  325. package/lib/{EnvironmentNotSupportAsyncWarning.js → errors/EnvironmentNotSupportAsyncWarning.js} +5 -5
  326. package/lib/{HookWebpackError.js → errors/HookWebpackError.js} +20 -16
  327. package/lib/{IgnoreErrorModuleFactory.js → errors/IgnoreErrorModuleFactory.js} +7 -4
  328. package/lib/{InvalidDependenciesModuleWarning.js → errors/InvalidDependenciesModuleWarning.js} +6 -3
  329. package/lib/errors/JSONParseError.js +115 -0
  330. package/lib/errors/LoaderLoadingError.js +20 -0
  331. package/lib/{ModuleBuildError.js → errors/ModuleBuildError.js} +22 -16
  332. package/lib/{ModuleDependencyError.js → errors/ModuleDependencyError.js} +10 -3
  333. package/lib/{ModuleDependencyWarning.js → errors/ModuleDependencyWarning.js} +13 -5
  334. package/lib/{ModuleError.js → errors/ModuleError.js} +10 -14
  335. package/lib/{ModuleHashingError.js → errors/ModuleHashingError.js} +5 -1
  336. package/lib/errors/ModuleNotFoundError.js +94 -0
  337. package/lib/errors/ModuleParseError.js +141 -0
  338. package/lib/{ModuleRestoreError.js → errors/ModuleRestoreError.js} +4 -1
  339. package/lib/{ModuleStoreError.js → errors/ModuleStoreError.js} +5 -1
  340. package/lib/{ModuleWarning.js → errors/ModuleWarning.js} +13 -14
  341. package/lib/{NodeStuffInWebError.js → errors/NodeStuffInWebError.js} +7 -5
  342. package/lib/errors/NonErrorEmittedError.js +30 -0
  343. package/lib/{UnhandledSchemeError.js → errors/UnhandledSchemeError.js} +9 -2
  344. package/lib/{UnsupportedFeatureWarning.js → errors/UnsupportedFeatureWarning.js} +4 -3
  345. package/lib/errors/WebpackError.js +84 -0
  346. package/lib/esm/ExportWebpackRequireRuntimeModule.js +2 -0
  347. package/lib/esm/ModuleChunkFormatPlugin.js +52 -15
  348. package/lib/esm/ModuleChunkLoadingPlugin.js +11 -3
  349. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +80 -52
  350. package/lib/hmr/HotModuleReplacement.runtime.js +175 -30
  351. package/lib/hmr/HotModuleReplacementRuntimeModule.js +8 -0
  352. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +173 -26
  353. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -0
  354. package/lib/hmr/LazyCompilationPlugin.js +154 -7
  355. package/lib/hmr/lazyCompilationBackend.js +53 -12
  356. package/lib/html/HtmlGenerator.js +1490 -0
  357. package/lib/html/HtmlModule.js +41 -0
  358. package/lib/html/HtmlModulesPlugin.js +1129 -0
  359. package/lib/html/HtmlParser.js +1970 -0
  360. package/lib/html/favicon.svg +1 -0
  361. package/lib/html/syntax.js +9106 -0
  362. package/lib/ids/ChunkModuleIdRangePlugin.js +3 -1
  363. package/lib/ids/DeterministicChunkIdsPlugin.js +3 -1
  364. package/lib/ids/DeterministicModuleIdsPlugin.js +3 -1
  365. package/lib/ids/HashedModuleIdsPlugin.js +2 -1
  366. package/lib/ids/IdHelpers.js +49 -12
  367. package/lib/ids/NamedChunkIdsPlugin.js +3 -1
  368. package/lib/ids/NamedModuleIdsPlugin.js +3 -1
  369. package/lib/ids/NaturalChunkIdsPlugin.js +1 -1
  370. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  371. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -1
  372. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -1
  373. package/lib/ids/SyncModuleIdsPlugin.js +3 -1
  374. package/lib/index.js +66 -15
  375. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +5 -6
  376. package/lib/javascript/BasicEvaluatedExpression.js +370 -49
  377. package/lib/javascript/ChunkFormatHelpers.js +2 -1
  378. package/lib/javascript/ChunkHelpers.js +1 -0
  379. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
  380. package/lib/javascript/EnableChunkLoadingPlugin.js +6 -1
  381. package/lib/javascript/JavascriptGenerator.js +213 -51
  382. package/lib/javascript/JavascriptModule.js +54 -0
  383. package/lib/javascript/JavascriptModulesPlugin.js +628 -198
  384. package/lib/javascript/JavascriptParser.js +1334 -471
  385. package/lib/javascript/JavascriptParserHelpers.js +10 -7
  386. package/lib/javascript/StartupHelpers.js +5 -0
  387. package/lib/javascript/syntax.js +5037 -0
  388. package/lib/json/JsonData.js +5 -0
  389. package/lib/json/JsonGenerator.js +21 -0
  390. package/lib/json/JsonModule.js +40 -0
  391. package/lib/json/JsonModulesPlugin.js +8 -1
  392. package/lib/json/JsonParser.js +18 -27
  393. package/lib/library/AbstractLibraryPlugin.js +17 -2
  394. package/lib/library/AmdLibraryPlugin.js +8 -0
  395. package/lib/library/AssignLibraryPlugin.js +21 -3
  396. package/lib/library/EnableLibraryPlugin.js +8 -2
  397. package/lib/library/ExportPropertyLibraryPlugin.js +10 -0
  398. package/lib/{FalseIIFEUmdWarning.js → library/FalseIIFEUmdWarning.js} +2 -1
  399. package/lib/library/JsonpLibraryPlugin.js +8 -0
  400. package/lib/library/ModuleLibraryPlugin.js +154 -7
  401. package/lib/library/SystemLibraryPlugin.js +11 -3
  402. package/lib/library/UmdLibraryPlugin.js +16 -0
  403. package/lib/loaders/LoaderRunner.js +714 -0
  404. package/lib/loaders/loadLoader.js +100 -0
  405. package/lib/logging/Logger.js +17 -0
  406. package/lib/logging/createConsoleLogger.js +7 -0
  407. package/lib/logging/runtime.js +2 -0
  408. package/lib/logging/truncateArgs.js +2 -0
  409. package/lib/node/CommonJsChunkLoadingPlugin.js +5 -1
  410. package/lib/node/NodeEnvironmentPlugin.js +7 -3
  411. package/lib/node/NodeSourcePlugin.js +1 -1
  412. package/lib/node/NodeTargetPlugin.js +4 -63
  413. package/lib/node/NodeTemplatePlugin.js +3 -1
  414. package/lib/node/NodeWatchFileSystem.js +40 -22
  415. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +13 -9
  416. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +33 -3
  417. package/lib/node/ReadFileCompileWasmPlugin.js +28 -3
  418. package/lib/node/RequireChunkLoadingRuntimeModule.js +21 -16
  419. package/lib/node/nodeBuiltins.js +80 -0
  420. package/lib/node/nodeConsole.js +116 -64
  421. package/lib/optimize/AggressiveMergingPlugin.js +22 -16
  422. package/lib/optimize/AggressiveSplittingPlugin.js +6 -1
  423. package/lib/optimize/ConcatenatedModule.js +603 -130
  424. package/lib/optimize/ConstExportsPlugin.js +211 -0
  425. package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -1
  426. package/lib/optimize/FlagIncludedChunksPlugin.js +15 -4
  427. package/lib/optimize/InlineExports.js +178 -0
  428. package/lib/optimize/InnerGraph.js +374 -262
  429. package/lib/optimize/InnerGraphPlugin.js +246 -117
  430. package/lib/optimize/LimitChunkCountPlugin.js +9 -0
  431. package/lib/optimize/MangleExportsPlugin.js +5 -1
  432. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -0
  433. package/lib/optimize/MinChunkSizePlugin.js +2 -1
  434. package/lib/optimize/MinMaxSizeWarning.js +5 -4
  435. package/lib/optimize/ModuleConcatenationPlugin.js +229 -55
  436. package/lib/optimize/RealContentHashPlugin.js +130 -52
  437. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
  438. package/lib/optimize/RemoveParentModulesPlugin.js +3 -1
  439. package/lib/optimize/RuntimeChunkPlugin.js +2 -1
  440. package/lib/optimize/SideEffectsFlagPlugin.js +381 -55
  441. package/lib/optimize/SplitChunksPlugin.js +200 -50
  442. package/lib/performance/AssetsOverSizeLimitWarning.js +3 -2
  443. package/lib/performance/EntrypointsOverSizeLimitWarning.js +3 -2
  444. package/lib/performance/NoAsyncChunksWarning.js +5 -3
  445. package/lib/performance/SizeLimitsPlugin.js +8 -2
  446. package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +1 -0
  447. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +21 -0
  448. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +1 -0
  449. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +5 -1
  450. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +25 -13
  451. package/lib/prefetch/ResourceHintPlugin.js +687 -0
  452. package/lib/prefetch/ResourceHintRuntimeModule.js +149 -0
  453. package/lib/prefetch/StartupAssetHintRuntimeModule.js +210 -0
  454. package/lib/prefetch/parseResourceHintOptions.js +103 -0
  455. package/lib/rules/BasicEffectRulePlugin.js +3 -0
  456. package/lib/rules/BasicMatcherRulePlugin.js +3 -0
  457. package/lib/rules/ObjectMatcherRulePlugin.js +3 -0
  458. package/lib/rules/RuleSetCompiler.js +132 -0
  459. package/lib/rules/UseEffectRulePlugin.js +10 -3
  460. package/lib/runtime/AsyncModuleGeneratorRuntimeModule.js +56 -0
  461. package/lib/runtime/AsyncModuleRuntimeModule.js +52 -33
  462. package/lib/runtime/AutoPublicPathRuntimeModule.js +22 -9
  463. package/lib/runtime/BaseUriRuntimeModule.js +1 -0
  464. package/lib/runtime/ChunkNameRuntimeModule.js +1 -0
  465. package/lib/runtime/CommonJsWrapRuntimeModule.js +37 -0
  466. package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +2 -1
  467. package/lib/runtime/CompatRuntimeModule.js +2 -0
  468. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +7 -4
  469. package/lib/runtime/CreateScriptRuntimeModule.js +1 -0
  470. package/lib/runtime/CreateScriptUrlRuntimeModule.js +1 -0
  471. package/lib/runtime/DefinePropertyGettersRuntimeModule.js +34 -4
  472. package/lib/runtime/EnsureChunkRuntimeModule.js +1 -0
  473. package/lib/runtime/GetChunkFilenameRuntimeModule.js +88 -8
  474. package/lib/runtime/GetFullHashRuntimeModule.js +1 -0
  475. package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -0
  476. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
  477. package/lib/runtime/GetWorkletBootstrapRuntimeModule.js +59 -0
  478. package/lib/runtime/GlobalRuntimeModule.js +1 -0
  479. package/lib/runtime/HasOwnPropertyRuntimeModule.js +2 -1
  480. package/lib/runtime/HelperRuntimeModule.js +5 -0
  481. package/lib/runtime/LoadScriptRuntimeModule.js +28 -37
  482. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +354 -37
  483. package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +2 -1
  484. package/lib/runtime/NonceRuntimeModule.js +1 -0
  485. package/lib/runtime/OnChunksLoadedRuntimeModule.js +5 -4
  486. package/lib/runtime/PublicPathRuntimeModule.js +1 -0
  487. package/lib/runtime/RelativeUrlRuntimeModule.js +4 -2
  488. package/lib/runtime/RuntimeIdRuntimeModule.js +1 -0
  489. package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +38 -0
  490. package/lib/runtime/StartupChunkDependenciesPlugin.js +13 -1
  491. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +2 -1
  492. package/lib/runtime/StartupEntrypointRuntimeModule.js +5 -3
  493. package/lib/runtime/SystemContextRuntimeModule.js +1 -0
  494. package/lib/runtime/ToBinaryRuntimeModule.js +1 -0
  495. package/lib/runtime/WorkerRuntimeModule.js +33 -0
  496. package/lib/schemes/DataUriPlugin.js +14 -2
  497. package/lib/schemes/FileUriPlugin.js +1 -1
  498. package/lib/schemes/HttpUriPlugin.js +86 -4
  499. package/lib/schemes/VirtualUrlPlugin.js +8 -4
  500. package/lib/serialization/AggregateErrorSerializer.js +9 -6
  501. package/lib/serialization/ArraySerializer.js +6 -8
  502. package/lib/serialization/BinaryMiddleware.js +427 -1006
  503. package/lib/serialization/DateObjectSerializer.js +4 -2
  504. package/lib/serialization/ErrorObjectSerializer.js +10 -6
  505. package/lib/serialization/FileMiddleware.js +345 -59
  506. package/lib/serialization/MapObjectSerializer.js +7 -9
  507. package/lib/serialization/NullPrototypeObjectSerializer.js +9 -9
  508. package/lib/serialization/ObjectMiddleware.js +73 -13
  509. package/lib/serialization/PlainObjectSerializer.js +16 -8
  510. package/lib/serialization/RegExpObjectSerializer.js +4 -2
  511. package/lib/serialization/Serializer.js +6 -0
  512. package/lib/serialization/SerializerMiddleware.js +14 -2
  513. package/lib/serialization/SetObjectSerializer.js +6 -8
  514. package/lib/serialization/SingleItemMiddleware.js +3 -0
  515. package/lib/sharing/ConsumeSharedFallbackDependency.js +1 -0
  516. package/lib/sharing/ConsumeSharedModule.js +21 -7
  517. package/lib/sharing/ConsumeSharedPlugin.js +11 -11
  518. package/lib/sharing/ConsumeSharedRuntimeModule.js +55 -45
  519. package/lib/sharing/ProvideForSharedDependency.js +1 -0
  520. package/lib/sharing/ProvideSharedDependency.js +34 -15
  521. package/lib/sharing/ProvideSharedModule.js +42 -12
  522. package/lib/sharing/ProvideSharedModuleFactory.js +1 -0
  523. package/lib/sharing/ProvideSharedPlugin.js +13 -8
  524. package/lib/sharing/SharePlugin.js +5 -1
  525. package/lib/sharing/ShareRuntimeModule.js +19 -16
  526. package/lib/sharing/resolveMatchedConfigs.js +6 -2
  527. package/lib/sharing/utils.js +9 -1
  528. package/lib/stats/DefaultStatsFactoryPlugin.js +289 -201
  529. package/lib/stats/DefaultStatsPresetPlugin.js +14 -2
  530. package/lib/stats/DefaultStatsPrinterPlugin.js +74 -170
  531. package/lib/stats/StatsFactory.js +70 -27
  532. package/lib/stats/StatsPrinter.js +16 -2
  533. package/lib/typescript/TypeScriptPlugin.js +210 -0
  534. package/lib/url/URLParserPlugin.js +111 -23
  535. package/lib/util/ArrayHelpers.js +1 -0
  536. package/lib/util/ArrayQueue.js +10 -5
  537. package/lib/util/AsyncQueue.js +154 -74
  538. package/lib/util/Hash.js +2 -2
  539. package/lib/util/IterableHelpers.js +3 -0
  540. package/lib/util/LazyBucketSortedSet.js +26 -0
  541. package/lib/util/LazySet.js +45 -4
  542. package/lib/util/LocConverter.js +64 -0
  543. package/lib/util/ParallelismFactorCalculator.js +1 -0
  544. package/lib/util/Queue.js +6 -3
  545. package/lib/util/Semaphore.js +15 -1
  546. package/lib/util/SetHelpers.js +4 -1
  547. package/lib/util/SortableSet.js +7 -1
  548. package/lib/util/SourceProcessor.js +119 -0
  549. package/lib/util/StackedCacheMap.js +20 -3
  550. package/lib/util/StackedMap.js +162 -43
  551. package/lib/util/StringXor.js +1 -1
  552. package/lib/util/TupleQueue.js +7 -3
  553. package/lib/util/TupleSet.js +14 -0
  554. package/lib/util/URLAbsoluteSpecifier.js +1 -0
  555. package/lib/util/WeakTupleMap.js +60 -1
  556. package/lib/util/binarySearchBounds.js +3 -2
  557. package/lib/util/chainedImports.js +3 -3
  558. package/lib/util/cleverMerge.js +19 -2
  559. package/lib/util/comparators.js +35 -4
  560. package/lib/util/compileBooleanMatcher.js +9 -0
  561. package/lib/util/concatenate.js +80 -24
  562. package/lib/util/conventions.js +46 -1
  563. package/lib/util/createHash.js +0 -1
  564. package/lib/util/createHooksRegistry.js +43 -0
  565. package/lib/util/createMappings.js +118 -0
  566. package/lib/util/dataURL.js +3 -2
  567. package/lib/util/deprecation.js +19 -0
  568. package/lib/util/deterministicGrouping.js +46 -17
  569. package/lib/util/extractSourceMap.js +2 -1
  570. package/lib/util/extractUrlAndGlobal.js +1 -0
  571. package/lib/util/findGraphRoots.js +7 -0
  572. package/lib/{formatLocation.js → util/formatLocation.js} +4 -2
  573. package/lib/{SizeFormatHelpers.js → util/formatSize.js} +10 -3
  574. package/lib/util/fs.js +87 -14
  575. package/lib/util/generateDebugId.js +1 -0
  576. package/lib/util/globUtils.js +710 -0
  577. package/lib/util/hash/BatchedHash.js +1 -0
  578. package/lib/util/hash/BulkUpdateHash.js +1 -0
  579. package/lib/util/hash/DebugHash.js +1 -0
  580. package/lib/util/hash/hash-digest.js +32 -15
  581. package/lib/util/hash/md4.js +1 -1
  582. package/lib/util/hash/wasm-hash.js +5 -0
  583. package/lib/util/hash/xxhash64.js +1 -1
  584. package/lib/util/identifier.js +118 -7
  585. package/lib/util/implicitTypeLoaderFallback.js +62 -0
  586. package/lib/util/internalSerializables.js +102 -60
  587. package/lib/util/magicComment.js +149 -7
  588. package/lib/util/makeSerializable.js +7 -0
  589. package/lib/util/memoize.js +2 -0
  590. package/lib/util/mimeTypes.js +176 -0
  591. package/lib/util/nonNumericOnlyHash.js +31 -1
  592. package/lib/util/numberHash.js +2 -2
  593. package/lib/util/parseJson.js +41 -0
  594. package/lib/util/processAsyncTree.js +8 -0
  595. package/lib/util/property.js +9 -2
  596. package/lib/util/publicPathPlaceholder.js +64 -0
  597. package/lib/util/registerExternalSerializer.js +24 -4
  598. package/lib/util/removeBOM.js +1 -0
  599. package/lib/util/runtime.js +32 -0
  600. package/lib/util/semver.js +15 -0
  601. package/lib/util/serialization.js +2 -0
  602. package/lib/util/smartGrouping.js +8 -0
  603. package/lib/util/source.js +23 -0
  604. package/lib/util/topologicalSort.js +69 -0
  605. package/lib/validateSchema.js +1 -0
  606. package/lib/wasm/EnableWasmLoadingPlugin.js +15 -1
  607. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +25 -18
  608. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +34 -22
  609. package/lib/wasm-async/AsyncWasmModule.js +77 -0
  610. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +6 -0
  611. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +6 -1
  612. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +22 -126
  613. package/lib/wasm-async/AsyncWebAssemblyParser.js +3 -2
  614. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +13 -2
  615. package/lib/wasm-sync/SyncWasmModule.js +39 -0
  616. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +7 -3
  617. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +86 -19
  618. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +4 -3
  619. package/lib/wasm-sync/WebAssemblyGenerator.js +27 -1
  620. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +9 -3
  621. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +4 -0
  622. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +20 -1
  623. package/lib/wasm-sync/WebAssemblyParser.js +9 -3
  624. package/lib/wasm-sync/WebAssemblyUtils.js +2 -0
  625. package/lib/web/FetchCompileAsyncWasmPlugin.js +29 -1
  626. package/lib/web/FetchCompileWasmPlugin.js +27 -1
  627. package/lib/web/JsonpChunkLoadingPlugin.js +11 -1
  628. package/lib/web/JsonpChunkLoadingRuntimeModule.js +58 -64
  629. package/lib/web/JsonpTemplatePlugin.js +2 -1
  630. package/lib/webpack.js +78 -1
  631. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +10 -1
  632. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +15 -10
  633. package/lib/webworker/WebWorkerTemplatePlugin.js +1 -1
  634. package/module.d.ts +21 -0
  635. package/package.json +79 -77
  636. package/schemas/WebpackOptions.check.js +1 -1
  637. package/schemas/WebpackOptions.json +1173 -80
  638. package/schemas/plugins/{DllPlugin.check.d.ts → HtmlGeneratorOptions.check.d.ts} +1 -1
  639. package/schemas/plugins/HtmlGeneratorOptions.check.js +6 -0
  640. package/schemas/plugins/HtmlGeneratorOptions.json +3 -0
  641. package/schemas/plugins/{DllReferencePlugin.check.d.ts → HtmlParserOptions.check.d.ts} +1 -1
  642. package/schemas/plugins/HtmlParserOptions.check.js +6 -0
  643. package/schemas/plugins/HtmlParserOptions.json +3 -0
  644. package/schemas/plugins/ProgressPlugin.check.js +1 -1
  645. package/schemas/plugins/ProgressPlugin.json +38 -0
  646. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  647. package/schemas/plugins/container/ContainerReferencePlugin.json +2 -0
  648. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  649. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  650. package/schemas/plugins/container/ModuleFederationPlugin.json +2 -0
  651. package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.d.ts +7 -0
  652. package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +6 -0
  653. package/schemas/plugins/css/CssAutoOrModuleParserOptions.json +3 -0
  654. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  655. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  656. package/schemas/plugins/dll/DllPlugin.check.d.ts +7 -0
  657. package/schemas/plugins/dll/DllReferencePlugin.check.d.ts +7 -0
  658. package/types.d.ts +11053 -3019
  659. package/lib/CaseSensitiveModulesWarning.js +0 -72
  660. package/lib/GraphHelpers.js +0 -46
  661. package/lib/ModuleParseError.js +0 -125
  662. package/lib/NoModeWarning.js +0 -23
  663. package/lib/css/CssMergeStyleSheetsRuntimeModule.js +0 -56
  664. package/lib/css/walkCssTokens.js +0 -1843
  665. package/lib/util/AppendOnlyStackedSet.js +0 -78
  666. /package/schemas/plugins/{DllPlugin.check.js → dll/DllPlugin.check.js} +0 -0
  667. /package/schemas/plugins/{DllPlugin.json → dll/DllPlugin.json} +0 -0
  668. /package/schemas/plugins/{DllReferencePlugin.check.js → dll/DllReferencePlugin.check.js} +0 -0
  669. /package/schemas/plugins/{DllReferencePlugin.json → dll/DllReferencePlugin.json} +0 -0
@@ -21,42 +21,38 @@ const { MultiItemCache } = require("./CacheFacade");
21
21
  const Chunk = require("./Chunk");
22
22
  const ChunkGraph = require("./ChunkGraph");
23
23
  const ChunkGroup = require("./ChunkGroup");
24
- const ChunkRenderError = require("./ChunkRenderError");
25
24
  const ChunkTemplate = require("./ChunkTemplate");
26
- const CodeGenerationError = require("./CodeGenerationError");
27
25
  const CodeGenerationResults = require("./CodeGenerationResults");
28
26
  const Dependency = require("./Dependency");
29
27
  const DependencyTemplates = require("./DependencyTemplates");
30
28
  const Entrypoint = require("./Entrypoint");
31
29
  const ErrorHelpers = require("./ErrorHelpers");
32
30
  const FileSystemInfo = require("./FileSystemInfo");
33
- const {
34
- connectChunkGroupAndChunk,
35
- connectChunkGroupParentAndChild,
36
- connectEntrypointAndDependOn
37
- } = require("./GraphHelpers");
38
- const {
39
- makeWebpackError,
40
- tryRunOrWebpackError
41
- } = require("./HookWebpackError");
31
+ const LazyBarrelController = require("./LazyBarrel");
42
32
  const MainTemplate = require("./MainTemplate");
43
33
  const Module = require("./Module");
44
- const ModuleDependencyError = require("./ModuleDependencyError");
45
- const ModuleDependencyWarning = require("./ModuleDependencyWarning");
46
34
  const ModuleGraph = require("./ModuleGraph");
47
- const ModuleHashingError = require("./ModuleHashingError");
48
- const ModuleNotFoundError = require("./ModuleNotFoundError");
49
35
  const ModuleProfile = require("./ModuleProfile");
50
- const ModuleRestoreError = require("./ModuleRestoreError");
51
- const ModuleStoreError = require("./ModuleStoreError");
52
36
  const ModuleTemplate = require("./ModuleTemplate");
53
37
  const { WEBPACK_MODULE_TYPE_RUNTIME } = require("./ModuleTypeConstants");
54
38
  const RuntimeGlobals = require("./RuntimeGlobals");
55
39
  const RuntimeTemplate = require("./RuntimeTemplate");
56
40
  const Stats = require("./Stats");
57
- const WebpackError = require("./WebpackError");
58
41
  const buildChunkGraph = require("./buildChunkGraph");
59
42
  const BuildCycleError = require("./errors/BuildCycleError");
43
+ const ChunkRenderError = require("./errors/ChunkRenderError");
44
+ const CodeGenerationError = require("./errors/CodeGenerationError");
45
+ const {
46
+ makeWebpackError,
47
+ tryRunOrWebpackError
48
+ } = require("./errors/HookWebpackError");
49
+ const ModuleDependencyError = require("./errors/ModuleDependencyError");
50
+ const ModuleDependencyWarning = require("./errors/ModuleDependencyWarning");
51
+ const ModuleHashingError = require("./errors/ModuleHashingError");
52
+ const ModuleNotFoundError = require("./errors/ModuleNotFoundError");
53
+ const ModuleRestoreError = require("./errors/ModuleRestoreError");
54
+ const ModuleStoreError = require("./errors/ModuleStoreError");
55
+ const WebpackError = require("./errors/WebpackError");
60
56
  const { LogType, Logger } = require("./logging/Logger");
61
57
  const StatsFactory = require("./stats/StatsFactory");
62
58
  const StatsPrinter = require("./stats/StatsPrinter");
@@ -113,6 +109,7 @@ const { isSourceEqual } = require("./util/source");
113
109
  /** @typedef {import("./Module").BuildInfo} BuildInfo */
114
110
  /** @typedef {import("./Module").ValueCacheVersions} ValueCacheVersions */
115
111
  /** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
112
+ /** @typedef {import("./Module").SourceTypes} SourceTypes */
116
113
  /** @typedef {import("./NormalModule").NormalModuleCompilationHooks} NormalModuleCompilationHooks */
117
114
  /** @typedef {import("./Module").FactoryMeta} FactoryMeta */
118
115
  /** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
@@ -137,11 +134,13 @@ const { isSourceEqual } = require("./util/source");
137
134
  /** @typedef {import("./util/Hash")} Hash */
138
135
 
139
136
  /**
137
+ * Defines the shared type used by this module.
140
138
  * @template T
141
139
  * @typedef {import("tapable").AsArray<T>} AsArray<T>
142
140
  */
143
141
 
144
142
  /**
143
+ * Defines the shared type used by this module.
145
144
  * @template T
146
145
  * @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T>
147
146
  */
@@ -149,12 +148,14 @@ const { isSourceEqual } = require("./util/source");
149
148
  /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
150
149
 
151
150
  /**
151
+ * Defines the callback callback.
152
152
  * @callback Callback
153
153
  * @param {(WebpackError | null)=} err
154
154
  * @returns {void}
155
155
  */
156
156
 
157
157
  /**
158
+ * Defines the module callback callback.
158
159
  * @callback ModuleCallback
159
160
  * @param {WebpackError | null=} err
160
161
  * @param {Module | null=} result
@@ -162,6 +163,7 @@ const { isSourceEqual } = require("./util/source");
162
163
  */
163
164
 
164
165
  /**
166
+ * Defines the module factory result callback callback.
165
167
  * @callback ModuleFactoryResultCallback
166
168
  * @param {WebpackError | null=} err
167
169
  * @param {ModuleFactoryResult | null=} result
@@ -169,6 +171,7 @@ const { isSourceEqual } = require("./util/source");
169
171
  */
170
172
 
171
173
  /**
174
+ * Defines the module or module factory result callback callback.
172
175
  * @callback ModuleOrModuleFactoryResultCallback
173
176
  * @param {WebpackError | null=} err
174
177
  * @param {Module | ModuleFactoryResult | null=} result
@@ -176,6 +179,7 @@ const { isSourceEqual } = require("./util/source");
176
179
  */
177
180
 
178
181
  /**
182
+ * Defines the execute module callback callback.
179
183
  * @callback ExecuteModuleCallback
180
184
  * @param {WebpackError | null=} err
181
185
  * @param {ExecuteModuleResult | null=} result
@@ -187,6 +191,7 @@ const { isSourceEqual } = require("./util/source");
187
191
  /** @typedef {Record<string, Source>} CompilationAssets */
188
192
 
189
193
  /**
194
+ * Defines the available modules chunk group mapping type used by this module.
190
195
  * @typedef {object} AvailableModulesChunkGroupMapping
191
196
  * @property {ChunkGroup} chunkGroup
192
197
  * @property {Set<Module>} availableModules
@@ -194,6 +199,7 @@ const { isSourceEqual } = require("./util/source");
194
199
  */
195
200
 
196
201
  /**
202
+ * Defines the dependencies block like type used by this module.
197
203
  * @typedef {object} DependenciesBlockLike
198
204
  * @property {Dependency[]} dependencies
199
205
  * @property {AsyncDependenciesBlock[]} blocks
@@ -202,16 +208,20 @@ const { isSourceEqual } = require("./util/source");
202
208
  /** @typedef {Set<Chunk>} Chunks */
203
209
 
204
210
  /**
211
+ * Defines the chunk path data type used by this module.
205
212
  * @typedef {object} ChunkPathData
206
213
  * @property {string | number} id
207
214
  * @property {string=} name
208
215
  * @property {string} hash
209
216
  * @property {HashWithLengthFunction=} hashWithLength
217
+ * @property {HashWithDigestFunction=} hashWithDigest builds `[chunkhash:<digest>]` per chunk in the runtime chunk-filename map
210
218
  * @property {(Record<string, string>)=} contentHash
211
219
  * @property {(Record<string, HashWithLengthFunction>)=} contentHashWithLength
220
+ * @property {(Record<string, HashWithDigestFunction>)=} contentHashWithDigest builds `[contenthash:<digest>]` per chunk in the runtime chunk-filename map
212
221
  */
213
222
 
214
223
  /**
224
+ * Defines the chunk hash context type used by this module.
215
225
  * @typedef {object} ChunkHashContext
216
226
  * @property {CodeGenerationResults} codeGenerationResults results of code generation
217
227
  * @property {RuntimeTemplate} runtimeTemplate the runtime template
@@ -220,12 +230,14 @@ const { isSourceEqual } = require("./util/source");
220
230
  */
221
231
 
222
232
  /**
233
+ * Defines the runtime requirements context type used by this module.
223
234
  * @typedef {object} RuntimeRequirementsContext
224
235
  * @property {ChunkGraph} chunkGraph the chunk graph
225
236
  * @property {CodeGenerationResults} codeGenerationResults the code generation results
226
237
  */
227
238
 
228
239
  /**
240
+ * Defines the execute module options type used by this module.
229
241
  * @typedef {object} ExecuteModuleOptions
230
242
  * @property {EntryOptions=} entryOptions
231
243
  */
@@ -235,9 +247,11 @@ const { isSourceEqual } = require("./util/source");
235
247
  /** @typedef {EXPECTED_ANY} ExecuteModuleExports */
236
248
 
237
249
  /**
250
+ * Defines the execute module result type used by this module.
238
251
  * @typedef {object} ExecuteModuleResult
239
252
  * @property {ExecuteModuleExports} exports
240
253
  * @property {boolean} cacheable
254
+ * @property {string[]} notCacheableReasons reasons why the executed modules are not cacheable
241
255
  * @property {ExecuteModuleAssets} assets
242
256
  * @property {FileSystemDependencies} fileDependencies
243
257
  * @property {FileSystemDependencies} contextDependencies
@@ -246,6 +260,7 @@ const { isSourceEqual } = require("./util/source");
246
260
  */
247
261
 
248
262
  /**
263
+ * Defines the execute module object type used by this module.
249
264
  * @typedef {object} ExecuteModuleObject
250
265
  * @property {string=} id module id
251
266
  * @property {ExecuteModuleExports} exports exports
@@ -254,6 +269,7 @@ const { isSourceEqual } = require("./util/source");
254
269
  */
255
270
 
256
271
  /**
272
+ * Defines the execute module argument type used by this module.
257
273
  * @typedef {object} ExecuteModuleArgument
258
274
  * @property {Module} module
259
275
  * @property {ExecuteModuleObject=} moduleObject
@@ -263,6 +279,7 @@ const { isSourceEqual } = require("./util/source");
263
279
  /** @typedef {((id: string) => ExecuteModuleExports) & { i?: ((options: ExecuteOptions) => void)[], c?: Record<string, ExecuteModuleObject> }} WebpackRequire */
264
280
 
265
281
  /**
282
+ * Defines the execute options type used by this module.
266
283
  * @typedef {object} ExecuteOptions
267
284
  * @property {string=} id module id
268
285
  * @property {ExecuteModuleObject} module module
@@ -272,6 +289,7 @@ const { isSourceEqual } = require("./util/source");
272
289
  /** @typedef {Map<string, { source: Source, info: AssetInfo | undefined }>} ExecuteModuleAssets */
273
290
 
274
291
  /**
292
+ * Defines the execute module context type used by this module.
275
293
  * @typedef {object} ExecuteModuleContext
276
294
  * @property {ExecuteModuleAssets} assets
277
295
  * @property {Chunk} chunk
@@ -280,6 +298,7 @@ const { isSourceEqual } = require("./util/source");
280
298
  */
281
299
 
282
300
  /**
301
+ * Defines the entry data type used by this module.
283
302
  * @typedef {object} EntryData
284
303
  * @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup
285
304
  * @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated
@@ -287,6 +306,7 @@ const { isSourceEqual } = require("./util/source");
287
306
  */
288
307
 
289
308
  /**
309
+ * Defines the log entry type used by this module.
290
310
  * @typedef {object} LogEntry
291
311
  * @property {keyof LogType} type
292
312
  * @property {EXPECTED_ANY[]=} args
@@ -295,6 +315,7 @@ const { isSourceEqual } = require("./util/source");
295
315
  */
296
316
 
297
317
  /**
318
+ * Defines the known asset info type used by this module.
298
319
  * @typedef {object} KnownAssetInfo
299
320
  * @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash)
300
321
  * @property {boolean=} minimized whether the asset is minimized
@@ -302,6 +323,7 @@ const { isSourceEqual } = require("./util/source");
302
323
  * @property {string | string[]=} chunkhash the value(s) of the chunk hash used for this asset
303
324
  * @property {string | string[]=} modulehash the value(s) of the module hash used for this asset
304
325
  * @property {string | string[]=} contenthash the value(s) of the content hash used for this asset
326
+ * @property {Record<string, string>=} contenthashDigest maps a `[contenthash:<digest>]` value to its digest, so `RealContentHashPlugin` re-encodes the recomputed hash in it
305
327
  * @property {string=} sourceFilename when asset was created from a source file (potentially transformed), the original filename relative to compilation context
306
328
  * @property {number=} size size in bytes, only set after asset has been emitted
307
329
  * @property {boolean=} development true, when asset is only used for development and doesn't count towards user-facing assets
@@ -316,6 +338,7 @@ const { isSourceEqual } = require("./util/source");
316
338
  /** @typedef {{ path: string, info: AssetInfo }} InterpolatedPathAndAssetInfo */
317
339
 
318
340
  /**
341
+ * Defines the asset type used by this module.
319
342
  * @typedef {object} Asset
320
343
  * @property {string} name the filename of the asset
321
344
  * @property {Source} source source of the asset
@@ -324,7 +347,10 @@ const { isSourceEqual } = require("./util/source");
324
347
 
325
348
  /** @typedef {(length: number) => string} HashWithLengthFunction */
326
349
 
350
+ /** @typedef {(digest: string, length?: number) => string} HashWithDigestFunction */
351
+
327
352
  /**
353
+ * Defines the module path data type used by this module.
328
354
  * @typedef {object} ModulePathData
329
355
  * @property {string | number} id
330
356
  * @property {string} hash
@@ -334,10 +360,14 @@ const { isSourceEqual } = require("./util/source");
334
360
  /** @typedef {(id: string | number) => string | number} PrepareIdFunction */
335
361
 
336
362
  /**
363
+ * Defines the path data type used by this module.
337
364
  * @typedef {object} PathData
338
365
  * @property {ChunkGraph=} chunkGraph
339
366
  * @property {string=} hash
367
+ * @property {string=} fullHash untruncated compilation hash, for re-encoding `[fullhash:<digest>]`
368
+ * @property {string=} fullHashDigest digest `fullHash` is encoded in (defaults to `hashDigest`)
340
369
  * @property {HashWithLengthFunction=} hashWithLength
370
+ * @property {HashWithDigestFunction=} hashWithDigest builds `[fullhash:<digest>]`/`[hash:<digest>]` in the runtime chunk-filename context, where it throws because a runtime `getFullHash()` expression cannot be re-encoded
341
371
  * @property {(Chunk | ChunkPathData)=} chunk
342
372
  * @property {(Module | ModulePathData)=} module
343
373
  * @property {RuntimeSpec=} runtime
@@ -346,16 +376,40 @@ const { isSourceEqual } = require("./util/source");
346
376
  * @property {string=} query
347
377
  * @property {string=} contentHashType
348
378
  * @property {string=} contentHash
379
+ * @property {string=} contentHashFull untruncated module/asset content hash, for re-encoding `[contenthash:<digest>]` from full entropy
349
380
  * @property {HashWithLengthFunction=} contentHashWithLength
381
+ * @property {string=} hashDigest digest the stored hashes are encoded in (for `[hash:<digest>]`)
382
+ * @property {boolean=} realContentHash whether `optimization.realContentHash` recomputes content hashes (records an inline `[contenthash:<digest>]` so it re-encodes in that digest)
383
+ * @property {boolean=} hashAsFullHash treat `[hash]` as `[fullhash]` rather than the module hash (CSS local idents)
350
384
  * @property {boolean=} noChunkHash
351
385
  * @property {string=} url
352
386
  * @property {string=} local
387
+ * @property {string=} uniqueName
353
388
  * @property {PrepareIdFunction=} prepareId
354
389
  */
355
390
 
391
+ /**
392
+ * Path data narrowed for the chunk filename / chunk asset interpolation context,
393
+ * where `chunk` is always provided. Use as the type parameter to `TemplatePathFn`
394
+ * for callbacks that receive a chunk context (for example `output.filename`,
395
+ * `output.chunkFilename`, `output.cssFilename`, `output.cssChunkFilename`,
396
+ * `optimization.splitChunks.cacheGroups[*].filename`).
397
+ * @typedef {PathData & { chunk: Chunk | ChunkPathData }} PathDataChunk
398
+ */
399
+
400
+ /**
401
+ * Path data narrowed for the module asset interpolation context, where `module`
402
+ * and `chunkGraph` are always provided. Use as the type parameter to
403
+ * `TemplatePathFn` for callbacks that receive a module context (for example
404
+ * `output.assetModuleFilename`, the per-module `generator.filename` /
405
+ * `generator.outputPath`, and `module.parser.css.localIdentName`).
406
+ * @typedef {PathData & { module: Module | ModulePathData, chunkGraph: ChunkGraph }} PathDataModule
407
+ */
408
+
356
409
  /** @typedef {"module" | "chunk" | "root-of-chunk" | "nested"} ExcludeModulesType */
357
410
 
358
411
  /**
412
+ * Defines the known normalized stats options type used by this module.
359
413
  * @typedef {object} KnownNormalizedStatsOptions
360
414
  * @property {string} context
361
415
  * @property {RequestShortener} requestShortener
@@ -400,6 +454,7 @@ const { isSourceEqual } = require("./util/source");
400
454
  /** @typedef {KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, EXPECTED_ANY>} NormalizedStatsOptions */
401
455
 
402
456
  /**
457
+ * Defines the known create stats options context type used by this module.
403
458
  * @typedef {object} KnownCreateStatsOptionsContext
404
459
  * @property {boolean=} forToString
405
460
  */
@@ -422,6 +477,7 @@ const esmDependencyCategory = "esm";
422
477
  // TODO webpack 6: remove
423
478
  const deprecatedNormalModuleLoaderHook = util.deprecate(
424
479
  /**
480
+ * Handles the callback logic for this hook.
425
481
  * @param {Compilation} compilation compilation
426
482
  * @returns {NormalModuleCompilationHooks["loader"]} hooks
427
483
  */
@@ -433,6 +489,7 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
433
489
 
434
490
  // TODO webpack 6: remove
435
491
  /**
492
+ * Define removed module templates.
436
493
  * @param {ModuleTemplates | undefined} moduleTemplates module templates
437
494
  */
438
495
  const defineRemovedModuleTemplates = (moduleTemplates) => {
@@ -481,6 +538,7 @@ const byLocation = compareSelect((err) => err.loc, compareLocations);
481
538
  const compareErrors = concatComparators(byModule, byLocation, byMessage);
482
539
 
483
540
  /**
541
+ * Defines the known unsafe cache data type used by this module.
484
542
  * @typedef {object} KnownUnsafeCacheData
485
543
  * @property {FactoryMeta=} factoryMeta factory meta
486
544
  * @property {ResolveOptions=} resolveOptions resolve options
@@ -491,6 +549,7 @@ const compareErrors = concatComparators(byModule, byLocation, byMessage);
491
549
  /** @typedef {KnownUnsafeCacheData & Record<string, EXPECTED_ANY>} UnsafeCacheData */
492
550
 
493
551
  /**
552
+ * Defines the module with restore from unsafe cache type used by this module.
494
553
  * @typedef {Module & { restoreFromUnsafeCache?: (unsafeCacheData: UnsafeCacheData, moduleFactory: ModuleFactory, compilationParams: CompilationParams) => void }} ModuleWithRestoreFromUnsafeCache
495
554
  */
496
555
 
@@ -502,7 +561,38 @@ const unsafeCacheDependencies = new WeakMap();
502
561
  /** @type {WeakMap<ModuleWithRestoreFromUnsafeCache, UnsafeCacheData>} */
503
562
  const unsafeCacheData = new WeakMap();
504
563
 
505
- /** @typedef {{ id: ModuleId, modules?: Map<Module, ModuleId>, blocks?: (ChunkId | null)[] }} References */
564
+ /** @typedef {EXPECTED_OBJECT} DependencyReportCacheToken */
565
+
566
+ /**
567
+ * Renewed when the module or a transitively referenced module is rebuilt.
568
+ * @type {WeakMap<Module, DependencyReportCacheToken>}
569
+ */
570
+ const dependencyReportCacheTokens = new WeakMap();
571
+
572
+ /**
573
+ * Modules known to have no dependency errors/warnings, per cache token.
574
+ * @type {WeakMap<DependencyReportCacheToken, WeakSet<Module>>}
575
+ */
576
+ const modulesWithoutProblems = new WeakMap();
577
+
578
+ /**
579
+ * Reduce affect type.
580
+ * @param {Readonly<ModuleGraphConnection[]>} connections connections
581
+ * @returns {symbol | boolean} result
582
+ */
583
+ const reduceAffectType = (connections) => {
584
+ let affected = false;
585
+ for (const { dependency } of connections) {
586
+ if (!dependency) continue;
587
+ const type = dependency.couldAffectReferencingModule();
588
+ if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE;
589
+ if (type === false) continue;
590
+ affected = true;
591
+ }
592
+ return affected;
593
+ };
594
+
595
+ /** @typedef {{ id: ModuleId, modules?: Map<Module, ModuleId>, blocks?: (ChunkId | null)[], sourceTypes?: SourceTypes }} References */
506
596
  /** @typedef {Map<Module, WeakTupleMap<EXPECTED_ANY[], EXPECTED_ANY>>} ModuleMemCaches */
507
597
 
508
598
  class Compilation {
@@ -512,6 +602,7 @@ class Compilation {
512
602
  * @param {CompilationParams} params the compilation parameters
513
603
  */
514
604
  constructor(compiler, params) {
605
+ /** @type {boolean} */
515
606
  this._backCompat = compiler._backCompat;
516
607
 
517
608
  const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this);
@@ -522,6 +613,7 @@ class Compilation {
522
613
  /** @type {Set<string>} */
523
614
  let savedAssets = new Set();
524
615
  /**
616
+ * Returns new assets.
525
617
  * @param {CompilationAssets} assets assets
526
618
  * @returns {CompilationAssets} new assets
527
619
  */
@@ -554,6 +646,7 @@ class Compilation {
554
646
  /** @type {ProcessedAssets | undefined} */
555
647
  const processedAssets = additionalAssetsFn ? new WeakSet() : undefined;
556
648
  /**
649
+ * Gets available assets.
557
650
  * @param {CompilationAssets} assets to be processed by additionalAssetsFn
558
651
  * @returns {CompilationAssets} available assets
559
652
  */
@@ -584,6 +677,7 @@ class Compilation {
584
677
  ...remainingTap,
585
678
  type: "async",
586
679
  /**
680
+ * Processes the provided asset.
587
681
  * @param {CompilationAssets} assets assets
588
682
  * @param {(err?: Error | null, result?: void) => void} callback callback
589
683
  * @returns {void}
@@ -629,6 +723,7 @@ class Compilation {
629
723
  return {
630
724
  ...remainingTap,
631
725
  /**
726
+ * Processes the provided asset.
632
727
  * @param {CompilationAssets} assets assets
633
728
  * @param {(err?: Error | null, result?: void) => void} callback callback
634
729
  * @returns {void}
@@ -637,6 +732,7 @@ class Compilation {
637
732
  fn(
638
733
  assets,
639
734
  /**
735
+ * Handles the callback logic for this hook.
640
736
  * @param {Error} err err
641
737
  * @returns {void}
642
738
  */
@@ -673,6 +769,7 @@ class Compilation {
673
769
  return {
674
770
  ...remainingTap,
675
771
  /**
772
+ * Returns result.
676
773
  * @param {CompilationAssets} assets assets
677
774
  * @returns {Promise<CompilationAssets>} result
678
775
  */
@@ -700,6 +797,7 @@ class Compilation {
700
797
  const afterProcessAssetsHook = new SyncHook(["assets"]);
701
798
 
702
799
  /**
800
+ * Creates a process assets hook.
703
801
  * @template T
704
802
  * @param {string} name name of the hook
705
803
  * @param {number} stage new stage
@@ -710,6 +808,7 @@ class Compilation {
710
808
  const createProcessAssetsHook = (name, stage, getArgs, code) => {
711
809
  if (!this._backCompat && code) return;
712
810
  /**
811
+ * Returns error message.
713
812
  * @param {string} reason reason
714
813
  * @returns {string} error message
715
814
  */
@@ -718,6 +817,7 @@ class Compilation {
718
817
  ) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
719
818
  BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
720
819
  /**
820
+ * Normalizes tap options for migrated process-assets hooks.
721
821
  * @param {string | (import("tapable").TapOptions & { name: string } & ProcessAssetsAdditionalOptions)} options hook options
722
822
  * @returns {import("tapable").TapOptions & { name: string } & ProcessAssetsAdditionalOptions} modified options
723
823
  */
@@ -784,9 +884,15 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
784
884
  "runtime"
785
885
  ]),
786
886
 
787
- /** @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */
887
+ /**
888
+ * @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>}
889
+ * @since 5.32.0
890
+ */
788
891
  executeModule: new SyncHook(["options", "context"]),
789
- /** @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */
892
+ /**
893
+ * @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>}
894
+ * @since 5.33.0
895
+ */
790
896
  prepareModuleExecution: new AsyncParallelHook(["options", "context"]),
791
897
 
792
898
  /** @type {AsyncSeriesHook<[Iterable<Module>]>} */
@@ -990,7 +1096,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
990
1096
 
991
1097
  processAssets: processAssetsHook,
992
1098
  afterProcessAssets: afterProcessAssetsHook,
993
- /** @type {AsyncSeriesHook<[CompilationAssets]>} */
1099
+ /**
1100
+ * @type {AsyncSeriesHook<[CompilationAssets]>}
1101
+ * @since 5.8.0
1102
+ */
994
1103
  processAdditionalAssets: new AsyncSeriesHook(["assets"]),
995
1104
 
996
1105
  /** @type {SyncBailHook<[], boolean | void>} */
@@ -1042,6 +1151,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1042
1151
  statsPrinter: new SyncHook(["statsPrinter", "options"]),
1043
1152
 
1044
1153
  /**
1154
+ * Gets normal module loader.
1045
1155
  * @deprecated
1046
1156
  * @returns {SyncHook<[AnyLoaderContext, NormalModule]>} normal module loader hook
1047
1157
  */
@@ -1062,6 +1172,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1062
1172
  this.inputFileSystem =
1063
1173
  /** @type {InputFileSystem} */
1064
1174
  (compiler.inputFileSystem);
1175
+ /** @type {FileSystemInfo} */
1065
1176
  this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, {
1066
1177
  unmanagedPaths: compiler.unmanagedPaths,
1067
1178
  managedPaths: compiler.managedPaths,
@@ -1080,7 +1191,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1080
1191
  }
1081
1192
  /** @type {ValueCacheVersions} */
1082
1193
  this.valueCacheVersions = new Map();
1194
+ /** @type {RequestShortener} */
1083
1195
  this.requestShortener = compiler.requestShortener;
1196
+ /** @type {string} */
1084
1197
  this.compilerPath = compiler.compilerPath;
1085
1198
 
1086
1199
  this.logger = this.getLogger("webpack.Compilation");
@@ -1095,9 +1208,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1095
1208
  /** @type {boolean} */
1096
1209
  this.profile = (options && options.profile) || false;
1097
1210
 
1211
+ /** @type {CompilationParams} */
1098
1212
  this.params = params;
1213
+ /** @type {MainTemplate} */
1099
1214
  this.mainTemplate = new MainTemplate(this.outputOptions, this);
1215
+ /** @type {ChunkTemplate} */
1100
1216
  this.chunkTemplate = new ChunkTemplate(this.outputOptions, this);
1217
+ /** @type {RuntimeTemplate} */
1101
1218
  this.runtimeTemplate = new RuntimeTemplate(
1102
1219
  this,
1103
1220
  this.outputOptions,
@@ -1207,6 +1324,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1207
1324
  this.assetsInfo = new Map();
1208
1325
  /** @type {Map<string, Map<string, Set<string>>>} */
1209
1326
  this._assetsRelatedIn = new Map();
1327
+ /** @type {Map<string, Set<Chunk>> | undefined} */
1328
+ this._assetToChunkIndex = undefined;
1329
+ /** @type {Map<string, Set<Chunk>> | undefined} */
1330
+ this._assetToChunkAuxiliaryIndex = undefined;
1210
1331
  /** @type {Error[]} */
1211
1332
  this.errors = [];
1212
1333
  /** @type {Error[]} */
@@ -1259,6 +1380,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1259
1380
  this.compilationDependencies = {
1260
1381
  add: util.deprecate(
1261
1382
  /**
1383
+ * Handles the add callback for this hook.
1262
1384
  * @param {string} item item
1263
1385
  * @returns {FileSystemDependencies} file dependencies
1264
1386
  */
@@ -1268,8 +1390,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1268
1390
  )
1269
1391
  };
1270
1392
 
1393
+ /** @type {CacheFacade} */
1271
1394
  this._modulesCache = this.getCache("Compilation/modules");
1395
+ /** @type {CacheFacade} */
1272
1396
  this._assetsCache = this.getCache("Compilation/assets");
1397
+ /** @type {CacheFacade} */
1273
1398
  this._codeGenerationCache = this.getCache("Compilation/codeGeneration");
1274
1399
 
1275
1400
  const unsafeCache = options.module.unsafeCache;
@@ -1278,6 +1403,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1278
1403
  /** @type {UnsafeCachePredicate} */
1279
1404
  this._unsafeCachePredicate =
1280
1405
  typeof unsafeCache === "function" ? unsafeCache : () => true;
1406
+
1407
+ /** @type {LazyBarrelController} */
1408
+ this._lazyBarrelController = new LazyBarrelController(this);
1281
1409
  }
1282
1410
 
1283
1411
  getStats() {
@@ -1285,6 +1413,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1285
1413
  }
1286
1414
 
1287
1415
  /**
1416
+ * Creates a stats options.
1288
1417
  * @param {string | boolean | StatsOptions | undefined} optionsOrPreset stats option value
1289
1418
  * @param {CreateStatsOptionsContext=} context context
1290
1419
  * @returns {NormalizedStatsOptions} normalized options
@@ -1318,6 +1447,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1318
1447
  }
1319
1448
 
1320
1449
  /**
1450
+ * Creates a stats factory.
1321
1451
  * @param {NormalizedStatsOptions} options options
1322
1452
  * @returns {StatsFactory} the stats factory
1323
1453
  */
@@ -1328,6 +1458,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1328
1458
  }
1329
1459
 
1330
1460
  /**
1461
+ * Creates a stats printer.
1331
1462
  * @param {NormalizedStatsOptions} options options
1332
1463
  * @returns {StatsPrinter} the stats printer
1333
1464
  */
@@ -1338,6 +1469,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1338
1469
  }
1339
1470
 
1340
1471
  /**
1472
+ * Returns the cache facade instance.
1341
1473
  * @param {string} name cache name
1342
1474
  * @returns {CacheFacade} the cache facade instance
1343
1475
  */
@@ -1346,6 +1478,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1346
1478
  }
1347
1479
 
1348
1480
  /**
1481
+ * Returns a logger with that name.
1349
1482
  * @param {string | (() => string)} name name of the logger, or function called once to get the logger name
1350
1483
  * @returns {Logger} a logger with that name
1351
1484
  */
@@ -1392,7 +1525,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1392
1525
  typeof console.profileEnd === "function"
1393
1526
  ) {
1394
1527
  console.profileEnd(
1395
- `[${name}] ${/** @type {NonNullable<LogEntry["args"]>} */ (logEntry.args)[0]}`
1528
+ `[${name}] ${
1529
+ /** @type {NonNullable<LogEntry["args"]>} */ (logEntry.args)[0]
1530
+ }`
1396
1531
  );
1397
1532
  }
1398
1533
  if (logEntries === undefined) {
@@ -1471,6 +1606,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1471
1606
  }
1472
1607
 
1473
1608
  /**
1609
+ * Adds the provided module to the compilation.
1474
1610
  * @param {Module} module module to be added that was created
1475
1611
  * @param {ModuleCallback} callback returns the module in the compilation,
1476
1612
  * it could be the passed one (if new), or an already existing in the compilation
@@ -1481,6 +1617,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1481
1617
  }
1482
1618
 
1483
1619
  /**
1620
+ * Adds the provided module to the compilation.
1484
1621
  * @param {Module} module module to be added that was created
1485
1622
  * @param {ModuleCallback} callback returns the module in the compilation,
1486
1623
  * it could be the passed one (if new), or an already existing in the compilation
@@ -1630,6 +1767,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1630
1767
  }
1631
1768
 
1632
1769
  /**
1770
+ * Process module dependencies.
1633
1771
  * @param {Module} module to be processed for deps
1634
1772
  * @param {ModuleCallback} callback callback to be triggered
1635
1773
  * @returns {void}
@@ -1639,11 +1777,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1639
1777
  }
1640
1778
 
1641
1779
  /**
1780
+ * Process module dependencies non recursive.
1642
1781
  * @param {Module} module to be processed for deps
1643
1782
  * @returns {void}
1644
1783
  */
1645
1784
  processModuleDependenciesNonRecursive(module) {
1646
1785
  /**
1786
+ * Process dependencies block.
1647
1787
  * @param {DependenciesBlock} block block
1648
1788
  */
1649
1789
  const processDependenciesBlock = (block) => {
@@ -1662,6 +1802,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1662
1802
  }
1663
1803
 
1664
1804
  /**
1805
+ * Process module dependencies.
1665
1806
  * @param {Module} module to be processed for deps
1666
1807
  * @param {ModuleCallback} callback callback to be triggered
1667
1808
  * @returns {void}
@@ -1674,6 +1815,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1674
1815
  Dependency.isLowPriorityDependency
1675
1816
  );
1676
1817
 
1818
+ // lazy barrel: defer re-export targets of side-effect-free modules
1819
+ const hasLazyBarrel = this._lazyBarrelController.classify(module);
1820
+
1677
1821
  /** @type {DependenciesBlock} */
1678
1822
  let currentBlock;
1679
1823
 
@@ -1697,6 +1841,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1697
1841
  let inProgressTransitive = 1;
1698
1842
 
1699
1843
  /**
1844
+ * On dependencies sorted.
1700
1845
  * @param {WebpackError=} err error
1701
1846
  * @returns {void}
1702
1847
  */
@@ -1733,6 +1878,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1733
1878
  };
1734
1879
 
1735
1880
  /**
1881
+ * On transitive tasks finished.
1736
1882
  * @param {WebpackError=} err error
1737
1883
  * @returns {void}
1738
1884
  */
@@ -1744,12 +1890,23 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1744
1890
  };
1745
1891
 
1746
1892
  /**
1893
+ * Process dependency.
1747
1894
  * @param {Dependency} dep dependency
1748
1895
  * @param {number} index index in block
1749
1896
  * @returns {void}
1750
1897
  */
1751
1898
  const processDependency = (dep, index) => {
1752
1899
  this.moduleGraph.setParents(dep, currentBlock, module, index);
1900
+ if (
1901
+ hasLazyBarrel &&
1902
+ // TODO remove in webpack 6
1903
+ // It may be missing on custom dependency types not extending the base Dependency
1904
+ "isLazy" in dep &&
1905
+ dep.isLazy()
1906
+ ) {
1907
+ return;
1908
+ }
1909
+
1753
1910
  if (this._unsafeCache) {
1754
1911
  try {
1755
1912
  const unsafeCachedModule = unsafeCacheDependencies.get(dep);
@@ -1763,6 +1920,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1763
1920
  dep,
1764
1921
  unsafeCachedModule
1765
1922
  );
1923
+ this._lazyBarrelController.unlazyForDependency(
1924
+ unsafeCachedModule,
1925
+ dep,
1926
+ sortedDependencies
1927
+ );
1766
1928
  return;
1767
1929
  }
1768
1930
  const identifier = unsafeCachedModule.identifier();
@@ -1776,6 +1938,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1776
1938
  dep,
1777
1939
  cachedModule
1778
1940
  );
1941
+ this._lazyBarrelController.unlazyForDependency(
1942
+ cachedModule,
1943
+ dep,
1944
+ sortedDependencies
1945
+ );
1779
1946
  return;
1780
1947
  }
1781
1948
  inProgressSorting++;
@@ -1836,6 +2003,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1836
2003
  dep,
1837
2004
  cachedModule
1838
2005
  ); // a3
2006
+ this._lazyBarrelController.unlazyForDependency(
2007
+ cachedModule,
2008
+ dep,
2009
+ sortedDependencies
2010
+ );
1839
2011
  } catch (err) {
1840
2012
  if (inProgressSorting <= 0) return;
1841
2013
  inProgressSorting = -1;
@@ -1855,6 +2027,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1855
2027
  };
1856
2028
 
1857
2029
  /**
2030
+ * Process dependency for resolving.
1858
2031
  * @param {Dependency} dep dependency
1859
2032
  * @returns {void}
1860
2033
  */
@@ -1973,6 +2146,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1973
2146
  }
1974
2147
 
1975
2148
  /**
2149
+ * Handle new module from unsafe cache.
1976
2150
  * @private
1977
2151
  * @param {Module} originModule original module
1978
2152
  * @param {Dependency} dependency dependency
@@ -2000,11 +2174,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2000
2174
  module,
2001
2175
  true,
2002
2176
  false,
2177
+ [dependency],
2003
2178
  callback
2004
2179
  );
2005
2180
  }
2006
2181
 
2007
2182
  /**
2183
+ * Handle existing module from unsafe cache.
2008
2184
  * @private
2009
2185
  * @param {Module} originModule original modules
2010
2186
  * @param {Dependency} dependency dependency
@@ -2017,6 +2193,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2017
2193
  }
2018
2194
 
2019
2195
  /**
2196
+ * Processes the provided factorize module option.
2020
2197
  * @param {FactorizeModuleOptions} options options
2021
2198
  * @param {ModuleOrModuleFactoryResultCallback} callback callback
2022
2199
  * @returns {void}
@@ -2103,18 +2280,21 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2103
2280
  }
2104
2281
 
2105
2282
  /**
2283
+ * Processes the provided module callback.
2106
2284
  * @overload
2107
2285
  * @param {FactorizeModuleOptions & { factoryResult?: false }} options options
2108
2286
  * @param {ModuleCallback} callback callback
2109
2287
  * @returns {void}
2110
2288
  */
2111
2289
  /**
2290
+ * Processes the provided module factory result callback.
2112
2291
  * @overload
2113
2292
  * @param {FactorizeModuleOptions & { factoryResult: true }} options options
2114
2293
  * @param {ModuleFactoryResultCallback} callback callback
2115
2294
  * @returns {void}
2116
2295
  */
2117
2296
  /**
2297
+ * Processes the provided |.
2118
2298
  * @param {FactorizeModuleOptions & { factoryResult?: false } | FactorizeModuleOptions & { factoryResult: true }} options options
2119
2299
  * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback
2120
2300
  */
@@ -2127,6 +2307,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2127
2307
  }
2128
2308
 
2129
2309
  /**
2310
+ * Defines the handle module creation options type used by this module.
2130
2311
  * @typedef {object} HandleModuleCreationOptions
2131
2312
  * @property {ModuleFactory} factory
2132
2313
  * @property {Dependency[]} dependencies
@@ -2139,6 +2320,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2139
2320
  */
2140
2321
 
2141
2322
  /**
2323
+ * Handle module creation.
2142
2324
  * @param {HandleModuleCreationOptions} options options object
2143
2325
  * @param {ModuleCallback} callback callback
2144
2326
  * @returns {void}
@@ -2202,7 +2384,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2202
2384
  applyFactoryResultDependencies();
2203
2385
  return callback();
2204
2386
  }
2205
-
2206
2387
  if (currentProfile !== undefined) {
2207
2388
  moduleGraph.setProfile(newModule, currentProfile);
2208
2389
  }
@@ -2275,6 +2456,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2275
2456
  module,
2276
2457
  recursive,
2277
2458
  checkCycle,
2459
+ dependencies,
2278
2460
  callback
2279
2461
  );
2280
2462
  });
@@ -2283,11 +2465,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2283
2465
  }
2284
2466
 
2285
2467
  /**
2468
+ * Handle module build and dependencies.
2286
2469
  * @private
2287
2470
  * @param {Module | null} originModule original module
2288
2471
  * @param {Module} module module
2289
2472
  * @param {boolean} recursive true if make it recursive, otherwise false
2290
2473
  * @param {boolean} checkCycle true if need to check cycle, otherwise false
2474
+ * @param {Dependency[]} dependencies the dependencies that resolved to the module (lazy barrel)
2291
2475
  * @param {ModuleCallback} callback callback
2292
2476
  * @returns {void}
2293
2477
  */
@@ -2296,6 +2480,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2296
2480
  module,
2297
2481
  recursive,
2298
2482
  checkCycle,
2483
+ dependencies,
2299
2484
  callback
2300
2485
  ) {
2301
2486
  // Check for cycles when build is trigger inside another build
@@ -2360,21 +2545,60 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2360
2545
  return;
2361
2546
  }
2362
2547
 
2363
- // This avoids deadlocks for circular dependencies
2364
- if (this.processDependenciesQueue.isProcessing(module)) {
2365
- return callback(null, module);
2366
- }
2548
+ // lazy barrel:
2549
+ // 1. first call: barrel module is not classified yet, so this records the requested
2550
+ // ids and returns undefined; the targets get built below when
2551
+ // `processModuleDependencies` runs `_lazyBarrelController.classify` and replays them.
2552
+ // 2. later call: barrel module is already built, so `processModuleDependencies` won't
2553
+ // re-walk it; the newly requested targets must be built here.
2554
+ const unlazyItems = this._lazyBarrelController.request(
2555
+ module,
2556
+ dependencies
2557
+ );
2367
2558
 
2368
- this.processModuleDependencies(module, (err) => {
2369
- if (err) {
2370
- return callback(err);
2559
+ if (unlazyItems !== undefined) {
2560
+ let inProgress = unlazyItems.length + 1; // +1 = the module's own dep processing
2561
+ let errored = false;
2562
+ /**
2563
+ * @param {(WebpackError | null)=} err error
2564
+ * @returns {void}
2565
+ */
2566
+ const onJobDone = (err) => {
2567
+ if (errored) return;
2568
+ if (err) {
2569
+ errored = true;
2570
+ return callback(err);
2571
+ }
2572
+ if (--inProgress === 0) callback(null, module);
2573
+ };
2574
+ for (const item of unlazyItems) {
2575
+ this.handleModuleCreation(item, (err) => {
2576
+ onJobDone(err && this.bail ? err : null);
2577
+ });
2371
2578
  }
2372
- callback(null, module);
2373
- });
2579
+ if (this.processDependenciesQueue.isProcessing(module)) {
2580
+ onJobDone();
2581
+ } else {
2582
+ this.processModuleDependencies(module, onJobDone);
2583
+ }
2584
+ } else {
2585
+ // This avoids deadlocks for circular dependencies
2586
+ if (this.processDependenciesQueue.isProcessing(module)) {
2587
+ return callback(null, module);
2588
+ }
2589
+
2590
+ this.processModuleDependencies(module, (err) => {
2591
+ if (err) {
2592
+ return callback(err);
2593
+ }
2594
+ callback(null, module);
2595
+ });
2596
+ }
2374
2597
  });
2375
2598
  }
2376
2599
 
2377
2600
  /**
2601
+ * Adds the provided string to the compilation.
2378
2602
  * @param {string} context context string path
2379
2603
  * @param {Dependency} dependency dependency used to create Module chain
2380
2604
  * @param {ModuleCallback} callback callback for when module chain is complete
@@ -2385,6 +2609,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2385
2609
  }
2386
2610
 
2387
2611
  /**
2612
+ * Adds the provided object to the compilation.
2388
2613
  * @param {object} options options
2389
2614
  * @param {string} options.context context string path
2390
2615
  * @param {Dependency} options.dependency dependency used to create Module chain
@@ -2439,6 +2664,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2439
2664
  }
2440
2665
 
2441
2666
  /**
2667
+ * Adds the provided string to the compilation.
2442
2668
  * @param {string} context context path for entry
2443
2669
  * @param {Dependency} entry entry dependency that should be followed
2444
2670
  * @param {string | EntryOptions} optionsOrName options or deprecated name of entry
@@ -2456,6 +2682,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2456
2682
  }
2457
2683
 
2458
2684
  /**
2685
+ * Adds the provided string to the compilation.
2459
2686
  * @param {string} context context path for entry
2460
2687
  * @param {Dependency} dependency dependency that should be followed
2461
2688
  * @param {EntryOptions} options options
@@ -2473,6 +2700,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2473
2700
  }
2474
2701
 
2475
2702
  /**
2703
+ * Adds the provided string to the compilation.
2476
2704
  * @param {string} context context path for entry
2477
2705
  * @param {Dependency} entry entry dependency that should be followed
2478
2706
  * @param {"dependencies" | "includeDependencies"} target type of entry
@@ -2553,6 +2781,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2553
2781
  }
2554
2782
 
2555
2783
  /**
2784
+ * Processes the provided module.
2556
2785
  * @param {Module} module module to be rebuilt
2557
2786
  * @param {ModuleCallback} callback callback when module finishes rebuilding
2558
2787
  * @returns {void}
@@ -2562,6 +2791,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2562
2791
  }
2563
2792
 
2564
2793
  /**
2794
+ * Processes the provided module.
2565
2795
  * @param {Module} module module to be rebuilt
2566
2796
  * @param {ModuleCallback} callback callback when module finishes rebuilding
2567
2797
  * @returns {void}
@@ -2607,6 +2837,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2607
2837
  }
2608
2838
 
2609
2839
  /**
2840
+ * Compute affected modules.
2610
2841
  * @private
2611
2842
  * @param {Set<Module>} modules modules
2612
2843
  */
@@ -2629,6 +2860,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2629
2860
  let statWithoutBuild = 0;
2630
2861
 
2631
2862
  /**
2863
+ * Compute references.
2632
2864
  * @param {Module} module module
2633
2865
  * @returns {WeakReferences | undefined} references
2634
2866
  */
@@ -2646,6 +2878,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2646
2878
  };
2647
2879
 
2648
2880
  /**
2881
+ * Compares references.
2649
2882
  * @param {Module} module the module
2650
2883
  * @param {WeakReferences | undefined} references references
2651
2884
  * @returns {boolean} true, when the references differ
@@ -2721,21 +2954,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2721
2954
  }
2722
2955
  }
2723
2956
 
2724
- /**
2725
- * @param {Readonly<ModuleGraphConnection[]>} connections connections
2726
- * @returns {symbol | boolean} result
2727
- */
2728
- const reduceAffectType = (connections) => {
2729
- let affected = false;
2730
- for (const { dependency } of connections) {
2731
- if (!dependency) continue;
2732
- const type = dependency.couldAffectReferencingModule();
2733
- if (type === Dependency.TRANSITIVE) return Dependency.TRANSITIVE;
2734
- if (type === false) continue;
2735
- affected = true;
2736
- }
2737
- return affected;
2738
- };
2739
2957
  /** @type {Set<Module>} */
2740
2958
  const directOnlyInfectedModules = new Set();
2741
2959
  for (const module of infectedModules) {
@@ -2804,6 +3022,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2804
3022
  let statChanged = 0;
2805
3023
  let statNew = 0;
2806
3024
  /**
3025
+ * Compute references.
2807
3026
  * @param {Module} module module
2808
3027
  * @returns {References} references
2809
3028
  */
@@ -2837,17 +3056,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2837
3056
  queue.push.apply(queue, block.blocks);
2838
3057
  }
2839
3058
  }
2840
- return { id, modules, blocks };
3059
+ return {
3060
+ id,
3061
+ modules,
3062
+ blocks,
3063
+ sourceTypes: module.getReferencedSourceTypes()
3064
+ };
2841
3065
  };
2842
3066
  /**
3067
+ * Compares references.
2843
3068
  * @param {Module} module module
2844
3069
  * @param {object} references references
2845
3070
  * @param {string | number} references.id id
2846
3071
  * @param {Map<Module, string | number | undefined>=} references.modules modules
2847
3072
  * @param {(string | number | null)[]=} references.blocks blocks
3073
+ * @param {SourceTypes=} references.sourceTypes connection-dependent source types
2848
3074
  * @returns {boolean} ok?
2849
3075
  */
2850
- const compareReferences = (module, { id, modules, blocks }) => {
3076
+ const compareReferences = (
3077
+ module,
3078
+ { id, modules, blocks, sourceTypes }
3079
+ ) => {
2851
3080
  if (id !== chunkGraph.getModuleId(module)) return false;
2852
3081
  if (modules !== undefined) {
2853
3082
  for (const [module, id] of modules) {
@@ -2871,6 +3100,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2871
3100
  }
2872
3101
  if (i !== blocks.length) return false;
2873
3102
  }
3103
+ // getReferencedSourceTypes() returns interned type sets, compare by reference. #20800
3104
+ if (
3105
+ sourceTypes !== undefined &&
3106
+ module.getReferencedSourceTypes() !== sourceTypes
3107
+ ) {
3108
+ return false;
3109
+ }
2874
3110
  return true;
2875
3111
  };
2876
3112
 
@@ -2907,6 +3143,58 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2907
3143
  }
2908
3144
 
2909
3145
  /**
3146
+ * Assigns a fresh dependency report cache token to every module whose
3147
+ * dependency errors/warnings could have changed since the previous
3148
+ * compilation: built modules and their (transitive) parents.
3149
+ * @private
3150
+ * @param {Set<Module>} modules modules
3151
+ * @returns {void}
3152
+ */
3153
+ _flagModulesForDependencyReporting(modules) {
3154
+ /** @type {DependencyReportCacheToken} */
3155
+ const token = {};
3156
+ const { moduleGraph, builtModules } = this;
3157
+ /** @type {Set<Module>} */
3158
+ const updatedModules = new Set();
3159
+ for (const module of modules) {
3160
+ if (
3161
+ builtModules.has(module) ||
3162
+ !dependencyReportCacheTokens.has(module)
3163
+ ) {
3164
+ updatedModules.add(module);
3165
+ }
3166
+ }
3167
+ // skip the parent walk when everything is updated anyway (initial build)
3168
+ if (updatedModules.size !== modules.size) {
3169
+ /** @type {Set<Module>} */
3170
+ const directOnlyUpdatedModules = new Set();
3171
+ for (const module of updatedModules) {
3172
+ for (const [
3173
+ referencingModule,
3174
+ connections
3175
+ ] of moduleGraph.getIncomingConnectionsByOriginModule(module)) {
3176
+ if (!referencingModule) continue;
3177
+ if (updatedModules.has(referencingModule)) continue;
3178
+ const type = reduceAffectType(connections);
3179
+ if (!type) continue;
3180
+ if (type === true) {
3181
+ directOnlyUpdatedModules.add(referencingModule);
3182
+ } else {
3183
+ updatedModules.add(referencingModule);
3184
+ }
3185
+ }
3186
+ }
3187
+ for (const module of directOnlyUpdatedModules) {
3188
+ updatedModules.add(module);
3189
+ }
3190
+ }
3191
+ for (const module of updatedModules) {
3192
+ dependencyReportCacheTokens.set(module, token);
3193
+ }
3194
+ }
3195
+
3196
+ /**
3197
+ * Processes the provided callback.
2910
3198
  * @param {Callback} callback callback
2911
3199
  */
2912
3200
  finish(callback) {
@@ -2966,6 +3254,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2966
3254
  const logger = this.getLogger("webpack.Compilation.ModuleProfile");
2967
3255
  // Avoid coverage problems due indirect changes
2968
3256
  /**
3257
+ * Processes the provided value.
2969
3258
  * @param {number} value value
2970
3259
  * @param {string} msg message
2971
3260
  */
@@ -2984,6 +3273,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2984
3273
  }
2985
3274
  };
2986
3275
  /**
3276
+ * Log normal summary.
2987
3277
  * @param {string} category a category
2988
3278
  * @param {(profile: ModuleProfile) => number} getDuration get duration callback
2989
3279
  * @param {(profile: ModuleProfile) => number} getParallelism get parallelism callback
@@ -3013,6 +3303,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3013
3303
  );
3014
3304
  };
3015
3305
  /**
3306
+ * Log by loaders summary.
3016
3307
  * @param {string} category a category
3017
3308
  * @param {(profile: ModuleProfile) => number} getDuration get duration callback
3018
3309
  * @param {(profile: ModuleProfile) => number} getParallelism get parallelism callback
@@ -3040,16 +3331,18 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3040
3331
  if (d === 0 || p === 0) continue;
3041
3332
  const t = d / p;
3042
3333
  innerSum += t;
3043
- if (t <= 10) continue;
3044
- logByValue(
3045
- t,
3046
- ` | | ${Math.round(t)} ms${
3047
- p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : ""
3048
- } ${category} > ${module.readableIdentifier(
3049
- this.requestShortener
3050
- )}`
3051
- );
3052
- innerMax = Math.max(innerMax, t);
3334
+ /* istanbul ignore next -- @preserve: only slow (>10ms) modules are logged, timing-dependent */
3335
+ if (t > 10) {
3336
+ logByValue(
3337
+ t,
3338
+ ` | | ${Math.round(t)} ms${
3339
+ p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : ""
3340
+ } ${category} > ${module.readableIdentifier(
3341
+ this.requestShortener
3342
+ )}`
3343
+ );
3344
+ innerMax = Math.max(innerMax, t);
3345
+ }
3053
3346
  }
3054
3347
  sum += innerSum;
3055
3348
  if (innerSum <= 10) continue;
@@ -3120,19 +3413,28 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3120
3413
 
3121
3414
  // extract warnings and errors from modules
3122
3415
  this.moduleGraph.freeze("dependency errors");
3123
- // TODO keep a cacheToken (= {}) for each module in the graph
3124
- // create a new one per compilation and flag all updated files
3125
- // and parents with it
3126
3416
  this.logger.time("report dependency errors and warnings");
3417
+ // moduleMemCaches has its own invalidation (incl. reference changes),
3418
+ // so cache tokens are only used without it
3419
+ const useReportCacheTokens = moduleMemCaches === undefined;
3420
+ if (useReportCacheTokens) {
3421
+ this._flagModulesForDependencyReporting(modules);
3422
+ }
3127
3423
  for (const module of modules) {
3128
- // TODO only run for modules with changed cacheToken
3129
- // global WeakMap<CacheToken, WeakSet<Module>> to keep modules without errors/warnings
3130
3424
  const memCache = moduleMemCaches && moduleMemCaches.get(module);
3131
3425
  if (memCache && memCache.get("noWarningsOrErrors")) continue;
3426
+ let token;
3427
+ if (useReportCacheTokens) {
3428
+ token = dependencyReportCacheTokens.get(module);
3429
+ const cleanModules = modulesWithoutProblems.get(
3430
+ /** @type {DependencyReportCacheToken} */ (token)
3431
+ );
3432
+ if (cleanModules !== undefined && cleanModules.has(module)) continue;
3433
+ }
3132
3434
  let hasProblems = this.reportDependencyErrorsAndWarnings(module, [
3133
3435
  module
3134
3436
  ]);
3135
- const errors = module.getErrors();
3437
+ const errors = /** @type {WebpackError[]} */ (module.getErrors());
3136
3438
  if (errors !== undefined) {
3137
3439
  for (const error of errors) {
3138
3440
  if (!error.module) {
@@ -3142,7 +3444,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3142
3444
  hasProblems = true;
3143
3445
  }
3144
3446
  }
3145
- const warnings = module.getWarnings();
3447
+ const warnings = /** @type {WebpackError[]} */ (module.getWarnings());
3146
3448
  if (warnings !== undefined) {
3147
3449
  for (const warning of warnings) {
3148
3450
  if (!warning.module) {
@@ -3152,7 +3454,21 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3152
3454
  hasProblems = true;
3153
3455
  }
3154
3456
  }
3155
- if (!hasProblems && memCache) memCache.set("noWarningsOrErrors", true);
3457
+ if (!hasProblems) {
3458
+ if (memCache) memCache.set("noWarningsOrErrors", true);
3459
+ if (useReportCacheTokens) {
3460
+ let cleanModules = modulesWithoutProblems.get(
3461
+ /** @type {DependencyReportCacheToken} */ (token)
3462
+ );
3463
+ if (cleanModules === undefined) {
3464
+ modulesWithoutProblems.set(
3465
+ /** @type {DependencyReportCacheToken} */ (token),
3466
+ (cleanModules = new WeakSet())
3467
+ );
3468
+ }
3469
+ cleanModules.add(module);
3470
+ }
3471
+ }
3156
3472
  }
3157
3473
  this.moduleGraph.unfreeze();
3158
3474
  this.logger.timeEnd("report dependency errors and warnings");
@@ -3171,17 +3487,21 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3171
3487
  this.additionalChunkAssets.length = 0;
3172
3488
  this.assets = {};
3173
3489
  this.assetsInfo.clear();
3490
+ this._assetToChunkIndex = undefined;
3491
+ this._assetToChunkAuxiliaryIndex = undefined;
3174
3492
  this.moduleGraph.removeAllModuleAttributes();
3175
3493
  this.moduleGraph.unfreeze();
3176
3494
  this.moduleMemCaches2 = undefined;
3177
3495
  }
3178
3496
 
3179
3497
  /**
3498
+ * Processes the provided callback.
3180
3499
  * @param {Callback} callback signals when the call finishes
3181
3500
  * @returns {void}
3182
3501
  */
3183
3502
  seal(callback) {
3184
3503
  /**
3504
+ * Processes the provided err.
3185
3505
  * @param {WebpackError=} err err
3186
3506
  * @returns {void}
3187
3507
  */
@@ -3191,6 +3511,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3191
3511
  this.rebuildQueue.clear();
3192
3512
  this.processDependenciesQueue.clear();
3193
3513
  this.addModuleQueue.clear();
3514
+ // lazy barrel only acts during make; release its bookkeeping now
3515
+ this._lazyBarrelController.clear();
3516
+ // unsafe-cache restore tables are only read during make; release them
3517
+ // so they stop pinning restored modules for the rest of the compilation
3518
+ this._restoredUnsafeCacheModuleEntries.clear();
3519
+ this._restoredUnsafeCacheEntries.clear();
3194
3520
  return callback(err);
3195
3521
  };
3196
3522
 
@@ -3228,7 +3554,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3228
3554
  this.namedChunkGroups.set(name, entrypoint);
3229
3555
  this.entrypoints.set(name, entrypoint);
3230
3556
  this.chunkGroups.push(entrypoint);
3231
- connectChunkGroupAndChunk(entrypoint, chunk);
3557
+
3558
+ if (entrypoint.pushChunk(chunk)) {
3559
+ chunk.addGroup(entrypoint);
3560
+ }
3232
3561
 
3233
3562
  /** @type {Set<Module>} */
3234
3563
  const entryModules = new Set();
@@ -3256,6 +3585,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3256
3585
  this.assignDepths(entryModules);
3257
3586
 
3258
3587
  /**
3588
+ * Returns sorted deps.
3259
3589
  * @param {Dependency[]} deps deps
3260
3590
  * @returns {Module[]} sorted deps
3261
3591
  */
@@ -3318,8 +3648,12 @@ Remove the 'runtime' option from the entrypoint.`);
3318
3648
  entry.setRuntimeChunk(entryChunk);
3319
3649
  continue outer;
3320
3650
  }
3321
- connectEntrypointAndDependOn(entry, dependency);
3322
- connectChunkGroupParentAndChild(dependency, entry);
3651
+
3652
+ entry.addDependOn(dependency);
3653
+
3654
+ if (dependency.addChild(entry)) {
3655
+ entry.addParent(dependency);
3656
+ }
3323
3657
  }
3324
3658
  } else if (runtime) {
3325
3659
  const entry = /** @type {Entrypoint} */ (this.entrypoints.get(name));
@@ -3556,6 +3890,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3556
3890
  }
3557
3891
 
3558
3892
  /**
3893
+ * Report dependency errors and warnings.
3559
3894
  * @param {Module} module module to report from
3560
3895
  * @param {DependenciesBlock[]} blocks blocks to report from
3561
3896
  * @returns {boolean} true, when it has warnings or errors
@@ -3569,7 +3904,14 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3569
3904
  const warnings = d.getWarnings(this.moduleGraph);
3570
3905
  if (warnings) {
3571
3906
  for (const w of warnings) {
3572
- const warning = new ModuleDependencyWarning(module, w, d.loc);
3907
+ // A consolidated dependency (e.g. CssIcssExportDependency) carries
3908
+ // per-item locations on the error itself; fall back to the
3909
+ // dependency loc for the usual one-loc-per-dependency case.
3910
+ const warning = new ModuleDependencyWarning(
3911
+ module,
3912
+ w,
3913
+ /** @type {EXPECTED_ANY} */ (w).loc || d.loc
3914
+ );
3573
3915
  this.warnings.push(warning);
3574
3916
  hasProblems = true;
3575
3917
  }
@@ -3577,7 +3919,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3577
3919
  const errors = d.getErrors(this.moduleGraph);
3578
3920
  if (errors) {
3579
3921
  for (const e of errors) {
3580
- const error = new ModuleDependencyError(module, e, d.loc);
3922
+ const error = new ModuleDependencyError(
3923
+ module,
3924
+ e,
3925
+ /** @type {EXPECTED_ANY} */ (e).loc || d.loc
3926
+ );
3581
3927
  this.errors.push(error);
3582
3928
  hasProblems = true;
3583
3929
  }
@@ -3592,6 +3938,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3592
3938
  }
3593
3939
 
3594
3940
  /**
3941
+ * Generates code and runtime requirements for this module.
3595
3942
  * @param {Callback} callback callback
3596
3943
  */
3597
3944
  codeGeneration(callback) {
@@ -3629,6 +3976,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3629
3976
  }
3630
3977
 
3631
3978
  /**
3979
+ * Run code generation jobs.
3632
3980
  * @private
3633
3981
  * @param {CodeGenerationJobs} jobs code generation jobs
3634
3982
  * @param {Callback} callback callback
@@ -3738,6 +4086,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3738
4086
  }
3739
4087
 
3740
4088
  /**
4089
+ * Code generation module.
3741
4090
  * @param {Module} module module
3742
4091
  * @param {RuntimeSpec} runtime runtime
3743
4092
  * @param {RuntimeSpec[]} runtimes runtimes
@@ -3749,6 +4098,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3749
4098
  * @param {WebpackError[]} errors errors
3750
4099
  * @param {CodeGenerationResults} results results
3751
4100
  * @param {(err?: WebpackError | null, result?: boolean) => void} callback callback
4101
+ * @returns {void}
3752
4102
  */
3753
4103
  _codeGenerationModule(
3754
4104
  module,
@@ -3764,6 +4114,39 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3764
4114
  callback
3765
4115
  ) {
3766
4116
  let codeGenerated = false;
4117
+ // without a cache backend, skip building the cache keys — the module
4118
+ // identifier strings are large (concatenated modules join all inner ids)
4119
+ if (!this._codeGenerationCache.isEnabled()) {
4120
+ /** @type {CodeGenerationResult} */
4121
+ let result;
4122
+ try {
4123
+ codeGenerated = true;
4124
+ this.codeGeneratedModules.add(module);
4125
+ result = module.codeGeneration({
4126
+ chunkGraph,
4127
+ moduleGraph,
4128
+ dependencyTemplates,
4129
+ runtimeTemplate,
4130
+ runtime,
4131
+ runtimes,
4132
+ codeGenerationResults: results,
4133
+ compilation: this
4134
+ });
4135
+ } catch (err) {
4136
+ errors.push(
4137
+ new CodeGenerationError(module, /** @type {Error} */ (err))
4138
+ );
4139
+ result = {
4140
+ sources: new Map(),
4141
+ runtimeRequirements: null,
4142
+ data: undefined
4143
+ };
4144
+ }
4145
+ for (const runtime of runtimes) {
4146
+ results.add(module, runtime, result);
4147
+ }
4148
+ return callback(null, codeGenerated);
4149
+ }
3767
4150
  const cache = new MultiItemCache(
3768
4151
  runtimes.map((runtime) =>
3769
4152
  this._codeGenerationCache.getItemCache(
@@ -3796,7 +4179,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3796
4179
  );
3797
4180
  result = cachedResult = {
3798
4181
  sources: new Map(),
3799
- runtimeRequirements: null
4182
+ runtimeRequirements: null,
4183
+ data: undefined
3800
4184
  };
3801
4185
  }
3802
4186
  } else {
@@ -3830,6 +4214,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3830
4214
  }
3831
4215
 
3832
4216
  /**
4217
+ * Process runtime requirements.
3833
4218
  * @param {object} options options
3834
4219
  * @param {ChunkGraph=} options.chunkGraph the chunk graph
3835
4220
  * @param {Iterable<Module>=} options.modules modules
@@ -3973,6 +4358,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3973
4358
 
3974
4359
  // TODO webpack 6 make chunkGraph argument non-optional
3975
4360
  /**
4361
+ * Adds runtime module.
3976
4362
  * @param {Chunk} chunk target chunk
3977
4363
  * @param {RuntimeModule} module runtime module
3978
4364
  * @param {ChunkGraph} chunkGraph the chunk graph
@@ -4065,7 +4451,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4065
4451
  }
4066
4452
  const chunk = this.addChunk(name);
4067
4453
 
4068
- connectChunkGroupAndChunk(chunkGroup, chunk);
4454
+ if (chunkGroup.pushChunk(chunk)) {
4455
+ chunk.addGroup(chunkGroup);
4456
+ }
4069
4457
 
4070
4458
  this.chunkGroups.push(chunkGroup);
4071
4459
  if (name) {
@@ -4075,6 +4463,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4075
4463
  }
4076
4464
 
4077
4465
  /**
4466
+ * Adds the provided async entrypoint to this chunk group.
4078
4467
  * @param {EntryOptions} options options for the entrypoint
4079
4468
  * @param {Module} module the module the references the chunk group
4080
4469
  * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module)
@@ -4108,7 +4497,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4108
4497
  }
4109
4498
  this.chunkGroups.push(entrypoint);
4110
4499
  this.asyncEntrypoints.push(entrypoint);
4111
- connectChunkGroupAndChunk(entrypoint, chunk);
4500
+ if (entrypoint.pushChunk(chunk)) {
4501
+ chunk.addGroup(entrypoint);
4502
+ }
4112
4503
  if (module) {
4113
4504
  entrypoint.addOrigin(module, loc, request);
4114
4505
  }
@@ -4140,6 +4531,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4140
4531
  }
4141
4532
 
4142
4533
  /**
4534
+ * Processes the provided module.
4143
4535
  * @deprecated
4144
4536
  * @param {Module} module module to assign depth
4145
4537
  * @returns {void}
@@ -4154,6 +4546,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4154
4546
  moduleGraph.setDepth(module, 0);
4155
4547
 
4156
4548
  /**
4549
+ * Processes the provided module.
4157
4550
  * @param {Module} module module for processing
4158
4551
  * @returns {void}
4159
4552
  */
@@ -4176,7 +4569,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4176
4569
  }
4177
4570
 
4178
4571
  /**
4179
- * @param {Module[] | Set<Module>} modules module to assign depth
4572
+ * Assigns depth values to the provided modules.
4573
+ * @param {Module[] | Set<Module>} modules modules to assign depth
4180
4574
  * @returns {void}
4181
4575
  */
4182
4576
  assignDepths(modules) {
@@ -4210,6 +4604,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4210
4604
  }
4211
4605
 
4212
4606
  /**
4607
+ * Gets dependency referenced exports.
4213
4608
  * @param {Dependency} dependency the dependency
4214
4609
  * @param {RuntimeSpec} runtime the runtime
4215
4610
  * @returns {ReferencedExports} referenced exports
@@ -4227,6 +4622,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4227
4622
  }
4228
4623
 
4229
4624
  /**
4625
+ * Removes reasons of dependency block.
4230
4626
  * @param {Module} module module relationship for removal
4231
4627
  * @param {DependenciesBlockLike} block dependencies block
4232
4628
  * @returns {void}
@@ -4257,6 +4653,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4257
4653
  }
4258
4654
 
4259
4655
  /**
4656
+ * Patch chunks after reason removal.
4260
4657
  * @param {Module} module module to patch tie
4261
4658
  * @param {Chunk} chunk chunk to patch tie
4262
4659
  * @returns {void}
@@ -4275,12 +4672,14 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4275
4672
  }
4276
4673
 
4277
4674
  /**
4675
+ * Removes chunk from dependencies.
4278
4676
  * @param {DependenciesBlock} block block tie for Chunk
4279
4677
  * @param {Chunk} chunk chunk to remove from dep
4280
4678
  * @returns {void}
4281
4679
  */
4282
4680
  removeChunkFromDependencies(block, chunk) {
4283
4681
  /**
4682
+ * Iterator dependency.
4284
4683
  * @param {Dependency} d dependency to (maybe) patch up
4285
4684
  */
4286
4685
  const iteratorDependency = (d) => {
@@ -4314,6 +4713,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4314
4713
  assignRuntimeIds() {
4315
4714
  const { chunkGraph } = this;
4316
4715
  /**
4716
+ * Process entrypoint.
4317
4717
  * @param {Entrypoint} ep an entrypoint
4318
4718
  */
4319
4719
  const processEntrypoint = (ep) => {
@@ -4367,10 +4767,13 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4367
4767
  for (const module of this.modules) {
4368
4768
  const memCache = moduleMemCaches2 && moduleMemCaches2.get(module);
4369
4769
  for (const runtime of chunkGraph.getModuleRuntimes(module)) {
4770
+ const cacheKey = memCache
4771
+ ? `moduleHash-${getRuntimeKey(runtime)}`
4772
+ : undefined;
4370
4773
  if (memCache) {
4371
4774
  const digest =
4372
4775
  /** @type {string} */
4373
- (memCache.get(`moduleHash-${getRuntimeKey(runtime)}`));
4776
+ (memCache.get(/** @type {string} */ (cacheKey)));
4374
4777
  if (digest !== undefined) {
4375
4778
  chunkGraph.setModuleHashes(
4376
4779
  module,
@@ -4394,7 +4797,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4394
4797
  errors
4395
4798
  );
4396
4799
  if (memCache) {
4397
- memCache.set(`moduleHash-${getRuntimeKey(runtime)}`, digest);
4800
+ memCache.set(/** @type {string} */ (cacheKey), digest);
4398
4801
  }
4399
4802
  }
4400
4803
  }
@@ -4416,6 +4819,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
4416
4819
  }
4417
4820
 
4418
4821
  /**
4822
+ * Create module hash.
4419
4823
  * @private
4420
4824
  * @param {Module} module module
4421
4825
  * @param {ChunkGraph} chunkGraph the chunk graph
@@ -4630,6 +5034,7 @@ This prevents using hashes of each other and should be avoided.`);
4630
5034
  const errors = [];
4631
5035
 
4632
5036
  /**
5037
+ * Processes the provided chunk.
4633
5038
  * @param {Chunk} chunk chunk
4634
5039
  */
4635
5040
  const processChunk = (chunk) => {
@@ -4762,12 +5167,18 @@ This prevents using hashes of each other and should be avoided.`);
4762
5167
  }
4763
5168
 
4764
5169
  /**
5170
+ * Processes the provided file.
4765
5171
  * @param {string} file file name
4766
5172
  * @param {Source} source asset source
4767
5173
  * @param {AssetInfo} assetInfo extra asset information
4768
5174
  * @returns {void}
4769
5175
  */
4770
5176
  emitAsset(file, source, assetInfo = {}) {
5177
+ // A file may be attached to a chunk right after any emit (including the
5178
+ // re-emit path for assets shared across chunks in createChunkAssets), so
5179
+ // the lazily-built reverse index is stale after every emitAsset.
5180
+ this._assetToChunkIndex = undefined;
5181
+ this._assetToChunkAuxiliaryIndex = undefined;
4771
5182
  if (this.assets[file]) {
4772
5183
  if (!isSourceEqual(this.assets[file], source)) {
4773
5184
  this.errors.push(
@@ -4793,6 +5204,7 @@ This prevents using hashes of each other and should be avoided.`);
4793
5204
  }
4794
5205
 
4795
5206
  /**
5207
+ * Processes the provided file.
4796
5208
  * @private
4797
5209
  * @param {string} file file name
4798
5210
  * @param {AssetInfo=} newInfo new asset information
@@ -4809,6 +5221,7 @@ This prevents using hashes of each other and should be avoided.`);
4809
5221
  if (oldRelated) {
4810
5222
  for (const key of Object.keys(oldRelated)) {
4811
5223
  /**
5224
+ * Processes the provided name.
4812
5225
  * @param {string} name name
4813
5226
  */
4814
5227
  const remove = (name) => {
@@ -4834,6 +5247,7 @@ This prevents using hashes of each other and should be avoided.`);
4834
5247
  if (newRelated) {
4835
5248
  for (const key of Object.keys(newRelated)) {
4836
5249
  /**
5250
+ * Processes the provided name.
4837
5251
  * @param {string} name name
4838
5252
  */
4839
5253
  const add = (name) => {
@@ -4860,6 +5274,7 @@ This prevents using hashes of each other and should be avoided.`);
4860
5274
  }
4861
5275
 
4862
5276
  /**
5277
+ * Updates asset using the provided file.
4863
5278
  * @param {string} file file name
4864
5279
  * @param {Source | ((source: Source) => Source)} newSourceOrFunction new asset source or function converting old to new
4865
5280
  * @param {(AssetInfo | ((assetInfo?: AssetInfo) => AssetInfo | undefined)) | undefined} assetInfoUpdateOrFunction new asset info or function converting old to new
@@ -4893,6 +5308,7 @@ This prevents using hashes of each other and should be avoided.`);
4893
5308
  }
4894
5309
 
4895
5310
  /**
5311
+ * Processes the provided file.
4896
5312
  * @param {string} file file name
4897
5313
  * @param {string} newFile the new name of file
4898
5314
  */
@@ -4944,25 +5360,99 @@ This prevents using hashes of each other and should be avoided.`);
4944
5360
  this._setAssetInfo(newFile, assetInfo);
4945
5361
  delete this.assets[file];
4946
5362
  this.assets[newFile] = source;
5363
+ this._buildAssetToChunkIndex();
5364
+ const index = /** @type {Map<string, Set<Chunk>>} */ (
5365
+ this._assetToChunkIndex
5366
+ );
5367
+ const auxiliaryIndex = /** @type {Map<string, Set<Chunk>>} */ (
5368
+ this._assetToChunkAuxiliaryIndex
5369
+ );
5370
+ const chunks = index.get(file);
5371
+ const auxiliaryChunks = auxiliaryIndex.get(file);
5372
+ if (chunks === undefined && auxiliaryChunks === undefined) {
5373
+ // Not tracked in either index: chunk sets may have been mutated
5374
+ // directly (bypassing emitAsset), so scan all chunks to stay correct.
5375
+ for (const chunk of this.chunks) {
5376
+ this._renameAssetInChunk(chunk, chunk.files, index, file, newFile);
5377
+ this._renameAssetInChunk(
5378
+ chunk,
5379
+ chunk.auxiliaryFiles,
5380
+ auxiliaryIndex,
5381
+ file,
5382
+ newFile
5383
+ );
5384
+ }
5385
+ return;
5386
+ }
5387
+ if (chunks !== undefined) {
5388
+ index.delete(file);
5389
+ for (const chunk of chunks) {
5390
+ this._renameAssetInChunk(chunk, chunk.files, index, file, newFile);
5391
+ }
5392
+ }
5393
+ if (auxiliaryChunks !== undefined) {
5394
+ auxiliaryIndex.delete(file);
5395
+ for (const chunk of auxiliaryChunks) {
5396
+ this._renameAssetInChunk(
5397
+ chunk,
5398
+ chunk.auxiliaryFiles,
5399
+ auxiliaryIndex,
5400
+ file,
5401
+ newFile
5402
+ );
5403
+ }
5404
+ }
5405
+ }
5406
+
5407
+ // Lazily build the reverse index file -> chunks. emitAsset() invalidates
5408
+ // it, so chunk.files / chunk.auxiliaryFiles entries added alongside a newly
5409
+ // emitted asset are always picked up on the next rebuild.
5410
+ /**
5411
+ * @private
5412
+ * @returns {void}
5413
+ */
5414
+ _buildAssetToChunkIndex() {
5415
+ if (this._assetToChunkIndex !== undefined) return;
5416
+ /** @type {Map<string, Set<Chunk>>} */
5417
+ const filesIndex = new Map();
5418
+ /** @type {Map<string, Set<Chunk>>} */
5419
+ const auxiliaryIndex = new Map();
4947
5420
  for (const chunk of this.chunks) {
4948
- {
4949
- const size = chunk.files.size;
4950
- chunk.files.delete(file);
4951
- if (size !== chunk.files.size) {
4952
- chunk.files.add(newFile);
4953
- }
5421
+ for (const file of chunk.files) {
5422
+ let set = filesIndex.get(file);
5423
+ if (set === undefined) filesIndex.set(file, (set = new Set()));
5424
+ set.add(chunk);
4954
5425
  }
4955
- {
4956
- const size = chunk.auxiliaryFiles.size;
4957
- chunk.auxiliaryFiles.delete(file);
4958
- if (size !== chunk.auxiliaryFiles.size) {
4959
- chunk.auxiliaryFiles.add(newFile);
4960
- }
5426
+ for (const file of chunk.auxiliaryFiles) {
5427
+ let set = auxiliaryIndex.get(file);
5428
+ if (set === undefined) auxiliaryIndex.set(file, (set = new Set()));
5429
+ set.add(chunk);
4961
5430
  }
4962
5431
  }
5432
+ this._assetToChunkIndex = filesIndex;
5433
+ this._assetToChunkAuxiliaryIndex = auxiliaryIndex;
5434
+ }
5435
+
5436
+ /**
5437
+ * @private
5438
+ * @param {Chunk} chunk the chunk owning the set
5439
+ * @param {Set<string>} set chunk.files or chunk.auxiliaryFiles
5440
+ * @param {Map<string, Set<Chunk>>} index matching reverse index
5441
+ * @param {string} file old file name
5442
+ * @param {string} newFile new file name
5443
+ * @returns {void}
5444
+ */
5445
+ _renameAssetInChunk(chunk, set, index, file, newFile) {
5446
+ // Only carry the rename to chunks that actually held the old name.
5447
+ if (!set.delete(file)) return;
5448
+ set.add(newFile);
5449
+ let target = index.get(newFile);
5450
+ if (target === undefined) index.set(newFile, (target = new Set()));
5451
+ target.add(chunk);
4963
5452
  }
4964
5453
 
4965
5454
  /**
5455
+ * Processes the provided file.
4966
5456
  * @param {string} file file name
4967
5457
  */
4968
5458
  deleteAsset(file) {
@@ -4976,6 +5466,7 @@ This prevents using hashes of each other and should be avoided.`);
4976
5466
  if (related) {
4977
5467
  for (const key of Object.keys(related)) {
4978
5468
  /**
5469
+ * Checks used and delete.
4979
5470
  * @param {string} file file
4980
5471
  */
4981
5472
  const checkUsedAndDelete = (file) => {
@@ -4993,11 +5484,31 @@ This prevents using hashes of each other and should be avoided.`);
4993
5484
  }
4994
5485
  }
4995
5486
  }
4996
- // TODO If this becomes a performance problem
4997
- // store a reverse mapping from asset to chunk
4998
- for (const chunk of this.chunks) {
4999
- chunk.files.delete(file);
5000
- chunk.auxiliaryFiles.delete(file);
5487
+ this._buildAssetToChunkIndex();
5488
+ const index = /** @type {Map<string, Set<Chunk>>} */ (
5489
+ this._assetToChunkIndex
5490
+ );
5491
+ const auxiliaryIndex = /** @type {Map<string, Set<Chunk>>} */ (
5492
+ this._assetToChunkAuxiliaryIndex
5493
+ );
5494
+ const chunks = index.get(file);
5495
+ const auxiliaryChunks = auxiliaryIndex.get(file);
5496
+ if (chunks === undefined && auxiliaryChunks === undefined) {
5497
+ // Not tracked in either index: chunk sets may have been mutated
5498
+ // directly (bypassing emitAsset), so scan all chunks to stay correct.
5499
+ for (const chunk of this.chunks) {
5500
+ chunk.files.delete(file);
5501
+ chunk.auxiliaryFiles.delete(file);
5502
+ }
5503
+ return;
5504
+ }
5505
+ if (chunks !== undefined) {
5506
+ for (const chunk of chunks) chunk.files.delete(file);
5507
+ index.delete(file);
5508
+ }
5509
+ if (auxiliaryChunks !== undefined) {
5510
+ for (const chunk of auxiliaryChunks) chunk.auxiliaryFiles.delete(file);
5511
+ auxiliaryIndex.delete(file);
5001
5512
  }
5002
5513
  }
5003
5514
 
@@ -5017,6 +5528,7 @@ This prevents using hashes of each other and should be avoided.`);
5017
5528
  }
5018
5529
 
5019
5530
  /**
5531
+ * Returns the asset or undefined when not found.
5020
5532
  * @param {string} name the name of the asset
5021
5533
  * @returns {Readonly<Asset> | undefined} the asset or undefined when not found
5022
5534
  */
@@ -5034,6 +5546,8 @@ This prevents using hashes of each other and should be avoided.`);
5034
5546
  chunk.files.clear();
5035
5547
  chunk.auxiliaryFiles.clear();
5036
5548
  }
5549
+ this._assetToChunkIndex = undefined;
5550
+ this._assetToChunkAuxiliaryIndex = undefined;
5037
5551
  }
5038
5552
 
5039
5553
  createModuleAssets() {
@@ -5062,6 +5576,7 @@ This prevents using hashes of each other and should be avoided.`);
5062
5576
  }
5063
5577
 
5064
5578
  /**
5579
+ * Gets render manifest.
5065
5580
  * @param {RenderManifestOptions} options options object
5066
5581
  * @returns {RenderManifestEntry[]} manifest entries
5067
5582
  */
@@ -5070,6 +5585,7 @@ This prevents using hashes of each other and should be avoided.`);
5070
5585
  }
5071
5586
 
5072
5587
  /**
5588
+ * Creates a chunk assets.
5073
5589
  * @param {Callback} callback signals when the call finishes
5074
5590
  * @returns {void}
5075
5591
  */
@@ -5119,7 +5635,7 @@ This prevents using hashes of each other and should be avoided.`);
5119
5635
  );
5120
5636
 
5121
5637
  assetCacheItem.get((err, sourceFromCache) => {
5122
- /** @type {TemplatePath} */
5638
+ /** @type {string | import("./TemplatedPathPlugin").TemplatePathFn<EXPECTED_ANY>} */
5123
5639
  let filenameTemplate;
5124
5640
  /** @type {string} */
5125
5641
  let file;
@@ -5128,6 +5644,7 @@ This prevents using hashes of each other and should be avoided.`);
5128
5644
 
5129
5645
  let inTry = true;
5130
5646
  /**
5647
+ * Error and callback.
5131
5648
  * @param {Error} err error
5132
5649
  * @returns {void}
5133
5650
  */
@@ -5235,11 +5752,13 @@ This prevents using hashes of each other and should be avoided.`);
5235
5752
  }
5236
5753
 
5237
5754
  /**
5238
- * @param {TemplatePath} filename used to get asset path with hash
5239
- * @param {PathData} data context data
5755
+ * Returns interpolated path.
5756
+ * @template {PathData} [T=PathData]
5757
+ * @param {string | import("./TemplatedPathPlugin").TemplatePathFn<T>} filename used to get asset path with hash
5758
+ * @param {T=} data context data
5240
5759
  * @returns {string} interpolated path
5241
5760
  */
5242
- getPath(filename, data = {}) {
5761
+ getPath(filename, data = /** @type {T} */ ({})) {
5243
5762
  if (!data.hash) {
5244
5763
  data = {
5245
5764
  hash: this.hash,
@@ -5250,11 +5769,13 @@ This prevents using hashes of each other and should be avoided.`);
5250
5769
  }
5251
5770
 
5252
5771
  /**
5253
- * @param {TemplatePath} filename used to get asset path with hash
5254
- * @param {PathData} data context data
5772
+ * Gets path with info.
5773
+ * @template {PathData} [T=PathData]
5774
+ * @param {string | import("./TemplatedPathPlugin").TemplatePathFn<T>} filename used to get asset path with hash
5775
+ * @param {T=} data context data
5255
5776
  * @returns {InterpolatedPathAndAssetInfo} interpolated path and asset info
5256
5777
  */
5257
- getPathWithInfo(filename, data = {}) {
5778
+ getPathWithInfo(filename, data = /** @type {T} */ ({})) {
5258
5779
  if (!data.hash) {
5259
5780
  data = {
5260
5781
  hash: this.hash,
@@ -5265,8 +5786,10 @@ This prevents using hashes of each other and should be avoided.`);
5265
5786
  }
5266
5787
 
5267
5788
  /**
5268
- * @param {TemplatePath} filename used to get asset path with hash
5269
- * @param {PathData} data context data
5789
+ * Returns interpolated path.
5790
+ * @template {PathData} [T=PathData]
5791
+ * @param {string | import("./TemplatedPathPlugin").TemplatePathFn<T>} filename used to get asset path with hash
5792
+ * @param {T} data context data
5270
5793
  * @returns {string} interpolated path
5271
5794
  */
5272
5795
  getAssetPath(filename, data) {
@@ -5278,8 +5801,10 @@ This prevents using hashes of each other and should be avoided.`);
5278
5801
  }
5279
5802
 
5280
5803
  /**
5281
- * @param {TemplatePath} filename used to get asset path with hash
5282
- * @param {PathData} data context data
5804
+ * Gets asset path with info.
5805
+ * @template {PathData} [T=PathData]
5806
+ * @param {string | import("./TemplatedPathPlugin").TemplatePathFn<T>} filename used to get asset path with hash
5807
+ * @param {T} data context data
5283
5808
  * @returns {InterpolatedPathAndAssetInfo} interpolated path and asset info
5284
5809
  */
5285
5810
  getAssetPathWithInfo(filename, data) {
@@ -5323,6 +5848,7 @@ This prevents using hashes of each other and should be avoided.`);
5323
5848
  }
5324
5849
 
5325
5850
  /**
5851
+ * Processes the provided module.
5326
5852
  * @param {Module} module the module
5327
5853
  * @param {ExecuteModuleOptions} options options
5328
5854
  * @param {ExecuteModuleCallback} callback callback
@@ -5373,7 +5899,9 @@ This prevents using hashes of each other and should be avoided.`);
5373
5899
  ...options.entryOptions
5374
5900
  });
5375
5901
  chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
5376
- connectChunkGroupAndChunk(entrypoint, chunk);
5902
+ if (entrypoint.pushChunk(chunk)) {
5903
+ chunk.addGroup(entrypoint);
5904
+ }
5377
5905
  entrypoint.setRuntimeChunk(chunk);
5378
5906
  entrypoint.setEntrypointChunk(chunk);
5379
5907
 
@@ -5407,6 +5935,7 @@ This prevents using hashes of each other and should be avoided.`);
5407
5935
  this.outputOptions.hashFunction
5408
5936
  );
5409
5937
  /**
5938
+ * Processes the provided module.
5410
5939
  * @param {Module} module the module
5411
5940
  * @param {Callback} callback callback
5412
5941
  * @returns {void}
@@ -5512,6 +6041,8 @@ This prevents using hashes of each other and should be avoided.`);
5512
6041
  const assets = new Map();
5513
6042
 
5514
6043
  let cacheable = true;
6044
+ /** @type {ExecuteModuleResult["notCacheableReasons"]} */
6045
+ const notCacheableReasons = [];
5515
6046
 
5516
6047
  /** @type {ExecuteModuleContext} */
5517
6048
  const context = {
@@ -5547,11 +6078,18 @@ This prevents using hashes of each other and should be avoided.`);
5547
6078
  missingDependencies,
5548
6079
  buildDependencies
5549
6080
  );
5550
- if (
5551
- /** @type {BuildInfo} */ (module.buildInfo).cacheable ===
5552
- false
5553
- ) {
6081
+ const buildInfo = /** @type {BuildInfo} */ (
6082
+ module.buildInfo
6083
+ );
6084
+ if (buildInfo.cacheable === false) {
5554
6085
  cacheable = false;
6086
+ if (buildInfo.notCacheableReasons) {
6087
+ for (const reason of buildInfo.notCacheableReasons) {
6088
+ if (!notCacheableReasons.includes(reason)) {
6089
+ notCacheableReasons.push(reason);
6090
+ }
6091
+ }
6092
+ }
5555
6093
  }
5556
6094
  if (module.buildInfo && module.buildInfo.assets) {
5557
6095
  const { assets: moduleAssets, assetsInfo } =
@@ -5617,6 +6155,7 @@ This prevents using hashes of each other and should be avoided.`);
5617
6155
  context.__webpack_require__ = __webpack_require__;
5618
6156
 
5619
6157
  /**
6158
+ * Webpack require module.
5620
6159
  * @param {ExecuteModuleArgument} moduleArgument the module argument
5621
6160
  * @param {string=} id id
5622
6161
  * @returns {ExecuteModuleExports} exports
@@ -5702,6 +6241,7 @@ This prevents using hashes of each other and should be avoided.`);
5702
6241
  exports,
5703
6242
  assets,
5704
6243
  cacheable,
6244
+ notCacheableReasons,
5705
6245
  fileDependencies,
5706
6246
  contextDependencies,
5707
6247
  missingDependencies,
@@ -5759,6 +6299,7 @@ This prevents using hashes of each other and should be avoided.`);
5759
6299
  }
5760
6300
 
5761
6301
  /**
6302
+ * Defines the factorize module options type used by this module.
5762
6303
  * @typedef {object} FactorizeModuleOptions
5763
6304
  * @property {ModuleProfile=} currentProfile
5764
6305
  * @property {ModuleFactory} factory
@@ -5770,6 +6311,7 @@ This prevents using hashes of each other and should be avoided.`);
5770
6311
  */
5771
6312
 
5772
6313
  /**
6314
+ * Processes the provided factorize module option.
5773
6315
  * @param {FactorizeModuleOptions} options options object
5774
6316
  * @param {ModuleCallback | ModuleFactoryResultCallback} callback callback
5775
6317
  * @returns {void}
@@ -5796,6 +6338,7 @@ Object.defineProperty(compilationPrototype, "cache", {
5796
6338
  configurable: false,
5797
6339
  get: util.deprecate(
5798
6340
  /**
6341
+ * Returns the cache.
5799
6342
  * @this {Compilation} the compilation
5800
6343
  * @returns {Cache} the cache
5801
6344
  */
@@ -5807,6 +6350,7 @@ Object.defineProperty(compilationPrototype, "cache", {
5807
6350
  ),
5808
6351
  set: util.deprecate(
5809
6352
  /**
6353
+ * Handles the value callback for this hook.
5810
6354
  * @param {EXPECTED_ANY} _v value
5811
6355
  */
5812
6356
  (_v) => {},