webpack 5.93.0 → 5.95.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 (344) hide show
  1. package/README.md +8 -5
  2. package/bin/webpack.js +6 -7
  3. package/hot/log.js +1 -2
  4. package/hot/only-dev-server.js +1 -1
  5. package/hot/poll.js +1 -1
  6. package/hot/signal.js +1 -1
  7. package/lib/APIPlugin.js +4 -3
  8. package/lib/AbstractMethodError.js +10 -5
  9. package/lib/AutomaticPrefetchPlugin.js +1 -1
  10. package/lib/BannerPlugin.js +12 -6
  11. package/lib/Cache.js +8 -10
  12. package/lib/CacheFacade.js +3 -3
  13. package/lib/CaseSensitiveModulesWarning.js +5 -7
  14. package/lib/Chunk.js +14 -11
  15. package/lib/ChunkGraph.js +58 -36
  16. package/lib/ChunkGroup.js +2 -3
  17. package/lib/ChunkTemplate.js +43 -0
  18. package/lib/CleanPlugin.js +10 -11
  19. package/lib/CodeGenerationResults.js +6 -5
  20. package/lib/CommentCompilationWarning.js +0 -1
  21. package/lib/Compilation.js +223 -191
  22. package/lib/Compiler.js +81 -82
  23. package/lib/ConcatenationScope.js +3 -6
  24. package/lib/ConditionalInitFragment.js +6 -7
  25. package/lib/ConstPlugin.js +7 -15
  26. package/lib/ContextExclusionPlugin.js +3 -3
  27. package/lib/ContextModule.js +33 -20
  28. package/lib/ContextModuleFactory.js +89 -44
  29. package/lib/ContextReplacementPlugin.js +10 -9
  30. package/lib/DefinePlugin.js +75 -68
  31. package/lib/DelegatedModule.js +7 -3
  32. package/lib/DelegatedModuleFactoryPlugin.js +36 -22
  33. package/lib/DelegatedPlugin.js +4 -0
  34. package/lib/DependenciesBlock.js +0 -1
  35. package/lib/Dependency.js +10 -14
  36. package/lib/DllEntryPlugin.js +4 -2
  37. package/lib/DllModuleFactory.js +1 -0
  38. package/lib/DllPlugin.js +9 -7
  39. package/lib/DllReferencePlugin.js +30 -15
  40. package/lib/EntryPlugin.js +1 -3
  41. package/lib/EnvironmentPlugin.js +6 -2
  42. package/lib/ErrorHelpers.js +11 -12
  43. package/lib/EvalDevToolModulePlugin.js +10 -12
  44. package/lib/EvalSourceMapDevToolPlugin.js +15 -13
  45. package/lib/ExportsInfo.js +185 -120
  46. package/lib/ExternalModule.js +41 -15
  47. package/lib/ExternalModuleFactoryPlugin.js +23 -10
  48. package/lib/FileSystemInfo.js +791 -422
  49. package/lib/FlagAllModulesAsUsedPlugin.js +1 -1
  50. package/lib/FlagDependencyExportsPlugin.js +12 -11
  51. package/lib/FlagDependencyUsagePlugin.js +1 -1
  52. package/lib/Generator.js +2 -5
  53. package/lib/GraphHelpers.js +3 -2
  54. package/lib/HookWebpackError.js +8 -10
  55. package/lib/HotModuleReplacementPlugin.js +78 -64
  56. package/lib/IgnoreErrorModuleFactory.js +3 -3
  57. package/lib/IgnorePlugin.js +1 -3
  58. package/lib/IgnoreWarningsPlugin.js +6 -9
  59. package/lib/InitFragment.js +2 -3
  60. package/lib/LibManifestPlugin.js +4 -3
  61. package/lib/MainTemplate.js +72 -19
  62. package/lib/Module.js +25 -9
  63. package/lib/ModuleBuildError.js +4 -11
  64. package/lib/ModuleDependencyError.js +5 -5
  65. package/lib/ModuleDependencyWarning.js +5 -5
  66. package/lib/ModuleError.js +1 -5
  67. package/lib/ModuleFilenameHelpers.js +29 -46
  68. package/lib/ModuleGraph.js +7 -6
  69. package/lib/ModuleGraphConnection.js +6 -6
  70. package/lib/ModuleInfoHeaderPlugin.js +82 -30
  71. package/lib/ModuleParseError.js +8 -9
  72. package/lib/ModuleRestoreError.js +1 -1
  73. package/lib/ModuleStoreError.js +1 -1
  74. package/lib/ModuleTemplate.js +33 -1
  75. package/lib/ModuleTypeConstants.js +21 -22
  76. package/lib/ModuleWarning.js +1 -5
  77. package/lib/MultiCompiler.js +24 -26
  78. package/lib/MultiStats.js +73 -31
  79. package/lib/MultiWatching.js +1 -1
  80. package/lib/NormalModule.js +130 -69
  81. package/lib/NormalModuleFactory.js +53 -49
  82. package/lib/OptimizationStages.js +3 -3
  83. package/lib/ProgressPlugin.js +9 -9
  84. package/lib/ProvidePlugin.js +4 -4
  85. package/lib/RuntimeGlobals.js +71 -70
  86. package/lib/RuntimeModule.js +1 -1
  87. package/lib/RuntimePlugin.js +24 -12
  88. package/lib/RuntimeTemplate.js +40 -44
  89. package/lib/SizeFormatHelpers.js +2 -4
  90. package/lib/SourceMapDevToolPlugin.js +42 -34
  91. package/lib/Stats.js +5 -11
  92. package/lib/Template.js +18 -24
  93. package/lib/TemplatedPathPlugin.js +21 -13
  94. package/lib/WarnDeprecatedOptionPlugin.js +0 -1
  95. package/lib/WatchIgnorePlugin.js +26 -9
  96. package/lib/Watching.js +10 -5
  97. package/lib/WebpackOptionsApply.js +84 -62
  98. package/lib/asset/AssetGenerator.js +107 -42
  99. package/lib/asset/AssetModulesPlugin.js +29 -23
  100. package/lib/asset/AssetSourceGenerator.js +2 -7
  101. package/lib/async-modules/AwaitDependenciesInitFragment.js +6 -7
  102. package/lib/buildChunkGraph.js +93 -81
  103. package/lib/cache/IdleFileCachePlugin.js +4 -4
  104. package/lib/cache/MemoryWithGcCachePlugin.js +5 -5
  105. package/lib/cache/PackFileCacheStrategy.js +51 -50
  106. package/lib/cache/ResolverCachePlugin.js +6 -6
  107. package/lib/cache/mergeEtags.js +16 -21
  108. package/lib/cli.js +148 -104
  109. package/lib/config/browserslistTargetHandler.js +16 -13
  110. package/lib/config/defaults.js +32 -28
  111. package/lib/config/normalization.js +335 -344
  112. package/lib/config/target.js +42 -52
  113. package/lib/container/ContainerEntryModule.js +2 -2
  114. package/lib/container/ContainerPlugin.js +1 -1
  115. package/lib/container/RemoteRuntimeModule.js +11 -8
  116. package/lib/container/options.js +18 -4
  117. package/lib/css/CssExportsGenerator.js +26 -24
  118. package/lib/css/CssGenerator.js +9 -4
  119. package/lib/css/CssLoadingRuntimeModule.js +10 -10
  120. package/lib/css/CssModulesPlugin.js +127 -47
  121. package/lib/css/CssParser.js +20 -18
  122. package/lib/css/walkCssTokens.js +80 -95
  123. package/lib/debug/ProfilingPlugin.js +19 -20
  124. package/lib/dependencies/AMDDefineDependency.js +1 -1
  125. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +83 -47
  126. package/lib/dependencies/AMDRequireArrayDependency.js +9 -10
  127. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +22 -16
  128. package/lib/dependencies/AMDRuntimeModules.js +2 -2
  129. package/lib/dependencies/CommonJsDependencyHelpers.js +6 -2
  130. package/lib/dependencies/CommonJsExportRequireDependency.js +37 -41
  131. package/lib/dependencies/CommonJsExportsDependency.js +0 -1
  132. package/lib/dependencies/CommonJsExportsParserPlugin.js +19 -23
  133. package/lib/dependencies/CommonJsFullRequireDependency.js +1 -1
  134. package/lib/dependencies/CommonJsImportsParserPlugin.js +52 -61
  135. package/lib/dependencies/CommonJsSelfReferenceDependency.js +6 -8
  136. package/lib/dependencies/ConstDependency.js +1 -1
  137. package/lib/dependencies/ContextDependency.js +7 -2
  138. package/lib/dependencies/ContextDependencyHelpers.js +31 -34
  139. package/lib/dependencies/ContextElementDependency.js +35 -8
  140. package/lib/dependencies/CriticalDependencyWarning.js +1 -1
  141. package/lib/dependencies/CssExportDependency.js +7 -7
  142. package/lib/dependencies/CssImportDependency.js +0 -2
  143. package/lib/dependencies/CssLocalIdentifierDependency.js +3 -3
  144. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
  145. package/lib/dependencies/CssUrlDependency.js +4 -5
  146. package/lib/dependencies/DynamicExports.js +5 -5
  147. package/lib/dependencies/ExportsInfoDependency.js +1 -2
  148. package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -1
  149. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -5
  150. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +27 -16
  151. package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
  152. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +107 -64
  153. package/lib/dependencies/HarmonyExports.js +2 -2
  154. package/lib/dependencies/HarmonyImportDependency.js +2 -4
  155. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -4
  156. package/lib/dependencies/HarmonyImportSpecifierDependency.js +40 -15
  157. package/lib/dependencies/ImportDependency.js +1 -1
  158. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +5 -5
  159. package/lib/dependencies/ImportMetaPlugin.js +11 -13
  160. package/lib/dependencies/ImportParserPlugin.js +39 -44
  161. package/lib/dependencies/JsonExportsDependency.js +22 -18
  162. package/lib/dependencies/LoaderPlugin.js +47 -36
  163. package/lib/dependencies/LocalModule.js +1 -1
  164. package/lib/dependencies/LocalModulesHelpers.js +4 -4
  165. package/lib/dependencies/ModuleDecoratorDependency.js +1 -1
  166. package/lib/dependencies/ProvidedDependency.js +1 -1
  167. package/lib/dependencies/PureExpressionDependency.js +6 -6
  168. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  169. package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
  170. package/lib/dependencies/SystemPlugin.js +1 -1
  171. package/lib/dependencies/URLDependency.js +3 -3
  172. package/lib/dependencies/URLPlugin.js +66 -12
  173. package/lib/dependencies/WorkerPlugin.js +25 -24
  174. package/lib/dependencies/processExportInfo.js +3 -1
  175. package/lib/electron/ElectronTargetPlugin.js +1 -0
  176. package/lib/esm/ModuleChunkFormatPlugin.js +3 -3
  177. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -3
  178. package/lib/formatLocation.js +1 -2
  179. package/lib/hmr/HotModuleReplacement.runtime.js +4 -5
  180. package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -0
  181. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +9 -12
  182. package/lib/hmr/LazyCompilationPlugin.js +27 -12
  183. package/lib/hmr/lazyCompilationBackend.js +64 -40
  184. package/lib/ids/ChunkModuleIdRangePlugin.js +1 -3
  185. package/lib/ids/DeterministicChunkIdsPlugin.js +2 -4
  186. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
  187. package/lib/ids/HashedModuleIdsPlugin.js +5 -1
  188. package/lib/ids/IdHelpers.js +29 -39
  189. package/lib/ids/SyncModuleIdsPlugin.js +7 -2
  190. package/lib/index.js +1 -5
  191. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +5 -4
  192. package/lib/javascript/BasicEvaluatedExpression.js +4 -19
  193. package/lib/javascript/ChunkHelpers.js +1 -1
  194. package/lib/javascript/CommonJsChunkFormatPlugin.js +3 -2
  195. package/lib/javascript/EnableChunkLoadingPlugin.js +7 -6
  196. package/lib/javascript/JavascriptGenerator.js +23 -7
  197. package/lib/javascript/JavascriptModulesPlugin.js +133 -86
  198. package/lib/javascript/JavascriptParser.js +179 -200
  199. package/lib/javascript/JavascriptParserHelpers.js +20 -21
  200. package/lib/javascript/StartupHelpers.js +41 -13
  201. package/lib/json/JsonGenerator.js +7 -13
  202. package/lib/json/JsonModulesPlugin.js +1 -4
  203. package/lib/json/JsonParser.js +5 -3
  204. package/lib/library/AmdLibraryPlugin.js +12 -16
  205. package/lib/library/AssignLibraryPlugin.js +8 -10
  206. package/lib/library/EnableLibraryPlugin.js +15 -14
  207. package/lib/library/JsonpLibraryPlugin.js +2 -1
  208. package/lib/library/ModernModuleLibraryPlugin.js +8 -6
  209. package/lib/library/ModuleLibraryPlugin.js +2 -1
  210. package/lib/library/SystemLibraryPlugin.js +2 -1
  211. package/lib/library/UmdLibraryPlugin.js +66 -92
  212. package/lib/logging/Logger.js +32 -4
  213. package/lib/logging/createConsoleLogger.js +12 -13
  214. package/lib/logging/runtime.js +7 -8
  215. package/lib/logging/truncateArgs.js +5 -8
  216. package/lib/node/NodeWatchFileSystem.js +3 -18
  217. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
  218. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -0
  219. package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -2
  220. package/lib/node/nodeConsole.js +22 -22
  221. package/lib/optimize/AggressiveMergingPlugin.js +2 -4
  222. package/lib/optimize/AggressiveSplittingPlugin.js +16 -19
  223. package/lib/optimize/ConcatenatedModule.js +81 -51
  224. package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
  225. package/lib/optimize/FlagIncludedChunksPlugin.js +3 -3
  226. package/lib/optimize/InnerGraph.js +17 -17
  227. package/lib/optimize/InnerGraphPlugin.js +8 -7
  228. package/lib/optimize/LimitChunkCountPlugin.js +2 -3
  229. package/lib/optimize/MangleExportsPlugin.js +1 -0
  230. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
  231. package/lib/optimize/MinMaxSizeWarning.js +1 -1
  232. package/lib/optimize/ModuleConcatenationPlugin.js +54 -78
  233. package/lib/optimize/RealContentHashPlugin.js +7 -10
  234. package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
  235. package/lib/optimize/SideEffectsFlagPlugin.js +6 -2
  236. package/lib/optimize/SplitChunksPlugin.js +34 -30
  237. package/lib/performance/SizeLimitsPlugin.js +2 -2
  238. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -1
  239. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -1
  240. package/lib/rules/BasicEffectRulePlugin.js +3 -1
  241. package/lib/rules/BasicMatcherRulePlugin.js +3 -1
  242. package/lib/rules/ObjectMatcherRulePlugin.js +4 -1
  243. package/lib/rules/RuleSetCompiler.js +41 -22
  244. package/lib/rules/UseEffectRulePlugin.js +36 -32
  245. package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
  246. package/lib/runtime/AutoPublicPathRuntimeModule.js +8 -3
  247. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +2 -2
  248. package/lib/runtime/DefinePropertyGettersRuntimeModule.js +1 -1
  249. package/lib/runtime/EnsureChunkRuntimeModule.js +10 -11
  250. package/lib/runtime/GetChunkFilenameRuntimeModule.js +11 -17
  251. package/lib/runtime/LoadScriptRuntimeModule.js +17 -18
  252. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -3
  253. package/lib/schemes/DataUriPlugin.js +1 -1
  254. package/lib/schemes/HttpUriPlugin.js +241 -126
  255. package/lib/serialization/BinaryMiddleware.js +44 -28
  256. package/lib/serialization/DateObjectSerializer.js +1 -0
  257. package/lib/serialization/ErrorObjectSerializer.js +2 -0
  258. package/lib/serialization/FileMiddleware.js +154 -106
  259. package/lib/serialization/MapObjectSerializer.js +2 -1
  260. package/lib/serialization/NullPrototypeObjectSerializer.js +3 -2
  261. package/lib/serialization/ObjectMiddleware.js +52 -56
  262. package/lib/serialization/PlainObjectSerializer.js +32 -6
  263. package/lib/serialization/RegExpObjectSerializer.js +1 -0
  264. package/lib/serialization/Serializer.js +4 -5
  265. package/lib/serialization/SerializerMiddleware.js +6 -6
  266. package/lib/serialization/SetObjectSerializer.js +2 -1
  267. package/lib/sharing/ConsumeSharedPlugin.js +116 -97
  268. package/lib/sharing/ConsumeSharedRuntimeModule.js +4 -4
  269. package/lib/sharing/ProvideForSharedDependency.js +0 -1
  270. package/lib/sharing/ProvideSharedPlugin.js +2 -2
  271. package/lib/sharing/resolveMatchedConfigs.js +2 -1
  272. package/lib/sharing/utils.js +15 -27
  273. package/lib/stats/DefaultStatsFactoryPlugin.js +424 -281
  274. package/lib/stats/DefaultStatsPresetPlugin.js +73 -18
  275. package/lib/stats/DefaultStatsPrinterPlugin.js +370 -101
  276. package/lib/stats/StatsFactory.js +127 -56
  277. package/lib/stats/StatsPrinter.js +75 -44
  278. package/lib/util/ArrayHelpers.js +8 -4
  279. package/lib/util/ArrayQueue.js +1 -1
  280. package/lib/util/AsyncQueue.js +31 -12
  281. package/lib/util/IterableHelpers.js +3 -4
  282. package/lib/util/LazyBucketSortedSet.js +60 -44
  283. package/lib/util/LazySet.js +13 -0
  284. package/lib/util/MapHelpers.js +1 -3
  285. package/lib/util/ParallelismFactorCalculator.js +1 -1
  286. package/lib/util/Queue.js +1 -1
  287. package/lib/util/Semaphore.js +4 -7
  288. package/lib/util/SetHelpers.js +5 -5
  289. package/lib/util/SortableSet.js +4 -3
  290. package/lib/util/StackedCacheMap.js +4 -6
  291. package/lib/util/StackedMap.js +1 -3
  292. package/lib/util/StringXor.js +0 -5
  293. package/lib/util/TupleQueue.js +1 -1
  294. package/lib/util/TupleSet.js +15 -5
  295. package/lib/util/URLAbsoluteSpecifier.js +7 -7
  296. package/lib/util/WeakTupleMap.js +19 -21
  297. package/lib/util/binarySearchBounds.js +5 -12
  298. package/lib/util/chainedImports.js +1 -1
  299. package/lib/util/cleverMerge.js +21 -19
  300. package/lib/util/comparators.js +57 -52
  301. package/lib/util/compileBooleanMatcher.js +3 -6
  302. package/lib/util/conventions.js +8 -11
  303. package/lib/util/createHash.js +9 -6
  304. package/lib/util/deprecation.js +22 -12
  305. package/lib/util/deterministicGrouping.js +19 -26
  306. package/lib/util/findGraphRoots.js +2 -2
  307. package/lib/util/fs.js +32 -32
  308. package/lib/util/hash/md4.js +2 -2
  309. package/lib/util/hash/wasm-hash.js +7 -7
  310. package/lib/util/hash/xxhash64.js +2 -2
  311. package/lib/util/identifier.js +81 -59
  312. package/lib/util/memoize.js +8 -10
  313. package/lib/util/mergeScope.js +6 -9
  314. package/lib/util/nonNumericOnlyHash.js +2 -2
  315. package/lib/util/numberHash.js +1 -6
  316. package/lib/util/objectToMap.js +0 -1
  317. package/lib/util/propertyAccess.js +2 -5
  318. package/lib/util/propertyName.js +1 -3
  319. package/lib/util/registerExternalSerializer.js +1 -1
  320. package/lib/util/runtime.js +109 -113
  321. package/lib/util/semver.js +29 -27
  322. package/lib/util/serialization.js +16 -1
  323. package/lib/util/smartGrouping.js +5 -5
  324. package/lib/util/source.js +1 -1
  325. package/lib/wasm/EnableWasmLoadingPlugin.js +5 -4
  326. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
  327. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -6
  328. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
  329. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +20 -19
  330. package/lib/wasm-sync/WebAssemblyGenerator.js +14 -29
  331. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
  332. package/lib/wasm-sync/WebAssemblyUtils.js +2 -2
  333. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -3
  334. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -1
  335. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  336. package/package.json +18 -17
  337. package/schemas/WebpackOptions.check.js +1 -1
  338. package/schemas/WebpackOptions.json +5 -0
  339. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  340. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  341. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  342. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  343. package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
  344. package/types.d.ts +681 -355
@@ -38,6 +38,7 @@ const { getEntryRuntime, mergeRuntime } = require("./util/runtime");
38
38
  * @typedef {object} ChunkGroupInfo
39
39
  * @property {ChunkGroup} chunkGroup the chunk group
40
40
  * @property {RuntimeSpec} runtime the runtimes
41
+ * @property {boolean} initialized is this chunk group initialized
41
42
  * @property {bigint | undefined} minAvailableModules current minimal set of modules available at this point
42
43
  * @property {bigint[]} availableModulesToBeMerged enqueued updates to the minimal set of available modules
43
44
  * @property {Set<Module>=} skippedItems modules that were skipped because module is already available in parent chunks (need to reconsider when minAvailableModules is shrinking)
@@ -209,7 +210,7 @@ const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => {
209
210
  const merged = /** @type {ConnectionState} */ (modules[idx]);
210
211
  /** @type {ModuleGraphConnection[]} */
211
212
  (/** @type {unknown} */ (modules[idx + 1])).push(connection);
212
- if (merged === true) continue outer;
213
+ if (merged === true) continue;
213
214
  modules[idx] = ModuleGraphConnection.addConnectionStates(
214
215
  merged,
215
216
  state
@@ -234,7 +235,6 @@ const extractBlockModules = (module, moduleGraph, runtime, blockModulesMap) => {
234
235
  };
235
236
 
236
237
  /**
237
- *
238
238
  * @param {Logger} logger a logger
239
239
  * @param {Compilation} compilation the compilation
240
240
  * @param {InputEntrypointsAndModules} inputEntrypointsAndModules chunk groups which are processed with the modules
@@ -286,7 +286,6 @@ const visitModules = (
286
286
  }
287
287
 
288
288
  /**
289
- *
290
289
  * @param {DependenciesBlock} block block
291
290
  * @param {RuntimeSpec} runtime runtime
292
291
  * @returns {BlockModulesInFlattenTuples} block modules in flatten tuples
@@ -316,15 +315,14 @@ const visitModules = (
316
315
  for (const [block, blockModules] of map)
317
316
  blockModulesMap.set(block, blockModules);
318
317
  return map.get(block);
319
- } else {
320
- logger.time("visitModules: prepare");
321
- extractBlockModules(module, moduleGraph, runtime, blockModulesMap);
322
- blockModules =
323
- /** @type {BlockModulesInFlattenTuples} */
324
- (blockModulesMap.get(block));
325
- logger.timeAggregate("visitModules: prepare");
326
- return blockModules;
327
318
  }
319
+ logger.time("visitModules: prepare");
320
+ extractBlockModules(module, moduleGraph, runtime, blockModulesMap);
321
+ blockModules =
322
+ /** @type {BlockModulesInFlattenTuples} */
323
+ (blockModulesMap.get(block));
324
+ logger.timeAggregate("visitModules: prepare");
325
+ return blockModules;
328
326
  };
329
327
 
330
328
  let statProcessedQueueItems = 0;
@@ -332,12 +330,12 @@ const visitModules = (
332
330
  let statConnectedChunkGroups = 0;
333
331
  let statProcessedChunkGroupsForMerging = 0;
334
332
  let statMergedAvailableModuleSets = 0;
335
- let statForkedAvailableModules = 0;
336
- let statForkedAvailableModulesCount = 0;
337
- let statForkedAvailableModulesCountPlus = 0;
338
- let statForkedMergedModulesCount = 0;
339
- let statForkedMergedModulesCountPlus = 0;
340
- let statForkedResultModulesCount = 0;
333
+ const statForkedAvailableModules = 0;
334
+ const statForkedAvailableModulesCount = 0;
335
+ const statForkedAvailableModulesCountPlus = 0;
336
+ const statForkedMergedModulesCount = 0;
337
+ const statForkedMergedModulesCountPlus = 0;
338
+ const statForkedResultModulesCount = 0;
341
339
  let statChunkGroupInfoUpdated = 0;
342
340
  let statChildChunkGroupsReconnected = 0;
343
341
 
@@ -348,8 +346,8 @@ const visitModules = (
348
346
  /** @type {Map<DependenciesBlock, ChunkGroupInfo>} */
349
347
  const blockChunkGroups = new Map();
350
348
 
351
- /** @type {Map<ChunkGroupInfo, DependenciesBlock>} */
352
- const blockByChunkGroups = new Map();
349
+ /** @type {Map<ChunkGroupInfo, Set<DependenciesBlock>>} */
350
+ const blocksByChunkGroups = new Map();
353
351
 
354
352
  /** @type {Map<string, ChunkGroupInfo>} */
355
353
  const namedChunkGroups = new Map();
@@ -370,7 +368,7 @@ const visitModules = (
370
368
  /** @type {QueueItem[]} */
371
369
  let queue = [];
372
370
 
373
- /** @type {Map<ChunkGroupInfo, Set<ChunkGroupInfo>>} */
371
+ /** @type {Map<ChunkGroupInfo, Set<[ChunkGroupInfo, QueueItem | null]>>} */
374
372
  const queueConnect = new Map();
375
373
  /** @type {Set<ChunkGroupInfo>} */
376
374
  const chunkGroupsForCombining = new Set();
@@ -385,6 +383,7 @@ const visitModules = (
385
383
  );
386
384
  /** @type {ChunkGroupInfo} */
387
385
  const chunkGroupInfo = {
386
+ initialized: false,
388
387
  chunkGroup,
389
388
  runtime,
390
389
  minAvailableModules: undefined,
@@ -455,7 +454,7 @@ const visitModules = (
455
454
 
456
455
  /** @type {Set<ChunkGroupInfo>} */
457
456
  const outdatedChunkGroupInfo = new Set();
458
- /** @type {Set<ChunkGroupInfo>} */
457
+ /** @type {Set<[ChunkGroupInfo, QueueItem]>} */
459
458
  const chunkGroupsForMerging = new Set();
460
459
  /** @type {QueueItem[]} */
461
460
  let queueDelayed = [];
@@ -508,6 +507,7 @@ const visitModules = (
508
507
  entrypoint.index = nextChunkGroupIndex++;
509
508
  cgi = {
510
509
  chunkGroup: entrypoint,
510
+ initialized: false,
511
511
  runtime: entrypoint.options.runtime || entrypoint.name,
512
512
  minAvailableModules: ZERO_BIGINT,
513
513
  availableModulesToBeMerged: [],
@@ -575,6 +575,7 @@ const visitModules = (
575
575
  maskByChunk.set(c.chunks[0], ZERO_BIGINT);
576
576
  c.index = nextChunkGroupIndex++;
577
577
  cgi = {
578
+ initialized: false,
578
579
  chunkGroup: c,
579
580
  runtime: chunkGroupInfo.runtime,
580
581
  minAvailableModules: undefined,
@@ -617,7 +618,6 @@ const visitModules = (
617
618
  blockConnections.set(b, []);
618
619
  }
619
620
  blockChunkGroups.set(b, /** @type {ChunkGroupInfo} */ (cgi));
620
- blockByChunkGroups.set(/** @type {ChunkGroupInfo} */ (cgi), b);
621
621
  } else if (entryOptions) {
622
622
  entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup);
623
623
  } else {
@@ -639,19 +639,17 @@ const visitModules = (
639
639
  connectList = new Set();
640
640
  queueConnect.set(chunkGroupInfo, connectList);
641
641
  }
642
- connectList.add(/** @type {ChunkGroupInfo} */ (cgi));
643
-
644
- // TODO check if this really need to be done for each traversal
645
- // or if it is enough when it's queued when created
646
- // 4. We enqueue the DependenciesBlock for traversal
647
- queueDelayed.push({
648
- action: PROCESS_BLOCK,
649
- block: b,
650
- module,
651
- chunk: c.chunks[0],
652
- chunkGroup: c,
653
- chunkGroupInfo: /** @type {ChunkGroupInfo} */ (cgi)
654
- });
642
+ connectList.add([
643
+ cgi,
644
+ {
645
+ action: PROCESS_BLOCK,
646
+ block: b,
647
+ module,
648
+ chunk: c.chunks[0],
649
+ chunkGroup: c,
650
+ chunkGroupInfo: /** @type {ChunkGroupInfo} */ (cgi)
651
+ }
652
+ ]);
655
653
  } else if (entrypoint !== undefined) {
656
654
  chunkGroupInfo.chunkGroup.addAsyncEntrypoint(entrypoint);
657
655
  }
@@ -904,11 +902,10 @@ const visitModules = (
904
902
  for (const [chunkGroupInfo, targets] of queueConnect) {
905
903
  // 1. Add new targets to the list of children
906
904
  if (chunkGroupInfo.children === undefined) {
907
- chunkGroupInfo.children = targets;
908
- } else {
909
- for (const target of targets) {
910
- chunkGroupInfo.children.add(target);
911
- }
905
+ chunkGroupInfo.children = new Set();
906
+ }
907
+ for (const [target] of targets) {
908
+ chunkGroupInfo.children.add(target);
912
909
  }
913
910
 
914
911
  // 2. Calculate resulting available modules
@@ -918,9 +915,9 @@ const visitModules = (
918
915
  const runtime = chunkGroupInfo.runtime;
919
916
 
920
917
  // 3. Update chunk group info
921
- for (const target of targets) {
918
+ for (const [target, processBlock] of targets) {
922
919
  target.availableModulesToBeMerged.push(resultingAvailableModules);
923
- chunkGroupsForMerging.add(target);
920
+ chunkGroupsForMerging.add([target, processBlock]);
924
921
  const oldRuntime = target.runtime;
925
922
  const newRuntime = mergeRuntime(oldRuntime, runtime);
926
923
  if (oldRuntime !== newRuntime) {
@@ -938,7 +935,7 @@ const visitModules = (
938
935
  statProcessedChunkGroupsForMerging += chunkGroupsForMerging.size;
939
936
 
940
937
  // Execute the merge
941
- for (const info of chunkGroupsForMerging) {
938
+ for (const [info, processBlock] of chunkGroupsForMerging) {
942
939
  const availableModulesToBeMerged = info.availableModulesToBeMerged;
943
940
  const cachedMinAvailableModules = info.minAvailableModules;
944
941
  let minAvailableModules = cachedMinAvailableModules;
@@ -961,6 +958,27 @@ const visitModules = (
961
958
  info.resultingAvailableModules = undefined;
962
959
  outdatedChunkGroupInfo.add(info);
963
960
  }
961
+
962
+ if (processBlock) {
963
+ let blocks = blocksByChunkGroups.get(info);
964
+ if (!blocks) {
965
+ blocksByChunkGroups.set(info, (blocks = new Set()));
966
+ }
967
+
968
+ // Whether to walk block depends on minAvailableModules and input block.
969
+ // We can treat creating chunk group as a function with 2 input, entry block and minAvailableModules
970
+ // If input is the same, we can skip re-walk
971
+ let needWalkBlock = !info.initialized || changed;
972
+ if (!blocks.has(processBlock.block)) {
973
+ needWalkBlock = true;
974
+ blocks.add(processBlock.block);
975
+ }
976
+
977
+ if (needWalkBlock) {
978
+ info.initialized = true;
979
+ queueDelayed.push(processBlock);
980
+ }
981
+ }
964
982
  }
965
983
  chunkGroupsForMerging.clear();
966
984
  };
@@ -1060,7 +1078,7 @@ const visitModules = (
1060
1078
  connectList = new Set();
1061
1079
  queueConnect.set(info, connectList);
1062
1080
  }
1063
- connectList.add(cgi);
1081
+ connectList.add([cgi, null]);
1064
1082
  }
1065
1083
  }
1066
1084
 
@@ -1120,48 +1138,44 @@ const visitModules = (
1120
1138
  for (const info of outdatedOrderIndexChunkGroups) {
1121
1139
  const { chunkGroup, runtime } = info;
1122
1140
 
1123
- const block = blockByChunkGroups.get(info);
1141
+ const blocks = blocksByChunkGroups.get(info);
1124
1142
 
1125
- if (!block) {
1143
+ if (!blocks) {
1126
1144
  continue;
1127
1145
  }
1128
1146
 
1129
- let preOrderIndex = 0;
1130
- let postOrderIndex = 0;
1131
-
1132
- /**
1133
- * @param {DependenciesBlock} current current
1134
- * @param {BlocksWithNestedBlocks} visited visited dependencies blocks
1135
- */
1136
- const process = (current, visited) => {
1137
- const blockModules = getBlockModules(current, runtime);
1138
- if (blockModules === undefined) {
1139
- return;
1140
- }
1141
-
1142
- for (let i = 0, len = blockModules.length; i < len; i += 3) {
1143
- const activeState = /** @type {ConnectionState} */ (
1144
- blockModules[i + 1]
1145
- );
1146
- if (activeState === false) {
1147
- continue;
1148
- }
1149
- const refModule = /** @type {Module} */ (blockModules[i]);
1150
- if (visited.has(refModule)) {
1151
- continue;
1152
- }
1147
+ for (const block of blocks) {
1148
+ let preOrderIndex = 0;
1149
+ let postOrderIndex = 0;
1150
+ /**
1151
+ * @param {DependenciesBlock} current current
1152
+ * @param {BlocksWithNestedBlocks} visited visited dependencies blocks
1153
+ */
1154
+ const process = (current, visited) => {
1155
+ const blockModules = getBlockModules(current, runtime);
1156
+ for (let i = 0, len = blockModules.length; i < len; i += 3) {
1157
+ const activeState = /** @type {ConnectionState} */ (
1158
+ blockModules[i + 1]
1159
+ );
1160
+ if (activeState === false) {
1161
+ continue;
1162
+ }
1163
+ const refModule = /** @type {Module} */ (blockModules[i]);
1164
+ if (visited.has(refModule)) {
1165
+ continue;
1166
+ }
1153
1167
 
1154
- visited.add(refModule);
1168
+ visited.add(refModule);
1155
1169
 
1156
- if (refModule) {
1157
- chunkGroup.setModulePreOrderIndex(refModule, preOrderIndex++);
1158
- process(refModule, visited);
1159
- chunkGroup.setModulePostOrderIndex(refModule, postOrderIndex++);
1170
+ if (refModule) {
1171
+ chunkGroup.setModulePreOrderIndex(refModule, preOrderIndex++);
1172
+ process(refModule, visited);
1173
+ chunkGroup.setModulePostOrderIndex(refModule, postOrderIndex++);
1174
+ }
1160
1175
  }
1161
- }
1162
- };
1163
-
1164
- process(block, new Set());
1176
+ };
1177
+ process(block, new Set());
1178
+ }
1165
1179
  }
1166
1180
  outdatedOrderIndexChunkGroups.clear();
1167
1181
  ordinalByModule.clear();
@@ -1179,7 +1193,6 @@ const visitModules = (
1179
1193
  };
1180
1194
 
1181
1195
  /**
1182
- *
1183
1196
  * @param {Compilation} compilation the compilation
1184
1197
  * @param {BlocksWithNestedBlocks} blocksWithNestedBlocks flag for blocks that have nested blocks
1185
1198
  * @param {BlockConnections} blockConnections connection for blocks
@@ -1195,7 +1208,6 @@ const connectChunkGroups = (
1195
1208
 
1196
1209
  /**
1197
1210
  * Helper function to check if all modules of a chunk are available
1198
- *
1199
1211
  * @param {ChunkGroup} chunkGroup the chunkGroup to scan
1200
1212
  * @param {bigint} availableModules the comparator set
1201
1213
  * @returns {boolean} return true if all modules of a chunk are available
@@ -11,7 +11,7 @@ const ProgressPlugin = require("../ProgressPlugin");
11
11
  /** @typedef {import("../Compiler")} Compiler */
12
12
  /** @typedef {import("./PackFileCacheStrategy")} PackFileCacheStrategy */
13
13
 
14
- const BUILD_DEPENDENCIES_KEY = Symbol();
14
+ const BUILD_DEPENDENCIES_KEY = Symbol("build dependencies key");
15
15
 
16
16
  class IdleFileCachePlugin {
17
17
  /**
@@ -38,7 +38,7 @@ class IdleFileCachePlugin {
38
38
  * @returns {void}
39
39
  */
40
40
  apply(compiler) {
41
- let strategy = this.strategy;
41
+ const strategy = this.strategy;
42
42
  const idleTimeout = this.idleTimeout;
43
43
  const idleTimeoutForInitialStore = Math.min(
44
44
  idleTimeout,
@@ -119,7 +119,7 @@ class IdleFileCachePlugin {
119
119
  currentIdlePromise = promise.then(() => strategy.afterAllStored());
120
120
  if (reportProgress) {
121
121
  currentIdlePromise = currentIdlePromise.then(() => {
122
- reportProgress(1, `stored`);
122
+ reportProgress(1, "stored");
123
123
  });
124
124
  }
125
125
  return currentIdlePromise.then(() => {
@@ -175,7 +175,7 @@ class IdleFileCachePlugin {
175
175
  }
176
176
  };
177
177
  /** @type {ReturnType<typeof setTimeout> | undefined} */
178
- let idleTimer = undefined;
178
+ let idleTimer;
179
179
  compiler.cache.hooks.beginIdle.tap(
180
180
  { name: "IdleFileCachePlugin", stage: Cache.STAGE_DISK },
181
181
  () => {
@@ -20,6 +20,7 @@ class MemoryWithGcCachePlugin {
20
20
  constructor({ maxGenerations }) {
21
21
  this._maxGenerations = maxGenerations;
22
22
  }
23
+
23
24
  /**
24
25
  * Apply the plugin
25
26
  * @param {Compiler} compiler the compiler instance
@@ -106,12 +107,11 @@ class MemoryWithGcCachePlugin {
106
107
  oldCache.delete(identifier);
107
108
  cache.set(identifier, cacheEntry);
108
109
  return null;
109
- } else {
110
- if (cacheEntry.etag !== etag) return null;
111
- oldCache.delete(identifier);
112
- cache.set(identifier, cacheEntry);
113
- return cacheEntry.data;
114
110
  }
111
+ if (cacheEntry.etag !== etag) return null;
112
+ oldCache.delete(identifier);
113
+ cache.set(identifier, cacheEntry);
114
+ return cacheEntry.data;
115
115
  }
116
116
  gotHandlers.push((result, callback) => {
117
117
  if (result === undefined) {
@@ -160,19 +160,18 @@ class Pack {
160
160
  const info = this.itemInfo.get(identifier);
161
161
  this._addRequest(identifier);
162
162
  if (info === undefined) {
163
- return undefined;
163
+ return;
164
164
  }
165
165
  if (info.etag !== etag) return null;
166
166
  info.lastAccess = Date.now();
167
167
  const loc = info.location;
168
168
  if (loc === -1) {
169
169
  return info.freshValue;
170
- } else {
171
- if (!this.content[loc]) {
172
- return undefined;
173
- }
174
- return /** @type {PackContent} */ (this.content[loc]).get(identifier);
175
170
  }
171
+ if (!this.content[loc]) {
172
+ return;
173
+ }
174
+ return /** @type {PackContent} */ (this.content[loc]).get(identifier);
176
175
  }
177
176
 
178
177
  /**
@@ -528,7 +527,7 @@ class Pack {
528
527
  */
529
528
  _gcOldestContent() {
530
529
  /** @type {PackItemInfo | undefined} */
531
- let oldest = undefined;
530
+ let oldest;
532
531
  for (const info of this.itemInfo.values()) {
533
532
  if (oldest === undefined || info.lastAccess < oldest.lastAccess) {
534
533
  oldest = info;
@@ -677,16 +676,16 @@ class PackContentItems {
677
676
  logger.log(`Serialization of '${key}': ${duration} ms`);
678
677
  else logger.debug(`Serialization of '${key}': ${duration} ms`);
679
678
  }
680
- } catch (e) {
679
+ } catch (err) {
681
680
  rollback(s);
682
- if (e === NOT_SERIALIZABLE) continue;
681
+ if (err === NOT_SERIALIZABLE) continue;
683
682
  const msg = "Skipped not serializable cache item";
684
- if (e.message.includes("ModuleBuildError")) {
685
- logger.log(`${msg} (in build error): ${e.message}`);
686
- logger.debug(`${msg} '${key}' (in build error): ${e.stack}`);
683
+ if (err.message.includes("ModuleBuildError")) {
684
+ logger.log(`${msg} (in build error): ${err.message}`);
685
+ logger.debug(`${msg} '${key}' (in build error): ${err.stack}`);
687
686
  } else {
688
- logger.warn(`${msg}: ${e.message}`);
689
- logger.debug(`${msg} '${key}': ${e.stack}`);
687
+ logger.warn(`${msg}: ${err.message}`);
688
+ logger.debug(`${msg} '${key}': ${err.stack}`);
690
689
  }
691
690
  }
692
691
  }
@@ -698,7 +697,7 @@ class PackContentItems {
698
697
  try {
699
698
  write(true);
700
699
  write(this.map);
701
- } catch (e) {
700
+ } catch (_err) {
702
701
  rollback(s);
703
702
 
704
703
  // Try to serialize each item on it's own
@@ -708,13 +707,13 @@ class PackContentItems {
708
707
  try {
709
708
  write(key);
710
709
  write(value);
711
- } catch (e) {
710
+ } catch (err) {
712
711
  rollback(s);
713
- if (e === NOT_SERIALIZABLE) continue;
712
+ if (err === NOT_SERIALIZABLE) continue;
714
713
  logger.warn(
715
- `Skipped not serializable cache item '${key}': ${e.message}`
714
+ `Skipped not serializable cache item '${key}': ${err.message}`
716
715
  );
717
- logger.debug(e.stack);
716
+ logger.debug(err.stack);
718
717
  }
719
718
  }
720
719
  write(null);
@@ -817,6 +816,7 @@ class PackContent {
817
816
  return this.content.get(identifier);
818
817
  }
819
818
 
819
+ const logger = /** @type {Logger} */ (this.logger);
820
820
  // We are in state B
821
821
  const { lazyName } = this;
822
822
  /** @type {string | undefined} */
@@ -827,35 +827,35 @@ class PackContent {
827
827
  timeMessage = `restore cache content ${lazyName} (${formatSize(
828
828
  this.getSize()
829
829
  )})`;
830
- this.logger.log(
830
+ logger.log(
831
831
  `starting to restore cache content ${lazyName} (${formatSize(
832
832
  this.getSize()
833
833
  )}) because of request to: ${identifier}`
834
834
  );
835
- this.logger.time(timeMessage);
835
+ logger.time(timeMessage);
836
836
  }
837
837
  const value = this.lazy();
838
838
  if ("then" in value) {
839
839
  return value.then(data => {
840
840
  const map = data.map;
841
841
  if (timeMessage) {
842
- this.logger.timeEnd(timeMessage);
842
+ logger.timeEnd(timeMessage);
843
843
  }
844
844
  // Move to state C
845
845
  this.content = map;
846
846
  this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
847
847
  return map.get(identifier);
848
848
  });
849
- } else {
850
- const map = value.map;
851
- if (timeMessage) {
852
- this.logger.timeEnd(timeMessage);
853
- }
854
- // Move to state C
855
- this.content = map;
856
- this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
857
- return map.get(identifier);
858
849
  }
850
+
851
+ const map = value.map;
852
+ if (timeMessage) {
853
+ logger.timeEnd(timeMessage);
854
+ }
855
+ // Move to state C
856
+ this.content = map;
857
+ this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
858
+ return map.get(identifier);
859
859
  }
860
860
 
861
861
  /**
@@ -865,6 +865,7 @@ class PackContent {
865
865
  unpack(reason) {
866
866
  if (this.content) return;
867
867
 
868
+ const logger = /** @type {Logger} */ (this.logger);
868
869
  // Move from state B to C
869
870
  if (this.lazy) {
870
871
  const { lazyName } = this;
@@ -876,27 +877,26 @@ class PackContent {
876
877
  timeMessage = `unpack cache content ${lazyName} (${formatSize(
877
878
  this.getSize()
878
879
  )})`;
879
- this.logger.log(
880
+ logger.log(
880
881
  `starting to unpack cache content ${lazyName} (${formatSize(
881
882
  this.getSize()
882
883
  )}) because ${reason}`
883
884
  );
884
- this.logger.time(timeMessage);
885
+ logger.time(timeMessage);
885
886
  }
886
887
  const value = this.lazy();
887
888
  if ("then" in value) {
888
889
  return value.then(data => {
889
890
  if (timeMessage) {
890
- this.logger.timeEnd(timeMessage);
891
+ logger.timeEnd(timeMessage);
891
892
  }
892
893
  this.content = data.map;
893
894
  });
894
- } else {
895
- if (timeMessage) {
896
- this.logger.timeEnd(timeMessage);
897
- }
898
- this.content = value.map;
899
895
  }
896
+ if (timeMessage) {
897
+ logger.timeEnd(timeMessage);
898
+ }
899
+ this.content = value.map;
900
900
  }
901
901
  }
902
902
 
@@ -957,6 +957,7 @@ class PackContent {
957
957
  );
958
958
  return;
959
959
  }
960
+ const logger = /** @type {Logger} */ (this.logger);
960
961
  // State B2
961
962
  const { lazyName } = this;
962
963
  /** @type {string | undefined} */
@@ -967,12 +968,12 @@ class PackContent {
967
968
  timeMessage = `unpack cache content ${lazyName} (${formatSize(
968
969
  this.getSize()
969
970
  )})`;
970
- this.logger.log(
971
+ logger.log(
971
972
  `starting to unpack cache content ${lazyName} (${formatSize(
972
973
  this.getSize()
973
974
  )}) because it's outdated and need to be serialized`
974
975
  );
975
- this.logger.time(timeMessage);
976
+ logger.time(timeMessage);
976
977
  }
977
978
  const value = this.lazy();
978
979
  this.outdated = false;
@@ -981,7 +982,7 @@ class PackContent {
981
982
  this.lazy = write(() =>
982
983
  value.then(data => {
983
984
  if (timeMessage) {
984
- this.logger.timeEnd(timeMessage);
985
+ logger.timeEnd(timeMessage);
985
986
  }
986
987
  const oldMap = data.map;
987
988
  /** @type {Map<string, any>} */
@@ -999,7 +1000,7 @@ class PackContent {
999
1000
  } else {
1000
1001
  // Move to state C1
1001
1002
  if (timeMessage) {
1002
- this.logger.timeEnd(timeMessage);
1003
+ logger.timeEnd(timeMessage);
1003
1004
  }
1004
1005
  const oldMap = value.map;
1005
1006
  /** @type {Map<string, any>} */
@@ -1148,19 +1149,19 @@ class PackFileCacheStrategy {
1148
1149
  })
1149
1150
  .then(packContainer => {
1150
1151
  logger.timeEnd("restore cache container");
1151
- if (!packContainer) return undefined;
1152
+ if (!packContainer) return;
1152
1153
  if (!(packContainer instanceof PackContainer)) {
1153
1154
  logger.warn(
1154
1155
  `Restored pack from ${cacheLocation}${this._extension}, but contained content is unexpected.`,
1155
1156
  packContainer
1156
1157
  );
1157
- return undefined;
1158
+ return;
1158
1159
  }
1159
1160
  if (packContainer.version !== version) {
1160
1161
  logger.log(
1161
1162
  `Restored pack from ${cacheLocation}${this._extension}, but version doesn't match.`
1162
1163
  );
1163
- return undefined;
1164
+ return;
1164
1165
  }
1165
1166
  logger.time("check build dependencies");
1166
1167
  return Promise.all([
@@ -1321,7 +1322,7 @@ class PackFileCacheStrategy {
1321
1322
  pack.stopCapturingRequests();
1322
1323
  if (!pack.invalid) return;
1323
1324
  this.packPromise = undefined;
1324
- this.logger.log(`Storing pack...`);
1325
+ this.logger.log("Storing pack...");
1325
1326
  let promise;
1326
1327
  const newBuildDependencies = new Set();
1327
1328
  for (const dep of this.newBuildDependencies) {
@@ -1439,7 +1440,7 @@ class PackFileCacheStrategy {
1439
1440
  }
1440
1441
  return promise.then(() => {
1441
1442
  if (reportProgress) reportProgress(0.8, "serialize pack");
1442
- this.logger.time(`store pack`);
1443
+ this.logger.time("store pack");
1443
1444
  const updatedBuildDependencies = new Set(this.buildDependencies);
1444
1445
  for (const dep of newBuildDependencies) {
1445
1446
  updatedBuildDependencies.add(dep);
@@ -1464,7 +1465,7 @@ class PackFileCacheStrategy {
1464
1465
  this.buildDependencies.add(dep);
1465
1466
  }
1466
1467
  this.newBuildDependencies.clear();
1467
- this.logger.timeEnd(`store pack`);
1468
+ this.logger.timeEnd("store pack");
1468
1469
  const stats = pack.getContentStats();
1469
1470
  this.logger.log(
1470
1471
  "Stored pack (%d items, %d files, %d MiB)",
@@ -1474,7 +1475,7 @@ class PackFileCacheStrategy {
1474
1475
  );
1475
1476
  })
1476
1477
  .catch(err => {
1477
- this.logger.timeEnd(`store pack`);
1478
+ this.logger.timeEnd("store pack");
1478
1479
  this.logger.warn(`Caching failed for pack: ${err}`);
1479
1480
  this.logger.debug(err.stack);
1480
1481
  });
@@ -59,11 +59,10 @@ const objectToString = (object, excludeContext) => {
59
59
  for (const key in object) {
60
60
  if (excludeContext && key === "context") continue;
61
61
  const value = object[key];
62
- if (typeof value === "object" && value !== null) {
63
- str += `|${key}=[${objectToString(value, false)}|]`;
64
- } else {
65
- str += `|${key}=|${value}`;
66
- }
62
+ str +=
63
+ typeof value === "object" && value !== null
64
+ ? `|${key}=[${objectToString(value, false)}|]`
65
+ : `|${key}=|${value}`;
67
66
  }
68
67
  return str;
69
68
  };
@@ -241,7 +240,8 @@ class ResolverCachePlugin {
241
240
  }
242
241
  }
243
242
  const itemCache = cache.getItemCache(identifier, null);
244
- let callbacks, yields;
243
+ let callbacks;
244
+ let yields;
245
245
  const done = withYield
246
246
  ? (err, result) => {
247
247
  if (callbacks === undefined) {