webpack 5.99.9 → 5.100.1

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 (308) hide show
  1. package/bin/webpack.js +8 -2
  2. package/hot/log.js +15 -15
  3. package/hot/poll.js +1 -0
  4. package/lib/APIPlugin.js +3 -3
  5. package/lib/AbstractMethodError.js +1 -0
  6. package/lib/AutomaticPrefetchPlugin.js +1 -0
  7. package/lib/BannerPlugin.js +1 -1
  8. package/lib/CaseSensitiveModulesWarning.js +4 -4
  9. package/lib/Chunk.js +6 -6
  10. package/lib/ChunkGraph.js +37 -31
  11. package/lib/ChunkGroup.js +4 -4
  12. package/lib/ChunkTemplate.js +1 -1
  13. package/lib/CleanPlugin.js +94 -17
  14. package/lib/CodeGenerationResults.js +1 -1
  15. package/lib/CompatibilityPlugin.js +5 -2
  16. package/lib/Compilation.js +67 -45
  17. package/lib/Compiler.js +46 -16
  18. package/lib/ConcatenationScope.js +15 -6
  19. package/lib/ConstPlugin.js +5 -3
  20. package/lib/ContextModule.js +16 -12
  21. package/lib/ContextModuleFactory.js +4 -3
  22. package/lib/ContextReplacementPlugin.js +4 -2
  23. package/lib/CssModule.js +2 -2
  24. package/lib/DefinePlugin.js +111 -3
  25. package/lib/DelegatedModuleFactoryPlugin.js +18 -18
  26. package/lib/Dependency.js +11 -4
  27. package/lib/DependencyTemplate.js +1 -0
  28. package/lib/DllEntryPlugin.js +3 -1
  29. package/lib/DllPlugin.js +4 -3
  30. package/lib/DllReferencePlugin.js +2 -2
  31. package/lib/DynamicEntryPlugin.js +1 -1
  32. package/lib/EntryOptionPlugin.js +5 -0
  33. package/lib/ErrorHelpers.js +4 -4
  34. package/lib/EvalDevToolModulePlugin.js +3 -3
  35. package/lib/EvalSourceMapDevToolPlugin.js +7 -7
  36. package/lib/ExportsInfo.js +48 -39
  37. package/lib/ExternalModule.js +15 -11
  38. package/lib/ExternalModuleFactoryPlugin.js +5 -2
  39. package/lib/FileSystemInfo.js +51 -36
  40. package/lib/FlagDependencyExportsPlugin.js +14 -7
  41. package/lib/FlagDependencyUsagePlugin.js +1 -1
  42. package/lib/Generator.js +14 -1
  43. package/lib/HookWebpackError.js +1 -0
  44. package/lib/HotModuleReplacementPlugin.js +77 -50
  45. package/lib/IgnorePlugin.js +5 -2
  46. package/lib/InvalidDependenciesModuleWarning.js +1 -1
  47. package/lib/JavascriptMetaInfoPlugin.js +0 -1
  48. package/lib/LibManifestPlugin.js +4 -2
  49. package/lib/LoaderOptionsPlugin.js +6 -4
  50. package/lib/MainTemplate.js +2 -2
  51. package/lib/Module.js +21 -6
  52. package/lib/ModuleFactory.js +1 -0
  53. package/lib/ModuleGraph.js +24 -2
  54. package/lib/ModuleGraphConnection.js +5 -5
  55. package/lib/ModuleInfoHeaderPlugin.js +2 -1
  56. package/lib/ModuleParseError.js +1 -0
  57. package/lib/ModuleSourceTypesConstants.js +12 -12
  58. package/lib/ModuleTemplate.js +1 -1
  59. package/lib/ModuleTypeConstants.js +21 -21
  60. package/lib/MultiCompiler.js +6 -6
  61. package/lib/NormalModule.js +31 -44
  62. package/lib/NormalModuleFactory.js +34 -20
  63. package/lib/NormalModuleReplacementPlugin.js +1 -1
  64. package/lib/NullFactory.js +1 -0
  65. package/lib/OptimizationStages.js +1 -1
  66. package/lib/Parser.js +1 -0
  67. package/lib/ProgressPlugin.js +12 -5
  68. package/lib/ProvidePlugin.js +5 -1
  69. package/lib/RawModule.js +14 -0
  70. package/lib/RecordIdsPlugin.js +3 -3
  71. package/lib/RuntimeGlobals.js +175 -155
  72. package/lib/RuntimeModule.js +1 -0
  73. package/lib/RuntimePlugin.js +33 -7
  74. package/lib/RuntimeTemplate.js +111 -11
  75. package/lib/SourceMapDevToolModuleOptionsPlugin.js +15 -25
  76. package/lib/SourceMapDevToolPlugin.js +19 -17
  77. package/lib/Template.js +2 -2
  78. package/lib/TemplatedPathPlugin.js +1 -1
  79. package/lib/WarnDeprecatedOptionPlugin.js +7 -8
  80. package/lib/WatchIgnorePlugin.js +4 -3
  81. package/lib/WebpackIsIncludedPlugin.js +2 -1
  82. package/lib/WebpackOptionsApply.js +115 -27
  83. package/lib/asset/AssetGenerator.js +15 -11
  84. package/lib/asset/AssetModulesPlugin.js +19 -17
  85. package/lib/asset/AssetSourceGenerator.js +4 -4
  86. package/lib/asset/RawDataUrlModule.js +4 -2
  87. package/lib/async-modules/AwaitDependenciesInitFragment.js +1 -1
  88. package/lib/buildChunkGraph.js +6 -3
  89. package/lib/cache/AddBuildDependenciesPlugin.js +5 -6
  90. package/lib/cache/IdleFileCachePlugin.js +7 -4
  91. package/lib/cache/MemoryCachePlugin.js +1 -0
  92. package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
  93. package/lib/cache/PackFileCacheStrategy.js +26 -20
  94. package/lib/cache/ResolverCachePlugin.js +16 -8
  95. package/lib/cli.js +15 -10
  96. package/lib/config/browserslistTargetHandler.js +3 -3
  97. package/lib/config/defaults.js +25 -17
  98. package/lib/config/normalization.js +2 -1
  99. package/lib/config/target.js +6 -5
  100. package/lib/container/ContainerPlugin.js +1 -1
  101. package/lib/container/ContainerReferencePlugin.js +1 -1
  102. package/lib/container/FallbackModule.js +2 -1
  103. package/lib/container/HoistContainerReferencesPlugin.js +1 -1
  104. package/lib/container/ModuleFederationPlugin.js +2 -2
  105. package/lib/container/RemoteModule.js +1 -1
  106. package/lib/css/CssGenerator.js +9 -6
  107. package/lib/css/CssModulesPlugin.js +44 -31
  108. package/lib/css/CssParser.js +6 -4
  109. package/lib/css/walkCssTokens.js +33 -37
  110. package/lib/debug/ProfilingPlugin.js +6 -6
  111. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -8
  112. package/lib/dependencies/AMDPlugin.js +12 -8
  113. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +28 -26
  114. package/lib/dependencies/CachedConstDependency.js +1 -5
  115. package/lib/dependencies/CommonJsExportRequireDependency.js +6 -4
  116. package/lib/dependencies/CommonJsExportsParserPlugin.js +22 -25
  117. package/lib/dependencies/CommonJsFullRequireDependency.js +1 -9
  118. package/lib/dependencies/CommonJsImportsParserPlugin.js +100 -114
  119. package/lib/dependencies/CommonJsPlugin.js +15 -16
  120. package/lib/dependencies/ContextDependencyHelpers.js +2 -1
  121. package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
  122. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
  123. package/lib/dependencies/CssIcssExportDependency.js +1 -1
  124. package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
  125. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
  126. package/lib/dependencies/DynamicExports.js +9 -9
  127. package/lib/dependencies/ExportsInfoDependency.js +1 -1
  128. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +122 -101
  129. package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
  130. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +95 -19
  131. package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
  132. package/lib/dependencies/HarmonyImportDependency.js +11 -5
  133. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +238 -162
  134. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -1
  135. package/lib/dependencies/HarmonyImportSpecifierDependency.js +20 -9
  136. package/lib/dependencies/HarmonyModulesPlugin.js +23 -12
  137. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
  138. package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
  139. package/lib/dependencies/ImportMetaPlugin.js +2 -2
  140. package/lib/dependencies/ImportParserPlugin.js +40 -9
  141. package/lib/dependencies/ImportPlugin.js +3 -1
  142. package/lib/dependencies/LoaderPlugin.js +1 -0
  143. package/lib/dependencies/ModuleDependency.js +3 -1
  144. package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
  145. package/lib/dependencies/RequireContextPlugin.js +3 -1
  146. package/lib/dependencies/RequireEnsurePlugin.js +6 -6
  147. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +33 -34
  148. package/lib/dependencies/RequireIncludePlugin.js +1 -0
  149. package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
  150. package/lib/dependencies/SystemPlugin.js +1 -1
  151. package/lib/dependencies/URLContextDependency.js +65 -0
  152. package/lib/dependencies/URLPlugin.js +17 -157
  153. package/lib/dependencies/WorkerPlugin.js +23 -10
  154. package/lib/dependencies/processExportInfo.js +2 -1
  155. package/lib/esm/ModuleChunkFormatPlugin.js +269 -185
  156. package/lib/esm/ModuleChunkLoadingPlugin.js +39 -1
  157. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +70 -3
  158. package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
  159. package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
  160. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +37 -0
  161. package/lib/hmr/LazyCompilationPlugin.js +4 -2
  162. package/lib/hmr/lazyCompilationBackend.js +4 -2
  163. package/lib/ids/ChunkModuleIdRangePlugin.js +6 -3
  164. package/lib/ids/DeterministicChunkIdsPlugin.js +30 -35
  165. package/lib/ids/DeterministicModuleIdsPlugin.js +4 -3
  166. package/lib/ids/HashedModuleIdsPlugin.js +5 -4
  167. package/lib/ids/IdHelpers.js +21 -17
  168. package/lib/ids/NamedChunkIdsPlugin.js +5 -5
  169. package/lib/ids/NamedModuleIdsPlugin.js +4 -4
  170. package/lib/ids/NaturalChunkIdsPlugin.js +2 -1
  171. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  172. package/lib/ids/OccurrenceChunkIdsPlugin.js +3 -2
  173. package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
  174. package/lib/ids/SyncModuleIdsPlugin.js +1 -1
  175. package/lib/index.js +13 -3
  176. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +113 -119
  177. package/lib/javascript/BasicEvaluatedExpression.js +2 -1
  178. package/lib/javascript/ChunkHelpers.js +1 -0
  179. package/lib/javascript/CommonJsChunkFormatPlugin.js +121 -136
  180. package/lib/javascript/EnableChunkLoadingPlugin.js +6 -3
  181. package/lib/javascript/JavascriptGenerator.js +14 -2
  182. package/lib/javascript/JavascriptModulesPlugin.js +68 -27
  183. package/lib/javascript/JavascriptParser.js +117 -76
  184. package/lib/javascript/JavascriptParserHelpers.js +41 -41
  185. package/lib/javascript/StartupHelpers.js +17 -17
  186. package/lib/json/JsonGenerator.js +4 -2
  187. package/lib/json/JsonModulesPlugin.js +2 -2
  188. package/lib/json/JsonParser.js +1 -1
  189. package/lib/library/AbstractLibraryPlugin.js +6 -2
  190. package/lib/library/AssignLibraryPlugin.js +21 -6
  191. package/lib/library/EnableLibraryPlugin.js +23 -3
  192. package/lib/library/UmdLibraryPlugin.js +15 -6
  193. package/lib/logging/createConsoleLogger.js +3 -3
  194. package/lib/logging/runtime.js +9 -9
  195. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +4 -22
  196. package/lib/node/RequireChunkLoadingRuntimeModule.js +4 -22
  197. package/lib/node/nodeConsole.js +4 -2
  198. package/lib/optimize/AggressiveMergingPlugin.js +45 -46
  199. package/lib/optimize/AggressiveSplittingPlugin.js +13 -12
  200. package/lib/optimize/ConcatenatedModule.js +227 -57
  201. package/lib/optimize/EnsureChunkConditionsPlugin.js +58 -58
  202. package/lib/optimize/FlagIncludedChunksPlugin.js +3 -1
  203. package/lib/optimize/InnerGraph.js +115 -112
  204. package/lib/optimize/InnerGraphPlugin.js +2 -2
  205. package/lib/optimize/LimitChunkCountPlugin.js +4 -2
  206. package/lib/optimize/MangleExportsPlugin.js +4 -3
  207. package/lib/optimize/MergeDuplicateChunksPlugin.js +80 -81
  208. package/lib/optimize/MinChunkSizePlugin.js +6 -3
  209. package/lib/optimize/ModuleConcatenationPlugin.js +31 -22
  210. package/lib/optimize/RealContentHashPlugin.js +26 -20
  211. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
  212. package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
  213. package/lib/optimize/SideEffectsFlagPlugin.js +3 -2
  214. package/lib/optimize/SplitChunksPlugin.js +16 -13
  215. package/lib/rules/BasicEffectRulePlugin.js +4 -2
  216. package/lib/rules/BasicMatcherRulePlugin.js +3 -1
  217. package/lib/rules/ObjectMatcherRulePlugin.js +3 -1
  218. package/lib/rules/RuleSetCompiler.js +19 -5
  219. package/lib/rules/UseEffectRulePlugin.js +17 -9
  220. package/lib/runtime/AsyncModuleRuntimeModule.js +64 -9
  221. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -1
  222. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +214 -0
  223. package/lib/runtime/RuntimeIdRuntimeModule.js +2 -1
  224. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +8 -7
  225. package/lib/schemes/FileUriPlugin.js +1 -1
  226. package/lib/schemes/HttpUriPlugin.js +27 -19
  227. package/lib/schemes/VirtualUrlPlugin.js +222 -0
  228. package/lib/serialization/AggregateErrorSerializer.js +1 -1
  229. package/lib/serialization/BinaryMiddleware.js +5 -4
  230. package/lib/serialization/FileMiddleware.js +7 -4
  231. package/lib/serialization/ObjectMiddleware.js +14 -8
  232. package/lib/serialization/Serializer.js +5 -3
  233. package/lib/serialization/SerializerMiddleware.js +2 -0
  234. package/lib/sharing/ConsumeSharedModule.js +1 -1
  235. package/lib/sharing/ConsumeSharedPlugin.js +3 -3
  236. package/lib/sharing/ConsumeSharedRuntimeModule.js +2 -2
  237. package/lib/sharing/ProvideSharedModule.js +1 -1
  238. package/lib/sharing/ProvideSharedPlugin.js +3 -2
  239. package/lib/sharing/SharePlugin.js +2 -1
  240. package/lib/sharing/ShareRuntimeModule.js +3 -5
  241. package/lib/sharing/utils.js +34 -34
  242. package/lib/stats/DefaultStatsFactoryPlugin.js +49 -46
  243. package/lib/stats/DefaultStatsPresetPlugin.js +13 -13
  244. package/lib/stats/DefaultStatsPrinterPlugin.js +15 -9
  245. package/lib/stats/StatsFactory.js +6 -3
  246. package/lib/stats/StatsPrinter.js +6 -7
  247. package/lib/url/URLParserPlugin.js +266 -0
  248. package/lib/util/ArrayQueue.js +1 -1
  249. package/lib/util/AsyncQueue.js +1 -1
  250. package/lib/util/Hash.js +2 -0
  251. package/lib/util/IterableHelpers.js +1 -1
  252. package/lib/util/LazyBucketSortedSet.js +2 -1
  253. package/lib/util/LazySet.js +11 -6
  254. package/lib/util/ParallelismFactorCalculator.js +1 -1
  255. package/lib/util/SetHelpers.js +3 -3
  256. package/lib/util/SortableSet.js +2 -2
  257. package/lib/util/StackedCacheMap.js +3 -1
  258. package/lib/util/StackedMap.js +2 -2
  259. package/lib/util/StringXor.js +1 -0
  260. package/lib/util/TupleSet.js +1 -0
  261. package/lib/util/URLAbsoluteSpecifier.js +1 -1
  262. package/lib/util/cleverMerge.js +95 -58
  263. package/lib/util/comparators.js +154 -127
  264. package/lib/util/compileBooleanMatcher.js +8 -3
  265. package/lib/util/concatenate.js +8 -7
  266. package/lib/util/conventions.js +72 -73
  267. package/lib/util/create-schema-validation.js +2 -1
  268. package/lib/util/createHash.js +10 -4
  269. package/lib/util/deprecation.js +69 -66
  270. package/lib/util/deterministicGrouping.js +4 -2
  271. package/lib/util/extractUrlAndGlobal.js +1 -1
  272. package/lib/util/findGraphRoots.js +2 -2
  273. package/lib/util/fs.js +30 -23
  274. package/lib/util/hash/md4.js +2 -2
  275. package/lib/util/hash/wasm-hash.js +4 -2
  276. package/lib/util/identifier.js +13 -12
  277. package/lib/util/internalSerializables.js +2 -0
  278. package/lib/util/magicComment.js +5 -5
  279. package/lib/util/processAsyncTree.js +1 -1
  280. package/lib/util/propertyAccess.js +1 -1
  281. package/lib/util/propertyName.js +1 -1
  282. package/lib/util/registerExternalSerializer.js +1 -2
  283. package/lib/util/removeBOM.js +1 -1
  284. package/lib/util/runtime.js +29 -21
  285. package/lib/util/semver.js +1 -1
  286. package/lib/util/serialization.js +3 -0
  287. package/lib/util/source.js +3 -2
  288. package/lib/validateSchema.js +1 -0
  289. package/lib/wasm/EnableWasmLoadingPlugin.js +6 -3
  290. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -1
  291. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +46 -49
  292. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
  293. package/lib/wasm-sync/WebAssemblyGenerator.js +2 -3
  294. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +3 -2
  295. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +3 -0
  296. package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
  297. package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -22
  298. package/lib/webpack.js +4 -5
  299. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
  300. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -24
  301. package/lib/webworker/WebWorkerTemplatePlugin.js +1 -0
  302. package/package.json +119 -113
  303. package/schemas/WebpackOptions.check.js +1 -1
  304. package/schemas/WebpackOptions.json +17 -0
  305. package/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts +7 -0
  306. package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +6 -0
  307. package/schemas/plugins/schemes/VirtualUrlPlugin.json +77 -0
  308. package/types.d.ts +1243 -409
@@ -55,20 +55,113 @@ const createCachedParameterizedComparator = fn => {
55
55
  };
56
56
 
57
57
  /**
58
- * @param {Chunk} a chunk
59
- * @param {Chunk} b chunk
60
- * @returns {-1|0|1} compare result
58
+ * @param {string | number} a first id
59
+ * @param {string | number} b second id
60
+ * @returns {-1 | 0 | 1} compare result
61
61
  */
62
- module.exports.compareChunksById = (a, b) =>
63
- compareIds(/** @type {ChunkId} */ (a.id), /** @type {ChunkId} */ (b.id));
62
+ const compareIds = (a, b) => {
63
+ if (typeof a !== typeof b) {
64
+ return typeof a < typeof b ? -1 : 1;
65
+ }
66
+ if (a < b) return -1;
67
+ if (a > b) return 1;
68
+ return 0;
69
+ };
64
70
 
65
71
  /**
66
- * @param {Module} a module
67
- * @param {Module} b module
68
- * @returns {-1|0|1} compare result
72
+ * @template T
73
+ * @param {Comparator<T>} elementComparator comparator for elements
74
+ * @returns {Comparator<Iterable<T>>} comparator for iterables of elements
69
75
  */
70
- module.exports.compareModulesByIdentifier = (a, b) =>
71
- compareIds(a.identifier(), b.identifier());
76
+ const compareIterables = elementComparator => {
77
+ const cacheEntry = compareIteratorsCache.get(elementComparator);
78
+ if (cacheEntry !== undefined) return cacheEntry;
79
+ /**
80
+ * @param {Iterable<T>} a first value
81
+ * @param {Iterable<T>} b second value
82
+ * @returns {-1|0|1} compare result
83
+ */
84
+ const result = (a, b) => {
85
+ const aI = a[Symbol.iterator]();
86
+ const bI = b[Symbol.iterator]();
87
+ while (true) {
88
+ const aItem = aI.next();
89
+ const bItem = bI.next();
90
+ if (aItem.done) {
91
+ return bItem.done ? 0 : -1;
92
+ } else if (bItem.done) {
93
+ return 1;
94
+ }
95
+ const res = elementComparator(aItem.value, bItem.value);
96
+ if (res !== 0) return res;
97
+ }
98
+ };
99
+ compareIteratorsCache.set(elementComparator, result);
100
+ return result;
101
+ };
102
+
103
+ /**
104
+ * Compare two locations
105
+ * @param {DependencyLocation} a A location node
106
+ * @param {DependencyLocation} b A location node
107
+ * @returns {-1|0|1} sorting comparator value
108
+ */
109
+ const compareLocations = (a, b) => {
110
+ const isObjectA = typeof a === "object" && a !== null;
111
+ const isObjectB = typeof b === "object" && b !== null;
112
+ if (!isObjectA || !isObjectB) {
113
+ if (isObjectA) return 1;
114
+ if (isObjectB) return -1;
115
+ return 0;
116
+ }
117
+ if ("start" in a) {
118
+ if ("start" in b) {
119
+ const ap = a.start;
120
+ const bp = b.start;
121
+ if (ap.line < bp.line) return -1;
122
+ if (ap.line > bp.line) return 1;
123
+ if (
124
+ /** @type {number} */ (ap.column) < /** @type {number} */ (bp.column)
125
+ ) {
126
+ return -1;
127
+ }
128
+ if (
129
+ /** @type {number} */ (ap.column) > /** @type {number} */ (bp.column)
130
+ ) {
131
+ return 1;
132
+ }
133
+ } else {
134
+ return -1;
135
+ }
136
+ } else if ("start" in b) {
137
+ return 1;
138
+ }
139
+ if ("name" in a) {
140
+ if ("name" in b) {
141
+ if (a.name < b.name) return -1;
142
+ if (a.name > b.name) return 1;
143
+ } else {
144
+ return -1;
145
+ }
146
+ } else if ("name" in b) {
147
+ return 1;
148
+ }
149
+ if ("index" in a) {
150
+ if ("index" in b) {
151
+ if (/** @type {number} */ (a.index) < /** @type {number} */ (b.index)) {
152
+ return -1;
153
+ }
154
+ if (/** @type {number} */ (a.index) > /** @type {number} */ (b.index)) {
155
+ return 1;
156
+ }
157
+ } else {
158
+ return -1;
159
+ }
160
+ } else if ("index" in b) {
161
+ return 1;
162
+ }
163
+ return 0;
164
+ };
72
165
 
73
166
  /**
74
167
  * @param {ChunkGraph} chunkGraph the chunk graph
@@ -81,9 +174,6 @@ const compareModulesById = (chunkGraph, a, b) =>
81
174
  /** @type {ModuleId} */ (chunkGraph.getModuleId(a)),
82
175
  /** @type {ModuleId} */ (chunkGraph.getModuleId(b))
83
176
  );
84
- /** @type {ParameterizedComparator<ChunkGraph, Module>} */
85
- module.exports.compareModulesById =
86
- createCachedParameterizedComparator(compareModulesById);
87
177
 
88
178
  /**
89
179
  * @param {number} a number
@@ -98,7 +188,6 @@ const compareNumbers = (a, b) => {
98
188
  if (a > b) return 1;
99
189
  return 0;
100
190
  };
101
- module.exports.compareNumbers = compareNumbers;
102
191
 
103
192
  /**
104
193
  * @param {string} a string
@@ -170,7 +259,6 @@ const compareStringsNumeric = (a, b) => {
170
259
 
171
260
  return 0;
172
261
  };
173
- module.exports.compareStringsNumeric = compareStringsNumeric;
174
262
 
175
263
  /**
176
264
  * @param {ModuleGraph} moduleGraph the module graph
@@ -186,11 +274,6 @@ const compareModulesByPostOrderIndexOrIdentifier = (moduleGraph, a, b) => {
186
274
  if (cmp !== 0) return cmp;
187
275
  return compareIds(a.identifier(), b.identifier());
188
276
  };
189
- /** @type {ParameterizedComparator<ModuleGraph, Module>} */
190
- module.exports.compareModulesByPostOrderIndexOrIdentifier =
191
- createCachedParameterizedComparator(
192
- compareModulesByPostOrderIndexOrIdentifier
193
- );
194
277
 
195
278
  /**
196
279
  * @param {ModuleGraph} moduleGraph the module graph
@@ -206,11 +289,6 @@ const compareModulesByPreOrderIndexOrIdentifier = (moduleGraph, a, b) => {
206
289
  if (cmp !== 0) return cmp;
207
290
  return compareIds(a.identifier(), b.identifier());
208
291
  };
209
- /** @type {ParameterizedComparator<ModuleGraph, Module>} */
210
- module.exports.compareModulesByPreOrderIndexOrIdentifier =
211
- createCachedParameterizedComparator(
212
- compareModulesByPreOrderIndexOrIdentifier
213
- );
214
292
 
215
293
  /**
216
294
  * @param {ChunkGraph} chunkGraph the chunk graph
@@ -226,9 +304,6 @@ const compareModulesByIdOrIdentifier = (chunkGraph, a, b) => {
226
304
  if (cmp !== 0) return cmp;
227
305
  return compareIds(a.identifier(), b.identifier());
228
306
  };
229
- /** @type {ParameterizedComparator<ChunkGraph, Module>} */
230
- module.exports.compareModulesByIdOrIdentifier =
231
- createCachedParameterizedComparator(compareModulesByIdOrIdentifier);
232
307
 
233
308
  /**
234
309
  * @param {ChunkGraph} chunkGraph the chunk graph
@@ -237,25 +312,6 @@ module.exports.compareModulesByIdOrIdentifier =
237
312
  * @returns {-1 | 0 | 1} compare result
238
313
  */
239
314
  const compareChunks = (chunkGraph, a, b) => chunkGraph.compareChunks(a, b);
240
- /** @type {ParameterizedComparator<ChunkGraph, Chunk>} */
241
- module.exports.compareChunks =
242
- createCachedParameterizedComparator(compareChunks);
243
-
244
- /**
245
- * @param {string | number} a first id
246
- * @param {string | number} b second id
247
- * @returns {-1 | 0 | 1} compare result
248
- */
249
- const compareIds = (a, b) => {
250
- if (typeof a !== typeof b) {
251
- return typeof a < typeof b ? -1 : 1;
252
- }
253
- if (a < b) return -1;
254
- if (a > b) return 1;
255
- return 0;
256
- };
257
-
258
- module.exports.compareIds = compareIds;
259
315
 
260
316
  /**
261
317
  * @param {string} a first string
@@ -268,8 +324,6 @@ const compareStrings = (a, b) => {
268
324
  return 0;
269
325
  };
270
326
 
271
- module.exports.compareStrings = compareStrings;
272
-
273
327
  /**
274
328
  * @param {ChunkGroup} a first chunk group
275
329
  * @param {ChunkGroup} b second chunk group
@@ -277,7 +331,6 @@ module.exports.compareStrings = compareStrings;
277
331
  */
278
332
  const compareChunkGroupsByIndex = (a, b) =>
279
333
  /** @type {number} */ (a.index) < /** @type {number} */ (b.index) ? -1 : 1;
280
- module.exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex;
281
334
 
282
335
  /**
283
336
  * @template {EXPECTED_OBJECT} K1
@@ -354,7 +407,6 @@ const concatComparators = (c1, c2, ...cRest) => {
354
407
  concatComparatorsCache.set(c1, c2, result);
355
408
  return result;
356
409
  };
357
- module.exports.concatComparators = concatComparators;
358
410
 
359
411
  /**
360
412
  * @template A, B
@@ -396,44 +448,10 @@ const compareSelect = (getter, comparator) => {
396
448
  compareSelectCache.set(getter, comparator, result);
397
449
  return result;
398
450
  };
399
- module.exports.compareSelect = compareSelect;
400
451
 
401
452
  /** @type {WeakMap<Comparator<EXPECTED_ANY>, Comparator<Iterable<EXPECTED_ANY>>>} */
402
453
  const compareIteratorsCache = new WeakMap();
403
454
 
404
- /**
405
- * @template T
406
- * @param {Comparator<T>} elementComparator comparator for elements
407
- * @returns {Comparator<Iterable<T>>} comparator for iterables of elements
408
- */
409
- const compareIterables = elementComparator => {
410
- const cacheEntry = compareIteratorsCache.get(elementComparator);
411
- if (cacheEntry !== undefined) return cacheEntry;
412
- /**
413
- * @param {Iterable<T>} a first value
414
- * @param {Iterable<T>} b second value
415
- * @returns {-1|0|1} compare result
416
- */
417
- const result = (a, b) => {
418
- const aI = a[Symbol.iterator]();
419
- const bI = b[Symbol.iterator]();
420
- while (true) {
421
- const aItem = aI.next();
422
- const bItem = bI.next();
423
- if (aItem.done) {
424
- return bItem.done ? 0 : -1;
425
- } else if (bItem.done) {
426
- return 1;
427
- }
428
- const res = elementComparator(aItem.value, bItem.value);
429
- if (res !== 0) return res;
430
- }
431
- };
432
- compareIteratorsCache.set(elementComparator, result);
433
- return result;
434
- };
435
- module.exports.compareIterables = compareIterables;
436
-
437
455
  // TODO this is no longer needed when minimum node.js version is >= 12
438
456
  // since these versions ship with a stable sort function
439
457
  /**
@@ -441,7 +459,7 @@ module.exports.compareIterables = compareIterables;
441
459
  * @param {Iterable<T>} iterable original ordered list
442
460
  * @returns {Comparator<T>} comparator
443
461
  */
444
- module.exports.keepOriginalOrder = iterable => {
462
+ const keepOriginalOrder = iterable => {
445
463
  /** @type {Map<T, number>} */
446
464
  const map = new Map();
447
465
  let i = 0;
@@ -459,7 +477,7 @@ module.exports.keepOriginalOrder = iterable => {
459
477
  * @param {ChunkGraph} chunkGraph the chunk graph
460
478
  * @returns {Comparator<Chunk>} comparator
461
479
  */
462
- module.exports.compareChunksNatural = chunkGraph => {
480
+ const compareChunksNatural = chunkGraph => {
463
481
  const cmpFn = module.exports.compareModulesById(chunkGraph);
464
482
  const cmpIterableFn = compareIterables(cmpFn);
465
483
  return concatComparators(
@@ -479,45 +497,54 @@ module.exports.compareChunksNatural = chunkGraph => {
479
497
  );
480
498
  };
481
499
 
500
+ module.exports.compareChunkGroupsByIndex = compareChunkGroupsByIndex;
501
+ /** @type {ParameterizedComparator<ChunkGraph, Chunk>} */
502
+ module.exports.compareChunks =
503
+ createCachedParameterizedComparator(compareChunks);
482
504
  /**
483
- * Compare two locations
484
- * @param {DependencyLocation} a A location node
485
- * @param {DependencyLocation} b A location node
486
- * @returns {-1|0|1} sorting comparator value
505
+ * @param {Chunk} a chunk
506
+ * @param {Chunk} b chunk
507
+ * @returns {-1|0|1} compare result
487
508
  */
488
- module.exports.compareLocations = (a, b) => {
489
- const isObjectA = typeof a === "object" && a !== null;
490
- const isObjectB = typeof b === "object" && b !== null;
491
- if (!isObjectA || !isObjectB) {
492
- if (isObjectA) return 1;
493
- if (isObjectB) return -1;
494
- return 0;
495
- }
496
- if ("start" in a) {
497
- if ("start" in b) {
498
- const ap = a.start;
499
- const bp = b.start;
500
- if (ap.line < bp.line) return -1;
501
- if (ap.line > bp.line) return 1;
502
- if (/** @type {number} */ (ap.column) < /** @type {number} */ (bp.column))
503
- return -1;
504
- if (/** @type {number} */ (ap.column) > /** @type {number} */ (bp.column))
505
- return 1;
506
- } else return -1;
507
- } else if ("start" in b) return 1;
508
- if ("name" in a) {
509
- if ("name" in b) {
510
- if (a.name < b.name) return -1;
511
- if (a.name > b.name) return 1;
512
- } else return -1;
513
- } else if ("name" in b) return 1;
514
- if ("index" in a) {
515
- if ("index" in b) {
516
- if (/** @type {number} */ (a.index) < /** @type {number} */ (b.index))
517
- return -1;
518
- if (/** @type {number} */ (a.index) > /** @type {number} */ (b.index))
519
- return 1;
520
- } else return -1;
521
- } else if ("index" in b) return 1;
522
- return 0;
523
- };
509
+ module.exports.compareChunksById = (a, b) =>
510
+ compareIds(/** @type {ChunkId} */ (a.id), /** @type {ChunkId} */ (b.id));
511
+ module.exports.compareChunksNatural = compareChunksNatural;
512
+
513
+ module.exports.compareIds = compareIds;
514
+
515
+ module.exports.compareIterables = compareIterables;
516
+
517
+ module.exports.compareLocations = compareLocations;
518
+
519
+ /** @type {ParameterizedComparator<ChunkGraph, Module>} */
520
+ module.exports.compareModulesById =
521
+ createCachedParameterizedComparator(compareModulesById);
522
+ /** @type {ParameterizedComparator<ChunkGraph, Module>} */
523
+ module.exports.compareModulesByIdOrIdentifier =
524
+ createCachedParameterizedComparator(compareModulesByIdOrIdentifier);
525
+ /**
526
+ * @param {Module} a module
527
+ * @param {Module} b module
528
+ * @returns {-1|0|1} compare result
529
+ */
530
+ module.exports.compareModulesByIdentifier = (a, b) =>
531
+ compareIds(a.identifier(), b.identifier());
532
+ /** @type {ParameterizedComparator<ModuleGraph, Module>} */
533
+ module.exports.compareModulesByPostOrderIndexOrIdentifier =
534
+ createCachedParameterizedComparator(
535
+ compareModulesByPostOrderIndexOrIdentifier
536
+ );
537
+ /** @type {ParameterizedComparator<ModuleGraph, Module>} */
538
+ module.exports.compareModulesByPreOrderIndexOrIdentifier =
539
+ createCachedParameterizedComparator(
540
+ compareModulesByPreOrderIndexOrIdentifier
541
+ );
542
+
543
+ module.exports.compareNumbers = compareNumbers;
544
+ module.exports.compareSelect = compareSelect;
545
+ module.exports.compareStrings = compareStrings;
546
+ module.exports.compareStringsNumeric = compareStringsNumeric;
547
+
548
+ module.exports.concatComparators = concatComparators;
549
+
550
+ module.exports.keepOriginalOrder = keepOriginalOrder;
@@ -42,10 +42,12 @@ const compileBooleanMatcher = map => {
42
42
  const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => {
43
43
  if (positiveItems.length === 0) return () => "false";
44
44
  if (negativeItems.length === 0) return () => "true";
45
- if (positiveItems.length === 1)
45
+ if (positiveItems.length === 1) {
46
46
  return value => `${toSimpleString(positiveItems[0])} == ${value}`;
47
- if (negativeItems.length === 1)
47
+ }
48
+ if (negativeItems.length === 1) {
48
49
  return value => `${toSimpleString(negativeItems[0])} != ${value}`;
50
+ }
49
51
  const positiveRegexp = itemsToRegexp(positiveItems);
50
52
  const negativeRegexp = itemsToRegexp(negativeItems);
51
53
  if (positiveRegexp.length <= negativeRegexp.length) {
@@ -146,6 +148,7 @@ const itemsToRegexp = itemsArr => {
146
148
  if (countOfSingleCharItems === itemsArr.length) {
147
149
  return `[${quoteMeta(itemsArr.sort().join(""))}]`;
148
150
  }
151
+ /** @type {Set<string>} */
149
152
  const items = new Set(itemsArr.sort());
150
153
  if (countOfSingleCharItems > 2) {
151
154
  let singleCharItems = "";
@@ -224,11 +227,13 @@ const itemsToRegexp = itemsArr => {
224
227
 
225
228
  // TODO further optimize regexp, i. e.
226
229
  // use ranges: (1|2|3|4|a) => [1-4a]
227
- const conditional = finishedItems.concat(Array.from(items, quoteMeta));
230
+ /** @type {string[]} */
231
+ const conditional = [...finishedItems, ...Array.from(items, quoteMeta)];
228
232
  if (conditional.length === 1) return conditional[0];
229
233
  return `(${conditional.join("|")})`;
230
234
  };
231
235
 
232
236
  compileBooleanMatcher.fromLists = compileBooleanMatcherFromLists;
233
237
  compileBooleanMatcher.itemsToRegexp = itemsToRegexp;
238
+
234
239
  module.exports = compileBooleanMatcher;
@@ -29,7 +29,7 @@ const getAllReferences = variable => {
29
29
  for (const scope of variable.scope.childScopes) {
30
30
  for (const innerVar of scope.variables) {
31
31
  if (innerVar.identifiers.some(id => identifiers.has(id))) {
32
- set = set.concat(innerVar.references);
32
+ set = [...set, ...innerVar.references];
33
33
  break;
34
34
  }
35
35
  }
@@ -122,8 +122,9 @@ function findNewName(oldName, usedNamed1, usedNamed2, extraInfo) {
122
122
  if (
123
123
  !usedNamed1.has(nameIdent) &&
124
124
  (!usedNamed2 || !usedNamed2.has(nameIdent))
125
- )
125
+ ) {
126
126
  return nameIdent;
127
+ }
127
128
  }
128
129
 
129
130
  let i = 0;
@@ -220,12 +221,12 @@ const getUsedNamesInScopeInfo = (usedNamesInScopeInfo, module, id) => {
220
221
  };
221
222
 
222
223
  module.exports = {
223
- getUsedNamesInScopeInfo,
224
+ DEFAULT_EXPORT,
225
+ NAMESPACE_OBJECT_EXPORT,
226
+ RESERVED_NAMES,
227
+ addScopeSymbols,
224
228
  findNewName,
225
229
  getAllReferences,
226
230
  getPathInAst,
227
- NAMESPACE_OBJECT_EXPORT,
228
- DEFAULT_EXPORT,
229
- RESERVED_NAMES,
230
- addScopeSymbols
231
+ getUsedNamesInScopeInfo
231
232
  };
@@ -6,6 +6,77 @@
6
6
  "use strict";
7
7
 
8
8
  /** @typedef {import("../../declarations/WebpackOptions").CssGeneratorExportsConvention} CssGeneratorExportsConvention */
9
+ // Copy from css-loader
10
+ /**
11
+ * @param {string} string string
12
+ * @returns {string} result
13
+ */
14
+ const preserveCamelCase = string => {
15
+ let result = string;
16
+ let isLastCharLower = false;
17
+ let isLastCharUpper = false;
18
+ let isLastLastCharUpper = false;
19
+
20
+ for (let i = 0; i < result.length; i++) {
21
+ const character = result[i];
22
+
23
+ if (isLastCharLower && /[\p{Lu}]/u.test(character)) {
24
+ result = `${result.slice(0, i)}-${result.slice(i)}`;
25
+ isLastCharLower = false;
26
+ isLastLastCharUpper = isLastCharUpper;
27
+ isLastCharUpper = true;
28
+ i += 1;
29
+ } else if (
30
+ isLastCharUpper &&
31
+ isLastLastCharUpper &&
32
+ /[\p{Ll}]/u.test(character)
33
+ ) {
34
+ result = `${result.slice(0, i - 1)}-${result.slice(i - 1)}`;
35
+ isLastLastCharUpper = isLastCharUpper;
36
+ isLastCharUpper = false;
37
+ isLastCharLower = true;
38
+ } else {
39
+ isLastCharLower =
40
+ character.toLowerCase() === character &&
41
+ character.toUpperCase() !== character;
42
+ isLastLastCharUpper = isLastCharUpper;
43
+ isLastCharUpper =
44
+ character.toUpperCase() === character &&
45
+ character.toLowerCase() !== character;
46
+ }
47
+ }
48
+
49
+ return result;
50
+ };
51
+
52
+ // Copy from css-loader
53
+ /**
54
+ * @param {string} input input
55
+ * @returns {string} result
56
+ */
57
+ module.exports.camelCase = input => {
58
+ let result = input.trim();
59
+
60
+ if (result.length === 0) {
61
+ return "";
62
+ }
63
+
64
+ if (result.length === 1) {
65
+ return result.toLowerCase();
66
+ }
67
+
68
+ const hasUpperCase = result !== result.toLowerCase();
69
+
70
+ if (hasUpperCase) {
71
+ result = preserveCamelCase(result);
72
+ }
73
+
74
+ return result
75
+ .replace(/^[_.\- ]+/, "")
76
+ .toLowerCase()
77
+ .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase())
78
+ .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase());
79
+ };
9
80
 
10
81
  /**
11
82
  * @param {string} input input
@@ -42,7 +113,7 @@ module.exports.cssExportConvention = (input, convention) => {
42
113
  }
43
114
  }
44
115
  }
45
- return Array.from(set);
116
+ return [...set];
46
117
  };
47
118
 
48
119
  // Copy from css-loader
@@ -52,75 +123,3 @@ module.exports.cssExportConvention = (input, convention) => {
52
123
  */
53
124
  module.exports.dashesCamelCase = input =>
54
125
  input.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
55
-
56
- // Copy from css-loader
57
- /**
58
- * @param {string} input input
59
- * @returns {string} result
60
- */
61
- module.exports.camelCase = input => {
62
- let result = input.trim();
63
-
64
- if (result.length === 0) {
65
- return "";
66
- }
67
-
68
- if (result.length === 1) {
69
- return result.toLowerCase();
70
- }
71
-
72
- const hasUpperCase = result !== result.toLowerCase();
73
-
74
- if (hasUpperCase) {
75
- result = preserveCamelCase(result);
76
- }
77
-
78
- return result
79
- .replace(/^[_.\- ]+/, "")
80
- .toLowerCase()
81
- .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase())
82
- .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toUpperCase());
83
- };
84
-
85
- // Copy from css-loader
86
- /**
87
- * @param {string} string string
88
- * @returns {string} result
89
- */
90
- const preserveCamelCase = string => {
91
- let result = string;
92
- let isLastCharLower = false;
93
- let isLastCharUpper = false;
94
- let isLastLastCharUpper = false;
95
-
96
- for (let i = 0; i < result.length; i++) {
97
- const character = result[i];
98
-
99
- if (isLastCharLower && /[\p{Lu}]/u.test(character)) {
100
- result = `${result.slice(0, i)}-${result.slice(i)}`;
101
- isLastCharLower = false;
102
- isLastLastCharUpper = isLastCharUpper;
103
- isLastCharUpper = true;
104
- i += 1;
105
- } else if (
106
- isLastCharUpper &&
107
- isLastLastCharUpper &&
108
- /[\p{Ll}]/u.test(character)
109
- ) {
110
- result = `${result.slice(0, i - 1)}-${result.slice(i - 1)}`;
111
- isLastLastCharUpper = isLastCharUpper;
112
- isLastCharUpper = false;
113
- isLastCharLower = true;
114
- } else {
115
- isLastCharLower =
116
- character.toLowerCase() === character &&
117
- character.toUpperCase() !== character;
118
- isLastLastCharUpper = isLastCharUpper;
119
- isLastCharUpper =
120
- character.toUpperCase() === character &&
121
- character.toLowerCase() !== character;
122
- }
123
- }
124
-
125
- return result;
126
- };
@@ -7,6 +7,7 @@
7
7
 
8
8
  const memoize = require("./memoize");
9
9
 
10
+ /** @typedef {import("schema-utils").Schema} Schema */
10
11
  /** @typedef {import("schema-utils/declarations/validate").ValidationErrorConfiguration} ValidationErrorConfiguration */
11
12
  /** @typedef {import("./fs").JsonObject} JsonObject */
12
13
 
@@ -15,7 +16,7 @@ const getValidate = memoize(() => require("schema-utils").validate);
15
16
  /**
16
17
  * @template {object | object[]} T
17
18
  * @param {((value: T) => boolean) | undefined} check check
18
- * @param {() => JsonObject} getSchema get schema fn
19
+ * @param {() => Schema} getSchema get schema fn
19
20
  * @param {ValidationErrorConfiguration} options options
20
21
  * @returns {(value?: T) => void} validate
21
22
  */
@@ -48,8 +48,9 @@ class BulkUpdateDecorator extends Hash {
48
48
  typeof data !== "string" ||
49
49
  data.length > BULK_SIZE
50
50
  ) {
51
- if (this.hash === undefined)
51
+ if (this.hash === undefined) {
52
52
  this.hash = /** @type {HashFactory} */ (this.hashFactory)();
53
+ }
53
54
  if (this.buffer.length > 0) {
54
55
  this.hash.update(this.buffer);
55
56
  this.buffer = "";
@@ -58,8 +59,9 @@ class BulkUpdateDecorator extends Hash {
58
59
  } else {
59
60
  this.buffer += data;
60
61
  if (this.buffer.length > BULK_SIZE) {
61
- if (this.hash === undefined)
62
+ if (this.hash === undefined) {
62
63
  this.hash = /** @type {HashFactory} */ (this.hashFactory)();
64
+ }
63
65
  this.hash.update(this.buffer);
64
66
  this.buffer = "";
65
67
  }
@@ -113,13 +115,17 @@ class DebugHash extends Hash {
113
115
  * @returns {this} updated hash
114
116
  */
115
117
  update(data, inputEncoding) {
116
- if (typeof data !== "string") data = data.toString("utf-8");
118
+ if (typeof data !== "string") data = data.toString("utf8");
117
119
  const prefix = Buffer.from("@webpack-debug-digest@").toString("hex");
118
120
  if (data.startsWith(prefix)) {
119
121
  data = Buffer.from(data.slice(prefix.length), "hex").toString();
120
122
  }
121
123
  this.string += `[${data}](${
122
- /** @type {string} */ (new Error().stack).split("\n", 3)[2]
124
+ /** @type {string} */
125
+ (
126
+ // eslint-disable-next-line unicorn/error-message
127
+ new Error().stack
128
+ ).split("\n", 3)[2]
123
129
  })\n`;
124
130
  return this;
125
131
  }