webpack 5.76.1 → 5.88.2

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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (442) hide show
  1. package/README.md +10 -4
  2. package/bin/webpack.js +26 -2
  3. package/hot/dev-server.js +2 -1
  4. package/hot/lazy-compilation-node.js +10 -0
  5. package/hot/lazy-compilation-web.js +9 -0
  6. package/hot/log-apply-result.js +5 -0
  7. package/hot/log.js +22 -0
  8. package/hot/only-dev-server.js +2 -1
  9. package/hot/poll.js +3 -0
  10. package/hot/signal.js +4 -0
  11. package/lib/APIPlugin.js +174 -116
  12. package/lib/AsyncDependenciesBlock.js +13 -5
  13. package/lib/AutomaticPrefetchPlugin.js +1 -0
  14. package/lib/BannerPlugin.js +6 -1
  15. package/lib/CacheFacade.js +4 -0
  16. package/lib/CaseSensitiveModulesWarning.js +3 -1
  17. package/lib/Chunk.js +36 -18
  18. package/lib/ChunkGraph.js +4 -4
  19. package/lib/ChunkGroup.js +25 -10
  20. package/lib/CleanPlugin.js +30 -7
  21. package/lib/CodeGenerationResults.js +2 -2
  22. package/lib/CompatibilityPlugin.js +85 -46
  23. package/lib/Compilation.js +17 -8
  24. package/lib/Compiler.js +18 -14
  25. package/lib/ConcatenationScope.js +2 -2
  26. package/lib/ConditionalInitFragment.js +11 -1
  27. package/lib/ConstPlugin.js +95 -47
  28. package/lib/ContextModule.js +20 -6
  29. package/lib/ContextModuleFactory.js +2 -1
  30. package/lib/ContextReplacementPlugin.js +13 -0
  31. package/lib/CssModule.js +169 -0
  32. package/lib/DefinePlugin.js +152 -86
  33. package/lib/DelegatedModule.js +22 -4
  34. package/lib/DelegatedModuleFactoryPlugin.js +6 -0
  35. package/lib/DependenciesBlock.js +17 -1
  36. package/lib/Dependency.js +19 -5
  37. package/lib/DependencyTemplates.js +1 -1
  38. package/lib/DllEntryPlugin.js +16 -1
  39. package/lib/DllModule.js +17 -2
  40. package/lib/DllModuleFactory.js +1 -1
  41. package/lib/DllReferencePlugin.js +13 -1
  42. package/lib/Entrypoint.js +1 -1
  43. package/lib/ErrorHelpers.js +62 -22
  44. package/lib/EvalSourceMapDevToolPlugin.js +9 -2
  45. package/lib/ExportsInfo.js +25 -4
  46. package/lib/ExportsInfoApiPlugin.js +30 -14
  47. package/lib/ExternalModule.js +30 -9
  48. package/lib/FileSystemInfo.js +61 -25
  49. package/lib/FlagAllModulesAsUsedPlugin.js +27 -27
  50. package/lib/FlagDependencyExportsPlugin.js +336 -348
  51. package/lib/FlagDependencyUsagePlugin.js +9 -9
  52. package/lib/FlagEntryExportAsUsedPlugin.js +26 -23
  53. package/lib/Generator.js +7 -0
  54. package/lib/HookWebpackError.js +1 -1
  55. package/lib/HotModuleReplacementPlugin.js +60 -46
  56. package/lib/IgnoreErrorModuleFactory.js +1 -1
  57. package/lib/InitFragment.js +28 -5
  58. package/lib/JavascriptMetaInfoPlugin.js +27 -15
  59. package/lib/LibManifestPlugin.js +22 -5
  60. package/lib/LoaderOptionsPlugin.js +12 -2
  61. package/lib/MainTemplate.js +2 -2
  62. package/lib/Module.js +44 -12
  63. package/lib/ModuleBuildError.js +9 -0
  64. package/lib/ModuleDependencyError.js +4 -2
  65. package/lib/ModuleDependencyWarning.js +4 -2
  66. package/lib/ModuleError.js +9 -0
  67. package/lib/ModuleFactory.js +1 -1
  68. package/lib/ModuleFilenameHelpers.js +114 -4
  69. package/lib/ModuleGraph.js +33 -23
  70. package/lib/ModuleGraphConnection.js +19 -6
  71. package/lib/ModuleInfoHeaderPlugin.js +9 -2
  72. package/lib/ModuleNotFoundError.js +5 -2
  73. package/lib/ModuleParseError.js +9 -0
  74. package/lib/ModuleProfile.js +1 -0
  75. package/lib/ModuleRestoreError.js +2 -0
  76. package/lib/ModuleStoreError.js +2 -1
  77. package/lib/ModuleTypeConstants.js +169 -0
  78. package/lib/ModuleWarning.js +9 -0
  79. package/lib/MultiWatching.js +4 -0
  80. package/lib/NodeStuffPlugin.js +65 -35
  81. package/lib/NormalModule.js +12 -2
  82. package/lib/NormalModuleFactory.js +56 -8
  83. package/lib/NormalModuleReplacementPlugin.js +5 -3
  84. package/lib/NullFactory.js +1 -1
  85. package/lib/PrefetchPlugin.js +4 -0
  86. package/lib/ProgressPlugin.js +71 -15
  87. package/lib/ProvidePlugin.js +30 -14
  88. package/lib/RawModule.js +13 -2
  89. package/lib/RecordIdsPlugin.js +4 -4
  90. package/lib/RequireJsStuffPlugin.js +22 -15
  91. package/lib/RuntimeGlobals.js +5 -0
  92. package/lib/RuntimeModule.js +12 -11
  93. package/lib/RuntimePlugin.js +10 -3
  94. package/lib/RuntimeTemplate.js +29 -11
  95. package/lib/SelfModuleFactory.js +12 -0
  96. package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -0
  97. package/lib/SourceMapDevToolPlugin.js +47 -11
  98. package/lib/Template.js +5 -3
  99. package/lib/UseStrictPlugin.js +29 -11
  100. package/lib/WarnCaseSensitiveModulesPlugin.js +12 -0
  101. package/lib/WarnDeprecatedOptionPlugin.js +7 -0
  102. package/lib/WatchIgnorePlugin.js +4 -0
  103. package/lib/Watching.js +62 -25
  104. package/lib/WebpackError.js +14 -5
  105. package/lib/WebpackIsIncludedPlugin.js +22 -13
  106. package/lib/WebpackOptionsApply.js +41 -44
  107. package/lib/WebpackOptionsDefaulter.js +10 -3
  108. package/lib/asset/AssetGenerator.js +24 -9
  109. package/lib/asset/AssetModulesPlugin.js +28 -12
  110. package/lib/asset/AssetParser.js +15 -7
  111. package/lib/asset/AssetSourceParser.js +8 -3
  112. package/lib/asset/RawDataUrlModule.js +15 -4
  113. package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -0
  114. package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
  115. package/lib/buildChunkGraph.js +37 -21
  116. package/lib/cache/IdleFileCachePlugin.js +2 -1
  117. package/lib/cache/MemoryWithGcCachePlugin.js +2 -0
  118. package/lib/cache/PackFileCacheStrategy.js +59 -22
  119. package/lib/cache/ResolverCachePlugin.js +3 -0
  120. package/lib/config/browserslistTargetHandler.js +10 -10
  121. package/lib/config/defaults.js +306 -105
  122. package/lib/config/normalization.js +110 -71
  123. package/lib/config/target.js +37 -10
  124. package/lib/container/ContainerEntryModule.js +11 -1
  125. package/lib/container/ContainerEntryModuleFactory.js +1 -1
  126. package/lib/container/ContainerExposedDependency.js +9 -0
  127. package/lib/container/ContainerPlugin.js +3 -1
  128. package/lib/container/FallbackDependency.js +13 -0
  129. package/lib/container/FallbackItemDependency.js +3 -0
  130. package/lib/container/FallbackModule.js +12 -2
  131. package/lib/container/FallbackModuleFactory.js +1 -1
  132. package/lib/container/RemoteModule.js +11 -1
  133. package/lib/container/RemoteRuntimeModule.js +3 -2
  134. package/lib/container/RemoteToExternalDependency.js +3 -0
  135. package/lib/css/CssExportsGenerator.js +9 -0
  136. package/lib/css/CssGenerator.js +5 -1
  137. package/lib/css/CssLoadingRuntimeModule.js +53 -22
  138. package/lib/css/CssModulesPlugin.js +253 -74
  139. package/lib/css/CssParser.js +697 -282
  140. package/lib/css/walkCssTokens.js +269 -138
  141. package/lib/debug/ProfilingPlugin.js +33 -12
  142. package/lib/dependencies/AMDDefineDependency.js +54 -10
  143. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +13 -2
  144. package/lib/dependencies/AMDPlugin.js +33 -20
  145. package/lib/dependencies/AMDRequireArrayDependency.js +13 -0
  146. package/lib/dependencies/AMDRequireContextDependency.js +15 -0
  147. package/lib/dependencies/AMDRequireDependenciesBlock.js +6 -0
  148. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +8 -2
  149. package/lib/dependencies/AMDRequireDependency.js +16 -1
  150. package/lib/dependencies/AMDRequireItemDependency.js +6 -0
  151. package/lib/dependencies/AMDRuntimeModules.js +2 -2
  152. package/lib/dependencies/CachedConstDependency.js +14 -0
  153. package/lib/dependencies/CommonJsDependencyHelpers.js +9 -0
  154. package/lib/dependencies/CommonJsExportRequireDependency.js +19 -0
  155. package/lib/dependencies/CommonJsExportsDependency.js +16 -0
  156. package/lib/dependencies/CommonJsExportsParserPlugin.js +77 -5
  157. package/lib/dependencies/CommonJsFullRequireDependency.js +10 -1
  158. package/lib/dependencies/CommonJsImportsParserPlugin.js +174 -63
  159. package/lib/dependencies/CommonJsPlugin.js +51 -26
  160. package/lib/dependencies/CommonJsRequireContextDependency.js +17 -0
  161. package/lib/dependencies/CommonJsRequireDependency.js +7 -0
  162. package/lib/dependencies/CommonJsSelfReferenceDependency.js +16 -0
  163. package/lib/dependencies/ConstDependency.js +11 -2
  164. package/lib/dependencies/ContextDependency.js +15 -2
  165. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  166. package/lib/dependencies/ContextElementDependency.js +8 -0
  167. package/lib/dependencies/CreateScriptUrlDependency.js +10 -1
  168. package/lib/dependencies/CriticalDependencyWarning.js +3 -0
  169. package/lib/dependencies/CssExportDependency.js +8 -0
  170. package/lib/dependencies/CssImportDependency.js +55 -3
  171. package/lib/dependencies/CssLocalIdentifierDependency.js +18 -1
  172. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +10 -1
  173. package/lib/dependencies/CssUrlDependency.js +46 -16
  174. package/lib/dependencies/DelegatedSourceDependency.js +3 -0
  175. package/lib/dependencies/DllEntryDependency.js +14 -0
  176. package/lib/dependencies/DynamicExports.js +10 -6
  177. package/lib/dependencies/ExportsInfoDependency.js +25 -4
  178. package/lib/dependencies/HarmonyAcceptDependency.js +10 -1
  179. package/lib/dependencies/HarmonyAcceptImportDependency.js +3 -0
  180. package/lib/dependencies/HarmonyCompatibilityDependency.js +2 -1
  181. package/lib/dependencies/HarmonyDetectionParserPlugin.js +22 -2
  182. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +32 -6
  183. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +5 -0
  184. package/lib/dependencies/HarmonyExportExpressionDependency.js +20 -3
  185. package/lib/dependencies/HarmonyExportHeaderDependency.js +13 -0
  186. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +22 -6
  187. package/lib/dependencies/HarmonyExportInitFragment.js +2 -1
  188. package/lib/dependencies/HarmonyExportSpecifierDependency.js +12 -0
  189. package/lib/dependencies/HarmonyExports.js +11 -5
  190. package/lib/dependencies/HarmonyImportDependency.js +10 -1
  191. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +53 -22
  192. package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -2
  193. package/lib/dependencies/HarmonyImportSpecifierDependency.js +139 -16
  194. package/lib/dependencies/HarmonyModulesPlugin.js +23 -5
  195. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -3
  196. package/lib/dependencies/ImportContextDependency.js +15 -0
  197. package/lib/dependencies/ImportDependency.js +15 -4
  198. package/lib/dependencies/ImportEagerDependency.js +7 -4
  199. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +51 -13
  200. package/lib/dependencies/ImportMetaContextPlugin.js +18 -5
  201. package/lib/dependencies/ImportMetaHotAcceptDependency.js +6 -0
  202. package/lib/dependencies/ImportMetaHotDeclineDependency.js +6 -0
  203. package/lib/dependencies/ImportMetaPlugin.js +103 -51
  204. package/lib/dependencies/ImportParserPlugin.js +83 -25
  205. package/lib/dependencies/ImportPlugin.js +21 -7
  206. package/lib/dependencies/ImportWeakDependency.js +7 -4
  207. package/lib/dependencies/JsonExportsDependency.js +9 -1
  208. package/lib/dependencies/LocalModule.js +16 -0
  209. package/lib/dependencies/LocalModuleDependency.js +15 -0
  210. package/lib/dependencies/LocalModulesHelpers.js +18 -0
  211. package/lib/dependencies/ModuleDecoratorDependency.js +8 -0
  212. package/lib/dependencies/ModuleDependency.js +9 -1
  213. package/lib/dependencies/ModuleDependencyTemplateAsId.js +2 -1
  214. package/lib/dependencies/ModuleHotAcceptDependency.js +6 -0
  215. package/lib/dependencies/ModuleHotDeclineDependency.js +6 -0
  216. package/lib/dependencies/PrefetchDependency.js +3 -0
  217. package/lib/dependencies/ProvidedDependency.js +14 -2
  218. package/lib/dependencies/PureExpressionDependency.js +10 -1
  219. package/lib/dependencies/RequireContextDependency.js +6 -0
  220. package/lib/dependencies/RequireContextDependencyParserPlugin.js +13 -5
  221. package/lib/dependencies/RequireContextPlugin.js +19 -6
  222. package/lib/dependencies/RequireEnsureDependenciesBlock.js +7 -0
  223. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +6 -1
  224. package/lib/dependencies/RequireEnsureDependency.js +16 -2
  225. package/lib/dependencies/RequireEnsureItemDependency.js +3 -0
  226. package/lib/dependencies/RequireEnsurePlugin.js +27 -7
  227. package/lib/dependencies/RequireHeaderDependency.js +14 -1
  228. package/lib/dependencies/RequireIncludeDependency.js +5 -0
  229. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +29 -5
  230. package/lib/dependencies/RequireIncludePlugin.js +25 -5
  231. package/lib/dependencies/RequireResolveContextDependency.js +17 -0
  232. package/lib/dependencies/RequireResolveDependency.js +6 -0
  233. package/lib/dependencies/RequireResolveHeaderDependency.js +18 -0
  234. package/lib/dependencies/RuntimeRequirementsDependency.js +8 -0
  235. package/lib/dependencies/StaticExportsDependency.js +8 -0
  236. package/lib/dependencies/SystemPlugin.js +48 -21
  237. package/lib/dependencies/SystemRuntimeModule.js +1 -1
  238. package/lib/dependencies/URLDependency.js +13 -4
  239. package/lib/dependencies/URLPlugin.js +31 -18
  240. package/lib/dependencies/UnsupportedDependency.js +13 -0
  241. package/lib/dependencies/WebAssemblyExportImportedDependency.js +14 -0
  242. package/lib/dependencies/WebAssemblyImportDependency.js +9 -1
  243. package/lib/dependencies/WebpackIsIncludedDependency.js +5 -0
  244. package/lib/dependencies/WorkerDependency.js +47 -3
  245. package/lib/dependencies/WorkerPlugin.js +105 -32
  246. package/lib/dependencies/getFunctionExpression.js +7 -0
  247. package/lib/esm/ExportWebpackRequireRuntimeModule.js +3 -2
  248. package/lib/esm/ModuleChunkFormatPlugin.js +21 -8
  249. package/lib/esm/ModuleChunkLoadingPlugin.js +9 -0
  250. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +19 -12
  251. package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
  252. package/lib/hmr/LazyCompilationPlugin.js +14 -5
  253. package/lib/ids/ChunkModuleIdRangePlugin.js +11 -0
  254. package/lib/ids/DeterministicChunkIdsPlugin.js +11 -2
  255. package/lib/ids/DeterministicModuleIdsPlugin.js +11 -7
  256. package/lib/ids/HashedModuleIdsPlugin.js +9 -2
  257. package/lib/ids/IdHelpers.js +6 -0
  258. package/lib/ids/NamedChunkIdsPlugin.js +13 -1
  259. package/lib/ids/NamedModuleIdsPlugin.js +14 -3
  260. package/lib/ids/OccurrenceChunkIdsPlugin.js +6 -2
  261. package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
  262. package/lib/ids/SyncModuleIdsPlugin.js +3 -2
  263. package/lib/index.js +8 -0
  264. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +3 -3
  265. package/lib/javascript/BasicEvaluatedExpression.js +137 -11
  266. package/lib/javascript/ChunkHelpers.js +2 -2
  267. package/lib/javascript/CommonJsChunkFormatPlugin.js +7 -3
  268. package/lib/javascript/EnableChunkLoadingPlugin.js +4 -0
  269. package/lib/javascript/JavascriptModulesPlugin.js +217 -198
  270. package/lib/javascript/JavascriptParser.js +941 -256
  271. package/lib/javascript/JavascriptParserHelpers.js +37 -15
  272. package/lib/javascript/StartupHelpers.js +2 -2
  273. package/lib/json/JsonData.js +26 -1
  274. package/lib/json/JsonGenerator.js +21 -7
  275. package/lib/json/JsonModulesPlugin.js +14 -5
  276. package/lib/json/JsonParser.js +27 -13
  277. package/lib/library/AbstractLibraryPlugin.js +4 -0
  278. package/lib/library/AmdLibraryPlugin.js +22 -6
  279. package/lib/library/AssignLibraryPlugin.js +19 -5
  280. package/lib/library/EnableLibraryPlugin.js +4 -0
  281. package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
  282. package/lib/library/ModuleLibraryPlugin.js +8 -4
  283. package/lib/library/SystemLibraryPlugin.js +2 -1
  284. package/lib/library/UmdLibraryPlugin.js +24 -2
  285. package/lib/logging/runtime.js +1 -1
  286. package/lib/logging/truncateArgs.js +4 -0
  287. package/lib/node/CommonJsChunkLoadingPlugin.js +17 -2
  288. package/lib/node/NodeTargetPlugin.js +3 -0
  289. package/lib/node/NodeTemplatePlugin.js +10 -2
  290. package/lib/node/NodeWatchFileSystem.js +1 -1
  291. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +18 -9
  292. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +12 -2
  293. package/lib/node/ReadFileCompileWasmPlugin.js +21 -3
  294. package/lib/node/RequireChunkLoadingRuntimeModule.js +15 -8
  295. package/lib/node/nodeConsole.js +2 -4
  296. package/lib/optimize/AggressiveMergingPlugin.js +8 -0
  297. package/lib/optimize/AggressiveSplittingPlugin.js +9 -2
  298. package/lib/optimize/ConcatenatedModule.js +8 -6
  299. package/lib/optimize/EnsureChunkConditionsPlugin.js +3 -0
  300. package/lib/optimize/FlagIncludedChunksPlugin.js +11 -5
  301. package/lib/optimize/InnerGraph.js +5 -5
  302. package/lib/optimize/InnerGraphPlugin.js +57 -48
  303. package/lib/optimize/LimitChunkCountPlugin.js +29 -4
  304. package/lib/optimize/MangleExportsPlugin.js +1 -1
  305. package/lib/optimize/MinMaxSizeWarning.js +5 -0
  306. package/lib/optimize/ModuleConcatenationPlugin.js +59 -2
  307. package/lib/optimize/RealContentHashPlugin.js +86 -30
  308. package/lib/optimize/RemoveParentModulesPlugin.js +6 -0
  309. package/lib/optimize/RuntimeChunkPlugin.js +9 -1
  310. package/lib/optimize/SideEffectsFlagPlugin.js +53 -44
  311. package/lib/optimize/SplitChunksPlugin.js +71 -31
  312. package/lib/performance/SizeLimitsPlugin.js +7 -4
  313. package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +4 -2
  314. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +3 -1
  315. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +6 -3
  316. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -2
  317. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +4 -2
  318. package/lib/rules/BasicEffectRulePlugin.js +4 -0
  319. package/lib/rules/BasicMatcherRulePlugin.js +5 -0
  320. package/lib/rules/RuleSetCompiler.js +3 -3
  321. package/lib/rules/UseEffectRulePlugin.js +6 -4
  322. package/lib/runtime/AsyncModuleRuntimeModule.js +9 -6
  323. package/lib/runtime/AutoPublicPathRuntimeModule.js +16 -5
  324. package/lib/runtime/BaseUriRuntimeModule.js +8 -4
  325. package/lib/runtime/ChunkNameRuntimeModule.js +1 -1
  326. package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +5 -2
  327. package/lib/runtime/CompatRuntimeModule.js +7 -2
  328. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +5 -2
  329. package/lib/runtime/CreateScriptRuntimeModule.js +4 -2
  330. package/lib/runtime/CreateScriptUrlRuntimeModule.js +4 -2
  331. package/lib/runtime/DefinePropertyGettersRuntimeModule.js +5 -2
  332. package/lib/runtime/EnsureChunkRuntimeModule.js +18 -4
  333. package/lib/runtime/GetChunkFilenameRuntimeModule.js +45 -26
  334. package/lib/runtime/GetFullHashRuntimeModule.js +4 -3
  335. package/lib/runtime/GetMainFilenameRuntimeModule.js +5 -2
  336. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +27 -6
  337. package/lib/runtime/GlobalRuntimeModule.js +1 -1
  338. package/lib/runtime/HasOwnPropertyRuntimeModule.js +5 -2
  339. package/lib/runtime/LoadScriptRuntimeModule.js +65 -50
  340. package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +5 -2
  341. package/lib/runtime/NonceRuntimeModule.js +1 -1
  342. package/lib/runtime/OnChunksLoadedRuntimeModule.js +4 -2
  343. package/lib/runtime/PublicPathRuntimeModule.js +9 -2
  344. package/lib/runtime/RelativeUrlRuntimeModule.js +5 -2
  345. package/lib/runtime/RuntimeIdRuntimeModule.js +6 -2
  346. package/lib/runtime/StartupChunkDependenciesPlugin.js +15 -0
  347. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +13 -4
  348. package/lib/runtime/StartupEntrypointRuntimeModule.js +11 -7
  349. package/lib/runtime/SystemContextRuntimeModule.js +1 -1
  350. package/lib/schemes/DataUriPlugin.js +16 -3
  351. package/lib/schemes/HttpUriPlugin.js +38 -0
  352. package/lib/serialization/ArraySerializer.js +22 -6
  353. package/lib/serialization/BinaryMiddleware.js +164 -1
  354. package/lib/serialization/DateObjectSerializer.js +15 -4
  355. package/lib/serialization/ErrorObjectSerializer.js +23 -8
  356. package/lib/serialization/FileMiddleware.js +17 -0
  357. package/lib/serialization/MapObjectSerializer.js +24 -8
  358. package/lib/serialization/NullPrototypeObjectSerializer.js +25 -8
  359. package/lib/serialization/ObjectMiddleware.js +33 -2
  360. package/lib/serialization/PlainObjectSerializer.js +23 -12
  361. package/lib/serialization/RegExpObjectSerializer.js +16 -5
  362. package/lib/serialization/SetObjectSerializer.js +21 -6
  363. package/lib/serialization/types.js +1 -1
  364. package/lib/sharing/ConsumeSharedFallbackDependency.js +3 -0
  365. package/lib/sharing/ConsumeSharedModule.js +13 -2
  366. package/lib/sharing/ConsumeSharedPlugin.js +4 -0
  367. package/lib/sharing/ConsumeSharedRuntimeModule.js +22 -7
  368. package/lib/sharing/ProvideSharedDependency.js +17 -0
  369. package/lib/sharing/ProvideSharedModule.js +11 -1
  370. package/lib/sharing/ProvideSharedModuleFactory.js +1 -1
  371. package/lib/sharing/ProvideSharedPlugin.js +22 -21
  372. package/lib/sharing/ShareRuntimeModule.js +19 -9
  373. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  374. package/lib/sharing/utils.js +320 -7
  375. package/lib/stats/DefaultStatsFactoryPlugin.js +105 -29
  376. package/lib/stats/DefaultStatsPresetPlugin.js +9 -0
  377. package/lib/stats/DefaultStatsPrinterPlugin.js +43 -0
  378. package/lib/util/AsyncQueue.js +4 -2
  379. package/lib/util/LazySet.js +10 -2
  380. package/lib/util/MapHelpers.js +19 -5
  381. package/lib/util/ParallelismFactorCalculator.js +10 -0
  382. package/lib/util/Semaphore.js +1 -1
  383. package/lib/util/StackedCacheMap.js +7 -1
  384. package/lib/util/StringXor.js +51 -0
  385. package/lib/util/URLAbsoluteSpecifier.js +1 -1
  386. package/lib/util/binarySearchBounds.js +49 -0
  387. package/lib/util/compileBooleanMatcher.js +31 -0
  388. package/lib/util/createHash.js +35 -13
  389. package/lib/util/deprecation.js +18 -3
  390. package/lib/util/deterministicGrouping.js +50 -11
  391. package/lib/util/findGraphRoots.js +4 -2
  392. package/lib/util/hash/md4.js +2 -2
  393. package/lib/util/hash/xxhash64.js +1 -1
  394. package/lib/util/identifier.js +4 -0
  395. package/lib/util/internalSerializables.js +1 -0
  396. package/lib/util/makeSerializable.js +7 -0
  397. package/lib/util/memoize.js +3 -3
  398. package/lib/util/numberHash.js +75 -21
  399. package/lib/util/processAsyncTree.js +7 -1
  400. package/lib/util/propertyAccess.js +9 -54
  401. package/lib/util/propertyName.js +79 -0
  402. package/lib/util/registerExternalSerializer.js +1 -1
  403. package/lib/util/runtime.js +84 -21
  404. package/lib/util/semver.js +2 -1
  405. package/lib/util/serialization.js +10 -0
  406. package/lib/util/smartGrouping.js +1 -1
  407. package/lib/validateSchema.js +6 -2
  408. package/lib/wasm/EnableWasmLoadingPlugin.js +4 -0
  409. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +15 -2
  410. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +9 -1
  411. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +14 -3
  412. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +28 -8
  413. package/lib/wasm-async/AsyncWebAssemblyParser.js +11 -4
  414. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +39 -8
  415. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +17 -6
  416. package/lib/wasm-sync/WebAssemblyGenerator.js +19 -5
  417. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
  418. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +53 -43
  419. package/lib/wasm-sync/WebAssemblyParser.js +15 -4
  420. package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
  421. package/lib/web/FetchCompileAsyncWasmPlugin.js +11 -1
  422. package/lib/web/FetchCompileWasmPlugin.js +59 -42
  423. package/lib/web/JsonpChunkLoadingPlugin.js +9 -0
  424. package/lib/web/JsonpChunkLoadingRuntimeModule.js +26 -9
  425. package/lib/webpack.js +12 -3
  426. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +9 -0
  427. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +20 -17
  428. package/module.d.ts +55 -37
  429. package/package.json +59 -56
  430. package/schemas/WebpackOptions.check.js +1 -1
  431. package/schemas/WebpackOptions.json +133 -6
  432. package/schemas/plugins/ProgressPlugin.check.js +1 -1
  433. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  434. package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
  435. package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
  436. package/schemas/plugins/container/ContainerPlugin.json +8 -0
  437. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  438. package/schemas/plugins/container/ModuleFederationPlugin.json +8 -0
  439. package/schemas/plugins/css/CssGeneratorOptions.json +1 -1
  440. package/schemas/plugins/css/CssParserOptions.json +1 -1
  441. package/schemas/plugins/sharing/SharePlugin.check.js +1 -1
  442. package/types.d.ts +1629 -683
@@ -14,6 +14,7 @@ const { getInitialChunkIds } = require("../javascript/StartupHelpers");
14
14
  const compileBooleanMatcher = require("../util/compileBooleanMatcher");
15
15
 
16
16
  /** @typedef {import("../Chunk")} Chunk */
17
+ /** @typedef {import("../ChunkGraph")} ChunkGraph */
17
18
 
18
19
  /**
19
20
  * @typedef {Object} JsonpCompilationPluginHooks
@@ -46,6 +47,9 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
46
47
  return hooks;
47
48
  }
48
49
 
50
+ /**
51
+ * @param {Set<string>} runtimeRequirements runtime requirements
52
+ */
49
53
  constructor(runtimeRequirements) {
50
54
  super("jsonp chunk loading", RuntimeModule.STAGE_ATTACH);
51
55
  this._runtimeRequirements = runtimeRequirements;
@@ -66,10 +70,10 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
66
70
  }
67
71
 
68
72
  /**
69
- * @returns {string} runtime code
73
+ * @returns {string | null} runtime code
70
74
  */
71
75
  generate() {
72
- const { chunkGraph, compilation, chunk } = this;
76
+ const compilation = /** @type {Compilation} */ (this.compilation);
73
77
  const {
74
78
  runtimeTemplate,
75
79
  outputOptions: {
@@ -105,9 +109,14 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
105
109
  const withPreload = this._runtimeRequirements.has(
106
110
  RuntimeGlobals.preloadChunkHandlers
107
111
  );
112
+ const withFetchPriority = this._runtimeRequirements.has(
113
+ RuntimeGlobals.hasFetchPriority
114
+ );
108
115
  const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify(
109
116
  chunkLoadingGlobal
110
117
  )}]`;
118
+ const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph);
119
+ const chunk = /** @type {Chunk} */ (this.chunk);
111
120
  const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
112
121
  const hasJsMatcher = compileBooleanMatcher(conditionMap);
113
122
  const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
@@ -135,7 +144,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
135
144
  withLoading
136
145
  ? Template.asString([
137
146
  `${fn}.j = ${runtimeTemplate.basicFunction(
138
- "chunkId, promises",
147
+ `chunkId, promises${withFetchPriority ? ", fetchPriority" : ""}`,
139
148
  hasJsMatcher !== false
140
149
  ? Template.indent([
141
150
  "// JSONP chunk loading for javascript",
@@ -187,9 +196,15 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
187
196
  "}"
188
197
  ]
189
198
  )};`,
190
- `${RuntimeGlobals.loadScript}(url, loadingEnded, "chunk-" + chunkId, chunkId);`
199
+ `${
200
+ RuntimeGlobals.loadScript
201
+ }(url, loadingEnded, "chunk-" + chunkId, chunkId${
202
+ withFetchPriority ? ", fetchPriority" : ""
203
+ });`
191
204
  ]),
192
- "} else installedChunks[chunkId] = 0;"
205
+ hasJsMatcher === true
206
+ ? "}"
207
+ : "} else installedChunks[chunkId] = 0;"
193
208
  ]),
194
209
  "}"
195
210
  ]),
@@ -250,7 +265,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
250
265
  linkPreload.call(
251
266
  Template.asString([
252
267
  "var link = document.createElement('link');",
253
- scriptType
268
+ scriptType && scriptType !== "module"
254
269
  ? `link.type = ${JSON.stringify(scriptType)};`
255
270
  : "",
256
271
  "link.charset = 'utf-8';",
@@ -259,8 +274,10 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
259
274
  `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`
260
275
  ),
261
276
  "}",
262
- 'link.rel = "preload";',
263
- 'link.as = "script";',
277
+ scriptType === "module"
278
+ ? 'link.rel = "modulepreload";'
279
+ : 'link.rel = "preload";',
280
+ scriptType === "module" ? "" : 'link.as = "script";',
264
281
  `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`,
265
282
  crossOriginLoading
266
283
  ? crossOriginLoading === "use-credentials"
@@ -422,7 +439,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
422
439
  "}"
423
440
  ]),
424
441
  "}",
425
- "if(runtime) var result = runtime(__webpack_require__);"
442
+ `if(runtime) var result = runtime(${RuntimeGlobals.require});`
426
443
  ]),
427
444
  "}",
428
445
  "if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);",
package/lib/webpack.js CHANGED
@@ -61,7 +61,10 @@ const createMultiCompiler = (childOptions, options) => {
61
61
  const createCompiler = rawOptions => {
62
62
  const options = getNormalizedWebpackOptions(rawOptions);
63
63
  applyWebpackOptionsBaseDefaults(options);
64
- const compiler = new Compiler(options.context, options);
64
+ const compiler = new Compiler(
65
+ /** @type {string} */ (options.context),
66
+ options
67
+ );
65
68
  new NodeEnvironmentPlugin({
66
69
  infrastructureLogging: options.infrastructureLogging
67
70
  }).apply(compiler);
@@ -69,7 +72,7 @@ const createCompiler = rawOptions => {
69
72
  for (const plugin of options.plugins) {
70
73
  if (typeof plugin === "function") {
71
74
  plugin.call(compiler, compiler);
72
- } else {
75
+ } else if (plugin) {
73
76
  plugin.apply(compiler);
74
77
  }
75
78
  }
@@ -96,6 +99,11 @@ const createCompiler = rawOptions => {
96
99
  * @returns {MultiCompiler} the multi compiler object
97
100
  */
98
101
 
102
+ /**
103
+ * @template T
104
+ * @param {Array<T> | T} options options
105
+ * @returns {Array<T>} array of options
106
+ */
99
107
  const asArray = options =>
100
108
  Array.isArray(options) ? Array.from(options) : [options];
101
109
 
@@ -103,7 +111,7 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
103
111
  /**
104
112
  * @param {WebpackOptions | (ReadonlyArray<WebpackOptions> & MultiCompilerOptions)} options options
105
113
  * @param {Callback<Stats> & Callback<MultiStats>=} callback callback
106
- * @returns {Compiler | MultiCompiler}
114
+ * @returns {Compiler | MultiCompiler} Compiler or MultiCompiler
107
115
  */
108
116
  (options, callback) => {
109
117
  const create = () => {
@@ -117,6 +125,7 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
117
125
  }
118
126
  /** @type {MultiCompiler|Compiler} */
119
127
  let compiler;
128
+ /** @type {boolean | undefined} */
120
129
  let watch = false;
121
130
  /** @type {WatchOptions|WatchOptions[]} */
122
131
  let watchOptions;
@@ -9,6 +9,7 @@ const RuntimeGlobals = require("../RuntimeGlobals");
9
9
  const StartupChunkDependenciesPlugin = require("../runtime/StartupChunkDependenciesPlugin");
10
10
  const ImportScriptsChunkLoadingRuntimeModule = require("./ImportScriptsChunkLoadingRuntimeModule");
11
11
 
12
+ /** @typedef {import("../Chunk")} Chunk */
12
13
  /** @typedef {import("../Compiler")} Compiler */
13
14
 
14
15
  class ImportScriptsChunkLoadingPlugin {
@@ -26,6 +27,10 @@ class ImportScriptsChunkLoadingPlugin {
26
27
  "ImportScriptsChunkLoadingPlugin",
27
28
  compilation => {
28
29
  const globalChunkLoading = compilation.outputOptions.chunkLoading;
30
+ /**
31
+ * @param {Chunk} chunk chunk
32
+ * @returns {boolean} true, if wasm loading is enabled for the chunk
33
+ */
29
34
  const isEnabledForChunk = chunk => {
30
35
  const options = chunk.getEntryOptions();
31
36
  const chunkLoading =
@@ -35,6 +40,10 @@ class ImportScriptsChunkLoadingPlugin {
35
40
  return chunkLoading === "import-scripts";
36
41
  };
37
42
  const onceForChunkSet = new WeakSet();
43
+ /**
44
+ * @param {Chunk} chunk chunk
45
+ * @param {Set<string>} set runtime requirements
46
+ */
38
47
  const handler = (chunk, set) => {
39
48
  if (onceForChunkSet.has(chunk)) return;
40
49
  onceForChunkSet.add(chunk);
@@ -16,8 +16,14 @@ const compileBooleanMatcher = require("../util/compileBooleanMatcher");
16
16
  const { getUndoPath } = require("../util/identifier");
17
17
 
18
18
  /** @typedef {import("../Chunk")} Chunk */
19
+ /** @typedef {import("../ChunkGraph")} ChunkGraph */
20
+ /** @typedef {import("../Compilation")} Compilation */
19
21
 
20
22
  class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
23
+ /**
24
+ * @param {Set<string>} runtimeRequirements runtime requirements
25
+ * @param {boolean} withCreateScriptUrl with createScriptUrl support
26
+ */
21
27
  constructor(runtimeRequirements, withCreateScriptUrl) {
22
28
  super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH);
23
29
  this.runtimeRequirements = runtimeRequirements;
@@ -34,8 +40,9 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
34
40
  if (options && options.baseUri) {
35
41
  return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`;
36
42
  }
37
- const outputName = this.compilation.getPath(
38
- getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
43
+ const compilation = /** @type {Compilation} */ (this.compilation);
44
+ const outputName = compilation.getPath(
45
+ getChunkFilenameTemplate(chunk, compilation.outputOptions),
39
46
  {
40
47
  chunk,
41
48
  contentHashType: "javascript"
@@ -43,7 +50,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
43
50
  );
44
51
  const rootOutputDir = getUndoPath(
45
52
  outputName,
46
- this.compilation.outputOptions.path,
53
+ /** @type {string} */ (compilation.outputOptions.path),
47
54
  false
48
55
  );
49
56
  return `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify(
@@ -52,19 +59,10 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
52
59
  }
53
60
 
54
61
  /**
55
- * @returns {string} runtime code
62
+ * @returns {string | null} runtime code
56
63
  */
57
64
  generate() {
58
- const {
59
- chunk,
60
- chunkGraph,
61
- compilation: {
62
- runtimeTemplate,
63
- outputOptions: { chunkLoadingGlobal, hotUpdateGlobal }
64
- },
65
- _withCreateScriptUrl: withCreateScriptUrl
66
- } = this;
67
- const globalObject = runtimeTemplate.globalObject;
65
+ const compilation = /** @type {Compilation} */ (this.compilation);
68
66
  const fn = RuntimeGlobals.ensureChunkHandlers;
69
67
  const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI);
70
68
  const withLoading = this.runtimeRequirements.has(
@@ -76,9 +74,12 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
76
74
  const withHmrManifest = this.runtimeRequirements.has(
77
75
  RuntimeGlobals.hmrDownloadManifest
78
76
  );
77
+ const globalObject = compilation.runtimeTemplate.globalObject;
79
78
  const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify(
80
- chunkLoadingGlobal
79
+ compilation.outputOptions.chunkLoadingGlobal
81
80
  )}]`;
81
+ const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph);
82
+ const chunk = /** @type {Chunk} */ (this.chunk);
82
83
  const hasJsMatcher = compileBooleanMatcher(
83
84
  chunkGraph.getChunkConditionMap(chunk, chunkHasJs)
84
85
  );
@@ -87,6 +88,8 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
87
88
  const stateExpression = withHmr
88
89
  ? `${RuntimeGlobals.hmrRuntimeStatePrefix}_importScripts`
89
90
  : undefined;
91
+ const runtimeTemplate = compilation.runtimeTemplate;
92
+ const { _withCreateScriptUrl: withCreateScriptUrl } = this;
90
93
 
91
94
  return Template.asString([
92
95
  withBaseURI ? this._generateBaseUri(chunk) : "// no baseURI",
@@ -120,7 +123,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
120
123
  "}"
121
124
  ]),
122
125
  "}",
123
- "if(runtime) runtime(__webpack_require__);",
126
+ `if(runtime) runtime(${RuntimeGlobals.require});`,
124
127
  "while(chunkIds.length)",
125
128
  Template.indent("installedChunks[chunkIds.pop()] = 1;"),
126
129
  "parentChunkLoadingFunction(data);"
@@ -165,7 +168,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
165
168
  Template.indent([
166
169
  "var success = false;",
167
170
  `${globalObject}[${JSON.stringify(
168
- hotUpdateGlobal
171
+ compilation.outputOptions.hotUpdateGlobal
169
172
  )}] = ${runtimeTemplate.basicFunction("_, moreModules, runtime", [
170
173
  "for(var moduleId in moreModules) {",
171
174
  Template.indent([
package/module.d.ts CHANGED
@@ -1,45 +1,55 @@
1
1
  declare namespace webpack {
2
- type HotEvent =
3
- | {
4
- type: "disposed";
5
- /** The module in question. */
6
- moduleId: number;
7
- }
8
- | {
9
- type: "self-declined" | "unaccepted";
10
- /** The module in question. */
11
- moduleId: number;
12
- /** the chain from where the update was propagated. */
13
- chain: number[];
14
- }
2
+ type DeclinedEvent =
15
3
  | {
16
4
  type: "declined";
17
5
  /** The module in question. */
18
- moduleId: number;
6
+ moduleId: number | string;
19
7
  /** the chain from where the update was propagated. */
20
- chain: number[];
8
+ chain: (number | string)[];
21
9
  /** the module id of the declining parent */
22
- parentId: number;
10
+ parentId: number | string;
23
11
  }
24
12
  | {
25
- type: "accepted";
13
+ type: "self-declined";
26
14
  /** The module in question. */
27
- moduleId: number;
15
+ moduleId: number | string;
28
16
  /** the chain from where the update was propagated. */
29
- chain: number[];
30
- /** the modules that are outdated and will be disposed */
31
- outdatedModules: number[];
32
- /** the accepted dependencies that are outdated */
33
- outdatedDependencies: {
34
- [id: number]: number[];
35
- };
36
- }
17
+ chain: (number | string)[];
18
+ };
19
+
20
+ type UnacceptedEvent = {
21
+ type: "unaccepted";
22
+ /** The module in question. */
23
+ moduleId: number | string;
24
+ /** the chain from where the update was propagated. */
25
+ chain: (number | string)[];
26
+ };
27
+
28
+ type AcceptedEvent = {
29
+ type: "accepted";
30
+ /** The module in question. */
31
+ moduleId: number | string;
32
+ /** the modules that are outdated and will be disposed */
33
+ outdatedModules: (number | string)[];
34
+ /** the accepted dependencies that are outdated */
35
+ outdatedDependencies: {
36
+ [id: number]: (number | string)[];
37
+ };
38
+ };
39
+
40
+ type DisposedEvent = {
41
+ type: "disposed";
42
+ /** The module in question. */
43
+ moduleId: number | string;
44
+ };
45
+
46
+ type ErroredEvent =
37
47
  | {
38
48
  type: "accept-error-handler-errored";
39
49
  /** The module in question. */
40
- moduleId: number;
50
+ moduleId: number | string;
41
51
  /** the module id owning the accept handler. */
42
- dependencyId: number;
52
+ dependencyId: number | string;
43
53
  /** the thrown error */
44
54
  error: Error;
45
55
  /** the error thrown by the module before the error handler tried to handle it. */
@@ -48,7 +58,7 @@ declare namespace webpack {
48
58
  | {
49
59
  type: "self-accept-error-handler-errored";
50
60
  /** The module in question. */
51
- moduleId: number;
61
+ moduleId: number | string;
52
62
  /** the thrown error */
53
63
  error: Error;
54
64
  /** the error thrown by the module before the error handler tried to handle it. */
@@ -57,29 +67,36 @@ declare namespace webpack {
57
67
  | {
58
68
  type: "accept-errored";
59
69
  /** The module in question. */
60
- moduleId: number;
70
+ moduleId: number | string;
61
71
  /** the module id owning the accept handler. */
62
- dependencyId: number;
72
+ dependencyId: number | string;
63
73
  /** the thrown error */
64
74
  error: Error;
65
75
  }
66
76
  | {
67
77
  type: "self-accept-errored";
68
78
  /** The module in question. */
69
- moduleId: number;
79
+ moduleId: number | string;
70
80
  /** the thrown error */
71
81
  error: Error;
72
82
  };
73
83
 
84
+ type HotEvent =
85
+ | DeclinedEvent
86
+ | UnacceptedEvent
87
+ | AcceptedEvent
88
+ | DisposedEvent
89
+ | ErroredEvent;
90
+
74
91
  interface ApplyOptions {
75
92
  ignoreUnaccepted?: boolean;
76
93
  ignoreDeclined?: boolean;
77
94
  ignoreErrored?: boolean;
78
- onDeclined?(callback: (info: HotEvent) => void): void;
79
- onUnaccepted?(callback: (info: HotEvent) => void): void;
80
- onAccepted?(callback: (info: HotEvent) => void): void;
81
- onDisposed?(callback: (info: HotEvent) => void): void;
82
- onErrored?(callback: (info: HotEvent) => void): void;
95
+ onDeclined?: (event: DeclinedEvent) => void;
96
+ onUnaccepted?: (event: UnacceptedEvent) => void;
97
+ onAccepted?: (event: AcceptedEvent) => void;
98
+ onDisposed?: (event: DisposedEvent) => void;
99
+ onErrored?: (event: ErroredEvent) => void;
83
100
  }
84
101
 
85
102
  const enum HotUpdateStatus {
@@ -157,6 +174,7 @@ interface ImportMeta {
157
174
  exclude?: RegExp;
158
175
  preload?: boolean | number;
159
176
  prefetch?: boolean | number;
177
+ fetchPriority?: "low" | "high" | "auto";
160
178
  chunkName?: string;
161
179
  exports?: string | string[][];
162
180
  mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.76.1",
3
+ "version": "5.88.2",
4
4
  "author": "Tobias Koppers @sokra",
5
- "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
5
+ "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@types/eslint-scope": "^3.7.3",
9
- "@types/estree": "^0.0.51",
10
- "@webassemblyjs/ast": "1.11.1",
11
- "@webassemblyjs/wasm-edit": "1.11.1",
12
- "@webassemblyjs/wasm-parser": "1.11.1",
9
+ "@types/estree": "^1.0.0",
10
+ "@webassemblyjs/ast": "^1.11.5",
11
+ "@webassemblyjs/wasm-edit": "^1.11.5",
12
+ "@webassemblyjs/wasm-parser": "^1.11.5",
13
13
  "acorn": "^8.7.1",
14
- "acorn-import-assertions": "^1.7.6",
14
+ "acorn-import-assertions": "^1.9.0",
15
15
  "browserslist": "^4.14.5",
16
16
  "chrome-trace-event": "^1.0.2",
17
- "enhanced-resolve": "^5.10.0",
18
- "es-module-lexer": "^0.9.0",
17
+ "enhanced-resolve": "^5.15.0",
18
+ "es-module-lexer": "^1.2.1",
19
19
  "eslint-scope": "5.1.1",
20
20
  "events": "^3.2.0",
21
21
  "glob-to-regexp": "^0.4.1",
@@ -24,9 +24,9 @@
24
24
  "loader-runner": "^4.2.0",
25
25
  "mime-types": "^2.1.27",
26
26
  "neo-async": "^2.6.2",
27
- "schema-utils": "^3.1.0",
27
+ "schema-utils": "^3.2.0",
28
28
  "tapable": "^2.1.1",
29
- "terser-webpack-plugin": "^5.1.3",
29
+ "terser-webpack-plugin": "^5.3.7",
30
30
  "watchpack": "^2.4.0",
31
31
  "webpack-sources": "^3.2.3"
32
32
  },
@@ -36,12 +36,12 @@
36
36
  }
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "^7.11.1",
40
- "@babel/preset-react": "^7.10.4",
41
- "@types/es-module-lexer": "^0.4.1",
42
- "@types/jest": "^27.4.0",
43
- "@types/node": "^17.0.16",
44
- "assemblyscript": "^0.19.16",
39
+ "@babel/core": "^7.21.4",
40
+ "@babel/preset-react": "^7.18.6",
41
+ "@types/jest": "^29.5.0",
42
+ "@types/mime-types": "^2.1.1",
43
+ "@types/node": "^20.1.7",
44
+ "assemblyscript": "^0.27.2",
45
45
  "babel-loader": "^8.1.0",
46
46
  "benchmark": "^2.1.4",
47
47
  "bundle-loader": "^0.5.6",
@@ -49,65 +49,65 @@
49
49
  "coffeescript": "^2.5.1",
50
50
  "core-js": "^3.6.5",
51
51
  "coveralls": "^3.1.0",
52
- "cspell": "^4.0.63",
52
+ "cspell": "^6.31.1",
53
53
  "css-loader": "^5.0.1",
54
54
  "date-fns": "^2.15.0",
55
55
  "es5-ext": "^0.10.53",
56
56
  "es6-promise-polyfill": "^1.2.0",
57
- "eslint": "^7.14.0",
57
+ "eslint": "^8.38.0",
58
58
  "eslint-config-prettier": "^8.1.0",
59
- "eslint-plugin-jest": "^24.7.0",
60
- "eslint-plugin-jsdoc": "^33.0.0",
59
+ "eslint-plugin-jest": "^27.2.1",
60
+ "eslint-plugin-jsdoc": "^43.0.5",
61
61
  "eslint-plugin-node": "^11.0.0",
62
- "eslint-plugin-prettier": "^4.0.0",
62
+ "eslint-plugin-prettier": "^4.2.1",
63
63
  "file-loader": "^6.0.0",
64
- "fork-ts-checker-webpack-plugin": "^6.0.5",
64
+ "fork-ts-checker-webpack-plugin": "^8.0.0",
65
65
  "hash-wasm": "^4.9.0",
66
- "husky": "^6.0.0",
66
+ "husky": "^8.0.3",
67
67
  "is-ci": "^3.0.0",
68
68
  "istanbul": "^0.4.5",
69
- "jest": "^27.5.0",
70
- "jest-circus": "^27.5.0",
71
- "jest-cli": "^27.5.0",
72
- "jest-diff": "^27.5.0",
73
- "jest-junit": "^13.0.0",
69
+ "jest": "^29.5.0",
70
+ "jest-circus": "^29.5.0",
71
+ "jest-cli": "^29.5.0",
72
+ "jest-diff": "^29.5.0",
73
+ "jest-environment-node": "^29.5.0",
74
+ "jest-junit": "^16.0.0",
74
75
  "json-loader": "^0.5.7",
75
76
  "json5": "^2.1.3",
76
77
  "less": "^4.0.0",
77
78
  "less-loader": "^8.0.0",
78
- "lint-staged": "^11.0.0",
79
- "loader-utils": "^2.0.3",
79
+ "lint-staged": "^13.2.1",
80
80
  "lodash": "^4.17.19",
81
81
  "lodash-es": "^4.17.15",
82
- "memfs": "^3.2.0",
82
+ "memfs": "^3.5.0",
83
83
  "mini-css-extract-plugin": "^1.6.1",
84
84
  "mini-svg-data-uri": "^1.2.3",
85
85
  "nyc": "^15.1.0",
86
- "open-cli": "^6.0.1",
86
+ "open-cli": "^7.2.0",
87
87
  "prettier": "^2.7.1",
88
- "pretty-format": "^27.0.2",
88
+ "pretty-format": "^29.5.0",
89
89
  "pug": "^3.0.0",
90
90
  "pug-loader": "^2.4.0",
91
91
  "raw-loader": "^4.0.1",
92
- "react": "^17.0.1",
93
- "react-dom": "^17.0.1",
92
+ "react": "^18.2.0",
93
+ "react-dom": "^18.2.0",
94
94
  "rimraf": "^3.0.2",
95
95
  "script-loader": "^0.7.2",
96
- "simple-git": "^2.17.0",
96
+ "simple-git": "^3.17.0",
97
97
  "strip-ansi": "^6.0.0",
98
98
  "style-loader": "^2.0.0",
99
- "terser": "^5.7.0",
99
+ "terser": "^5.17.0",
100
100
  "toml": "^3.0.0",
101
- "tooling": "webpack/tooling#v1.22.0",
102
- "ts-loader": "^8.0.2",
103
- "typescript": "^4.8.4",
101
+ "tooling": "webpack/tooling#v1.23.0",
102
+ "ts-loader": "^9.4.2",
103
+ "typescript": "^5.0.4",
104
104
  "url-loader": "^4.1.0",
105
- "wast-loader": "^1.11.0",
105
+ "wast-loader": "^1.11.5",
106
106
  "webassembly-feature": "1.3.0",
107
- "webpack-cli": "^4.3.0",
107
+ "webpack-cli": "^5.0.1",
108
108
  "xxhashjs": "^0.2.2",
109
109
  "yamljs": "^0.3.0",
110
- "yarn-deduplicate": "^3.1.0"
110
+ "yarn-deduplicate": "^6.0.1"
111
111
  },
112
112
  "engines": {
113
113
  "node": ">=10.13.0"
@@ -149,18 +149,17 @@
149
149
  "pretest": "yarn lint",
150
150
  "prelint": "yarn setup",
151
151
  "lint": "yarn code-lint && yarn special-lint && yarn type-lint && yarn typings-test && yarn module-typings-test && yarn yarn-lint && yarn pretty-lint && yarn spellcheck",
152
- "code-lint": "eslint . --ext '.js' --cache",
152
+ "code-lint": "eslint --cache .",
153
153
  "type-lint": "tsc",
154
154
  "typings-test": "tsc -p tsconfig.types.test.json",
155
155
  "module-typings-test": "tsc -p tsconfig.module.test.json",
156
- "spellcheck": "cspell \"**/*\"",
156
+ "spellcheck": "cspell --no-progress \"**\"",
157
157
  "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals",
158
158
  "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write",
159
159
  "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
160
160
  "prepare": "husky install",
161
- "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"",
162
- "pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"module.d.ts\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
163
- "pretty-lint-fix": "yarn pretty-lint-base-all --loglevel warn --write",
161
+ "pretty-lint-base": "prettier --cache .",
162
+ "pretty-lint-fix": "yarn pretty-lint-base --loglevel warn --write",
164
163
  "pretty-lint": "yarn pretty-lint-base --check",
165
164
  "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock",
166
165
  "yarn-lint-fix": "yarn-deduplicate -s highest yarn.lock",
@@ -175,14 +174,14 @@
175
174
  "cover:unit": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
176
175
  "cover:types": "node node_modules/tooling/type-coverage",
177
176
  "cover:merge": "yarn mkdirp .nyc_output && nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output",
178
- "cover:report": "nyc report -t coverage"
177
+ "cover:report": "nyc report --reporter=lcov --reporter=text -t coverage"
179
178
  },
180
179
  "lint-staged": {
181
- "*.js|{lib,setup,bin,hot,tooling,schemas}/**/*.js|test/*.js|{test,examples}/**/webpack.config.js}": [
182
- "eslint --cache"
180
+ "*.{js,cjs,mjs}": [
181
+ "eslint --cache --fix"
183
182
  ],
184
- "*.{ts,json,yml,yaml,md}|examples/*.md": [
185
- "prettier --check"
183
+ "*": [
184
+ "prettier --cache --ignore-unknown"
186
185
  ],
187
186
  "*.md|{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}": [
188
187
  "cspell"
@@ -235,9 +234,13 @@
235
234
  "<rootDir>/schemas",
236
235
  "<rootDir>/node_modules"
237
236
  ],
238
- "testEnvironment": "node",
237
+ "testEnvironment": "./test/patch-node-env.js",
239
238
  "coverageReporters": [
240
239
  "json"
241
- ]
240
+ ],
241
+ "snapshotFormat": {
242
+ "escapeString": true,
243
+ "printBasicPrototype": true
244
+ }
242
245
  }
243
246
  }