webpack 5.106.0 → 5.106.2

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 (553) hide show
  1. package/lib/APIPlugin.js +3 -1
  2. package/lib/AbstractMethodError.js +10 -1
  3. package/lib/AsyncDependenciesBlock.js +3 -0
  4. package/lib/AsyncDependencyToInitialChunkError.js +6 -1
  5. package/lib/AutomaticPrefetchPlugin.js +6 -1
  6. package/lib/BannerPlugin.js +10 -1
  7. package/lib/Cache.js +26 -1
  8. package/lib/CacheFacade.js +26 -0
  9. package/lib/CaseSensitiveModulesWarning.js +9 -1
  10. package/lib/Chunk.js +46 -0
  11. package/lib/ChunkGraph.js +111 -0
  12. package/lib/ChunkGroup.js +57 -13
  13. package/lib/ChunkTemplate.js +9 -0
  14. package/lib/CleanPlugin.js +14 -1
  15. package/lib/CodeGenerationResults.js +19 -0
  16. package/lib/CommentCompilationWarning.js +6 -0
  17. package/lib/CompatibilityPlugin.js +15 -1
  18. package/lib/Compilation.js +127 -1
  19. package/lib/Compiler.js +37 -4
  20. package/lib/ConcatenationScope.js +24 -1
  21. package/lib/ConditionalInitFragment.js +6 -0
  22. package/lib/ConstPlugin.js +4 -1
  23. package/lib/ContextExclusionPlugin.js +2 -1
  24. package/lib/ContextModule.js +12 -0
  25. package/lib/ContextModuleFactory.js +10 -0
  26. package/lib/ContextReplacementPlugin.js +4 -1
  27. package/lib/CssModule.js +6 -0
  28. package/lib/DefinePlugin.js +20 -7
  29. package/lib/DelegatedModule.js +13 -0
  30. package/lib/DelegatedModuleFactoryPlugin.js +3 -0
  31. package/lib/DelegatedPlugin.js +2 -1
  32. package/lib/DependenciesBlock.js +6 -1
  33. package/lib/Dependency.js +26 -3
  34. package/lib/DependencyTemplate.js +5 -0
  35. package/lib/DependencyTemplates.js +4 -0
  36. package/lib/DllEntryPlugin.js +2 -1
  37. package/lib/DllModule.js +11 -0
  38. package/lib/DllModuleFactory.js +1 -0
  39. package/lib/DllPlugin.js +2 -1
  40. package/lib/DllReferencePlugin.js +11 -6
  41. package/lib/DotenvPlugin.js +3 -0
  42. package/lib/DynamicEntryPlugin.js +3 -1
  43. package/lib/EntryOptionPlugin.js +3 -0
  44. package/lib/EntryPlugin.js +2 -1
  45. package/lib/Entrypoint.js +4 -0
  46. package/lib/EnvironmentPlugin.js +2 -1
  47. package/lib/ErrorHelpers.js +7 -0
  48. package/lib/EvalDevToolModulePlugin.js +3 -1
  49. package/lib/EvalSourceMapDevToolPlugin.js +3 -1
  50. package/lib/ExportsInfo.js +56 -2
  51. package/lib/ExportsInfoApiPlugin.js +2 -1
  52. package/lib/ExternalModule.js +38 -0
  53. package/lib/ExternalModuleFactoryPlugin.js +10 -0
  54. package/lib/ExternalsPlugin.js +2 -1
  55. package/lib/FileSystemInfo.js +105 -0
  56. package/lib/FlagAllModulesAsUsedPlugin.js +2 -1
  57. package/lib/FlagDependencyExportsPlugin.js +4 -1
  58. package/lib/FlagDependencyUsagePlugin.js +5 -1
  59. package/lib/FlagEntryExportAsUsedPlugin.js +2 -1
  60. package/lib/Generator.js +13 -0
  61. package/lib/GraphHelpers.js +3 -0
  62. package/lib/HookWebpackError.js +6 -0
  63. package/lib/HotModuleReplacementPlugin.js +9 -1
  64. package/lib/IgnoreErrorModuleFactory.js +2 -0
  65. package/lib/IgnorePlugin.js +2 -1
  66. package/lib/IgnoreWarningsPlugin.js +2 -1
  67. package/lib/InitFragment.js +10 -0
  68. package/lib/InvalidDependenciesModuleWarning.js +1 -0
  69. package/lib/JavascriptMetaInfoPlugin.js +2 -1
  70. package/lib/LibManifestPlugin.js +4 -1
  71. package/lib/LibraryTemplatePlugin.js +2 -1
  72. package/lib/LoaderOptionsPlugin.js +3 -1
  73. package/lib/LoaderTargetPlugin.js +2 -1
  74. package/lib/MainTemplate.js +15 -0
  75. package/lib/ManifestPlugin.js +9 -2
  76. package/lib/Module.js +82 -4
  77. package/lib/ModuleBuildError.js +3 -0
  78. package/lib/ModuleDependencyWarning.js +1 -0
  79. package/lib/ModuleError.js +2 -0
  80. package/lib/ModuleFactory.js +5 -0
  81. package/lib/ModuleFilenameHelpers.js +3 -0
  82. package/lib/ModuleGraph.js +66 -0
  83. package/lib/ModuleGraphConnection.js +9 -0
  84. package/lib/ModuleInfoHeaderPlugin.js +5 -0
  85. package/lib/ModuleNotFoundError.js +1 -0
  86. package/lib/ModuleParseError.js +3 -0
  87. package/lib/ModuleRestoreError.js +1 -0
  88. package/lib/ModuleSourceTypeConstants.js +1 -0
  89. package/lib/ModuleStoreError.js +1 -0
  90. package/lib/ModuleTemplate.js +8 -0
  91. package/lib/ModuleWarning.js +3 -0
  92. package/lib/MultiCompiler.js +28 -0
  93. package/lib/MultiStats.js +8 -0
  94. package/lib/MultiWatching.js +3 -0
  95. package/lib/NoEmitOnErrorsPlugin.js +1 -1
  96. package/lib/NodeStuffInWebError.js +1 -0
  97. package/lib/NodeStuffPlugin.js +10 -1
  98. package/lib/NormalModule.js +30 -2
  99. package/lib/NormalModuleFactory.js +25 -0
  100. package/lib/NormalModuleReplacementPlugin.js +1 -1
  101. package/lib/NullFactory.js +1 -0
  102. package/lib/OptionsApply.js +1 -0
  103. package/lib/Parser.js +2 -0
  104. package/lib/PlatformPlugin.js +2 -1
  105. package/lib/PrefetchPlugin.js +2 -1
  106. package/lib/ProgressPlugin.js +29 -12
  107. package/lib/ProvidePlugin.js +3 -1
  108. package/lib/RawModule.js +12 -0
  109. package/lib/RecordIdsPlugin.js +8 -0
  110. package/lib/RequestShortener.js +8 -0
  111. package/lib/RequireJsStuffPlugin.js +2 -1
  112. package/lib/ResolverFactory.js +5 -0
  113. package/lib/RuntimeGlobals.js +1 -0
  114. package/lib/RuntimeModule.js +13 -0
  115. package/lib/RuntimePlugin.js +2 -0
  116. package/lib/RuntimeTemplate.js +35 -1
  117. package/lib/SelfModuleFactory.js +2 -0
  118. package/lib/SizeFormatHelpers.js +1 -0
  119. package/lib/SourceMapDevToolModuleOptionsPlugin.js +2 -0
  120. package/lib/SourceMapDevToolPlugin.js +3 -1
  121. package/lib/Stats.js +5 -0
  122. package/lib/Template.js +20 -0
  123. package/lib/TemplatedPathPlugin.js +10 -3
  124. package/lib/UnhandledSchemeError.js +6 -0
  125. package/lib/UnsupportedFeatureWarning.js +1 -0
  126. package/lib/UseStrictPlugin.js +2 -1
  127. package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
  128. package/lib/WarnDeprecatedOptionPlugin.js +1 -1
  129. package/lib/WarnNoModeSetPlugin.js +1 -1
  130. package/lib/WatchIgnorePlugin.js +4 -1
  131. package/lib/Watching.js +14 -0
  132. package/lib/WebpackError.js +3 -0
  133. package/lib/WebpackIsIncludedPlugin.js +2 -0
  134. package/lib/WebpackOptionsApply.js +1 -0
  135. package/lib/WebpackOptionsDefaulter.js +1 -0
  136. package/lib/asset/AssetBytesGenerator.js +6 -0
  137. package/lib/asset/AssetBytesParser.js +1 -0
  138. package/lib/asset/AssetGenerator.js +20 -2
  139. package/lib/asset/AssetModulesPlugin.js +4 -1
  140. package/lib/asset/AssetParser.js +2 -0
  141. package/lib/asset/AssetSourceGenerator.js +6 -0
  142. package/lib/asset/AssetSourceParser.js +1 -0
  143. package/lib/asset/RawDataUrlModule.js +11 -0
  144. package/lib/async-modules/AsyncModuleHelpers.js +1 -0
  145. package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -0
  146. package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
  147. package/lib/buildChunkGraph.js +15 -0
  148. package/lib/cache/AddBuildDependenciesPlugin.js +2 -1
  149. package/lib/cache/AddManagedPathsPlugin.js +2 -1
  150. package/lib/cache/IdleFileCachePlugin.js +2 -1
  151. package/lib/cache/MemoryCachePlugin.js +1 -1
  152. package/lib/cache/MemoryWithGcCachePlugin.js +3 -1
  153. package/lib/cache/PackFileCacheStrategy.js +29 -0
  154. package/lib/cache/ResolverCachePlugin.js +10 -1
  155. package/lib/cache/getLazyHashedEtag.js +4 -0
  156. package/lib/cache/mergeEtags.js +2 -0
  157. package/lib/cli.js +30 -0
  158. package/lib/config/browserslistTargetHandler.js +2 -0
  159. package/lib/config/defaults.js +35 -2
  160. package/lib/config/normalization.js +12 -0
  161. package/lib/config/target.js +11 -0
  162. package/lib/container/ContainerEntryDependency.js +2 -0
  163. package/lib/container/ContainerEntryModule.js +12 -0
  164. package/lib/container/ContainerEntryModuleFactory.js +1 -0
  165. package/lib/container/ContainerExposedDependency.js +4 -0
  166. package/lib/container/ContainerPlugin.js +2 -1
  167. package/lib/container/ContainerReferencePlugin.js +2 -1
  168. package/lib/container/FallbackDependency.js +4 -0
  169. package/lib/container/FallbackItemDependency.js +1 -0
  170. package/lib/container/FallbackModule.js +12 -0
  171. package/lib/container/FallbackModuleFactory.js +1 -0
  172. package/lib/container/ModuleFederationPlugin.js +3 -1
  173. package/lib/container/RemoteModule.js +13 -0
  174. package/lib/container/RemoteRuntimeModule.js +1 -0
  175. package/lib/container/RemoteToExternalDependency.js +1 -0
  176. package/lib/container/options.js +7 -0
  177. package/lib/css/CssGenerator.js +35 -14
  178. package/lib/css/CssInjectStyleRuntimeModule.js +1 -0
  179. package/lib/css/CssLoadingRuntimeModule.js +1 -0
  180. package/lib/css/CssMergeStyleSheetsRuntimeModule.js +1 -0
  181. package/lib/css/CssModulesPlugin.js +69 -3
  182. package/lib/css/CssParser.js +71 -1
  183. package/lib/css/walkCssTokens.js +31 -0
  184. package/lib/debug/ProfilingPlugin.js +19 -1
  185. package/lib/dependencies/AMDDefineDependency.js +7 -0
  186. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +12 -0
  187. package/lib/dependencies/AMDPlugin.js +4 -1
  188. package/lib/dependencies/AMDRequireArrayDependency.js +6 -0
  189. package/lib/dependencies/AMDRequireContextDependency.js +3 -0
  190. package/lib/dependencies/AMDRequireDependenciesBlock.js +1 -0
  191. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +13 -0
  192. package/lib/dependencies/AMDRequireDependency.js +4 -0
  193. package/lib/dependencies/AMDRequireItemDependency.js +1 -0
  194. package/lib/dependencies/AMDRuntimeModules.js +3 -0
  195. package/lib/dependencies/CachedConstDependency.js +6 -1
  196. package/lib/dependencies/CommonJsDependencyHelpers.js +1 -0
  197. package/lib/dependencies/CommonJsExportRequireDependency.js +8 -0
  198. package/lib/dependencies/CommonJsExportsDependency.js +4 -0
  199. package/lib/dependencies/CommonJsExportsParserPlugin.js +8 -0
  200. package/lib/dependencies/CommonJsFullRequireDependency.js +4 -0
  201. package/lib/dependencies/CommonJsImportsParserPlugin.js +20 -0
  202. package/lib/dependencies/CommonJsPlugin.js +4 -1
  203. package/lib/dependencies/CommonJsRequireContextDependency.js +3 -0
  204. package/lib/dependencies/CommonJsRequireDependency.js +3 -0
  205. package/lib/dependencies/CommonJsSelfReferenceDependency.js +5 -0
  206. package/lib/dependencies/ConstDependency.js +6 -1
  207. package/lib/dependencies/ContextDependency.js +8 -1
  208. package/lib/dependencies/ContextDependencyHelpers.js +3 -0
  209. package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
  210. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
  211. package/lib/dependencies/ContextElementDependency.js +4 -0
  212. package/lib/dependencies/CreateRequireParserPlugin.js +6 -0
  213. package/lib/dependencies/CreateScriptUrlDependency.js +4 -0
  214. package/lib/dependencies/CriticalDependencyWarning.js +1 -0
  215. package/lib/dependencies/CssIcssExportDependency.js +11 -3
  216. package/lib/dependencies/CssIcssImportDependency.js +4 -1
  217. package/lib/dependencies/CssIcssSymbolDependency.js +5 -1
  218. package/lib/dependencies/CssImportDependency.js +4 -0
  219. package/lib/dependencies/CssUrlDependency.js +7 -0
  220. package/lib/dependencies/DelegatedSourceDependency.js +1 -0
  221. package/lib/dependencies/DllEntryDependency.js +3 -0
  222. package/lib/dependencies/DynamicExports.js +5 -0
  223. package/lib/dependencies/EntryDependency.js +1 -0
  224. package/lib/dependencies/ExportsInfoDependency.js +6 -0
  225. package/lib/dependencies/ExternalModuleDependency.js +5 -0
  226. package/lib/dependencies/ExternalModuleInitFragment.js +3 -0
  227. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +4 -0
  228. package/lib/dependencies/HarmonyAcceptDependency.js +6 -0
  229. package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -0
  230. package/lib/dependencies/HarmonyCompatibilityDependency.js +1 -0
  231. package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -0
  232. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -0
  233. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -0
  234. package/lib/dependencies/HarmonyExportExpressionDependency.js +14 -5
  235. package/lib/dependencies/HarmonyExportHeaderDependency.js +4 -0
  236. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +33 -2
  237. package/lib/dependencies/HarmonyExportInitFragment.js +6 -0
  238. package/lib/dependencies/HarmonyExportSpecifierDependency.js +5 -0
  239. package/lib/dependencies/HarmonyExports.js +2 -0
  240. package/lib/dependencies/HarmonyImportDependency.js +11 -0
  241. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +9 -0
  242. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -0
  243. package/lib/dependencies/HarmonyImportSpecifierDependency.js +17 -2
  244. package/lib/dependencies/HarmonyModulesPlugin.js +4 -1
  245. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -0
  246. package/lib/dependencies/ImportContextDependency.js +4 -0
  247. package/lib/dependencies/ImportDependency.js +5 -0
  248. package/lib/dependencies/ImportEagerDependency.js +2 -0
  249. package/lib/dependencies/ImportMetaContextDependency.js +1 -0
  250. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +3 -0
  251. package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
  252. package/lib/dependencies/ImportMetaHotAcceptDependency.js +1 -0
  253. package/lib/dependencies/ImportMetaHotDeclineDependency.js +1 -0
  254. package/lib/dependencies/ImportMetaPlugin.js +6 -0
  255. package/lib/dependencies/ImportParserPlugin.js +7 -0
  256. package/lib/dependencies/ImportPhase.js +6 -2
  257. package/lib/dependencies/ImportPlugin.js +2 -1
  258. package/lib/dependencies/ImportWeakDependency.js +2 -0
  259. package/lib/dependencies/JsonExportsDependency.js +6 -1
  260. package/lib/dependencies/LoaderDependency.js +2 -0
  261. package/lib/dependencies/LoaderImportDependency.js +2 -0
  262. package/lib/dependencies/LoaderPlugin.js +4 -1
  263. package/lib/dependencies/LocalModule.js +4 -0
  264. package/lib/dependencies/LocalModuleDependency.js +4 -0
  265. package/lib/dependencies/LocalModulesHelpers.js +3 -0
  266. package/lib/dependencies/ModuleDecoratorDependency.js +7 -1
  267. package/lib/dependencies/ModuleDependency.js +7 -0
  268. package/lib/dependencies/ModuleDependencyTemplateAsId.js +1 -0
  269. package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
  270. package/lib/dependencies/ModuleHotAcceptDependency.js +1 -0
  271. package/lib/dependencies/ModuleHotDeclineDependency.js +1 -0
  272. package/lib/dependencies/ModuleInitFragmentDependency.js +4 -0
  273. package/lib/dependencies/NullDependency.js +2 -0
  274. package/lib/dependencies/PrefetchDependency.js +1 -0
  275. package/lib/dependencies/ProvidedDependency.js +6 -1
  276. package/lib/dependencies/PureExpressionDependency.js +7 -1
  277. package/lib/dependencies/RequireContextDependency.js +1 -0
  278. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -0
  279. package/lib/dependencies/RequireContextPlugin.js +2 -1
  280. package/lib/dependencies/RequireEnsureDependenciesBlock.js +1 -0
  281. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -0
  282. package/lib/dependencies/RequireEnsureDependency.js +4 -0
  283. package/lib/dependencies/RequireEnsureItemDependency.js +1 -0
  284. package/lib/dependencies/RequireEnsurePlugin.js +2 -1
  285. package/lib/dependencies/RequireHeaderDependency.js +4 -0
  286. package/lib/dependencies/RequireIncludeDependency.js +2 -0
  287. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -0
  288. package/lib/dependencies/RequireIncludePlugin.js +2 -1
  289. package/lib/dependencies/RequireResolveContextDependency.js +3 -0
  290. package/lib/dependencies/RequireResolveDependency.js +1 -0
  291. package/lib/dependencies/RequireResolveHeaderDependency.js +5 -0
  292. package/lib/dependencies/RuntimeRequirementsDependency.js +5 -1
  293. package/lib/dependencies/StaticExportsDependency.js +3 -0
  294. package/lib/dependencies/SystemPlugin.js +4 -1
  295. package/lib/dependencies/SystemRuntimeModule.js +1 -0
  296. package/lib/dependencies/URLContextDependency.js +3 -0
  297. package/lib/dependencies/URLDependency.js +6 -0
  298. package/lib/dependencies/URLPlugin.js +2 -0
  299. package/lib/dependencies/UnsupportedDependency.js +4 -0
  300. package/lib/dependencies/WebAssemblyExportImportedDependency.js +4 -0
  301. package/lib/dependencies/WebAssemblyImportDependency.js +4 -1
  302. package/lib/dependencies/WebpackIsIncludedDependency.js +2 -0
  303. package/lib/dependencies/WorkerDependency.js +6 -1
  304. package/lib/dependencies/WorkerPlugin.js +9 -1
  305. package/lib/dependencies/getFunctionExpression.js +1 -0
  306. package/lib/dependencies/processExportInfo.js +1 -0
  307. package/lib/electron/ElectronTargetPlugin.js +2 -1
  308. package/lib/esm/ExportWebpackRequireRuntimeModule.js +2 -0
  309. package/lib/esm/ModuleChunkFormatPlugin.js +5 -1
  310. package/lib/esm/ModuleChunkLoadingPlugin.js +3 -1
  311. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +5 -0
  312. package/lib/formatLocation.js +2 -0
  313. package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -0
  314. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -0
  315. package/lib/hmr/LazyCompilationPlugin.js +20 -1
  316. package/lib/hmr/lazyCompilationBackend.js +2 -0
  317. package/lib/ids/ChunkModuleIdRangePlugin.js +3 -1
  318. package/lib/ids/DeterministicChunkIdsPlugin.js +3 -1
  319. package/lib/ids/DeterministicModuleIdsPlugin.js +3 -1
  320. package/lib/ids/HashedModuleIdsPlugin.js +2 -1
  321. package/lib/ids/IdHelpers.js +20 -0
  322. package/lib/ids/NamedChunkIdsPlugin.js +3 -1
  323. package/lib/ids/NamedModuleIdsPlugin.js +3 -1
  324. package/lib/ids/NaturalChunkIdsPlugin.js +1 -1
  325. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  326. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -1
  327. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -1
  328. package/lib/ids/SyncModuleIdsPlugin.js +3 -1
  329. package/lib/index.js +5 -0
  330. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
  331. package/lib/javascript/BasicEvaluatedExpression.js +4 -2
  332. package/lib/javascript/ChunkFormatHelpers.js +2 -1
  333. package/lib/javascript/ChunkHelpers.js +1 -0
  334. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
  335. package/lib/javascript/EnableChunkLoadingPlugin.js +5 -1
  336. package/lib/javascript/JavascriptGenerator.js +10 -0
  337. package/lib/javascript/JavascriptModulesPlugin.js +23 -1
  338. package/lib/javascript/JavascriptParser.js +163 -0
  339. package/lib/javascript/JavascriptParserHelpers.js +6 -0
  340. package/lib/javascript/StartupHelpers.js +5 -0
  341. package/lib/json/JsonData.js +5 -0
  342. package/lib/json/JsonGenerator.js +21 -0
  343. package/lib/json/JsonModulesPlugin.js +1 -1
  344. package/lib/json/JsonParser.js +8 -10
  345. package/lib/library/AbstractLibraryPlugin.js +16 -1
  346. package/lib/library/AmdLibraryPlugin.js +8 -0
  347. package/lib/library/AssignLibraryPlugin.js +16 -0
  348. package/lib/library/EnableLibraryPlugin.js +7 -1
  349. package/lib/library/ExportPropertyLibraryPlugin.js +9 -0
  350. package/lib/library/JsonpLibraryPlugin.js +8 -0
  351. package/lib/library/ModuleLibraryPlugin.js +12 -1
  352. package/lib/library/SystemLibraryPlugin.js +8 -0
  353. package/lib/library/UmdLibraryPlugin.js +16 -0
  354. package/lib/logging/Logger.js +17 -0
  355. package/lib/logging/createConsoleLogger.js +7 -0
  356. package/lib/logging/runtime.js +2 -0
  357. package/lib/logging/truncateArgs.js +2 -0
  358. package/lib/node/CommonJsChunkLoadingPlugin.js +5 -1
  359. package/lib/node/NodeEnvironmentPlugin.js +3 -1
  360. package/lib/node/NodeSourcePlugin.js +1 -1
  361. package/lib/node/NodeTargetPlugin.js +2 -1
  362. package/lib/node/NodeTemplatePlugin.js +3 -1
  363. package/lib/node/NodeWatchFileSystem.js +2 -0
  364. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +3 -0
  365. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +4 -1
  366. package/lib/node/ReadFileCompileWasmPlugin.js +4 -1
  367. package/lib/node/RequireChunkLoadingRuntimeModule.js +3 -0
  368. package/lib/node/nodeConsole.js +3 -0
  369. package/lib/optimize/AggressiveMergingPlugin.js +3 -1
  370. package/lib/optimize/AggressiveSplittingPlugin.js +6 -1
  371. package/lib/optimize/ConcatenatedModule.js +11 -0
  372. package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -1
  373. package/lib/optimize/FlagIncludedChunksPlugin.js +2 -1
  374. package/lib/optimize/InnerGraph.js +15 -0
  375. package/lib/optimize/InnerGraphPlugin.js +3 -1
  376. package/lib/optimize/LimitChunkCountPlugin.js +9 -0
  377. package/lib/optimize/MangleExportsPlugin.js +5 -1
  378. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -0
  379. package/lib/optimize/MinChunkSizePlugin.js +2 -1
  380. package/lib/optimize/MinMaxSizeWarning.js +1 -0
  381. package/lib/optimize/ModuleConcatenationPlugin.js +21 -1
  382. package/lib/optimize/RealContentHashPlugin.js +16 -1
  383. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
  384. package/lib/optimize/RemoveParentModulesPlugin.js +3 -1
  385. package/lib/optimize/RuntimeChunkPlugin.js +2 -1
  386. package/lib/optimize/SideEffectsFlagPlugin.js +7 -1
  387. package/lib/optimize/SplitChunksPlugin.js +49 -1
  388. package/lib/performance/AssetsOverSizeLimitWarning.js +1 -0
  389. package/lib/performance/EntrypointsOverSizeLimitWarning.js +1 -0
  390. package/lib/performance/SizeLimitsPlugin.js +7 -1
  391. package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +1 -0
  392. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +6 -0
  393. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +1 -0
  394. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -0
  395. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -0
  396. package/lib/rules/BasicEffectRulePlugin.js +3 -0
  397. package/lib/rules/BasicMatcherRulePlugin.js +3 -0
  398. package/lib/rules/ObjectMatcherRulePlugin.js +3 -0
  399. package/lib/rules/RuleSetCompiler.js +18 -0
  400. package/lib/rules/UseEffectRulePlugin.js +6 -0
  401. package/lib/runtime/AsyncModuleRuntimeModule.js +1 -0
  402. package/lib/runtime/AutoPublicPathRuntimeModule.js +1 -0
  403. package/lib/runtime/BaseUriRuntimeModule.js +1 -0
  404. package/lib/runtime/ChunkNameRuntimeModule.js +1 -0
  405. package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +1 -0
  406. package/lib/runtime/CompatRuntimeModule.js +2 -0
  407. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -0
  408. package/lib/runtime/CreateScriptRuntimeModule.js +1 -0
  409. package/lib/runtime/CreateScriptUrlRuntimeModule.js +1 -0
  410. package/lib/runtime/DefinePropertyGettersRuntimeModule.js +1 -0
  411. package/lib/runtime/EnsureChunkRuntimeModule.js +1 -0
  412. package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -0
  413. package/lib/runtime/GetFullHashRuntimeModule.js +1 -0
  414. package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -0
  415. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -0
  416. package/lib/runtime/GlobalRuntimeModule.js +1 -0
  417. package/lib/runtime/HasOwnPropertyRuntimeModule.js +1 -0
  418. package/lib/runtime/HelperRuntimeModule.js +5 -0
  419. package/lib/runtime/LoadScriptRuntimeModule.js +1 -0
  420. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +2 -0
  421. package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +1 -0
  422. package/lib/runtime/NonceRuntimeModule.js +1 -0
  423. package/lib/runtime/OnChunksLoadedRuntimeModule.js +1 -0
  424. package/lib/runtime/PublicPathRuntimeModule.js +1 -0
  425. package/lib/runtime/RelativeUrlRuntimeModule.js +1 -0
  426. package/lib/runtime/RuntimeIdRuntimeModule.js +1 -0
  427. package/lib/runtime/StartupChunkDependenciesPlugin.js +13 -1
  428. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -0
  429. package/lib/runtime/StartupEntrypointRuntimeModule.js +1 -0
  430. package/lib/runtime/SystemContextRuntimeModule.js +1 -0
  431. package/lib/runtime/ToBinaryRuntimeModule.js +1 -0
  432. package/lib/schemes/DataUriPlugin.js +1 -1
  433. package/lib/schemes/FileUriPlugin.js +1 -1
  434. package/lib/schemes/HttpUriPlugin.js +43 -1
  435. package/lib/schemes/VirtualUrlPlugin.js +6 -1
  436. package/lib/serialization/AggregateErrorSerializer.js +2 -0
  437. package/lib/serialization/ArraySerializer.js +2 -0
  438. package/lib/serialization/BinaryMiddleware.js +20 -1
  439. package/lib/serialization/DateObjectSerializer.js +2 -0
  440. package/lib/serialization/ErrorObjectSerializer.js +3 -0
  441. package/lib/serialization/FileMiddleware.js +21 -0
  442. package/lib/serialization/MapObjectSerializer.js +2 -0
  443. package/lib/serialization/NullPrototypeObjectSerializer.js +2 -0
  444. package/lib/serialization/ObjectMiddleware.js +23 -0
  445. package/lib/serialization/PlainObjectSerializer.js +7 -0
  446. package/lib/serialization/RegExpObjectSerializer.js +2 -0
  447. package/lib/serialization/Serializer.js +5 -0
  448. package/lib/serialization/SerializerMiddleware.js +12 -0
  449. package/lib/serialization/SetObjectSerializer.js +2 -0
  450. package/lib/serialization/SingleItemMiddleware.js +3 -0
  451. package/lib/sharing/ConsumeSharedFallbackDependency.js +1 -0
  452. package/lib/sharing/ConsumeSharedModule.js +15 -0
  453. package/lib/sharing/ConsumeSharedPlugin.js +6 -1
  454. package/lib/sharing/ConsumeSharedRuntimeModule.js +1 -0
  455. package/lib/sharing/ProvideForSharedDependency.js +1 -0
  456. package/lib/sharing/ProvideSharedDependency.js +4 -0
  457. package/lib/sharing/ProvideSharedModule.js +11 -0
  458. package/lib/sharing/ProvideSharedModuleFactory.js +1 -0
  459. package/lib/sharing/ProvideSharedPlugin.js +4 -1
  460. package/lib/sharing/SharePlugin.js +2 -1
  461. package/lib/sharing/ShareRuntimeModule.js +1 -0
  462. package/lib/sharing/resolveMatchedConfigs.js +3 -0
  463. package/lib/sharing/utils.js +8 -0
  464. package/lib/stats/DefaultStatsFactoryPlugin.js +56 -1
  465. package/lib/stats/DefaultStatsPresetPlugin.js +11 -1
  466. package/lib/stats/DefaultStatsPrinterPlugin.js +37 -1
  467. package/lib/stats/StatsFactory.js +12 -0
  468. package/lib/stats/StatsPrinter.js +7 -0
  469. package/lib/url/URLParserPlugin.js +6 -0
  470. package/lib/util/AppendOnlyStackedSet.js +15 -0
  471. package/lib/util/ArrayHelpers.js +1 -0
  472. package/lib/util/ArrayQueue.js +10 -5
  473. package/lib/util/AsyncQueue.js +20 -0
  474. package/lib/util/IterableHelpers.js +3 -0
  475. package/lib/util/LazyBucketSortedSet.js +21 -0
  476. package/lib/util/LazySet.js +39 -0
  477. package/lib/util/ParallelismFactorCalculator.js +1 -0
  478. package/lib/util/Queue.js +6 -3
  479. package/lib/util/Semaphore.js +14 -1
  480. package/lib/util/SetHelpers.js +3 -0
  481. package/lib/util/SortableSet.js +6 -0
  482. package/lib/util/StackedCacheMap.js +20 -3
  483. package/lib/util/StackedMap.js +45 -0
  484. package/lib/util/StringXor.js +1 -1
  485. package/lib/util/TupleQueue.js +7 -3
  486. package/lib/util/TupleSet.js +13 -0
  487. package/lib/util/URLAbsoluteSpecifier.js +1 -0
  488. package/lib/util/WeakTupleMap.js +33 -0
  489. package/lib/util/binarySearchBounds.js +1 -0
  490. package/lib/util/cleverMerge.js +17 -0
  491. package/lib/util/comparators.js +31 -0
  492. package/lib/util/compileBooleanMatcher.js +9 -0
  493. package/lib/util/concatenate.js +6 -0
  494. package/lib/util/conventions.js +4 -0
  495. package/lib/util/dataURL.js +1 -0
  496. package/lib/util/deprecation.js +19 -0
  497. package/lib/util/deterministicGrouping.js +20 -0
  498. package/lib/util/extractSourceMap.js +1 -0
  499. package/lib/util/extractUrlAndGlobal.js +1 -0
  500. package/lib/util/findGraphRoots.js +5 -0
  501. package/lib/util/fs.js +63 -0
  502. package/lib/util/generateDebugId.js +1 -0
  503. package/lib/util/hash/BatchedHash.js +1 -0
  504. package/lib/util/hash/BulkUpdateHash.js +1 -0
  505. package/lib/util/hash/hash-digest.js +8 -0
  506. package/lib/util/hash/wasm-hash.js +5 -0
  507. package/lib/util/identifier.js +19 -0
  508. package/lib/util/magicComment.js +1 -0
  509. package/lib/util/makeSerializable.js +6 -0
  510. package/lib/util/memoize.js +2 -0
  511. package/lib/util/mimeTypes.js +176 -0
  512. package/lib/util/nonNumericOnlyHash.js +1 -0
  513. package/lib/util/parseJson.js +112 -0
  514. package/lib/util/processAsyncTree.js +8 -0
  515. package/lib/util/property.js +1 -0
  516. package/lib/util/registerExternalSerializer.js +20 -0
  517. package/lib/util/removeBOM.js +1 -0
  518. package/lib/util/runtime.js +32 -0
  519. package/lib/util/semver.js +15 -0
  520. package/lib/util/serialization.js +2 -0
  521. package/lib/util/smartGrouping.js +8 -0
  522. package/lib/util/source.js +2 -0
  523. package/lib/validateSchema.js +1 -0
  524. package/lib/wasm/EnableWasmLoadingPlugin.js +15 -1
  525. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +1 -0
  526. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -0
  527. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +6 -0
  528. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -0
  529. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +10 -1
  530. package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -0
  531. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +12 -1
  532. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +1 -0
  533. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +1 -0
  534. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +1 -1
  535. package/lib/wasm-sync/WebAssemblyGenerator.js +26 -1
  536. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +2 -0
  537. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +4 -0
  538. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +10 -1
  539. package/lib/wasm-sync/WebAssemblyParser.js +2 -0
  540. package/lib/wasm-sync/WebAssemblyUtils.js +2 -0
  541. package/lib/web/FetchCompileAsyncWasmPlugin.js +10 -1
  542. package/lib/web/FetchCompileWasmPlugin.js +13 -1
  543. package/lib/web/JsonpChunkLoadingPlugin.js +11 -1
  544. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -0
  545. package/lib/web/JsonpTemplatePlugin.js +2 -1
  546. package/lib/webpack.js +10 -0
  547. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +10 -1
  548. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -0
  549. package/lib/webworker/WebWorkerTemplatePlugin.js +1 -1
  550. package/package.json +12 -14
  551. package/schemas/WebpackOptions.check.js +1 -1
  552. package/schemas/WebpackOptions.json +44 -55
  553. package/types.d.ts +4594 -331
package/lib/Compiler.js CHANGED
@@ -5,7 +5,6 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const parseJson = require("json-parse-even-better-errors");
9
8
  const asyncLib = require("neo-async");
10
9
  const {
11
10
  AsyncParallelHook,
@@ -31,6 +30,7 @@ const { Logger } = require("./logging/Logger");
31
30
  const { dirname, join, mkdirp } = require("./util/fs");
32
31
  const { makePathsRelative } = require("./util/identifier");
33
32
  const memoize = require("./util/memoize");
33
+ const parseJson = require("./util/parseJson");
34
34
  const { isSourceEqual } = require("./util/source");
35
35
  const webpack = require(".");
36
36
 
@@ -67,12 +67,14 @@ const webpack = require(".");
67
67
  /** @typedef {import("schema-utils").ValidationErrorConfiguration} ValidationErrorConfiguration */
68
68
 
69
69
  /**
70
+ * Defines the compilation params type used by this module.
70
71
  * @typedef {object} CompilationParams
71
72
  * @property {NormalModuleFactory} normalModuleFactory
72
73
  * @property {ContextModuleFactory} contextModuleFactory
73
74
  */
74
75
 
75
76
  /**
77
+ * Defines the callback type used by this module.
76
78
  * @template T
77
79
  * @template [R=void]
78
80
  * @typedef {import("./webpack").Callback<T, R>} Callback
@@ -81,6 +83,7 @@ const webpack = require(".");
81
83
  /** @typedef {import("./webpack").ErrorCallback} ErrorCallback */
82
84
 
83
85
  /**
86
+ * Defines the run as child callback callback.
84
87
  * @callback RunAsChildCallback
85
88
  * @param {Error | null} err
86
89
  * @param {Chunk[]=} entries
@@ -89,6 +92,7 @@ const webpack = require(".");
89
92
  */
90
93
 
91
94
  /**
95
+ * Defines the known records type used by this module.
92
96
  * @typedef {object} KnownRecords
93
97
  * @property {SplitData[]=} aggressiveSplits
94
98
  * @property {RecordsChunks=} chunks
@@ -105,6 +109,7 @@ const webpack = require(".");
105
109
  /** @typedef {KnownRecords & Record<string, KnownRecords[]> & Record<string, EXPECTED_ANY>} Records */
106
110
 
107
111
  /**
112
+ * Defines the asset emitted info type used by this module.
108
113
  * @typedef {object} AssetEmittedInfo
109
114
  * @property {Buffer} content
110
115
  * @property {Source} source
@@ -121,6 +126,7 @@ const webpack = require(".");
121
126
  /** @typedef {{ buildInfo: BuildInfo, references: WeakReferences | undefined, memCache: MemCache }} ModuleMemCachesItem */
122
127
 
123
128
  /**
129
+ * Checks whether this object is sorted.
124
130
  * @template T
125
131
  * @param {T[]} array an array
126
132
  * @returns {boolean} true, if the array is sorted
@@ -133,6 +139,7 @@ const isSorted = (array) => {
133
139
  };
134
140
 
135
141
  /**
142
+ * Returns the object with properties sorted by property name.
136
143
  * @template {object} T
137
144
  * @param {T} obj an object
138
145
  * @param {(keyof T)[]} keys the keys of the object
@@ -147,6 +154,7 @@ const sortObject = (obj, keys) => {
147
154
  };
148
155
 
149
156
  /**
157
+ * Returns true, if the filename contains any hash.
150
158
  * @param {string} filename filename
151
159
  * @param {string | string[] | undefined} hashes list of hashes
152
160
  * @returns {boolean} true, if the filename contains any hash
@@ -163,6 +171,7 @@ const getValidate = memoize(() => require("schema-utils").validate);
163
171
 
164
172
  class Compiler {
165
173
  /**
174
+ * Creates an instance of Compiler.
166
175
  * @param {string} context the compilation path
167
176
  * @param {WebpackOptions} options options
168
177
  */
@@ -354,6 +363,7 @@ class Compiler {
354
363
  }
355
364
 
356
365
  /**
366
+ * Returns the cache facade instance.
357
367
  * @param {string} name cache name
358
368
  * @returns {CacheFacade} the cache facade instance
359
369
  */
@@ -366,6 +376,7 @@ class Compiler {
366
376
  }
367
377
 
368
378
  /**
379
+ * Gets infrastructure logger.
369
380
  * @param {string | (() => string)} name name of the logger, or function called once to get the logger name
370
381
  * @returns {Logger} a logger with that name
371
382
  */
@@ -481,6 +492,7 @@ class Compiler {
481
492
  }
482
493
 
483
494
  /**
495
+ * Returns a compiler watcher.
484
496
  * @param {WatchOptions} watchOptions the watcher's options
485
497
  * @param {Callback<Stats>} handler signals when the call finishes
486
498
  * @returns {Watching | undefined} a compiler watcher
@@ -498,6 +510,7 @@ class Compiler {
498
510
  }
499
511
 
500
512
  /**
513
+ * Processes the provided stat.
501
514
  * @param {Callback<Stats>} callback signals when the call finishes
502
515
  * @returns {void}
503
516
  */
@@ -511,6 +524,7 @@ class Compiler {
511
524
  let logger;
512
525
 
513
526
  /**
527
+ * Processes the provided err.
514
528
  * @param {Error | null} err error
515
529
  * @param {Stats=} stats stats
516
530
  */
@@ -532,6 +546,7 @@ class Compiler {
532
546
  this.running = true;
533
547
 
534
548
  /**
549
+ * Processes the provided err.
535
550
  * @param {Error | null} err error
536
551
  * @param {Compilation=} _compilation compilation
537
552
  * @returns {void}
@@ -639,6 +654,7 @@ class Compiler {
639
654
  }
640
655
 
641
656
  /**
657
+ * Processes the provided run as child callback.
642
658
  * @param {RunAsChildCallback} callback signals when the call finishes
643
659
  * @returns {void}
644
660
  */
@@ -646,6 +662,7 @@ class Compiler {
646
662
  const startTime = Date.now();
647
663
 
648
664
  /**
665
+ * Processes the provided err.
649
666
  * @param {Error | null} err error
650
667
  * @param {Chunk[]=} entries entries
651
668
  * @param {Compilation=} compilation compilation
@@ -699,6 +716,7 @@ class Compiler {
699
716
  }
700
717
 
701
718
  /**
719
+ * Processes the provided compilation.
702
720
  * @param {Compilation} compilation the compilation
703
721
  * @param {ErrorCallback} callback signals when the assets are emitted
704
722
  * @returns {void}
@@ -708,6 +726,7 @@ class Compiler {
708
726
  let outputPath;
709
727
 
710
728
  /**
729
+ * Processes the provided err.
711
730
  * @param {Error=} err error
712
731
  * @returns {void}
713
732
  */
@@ -741,6 +760,7 @@ class Compiler {
741
760
  }
742
761
 
743
762
  /**
763
+ * Processes the provided err.
744
764
  * @param {Error=} err error
745
765
  * @returns {void}
746
766
  */
@@ -875,6 +895,7 @@ ${other}`);
875
895
  };
876
896
 
877
897
  /**
898
+ * Updates with replacement source.
878
899
  * @param {number} size size
879
900
  */
880
901
  const updateWithReplacementSource = (size) => {
@@ -897,6 +918,7 @@ ${other}`);
897
918
  };
898
919
 
899
920
  /**
921
+ * Updates file with replacement source.
900
922
  * @param {string} file file
901
923
  * @param {CacheEntry} cacheEntry cache entry
902
924
  * @param {number} size size
@@ -918,6 +940,7 @@ ${other}`);
918
940
  };
919
941
 
920
942
  /**
943
+ * Process existing file.
921
944
  * @param {IStats} stats stats
922
945
  * @returns {void}
923
946
  */
@@ -1052,6 +1075,7 @@ ${other}`);
1052
1075
  }
1053
1076
 
1054
1077
  /**
1078
+ * Processes the provided error callback.
1055
1079
  * @param {ErrorCallback} callback signals when the call finishes
1056
1080
  * @returns {void}
1057
1081
  */
@@ -1076,6 +1100,7 @@ ${other}`);
1076
1100
  }
1077
1101
 
1078
1102
  /**
1103
+ * Processes the provided error callback.
1079
1104
  * @param {ErrorCallback} callback signals when the call finishes
1080
1105
  * @returns {void}
1081
1106
  */
@@ -1125,6 +1150,7 @@ ${other}`);
1125
1150
  }
1126
1151
 
1127
1152
  /**
1153
+ * Processes the provided error callback.
1128
1154
  * @param {ErrorCallback} callback signals when the call finishes
1129
1155
  * @returns {void}
1130
1156
  */
@@ -1151,6 +1177,7 @@ ${other}`);
1151
1177
  }
1152
1178
 
1153
1179
  /**
1180
+ * Processes the provided error callback.
1154
1181
  * @param {ErrorCallback} callback signals when the call finishes
1155
1182
  * @returns {void}
1156
1183
  */
@@ -1173,9 +1200,9 @@ ${other}`);
1173
1200
  if (err) return callback(err);
1174
1201
 
1175
1202
  try {
1176
- this.records = parseJson(
1177
- /** @type {Buffer} */ (content).toString("utf8")
1178
- );
1203
+ this.records =
1204
+ /** @type {Records} */
1205
+ (parseJson(/** @type {Buffer} */ (content).toString("utf8")));
1179
1206
  } catch (parseErr) {
1180
1207
  return callback(
1181
1208
  new Error(
@@ -1191,6 +1218,7 @@ ${other}`);
1191
1218
  }
1192
1219
 
1193
1220
  /**
1221
+ * Creates a child compiler.
1194
1222
  * @param {Compilation} compilation the compilation
1195
1223
  * @param {string} compilerName the compiler's name
1196
1224
  * @param {number} compilerIndex the compiler's index
@@ -1293,6 +1321,7 @@ ${other}`);
1293
1321
  }
1294
1322
 
1295
1323
  /**
1324
+ * Creates a compilation.
1296
1325
  * @param {CompilationParams} params the compilation parameters
1297
1326
  * @returns {Compilation} compilation
1298
1327
  */
@@ -1302,6 +1331,7 @@ ${other}`);
1302
1331
  }
1303
1332
 
1304
1333
  /**
1334
+ * Returns the created compilation.
1305
1335
  * @param {CompilationParams} params the compilation parameters
1306
1336
  * @returns {Compilation} the created compilation
1307
1337
  */
@@ -1343,6 +1373,7 @@ ${other}`);
1343
1373
  }
1344
1374
 
1345
1375
  /**
1376
+ * Processes the provided compilation.
1346
1377
  * @param {Callback<Compilation>} callback signals when the compilation finishes
1347
1378
  * @returns {void}
1348
1379
  */
@@ -1394,6 +1425,7 @@ ${other}`);
1394
1425
  }
1395
1426
 
1396
1427
  /**
1428
+ * Processes the provided error callback.
1397
1429
  * @param {ErrorCallback} callback signals when the compiler closes
1398
1430
  * @returns {void}
1399
1431
  */
@@ -1431,6 +1463,7 @@ ${other}`);
1431
1463
  }
1432
1464
 
1433
1465
  /**
1466
+ * Returns schema.
1434
1467
  * @returns {Schema} schema
1435
1468
  */
1436
1469
  const getSchema = () => {
@@ -20,16 +20,24 @@ const MODULE_REFERENCE_REGEXP =
20
20
  /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(_deferredImport)?(?:_asiSafe(\d))?__$/;
21
21
 
22
22
  /**
23
+ * Encodes how a concatenated module reference should be interpreted when it is
24
+ * later reconstructed from its placeholder identifier.
23
25
  * @typedef {object} ModuleReferenceOptions
24
- * @property {Ids} ids the properties/exports of the module
26
+ * @property {Ids} ids the properties or exports selected from the referenced module
25
27
  * @property {boolean} call true, when this referenced export is called
26
28
  * @property {boolean} directImport true, when this referenced export is directly imported (not via property access)
27
29
  * @property {boolean} deferredImport true, when this referenced export is deferred
28
30
  * @property {boolean | undefined} asiSafe if the position is ASI safe or unknown
29
31
  */
30
32
 
33
+ /**
34
+ * Tracks the symbols and cross-module references needed while rendering a
35
+ * concatenated module.
36
+ */
31
37
  class ConcatenationScope {
32
38
  /**
39
+ * Creates the mutable scope object used while rendering a concatenated
40
+ * module and its cross-module references.
33
41
  * @param {ModuleInfo[] | Map<Module, ModuleInfo>} modulesMap all module info by module
34
42
  * @param {ConcatenatedModuleInfo} currentModule the current module info
35
43
  * @param {Set<string>} usedNames all used names
@@ -49,6 +57,7 @@ class ConcatenationScope {
49
57
  }
50
58
 
51
59
  /**
60
+ * Checks whether a module participates in the current concatenation scope.
52
61
  * @param {Module} module the referenced module
53
62
  * @returns {boolean} true, when it's in the scope
54
63
  */
@@ -57,6 +66,8 @@ class ConcatenationScope {
57
66
  }
58
67
 
59
68
  /**
69
+ * Records the symbol that should be used when the current module exports a
70
+ * named binding.
60
71
  * @param {string} exportName name of the export
61
72
  * @param {string} symbol identifier of the export in source code
62
73
  */
@@ -70,6 +81,8 @@ class ConcatenationScope {
70
81
  }
71
82
 
72
83
  /**
84
+ * Records a raw expression that can be used to reference an export without
85
+ * going through the normal symbol map.
73
86
  * @param {string} exportName name of the export
74
87
  * @param {string} expression expression to be used
75
88
  */
@@ -83,6 +96,7 @@ class ConcatenationScope {
83
96
  }
84
97
 
85
98
  /**
99
+ * Returns the raw expression registered for an export, if one exists.
86
100
  * @param {string} exportName name of the export
87
101
  * @returns {string | undefined} the expression of the export
88
102
  */
@@ -94,6 +108,8 @@ class ConcatenationScope {
94
108
  }
95
109
 
96
110
  /**
111
+ * Replaces the raw expression for an export only when that export already
112
+ * has an entry in the raw export map.
97
113
  * @param {string} exportName name of the export
98
114
  * @param {string} expression expression to be used
99
115
  */
@@ -107,6 +123,7 @@ class ConcatenationScope {
107
123
  }
108
124
 
109
125
  /**
126
+ * Records the symbol that should be used for the synthetic namespace export.
110
127
  * @param {string} symbol identifier of the export in source code
111
128
  */
112
129
  registerNamespaceExport(symbol) {
@@ -114,6 +131,8 @@ class ConcatenationScope {
114
131
  }
115
132
 
116
133
  /**
134
+ * Encodes a reference to another concatenated module as a placeholder
135
+ * identifier that can be parsed later during code generation.
117
136
  * @param {Module} module the referenced module
118
137
  * @param {Partial<ModuleReferenceOptions>} options options
119
138
  * @returns {string} the reference as identifier
@@ -145,6 +164,8 @@ class ConcatenationScope {
145
164
  }
146
165
 
147
166
  /**
167
+ * Checks whether an identifier is one of webpack's encoded concatenation
168
+ * module references.
148
169
  * @param {string} name the identifier
149
170
  * @returns {boolean} true, when it's an module reference
150
171
  */
@@ -153,6 +174,8 @@ class ConcatenationScope {
153
174
  }
154
175
 
155
176
  /**
177
+ * Parses an encoded module reference back into its module index and
178
+ * reference flags.
156
179
  * @param {string} name the identifier
157
180
  * @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index
158
181
  */
@@ -15,6 +15,7 @@ const { mergeRuntime } = require("./util/runtime");
15
15
  /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
16
16
 
17
17
  /**
18
+ * Returns wrapped source.
18
19
  * @param {string} condition condition
19
20
  * @param {string | Source} source source
20
21
  * @returns {string | Source} wrapped source
@@ -36,10 +37,12 @@ const wrapInCondition = (condition, source) => {
36
37
  };
37
38
 
38
39
  /**
40
+ * Represents ConditionalInitFragment.
39
41
  * @extends {InitFragment<GenerateContext>}
40
42
  */
41
43
  class ConditionalInitFragment extends InitFragment {
42
44
  /**
45
+ * Creates an instance of ConditionalInitFragment.
43
46
  * @param {string | Source | undefined} content the source code that will be included as initialization code
44
47
  * @param {number} stage category of initialization code (contribute to order)
45
48
  * @param {number} position position in the category (contribute to order)
@@ -60,6 +63,7 @@ class ConditionalInitFragment extends InitFragment {
60
63
  }
61
64
 
62
65
  /**
66
+ * Returns the source code that will be included as initialization code.
63
67
  * @param {GenerateContext} context context
64
68
  * @returns {string | Source | undefined} the source code that will be included as initialization code
65
69
  */
@@ -77,6 +81,7 @@ class ConditionalInitFragment extends InitFragment {
77
81
  }
78
82
 
79
83
  /**
84
+ * Returns the source code that will be included at the end of the module.
80
85
  * @param {GenerateContext} context context
81
86
  * @returns {string | Source | undefined} the source code that will be included at the end of the module
82
87
  */
@@ -94,6 +99,7 @@ class ConditionalInitFragment extends InitFragment {
94
99
  }
95
100
 
96
101
  /**
102
+ * Returns merged fragment.
97
103
  * @param {ConditionalInitFragment} other fragment to merge with
98
104
  * @returns {ConditionalInitFragment} merged fragment
99
105
  */
@@ -30,6 +30,7 @@ const { parseResource } = require("./util/identifier");
30
30
  /** @typedef {Set<string>} Declarations */
31
31
 
32
32
  /**
33
+ * Collect declaration.
33
34
  * @param {Declarations} declarations set of declarations
34
35
  * @param {Identifier | Pattern} pattern pattern to collect declarations from
35
36
  */
@@ -64,6 +65,7 @@ const collectDeclaration = (declarations, pattern) => {
64
65
  };
65
66
 
66
67
  /**
68
+ * Gets hoisted declarations.
67
69
  * @param {Statement} branch branch to get hoisted declarations from
68
70
  * @param {boolean} includeFunctionDeclarations whether to include function declarations
69
71
  * @returns {string[]} hoisted declarations
@@ -138,7 +140,7 @@ const PLUGIN_NAME = "ConstPlugin";
138
140
 
139
141
  class ConstPlugin {
140
142
  /**
141
- * Apply the plugin
143
+ * Applies the plugin by registering its hooks on the compiler.
142
144
  * @param {Compiler} compiler the compiler instance
143
145
  * @returns {void}
144
146
  */
@@ -158,6 +160,7 @@ class ConstPlugin {
158
160
  );
159
161
 
160
162
  /**
163
+ * Handles the hook callback for this code path.
161
164
  * @param {JavascriptParser} parser the parser
162
165
  */
163
166
  const handler = (parser) => {
@@ -10,6 +10,7 @@ const PLUGIN_NAME = "ContextExclusionPlugin";
10
10
 
11
11
  class ContextExclusionPlugin {
12
12
  /**
13
+ * Creates an instance of ContextExclusionPlugin.
13
14
  * @param {RegExp} negativeMatcher Matcher regular expression
14
15
  */
15
16
  constructor(negativeMatcher) {
@@ -17,7 +18,7 @@ class ContextExclusionPlugin {
17
18
  }
18
19
 
19
20
  /**
20
- * Apply the plugin
21
+ * Applies the plugin by registering its hooks on the compiler.
21
22
  * @param {Compiler} compiler the compiler instance
22
23
  * @returns {void}
23
24
  */
@@ -172,6 +172,7 @@ class ContextModule extends Module {
172
172
  }
173
173
 
174
174
  /**
175
+ * Returns the source types this module can generate.
175
176
  * @returns {SourceTypes} types available (do not mutate)
176
177
  */
177
178
  getSourceTypes() {
@@ -280,6 +281,7 @@ class ContextModule extends Module {
280
281
  }
281
282
 
282
283
  /**
284
+ * Returns the unique identifier used to reference this module.
283
285
  * @returns {string} a unique identifier of the module
284
286
  */
285
287
  identifier() {
@@ -287,6 +289,7 @@ class ContextModule extends Module {
287
289
  }
288
290
 
289
291
  /**
292
+ * Returns a human-readable identifier for this module.
290
293
  * @param {RequestShortener} requestShortener the request shortener
291
294
  * @returns {string} a user readable identifier of the module
292
295
  */
@@ -353,6 +356,7 @@ class ContextModule extends Module {
353
356
  }
354
357
 
355
358
  /**
359
+ * Gets the library identifier.
356
360
  * @param {LibIdentOptions} options options
357
361
  * @returns {LibIdent | null} an identifier for library inclusion
358
362
  */
@@ -415,6 +419,7 @@ class ContextModule extends Module {
415
419
  }
416
420
 
417
421
  /**
422
+ * Invalidates the cached state associated with this value.
418
423
  * @returns {void}
419
424
  */
420
425
  invalidateBuild() {
@@ -422,6 +427,7 @@ class ContextModule extends Module {
422
427
  }
423
428
 
424
429
  /**
430
+ * Checks whether the module needs to be rebuilt for the current build state.
425
431
  * @param {NeedBuildContext} context context info
426
432
  * @param {NeedBuildCallback} callback callback function, returns true, if the module needs a rebuild
427
433
  * @returns {void}
@@ -443,6 +449,7 @@ class ContextModule extends Module {
443
449
  }
444
450
 
445
451
  /**
452
+ * Builds the module using the provided compilation context.
446
453
  * @param {WebpackOptions} options webpack options
447
454
  * @param {Compilation} compilation the compilation
448
455
  * @param {ResolverWithOptions} resolver the resolver
@@ -576,6 +583,7 @@ class ContextModule extends Module {
576
583
  }
577
584
 
578
585
  /**
586
+ * Adds the provided file dependencies to the module.
579
587
  * @param {FileSystemDependencies} fileDependencies set where file dependencies are added to
580
588
  * @param {FileSystemDependencies} contextDependencies set where context dependencies are added to
581
589
  * @param {FileSystemDependencies} missingDependencies set where missing dependencies are added to
@@ -1311,6 +1319,7 @@ module.exports = webpackEmptyAsyncContext;`;
1311
1319
  }
1312
1320
 
1313
1321
  /**
1322
+ * Generates code and runtime requirements for this module.
1314
1323
  * @param {CodeGenerationContext} context context for code generation
1315
1324
  * @returns {CodeGenerationResult} result
1316
1325
  */
@@ -1370,6 +1379,7 @@ module.exports = webpackEmptyAsyncContext;`;
1370
1379
  }
1371
1380
 
1372
1381
  /**
1382
+ * Returns the estimated size for the requested source type.
1373
1383
  * @param {string=} type the source type for which the size should be estimated
1374
1384
  * @returns {number} the estimated size of the module (must be non-zero)
1375
1385
  */
@@ -1386,6 +1396,7 @@ module.exports = webpackEmptyAsyncContext;`;
1386
1396
  }
1387
1397
 
1388
1398
  /**
1399
+ * Serializes this instance into the provided serializer context.
1389
1400
  * @param {ObjectSerializerContext} context context
1390
1401
  */
1391
1402
  serialize(context) {
@@ -1396,6 +1407,7 @@ module.exports = webpackEmptyAsyncContext;`;
1396
1407
  }
1397
1408
 
1398
1409
  /**
1410
+ * Restores this instance from the provided deserializer context.
1399
1411
  * @param {ObjectDeserializerContext} context context
1400
1412
  */
1401
1413
  deserialize(context) {
@@ -26,6 +26,7 @@ const { join } = require("./util/fs");
26
26
  /** @typedef {import("./dependencies/ContextDependency").ContextOptions} ContextOptions */
27
27
 
28
28
  /**
29
+ * Defines the shared type used by this module.
29
30
  * @template T
30
31
  * @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T>
31
32
  */
@@ -34,6 +35,7 @@ const { join } = require("./util/fs");
34
35
  /** @typedef {{ context: string, request: string }} ContextAlternativeRequest */
35
36
 
36
37
  /**
38
+ * Defines the context resolve data type used by this module.
37
39
  * @typedef {object} ContextResolveData
38
40
  * @property {string} context
39
41
  * @property {string} request
@@ -51,6 +53,7 @@ const EMPTY_RESOLVE_OPTIONS = {};
51
53
 
52
54
  class ContextModuleFactory extends ModuleFactory {
53
55
  /**
56
+ * Creates an instance of ContextModuleFactory.
54
57
  * @param {ResolverFactory} resolverFactory resolverFactory
55
58
  */
56
59
  constructor(resolverFactory) {
@@ -102,6 +105,7 @@ class ContextModuleFactory extends ModuleFactory {
102
105
  }
103
106
 
104
107
  /**
108
+ * Processes the provided data.
105
109
  * @param {ModuleFactoryCreateData} data data object
106
110
  * @param {ModuleFactoryCallback} callback callback
107
111
  * @returns {void}
@@ -195,6 +199,7 @@ class ContextModuleFactory extends ModuleFactory {
195
199
  (callback) => {
196
200
  const results = /** @type {ResolveRequest[]} */ ([]);
197
201
  /**
202
+ * Processes the provided obj.
198
203
  * @param {ResolveRequest} obj obj
199
204
  * @returns {void}
200
205
  */
@@ -304,6 +309,7 @@ class ContextModuleFactory extends ModuleFactory {
304
309
  }
305
310
 
306
311
  /**
312
+ * Resolves dependencies.
307
313
  * @param {InputFileSystem} fs file system
308
314
  * @param {ContextModuleOptions} options options
309
315
  * @param {ResolveDependenciesCallback} callback callback function
@@ -327,6 +333,7 @@ class ContextModuleFactory extends ModuleFactory {
327
333
  if (!regExp || !resource) return callback(null, []);
328
334
 
329
335
  /**
336
+ * Adds directory checked.
330
337
  * @param {string} ctx context
331
338
  * @param {string} directory directory
332
339
  * @param {Set<string>} visited visited
@@ -356,6 +363,7 @@ class ContextModuleFactory extends ModuleFactory {
356
363
  };
357
364
 
358
365
  /**
366
+ * Adds the provided ctx to the context module factory.
359
367
  * @param {string} ctx context
360
368
  * @param {string} directory directory
361
369
  * @param {(context: string, subResource: string, callback: () => void) => void} addSubDirectory addSubDirectoryFn
@@ -458,6 +466,7 @@ class ContextModuleFactory extends ModuleFactory {
458
466
  };
459
467
 
460
468
  /**
469
+ * Adds sub directory.
461
470
  * @param {string} ctx context
462
471
  * @param {string} dir dir
463
472
  * @param {ResolveDependenciesCallback} callback callback
@@ -467,6 +476,7 @@ class ContextModuleFactory extends ModuleFactory {
467
476
  addDirectory(ctx, dir, addSubDirectory, callback);
468
477
 
469
478
  /**
479
+ * Processes the provided resource.
470
480
  * @param {string} resource resource
471
481
  * @param {ResolveDependenciesCallback} callback callback
472
482
  */
@@ -20,6 +20,7 @@ const PLUGIN_NAME = "ContextReplacementPlugin";
20
20
 
21
21
  class ContextReplacementPlugin {
22
22
  /**
23
+ * Creates an instance of ContextReplacementPlugin.
23
24
  * @param {RegExp} resourceRegExp A regular expression that determines which files will be selected
24
25
  * @param {(string | ((context: BeforeContextResolveData | AfterContextResolveData) => void) | RegExp | boolean)=} newContentResource A new resource to replace the match
25
26
  * @param {(boolean | NewContentCreateContextMap | RegExp)=} newContentRecursive If true, all subdirectories are searched for matches
@@ -44,6 +45,7 @@ class ContextReplacementPlugin {
44
45
  ) {
45
46
  this.newContentResource = newContentResource;
46
47
  /**
48
+ * Stores new content create context map.
47
49
  * @param {InputFileSystem} fs input file system
48
50
  * @param {(err: null | Error, newContentRecursive: NewContentCreateContextMap) => void} callback callback
49
51
  */
@@ -87,7 +89,7 @@ class ContextReplacementPlugin {
87
89
  }
88
90
 
89
91
  /**
90
- * Apply the plugin
92
+ * Applies the plugin by registering its hooks on the compiler.
91
93
  * @param {Compiler} compiler the compiler instance
92
94
  * @returns {void}
93
95
  */
@@ -202,6 +204,7 @@ class ContextReplacementPlugin {
202
204
  }
203
205
 
204
206
  /**
207
+ * Creates a resolve dependencies from context map.
205
208
  * @param {(fs: InputFileSystem, callback: (err: null | Error, map: NewContentCreateContextMap) => void) => void} createContextMap create context map function
206
209
  * @returns {(fs: InputFileSystem, options: ContextModuleOptions, callback: (err: null | Error, dependencies?: ContextElementDependency[]) => void) => void} resolve resolve dependencies from context map function
207
210
  */