webpack 5.100.2 → 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 +126 -113
  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 +9 -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 +23 -23
  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 +35 -26
  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 +3 -3
  88. package/lib/asset/AssetGenerator.js +1 -1
  89. package/lib/asset/AssetModulesPlugin.js +6 -6
  90. package/lib/async-modules/AsyncModuleHelpers.js +1 -1
  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 -13
  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 +56 -48
  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 +80 -78
  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 +5 -5
  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 +85 -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 +10 -10
  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 +151 -44
@@ -14,7 +14,7 @@ const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
14
14
  * @param {string} relativePath relative path
15
15
  * @returns {string} request
16
16
  */
17
- const relativePathToRequest = relativePath => {
17
+ const relativePathToRequest = (relativePath) => {
18
18
  if (relativePath === "") return "./.";
19
19
  if (relativePath === "..") return "../.";
20
20
  if (relativePath.startsWith("../")) return relativePath;
@@ -103,7 +103,7 @@ const requestToAbsolute = (context, relativePath) => {
103
103
  * @param {((value: string) => T)} realFn real function
104
104
  * @returns {MakeCacheableResult<T> & { bindCache: BindCache<T> }} cacheable function
105
105
  */
106
- const makeCacheable = realFn => {
106
+ const makeCacheable = (realFn) => {
107
107
  /**
108
108
  * @template T
109
109
  * @typedef {Map<string, T>} CacheItem
@@ -115,7 +115,7 @@ const makeCacheable = realFn => {
115
115
  * @param {AssociatedObjectForCache} associatedObjectForCache an object to which the cache will be attached
116
116
  * @returns {CacheItem<T>} cache item
117
117
  */
118
- const getCache = associatedObjectForCache => {
118
+ const getCache = (associatedObjectForCache) => {
119
119
  const entry = cache.get(associatedObjectForCache);
120
120
  if (entry !== undefined) return entry;
121
121
  /** @type {Map<string, T>} */
@@ -136,13 +136,13 @@ const makeCacheable = realFn => {
136
136
  };
137
137
 
138
138
  /** @type {BindCache<T>} */
139
- fn.bindCache = associatedObjectForCache => {
139
+ fn.bindCache = (associatedObjectForCache) => {
140
140
  const cache = getCache(associatedObjectForCache);
141
141
  /**
142
142
  * @param {string} str string
143
143
  * @returns {T} value
144
144
  */
145
- return str => {
145
+ return (str) => {
146
146
  const entry = cache.get(str);
147
147
  if (entry !== undefined) return entry;
148
148
  const result = realFn(str);
@@ -164,7 +164,7 @@ const makeCacheable = realFn => {
164
164
  * @param {(context: string, identifier: string) => string} fn function
165
165
  * @returns {MakeCacheableWithContextResult & { bindCache: BindCacheForContext, bindContextCache: BindContextCacheForContext }} cacheable function with context
166
166
  */
167
- const makeCacheableWithContext = fn => {
167
+ const makeCacheableWithContext = (fn) => {
168
168
  /** @type {WeakMap<AssociatedObjectForCache, Map<string, Map<string, string>>>} */
169
169
  const cache = new WeakMap();
170
170
 
@@ -195,7 +195,7 @@ const makeCacheableWithContext = fn => {
195
195
  };
196
196
 
197
197
  /** @type {BindCacheForContext} */
198
- cachedFn.bindCache = associatedObjectForCache => {
198
+ cachedFn.bindCache = (associatedObjectForCache) => {
199
199
  let innerCache;
200
200
  if (associatedObjectForCache) {
201
201
  innerCache = cache.get(associatedObjectForCache);
@@ -254,7 +254,7 @@ const makeCacheableWithContext = fn => {
254
254
  * @param {string} identifier identifier used to create relative path
255
255
  * @returns {string} the returned relative path
256
256
  */
257
- const boundFn = identifier => {
257
+ const boundFn = (identifier) => {
258
258
  const cachedResult = innerSubCache.get(identifier);
259
259
  if (cachedResult !== undefined) {
260
260
  return cachedResult;
@@ -278,7 +278,7 @@ const makeCacheableWithContext = fn => {
278
278
  const _makePathsRelative = (context, identifier) =>
279
279
  identifier
280
280
  .split(SEGMENTS_SPLIT_REGEXP)
281
- .map(str => absoluteToRequest(context, str))
281
+ .map((str) => absoluteToRequest(context, str))
282
282
  .join("");
283
283
 
284
284
  /**
@@ -289,7 +289,7 @@ const _makePathsRelative = (context, identifier) =>
289
289
  const _makePathsAbsolute = (context, identifier) =>
290
290
  identifier
291
291
  .split(SEGMENTS_SPLIT_REGEXP)
292
- .map(str => requestToAbsolute(context, str))
292
+ .map((str) => requestToAbsolute(context, str))
293
293
  .join("");
294
294
 
295
295
  /**
@@ -300,7 +300,7 @@ const _makePathsAbsolute = (context, identifier) =>
300
300
  const _contextify = (context, request) =>
301
301
  request
302
302
  .split("!")
303
- .map(r => absoluteToRequest(context, r))
303
+ .map((r) => absoluteToRequest(context, r))
304
304
  .join("!");
305
305
 
306
306
  const contextify = makeCacheableWithContext(_contextify);
@@ -313,7 +313,7 @@ const contextify = makeCacheableWithContext(_contextify);
313
313
  const _absolutify = (context, request) =>
314
314
  request
315
315
  .split("!")
316
- .map(r => requestToAbsolute(context, r))
316
+ .map((r) => requestToAbsolute(context, r))
317
317
  .join("!");
318
318
 
319
319
  const absolutify = makeCacheableWithContext(_absolutify);
@@ -329,7 +329,7 @@ const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/;
329
329
  * @param {string} str the path with query and fragment
330
330
  * @returns {ParsedResource} parsed parts
331
331
  */
332
- const _parseResource = str => {
332
+ const _parseResource = (str) => {
333
333
  const match =
334
334
  /** @type {[string, string, string | undefined, string | undefined]} */
335
335
  (/** @type {unknown} */ (PATH_QUERY_FRAGMENT_REGEXP.exec(str)));
@@ -346,7 +346,7 @@ const _parseResource = str => {
346
346
  * @param {string} str the path with query and fragment
347
347
  * @returns {ParsedResourceWithoutFragment} parsed parts
348
348
  */
349
- const _parseResourceWithoutFragment = str => {
349
+ const _parseResourceWithoutFragment = (str) => {
350
350
  const match =
351
351
  /** @type {[string, string, string | undefined]} */
352
352
  (/** @type {unknown} */ (PATH_QUERY_REGEXP.exec(str)));
@@ -5,9 +5,13 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const memoize = require("./memoize");
9
+
10
+ const getVm = memoize(() => require("vm"));
11
+
8
12
  // regexp to match at least one "magic comment"
9
13
  module.exports.createMagicCommentContext = () =>
10
- require("vm").createContext(undefined, {
14
+ getVm().createContext(undefined, {
11
15
  name: "Webpack Magic Comment Parser",
12
16
  codeGeneration: { strings: false, wasm: false }
13
17
  });
@@ -14,7 +14,7 @@
14
14
  * @param {FunctionReturning<T>} fn memorized function
15
15
  * @returns {FunctionReturning<T>} new function
16
16
  */
17
- const memoize = fn => {
17
+ const memoize = (fn) => {
18
18
  let cache = false;
19
19
  /** @type {T | undefined} */
20
20
  let result;
@@ -24,7 +24,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
24
24
  /**
25
25
  * @param {T} item item
26
26
  */
27
- const push = item => {
27
+ const push = (item) => {
28
28
  queue.push(item);
29
29
  if (!processScheduled && processing < concurrency) {
30
30
  processScheduled = true;
@@ -35,7 +35,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
35
35
  /**
36
36
  * @param {E | null | undefined} err error
37
37
  */
38
- const processorCallback = err => {
38
+ const processorCallback = (err) => {
39
39
  processing--;
40
40
  if (err && !finished) {
41
41
  finished = true;
@@ -66,7 +66,7 @@ const RESERVED_IDENTIFIER = new Set([
66
66
  * @param {string} prop property name to analyze
67
67
  * @returns {string} valid JS property name
68
68
  */
69
- const propertyName = prop => {
69
+ const propertyName = (prop) => {
70
70
  if (SAFE_IDENTIFIER.test(prop) && !RESERVED_IDENTIFIER.has(prop)) {
71
71
  return prop;
72
72
  }
@@ -9,7 +9,7 @@
9
9
  * @param {string | Buffer} strOrBuffer string or buffer
10
10
  * @returns {string | Buffer} result without BOM
11
11
  */
12
- module.exports = strOrBuffer => {
12
+ module.exports = (strOrBuffer) => {
13
13
  if (typeof strOrBuffer === "string" && strOrBuffer.charCodeAt(0) === 0xfeff) {
14
14
  return strOrBuffer.slice(1);
15
15
  } else if (
@@ -74,7 +74,7 @@ const forEachRuntime = (runtime, fn, deterministicOrder = false) => {
74
74
  * @param {SortableSet<T>} set set
75
75
  * @returns {string} runtime key
76
76
  */
77
- const getRuntimesKey = set => {
77
+ const getRuntimesKey = (set) => {
78
78
  set.sort();
79
79
  return [...set].join("\n");
80
80
  };
@@ -83,7 +83,7 @@ const getRuntimesKey = set => {
83
83
  * @param {RuntimeSpec} runtime runtime(s)
84
84
  * @returns {string} key of runtimes
85
85
  */
86
- const getRuntimeKey = runtime => {
86
+ const getRuntimeKey = (runtime) => {
87
87
  if (runtime === undefined) return "*";
88
88
  if (typeof runtime === "string") return runtime;
89
89
  return runtime.getFromUnorderedCache(getRuntimesKey);
@@ -93,7 +93,7 @@ const getRuntimeKey = runtime => {
93
93
  * @param {string} key key of runtimes
94
94
  * @returns {RuntimeSpec} runtime(s)
95
95
  */
96
- const keyToRuntime = key => {
96
+ const keyToRuntime = (key) => {
97
97
  if (key === "*") return;
98
98
  const items = key.split("\n");
99
99
  if (items.length === 1) return items[0];
@@ -105,7 +105,7 @@ const keyToRuntime = key => {
105
105
  * @param {SortableSet<T>} set set
106
106
  * @returns {string} runtime string
107
107
  */
108
- const getRuntimesString = set => {
108
+ const getRuntimesString = (set) => {
109
109
  set.sort();
110
110
  return [...set].join("+");
111
111
  };
@@ -114,7 +114,7 @@ const getRuntimesString = set => {
114
114
  * @param {RuntimeSpec} runtime runtime(s)
115
115
  * @returns {string} readable version
116
116
  */
117
- const runtimeToString = runtime => {
117
+ const runtimeToString = (runtime) => {
118
118
  if (runtime === undefined) return "*";
119
119
  if (typeof runtime === "string") return runtime;
120
120
  return runtime.getFromUnorderedCache(getRuntimesString);
@@ -124,7 +124,7 @@ const runtimeToString = runtime => {
124
124
  * @param {RuntimeCondition} runtimeCondition runtime condition
125
125
  * @returns {string} readable version
126
126
  */
127
- const runtimeConditionToString = runtimeCondition => {
127
+ const runtimeConditionToString = (runtimeCondition) => {
128
128
  if (runtimeCondition === true) return "true";
129
129
  if (runtimeCondition === false) return "false";
130
130
  return runtimeToString(runtimeCondition);
@@ -13,7 +13,7 @@
13
13
  * @param {string} str version string
14
14
  * @returns {SemVerRange} parsed version
15
15
  */
16
- const parseVersion = str => {
16
+ const parseVersion = (str) => {
17
17
  /**
18
18
  * @param {str} str str
19
19
  * @returns {(string | number)[]} result
@@ -100,15 +100,15 @@ module.exports.versionLt = versionLt;
100
100
  * @param {string} str range string
101
101
  * @returns {SemVerRange} parsed range
102
102
  */
103
- module.exports.parseRange = str => {
103
+ module.exports.parseRange = (str) => {
104
104
  /**
105
105
  * @param {string} str str
106
106
  * @returns {(string | number)[]} result
107
107
  */
108
- const splitAndConvert = str => {
108
+ const splitAndConvert = (str) => {
109
109
  return str
110
110
  .split(".")
111
- .map(item => (item !== "NaN" && `${+item}` === item ? +item : item));
111
+ .map((item) => (item !== "NaN" && `${+item}` === item ? +item : item));
112
112
  };
113
113
 
114
114
  // see https://docs.npmjs.com/misc/semver#range-grammar for grammar
@@ -116,7 +116,7 @@ module.exports.parseRange = str => {
116
116
  * @param {string} str str
117
117
  * @returns {SemVerRangeItem[]}
118
118
  */
119
- const parsePartial = str => {
119
+ const parsePartial = (str) => {
120
120
  const match =
121
121
  /** @type {RegExpExecArray} */
122
122
  (/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str));
@@ -146,7 +146,7 @@ module.exports.parseRange = str => {
146
146
  * @param {SemVerRangeItem[]} range range
147
147
  * @returns {SemVerRangeItem[]}
148
148
  */
149
- const toFixed = range => {
149
+ const toFixed = (range) => {
150
150
  if (range.length === 1) {
151
151
  // Special case for "*" is "x.x.x" instead of "="
152
152
  return [0];
@@ -166,7 +166,7 @@ module.exports.parseRange = str => {
166
166
  * @param {SemVerRangeItem[]} range
167
167
  * @returns {SemVerRangeItem[]} result
168
168
  */
169
- const negate = range => {
169
+ const negate = (range) => {
170
170
  return [-(/** @type { [number]} */ (range)[0]) - 1, ...range.slice(1)];
171
171
  };
172
172
 
@@ -174,7 +174,7 @@ module.exports.parseRange = str => {
174
174
  * @param {string} str str
175
175
  * @returns {SemVerRange}
176
176
  */
177
- const parseSimple = str => {
177
+ const parseSimple = (str) => {
178
178
  // simple ::= primitive | partial | tilde | caret
179
179
  // primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | '!' ) ( ' ' ) * partial
180
180
  // tilde ::= '~' ( ' ' ) * partial
@@ -253,7 +253,7 @@ module.exports.parseRange = str => {
253
253
  * @param {string} str str
254
254
  * @returns {SemVerRange}
255
255
  */
256
- const parseRange = str => {
256
+ const parseRange = (str) => {
257
257
  // range ::= hyphen | simple ( ' ' ( ' ' ) * simple ) * | ''
258
258
  // hyphen ::= partial ( ' ' ) * ' - ' ( ' ' ) * partial
259
259
  const items = str.split(/\s+-\s+/);
@@ -292,7 +292,7 @@ module.exports.parseRange = str => {
292
292
  * @param {string} str str
293
293
  * @returns {SemVerRange}
294
294
  */
295
- const parseLogicalOr = str => {
295
+ const parseLogicalOr = (str) => {
296
296
  // range-set ::= range ( logical-or range ) *
297
297
  // logical-or ::= ( ' ' ) * '||' ( ' ' ) *
298
298
  const items =
@@ -310,7 +310,7 @@ module.exports.parseRange = str => {
310
310
  * @param {SemVerRange} range
311
311
  * @returns {string}
312
312
  */
313
- const rangeToString = range => {
313
+ const rangeToString = (range) => {
314
314
  var fixCount = /** @type {number} */ (range[0]);
315
315
  var str = "";
316
316
  if (range.length === 1) {
@@ -532,7 +532,7 @@ module.exports.satisfy = satisfy;
532
532
  * @param {SemVerRange | string | number | false | undefined} json
533
533
  * @returns {string}
534
534
  */
535
- module.exports.stringifyHoley = json => {
535
+ module.exports.stringifyHoley = (json) => {
536
536
  switch (typeof json) {
537
537
  case "undefined":
538
538
  return "";
@@ -558,7 +558,7 @@ module.exports.stringifyHoley = json => {
558
558
  * @param {RuntimeTemplate} runtimeTemplate
559
559
  * @returns {string}
560
560
  */
561
- exports.parseVersionRuntimeCode = runtimeTemplate =>
561
+ exports.parseVersionRuntimeCode = (runtimeTemplate) =>
562
562
  `var parseVersion = ${runtimeTemplate.basicFunction("str", [
563
563
  "// see webpack/lib/util/semver.js for original code",
564
564
  `var p=${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return p.split(".").map(${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return+p==p?+p:p})},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;`
@@ -570,7 +570,7 @@ exports.parseVersionRuntimeCode = runtimeTemplate =>
570
570
  * @param {RuntimeTemplate} runtimeTemplate
571
571
  * @returns {string}
572
572
  */
573
- exports.versionLtRuntimeCode = runtimeTemplate =>
573
+ exports.versionLtRuntimeCode = (runtimeTemplate) =>
574
574
  `var versionLt = ${runtimeTemplate.basicFunction("a, b", [
575
575
  "// see webpack/lib/util/semver.js for original code",
576
576
  'a=parseVersion(a),b=parseVersion(b);for(var r=0;;){if(r>=a.length)return r<b.length&&"u"!=(typeof b[r])[0];var e=a[r],n=(typeof e)[0];if(r>=b.length)return"u"==n;var t=b[r],f=(typeof t)[0];if(n!=f)return"o"==n&&"n"==f||("s"==f||"u"==n);if("o"!=n&&"u"!=n&&e!=t)return e<t;r++}'
@@ -582,7 +582,7 @@ exports.versionLtRuntimeCode = runtimeTemplate =>
582
582
  * @param {RuntimeTemplate} runtimeTemplate
583
583
  * @returns {string}
584
584
  */
585
- exports.rangeToStringRuntimeCode = runtimeTemplate =>
585
+ exports.rangeToStringRuntimeCode = (runtimeTemplate) =>
586
586
  `var rangeToString = ${runtimeTemplate.basicFunction("range", [
587
587
  "// see webpack/lib/util/semver.js for original code",
588
588
  'var r=range[0],n="";if(1===range.length)return"*";if(r+.5){n+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a<range.length;a++){e--,n+="u"==(typeof(t=range[a]))[0]?"-":(e>0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a<range.length;a++){var t=range[a];g.push(0===t?"not("+o()+")":1===t?"("+o()+" || "+o()+")":2===t?g.pop()+" "+g.pop():rangeToString(t))}return o();function o(){return g.pop().replace(/^\\((.+)\\)$/,"$1")}'
@@ -594,7 +594,7 @@ exports.rangeToStringRuntimeCode = runtimeTemplate =>
594
594
  * @param {RuntimeTemplate} runtimeTemplate
595
595
  * @returns {string}
596
596
  */
597
- exports.satisfyRuntimeCode = runtimeTemplate =>
597
+ exports.satisfyRuntimeCode = (runtimeTemplate) =>
598
598
  `var satisfy = ${runtimeTemplate.basicFunction("range, version", [
599
599
  "// see webpack/lib/util/semver.js for original code",
600
600
  'if(0 in range){version=parseVersion(version);var e=range[0],r=e<0;r&&(e=-e-1);for(var n=0,i=1,a=!0;;i++,n++){var f,s,g=i<range.length?(typeof range[i])[0]:"";if(n>=version.length||"o"==(s=(typeof(f=version[n]))[0]))return!a||("u"==g?i>e&&!r:""==g!=r);if("u"==s){if(!a||"u"!=g)return!1}else if(a)if(g==s)if(i<=e){if(f!=range[i])return!1}else{if(r?f>range[i]:f<range[i])return!1;f!=range[i]&&(a=!1)}else if("s"!=g&&"n"!=g){if(r||i<=e)return!1;a=!1,i--}else{if(i<=e||s<g!=r)return!1;a=!1}else"s"!=g&&"n"!=g&&(a=!1,i--)}}var t=[],o=t.pop.bind(t);for(n=1;n<range.length;n++){var u=range[n];t.push(1==u?o()|o():2==u?o()&o():u?satisfy(u,version):!o())}return!!o();'
@@ -42,7 +42,7 @@ const registerSerializers = memoize(() => {
42
42
  // This allows bundling all internal serializers
43
43
  const internalSerializables = require("./internalSerializables");
44
44
 
45
- getObjectMiddleware().registerLoader(/^webpack\/lib\//, req => {
45
+ getObjectMiddleware().registerLoader(/^webpack\/lib\//, (req) => {
46
46
  const loader =
47
47
  internalSerializables[
48
48
  /** @type {keyof import("./internalSerializables")} */
@@ -95,9 +95,9 @@ module.exports = {
95
95
  return /** @type {Serializer<EXPECTED_ANY, EXPECTED_ANY, EXPECTED_ANY>} */ (
96
96
  buffersSerializer = new Serializer([
97
97
  new SingleItemMiddleware(),
98
- new (getObjectMiddleware())(context => {
98
+ new (getObjectMiddleware())((context) => {
99
99
  if ("write" in context) {
100
- context.writeLazy = value => {
100
+ context.writeLazy = (value) => {
101
101
  context.write(
102
102
  SerializerMiddleware.createLazy(value, binaryMiddleware)
103
103
  );
@@ -127,9 +127,9 @@ module.exports = {
127
127
  return /** @type {Serializer<D, S, C>} */ (
128
128
  new Serializer([
129
129
  new SingleItemMiddleware(),
130
- new (getObjectMiddleware())(context => {
130
+ new (getObjectMiddleware())((context) => {
131
131
  if ("write" in context) {
132
- context.writeLazy = value => {
132
+ context.writeLazy = (value) => {
133
133
  context.write(
134
134
  SerializerMiddleware.createLazy(value, binaryMiddleware)
135
135
  );
@@ -81,7 +81,7 @@ const smartGrouping = (items, groupConfigs) => {
81
81
  * @param {Set<ItemWithGroups<T, R>>} itemsWithGroups input items with groups
82
82
  * @returns {(T | R)[]} groups items
83
83
  */
84
- const runGrouping = itemsWithGroups => {
84
+ const runGrouping = (itemsWithGroups) => {
85
85
  const totalSize = itemsWithGroups.size;
86
86
  for (const entry of itemsWithGroups) {
87
87
  for (const group of entry.groups) {
@@ -85,7 +85,7 @@ const validateSchema = (schema, options, validationConfiguration) => {
85
85
  if (
86
86
  children &&
87
87
  children.some(
88
- child =>
88
+ (child) =>
89
89
  child.keyword === "absolutePath" &&
90
90
  child.instancePath === "/output/filename"
91
91
  )
@@ -96,7 +96,7 @@ const validateSchema = (schema, options, validationConfiguration) => {
96
96
  if (
97
97
  children &&
98
98
  children.some(
99
- child =>
99
+ (child) =>
100
100
  child.keyword === "pattern" && child.instancePath === "/devtool"
101
101
  )
102
102
  ) {
@@ -16,7 +16,7 @@ const enabledTypes = new WeakMap();
16
16
  * @param {Compiler} compiler compiler instance
17
17
  * @returns {Set<WasmLoadingType>} enabled types
18
18
  */
19
- const getEnabledTypes = compiler => {
19
+ const getEnabledTypes = (compiler) => {
20
20
  let set = enabledTypes.get(compiler);
21
21
  if (set === undefined) {
22
22
  set = new Set();
@@ -50,7 +50,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule {
50
50
  JSON.stringify(outputOptions.webassemblyModuleFilename),
51
51
  {
52
52
  hash: `" + ${RuntimeGlobals.getFullHash}() + "`,
53
- hashWithLength: length =>
53
+ hashWithLength: (length) =>
54
54
  `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`,
55
55
  module: {
56
56
  id: '" + wasmModuleId + "',
@@ -120,7 +120,7 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
120
120
  const importObjRequestItems = Array.from(
121
121
  wasmDepsByRequest,
122
122
  ([request, deps]) => {
123
- const exportItems = deps.map(dep => {
123
+ const exportItems = deps.map((dep) => {
124
124
  const importedModule =
125
125
  /** @type {Module} */
126
126
  (moduleGraph.getModule(dep));
@@ -22,13 +22,13 @@ class UniversalCompileAsyncWasmPlugin {
22
22
  * @returns {void}
23
23
  */
24
24
  apply(compiler) {
25
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
25
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
26
26
  const globalWasmLoading = compilation.outputOptions.wasmLoading;
27
27
  /**
28
28
  * @param {Chunk} chunk chunk
29
29
  * @returns {boolean} true, if wasm loading is enabled for the chunk
30
30
  */
31
- const isEnabledForChunk = chunk => {
31
+ const isEnabledForChunk = (chunk) => {
32
32
  const options = chunk.getEntryOptions();
33
33
  const wasmLoading =
34
34
  options && options.wasmLoading !== undefined
@@ -46,7 +46,7 @@ class UniversalCompileAsyncWasmPlugin {
46
46
  * @param {string} path path
47
47
  * @returns {string} code
48
48
  */
49
- const generateBeforeLoadBinaryCode = path =>
49
+ const generateBeforeLoadBinaryCode = (path) =>
50
50
  Template.asString([
51
51
  "var useFetch = typeof document !== 'undefined' || typeof self !== 'undefined';",
52
52
  `var wasmUrl = ${path};`
@@ -85,7 +85,7 @@ class UniversalCompileAsyncWasmPlugin {
85
85
  if (
86
86
  !chunkGraph.hasModuleInGraph(
87
87
  chunk,
88
- m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
88
+ (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
89
89
  )
90
90
  ) {
91
91
  return;
@@ -139,7 +139,9 @@ const generateImportObject = (
139
139
  importObject = [
140
140
  "return {",
141
141
  Template.indent([
142
- properties.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n")
142
+ properties
143
+ .map((p) => `${JSON.stringify(p.name)}: ${p.value}`)
144
+ .join(",\n")
143
145
  ]),
144
146
  "};"
145
147
  ];
@@ -160,7 +162,9 @@ const generateImportObject = (
160
162
  Template.asString([
161
163
  `${JSON.stringify(module)}: {`,
162
164
  Template.indent([
163
- list.map(p => `${JSON.stringify(p.name)}: ${p.value}`).join(",\n")
165
+ list
166
+ .map((p) => `${JSON.stringify(p.name)}: ${p.value}`)
167
+ .join(",\n")
164
168
  ]),
165
169
  "}"
166
170
  ])
@@ -187,7 +191,7 @@ const generateImportObject = (
187
191
  } else if (waitForInstances.size > 0) {
188
192
  const promises = Array.from(
189
193
  waitForInstances.values(),
190
- id => `installedWasmModules[${JSON.stringify(id)}]`
194
+ (id) => `installedWasmModules[${JSON.stringify(id)}]`
191
195
  ).join(", ");
192
196
  const variables = Array.from(
193
197
  waitForInstances.keys(),
@@ -251,7 +255,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
251
255
  const { mangleImports } = this;
252
256
  /** @type {string[]} */
253
257
  const declarations = [];
254
- const importObjects = wasmModules.map(module =>
258
+ const importObjects = wasmModules.map((module) =>
255
259
  generateImportObject(
256
260
  chunkGraph,
257
261
  module,
@@ -260,14 +264,14 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
260
264
  chunk.runtime
261
265
  )
262
266
  );
263
- const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, m =>
267
+ const chunkModuleIdMap = chunkGraph.getChunkModuleIdMap(chunk, (m) =>
264
268
  m.type.startsWith("webassembly")
265
269
  );
266
270
  /**
267
271
  * @param {string} content content
268
272
  * @returns {string} created import object
269
273
  */
270
- const createImportObject = content =>
274
+ const createImportObject = (content) =>
271
275
  mangleImports
272
276
  ? `{ ${JSON.stringify(WebAssemblyUtils.MANGLED_MODULE)}: ${content} }`
273
277
  : content;
@@ -275,12 +279,12 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
275
279
  JSON.stringify(outputOptions.webassemblyModuleFilename),
276
280
  {
277
281
  hash: `" + ${RuntimeGlobals.getFullHash}() + "`,
278
- hashWithLength: length =>
282
+ hashWithLength: (length) =>
279
283
  `" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`,
280
284
  module: {
281
285
  id: '" + wasmModuleId + "',
282
286
  hash: `" + ${JSON.stringify(
283
- chunkGraph.getChunkModuleRenderedHashMap(chunk, m =>
287
+ chunkGraph.getChunkModuleRenderedHashMap(chunk, (m) =>
284
288
  m.type.startsWith("webassembly")
285
289
  )
286
290
  )}[chunkId][wasmModuleId] + "`,
@@ -288,7 +292,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
288
292
  return `" + ${JSON.stringify(
289
293
  chunkGraph.getChunkModuleRenderedHashMap(
290
294
  chunk,
291
- m => m.type.startsWith("webassembly"),
295
+ (m) => m.type.startsWith("webassembly"),
292
296
  length
293
297
  )
294
298
  )}[chunkId][wasmModuleId] + "`;
@@ -22,8 +22,8 @@ class WasmFinalizeExportsPlugin {
22
22
  * @returns {void}
23
23
  */
24
24
  apply(compiler) {
25
- compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
26
- compilation.hooks.finishModules.tap(PLUGIN_NAME, modules => {
25
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
26
+ compilation.hooks.finishModules.tap(PLUGIN_NAME, (modules) => {
27
27
  for (const module of modules) {
28
28
  // 1. if a WebAssembly module
29
29
  if (module.type.startsWith("webassembly") === true) {