webpack 5.97.1 → 5.99.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 (262) hide show
  1. package/README.md +345 -392
  2. package/lib/AsyncDependenciesBlock.js +3 -1
  3. package/lib/BannerPlugin.js +1 -1
  4. package/lib/Cache.js +9 -7
  5. package/lib/CacheFacade.js +5 -5
  6. package/lib/Chunk.js +2 -2
  7. package/lib/ChunkGraph.js +21 -16
  8. package/lib/ChunkTemplate.js +6 -6
  9. package/lib/CleanPlugin.js +10 -10
  10. package/lib/CodeGenerationResults.js +4 -3
  11. package/lib/CompatibilityPlugin.js +4 -1
  12. package/lib/Compilation.js +343 -167
  13. package/lib/Compiler.js +13 -18
  14. package/lib/ConditionalInitFragment.js +1 -1
  15. package/lib/ConstPlugin.js +5 -3
  16. package/lib/ContextModule.js +4 -2
  17. package/lib/ContextModuleFactory.js +3 -3
  18. package/lib/ContextReplacementPlugin.js +43 -16
  19. package/lib/DefinePlugin.js +25 -24
  20. package/lib/DelegatedModule.js +4 -2
  21. package/lib/DelegatedModuleFactoryPlugin.js +2 -1
  22. package/lib/Dependency.js +19 -13
  23. package/lib/DependencyTemplates.js +4 -3
  24. package/lib/DllModule.js +4 -2
  25. package/lib/DllModuleFactory.js +2 -2
  26. package/lib/DllReferencePlugin.js +2 -1
  27. package/lib/DynamicEntryPlugin.js +1 -1
  28. package/lib/EnvironmentPlugin.js +4 -2
  29. package/lib/ExportsInfo.js +72 -40
  30. package/lib/ExternalModule.js +14 -5
  31. package/lib/ExternalModuleFactoryPlugin.js +24 -12
  32. package/lib/FileSystemInfo.js +129 -94
  33. package/lib/FlagDependencyExportsPlugin.js +6 -4
  34. package/lib/FlagDependencyUsagePlugin.js +1 -1
  35. package/lib/Generator.js +29 -1
  36. package/lib/HookWebpackError.js +2 -2
  37. package/lib/HotModuleReplacementPlugin.js +3 -9
  38. package/lib/IgnoreErrorModuleFactory.js +2 -2
  39. package/lib/IgnorePlugin.js +0 -5
  40. package/lib/InitFragment.js +1 -1
  41. package/lib/LoaderOptionsPlugin.js +8 -5
  42. package/lib/MainTemplate.js +7 -7
  43. package/lib/Module.js +44 -21
  44. package/lib/ModuleBuildError.js +3 -1
  45. package/lib/ModuleDependencyError.js +4 -3
  46. package/lib/ModuleDependencyWarning.js +4 -3
  47. package/lib/ModuleFactory.js +9 -3
  48. package/lib/ModuleFilenameHelpers.js +21 -39
  49. package/lib/ModuleGraph.js +20 -14
  50. package/lib/ModuleGraphConnection.js +7 -13
  51. package/lib/ModuleNotFoundError.js +1 -1
  52. package/lib/ModuleParseError.js +2 -1
  53. package/lib/ModuleSourceTypesConstants.js +11 -0
  54. package/lib/ModuleTemplate.js +5 -5
  55. package/lib/ModuleTypeConstants.js +15 -0
  56. package/lib/MultiCompiler.js +4 -4
  57. package/lib/MultiStats.js +1 -1
  58. package/lib/NormalModule.js +101 -54
  59. package/lib/NormalModuleFactory.js +38 -33
  60. package/lib/NormalModuleReplacementPlugin.js +3 -2
  61. package/lib/NullFactory.js +2 -2
  62. package/lib/Parser.js +4 -3
  63. package/lib/ProgressPlugin.js +1 -2
  64. package/lib/RawModule.js +4 -2
  65. package/lib/RecordIdsPlugin.js +6 -2
  66. package/lib/RequestShortener.js +3 -1
  67. package/lib/ResolverFactory.js +12 -9
  68. package/lib/RuntimeModule.js +4 -2
  69. package/lib/RuntimeTemplate.js +2 -1
  70. package/lib/SelfModuleFactory.js +2 -2
  71. package/lib/SourceMapDevToolPlugin.js +0 -8
  72. package/lib/Template.js +6 -5
  73. package/lib/TemplatedPathPlugin.js +15 -12
  74. package/lib/WebpackOptionsApply.js +1 -1
  75. package/lib/asset/AssetGenerator.js +237 -170
  76. package/lib/asset/AssetModulesPlugin.js +52 -10
  77. package/lib/asset/AssetSourceGenerator.js +18 -0
  78. package/lib/asset/RawDataUrlModule.js +4 -2
  79. package/lib/buildChunkGraph.js +14 -4
  80. package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
  81. package/lib/cache/PackFileCacheStrategy.js +137 -121
  82. package/lib/cache/ResolverCachePlugin.js +15 -7
  83. package/lib/cache/getLazyHashedEtag.js +4 -3
  84. package/lib/cli.js +23 -15
  85. package/lib/config/defaults.js +104 -28
  86. package/lib/config/normalization.js +14 -13
  87. package/lib/config/target.js +8 -8
  88. package/lib/container/ContainerEntryModule.js +4 -2
  89. package/lib/container/ContainerEntryModuleFactory.js +2 -2
  90. package/lib/container/FallbackModule.js +4 -2
  91. package/lib/container/FallbackModuleFactory.js +2 -2
  92. package/lib/container/RemoteModule.js +4 -2
  93. package/lib/container/options.js +5 -5
  94. package/lib/css/CssGenerator.js +71 -9
  95. package/lib/css/CssLoadingRuntimeModule.js +5 -2
  96. package/lib/css/CssModulesPlugin.js +41 -9
  97. package/lib/css/CssParser.js +37 -17
  98. package/lib/css/walkCssTokens.js +17 -17
  99. package/lib/debug/ProfilingPlugin.js +98 -38
  100. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +10 -4
  101. package/lib/dependencies/AMDPlugin.js +5 -2
  102. package/lib/dependencies/AMDRequireArrayDependency.js +4 -3
  103. package/lib/dependencies/AMDRequireContextDependency.js +2 -1
  104. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +15 -7
  105. package/lib/dependencies/AMDRuntimeModules.js +3 -1
  106. package/lib/dependencies/CommonJsExportRequireDependency.js +4 -5
  107. package/lib/dependencies/CommonJsExportsParserPlugin.js +3 -3
  108. package/lib/dependencies/CommonJsImportsParserPlugin.js +38 -7
  109. package/lib/dependencies/CommonJsRequireContextDependency.js +2 -1
  110. package/lib/dependencies/ContextDependencyHelpers.js +13 -6
  111. package/lib/dependencies/CssIcssExportDependency.js +15 -12
  112. package/lib/dependencies/CssIcssImportDependency.js +4 -1
  113. package/lib/dependencies/CssLocalIdentifierDependency.js +18 -15
  114. package/lib/dependencies/ExportsInfoDependency.js +6 -1
  115. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +5 -5
  116. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +22 -15
  117. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +23 -8
  118. package/lib/dependencies/HarmonyExportSpecifierDependency.js +2 -2
  119. package/lib/dependencies/HarmonyImportDependency.js +8 -6
  120. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -14
  121. package/lib/dependencies/HarmonyImportSpecifierDependency.js +5 -5
  122. package/lib/dependencies/ImportContextDependency.js +2 -1
  123. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +8 -4
  124. package/lib/dependencies/JsonExportsDependency.js +49 -27
  125. package/lib/dependencies/LoaderPlugin.js +4 -14
  126. package/lib/dependencies/RequireContextDependency.js +2 -1
  127. package/lib/dependencies/RequireContextDependencyParserPlugin.js +6 -3
  128. package/lib/dependencies/RequireEnsureDependenciesBlock.js +3 -2
  129. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +11 -5
  130. package/lib/dependencies/RequireResolveContextDependency.js +1 -1
  131. package/lib/dependencies/WebAssemblyExportImportedDependency.js +1 -1
  132. package/lib/dependencies/WorkerDependency.js +6 -3
  133. package/lib/dependencies/WorkerPlugin.js +100 -41
  134. package/lib/esm/ModuleChunkFormatPlugin.js +5 -0
  135. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +3 -2
  136. package/lib/hmr/HotModuleReplacement.runtime.js +1 -0
  137. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +1 -0
  138. package/lib/hmr/LazyCompilationPlugin.js +32 -24
  139. package/lib/hmr/lazyCompilationBackend.js +1 -1
  140. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
  141. package/lib/ids/HashedModuleIdsPlugin.js +2 -1
  142. package/lib/ids/IdHelpers.js +15 -14
  143. package/lib/ids/SyncModuleIdsPlugin.js +9 -5
  144. package/lib/index.js +5 -5
  145. package/lib/javascript/BasicEvaluatedExpression.js +6 -6
  146. package/lib/javascript/JavascriptGenerator.js +11 -1
  147. package/lib/javascript/JavascriptModulesPlugin.js +54 -34
  148. package/lib/javascript/JavascriptParser.js +272 -188
  149. package/lib/javascript/JavascriptParserHelpers.js +10 -9
  150. package/lib/javascript/StartupHelpers.js +4 -1
  151. package/lib/json/JsonData.js +4 -4
  152. package/lib/json/JsonGenerator.js +54 -22
  153. package/lib/json/JsonModulesPlugin.js +16 -3
  154. package/lib/json/JsonParser.js +10 -4
  155. package/lib/library/AbstractLibraryPlugin.js +7 -3
  156. package/lib/library/AssignLibraryPlugin.js +29 -1
  157. package/lib/library/EnableLibraryPlugin.js +7 -10
  158. package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
  159. package/lib/library/ModuleLibraryPlugin.js +121 -15
  160. package/lib/logging/Logger.js +2 -2
  161. package/lib/logging/createConsoleLogger.js +4 -4
  162. package/lib/node/NodeEnvironmentPlugin.js +6 -2
  163. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -2
  164. package/lib/node/ReadFileCompileWasmPlugin.js +1 -2
  165. package/lib/node/nodeConsole.js +3 -1
  166. package/lib/optimize/AggressiveSplittingPlugin.js +1 -1
  167. package/lib/optimize/ConcatenatedModule.js +19 -12
  168. package/lib/optimize/InnerGraph.js +3 -2
  169. package/lib/optimize/InnerGraphPlugin.js +13 -7
  170. package/lib/optimize/LimitChunkCountPlugin.js +20 -0
  171. package/lib/optimize/ModuleConcatenationPlugin.js +10 -7
  172. package/lib/optimize/RealContentHashPlugin.js +8 -4
  173. package/lib/optimize/SideEffectsFlagPlugin.js +4 -2
  174. package/lib/optimize/SplitChunksPlugin.js +90 -65
  175. package/lib/rules/BasicEffectRulePlugin.js +9 -1
  176. package/lib/rules/BasicMatcherRulePlugin.js +15 -4
  177. package/lib/rules/ObjectMatcherRulePlugin.js +12 -3
  178. package/lib/rules/RuleSetCompiler.js +25 -14
  179. package/lib/rules/UseEffectRulePlugin.js +47 -17
  180. package/lib/runtime/AutoPublicPathRuntimeModule.js +1 -1
  181. package/lib/runtime/GetChunkFilenameRuntimeModule.js +6 -6
  182. package/lib/schemes/HttpUriPlugin.js +38 -17
  183. package/lib/serialization/BinaryMiddleware.js +52 -19
  184. package/lib/serialization/FileMiddleware.js +78 -48
  185. package/lib/serialization/ObjectMiddleware.js +78 -29
  186. package/lib/serialization/PlainObjectSerializer.js +1 -1
  187. package/lib/serialization/Serializer.js +15 -10
  188. package/lib/serialization/SerializerMiddleware.js +80 -41
  189. package/lib/serialization/SingleItemMiddleware.js +10 -7
  190. package/lib/serialization/types.js +1 -1
  191. package/lib/sharing/ConsumeSharedModule.js +4 -2
  192. package/lib/sharing/ProvideSharedModule.js +4 -2
  193. package/lib/sharing/ProvideSharedModuleFactory.js +5 -3
  194. package/lib/sharing/utils.js +2 -2
  195. package/lib/stats/DefaultStatsFactoryPlugin.js +81 -79
  196. package/lib/stats/DefaultStatsPresetPlugin.js +43 -23
  197. package/lib/stats/DefaultStatsPrinterPlugin.js +85 -43
  198. package/lib/stats/StatsFactory.js +11 -11
  199. package/lib/stats/StatsPrinter.js +7 -7
  200. package/lib/util/ArrayHelpers.js +2 -4
  201. package/lib/util/ArrayQueue.js +1 -1
  202. package/lib/util/AsyncQueue.js +4 -4
  203. package/lib/util/IterableHelpers.js +1 -1
  204. package/lib/util/LazyBucketSortedSet.js +41 -23
  205. package/lib/util/LazySet.js +3 -2
  206. package/lib/util/MapHelpers.js +1 -1
  207. package/lib/util/ParallelismFactorCalculator.js +1 -1
  208. package/lib/util/Semaphore.js +3 -3
  209. package/lib/util/SetHelpers.js +1 -1
  210. package/lib/util/SortableSet.js +9 -7
  211. package/lib/util/TupleQueue.js +9 -8
  212. package/lib/util/TupleSet.js +2 -2
  213. package/lib/util/WeakTupleMap.js +12 -11
  214. package/lib/util/binarySearchBounds.js +2 -1
  215. package/lib/util/cleverMerge.js +84 -54
  216. package/lib/util/comparators.js +22 -21
  217. package/lib/util/compileBooleanMatcher.js +3 -3
  218. package/lib/util/concatenate.js +6 -4
  219. package/lib/util/create-schema-validation.js +4 -4
  220. package/lib/util/createHash.js +2 -2
  221. package/lib/util/deprecation.js +35 -33
  222. package/lib/util/deterministicGrouping.js +6 -6
  223. package/lib/util/findGraphRoots.js +1 -1
  224. package/lib/util/fs.js +39 -39
  225. package/lib/util/hash/wasm-hash.js +2 -2
  226. package/lib/util/identifier.js +15 -18
  227. package/lib/util/makeSerializable.js +1 -1
  228. package/lib/util/memoize.js +4 -1
  229. package/lib/util/objectToMap.js +3 -2
  230. package/lib/util/processAsyncTree.js +2 -2
  231. package/lib/util/propertyName.js +0 -1
  232. package/lib/util/registerExternalSerializer.js +15 -18
  233. package/lib/util/removeBOM.js +25 -0
  234. package/lib/util/runtime.js +34 -27
  235. package/lib/util/semver.js +18 -8
  236. package/lib/util/serialization.js +5 -16
  237. package/lib/util/smartGrouping.js +3 -3
  238. package/lib/validateSchema.js +4 -7
  239. package/lib/wasm/EnableWasmLoadingPlugin.js +2 -2
  240. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
  241. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +11 -0
  242. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +10 -0
  243. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -2
  244. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -0
  245. package/lib/wasm-sync/WebAssemblyGenerator.js +28 -12
  246. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +10 -0
  247. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -2
  248. package/lib/wasm-sync/WebAssemblyParser.js +9 -4
  249. package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -2
  250. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -0
  251. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +30 -25
  252. package/package.json +27 -26
  253. package/schemas/WebpackOptions.check.js +1 -1
  254. package/schemas/WebpackOptions.json +48 -13
  255. package/schemas/plugins/JsonModulesPluginGenerator.check.d.ts +7 -0
  256. package/schemas/plugins/JsonModulesPluginGenerator.check.js +6 -0
  257. package/schemas/plugins/JsonModulesPluginGenerator.json +11 -0
  258. package/schemas/plugins/JsonModulesPluginParser.check.js +1 -1
  259. package/schemas/plugins/JsonModulesPluginParser.json +4 -0
  260. package/schemas/plugins/SourceMapDevToolPlugin.json +2 -2
  261. package/types.d.ts +888 -583
  262. package/lib/library/ModernModuleLibraryPlugin.js +0 -144
@@ -7,9 +7,15 @@
7
7
 
8
8
  /** @typedef {import("../Compiler")} Compiler */
9
9
  /** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkGroup} KnownStatsChunkGroup */
10
+ /** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsError} KnownStatsError */
11
+ /** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsModuleIssuer} KnownStatsModuleIssuer */
12
+ /** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsModuleTraceDependency} KnownStatsModuleTraceDependency */
13
+ /** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsModuleTraceItem} KnownStatsModuleTraceItem */
14
+ /** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsProfile} KnownStatsProfile */
10
15
  /** @typedef {import("./StatsPrinter")} StatsPrinter */
11
16
  /** @typedef {import("./StatsPrinter").KnownStatsPrinterColorFn} KnownStatsPrinterColorFn */
12
- /** @typedef {import("./StatsPrinter").KnownStatsPrinterFormaters} KnownStatsPrinterFormaters */
17
+ /** @typedef {import("./StatsPrinter").KnownStatsPrinterContext} KnownStatsPrinterContext */
18
+ /** @typedef {import("./StatsPrinter").KnownStatsPrinterFormatters} KnownStatsPrinterFormatters */
13
19
  /** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */
14
20
 
15
21
  const DATA_URI_CONTENT_LENGTH = 16;
@@ -59,7 +65,7 @@ const getResourceName = resource => {
59
65
  */
60
66
  const getModuleName = name => {
61
67
  const [, prefix, resource] =
62
- /** @type {[any, string, string]} */
68
+ /** @type {[string, string, string]} */
63
69
  (/** @type {unknown} */ (/^(.*!)?([^!]*)$/.exec(name)));
64
70
 
65
71
  if (resource.length > MAX_MODULE_IDENTIFIER_LENGTH) {
@@ -79,7 +85,7 @@ const getModuleName = name => {
79
85
 
80
86
  /**
81
87
  * @param {string} str string
82
- * @param {function(string): string} fn function to apply to each line
88
+ * @param {(item: string) => string} fn function to apply to each line
83
89
  * @returns {string} joined string
84
90
  */
85
91
  const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
@@ -111,7 +117,42 @@ const moreCount = (list, count) =>
111
117
  * @typedef {{ [P in K]-?: T[P] }} WithRequired
112
118
  */
113
119
 
114
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation">, printer: StatsPrinter) => string | undefined>} */
120
+ /**
121
+ * @template {keyof StatsPrinterContext} RequiredStatsPrinterContextKeys
122
+ * @typedef {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | RequiredStatsPrinterContextKeys>} DefineStatsPrinterContext
123
+ */
124
+
125
+ /**
126
+ * @template T
127
+ * @template {keyof StatsPrinterContext} RequiredStatsPrinterContextKeys
128
+ * @typedef {(thing: Exclude<T, undefined>, context: DefineStatsPrinterContext<RequiredStatsPrinterContextKeys>, printer: StatsPrinter) => string | undefined} ModuleSimplePrinter
129
+ */
130
+
131
+ /**
132
+ * @template T
133
+ * @typedef {T extends (infer U)[] ? U : T} Unpacked
134
+ */
135
+
136
+ /**
137
+ * @template {object} O
138
+ * @template {keyof O} P
139
+ * @template {string} B
140
+ * @typedef {P extends string ? `${B}.${P}` : never} PropertyName
141
+ */
142
+
143
+ /**
144
+ * @template {string} T
145
+ * @typedef {{ [property in `${T}.separator!`]: () => string }} Separator
146
+ */
147
+
148
+ /**
149
+ * @template {object} O
150
+ * @template {string} B
151
+ * @template {string} [R=B]
152
+ * @typedef {{ [P in keyof O as PropertyName<O, P, B>]?: ModuleSimplePrinter<O[P], R> }} Printers
153
+ */
154
+
155
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation">, printer: StatsPrinter) => string | undefined>} */
115
156
  const COMPILATION_SIMPLE_PRINTERS = {
116
157
  "compilation.summary!": (
117
158
  _,
@@ -318,7 +359,7 @@ const COMPILATION_SIMPLE_PRINTERS = {
318
359
  }
319
360
  };
320
361
 
321
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "asset">, printer: StatsPrinter) => string | undefined>} */
362
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "asset">, printer: StatsPrinter) => string | undefined>} */
322
363
  const ASSET_SIMPLE_PRINTERS = {
323
364
  "asset.type": type => type,
324
365
  "asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) =>
@@ -339,13 +380,7 @@ const ASSET_SIMPLE_PRINTERS = {
339
380
  "asset.info.javascriptModule": (javascriptModule, { formatFlag }) =>
340
381
  javascriptModule ? formatFlag("javascript module") : undefined,
341
382
  "asset.info.sourceFilename": (sourceFilename, { formatFlag }) =>
342
- sourceFilename
343
- ? formatFlag(
344
- sourceFilename === true
345
- ? "from source file"
346
- : `from: ${sourceFilename}`
347
- )
348
- : undefined,
383
+ sourceFilename ? formatFlag(`from: ${sourceFilename}`) : undefined,
349
384
  "asset.info.development": (development, { green, formatFlag }) =>
350
385
  development ? green(formatFlag("dev")) : undefined,
351
386
  "asset.info.hotModuleReplacement": (
@@ -376,7 +411,7 @@ const ASSET_SIMPLE_PRINTERS = {
376
411
  assetChunkIdHint: name => name
377
412
  };
378
413
 
379
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "module">, printer: StatsPrinter) => string | undefined>} */
414
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "module">, printer: StatsPrinter) => string | undefined>} */
380
415
  const MODULE_SIMPLE_PRINTERS = {
381
416
  "module.type": type => (type !== "module" ? type : undefined),
382
417
  "module.id": (id, { formatModuleId }) =>
@@ -493,13 +528,13 @@ const MODULE_SIMPLE_PRINTERS = {
493
528
  "module.separator!": () => "\n"
494
529
  };
495
530
 
496
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleIssuer">, printer: StatsPrinter) => string | undefined>} */
531
+ /** @type {Printers<KnownStatsModuleIssuer, "moduleIssuer"> & Printers<KnownStatsModuleIssuer["profile"], "moduleIssuer.profile", "moduleIssuer">} */
497
532
  const MODULE_ISSUER_PRINTERS = {
498
533
  "moduleIssuer.id": (id, { formatModuleId }) => formatModuleId(id),
499
534
  "moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value)
500
535
  };
501
536
 
502
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleReason">, printer: StatsPrinter) => string | undefined>} */
537
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleReason">, printer: StatsPrinter) => string | undefined>} */
503
538
  const MODULE_REASON_PRINTERS = {
504
539
  "moduleReason.type": type => type,
505
540
  "moduleReason.userRequest": (userRequest, { cyan }) =>
@@ -525,7 +560,7 @@ const MODULE_REASON_PRINTERS = {
525
560
  : undefined
526
561
  };
527
562
 
528
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "profile">, printer: StatsPrinter) => string | undefined>} */
563
+ /** @type {Printers<KnownStatsProfile, "module.profile", "profile">} */
529
564
  const MODULE_PROFILE_PRINTERS = {
530
565
  "module.profile.total": (value, { formatTime }) => formatTime(value),
531
566
  "module.profile.resolving": (value, { formatTime }) =>
@@ -544,7 +579,7 @@ const MODULE_PROFILE_PRINTERS = {
544
579
  value ? `additional integration: ${formatTime(value)}` : undefined
545
580
  };
546
581
 
547
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunkGroupKind" | "chunkGroup">, printer: StatsPrinter) => string | undefined>} */
582
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunkGroupKind" | "chunkGroup">, printer: StatsPrinter) => string | undefined>} */
548
583
  const CHUNK_GROUP_PRINTERS = {
549
584
  "chunkGroup.kind!": (_, { chunkGroupKind }) => chunkGroupKind,
550
585
  "chunkGroup.separator!": () => "\n",
@@ -596,7 +631,7 @@ const CHUNK_GROUP_PRINTERS = {
596
631
  "chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined)
597
632
  };
598
633
 
599
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunk">, printer: StatsPrinter) => string | undefined>} */
634
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunk">, printer: StatsPrinter) => string | undefined>} */
600
635
  const CHUNK_PRINTERS = {
601
636
  "chunk.id": (id, { formatChunkId }) => formatChunkId(id),
602
637
  "chunk.files[]": (file, { formatFilename }) => formatFilename(file),
@@ -650,7 +685,7 @@ const CHUNK_PRINTERS = {
650
685
  "chunkOrigin.loc": loc => loc
651
686
  };
652
687
 
653
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "error">, printer: StatsPrinter) => string | undefined>} */
688
+ /** @type {Printers<KnownStatsError, "error"> & { ["error.filteredDetails"]?: (filteredDetails: number) => string | undefined } & Separator<"error">} */
654
689
  const ERROR_PRINTERS = {
655
690
  "error.compilerPath": (compilerPath, { bold }) =>
656
691
  compilerPath ? bold(`(${compilerPath})`) : undefined,
@@ -676,7 +711,7 @@ const ERROR_PRINTERS = {
676
711
  "error.separator!": () => "\n"
677
712
  };
678
713
 
679
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "logging">, printer: StatsPrinter) => string | undefined>} */
714
+ /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormatters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "logging">, printer: StatsPrinter) => string | undefined>} */
680
715
  const LOG_ENTRY_PRINTERS = {
681
716
  "loggingEntry(error).loggingEntry.message": (message, { red }) =>
682
717
  mapLines(message, x => `<e> ${red(x)}`),
@@ -716,17 +751,19 @@ const LOG_ENTRY_PRINTERS = {
716
751
  filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined
717
752
  };
718
753
 
719
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceItem">, printer: StatsPrinter) => string | undefined>} */
754
+ /** @type {Printers<KnownStatsModuleTraceItem, "moduleTraceItem">} */
720
755
  const MODULE_TRACE_ITEM_PRINTERS = {
721
756
  "moduleTraceItem.originName": originName => originName
722
757
  };
723
758
 
724
- /** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceDependency">, printer: StatsPrinter) => string | undefined>} */
759
+ /** @type {Printers<KnownStatsModuleTraceDependency, "moduleTraceDependency">} */
725
760
  const MODULE_TRACE_DEPENDENCY_PRINTERS = {
726
761
  "moduleTraceDependency.loc": loc => loc
727
762
  };
728
763
 
729
- /** @type {Record<string, string | function(any): string>} */
764
+ /**
765
+ * @type {Record<string, string | ((item: EXPECTED_ANY) => string)>}
766
+ */
730
767
  const ITEM_NAMES = {
731
768
  "compilation.assets[]": "asset",
732
769
  "compilation.modules[]": "module",
@@ -969,7 +1006,7 @@ const itemsJoinComma = items => items.filter(Boolean).join(", ");
969
1006
  /** @type {SimpleItemsJoiner} */
970
1007
  const itemsJoinCommaBrackets = items =>
971
1008
  items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined;
972
- /** @type {function(string): SimpleItemsJoiner} */
1009
+ /** @type {(item: string) => SimpleItemsJoiner} */
973
1010
  const itemsJoinCommaBracketsWithName = name => items =>
974
1011
  items.length > 0
975
1012
  ? `(${name}: ${items.filter(Boolean).join(", ")})`
@@ -1300,7 +1337,7 @@ const AVAILABLE_COLORS = {
1300
1337
  magenta: "\u001B[1m\u001B[35m"
1301
1338
  };
1302
1339
 
1303
- /** @type {Record<string, function(any, Required<KnownStatsPrinterColorFn> & StatsPrinterContext, ...any): string>} */
1340
+ /** @type {Record<string, (value: any, options: Required<KnownStatsPrinterColorFn> & StatsPrinterContext, ...args: any) => string>} */
1304
1341
  const AVAILABLE_FORMATS = {
1305
1342
  formatChunkId: (id, { yellow }, direction) => {
1306
1343
  switch (direction) {
@@ -1391,7 +1428,7 @@ const AVAILABLE_FORMATS = {
1391
1428
  }
1392
1429
  };
1393
1430
 
1394
- /** @typedef {function(string): string} ResultModifierFn */
1431
+ /** @typedef {(result: string) => string} ResultModifierFn */
1395
1432
  /** @type {Record<string, ResultModifierFn>} */
1396
1433
  const RESULT_MODIFIER = {
1397
1434
  "module.modules": result => indent(result, "| ")
@@ -1498,7 +1535,7 @@ class DefaultStatsPrinterPlugin {
1498
1535
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1499
1536
  COMPILATION_SIMPLE_PRINTERS[key](
1500
1537
  obj,
1501
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation">} */
1538
+ /** @type {DefineStatsPrinterContext<"compilation">} */
1502
1539
  (ctx),
1503
1540
  stats
1504
1541
  )
@@ -1511,7 +1548,7 @@ class DefaultStatsPrinterPlugin {
1511
1548
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1512
1549
  ASSET_SIMPLE_PRINTERS[key](
1513
1550
  obj,
1514
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "asset">} */
1551
+ /** @type {DefineStatsPrinterContext<"asset">} */
1515
1552
  (ctx),
1516
1553
  stats
1517
1554
  )
@@ -1524,7 +1561,7 @@ class DefaultStatsPrinterPlugin {
1524
1561
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1525
1562
  MODULE_SIMPLE_PRINTERS[key](
1526
1563
  obj,
1527
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "module">} */
1564
+ /** @type {DefineStatsPrinterContext<"module">} */
1528
1565
  (ctx),
1529
1566
  stats
1530
1567
  )
@@ -1535,9 +1572,10 @@ class DefaultStatsPrinterPlugin {
1535
1572
  stats.hooks.print
1536
1573
  .for(key)
1537
1574
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1538
- MODULE_ISSUER_PRINTERS[key](
1575
+ /** @type {Record<string, ModuleSimplePrinter<KnownStatsModuleIssuer[keyof KnownStatsModuleIssuer] | KnownStatsModuleIssuer["profile"][keyof KnownStatsModuleIssuer["profile"]], "type" | "compilation" | "moduleIssuer">>} */
1576
+ (MODULE_ISSUER_PRINTERS)[key](
1539
1577
  obj,
1540
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleIssuer">} */
1578
+ /** @type {DefineStatsPrinterContext<"moduleIssuer">} */
1541
1579
  (ctx),
1542
1580
  stats
1543
1581
  )
@@ -1550,7 +1588,7 @@ class DefaultStatsPrinterPlugin {
1550
1588
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1551
1589
  MODULE_REASON_PRINTERS[key](
1552
1590
  obj,
1553
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleReason">} */
1591
+ /** @type {DefineStatsPrinterContext<"moduleReason">} */
1554
1592
  (ctx),
1555
1593
  stats
1556
1594
  )
@@ -1561,9 +1599,10 @@ class DefaultStatsPrinterPlugin {
1561
1599
  stats.hooks.print
1562
1600
  .for(key)
1563
1601
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1564
- MODULE_PROFILE_PRINTERS[key](
1602
+ /** @type {Record<string, ModuleSimplePrinter<KnownStatsProfile[keyof KnownStatsProfile], "type" | "compilation" | "profile">>} */
1603
+ (MODULE_PROFILE_PRINTERS)[key](
1565
1604
  obj,
1566
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "profile">} */
1605
+ /** @type {DefineStatsPrinterContext<"profile">} */
1567
1606
  (ctx),
1568
1607
  stats
1569
1608
  )
@@ -1576,7 +1615,7 @@ class DefaultStatsPrinterPlugin {
1576
1615
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1577
1616
  CHUNK_GROUP_PRINTERS[key](
1578
1617
  obj,
1579
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunkGroupKind" | "chunkGroup">} */
1618
+ /** @type {DefineStatsPrinterContext<"chunkGroupKind" | "chunkGroup">} */
1580
1619
  (ctx),
1581
1620
  stats
1582
1621
  )
@@ -1589,7 +1628,7 @@ class DefaultStatsPrinterPlugin {
1589
1628
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1590
1629
  CHUNK_PRINTERS[key](
1591
1630
  obj,
1592
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunk">} */
1631
+ /** @type {DefineStatsPrinterContext<"chunk">} */
1593
1632
  (ctx),
1594
1633
  stats
1595
1634
  )
@@ -1600,9 +1639,10 @@ class DefaultStatsPrinterPlugin {
1600
1639
  stats.hooks.print
1601
1640
  .for(key)
1602
1641
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1603
- ERROR_PRINTERS[key](
1642
+ /** @type {Record<string, ModuleSimplePrinter<KnownStatsError[keyof KnownStatsError], "type" | "compilation" | "error">>} */
1643
+ (ERROR_PRINTERS)[key](
1604
1644
  obj,
1605
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "error">} */
1645
+ /** @type {DefineStatsPrinterContext<"error">} */
1606
1646
  (ctx),
1607
1647
  stats
1608
1648
  )
@@ -1615,7 +1655,7 @@ class DefaultStatsPrinterPlugin {
1615
1655
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1616
1656
  LOG_ENTRY_PRINTERS[key](
1617
1657
  obj,
1618
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "logging">} */
1658
+ /** @type {DefineStatsPrinterContext<"logging">} */
1619
1659
  (ctx),
1620
1660
  stats
1621
1661
  )
@@ -1626,9 +1666,10 @@ class DefaultStatsPrinterPlugin {
1626
1666
  stats.hooks.print
1627
1667
  .for(key)
1628
1668
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1629
- MODULE_TRACE_DEPENDENCY_PRINTERS[key](
1669
+ /** @type {Record<string, ModuleSimplePrinter<KnownStatsModuleTraceDependency[keyof KnownStatsModuleTraceDependency], "type" | "compilation" | "moduleTraceDependency">>} */
1670
+ (MODULE_TRACE_DEPENDENCY_PRINTERS)[key](
1630
1671
  obj,
1631
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceDependency">} */
1672
+ /** @type {DefineStatsPrinterContext<"moduleTraceDependency">} */
1632
1673
  (ctx),
1633
1674
  stats
1634
1675
  )
@@ -1639,9 +1680,10 @@ class DefaultStatsPrinterPlugin {
1639
1680
  stats.hooks.print
1640
1681
  .for(key)
1641
1682
  .tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
1642
- MODULE_TRACE_ITEM_PRINTERS[key](
1683
+ /** @type {Record<string, ModuleSimplePrinter<KnownStatsModuleTraceItem[keyof KnownStatsModuleTraceItem], "type" | "compilation" | "moduleTraceItem">>} */
1684
+ (MODULE_TRACE_ITEM_PRINTERS)[key](
1643
1685
  obj,
1644
- /** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceItem">} */
1686
+ /** @type {DefineStatsPrinterContext<"moduleTraceItem">} */
1645
1687
  (ctx),
1646
1688
  stats
1647
1689
  )
@@ -14,24 +14,24 @@ const smartGrouping = require("../util/smartGrouping");
14
14
  /** @typedef {import("../Compilation").NormalizedStatsOptions} NormalizedStatsOptions */
15
15
  /** @typedef {import("../Module")} Module */
16
16
  /** @typedef {import("../WebpackError")} WebpackError */
17
- /** @typedef {import("../util/comparators").Comparator<any>} Comparator */
17
+ /** @typedef {import("../util/comparators").Comparator<TODO>} Comparator */
18
18
  /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
19
- /** @typedef {import("../util/smartGrouping").GroupConfig<any, object>} GroupConfig */
19
+ /** @typedef {import("../util/smartGrouping").GroupConfig<TODO, EXPECTED_OBJECT>} GroupConfig */
20
20
 
21
21
  /**
22
22
  * @typedef {object} KnownStatsFactoryContext
23
23
  * @property {string} type
24
- * @property {function(string): string} makePathsRelative
24
+ * @property {(path: string) => string} makePathsRelative
25
25
  * @property {Compilation} compilation
26
26
  * @property {Set<Module>} rootModules
27
- * @property {Map<string,Chunk[]>} compilationFileToChunks
28
- * @property {Map<string,Chunk[]>} compilationAuxiliaryFileToChunks
27
+ * @property {Map<string, Chunk[]>} compilationFileToChunks
28
+ * @property {Map<string, Chunk[]>} compilationAuxiliaryFileToChunks
29
29
  * @property {RuntimeSpec} runtime
30
- * @property {function(Compilation): WebpackError[]} cachedGetErrors
31
- * @property {function(Compilation): WebpackError[]} cachedGetWarnings
30
+ * @property {(compilation: Compilation) => WebpackError[]} cachedGetErrors
31
+ * @property {(compilation: Compilation) => WebpackError[]} cachedGetWarnings
32
32
  */
33
33
 
34
- /** @typedef {Record<string, any> & KnownStatsFactoryContext} StatsFactoryContext */
34
+ /** @typedef {KnownStatsFactoryContext & Record<string, EXPECTED_ANY>} StatsFactoryContext */
35
35
 
36
36
  /** @typedef {any} CreatedObject */
37
37
  /** @typedef {any} FactoryData */
@@ -128,7 +128,7 @@ class StatsFactory {
128
128
  * @param {HM} hookMap hook map
129
129
  * @param {Caches<H>} cache cache
130
130
  * @param {string} type type
131
- * @param {function(H): R | void} fn fn
131
+ * @param {(hook: H) => R | void} fn fn
132
132
  * @returns {R | void} hook
133
133
  * @private
134
134
  */
@@ -146,7 +146,7 @@ class StatsFactory {
146
146
  * @param {Caches<H>} cache cache
147
147
  * @param {string} type type
148
148
  * @param {FactoryData} data data
149
- * @param {function(H, FactoryData): FactoryData} fn fn
149
+ * @param {(hook: H, factoryData: FactoryData) => FactoryData} fn fn
150
150
  * @returns {FactoryData} data
151
151
  * @private
152
152
  */
@@ -165,7 +165,7 @@ class StatsFactory {
165
165
  * @param {Caches<H>} cache cache
166
166
  * @param {string} type type
167
167
  * @param {Array<FactoryData>} items items
168
- * @param {function(H, R, number, number): R | undefined} fn fn
168
+ * @param {(hook: H, item: R, idx: number, i: number) => R | undefined} fn fn
169
169
  * @param {boolean} forceClone force clone
170
170
  * @returns {R[]} result for each level
171
171
  * @private
@@ -55,10 +55,10 @@ const { HookMap, SyncWaterfallHook, SyncBailHook } = require("tapable");
55
55
  */
56
56
 
57
57
  /**
58
- * @typedef {object} KnownStatsPrinterFormaters
58
+ * @typedef {object} KnownStatsPrinterFormatters
59
59
  * @property {(file: string, oversize?: boolean) => string=} formatFilename
60
- * @property {(id: string) => string=} formatModuleId
61
- * @property {(id: string, direction?: "parent"|"child"|"sibling") => string=} formatChunkId
60
+ * @property {(id: string | number) => string=} formatModuleId
61
+ * @property {(id: string | number, direction?: "parent" | "child" | "sibling") => string=} formatChunkId
62
62
  * @property {(size: number) => string=} formatSize
63
63
  * @property {(size: string) => string=} formatLayer
64
64
  * @property {(dateTime: number) => string=} formatDateTime
@@ -67,8 +67,8 @@ const { HookMap, SyncWaterfallHook, SyncBailHook } = require("tapable");
67
67
  * @property {(message: string) => string=} formatError
68
68
  */
69
69
 
70
- /** @typedef {Record<string, EXPECTED_ANY> & KnownStatsPrinterColorFn & KnownStatsPrinterFormaters & KnownStatsPrinterContext} StatsPrinterContext */
71
- /** @typedef {any} PrintObject */
70
+ /** @typedef {KnownStatsPrinterColorFn & KnownStatsPrinterFormatters & KnownStatsPrinterContext & Record<string, EXPECTED_ANY>} StatsPrinterContext */
71
+ /** @typedef {TODO} PrintObject */
72
72
 
73
73
  /**
74
74
  * @typedef {object} StatsPrintHooks
@@ -147,7 +147,7 @@ class StatsPrinter {
147
147
  * @template {H extends import("tapable").Hook<any, infer R> ? R : never} R
148
148
  * @param {HM} hookMap hook map
149
149
  * @param {string} type type
150
- * @param {function(H): R | void} fn fn
150
+ * @param {(hooK: H) => R | void} fn fn
151
151
  * @returns {R | void} hook
152
152
  */
153
153
  _forEachLevel(hookMap, type, fn) {
@@ -165,7 +165,7 @@ class StatsPrinter {
165
165
  * @param {HM} hookMap hook map
166
166
  * @param {string} type type
167
167
  * @param {string} data data
168
- * @param {function(H, string): string} fn fn
168
+ * @param {(hook: H, data: string) => string} fn fn
169
169
  * @returns {string} result of `fn`
170
170
  */
171
171
  _forEachLevelWaterfall(hookMap, type, data, fn) {
@@ -7,12 +7,11 @@
7
7
 
8
8
  /**
9
9
  * Compare two arrays or strings by performing strict equality check for each value.
10
- * @template T [T=any]
10
+ * @template T
11
11
  * @param {ArrayLike<T>} a Array of values to be compared
12
12
  * @param {ArrayLike<T>} b Array of values to be compared
13
13
  * @returns {boolean} returns true if all the elements of passed arrays are strictly equal.
14
14
  */
15
-
16
15
  module.exports.equals = (a, b) => {
17
16
  if (a.length !== b.length) return false;
18
17
  for (let i = 0; i < a.length; i++) {
@@ -23,12 +22,11 @@ module.exports.equals = (a, b) => {
23
22
 
24
23
  /**
25
24
  * Partition an array by calling a predicate function on each value.
26
- * @template T [T=any]
25
+ * @template T
27
26
  * @param {Array<T>} arr Array of values to be partitioned
28
27
  * @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result.
29
28
  * @returns {[Array<T>, Array<T>]} returns the values of `arr` partitioned into two new arrays based on fn predicate.
30
29
  */
31
-
32
30
  module.exports.groupBy = (
33
31
  // eslint-disable-next-line default-param-last
34
32
  arr = [],
@@ -10,7 +10,7 @@
10
10
  */
11
11
  class ArrayQueue {
12
12
  /**
13
- * @param {Iterable<T>=} items The initial elements.
13
+ * @param {Iterable<T>} [items] The initial elements.
14
14
  */
15
15
  constructor(items) {
16
16
  /**
@@ -50,12 +50,12 @@ class AsyncQueueEntry {
50
50
 
51
51
  /**
52
52
  * @template T, K
53
- * @typedef {function(T): K} getKey
53
+ * @typedef {(item: T) => K} getKey
54
54
  */
55
55
 
56
56
  /**
57
57
  * @template T, R
58
- * @typedef {function(T, Callback<R>): void} Processor
58
+ * @typedef {(item: T, callback: Callback<R>) => void} Processor
59
59
  */
60
60
 
61
61
  /**
@@ -85,13 +85,13 @@ class AsyncQueue {
85
85
  this._entries = new Map();
86
86
  /** @type {ArrayQueue<AsyncQueueEntry<T, K, R>>} */
87
87
  this._queued = new ArrayQueue();
88
- /** @type {AsyncQueue<any, any, any>[] | undefined} */
88
+ /** @type {AsyncQueue<T, K, R>[] | undefined} */
89
89
  this._children = undefined;
90
90
  this._activeTasks = 0;
91
91
  this._willEnsureProcessing = false;
92
92
  this._needProcessing = false;
93
93
  this._stopped = false;
94
- /** @type {AsyncQueue<any, any, any>} */
94
+ /** @type {AsyncQueue<T, K, R>} */
95
95
  this._root = parent ? parent._root : this;
96
96
  if (parent) {
97
97
  if (this._root._children === undefined) {
@@ -19,7 +19,7 @@ const last = set => {
19
19
  /**
20
20
  * @template T
21
21
  * @param {Iterable<T>} iterable iterable
22
- * @param {function(T): boolean | null | undefined} filter predicate
22
+ * @param {(value: T) => boolean | null | undefined} filter predicate
23
23
  * @returns {boolean} true, if some items match the filter predicate
24
24
  */
25
25
  const someInIterable = (iterable, filter) => {