webpack 5.108.4 → 5.109.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 (186) hide show
  1. package/lib/APIPlugin.js +48 -29
  2. package/lib/CacheFacade.js +8 -0
  3. package/lib/ChunkGroup.js +1 -0
  4. package/lib/CompatibilityPlugin.js +31 -29
  5. package/lib/Compilation.js +49 -4
  6. package/lib/ConstPlugin.js +11 -11
  7. package/lib/ContextModule.js +239 -6
  8. package/lib/ContextModuleFactory.js +139 -14
  9. package/lib/DefinePlugin.js +396 -101
  10. package/lib/Entrypoint.js +1 -1
  11. package/lib/ExportsInfoApiPlugin.js +2 -2
  12. package/lib/ExternalModule.js +107 -5
  13. package/lib/ExternalModuleFactoryPlugin.js +20 -1
  14. package/lib/FileSystemInfo.js +130 -74
  15. package/lib/HotModuleReplacementPlugin.js +18 -15
  16. package/lib/Module.js +3 -0
  17. package/lib/ModuleFilenameHelpers.js +2 -2
  18. package/lib/ModuleTypeConstants.js +8 -1
  19. package/lib/MultiCompiler.js +13 -2
  20. package/lib/MultiWatching.js +1 -0
  21. package/lib/NodeStuffPlugin.js +51 -33
  22. package/lib/NormalModule.js +169 -401
  23. package/lib/NormalModuleFactory.js +76 -2
  24. package/lib/ProgressPlugin.js +211 -119
  25. package/lib/ProvidePlugin.js +2 -2
  26. package/lib/RuntimeGlobals.js +47 -0
  27. package/lib/RuntimePlugin.js +33 -0
  28. package/lib/RuntimeTemplate.js +304 -16
  29. package/lib/UseStrictPlugin.js +1 -1
  30. package/lib/WebpackIsIncludedPlugin.js +1 -1
  31. package/lib/WebpackOptionsApply.js +24 -19
  32. package/lib/asset/AssetGenerator.js +110 -28
  33. package/lib/asset/AssetModulesPlugin.js +92 -2
  34. package/lib/asset/WebManifestGenerator.js +164 -0
  35. package/lib/asset/WebManifestParser.js +130 -0
  36. package/lib/async-modules/AwaitDependenciesInitFragment.js +14 -4
  37. package/lib/async-modules/isGeneratorLowered.js +26 -0
  38. package/lib/cache/PackFileCacheStrategy.js +9 -3
  39. package/lib/config/browserslistTargetHandler.js +40 -0
  40. package/lib/config/defaults.js +219 -29
  41. package/lib/config/normalization.js +26 -0
  42. package/lib/config/target.js +9 -1
  43. package/lib/css/CssGenerator.js +40 -31
  44. package/lib/css/CssLoadingRuntimeModule.js +5 -1
  45. package/lib/css/CssModulesPlugin.js +13 -0
  46. package/lib/css/CssParser.js +594 -263
  47. package/lib/css/syntax.js +875 -462
  48. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +6 -6
  49. package/lib/dependencies/AMDPlugin.js +2 -2
  50. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +13 -13
  51. package/lib/dependencies/CommonJsDependencyHelpers.js +39 -0
  52. package/lib/dependencies/CommonJsExportsDependency.js +47 -2
  53. package/lib/dependencies/CommonJsExportsParserPlugin.js +10 -10
  54. package/lib/dependencies/CommonJsImportsParserPlugin.js +18 -18
  55. package/lib/dependencies/CommonJsPlugin.js +2 -2
  56. package/lib/dependencies/CommonJsRequireDependency.js +26 -1
  57. package/lib/dependencies/CommonJsSelfReferenceDependency.js +32 -1
  58. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  59. package/lib/dependencies/CreateRequireParserPlugin.js +6 -6
  60. package/lib/dependencies/CssIcssExportDependency.js +162 -71
  61. package/lib/dependencies/CssUrlDependency.js +35 -4
  62. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +2 -2
  63. package/lib/dependencies/HarmonyCompatibilityDependency.js +32 -14
  64. package/lib/dependencies/HarmonyDetectionParserPlugin.js +43 -13
  65. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +7 -19
  66. package/lib/dependencies/HarmonyImportDependency.js +12 -1
  67. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +11 -11
  68. package/lib/dependencies/HarmonyModulesPlugin.js +6 -0
  69. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
  70. package/lib/dependencies/HtmlEntryDependency.js +797 -172
  71. package/lib/dependencies/HtmlSourceDependency.js +26 -0
  72. package/lib/dependencies/ImportDependency.js +43 -1
  73. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +31 -18
  74. package/lib/dependencies/ImportMetaContextPlugin.js +38 -7
  75. package/lib/dependencies/ImportMetaGlobDependency.js +81 -0
  76. package/lib/dependencies/ImportMetaGlobDependencyParserPlugin.js +78 -0
  77. package/lib/dependencies/ImportMetaGlobHelpers.js +660 -0
  78. package/lib/dependencies/ImportMetaPlugin.js +532 -180
  79. package/lib/dependencies/ImportMetaResolveDependency.js +90 -0
  80. package/lib/dependencies/ImportParserPlugin.js +80 -17
  81. package/lib/dependencies/ImportPhase.js +10 -8
  82. package/lib/dependencies/LoaderPlugin.js +5 -1
  83. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  84. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +3 -6
  85. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +4 -11
  86. package/lib/dependencies/SystemPlugin.js +2 -4
  87. package/lib/dependencies/TopLevelAwaitDependency.js +93 -0
  88. package/lib/dependencies/URLDependency.js +141 -21
  89. package/lib/dependencies/{WorkerPlugin.js → WorkerAndWorkletPlugin.js} +324 -112
  90. package/lib/dependencies/WorkerDependency.js +86 -18
  91. package/lib/dependencies/WorkletDependency.js +278 -0
  92. package/lib/dll/DelegatedModuleFactoryPlugin.js +19 -0
  93. package/lib/errors/EnvironmentNotSupportAsyncWarning.js +1 -1
  94. package/lib/errors/LoaderLoadingError.js +20 -0
  95. package/lib/errors/ModuleParseError.js +39 -22
  96. package/lib/errors/NodeStuffInWebError.js +1 -1
  97. package/lib/esm/ModuleChunkFormatPlugin.js +47 -14
  98. package/lib/esm/ModuleChunkLoadingPlugin.js +8 -1
  99. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +29 -1
  100. package/lib/hmr/lazyCompilationBackend.js +32 -8
  101. package/lib/html/HtmlGenerator.js +887 -15
  102. package/lib/html/HtmlModule.js +2 -2
  103. package/lib/html/HtmlModulesPlugin.js +610 -166
  104. package/lib/html/HtmlParser.js +603 -247
  105. package/lib/html/favicon.svg +1 -0
  106. package/lib/html/syntax.js +1264 -661
  107. package/lib/ids/IdHelpers.js +1 -1
  108. package/lib/index.js +6 -0
  109. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -5
  110. package/lib/javascript/BasicEvaluatedExpression.js +366 -48
  111. package/lib/javascript/JavascriptGenerator.js +197 -49
  112. package/lib/javascript/JavascriptModulesPlugin.js +178 -24
  113. package/lib/javascript/JavascriptParser.js +701 -355
  114. package/lib/javascript/JavascriptParserHelpers.js +3 -6
  115. package/lib/javascript/syntax.js +4380 -0
  116. package/lib/library/ModuleLibraryPlugin.js +38 -1
  117. package/lib/loaders/LoaderRunner.js +714 -0
  118. package/lib/loaders/loadLoader.js +100 -0
  119. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +19 -0
  120. package/lib/node/ReadFileCompileWasmPlugin.js +14 -0
  121. package/lib/optimize/ConcatenatedModule.js +120 -16
  122. package/lib/optimize/FlagIncludedChunksPlugin.js +13 -3
  123. package/lib/optimize/InnerGraphPlugin.js +50 -30
  124. package/lib/optimize/ModuleConcatenationPlugin.js +69 -3
  125. package/lib/optimize/SideEffectsFlagPlugin.js +86 -43
  126. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +15 -0
  127. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +24 -13
  128. package/lib/prefetch/ResourceHintPlugin.js +663 -0
  129. package/lib/prefetch/ResourceHintRuntimeModule.js +149 -0
  130. package/lib/prefetch/StartupAssetHintRuntimeModule.js +210 -0
  131. package/lib/prefetch/parseResourceHintOptions.js +103 -0
  132. package/lib/rules/RuleSetCompiler.js +114 -0
  133. package/lib/runtime/AsyncModuleGeneratorRuntimeModule.js +56 -0
  134. package/lib/runtime/AsyncModuleRuntimeModule.js +24 -8
  135. package/lib/runtime/AutoPublicPathRuntimeModule.js +7 -1
  136. package/lib/runtime/CommonJsWrapRuntimeModule.js +37 -0
  137. package/lib/runtime/GetWorkletBootstrapRuntimeModule.js +59 -0
  138. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +204 -8
  139. package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +4 -1
  140. package/lib/schemes/HttpUriPlugin.js +40 -1
  141. package/lib/schemes/VirtualUrlPlugin.js +1 -2
  142. package/lib/serialization/FileMiddleware.js +29 -3
  143. package/lib/stats/DefaultStatsFactoryPlugin.js +32 -3
  144. package/lib/stats/DefaultStatsPresetPlugin.js +2 -0
  145. package/lib/stats/DefaultStatsPrinterPlugin.js +12 -2
  146. package/lib/stats/StatsFactory.js +15 -8
  147. package/lib/url/URLParserPlugin.js +66 -13
  148. package/lib/util/AsyncQueue.js +122 -72
  149. package/lib/util/SetHelpers.js +1 -1
  150. package/lib/util/StackedMap.js +122 -48
  151. package/lib/util/binarySearchBounds.js +2 -2
  152. package/lib/util/concatenate.js +40 -14
  153. package/lib/util/createHooksRegistry.js +13 -5
  154. package/lib/util/dataURL.js +2 -2
  155. package/lib/util/deterministicGrouping.js +7 -5
  156. package/lib/util/formatSize.js +6 -2
  157. package/lib/util/globUtils.js +710 -0
  158. package/lib/util/identifier.js +23 -6
  159. package/lib/util/implicitTypeLoaderFallback.js +62 -0
  160. package/lib/util/internalSerializables.js +88 -71
  161. package/lib/util/magicComment.js +121 -25
  162. package/lib/util/numberHash.js +2 -2
  163. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +24 -18
  164. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +33 -22
  165. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +79 -16
  166. package/lib/web/FetchCompileAsyncWasmPlugin.js +19 -0
  167. package/lib/web/FetchCompileWasmPlugin.js +14 -0
  168. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -0
  169. package/lib/webpack.js +65 -0
  170. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +3 -0
  171. package/module.d.ts +21 -0
  172. package/package.json +13 -12
  173. package/schemas/WebpackOptions.check.js +1 -1
  174. package/schemas/WebpackOptions.json +759 -36
  175. package/schemas/plugins/HtmlParserOptions.check.js +1 -1
  176. package/schemas/plugins/ProgressPlugin.check.js +1 -1
  177. package/schemas/plugins/ProgressPlugin.json +17 -1
  178. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  179. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  180. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  181. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  182. package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
  183. package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +1 -1
  184. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  185. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  186. package/types.d.ts +1213 -96
@@ -70,10 +70,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
70
70
  ),
71
71
  /** @type {Range} */ (statement.range)
72
72
  );
73
- dep.setLocWithIndex(
74
- /** @type {DependencyLocation} */ (statement.loc),
75
- -1
76
- );
73
+ dep.setLocWithIndex(parser.getLocation(statement), -1);
77
74
  parser.state.module.addPresentationalDependency(dep);
78
75
  return true;
79
76
  });
@@ -84,10 +81,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
84
81
  "",
85
82
  /** @type {Range} */ (statement.range)
86
83
  );
87
- clearDep.setLocWithIndex(
88
- /** @type {DependencyLocation} */ (statement.loc),
89
- -1
90
- );
84
+ clearDep.setLocWithIndex(parser.getLocation(statement), -1);
91
85
  parser.state.module.addPresentationalDependency(clearDep);
92
86
 
93
87
  const phase = getImportPhase(parser, statement);
@@ -95,7 +89,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
95
89
  const error = new WebpackError(
96
90
  "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 };"
97
91
  );
98
- error.loc = statement.loc || undefined;
92
+ error.loc = parser.getLocation(statement) || undefined;
99
93
  parser.state.current.addError(error);
100
94
  }
101
95
  const sideEffectDep = new HarmonyImportSideEffectDependency(
@@ -104,10 +98,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
104
98
  phase,
105
99
  getImportAttributes(statement)
106
100
  );
107
- sideEffectDep.setLocWithIndex(
108
- /** @type {DependencyLocation} */ (statement.loc),
109
- -1
110
- );
101
+ sideEffectDep.setLocWithIndex(parser.getLocation(statement), -1);
111
102
  // lazy barrel: defer at parse time when the importing module is side-effect-free
112
103
  const moduleFactoryMeta = parser.state.module.factoryMeta;
113
104
  if (moduleFactoryMeta !== undefined && moduleFactoryMeta.sideEffectFree) {
@@ -168,10 +159,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
168
159
  node.type === "ClassDeclaration" ||
169
160
  node.type === "ClassExpression") &&
170
161
  !node.id));
171
- dep.setLocWithIndex(
172
- /** @type {DependencyLocation} */ (statement.loc),
173
- -1
174
- );
162
+ dep.setLocWithIndex(parser.getLocation(statement), -1);
175
163
  parser.state.current.addDependency(dep);
176
164
  getInnerGraphUtils(parser.state.compilation).addVariableUsage(
177
165
  parser,
@@ -241,7 +229,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
241
229
  dep.setLazy(true);
242
230
  }
243
231
  dep.setLocWithIndex(
244
- /** @type {DependencyLocation} */ (statement.loc),
232
+ parser.getLocation(statement),
245
233
  /** @type {number} */ (idx)
246
234
  );
247
235
  const isAsiSafe = !parser.isAsiPosition(
@@ -296,7 +284,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
296
284
  dep.setLazy(true);
297
285
  }
298
286
  dep.setLocWithIndex(
299
- /** @type {DependencyLocation} */ (statement.loc),
287
+ parser.getLocation(statement),
300
288
  /** @type {number} */ (idx)
301
289
  );
302
290
  const isAsiSafe = !parser.isAsiPosition(
@@ -10,6 +10,7 @@ const Dependency = require("../Dependency");
10
10
  const InitFragment = require("../InitFragment");
11
11
  const Template = require("../Template");
12
12
  const AwaitDependenciesInitFragment = require("../async-modules/AwaitDependenciesInitFragment");
13
+ const isGeneratorLowered = require("../async-modules/isGeneratorLowered");
13
14
  const { filterRuntime, mergeRuntime } = require("../util/runtime");
14
15
  const HarmonyLinkingError = require("./HarmonyLinkingError");
15
16
  const { ImportPhase, ImportPhaseUtils } = require("./ImportPhase");
@@ -475,8 +476,18 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
475
476
  )
476
477
  );
477
478
  const importVar = dep.getImportVar(templateContext.moduleGraph);
479
+ // When the consuming module is emitted as a generator (target without
480
+ // `async`/`await`), the dependency `await` must become `yield`.
481
+ const generatorLowered = isGeneratorLowered(
482
+ /** @type {Module} */ (module),
483
+ moduleGraph,
484
+ templateContext.runtimeTemplate
485
+ );
478
486
  templateContext.initFragments.push(
479
- new AwaitDependenciesInitFragment(new Map([[importVar, importVar]]))
487
+ new AwaitDependenciesInitFragment(
488
+ new Map([[importVar, importVar]]),
489
+ generatorLowered
490
+ )
480
491
  );
481
492
  templateContext.initFragments.push(
482
493
  new ConditionalInitFragment(
@@ -237,7 +237,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
237
237
  : "",
238
238
  /** @type {Range} */ (statement.range)
239
239
  );
240
- clearDep.loc = /** @type {DependencyLocation} */ (statement.loc);
240
+ clearDep.loc = parser.getLocation(statement);
241
241
  parser.state.module.addPresentationalDependency(clearDep);
242
242
  parser.unsetAsiPosition(/** @type {Range} */ (statement.range)[1]);
243
243
  const attributes = getImportAttributes(statement);
@@ -250,7 +250,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
250
250
  const error = new WebpackError(
251
251
  "Deferred import can only be used with `import * as namespace from '...'` syntax."
252
252
  );
253
- error.loc = statement.loc || undefined;
253
+ error.loc = parser.getLocation(statement) || undefined;
254
254
  parser.state.current.addError(error);
255
255
  }
256
256
 
@@ -260,7 +260,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
260
260
  phase,
261
261
  attributes
262
262
  );
263
- sideEffectDep.loc = /** @type {DependencyLocation} */ (statement.loc);
263
+ sideEffectDep.loc = parser.getLocation(statement);
264
264
  parser.state.module.addDependency(sideEffectDep);
265
265
  return true;
266
266
  });
@@ -307,7 +307,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
307
307
  dep.asiSafe = !parser.isAsiPosition(
308
308
  /** @type {Range} */ (expression.range)[0]
309
309
  );
310
- dep.loc = /** @type {DependencyLocation} */ (expression.loc);
310
+ dep.loc = parser.getLocation(expression);
311
311
  parser.state.module.addDependency(dep);
312
312
  getInnerGraphUtils(parser.state.compilation).onUsage(
313
313
  parser.state,
@@ -353,7 +353,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
353
353
  dep.asiSafe = !parser.isAsiPosition(
354
354
  /** @type {Range} */ (expr.range)[0]
355
355
  );
356
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
356
+ dep.loc = parser.getLocation(expr);
357
357
  dep.call = parser.scope.inTaggedTemplateTag;
358
358
  parser.state.module.addDependency(dep);
359
359
  attachDependencyGuards(parser, dep);
@@ -406,7 +406,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
406
406
  /** @type {Range} */
407
407
  (expr.range)[0]
408
408
  );
409
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
409
+ dep.loc = parser.getLocation(expr);
410
410
  parser.state.module.addDependency(dep);
411
411
  attachDependencyGuards(parser, dep);
412
412
  getInnerGraphUtils(parser.state.compilation).onUsage(
@@ -463,7 +463,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
463
463
  dep.namespaceObjectAsContext =
464
464
  members.length > 0 &&
465
465
  /** @type {boolean} */ (this.strictThisContextOnImports);
466
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
466
+ dep.loc = parser.getLocation(expr);
467
467
  parser.state.module.addDependency(dep);
468
468
  attachDependencyGuards(parser, dep);
469
469
  if (args) parser.walkExpressions(args);
@@ -504,7 +504,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
504
504
  }
505
505
  const dependencies = requests.map((request) => {
506
506
  const dep = new HarmonyAcceptImportDependency(request);
507
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
507
+ dep.loc = parser.getLocation(expr);
508
508
  parser.state.module.addDependency(dep);
509
509
  return dep;
510
510
  });
@@ -515,7 +515,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
515
515
  dependencies,
516
516
  true
517
517
  );
518
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
518
+ dep.loc = parser.getLocation(expr);
519
519
  parser.state.module.addDependency(dep);
520
520
  }
521
521
  });
@@ -526,7 +526,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
526
526
  }
527
527
  const dependencies = requests.map((request) => {
528
528
  const dep = new HarmonyAcceptImportDependency(request);
529
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
529
+ dep.loc = parser.getLocation(expr);
530
530
  parser.state.module.addDependency(dep);
531
531
  return dep;
532
532
  });
@@ -537,7 +537,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
537
537
  dependencies,
538
538
  false
539
539
  );
540
- dep.loc = /** @type {DependencyLocation} */ (expr.loc);
540
+ dep.loc = parser.getLocation(expr);
541
541
  parser.state.module.addDependency(dep);
542
542
  }
543
543
  });
@@ -25,6 +25,7 @@ const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDepe
25
25
  const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
26
26
 
27
27
  const HarmonyTopLevelThisParserPlugin = require("./HarmonyTopLevelThisParserPlugin");
28
+ const TopLevelAwaitDependency = require("./TopLevelAwaitDependency");
28
29
 
29
30
  /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
30
31
  /** @typedef {import("../Compiler")} Compiler */
@@ -62,6 +63,11 @@ class HarmonyModulesPlugin {
62
63
  new HarmonyCompatibilityDependency.Template()
63
64
  );
64
65
 
66
+ compilation.dependencyTemplates.set(
67
+ TopLevelAwaitDependency,
68
+ new TopLevelAwaitDependency.Template()
69
+ );
70
+
65
71
  compilation.dependencyFactories.set(
66
72
  HarmonyImportSideEffectDependency,
67
73
  normalModuleFactory
@@ -29,7 +29,7 @@ class HarmonyTopLevelThisParserPlugin {
29
29
  /** @type {Range} */ (node.range),
30
30
  null
31
31
  );
32
- dep.loc = /** @type {DependencyLocation} */ (node.loc);
32
+ dep.loc = parser.getLocation(node);
33
33
  parser.state.module.addPresentationalDependency(dep);
34
34
  return true;
35
35
  }