webpack 5.100.2 → 5.101.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 (309) hide show
  1. package/README.md +12 -10
  2. package/bin/webpack.js +7 -7
  3. package/lib/APIPlugin.js +12 -14
  4. package/lib/AutomaticPrefetchPlugin.js +2 -2
  5. package/lib/BannerPlugin.js +4 -4
  6. package/lib/Cache.js +1 -1
  7. package/lib/CacheFacade.js +7 -7
  8. package/lib/CaseSensitiveModulesWarning.js +2 -2
  9. package/lib/Chunk.js +3 -3
  10. package/lib/ChunkGraph.js +63 -18
  11. package/lib/ChunkGroup.js +4 -4
  12. package/lib/CleanPlugin.js +19 -53
  13. package/lib/CodeGenerationResults.js +3 -3
  14. package/lib/CompatibilityPlugin.js +6 -6
  15. package/lib/Compilation.js +168 -116
  16. package/lib/Compiler.js +37 -37
  17. package/lib/ConcatenationScope.js +39 -1
  18. package/lib/ConstPlugin.js +11 -11
  19. package/lib/ContextExclusionPlugin.js +3 -3
  20. package/lib/ContextModule.js +12 -11
  21. package/lib/ContextModuleFactory.js +11 -11
  22. package/lib/ContextReplacementPlugin.js +5 -5
  23. package/lib/DefinePlugin.js +24 -22
  24. package/lib/DelegatedModuleFactoryPlugin.js +1 -1
  25. package/lib/Dependency.js +2 -1
  26. package/lib/DllEntryPlugin.js +1 -1
  27. package/lib/DllReferencePlugin.js +1 -1
  28. package/lib/DynamicEntryPlugin.js +3 -3
  29. package/lib/EntryPlugin.js +1 -1
  30. package/lib/EnvironmentPlugin.js +1 -1
  31. package/lib/ErrorHelpers.js +2 -2
  32. package/lib/EvalDevToolModulePlugin.js +2 -2
  33. package/lib/EvalSourceMapDevToolPlugin.js +5 -5
  34. package/lib/ExportsInfo.js +9 -9
  35. package/lib/ExportsInfoApiPlugin.js +2 -2
  36. package/lib/ExternalModule.js +163 -48
  37. package/lib/ExternalModuleFactoryPlugin.js +2 -2
  38. package/lib/ExternalsPlugin.js +45 -0
  39. package/lib/FileSystemInfo.js +64 -61
  40. package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
  41. package/lib/FlagDependencyExportsPlugin.js +7 -7
  42. package/lib/FlagDependencyUsagePlugin.js +4 -4
  43. package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
  44. package/lib/HotModuleReplacementPlugin.js +27 -27
  45. package/lib/IgnorePlugin.js +3 -3
  46. package/lib/IgnoreWarningsPlugin.js +4 -4
  47. package/lib/InitFragment.js +6 -0
  48. package/lib/InvalidDependenciesModuleWarning.js +1 -1
  49. package/lib/JavascriptMetaInfoPlugin.js +1 -1
  50. package/lib/LibManifestPlugin.js +2 -2
  51. package/lib/LoaderOptionsPlugin.js +1 -1
  52. package/lib/LoaderTargetPlugin.js +2 -2
  53. package/lib/MainTemplate.js +1 -1
  54. package/lib/Module.js +3 -2
  55. package/lib/ModuleFilenameHelpers.js +3 -3
  56. package/lib/ModuleGraph.js +23 -38
  57. package/lib/ModuleInfoHeaderPlugin.js +3 -3
  58. package/lib/ModuleParseError.js +5 -3
  59. package/lib/ModuleTemplate.js +3 -2
  60. package/lib/MultiCompiler.js +29 -24
  61. package/lib/MultiStats.js +18 -13
  62. package/lib/MultiWatching.js +1 -1
  63. package/lib/NoEmitOnErrorsPlugin.js +2 -2
  64. package/lib/NodeStuffPlugin.js +27 -15
  65. package/lib/NormalModule.js +23 -23
  66. package/lib/NormalModuleFactory.js +23 -21
  67. package/lib/NormalModuleReplacementPlugin.js +3 -3
  68. package/lib/PrefetchPlugin.js +1 -1
  69. package/lib/ProgressPlugin.js +11 -11
  70. package/lib/ProvidePlugin.js +2 -2
  71. package/lib/RecordIdsPlugin.js +3 -3
  72. package/lib/ResolverFactory.js +3 -3
  73. package/lib/RuntimeGlobals.js +20 -0
  74. package/lib/RuntimePlugin.js +16 -16
  75. package/lib/RuntimeTemplate.js +35 -26
  76. package/lib/SizeFormatHelpers.js +1 -1
  77. package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
  78. package/lib/SourceMapDevToolPlugin.js +9 -9
  79. package/lib/Stats.js +2 -2
  80. package/lib/Template.js +1 -1
  81. package/lib/TemplatedPathPlugin.js +2 -2
  82. package/lib/UseStrictPlugin.js +1 -1
  83. package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
  84. package/lib/WarnDeprecatedOptionPlugin.js +1 -1
  85. package/lib/WarnNoModeSetPlugin.js +1 -1
  86. package/lib/WatchIgnorePlugin.js +2 -2
  87. package/lib/Watching.js +12 -14
  88. package/lib/WebpackIsIncludedPlugin.js +2 -2
  89. package/lib/WebpackOptionsApply.js +3 -3
  90. package/lib/asset/AssetGenerator.js +1 -1
  91. package/lib/asset/AssetModulesPlugin.js +6 -6
  92. package/lib/async-modules/AsyncModuleHelpers.js +1 -1
  93. package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
  94. package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
  95. package/lib/buildChunkGraph.js +5 -5
  96. package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
  97. package/lib/cache/IdleFileCachePlugin.js +5 -5
  98. package/lib/cache/PackFileCacheStrategy.js +20 -20
  99. package/lib/cache/ResolverCachePlugin.js +4 -4
  100. package/lib/cli.js +196 -14
  101. package/lib/config/browserslistTargetHandler.js +6 -6
  102. package/lib/config/defaults.js +23 -14
  103. package/lib/config/normalization.js +41 -38
  104. package/lib/config/target.js +4 -4
  105. package/lib/container/ContainerEntryModule.js +3 -3
  106. package/lib/container/ContainerPlugin.js +3 -3
  107. package/lib/container/ContainerReferencePlugin.js +3 -3
  108. package/lib/container/FallbackModule.js +1 -1
  109. package/lib/container/HoistContainerReferencesPlugin.js +7 -7
  110. package/lib/container/options.js +4 -4
  111. package/lib/css/CssGenerator.js +5 -3
  112. package/lib/css/CssLoadingRuntimeModule.js +1 -1
  113. package/lib/css/CssModulesPlugin.js +25 -22
  114. package/lib/css/CssParser.js +5 -5
  115. package/lib/css/walkCssTokens.js +9 -9
  116. package/lib/debug/ProfilingPlugin.js +5 -5
  117. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
  118. package/lib/dependencies/AMDPlugin.js +3 -3
  119. package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
  120. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
  121. package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
  122. package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
  123. package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
  124. package/lib/dependencies/CommonJsPlugin.js +2 -2
  125. package/lib/dependencies/ContextDependency.js +1 -1
  126. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  127. package/lib/dependencies/CssIcssExportDependency.js +2 -2
  128. package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
  129. package/lib/dependencies/CssUrlDependency.js +4 -4
  130. package/lib/dependencies/DynamicExports.js +5 -5
  131. package/lib/dependencies/HarmonyAcceptDependency.js +91 -5
  132. package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
  133. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
  134. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
  135. package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
  136. package/lib/dependencies/HarmonyExports.js +1 -1
  137. package/lib/dependencies/HarmonyImportDependency.js +28 -9
  138. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
  139. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
  140. package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
  141. package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
  142. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
  143. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
  144. package/lib/dependencies/ImportMetaPlugin.js +7 -7
  145. package/lib/dependencies/ImportParserPlugin.js +4 -4
  146. package/lib/dependencies/JsonExportsDependency.js +7 -2
  147. package/lib/dependencies/LoaderPlugin.js +4 -4
  148. package/lib/dependencies/ModuleDependency.js +2 -1
  149. package/lib/dependencies/ProvidedDependency.js +2 -2
  150. package/lib/dependencies/PureExpressionDependency.js +1 -1
  151. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  152. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
  153. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
  154. package/lib/dependencies/SystemPlugin.js +3 -3
  155. package/lib/dependencies/WorkerPlugin.js +5 -5
  156. package/lib/dependencies/getFunctionExpression.js +1 -1
  157. package/lib/esm/ExportWebpackRequireRuntimeModule.js +8 -1
  158. package/lib/esm/ModuleChunkFormatPlugin.js +35 -69
  159. package/lib/esm/ModuleChunkLoadingPlugin.js +3 -6
  160. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
  161. package/lib/formatLocation.js +2 -2
  162. package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
  163. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
  164. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
  165. package/lib/hmr/LazyCompilationPlugin.js +6 -6
  166. package/lib/hmr/lazyCompilationBackend.js +6 -6
  167. package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
  168. package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
  169. package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
  170. package/lib/ids/HashedModuleIdsPlugin.js +1 -1
  171. package/lib/ids/IdHelpers.js +9 -9
  172. package/lib/ids/NamedChunkIdsPlugin.js +5 -5
  173. package/lib/ids/NamedModuleIdsPlugin.js +2 -2
  174. package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
  175. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  176. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
  177. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
  178. package/lib/ids/SyncModuleIdsPlugin.js +4 -4
  179. package/lib/index.js +18 -6
  180. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
  181. package/lib/javascript/BasicEvaluatedExpression.js +3 -3
  182. package/lib/javascript/ChunkFormatHelpers.js +70 -0
  183. package/lib/javascript/CommonJsChunkFormatPlugin.js +10 -21
  184. package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
  185. package/lib/javascript/JavascriptGenerator.js +1 -1
  186. package/lib/javascript/JavascriptModulesPlugin.js +108 -54
  187. package/lib/javascript/JavascriptParser.js +80 -78
  188. package/lib/javascript/JavascriptParserHelpers.js +3 -3
  189. package/lib/javascript/StartupHelpers.js +2 -2
  190. package/lib/json/JsonGenerator.js +2 -2
  191. package/lib/json/JsonModulesPlugin.js +2 -2
  192. package/lib/library/AbstractLibraryPlugin.js +30 -3
  193. package/lib/library/AmdLibraryPlugin.js +3 -3
  194. package/lib/library/AssignLibraryPlugin.js +2 -2
  195. package/lib/library/EnableLibraryPlugin.js +2 -2
  196. package/lib/library/ModuleLibraryPlugin.js +49 -31
  197. package/lib/library/SystemLibraryPlugin.js +6 -4
  198. package/lib/library/UmdLibraryPlugin.js +14 -14
  199. package/lib/logging/createConsoleLogger.js +4 -4
  200. package/lib/logging/runtime.js +3 -3
  201. package/lib/logging/truncateArgs.js +4 -4
  202. package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
  203. package/lib/node/NodeEnvironmentPlugin.js +1 -1
  204. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
  205. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
  206. package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
  207. package/lib/node/RequireChunkLoadingRuntimeModule.js +13 -6
  208. package/lib/node/nodeConsole.js +2 -2
  209. package/lib/optimize/AggressiveMergingPlugin.js +2 -2
  210. package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
  211. package/lib/optimize/ConcatenatedModule.js +186 -77
  212. package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
  213. package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
  214. package/lib/optimize/InnerGraph.js +5 -5
  215. package/lib/optimize/InnerGraphPlugin.js +14 -12
  216. package/lib/optimize/LimitChunkCountPlugin.js +5 -5
  217. package/lib/optimize/MangleExportsPlugin.js +5 -5
  218. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
  219. package/lib/optimize/MinChunkSizePlugin.js +3 -3
  220. package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
  221. package/lib/optimize/RealContentHashPlugin.js +23 -23
  222. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
  223. package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
  224. package/lib/optimize/RuntimeChunkPlugin.js +2 -2
  225. package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
  226. package/lib/optimize/SplitChunksPlugin.js +20 -20
  227. package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
  228. package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
  229. package/lib/performance/SizeLimitsPlugin.js +4 -4
  230. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
  231. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
  232. package/lib/rules/BasicMatcherRulePlugin.js +1 -1
  233. package/lib/rules/RuleSetCompiler.js +10 -10
  234. package/lib/rules/UseEffectRulePlugin.js +2 -2
  235. package/lib/runtime/GetChunkFilenameRuntimeModule.js +19 -15
  236. package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
  237. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
  238. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
  239. package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
  240. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
  241. package/lib/schemes/DataUriPlugin.js +3 -3
  242. package/lib/schemes/FileUriPlugin.js +1 -1
  243. package/lib/schemes/HttpUriPlugin.js +40 -36
  244. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  245. package/lib/serialization/BinaryMiddleware.js +11 -11
  246. package/lib/serialization/FileMiddleware.js +18 -17
  247. package/lib/serialization/ObjectMiddleware.js +8 -8
  248. package/lib/serialization/Serializer.js +2 -2
  249. package/lib/serialization/SerializerMiddleware.js +2 -2
  250. package/lib/sharing/ConsumeSharedPlugin.js +4 -4
  251. package/lib/sharing/ProvideSharedPlugin.js +4 -4
  252. package/lib/sharing/SharePlugin.js +1 -1
  253. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  254. package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
  255. package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
  256. package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
  257. package/lib/stats/StatsFactory.js +7 -7
  258. package/lib/stats/StatsPrinter.js +9 -9
  259. package/lib/url/URLParserPlugin.js +5 -5
  260. package/lib/util/AsyncQueue.js +4 -4
  261. package/lib/util/IterableHelpers.js +2 -2
  262. package/lib/util/LazyBucketSortedSet.js +3 -3
  263. package/lib/util/SetHelpers.js +2 -2
  264. package/lib/util/StackedCacheMap.js +1 -1
  265. package/lib/util/StackedMap.js +1 -1
  266. package/lib/util/TupleSet.js +1 -1
  267. package/lib/util/WeakTupleMap.js +1 -1
  268. package/lib/util/cleverMerge.js +8 -8
  269. package/lib/util/comparators.js +10 -10
  270. package/lib/util/compileBooleanMatcher.js +20 -20
  271. package/lib/util/concatenate.js +3 -3
  272. package/lib/util/conventions.js +4 -4
  273. package/lib/util/create-schema-validation.js +1 -1
  274. package/lib/util/createHash.js +1 -1
  275. package/lib/util/deprecation.js +4 -4
  276. package/lib/util/deterministicGrouping.js +7 -7
  277. package/lib/util/findGraphRoots.js +1 -1
  278. package/lib/util/fs.js +4 -4
  279. package/lib/util/identifier.js +14 -14
  280. package/lib/util/magicComment.js +5 -1
  281. package/lib/util/memoize.js +1 -1
  282. package/lib/util/processAsyncTree.js +2 -2
  283. package/lib/util/propertyName.js +1 -1
  284. package/lib/util/removeBOM.js +1 -1
  285. package/lib/util/runtime.js +6 -6
  286. package/lib/util/semver.js +16 -16
  287. package/lib/util/serialization.js +5 -5
  288. package/lib/util/smartGrouping.js +1 -1
  289. package/lib/validateSchema.js +2 -2
  290. package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
  291. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
  292. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
  293. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
  294. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
  295. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
  296. package/lib/wasm-sync/WebAssemblyGenerator.js +16 -17
  297. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
  298. package/lib/wasm-sync/WebAssemblyParser.js +2 -2
  299. package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
  300. package/lib/web/FetchCompileWasmPlugin.js +4 -4
  301. package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
  302. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
  303. package/lib/webpack.js +17 -12
  304. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
  305. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  306. package/package.json +16 -16
  307. package/schemas/WebpackOptions.check.js +1 -1
  308. package/schemas/WebpackOptions.json +4 -0
  309. package/types.d.ts +275 -64
@@ -118,7 +118,7 @@ const ALLOWED_MEMBER_TYPES_ALL = 0b11;
118
118
  const LEGACY_ASSERT_ATTRIBUTES = Symbol("assert");
119
119
 
120
120
  /** @type {(BaseParser: typeof AcornParser) => typeof AcornParser} */
121
- const importAssertions = Parser =>
121
+ const importAssertions = (Parser) =>
122
122
  class extends Parser {
123
123
  /**
124
124
  * @this {InstanceType<AcornParser>}
@@ -189,7 +189,7 @@ let parser = AcornParser.extend(importAssertions);
189
189
  * @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions
190
190
  * @returns {ImportAttributes | undefined} import attributes
191
191
  */
192
- const getImportAttributes = node => {
192
+ const getImportAttributes = (node) => {
193
193
  if (node.type === "ImportExpression") {
194
194
  if (
195
195
  node.options &&
@@ -361,7 +361,7 @@ const objectAndMembersToName = (object, membersReversed) => {
361
361
  * @param {Expression | SpreadElement | Super} expression expression
362
362
  * @returns {string | "this" | undefined} name or variable info
363
363
  */
364
- const getRootName = expression => {
364
+ const getRootName = (expression) => {
365
365
  switch (expression.type) {
366
366
  case "Identifier":
367
367
  return expression.name;
@@ -607,7 +607,7 @@ class JavascriptParser extends Parser {
607
607
  }
608
608
 
609
609
  _initializeEvaluating() {
610
- this.hooks.evaluate.for("Literal").tap(CLASS_NAME, _expr => {
610
+ this.hooks.evaluate.for("Literal").tap(CLASS_NAME, (_expr) => {
611
611
  const expr = /** @type {Literal} */ (_expr);
612
612
 
613
613
  switch (typeof expr.value) {
@@ -639,7 +639,7 @@ class JavascriptParser extends Parser {
639
639
  .setRange(/** @type {Range} */ (expr.range));
640
640
  }
641
641
  });
642
- this.hooks.evaluate.for("NewExpression").tap(CLASS_NAME, _expr => {
642
+ this.hooks.evaluate.for("NewExpression").tap(CLASS_NAME, (_expr) => {
643
643
  const expr = /** @type {NewExpression} */ (_expr);
644
644
  const callee = expr.callee;
645
645
  if (callee.type !== "Identifier") return;
@@ -704,7 +704,7 @@ class JavascriptParser extends Parser {
704
704
  .setRegExp(flags ? new RegExp(regExp, flags) : new RegExp(regExp))
705
705
  .setRange(/** @type {Range} */ (expr.range));
706
706
  });
707
- this.hooks.evaluate.for("LogicalExpression").tap(CLASS_NAME, _expr => {
707
+ this.hooks.evaluate.for("LogicalExpression").tap(CLASS_NAME, (_expr) => {
708
708
  const expr = /** @type {LogicalExpression} */ (_expr);
709
709
 
710
710
  const left = this.evaluateExpression(expr.left);
@@ -822,7 +822,7 @@ class JavascriptParser extends Parser {
822
822
  }
823
823
  };
824
824
 
825
- this.hooks.evaluate.for("BinaryExpression").tap(CLASS_NAME, _expr => {
825
+ this.hooks.evaluate.for("BinaryExpression").tap(CLASS_NAME, (_expr) => {
826
826
  const expr = /** @type {BinaryExpression} */ (_expr);
827
827
 
828
828
  /**
@@ -831,7 +831,7 @@ class JavascriptParser extends Parser {
831
831
  * @param {(leftOperand: T, rightOperand: T) => boolean | number | bigint | string} operandHandler the handler for the operation (e.g. (a, b) => a + b)
832
832
  * @returns {BasicEvaluatedExpression | undefined} the evaluated expression
833
833
  */
834
- const handleConstOperation = operandHandler => {
834
+ const handleConstOperation = (operandHandler) => {
835
835
  const left = this.evaluateExpression(expr.left);
836
836
  if (!left.isCompileTimeValue()) return;
837
837
 
@@ -871,7 +871,7 @@ class JavascriptParser extends Parser {
871
871
  * @param {BasicEvaluatedExpression[]} parts parts
872
872
  * @returns {string} value
873
873
  */
874
- const getPrefix = parts => {
874
+ const getPrefix = (parts) => {
875
875
  let value = "";
876
876
  for (const p of parts) {
877
877
  const v = p.asString();
@@ -884,7 +884,7 @@ class JavascriptParser extends Parser {
884
884
  * @param {BasicEvaluatedExpression[]} parts parts
885
885
  * @returns {string} value
886
886
  */
887
- const getSuffix = parts => {
887
+ const getSuffix = (parts) => {
888
888
  let value = "";
889
889
  for (let i = parts.length - 1; i >= 0; i--) {
890
890
  const v = parts[i].asString();
@@ -927,7 +927,7 @@ class JavascriptParser extends Parser {
927
927
  * @param {boolean} eql true for "===" and false for "!=="
928
928
  * @returns {BasicEvaluatedExpression | undefined} the evaluated expression
929
929
  */
930
- const handleStrictEqualityComparison = eql => {
930
+ const handleStrictEqualityComparison = (eql) => {
931
931
  const left = this.evaluateExpression(expr.left);
932
932
  const right = this.evaluateExpression(expr.right);
933
933
  const res = new BasicEvaluatedExpression();
@@ -989,7 +989,7 @@ class JavascriptParser extends Parser {
989
989
  * @param {boolean} eql true for "==" and false for "!="
990
990
  * @returns {BasicEvaluatedExpression | undefined} the evaluated expression
991
991
  */
992
- const handleAbstractEqualityComparison = eql => {
992
+ const handleAbstractEqualityComparison = (eql) => {
993
993
  const left = this.evaluateExpression(expr.left);
994
994
  const right = this.evaluateExpression(expr.right);
995
995
  const res = new BasicEvaluatedExpression();
@@ -1225,7 +1225,7 @@ class JavascriptParser extends Parser {
1225
1225
  return handleConstOperation((l, r) => l >= r);
1226
1226
  }
1227
1227
  });
1228
- this.hooks.evaluate.for("UnaryExpression").tap(CLASS_NAME, _expr => {
1228
+ this.hooks.evaluate.for("UnaryExpression").tap(CLASS_NAME, (_expr) => {
1229
1229
  const expr = /** @type {UnaryExpression} */ (_expr);
1230
1230
 
1231
1231
  /**
@@ -1234,7 +1234,7 @@ class JavascriptParser extends Parser {
1234
1234
  * @param {(operand: T) => boolean | number | bigint | string} operandHandler handler for the operand
1235
1235
  * @returns {BasicEvaluatedExpression | undefined} evaluated expression
1236
1236
  */
1237
- const handleConstOperation = operandHandler => {
1237
+ const handleConstOperation = (operandHandler) => {
1238
1238
  const argument = this.evaluateExpression(expr.argument);
1239
1239
  if (!argument.isCompileTimeValue()) return;
1240
1240
  const result = operandHandler(
@@ -1341,22 +1341,22 @@ class JavascriptParser extends Parser {
1341
1341
  .setSideEffects(argument.couldHaveSideEffects())
1342
1342
  .setRange(/** @type {Range} */ (expr.range));
1343
1343
  } else if (expr.operator === "~") {
1344
- return handleConstOperation(v => ~v);
1344
+ return handleConstOperation((v) => ~v);
1345
1345
  } else if (expr.operator === "+") {
1346
1346
  // eslint-disable-next-line no-implicit-coercion
1347
- return handleConstOperation(v => +v);
1347
+ return handleConstOperation((v) => +v);
1348
1348
  } else if (expr.operator === "-") {
1349
- return handleConstOperation(v => -v);
1349
+ return handleConstOperation((v) => -v);
1350
1350
  }
1351
1351
  });
1352
1352
  this.hooks.evaluateTypeof
1353
1353
  .for("undefined")
1354
- .tap(CLASS_NAME, expr =>
1354
+ .tap(CLASS_NAME, (expr) =>
1355
1355
  new BasicEvaluatedExpression()
1356
1356
  .setString("undefined")
1357
1357
  .setRange(/** @type {Range} */ (expr.range))
1358
1358
  );
1359
- this.hooks.evaluate.for("Identifier").tap(CLASS_NAME, expr => {
1359
+ this.hooks.evaluate.for("Identifier").tap(CLASS_NAME, (expr) => {
1360
1360
  if (/** @type {Identifier} */ (expr).name === "undefined") {
1361
1361
  return new BasicEvaluatedExpression()
1362
1362
  .setUndefined()
@@ -1373,7 +1373,7 @@ class JavascriptParser extends Parser {
1373
1373
  let cachedExpression;
1374
1374
  /** @type {GetInfoResult | undefined} */
1375
1375
  let cachedInfo;
1376
- this.hooks.evaluate.for(exprType).tap(CLASS_NAME, expr => {
1376
+ this.hooks.evaluate.for(exprType).tap(CLASS_NAME, (expr) => {
1377
1377
  const expression =
1378
1378
  /** @type {Identifier | ThisExpression | MemberExpression} */ (expr);
1379
1379
 
@@ -1382,12 +1382,12 @@ class JavascriptParser extends Parser {
1382
1382
  return this.callHooksForInfoWithFallback(
1383
1383
  this.hooks.evaluateIdentifier,
1384
1384
  info.name,
1385
- _name => {
1385
+ (_name) => {
1386
1386
  cachedExpression = expression;
1387
1387
  cachedInfo = info;
1388
1388
  return undefined;
1389
1389
  },
1390
- name => {
1390
+ (name) => {
1391
1391
  const hook = this.hooks.evaluateDefinedIdentifier.get(name);
1392
1392
  if (hook !== undefined) {
1393
1393
  return hook.call(expression);
@@ -1399,7 +1399,7 @@ class JavascriptParser extends Parser {
1399
1399
  });
1400
1400
  this.hooks.evaluate
1401
1401
  .for(exprType)
1402
- .tap({ name: CLASS_NAME, stage: 100 }, expr => {
1402
+ .tap({ name: CLASS_NAME, stage: 100 }, (expr) => {
1403
1403
  const expression =
1404
1404
  /** @type {Identifier | ThisExpression | MemberExpression} */
1405
1405
  (expr);
@@ -1422,7 +1422,7 @@ class JavascriptParser extends Parser {
1422
1422
  cachedExpression = cachedInfo = undefined;
1423
1423
  });
1424
1424
  };
1425
- tapEvaluateWithVariableInfo("Identifier", expr => {
1425
+ tapEvaluateWithVariableInfo("Identifier", (expr) => {
1426
1426
  const info = this.getVariableInfo(/** @type {Identifier} */ (expr).name);
1427
1427
  if (
1428
1428
  typeof info === "string" ||
@@ -1437,7 +1437,7 @@ class JavascriptParser extends Parser {
1437
1437
  };
1438
1438
  }
1439
1439
  });
1440
- tapEvaluateWithVariableInfo("ThisExpression", _expr => {
1440
+ tapEvaluateWithVariableInfo("ThisExpression", (_expr) => {
1441
1441
  const info = this.getVariableInfo("this");
1442
1442
  if (
1443
1443
  typeof info === "string" ||
@@ -1452,7 +1452,7 @@ class JavascriptParser extends Parser {
1452
1452
  };
1453
1453
  }
1454
1454
  });
1455
- this.hooks.evaluate.for("MetaProperty").tap(CLASS_NAME, expr => {
1455
+ this.hooks.evaluate.for("MetaProperty").tap(CLASS_NAME, (expr) => {
1456
1456
  const metaProperty = /** @type {MetaProperty} */ (expr);
1457
1457
 
1458
1458
  return this.callHooksForName(
@@ -1462,14 +1462,14 @@ class JavascriptParser extends Parser {
1462
1462
  metaProperty
1463
1463
  );
1464
1464
  });
1465
- tapEvaluateWithVariableInfo("MemberExpression", expr =>
1465
+ tapEvaluateWithVariableInfo("MemberExpression", (expr) =>
1466
1466
  this.getMemberExpressionInfo(
1467
1467
  /** @type {MemberExpression} */ (expr),
1468
1468
  ALLOWED_MEMBER_TYPES_EXPRESSION
1469
1469
  )
1470
1470
  );
1471
1471
 
1472
- this.hooks.evaluate.for("CallExpression").tap(CLASS_NAME, _expr => {
1472
+ this.hooks.evaluate.for("CallExpression").tap(CLASS_NAME, (_expr) => {
1473
1473
  const expr = /** @type {CallExpression} */ (_expr);
1474
1474
  if (
1475
1475
  expr.callee.type === "MemberExpression" &&
@@ -1641,7 +1641,7 @@ class JavascriptParser extends Parser {
1641
1641
  };
1642
1642
  };
1643
1643
 
1644
- this.hooks.evaluate.for("TemplateLiteral").tap(CLASS_NAME, _node => {
1644
+ this.hooks.evaluate.for("TemplateLiteral").tap(CLASS_NAME, (_node) => {
1645
1645
  const node = /** @type {TemplateLiteral} */ (_node);
1646
1646
 
1647
1647
  const { quasis, parts } = getSimplifiedTemplateResult("cooked", node);
@@ -1654,7 +1654,7 @@ class JavascriptParser extends Parser {
1654
1654
  });
1655
1655
  this.hooks.evaluate
1656
1656
  .for("TaggedTemplateExpression")
1657
- .tap(CLASS_NAME, _node => {
1657
+ .tap(CLASS_NAME, (_node) => {
1658
1658
  const node = /** @type {TaggedTemplateExpression} */ (_node);
1659
1659
  const tag = this.evaluateExpression(node.tag);
1660
1660
 
@@ -1767,44 +1767,46 @@ class JavascriptParser extends Parser {
1767
1767
  .setSideEffects(param.couldHaveSideEffects())
1768
1768
  .setRange(/** @type {Range} */ (expr.range));
1769
1769
  });
1770
- this.hooks.evaluate.for("ConditionalExpression").tap(CLASS_NAME, _expr => {
1771
- const expr = /** @type {ConditionalExpression} */ (_expr);
1772
-
1773
- const condition = this.evaluateExpression(expr.test);
1774
- const conditionValue = condition.asBool();
1775
- let res;
1776
- if (conditionValue === undefined) {
1777
- const consequent = this.evaluateExpression(expr.consequent);
1778
- const alternate = this.evaluateExpression(expr.alternate);
1779
- res = new BasicEvaluatedExpression();
1780
- if (consequent.isConditional()) {
1781
- res.setOptions(
1782
- /** @type {BasicEvaluatedExpression[]} */ (consequent.options)
1783
- );
1770
+ this.hooks.evaluate
1771
+ .for("ConditionalExpression")
1772
+ .tap(CLASS_NAME, (_expr) => {
1773
+ const expr = /** @type {ConditionalExpression} */ (_expr);
1774
+
1775
+ const condition = this.evaluateExpression(expr.test);
1776
+ const conditionValue = condition.asBool();
1777
+ let res;
1778
+ if (conditionValue === undefined) {
1779
+ const consequent = this.evaluateExpression(expr.consequent);
1780
+ const alternate = this.evaluateExpression(expr.alternate);
1781
+ res = new BasicEvaluatedExpression();
1782
+ if (consequent.isConditional()) {
1783
+ res.setOptions(
1784
+ /** @type {BasicEvaluatedExpression[]} */ (consequent.options)
1785
+ );
1786
+ } else {
1787
+ res.setOptions([consequent]);
1788
+ }
1789
+ if (alternate.isConditional()) {
1790
+ res.addOptions(
1791
+ /** @type {BasicEvaluatedExpression[]} */ (alternate.options)
1792
+ );
1793
+ } else {
1794
+ res.addOptions([alternate]);
1795
+ }
1784
1796
  } else {
1785
- res.setOptions([consequent]);
1786
- }
1787
- if (alternate.isConditional()) {
1788
- res.addOptions(
1789
- /** @type {BasicEvaluatedExpression[]} */ (alternate.options)
1797
+ res = this.evaluateExpression(
1798
+ conditionValue ? expr.consequent : expr.alternate
1790
1799
  );
1791
- } else {
1792
- res.addOptions([alternate]);
1800
+ if (condition.couldHaveSideEffects()) res.setSideEffects();
1793
1801
  }
1794
- } else {
1795
- res = this.evaluateExpression(
1796
- conditionValue ? expr.consequent : expr.alternate
1797
- );
1798
- if (condition.couldHaveSideEffects()) res.setSideEffects();
1799
- }
1800
- res.setRange(/** @type {Range} */ (expr.range));
1801
- return res;
1802
- });
1803
- this.hooks.evaluate.for("ArrayExpression").tap(CLASS_NAME, _expr => {
1802
+ res.setRange(/** @type {Range} */ (expr.range));
1803
+ return res;
1804
+ });
1805
+ this.hooks.evaluate.for("ArrayExpression").tap(CLASS_NAME, (_expr) => {
1804
1806
  const expr = /** @type {ArrayExpression} */ (_expr);
1805
1807
 
1806
1808
  const items = expr.elements.map(
1807
- element =>
1809
+ (element) =>
1808
1810
  element !== null &&
1809
1811
  element.type !== "SpreadElement" &&
1810
1812
  this.evaluateExpression(element)
@@ -1814,7 +1816,7 @@ class JavascriptParser extends Parser {
1814
1816
  .setItems(/** @type {BasicEvaluatedExpression[]} */ (items))
1815
1817
  .setRange(/** @type {Range} */ (expr.range));
1816
1818
  });
1817
- this.hooks.evaluate.for("ChainExpression").tap(CLASS_NAME, _expr => {
1819
+ this.hooks.evaluate.for("ChainExpression").tap(CLASS_NAME, (_expr) => {
1818
1820
  const expr = /** @type {ChainExpression} */ (_expr);
1819
1821
  /** @type {Expression[]} */
1820
1822
  const optionalExpressionsStack = [];
@@ -2680,7 +2682,7 @@ class JavascriptParser extends Parser {
2680
2682
  this.prevStatement = prev;
2681
2683
  this.blockPreWalkStatement(statement.declaration);
2682
2684
  let index = 0;
2683
- this.enterDeclaration(statement.declaration, def => {
2685
+ this.enterDeclaration(statement.declaration, (def) => {
2684
2686
  this.hooks.exportSpecifier.call(statement, def, def, index++);
2685
2687
  });
2686
2688
  }
@@ -3061,7 +3063,7 @@ class JavascriptParser extends Parser {
3061
3063
  this.inBlockScope(() => {
3062
3064
  // Error binding is optional in catch clause since ECMAScript 2019
3063
3065
  if (catchClause.param !== null) {
3064
- this.enterPattern(catchClause.param, ident => {
3066
+ this.enterPattern(catchClause.param, (ident) => {
3065
3067
  this.defineVariable(ident);
3066
3068
  });
3067
3069
  this.walkPattern(catchClause.param);
@@ -3620,7 +3622,7 @@ class JavascriptParser extends Parser {
3620
3622
  * @param {Expression | SpreadElement} argOrThis arg or this
3621
3623
  * @returns {string | VariableInfo | undefined} var info
3622
3624
  */
3623
- const getVarInfo = argOrThis => {
3625
+ const getVarInfo = (argOrThis) => {
3624
3626
  const renameIdentifier = this.getRenameIdentifier(argOrThis);
3625
3627
  if (
3626
3628
  renameIdentifier &&
@@ -3702,8 +3704,8 @@ class JavascriptParser extends Parser {
3702
3704
  * @param {FunctionExpression | ArrowFunctionExpression} fn function
3703
3705
  * @returns {boolean} true when simple function
3704
3706
  */
3705
- const isSimpleFunction = fn =>
3706
- fn.params.every(p => p.type === "Identifier");
3707
+ const isSimpleFunction = (fn) =>
3708
+ fn.params.every((p) => p.type === "Identifier");
3707
3709
  if (
3708
3710
  expression.callee.type === "MemberExpression" &&
3709
3711
  expression.callee.object.type.endsWith("FunctionExpression") &&
@@ -3976,7 +3978,7 @@ class JavascriptParser extends Parser {
3976
3978
  hookMap,
3977
3979
  members.length === 0 ? exprName.rootInfo : exprName.name,
3978
3980
  fallback &&
3979
- (name => fallback(name, exprName.rootInfo, exprName.getMembers)),
3981
+ ((name) => fallback(name, exprName.rootInfo, exprName.getMembers)),
3980
3982
  defined && (() => defined(exprName.name)),
3981
3983
  ...args
3982
3984
  );
@@ -4110,7 +4112,7 @@ class JavascriptParser extends Parser {
4110
4112
 
4111
4113
  this.undefineVariable("this");
4112
4114
 
4113
- this.enterPatterns(params, ident => {
4115
+ this.enterPatterns(params, (ident) => {
4114
4116
  this.defineVariable(ident);
4115
4117
  });
4116
4118
 
@@ -4142,7 +4144,7 @@ class JavascriptParser extends Parser {
4142
4144
  this.undefineVariable("this");
4143
4145
  }
4144
4146
 
4145
- this.enterPatterns(params, ident => {
4147
+ this.enterPatterns(params, (ident) => {
4146
4148
  this.defineVariable(ident);
4147
4149
  });
4148
4150
 
@@ -4174,7 +4176,7 @@ class JavascriptParser extends Parser {
4174
4176
  this.undefineVariable("this");
4175
4177
  }
4176
4178
 
4177
- this.enterPatterns(params, ident => {
4179
+ this.enterPatterns(params, (ident) => {
4178
4180
  this.defineVariable(ident);
4179
4181
  });
4180
4182
 
@@ -4513,7 +4515,7 @@ class JavascriptParser extends Parser {
4513
4515
  ast = JavascriptParser._parse(source, {
4514
4516
  sourceType: this.sourceType,
4515
4517
  onComment: comments,
4516
- onInsertedSemicolon: pos => semicolons.add(pos)
4518
+ onInsertedSemicolon: (pos) => semicolons.add(pos)
4517
4519
  });
4518
4520
  }
4519
4521
 
@@ -4596,7 +4598,7 @@ class JavascriptParser extends Parser {
4596
4598
  return false;
4597
4599
  }
4598
4600
  const items = expr.body.body;
4599
- return items.every(item => {
4601
+ return items.every((item) => {
4600
4602
  if (item.type === "StaticBlock") {
4601
4603
  return false;
4602
4604
  }
@@ -4649,7 +4651,7 @@ class JavascriptParser extends Parser {
4649
4651
  return true;
4650
4652
 
4651
4653
  case "VariableDeclaration":
4652
- return expr.declarations.every(decl =>
4654
+ return expr.declarations.every((decl) =>
4653
4655
  this.isPure(decl.init, /** @type {Range} */ (decl.range)[0])
4654
4656
  );
4655
4657
 
@@ -4673,7 +4675,7 @@ class JavascriptParser extends Parser {
4673
4675
  );
4674
4676
 
4675
4677
  case "SequenceExpression":
4676
- return expr.expressions.every(expr => {
4678
+ return expr.expressions.every((expr) => {
4677
4679
  const pureFlag = this.isPure(expr, commentsStartPos);
4678
4680
  commentsStartPos = /** @type {Range} */ (expr.range)[1];
4679
4681
  return pureFlag;
@@ -4686,13 +4688,13 @@ class JavascriptParser extends Parser {
4686
4688
  commentsStartPos,
4687
4689
  /** @type {Range} */ (expr.range)[0]
4688
4690
  ]).some(
4689
- comment =>
4691
+ (comment) =>
4690
4692
  comment.type === "Block" &&
4691
4693
  /^\s*(#|@)__PURE__\s*$/.test(comment.value)
4692
4694
  );
4693
4695
  if (!pureFlag) return false;
4694
4696
  commentsStartPos = /** @type {Range} */ (expr.callee.range)[1];
4695
- return expr.arguments.every(arg => {
4697
+ return expr.arguments.every((arg) => {
4696
4698
  if (arg.type === "SpreadElement") return false;
4697
4699
  const pureFlag = this.isPure(arg, commentsStartPos);
4698
4700
  commentsStartPos = /** @type {Range} */ (arg.range)[1];
@@ -21,7 +21,7 @@ module.exports.approve = () => true;
21
21
  * @param {boolean} value the boolean value
22
22
  * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function
23
23
  */
24
- module.exports.evaluateToBoolean = value =>
24
+ module.exports.evaluateToBoolean = (value) =>
25
25
  function booleanExpression(expr) {
26
26
  return new BasicEvaluatedExpression()
27
27
  .setBoolean(value)
@@ -65,7 +65,7 @@ module.exports.evaluateToIdentifier = (
65
65
  * @param {number} value the number value
66
66
  * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function
67
67
  */
68
- module.exports.evaluateToNumber = value =>
68
+ module.exports.evaluateToNumber = (value) =>
69
69
  function stringExpression(expr) {
70
70
  return new BasicEvaluatedExpression()
71
71
  .setNumber(value)
@@ -76,7 +76,7 @@ module.exports.evaluateToNumber = value =>
76
76
  * @param {string} value the string value
77
77
  * @returns {(expression: Expression) => BasicEvaluatedExpression} plugin function
78
78
  */
79
- module.exports.evaluateToString = value =>
79
+ module.exports.evaluateToString = (value) =>
80
80
  function stringExpression(expr) {
81
81
  return new BasicEvaluatedExpression()
82
82
  .setString(value)
@@ -54,7 +54,7 @@ module.exports.generateEntryStartup = (
54
54
  * @param {ModuleId} id id
55
55
  * @returns {string} fn to execute
56
56
  */
57
- const runModule = id => `__webpack_exec__(${JSON.stringify(id)})`;
57
+ const runModule = (id) => `__webpack_exec__(${JSON.stringify(id)})`;
58
58
  /**
59
59
  * @param {Chunks} chunks chunks
60
60
  * @param {ModuleIds} moduleIds module ids
@@ -74,7 +74,7 @@ module.exports.generateEntryStartup = (
74
74
  passive
75
75
  ? RuntimeGlobals.onChunksLoaded
76
76
  : RuntimeGlobals.startupEntrypoint
77
- }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});`
77
+ }(0, ${JSON.stringify(Array.from(chunks, (c) => c.id))}, ${fn});`
78
78
  );
79
79
  if (final && passive) {
80
80
  runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`);
@@ -29,13 +29,13 @@ const RuntimeGlobals = require("../RuntimeGlobals");
29
29
  * @param {JsonValue} data Raw JSON data
30
30
  * @returns {undefined|string} stringified data
31
31
  */
32
- const stringifySafe = data => {
32
+ const stringifySafe = (data) => {
33
33
  const stringified = JSON.stringify(data);
34
34
  if (!stringified) {
35
35
  return; // Invalid JSON
36
36
  }
37
37
 
38
- return stringified.replace(/\u2028|\u2029/g, str =>
38
+ return stringified.replace(/\u2028|\u2029/g, (str) =>
39
39
  str === "\u2029" ? "\\u2029" : "\\u2028"
40
40
  ); // invalid in JavaScript but valid JSON
41
41
  };
@@ -51,13 +51,13 @@ class JsonModulesPlugin {
51
51
  (compilation, { normalModuleFactory }) => {
52
52
  normalModuleFactory.hooks.createParser
53
53
  .for(JSON_MODULE_TYPE)
54
- .tap(PLUGIN_NAME, parserOptions => {
54
+ .tap(PLUGIN_NAME, (parserOptions) => {
55
55
  validate(parserOptions);
56
56
  return new JsonParser(parserOptions);
57
57
  });
58
58
  normalModuleFactory.hooks.createGenerator
59
59
  .for(JSON_MODULE_TYPE)
60
- .tap(PLUGIN_NAME, generatorOptions => {
60
+ .tap(PLUGIN_NAME, (generatorOptions) => {
61
61
  validateGenerator(generatorOptions);
62
62
  return new JsonGenerator(generatorOptions);
63
63
  });
@@ -19,6 +19,8 @@ const JavascriptModulesPlugin = require("../javascript/JavascriptModulesPlugin")
19
19
  /** @typedef {import("../Module")} Module */
20
20
  /** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
21
21
  /** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */
22
+ /** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
23
+ /** @typedef {import("../javascript/JavascriptModulesPlugin").ModuleRenderContext} ModuleRenderContext */
22
24
  /** @typedef {import("../util/Hash")} Hash */
23
25
 
24
26
  const COMMON_LIBRARY_NAME_MESSAGE =
@@ -58,7 +60,7 @@ class AbstractLibraryPlugin {
58
60
  */
59
61
  apply(compiler) {
60
62
  const { _pluginName } = this;
61
- compiler.hooks.thisCompilation.tap(_pluginName, compilation => {
63
+ compiler.hooks.thisCompilation.tap(_pluginName, (compilation) => {
62
64
  compilation.hooks.finishModules.tap(
63
65
  { name: _pluginName, stage: 10 },
64
66
  () => {
@@ -95,7 +97,7 @@ class AbstractLibraryPlugin {
95
97
  * @param {Chunk} chunk chunk
96
98
  * @returns {T | false} options for the chunk
97
99
  */
98
- const getOptionsForChunk = chunk => {
100
+ const getOptionsForChunk = (chunk) => {
99
101
  if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) {
100
102
  return false;
101
103
  }
@@ -162,7 +164,7 @@ class AbstractLibraryPlugin {
162
164
  this.strictRuntimeBailout !==
163
165
  AbstractLibraryPlugin.prototype.strictRuntimeBailout
164
166
  ) {
165
- hooks.strictRuntimeBailout.tap(_pluginName, renderContext => {
167
+ hooks.strictRuntimeBailout.tap(_pluginName, (renderContext) => {
166
168
  const options = getOptionsForChunk(renderContext.chunk);
167
169
  if (options === false) return;
168
170
  return this.strictRuntimeBailout(renderContext, {
@@ -173,6 +175,20 @@ class AbstractLibraryPlugin {
173
175
  });
174
176
  }
175
177
 
178
+ if (
179
+ this.renderModuleContent !==
180
+ AbstractLibraryPlugin.prototype.renderModuleContent
181
+ ) {
182
+ hooks.renderModuleContent.tap(
183
+ _pluginName,
184
+ (source, module, renderContext) =>
185
+ this.renderModuleContent(source, module, renderContext, {
186
+ compilation,
187
+ chunkGraph: compilation.chunkGraph
188
+ })
189
+ );
190
+ }
191
+
176
192
  if (
177
193
  this.renderStartup !== AbstractLibraryPlugin.prototype.renderStartup
178
194
  ) {
@@ -288,6 +304,17 @@ class AbstractLibraryPlugin {
288
304
  return source;
289
305
  }
290
306
 
307
+ /**
308
+ * @param {Source} source source
309
+ * @param {Module} module module
310
+ * @param {ModuleRenderContext} renderContext render context
311
+ * @param {Omit<LibraryContext<T>, 'options'>} libraryContext context
312
+ * @returns {Source} source with library export
313
+ */
314
+ renderModuleContent(source, module, renderContext, libraryContext) {
315
+ return source;
316
+ }
317
+
291
318
  /**
292
319
  * @param {Chunk} chunk the chunk
293
320
  * @param {Hash} hash hash
@@ -85,13 +85,13 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
85
85
  const modules = chunkGraph
86
86
  .getChunkModules(chunk)
87
87
  .filter(
88
- m =>
88
+ (m) =>
89
89
  m instanceof ExternalModule &&
90
90
  (m.externalType === "amd" || m.externalType === "amd-require")
91
91
  );
92
92
  const externals = /** @type {ExternalModule[]} */ (modules);
93
93
  const externalsDepsArray = JSON.stringify(
94
- externals.map(m =>
94
+ externals.map((m) =>
95
95
  typeof m.request === "object" && !Array.isArray(m.request)
96
96
  ? m.request.amd
97
97
  : m.request
@@ -99,7 +99,7 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
99
99
  );
100
100
  const externalsArguments = externals
101
101
  .map(
102
- m =>
102
+ (m) =>
103
103
  `__WEBPACK_EXTERNAL_MODULE_${Template.toIdentifier(
104
104
  `${chunkGraph.getModuleId(m)}`
105
105
  )}__`
@@ -35,7 +35,7 @@ const IDENTIFIER_REGEX =
35
35
  * @param {string} name name to be validated
36
36
  * @returns {boolean} true, when valid
37
37
  */
38
- const isNameValid = name =>
38
+ const isNameValid = (name) =>
39
39
  !KEYWORD_REGEX.test(name) && IDENTIFIER_REGEX.test(name);
40
40
 
41
41
  /**
@@ -197,7 +197,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
197
197
  ...(Array.isArray(options.name) ? options.name : [options.name])
198
198
  ]
199
199
  : prefix;
200
- return fullName.map(n =>
200
+ return fullName.map((n) =>
201
201
  compilation.getPath(n, {
202
202
  chunk
203
203
  })
@@ -21,7 +21,7 @@ const enabledTypes = new WeakMap();
21
21
  * @param {Compiler} compiler the compiler instance
22
22
  * @returns {Set<LibraryType>} enabled types
23
23
  */
24
- const getEnabledTypes = compiler => {
24
+ const getEnabledTypes = (compiler) => {
25
25
  let set = enabledTypes.get(compiler);
26
26
  if (set === undefined) {
27
27
  set = new Set();
@@ -243,7 +243,7 @@ class EnableLibraryPlugin {
243
243
  apply(compiler) {
244
244
  compiler.hooks.thisCompilation.tap(
245
245
  "WarnFalseIifeUmdPlugin",
246
- compilation => {
246
+ (compilation) => {
247
247
  const FalseIIFEUmdWarning = require("../FalseIIFEUmdWarning");
248
248
 
249
249
  compilation.warnings.push(new FalseIIFEUmdWarning());