webpack 5.104.1 → 5.105.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 (279) hide show
  1. package/bin/webpack.js +6 -3
  2. package/lib/APIPlugin.js +85 -15
  3. package/lib/AbstractMethodError.js +1 -0
  4. package/lib/AsyncDependenciesBlock.js +13 -1
  5. package/lib/AsyncDependencyToInitialChunkError.js +1 -0
  6. package/lib/AutomaticPrefetchPlugin.js +1 -1
  7. package/lib/BannerPlugin.js +2 -0
  8. package/lib/CacheFacade.js +2 -2
  9. package/lib/CaseSensitiveModulesWarning.js +1 -0
  10. package/lib/Chunk.js +8 -4
  11. package/lib/ChunkGraph.js +30 -9
  12. package/lib/ChunkGroup.js +6 -3
  13. package/lib/ChunkRenderError.js +2 -0
  14. package/lib/CleanPlugin.js +4 -1
  15. package/lib/CodeGenerationError.js +7 -1
  16. package/lib/CodeGenerationResults.js +10 -3
  17. package/lib/CommentCompilationWarning.js +2 -1
  18. package/lib/Compilation.js +280 -236
  19. package/lib/Compiler.js +3 -2
  20. package/lib/ConcatenationScope.js +2 -1
  21. package/lib/ConcurrentCompilationError.js +3 -3
  22. package/lib/ContextModule.js +248 -111
  23. package/lib/ContextModuleFactory.js +14 -2
  24. package/lib/DefinePlugin.js +3 -1
  25. package/lib/DelegatedModule.js +6 -0
  26. package/lib/DelegatedModuleFactoryPlugin.js +2 -0
  27. package/lib/Dependency.js +6 -1
  28. package/lib/DependencyTemplates.js +3 -2
  29. package/lib/DllModule.js +2 -0
  30. package/lib/DllReferencePlugin.js +1 -0
  31. package/lib/DotenvPlugin.js +11 -5
  32. package/lib/DynamicEntryPlugin.js +1 -0
  33. package/lib/EnvironmentNotSupportAsyncWarning.js +1 -0
  34. package/lib/EvalSourceMapDevToolPlugin.js +17 -13
  35. package/lib/ExportsInfo.js +8 -4
  36. package/lib/ExternalModule.js +16 -0
  37. package/lib/FalseIIFEUmdWarning.js +1 -0
  38. package/lib/FileSystemInfo.js +49 -25
  39. package/lib/FlagDependencyExportsPlugin.js +8 -1
  40. package/lib/FlagDependencyUsagePlugin.js +9 -7
  41. package/lib/HarmonyLinkingError.js +1 -0
  42. package/lib/HookWebpackError.js +2 -0
  43. package/lib/HotModuleReplacementPlugin.js +16 -2
  44. package/lib/InitFragment.js +1 -0
  45. package/lib/InvalidDependenciesModuleWarning.js +1 -0
  46. package/lib/LibManifestPlugin.js +1 -0
  47. package/lib/ManifestPlugin.js +4 -1
  48. package/lib/Module.js +7 -4
  49. package/lib/ModuleBuildError.js +3 -1
  50. package/lib/ModuleDependencyError.js +1 -0
  51. package/lib/ModuleDependencyWarning.js +1 -0
  52. package/lib/ModuleError.js +2 -1
  53. package/lib/ModuleFilenameHelpers.js +2 -1
  54. package/lib/ModuleGraph.js +3 -0
  55. package/lib/ModuleGraphConnection.js +10 -1
  56. package/lib/ModuleHashingError.js +2 -0
  57. package/lib/ModuleInfoHeaderPlugin.js +6 -1
  58. package/lib/ModuleNotFoundError.js +1 -0
  59. package/lib/ModuleParseError.js +5 -1
  60. package/lib/ModuleProfile.js +1 -1
  61. package/lib/ModuleRestoreError.js +2 -0
  62. package/lib/ModuleSourceTypeConstants.js +1 -11
  63. package/lib/ModuleStoreError.js +2 -0
  64. package/lib/ModuleWarning.js +3 -1
  65. package/lib/MultiCompiler.js +11 -7
  66. package/lib/MultiWatching.js +2 -2
  67. package/lib/NoModeWarning.js +1 -0
  68. package/lib/NodeStuffInWebError.js +1 -0
  69. package/lib/NormalModule.js +26 -5
  70. package/lib/NormalModuleFactory.js +20 -4
  71. package/lib/OptionsApply.js +3 -1
  72. package/lib/ProgressPlugin.js +4 -0
  73. package/lib/RawModule.js +2 -0
  74. package/lib/RuntimeModule.js +10 -0
  75. package/lib/RuntimePlugin.js +7 -9
  76. package/lib/RuntimeTemplate.js +14 -7
  77. package/lib/SourceMapDevToolPlugin.js +30 -23
  78. package/lib/Template.js +10 -5
  79. package/lib/TemplatedPathPlugin.js +4 -2
  80. package/lib/UnhandledSchemeError.js +1 -0
  81. package/lib/UnsupportedFeatureWarning.js +1 -0
  82. package/lib/WarnDeprecatedOptionPlugin.js +1 -0
  83. package/lib/WatchIgnorePlugin.js +1 -1
  84. package/lib/Watching.js +5 -0
  85. package/lib/WebpackError.js +4 -0
  86. package/lib/WebpackOptionsApply.js +60 -40
  87. package/lib/asset/AssetBytesGenerator.js +1 -0
  88. package/lib/asset/AssetGenerator.js +9 -3
  89. package/lib/asset/AssetModulesPlugin.js +33 -2
  90. package/lib/asset/AssetSourceGenerator.js +1 -0
  91. package/lib/asset/RawDataUrlModule.js +4 -0
  92. package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -1
  93. package/lib/buildChunkGraph.js +31 -2
  94. package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
  95. package/lib/cache/PackFileCacheStrategy.js +41 -8
  96. package/lib/cache/getLazyHashedEtag.js +13 -4
  97. package/lib/cache/mergeEtags.js +3 -1
  98. package/lib/cli.js +3 -1
  99. package/lib/config/defaults.js +65 -44
  100. package/lib/config/normalization.js +96 -0
  101. package/lib/container/ContainerEntryModule.js +4 -0
  102. package/lib/container/FallbackModule.js +2 -0
  103. package/lib/container/HoistContainerReferencesPlugin.js +6 -0
  104. package/lib/container/RemoteModule.js +19 -0
  105. package/lib/css/CssGenerator.js +31 -4
  106. package/lib/css/CssModulesPlugin.js +26 -30
  107. package/lib/css/CssParser.js +12 -9
  108. package/lib/debug/ProfilingPlugin.js +1 -0
  109. package/lib/dependencies/AMDDefineDependency.js +3 -1
  110. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +6 -0
  111. package/lib/dependencies/AMDPlugin.js +1 -1
  112. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +7 -1
  113. package/lib/dependencies/CachedConstDependency.js +1 -0
  114. package/lib/dependencies/CommonJsDependencyHelpers.js +2 -0
  115. package/lib/dependencies/CommonJsExportRequireDependency.js +1 -0
  116. package/lib/dependencies/CommonJsFullRequireDependency.js +2 -0
  117. package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -0
  118. package/lib/dependencies/CommonJsRequireContextDependency.js +2 -2
  119. package/lib/dependencies/CommonJsSelfReferenceDependency.js +1 -0
  120. package/lib/dependencies/ConstDependency.js +1 -0
  121. package/lib/dependencies/ContextDependencyHelpers.js +11 -4
  122. package/lib/dependencies/ContextElementDependency.js +1 -0
  123. package/lib/dependencies/CriticalDependencyWarning.js +1 -0
  124. package/lib/dependencies/CssIcssExportDependency.js +5 -4
  125. package/lib/dependencies/CssIcssSymbolDependency.js +1 -0
  126. package/lib/dependencies/CssUrlDependency.js +2 -3
  127. package/lib/dependencies/ExternalModuleInitFragment.js +4 -1
  128. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +0 -9
  129. package/lib/dependencies/HarmonyAcceptDependency.js +3 -0
  130. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +1 -0
  131. package/lib/dependencies/HarmonyExportExpressionDependency.js +4 -0
  132. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +8 -1
  133. package/lib/dependencies/HarmonyExportInitFragment.js +17 -3
  134. package/lib/dependencies/HarmonyExportSpecifierDependency.js +4 -0
  135. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +266 -5
  136. package/lib/dependencies/HarmonyImportSpecifierDependency.js +22 -3
  137. package/lib/dependencies/ImportDependency.js +1 -0
  138. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
  139. package/lib/dependencies/ImportMetaPlugin.js +53 -11
  140. package/lib/dependencies/ImportParserPlugin.js +7 -12
  141. package/lib/dependencies/LoaderPlugin.js +3 -0
  142. package/lib/dependencies/ModuleDecoratorDependency.js +1 -0
  143. package/lib/dependencies/ModuleDependency.js +1 -0
  144. package/lib/dependencies/ModuleInitFragmentDependency.js +87 -0
  145. package/lib/dependencies/ProvidedDependency.js +1 -0
  146. package/lib/dependencies/RequireContextPlugin.js +1 -0
  147. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +7 -2
  148. package/lib/dependencies/RuntimeRequirementsDependency.js +1 -0
  149. package/lib/dependencies/WorkerDependency.js +9 -3
  150. package/lib/dependencies/WorkerPlugin.js +1 -0
  151. package/lib/dependencies/getFunctionExpression.js +3 -1
  152. package/lib/errors/BuildCycleError.js +4 -1
  153. package/lib/esm/ModuleChunkFormatPlugin.js +6 -4
  154. package/lib/esm/ModuleChunkLoadingPlugin.js +1 -0
  155. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +1 -0
  156. package/lib/hmr/LazyCompilationPlugin.js +5 -0
  157. package/lib/hmr/lazyCompilationBackend.js +3 -2
  158. package/lib/ids/ChunkModuleIdRangePlugin.js +2 -0
  159. package/lib/ids/IdHelpers.js +10 -8
  160. package/lib/ids/OccurrenceModuleIdsPlugin.js +15 -7
  161. package/lib/ids/SyncModuleIdsPlugin.js +5 -1
  162. package/lib/javascript/BasicEvaluatedExpression.js +1 -0
  163. package/lib/javascript/EnableChunkLoadingPlugin.js +5 -2
  164. package/lib/javascript/JavascriptModulesPlugin.js +29 -8
  165. package/lib/javascript/JavascriptParser.js +47 -14
  166. package/lib/json/JsonParser.js +6 -0
  167. package/lib/library/AbstractLibraryPlugin.js +4 -1
  168. package/lib/library/AmdLibraryPlugin.js +2 -1
  169. package/lib/library/AssignLibraryPlugin.js +6 -2
  170. package/lib/library/EnableLibraryPlugin.js +1 -0
  171. package/lib/library/ExportPropertyLibraryPlugin.js +1 -1
  172. package/lib/library/JsonpLibraryPlugin.js +1 -1
  173. package/lib/library/ModuleLibraryPlugin.js +130 -13
  174. package/lib/library/SystemLibraryPlugin.js +4 -1
  175. package/lib/library/UmdLibraryPlugin.js +4 -3
  176. package/lib/logging/createConsoleLogger.js +3 -0
  177. package/lib/logging/truncateArgs.js +1 -1
  178. package/lib/node/CommonJsChunkLoadingPlugin.js +1 -0
  179. package/lib/node/NodeTargetPlugin.js +1 -0
  180. package/lib/node/NodeWatchFileSystem.js +3 -0
  181. package/lib/node/nodeConsole.js +18 -1
  182. package/lib/optimize/AggressiveMergingPlugin.js +2 -1
  183. package/lib/optimize/AggressiveSplittingPlugin.js +10 -6
  184. package/lib/optimize/ConcatenatedModule.js +33 -19
  185. package/lib/optimize/FlagIncludedChunksPlugin.js +11 -1
  186. package/lib/optimize/InnerGraph.js +5 -3
  187. package/lib/optimize/InnerGraphPlugin.js +25 -25
  188. package/lib/optimize/MangleExportsPlugin.js +14 -2
  189. package/lib/optimize/MergeDuplicateChunksPlugin.js +3 -0
  190. package/lib/optimize/MinChunkSizePlugin.js +5 -2
  191. package/lib/optimize/ModuleConcatenationPlugin.js +19 -4
  192. package/lib/optimize/RealContentHashPlugin.js +35 -27
  193. package/lib/optimize/RemoveParentModulesPlugin.js +12 -3
  194. package/lib/optimize/SideEffectsFlagPlugin.js +3 -0
  195. package/lib/optimize/SplitChunksPlugin.js +14 -3
  196. package/lib/performance/AssetsOverSizeLimitWarning.js +6 -2
  197. package/lib/performance/EntrypointsOverSizeLimitWarning.js +6 -2
  198. package/lib/performance/NoAsyncChunksWarning.js +1 -0
  199. package/lib/rules/BasicEffectRulePlugin.js +2 -0
  200. package/lib/rules/BasicMatcherRulePlugin.js +3 -0
  201. package/lib/rules/ObjectMatcherRulePlugin.js +5 -1
  202. package/lib/rules/RuleSetCompiler.js +2 -0
  203. package/lib/runtime/AsyncModuleRuntimeModule.js +1 -0
  204. package/lib/runtime/ChunkNameRuntimeModule.js +1 -0
  205. package/lib/runtime/CompatRuntimeModule.js +1 -0
  206. package/lib/runtime/EnsureChunkRuntimeModule.js +1 -0
  207. package/lib/runtime/GetChunkFilenameRuntimeModule.js +4 -0
  208. package/lib/runtime/GetMainFilenameRuntimeModule.js +2 -0
  209. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -0
  210. package/lib/runtime/LoadScriptRuntimeModule.js +2 -0
  211. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +15 -32
  212. package/lib/runtime/PublicPathRuntimeModule.js +1 -0
  213. package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -0
  214. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -0
  215. package/lib/runtime/StartupEntrypointRuntimeModule.js +1 -0
  216. package/lib/schemes/HttpUriPlugin.js +27 -7
  217. package/lib/schemes/VirtualUrlPlugin.js +7 -2
  218. package/lib/serialization/BinaryMiddleware.js +4 -0
  219. package/lib/serialization/FileMiddleware.js +9 -4
  220. package/lib/serialization/ObjectMiddleware.js +34 -11
  221. package/lib/serialization/PlainObjectSerializer.js +2 -0
  222. package/lib/sharing/ConsumeSharedModule.js +60 -0
  223. package/lib/sharing/ConsumeSharedPlugin.js +5 -4
  224. package/lib/sharing/ProvideSharedModule.js +4 -0
  225. package/lib/sharing/ProvideSharedPlugin.js +24 -25
  226. package/lib/sharing/resolveMatchedConfigs.js +2 -2
  227. package/lib/sharing/utils.js +8 -6
  228. package/lib/stats/DefaultStatsFactoryPlugin.js +14 -12
  229. package/lib/stats/DefaultStatsPrinterPlugin.js +6 -5
  230. package/lib/stats/StatsFactory.js +2 -2
  231. package/lib/url/URLParserPlugin.js +4 -3
  232. package/lib/util/AppendOnlyStackedSet.js +57 -0
  233. package/lib/util/Hash.js +1 -0
  234. package/lib/util/IterableHelpers.js +1 -0
  235. package/lib/util/LazyBucketSortedSet.js +1 -0
  236. package/lib/util/LazySet.js +1 -0
  237. package/lib/util/ParallelismFactorCalculator.js +1 -0
  238. package/lib/util/SortableSet.js +1 -0
  239. package/lib/util/StringXor.js +1 -0
  240. package/lib/util/binarySearchBounds.js +15 -8
  241. package/lib/util/chainedImports.js +1 -1
  242. package/lib/util/cleverMerge.js +6 -1
  243. package/lib/util/comparators.js +21 -1
  244. package/lib/util/compileBooleanMatcher.js +3 -3
  245. package/lib/util/concatenate.js +3 -2
  246. package/lib/util/conventions.js +3 -2
  247. package/lib/util/deterministicGrouping.js +13 -1
  248. package/lib/util/extractSourceMap.js +12 -13
  249. package/lib/util/fs.js +15 -19
  250. package/lib/util/hash/BatchedHash.js +3 -0
  251. package/lib/util/hash/BulkUpdateHash.js +7 -1
  252. package/lib/util/hash/hash-digest.js +1 -0
  253. package/lib/util/hash/wasm-hash.js +16 -1
  254. package/lib/util/identifier.js +7 -2
  255. package/lib/util/magicComment.js +1 -1
  256. package/lib/util/propertyName.js +1 -1
  257. package/lib/util/registerExternalSerializer.js +1 -0
  258. package/lib/util/runtime.js +15 -1
  259. package/lib/util/semver.js +1 -0
  260. package/lib/util/serialization.js +2 -2
  261. package/lib/wasm/EnableWasmLoadingPlugin.js +1 -0
  262. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +11 -3
  263. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +1 -0
  264. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -2
  265. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +5 -1
  266. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +3 -0
  267. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +2 -0
  268. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +7 -3
  269. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -2
  270. package/lib/wasm-sync/WebAssemblyParser.js +3 -1
  271. package/lib/web/FetchCompileWasmPlugin.js +1 -0
  272. package/lib/web/JsonpChunkLoadingPlugin.js +1 -0
  273. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -0
  274. package/lib/webpack.js +13 -3
  275. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
  276. package/package.json +20 -28
  277. package/schemas/WebpackOptions.check.js +1 -1
  278. package/schemas/WebpackOptions.json +71 -5
  279. package/types.d.ts +339 -93
@@ -35,7 +35,7 @@ const CssImportDependency = require("../dependencies/CssImportDependency");
35
35
  const CssUrlDependency = require("../dependencies/CssUrlDependency");
36
36
  const StaticExportsDependency = require("../dependencies/StaticExportsDependency");
37
37
  const JavascriptModulesPlugin = require("../javascript/JavascriptModulesPlugin");
38
- const { compareModulesByIdOrIdentifier } = require("../util/comparators");
38
+ const { compareModulesByFullName } = require("../util/comparators");
39
39
  const createSchemaValidation = require("../util/create-schema-validation");
40
40
  const createHash = require("../util/createHash");
41
41
  const { getUndoPath } = require("../util/identifier");
@@ -311,7 +311,7 @@ class CssModulesPlugin {
311
311
  (compilation.moduleGraph.getParentModule(dependency));
312
312
 
313
313
  if (parent instanceof CssModule) {
314
- /** @type {import("../CssModule").Inheritance | undefined} */
314
+ /** @type {Inheritance | undefined} */
315
315
  let inheritance;
316
316
 
317
317
  if (
@@ -417,6 +417,7 @@ class CssModulesPlugin {
417
417
 
418
418
  return source;
419
419
  });
420
+ /** @type {WeakMap<Chunk, CssModule[]>} */
420
421
  const orderedCssModulesPerChunk = new WeakMap();
421
422
  compilation.hooks.afterCodeGeneration.tap(PLUGIN_NAME, () => {
422
423
  const { chunkGraph } = compilation;
@@ -526,6 +527,7 @@ class CssModulesPlugin {
526
527
  : globalChunkLoading;
527
528
  return chunkLoading === "jsonp" || chunkLoading === "import";
528
529
  };
530
+ /** @type {WeakSet<Chunk>} */
529
531
  const onceForChunkSet = new WeakSet();
530
532
  /**
531
533
  * @param {Chunk} chunk chunk to check
@@ -597,7 +599,7 @@ class CssModulesPlugin {
597
599
 
598
600
  /**
599
601
  * @param {Chunk} chunk chunk
600
- * @param {Iterable<Module>} modules unordered modules
602
+ * @param {Iterable<Module> | undefined} modules unordered modules
601
603
  * @param {Compilation} compilation compilation
602
604
  * @returns {Module[]} ordered modules
603
605
  */
@@ -632,8 +634,8 @@ class CssModulesPlugin {
632
634
  return modulesByChunkGroup[0].list.reverse();
633
635
  }
634
636
 
635
- const boundCompareModulesByIdOrIdentifier = compareModulesByIdOrIdentifier(
636
- compilation.chunkGraph
637
+ const boundCompareModulesByFullName = compareModulesByFullName(
638
+ compilation.compiler
637
639
  );
638
640
 
639
641
  /**
@@ -646,10 +648,7 @@ class CssModulesPlugin {
646
648
  return b.length === 0 ? 0 : 1;
647
649
  }
648
650
  if (b.length === 0) return -1;
649
- return boundCompareModulesByIdOrIdentifier(
650
- a[a.length - 1],
651
- b[b.length - 1]
652
- );
651
+ return boundCompareModulesByFullName(a[a.length - 1], b[b.length - 1]);
653
652
  };
654
653
 
655
654
  modulesByChunkGroup.sort(compareModuleLists);
@@ -658,6 +657,7 @@ class CssModulesPlugin {
658
657
  const finalModules = [];
659
658
 
660
659
  for (;;) {
660
+ /** @type {Set<Module>} */
661
661
  const failedModules = new Set();
662
662
  const list = modulesByChunkGroup[0].list;
663
663
  if (list.length === 0) {
@@ -666,6 +666,7 @@ class CssModulesPlugin {
666
666
  }
667
667
  /** @type {Module} */
668
668
  let selectedModule = list[list.length - 1];
669
+ /** @type {undefined | false | Module} */
669
670
  let hasFailed;
670
671
  outer: for (;;) {
671
672
  for (const { list, set } of modulesByChunkGroup) {
@@ -690,10 +691,9 @@ class CssModulesPlugin {
690
691
  // TODO print better warning
691
692
  compilation.warnings.push(
692
693
  new WebpackError(
693
- `chunk ${chunk.name || chunk.id}\nConflicting order between ${
694
- /** @type {Module} */
695
- (hasFailed).readableIdentifier(compilation.requestShortener)
696
- } and ${selectedModule.readableIdentifier(
694
+ `chunk ${chunk.name || chunk.id}\nConflicting order between ${hasFailed.readableIdentifier(
695
+ compilation.requestShortener
696
+ )} and ${selectedModule.readableIdentifier(
697
697
  compilation.requestShortener
698
698
  )}`
699
699
  )
@@ -721,35 +721,29 @@ class CssModulesPlugin {
721
721
  * @param {Chunk} chunk chunk
722
722
  * @param {ChunkGraph} chunkGraph chunk graph
723
723
  * @param {Compilation} compilation compilation
724
- * @returns {Module[]} ordered css modules
724
+ * @returns {CssModule[]} ordered css modules
725
725
  */
726
726
  getOrderedChunkCssModules(chunk, chunkGraph, compilation) {
727
- return [
727
+ return /** @type {CssModule[]} */ ([
728
728
  ...this.getModulesInOrder(
729
729
  chunk,
730
- /** @type {Iterable<Module>} */
731
- (
732
- chunkGraph.getOrderedChunkModulesIterableBySourceType(
733
- chunk,
734
- CSS_IMPORT_TYPE,
735
- compareModulesByIdOrIdentifier(chunkGraph)
736
- )
730
+ chunkGraph.getOrderedChunkModulesIterableBySourceType(
731
+ chunk,
732
+ CSS_IMPORT_TYPE,
733
+ compareModulesByFullName(compilation.compiler)
737
734
  ),
738
735
  compilation
739
736
  ),
740
737
  ...this.getModulesInOrder(
741
738
  chunk,
742
- /** @type {Iterable<Module>} */
743
- (
744
- chunkGraph.getOrderedChunkModulesIterableBySourceType(
745
- chunk,
746
- CSS_TYPE,
747
- compareModulesByIdOrIdentifier(chunkGraph)
748
- )
739
+ chunkGraph.getOrderedChunkModulesIterableBySourceType(
740
+ chunk,
741
+ CSS_TYPE,
742
+ compareModulesByFullName(compilation.compiler)
749
743
  ),
750
744
  compilation
751
745
  )
752
- ];
746
+ ]);
753
747
  }
754
748
 
755
749
  /**
@@ -768,6 +762,7 @@ class CssModulesPlugin {
768
762
  inheritance.push(...module.inheritance);
769
763
  }
770
764
 
765
+ /** @type {CachedSource} */
771
766
  let source;
772
767
  if (
773
768
  cacheEntry &&
@@ -792,6 +787,7 @@ class CssModulesPlugin {
792
787
  );
793
788
  /** @type {Source} */
794
789
  let moduleSource = new ReplaceSource(moduleSourceContent);
790
+ /** @type {null | RegExpExecArray} */
795
791
  let match;
796
792
  while ((match = publicPathAutoRegex.exec(moduleSourceCode))) {
797
793
  /** @type {ReplaceSource} */ (moduleSource).replace(
@@ -56,11 +56,11 @@ const CC_EQUAL = "=".charCodeAt(0);
56
56
  const STRING_MULTILINE = /\\[\n\r\f]/g;
57
57
  // https://www.w3.org/TR/css-syntax-3/#whitespace
58
58
  const TRIM_WHITE_SPACES = /(^[ \t\n\r\f]*|[ \t\n\r\f]*$)/g;
59
- const UNESCAPE = /\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g;
60
- const IMAGE_SET_FUNCTION = /^(-\w+-)?image-set$/i;
61
- const OPTIONALLY_VENDOR_PREFIXED_KEYFRAMES_AT_RULE = /^@(-\w+-)?keyframes$/;
62
- const COMPOSES_PROPERTY = /^(composes|compose-with)$/i;
63
- const IS_MODULES = /\.module(s)?\.[^.]+$/i;
59
+ const UNESCAPE = /\\([0-9a-f]{1,6}[ \t\n\r\f]?|[\s\S])/gi;
60
+ const IMAGE_SET_FUNCTION = /^(?:-\w+-)?image-set$/i;
61
+ const OPTIONALLY_VENDOR_PREFIXED_KEYFRAMES_AT_RULE = /^@(?:-\w+-)?keyframes$/;
62
+ const COMPOSES_PROPERTY = /^(?:composes|compose-with)$/i;
63
+ const IS_MODULES = /\.modules?\.[^.]+$/i;
64
64
  const CSS_COMMENT = /\/\*((?!\*\/).*?)\*\//g;
65
65
 
66
66
  /**
@@ -72,6 +72,7 @@ const matchAll = (regexp, str) => {
72
72
  /** @type {RegExpExecArray[]} */
73
73
  const result = [];
74
74
 
75
+ /** @type {null | RegExpExecArray} */
75
76
  let match;
76
77
 
77
78
  // Use a while loop with exec() to find all matches
@@ -123,8 +124,7 @@ const normalizeUrl = (str, isString) => {
123
124
  return str;
124
125
  };
125
126
 
126
- // eslint-disable-next-line no-useless-escape
127
- const regexSingleEscape = /[ -,.\/:-@[\]\^`{-~]/;
127
+ const regexSingleEscape = /[ -,./:-@[\]^`{-~]/;
128
128
  const regexExcessiveSpaces =
129
129
  /(^|\\+)?(\\[A-F0-9]{1,6})\u0020(?![a-fA-F0-9\u0020])/g;
130
130
 
@@ -139,10 +139,10 @@ const escapeIdentifier = (str) => {
139
139
  while (counter < str.length) {
140
140
  const character = str.charAt(counter++);
141
141
 
142
+ /** @type {string} */
142
143
  let value;
143
144
 
144
- // eslint-disable-next-line no-control-regex
145
- if (/[\t\n\f\r\u000B]/.test(character)) {
145
+ if (/[\t\n\f\r\v]/.test(character)) {
146
146
  const codePoint = character.charCodeAt(0);
147
147
 
148
148
  value = `\\${codePoint.toString(16).toUpperCase()} `;
@@ -829,12 +829,14 @@ class CssParser extends Parser {
829
829
  return newline;
830
830
  }
831
831
 
832
+ /** @type {undefined | string} */
832
833
  let layer;
833
834
 
834
835
  if (tokens[1]) {
835
836
  layer = input.slice(tokens[1][0] + 6, tokens[1][1] - 1).trim();
836
837
  }
837
838
 
839
+ /** @type {undefined | string} */
838
840
  let supports;
839
841
 
840
842
  if (tokens[2]) {
@@ -847,6 +849,7 @@ class CssParser extends Parser {
847
849
  last[1]
848
850
  )[0];
849
851
 
852
+ /** @type {undefined | string} */
850
853
  let media;
851
854
 
852
855
  if (mediaStart !== semi - 1) {
@@ -561,6 +561,7 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
561
561
  id,
562
562
  cat: defaultCategory
563
563
  });
564
+ /** @type {PluginFunction} */
564
565
  let r;
565
566
  try {
566
567
  r = fn(...args);
@@ -10,6 +10,7 @@ const makeSerializable = require("../util/makeSerializable");
10
10
  const NullDependency = require("./NullDependency");
11
11
 
12
12
  /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
13
+ /** @typedef {import("./LocalModule")} LocalModule */
13
14
  /** @typedef {import("../Dependency")} Dependency */
14
15
  /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
15
16
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
@@ -120,6 +121,7 @@ class AMDDefineDependency extends NullDependency {
120
121
  this.functionRange = functionRange;
121
122
  this.objectRange = objectRange;
122
123
  this.namedModule = namedModule;
124
+ /** @type {LocalModule | null} */
123
125
  this.localModule = null;
124
126
  }
125
127
 
@@ -182,7 +184,7 @@ AMDDefineDependency.Template = class AMDDefineDependencyTemplate extends (
182
184
 
183
185
  /**
184
186
  * @param {AMDDefineDependency} dependency dependency
185
- * @returns {string} variable name
187
+ * @returns {string | false | null} variable name
186
188
  */
187
189
  localModuleVar(dependency) {
188
190
  return (
@@ -26,11 +26,13 @@ const { addLocalModule, getLocalModule } = require("./LocalModulesHelpers");
26
26
  /** @typedef {import("estree").ObjectExpression} ObjectExpression */
27
27
  /** @typedef {import("estree").SpreadElement} SpreadElement */
28
28
  /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
29
+ /** @typedef {import("../Dependency")} Dependency */
29
30
  /** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
30
31
  /** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
31
32
  /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
32
33
  /** @typedef {import("../javascript/JavascriptParser").ExportedVariableInfo} ExportedVariableInfo */
33
34
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
35
+ /** @typedef {import("./LocalModule")} LocalModule */
34
36
 
35
37
  /**
36
38
  * @param {Expression | SpreadElement} expr expression
@@ -123,7 +125,9 @@ class AMDDefineDependencyParserPlugin {
123
125
  const deps = [];
124
126
  const array = /** @type {string[]} */ (param.array);
125
127
  for (const [idx, request] of array.entries()) {
128
+ /** @type {string | LocalModuleDependency | AMDRequireItemDependency} */
126
129
  let dep;
130
+ /** @type {undefined | null | LocalModule} */
127
131
  let localModule;
128
132
  if (request === "require") {
129
133
  identifiers[idx] = request;
@@ -174,7 +178,9 @@ class AMDDefineDependencyParserPlugin {
174
178
 
175
179
  return true;
176
180
  } else if (param.isString()) {
181
+ /** @type {Dependency} */
177
182
  let dep;
183
+ /** @type {undefined | null | LocalModule} */
178
184
  let localModule;
179
185
 
180
186
  if (param.string === "require") {
@@ -58,7 +58,7 @@ class AMDPlugin {
58
58
  * @returns {void}
59
59
  */
60
60
  apply(compiler) {
61
- const amdOptions = this.amdOptions;
61
+ const { amdOptions } = this;
62
62
  compiler.hooks.compilation.tap(
63
63
  PLUGIN_NAME,
64
64
  (compilation, { contextModuleFactory, normalModuleFactory }) => {
@@ -25,10 +25,12 @@ const getFunctionExpression = require("./getFunctionExpression");
25
25
  /** @typedef {import("estree").SourceLocation} SourceLocation */
26
26
  /** @typedef {import("estree").SpreadElement} SpreadElement */
27
27
  /** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
28
+ /** @typedef {import("../Dependency")} Dependency */
28
29
  /** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
29
30
  /** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
30
31
  /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
31
32
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
33
+ /** @typedef {import("./LocalModule")} LocalModule */
32
34
 
33
35
  const PLUGIN_NAME = "AMDRequireDependenciesBlockParserPlugin";
34
36
 
@@ -102,8 +104,10 @@ class AMDRequireDependenciesBlockParserPlugin {
102
104
  } else if (param.isConstArray()) {
103
105
  /** @type {(string | LocalModuleDependency | AMDRequireItemDependency)[]} */
104
106
  const deps = [];
105
- for (const request of /** @type {EXPECTED_ANY[]} */ (param.array)) {
107
+ for (const request of /** @type {string[]} */ (param.array)) {
108
+ /** @type {string | LocalModuleDependency | AMDRequireItemDependency} */
106
109
  let dep;
110
+ /** @type {undefined | null | LocalModule} */
107
111
  let localModule;
108
112
  if (request === "require") {
109
113
  dep = RuntimeGlobals.require;
@@ -152,7 +156,9 @@ class AMDRequireDependenciesBlockParserPlugin {
152
156
  }
153
157
  return true;
154
158
  } else if (param.isString()) {
159
+ /** @type {Dependency} */
155
160
  let dep;
161
+ /** @type {LocalModule | null | undefined} */
156
162
  let localModule;
157
163
  if (param.string === "require") {
158
164
  dep = new ConstDependency(
@@ -38,6 +38,7 @@ class CachedConstDependency extends NullDependency {
38
38
  this.range = range;
39
39
  this.identifier = identifier;
40
40
  this.place = place;
41
+ /** @type {undefined | string} */
41
42
  this._hashUpdate = undefined;
42
43
  }
43
44
 
@@ -22,7 +22,9 @@ module.exports.handleDependencyBase = (
22
22
  module,
23
23
  runtimeRequirements
24
24
  ) => {
25
+ /** @type {string} */
25
26
  let base;
27
+ /** @type {string} */
26
28
  let type;
27
29
  switch (depBase) {
28
30
  case "exports":
@@ -57,6 +57,7 @@ class CommonJsExportRequireDependency extends ModuleDependency {
57
57
  this.names = names;
58
58
  this.ids = ids;
59
59
  this.resultUsed = resultUsed;
60
+ /** @type {undefined | boolean} */
60
61
  this.asiSafe = undefined;
61
62
  }
62
63
 
@@ -41,7 +41,9 @@ class CommonJsFullRequireDependency extends ModuleDependency {
41
41
  this.range = range;
42
42
  this.names = names;
43
43
  this.idRanges = idRanges;
44
+ /** @type {boolean} */
44
45
  this.call = false;
46
+ /** @type {undefined | boolean} */
45
47
  this.asiSafe = undefined;
46
48
  }
47
49
 
@@ -40,6 +40,7 @@ const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency
40
40
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
41
41
  /** @typedef {import("../javascript/JavascriptParser").Members} Members */
42
42
  /** @typedef {import("../javascript/JavascriptParser").CalleeMembers} CalleeMembers */
43
+ /** @typedef {import("./LocalModule")} LocalModule */
43
44
 
44
45
  /**
45
46
  * @typedef {object} CommonJsImportSettings
@@ -299,6 +300,7 @@ class CommonJsImportsParserPlugin {
299
300
  }
300
301
 
301
302
  if (expr.arguments.length !== 1) return;
303
+ /** @type {null | LocalModule} */
302
304
  let localModule;
303
305
  const param = parser.evaluateExpression(expr.arguments[0]);
304
306
  if (param.isConditional()) {
@@ -586,6 +588,7 @@ class CommonJsImportsParserPlugin {
586
588
  moduleName = ["module", "node:module"];
587
589
  specifierName = "createRequire";
588
590
  } else {
591
+ /** @type {undefined | string} */
589
592
  let moduleName;
590
593
  const match = /^(.*) from (.*)$/.exec(options.createRequire);
591
594
  if (match) {
@@ -18,8 +18,8 @@ class CommonJsRequireContextDependency extends ContextDependency {
18
18
  /**
19
19
  * @param {ContextDependencyOptions} options options for the context module
20
20
  * @param {Range} range location in source code
21
- * @param {Range | undefined} valueRange location of the require call
22
- * @param {boolean | string} inShorthand true or name
21
+ * @param {Range=} valueRange location of the require call
22
+ * @param {boolean | string=} inShorthand true or name
23
23
  * @param {string=} context context
24
24
  */
25
25
  constructor(options, range, valueRange, inShorthand, context) {
@@ -118,6 +118,7 @@ CommonJsSelfReferenceDependency.Template = class CommonJsSelfReferenceDependency
118
118
  );
119
119
  }
120
120
 
121
+ /** @type {string} */
121
122
  let base;
122
123
  switch (dep.base) {
123
124
  case "exports":
@@ -33,6 +33,7 @@ class ConstDependency extends NullDependency {
33
33
  this.runtimeRequirements = runtimeRequirements
34
34
  ? new Set(runtimeRequirements)
35
35
  : null;
36
+ /** @type {undefined | string} */
36
37
  this._hashUpdate = undefined;
37
38
  }
38
39
 
@@ -26,7 +26,7 @@ const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
26
26
 
27
27
  /**
28
28
  * @param {string} prefix prefix
29
- * @returns {{prefix: string, context: string}} result
29
+ * @returns {{ prefix: string, context: string }} result
30
30
  */
31
31
  const splitContextFromPrefix = (prefix) => {
32
32
  const idx = prefix.lastIndexOf("/");
@@ -42,17 +42,23 @@ const splitContextFromPrefix = (prefix) => {
42
42
  };
43
43
 
44
44
  /** @typedef {Partial<Omit<ContextDependencyOptions, "resource">>} PartialContextDependencyOptions */
45
- /** @typedef {{ new(options: ContextDependencyOptions, range: Range, valueRange: Range, ...args: EXPECTED_ANY[]): ContextDependency }} ContextDependencyConstructor */
45
+ /** @typedef {{ new (options: ContextDependencyOptions, range: Range, valueRange: Range, ...args: EXPECTED_ANY[]): ContextDependency }} ContextDependencyConstructor */
46
46
 
47
47
  /**
48
- * @param {ContextDependencyConstructor} Dep the Dependency class
48
+ * @template T
49
+ * @typedef {T extends new (options: ContextDependencyOptions, range: Range, valueRange: Range, ...remains: infer R) => EXPECTED_ANY ? R : []} GetAdditionalDepArgs
50
+ */
51
+
52
+ /**
53
+ * @template {ContextDependencyConstructor} T
54
+ * @param {T} Dep the Dependency class
49
55
  * @param {Range} range source range
50
56
  * @param {BasicEvaluatedExpression} param context param
51
57
  * @param {Expression} expr expr
52
58
  * @param {Pick<JavascriptParserOptions, `${"expr" | "wrapped"}Context${"Critical" | "Recursive" | "RegExp"}` | "exprContextRequest">} options options for context creation
53
59
  * @param {PartialContextDependencyOptions} contextOptions options for the ContextModule
54
60
  * @param {JavascriptParser} parser the parser
55
- * @param {...EXPECTED_ANY} depArgs depArgs
61
+ * @param {GetAdditionalDepArgs<T>} depArgs depArgs
56
62
  * @returns {ContextDependency} the created Dependency
57
63
  */
58
64
  module.exports.create = (
@@ -216,6 +222,7 @@ module.exports.create = (
216
222
  ...depArgs
217
223
  );
218
224
  dep.loc = /** @type {DependencyLocation} */ (expr.loc);
225
+ /** @type {Replaces} */
219
226
  const replaces = [];
220
227
  if (prefixRange) {
221
228
  replaces.push({
@@ -82,6 +82,7 @@ class ContextElementDependency extends ModuleDependency {
82
82
  */
83
83
  getReferencedExports(moduleGraph, runtime) {
84
84
  if (!this.referencedExports) return Dependency.EXPORTS_OBJECT_REFERENCED;
85
+ /** @type {ReferencedExports} */
85
86
  const refs = [];
86
87
  for (const referencedExport of this.referencedExports) {
87
88
  if (
@@ -15,6 +15,7 @@ class CriticalDependencyWarning extends WebpackError {
15
15
  constructor(message) {
16
16
  super();
17
17
 
18
+ /** @type {string} */
18
19
  this.name = "CriticalDependencyWarning";
19
20
  this.message = `Critical dependency: ${message}`;
20
21
  }
@@ -60,7 +60,7 @@ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => {
60
60
 
61
61
  let localIdentHash = "";
62
62
 
63
- if (/\[(fullhash|hash)\]/.test(localIdentName)) {
63
+ if (/\[(?:fullhash|hash)\]/.test(localIdentName)) {
64
64
  const hashSalt = generator.options.localIdentHashSalt;
65
65
  const hashDigest =
66
66
  /** @type {string} */
@@ -113,8 +113,8 @@ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => {
113
113
  if (typeof id !== "string") return id;
114
114
 
115
115
  return id
116
- .replace(/^([.-]|[^a-zA-Z0-9_-])+/, "")
117
- .replace(/[^a-zA-Z0-9_-]+/g, "_");
116
+ .replace(/^([.-]|[^a-z0-9_-])+/i, "")
117
+ .replace(/[^a-z0-9_-]+/gi, "_");
118
118
  },
119
119
  filename: relativeResourcePath,
120
120
  hash: localIdentHash,
@@ -135,7 +135,7 @@ const getLocalIdent = (local, module, chunkGraph, runtimeTemplate) => {
135
135
  }
136
136
 
137
137
  // Protect the first character from unsupported values
138
- return localIdent.replace(/^((-?[0-9])|--)/, "_$1");
138
+ return localIdent.replace(/^((-?\d)|--)/, "_$1");
139
139
  };
140
140
 
141
141
  // 0 - replace, 1 - replace, 2 - append, 2 - once
@@ -170,6 +170,7 @@ class CssIcssExportDependency extends NullDependency {
170
170
  this.interpolate = interpolate;
171
171
  this.exportMode = exportMode;
172
172
  this.exportType = exportType;
173
+ /** @type {undefined | string} */
173
174
  this._hashUpdate = undefined;
174
175
  }
175
176
 
@@ -36,6 +36,7 @@ class CssIcssSymbolDependency extends NullDependency {
36
36
  this.symbol = symbol;
37
37
  this.range = range;
38
38
  this.isReference = isReference;
39
+ /** @type {undefined | string} */
39
40
  this._hashUpdate = undefined;
40
41
  }
41
42
 
@@ -16,6 +16,7 @@ const ModuleDependency = require("./ModuleDependency");
16
16
  /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
17
17
  /** @typedef {import("../Module")} Module */
18
18
  /** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
19
+ /** @typedef {import("../Module").CodeGenerationResultData} CodeGenerationResultData */
19
20
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
20
21
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
21
22
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
@@ -173,9 +174,7 @@ CssUrlDependency.Template = class CssUrlDependencyTemplate extends (
173
174
  return "data:,";
174
175
  }
175
176
  const codeGen = codeGenerationResults.get(module, runtime);
176
- const data =
177
- /** @type {NonNullable<CodeGenerationResult["data"]>} */
178
- (codeGen.data);
177
+ const data = codeGen.data;
179
178
  if (!data) return "data:,";
180
179
  const url = data.get("url");
181
180
  if (!url || !url["css-url"]) return "data:,";
@@ -13,7 +13,8 @@ const makeSerializable = require("../util/makeSerializable");
13
13
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
14
14
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
15
15
  /** @typedef {{ name: string, value?: string }[]} ArrayImportSpecifiers */
16
- /** @typedef {Map<string, Set<string>>} ImportSpecifiers */
16
+ /** @typedef {Set<string>} ImportSpecifier */
17
+ /** @typedef {Map<string, ImportSpecifier>} ImportSpecifiers */
17
18
 
18
19
  /**
19
20
  * @extends {InitFragment<GenerateContext>}
@@ -38,6 +39,7 @@ class ExternalModuleInitFragment extends InitFragment {
38
39
  for (const { name, value } of specifiers) {
39
40
  let specifiers = this.specifiers.get(name);
40
41
  if (!specifiers) {
42
+ /** @type {ImportSpecifier} */
41
43
  specifiers = new Set();
42
44
  this.specifiers.set(name, specifiers);
43
45
  }
@@ -77,6 +79,7 @@ class ExternalModuleInitFragment extends InitFragment {
77
79
  * @returns {string | Source | undefined} the source code that will be included as initialization code
78
80
  */
79
81
  getContent({ runtimeRequirements }) {
82
+ /** @type {string[]} */
80
83
  const namedImports = [];
81
84
 
82
85
  for (const [name, specifiers] of this.specifiers) {
@@ -31,15 +31,6 @@ class ExternalModuleInitFragmentDependency extends NullDependency {
31
31
  this.default = defaultImport;
32
32
  }
33
33
 
34
- /**
35
- * @returns {string} hash update
36
- */
37
- _createHashUpdate() {
38
- return `${this.importedModule}${JSON.stringify(this.specifiers)}${
39
- this.default || "null"
40
- }`;
41
- }
42
-
43
34
  /**
44
35
  * @param {ObjectSerializerContext} context context
45
36
  */
@@ -114,8 +114,11 @@ HarmonyAcceptDependency.Template = class HarmonyAcceptDependencyTemplate extends
114
114
  * @returns {HarmonyImportDependency[]} array of related harmony import dependencies
115
115
  */
116
116
  const getHarmonyImportDependencies = (dependency) => {
117
+ /** @type {HarmonyImportDependency[]} */
117
118
  const result = [];
119
+ /** @type {HarmonyImportDependency | null} */
118
120
  let deferDependency = null;
121
+ /** @type {HarmonyImportDependency | null} */
119
122
  let noDeferredDependency = null;
120
123
 
121
124
  for (const d of module.dependencies) {
@@ -103,6 +103,7 @@ HarmonyEvaluatedImportSpecifierDependency.Template = class HarmonyEvaluatedImpor
103
103
  );
104
104
  const ids = dep.getIds(moduleGraph);
105
105
 
106
+ /** @type {boolean | undefined | null} */
106
107
  let value;
107
108
 
108
109
  const exportsType =
@@ -21,6 +21,7 @@ const NullDependency = require("./NullDependency");
21
21
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
22
22
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
23
23
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
24
+ /** @typedef {import("./HarmonyExportInitFragment").ExportMap} ExportMap */
24
25
 
25
26
  class HarmonyExportExpressionDependency extends NullDependency {
26
27
  /**
@@ -120,6 +121,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
120
121
  const { declarationId } = dep;
121
122
  const exportsName = module.exportsArgument;
122
123
  if (declarationId) {
124
+ /** @type {string} */
123
125
  let name;
124
126
  if (typeof declarationId === "string") {
125
127
  name = declarationId;
@@ -139,6 +141,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
139
141
  .getExportsInfo(module)
140
142
  .getUsedName("default", runtime);
141
143
  if (used) {
144
+ /** @type {ExportMap} */
142
145
  const map = new Map();
143
146
  map.set(used, `/* export default binding */ ${name}`);
144
147
  initFragments.push(new HarmonyExportInitFragment(exportsName, map));
@@ -164,6 +167,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
164
167
  .getUsedName("default", runtime);
165
168
  if (used) {
166
169
  runtimeRequirements.add(RuntimeGlobals.exports);
170
+ /** @type {ExportMap} */
167
171
  const map = new Map();
168
172
  map.set(used, name);
169
173
  initFragments.push(new HarmonyExportInitFragment(exportsName, map));