@depup/webpack 5.105.4-depup.37

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 (709) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +38 -0
  3. package/bin/webpack.js +196 -0
  4. package/hot/dev-server.js +90 -0
  5. package/hot/emitter-event-target.js +7 -0
  6. package/hot/emitter.js +2 -0
  7. package/hot/lazy-compilation-node.js +66 -0
  8. package/hot/lazy-compilation-universal.js +18 -0
  9. package/hot/lazy-compilation-web.js +93 -0
  10. package/hot/load-http.js +7 -0
  11. package/hot/log-apply-result.js +49 -0
  12. package/hot/log.js +78 -0
  13. package/hot/only-dev-server.js +118 -0
  14. package/hot/poll.js +41 -0
  15. package/hot/signal.js +66 -0
  16. package/lib/APIPlugin.js +392 -0
  17. package/lib/AbstractMethodError.js +56 -0
  18. package/lib/AsyncDependenciesBlock.js +128 -0
  19. package/lib/AsyncDependencyToInitialChunkError.js +34 -0
  20. package/lib/AutomaticPrefetchPlugin.js +66 -0
  21. package/lib/BannerPlugin.js +138 -0
  22. package/lib/Cache.js +168 -0
  23. package/lib/CacheFacade.js +349 -0
  24. package/lib/CaseSensitiveModulesWarning.js +72 -0
  25. package/lib/Chunk.js +899 -0
  26. package/lib/ChunkGraph.js +1968 -0
  27. package/lib/ChunkGroup.js +615 -0
  28. package/lib/ChunkRenderError.js +38 -0
  29. package/lib/ChunkTemplate.js +181 -0
  30. package/lib/CleanPlugin.js +495 -0
  31. package/lib/CodeGenerationError.js +35 -0
  32. package/lib/CodeGenerationResults.js +167 -0
  33. package/lib/CommentCompilationWarning.js +33 -0
  34. package/lib/CompatibilityPlugin.js +240 -0
  35. package/lib/Compilation.js +5876 -0
  36. package/lib/Compiler.js +1413 -0
  37. package/lib/ConcatenationScope.js +181 -0
  38. package/lib/ConcurrentCompilationError.js +18 -0
  39. package/lib/ConditionalInitFragment.js +120 -0
  40. package/lib/ConstPlugin.js +567 -0
  41. package/lib/ContextExclusionPlugin.js +33 -0
  42. package/lib/ContextModule.js +1411 -0
  43. package/lib/ContextModuleFactory.js +514 -0
  44. package/lib/ContextReplacementPlugin.js +227 -0
  45. package/lib/CssModule.js +179 -0
  46. package/lib/DefinePlugin.js +878 -0
  47. package/lib/DelegatedModule.js +279 -0
  48. package/lib/DelegatedModuleFactoryPlugin.js +116 -0
  49. package/lib/DelegatedPlugin.js +49 -0
  50. package/lib/DependenciesBlock.js +120 -0
  51. package/lib/Dependency.js +390 -0
  52. package/lib/DependencyTemplate.js +71 -0
  53. package/lib/DependencyTemplates.js +67 -0
  54. package/lib/DllEntryPlugin.js +76 -0
  55. package/lib/DllModule.js +175 -0
  56. package/lib/DllModuleFactory.js +38 -0
  57. package/lib/DllPlugin.js +73 -0
  58. package/lib/DllReferencePlugin.js +189 -0
  59. package/lib/DotenvPlugin.js +468 -0
  60. package/lib/DynamicEntryPlugin.js +93 -0
  61. package/lib/EntryOptionPlugin.js +98 -0
  62. package/lib/EntryPlugin.js +72 -0
  63. package/lib/Entrypoint.js +120 -0
  64. package/lib/EnvironmentNotSupportAsyncWarning.js +51 -0
  65. package/lib/EnvironmentPlugin.js +74 -0
  66. package/lib/ErrorHelpers.js +100 -0
  67. package/lib/EvalDevToolModulePlugin.js +135 -0
  68. package/lib/EvalSourceMapDevToolPlugin.js +252 -0
  69. package/lib/ExportsInfo.js +1663 -0
  70. package/lib/ExportsInfoApiPlugin.js +87 -0
  71. package/lib/ExternalModule.js +1169 -0
  72. package/lib/ExternalModuleFactoryPlugin.js +370 -0
  73. package/lib/ExternalsPlugin.js +93 -0
  74. package/lib/FalseIIFEUmdWarning.js +20 -0
  75. package/lib/FileSystemInfo.js +4131 -0
  76. package/lib/FlagAllModulesAsUsedPlugin.js +55 -0
  77. package/lib/FlagDependencyExportsPlugin.js +437 -0
  78. package/lib/FlagDependencyUsagePlugin.js +348 -0
  79. package/lib/FlagEntryExportAsUsedPlugin.js +56 -0
  80. package/lib/Generator.js +188 -0
  81. package/lib/GraphHelpers.js +46 -0
  82. package/lib/HarmonyLinkingError.js +17 -0
  83. package/lib/HookWebpackError.js +121 -0
  84. package/lib/HotModuleReplacementPlugin.js +930 -0
  85. package/lib/HotUpdateChunk.js +16 -0
  86. package/lib/IgnoreErrorModuleFactory.js +39 -0
  87. package/lib/IgnorePlugin.js +105 -0
  88. package/lib/IgnoreWarningsPlugin.js +41 -0
  89. package/lib/InitFragment.js +204 -0
  90. package/lib/InvalidDependenciesModuleWarning.js +44 -0
  91. package/lib/JavascriptMetaInfoPlugin.js +78 -0
  92. package/lib/LibManifestPlugin.js +144 -0
  93. package/lib/LibraryTemplatePlugin.js +48 -0
  94. package/lib/LoaderOptionsPlugin.js +81 -0
  95. package/lib/LoaderTargetPlugin.js +39 -0
  96. package/lib/MainTemplate.js +371 -0
  97. package/lib/ManifestPlugin.js +242 -0
  98. package/lib/Module.js +1319 -0
  99. package/lib/ModuleBuildError.js +83 -0
  100. package/lib/ModuleDependencyError.js +44 -0
  101. package/lib/ModuleDependencyWarning.js +49 -0
  102. package/lib/ModuleError.js +69 -0
  103. package/lib/ModuleFactory.js +57 -0
  104. package/lib/ModuleFilenameHelpers.js +388 -0
  105. package/lib/ModuleGraph.js +1024 -0
  106. package/lib/ModuleGraphConnection.js +199 -0
  107. package/lib/ModuleHashingError.js +31 -0
  108. package/lib/ModuleInfoHeaderPlugin.js +318 -0
  109. package/lib/ModuleNotFoundError.js +90 -0
  110. package/lib/ModuleParseError.js +125 -0
  111. package/lib/ModuleProfile.js +108 -0
  112. package/lib/ModuleRestoreError.js +46 -0
  113. package/lib/ModuleSourceTypeConstants.js +179 -0
  114. package/lib/ModuleStoreError.js +45 -0
  115. package/lib/ModuleTemplate.js +173 -0
  116. package/lib/ModuleTypeConstants.js +190 -0
  117. package/lib/ModuleWarning.js +68 -0
  118. package/lib/MultiCompiler.js +678 -0
  119. package/lib/MultiStats.js +213 -0
  120. package/lib/MultiWatching.js +77 -0
  121. package/lib/NoEmitOnErrorsPlugin.js +30 -0
  122. package/lib/NoModeWarning.js +23 -0
  123. package/lib/NodeStuffInWebError.js +35 -0
  124. package/lib/NodeStuffPlugin.js +587 -0
  125. package/lib/NormalModule.js +1798 -0
  126. package/lib/NormalModuleFactory.js +1455 -0
  127. package/lib/NormalModuleReplacementPlugin.js +75 -0
  128. package/lib/NullFactory.js +24 -0
  129. package/lib/OptimizationStages.js +10 -0
  130. package/lib/OptionsApply.js +24 -0
  131. package/lib/Parser.js +40 -0
  132. package/lib/PlatformPlugin.js +41 -0
  133. package/lib/PrefetchPlugin.js +56 -0
  134. package/lib/ProgressPlugin.js +712 -0
  135. package/lib/ProvidePlugin.js +121 -0
  136. package/lib/RawModule.js +180 -0
  137. package/lib/RecordIdsPlugin.js +216 -0
  138. package/lib/RequestShortener.js +36 -0
  139. package/lib/RequireJsStuffPlugin.js +84 -0
  140. package/lib/ResolverFactory.js +156 -0
  141. package/lib/RuntimeGlobals.js +450 -0
  142. package/lib/RuntimeModule.js +242 -0
  143. package/lib/RuntimePlugin.js +547 -0
  144. package/lib/RuntimeTemplate.js +1288 -0
  145. package/lib/SelfModuleFactory.js +33 -0
  146. package/lib/SingleEntryPlugin.js +8 -0
  147. package/lib/SizeFormatHelpers.js +25 -0
  148. package/lib/SourceMapDevToolModuleOptionsPlugin.js +52 -0
  149. package/lib/SourceMapDevToolPlugin.js +646 -0
  150. package/lib/Stats.js +89 -0
  151. package/lib/Template.js +427 -0
  152. package/lib/TemplatedPathPlugin.js +400 -0
  153. package/lib/UnhandledSchemeError.js +34 -0
  154. package/lib/UnsupportedFeatureWarning.js +35 -0
  155. package/lib/UseStrictPlugin.js +81 -0
  156. package/lib/WarnCaseSensitiveModulesPlugin.js +64 -0
  157. package/lib/WarnDeprecatedOptionPlugin.js +60 -0
  158. package/lib/WarnNoModeSetPlugin.js +27 -0
  159. package/lib/WatchIgnorePlugin.js +155 -0
  160. package/lib/Watching.js +531 -0
  161. package/lib/WebpackError.js +81 -0
  162. package/lib/WebpackIsIncludedPlugin.js +93 -0
  163. package/lib/WebpackOptionsApply.js +941 -0
  164. package/lib/WebpackOptionsDefaulter.js +26 -0
  165. package/lib/asset/AssetBytesGenerator.js +172 -0
  166. package/lib/asset/AssetBytesParser.js +37 -0
  167. package/lib/asset/AssetGenerator.js +816 -0
  168. package/lib/asset/AssetModulesPlugin.js +358 -0
  169. package/lib/asset/AssetParser.js +73 -0
  170. package/lib/asset/AssetSourceGenerator.js +171 -0
  171. package/lib/asset/AssetSourceParser.js +37 -0
  172. package/lib/asset/RawDataUrlModule.js +179 -0
  173. package/lib/async-modules/AsyncModuleHelpers.js +52 -0
  174. package/lib/async-modules/AwaitDependenciesInitFragment.js +90 -0
  175. package/lib/async-modules/InferAsyncModulesPlugin.js +54 -0
  176. package/lib/buildChunkGraph.js +1392 -0
  177. package/lib/cache/AddBuildDependenciesPlugin.js +32 -0
  178. package/lib/cache/AddManagedPathsPlugin.js +40 -0
  179. package/lib/cache/IdleFileCachePlugin.js +242 -0
  180. package/lib/cache/MemoryCachePlugin.js +57 -0
  181. package/lib/cache/MemoryWithGcCachePlugin.js +142 -0
  182. package/lib/cache/PackFileCacheStrategy.js +1600 -0
  183. package/lib/cache/ResolverCachePlugin.js +450 -0
  184. package/lib/cache/getLazyHashedEtag.js +91 -0
  185. package/lib/cache/mergeEtags.js +71 -0
  186. package/lib/cli.js +859 -0
  187. package/lib/config/browserslistTargetHandler.js +388 -0
  188. package/lib/config/defaults.js +2086 -0
  189. package/lib/config/normalization.js +681 -0
  190. package/lib/config/target.js +389 -0
  191. package/lib/container/ContainerEntryDependency.js +50 -0
  192. package/lib/container/ContainerEntryModule.js +303 -0
  193. package/lib/container/ContainerEntryModuleFactory.js +27 -0
  194. package/lib/container/ContainerExposedDependency.js +62 -0
  195. package/lib/container/ContainerPlugin.js +118 -0
  196. package/lib/container/ContainerReferencePlugin.js +139 -0
  197. package/lib/container/FallbackDependency.js +66 -0
  198. package/lib/container/FallbackItemDependency.js +34 -0
  199. package/lib/container/FallbackModule.js +193 -0
  200. package/lib/container/FallbackModuleFactory.js +27 -0
  201. package/lib/container/HoistContainerReferencesPlugin.js +256 -0
  202. package/lib/container/ModuleFederationPlugin.js +131 -0
  203. package/lib/container/RemoteModule.js +225 -0
  204. package/lib/container/RemoteRuntimeModule.js +144 -0
  205. package/lib/container/RemoteToExternalDependency.js +33 -0
  206. package/lib/container/options.js +105 -0
  207. package/lib/css/CssGenerator.js +587 -0
  208. package/lib/css/CssLoadingRuntimeModule.js +513 -0
  209. package/lib/css/CssMergeStyleSheetsRuntimeModule.js +56 -0
  210. package/lib/css/CssModulesPlugin.js +939 -0
  211. package/lib/css/CssParser.js +2621 -0
  212. package/lib/css/walkCssTokens.js +1740 -0
  213. package/lib/debug/ProfilingPlugin.js +589 -0
  214. package/lib/dependencies/AMDDefineDependency.js +267 -0
  215. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +504 -0
  216. package/lib/dependencies/AMDPlugin.js +243 -0
  217. package/lib/dependencies/AMDRequireArrayDependency.js +124 -0
  218. package/lib/dependencies/AMDRequireContextDependency.js +69 -0
  219. package/lib/dependencies/AMDRequireDependenciesBlock.js +28 -0
  220. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +425 -0
  221. package/lib/dependencies/AMDRequireDependency.js +189 -0
  222. package/lib/dependencies/AMDRequireItemDependency.js +41 -0
  223. package/lib/dependencies/AMDRuntimeModules.js +50 -0
  224. package/lib/dependencies/CachedConstDependency.js +135 -0
  225. package/lib/dependencies/CommonJsDependencyHelpers.js +65 -0
  226. package/lib/dependencies/CommonJsExportRequireDependency.js +416 -0
  227. package/lib/dependencies/CommonJsExportsDependency.js +184 -0
  228. package/lib/dependencies/CommonJsExportsParserPlugin.js +425 -0
  229. package/lib/dependencies/CommonJsFullRequireDependency.js +162 -0
  230. package/lib/dependencies/CommonJsImportsParserPlugin.js +611 -0
  231. package/lib/dependencies/CommonJsPlugin.js +316 -0
  232. package/lib/dependencies/CommonJsRequireContextDependency.js +73 -0
  233. package/lib/dependencies/CommonJsRequireDependency.js +42 -0
  234. package/lib/dependencies/CommonJsSelfReferenceDependency.js +156 -0
  235. package/lib/dependencies/ConstDependency.js +118 -0
  236. package/lib/dependencies/ContextDependency.js +183 -0
  237. package/lib/dependencies/ContextDependencyHelpers.js +277 -0
  238. package/lib/dependencies/ContextDependencyTemplateAsId.js +63 -0
  239. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +62 -0
  240. package/lib/dependencies/ContextElementDependency.js +147 -0
  241. package/lib/dependencies/CreateRequireParserPlugin.js +356 -0
  242. package/lib/dependencies/CreateScriptUrlDependency.js +75 -0
  243. package/lib/dependencies/CriticalDependencyWarning.js +29 -0
  244. package/lib/dependencies/CssIcssExportDependency.js +539 -0
  245. package/lib/dependencies/CssIcssImportDependency.js +183 -0
  246. package/lib/dependencies/CssIcssSymbolDependency.js +131 -0
  247. package/lib/dependencies/CssImportDependency.js +120 -0
  248. package/lib/dependencies/CssUrlDependency.js +189 -0
  249. package/lib/dependencies/DelegatedSourceDependency.js +33 -0
  250. package/lib/dependencies/DllEntryDependency.js +61 -0
  251. package/lib/dependencies/DynamicExports.js +73 -0
  252. package/lib/dependencies/EntryDependency.js +30 -0
  253. package/lib/dependencies/ExportsInfoDependency.js +161 -0
  254. package/lib/dependencies/ExternalModuleDependency.js +109 -0
  255. package/lib/dependencies/ExternalModuleInitFragment.js +137 -0
  256. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +87 -0
  257. package/lib/dependencies/HarmonyAcceptDependency.js +237 -0
  258. package/lib/dependencies/HarmonyAcceptImportDependency.js +37 -0
  259. package/lib/dependencies/HarmonyCompatibilityDependency.js +91 -0
  260. package/lib/dependencies/HarmonyDetectionParserPlugin.js +103 -0
  261. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +165 -0
  262. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +254 -0
  263. package/lib/dependencies/HarmonyExportExpressionDependency.js +211 -0
  264. package/lib/dependencies/HarmonyExportHeaderDependency.js +78 -0
  265. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +1494 -0
  266. package/lib/dependencies/HarmonyExportInitFragment.js +191 -0
  267. package/lib/dependencies/HarmonyExportSpecifierDependency.js +127 -0
  268. package/lib/dependencies/HarmonyExports.js +46 -0
  269. package/lib/dependencies/HarmonyImportDependency.js +459 -0
  270. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +576 -0
  271. package/lib/dependencies/HarmonyImportSideEffectDependency.js +91 -0
  272. package/lib/dependencies/HarmonyImportSpecifierDependency.js +514 -0
  273. package/lib/dependencies/HarmonyModulesPlugin.js +158 -0
  274. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +39 -0
  275. package/lib/dependencies/ImportContextDependency.js +81 -0
  276. package/lib/dependencies/ImportDependency.js +158 -0
  277. package/lib/dependencies/ImportEagerDependency.js +76 -0
  278. package/lib/dependencies/ImportMetaContextDependency.js +42 -0
  279. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +312 -0
  280. package/lib/dependencies/ImportMetaContextPlugin.js +72 -0
  281. package/lib/dependencies/ImportMetaHotAcceptDependency.js +41 -0
  282. package/lib/dependencies/ImportMetaHotDeclineDependency.js +42 -0
  283. package/lib/dependencies/ImportMetaPlugin.js +447 -0
  284. package/lib/dependencies/ImportParserPlugin.js +602 -0
  285. package/lib/dependencies/ImportPhase.js +125 -0
  286. package/lib/dependencies/ImportPlugin.js +98 -0
  287. package/lib/dependencies/ImportWeakDependency.js +74 -0
  288. package/lib/dependencies/JsonExportsDependency.js +137 -0
  289. package/lib/dependencies/LoaderDependency.js +38 -0
  290. package/lib/dependencies/LoaderImportDependency.js +39 -0
  291. package/lib/dependencies/LoaderPlugin.js +294 -0
  292. package/lib/dependencies/LocalModule.js +60 -0
  293. package/lib/dependencies/LocalModuleDependency.js +84 -0
  294. package/lib/dependencies/LocalModulesHelpers.js +68 -0
  295. package/lib/dependencies/ModuleDecoratorDependency.js +136 -0
  296. package/lib/dependencies/ModuleDependency.js +100 -0
  297. package/lib/dependencies/ModuleDependencyTemplateAsId.js +35 -0
  298. package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +39 -0
  299. package/lib/dependencies/ModuleHotAcceptDependency.js +41 -0
  300. package/lib/dependencies/ModuleHotDeclineDependency.js +42 -0
  301. package/lib/dependencies/ModuleInitFragmentDependency.js +87 -0
  302. package/lib/dependencies/NullDependency.js +42 -0
  303. package/lib/dependencies/PrefetchDependency.js +27 -0
  304. package/lib/dependencies/ProvidedDependency.js +156 -0
  305. package/lib/dependencies/PureExpressionDependency.js +161 -0
  306. package/lib/dependencies/RequireContextDependency.js +38 -0
  307. package/lib/dependencies/RequireContextDependencyParserPlugin.js +69 -0
  308. package/lib/dependencies/RequireContextPlugin.js +167 -0
  309. package/lib/dependencies/RequireEnsureDependenciesBlock.js +29 -0
  310. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +145 -0
  311. package/lib/dependencies/RequireEnsureDependency.js +115 -0
  312. package/lib/dependencies/RequireEnsureItemDependency.js +36 -0
  313. package/lib/dependencies/RequireEnsurePlugin.js +86 -0
  314. package/lib/dependencies/RequireHeaderDependency.js +70 -0
  315. package/lib/dependencies/RequireIncludeDependency.js +79 -0
  316. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +100 -0
  317. package/lib/dependencies/RequireIncludePlugin.js +63 -0
  318. package/lib/dependencies/RequireResolveContextDependency.js +67 -0
  319. package/lib/dependencies/RequireResolveDependency.js +58 -0
  320. package/lib/dependencies/RequireResolveHeaderDependency.js +81 -0
  321. package/lib/dependencies/RuntimeRequirementsDependency.js +85 -0
  322. package/lib/dependencies/StaticExportsDependency.js +72 -0
  323. package/lib/dependencies/SystemPlugin.js +168 -0
  324. package/lib/dependencies/SystemRuntimeModule.js +35 -0
  325. package/lib/dependencies/URLContextDependency.js +65 -0
  326. package/lib/dependencies/URLDependency.js +165 -0
  327. package/lib/dependencies/URLPlugin.js +67 -0
  328. package/lib/dependencies/UnsupportedDependency.js +82 -0
  329. package/lib/dependencies/WebAssemblyExportImportedDependency.js +93 -0
  330. package/lib/dependencies/WebAssemblyImportDependency.js +108 -0
  331. package/lib/dependencies/WebpackIsIncludedDependency.js +84 -0
  332. package/lib/dependencies/WorkerDependency.js +141 -0
  333. package/lib/dependencies/WorkerPlugin.js +565 -0
  334. package/lib/dependencies/getFunctionExpression.js +66 -0
  335. package/lib/dependencies/processExportInfo.js +67 -0
  336. package/lib/electron/ElectronTargetPlugin.js +71 -0
  337. package/lib/errors/BuildCycleError.js +30 -0
  338. package/lib/esm/ExportWebpackRequireRuntimeModule.js +30 -0
  339. package/lib/esm/ModuleChunkFormatPlugin.js +273 -0
  340. package/lib/esm/ModuleChunkLoadingPlugin.js +143 -0
  341. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +426 -0
  342. package/lib/formatLocation.js +67 -0
  343. package/lib/hmr/HotModuleReplacement.runtime.js +419 -0
  344. package/lib/hmr/HotModuleReplacementRuntimeModule.js +42 -0
  345. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +471 -0
  346. package/lib/hmr/JavascriptHotModuleReplacementHelper.js +37 -0
  347. package/lib/hmr/LazyCompilationPlugin.js +473 -0
  348. package/lib/hmr/lazyCompilationBackend.js +167 -0
  349. package/lib/ids/ChunkModuleIdRangePlugin.js +94 -0
  350. package/lib/ids/DeterministicChunkIdsPlugin.js +73 -0
  351. package/lib/ids/DeterministicModuleIdsPlugin.js +98 -0
  352. package/lib/ids/HashedModuleIdsPlugin.js +85 -0
  353. package/lib/ids/IdHelpers.js +492 -0
  354. package/lib/ids/NamedChunkIdsPlugin.js +92 -0
  355. package/lib/ids/NamedModuleIdsPlugin.js +68 -0
  356. package/lib/ids/NaturalChunkIdsPlugin.js +35 -0
  357. package/lib/ids/NaturalModuleIdsPlugin.js +40 -0
  358. package/lib/ids/OccurrenceChunkIdsPlugin.js +86 -0
  359. package/lib/ids/OccurrenceModuleIdsPlugin.js +168 -0
  360. package/lib/ids/SyncModuleIdsPlugin.js +161 -0
  361. package/lib/index.js +681 -0
  362. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +153 -0
  363. package/lib/javascript/BasicEvaluatedExpression.js +603 -0
  364. package/lib/javascript/ChunkFormatHelpers.js +70 -0
  365. package/lib/javascript/ChunkHelpers.js +45 -0
  366. package/lib/javascript/CommonJsChunkFormatPlugin.js +148 -0
  367. package/lib/javascript/EnableChunkLoadingPlugin.js +127 -0
  368. package/lib/javascript/JavascriptGenerator.js +277 -0
  369. package/lib/javascript/JavascriptModulesPlugin.js +1905 -0
  370. package/lib/javascript/JavascriptParser.js +5476 -0
  371. package/lib/javascript/JavascriptParserHelpers.js +129 -0
  372. package/lib/javascript/StartupHelpers.js +178 -0
  373. package/lib/json/JsonData.js +74 -0
  374. package/lib/json/JsonGenerator.js +234 -0
  375. package/lib/json/JsonModulesPlugin.js +66 -0
  376. package/lib/json/JsonParser.js +93 -0
  377. package/lib/library/AbstractLibraryPlugin.js +339 -0
  378. package/lib/library/AmdLibraryPlugin.js +181 -0
  379. package/lib/library/AssignLibraryPlugin.js +445 -0
  380. package/lib/library/EnableLibraryPlugin.js +306 -0
  381. package/lib/library/ExportPropertyLibraryPlugin.js +116 -0
  382. package/lib/library/JsonpLibraryPlugin.js +92 -0
  383. package/lib/library/ModuleLibraryPlugin.js +438 -0
  384. package/lib/library/SystemLibraryPlugin.js +256 -0
  385. package/lib/library/UmdLibraryPlugin.js +355 -0
  386. package/lib/logging/Logger.js +223 -0
  387. package/lib/logging/createConsoleLogger.js +217 -0
  388. package/lib/logging/runtime.js +45 -0
  389. package/lib/logging/truncateArgs.js +83 -0
  390. package/lib/node/CommonJsChunkLoadingPlugin.js +120 -0
  391. package/lib/node/NodeEnvironmentPlugin.js +73 -0
  392. package/lib/node/NodeSourcePlugin.js +19 -0
  393. package/lib/node/NodeTargetPlugin.js +102 -0
  394. package/lib/node/NodeTemplatePlugin.js +42 -0
  395. package/lib/node/NodeWatchFileSystem.js +198 -0
  396. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +286 -0
  397. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +123 -0
  398. package/lib/node/ReadFileCompileWasmPlugin.js +127 -0
  399. package/lib/node/RequireChunkLoadingRuntimeModule.js +239 -0
  400. package/lib/node/nodeConsole.js +185 -0
  401. package/lib/optimize/AggressiveMergingPlugin.js +98 -0
  402. package/lib/optimize/AggressiveSplittingPlugin.js +352 -0
  403. package/lib/optimize/ConcatenatedModule.js +2290 -0
  404. package/lib/optimize/EnsureChunkConditionsPlugin.js +88 -0
  405. package/lib/optimize/FlagIncludedChunksPlugin.js +137 -0
  406. package/lib/optimize/InnerGraph.js +368 -0
  407. package/lib/optimize/InnerGraphPlugin.js +455 -0
  408. package/lib/optimize/LimitChunkCountPlugin.js +302 -0
  409. package/lib/optimize/MangleExportsPlugin.js +194 -0
  410. package/lib/optimize/MergeDuplicateChunksPlugin.js +138 -0
  411. package/lib/optimize/MinChunkSizePlugin.js +121 -0
  412. package/lib/optimize/MinMaxSizeWarning.js +35 -0
  413. package/lib/optimize/ModuleConcatenationPlugin.js +971 -0
  414. package/lib/optimize/RealContentHashPlugin.js +488 -0
  415. package/lib/optimize/RemoveEmptyChunksPlugin.js +60 -0
  416. package/lib/optimize/RemoveParentModulesPlugin.js +216 -0
  417. package/lib/optimize/RuntimeChunkPlugin.js +52 -0
  418. package/lib/optimize/SideEffectsFlagPlugin.js +417 -0
  419. package/lib/optimize/SplitChunksPlugin.js +1836 -0
  420. package/lib/performance/AssetsOverSizeLimitWarning.js +37 -0
  421. package/lib/performance/EntrypointsOverSizeLimitWarning.js +40 -0
  422. package/lib/performance/NoAsyncChunksWarning.js +21 -0
  423. package/lib/performance/SizeLimitsPlugin.js +183 -0
  424. package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +46 -0
  425. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +95 -0
  426. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +56 -0
  427. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +52 -0
  428. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +46 -0
  429. package/lib/rules/BasicEffectRulePlugin.js +56 -0
  430. package/lib/rules/BasicMatcherRulePlugin.js +68 -0
  431. package/lib/rules/ObjectMatcherRulePlugin.js +79 -0
  432. package/lib/rules/RuleSetCompiler.js +447 -0
  433. package/lib/rules/UseEffectRulePlugin.js +236 -0
  434. package/lib/runtime/AsyncModuleRuntimeModule.js +199 -0
  435. package/lib/runtime/AutoPublicPathRuntimeModule.js +90 -0
  436. package/lib/runtime/BaseUriRuntimeModule.js +35 -0
  437. package/lib/runtime/ChunkNameRuntimeModule.js +28 -0
  438. package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +40 -0
  439. package/lib/runtime/CompatRuntimeModule.js +83 -0
  440. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +69 -0
  441. package/lib/runtime/CreateScriptRuntimeModule.js +38 -0
  442. package/lib/runtime/CreateScriptUrlRuntimeModule.js +38 -0
  443. package/lib/runtime/DefinePropertyGettersRuntimeModule.js +42 -0
  444. package/lib/runtime/EnsureChunkRuntimeModule.js +69 -0
  445. package/lib/runtime/GetChunkFilenameRuntimeModule.js +299 -0
  446. package/lib/runtime/GetFullHashRuntimeModule.js +31 -0
  447. package/lib/runtime/GetMainFilenameRuntimeModule.js +49 -0
  448. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +99 -0
  449. package/lib/runtime/GlobalRuntimeModule.js +47 -0
  450. package/lib/runtime/HasOwnPropertyRuntimeModule.js +35 -0
  451. package/lib/runtime/HelperRuntimeModule.js +18 -0
  452. package/lib/runtime/LoadScriptRuntimeModule.js +174 -0
  453. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +232 -0
  454. package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +39 -0
  455. package/lib/runtime/NonceRuntimeModule.js +24 -0
  456. package/lib/runtime/OnChunksLoadedRuntimeModule.js +78 -0
  457. package/lib/runtime/PublicPathRuntimeModule.js +38 -0
  458. package/lib/runtime/RelativeUrlRuntimeModule.js +44 -0
  459. package/lib/runtime/RuntimeIdRuntimeModule.js +33 -0
  460. package/lib/runtime/StartupChunkDependenciesPlugin.js +88 -0
  461. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +77 -0
  462. package/lib/runtime/StartupEntrypointRuntimeModule.js +54 -0
  463. package/lib/runtime/SystemContextRuntimeModule.js +23 -0
  464. package/lib/runtime/ToBinaryRuntimeModule.js +72 -0
  465. package/lib/schemes/DataUriPlugin.js +47 -0
  466. package/lib/schemes/FileUriPlugin.js +54 -0
  467. package/lib/schemes/HttpUriPlugin.js +1410 -0
  468. package/lib/schemes/VirtualUrlPlugin.js +248 -0
  469. package/lib/serialization/AggregateErrorSerializer.js +41 -0
  470. package/lib/serialization/ArraySerializer.js +38 -0
  471. package/lib/serialization/BinaryMiddleware.js +1164 -0
  472. package/lib/serialization/DateObjectSerializer.js +28 -0
  473. package/lib/serialization/ErrorObjectSerializer.js +49 -0
  474. package/lib/serialization/FileMiddleware.js +766 -0
  475. package/lib/serialization/MapObjectSerializer.js +48 -0
  476. package/lib/serialization/NullPrototypeObjectSerializer.js +53 -0
  477. package/lib/serialization/ObjectMiddleware.js +877 -0
  478. package/lib/serialization/PlainObjectSerializer.js +119 -0
  479. package/lib/serialization/RegExpObjectSerializer.js +29 -0
  480. package/lib/serialization/Serializer.js +82 -0
  481. package/lib/serialization/SerializerMiddleware.js +226 -0
  482. package/lib/serialization/SetObjectSerializer.js +40 -0
  483. package/lib/serialization/SingleItemMiddleware.js +36 -0
  484. package/lib/serialization/types.js +13 -0
  485. package/lib/sharing/ConsumeSharedFallbackDependency.js +33 -0
  486. package/lib/sharing/ConsumeSharedModule.js +344 -0
  487. package/lib/sharing/ConsumeSharedPlugin.js +380 -0
  488. package/lib/sharing/ConsumeSharedRuntimeModule.js +358 -0
  489. package/lib/sharing/ProvideForSharedDependency.js +33 -0
  490. package/lib/sharing/ProvideSharedDependency.js +80 -0
  491. package/lib/sharing/ProvideSharedModule.js +196 -0
  492. package/lib/sharing/ProvideSharedModuleFactory.js +37 -0
  493. package/lib/sharing/ProvideSharedPlugin.js +248 -0
  494. package/lib/sharing/SharePlugin.js +91 -0
  495. package/lib/sharing/ShareRuntimeModule.js +152 -0
  496. package/lib/sharing/resolveMatchedConfigs.js +106 -0
  497. package/lib/sharing/utils.js +421 -0
  498. package/lib/stats/DefaultStatsFactoryPlugin.js +2791 -0
  499. package/lib/stats/DefaultStatsPresetPlugin.js +417 -0
  500. package/lib/stats/DefaultStatsPrinterPlugin.js +1860 -0
  501. package/lib/stats/StatsFactory.js +406 -0
  502. package/lib/stats/StatsPrinter.js +300 -0
  503. package/lib/url/URLParserPlugin.js +266 -0
  504. package/lib/util/AppendOnlyStackedSet.js +78 -0
  505. package/lib/util/ArrayHelpers.js +46 -0
  506. package/lib/util/ArrayQueue.js +104 -0
  507. package/lib/util/AsyncQueue.js +411 -0
  508. package/lib/util/Hash.js +68 -0
  509. package/lib/util/IterableHelpers.js +46 -0
  510. package/lib/util/LazyBucketSortedSet.js +272 -0
  511. package/lib/util/LazySet.js +236 -0
  512. package/lib/util/MapHelpers.js +34 -0
  513. package/lib/util/ParallelismFactorCalculator.js +70 -0
  514. package/lib/util/Queue.js +52 -0
  515. package/lib/util/Semaphore.js +51 -0
  516. package/lib/util/SetHelpers.js +94 -0
  517. package/lib/util/SortableSet.js +176 -0
  518. package/lib/util/StackedCacheMap.js +140 -0
  519. package/lib/util/StackedMap.js +164 -0
  520. package/lib/util/StringXor.js +103 -0
  521. package/lib/util/TupleQueue.js +70 -0
  522. package/lib/util/TupleSet.js +185 -0
  523. package/lib/util/URLAbsoluteSpecifier.js +86 -0
  524. package/lib/util/WeakTupleMap.js +227 -0
  525. package/lib/util/binarySearchBounds.js +136 -0
  526. package/lib/util/chainedImports.js +99 -0
  527. package/lib/util/cleverMerge.js +676 -0
  528. package/lib/util/comparators.js +645 -0
  529. package/lib/util/compileBooleanMatcher.js +313 -0
  530. package/lib/util/concatenate.js +232 -0
  531. package/lib/util/conventions.js +126 -0
  532. package/lib/util/create-schema-validation.js +41 -0
  533. package/lib/util/createHash.js +91 -0
  534. package/lib/util/dataURL.js +39 -0
  535. package/lib/util/deprecation.js +350 -0
  536. package/lib/util/deterministicGrouping.js +561 -0
  537. package/lib/util/extractSourceMap.js +318 -0
  538. package/lib/util/extractUrlAndGlobal.js +18 -0
  539. package/lib/util/findGraphRoots.js +211 -0
  540. package/lib/util/fs.js +675 -0
  541. package/lib/util/generateDebugId.js +33 -0
  542. package/lib/util/hash/BatchedHash.js +115 -0
  543. package/lib/util/hash/BulkUpdateHash.js +145 -0
  544. package/lib/util/hash/DebugHash.js +75 -0
  545. package/lib/util/hash/hash-digest.js +217 -0
  546. package/lib/util/hash/md4.js +20 -0
  547. package/lib/util/hash/wasm-hash.js +232 -0
  548. package/lib/util/hash/xxhash64.js +20 -0
  549. package/lib/util/identifier.js +471 -0
  550. package/lib/util/internalSerializables.js +222 -0
  551. package/lib/util/magicComment.js +25 -0
  552. package/lib/util/makeSerializable.js +60 -0
  553. package/lib/util/memoize.js +36 -0
  554. package/lib/util/nonNumericOnlyHash.js +22 -0
  555. package/lib/util/numberHash.js +95 -0
  556. package/lib/util/objectToMap.js +15 -0
  557. package/lib/util/processAsyncTree.js +68 -0
  558. package/lib/util/propertyAccess.js +30 -0
  559. package/lib/util/propertyName.js +76 -0
  560. package/lib/util/registerExternalSerializer.js +334 -0
  561. package/lib/util/removeBOM.js +25 -0
  562. package/lib/util/runtime.js +717 -0
  563. package/lib/util/semver.js +604 -0
  564. package/lib/util/serialization.js +153 -0
  565. package/lib/util/smartGrouping.js +221 -0
  566. package/lib/util/source.js +62 -0
  567. package/lib/util/traverseDestructuringAssignmentProperties.js +45 -0
  568. package/lib/validateSchema.js +177 -0
  569. package/lib/wasm/EnableWasmLoadingPlugin.js +146 -0
  570. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +154 -0
  571. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +74 -0
  572. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +212 -0
  573. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +209 -0
  574. package/lib/wasm-async/AsyncWebAssemblyParser.js +80 -0
  575. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +107 -0
  576. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +20 -0
  577. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +422 -0
  578. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +91 -0
  579. package/lib/wasm-sync/WebAssemblyGenerator.js +535 -0
  580. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +111 -0
  581. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +236 -0
  582. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +151 -0
  583. package/lib/wasm-sync/WebAssemblyParser.js +201 -0
  584. package/lib/wasm-sync/WebAssemblyUtils.js +66 -0
  585. package/lib/web/FetchCompileAsyncWasmPlugin.js +70 -0
  586. package/lib/web/FetchCompileWasmPlugin.js +86 -0
  587. package/lib/web/JsonpChunkLoadingPlugin.js +101 -0
  588. package/lib/web/JsonpChunkLoadingRuntimeModule.js +455 -0
  589. package/lib/web/JsonpTemplatePlugin.js +37 -0
  590. package/lib/webpack.js +227 -0
  591. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +110 -0
  592. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +231 -0
  593. package/lib/webworker/WebWorkerTemplatePlugin.js +26 -0
  594. package/module.d.ts +238 -0
  595. package/package.json +258 -0
  596. package/schemas/WebpackOptions.check.d.ts +7 -0
  597. package/schemas/WebpackOptions.check.js +6 -0
  598. package/schemas/WebpackOptions.json +6179 -0
  599. package/schemas/_container.json +155 -0
  600. package/schemas/_sharing.json +118 -0
  601. package/schemas/plugins/BannerPlugin.check.d.ts +7 -0
  602. package/schemas/plugins/BannerPlugin.check.js +6 -0
  603. package/schemas/plugins/BannerPlugin.json +115 -0
  604. package/schemas/plugins/DllPlugin.check.d.ts +7 -0
  605. package/schemas/plugins/DllPlugin.check.js +6 -0
  606. package/schemas/plugins/DllPlugin.json +36 -0
  607. package/schemas/plugins/DllReferencePlugin.check.d.ts +7 -0
  608. package/schemas/plugins/DllReferencePlugin.check.js +6 -0
  609. package/schemas/plugins/DllReferencePlugin.json +206 -0
  610. package/schemas/plugins/IgnorePlugin.check.d.ts +7 -0
  611. package/schemas/plugins/IgnorePlugin.check.js +6 -0
  612. package/schemas/plugins/IgnorePlugin.json +34 -0
  613. package/schemas/plugins/LoaderOptionsPlugin.check.d.ts +7 -0
  614. package/schemas/plugins/LoaderOptionsPlugin.check.js +6 -0
  615. package/schemas/plugins/LoaderOptionsPlugin.json +27 -0
  616. package/schemas/plugins/ManifestPlugin.check.d.ts +7 -0
  617. package/schemas/plugins/ManifestPlugin.check.js +6 -0
  618. package/schemas/plugins/ManifestPlugin.json +98 -0
  619. package/schemas/plugins/ProgressPlugin.check.d.ts +7 -0
  620. package/schemas/plugins/ProgressPlugin.check.js +6 -0
  621. package/schemas/plugins/ProgressPlugin.json +65 -0
  622. package/schemas/plugins/SourceMapDevToolPlugin.check.d.ts +7 -0
  623. package/schemas/plugins/SourceMapDevToolPlugin.check.js +6 -0
  624. package/schemas/plugins/SourceMapDevToolPlugin.json +168 -0
  625. package/schemas/plugins/WatchIgnorePlugin.check.d.ts +7 -0
  626. package/schemas/plugins/WatchIgnorePlugin.check.js +6 -0
  627. package/schemas/plugins/WatchIgnorePlugin.json +25 -0
  628. package/schemas/plugins/asset/AssetGeneratorOptions.check.d.ts +7 -0
  629. package/schemas/plugins/asset/AssetGeneratorOptions.check.js +6 -0
  630. package/schemas/plugins/asset/AssetGeneratorOptions.json +3 -0
  631. package/schemas/plugins/asset/AssetInlineGeneratorOptions.check.d.ts +7 -0
  632. package/schemas/plugins/asset/AssetInlineGeneratorOptions.check.js +6 -0
  633. package/schemas/plugins/asset/AssetInlineGeneratorOptions.json +3 -0
  634. package/schemas/plugins/asset/AssetParserOptions.check.d.ts +7 -0
  635. package/schemas/plugins/asset/AssetParserOptions.check.js +6 -0
  636. package/schemas/plugins/asset/AssetParserOptions.json +3 -0
  637. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.d.ts +7 -0
  638. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +6 -0
  639. package/schemas/plugins/asset/AssetResourceGeneratorOptions.json +3 -0
  640. package/schemas/plugins/container/ContainerPlugin.check.d.ts +7 -0
  641. package/schemas/plugins/container/ContainerPlugin.check.js +6 -0
  642. package/schemas/plugins/container/ContainerPlugin.json +294 -0
  643. package/schemas/plugins/container/ContainerReferencePlugin.check.d.ts +7 -0
  644. package/schemas/plugins/container/ContainerReferencePlugin.check.js +6 -0
  645. package/schemas/plugins/container/ContainerReferencePlugin.json +132 -0
  646. package/schemas/plugins/container/ExternalsType.check.d.ts +7 -0
  647. package/schemas/plugins/container/ExternalsType.check.js +6 -0
  648. package/schemas/plugins/container/ExternalsType.json +3 -0
  649. package/schemas/plugins/container/ModuleFederationPlugin.check.d.ts +7 -0
  650. package/schemas/plugins/container/ModuleFederationPlugin.check.js +6 -0
  651. package/schemas/plugins/container/ModuleFederationPlugin.json +525 -0
  652. package/schemas/plugins/css/CssGeneratorOptions.check.d.ts +7 -0
  653. package/schemas/plugins/css/CssGeneratorOptions.check.js +6 -0
  654. package/schemas/plugins/css/CssGeneratorOptions.json +3 -0
  655. package/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts +7 -0
  656. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +6 -0
  657. package/schemas/plugins/css/CssModuleGeneratorOptions.json +3 -0
  658. package/schemas/plugins/css/CssModuleParserOptions.check.d.ts +7 -0
  659. package/schemas/plugins/css/CssModuleParserOptions.check.js +6 -0
  660. package/schemas/plugins/css/CssModuleParserOptions.json +3 -0
  661. package/schemas/plugins/css/CssParserOptions.check.d.ts +7 -0
  662. package/schemas/plugins/css/CssParserOptions.check.js +6 -0
  663. package/schemas/plugins/css/CssParserOptions.json +3 -0
  664. package/schemas/plugins/debug/ProfilingPlugin.check.d.ts +7 -0
  665. package/schemas/plugins/debug/ProfilingPlugin.check.js +6 -0
  666. package/schemas/plugins/debug/ProfilingPlugin.json +12 -0
  667. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.d.ts +7 -0
  668. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +6 -0
  669. package/schemas/plugins/ids/HashedModuleIdsPlugin.json +57 -0
  670. package/schemas/plugins/ids/OccurrenceChunkIdsPlugin.check.d.ts +7 -0
  671. package/schemas/plugins/ids/OccurrenceChunkIdsPlugin.check.js +6 -0
  672. package/schemas/plugins/ids/OccurrenceChunkIdsPlugin.json +11 -0
  673. package/schemas/plugins/ids/OccurrenceModuleIdsPlugin.check.d.ts +7 -0
  674. package/schemas/plugins/ids/OccurrenceModuleIdsPlugin.check.js +6 -0
  675. package/schemas/plugins/ids/OccurrenceModuleIdsPlugin.json +11 -0
  676. package/schemas/plugins/json/JsonModulesPluginGenerator.check.d.ts +7 -0
  677. package/schemas/plugins/json/JsonModulesPluginGenerator.check.js +6 -0
  678. package/schemas/plugins/json/JsonModulesPluginGenerator.json +3 -0
  679. package/schemas/plugins/json/JsonModulesPluginParser.check.d.ts +7 -0
  680. package/schemas/plugins/json/JsonModulesPluginParser.check.js +6 -0
  681. package/schemas/plugins/json/JsonModulesPluginParser.json +3 -0
  682. package/schemas/plugins/optimize/AggressiveSplittingPlugin.check.d.ts +7 -0
  683. package/schemas/plugins/optimize/AggressiveSplittingPlugin.check.js +6 -0
  684. package/schemas/plugins/optimize/AggressiveSplittingPlugin.json +23 -0
  685. package/schemas/plugins/optimize/LimitChunkCountPlugin.check.d.ts +7 -0
  686. package/schemas/plugins/optimize/LimitChunkCountPlugin.check.js +6 -0
  687. package/schemas/plugins/optimize/LimitChunkCountPlugin.json +21 -0
  688. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.d.ts +7 -0
  689. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +6 -0
  690. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.json +11 -0
  691. package/schemas/plugins/optimize/MinChunkSizePlugin.check.d.ts +7 -0
  692. package/schemas/plugins/optimize/MinChunkSizePlugin.check.js +6 -0
  693. package/schemas/plugins/optimize/MinChunkSizePlugin.json +20 -0
  694. package/schemas/plugins/schemes/HttpUriPlugin.check.d.ts +7 -0
  695. package/schemas/plugins/schemes/HttpUriPlugin.check.js +6 -0
  696. package/schemas/plugins/schemes/HttpUriPlugin.json +74 -0
  697. package/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts +7 -0
  698. package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +6 -0
  699. package/schemas/plugins/schemes/VirtualUrlPlugin.json +77 -0
  700. package/schemas/plugins/sharing/ConsumeSharedPlugin.check.d.ts +7 -0
  701. package/schemas/plugins/sharing/ConsumeSharedPlugin.check.js +6 -0
  702. package/schemas/plugins/sharing/ConsumeSharedPlugin.json +120 -0
  703. package/schemas/plugins/sharing/ProvideSharedPlugin.check.d.ts +7 -0
  704. package/schemas/plugins/sharing/ProvideSharedPlugin.check.js +6 -0
  705. package/schemas/plugins/sharing/ProvideSharedPlugin.json +94 -0
  706. package/schemas/plugins/sharing/SharePlugin.check.d.ts +7 -0
  707. package/schemas/plugins/sharing/SharePlugin.check.js +6 -0
  708. package/schemas/plugins/sharing/SharePlugin.json +133 -0
  709. package/types.d.ts +20217 -0
@@ -0,0 +1,1494 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const ConditionalInitFragment = require("../ConditionalInitFragment");
9
+ const Dependency = require("../Dependency");
10
+ const { UsageState } = require("../ExportsInfo");
11
+ const HarmonyLinkingError = require("../HarmonyLinkingError");
12
+ const InitFragment = require("../InitFragment");
13
+ const RuntimeGlobals = require("../RuntimeGlobals");
14
+ const Template = require("../Template");
15
+ const {
16
+ getMakeDeferredNamespaceModeFromExportsType
17
+ } = require("../runtime/MakeDeferredNamespaceObjectRuntime");
18
+ const { countIterable } = require("../util/IterableHelpers");
19
+ const { combine, first } = require("../util/SetHelpers");
20
+ const makeSerializable = require("../util/makeSerializable");
21
+ const propertyAccess = require("../util/propertyAccess");
22
+ const { propertyName } = require("../util/propertyName");
23
+ const {
24
+ filterRuntime,
25
+ getRuntimeKey,
26
+ keyToRuntime
27
+ } = require("../util/runtime");
28
+ const HarmonyExportInitFragment = require("./HarmonyExportInitFragment");
29
+ const HarmonyImportDependency = require("./HarmonyImportDependency");
30
+ const { ImportPhaseUtils } = require("./ImportPhase");
31
+ const processExportInfo = require("./processExportInfo");
32
+
33
+ /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
34
+ /** @typedef {import("../ChunkGraph")} ChunkGraph */
35
+ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
36
+ /** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
37
+ /** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
38
+ /** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
39
+ /** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
40
+ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
41
+ /** @typedef {import("../ExportsInfo")} ExportsInfo */
42
+ /** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */
43
+ /** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
44
+ /** @typedef {import("../ExportsInfo").UsedName} UsedName */
45
+ /** @typedef {import("../Generator").GenerateContext} GenerateContext */
46
+ /** @typedef {import("../Module")} Module */
47
+ /** @typedef {import("../Module").BuildMeta} BuildMeta */
48
+ /** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
49
+ /** @typedef {import("../Module").ExportsType} ExportsType */
50
+ /** @typedef {import("../ModuleGraph")} ModuleGraph */
51
+ /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
52
+ /** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
53
+ /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
54
+ /** @typedef {import("../WebpackError")} WebpackError */
55
+ /** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
56
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
57
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
58
+ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
59
+ /** @typedef {import("./HarmonyImportDependency").Ids} Ids */
60
+ /** @typedef {import("./HarmonyImportDependency").ExportPresenceMode} ExportPresenceMode */
61
+ /** @typedef {import("./HarmonyExportInitFragment").ExportMap} ExportMap */
62
+ /** @typedef {import("../dependencies/ImportPhase").ImportPhaseType} ImportPhaseType */
63
+
64
+ /** @typedef {"missing" | "unused" | "empty-star" | "reexport-dynamic-default" | "reexport-named-default" | "reexport-namespace-object" | "reexport-fake-namespace-object" | "reexport-undefined" | "normal-reexport" | "dynamic-reexport"} ExportModeType */
65
+
66
+ const { ExportPresenceModes } = HarmonyImportDependency;
67
+
68
+ const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids");
69
+
70
+ class NormalReexportItem {
71
+ /**
72
+ * @param {string} name export name
73
+ * @param {Ids} ids reexported ids from other module
74
+ * @param {ExportInfo} exportInfo export info from other module
75
+ * @param {boolean} checked true, if it should be checked at runtime if this export exists
76
+ * @param {boolean} hidden true, if it is hidden behind another active export in the same module
77
+ */
78
+ constructor(name, ids, exportInfo, checked, hidden) {
79
+ this.name = name;
80
+ this.ids = ids;
81
+ this.exportInfo = exportInfo;
82
+ this.checked = checked;
83
+ this.hidden = hidden;
84
+ }
85
+ }
86
+
87
+ /** @typedef {Set<string>} ExportModeIgnored */
88
+ /** @typedef {Set<string>} ExportModeHidden */
89
+
90
+ class ExportMode {
91
+ /**
92
+ * @param {ExportModeType} type type of the mode
93
+ */
94
+ constructor(type) {
95
+ /** @type {ExportModeType} */
96
+ this.type = type;
97
+
98
+ // for "normal-reexport":
99
+ /** @type {NormalReexportItem[] | null} */
100
+ this.items = null;
101
+
102
+ // for "reexport-named-default" | "reexport-fake-namespace-object" | "reexport-namespace-object"
103
+ /** @type {string | null} */
104
+ this.name = null;
105
+ /** @type {ExportInfo | null} */
106
+ this.partialNamespaceExportInfo = null;
107
+
108
+ // for "dynamic-reexport":
109
+ /** @type {ExportModeIgnored | null} */
110
+ this.ignored = null;
111
+
112
+ // for "dynamic-reexport" | "empty-star":
113
+ /** @type {ExportModeHidden | undefined | null} */
114
+ this.hidden = null;
115
+
116
+ // for "missing":
117
+ /** @type {string | null} */
118
+ this.userRequest = null;
119
+
120
+ // for "reexport-fake-namespace-object":
121
+ /** @type {number} */
122
+ this.fakeType = 0;
123
+ }
124
+ }
125
+
126
+ /** @typedef {number[]} DependencyIndices */
127
+
128
+ /**
129
+ * @param {ModuleGraph} moduleGraph module graph
130
+ * @param {HarmonyExportImportedSpecifierDependency[]} dependencies dependencies
131
+ * @param {HarmonyExportImportedSpecifierDependency=} additionalDependency additional dependency
132
+ * @returns {{ names: ExportInfoName[], dependencyIndices: DependencyIndices }} result
133
+ */
134
+ const determineExportAssignments = (
135
+ moduleGraph,
136
+ dependencies,
137
+ additionalDependency
138
+ ) => {
139
+ /** @type {Set<ExportInfoName>} */
140
+ const names = new Set();
141
+ /** @type {DependencyIndices} */
142
+ const dependencyIndices = [];
143
+
144
+ if (additionalDependency) {
145
+ dependencies = [...dependencies, additionalDependency];
146
+ }
147
+
148
+ for (const dep of dependencies) {
149
+ const i = dependencyIndices.length;
150
+ dependencyIndices[i] = names.size;
151
+ const otherImportedModule = moduleGraph.getModule(dep);
152
+ if (otherImportedModule) {
153
+ const exportsInfo = moduleGraph.getExportsInfo(otherImportedModule);
154
+ for (const exportInfo of exportsInfo.exports) {
155
+ if (
156
+ exportInfo.provided === true &&
157
+ exportInfo.name !== "default" &&
158
+ !names.has(exportInfo.name)
159
+ ) {
160
+ names.add(exportInfo.name);
161
+ dependencyIndices[i] = names.size;
162
+ }
163
+ }
164
+ }
165
+ }
166
+ dependencyIndices.push(names.size);
167
+
168
+ return { names: [...names], dependencyIndices };
169
+ };
170
+
171
+ /**
172
+ * @param {object} options options
173
+ * @param {ExportInfoName[]} options.names names
174
+ * @param {DependencyIndices} options.dependencyIndices dependency indices
175
+ * @param {string} name name
176
+ * @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency>} dependencies dependencies
177
+ * @returns {HarmonyExportImportedSpecifierDependency | undefined} found dependency or nothing
178
+ */
179
+ const findDependencyForName = (
180
+ { names, dependencyIndices },
181
+ name,
182
+ dependencies
183
+ ) => {
184
+ const dependenciesIt = dependencies[Symbol.iterator]();
185
+ const dependencyIndicesIt = dependencyIndices[Symbol.iterator]();
186
+ let dependenciesItResult = dependenciesIt.next();
187
+ let dependencyIndicesItResult = dependencyIndicesIt.next();
188
+ if (dependencyIndicesItResult.done) return;
189
+ for (let i = 0; i < names.length; i++) {
190
+ while (i >= dependencyIndicesItResult.value) {
191
+ dependenciesItResult = dependenciesIt.next();
192
+ dependencyIndicesItResult = dependencyIndicesIt.next();
193
+ if (dependencyIndicesItResult.done) return;
194
+ }
195
+ if (names[i] === name) return dependenciesItResult.value;
196
+ }
197
+ return undefined;
198
+ };
199
+
200
+ /**
201
+ * @param {ModuleGraph} moduleGraph the module graph
202
+ * @param {HarmonyExportImportedSpecifierDependency} dep the dependency
203
+ * @param {string} runtimeKey the runtime key
204
+ * @returns {ExportMode} the export mode
205
+ */
206
+ const getMode = (moduleGraph, dep, runtimeKey) => {
207
+ const importedModule = moduleGraph.getModule(dep);
208
+
209
+ if (!importedModule) {
210
+ const mode = new ExportMode("missing");
211
+
212
+ mode.userRequest = dep.userRequest;
213
+
214
+ return mode;
215
+ }
216
+
217
+ const name = dep.name;
218
+ const runtime = keyToRuntime(runtimeKey);
219
+ const parentModule = /** @type {Module} */ (moduleGraph.getParentModule(dep));
220
+ const exportsInfo = moduleGraph.getExportsInfo(parentModule);
221
+
222
+ if (
223
+ name
224
+ ? exportsInfo.getUsed(name, runtime) === UsageState.Unused
225
+ : exportsInfo.isUsed(runtime) === false
226
+ ) {
227
+ const mode = new ExportMode("unused");
228
+
229
+ mode.name = name || "*";
230
+
231
+ return mode;
232
+ }
233
+
234
+ const importedExportsType = importedModule.getExportsType(
235
+ moduleGraph,
236
+ /** @type {BuildMeta} */
237
+ (parentModule.buildMeta).strictHarmonyModule
238
+ );
239
+
240
+ const ids = dep.getIds(moduleGraph);
241
+
242
+ // Special handling for reexporting the default export
243
+ // from non-namespace modules
244
+ if (name && ids.length > 0 && ids[0] === "default") {
245
+ switch (importedExportsType) {
246
+ case "dynamic": {
247
+ const mode = new ExportMode("reexport-dynamic-default");
248
+
249
+ mode.name = name;
250
+
251
+ return mode;
252
+ }
253
+ case "default-only":
254
+ case "default-with-named": {
255
+ const exportInfo = exportsInfo.getReadOnlyExportInfo(name);
256
+ const mode = new ExportMode("reexport-named-default");
257
+
258
+ mode.name = name;
259
+ mode.partialNamespaceExportInfo = exportInfo;
260
+
261
+ return mode;
262
+ }
263
+ }
264
+ }
265
+
266
+ // reexporting with a fixed name
267
+ if (name) {
268
+ /** @type {ExportMode} */
269
+ let mode;
270
+ const exportInfo = exportsInfo.getReadOnlyExportInfo(name);
271
+
272
+ if (ids.length > 0) {
273
+ // export { name as name }
274
+ switch (importedExportsType) {
275
+ case "default-only":
276
+ mode = new ExportMode("reexport-undefined");
277
+ mode.name = name;
278
+ break;
279
+ default:
280
+ mode = new ExportMode("normal-reexport");
281
+ mode.items = [
282
+ new NormalReexportItem(name, ids, exportInfo, false, false)
283
+ ];
284
+ break;
285
+ }
286
+ } else {
287
+ // export * as name
288
+ switch (importedExportsType) {
289
+ case "default-only":
290
+ mode = new ExportMode("reexport-fake-namespace-object");
291
+ mode.name = name;
292
+ mode.partialNamespaceExportInfo = exportInfo;
293
+ mode.fakeType = 0;
294
+ break;
295
+ case "default-with-named":
296
+ mode = new ExportMode("reexport-fake-namespace-object");
297
+ mode.name = name;
298
+ mode.partialNamespaceExportInfo = exportInfo;
299
+ mode.fakeType = 2;
300
+ break;
301
+ case "dynamic":
302
+ default:
303
+ mode = new ExportMode("reexport-namespace-object");
304
+ mode.name = name;
305
+ mode.partialNamespaceExportInfo = exportInfo;
306
+ }
307
+ }
308
+
309
+ return mode;
310
+ }
311
+
312
+ // Star reexporting
313
+ const { ignoredExports, exports, checked, hidden } = dep.getStarReexports(
314
+ moduleGraph,
315
+ runtime,
316
+ exportsInfo,
317
+ importedModule
318
+ );
319
+ if (!exports) {
320
+ // We have too few info about the modules
321
+ // Delegate the logic to the runtime code
322
+
323
+ const mode = new ExportMode("dynamic-reexport");
324
+ mode.ignored = ignoredExports;
325
+ mode.hidden = hidden;
326
+
327
+ return mode;
328
+ }
329
+
330
+ if (exports.size === 0) {
331
+ const mode = new ExportMode("empty-star");
332
+ mode.hidden = hidden;
333
+
334
+ return mode;
335
+ }
336
+
337
+ const mode = new ExportMode("normal-reexport");
338
+
339
+ mode.items = Array.from(
340
+ exports,
341
+ (exportName) =>
342
+ new NormalReexportItem(
343
+ exportName,
344
+ [exportName],
345
+ exportsInfo.getReadOnlyExportInfo(exportName),
346
+ /** @type {Checked} */
347
+ (checked).has(exportName),
348
+ false
349
+ )
350
+ );
351
+ if (hidden !== undefined) {
352
+ for (const exportName of hidden) {
353
+ mode.items.push(
354
+ new NormalReexportItem(
355
+ exportName,
356
+ [exportName],
357
+ exportsInfo.getReadOnlyExportInfo(exportName),
358
+ false,
359
+ true
360
+ )
361
+ );
362
+ }
363
+ }
364
+
365
+ return mode;
366
+ };
367
+
368
+ /** @typedef {Set<string>} Exports */
369
+ /** @typedef {Set<string>} Checked */
370
+ /** @typedef {Set<string>} Hidden */
371
+ /** @typedef {Set<string>} IgnoredExports */
372
+
373
+ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
374
+ /**
375
+ * @param {string} request the request string
376
+ * @param {number} sourceOrder the order in the original source file
377
+ * @param {Ids} ids the requested export name of the imported module
378
+ * @param {string | null} name the export name of for this module
379
+ * @param {Set<string>} activeExports other named exports in the module
380
+ * @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency> | null} otherStarExports other star exports in the module before this import
381
+ * @param {ExportPresenceMode} exportPresenceMode mode of checking export names
382
+ * @param {HarmonyStarExportsList | null} allStarExports all star exports in the module
383
+ * @param {ImportPhaseType} phase import phase
384
+ * @param {ImportAttributes=} attributes import attributes
385
+ */
386
+ constructor(
387
+ request,
388
+ sourceOrder,
389
+ ids,
390
+ name,
391
+ activeExports,
392
+ otherStarExports,
393
+ exportPresenceMode,
394
+ allStarExports,
395
+ phase,
396
+ attributes
397
+ ) {
398
+ super(request, sourceOrder, phase, attributes);
399
+
400
+ this.ids = ids;
401
+ this.name = name;
402
+ this.activeExports = activeExports;
403
+ this.otherStarExports = otherStarExports;
404
+ this.exportPresenceMode = exportPresenceMode;
405
+ this.allStarExports = allStarExports;
406
+ }
407
+
408
+ /**
409
+ * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module
410
+ */
411
+ couldAffectReferencingModule() {
412
+ return Dependency.TRANSITIVE;
413
+ }
414
+
415
+ // TODO webpack 6 remove
416
+ get id() {
417
+ throw new Error("id was renamed to ids and type changed to string[]");
418
+ }
419
+
420
+ // TODO webpack 6 remove
421
+ getId() {
422
+ throw new Error("id was renamed to ids and type changed to string[]");
423
+ }
424
+
425
+ // TODO webpack 6 remove
426
+ setId() {
427
+ throw new Error("id was renamed to ids and type changed to string[]");
428
+ }
429
+
430
+ get type() {
431
+ return "harmony export imported specifier";
432
+ }
433
+
434
+ /**
435
+ * @param {ModuleGraph} moduleGraph the module graph
436
+ * @returns {Ids} the imported id
437
+ */
438
+ getIds(moduleGraph) {
439
+ return moduleGraph.getMeta(this)[idsSymbol] || this.ids;
440
+ }
441
+
442
+ /**
443
+ * @param {ModuleGraph} moduleGraph the module graph
444
+ * @param {Ids} ids the imported ids
445
+ * @returns {void}
446
+ */
447
+ setIds(moduleGraph, ids) {
448
+ moduleGraph.getMeta(this)[idsSymbol] = ids;
449
+ }
450
+
451
+ /**
452
+ * @param {ModuleGraph} moduleGraph the module graph
453
+ * @param {RuntimeSpec} runtime the runtime
454
+ * @returns {ExportMode} the export mode
455
+ */
456
+ getMode(moduleGraph, runtime) {
457
+ return moduleGraph.dependencyCacheProvide(
458
+ this,
459
+ getRuntimeKey(runtime),
460
+ getMode
461
+ );
462
+ }
463
+
464
+ /**
465
+ * @param {ModuleGraph} moduleGraph the module graph
466
+ * @param {RuntimeSpec} runtime the runtime
467
+ * @param {ExportsInfo} exportsInfo exports info about the current module (optional)
468
+ * @param {Module} importedModule the imported module (optional)
469
+ * @returns {{ exports?: Exports, checked?: Checked, ignoredExports: IgnoredExports, hidden?: Hidden }} information
470
+ */
471
+ getStarReexports(
472
+ moduleGraph,
473
+ runtime,
474
+ exportsInfo = moduleGraph.getExportsInfo(
475
+ /** @type {Module} */ (moduleGraph.getParentModule(this))
476
+ ),
477
+ importedModule = /** @type {Module} */ (moduleGraph.getModule(this))
478
+ ) {
479
+ const importedExportsInfo = moduleGraph.getExportsInfo(importedModule);
480
+ const noExtraExports =
481
+ importedExportsInfo.otherExportsInfo.provided === false;
482
+ const noExtraImports =
483
+ exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused;
484
+
485
+ /** @type {IgnoredExports} */
486
+ const ignoredExports = new Set(["default", ...this.activeExports]);
487
+
488
+ /** @type {Hidden | undefined} */
489
+ let hiddenExports;
490
+ const otherStarExports =
491
+ this._discoverActiveExportsFromOtherStarExports(moduleGraph);
492
+ if (otherStarExports !== undefined) {
493
+ hiddenExports = new Set();
494
+ for (let i = 0; i < otherStarExports.namesSlice; i++) {
495
+ hiddenExports.add(otherStarExports.names[i]);
496
+ }
497
+ for (const e of ignoredExports) hiddenExports.delete(e);
498
+ }
499
+
500
+ if (!noExtraExports && !noExtraImports) {
501
+ return {
502
+ ignoredExports,
503
+ hidden: hiddenExports
504
+ };
505
+ }
506
+
507
+ /** @type {Exports} */
508
+ const exports = new Set();
509
+ /** @type {Checked} */
510
+ const checked = new Set();
511
+ /** @type {Hidden | undefined} */
512
+ const hidden = hiddenExports !== undefined ? new Set() : undefined;
513
+
514
+ if (noExtraImports) {
515
+ for (const exportInfo of exportsInfo.orderedExports) {
516
+ const name = exportInfo.name;
517
+ if (ignoredExports.has(name)) continue;
518
+ if (exportInfo.getUsed(runtime) === UsageState.Unused) continue;
519
+ const importedExportInfo =
520
+ importedExportsInfo.getReadOnlyExportInfo(name);
521
+ if (importedExportInfo.provided === false) continue;
522
+ if (hiddenExports !== undefined && hiddenExports.has(name)) {
523
+ /** @type {Hidden} */
524
+ (hidden).add(name);
525
+ continue;
526
+ }
527
+ exports.add(name);
528
+ if (importedExportInfo.provided === true) continue;
529
+ checked.add(name);
530
+ }
531
+ } else if (noExtraExports) {
532
+ for (const importedExportInfo of importedExportsInfo.orderedExports) {
533
+ const name = importedExportInfo.name;
534
+ if (ignoredExports.has(name)) continue;
535
+ if (importedExportInfo.provided === false) continue;
536
+ const exportInfo = exportsInfo.getReadOnlyExportInfo(name);
537
+ if (exportInfo.getUsed(runtime) === UsageState.Unused) continue;
538
+ if (hiddenExports !== undefined && hiddenExports.has(name)) {
539
+ /** @type {ExportModeHidden} */
540
+ (hidden).add(name);
541
+ continue;
542
+ }
543
+ exports.add(name);
544
+ if (importedExportInfo.provided === true) continue;
545
+ checked.add(name);
546
+ }
547
+ }
548
+
549
+ return { ignoredExports, exports, checked, hidden };
550
+ }
551
+
552
+ /**
553
+ * @param {ModuleGraph} moduleGraph module graph
554
+ * @returns {null | false | GetConditionFn} function to determine if the connection is active
555
+ */
556
+ getCondition(moduleGraph) {
557
+ return (connection, runtime) => {
558
+ const mode = this.getMode(moduleGraph, runtime);
559
+ return mode.type !== "unused" && mode.type !== "empty-star";
560
+ };
561
+ }
562
+
563
+ /**
564
+ * @param {ModuleGraph} moduleGraph the module graph
565
+ * @returns {ConnectionState} how this dependency connects the module to referencing modules
566
+ */
567
+ getModuleEvaluationSideEffectsState(moduleGraph) {
568
+ return false;
569
+ }
570
+
571
+ /**
572
+ * Returns list of exports referenced by this dependency
573
+ * @param {ModuleGraph} moduleGraph module graph
574
+ * @param {RuntimeSpec} runtime the runtime for which the module is analysed
575
+ * @returns {ReferencedExports} referenced exports
576
+ */
577
+ getReferencedExports(moduleGraph, runtime) {
578
+ const mode = this.getMode(moduleGraph, runtime);
579
+
580
+ switch (mode.type) {
581
+ case "missing":
582
+ case "unused":
583
+ case "empty-star":
584
+ case "reexport-undefined":
585
+ return Dependency.NO_EXPORTS_REFERENCED;
586
+
587
+ case "reexport-dynamic-default":
588
+ return Dependency.EXPORTS_OBJECT_REFERENCED;
589
+
590
+ case "reexport-named-default": {
591
+ if (!mode.partialNamespaceExportInfo) {
592
+ return Dependency.EXPORTS_OBJECT_REFERENCED;
593
+ }
594
+ /** @type {RawReferencedExports} */
595
+ const referencedExports = [];
596
+ processExportInfo(
597
+ runtime,
598
+ referencedExports,
599
+ [],
600
+ /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo)
601
+ );
602
+ return referencedExports;
603
+ }
604
+
605
+ case "reexport-namespace-object":
606
+ case "reexport-fake-namespace-object": {
607
+ if (!mode.partialNamespaceExportInfo) {
608
+ return Dependency.EXPORTS_OBJECT_REFERENCED;
609
+ }
610
+ /** @type {RawReferencedExports} */
611
+ const referencedExports = [];
612
+ processExportInfo(
613
+ runtime,
614
+ referencedExports,
615
+ [],
616
+ /** @type {ExportInfo} */ (mode.partialNamespaceExportInfo),
617
+ mode.type === "reexport-fake-namespace-object"
618
+ );
619
+ return referencedExports;
620
+ }
621
+
622
+ case "dynamic-reexport":
623
+ return Dependency.EXPORTS_OBJECT_REFERENCED;
624
+
625
+ case "normal-reexport": {
626
+ /** @type {RawReferencedExports} */
627
+ const referencedExports = [];
628
+ for (const {
629
+ ids,
630
+ exportInfo,
631
+ hidden
632
+ } of /** @type {NormalReexportItem[]} */ (mode.items)) {
633
+ if (hidden) continue;
634
+ processExportInfo(runtime, referencedExports, ids, exportInfo, false);
635
+ }
636
+ return referencedExports;
637
+ }
638
+
639
+ default:
640
+ throw new Error(`Unknown mode ${mode.type}`);
641
+ }
642
+ }
643
+
644
+ /**
645
+ * @param {ModuleGraph} moduleGraph the module graph
646
+ * @returns {{ names: ExportInfoName[], namesSlice: number, dependencyIndices: DependencyIndices, dependencyIndex: number } | undefined} exported names and their origin dependency
647
+ */
648
+ _discoverActiveExportsFromOtherStarExports(moduleGraph) {
649
+ if (!this.otherStarExports) return;
650
+
651
+ const i =
652
+ "length" in this.otherStarExports
653
+ ? this.otherStarExports.length
654
+ : countIterable(this.otherStarExports);
655
+ if (i === 0) return;
656
+
657
+ if (this.allStarExports) {
658
+ const { names, dependencyIndices } = moduleGraph.cached(
659
+ determineExportAssignments,
660
+ this.allStarExports.dependencies
661
+ );
662
+
663
+ return {
664
+ names,
665
+ namesSlice: dependencyIndices[i - 1],
666
+ dependencyIndices,
667
+ dependencyIndex: i
668
+ };
669
+ }
670
+
671
+ const { names, dependencyIndices } = moduleGraph.cached(
672
+ determineExportAssignments,
673
+ /** @type {HarmonyExportImportedSpecifierDependency[]} */
674
+ (this.otherStarExports),
675
+ this
676
+ );
677
+
678
+ return {
679
+ names,
680
+ namesSlice: dependencyIndices[i - 1],
681
+ dependencyIndices,
682
+ dependencyIndex: i
683
+ };
684
+ }
685
+
686
+ /**
687
+ * Returns the exported names
688
+ * @param {ModuleGraph} moduleGraph module graph
689
+ * @returns {ExportsSpec | undefined} export names
690
+ */
691
+ getExports(moduleGraph) {
692
+ const mode = this.getMode(moduleGraph, undefined);
693
+
694
+ switch (mode.type) {
695
+ case "missing":
696
+ return;
697
+ case "dynamic-reexport": {
698
+ const from =
699
+ /** @type {ModuleGraphConnection} */
700
+ (moduleGraph.getConnection(this));
701
+ return {
702
+ exports: true,
703
+ from,
704
+ canMangle: false,
705
+ excludeExports: mode.hidden
706
+ ? combine(
707
+ /** @type {ExportModeIgnored} */ (mode.ignored),
708
+ mode.hidden
709
+ )
710
+ : /** @type {ExportModeIgnored} */ (mode.ignored),
711
+ hideExports: mode.hidden,
712
+ dependencies: [from.module]
713
+ };
714
+ }
715
+ case "empty-star":
716
+ return {
717
+ exports: [],
718
+ hideExports: mode.hidden,
719
+ dependencies: [/** @type {Module} */ (moduleGraph.getModule(this))]
720
+ };
721
+ // falls through
722
+ case "normal-reexport": {
723
+ const from =
724
+ /** @type {ModuleGraphConnection} */
725
+ (moduleGraph.getConnection(this));
726
+ return {
727
+ exports: Array.from(
728
+ /** @type {NormalReexportItem[]} */ (mode.items),
729
+ (item) => ({
730
+ name: item.name,
731
+ from,
732
+ export: item.ids,
733
+ hidden: item.hidden
734
+ })
735
+ ),
736
+ priority: 1,
737
+ dependencies: [from.module]
738
+ };
739
+ }
740
+ case "reexport-dynamic-default": {
741
+ const from =
742
+ /** @type {ModuleGraphConnection} */
743
+ (moduleGraph.getConnection(this));
744
+ return {
745
+ exports: [
746
+ {
747
+ name: /** @type {string} */ (mode.name),
748
+ from,
749
+ export: ["default"]
750
+ }
751
+ ],
752
+ priority: 1,
753
+ dependencies: [from.module]
754
+ };
755
+ }
756
+ case "reexport-undefined":
757
+ return {
758
+ exports: [/** @type {string} */ (mode.name)],
759
+ dependencies: [/** @type {Module} */ (moduleGraph.getModule(this))]
760
+ };
761
+ case "reexport-fake-namespace-object": {
762
+ const from =
763
+ /** @type {ModuleGraphConnection} */
764
+ (moduleGraph.getConnection(this));
765
+ return {
766
+ exports: [
767
+ {
768
+ name: /** @type {string} */ (mode.name),
769
+ from,
770
+ export: null,
771
+ exports: [
772
+ {
773
+ name: "default",
774
+ canMangle: false,
775
+ from,
776
+ export: null
777
+ }
778
+ ]
779
+ }
780
+ ],
781
+ priority: 1,
782
+ dependencies: [from.module]
783
+ };
784
+ }
785
+ case "reexport-namespace-object": {
786
+ const from =
787
+ /** @type {ModuleGraphConnection} */
788
+ (moduleGraph.getConnection(this));
789
+ return {
790
+ exports: [
791
+ {
792
+ name: /** @type {string} */ (mode.name),
793
+ from,
794
+ export: null
795
+ }
796
+ ],
797
+ priority: 1,
798
+ dependencies: [from.module]
799
+ };
800
+ }
801
+ case "reexport-named-default": {
802
+ const from =
803
+ /** @type {ModuleGraphConnection} */
804
+ (moduleGraph.getConnection(this));
805
+ return {
806
+ exports: [
807
+ {
808
+ name: /** @type {string} */ (mode.name),
809
+ from,
810
+ export: ["default"]
811
+ }
812
+ ],
813
+ priority: 1,
814
+ dependencies: [from.module]
815
+ };
816
+ }
817
+ default:
818
+ throw new Error(`Unknown mode ${mode.type}`);
819
+ }
820
+ }
821
+
822
+ /**
823
+ * @param {ModuleGraph} moduleGraph module graph
824
+ * @returns {ExportPresenceMode} effective mode
825
+ */
826
+ _getEffectiveExportPresenceLevel(moduleGraph) {
827
+ if (this.exportPresenceMode !== ExportPresenceModes.AUTO) {
828
+ return this.exportPresenceMode;
829
+ }
830
+ const module = /** @type {Module} */ (moduleGraph.getParentModule(this));
831
+ return /** @type {BuildMeta} */ (module.buildMeta).strictHarmonyModule
832
+ ? ExportPresenceModes.ERROR
833
+ : ExportPresenceModes.WARN;
834
+ }
835
+
836
+ /**
837
+ * Returns warnings
838
+ * @param {ModuleGraph} moduleGraph module graph
839
+ * @returns {WebpackError[] | null | undefined} warnings
840
+ */
841
+ getWarnings(moduleGraph) {
842
+ const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
843
+ if (exportsPresence === ExportPresenceModes.WARN) {
844
+ return this._getErrors(moduleGraph);
845
+ }
846
+ return null;
847
+ }
848
+
849
+ /**
850
+ * Returns errors
851
+ * @param {ModuleGraph} moduleGraph module graph
852
+ * @returns {WebpackError[] | null | undefined} errors
853
+ */
854
+ getErrors(moduleGraph) {
855
+ const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
856
+ if (exportsPresence === ExportPresenceModes.ERROR) {
857
+ return this._getErrors(moduleGraph);
858
+ }
859
+ return null;
860
+ }
861
+
862
+ /**
863
+ * @param {ModuleGraph} moduleGraph module graph
864
+ * @returns {WebpackError[] | undefined} errors
865
+ */
866
+ _getErrors(moduleGraph) {
867
+ const ids = this.getIds(moduleGraph);
868
+ let errors = this.getLinkingErrors(
869
+ moduleGraph,
870
+ ids,
871
+ `(reexported as '${this.name}')`
872
+ );
873
+ if (ids.length === 0 && this.name === null) {
874
+ const potentialConflicts =
875
+ this._discoverActiveExportsFromOtherStarExports(moduleGraph);
876
+ if (potentialConflicts && potentialConflicts.namesSlice > 0) {
877
+ const ownNames = new Set(
878
+ potentialConflicts.names.slice(
879
+ potentialConflicts.namesSlice,
880
+ potentialConflicts.dependencyIndices[
881
+ potentialConflicts.dependencyIndex
882
+ ]
883
+ )
884
+ );
885
+ const importedModule = moduleGraph.getModule(this);
886
+ if (importedModule) {
887
+ const exportsInfo = moduleGraph.getExportsInfo(importedModule);
888
+ /** @type {Map<string, ExportInfoName[]>} */
889
+ const conflicts = new Map();
890
+ for (const exportInfo of exportsInfo.orderedExports) {
891
+ if (exportInfo.provided !== true) continue;
892
+ if (exportInfo.name === "default") continue;
893
+ if (this.activeExports.has(exportInfo.name)) continue;
894
+ if (ownNames.has(exportInfo.name)) continue;
895
+ const conflictingDependency = findDependencyForName(
896
+ potentialConflicts,
897
+ exportInfo.name,
898
+ this.allStarExports
899
+ ? this.allStarExports.dependencies
900
+ : [
901
+ .../** @type {ReadonlyArray<HarmonyExportImportedSpecifierDependency>} */
902
+ (this.otherStarExports),
903
+ this
904
+ ]
905
+ );
906
+ if (!conflictingDependency) continue;
907
+ const target = exportInfo.getTerminalBinding(moduleGraph);
908
+ if (!target) continue;
909
+ const conflictingModule =
910
+ /** @type {Module} */
911
+ (moduleGraph.getModule(conflictingDependency));
912
+ if (conflictingModule === importedModule) continue;
913
+ const conflictingExportInfo = moduleGraph.getExportInfo(
914
+ conflictingModule,
915
+ exportInfo.name
916
+ );
917
+ const conflictingTarget =
918
+ conflictingExportInfo.getTerminalBinding(moduleGraph);
919
+ if (!conflictingTarget) continue;
920
+ if (target === conflictingTarget) continue;
921
+ const list = conflicts.get(conflictingDependency.request);
922
+ if (list === undefined) {
923
+ conflicts.set(conflictingDependency.request, [exportInfo.name]);
924
+ } else {
925
+ list.push(exportInfo.name);
926
+ }
927
+ }
928
+ for (const [request, exports] of conflicts) {
929
+ if (!errors) errors = [];
930
+ errors.push(
931
+ new HarmonyLinkingError(
932
+ `The requested module '${
933
+ this.request
934
+ }' contains conflicting star exports for the ${
935
+ exports.length > 1 ? "names" : "name"
936
+ } ${exports
937
+ .map((e) => `'${e}'`)
938
+ .join(", ")} with the previous requested module '${request}'`
939
+ )
940
+ );
941
+ }
942
+ }
943
+ }
944
+ }
945
+ return errors;
946
+ }
947
+
948
+ /**
949
+ * @param {ObjectSerializerContext} context context
950
+ */
951
+ serialize(context) {
952
+ const { write, setCircularReference } = context;
953
+
954
+ setCircularReference(this);
955
+ write(this.ids);
956
+ write(this.name);
957
+ write(this.activeExports);
958
+ write(this.otherStarExports);
959
+ write(this.exportPresenceMode);
960
+ write(this.allStarExports);
961
+
962
+ super.serialize(context);
963
+ }
964
+
965
+ /**
966
+ * @param {ObjectDeserializerContext} context context
967
+ */
968
+ deserialize(context) {
969
+ const { read, setCircularReference } = context;
970
+
971
+ setCircularReference(this);
972
+ this.ids = read();
973
+ this.name = read();
974
+ this.activeExports = read();
975
+ this.otherStarExports = read();
976
+ this.exportPresenceMode = read();
977
+ this.allStarExports = read();
978
+
979
+ super.deserialize(context);
980
+ }
981
+ }
982
+
983
+ makeSerializable(
984
+ HarmonyExportImportedSpecifierDependency,
985
+ "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency"
986
+ );
987
+
988
+ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedSpecifierDependencyTemplate extends (
989
+ HarmonyImportDependency.Template
990
+ ) {
991
+ /**
992
+ * @param {Dependency} dependency the dependency for which the template should be applied
993
+ * @param {ReplaceSource} source the current replace source which can be modified
994
+ * @param {DependencyTemplateContext} templateContext the context object
995
+ * @returns {void}
996
+ */
997
+ apply(dependency, source, templateContext) {
998
+ const { moduleGraph, runtime, concatenationScope } = templateContext;
999
+
1000
+ const dep = /** @type {HarmonyExportImportedSpecifierDependency} */ (
1001
+ dependency
1002
+ );
1003
+
1004
+ const mode = dep.getMode(moduleGraph, runtime);
1005
+
1006
+ if (concatenationScope) {
1007
+ switch (mode.type) {
1008
+ case "reexport-undefined":
1009
+ concatenationScope.registerRawExport(
1010
+ /** @type {NonNullable<ExportMode["name"]>} */ (mode.name),
1011
+ "/* reexport non-default export from non-harmony */ undefined"
1012
+ );
1013
+ }
1014
+ return;
1015
+ }
1016
+
1017
+ if (mode.type !== "unused" && mode.type !== "empty-star") {
1018
+ super.apply(dependency, source, templateContext);
1019
+
1020
+ this._addExportFragments(
1021
+ templateContext.initFragments,
1022
+ dep,
1023
+ mode,
1024
+ templateContext.module,
1025
+ moduleGraph,
1026
+ templateContext.chunkGraph,
1027
+ runtime,
1028
+ templateContext.runtimeTemplate,
1029
+ templateContext.runtimeRequirements
1030
+ );
1031
+ }
1032
+ }
1033
+
1034
+ /**
1035
+ * @param {InitFragment<GenerateContext>[]} initFragments target array for init fragments
1036
+ * @param {HarmonyExportImportedSpecifierDependency} dep dependency
1037
+ * @param {ExportMode} mode the export mode
1038
+ * @param {Module} module the current module
1039
+ * @param {ModuleGraph} moduleGraph the module graph
1040
+ * @param {ChunkGraph} chunkGraph the chunk graph
1041
+ * @param {RuntimeSpec} runtime the runtime
1042
+ * @param {RuntimeTemplate} runtimeTemplate the runtime template
1043
+ * @param {RuntimeRequirements} runtimeRequirements runtime requirements
1044
+ * @returns {void}
1045
+ */
1046
+ _addExportFragments(
1047
+ initFragments,
1048
+ dep,
1049
+ mode,
1050
+ module,
1051
+ moduleGraph,
1052
+ chunkGraph,
1053
+ runtime,
1054
+ runtimeTemplate,
1055
+ runtimeRequirements
1056
+ ) {
1057
+ const importedModule = /** @type {Module} */ (moduleGraph.getModule(dep));
1058
+ const importVar = dep.getImportVar(moduleGraph);
1059
+ const isDeferred =
1060
+ ImportPhaseUtils.isDefer(dep.phase) &&
1061
+ !(/** @type {BuildMeta} */ (importedModule.buildMeta).async);
1062
+
1063
+ if (
1064
+ (mode.type === "reexport-namespace-object" ||
1065
+ mode.type === "reexport-fake-namespace-object") &&
1066
+ isDeferred
1067
+ ) {
1068
+ initFragments.push(
1069
+ ...this.getReexportDeferredNamespaceObjectFragments(
1070
+ importedModule,
1071
+ chunkGraph,
1072
+ moduleGraph
1073
+ .getExportsInfo(module)
1074
+ .getUsedName(mode.name ? mode.name : [], runtime),
1075
+ importVar,
1076
+ importedModule.getExportsType(
1077
+ moduleGraph,
1078
+ module.buildMeta && module.buildMeta.strictHarmonyModule
1079
+ ),
1080
+ runtimeRequirements
1081
+ )
1082
+ );
1083
+ return;
1084
+ }
1085
+ switch (mode.type) {
1086
+ case "missing":
1087
+ case "empty-star":
1088
+ initFragments.push(
1089
+ new InitFragment(
1090
+ "/* empty/unused harmony star reexport */\n",
1091
+ InitFragment.STAGE_HARMONY_EXPORTS,
1092
+ 1
1093
+ )
1094
+ );
1095
+ break;
1096
+
1097
+ case "unused":
1098
+ initFragments.push(
1099
+ new InitFragment(
1100
+ `${Template.toNormalComment(
1101
+ `unused harmony reexport ${mode.name}`
1102
+ )}\n`,
1103
+ InitFragment.STAGE_HARMONY_EXPORTS,
1104
+ 1
1105
+ )
1106
+ );
1107
+ break;
1108
+
1109
+ case "reexport-dynamic-default":
1110
+ initFragments.push(
1111
+ this.getReexportFragment(
1112
+ module,
1113
+ "reexport default from dynamic",
1114
+ moduleGraph
1115
+ .getExportsInfo(module)
1116
+ .getUsedName(/** @type {string} */ (mode.name), runtime),
1117
+ importVar,
1118
+ null,
1119
+ runtimeRequirements
1120
+ )
1121
+ );
1122
+ break;
1123
+
1124
+ case "reexport-fake-namespace-object":
1125
+ initFragments.push(
1126
+ ...this.getReexportFakeNamespaceObjectFragments(
1127
+ module,
1128
+ moduleGraph
1129
+ .getExportsInfo(module)
1130
+ .getUsedName(/** @type {string} */ (mode.name), runtime),
1131
+ importVar,
1132
+ mode.fakeType,
1133
+ runtimeRequirements
1134
+ )
1135
+ );
1136
+ break;
1137
+
1138
+ case "reexport-undefined":
1139
+ initFragments.push(
1140
+ this.getReexportFragment(
1141
+ module,
1142
+ "reexport non-default export from non-harmony",
1143
+ moduleGraph
1144
+ .getExportsInfo(module)
1145
+ .getUsedName(/** @type {string} */ (mode.name), runtime),
1146
+ "undefined",
1147
+ "",
1148
+ runtimeRequirements
1149
+ )
1150
+ );
1151
+ break;
1152
+
1153
+ case "reexport-named-default":
1154
+ initFragments.push(
1155
+ this.getReexportFragment(
1156
+ module,
1157
+ "reexport default export from named module",
1158
+ moduleGraph
1159
+ .getExportsInfo(module)
1160
+ .getUsedName(/** @type {string} */ (mode.name), runtime),
1161
+ importVar,
1162
+ "",
1163
+ runtimeRequirements
1164
+ )
1165
+ );
1166
+ break;
1167
+
1168
+ case "reexport-namespace-object":
1169
+ initFragments.push(
1170
+ this.getReexportFragment(
1171
+ module,
1172
+ "reexport module object",
1173
+ moduleGraph
1174
+ .getExportsInfo(module)
1175
+ .getUsedName(/** @type {string} */ (mode.name), runtime),
1176
+ importVar,
1177
+ "",
1178
+ runtimeRequirements
1179
+ )
1180
+ );
1181
+ break;
1182
+
1183
+ case "normal-reexport":
1184
+ for (const {
1185
+ name,
1186
+ ids,
1187
+ checked,
1188
+ hidden
1189
+ } of /** @type {NormalReexportItem[]} */ (mode.items)) {
1190
+ if (hidden) continue;
1191
+ if (checked) {
1192
+ const connection = moduleGraph.getConnection(dep);
1193
+ const key = `harmony reexport (checked) ${importVar} ${name}`;
1194
+ const runtimeCondition = dep.weak
1195
+ ? false
1196
+ : connection
1197
+ ? filterRuntime(runtime, (r) => connection.isTargetActive(r))
1198
+ : true;
1199
+ initFragments.push(
1200
+ new ConditionalInitFragment(
1201
+ `/* harmony reexport (checked) */ ${this.getConditionalReexportStatement(
1202
+ module,
1203
+ name,
1204
+ importVar,
1205
+ ids,
1206
+ runtimeRequirements
1207
+ )}`,
1208
+ moduleGraph.isAsync(importedModule)
1209
+ ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS
1210
+ : InitFragment.STAGE_HARMONY_IMPORTS,
1211
+ /** @type {number} */ (dep.sourceOrder),
1212
+ key,
1213
+ runtimeCondition
1214
+ )
1215
+ );
1216
+ } else {
1217
+ initFragments.push(
1218
+ this.getReexportFragment(
1219
+ module,
1220
+ "reexport safe",
1221
+ moduleGraph.getExportsInfo(module).getUsedName(name, runtime),
1222
+ importVar,
1223
+ moduleGraph
1224
+ .getExportsInfo(importedModule)
1225
+ .getUsedName(ids, runtime),
1226
+ runtimeRequirements
1227
+ )
1228
+ );
1229
+ }
1230
+ }
1231
+ break;
1232
+
1233
+ case "dynamic-reexport": {
1234
+ const ignored = mode.hidden
1235
+ ? combine(
1236
+ /** @type {ExportModeIgnored} */
1237
+ (mode.ignored),
1238
+ mode.hidden
1239
+ )
1240
+ : /** @type {ExportModeIgnored} */ (mode.ignored);
1241
+ let content =
1242
+ "/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};\n" +
1243
+ `/* harmony reexport (unknown) */ for(${runtimeTemplate.renderConst()} __WEBPACK_IMPORT_KEY__ in ${importVar}) `;
1244
+
1245
+ // Filter out exports which are defined by other exports
1246
+ // and filter out default export because it cannot be reexported with *
1247
+ if (ignored.size > 1) {
1248
+ content += `if(${JSON.stringify([
1249
+ ...ignored
1250
+ ])}.indexOf(__WEBPACK_IMPORT_KEY__) < 0) `;
1251
+ } else if (ignored.size === 1) {
1252
+ content += `if(__WEBPACK_IMPORT_KEY__ !== ${JSON.stringify(
1253
+ first(ignored)
1254
+ )}) `;
1255
+ }
1256
+
1257
+ content += "__WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = ";
1258
+ content +=
1259
+ runtimeTemplate.supportsArrowFunction() &&
1260
+ runtimeTemplate.supportsConst()
1261
+ ? `() => ${importVar}[__WEBPACK_IMPORT_KEY__]`
1262
+ : `function(key) { return ${importVar}[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)`;
1263
+
1264
+ runtimeRequirements.add(RuntimeGlobals.exports);
1265
+ runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
1266
+
1267
+ const exportsName = module.exportsArgument;
1268
+ initFragments.push(
1269
+ new InitFragment(
1270
+ `${content}\n/* harmony reexport (unknown) */ ${RuntimeGlobals.definePropertyGetters}(${exportsName}, __WEBPACK_REEXPORT_OBJECT__);\n`,
1271
+ moduleGraph.isAsync(importedModule)
1272
+ ? InitFragment.STAGE_ASYNC_HARMONY_IMPORTS
1273
+ : InitFragment.STAGE_HARMONY_IMPORTS,
1274
+ /** @type {number} */ (dep.sourceOrder)
1275
+ )
1276
+ );
1277
+ break;
1278
+ }
1279
+
1280
+ default:
1281
+ throw new Error(`Unknown mode ${mode.type}`);
1282
+ }
1283
+ }
1284
+
1285
+ /**
1286
+ * @param {Module} module the current module
1287
+ * @param {string} comment comment
1288
+ * @param {UsedName} key key
1289
+ * @param {string} name name
1290
+ * @param {UsedName | null} valueKey value key
1291
+ * @param {RuntimeRequirements} runtimeRequirements runtime requirements
1292
+ * @returns {HarmonyExportInitFragment} harmony export init fragment
1293
+ */
1294
+ getReexportFragment(
1295
+ module,
1296
+ comment,
1297
+ key,
1298
+ name,
1299
+ valueKey,
1300
+ runtimeRequirements
1301
+ ) {
1302
+ const returnValue = this.getReturnValue(name, valueKey);
1303
+
1304
+ runtimeRequirements.add(RuntimeGlobals.exports);
1305
+ runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
1306
+
1307
+ /** @type {ExportMap} */
1308
+ const map = new Map();
1309
+ map.set(key, `/* ${comment} */ ${returnValue}`);
1310
+
1311
+ return new HarmonyExportInitFragment(module.exportsArgument, map);
1312
+ }
1313
+
1314
+ /**
1315
+ * @param {Module} module module
1316
+ * @param {UsedName} key key
1317
+ * @param {string} name name
1318
+ * @param {number} fakeType fake type
1319
+ * @param {RuntimeRequirements} runtimeRequirements runtime requirements
1320
+ * @returns {[InitFragment<GenerateContext>, HarmonyExportInitFragment]} init fragments
1321
+ */
1322
+ getReexportFakeNamespaceObjectFragments(
1323
+ module,
1324
+ key,
1325
+ name,
1326
+ fakeType,
1327
+ runtimeRequirements
1328
+ ) {
1329
+ runtimeRequirements.add(RuntimeGlobals.exports);
1330
+ runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
1331
+ runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject);
1332
+
1333
+ /** @type {ExportMap} */
1334
+ const map = new Map();
1335
+ map.set(
1336
+ key,
1337
+ `/* reexport fake namespace object from non-harmony */ ${name}_namespace_cache || (${name}_namespace_cache = ${
1338
+ RuntimeGlobals.createFakeNamespaceObject
1339
+ }(${name}${fakeType ? `, ${fakeType}` : ""}))`
1340
+ );
1341
+
1342
+ return [
1343
+ new InitFragment(
1344
+ `var ${name}_namespace_cache;\n`,
1345
+ InitFragment.STAGE_CONSTANTS,
1346
+ -1,
1347
+ `${name}_namespace_cache`
1348
+ ),
1349
+ new HarmonyExportInitFragment(module.exportsArgument, map)
1350
+ ];
1351
+ }
1352
+
1353
+ /**
1354
+ * @param {Module} module module
1355
+ * @param {ChunkGraph} chunkGraph chunkGraph
1356
+ * @param {UsedName} key key
1357
+ * @param {string} name name
1358
+ * @param {ExportsType} exportsType exportsType
1359
+ * @param {RuntimeRequirements} runtimeRequirements runtimeRequirements
1360
+ * @returns {InitFragment<GenerateContext>[]} fragments
1361
+ */
1362
+ getReexportDeferredNamespaceObjectFragments(
1363
+ module,
1364
+ chunkGraph,
1365
+ key,
1366
+ name,
1367
+ exportsType,
1368
+ runtimeRequirements
1369
+ ) {
1370
+ runtimeRequirements.add(RuntimeGlobals.exports);
1371
+ runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
1372
+ runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject);
1373
+
1374
+ /** @type {ExportMap} */
1375
+ const map = new Map();
1376
+ const moduleId = JSON.stringify(chunkGraph.getModuleId(module));
1377
+ const mode = getMakeDeferredNamespaceModeFromExportsType(exportsType);
1378
+ map.set(
1379
+ key,
1380
+ `/* reexport deferred namespace object */ ${name}_deferred_namespace_cache || (${name}_deferred_namespace_cache = ${RuntimeGlobals.makeDeferredNamespaceObject}(${moduleId}, ${mode}))`
1381
+ );
1382
+
1383
+ return [
1384
+ new InitFragment(
1385
+ `var ${name}_deferred_namespace_cache;\n`,
1386
+ InitFragment.STAGE_CONSTANTS,
1387
+ -1,
1388
+ `${name}_deferred_namespace_cache`
1389
+ ),
1390
+ new HarmonyExportInitFragment(module.exportsArgument, map)
1391
+ ];
1392
+ }
1393
+
1394
+ /**
1395
+ * @param {Module} module module
1396
+ * @param {string} key key
1397
+ * @param {string} name name
1398
+ * @param {string | string[] | false} valueKey value key
1399
+ * @param {RuntimeRequirements} runtimeRequirements runtime requirements
1400
+ * @returns {string} result
1401
+ */
1402
+ getConditionalReexportStatement(
1403
+ module,
1404
+ key,
1405
+ name,
1406
+ valueKey,
1407
+ runtimeRequirements
1408
+ ) {
1409
+ if (valueKey === false) {
1410
+ return "/* unused export */\n";
1411
+ }
1412
+
1413
+ const exportsName = module.exportsArgument;
1414
+ const returnValue = this.getReturnValue(name, valueKey);
1415
+
1416
+ runtimeRequirements.add(RuntimeGlobals.exports);
1417
+ runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
1418
+ runtimeRequirements.add(RuntimeGlobals.hasOwnProperty);
1419
+
1420
+ return `if(${RuntimeGlobals.hasOwnProperty}(${name}, ${JSON.stringify(
1421
+ valueKey[0]
1422
+ )})) ${
1423
+ RuntimeGlobals.definePropertyGetters
1424
+ }(${exportsName}, { ${propertyName(
1425
+ key
1426
+ )}: function() { return ${returnValue}; } });\n`;
1427
+ }
1428
+
1429
+ /**
1430
+ * @param {string} name name
1431
+ * @param {null | false | string | string[]} valueKey value key
1432
+ * @returns {string | undefined} value
1433
+ */
1434
+ getReturnValue(name, valueKey) {
1435
+ if (valueKey === null) {
1436
+ return `${name}_default.a`;
1437
+ }
1438
+
1439
+ if (valueKey === "") {
1440
+ return name;
1441
+ }
1442
+
1443
+ if (valueKey === false) {
1444
+ return "/* unused export */ undefined";
1445
+ }
1446
+
1447
+ return `${name}${propertyAccess(valueKey)}`;
1448
+ }
1449
+ };
1450
+
1451
+ class HarmonyStarExportsList {
1452
+ constructor() {
1453
+ /** @type {HarmonyExportImportedSpecifierDependency[]} */
1454
+ this.dependencies = [];
1455
+ }
1456
+
1457
+ /**
1458
+ * @param {HarmonyExportImportedSpecifierDependency} dep dependency
1459
+ * @returns {void}
1460
+ */
1461
+ push(dep) {
1462
+ this.dependencies.push(dep);
1463
+ }
1464
+
1465
+ slice() {
1466
+ return [...this.dependencies];
1467
+ }
1468
+
1469
+ /**
1470
+ * @param {ObjectSerializerContext} context context
1471
+ */
1472
+ serialize({ write, setCircularReference }) {
1473
+ setCircularReference(this);
1474
+ write(this.dependencies);
1475
+ }
1476
+
1477
+ /**
1478
+ * @param {ObjectDeserializerContext} context context
1479
+ */
1480
+ deserialize({ read, setCircularReference }) {
1481
+ setCircularReference(this);
1482
+ this.dependencies = read();
1483
+ }
1484
+ }
1485
+
1486
+ makeSerializable(
1487
+ HarmonyStarExportsList,
1488
+ "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency",
1489
+ "HarmonyStarExportsList"
1490
+ );
1491
+
1492
+ module.exports = HarmonyExportImportedSpecifierDependency;
1493
+ module.exports.HarmonyStarExportsList = HarmonyStarExportsList;
1494
+ module.exports.idsSymbol = idsSymbol;