webpack 5.100.1 → 5.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/README.md +12 -10
  2. package/bin/webpack.js +7 -7
  3. package/lib/APIPlugin.js +12 -14
  4. package/lib/AutomaticPrefetchPlugin.js +2 -2
  5. package/lib/BannerPlugin.js +4 -4
  6. package/lib/Cache.js +1 -1
  7. package/lib/CacheFacade.js +7 -7
  8. package/lib/CaseSensitiveModulesWarning.js +2 -2
  9. package/lib/Chunk.js +3 -3
  10. package/lib/ChunkGraph.js +21 -18
  11. package/lib/ChunkGroup.js +4 -4
  12. package/lib/CleanPlugin.js +19 -53
  13. package/lib/CodeGenerationResults.js +3 -3
  14. package/lib/CompatibilityPlugin.js +6 -6
  15. package/lib/Compilation.js +127 -114
  16. package/lib/Compiler.js +37 -37
  17. package/lib/ConcatenationScope.js +39 -1
  18. package/lib/ConstPlugin.js +11 -11
  19. package/lib/ContextExclusionPlugin.js +3 -3
  20. package/lib/ContextModule.js +12 -11
  21. package/lib/ContextModuleFactory.js +11 -11
  22. package/lib/ContextReplacementPlugin.js +5 -5
  23. package/lib/DefinePlugin.js +24 -22
  24. package/lib/DelegatedModuleFactoryPlugin.js +1 -1
  25. package/lib/DllEntryPlugin.js +1 -1
  26. package/lib/DllReferencePlugin.js +1 -1
  27. package/lib/DynamicEntryPlugin.js +3 -3
  28. package/lib/EntryPlugin.js +1 -1
  29. package/lib/EnvironmentPlugin.js +1 -1
  30. package/lib/ErrorHelpers.js +2 -2
  31. package/lib/EvalDevToolModulePlugin.js +2 -2
  32. package/lib/EvalSourceMapDevToolPlugin.js +5 -5
  33. package/lib/ExportsInfo.js +9 -9
  34. package/lib/ExportsInfoApiPlugin.js +2 -2
  35. package/lib/ExternalModule.js +163 -48
  36. package/lib/ExternalModuleFactoryPlugin.js +2 -2
  37. package/lib/ExternalsPlugin.js +45 -0
  38. package/lib/FileSystemInfo.js +64 -61
  39. package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
  40. package/lib/FlagDependencyExportsPlugin.js +7 -7
  41. package/lib/FlagDependencyUsagePlugin.js +4 -4
  42. package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
  43. package/lib/HotModuleReplacementPlugin.js +27 -27
  44. package/lib/IgnorePlugin.js +3 -3
  45. package/lib/IgnoreWarningsPlugin.js +4 -4
  46. package/lib/InitFragment.js +6 -0
  47. package/lib/InvalidDependenciesModuleWarning.js +1 -1
  48. package/lib/JavascriptMetaInfoPlugin.js +1 -1
  49. package/lib/LibManifestPlugin.js +2 -2
  50. package/lib/LoaderOptionsPlugin.js +1 -1
  51. package/lib/LoaderTargetPlugin.js +2 -2
  52. package/lib/MainTemplate.js +1 -1
  53. package/lib/Module.js +1 -1
  54. package/lib/ModuleFilenameHelpers.js +3 -3
  55. package/lib/ModuleGraph.js +86 -5
  56. package/lib/ModuleInfoHeaderPlugin.js +3 -3
  57. package/lib/ModuleParseError.js +5 -3
  58. package/lib/MultiCompiler.js +29 -24
  59. package/lib/MultiStats.js +18 -13
  60. package/lib/MultiWatching.js +1 -1
  61. package/lib/NoEmitOnErrorsPlugin.js +2 -2
  62. package/lib/NodeStuffPlugin.js +27 -15
  63. package/lib/NormalModule.js +28 -24
  64. package/lib/NormalModuleFactory.js +23 -21
  65. package/lib/NormalModuleReplacementPlugin.js +3 -3
  66. package/lib/PrefetchPlugin.js +1 -1
  67. package/lib/ProgressPlugin.js +11 -11
  68. package/lib/ProvidePlugin.js +2 -2
  69. package/lib/RecordIdsPlugin.js +3 -3
  70. package/lib/ResolverFactory.js +3 -3
  71. package/lib/RuntimeGlobals.js +20 -0
  72. package/lib/RuntimePlugin.js +16 -16
  73. package/lib/RuntimeTemplate.js +42 -44
  74. package/lib/SizeFormatHelpers.js +1 -1
  75. package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
  76. package/lib/SourceMapDevToolPlugin.js +9 -9
  77. package/lib/Stats.js +2 -2
  78. package/lib/Template.js +1 -1
  79. package/lib/TemplatedPathPlugin.js +2 -2
  80. package/lib/UseStrictPlugin.js +1 -1
  81. package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
  82. package/lib/WarnDeprecatedOptionPlugin.js +1 -1
  83. package/lib/WarnNoModeSetPlugin.js +1 -1
  84. package/lib/WatchIgnorePlugin.js +2 -2
  85. package/lib/Watching.js +12 -12
  86. package/lib/WebpackIsIncludedPlugin.js +2 -2
  87. package/lib/WebpackOptionsApply.js +10 -3
  88. package/lib/asset/AssetGenerator.js +3 -3
  89. package/lib/asset/AssetModulesPlugin.js +6 -6
  90. package/lib/async-modules/AsyncModuleHelpers.js +50 -0
  91. package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
  92. package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
  93. package/lib/buildChunkGraph.js +5 -5
  94. package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
  95. package/lib/cache/IdleFileCachePlugin.js +5 -5
  96. package/lib/cache/PackFileCacheStrategy.js +20 -20
  97. package/lib/cache/ResolverCachePlugin.js +4 -4
  98. package/lib/cli.js +196 -14
  99. package/lib/config/browserslistTargetHandler.js +6 -6
  100. package/lib/config/defaults.js +23 -14
  101. package/lib/config/normalization.js +41 -38
  102. package/lib/config/target.js +4 -4
  103. package/lib/container/ContainerEntryModule.js +3 -3
  104. package/lib/container/ContainerPlugin.js +3 -3
  105. package/lib/container/ContainerReferencePlugin.js +3 -3
  106. package/lib/container/FallbackModule.js +1 -1
  107. package/lib/container/HoistContainerReferencesPlugin.js +7 -7
  108. package/lib/container/options.js +4 -4
  109. package/lib/css/CssGenerator.js +5 -3
  110. package/lib/css/CssLoadingRuntimeModule.js +1 -1
  111. package/lib/css/CssModulesPlugin.js +25 -22
  112. package/lib/css/CssParser.js +5 -5
  113. package/lib/css/walkCssTokens.js +9 -9
  114. package/lib/debug/ProfilingPlugin.js +5 -5
  115. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
  116. package/lib/dependencies/AMDPlugin.js +3 -3
  117. package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
  118. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
  119. package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
  120. package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
  121. package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
  122. package/lib/dependencies/CommonJsPlugin.js +2 -2
  123. package/lib/dependencies/ContextDependency.js +1 -1
  124. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  125. package/lib/dependencies/CssIcssExportDependency.js +2 -2
  126. package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
  127. package/lib/dependencies/CssUrlDependency.js +4 -4
  128. package/lib/dependencies/DynamicExports.js +5 -5
  129. package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
  130. package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
  131. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -23
  132. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
  133. package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
  134. package/lib/dependencies/HarmonyExports.js +1 -1
  135. package/lib/dependencies/HarmonyImportDependency.js +28 -9
  136. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +59 -75
  137. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
  138. package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
  139. package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
  140. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
  141. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
  142. package/lib/dependencies/ImportMetaPlugin.js +7 -7
  143. package/lib/dependencies/ImportParserPlugin.js +4 -4
  144. package/lib/dependencies/JsonExportsDependency.js +1 -1
  145. package/lib/dependencies/LoaderPlugin.js +4 -4
  146. package/lib/dependencies/ProvidedDependency.js +2 -2
  147. package/lib/dependencies/PureExpressionDependency.js +1 -1
  148. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  149. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
  150. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
  151. package/lib/dependencies/SystemPlugin.js +3 -3
  152. package/lib/dependencies/WorkerPlugin.js +5 -5
  153. package/lib/dependencies/getFunctionExpression.js +1 -1
  154. package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
  155. package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
  156. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
  157. package/lib/formatLocation.js +2 -2
  158. package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
  159. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
  160. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
  161. package/lib/hmr/LazyCompilationPlugin.js +6 -6
  162. package/lib/hmr/lazyCompilationBackend.js +6 -6
  163. package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
  164. package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
  165. package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
  166. package/lib/ids/HashedModuleIdsPlugin.js +1 -1
  167. package/lib/ids/IdHelpers.js +9 -9
  168. package/lib/ids/NamedChunkIdsPlugin.js +5 -5
  169. package/lib/ids/NamedModuleIdsPlugin.js +2 -2
  170. package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
  171. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  172. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
  173. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
  174. package/lib/ids/SyncModuleIdsPlugin.js +4 -4
  175. package/lib/index.js +10 -6
  176. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
  177. package/lib/javascript/BasicEvaluatedExpression.js +3 -3
  178. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
  179. package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
  180. package/lib/javascript/JavascriptGenerator.js +1 -1
  181. package/lib/javascript/JavascriptModulesPlugin.js +16 -16
  182. package/lib/javascript/JavascriptParser.js +90 -83
  183. package/lib/javascript/JavascriptParserHelpers.js +3 -3
  184. package/lib/javascript/StartupHelpers.js +2 -2
  185. package/lib/json/JsonGenerator.js +2 -2
  186. package/lib/json/JsonModulesPlugin.js +2 -2
  187. package/lib/library/AbstractLibraryPlugin.js +3 -3
  188. package/lib/library/AmdLibraryPlugin.js +3 -3
  189. package/lib/library/AssignLibraryPlugin.js +2 -2
  190. package/lib/library/EnableLibraryPlugin.js +2 -2
  191. package/lib/library/ModuleLibraryPlugin.js +7 -2
  192. package/lib/library/SystemLibraryPlugin.js +6 -4
  193. package/lib/library/UmdLibraryPlugin.js +14 -14
  194. package/lib/logging/createConsoleLogger.js +4 -4
  195. package/lib/logging/runtime.js +3 -3
  196. package/lib/logging/truncateArgs.js +4 -4
  197. package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
  198. package/lib/node/NodeEnvironmentPlugin.js +1 -1
  199. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
  200. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
  201. package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
  202. package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
  203. package/lib/node/nodeConsole.js +2 -2
  204. package/lib/optimize/AggressiveMergingPlugin.js +2 -2
  205. package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
  206. package/lib/optimize/ConcatenatedModule.js +161 -52
  207. package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
  208. package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
  209. package/lib/optimize/InnerGraph.js +5 -5
  210. package/lib/optimize/InnerGraphPlugin.js +14 -12
  211. package/lib/optimize/LimitChunkCountPlugin.js +5 -5
  212. package/lib/optimize/MangleExportsPlugin.js +5 -5
  213. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
  214. package/lib/optimize/MinChunkSizePlugin.js +3 -3
  215. package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
  216. package/lib/optimize/RealContentHashPlugin.js +23 -23
  217. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
  218. package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
  219. package/lib/optimize/RuntimeChunkPlugin.js +2 -2
  220. package/lib/optimize/SideEffectsFlagPlugin.js +22 -6
  221. package/lib/optimize/SplitChunksPlugin.js +20 -20
  222. package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
  223. package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
  224. package/lib/performance/SizeLimitsPlugin.js +4 -4
  225. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
  226. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
  227. package/lib/rules/BasicMatcherRulePlugin.js +1 -1
  228. package/lib/rules/RuleSetCompiler.js +10 -10
  229. package/lib/rules/UseEffectRulePlugin.js +2 -2
  230. package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
  231. package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
  232. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
  233. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
  234. package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
  235. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
  236. package/lib/schemes/DataUriPlugin.js +3 -3
  237. package/lib/schemes/FileUriPlugin.js +1 -1
  238. package/lib/schemes/HttpUriPlugin.js +40 -36
  239. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  240. package/lib/serialization/BinaryMiddleware.js +11 -11
  241. package/lib/serialization/FileMiddleware.js +17 -17
  242. package/lib/serialization/ObjectMiddleware.js +8 -8
  243. package/lib/serialization/Serializer.js +2 -2
  244. package/lib/serialization/SerializerMiddleware.js +2 -2
  245. package/lib/sharing/ConsumeSharedPlugin.js +4 -4
  246. package/lib/sharing/ProvideSharedPlugin.js +4 -4
  247. package/lib/sharing/SharePlugin.js +1 -1
  248. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  249. package/lib/stats/DefaultStatsFactoryPlugin.js +86 -80
  250. package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
  251. package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
  252. package/lib/stats/StatsFactory.js +7 -7
  253. package/lib/stats/StatsPrinter.js +9 -9
  254. package/lib/url/URLParserPlugin.js +5 -5
  255. package/lib/util/AsyncQueue.js +4 -4
  256. package/lib/util/IterableHelpers.js +2 -2
  257. package/lib/util/LazyBucketSortedSet.js +3 -3
  258. package/lib/util/SetHelpers.js +2 -2
  259. package/lib/util/StackedCacheMap.js +1 -1
  260. package/lib/util/StackedMap.js +1 -1
  261. package/lib/util/TupleSet.js +1 -1
  262. package/lib/util/WeakTupleMap.js +1 -1
  263. package/lib/util/cleverMerge.js +8 -8
  264. package/lib/util/comparators.js +107 -8
  265. package/lib/util/compileBooleanMatcher.js +20 -20
  266. package/lib/util/concatenate.js +3 -3
  267. package/lib/util/conventions.js +4 -4
  268. package/lib/util/create-schema-validation.js +1 -1
  269. package/lib/util/createHash.js +1 -1
  270. package/lib/util/deprecation.js +4 -4
  271. package/lib/util/deterministicGrouping.js +7 -7
  272. package/lib/util/findGraphRoots.js +1 -1
  273. package/lib/util/fs.js +3 -3
  274. package/lib/util/identifier.js +14 -14
  275. package/lib/util/magicComment.js +5 -1
  276. package/lib/util/memoize.js +1 -1
  277. package/lib/util/processAsyncTree.js +2 -2
  278. package/lib/util/propertyName.js +1 -1
  279. package/lib/util/removeBOM.js +1 -1
  280. package/lib/util/runtime.js +6 -6
  281. package/lib/util/semver.js +16 -16
  282. package/lib/util/serialization.js +5 -5
  283. package/lib/util/smartGrouping.js +1 -1
  284. package/lib/validateSchema.js +2 -2
  285. package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
  286. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
  287. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
  288. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
  289. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
  290. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
  291. package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
  292. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
  293. package/lib/wasm-sync/WebAssemblyParser.js +2 -2
  294. package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
  295. package/lib/web/FetchCompileWasmPlugin.js +4 -4
  296. package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
  297. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
  298. package/lib/webpack.js +17 -12
  299. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
  300. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  301. package/package.json +13 -13
  302. package/schemas/WebpackOptions.check.js +1 -1
  303. package/schemas/WebpackOptions.json +4 -0
  304. package/types.d.ts +186 -54
@@ -64,7 +64,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
64
64
  /** @typedef {KnownStatsCompilation & Record<string, EXPECTED_ANY>} StatsCompilation */
65
65
  /**
66
66
  * @typedef {object} KnownStatsCompilation
67
- * @property {Record<string, EXPECTED_ANY>=} env
67
+ * @property {EXPECTED_ANY=} env
68
68
  * @property {string=} name
69
69
  * @property {string=} hash
70
70
  * @property {string=} version
@@ -556,19 +556,19 @@ const SIMPLE_EXTRACTORS = {
556
556
  }
557
557
  if (!context.cachedGetErrors) {
558
558
  const map = new WeakMap();
559
- context.cachedGetErrors = compilation =>
559
+ context.cachedGetErrors = (compilation) =>
560
560
  map.get(compilation) ||
561
561
  // eslint-disable-next-line no-sequences
562
- (errors => (map.set(compilation, errors), errors))(
562
+ ((errors) => (map.set(compilation, errors), errors))(
563
563
  compilation.getErrors()
564
564
  );
565
565
  }
566
566
  if (!context.cachedGetWarnings) {
567
567
  const map = new WeakMap();
568
- context.cachedGetWarnings = compilation =>
568
+ context.cachedGetWarnings = (compilation) =>
569
569
  map.get(compilation) ||
570
570
  // eslint-disable-next-line no-sequences
571
- (warnings => (map.set(compilation, warnings), warnings))(
571
+ ((warnings) => (map.set(compilation, warnings), warnings))(
572
572
  compilation.getWarnings()
573
573
  );
574
574
  }
@@ -639,7 +639,7 @@ const SIMPLE_EXTRACTORS = {
639
639
  );
640
640
  let depthInCollapsedGroup = 0;
641
641
  for (const [origin, logEntries] of compilation.logging) {
642
- const debugMode = loggingDebug.some(fn => fn(origin));
642
+ const debugMode = loggingDebug.some((fn) => fn(origin));
643
643
  if (logging === false && !debugMode) continue;
644
644
  /** @type {KnownStatsLoggingEntry[]} */
645
645
  const groupStack = [];
@@ -724,7 +724,7 @@ const SIMPLE_EXTRACTORS = {
724
724
  hash: (object, compilation) => {
725
725
  object.hash = /** @type {string} */ (compilation.hash);
726
726
  },
727
- version: object => {
727
+ version: (object) => {
728
728
  object.version = require("../../package.json").version;
729
729
  },
730
730
  env: (object, compilation, context, { _env }) => {
@@ -796,6 +796,7 @@ const SIMPLE_EXTRACTORS = {
796
796
  ? relatedEntry
797
797
  : [relatedEntry];
798
798
  for (const dep of deps) {
799
+ if (!dep) continue;
799
800
  const depItem = assetMap.get(dep);
800
801
  if (!depItem) continue;
801
802
  assets.delete(depItem);
@@ -912,7 +913,7 @@ const SIMPLE_EXTRACTORS = {
912
913
  let filtered = 0;
913
914
  if (options.errorDetails === "auto" && rawErrors.length >= 3) {
914
915
  filtered = rawErrors
915
- .map(e => typeof e !== "string" && e.details)
916
+ .map((e) => typeof e !== "string" && e.details)
916
917
  .filter(Boolean).length;
917
918
  }
918
919
  if (
@@ -932,7 +933,7 @@ const SIMPLE_EXTRACTORS = {
932
933
  object.errors = errors;
933
934
  },
934
935
  errorsCount: (object, compilation, { cachedGetErrors }) => {
935
- object.errorsCount = countWithChildren(compilation, c =>
936
+ object.errorsCount = countWithChildren(compilation, (c) =>
936
937
  cachedGetErrors(c)
937
938
  );
938
939
  },
@@ -946,7 +947,7 @@ const SIMPLE_EXTRACTORS = {
946
947
  let filtered = 0;
947
948
  if (options.errorDetails === "auto") {
948
949
  filtered = cachedGetWarnings(compilation)
949
- .map(e => typeof e !== "string" && e.details)
950
+ .map((e) => typeof e !== "string" && e.details)
950
951
  .filter(Boolean).length;
951
952
  }
952
953
  if (
@@ -989,14 +990,14 @@ const SIMPLE_EXTRACTORS = {
989
990
  * @param {StatsError} warning warning
990
991
  * @returns {boolean} result
991
992
  */
992
- warning => {
993
+ (warning) => {
993
994
  const warningString = Object.keys(warning)
994
995
  .map(
995
- key =>
996
+ (key) =>
996
997
  `${warning[/** @type {keyof KnownStatsError} */ (key)]}`
997
998
  )
998
999
  .join("\n");
999
- return !warningsFilter.some(filter =>
1000
+ return !warningsFilter.some((filter) =>
1000
1001
  filter(warning, warningString)
1001
1002
  );
1002
1003
  }
@@ -1044,22 +1045,22 @@ const SIMPLE_EXTRACTORS = {
1044
1045
  compilationAuxiliaryFileToChunks.get(asset.name) || [];
1045
1046
  object.chunkNames = uniqueOrderedArray(
1046
1047
  chunks,
1047
- c => (c.name ? [c.name] : []),
1048
+ (c) => (c.name ? [c.name] : []),
1048
1049
  compareIds
1049
1050
  );
1050
1051
  object.chunkIdHints = uniqueOrderedArray(
1051
1052
  chunks,
1052
- c => [...c.idNameHints],
1053
+ (c) => [...c.idNameHints],
1053
1054
  compareIds
1054
1055
  );
1055
1056
  object.auxiliaryChunkNames = uniqueOrderedArray(
1056
1057
  auxiliaryChunks,
1057
- c => (c.name ? [c.name] : []),
1058
+ (c) => (c.name ? [c.name] : []),
1058
1059
  compareIds
1059
1060
  );
1060
1061
  object.auxiliaryChunkIdHints = uniqueOrderedArray(
1061
1062
  auxiliaryChunks,
1062
- c => [...c.idNameHints],
1063
+ (c) => [...c.idNameHints],
1063
1064
  compareIds
1064
1065
  );
1065
1066
  object.filteredRelated = asset.related ? asset.related.length : undefined;
@@ -1086,12 +1087,12 @@ const SIMPLE_EXTRACTORS = {
1086
1087
  compilationAuxiliaryFileToChunks.get(asset.name) || [];
1087
1088
  object.chunks = uniqueOrderedArray(
1088
1089
  chunks,
1089
- c => /** @type {ChunkId[]} */ (c.ids),
1090
+ (c) => /** @type {ChunkId[]} */ (c.ids),
1090
1091
  compareIds
1091
1092
  );
1092
1093
  object.auxiliaryChunks = uniqueOrderedArray(
1093
1094
  auxiliaryChunks,
1094
- c => /** @type {ChunkId[]} */ (c.ids),
1095
+ (c) => /** @type {ChunkId[]} */ (c.ids),
1095
1096
  compareIds
1096
1097
  );
1097
1098
  },
@@ -1113,7 +1114,7 @@ const SIMPLE_EXTRACTORS = {
1113
1114
  * @param {string} name Name
1114
1115
  * @returns {{ name: string, size: number }} Asset object
1115
1116
  */
1116
- const toAsset = name => {
1117
+ const toAsset = (name) => {
1117
1118
  const asset = compilation.getAsset(name);
1118
1119
  return {
1119
1120
  name,
@@ -1122,10 +1123,12 @@ const SIMPLE_EXTRACTORS = {
1122
1123
  };
1123
1124
  /** @type {(total: number, asset: { size: number }) => number} */
1124
1125
  const sizeReducer = (total, { size }) => total + size;
1125
- const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(toAsset);
1126
+ const assets = uniqueArray(chunkGroup.chunks, (c) => c.files).map(
1127
+ toAsset
1128
+ );
1126
1129
  const auxiliaryAssets = uniqueOrderedArray(
1127
1130
  chunkGroup.chunks,
1128
- c => c.auxiliaryFiles,
1131
+ (c) => c.auxiliaryFiles,
1129
1132
  compareIds
1130
1133
  ).map(toAsset);
1131
1134
  const assetsSize = assets.reduce(sizeReducer, 0);
@@ -1134,7 +1137,7 @@ const SIMPLE_EXTRACTORS = {
1134
1137
  const statsChunkGroup = {
1135
1138
  name,
1136
1139
  chunks: ids
1137
- ? /** @type {ChunkId[]} */ (chunkGroup.chunks.map(c => c.id))
1140
+ ? /** @type {ChunkId[]} */ (chunkGroup.chunks.map((c) => c.id))
1138
1141
  : undefined,
1139
1142
  assets: assets.length <= chunkGroupMaxAssets ? assets : undefined,
1140
1143
  filteredAssets:
@@ -1150,14 +1153,14 @@ const SIMPLE_EXTRACTORS = {
1150
1153
  : auxiliaryAssets.length,
1151
1154
  auxiliaryAssetsSize,
1152
1155
  children: children
1153
- ? mapObject(children, groups =>
1154
- groups.map(group => {
1155
- const assets = uniqueArray(group.chunks, c => c.files).map(
1156
+ ? mapObject(children, (groups) =>
1157
+ groups.map((group) => {
1158
+ const assets = uniqueArray(group.chunks, (c) => c.files).map(
1156
1159
  toAsset
1157
1160
  );
1158
1161
  const auxiliaryAssets = uniqueOrderedArray(
1159
1162
  group.chunks,
1160
- c => c.auxiliaryFiles,
1163
+ (c) => c.auxiliaryFiles,
1161
1164
  compareIds
1162
1165
  ).map(toAsset);
1163
1166
 
@@ -1166,7 +1169,7 @@ const SIMPLE_EXTRACTORS = {
1166
1169
  name: group.name,
1167
1170
  chunks: ids
1168
1171
  ? /** @type {ChunkId[]} */
1169
- (group.chunks.map(c => c.id))
1172
+ (group.chunks.map((c) => c.id))
1170
1173
  : undefined,
1171
1174
  assets:
1172
1175
  assets.length <= chunkGroupMaxAssets ? assets : undefined,
@@ -1189,7 +1192,7 @@ const SIMPLE_EXTRACTORS = {
1189
1192
  )
1190
1193
  : undefined,
1191
1194
  childAssets: children
1192
- ? mapObject(children, groups => {
1195
+ ? mapObject(children, (groups) => {
1193
1196
  /** @type {Set<string>} */
1194
1197
  const set = new Set();
1195
1198
  for (const group of groups) {
@@ -1313,7 +1316,7 @@ const SIMPLE_EXTRACTORS = {
1313
1316
  module,
1314
1317
  compareChunksById
1315
1318
  ),
1316
- chunk => chunk.id
1319
+ (chunk) => chunk.id
1317
1320
  )
1318
1321
  );
1319
1322
  },
@@ -1368,7 +1371,7 @@ const SIMPLE_EXTRACTORS = {
1368
1371
  ) => {
1369
1372
  object.optimizationBailout = moduleGraph
1370
1373
  .getOptimizationBailout(module)
1371
- .map(item => {
1374
+ .map((item) => {
1372
1375
  if (typeof item === "function") return item(requestShortener);
1373
1376
  return item;
1374
1377
  });
@@ -1578,7 +1581,7 @@ const SIMPLE_EXTRACTORS = {
1578
1581
  for (const g of chunk.groupsIterable) {
1579
1582
  origins.push(...g.origins);
1580
1583
  }
1581
- const array = origins.filter(origin => {
1584
+ const array = origins.filter((origin) => {
1582
1585
  const key = [
1583
1586
  origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
1584
1587
  formatLocation(origin.loc),
@@ -1625,8 +1628,8 @@ const SIMPLE_EXTRACTORS = {
1625
1628
  object.moduleIdentifier = module.identifier();
1626
1629
  object.moduleName = module.readableIdentifier(requestShortener);
1627
1630
  const dependencies = [...moduleGraph.getIncomingConnections(module)]
1628
- .filter(c => c.resolvedOriginModule === origin && c.dependency)
1629
- .map(c => c.dependency);
1631
+ .filter((c) => c.resolvedOriginModule === origin && c.dependency)
1632
+ .map((c) => c.dependency);
1630
1633
  object.dependencies = factory.create(
1631
1634
  `${type}.dependencies`,
1632
1635
  /** @type {Dependency[]} */
@@ -1670,9 +1673,11 @@ const FILTER_RESULTS = {
1670
1673
  warningsFilter: util.deprecate(
1671
1674
  (warning, context, { warningsFilter }) => {
1672
1675
  const warningString = Object.keys(warning)
1673
- .map(key => `${warning[/** @type {keyof KnownStatsError} */ (key)]}`)
1676
+ .map(
1677
+ (key) => `${warning[/** @type {keyof KnownStatsError} */ (key)]}`
1678
+ )
1674
1679
  .join("\n");
1675
- return !warningsFilter.some(filter => filter(warning, warningString));
1680
+ return !warningsFilter.some((filter) => filter(warning, warningString));
1676
1681
  },
1677
1682
  "config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings",
1678
1683
  "DEP_WEBPACK_STATS_WARNINGS_FILTER"
@@ -1684,9 +1689,9 @@ const FILTER_RESULTS = {
1684
1689
  const MODULES_SORTER = {
1685
1690
  _: (comparators, { compilation: { moduleGraph } }) => {
1686
1691
  comparators.push(
1687
- compareSelect(m => moduleGraph.getDepth(m), compareNumbers),
1688
- compareSelect(m => moduleGraph.getPreOrderIndex(m), compareNumbers),
1689
- compareSelect(m => m.identifier(), compareIds)
1692
+ compareSelect((m) => moduleGraph.getDepth(m), compareNumbers),
1693
+ compareSelect((m) => moduleGraph.getPreOrderIndex(m), compareNumbers),
1694
+ compareSelect((m) => m.identifier(), compareIds)
1690
1695
  );
1691
1696
  }
1692
1697
  };
@@ -1694,8 +1699,8 @@ const MODULES_SORTER = {
1694
1699
  /** @type {Record<string, Record<string, (comparators: Comparator<TODO>[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>>} */
1695
1700
  const SORTERS = {
1696
1701
  "compilation.chunks": {
1697
- _: comparators => {
1698
- comparators.push(compareSelect(c => c.id, compareIds));
1702
+ _: (comparators) => {
1703
+ comparators.push(compareSelect((c) => c.id, compareIds));
1699
1704
  }
1700
1705
  },
1701
1706
  "compilation.modules": MODULES_SORTER,
@@ -1705,24 +1710,24 @@ const SORTERS = {
1705
1710
  "module.reasons": {
1706
1711
  _: (comparators, _context) => {
1707
1712
  comparators.push(
1708
- compareSelect(x => x.originModule, compareModulesByIdentifier)
1713
+ compareSelect((x) => x.originModule, compareModulesByIdentifier)
1709
1714
  );
1710
1715
  comparators.push(
1711
- compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier)
1716
+ compareSelect((x) => x.resolvedOriginModule, compareModulesByIdentifier)
1712
1717
  );
1713
1718
  comparators.push(
1714
1719
  compareSelect(
1715
- x => x.dependency,
1720
+ (x) => x.dependency,
1716
1721
  concatComparators(
1717
1722
  compareSelect(
1718
1723
  /**
1719
1724
  * @param {Dependency} x dependency
1720
1725
  * @returns {DependencyLocation} location
1721
1726
  */
1722
- x => x.loc,
1727
+ (x) => x.loc,
1723
1728
  compareLocations
1724
1729
  ),
1725
- compareSelect(x => x.type, compareIds)
1730
+ compareSelect((x) => x.type, compareIds)
1726
1731
  )
1727
1732
  )
1728
1733
  );
@@ -1732,12 +1737,12 @@ const SORTERS = {
1732
1737
  _: (comparators, { compilation: { chunkGraph } }) => {
1733
1738
  comparators.push(
1734
1739
  compareSelect(
1735
- origin =>
1740
+ (origin) =>
1736
1741
  origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
1737
1742
  compareIds
1738
1743
  ),
1739
- compareSelect(origin => formatLocation(origin.loc), compareIds),
1740
- compareSelect(origin => origin.request, compareIds)
1744
+ compareSelect((origin) => formatLocation(origin.loc), compareIds),
1745
+ compareSelect((origin) => origin.request, compareIds)
1741
1746
  );
1742
1747
  }
1743
1748
  }
@@ -1753,7 +1758,7 @@ const SORTERS = {
1753
1758
  * @param {Children<T>} item item
1754
1759
  * @returns {number} item size
1755
1760
  */
1756
- const getItemSize = item =>
1761
+ const getItemSize = (item) =>
1757
1762
  // Each item takes 1 line
1758
1763
  // + the size of the children
1759
1764
  // + 1 extra line when it has children and filteredChildren
@@ -1768,7 +1773,7 @@ const getItemSize = item =>
1768
1773
  * @param {Children<T>[]} children children
1769
1774
  * @returns {number} total size
1770
1775
  */
1771
- const getTotalSize = children => {
1776
+ const getTotalSize = (children) => {
1772
1777
  let size = 0;
1773
1778
  for (const child of children) {
1774
1779
  size += getItemSize(child);
@@ -1781,7 +1786,7 @@ const getTotalSize = children => {
1781
1786
  * @param {Children<T>[]} children children
1782
1787
  * @returns {number} total items
1783
1788
  */
1784
- const getTotalItems = children => {
1789
+ const getTotalItems = (children) => {
1785
1790
  let count = 0;
1786
1791
  for (const child of children) {
1787
1792
  if (!child.children && !child.filteredChildren) {
@@ -1799,7 +1804,7 @@ const getTotalItems = children => {
1799
1804
  * @param {Children<T>[]} children children
1800
1805
  * @returns {Children<T>[]} collapsed children
1801
1806
  */
1802
- const collapse = children => {
1807
+ const collapse = (children) => {
1803
1808
  // After collapse each child must take exactly one line
1804
1809
  const newChildren = [];
1805
1810
  for (const child of children) {
@@ -1956,7 +1961,7 @@ const errorsSpaceLimit = (errors, max) => {
1956
1961
  // print only messages
1957
1962
  if (errors.length + 1 >= max) {
1958
1963
  return [
1959
- errors.map(error => {
1964
+ errors.map((error) => {
1960
1965
  if (typeof error === "string" || !error.details) return error;
1961
1966
  filtered++;
1962
1967
  return { ...error, details: "" };
@@ -2075,7 +2080,7 @@ const ASSETS_GROUPERS = {
2075
2080
  */
2076
2081
  const groupByFlag = (name, exclude) => {
2077
2082
  groupConfigs.push({
2078
- getKeys: asset => (asset[name] ? ["1"] : undefined),
2083
+ getKeys: (asset) => (asset[name] ? ["1"] : undefined),
2079
2084
  getOptions: () => ({
2080
2085
  groupChildren: !exclude,
2081
2086
  force: exclude
@@ -2111,7 +2116,7 @@ const ASSETS_GROUPERS = {
2111
2116
  }
2112
2117
  if (groupAssetsByPath || groupAssetsByExtension) {
2113
2118
  groupConfigs.push({
2114
- getKeys: asset => {
2119
+ getKeys: (asset) => {
2115
2120
  const extensionMatch =
2116
2121
  groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name);
2117
2122
  const extension = extensionMatch ? extensionMatch[1] : "";
@@ -2151,9 +2156,10 @@ const ASSETS_GROUPERS = {
2151
2156
  /**
2152
2157
  * @param {string} name name
2153
2158
  */
2154
- const groupByAssetInfoFlag = name => {
2159
+ const groupByAssetInfoFlag = (name) => {
2155
2160
  groupConfigs.push({
2156
- getKeys: asset => (asset.info && asset.info[name] ? ["1"] : undefined),
2161
+ getKeys: (asset) =>
2162
+ asset.info && asset.info[name] ? ["1"] : undefined,
2157
2163
  createGroup: (key, children, assets) => ({
2158
2164
  type: "assets by info",
2159
2165
  info: {
@@ -2172,9 +2178,9 @@ const ASSETS_GROUPERS = {
2172
2178
  /**
2173
2179
  * @param {keyof KnownStatsAsset} name name
2174
2180
  */
2175
- const groupByNames = name => {
2181
+ const groupByNames = (name) => {
2176
2182
  groupConfigs.push({
2177
- getKeys: asset => /** @type {string[]} */ (asset[name]),
2183
+ getKeys: (asset) => /** @type {string[]} */ (asset[name]),
2178
2184
  createGroup: (key, children, assets) => ({
2179
2185
  type: "assets by chunk",
2180
2186
  [name]: [key],
@@ -2190,9 +2196,9 @@ const ASSETS_GROUPERS = {
2190
2196
  },
2191
2197
  excludeAssets: (groupConfigs, context, { excludeAssets }) => {
2192
2198
  groupConfigs.push({
2193
- getKeys: asset => {
2199
+ getKeys: (asset) => {
2194
2200
  const ident = asset.name;
2195
- const excluded = excludeAssets.some(fn => fn(ident, asset));
2201
+ const excluded = excludeAssets.some((fn) => fn(ident, asset));
2196
2202
  if (excluded) return ["excluded"];
2197
2203
  },
2198
2204
  getOptions: () => ({
@@ -2211,7 +2217,7 @@ const ASSETS_GROUPERS = {
2211
2217
  /** @typedef {Record<string, (groupConfigs: GroupConfig<KnownStatsModule, TODO>[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} ModulesGroupers */
2212
2218
 
2213
2219
  /** @type {(type: ExcludeModulesType) => ModulesGroupers} */
2214
- const MODULES_GROUPERS = type => ({
2220
+ const MODULES_GROUPERS = (type) => ({
2215
2221
  _: (groupConfigs, context, options) => {
2216
2222
  /**
2217
2223
  * @param {keyof KnownStatsModule} name name
@@ -2220,7 +2226,7 @@ const MODULES_GROUPERS = type => ({
2220
2226
  */
2221
2227
  const groupByFlag = (name, type, exclude) => {
2222
2228
  groupConfigs.push({
2223
- getKeys: module => (module[name] ? ["1"] : undefined),
2229
+ getKeys: (module) => (module[name] ? ["1"] : undefined),
2224
2230
  getOptions: () => ({
2225
2231
  groupChildren: !exclude,
2226
2232
  force: exclude
@@ -2263,7 +2269,7 @@ const MODULES_GROUPERS = type => ({
2263
2269
  }
2264
2270
  if (groupModulesByType || !options.runtimeModules) {
2265
2271
  groupConfigs.push({
2266
- getKeys: module => {
2272
+ getKeys: (module) => {
2267
2273
  if (!module.moduleType) return;
2268
2274
  if (groupModulesByType) {
2269
2275
  return [module.moduleType.split("/", 1)[0]];
@@ -2271,7 +2277,7 @@ const MODULES_GROUPERS = type => ({
2271
2277
  return [WEBPACK_MODULE_TYPE_RUNTIME];
2272
2278
  }
2273
2279
  },
2274
- getOptions: key => {
2280
+ getOptions: (key) => {
2275
2281
  const exclude =
2276
2282
  key === WEBPACK_MODULE_TYPE_RUNTIME && !options.runtimeModules;
2277
2283
  return {
@@ -2293,7 +2299,7 @@ const MODULES_GROUPERS = type => ({
2293
2299
  }
2294
2300
  if (groupModulesByLayer) {
2295
2301
  groupConfigs.push({
2296
- getKeys: module => /** @type {string[]} */ ([module.layer]),
2302
+ getKeys: (module) => /** @type {string[]} */ ([module.layer]),
2297
2303
  createGroup: (key, children, modules) => ({
2298
2304
  type: "modules by layer",
2299
2305
  layer: key,
@@ -2304,7 +2310,7 @@ const MODULES_GROUPERS = type => ({
2304
2310
  }
2305
2311
  if (groupModulesByPath || groupModulesByExtension) {
2306
2312
  groupConfigs.push({
2307
- getKeys: module => {
2313
+ getKeys: (module) => {
2308
2314
  if (!module.name) return;
2309
2315
  const resource = parseResource(
2310
2316
  /** @type {string} */ (module.name.split("!").pop())
@@ -2353,10 +2359,10 @@ const MODULES_GROUPERS = type => ({
2353
2359
  },
2354
2360
  excludeModules: (groupConfigs, context, { excludeModules }) => {
2355
2361
  groupConfigs.push({
2356
- getKeys: module => {
2362
+ getKeys: (module) => {
2357
2363
  const name = module.name;
2358
2364
  if (name) {
2359
- const excluded = excludeModules.some(fn => fn(name, module, type));
2365
+ const excluded = excludeModules.some((fn) => fn(name, module, type));
2360
2366
  if (excluded) return ["1"];
2361
2367
  }
2362
2368
  },
@@ -2377,9 +2383,9 @@ const MODULES_GROUPERS = type => ({
2377
2383
 
2378
2384
  /** @type {ModuleReasonsGroupers} */
2379
2385
  const MODULE_REASONS_GROUPERS = {
2380
- groupReasonsByOrigin: groupConfigs => {
2386
+ groupReasonsByOrigin: (groupConfigs) => {
2381
2387
  groupConfigs.push({
2382
- getKeys: reason => /** @type {string[]} */ ([reason.module]),
2388
+ getKeys: (reason) => /** @type {string[]} */ ([reason.module]),
2383
2389
  createGroup: (key, children, reasons) => ({
2384
2390
  type: "from origin",
2385
2391
  module: key,
@@ -2406,7 +2412,7 @@ const RESULT_GROUPERS = {
2406
2412
  * @param {string} field a field name
2407
2413
  * @returns {field} normalized field
2408
2414
  */
2409
- const normalizeFieldKey = field => {
2415
+ const normalizeFieldKey = (field) => {
2410
2416
  if (field[0] === "!") {
2411
2417
  return field.slice(1);
2412
2418
  }
@@ -2418,7 +2424,7 @@ const normalizeFieldKey = field => {
2418
2424
  * @param {string} field a field name
2419
2425
  * @returns {boolean} result
2420
2426
  */
2421
- const sortOrderRegular = field => {
2427
+ const sortOrderRegular = (field) => {
2422
2428
  if (field[0] === "!") {
2423
2429
  return false;
2424
2430
  }
@@ -2430,7 +2436,7 @@ const sortOrderRegular = field => {
2430
2436
  * @param {string | false} field field name
2431
2437
  * @returns {(a: T, b: T) => 0 | 1 | -1} comparators
2432
2438
  */
2433
- const sortByField = field => {
2439
+ const sortByField = (field) => {
2434
2440
  if (!field) {
2435
2441
  /**
2436
2442
  * @param {T} a first
@@ -2443,7 +2449,7 @@ const sortByField = field => {
2443
2449
 
2444
2450
  const fieldKey = normalizeFieldKey(field);
2445
2451
 
2446
- let sortFn = compareSelect(m => m[fieldKey], compareIds);
2452
+ let sortFn = compareSelect((m) => m[fieldKey], compareIds);
2447
2453
 
2448
2454
  // if a field is prefixed with a "!" the sort is reversed!
2449
2455
  const sortIsRegular = sortOrderRegular(field);
@@ -2461,8 +2467,8 @@ const ASSET_SORTERS = {
2461
2467
  assetsSort: (comparators, context, { assetsSort }) => {
2462
2468
  comparators.push(sortByField(assetsSort));
2463
2469
  },
2464
- _: comparators => {
2465
- comparators.push(compareSelect(a => a.name, compareIds));
2470
+ _: (comparators) => {
2471
+ comparators.push(compareSelect((a) => a.name, compareIds));
2466
2472
  }
2467
2473
  };
2468
2474
 
@@ -2556,7 +2562,7 @@ const ITEM_NAMES = {
2556
2562
  * @param {T[]} items items to be merged
2557
2563
  * @returns {NamedObject<T>} an object
2558
2564
  */
2559
- const mergeToObject = items => {
2565
+ const mergeToObject = (items) => {
2560
2566
  const obj = Object.create(null);
2561
2567
  for (const item of items) {
2562
2568
  obj[item.name] = item;
@@ -2582,7 +2588,7 @@ class DefaultStatsFactoryPlugin {
2582
2588
  * @returns {void}
2583
2589
  */
2584
2590
  apply(compiler) {
2585
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
2591
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
2586
2592
  compilation.hooks.statsFactory.tap(
2587
2593
  PLUGIN_NAME,
2588
2594
  /**
@@ -144,31 +144,31 @@ const NAMED_PRESETS = {
144
144
  };
145
145
 
146
146
  /**
147
- * @param {Partial<NormalizedStatsOptions>} all stats option
147
+ * @param {Partial<NormalizedStatsOptions>} all stats options
148
148
  * @returns {boolean} true when enabled, otherwise false
149
149
  */
150
150
  const NORMAL_ON = ({ all }) => all !== false;
151
151
  /**
152
- * @param {Partial<NormalizedStatsOptions>} all stats option
152
+ * @param {Partial<NormalizedStatsOptions>} all stats options
153
153
  * @returns {boolean} true when enabled, otherwise false
154
154
  */
155
155
  const NORMAL_OFF = ({ all }) => all === true;
156
156
  /**
157
- * @param {Partial<NormalizedStatsOptions>} all stats option
157
+ * @param {Partial<NormalizedStatsOptions>} all stats options
158
158
  * @param {CreateStatsOptionsContext} forToString stats options context
159
159
  * @returns {boolean} true when enabled, otherwise false
160
160
  */
161
161
  const ON_FOR_TO_STRING = ({ all }, { forToString }) =>
162
162
  forToString ? all !== false : all === true;
163
163
  /**
164
- * @param {Partial<NormalizedStatsOptions>} all stats option
164
+ * @param {Partial<NormalizedStatsOptions>} all stats options
165
165
  * @param {CreateStatsOptionsContext} forToString stats options context
166
166
  * @returns {boolean} true when enabled, otherwise false
167
167
  */
168
168
  const OFF_FOR_TO_STRING = ({ all }, { forToString }) =>
169
169
  forToString ? all === true : all !== false;
170
170
  /**
171
- * @param {Partial<NormalizedStatsOptions>} all stats option
171
+ * @param {Partial<NormalizedStatsOptions>} all stats options
172
172
  * @param {CreateStatsOptionsContext} forToString stats options context
173
173
  * @returns {boolean | "auto"} true when enabled, otherwise false
174
174
  */
@@ -289,15 +289,15 @@ const DEFAULTS = {
289
289
  * @param {string | ({ test: (value: T) => boolean }) | ((value: T, ...args: EXPECTED_ANY[]) => boolean) | boolean} item item to normalize
290
290
  * @returns {(value: T, ...args: EXPECTED_ANY[]) => boolean} normalize fn
291
291
  */
292
- const normalizeFilter = item => {
292
+ const normalizeFilter = (item) => {
293
293
  if (typeof item === "string") {
294
294
  const regExp = new RegExp(
295
295
  `[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)`
296
296
  );
297
- return ident => regExp.test(/** @type {T} */ (ident));
297
+ return (ident) => regExp.test(/** @type {T} */ (ident));
298
298
  }
299
299
  if (item && typeof item === "object" && typeof item.test === "function") {
300
- return ident => item.test(ident);
300
+ return (ident) => item.test(ident);
301
301
  }
302
302
  if (typeof item === "boolean") {
303
303
  return () => item;
@@ -311,7 +311,7 @@ const normalizeFilter = item => {
311
311
 
312
312
  /** @type {Normalizers} */
313
313
  const NORMALIZER = {
314
- excludeModules: value => {
314
+ excludeModules: (value) => {
315
315
  if (!Array.isArray(value)) {
316
316
  value = value
317
317
  ? /** @type {KnownNormalizedStatsOptions["excludeModules"]} */ ([value])
@@ -319,13 +319,13 @@ const NORMALIZER = {
319
319
  }
320
320
  return value.map(normalizeFilter);
321
321
  },
322
- excludeAssets: value => {
322
+ excludeAssets: (value) => {
323
323
  if (!Array.isArray(value)) {
324
324
  value = value ? [value] : [];
325
325
  }
326
326
  return value.map(normalizeFilter);
327
327
  },
328
- warningsFilter: value => {
328
+ warningsFilter: (value) => {
329
329
  if (!Array.isArray(value)) {
330
330
  value = value ? [value] : [];
331
331
  }
@@ -340,7 +340,7 @@ const NORMALIZER = {
340
340
  * @param {StatsOptions["warningsFilter"]} filter a warning filter
341
341
  * @returns {WarningFilterFn} result
342
342
  */
343
- filter => {
343
+ (filter) => {
344
344
  if (typeof filter === "string") {
345
345
  return (warning, warningString) => warningString.includes(filter);
346
346
  }
@@ -356,11 +356,11 @@ const NORMALIZER = {
356
356
  }
357
357
  );
358
358
  },
359
- logging: value => {
359
+ logging: (value) => {
360
360
  if (value === true) value = "log";
361
361
  return /** @type {KnownNormalizedStatsOptions["logging"]} */ (value);
362
362
  },
363
- loggingDebug: value => {
363
+ loggingDebug: (value) => {
364
364
  if (!Array.isArray(value)) {
365
365
  value = value
366
366
  ? /** @type {KnownNormalizedStatsOptions["loggingDebug"]} */ ([value])
@@ -379,7 +379,7 @@ class DefaultStatsPresetPlugin {
379
379
  * @returns {void}
380
380
  */
381
381
  apply(compiler) {
382
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
382
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
383
383
  for (const key of Object.keys(NAMED_PRESETS)) {
384
384
  const defaults = NAMED_PRESETS[/** @type {keyof NamedPresets} */ (key)];
385
385
  compilation.hooks.statsPreset