webpack 5.100.1 → 5.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) 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 +21 -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 +127 -114
  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/DllEntryPlugin.js +1 -1
  26. package/lib/DllReferencePlugin.js +1 -1
  27. package/lib/DynamicEntryPlugin.js +3 -3
  28. package/lib/EntryPlugin.js +1 -1
  29. package/lib/EnvironmentPlugin.js +1 -1
  30. package/lib/ErrorHelpers.js +2 -2
  31. package/lib/EvalDevToolModulePlugin.js +2 -2
  32. package/lib/EvalSourceMapDevToolPlugin.js +5 -5
  33. package/lib/ExportsInfo.js +9 -9
  34. package/lib/ExportsInfoApiPlugin.js +2 -2
  35. package/lib/ExternalModule.js +163 -48
  36. package/lib/ExternalModuleFactoryPlugin.js +2 -2
  37. package/lib/ExternalsPlugin.js +45 -0
  38. package/lib/FileSystemInfo.js +64 -61
  39. package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
  40. package/lib/FlagDependencyExportsPlugin.js +7 -7
  41. package/lib/FlagDependencyUsagePlugin.js +4 -4
  42. package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
  43. package/lib/HotModuleReplacementPlugin.js +27 -27
  44. package/lib/IgnorePlugin.js +3 -3
  45. package/lib/IgnoreWarningsPlugin.js +4 -4
  46. package/lib/InitFragment.js +6 -0
  47. package/lib/InvalidDependenciesModuleWarning.js +1 -1
  48. package/lib/JavascriptMetaInfoPlugin.js +1 -1
  49. package/lib/LibManifestPlugin.js +2 -2
  50. package/lib/LoaderOptionsPlugin.js +1 -1
  51. package/lib/LoaderTargetPlugin.js +2 -2
  52. package/lib/MainTemplate.js +1 -1
  53. package/lib/Module.js +1 -1
  54. package/lib/ModuleFilenameHelpers.js +3 -3
  55. package/lib/ModuleGraph.js +86 -5
  56. package/lib/ModuleInfoHeaderPlugin.js +3 -3
  57. package/lib/ModuleParseError.js +5 -3
  58. package/lib/MultiCompiler.js +29 -24
  59. package/lib/MultiStats.js +18 -13
  60. package/lib/MultiWatching.js +1 -1
  61. package/lib/NoEmitOnErrorsPlugin.js +2 -2
  62. package/lib/NodeStuffPlugin.js +27 -15
  63. package/lib/NormalModule.js +28 -24
  64. package/lib/NormalModuleFactory.js +23 -21
  65. package/lib/NormalModuleReplacementPlugin.js +3 -3
  66. package/lib/PrefetchPlugin.js +1 -1
  67. package/lib/ProgressPlugin.js +11 -11
  68. package/lib/ProvidePlugin.js +2 -2
  69. package/lib/RecordIdsPlugin.js +3 -3
  70. package/lib/ResolverFactory.js +3 -3
  71. package/lib/RuntimeGlobals.js +20 -0
  72. package/lib/RuntimePlugin.js +16 -16
  73. package/lib/RuntimeTemplate.js +42 -44
  74. package/lib/SizeFormatHelpers.js +1 -1
  75. package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
  76. package/lib/SourceMapDevToolPlugin.js +9 -9
  77. package/lib/Stats.js +2 -2
  78. package/lib/Template.js +1 -1
  79. package/lib/TemplatedPathPlugin.js +2 -2
  80. package/lib/UseStrictPlugin.js +1 -1
  81. package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
  82. package/lib/WarnDeprecatedOptionPlugin.js +1 -1
  83. package/lib/WarnNoModeSetPlugin.js +1 -1
  84. package/lib/WatchIgnorePlugin.js +2 -2
  85. package/lib/Watching.js +12 -12
  86. package/lib/WebpackIsIncludedPlugin.js +2 -2
  87. package/lib/WebpackOptionsApply.js +10 -3
  88. package/lib/asset/AssetGenerator.js +3 -3
  89. package/lib/asset/AssetModulesPlugin.js +6 -6
  90. package/lib/async-modules/AsyncModuleHelpers.js +50 -0
  91. package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
  92. package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
  93. package/lib/buildChunkGraph.js +5 -5
  94. package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
  95. package/lib/cache/IdleFileCachePlugin.js +5 -5
  96. package/lib/cache/PackFileCacheStrategy.js +20 -20
  97. package/lib/cache/ResolverCachePlugin.js +4 -4
  98. package/lib/cli.js +196 -14
  99. package/lib/config/browserslistTargetHandler.js +6 -6
  100. package/lib/config/defaults.js +23 -14
  101. package/lib/config/normalization.js +41 -38
  102. package/lib/config/target.js +4 -4
  103. package/lib/container/ContainerEntryModule.js +3 -3
  104. package/lib/container/ContainerPlugin.js +3 -3
  105. package/lib/container/ContainerReferencePlugin.js +3 -3
  106. package/lib/container/FallbackModule.js +1 -1
  107. package/lib/container/HoistContainerReferencesPlugin.js +7 -7
  108. package/lib/container/options.js +4 -4
  109. package/lib/css/CssGenerator.js +5 -3
  110. package/lib/css/CssLoadingRuntimeModule.js +1 -1
  111. package/lib/css/CssModulesPlugin.js +25 -22
  112. package/lib/css/CssParser.js +5 -5
  113. package/lib/css/walkCssTokens.js +9 -9
  114. package/lib/debug/ProfilingPlugin.js +5 -5
  115. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
  116. package/lib/dependencies/AMDPlugin.js +3 -3
  117. package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
  118. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
  119. package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
  120. package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
  121. package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
  122. package/lib/dependencies/CommonJsPlugin.js +2 -2
  123. package/lib/dependencies/ContextDependency.js +1 -1
  124. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  125. package/lib/dependencies/CssIcssExportDependency.js +2 -2
  126. package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
  127. package/lib/dependencies/CssUrlDependency.js +4 -4
  128. package/lib/dependencies/DynamicExports.js +5 -5
  129. package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
  130. package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
  131. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -23
  132. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
  133. package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
  134. package/lib/dependencies/HarmonyExports.js +1 -1
  135. package/lib/dependencies/HarmonyImportDependency.js +28 -9
  136. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +59 -75
  137. package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
  138. package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
  139. package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
  140. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
  141. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
  142. package/lib/dependencies/ImportMetaPlugin.js +7 -7
  143. package/lib/dependencies/ImportParserPlugin.js +4 -4
  144. package/lib/dependencies/JsonExportsDependency.js +1 -1
  145. package/lib/dependencies/LoaderPlugin.js +4 -4
  146. package/lib/dependencies/ProvidedDependency.js +2 -2
  147. package/lib/dependencies/PureExpressionDependency.js +1 -1
  148. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  149. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
  150. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
  151. package/lib/dependencies/SystemPlugin.js +3 -3
  152. package/lib/dependencies/WorkerPlugin.js +5 -5
  153. package/lib/dependencies/getFunctionExpression.js +1 -1
  154. package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
  155. package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
  156. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
  157. package/lib/formatLocation.js +2 -2
  158. package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
  159. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
  160. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
  161. package/lib/hmr/LazyCompilationPlugin.js +6 -6
  162. package/lib/hmr/lazyCompilationBackend.js +6 -6
  163. package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
  164. package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
  165. package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
  166. package/lib/ids/HashedModuleIdsPlugin.js +1 -1
  167. package/lib/ids/IdHelpers.js +9 -9
  168. package/lib/ids/NamedChunkIdsPlugin.js +5 -5
  169. package/lib/ids/NamedModuleIdsPlugin.js +2 -2
  170. package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
  171. package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
  172. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
  173. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
  174. package/lib/ids/SyncModuleIdsPlugin.js +4 -4
  175. package/lib/index.js +10 -6
  176. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
  177. package/lib/javascript/BasicEvaluatedExpression.js +3 -3
  178. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
  179. package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
  180. package/lib/javascript/JavascriptGenerator.js +1 -1
  181. package/lib/javascript/JavascriptModulesPlugin.js +16 -16
  182. package/lib/javascript/JavascriptParser.js +90 -83
  183. package/lib/javascript/JavascriptParserHelpers.js +3 -3
  184. package/lib/javascript/StartupHelpers.js +2 -2
  185. package/lib/json/JsonGenerator.js +2 -2
  186. package/lib/json/JsonModulesPlugin.js +2 -2
  187. package/lib/library/AbstractLibraryPlugin.js +3 -3
  188. package/lib/library/AmdLibraryPlugin.js +3 -3
  189. package/lib/library/AssignLibraryPlugin.js +2 -2
  190. package/lib/library/EnableLibraryPlugin.js +2 -2
  191. package/lib/library/ModuleLibraryPlugin.js +7 -2
  192. package/lib/library/SystemLibraryPlugin.js +6 -4
  193. package/lib/library/UmdLibraryPlugin.js +14 -14
  194. package/lib/logging/createConsoleLogger.js +4 -4
  195. package/lib/logging/runtime.js +3 -3
  196. package/lib/logging/truncateArgs.js +4 -4
  197. package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
  198. package/lib/node/NodeEnvironmentPlugin.js +1 -1
  199. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
  200. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
  201. package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
  202. package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
  203. package/lib/node/nodeConsole.js +2 -2
  204. package/lib/optimize/AggressiveMergingPlugin.js +2 -2
  205. package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
  206. package/lib/optimize/ConcatenatedModule.js +161 -52
  207. package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
  208. package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
  209. package/lib/optimize/InnerGraph.js +5 -5
  210. package/lib/optimize/InnerGraphPlugin.js +14 -12
  211. package/lib/optimize/LimitChunkCountPlugin.js +5 -5
  212. package/lib/optimize/MangleExportsPlugin.js +5 -5
  213. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
  214. package/lib/optimize/MinChunkSizePlugin.js +3 -3
  215. package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
  216. package/lib/optimize/RealContentHashPlugin.js +23 -23
  217. package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
  218. package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
  219. package/lib/optimize/RuntimeChunkPlugin.js +2 -2
  220. package/lib/optimize/SideEffectsFlagPlugin.js +22 -6
  221. package/lib/optimize/SplitChunksPlugin.js +20 -20
  222. package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
  223. package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
  224. package/lib/performance/SizeLimitsPlugin.js +4 -4
  225. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
  226. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
  227. package/lib/rules/BasicMatcherRulePlugin.js +1 -1
  228. package/lib/rules/RuleSetCompiler.js +10 -10
  229. package/lib/rules/UseEffectRulePlugin.js +2 -2
  230. package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
  231. package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
  232. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
  233. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
  234. package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
  235. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
  236. package/lib/schemes/DataUriPlugin.js +3 -3
  237. package/lib/schemes/FileUriPlugin.js +1 -1
  238. package/lib/schemes/HttpUriPlugin.js +40 -36
  239. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  240. package/lib/serialization/BinaryMiddleware.js +11 -11
  241. package/lib/serialization/FileMiddleware.js +17 -17
  242. package/lib/serialization/ObjectMiddleware.js +8 -8
  243. package/lib/serialization/Serializer.js +2 -2
  244. package/lib/serialization/SerializerMiddleware.js +2 -2
  245. package/lib/sharing/ConsumeSharedPlugin.js +4 -4
  246. package/lib/sharing/ProvideSharedPlugin.js +4 -4
  247. package/lib/sharing/SharePlugin.js +1 -1
  248. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  249. package/lib/stats/DefaultStatsFactoryPlugin.js +86 -80
  250. package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
  251. package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
  252. package/lib/stats/StatsFactory.js +7 -7
  253. package/lib/stats/StatsPrinter.js +9 -9
  254. package/lib/url/URLParserPlugin.js +5 -5
  255. package/lib/util/AsyncQueue.js +4 -4
  256. package/lib/util/IterableHelpers.js +2 -2
  257. package/lib/util/LazyBucketSortedSet.js +3 -3
  258. package/lib/util/SetHelpers.js +2 -2
  259. package/lib/util/StackedCacheMap.js +1 -1
  260. package/lib/util/StackedMap.js +1 -1
  261. package/lib/util/TupleSet.js +1 -1
  262. package/lib/util/WeakTupleMap.js +1 -1
  263. package/lib/util/cleverMerge.js +8 -8
  264. package/lib/util/comparators.js +107 -8
  265. package/lib/util/compileBooleanMatcher.js +20 -20
  266. package/lib/util/concatenate.js +3 -3
  267. package/lib/util/conventions.js +4 -4
  268. package/lib/util/create-schema-validation.js +1 -1
  269. package/lib/util/createHash.js +1 -1
  270. package/lib/util/deprecation.js +4 -4
  271. package/lib/util/deterministicGrouping.js +7 -7
  272. package/lib/util/findGraphRoots.js +1 -1
  273. package/lib/util/fs.js +3 -3
  274. package/lib/util/identifier.js +14 -14
  275. package/lib/util/magicComment.js +5 -1
  276. package/lib/util/memoize.js +1 -1
  277. package/lib/util/processAsyncTree.js +2 -2
  278. package/lib/util/propertyName.js +1 -1
  279. package/lib/util/removeBOM.js +1 -1
  280. package/lib/util/runtime.js +6 -6
  281. package/lib/util/semver.js +16 -16
  282. package/lib/util/serialization.js +5 -5
  283. package/lib/util/smartGrouping.js +1 -1
  284. package/lib/validateSchema.js +2 -2
  285. package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
  286. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
  287. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
  288. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
  289. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
  290. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
  291. package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
  292. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
  293. package/lib/wasm-sync/WebAssemblyParser.js +2 -2
  294. package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
  295. package/lib/web/FetchCompileWasmPlugin.js +4 -4
  296. package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
  297. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
  298. package/lib/webpack.js +17 -12
  299. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
  300. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  301. package/package.json +13 -13
  302. package/schemas/WebpackOptions.check.js +1 -1
  303. package/schemas/WebpackOptions.json +4 -0
  304. package/types.d.ts +186 -54
package/lib/Compiler.js CHANGED
@@ -125,7 +125,7 @@ const webpack = require(".");
125
125
  * @param {string[]} array an array
126
126
  * @returns {boolean} true, if the array is sorted
127
127
  */
128
- const isSorted = array => {
128
+ const isSorted = (array) => {
129
129
  for (let i = 1; i < array.length; i++) {
130
130
  if (array[i - 1] > array[i]) return false;
131
131
  }
@@ -154,7 +154,7 @@ const sortObject = (obj, keys) => {
154
154
  const includesHash = (filename, hashes) => {
155
155
  if (!hashes) return false;
156
156
  if (Array.isArray(hashes)) {
157
- return hashes.some(hash => filename.includes(hash));
157
+ return hashes.some((hash) => filename.includes(hash));
158
158
  }
159
159
  return filename.includes(hashes);
160
160
  };
@@ -388,7 +388,7 @@ class Compiler {
388
388
  this.infrastructureLogger(name, type, args);
389
389
  }
390
390
  },
391
- childName => {
391
+ (childName) => {
392
392
  if (typeof name === "function") {
393
393
  if (typeof childName === "function") {
394
394
  return this.getInfrastructureLogger(() => {
@@ -540,7 +540,7 @@ class Compiler {
540
540
  compilation.startTime = startTime;
541
541
  compilation.endTime = Date.now();
542
542
  const stats = new Stats(compilation);
543
- this.hooks.done.callAsync(stats, err => {
543
+ this.hooks.done.callAsync(stats, (err) => {
544
544
  if (err) return finalCallback(err);
545
545
  return finalCallback(null, stats);
546
546
  });
@@ -550,7 +550,7 @@ class Compiler {
550
550
  process.nextTick(() => {
551
551
  logger = compilation.getLogger("webpack.Compiler");
552
552
  logger.time("emitAssets");
553
- this.emitAssets(compilation, err => {
553
+ this.emitAssets(compilation, (err) => {
554
554
  /** @type {Logger} */
555
555
  (logger).timeEnd("emitAssets");
556
556
  if (err) return finalCallback(err);
@@ -563,12 +563,12 @@ class Compiler {
563
563
  /** @type {Logger} */
564
564
  (logger).time("done hook");
565
565
  const stats = new Stats(compilation);
566
- this.hooks.done.callAsync(stats, err => {
566
+ this.hooks.done.callAsync(stats, (err) => {
567
567
  /** @type {Logger} */
568
568
  (logger).timeEnd("done hook");
569
569
  if (err) return finalCallback(err);
570
570
 
571
- this.hooks.additionalPass.callAsync(err => {
571
+ this.hooks.additionalPass.callAsync((err) => {
572
572
  if (err) return finalCallback(err);
573
573
  this.compile(onCompiled);
574
574
  });
@@ -578,7 +578,7 @@ class Compiler {
578
578
 
579
579
  /** @type {Logger} */
580
580
  (logger).time("emitRecords");
581
- this.emitRecords(err => {
581
+ this.emitRecords((err) => {
582
582
  /** @type {Logger} */
583
583
  (logger).timeEnd("emitRecords");
584
584
  if (err) return finalCallback(err);
@@ -588,13 +588,13 @@ class Compiler {
588
588
  /** @type {Logger} */
589
589
  (logger).time("done hook");
590
590
  const stats = new Stats(compilation);
591
- this.hooks.done.callAsync(stats, err => {
591
+ this.hooks.done.callAsync(stats, (err) => {
592
592
  /** @type {Logger} */
593
593
  (logger).timeEnd("done hook");
594
594
  if (err) return finalCallback(err);
595
595
  this.cache.storeBuildDependencies(
596
596
  compilation.buildDependencies,
597
- err => {
597
+ (err) => {
598
598
  if (err) return finalCallback(err);
599
599
  return finalCallback(null, stats);
600
600
  }
@@ -606,13 +606,13 @@ class Compiler {
606
606
  };
607
607
 
608
608
  const run = () => {
609
- this.hooks.beforeRun.callAsync(this, err => {
609
+ this.hooks.beforeRun.callAsync(this, (err) => {
610
610
  if (err) return finalCallback(err);
611
611
 
612
- this.hooks.run.callAsync(this, err => {
612
+ this.hooks.run.callAsync(this, (err) => {
613
613
  if (err) return finalCallback(err);
614
614
 
615
- this.readRecords(err => {
615
+ this.readRecords((err) => {
616
616
  if (err) return finalCallback(err);
617
617
 
618
618
  this.compile(onCompiled);
@@ -622,7 +622,7 @@ class Compiler {
622
622
  };
623
623
 
624
624
  if (this.idle) {
625
- this.cache.endIdle(err => {
625
+ this.cache.endIdle((err) => {
626
626
  if (err) return finalCallback(err);
627
627
 
628
628
  this.idle = false;
@@ -706,7 +706,7 @@ class Compiler {
706
706
  * @param {Error=} err error
707
707
  * @returns {void}
708
708
  */
709
- const emitFiles = err => {
709
+ const emitFiles = (err) => {
710
710
  if (err) return callback(err);
711
711
 
712
712
  const assets = compilation.getAssets();
@@ -739,7 +739,7 @@ class Compiler {
739
739
  * @param {Error=} err error
740
740
  * @returns {void}
741
741
  */
742
- const writeOut = err => {
742
+ const writeOut = (err) => {
743
743
  if (err) return callback(err);
744
744
  const targetPath = join(
745
745
  /** @type {OutputFileSystem} */
@@ -838,9 +838,9 @@ ${other}`);
838
838
  * @param {Buffer} content content to be written
839
839
  * @returns {void}
840
840
  */
841
- const doWrite = content => {
841
+ const doWrite = (content) => {
842
842
  /** @type {OutputFileSystem} */
843
- (this.outputFileSystem).writeFile(targetPath, content, err => {
843
+ (this.outputFileSystem).writeFile(targetPath, content, (err) => {
844
844
  if (err) return callback(err);
845
845
 
846
846
  // information marker that the asset has been emitted
@@ -871,7 +871,7 @@ ${other}`);
871
871
  /**
872
872
  * @param {number} size size
873
873
  */
874
- const updateWithReplacementSource = size => {
874
+ const updateWithReplacementSource = (size) => {
875
875
  updateFileWithReplacementSource(
876
876
  file,
877
877
  /** @type {CacheEntry} */ (cacheEntry),
@@ -915,7 +915,7 @@ ${other}`);
915
915
  * @param {IStats} stats stats
916
916
  * @returns {void}
917
917
  */
918
- const processExistingFile = stats => {
918
+ const processExistingFile = (stats) => {
919
919
  // skip emitting if it's already there and an immutable file
920
920
  if (immutable) {
921
921
  updateWithReplacementSource(/** @type {number} */ (stats.size));
@@ -1015,7 +1015,7 @@ ${other}`);
1015
1015
  writeOut();
1016
1016
  }
1017
1017
  },
1018
- err => {
1018
+ (err) => {
1019
1019
  // Clear map to free up memory
1020
1020
  caseInsensitiveMap.clear();
1021
1021
  if (err) {
@@ -1025,7 +1025,7 @@ ${other}`);
1025
1025
 
1026
1026
  this._assetEmittingPreviousFiles = allTargetPaths;
1027
1027
 
1028
- this.hooks.afterEmit.callAsync(compilation, err => {
1028
+ this.hooks.afterEmit.callAsync(compilation, (err) => {
1029
1029
  if (err) return callback(err);
1030
1030
 
1031
1031
  return callback();
@@ -1034,7 +1034,7 @@ ${other}`);
1034
1034
  );
1035
1035
  };
1036
1036
 
1037
- this.hooks.emit.callAsync(compilation, err => {
1037
+ this.hooks.emit.callAsync(compilation, (err) => {
1038
1038
  if (err) return callback(err);
1039
1039
  outputPath = compilation.getPath(this.outputPath, {});
1040
1040
  mkdirp(
@@ -1054,10 +1054,10 @@ ${other}`);
1054
1054
  if (this.recordsOutputPath) {
1055
1055
  asyncLib.parallel(
1056
1056
  [
1057
- cb => this.hooks.emitRecords.callAsync(cb),
1057
+ (cb) => this.hooks.emitRecords.callAsync(cb),
1058
1058
  this._emitRecords.bind(this)
1059
1059
  ],
1060
- err => callback(err)
1060
+ (err) => callback(err)
1061
1061
  );
1062
1062
  } else {
1063
1063
  this.hooks.emitRecords.callAsync(callback);
@@ -1111,7 +1111,7 @@ ${other}`);
1111
1111
  mkdirp(
1112
1112
  /** @type {OutputFileSystem} */ (this.outputFileSystem),
1113
1113
  recordsOutputPathDirectory,
1114
- err => {
1114
+ (err) => {
1115
1115
  if (err) return callback(err);
1116
1116
  writeFile();
1117
1117
  }
@@ -1127,10 +1127,10 @@ ${other}`);
1127
1127
  if (this.recordsInputPath) {
1128
1128
  asyncLib.parallel(
1129
1129
  [
1130
- cb => this.hooks.readRecords.callAsync(cb),
1130
+ (cb) => this.hooks.readRecords.callAsync(cb),
1131
1131
  this._readRecords.bind(this)
1132
1132
  ],
1133
- err => callback(err)
1133
+ (err) => callback(err)
1134
1134
  );
1135
1135
  } else {
1136
1136
  this.records = {};
@@ -1154,7 +1154,7 @@ ${other}`);
1154
1154
  return callback();
1155
1155
  }
1156
1156
  /** @type {InputFileSystem} */
1157
- (this.inputFileSystem).stat(this.recordsInputPath, err => {
1157
+ (this.inputFileSystem).stat(this.recordsInputPath, (err) => {
1158
1158
  // It doesn't exist
1159
1159
  // We can ignore this.
1160
1160
  if (err) return callback();
@@ -1339,7 +1339,7 @@ ${other}`);
1339
1339
  */
1340
1340
  compile(callback) {
1341
1341
  const params = this.newCompilationParams();
1342
- this.hooks.beforeCompile.callAsync(params, err => {
1342
+ this.hooks.beforeCompile.callAsync(params, (err) => {
1343
1343
  if (err) return callback(err);
1344
1344
 
1345
1345
  this.hooks.compile.call(params);
@@ -1349,28 +1349,28 @@ ${other}`);
1349
1349
  const logger = compilation.getLogger("webpack.Compiler");
1350
1350
 
1351
1351
  logger.time("make hook");
1352
- this.hooks.make.callAsync(compilation, err => {
1352
+ this.hooks.make.callAsync(compilation, (err) => {
1353
1353
  logger.timeEnd("make hook");
1354
1354
  if (err) return callback(err);
1355
1355
 
1356
1356
  logger.time("finish make hook");
1357
- this.hooks.finishMake.callAsync(compilation, err => {
1357
+ this.hooks.finishMake.callAsync(compilation, (err) => {
1358
1358
  logger.timeEnd("finish make hook");
1359
1359
  if (err) return callback(err);
1360
1360
 
1361
1361
  process.nextTick(() => {
1362
1362
  logger.time("finish compilation");
1363
- compilation.finish(err => {
1363
+ compilation.finish((err) => {
1364
1364
  logger.timeEnd("finish compilation");
1365
1365
  if (err) return callback(err);
1366
1366
 
1367
1367
  logger.time("seal compilation");
1368
- compilation.seal(err => {
1368
+ compilation.seal((err) => {
1369
1369
  logger.timeEnd("seal compilation");
1370
1370
  if (err) return callback(err);
1371
1371
 
1372
1372
  logger.time("afterCompile hook");
1373
- this.hooks.afterCompile.callAsync(compilation, err => {
1373
+ this.hooks.afterCompile.callAsync(compilation, (err) => {
1374
1374
  logger.timeEnd("afterCompile hook");
1375
1375
  if (err) return callback(err);
1376
1376
 
@@ -1391,12 +1391,12 @@ ${other}`);
1391
1391
  close(callback) {
1392
1392
  if (this.watching) {
1393
1393
  // When there is still an active watching, close this first
1394
- this.watching.close(_err => {
1394
+ this.watching.close((_err) => {
1395
1395
  this.close(callback);
1396
1396
  });
1397
1397
  return;
1398
1398
  }
1399
- this.hooks.shutdown.callAsync(err => {
1399
+ this.hooks.shutdown.callAsync((err) => {
1400
1400
  if (err) return callback(err);
1401
1401
  // Get rid of reference to last compilation to avoid leaking memory
1402
1402
  // We can't run this._cleanupLastCompilation() as the Stats to this compilation
@@ -30,8 +30,9 @@ class ConcatenationScope {
30
30
  /**
31
31
  * @param {ModuleInfo[] | Map<Module, ModuleInfo>} modulesMap all module info by module
32
32
  * @param {ConcatenatedModuleInfo} currentModule the current module info
33
+ * @param {Set<string>} usedNames all used names
33
34
  */
34
- constructor(modulesMap, currentModule) {
35
+ constructor(modulesMap, currentModule, usedNames) {
35
36
  this._currentModule = currentModule;
36
37
  if (Array.isArray(modulesMap)) {
37
38
  const map = new Map();
@@ -40,6 +41,7 @@ class ConcatenationScope {
40
41
  }
41
42
  modulesMap = map;
42
43
  }
44
+ this.usedNames = usedNames;
43
45
  this._modulesMap = modulesMap;
44
46
  }
45
47
 
@@ -77,6 +79,30 @@ class ConcatenationScope {
77
79
  }
78
80
  }
79
81
 
82
+ /**
83
+ * @param {string} exportName name of the export
84
+ * @returns {string | undefined} the expression of the export
85
+ */
86
+ getRawExport(exportName) {
87
+ if (!this._currentModule.rawExportMap) {
88
+ return undefined;
89
+ }
90
+ return this._currentModule.rawExportMap.get(exportName);
91
+ }
92
+
93
+ /**
94
+ * @param {string} exportName name of the export
95
+ * @param {string} expression expression to be used
96
+ */
97
+ setRawExportMap(exportName, expression) {
98
+ if (!this._currentModule.rawExportMap) {
99
+ this._currentModule.rawExportMap = new Map();
100
+ }
101
+ if (this._currentModule.rawExportMap.has(exportName)) {
102
+ this._currentModule.rawExportMap.set(exportName, expression);
103
+ }
104
+ }
105
+
80
106
  /**
81
107
  * @param {string} symbol identifier of the export in source code
82
108
  */
@@ -84,6 +110,18 @@ class ConcatenationScope {
84
110
  this._currentModule.namespaceExportSymbol = symbol;
85
111
  }
86
112
 
113
+ /**
114
+ * @param {string} symbol identifier of the export in source code
115
+ * @returns {boolean} registered success
116
+ */
117
+ registerUsedName(symbol) {
118
+ if (this.usedNames.has(symbol)) {
119
+ return false;
120
+ }
121
+ this.usedNames.add(symbol);
122
+ return true;
123
+ }
124
+
87
125
  /**
88
126
  * @param {Module} module the referenced module
89
127
  * @param {Partial<ModuleReferenceOptions>} options options
@@ -159,9 +159,9 @@ class ConstPlugin {
159
159
  /**
160
160
  * @param {JavascriptParser} parser the parser
161
161
  */
162
- const handler = parser => {
163
- parser.hooks.terminate.tap(PLUGIN_NAME, _statement => true);
164
- parser.hooks.statementIf.tap(PLUGIN_NAME, statement => {
162
+ const handler = (parser) => {
163
+ parser.hooks.terminate.tap(PLUGIN_NAME, (_statement) => true);
164
+ parser.hooks.statementIf.tap(PLUGIN_NAME, (statement) => {
165
165
  if (parser.scope.isAsmJs) return;
166
166
  const param = parser.evaluateExpression(statement.test);
167
167
  const bool = param.asBool();
@@ -185,7 +185,7 @@ class ConstPlugin {
185
185
  return bool;
186
186
  }
187
187
  });
188
- parser.hooks.unusedStatement.tap(PLUGIN_NAME, statement => {
188
+ parser.hooks.unusedStatement.tap(PLUGIN_NAME, (statement) => {
189
189
  if (
190
190
  parser.scope.isAsmJs ||
191
191
  // Check top level scope here again
@@ -198,7 +198,7 @@ class ConstPlugin {
198
198
  });
199
199
  parser.hooks.expressionConditionalOperator.tap(
200
200
  PLUGIN_NAME,
201
- expression => {
201
+ (expression) => {
202
202
  if (parser.scope.isAsmJs) return;
203
203
  const param = parser.evaluateExpression(expression.test);
204
204
  const bool = param.asBool();
@@ -239,7 +239,7 @@ class ConstPlugin {
239
239
  );
240
240
  parser.hooks.expressionLogicalOperator.tap(
241
241
  PLUGIN_NAME,
242
- expression => {
242
+ (expression) => {
243
243
  if (parser.scope.isAsmJs) return;
244
244
  if (
245
245
  expression.operator === "&&" ||
@@ -381,7 +381,7 @@ class ConstPlugin {
381
381
  }
382
382
  }
383
383
  );
384
- parser.hooks.optionalChaining.tap(PLUGIN_NAME, expr => {
384
+ parser.hooks.optionalChaining.tap(PLUGIN_NAME, (expr) => {
385
385
  /** @type {Expression[]} */
386
386
  const optionalExpressionsStack = [];
387
387
  /** @type {Expression | Super} */
@@ -441,7 +441,7 @@ class ConstPlugin {
441
441
  });
442
442
  parser.hooks.evaluateIdentifier
443
443
  .for("__resourceQuery")
444
- .tap(PLUGIN_NAME, expr => {
444
+ .tap(PLUGIN_NAME, (expr) => {
445
445
  if (parser.scope.isAsmJs) return;
446
446
  if (!parser.state.module) return;
447
447
  return evaluateToString(
@@ -450,7 +450,7 @@ class ConstPlugin {
450
450
  });
451
451
  parser.hooks.expression
452
452
  .for("__resourceQuery")
453
- .tap(PLUGIN_NAME, expr => {
453
+ .tap(PLUGIN_NAME, (expr) => {
454
454
  if (parser.scope.isAsmJs) return;
455
455
  if (!parser.state.module) return;
456
456
  const dep = new CachedConstDependency(
@@ -467,7 +467,7 @@ class ConstPlugin {
467
467
 
468
468
  parser.hooks.evaluateIdentifier
469
469
  .for("__resourceFragment")
470
- .tap(PLUGIN_NAME, expr => {
470
+ .tap(PLUGIN_NAME, (expr) => {
471
471
  if (parser.scope.isAsmJs) return;
472
472
  if (!parser.state.module) return;
473
473
  return evaluateToString(
@@ -476,7 +476,7 @@ class ConstPlugin {
476
476
  });
477
477
  parser.hooks.expression
478
478
  .for("__resourceFragment")
479
- .tap(PLUGIN_NAME, expr => {
479
+ .tap(PLUGIN_NAME, (expr) => {
480
480
  if (parser.scope.isAsmJs) return;
481
481
  if (!parser.state.module) return;
482
482
  const dep = new CachedConstDependency(
@@ -23,9 +23,9 @@ class ContextExclusionPlugin {
23
23
  * @returns {void}
24
24
  */
25
25
  apply(compiler) {
26
- compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
27
- cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, files =>
28
- files.filter(filePath => !this.negativeMatcher.test(filePath))
26
+ compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => {
27
+ cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, (files) =>
28
+ files.filter((filePath) => !this.negativeMatcher.test(filePath))
29
29
  );
30
30
  });
31
31
  }
@@ -283,7 +283,7 @@ class ContextModule extends Module {
283
283
  identifier = `${requestShortener.shorten(`${this.options.resource}`)}/`;
284
284
  } else {
285
285
  identifier = this.options.resource
286
- .map(r => `${requestShortener.shorten(r)}/`)
286
+ .map((r) => `${requestShortener.shorten(r)}/`)
287
287
  .join(" ");
288
288
  }
289
289
  if (this.options.resourceQuery) {
@@ -309,7 +309,7 @@ class ContextModule extends Module {
309
309
  }
310
310
  if (this.options.referencedExports) {
311
311
  identifier += ` referencedExports: ${this.options.referencedExports
312
- .map(e => e.join("."))
312
+ .map((e) => e.join("."))
313
313
  .join(", ")}`;
314
314
  }
315
315
  if (this.options.chunkName) {
@@ -355,7 +355,7 @@ class ContextModule extends Module {
355
355
  identifier = "false";
356
356
  } else {
357
357
  identifier = this.options.resource
358
- .map(res =>
358
+ .map((res) =>
359
359
  contextify(options.context, res, options.associatedObjectForCache)
360
360
  )
361
361
  .join(" ");
@@ -386,7 +386,7 @@ class ContextModule extends Module {
386
386
  }
387
387
  if (this.options.referencedExports) {
388
388
  identifier += ` referencedExports: ${this.options.referencedExports
389
- .map(e => e.join("."))
389
+ .map((e) => e.join("."))
390
390
  .join(", ")}`;
391
391
  }
392
392
 
@@ -466,7 +466,7 @@ class ContextModule extends Module {
466
466
  }
467
467
  dependencies.sort(
468
468
  concatComparators(
469
- compareSelect(a => a.loc, compareLocations),
469
+ compareSelect((a) => a.loc, compareLocations),
470
470
  keepOriginalOrder(this.dependencies)
471
471
  )
472
472
  );
@@ -588,7 +588,7 @@ class ContextModule extends Module {
588
588
  const sortedDependencies =
589
589
  /** @type {ContextElementDependency[]} */
590
590
  (dependencies)
591
- .filter(dependency => moduleGraph.getModule(dependency))
591
+ .filter((dependency) => moduleGraph.getModule(dependency))
592
592
  .sort((a, b) => {
593
593
  if (a.userRequest === b.userRequest) {
594
594
  return 0;
@@ -621,7 +621,8 @@ class ContextModule extends Module {
621
621
  // therefore the order of this is !important!
622
622
  const sortedModules = dependencies
623
623
  .map(
624
- dependency => /** @type {Module} */ (moduleGraph.getModule(dependency))
624
+ (dependency) =>
625
+ /** @type {Module} */ (moduleGraph.getModule(dependency))
625
626
  )
626
627
  .filter(Boolean)
627
628
  .sort(comparator);
@@ -945,7 +946,7 @@ module.exports = webpackAsyncContext;`;
945
946
  let hasMultipleOrNoChunks = false;
946
947
  let hasNoChunk = true;
947
948
  const fakeMap = this.getFakeMap(
948
- blocks.map(b => b.dependencies[0]),
949
+ blocks.map((b) => b.dependencies[0]),
949
950
  chunkGraph
950
951
  );
951
952
  const hasFakeMap = typeof fakeMap === "object";
@@ -954,7 +955,7 @@ module.exports = webpackAsyncContext;`;
954
955
  * @type {Item[]}
955
956
  */
956
957
  const items = blocks
957
- .map(block => {
958
+ .map((block) => {
958
959
  const dependency =
959
960
  /** @type {ContextElementDependency} */
960
961
  (block.dependencies[0]);
@@ -966,7 +967,7 @@ module.exports = webpackAsyncContext;`;
966
967
  chunks: undefined
967
968
  };
968
969
  })
969
- .filter(item => item.module);
970
+ .filter((item) => item.module);
970
971
  for (const item of items) {
971
972
  const chunkGroup = chunkGraph.getBlockChunkGroup(item.block);
972
973
  const chunks = (chunkGroup && chunkGroup.chunks) || [];
@@ -1000,7 +1001,7 @@ module.exports = webpackAsyncContext;`;
1000
1001
  map[item.userRequest] = [
1001
1002
  ...arrayStart,
1002
1003
  .../** @type {Chunk[]} */
1003
- (item.chunks).map(chunk => /** @type {ChunkId} */ (chunk.id))
1004
+ (item.chunks).map((chunk) => /** @type {ChunkId} */ (chunk.id))
1004
1005
  ];
1005
1006
  }
1006
1007
  }
@@ -56,7 +56,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
56
56
  {
57
57
  name: "alternatives",
58
58
  /** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["intercept"]} */
59
- intercept: interceptor => {
59
+ intercept: (interceptor) => {
60
60
  throw new Error(
61
61
  "Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead"
62
62
  );
@@ -169,13 +169,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
169
169
 
170
170
  asyncLib.parallel(
171
171
  [
172
- callback => {
172
+ (callback) => {
173
173
  const results = /** @type ResolveRequest[] */ ([]);
174
174
  /**
175
175
  * @param {ResolveRequest} obj obj
176
176
  * @returns {void}
177
177
  */
178
- const yield_ = obj => {
178
+ const yield_ = (obj) => {
179
179
  results.push(obj);
180
180
  };
181
181
 
@@ -189,13 +189,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
189
189
  contextDependencies,
190
190
  yield: yield_
191
191
  },
192
- err => {
192
+ (err) => {
193
193
  if (err) return callback(err);
194
194
  callback(null, results);
195
195
  }
196
196
  );
197
197
  },
198
- callback => {
198
+ (callback) => {
199
199
  asyncLib.map(
200
200
  loaders,
201
201
  (loader, callback) => {
@@ -230,7 +230,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
230
230
  /** @type {[ResolveRequest[], string[]]} */ (result);
231
231
  if (contextResult.length > 1) {
232
232
  const first = contextResult[0];
233
- contextResult = contextResult.filter(r => r.path);
233
+ contextResult = contextResult.filter((r) => r.path);
234
234
  if (contextResult.length === 0) contextResult.push(first);
235
235
  }
236
236
  this.hooks.afterResolve.callAsync(
@@ -241,7 +241,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
241
241
  (loaderResult.length > 0 ? "!" : ""),
242
242
  resource:
243
243
  contextResult.length > 1
244
- ? contextResult.map(r => r.path)
244
+ ? contextResult.map((r) => r.path)
245
245
  : contextResult[0].path,
246
246
  resolveDependencies: this.resolveDependencies.bind(this),
247
247
  resourceQuery: contextResult[0].query,
@@ -342,13 +342,13 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
342
342
  fs.readdir(directory, (err, files) => {
343
343
  if (err) return callback(err);
344
344
  const processedFiles = cmf.hooks.contextModuleFiles.call(
345
- /** @type {string[]} */ (files).map(file => file.normalize("NFC"))
345
+ /** @type {string[]} */ (files).map((file) => file.normalize("NFC"))
346
346
  );
347
347
  if (!processedFiles || processedFiles.length === 0) {
348
348
  return callback(null, []);
349
349
  }
350
350
  asyncLib.map(
351
- processedFiles.filter(p => p.indexOf(".") !== 0),
351
+ processedFiles.filter((p) => p.indexOf(".") !== 0),
352
352
  (segment, callback) => {
353
353
  const subResource = join(fs, directory, segment);
354
354
 
@@ -387,10 +387,10 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
387
387
  null,
388
388
  /** @type {ContextAlternativeRequest[]} */
389
389
  (alternatives)
390
- .filter(obj =>
390
+ .filter((obj) =>
391
391
  regExp.test(/** @type {string} */ (obj.request))
392
392
  )
393
- .map(obj => {
393
+ .map((obj) => {
394
394
  const dep = new ContextElementDependency(
395
395
  `${obj.request}${resourceQuery}${resourceFragment}`,
396
396
  obj.request,
@@ -97,8 +97,8 @@ class ContextReplacementPlugin {
97
97
  const newContentRegExp = this.newContentRegExp;
98
98
  const newContentCreateContextMap = this.newContentCreateContextMap;
99
99
 
100
- compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
101
- cmf.hooks.beforeResolve.tap(PLUGIN_NAME, result => {
100
+ compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, (cmf) => {
101
+ cmf.hooks.beforeResolve.tap(PLUGIN_NAME, (result) => {
102
102
  if (!result) return;
103
103
  if (resourceRegExp.test(result.request)) {
104
104
  if (newContentResource !== undefined) {
@@ -120,7 +120,7 @@ class ContextReplacementPlugin {
120
120
  }
121
121
  return result;
122
122
  });
123
- cmf.hooks.afterResolve.tap(PLUGIN_NAME, result => {
123
+ cmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => {
124
124
  if (!result) return;
125
125
  if (resourceRegExp.test(result.resource)) {
126
126
  if (newContentResource !== undefined) {
@@ -183,11 +183,11 @@ class ContextReplacementPlugin {
183
183
  * @returns {(fs: InputFileSystem, options: ContextModuleOptions, callback: (err: null | Error, dependencies?: ContextElementDependency[]) => void) => void} resolve resolve dependencies from context map function
184
184
  */
185
185
  const createResolveDependenciesFromContextMap =
186
- createContextMap => (fs, options, callback) => {
186
+ (createContextMap) => (fs, options, callback) => {
187
187
  createContextMap(fs, (err, map) => {
188
188
  if (err) return callback(err);
189
189
  const dependencies = Object.keys(map).map(
190
- key =>
190
+ (key) =>
191
191
  new ContextElementDependency(
192
192
  map[key] + options.resourceQuery + options.resourceFragment,
193
193
  key,