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
@@ -6,6 +6,7 @@
6
6
  "use strict";
7
7
 
8
8
  const Template = require("../Template");
9
+ const AwaitDependenciesInitFragment = require("../async-modules/AwaitDependenciesInitFragment");
9
10
  const makeSerializable = require("../util/makeSerializable");
10
11
  const HarmonyImportDependency = require("./HarmonyImportDependency");
11
12
  const NullDependency = require("./NullDependency");
@@ -82,8 +83,25 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
82
83
  moduleGraph,
83
84
  chunkGraph
84
85
  } = templateContext;
85
- const content = dep.dependencies
86
- .map(dependency => {
86
+
87
+ /** @type {HarmonyAcceptImportDependency[]} */
88
+ const syncDeps = [];
89
+
90
+ /** @type {HarmonyAcceptImportDependency[]} */
91
+ const asyncDeps = [];
92
+
93
+ for (const dependency of dep.dependencies) {
94
+ const connection = moduleGraph.getConnection(dependency);
95
+
96
+ if (connection && moduleGraph.isAsync(connection.module)) {
97
+ asyncDeps.push(dependency);
98
+ } else {
99
+ syncDeps.push(dependency);
100
+ }
101
+ }
102
+
103
+ let content = syncDeps
104
+ .map((dependency) => {
87
105
  const referencedModule = moduleGraph.getModule(dependency);
88
106
  return {
89
107
  dependency,
@@ -112,17 +130,33 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
112
130
  })
113
131
  .join("");
114
132
 
133
+ const promises = new Map(
134
+ asyncDeps.map((dependency) => [
135
+ dependency.getImportVar(moduleGraph),
136
+ dependency.getModuleExports(templateContext)
137
+ ])
138
+ );
139
+
140
+ let optAsync = "";
141
+ if (promises.size !== 0) {
142
+ optAsync = "async ";
143
+ content += new AwaitDependenciesInitFragment(promises).getContent({
144
+ ...templateContext,
145
+ type: "javascript"
146
+ });
147
+ }
148
+
115
149
  if (dep.hasCallback) {
116
150
  if (runtimeTemplate.supportsArrowFunction()) {
117
151
  source.insert(
118
152
  dep.range[0],
119
- `__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content}(`
153
+ `${optAsync}__WEBPACK_OUTDATED_DEPENDENCIES__ => { ${content} return (`
120
154
  );
121
155
  source.insert(dep.range[1], ")(__WEBPACK_OUTDATED_DEPENDENCIES__); }");
122
156
  } else {
123
157
  source.insert(
124
158
  dep.range[0],
125
- `function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content}(`
159
+ `${optAsync}function(__WEBPACK_OUTDATED_DEPENDENCIES__) { ${content} return (`
126
160
  );
127
161
  source.insert(
128
162
  dep.range[1],
@@ -135,7 +169,7 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
135
169
  const arrow = runtimeTemplate.supportsArrowFunction();
136
170
  source.insert(
137
171
  dep.range[1] - 0.5,
138
- `, ${arrow ? "() =>" : "function()"} { ${content} }`
172
+ `, ${arrow ? `${optAsync}() =>` : `${optAsync}function()`} { ${content} }`
139
173
  );
140
174
  }
141
175
  };
@@ -31,13 +31,13 @@ module.exports = class HarmonyDetectionParserPlugin {
31
31
  * @returns {void}
32
32
  */
33
33
  apply(parser) {
34
- parser.hooks.program.tap(PLUGIN_NAME, ast => {
34
+ parser.hooks.program.tap(PLUGIN_NAME, (ast) => {
35
35
  const isStrictHarmony =
36
36
  parser.state.module.type === JAVASCRIPT_MODULE_TYPE_ESM;
37
37
  const isHarmony =
38
38
  isStrictHarmony ||
39
39
  ast.body.some(
40
- statement =>
40
+ (statement) =>
41
41
  statement.type === "ImportDeclaration" ||
42
42
  statement.type === "ExportDefaultDeclaration" ||
43
43
  statement.type === "ExportNamedDeclaration" ||
@@ -33,9 +33,8 @@ const PLUGIN_NAME = "HarmonyExportDependencyParserPlugin";
33
33
  module.exports = class HarmonyExportDependencyParserPlugin {
34
34
  /**
35
35
  * @param {import("../../declarations/WebpackOptions").JavascriptParserOptions} options options
36
- * @param {boolean=} deferImport defer import enabled
37
36
  */
38
- constructor(options, deferImport) {
37
+ constructor(options) {
39
38
  this.exportPresenceMode =
40
39
  options.reexportExportsPresence !== undefined
41
40
  ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence)
@@ -44,7 +43,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
44
43
  : options.strictExportPresence
45
44
  ? ExportPresenceModes.ERROR
46
45
  : ExportPresenceModes.AUTO;
47
- this.deferImport = deferImport;
46
+ this.deferImport = options.deferImport;
48
47
  }
49
48
 
50
49
  /**
@@ -53,7 +52,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
53
52
  */
54
53
  apply(parser) {
55
54
  const { exportPresenceMode } = this;
56
- parser.hooks.export.tap(PLUGIN_NAME, statement => {
55
+ parser.hooks.export.tap(PLUGIN_NAME, (statement) => {
57
56
  const dep = new HarmonyExportHeaderDependency(
58
57
  /** @type {Range | false} */ (
59
58
  statement.declaration && statement.declaration.range
@@ -77,13 +76,16 @@ module.exports = class HarmonyExportDependencyParserPlugin {
77
76
  clearDep.loc = /** @type {DependencyLocation} */ (statement.loc);
78
77
  clearDep.loc.index = -1;
79
78
  parser.state.module.addPresentationalDependency(clearDep);
80
- const { defer } = getImportMode(parser, statement);
81
- if (defer) {
82
- const error = new WebpackError(
83
- "Deferred re-export (`export defer * as namespace from '...'`) is not a part of the Import Defer proposal.\nUse the following code instead:\n import defer * as namespace from '...';\n export { namespace };"
84
- );
85
- error.loc = statement.loc || undefined;
86
- parser.state.current.addError(error);
79
+ let defer = false;
80
+ if (this.deferImport) {
81
+ ({ defer } = getImportMode(parser, statement));
82
+ if (defer) {
83
+ const error = new WebpackError(
84
+ "Deferred re-export (`export defer * as namespace from '...'`) is not a part of the Import Defer proposal.\nUse the following code instead:\n import defer * as namespace from '...';\n export { namespace };"
85
+ );
86
+ error.loc = statement.loc || undefined;
87
+ parser.state.current.addError(error);
88
+ }
87
89
  }
88
90
  const sideEffectDep = new HarmonyImportSideEffectDependency(
89
91
  /** @type {string} */ (source),
@@ -107,7 +109,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
107
109
  exprRange,
108
110
  statementRange,
109
111
  comments
110
- .map(c => {
112
+ .map((c) => {
111
113
  switch (c.type) {
112
114
  case "Block":
113
115
  return `/*${c.value}*/`;
@@ -202,7 +204,9 @@ module.exports = class HarmonyExportDependencyParserPlugin {
202
204
  parser.state.harmonyStarExports || new HarmonyStarExportsList();
203
205
  }
204
206
  const attributes = getImportAttributes(statement);
205
- const { defer } = getImportMode(parser, statement);
207
+ const defer = this.deferImport
208
+ ? getImportMode(parser, statement).defer
209
+ : false;
206
210
  const dep = new HarmonyExportImportedSpecifierDependency(
207
211
  /** @type {string} */
208
212
  (source),
@@ -334,7 +334,7 @@ const getMode = (moduleGraph, dep, runtimeKey) => {
334
334
 
335
335
  mode.items = Array.from(
336
336
  exports,
337
- exportName =>
337
+ (exportName) =>
338
338
  new NormalReexportItem(
339
339
  exportName,
340
340
  [exportName],
@@ -378,7 +378,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
378
378
  * @param {ExportPresenceMode} exportPresenceMode mode of checking export names
379
379
  * @param {HarmonyStarExportsList | null} allStarExports all star exports in the module
380
380
  * @param {ImportAttributes=} attributes import attributes
381
- * @param {boolean=} deferEvaluation defer evaluation
381
+ * @param {boolean=} defer is defer phase
382
382
  */
383
383
  constructor(
384
384
  request,
@@ -390,9 +390,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
390
390
  exportPresenceMode,
391
391
  allStarExports,
392
392
  attributes,
393
- deferEvaluation
393
+ defer
394
394
  ) {
395
- super(request, sourceOrder, attributes);
395
+ super(request, sourceOrder, attributes, defer);
396
396
 
397
397
  this.ids = ids;
398
398
  this.name = name;
@@ -400,7 +400,6 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
400
400
  this.otherStarExports = otherStarExports;
401
401
  this.exportPresenceMode = exportPresenceMode;
402
402
  this.allStarExports = allStarExports;
403
- this.defer = deferEvaluation;
404
403
  }
405
404
 
406
405
  /**
@@ -722,7 +721,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
722
721
  return {
723
722
  exports: Array.from(
724
723
  /** @type {NormalReexportItem[]} */ (mode.items),
725
- item => ({
724
+ (item) => ({
726
725
  name: item.name,
727
726
  from,
728
727
  export: item.ids,
@@ -930,7 +929,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
930
929
  }' contains conflicting star exports for the ${
931
930
  exports.length > 1 ? "names" : "name"
932
931
  } ${exports
933
- .map(e => `'${e}'`)
932
+ .map((e) => `'${e}'`)
934
933
  .join(", ")} with the previous requested module '${request}'`
935
934
  )
936
935
  );
@@ -1190,7 +1189,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
1190
1189
  const runtimeCondition = dep.weak
1191
1190
  ? false
1192
1191
  : connection
1193
- ? filterRuntime(runtime, r => connection.isTargetActive(r))
1192
+ ? filterRuntime(runtime, (r) => connection.isTargetActive(r))
1194
1193
  : true;
1195
1194
  initFragments.push(
1196
1195
  new ConditionalInitFragment(
@@ -17,7 +17,7 @@ const { propertyName } = require("../util/propertyName");
17
17
  * @param {Iterable<string>} iterable iterable strings
18
18
  * @returns {string} result
19
19
  */
20
- const joinIterableWithComma = iterable => {
20
+ const joinIterableWithComma = (iterable) => {
21
21
  // This is more performant than Array.from().join(", ")
22
22
  // as it doesn't create an array
23
23
  let str = "";
@@ -40,7 +40,7 @@ module.exports.enable = (parserState, isStrictHarmony) => {
40
40
  * @param {ParserState} parserState parser state
41
41
  * @returns {boolean} true, when enabled
42
42
  */
43
- module.exports.isEnabled = parserState => {
43
+ module.exports.isEnabled = (parserState) => {
44
44
  const value = parserStateExportsState.get(parserState);
45
45
  return value === true;
46
46
  };
@@ -64,11 +64,13 @@ class HarmonyImportDependency extends ModuleDependency {
64
64
  * @param {string} request request string
65
65
  * @param {number} sourceOrder source order
66
66
  * @param {ImportAttributes=} attributes import attributes
67
+ * @param {boolean=} defer import attributes
67
68
  */
68
- constructor(request, sourceOrder, attributes) {
69
+ constructor(request, sourceOrder, attributes, defer) {
69
70
  super(request);
70
71
  this.sourceOrder = sourceOrder;
71
72
  this.assertions = attributes;
73
+ this.defer = defer;
72
74
  }
73
75
 
74
76
  get category() {
@@ -112,6 +114,24 @@ class HarmonyImportDependency extends ModuleDependency {
112
114
  return importVar;
113
115
  }
114
116
 
117
+ /**
118
+ * @param {DependencyTemplateContext} context the template context
119
+ * @returns {string} the expression
120
+ */
121
+ getModuleExports({
122
+ runtimeTemplate,
123
+ moduleGraph,
124
+ chunkGraph,
125
+ runtimeRequirements
126
+ }) {
127
+ return runtimeTemplate.moduleExports({
128
+ module: moduleGraph.getModule(this),
129
+ chunkGraph,
130
+ request: this.request,
131
+ runtimeRequirements
132
+ });
133
+ }
134
+
115
135
  /**
116
136
  * @param {boolean} update create new variables or update existing one
117
137
  * @param {DependencyTemplateContext} templateContext the template context
@@ -183,7 +203,7 @@ class HarmonyImportDependency extends ModuleDependency {
183
203
  new HarmonyLinkingError(
184
204
  `export ${ids
185
205
  .slice(0, pos)
186
- .map(id => `'${id}'`)
206
+ .map((id) => `'${id}'`)
187
207
  .join(".")} ${additionalMessage} was not found in '${
188
208
  this.userRequest
189
209
  }'${moreInfo}`
@@ -199,7 +219,7 @@ class HarmonyImportDependency extends ModuleDependency {
199
219
  return [
200
220
  new HarmonyLinkingError(
201
221
  `export ${ids
202
- .map(id => `'${id}'`)
222
+ .map((id) => `'${id}'`)
203
223
  .join(".")} ${additionalMessage} was not found in '${
204
224
  this.userRequest
205
225
  }'`
@@ -215,7 +235,7 @@ class HarmonyImportDependency extends ModuleDependency {
215
235
  return [
216
236
  new HarmonyLinkingError(
217
237
  `Can't import the named export ${ids
218
- .map(id => `'${id}'`)
238
+ .map((id) => `'${id}'`)
219
239
  .join(
220
240
  "."
221
241
  )} ${additionalMessage} from default-exporting module (only default export is available)`
@@ -236,7 +256,7 @@ class HarmonyImportDependency extends ModuleDependency {
236
256
  return [
237
257
  new HarmonyLinkingError(
238
258
  `Should not import the named export ${ids
239
- .map(id => `'${id}'`)
259
+ .map((id) => `'${id}'`)
240
260
  .join(
241
261
  "."
242
262
  )} ${additionalMessage} from default-exporting module (only default export is available soon)`
@@ -310,7 +330,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
310
330
  const runtimeCondition = dep.weak
311
331
  ? false
312
332
  : connection
313
- ? filterRuntime(runtime, r => connection.isTargetActive(r))
333
+ ? filterRuntime(runtime, (r) => connection.isTargetActive(r))
314
334
  : true;
315
335
 
316
336
  if (module && referencedModule) {
@@ -348,10 +368,9 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
348
368
  runtimeCondition
349
369
  )
350
370
  );
371
+ const importVar = dep.getImportVar(templateContext.moduleGraph);
351
372
  templateContext.initFragments.push(
352
- new AwaitDependenciesInitFragment(
353
- new Set([dep.getImportVar(templateContext.moduleGraph)])
354
- )
373
+ new AwaitDependenciesInitFragment(new Map([[importVar, importVar]]))
355
374
  );
356
375
  templateContext.initFragments.push(
357
376
  new ConditionalInitFragment(
@@ -59,9 +59,8 @@ const PLUGIN_NAME = "HarmonyImportDependencyParserPlugin";
59
59
  module.exports = class HarmonyImportDependencyParserPlugin {
60
60
  /**
61
61
  * @param {JavascriptParserOptions} options options
62
- * @param {boolean | undefined} deferImport defer import enabled
63
62
  */
64
- constructor(options, deferImport) {
63
+ constructor(options) {
65
64
  this.exportPresenceMode =
66
65
  options.importExportsPresence !== undefined
67
66
  ? ExportPresenceModes.fromUserOption(options.importExportsPresence)
@@ -71,7 +70,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
71
70
  ? ExportPresenceModes.ERROR
72
71
  : ExportPresenceModes.AUTO;
73
72
  this.strictThisContextOnImports = options.strictThisContextOnImports;
74
- this.deferImport = deferImport;
73
+ this.deferImport = options.deferImport;
75
74
  }
76
75
 
77
76
  /**
@@ -102,7 +101,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
102
101
  return node;
103
102
  }
104
103
 
105
- parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, expression => {
104
+ parser.hooks.isPure.for("Identifier").tap(PLUGIN_NAME, (expression) => {
106
105
  const expr = /** @type {Identifier} */ (expression);
107
106
  if (
108
107
  parser.isVariableDefined(expr.name) ||
@@ -124,17 +123,20 @@ module.exports = class HarmonyImportDependencyParserPlugin {
124
123
  parser.state.module.addPresentationalDependency(clearDep);
125
124
  parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]);
126
125
  const attributes = getImportAttributes(statement);
127
- const { defer } = getImportMode(parser, statement);
128
- if (
129
- defer &&
130
- (statement.specifiers.length !== 1 ||
131
- statement.specifiers[0].type !== "ImportNamespaceSpecifier")
132
- ) {
133
- const error = new WebpackError(
134
- "Deferred import can only be used with `import * as namespace from '...'` syntax."
135
- );
136
- error.loc = statement.loc || undefined;
137
- parser.state.current.addError(error);
126
+ let defer = false;
127
+ if (this.deferImport) {
128
+ ({ defer } = getImportMode(parser, statement));
129
+ if (
130
+ defer &&
131
+ (statement.specifiers.length !== 1 ||
132
+ statement.specifiers[0].type !== "ImportNamespaceSpecifier")
133
+ ) {
134
+ const error = new WebpackError(
135
+ "Deferred import can only be used with `import * as namespace from '...'` syntax."
136
+ );
137
+ error.loc = statement.loc || undefined;
138
+ parser.state.current.addError(error);
139
+ }
138
140
  }
139
141
  const sideEffectDep = new HarmonyImportSideEffectDependency(
140
142
  /** @type {string} */ (source),
@@ -150,7 +152,9 @@ module.exports = class HarmonyImportDependencyParserPlugin {
150
152
  PLUGIN_NAME,
151
153
  (statement, source, id, name) => {
152
154
  const ids = id === null ? [] : [id];
153
- const { defer } = getImportMode(parser, statement);
155
+ const defer = this.deferImport
156
+ ? getImportMode(parser, statement).defer
157
+ : false;
154
158
  parser.tagVariable(name, harmonySpecifierTag, {
155
159
  name,
156
160
  source,
@@ -162,7 +166,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
162
166
  return true;
163
167
  }
164
168
  );
165
- parser.hooks.binaryExpression.tap(PLUGIN_NAME, expression => {
169
+ parser.hooks.binaryExpression.tap(PLUGIN_NAME, (expression) => {
166
170
  if (expression.operator !== "in") return;
167
171
 
168
172
  const leftPartEvaluated = parser.evaluateExpression(expression.left);
@@ -204,34 +208,38 @@ module.exports = class HarmonyImportDependencyParserPlugin {
204
208
  );
205
209
  dep.loc = /** @type {DependencyLocation} */ (expression.loc);
206
210
  parser.state.module.addDependency(dep);
207
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
208
- return true;
209
- });
210
- parser.hooks.expression.for(harmonySpecifierTag).tap(PLUGIN_NAME, expr => {
211
- const settings = /** @type {HarmonySettings} */ (parser.currentTagData);
212
- const dep = new HarmonyImportSpecifierDependency(
213
- settings.source,
214
- settings.sourceOrder,
215
- settings.ids,
216
- settings.name,
217
- /** @type {Range} */
218
- (expr.range),
219
- exportPresenceMode,
220
- settings.attributes,
221
- [],
222
- settings.defer
223
- );
224
- dep.referencedPropertiesInDestructuring =
225
- parser.destructuringAssignmentPropertiesFor(expr);
226
- dep.shorthand = parser.scope.inShorthand;
227
- dep.directImport = true;
228
- dep.asiSafe = !parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]);
229
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
230
- dep.call = parser.scope.inTaggedTemplateTag;
231
- parser.state.module.addDependency(dep);
232
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
211
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
233
212
  return true;
234
213
  });
214
+ parser.hooks.expression
215
+ .for(harmonySpecifierTag)
216
+ .tap(PLUGIN_NAME, (expr) => {
217
+ const settings = /** @type {HarmonySettings} */ (parser.currentTagData);
218
+ const dep = new HarmonyImportSpecifierDependency(
219
+ settings.source,
220
+ settings.sourceOrder,
221
+ settings.ids,
222
+ settings.name,
223
+ /** @type {Range} */
224
+ (expr.range),
225
+ exportPresenceMode,
226
+ settings.attributes,
227
+ [],
228
+ settings.defer
229
+ );
230
+ dep.referencedPropertiesInDestructuring =
231
+ parser.destructuringAssignmentPropertiesFor(expr);
232
+ dep.shorthand = parser.scope.inShorthand;
233
+ dep.directImport = true;
234
+ dep.asiSafe = !parser.isAsiPosition(
235
+ /** @type {Range} */ (expr.range)[0]
236
+ );
237
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
238
+ dep.call = parser.scope.inTaggedTemplateTag;
239
+ parser.state.module.addDependency(dep);
240
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
241
+ return true;
242
+ });
235
243
  parser.hooks.expressionMemberChain
236
244
  .for(harmonySpecifierTag)
237
245
  .tap(
@@ -277,7 +285,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
277
285
  );
278
286
  dep.loc = /** @type {DependencyLocation} */ (expr.loc);
279
287
  parser.state.module.addDependency(dep);
280
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
288
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
281
289
  return true;
282
290
  }
283
291
  );
@@ -331,7 +339,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
331
339
  dep.loc = /** @type {DependencyLocation} */ (expr.loc);
332
340
  parser.state.module.addDependency(dep);
333
341
  if (args) parser.walkExpressions(args);
334
- InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e));
342
+ InnerGraph.onUsage(parser.state, (e) => (dep.usedByExports = e));
335
343
  return true;
336
344
  }
337
345
  );
@@ -342,7 +350,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
342
350
  // This is not a harmony module, skip it
343
351
  return;
344
352
  }
345
- const dependencies = requests.map(request => {
353
+ const dependencies = requests.map((request) => {
346
354
  const dep = new HarmonyAcceptImportDependency(request);
347
355
  dep.loc = /** @type {DependencyLocation} */ (expr.loc);
348
356
  parser.state.module.addDependency(dep);
@@ -364,7 +372,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
364
372
  // This is not a harmony module, skip it
365
373
  return;
366
374
  }
367
- const dependencies = requests.map(request => {
375
+ const dependencies = requests.map((request) => {
368
376
  const dep = new HarmonyAcceptImportDependency(request);
369
377
  dep.loc = /** @type {DependencyLocation} */ (expr.loc);
370
378
  parser.state.module.addDependency(dep);
@@ -387,7 +395,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
387
395
  /**
388
396
  * @param {JavascriptParser} parser parser
389
397
  * @param {ExportNamedDeclaration | ExportAllDeclaration | ImportDeclaration} node node
390
- * @returns {{defer: boolean}} import attributes
398
+ * @returns {{ defer: boolean }} import attributes
391
399
  */
392
400
  function getImportMode(parser, node) {
393
401
  const result = { defer: "phase" in node && node.phase === "defer" };
@@ -26,11 +26,10 @@ class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
26
26
  * @param {string} request the request string
27
27
  * @param {number} sourceOrder source order
28
28
  * @param {ImportAttributes=} attributes import attributes
29
- * @param {boolean=} deferred deferred
29
+ * @param {boolean=} defer is defer phase
30
30
  */
31
- constructor(request, sourceOrder, attributes, deferred) {
32
- super(request, sourceOrder, attributes);
33
- this.defer = deferred;
31
+ constructor(request, sourceOrder, attributes, defer) {
32
+ super(request, sourceOrder, attributes, defer);
34
33
  }
35
34
 
36
35
  get type() {
@@ -42,7 +41,7 @@ class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
42
41
  * @returns {null | false | GetConditionFn} function to determine if the connection is active
43
42
  */
44
43
  getCondition(moduleGraph) {
45
- return connection => {
44
+ return (connection) => {
46
45
  const refModule = connection.resolvedModule;
47
46
  if (!refModule) return true;
48
47
  return refModule.getSideEffectsConnectionState(moduleGraph);
@@ -51,7 +51,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
51
51
  * @param {ExportPresenceMode} exportPresenceMode export presence mode
52
52
  * @param {ImportAttributes | undefined} attributes import attributes
53
53
  * @param {Range[] | undefined} idRanges ranges for members of ids; the two arrays are right-aligned
54
- * @param {boolean=} deferred deferred
54
+ * @param {boolean=} defer is defer phase
55
55
  */
56
56
  constructor(
57
57
  request,
@@ -62,9 +62,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
62
62
  exportPresenceMode,
63
63
  attributes,
64
64
  idRanges, // TODO webpack 6 make this non-optional. It must always be set to properly trim ids.
65
- deferred
65
+ defer
66
66
  ) {
67
- super(request, sourceOrder, attributes);
67
+ super(request, sourceOrder, attributes, defer);
68
68
  this.ids = ids;
69
69
  this.name = name;
70
70
  this.range = range;
@@ -79,7 +79,6 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
79
79
  this.usedByExports = undefined;
80
80
  /** @type {Set<DestructuringAssignmentProperty> | undefined} */
81
81
  this.referencedPropertiesInDestructuring = undefined;
82
- this.defer = deferred;
83
82
  }
84
83
 
85
84
  // TODO webpack 6 remove
@@ -135,14 +135,8 @@ class HarmonyModulesPlugin {
135
135
  }
136
136
 
137
137
  new HarmonyDetectionParserPlugin(this.options).apply(parser);
138
- new HarmonyImportDependencyParserPlugin(
139
- parserOptions,
140
- this.options.deferImport
141
- ).apply(parser);
142
- new HarmonyExportDependencyParserPlugin(
143
- parserOptions,
144
- this.options.deferImport
145
- ).apply(parser);
138
+ new HarmonyImportDependencyParserPlugin(parserOptions).apply(parser);
139
+ new HarmonyExportDependencyParserPlugin(parserOptions).apply(parser);
146
140
  new HarmonyTopLevelThisParserPlugin().apply(parser);
147
141
  };
148
142
 
@@ -20,7 +20,7 @@ class HarmonyTopLevelThisParserPlugin {
20
20
  * @returns {void}
21
21
  */
22
22
  apply(parser) {
23
- parser.hooks.expression.for("this").tap(PLUGIN_NAME, node => {
23
+ parser.hooks.expression.for("this").tap(PLUGIN_NAME, (node) => {
24
24
  if (!parser.scope.topLevelScope) return;
25
25
  if (HarmonyExports.isEnabled(parser.state)) {
26
26
  const dep = new ConstDependency(
@@ -62,7 +62,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
62
62
  apply(parser) {
63
63
  parser.hooks.evaluateIdentifier
64
64
  .for("import.meta.webpackContext")
65
- .tap(PLUGIN_NAME, expr =>
65
+ .tap(PLUGIN_NAME, (expr) =>
66
66
  evaluateToIdentifier(
67
67
  "import.meta.webpackContext",
68
68
  "import.meta",
@@ -72,7 +72,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
72
72
  );
73
73
  parser.hooks.call
74
74
  .for("import.meta.webpackContext")
75
- .tap(PLUGIN_NAME, expr => {
75
+ .tap(PLUGIN_NAME, (expr) => {
76
76
  if (expr.arguments.length < 1 || expr.arguments.length > 2) return;
77
77
  const [directoryNode, optionsNode] = expr.arguments;
78
78
  if (optionsNode && optionsNode.type !== "ObjectExpression") return;
@@ -178,11 +178,11 @@ module.exports = class ImportMetaContextDependencyParserPlugin {
178
178
  /** @type {BasicEvaluatedExpression[]} */
179
179
  (expr.items);
180
180
  if (
181
- items.every(i => {
181
+ items.every((i) => {
182
182
  if (!i.isArray()) return false;
183
183
  const innerItems =
184
184
  /** @type {BasicEvaluatedExpression[]} */ (i.items);
185
- return innerItems.every(i => i.isString());
185
+ return innerItems.every((i) => i.isString());
186
186
  })
187
187
  ) {
188
188
  exports = [];