webpack 5.106.1 → 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 -1
  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 +59 -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 +10 -2
  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 +5 -0
  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/cli.js CHANGED
@@ -17,6 +17,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
17
17
 
18
18
  // TODO add originPath to PathItem for better errors
19
19
  /**
20
+ * Defines the path item type used by this module.
20
21
  * @typedef {object} PathItem
21
22
  * @property {Schema} schema the part of the schema
22
23
  * @property {string} path the path in the config
@@ -27,6 +28,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
27
28
  /** @typedef {string | number | boolean | RegExp} Value */
28
29
 
29
30
  /**
31
+ * Defines the problem type used by this module.
30
32
  * @typedef {object} Problem
31
33
  * @property {ProblemType} type
32
34
  * @property {string} path
@@ -37,6 +39,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
37
39
  */
38
40
 
39
41
  /**
42
+ * Defines the local problem type used by this module.
40
43
  * @typedef {object} LocalProblem
41
44
  * @property {ProblemType} type
42
45
  * @property {string} path
@@ -48,6 +51,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
48
51
  /** @typedef {string | number | boolean | EnumValueObject | EnumValueArray | null} EnumValue */
49
52
 
50
53
  /**
54
+ * Defines the argument config type used by this module.
51
55
  * @typedef {object} ArgumentConfig
52
56
  * @property {string=} description
53
57
  * @property {string=} negatedDescription
@@ -60,6 +64,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
60
64
  /** @typedef {"string" | "number" | "boolean"} SimpleType */
61
65
 
62
66
  /**
67
+ * Defines the argument type used by this module.
63
68
  * @typedef {object} Argument
64
69
  * @property {string | undefined} description
65
70
  * @property {SimpleType} simpleType
@@ -72,6 +77,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
72
77
  /** @typedef {Record<string, EXPECTED_ANY>} ObjectConfiguration */
73
78
 
74
79
  /**
80
+ * Returns object of arguments.
75
81
  * @param {Schema=} schema a json schema to create arguments for (by default webpack schema is used)
76
82
  * @returns {Flags} object of arguments
77
83
  */
@@ -80,6 +86,7 @@ const getArguments = (schema = webpackSchema) => {
80
86
  const flags = {};
81
87
 
82
88
  /**
89
+ * Path to argument name.
83
90
  * @param {string} input input
84
91
  * @returns {string} result
85
92
  */
@@ -95,6 +102,7 @@ const getArguments = (schema = webpackSchema) => {
95
102
  .toLowerCase();
96
103
 
97
104
  /**
105
+ * Returns schema part.
98
106
  * @param {string} path path
99
107
  * @returns {Schema} schema part
100
108
  */
@@ -117,6 +125,7 @@ const getArguments = (schema = webpackSchema) => {
117
125
  };
118
126
 
119
127
  /**
128
+ * Returns description.
120
129
  * @param {PathItem[]} path path in the schema
121
130
  * @returns {string | undefined} description
122
131
  */
@@ -131,6 +140,7 @@ const getArguments = (schema = webpackSchema) => {
131
140
  };
132
141
 
133
142
  /**
143
+ * Gets negated description.
134
144
  * @param {PathItem[]} path path in the schema
135
145
  * @returns {string | undefined} negative description
136
146
  */
@@ -144,6 +154,7 @@ const getArguments = (schema = webpackSchema) => {
144
154
  };
145
155
 
146
156
  /**
157
+ * Gets reset description.
147
158
  * @param {PathItem[]} path path in the schema
148
159
  * @returns {string | undefined} reset description
149
160
  */
@@ -157,6 +168,7 @@ const getArguments = (schema = webpackSchema) => {
157
168
  };
158
169
 
159
170
  /**
171
+ * Schema to argument config.
160
172
  * @param {Schema} schemaPart schema
161
173
  * @returns {Pick<ArgumentConfig, "type" | "values"> | undefined} partial argument config
162
174
  */
@@ -190,6 +202,7 @@ const getArguments = (schema = webpackSchema) => {
190
202
  };
191
203
 
192
204
  /**
205
+ * Adds the provided path to this object.
193
206
  * @param {PathItem[]} path path in the schema
194
207
  * @returns {void}
195
208
  */
@@ -219,6 +232,7 @@ const getArguments = (schema = webpackSchema) => {
219
232
  };
220
233
 
221
234
  /**
235
+ * Adds the provided path to this object.
222
236
  * @param {PathItem[]} path full path in schema
223
237
  * @param {boolean} multiple inside of an array
224
238
  * @returns {number} number of arguments added
@@ -281,6 +295,7 @@ const getArguments = (schema = webpackSchema) => {
281
295
  // TODO support `not` and `if/then/else`
282
296
  // TODO support `const`, but we don't use it on our schema
283
297
  /**
298
+ * Returns added arguments.
284
299
  * @param {Schema} schemaPart the current schema
285
300
  * @param {string} schemaPath the current path in the schema
286
301
  * @param {PathItem[]} path all previous visited schemaParts
@@ -433,6 +448,7 @@ const cliAddedItems = new WeakMap();
433
448
  /** @typedef {string | number} Property */
434
449
 
435
450
  /**
451
+ * Gets object and property.
436
452
  * @param {ObjectConfiguration} config configuration
437
453
  * @param {string} schemaPath path in the config
438
454
  * @param {number | undefined} index index of value when multiple values are provided, otherwise undefined
@@ -533,6 +549,7 @@ const getObjectAndProperty = (config, schemaPath, index = 0) => {
533
549
  };
534
550
 
535
551
  /**
552
+ * Updates value using the provided config.
536
553
  * @param {ObjectConfiguration} config configuration
537
554
  * @param {string} schemaPath path in the config
538
555
  * @param {ParsedValue} value parsed value
@@ -552,6 +569,7 @@ const setValue = (config, schemaPath, value, index) => {
552
569
  };
553
570
 
554
571
  /**
572
+ * Process argument config.
555
573
  * @param {ArgumentConfig} argConfig processing instructions
556
574
  * @param {ObjectConfiguration} config configuration
557
575
  * @param {Value} value the value
@@ -579,6 +597,7 @@ const processArgumentConfig = (argConfig, config, value, index) => {
579
597
  };
580
598
 
581
599
  /**
600
+ * Gets expected value.
582
601
  * @param {ArgumentConfig} argConfig processing instructions
583
602
  * @returns {string | undefined} expected message
584
603
  */
@@ -606,6 +625,7 @@ const getExpectedValue = (argConfig) => {
606
625
  const DECIMAL_NUMBER_REGEXP = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
607
626
 
608
627
  /**
628
+ * Parses value for argument config.
609
629
  * @param {ArgumentConfig} argConfig processing instructions
610
630
  * @param {Value} value the value
611
631
  * @returns {ParsedValue | undefined} parsed value
@@ -665,6 +685,7 @@ const parseValueForArgumentConfig = (argConfig, value) => {
665
685
  /** @typedef {Record<string, Value[]>} Values */
666
686
 
667
687
  /**
688
+ * Processes the provided arg.
668
689
  * @param {Flags} args object of arguments
669
690
  * @param {ObjectConfiguration} config configuration
670
691
  * @param {Values} values object with values
@@ -684,6 +705,7 @@ const processArguments = (args, config, values) => {
684
705
  continue;
685
706
  }
686
707
  /**
708
+ * Processes the provided value.
687
709
  * @param {Value} value value
688
710
  * @param {number | undefined} i index
689
711
  */
@@ -718,6 +740,7 @@ const processArguments = (args, config, values) => {
718
740
  };
719
741
 
720
742
  /**
743
+ * Checks whether this object is color supported.
721
744
  * @returns {boolean} true when colors supported, otherwise false
722
745
  */
723
746
  const isColorSupported = () => {
@@ -741,6 +764,7 @@ const isColorSupported = () => {
741
764
  };
742
765
 
743
766
  /**
767
+ * Returns result.
744
768
  * @param {number} index index
745
769
  * @param {string} string string
746
770
  * @param {string} close close
@@ -761,6 +785,7 @@ const replaceClose = (
761
785
  ) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
762
786
 
763
787
  /**
788
+ * Returns result.
764
789
  * @param {number} index index to replace
765
790
  * @param {string} string string
766
791
  * @param {string} open open string
@@ -776,6 +801,7 @@ const clearBleed = (index, string, open, close, replace) =>
776
801
  /** @typedef {(value: EXPECTED_ANY) => string} PrintFunction */
777
802
 
778
803
  /**
804
+ * Returns function to create color.
779
805
  * @param {string} open open string
780
806
  * @param {string} close close string
781
807
  * @param {string=} replace extra replace
@@ -790,6 +816,7 @@ const filterEmpty =
790
816
  : "";
791
817
 
792
818
  /**
819
+ * Returns result.
793
820
  * @param {number} open open code
794
821
  * @param {number} close close code
795
822
  * @param {string=} replace extra replace
@@ -799,15 +826,18 @@ const init = (open, close, replace) =>
799
826
  filterEmpty(`\u001B[${open}m`, `\u001B[${close}m`, replace);
800
827
 
801
828
  /**
829
+ * Defines the colors type used by this module.
802
830
  * @typedef {{ reset: PrintFunction, bold: PrintFunction, dim: PrintFunction, italic: PrintFunction, underline: PrintFunction, inverse: PrintFunction, hidden: PrintFunction, strikethrough: PrintFunction, black: PrintFunction, red: PrintFunction, green: PrintFunction, yellow: PrintFunction, blue: PrintFunction, magenta: PrintFunction, cyan: PrintFunction, white: PrintFunction, gray: PrintFunction, bgBlack: PrintFunction, bgRed: PrintFunction, bgGreen: PrintFunction, bgYellow: PrintFunction, bgBlue: PrintFunction, bgMagenta: PrintFunction, bgCyan: PrintFunction, bgWhite: PrintFunction, blackBright: PrintFunction, redBright: PrintFunction, greenBright: PrintFunction, yellowBright: PrintFunction, blueBright: PrintFunction, magentaBright: PrintFunction, cyanBright: PrintFunction, whiteBright: PrintFunction, bgBlackBright: PrintFunction, bgRedBright: PrintFunction, bgGreenBright: PrintFunction, bgYellowBright: PrintFunction, bgBlueBright: PrintFunction, bgMagentaBright: PrintFunction, bgCyanBright: PrintFunction, bgWhiteBright: PrintFunction }} Colors
803
831
  */
804
832
 
805
833
  /**
834
+ * Defines the colors options type used by this module.
806
835
  * @typedef {object} ColorsOptions
807
836
  * @property {boolean=} useColor force use colors
808
837
  */
809
838
 
810
839
  /**
840
+ * Creates a colors from the provided colors option.
811
841
  * @param {ColorsOptions=} options options
812
842
  * @returns {Colors} colors
813
843
  */
@@ -16,6 +16,7 @@ const browserslist = require("browserslist");
16
16
  const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
17
17
 
18
18
  /**
19
+ * Returns selected browsers.
19
20
  * @param {string | null | undefined} input input string
20
21
  * @param {string} context the context directory
21
22
  * @returns {string[] | undefined} selected browsers
@@ -58,6 +59,7 @@ const load = (input, context) => {
58
59
  };
59
60
 
60
61
  /**
62
+ * Returns target properties.
61
63
  * @param {string[]} browsers supported browsers list
62
64
  * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties
63
65
  */
@@ -80,11 +80,13 @@ const {
80
80
  /** @typedef {import("./target").TargetProperties} TargetProperties */
81
81
 
82
82
  /**
83
+ * Defines the recursive non nullable type used by this module.
83
84
  * @template T
84
85
  * @typedef {{ [P in keyof T]-?: T[P] extends object ? RecursiveNonNullable<NonNullable<T[P]>> : NonNullable<T[P]> }} RecursiveNonNullable
85
86
  */
86
87
 
87
88
  /**
89
+ * Defines the shared type used by this module.
88
90
  * @typedef {Output & {
89
91
  * uniqueName: NonNullable<Output["uniqueName"]>,
90
92
  * filename: NonNullable<Output["filename"]>,
@@ -129,6 +131,7 @@ const {
129
131
  */
130
132
 
131
133
  /**
134
+ * Defines the shared type used by this module.
132
135
  * @typedef {SnapshotOptions & {
133
136
  * managedPaths: NonNullable<SnapshotOptions["managedPaths"]>,
134
137
  * unmanagedPaths: NonNullable<SnapshotOptions["unmanagedPaths"]>,
@@ -141,6 +144,7 @@ const {
141
144
  */
142
145
 
143
146
  /**
147
+ * Defines the shared type used by this module.
144
148
  * @typedef {Optimization & {
145
149
  * runtimeChunk: NonNullable<Optimization["runtimeChunk"]>,
146
150
  * splitChunks: NonNullable<Optimization["splitChunks"]>,
@@ -169,6 +173,7 @@ const {
169
173
  */
170
174
 
171
175
  /**
176
+ * Defines the shared type used by this module.
172
177
  * @typedef {ExternalsPresets & {
173
178
  * web: NonNullable<ExternalsPresets["web"]>,
174
179
  * node: NonNullable<ExternalsPresets["node"]>,
@@ -181,6 +186,7 @@ const {
181
186
  */
182
187
 
183
188
  /**
189
+ * Defines the shared type used by this module.
184
190
  * @typedef {InfrastructureLogging & {
185
191
  * stream: NonNullable<InfrastructureLogging["stream"]>,
186
192
  * level: NonNullable<InfrastructureLogging["level"]>,
@@ -191,14 +197,17 @@ const {
191
197
  */
192
198
 
193
199
  /**
200
+ * Defines the webpack options normalized with base defaults type used by this module.
194
201
  * @typedef {WebpackOptionsNormalized & { context: NonNullable<WebpackOptionsNormalized["context"]> } & { infrastructureLogging: InfrastructureLoggingNormalizedWithDefaults }} WebpackOptionsNormalizedWithBaseDefaults
195
202
  */
196
203
 
197
204
  /**
205
+ * Defines the webpack options normalized with defaults type used by this module.
198
206
  * @typedef {WebpackOptionsNormalizedWithBaseDefaults & { target: NonNullable<WebpackOptionsNormalized["target"]> } & { output: OutputNormalizedWithDefaults } & { optimization: OptimizationNormalizedWithDefaults } & { devtool: NonNullable<WebpackOptionsNormalized["devtool"]> } & { stats: NonNullable<WebpackOptionsNormalized["stats"]> } & { node: NonNullable<WebpackOptionsNormalized["node"]> } & { profile: NonNullable<WebpackOptionsNormalized["profile"]> } & { parallelism: NonNullable<WebpackOptionsNormalized["parallelism"]> } & { snapshot: SnapshotNormalizedWithDefaults } & { externalsPresets: ExternalsPresetsNormalizedWithDefaults } & { externalsType: NonNullable<WebpackOptionsNormalized["externalsType"]> } & { watch: NonNullable<WebpackOptionsNormalized["watch"]> } & { performance: NonNullable<WebpackOptionsNormalized["performance"]> } & { recordsInputPath: NonNullable<WebpackOptionsNormalized["recordsInputPath"]> } & { recordsOutputPath: NonNullable<WebpackOptionsNormalized["recordsOutputPath"]> } & { dotenv: NonNullable<WebpackOptionsNormalized["dotenv"]> }} WebpackOptionsNormalizedWithDefaults
199
207
  */
200
208
 
201
209
  /**
210
+ * Defines the resolved options type used by this module.
202
211
  * @typedef {object} ResolvedOptions
203
212
  * @property {PlatformTargetProperties | false} platform - platform target properties
204
213
  */
@@ -211,7 +220,7 @@ const DEFAULTS = {
211
220
  };
212
221
 
213
222
  /**
214
- * Sets a constant default value when undefined
223
+ * Processes the provided obj.
215
224
  * @template T
216
225
  * @template {keyof T} P
217
226
  * @param {T} obj an object
@@ -226,7 +235,7 @@ const D = (obj, prop, value) => {
226
235
  };
227
236
 
228
237
  /**
229
- * Sets a dynamic default value when undefined, by calling the factory function
238
+ * Processes the provided obj.
230
239
  * @template T
231
240
  * @template {keyof T} P
232
241
  * @param {T} obj an object
@@ -282,6 +291,7 @@ const A = (obj, prop, factory) => {
282
291
  };
283
292
 
284
293
  /**
294
+ * Apply webpack options base defaults.
285
295
  * @param {WebpackOptionsNormalized} options options to be modified
286
296
  * @returns {void}
287
297
  */
@@ -291,6 +301,7 @@ const applyWebpackOptionsBaseDefaults = (options) => {
291
301
  };
292
302
 
293
303
  /**
304
+ * Apply webpack options defaults.
294
305
  * @param {WebpackOptionsNormalized} options options to be modified
295
306
  * @param {number=} compilerIndex index of compiler
296
307
  * @returns {ResolvedOptions} Resolved options after apply defaults
@@ -531,6 +542,7 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => {
531
542
  };
532
543
 
533
544
  /**
545
+ * Apply experiments defaults.
534
546
  * @param {ExperimentsNormalized} experiments options
535
547
  * @param {object} options options
536
548
  * @param {boolean} options.production is production
@@ -562,6 +574,7 @@ const applyExperimentsDefaults = (
562
574
  };
563
575
 
564
576
  /**
577
+ * Apply cache defaults.
565
578
  * @param {CacheOptionsNormalized} cache options
566
579
  * @param {object} options options
567
580
  * @param {string} options.name name
@@ -644,6 +657,7 @@ const applyCacheDefaults = (
644
657
  };
645
658
 
646
659
  /**
660
+ * Apply snapshot defaults.
647
661
  * @param {SnapshotOptions} snapshot options
648
662
  * @param {object} options options
649
663
  * @param {boolean} options.production is production
@@ -721,6 +735,7 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => {
721
735
  };
722
736
 
723
737
  /**
738
+ * Apply javascript parser options defaults.
724
739
  * @param {JavascriptParserOptions} parserOptions parser options
725
740
  * @param {object} options options
726
741
  * @param {boolean} options.futureDefaults is future defaults enabled
@@ -759,6 +774,7 @@ const applyJavascriptParserOptionsDefaults = (
759
774
  };
760
775
 
761
776
  /**
777
+ * Apply json generator options defaults.
762
778
  * @param {JsonGeneratorOptions} generatorOptions generator options
763
779
  * @returns {void}
764
780
  */
@@ -767,6 +783,7 @@ const applyJsonGeneratorOptionsDefaults = (generatorOptions) => {
767
783
  };
768
784
 
769
785
  /**
786
+ * Apply css generator options defaults.
770
787
  * @param {CssGeneratorOptions} generatorOptions generator options
771
788
  * @param {object} options options
772
789
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -785,6 +802,7 @@ const applyCssGeneratorOptionsDefaults = (
785
802
  };
786
803
 
787
804
  /**
805
+ * Apply module defaults.
788
806
  * @param {ModuleOptions} module options
789
807
  * @param {object} options options
790
808
  * @param {boolean} options.cache is caching enabled
@@ -827,6 +845,7 @@ const applyModuleDefaults = (
827
845
  module,
828
846
  "unsafeCache",
829
847
  /**
848
+ * Handles the callback logic for this hook.
830
849
  * @param {Module} module module
831
850
  * @returns {boolean} true, if we want to cache the module
832
851
  */
@@ -1216,6 +1235,7 @@ const applyModuleDefaults = (
1216
1235
  };
1217
1236
 
1218
1237
  /**
1238
+ * Apply output defaults.
1219
1239
  * @param {Output} output options
1220
1240
  * @param {object} options options
1221
1241
  * @param {string} options.context context
@@ -1242,6 +1262,7 @@ const applyOutputDefaults = (
1242
1262
  }
1243
1263
  ) => {
1244
1264
  /**
1265
+ * Returns a readable library name.
1245
1266
  * @param {Library=} library the library option
1246
1267
  * @returns {string} a readable library name
1247
1268
  */
@@ -1293,11 +1314,13 @@ const applyOutputDefaults = (
1293
1314
 
1294
1315
  const environment = /** @type {Environment} */ (output.environment);
1295
1316
  /**
1317
+ * Returns true, when v is truthy or undefined.
1296
1318
  * @param {boolean | undefined} v value
1297
1319
  * @returns {boolean} true, when v is truthy or undefined
1298
1320
  */
1299
1321
  const optimistic = (v) => v || v === undefined;
1300
1322
  /**
1323
+ * Conditionally optimistic.
1301
1324
  * @param {boolean | undefined} v value
1302
1325
  * @param {boolean | undefined} c condition
1303
1326
  * @returns {boolean | undefined} true, when v is truthy or undefined, or c is truthy
@@ -1615,6 +1638,7 @@ const applyOutputDefaults = (
1615
1638
  }
1616
1639
 
1617
1640
  /**
1641
+ * Processes the provided fn.
1618
1642
  * @param {(entryDescription: EntryDescription) => void} fn iterator
1619
1643
  * @returns {void}
1620
1644
  */
@@ -1673,6 +1697,7 @@ const applyOutputDefaults = (
1673
1697
  };
1674
1698
 
1675
1699
  /**
1700
+ * Apply externals presets defaults.
1676
1701
  * @param {ExternalsPresets} externalsPresets options
1677
1702
  * @param {object} options options
1678
1703
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -1685,6 +1710,7 @@ const applyExternalsPresetsDefaults = (
1685
1710
  { targetProperties, buildHttp, outputModule }
1686
1711
  ) => {
1687
1712
  /**
1713
+ * Checks whether this object is universal.
1688
1714
  * @param {keyof TargetProperties} key a key
1689
1715
  * @returns {boolean} true when target is universal, otherwise false
1690
1716
  */
@@ -1752,6 +1778,7 @@ const applyExternalsPresetsDefaults = (
1752
1778
  };
1753
1779
 
1754
1780
  /**
1781
+ * Apply loader defaults.
1755
1782
  * @param {Loader} loader options
1756
1783
  * @param {object} options options
1757
1784
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -1776,6 +1803,7 @@ const applyLoaderDefaults = (loader, { targetProperties, environment }) => {
1776
1803
  };
1777
1804
 
1778
1805
  /**
1806
+ * Apply node defaults.
1779
1807
  * @param {WebpackNode} node options
1780
1808
  * @param {object} options options
1781
1809
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -1821,6 +1849,7 @@ const applyNodeDefaults = (
1821
1849
  };
1822
1850
 
1823
1851
  /**
1852
+ * Apply performance defaults.
1824
1853
  * @param {Performance} performance options
1825
1854
  * @param {object} options options
1826
1855
  * @param {boolean} options.production is production
@@ -1834,6 +1863,7 @@ const applyPerformanceDefaults = (performance, { production }) => {
1834
1863
  };
1835
1864
 
1836
1865
  /**
1866
+ * Apply optimization defaults.
1837
1867
  * @param {Optimization} optimization options
1838
1868
  * @param {object} options options
1839
1869
  * @param {boolean} options.production is production
@@ -1931,6 +1961,7 @@ const applyOptimizationDefaults = (
1931
1961
  };
1932
1962
 
1933
1963
  /**
1964
+ * Gets resolve defaults.
1934
1965
  * @param {object} options options
1935
1966
  * @param {boolean} options.cache is cache enable
1936
1967
  * @param {string} options.context build context
@@ -2061,6 +2092,7 @@ const getResolveDefaults = ({
2061
2092
  };
2062
2093
 
2063
2094
  /**
2095
+ * Gets resolve loader defaults.
2064
2096
  * @param {object} options options
2065
2097
  * @param {boolean} options.cache is cache enable
2066
2098
  * @returns {ResolveOptions} resolve options
@@ -2080,6 +2112,7 @@ const getResolveLoaderDefaults = ({ cache }) => {
2080
2112
  };
2081
2113
 
2082
2114
  /**
2115
+ * Apply infrastructure logging defaults.
2083
2116
  * @param {InfrastructureLogging} infrastructureLogging options
2084
2117
  * @returns {void}
2085
2118
  */
@@ -25,12 +25,14 @@ const util = require("util");
25
25
  /** @typedef {import("../WebpackError")} WebpackError */
26
26
 
27
27
  /**
28
+ * Defines the webpack options interception type used by this module.
28
29
  * @typedef {object} WebpackOptionsInterception
29
30
  * @property {WebpackOptionsNormalized["devtool"]=} devtool
30
31
  */
31
32
 
32
33
  const handledDeprecatedNoEmitOnErrors = util.deprecate(
33
34
  /**
35
+ * Handles the callback logic for this hook.
34
36
  * @param {boolean} noEmitOnErrors no emit on errors
35
37
  * @param {boolean | undefined} emitOnErrors emit on errors
36
38
  * @returns {boolean} emit on errors
@@ -48,6 +50,7 @@ const handledDeprecatedNoEmitOnErrors = util.deprecate(
48
50
  );
49
51
 
50
52
  /**
53
+ * Returns result value.
51
54
  * @template T
52
55
  * @template R
53
56
  * @param {T | undefined} value value or not
@@ -58,12 +61,14 @@ const nestedConfig = (value, fn) =>
58
61
  value === undefined ? fn(/** @type {T} */ ({})) : fn(value);
59
62
 
60
63
  /**
64
+ * Returns result value.
61
65
  * @template T
62
66
  * @param {T | undefined} value value or not
63
67
  * @returns {T} result value
64
68
  */
65
69
  const cloneObject = (value) => /** @type {T} */ ({ ...value });
66
70
  /**
71
+ * Optional nested config.
67
72
  * @template T
68
73
  * @template R
69
74
  * @param {T | undefined} value value or not
@@ -74,6 +79,7 @@ const optionalNestedConfig = (value, fn) =>
74
79
  value === undefined ? undefined : fn(value);
75
80
 
76
81
  /**
82
+ * Returns cloned value.
77
83
  * @template T
78
84
  * @template R
79
85
  * @param {T[] | undefined} value array or not
@@ -83,6 +89,7 @@ const optionalNestedConfig = (value, fn) =>
83
89
  const nestedArray = (value, fn) => (Array.isArray(value) ? fn(value) : fn([]));
84
90
 
85
91
  /**
92
+ * Optional nested array.
86
93
  * @template T
87
94
  * @template R
88
95
  * @param {T[] | undefined} value array or not
@@ -93,6 +100,7 @@ const optionalNestedArray = (value, fn) =>
93
100
  Array.isArray(value) ? fn(value) : undefined;
94
101
 
95
102
  /**
103
+ * Keyed nested config.
96
104
  * @template T
97
105
  * @template R
98
106
  * @param {Record<string, T> | undefined} value value or not
@@ -126,6 +134,7 @@ const keyedNestedConfig = (value, fn, customKeys) => {
126
134
  };
127
135
 
128
136
  /**
137
+ * Gets normalized webpack options.
129
138
  * @param {WebpackOptions} config input config
130
139
  * @returns {WebpackOptionsNormalized} normalized options
131
140
  */
@@ -500,6 +509,7 @@ const getNormalizedWebpackOptions = (config) => ({
500
509
  });
501
510
 
502
511
  /**
512
+ * Gets normalized entry static.
503
513
  * @param {EntryStatic} entry static entry options
504
514
  * @returns {EntryStaticNormalized} normalized static entry options
505
515
  */
@@ -562,6 +572,7 @@ const getNormalizedEntryStatic = (entry) => {
562
572
  };
563
573
 
564
574
  /**
575
+ * Gets normalized optimization runtime chunk.
565
576
  * @param {OptimizationRuntimeChunk=} runtimeChunk runtimeChunk option
566
577
  * @returns {OptimizationRuntimeChunkNormalized=} normalized runtimeChunk option
567
578
  */
@@ -589,6 +600,7 @@ const getNormalizedOptimizationRuntimeChunk = (runtimeChunk) => {
589
600
  };
590
601
 
591
602
  /**
603
+ * Apply webpack options interception.
592
604
  * @param {WebpackOptionsNormalized} options options to be intercepted
593
605
  * @returns {{ options: WebpackOptionsNormalized, interception?: WebpackOptionsInterception }} options and interception
594
606
  */
@@ -12,6 +12,7 @@ const getBrowserslistTargetHandler = memoize(() =>
12
12
  );
13
13
 
14
14
  /**
15
+ * Gets default target.
15
16
  * @param {string} context the context directory
16
17
  * @returns {string} default target
17
18
  */
@@ -21,6 +22,7 @@ const getDefaultTarget = (context) => {
21
22
  };
22
23
 
23
24
  /**
25
+ * Defines the platform target properties type used by this module.
24
26
  * @typedef {object} PlatformTargetProperties
25
27
  * @property {boolean | null=} web web platform, importing of http(s) and std: is available
26
28
  * @property {boolean | null=} browser browser platform, running in a normal web browser
@@ -31,6 +33,7 @@ const getDefaultTarget = (context) => {
31
33
  */
32
34
 
33
35
  /**
36
+ * Defines the electron context target properties type used by this module.
34
37
  * @typedef {object} ElectronContextTargetProperties
35
38
  * @property {boolean | null} electronMain in main context
36
39
  * @property {boolean | null} electronPreload in preload context
@@ -38,6 +41,7 @@ const getDefaultTarget = (context) => {
38
41
  */
39
42
 
40
43
  /**
44
+ * Defines the api target properties type used by this module.
41
45
  * @typedef {object} ApiTargetProperties
42
46
  * @property {boolean | null} require has require function available
43
47
  * @property {boolean | null} nodeBuiltins has node.js built-in modules available
@@ -51,6 +55,7 @@ const getDefaultTarget = (context) => {
51
55
  */
52
56
 
53
57
  /**
58
+ * Defines the ecma target properties type used by this module.
54
59
  * @typedef {object} EcmaTargetProperties
55
60
  * @property {boolean | null} globalThis has globalThis variable available
56
61
  * @property {boolean | null} bigIntLiteral big int literal syntax is available
@@ -68,11 +73,13 @@ const getDefaultTarget = (context) => {
68
73
  */
69
74
 
70
75
  /**
76
+ * Defines the shared type used by this module.
71
77
  * @template T
72
78
  * @typedef {{ [P in keyof T]?: never }} Never<T>
73
79
  */
74
80
 
75
81
  /**
82
+ * Defines the shared type used by this module.
76
83
  * @template A
77
84
  * @template B
78
85
  * @typedef {(A & Never<B>) | (Never<A> & B) | (A & B)} Mix<A, B>
@@ -81,6 +88,7 @@ const getDefaultTarget = (context) => {
81
88
  /** @typedef {Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>} TargetProperties */
82
89
 
83
90
  /**
91
+ * Returns check if version is greater or equal.
84
92
  * @param {string} major major version
85
93
  * @param {string | undefined} minor minor version
86
94
  * @returns {(vMajor: number, vMinor?: number) => boolean | undefined} check if version is greater or equal
@@ -320,6 +328,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
320
328
  ];
321
329
 
322
330
  /**
331
+ * Gets target properties.
323
332
  * @param {string} target the target
324
333
  * @param {string} context the context directory
325
334
  * @returns {TargetProperties} target properties
@@ -341,6 +350,7 @@ const getTargetProperties = (target, context) => {
341
350
  };
342
351
 
343
352
  /**
353
+ * Merges target properties.
344
354
  * @param {TargetProperties[]} targetProperties array of target properties
345
355
  * @returns {TargetProperties} merged target properties
346
356
  */
@@ -377,6 +387,7 @@ const mergeTargetProperties = (targetProperties) => {
377
387
  };
378
388
 
379
389
  /**
390
+ * Gets targets properties.
380
391
  * @param {string[]} targets the targets
381
392
  * @param {string} context the context directory
382
393
  * @returns {TargetProperties} target properties
@@ -12,6 +12,7 @@ const makeSerializable = require("../util/makeSerializable");
12
12
 
13
13
  class ContainerEntryDependency extends Dependency {
14
14
  /**
15
+ * Creates an instance of ContainerEntryDependency.
15
16
  * @param {string} name entry name
16
17
  * @param {ExposesList} exposes list of exposed modules
17
18
  * @param {string} shareScope name of the share scope
@@ -27,6 +28,7 @@ class ContainerEntryDependency extends Dependency {
27
28
  }
28
29
 
29
30
  /**
31
+ * Returns an identifier to merge equal requests.
30
32
  * @returns {string | null} an identifier to merge equal requests
31
33
  */
32
34
  getResourceIdentifier() {