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
@@ -159,8 +159,9 @@ class ExportsInfo {
159
159
  * @returns {ExportInfo} the export info of unlisted exports
160
160
  */
161
161
  get otherExportsInfo() {
162
- if (this._redirectTo !== undefined)
162
+ if (this._redirectTo !== undefined) {
163
163
  return this._redirectTo.otherExportsInfo;
164
+ }
164
165
  return this._otherExportsInfo;
165
166
  }
166
167
 
@@ -259,8 +260,9 @@ class ExportsInfo {
259
260
  getExportInfo(name) {
260
261
  const info = this._exports.get(name);
261
262
  if (info !== undefined) return info;
262
- if (this._redirectTo !== undefined)
263
+ if (this._redirectTo !== undefined) {
263
264
  return this._redirectTo.getExportInfo(name);
265
+ }
264
266
  const newInfo = new ExportInfo(name, this._otherExportsInfo);
265
267
  this._exports.set(name, newInfo);
266
268
  this._exportsAreOrdered = false;
@@ -274,8 +276,9 @@ class ExportsInfo {
274
276
  getReadOnlyExportInfo(name) {
275
277
  const info = this._exports.get(name);
276
278
  if (info !== undefined) return info;
277
- if (this._redirectTo !== undefined)
279
+ if (this._redirectTo !== undefined) {
278
280
  return this._redirectTo.getReadOnlyExportInfo(name);
281
+ }
279
282
  return this._otherExportsInfo;
280
283
  }
281
284
 
@@ -494,8 +497,9 @@ class ExportsInfo {
494
497
  */
495
498
  isModuleUsed(runtime) {
496
499
  if (this.isUsed(runtime)) return true;
497
- if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused)
500
+ if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused) {
498
501
  return true;
502
+ }
499
503
  return false;
500
504
  }
501
505
 
@@ -504,17 +508,15 @@ class ExportsInfo {
504
508
  * @returns {SortableSet<string> | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown)
505
509
  */
506
510
  getUsedExports(runtime) {
507
- // eslint-disable-next-line no-constant-binary-expression
508
- if (!this._redirectTo !== undefined) {
509
- switch (this._otherExportsInfo.getUsed(runtime)) {
510
- case UsageState.NoInfo:
511
- return null;
512
- case UsageState.Unknown:
513
- case UsageState.OnlyPropertiesUsed:
514
- case UsageState.Used:
515
- return true;
516
- }
511
+ switch (this._otherExportsInfo.getUsed(runtime)) {
512
+ case UsageState.NoInfo:
513
+ return null;
514
+ case UsageState.Unknown:
515
+ case UsageState.OnlyPropertiesUsed:
516
+ case UsageState.Used:
517
+ return true;
517
518
  }
519
+
518
520
  const array = [];
519
521
  if (!this._exportsAreOrdered) this._sortExports();
520
522
  for (const exportInfo of this._exports.values()) {
@@ -553,17 +555,15 @@ class ExportsInfo {
553
555
  * @returns {null | true | string[]} list of exports when known
554
556
  */
555
557
  getProvidedExports() {
556
- // eslint-disable-next-line no-constant-binary-expression
557
- if (!this._redirectTo !== undefined) {
558
- switch (this._otherExportsInfo.provided) {
559
- case undefined:
560
- return null;
561
- case null:
562
- return true;
563
- case true:
564
- return true;
565
- }
558
+ switch (this._otherExportsInfo.provided) {
559
+ case undefined:
560
+ return null;
561
+ case null:
562
+ return true;
563
+ case true:
564
+ return true;
566
565
  }
566
+
567
567
  /** @type {string[]} */
568
568
  const array = [];
569
569
  if (!this._exportsAreOrdered) this._sortExports();
@@ -671,8 +671,9 @@ class ExportsInfo {
671
671
  return false;
672
672
  }
673
673
  for (const exportInfo of this.ownedExports) {
674
- if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB))
674
+ if (exportInfo.getUsed(runtimeA) !== exportInfo.getUsed(runtimeB)) {
675
675
  return false;
676
+ }
676
677
  }
677
678
  return true;
678
679
  }
@@ -722,9 +723,9 @@ class ExportsInfo {
722
723
  ) {
723
724
  const nested = info.exportsInfo.getUsedName(name.slice(1), runtime);
724
725
  if (!nested) return false;
725
- return arr.concat(nested);
726
+ return [...arr, ...(Array.isArray(nested) ? nested : [nested])];
726
727
  }
727
- return arr.concat(name.slice(1));
728
+ return [...arr, ...name.slice(1)];
728
729
  }
729
730
  const info = this.getReadOnlyExportInfo(name);
730
731
  const usedName = info.getUsedName(name, runtime);
@@ -832,7 +833,7 @@ class ExportsInfo {
832
833
 
833
834
  /** @typedef {Map<string, RuntimeUsageStateType>} UsedInRuntime */
834
835
 
835
- /** @typedef {{ module: Module, export: string[] }} TargetItemWithoutConnection */
836
+ /** @typedef {{ module: Module, export: string[], deferred: boolean }} TargetItemWithoutConnection */
836
837
 
837
838
  /** @typedef {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }} TargetItemWithConnection */
838
839
 
@@ -1245,7 +1246,7 @@ class ExportInfo {
1245
1246
  }
1246
1247
  } else if (
1247
1248
  runtime !== undefined &&
1248
- Array.from(runtime).every(
1249
+ [...runtime].every(
1249
1250
  runtime =>
1250
1251
  !(/** @type {UsedInRuntime} */ (this._usedInRuntime).has(runtime))
1251
1252
  )
@@ -1294,8 +1295,9 @@ class ExportInfo {
1294
1295
 
1295
1296
  _getMaxTarget() {
1296
1297
  if (this._maxTarget !== undefined) return this._maxTarget;
1297
- if (/** @type {Target} */ (this._target).size <= 1)
1298
+ if (/** @type {Target} */ (this._target).size <= 1) {
1298
1299
  return (this._maxTarget = this._target);
1300
+ }
1299
1301
  let maxPriority = -Infinity;
1300
1302
  let minPriority = Infinity;
1301
1303
  for (const { priority } of /** @type {Target} */ (this._target).values()) {
@@ -1341,7 +1343,10 @@ class ExportInfo {
1341
1343
  /** @type {TargetItemWithoutConnection} */
1342
1344
  let target = {
1343
1345
  module: rawTarget.connection.module,
1344
- export: rawTarget.export
1346
+ export: rawTarget.export,
1347
+ deferred: Boolean(
1348
+ rawTarget.connection.dependency && rawTarget.connection.dependency.defer
1349
+ )
1345
1350
  };
1346
1351
  for (;;) {
1347
1352
  if (validTargetModuleFilter(target.module)) return target;
@@ -1360,8 +1365,9 @@ class ExportInfo {
1360
1365
  target = {
1361
1366
  module: newTarget.module,
1362
1367
  export: newTarget.export
1363
- ? newTarget.export.concat(target.export.slice(1))
1364
- : target.export.slice(1)
1368
+ ? [...newTarget.export, ...target.export.slice(1)]
1369
+ : target.export.slice(1),
1370
+ deferred: newTarget.deferred
1365
1371
  };
1366
1372
  }
1367
1373
  }
@@ -1433,10 +1439,11 @@ class ExportInfo {
1433
1439
  module: newTarget.module,
1434
1440
  connection: newTarget.connection,
1435
1441
  export: newTarget.export
1436
- ? newTarget.export.concat(
1437
- /** @type {NonNullable<TargetItemWithConnection["export"]>} */
1442
+ ? [
1443
+ ...newTarget.export,
1444
+ .../** @type {NonNullable<TargetItemWithConnection["export"]>} */
1438
1445
  (target.export).slice(1)
1439
- )
1446
+ ]
1440
1447
  : /** @type {NonNullable<TargetItemWithConnection["export"]>} */
1441
1448
  (target.export).slice(1)
1442
1449
  };
@@ -1468,8 +1475,9 @@ class ExportInfo {
1468
1475
  if (
1469
1476
  target.export &&
1470
1477
  !equals(/** @type {ArrayLike<string>} */ (t.export), target.export)
1471
- )
1478
+ ) {
1472
1479
  return;
1480
+ }
1473
1481
  result = values.next();
1474
1482
  }
1475
1483
  return target;
@@ -1517,8 +1525,9 @@ class ExportInfo {
1517
1525
  * @returns {ExportsInfo} an exports info
1518
1526
  */
1519
1527
  createNestedExportsInfo() {
1520
- if (this.exportsInfoOwned)
1528
+ if (this.exportsInfoOwned) {
1521
1529
  return /** @type {ExportsInfo} */ (this.exportsInfo);
1530
+ }
1522
1531
  this.exportsInfoOwned = true;
1523
1532
  const oldExportsInfo = this.exportsInfo;
1524
1533
  this.exportsInfo = new ExportsInfo();
@@ -1671,5 +1680,5 @@ class ExportInfo {
1671
1680
 
1672
1681
  module.exports = ExportsInfo;
1673
1682
  module.exports.ExportInfo = ExportInfo;
1674
- module.exports.UsageState = UsageState;
1675
1683
  module.exports.RestoreProvidedData = RestoreProvidedData;
1684
+ module.exports.UsageState = UsageState;
@@ -12,9 +12,9 @@ const { UsageState } = require("./ExportsInfo");
12
12
  const InitFragment = require("./InitFragment");
13
13
  const Module = require("./Module");
14
14
  const {
15
- JS_TYPES,
15
+ CSS_IMPORT_TYPES,
16
16
  CSS_URL_TYPES,
17
- CSS_IMPORT_TYPES
17
+ JS_TYPES
18
18
  } = require("./ModuleSourceTypesConstants");
19
19
  const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("./ModuleTypeConstants");
20
20
  const RuntimeGlobals = require("./RuntimeGlobals");
@@ -352,8 +352,9 @@ const getSourceForModuleExternal = (
352
352
  runtimeTemplate,
353
353
  dependencyMeta
354
354
  ) => {
355
- if (!Array.isArray(moduleAndSpecifiers))
355
+ if (!Array.isArray(moduleAndSpecifiers)) {
356
356
  moduleAndSpecifiers = [moduleAndSpecifiers];
357
+ }
357
358
  const initFragment = new ModuleExternalInitFragment(
358
359
  moduleAndSpecifiers[0],
359
360
  undefined,
@@ -587,7 +588,7 @@ class ExternalModule extends Module {
587
588
  this.buildInfo = {
588
589
  strict: true,
589
590
  topLevelDeclarations: new Set(),
590
- module: compilation.outputOptions.module
591
+ javascriptModule: compilation.outputOptions.module
591
592
  };
592
593
  const { request, externalType } = this._getRequestAndExternalType();
593
594
  this.buildMeta.exportsType = "dynamic";
@@ -604,7 +605,7 @@ class ExternalModule extends Module {
604
605
  }
605
606
  break;
606
607
  case "module":
607
- if (this.buildInfo.module) {
608
+ if (this.buildInfo.javascriptModule) {
608
609
  if (!Array.isArray(request) || request.length === 1) {
609
610
  this.buildMeta.exportsType = "namespace";
610
611
  canMangle = true;
@@ -668,7 +669,7 @@ class ExternalModule extends Module {
668
669
  * @param {ConcatenationBailoutReasonContext} context context
669
670
  * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
670
671
  */
671
- getConcatenationBailoutReason({ moduleGraph }) {
672
+ getConcatenationBailoutReason(context) {
672
673
  switch (this.externalType) {
673
674
  case "amd":
674
675
  case "amd-require":
@@ -683,8 +684,9 @@ class ExternalModule extends Module {
683
684
 
684
685
  _getRequestAndExternalType() {
685
686
  let { request, externalType } = this;
686
- if (typeof request === "object" && !Array.isArray(request))
687
+ if (typeof request === "object" && !Array.isArray(request)) {
687
688
  request = request[externalType];
689
+ }
688
690
  externalType = this._resolveExternalType(externalType);
689
691
  return { request, externalType };
690
692
  }
@@ -758,7 +760,7 @@ class ExternalModule extends Module {
758
760
  case "commonjs-static":
759
761
  return getSourceForCommonJsExternal(request);
760
762
  case "node-commonjs":
761
- return /** @type {BuildInfo} */ (this.buildInfo).module
763
+ return /** @type {BuildInfo} */ (this.buildInfo).javascriptModule
762
764
  ? getSourceForCommonJsExternalInNodeModule(
763
765
  request,
764
766
  /** @type {string} */
@@ -790,7 +792,7 @@ class ExternalModule extends Module {
790
792
  case "script":
791
793
  return getSourceForScriptExternal(request, runtimeTemplate);
792
794
  case "module": {
793
- if (!(/** @type {BuildInfo} */ (this.buildInfo).module)) {
795
+ if (!(/** @type {BuildInfo} */ (this.buildInfo).javascriptModule)) {
794
796
  if (!runtimeTemplate.supportsDynamicImport()) {
795
797
  throw new Error(
796
798
  `The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script${
@@ -900,8 +902,9 @@ class ExternalModule extends Module {
900
902
  );
901
903
 
902
904
  let sourceString = sourceData.expression;
903
- if (sourceData.iife)
905
+ if (sourceData.iife) {
904
906
  sourceString = `(function() { return ${sourceString}; }())`;
907
+ }
905
908
  if (concatenationScope) {
906
909
  sourceString = `${
907
910
  runtimeTemplate.supportsConst() ? "const" : "var"
@@ -912,8 +915,9 @@ class ExternalModule extends Module {
912
915
  } else {
913
916
  sourceString = `module.exports = ${sourceString};`;
914
917
  }
915
- if (sourceData.init)
918
+ if (sourceData.init) {
916
919
  sourceString = `${sourceData.init}\n${sourceString}`;
920
+ }
917
921
 
918
922
  let data;
919
923
  if (sourceData.chunkInitFragments) {
@@ -12,7 +12,7 @@ const CssImportDependency = require("./dependencies/CssImportDependency");
12
12
  const CssUrlDependency = require("./dependencies/CssUrlDependency");
13
13
  const HarmonyImportDependency = require("./dependencies/HarmonyImportDependency");
14
14
  const ImportDependency = require("./dependencies/ImportDependency");
15
- const { resolveByProperty, cachedSetProperty } = require("./util/cleverMerge");
15
+ const { cachedSetProperty, resolveByProperty } = require("./util/cleverMerge");
16
16
 
17
17
  /** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionData} ExternalItemFunctionData */
18
18
  /** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */
@@ -75,6 +75,8 @@ const resolveLayer = (obj, layer) => {
75
75
  /** @typedef {string | string[] | boolean | Record<string, string | string[]>} ExternalValue */
76
76
  /** @typedef {string | undefined} ExternalType */
77
77
 
78
+ const PLUGIN_NAME = "ExternalModuleFactoryPlugin";
79
+
78
80
  class ExternalModuleFactoryPlugin {
79
81
  /**
80
82
  * @param {string | undefined} type default external type
@@ -92,7 +94,7 @@ class ExternalModuleFactoryPlugin {
92
94
  apply(normalModuleFactory) {
93
95
  const globalType = this.type;
94
96
  normalModuleFactory.hooks.factorize.tapAsync(
95
- "ExternalModuleFactoryPlugin",
97
+ PLUGIN_NAME,
96
98
  (data, callback) => {
97
99
  const context = data.context;
98
100
  const contextInfo = data.contextInfo;
@@ -335,4 +337,5 @@ class ExternalModuleFactoryPlugin {
335
337
  );
336
338
  }
337
339
  }
340
+
338
341
  module.exports = ExternalModuleFactoryPlugin;
@@ -5,15 +5,15 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const { create: createResolver } = require("enhanced-resolve");
9
8
  const nodeModule = require("module");
10
- const asyncLib = require("neo-async");
11
9
  const { isAbsolute } = require("path");
10
+ const { create: createResolver } = require("enhanced-resolve");
11
+ const asyncLib = require("neo-async");
12
12
  const { DEFAULTS } = require("./config/defaults");
13
13
  const AsyncQueue = require("./util/AsyncQueue");
14
14
  const StackedCacheMap = require("./util/StackedCacheMap");
15
15
  const createHash = require("./util/createHash");
16
- const { join, dirname, relative, lstatReadlinkAbsolute } = require("./util/fs");
16
+ const { dirname, join, lstatReadlinkAbsolute, relative } = require("./util/fs");
17
17
  const makeSerializable = require("./util/makeSerializable");
18
18
  const processAsyncTree = require("./util/processAsyncTree");
19
19
 
@@ -313,7 +313,7 @@ class Snapshot {
313
313
  * @param {number} value start value
314
314
  */
315
315
  setStartTime(value) {
316
- this._flags = this._flags | 1;
316
+ this._flags |= 1;
317
317
  this.startTime = value;
318
318
  }
319
319
 
@@ -350,7 +350,7 @@ class Snapshot {
350
350
  * @param {FileTimestamps} value file timestamps
351
351
  */
352
352
  setFileTimestamps(value) {
353
- this._flags = this._flags | 2;
353
+ this._flags |= 2;
354
354
  this.fileTimestamps = value;
355
355
  }
356
356
 
@@ -362,7 +362,7 @@ class Snapshot {
362
362
  * @param {FileHashes} value file hashes
363
363
  */
364
364
  setFileHashes(value) {
365
- this._flags = this._flags | 4;
365
+ this._flags |= 4;
366
366
  this.fileHashes = value;
367
367
  }
368
368
 
@@ -374,7 +374,7 @@ class Snapshot {
374
374
  * @param {FileTshs} value file tshs
375
375
  */
376
376
  setFileTshs(value) {
377
- this._flags = this._flags | 8;
377
+ this._flags |= 8;
378
378
  this.fileTshs = value;
379
379
  }
380
380
 
@@ -386,7 +386,7 @@ class Snapshot {
386
386
  * @param {ContextTimestamps} value context timestamps
387
387
  */
388
388
  setContextTimestamps(value) {
389
- this._flags = this._flags | 0x10;
389
+ this._flags |= 0x10;
390
390
  this.contextTimestamps = value;
391
391
  }
392
392
 
@@ -398,7 +398,7 @@ class Snapshot {
398
398
  * @param {ContextHashes} value context hashes
399
399
  */
400
400
  setContextHashes(value) {
401
- this._flags = this._flags | 0x20;
401
+ this._flags |= 0x20;
402
402
  this.contextHashes = value;
403
403
  }
404
404
 
@@ -410,7 +410,7 @@ class Snapshot {
410
410
  * @param {ContextTshs} value context tshs
411
411
  */
412
412
  setContextTshs(value) {
413
- this._flags = this._flags | 0x40;
413
+ this._flags |= 0x40;
414
414
  this.contextTshs = value;
415
415
  }
416
416
 
@@ -422,7 +422,7 @@ class Snapshot {
422
422
  * @param {MissingExistence} value context tshs
423
423
  */
424
424
  setMissingExistence(value) {
425
- this._flags = this._flags | 0x80;
425
+ this._flags |= 0x80;
426
426
  this.missingExistence = value;
427
427
  }
428
428
 
@@ -434,7 +434,7 @@ class Snapshot {
434
434
  * @param {ManagedItemInfo} value managed item info
435
435
  */
436
436
  setManagedItemInfo(value) {
437
- this._flags = this._flags | 0x100;
437
+ this._flags |= 0x100;
438
438
  this.managedItemInfo = value;
439
439
  }
440
440
 
@@ -446,7 +446,7 @@ class Snapshot {
446
446
  * @param {ManagedFiles} value managed files
447
447
  */
448
448
  setManagedFiles(value) {
449
- this._flags = this._flags | 0x200;
449
+ this._flags |= 0x200;
450
450
  this.managedFiles = value;
451
451
  }
452
452
 
@@ -458,7 +458,7 @@ class Snapshot {
458
458
  * @param {ManagedContexts} value managed contexts
459
459
  */
460
460
  setManagedContexts(value) {
461
- this._flags = this._flags | 0x400;
461
+ this._flags |= 0x400;
462
462
  this.managedContexts = value;
463
463
  }
464
464
 
@@ -470,7 +470,7 @@ class Snapshot {
470
470
  * @param {ManagedMissing} value managed missing
471
471
  */
472
472
  setManagedMissing(value) {
473
- this._flags = this._flags | 0x800;
473
+ this._flags |= 0x800;
474
474
  this.managedMissing = value;
475
475
  }
476
476
 
@@ -482,7 +482,7 @@ class Snapshot {
482
482
  * @param {Children} value children
483
483
  */
484
484
  setChildren(value) {
485
- this._flags = this._flags | 0x1000;
485
+ this._flags |= 0x1000;
486
486
  this.children = value;
487
487
  }
488
488
 
@@ -792,8 +792,9 @@ class SnapshotOptimization {
792
792
  snapshotContent: new Set(commonMap.keys()),
793
793
  children: undefined
794
794
  };
795
- if (optimizationEntry.children === undefined)
795
+ if (optimizationEntry.children === undefined) {
796
796
  optimizationEntry.children = new Set();
797
+ }
797
798
  optimizationEntry.children.add(newEntry);
798
799
  storeOptimizationEntry(newEntry);
799
800
  this._statSharedSnapshots++;
@@ -872,8 +873,9 @@ class SnapshotOptimization {
872
873
  * @returns {string} result
873
874
  */
874
875
  const parseString = str => {
875
- if (str[0] === "'" || str[0] === "`")
876
+ if (str[0] === "'" || str[0] === "`") {
876
877
  str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`;
878
+ }
877
879
  return JSON.parse(str);
878
880
  };
879
881
 
@@ -1197,7 +1199,7 @@ class FileSystemInfo {
1197
1199
  parallelism: 10,
1198
1200
  processor: this._getManagedItemDirectoryInfo.bind(this)
1199
1201
  });
1200
- const _unmanagedPaths = Array.from(unmanagedPaths);
1202
+ const _unmanagedPaths = [...unmanagedPaths];
1201
1203
  this.unmanagedPathsWithSlash =
1202
1204
  /** @type {string[]} */
1203
1205
  (_unmanagedPaths.filter(p => typeof p === "string")).map(p =>
@@ -1207,7 +1209,7 @@ class FileSystemInfo {
1207
1209
  /** @type {RegExp[]} */
1208
1210
  (_unmanagedPaths.filter(p => typeof p !== "string"));
1209
1211
 
1210
- this.managedPaths = Array.from(managedPaths);
1212
+ this.managedPaths = [...managedPaths];
1211
1213
  this.managedPathsWithSlash =
1212
1214
  /** @type {string[]} */
1213
1215
  (this.managedPaths.filter(p => typeof p === "string")).map(p =>
@@ -1217,7 +1219,7 @@ class FileSystemInfo {
1217
1219
  this.managedPathsRegExps =
1218
1220
  /** @type {RegExp[]} */
1219
1221
  (this.managedPaths.filter(p => typeof p !== "string"));
1220
- this.immutablePaths = Array.from(immutablePaths);
1222
+ this.immutablePaths = [...immutablePaths];
1221
1223
  this.immutablePathsWithSlash =
1222
1224
  /** @type {string[]} */
1223
1225
  (this.immutablePaths.filter(p => typeof p === "string")).map(p =>
@@ -1475,16 +1477,18 @@ class FileSystemInfo {
1475
1477
  const cache = this._contextHashes.get(path);
1476
1478
  if (cache !== undefined) {
1477
1479
  const resolved = getResolvedHash(cache);
1478
- if (resolved !== undefined)
1480
+ if (resolved !== undefined) {
1479
1481
  return callback(null, /** @type {string} */ (resolved));
1482
+ }
1480
1483
  return this._resolveContextHash(cache, callback);
1481
1484
  }
1482
1485
  this.contextHashQueue.add(path, (err, _entry) => {
1483
1486
  if (err) return callback(err);
1484
1487
  const entry = /** @type {ContextHash} */ (_entry);
1485
1488
  const resolved = getResolvedHash(entry);
1486
- if (resolved !== undefined)
1489
+ if (resolved !== undefined) {
1487
1490
  return callback(null, /** @type {string} */ (resolved));
1491
+ }
1488
1492
  this._resolveContextHash(entry, callback);
1489
1493
  });
1490
1494
  }
@@ -1893,8 +1897,9 @@ class FileSystemInfo {
1893
1897
  });
1894
1898
  }
1895
1899
  let request = subPath.replace(/\\/g, "/");
1896
- if (request.endsWith(".js"))
1900
+ if (request.endsWith(".js")) {
1897
1901
  request = request.slice(0, -3);
1902
+ }
1898
1903
  push({
1899
1904
  type: RBDT_RESOLVE_CJS_FILE_AS_CHILD,
1900
1905
  context,
@@ -1929,7 +1934,9 @@ class FileSystemInfo {
1929
1934
  );
1930
1935
  this._warnAboutExperimentalEsmTracking = true;
1931
1936
  }
1937
+
1932
1938
  const lexer = require("es-module-lexer");
1939
+
1933
1940
  lexer.init.then(() => {
1934
1941
  this.fs.readFile(path, (err, content) => {
1935
1942
  if (err) return callback(err);
@@ -1943,11 +1950,11 @@ class FileSystemInfo {
1943
1950
  if (imp.d === -1) {
1944
1951
  // import ... from "..."
1945
1952
  dependency = parseString(
1946
- source.substring(imp.s - 1, imp.e + 1)
1953
+ source.slice(imp.s - 1, imp.e + 1)
1947
1954
  );
1948
1955
  } else if (imp.d > -1) {
1949
1956
  // import()
1950
- const expr = source.substring(imp.s, imp.e).trim();
1957
+ const expr = source.slice(imp.s, imp.e).trim();
1951
1958
  dependency = parseString(expr);
1952
1959
  } else {
1953
1960
  // e.g. import.meta
@@ -1967,7 +1974,7 @@ class FileSystemInfo {
1967
1974
  });
1968
1975
  } catch (err1) {
1969
1976
  logger.warn(
1970
- `Parsing of ${path} for build dependencies failed at 'import(${source.substring(
1977
+ `Parsing of ${path} for build dependencies failed at 'import(${source.slice(
1971
1978
  imp.s,
1972
1979
  imp.e
1973
1980
  )})'.\n` +
@@ -2025,7 +2032,8 @@ class FileSystemInfo {
2025
2032
  let packageData;
2026
2033
  try {
2027
2034
  packageData = JSON.parse(
2028
- /** @type {Buffer} */ (content).toString("utf-8")
2035
+ /** @type {Buffer} */
2036
+ (content).toString("utf8")
2029
2037
  );
2030
2038
  } catch (parseErr) {
2031
2039
  return callback(/** @type {Error} */ (parseErr));
@@ -2099,8 +2107,9 @@ class FileSystemInfo {
2099
2107
  switch (type) {
2100
2108
  case "d":
2101
2109
  resolveContext(context, path, {}, (err, _, result) => {
2102
- if (expectedResult === false)
2110
+ if (expectedResult === false) {
2103
2111
  return callback(err ? undefined : INVALID);
2112
+ }
2104
2113
  if (err) return callback(err);
2105
2114
  const resultPath = /** @type {ResolveRequest} */ (result).path;
2106
2115
  if (resultPath !== expectedResult) return callback(INVALID);
@@ -2109,8 +2118,9 @@ class FileSystemInfo {
2109
2118
  break;
2110
2119
  case "f":
2111
2120
  resolveCjs(context, path, {}, (err, _, result) => {
2112
- if (expectedResult === false)
2121
+ if (expectedResult === false) {
2113
2122
  return callback(err ? undefined : INVALID);
2123
+ }
2114
2124
  if (err) return callback(err);
2115
2125
  const resultPath = /** @type {ResolveRequest} */ (result).path;
2116
2126
  if (resultPath !== expectedResult) return callback(INVALID);
@@ -2119,8 +2129,9 @@ class FileSystemInfo {
2119
2129
  break;
2120
2130
  case "c":
2121
2131
  resolveCjsAsChild(context, path, {}, (err, _, result) => {
2122
- if (expectedResult === false)
2132
+ if (expectedResult === false) {
2123
2133
  return callback(err ? undefined : INVALID);
2134
+ }
2124
2135
  if (err) return callback(err);
2125
2136
  const resultPath = /** @type {ResolveRequest} */ (result).path;
2126
2137
  if (resultPath !== expectedResult) return callback(INVALID);
@@ -2129,8 +2140,9 @@ class FileSystemInfo {
2129
2140
  break;
2130
2141
  case "e":
2131
2142
  resolveEsm(context, path, {}, (err, _, result) => {
2132
- if (expectedResult === false)
2143
+ if (expectedResult === false) {
2133
2144
  return callback(err ? undefined : INVALID);
2145
+ }
2134
2146
  if (err) return callback(err);
2135
2147
  const resultPath = /** @type {ResolveRequest} */ (result).path;
2136
2148
  if (resultPath !== expectedResult) return callback(INVALID);
@@ -3515,8 +3527,9 @@ class FileSystemInfo {
3515
3527
  fromFile: (file, stat, callback) => {
3516
3528
  // Prefer the cached value over our new stat to report consistent results
3517
3529
  const cache = this._fileTimestamps.get(file);
3518
- if (cache !== undefined)
3530
+ if (cache !== undefined) {
3519
3531
  return callback(null, cache === "ignore" ? null : cache);
3532
+ }
3520
3533
 
3521
3534
  const mtime = Number(stat.mtime);
3522
3535
 
@@ -4029,7 +4042,7 @@ class FileSystemInfo {
4029
4042
  }
4030
4043
  let data;
4031
4044
  try {
4032
- data = JSON.parse(/** @type {Buffer} */ (content).toString("utf-8"));
4045
+ data = JSON.parse(/** @type {Buffer} */ (content).toString("utf8"));
4033
4046
  } catch (parseErr) {
4034
4047
  return callback(/** @type {WebpackError} */ (parseErr));
4035
4048
  }
@@ -4048,8 +4061,9 @@ class FileSystemInfo {
4048
4061
  }
4049
4062
 
4050
4063
  getDeprecatedFileTimestamps() {
4051
- if (this._cachedDeprecatedFileTimestamps !== undefined)
4064
+ if (this._cachedDeprecatedFileTimestamps !== undefined) {
4052
4065
  return this._cachedDeprecatedFileTimestamps;
4066
+ }
4053
4067
  /** @type {Map<string, number | null>} */
4054
4068
  const map = new Map();
4055
4069
  for (const [path, info] of this._fileTimestamps) {
@@ -4059,8 +4073,9 @@ class FileSystemInfo {
4059
4073
  }
4060
4074
 
4061
4075
  getDeprecatedContextTimestamps() {
4062
- if (this._cachedDeprecatedContextTimestamps !== undefined)
4076
+ if (this._cachedDeprecatedContextTimestamps !== undefined) {
4063
4077
  return this._cachedDeprecatedContextTimestamps;
4078
+ }
4064
4079
  /** @type {Map<string, number | null>} */
4065
4080
  const map = new Map();
4066
4081
  for (const [path, info] of this._contextTimestamps) {