@module-federation/enhanced 0.0.0-perf-devtools-20260107043700 → 0.0.0-perf-website-code-usage-20260914033703

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 (289) hide show
  1. package/README.md +1 -1
  2. package/dist/CHANGELOG.md +2678 -0
  3. package/dist/README.md +213 -0
  4. package/dist/rstestmigrate.md +140 -0
  5. package/dist/src/_virtual/_rolldown/runtime.js +47 -0
  6. package/dist/src/index.d.ts +22 -18
  7. package/dist/src/index.js +47 -41
  8. package/dist/src/index.js.map +1 -1
  9. package/dist/src/lib/Constants.js +136 -116
  10. package/dist/src/lib/Constants.js.map +1 -1
  11. package/dist/src/lib/container/AsyncBoundaryPlugin.d.ts +20 -16
  12. package/dist/src/lib/container/AsyncBoundaryPlugin.js +137 -196
  13. package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
  14. package/dist/src/lib/container/ContainerEntryDependency.d.ts +25 -23
  15. package/dist/src/lib/container/ContainerEntryDependency.js +37 -39
  16. package/dist/src/lib/container/ContainerEntryDependency.js.map +1 -1
  17. package/dist/src/lib/container/ContainerEntryModule.d.ts +104 -79
  18. package/dist/src/lib/container/ContainerEntryModule.js +213 -234
  19. package/dist/src/lib/container/ContainerEntryModule.js.map +1 -1
  20. package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +15 -10
  21. package/dist/src/lib/container/ContainerEntryModuleFactory.js +21 -25
  22. package/dist/src/lib/container/ContainerEntryModuleFactory.js.map +1 -1
  23. package/dist/src/lib/container/ContainerExposedDependency.d.ts +26 -23
  24. package/dist/src/lib/container/ContainerExposedDependency.js +47 -47
  25. package/dist/src/lib/container/ContainerExposedDependency.js.map +1 -1
  26. package/dist/src/lib/container/ContainerPlugin.d.ts +12 -8
  27. package/dist/src/lib/container/ContainerPlugin.js +144 -213
  28. package/dist/src/lib/container/ContainerPlugin.js.map +1 -1
  29. package/dist/src/lib/container/ContainerReferencePlugin.d.ts +16 -12
  30. package/dist/src/lib/container/ContainerReferencePlugin.js +72 -101
  31. package/dist/src/lib/container/ContainerReferencePlugin.js.map +1 -1
  32. package/dist/src/lib/container/FallbackDependency.d.ts +24 -19
  33. package/dist/src/lib/container/FallbackDependency.js +46 -44
  34. package/dist/src/lib/container/FallbackDependency.js.map +1 -1
  35. package/dist/src/lib/container/FallbackItemDependency.d.ts +13 -8
  36. package/dist/src/lib/container/FallbackItemDependency.js +24 -24
  37. package/dist/src/lib/container/FallbackItemDependency.js.map +1 -1
  38. package/dist/src/lib/container/FallbackModule.d.ts +82 -71
  39. package/dist/src/lib/container/FallbackModule.js +133 -145
  40. package/dist/src/lib/container/FallbackModule.js.map +1 -1
  41. package/dist/src/lib/container/FallbackModuleFactory.d.ts +15 -10
  42. package/dist/src/lib/container/FallbackModuleFactory.js +20 -24
  43. package/dist/src/lib/container/FallbackModuleFactory.js.map +1 -1
  44. package/dist/src/lib/container/HoistContainerReferencesPlugin.d.ts +11 -7
  45. package/dist/src/lib/container/HoistContainerReferencesPlugin.js +124 -188
  46. package/dist/src/lib/container/HoistContainerReferencesPlugin.js.map +1 -1
  47. package/dist/src/lib/container/ModuleFederationPlugin.d.ts +20 -16
  48. package/dist/src/lib/container/ModuleFederationPlugin.js +151 -170
  49. package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -1
  50. package/dist/src/lib/container/RemoteModule.d.ts +83 -74
  51. package/dist/src/lib/container/RemoteModule.js +149 -153
  52. package/dist/src/lib/container/RemoteModule.js.map +1 -1
  53. package/dist/src/lib/container/RemoteRuntimeModule.d.ts +12 -7
  54. package/dist/src/lib/container/RemoteRuntimeModule.js +86 -120
  55. package/dist/src/lib/container/RemoteRuntimeModule.js.map +1 -1
  56. package/dist/src/lib/container/RemoteToExternalDependency.d.ts +13 -8
  57. package/dist/src/lib/container/RemoteToExternalDependency.js +25 -23
  58. package/dist/src/lib/container/RemoteToExternalDependency.js.map +1 -1
  59. package/dist/src/lib/container/constant.d.ts +3 -0
  60. package/dist/src/lib/container/constant.js +11 -14
  61. package/dist/src/lib/container/constant.js.map +1 -1
  62. package/dist/src/lib/container/options.d.ts +12 -3
  63. package/dist/src/lib/container/options.js +51 -69
  64. package/dist/src/lib/container/options.js.map +1 -1
  65. package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.d.ts +14 -9
  66. package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.js +56 -64
  67. package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.js.map +1 -1
  68. package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.d.ts +23 -19
  69. package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.js +70 -101
  70. package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.js.map +1 -1
  71. package/dist/src/lib/container/runtime/FederationModulesPlugin.d.ts +20 -16
  72. package/dist/src/lib/container/runtime/FederationModulesPlugin.js +38 -46
  73. package/dist/src/lib/container/runtime/FederationModulesPlugin.js.map +1 -1
  74. package/dist/src/lib/container/runtime/FederationRuntimeDependency.d.ts +9 -4
  75. package/dist/src/lib/container/runtime/FederationRuntimeDependency.js +16 -12
  76. package/dist/src/lib/container/runtime/FederationRuntimeDependency.js.map +1 -1
  77. package/dist/src/lib/container/runtime/FederationRuntimeModule.d.ts +16 -11
  78. package/dist/src/lib/container/runtime/FederationRuntimeModule.js +39 -46
  79. package/dist/src/lib/container/runtime/FederationRuntimeModule.js.map +1 -1
  80. package/dist/src/lib/container/runtime/FederationRuntimePlugin.d.ts +31 -18
  81. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +263 -293
  82. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -1
  83. package/dist/src/lib/container/runtime/getFederationGlobal.d.ts +9 -4
  84. package/dist/src/lib/container/runtime/getFederationGlobal.js +43 -41
  85. package/dist/src/lib/container/runtime/getFederationGlobal.js.map +1 -1
  86. package/dist/src/lib/container/runtime/normalizeToPosixPath.d.ts +5 -0
  87. package/dist/src/lib/container/runtime/normalizeToPosixPath.js +20 -0
  88. package/dist/src/lib/container/runtime/normalizeToPosixPath.js.map +1 -0
  89. package/dist/src/lib/container/runtime/utils.d.ts +22 -7
  90. package/dist/src/lib/container/runtime/utils.js +80 -102
  91. package/dist/src/lib/container/runtime/utils.js.map +1 -1
  92. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +15 -10
  93. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js +27 -25
  94. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -1
  95. package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +77 -67
  96. package/dist/src/lib/sharing/ConsumeSharedModule.js +190 -214
  97. package/dist/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
  98. package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +13 -9
  99. package/dist/src/lib/sharing/ConsumeSharedPlugin.js +308 -472
  100. package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
  101. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +16 -11
  102. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +108 -123
  103. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
  104. package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +14 -9
  105. package/dist/src/lib/sharing/ProvideForSharedDependency.js +25 -25
  106. package/dist/src/lib/sharing/ProvideForSharedDependency.js.map +1 -1
  107. package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +44 -38
  108. package/dist/src/lib/sharing/ProvideSharedDependency.js +72 -74
  109. package/dist/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
  110. package/dist/src/lib/sharing/ProvideSharedModule.d.ts +91 -81
  111. package/dist/src/lib/sharing/ProvideSharedModule.js +177 -181
  112. package/dist/src/lib/sharing/ProvideSharedModule.js.map +1 -1
  113. package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +14 -9
  114. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +19 -25
  115. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
  116. package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +27 -21
  117. package/dist/src/lib/sharing/ProvideSharedPlugin.js +341 -548
  118. package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
  119. package/dist/src/lib/sharing/SharePlugin.d.ts +55 -12
  120. package/dist/src/lib/sharing/SharePlugin.js +91 -91
  121. package/dist/src/lib/sharing/SharePlugin.js.map +1 -1
  122. package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +12 -7
  123. package/dist/src/lib/sharing/ShareRuntimeModule.js +81 -99
  124. package/dist/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
  125. package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +11 -7
  126. package/dist/src/lib/sharing/resolveMatchedConfigs.js +58 -71
  127. package/dist/src/lib/sharing/resolveMatchedConfigs.js.map +1 -1
  128. package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.d.ts +25 -0
  129. package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js +85 -0
  130. package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js.map +1 -0
  131. package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.d.ts +41 -0
  132. package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js +227 -0
  133. package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js.map +1 -0
  134. package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.d.ts +26 -0
  135. package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js +32 -0
  136. package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js.map +1 -0
  137. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.d.ts +32 -0
  138. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js +94 -0
  139. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js.map +1 -0
  140. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.d.ts +31 -0
  141. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js +49 -0
  142. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js.map +1 -0
  143. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.d.ts +22 -0
  144. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js +35 -0
  145. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js.map +1 -0
  146. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.d.ts +87 -0
  147. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js +144 -0
  148. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js.map +1 -0
  149. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts +16 -0
  150. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js +23 -0
  151. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js.map +1 -0
  152. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.d.ts +23 -0
  153. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js +163 -0
  154. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js.map +1 -0
  155. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.d.ts +22 -0
  156. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js +28 -0
  157. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js.map +1 -0
  158. package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.d.ts +20 -0
  159. package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js +44 -0
  160. package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js.map +1 -0
  161. package/dist/src/lib/sharing/utils.d.ts +27 -23
  162. package/dist/src/lib/sharing/utils.js +224 -366
  163. package/dist/src/lib/sharing/utils.js.map +1 -1
  164. package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.d.ts +11 -7
  165. package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js +56 -75
  166. package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js.map +1 -1
  167. package/dist/src/lib/startup/StartupHelpers.d.ts +11 -6
  168. package/dist/src/lib/startup/StartupHelpers.js +128 -178
  169. package/dist/src/lib/startup/StartupHelpers.js.map +1 -1
  170. package/dist/src/rspack.d.ts +3 -2
  171. package/dist/src/rspack.js +35 -10
  172. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +8 -4
  173. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -16
  174. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -1
  175. package/dist/src/runtime.d.ts +1 -1
  176. package/dist/src/runtime.js +11 -18
  177. package/dist/src/runtime.mjs +3 -0
  178. package/dist/src/schemas/container/ContainerPlugin.check.d.ts +13 -5
  179. package/dist/src/schemas/container/ContainerPlugin.check.js +767 -1220
  180. package/dist/src/schemas/container/ContainerPlugin.check.js.map +1 -1
  181. package/dist/src/schemas/container/ContainerPlugin.d.ts +267 -268
  182. package/dist/src/schemas/container/ContainerPlugin.js +269 -361
  183. package/dist/src/schemas/container/ContainerPlugin.js.map +1 -1
  184. package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +13 -5
  185. package/dist/src/schemas/container/ContainerReferencePlugin.check.js +335 -443
  186. package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +1 -1
  187. package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +102 -99
  188. package/dist/src/schemas/container/ContainerReferencePlugin.js +122 -162
  189. package/dist/src/schemas/container/ContainerReferencePlugin.js.map +1 -1
  190. package/dist/src/schemas/container/ExternalsType.check.d.ts +13 -5
  191. package/dist/src/schemas/container/ExternalsType.check.js +36 -62
  192. package/dist/src/schemas/container/ExternalsType.check.js.map +1 -1
  193. package/dist/src/schemas/container/ExternalsType.d.ts +5 -2
  194. package/dist/src/schemas/container/ExternalsType.js +8 -11
  195. package/dist/src/schemas/container/ExternalsType.js.map +1 -1
  196. package/dist/src/schemas/container/ModuleFederationPlugin.check.js +3020 -4301
  197. package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -1
  198. package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +828 -758
  199. package/dist/src/schemas/container/ModuleFederationPlugin.js +788 -993
  200. package/dist/src/schemas/container/ModuleFederationPlugin.js.map +1 -1
  201. package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.d.ts +13 -5
  202. package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js +568 -739
  203. package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js.map +1 -1
  204. package/dist/src/schemas/sharing/ConsumeSharedPlugin.d.ts +197 -189
  205. package/dist/src/schemas/sharing/ConsumeSharedPlugin.js +212 -233
  206. package/dist/src/schemas/sharing/ConsumeSharedPlugin.js.map +1 -1
  207. package/dist/src/schemas/sharing/ProvideSharedPlugin.check.d.ts +13 -5
  208. package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js +598 -775
  209. package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js.map +1 -1
  210. package/dist/src/schemas/sharing/ProvideSharedPlugin.d.ts +184 -176
  211. package/dist/src/schemas/sharing/ProvideSharedPlugin.js +196 -224
  212. package/dist/src/schemas/sharing/ProvideSharedPlugin.js.map +1 -1
  213. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +12 -4
  214. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +285 -482
  215. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +1 -1
  216. package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +103 -100
  217. package/dist/src/schemas/sharing/ProviderSharedPlugin.js +104 -126
  218. package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +1 -1
  219. package/dist/src/schemas/sharing/SharePlugin.check.d.ts +13 -5
  220. package/dist/src/schemas/sharing/SharePlugin.check.js +749 -794
  221. package/dist/src/schemas/sharing/SharePlugin.check.js.map +1 -1
  222. package/dist/src/schemas/sharing/SharePlugin.d.ts +245 -205
  223. package/dist/src/schemas/sharing/SharePlugin.js +256 -253
  224. package/dist/src/schemas/sharing/SharePlugin.js.map +1 -1
  225. package/dist/src/utils.d.ts +3 -0
  226. package/dist/src/utils.js +35 -26
  227. package/dist/src/utils.js.map +1 -1
  228. package/dist/src/webpack.d.ts +2 -2
  229. package/dist/src/webpack.js +6 -40
  230. package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +9 -7
  231. package/dist/src/wrapper/AsyncBoundaryPlugin.js +13 -17
  232. package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +1 -1
  233. package/dist/src/wrapper/BaseWrapperPlugin.d.ts +32 -0
  234. package/dist/src/wrapper/BaseWrapperPlugin.js +43 -0
  235. package/dist/src/wrapper/BaseWrapperPlugin.js.map +1 -0
  236. package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +10 -7
  237. package/dist/src/wrapper/ConsumeSharedPlugin.js +13 -17
  238. package/dist/src/wrapper/ConsumeSharedPlugin.js.map +1 -1
  239. package/dist/src/wrapper/ContainerPlugin.d.ts +9 -7
  240. package/dist/src/wrapper/ContainerPlugin.js +13 -17
  241. package/dist/src/wrapper/ContainerPlugin.js.map +1 -1
  242. package/dist/src/wrapper/ContainerReferencePlugin.d.ts +9 -7
  243. package/dist/src/wrapper/ContainerReferencePlugin.js +13 -17
  244. package/dist/src/wrapper/ContainerReferencePlugin.js.map +1 -1
  245. package/dist/src/wrapper/FederationModulesPlugin.d.ts +18 -10
  246. package/dist/src/wrapper/FederationModulesPlugin.js +20 -21
  247. package/dist/src/wrapper/FederationModulesPlugin.js.map +1 -1
  248. package/dist/src/wrapper/FederationRuntimePlugin.d.ts +11 -8
  249. package/dist/src/wrapper/FederationRuntimePlugin.js +19 -20
  250. package/dist/src/wrapper/FederationRuntimePlugin.js.map +1 -1
  251. package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +8 -5
  252. package/dist/src/wrapper/HoistContainerReferencesPlugin.js +13 -16
  253. package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +1 -1
  254. package/dist/src/wrapper/ModuleFederationPlugin.d.ts +12 -9
  255. package/dist/src/wrapper/ModuleFederationPlugin.js +71 -104
  256. package/dist/src/wrapper/ModuleFederationPlugin.js.map +1 -1
  257. package/dist/src/wrapper/ProvideSharedPlugin.d.ts +10 -7
  258. package/dist/src/wrapper/ProvideSharedPlugin.js +13 -17
  259. package/dist/src/wrapper/ProvideSharedPlugin.js.map +1 -1
  260. package/dist/src/wrapper/SharePlugin.d.ts +10 -7
  261. package/dist/src/wrapper/SharePlugin.js +13 -17
  262. package/dist/src/wrapper/SharePlugin.js.map +1 -1
  263. package/dist/src/wrapper/TreeShakingSharedPlugin.d.ts +10 -0
  264. package/dist/src/wrapper/TreeShakingSharedPlugin.js +15 -0
  265. package/dist/src/wrapper/TreeShakingSharedPlugin.js.map +1 -0
  266. package/package.json +27 -29
  267. package/dist/package.json +0 -110
  268. package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +0 -57
  269. package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +0 -33
  270. package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +0 -4
  271. package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +0 -28
  272. package/dist/src/declarations/plugins/container/Template.d.ts +0 -198
  273. package/dist/src/declarations/plugins/container/WebpackError.d.ts +0 -33
  274. package/dist/src/declarations/plugins/sharing/ConsumeSharedModule.d.ts +0 -82
  275. package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +0 -96
  276. package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +0 -98
  277. package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +0 -108
  278. package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.d.ts +0 -20
  279. package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js +0 -219
  280. package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js.map +0 -1
  281. package/dist/src/prefetch.d.ts +0 -2
  282. package/dist/src/prefetch.js +0 -8
  283. package/dist/src/prefetch.js.map +0 -1
  284. package/dist/src/rspack.js.map +0 -1
  285. package/dist/src/runtime.js.map +0 -1
  286. package/dist/src/types/runtime.d.ts +0 -10
  287. package/dist/src/types/runtime.js +0 -3
  288. package/dist/src/types/runtime.js.map +0 -1
  289. package/dist/src/webpack.js.map +0 -1
@@ -1,86 +1,111 @@
1
- import type { containerPlugin } from '@module-federation/sdk';
2
1
  import type { Compilation } from 'webpack';
3
- import type { InputFileSystem, LibIdentOptions, NeedBuildContext, ObjectDeserializerContext, ObjectSerializerContext, RequestShortener, ResolverWithOptions, WebpackOptions } from 'webpack/lib/Module';
2
+ import type {
3
+ InputFileSystem,
4
+ LibIdentOptions,
5
+ NeedBuildContext,
6
+ ObjectDeserializerContext,
7
+ ObjectSerializerContext,
8
+ RequestShortener,
9
+ ResolverWithOptions,
10
+ WebpackOptions,
11
+ } from 'webpack/lib/Module';
4
12
  import type WebpackError from 'webpack/lib/WebpackError';
5
- declare const Module: typeof import("webpack").Module;
13
+ declare const Module: typeof import('webpack').Module;
6
14
  export type ExposeOptions = {
7
- /**
8
- * requests to exposed modules (last one is exported)
9
- */
10
- import: string[];
11
- /**
12
- * custom chunk name for the exposed module
13
- */
14
- name: string;
15
+ /**
16
+ * requests to exposed modules (last one is exported)
17
+ */
18
+ import: string[];
19
+ /**
20
+ * custom chunk name for the exposed module
21
+ */
22
+ name: string;
15
23
  };
16
24
  declare class ContainerEntryModule extends Module {
17
- private _name;
18
- private _exposes;
19
- private _shareScope;
20
- private _injectRuntimeEntry;
21
- private _dataPrefetch;
22
- /**
23
- * @param {string} name container entry name
24
- * @param {[string, ExposeOptions][]} exposes list of exposed modules
25
- * @param {string|string[]} shareScope name of the share scope
26
- * @param {string} injectRuntimeEntry the path of injectRuntime file.
27
- * @param {containerPlugin.ContainerPluginOptions['dataPrefetch']} dataPrefetch whether enable dataPrefetch
28
- */
29
- constructor(name: string, exposes: [string, ExposeOptions][], shareScope: string | string[], injectRuntimeEntry: string, dataPrefetch: containerPlugin.ContainerPluginOptions['dataPrefetch']);
30
- /**
31
- * @param {ObjectDeserializerContext} context context
32
- * @returns {ContainerEntryModule} deserialized container entry module
33
- */
34
- static deserialize(context: ObjectDeserializerContext): ContainerEntryModule;
35
- /**
36
- * @returns {Set<string>} types available (do not mutate)
37
- */
38
- getSourceTypes(): Set<string>;
39
- /**
40
- * @returns {string} a unique identifier of the module
41
- */
42
- identifier(): string;
43
- /**
44
- * @param {RequestShortener} requestShortener the request shortener
45
- * @returns {string} a user readable identifier of the module
46
- */
47
- readableIdentifier(requestShortener: RequestShortener): string;
48
- /**
49
- * @param {LibIdentOptions} options options
50
- * @returns {string | null} an identifier for library inclusion
51
- */
52
- libIdent(options: LibIdentOptions): string | null;
53
- /**
54
- * @param {NeedBuildContext} context context info
55
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
56
- * @returns {void}
57
- */
58
- needBuild(context: NeedBuildContext, callback: (arg0: (WebpackError | null) | undefined, arg1: boolean | undefined) => void): void;
59
- /**
60
- * @param {WebpackOptions} options webpack options
61
- * @param {Compilation} compilation the compilation
62
- * @param {ResolverWithOptions} resolver the resolver
63
- * @param {InputFileSystem} fs the file system
64
- * @param {function(WebpackError): void} callback callback function
65
- * @returns {void}
66
- */
67
- build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError) => void): void;
68
- /**
69
- * @param {CodeGenerationContext} context context for code generation
70
- * @returns {CodeGenerationResult} result
71
- */
72
- codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }: any): {
73
- sources: Map<any, any>;
74
- runtimeRequirements: Set<"__webpack_require__.d" | "__webpack_require__.o" | "__webpack_exports__">;
75
- };
76
- /**
77
- * @param {string=} type the source type for which the size should be estimated
78
- * @returns {number} the estimated size of the module (must be non-zero)
79
- */
80
- size(type?: string): number;
81
- /**
82
- * @param {ObjectSerializerContext} context context
83
- */
84
- serialize(context: ObjectSerializerContext): void;
25
+ private _name;
26
+ private _exposes;
27
+ private _shareScope;
28
+ private _injectRuntimeEntry;
29
+ /**
30
+ * @param {string} name container entry name
31
+ * @param {[string, ExposeOptions][]} exposes list of exposed modules
32
+ * @param {string|string[]} shareScope name of the share scope
33
+ * @param {string} injectRuntimeEntry the path of injectRuntime file.
34
+ */
35
+ constructor(
36
+ name: string,
37
+ exposes: [string, ExposeOptions][],
38
+ shareScope: string | string[],
39
+ injectRuntimeEntry: string,
40
+ );
41
+ /**
42
+ * @param {ObjectDeserializerContext} context context
43
+ * @returns {ContainerEntryModule} deserialized container entry module
44
+ */
45
+ static deserialize(context: ObjectDeserializerContext): ContainerEntryModule;
46
+ /**
47
+ * @returns {Set<string>} types available (do not mutate)
48
+ */
49
+ getSourceTypes(): Set<string>;
50
+ /**
51
+ * @returns {string} a unique identifier of the module
52
+ */
53
+ identifier(): string;
54
+ /**
55
+ * @param {RequestShortener} requestShortener the request shortener
56
+ * @returns {string} a user readable identifier of the module
57
+ */
58
+ readableIdentifier(requestShortener: RequestShortener): string;
59
+ /**
60
+ * @param {LibIdentOptions} options options
61
+ * @returns {string | null} an identifier for library inclusion
62
+ */
63
+ libIdent(options: LibIdentOptions): string | null;
64
+ /**
65
+ * @param {NeedBuildContext} context context info
66
+ * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
67
+ * @returns {void}
68
+ */
69
+ needBuild(
70
+ context: NeedBuildContext,
71
+ callback: (
72
+ arg0: (WebpackError | null) | undefined,
73
+ arg1: boolean | undefined,
74
+ ) => void,
75
+ ): void;
76
+ /**
77
+ * @param {WebpackOptions} options webpack options
78
+ * @param {Compilation} compilation the compilation
79
+ * @param {ResolverWithOptions} resolver the resolver
80
+ * @param {InputFileSystem} fs the file system
81
+ * @param {function(WebpackError): void} callback callback function
82
+ * @returns {void}
83
+ */
84
+ build(
85
+ options: WebpackOptions,
86
+ compilation: Compilation,
87
+ resolver: ResolverWithOptions,
88
+ fs: InputFileSystem,
89
+ callback: (err?: WebpackError) => void,
90
+ ): void;
91
+ /**
92
+ * @param {CodeGenerationContext} context context for code generation
93
+ * @returns {CodeGenerationResult} result
94
+ */
95
+ codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }: any): {
96
+ sources: Map<any, any>;
97
+ runtimeRequirements: Set<
98
+ '__webpack_exports__' | '__webpack_require__.d' | '__webpack_require__.o'
99
+ >;
100
+ };
101
+ /**
102
+ * @param {string=} type the source type for which the size should be estimated
103
+ * @returns {number} the estimated size of the module (must be non-zero)
104
+ */
105
+ size(type?: string): number;
106
+ /**
107
+ * @param {ObjectSerializerContext} context context
108
+ */
109
+ serialize(context: ObjectSerializerContext): void;
85
110
  }
86
111
  export default ContainerEntryModule;
@@ -1,238 +1,217 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
4
- */
5
1
  'use strict';
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_lib_Constants = require('../Constants.js');
6
+ const require_lib_container_ContainerExposedDependency = require('./ContainerExposedDependency.js');
7
+ const require_lib_container_runtime_utils = require('./runtime/utils.js');
8
+ let _module_federation_sdk = require("@module-federation/sdk");
9
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
10
+ let _module_federation_error_codes = require("@module-federation/error-codes");
11
+ let _module_federation_error_codes_node = require("@module-federation/error-codes/node");
12
+
13
+ //#region src/lib/container/ContainerEntryModule.ts
14
+ const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
15
+ const { sources: webpackSources, AsyncDependenciesBlock, Template, Module, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
16
+ const StaticExportsDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/StaticExportsDependency"));
17
+ const EntryDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/EntryDependency"));
18
+ const SOURCE_TYPES = new Set(["javascript"]);
19
+ var ContainerEntryModule = class ContainerEntryModule extends Module {
20
+ /**
21
+ * @param {string} name container entry name
22
+ * @param {[string, ExposeOptions][]} exposes list of exposed modules
23
+ * @param {string|string[]} shareScope name of the share scope
24
+ * @param {string} injectRuntimeEntry the path of injectRuntime file.
25
+ */
26
+ constructor(name, exposes, shareScope, injectRuntimeEntry) {
27
+ super(require_lib_Constants.JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
28
+ this._name = name;
29
+ this._exposes = exposes;
30
+ this._shareScope = shareScope;
31
+ this._injectRuntimeEntry = injectRuntimeEntry;
32
+ }
33
+ /**
34
+ * @param {ObjectDeserializerContext} context context
35
+ * @returns {ContainerEntryModule} deserialized container entry module
36
+ */
37
+ static deserialize(context) {
38
+ const { read } = context;
39
+ const obj = new ContainerEntryModule(read(), read(), read(), read());
40
+ obj.deserialize(context);
41
+ return obj;
42
+ }
43
+ /**
44
+ * @returns {Set<string>} types available (do not mutate)
45
+ */
46
+ getSourceTypes() {
47
+ return SOURCE_TYPES;
48
+ }
49
+ /**
50
+ * @returns {string} a unique identifier of the module
51
+ */
52
+ identifier() {
53
+ return `container entry (${Array.isArray(this._shareScope) ? this._shareScope.join("|") : this._shareScope}) ${JSON.stringify(this._exposes)} ${this._injectRuntimeEntry}`;
54
+ }
55
+ /**
56
+ * @param {RequestShortener} requestShortener the request shortener
57
+ * @returns {string} a user readable identifier of the module
58
+ */
59
+ readableIdentifier(requestShortener) {
60
+ return "container entry";
61
+ }
62
+ /**
63
+ * @param {LibIdentOptions} options options
64
+ * @returns {string | null} an identifier for library inclusion
65
+ */
66
+ libIdent(options) {
67
+ return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${this._name}`;
68
+ }
69
+ /**
70
+ * @param {NeedBuildContext} context context info
71
+ * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
72
+ * @returns {void}
73
+ */
74
+ needBuild(context, callback) {
75
+ callback(null, !this.buildMeta);
76
+ }
77
+ /**
78
+ * @param {WebpackOptions} options webpack options
79
+ * @param {Compilation} compilation the compilation
80
+ * @param {ResolverWithOptions} resolver the resolver
81
+ * @param {InputFileSystem} fs the file system
82
+ * @param {function(WebpackError): void} callback callback function
83
+ * @returns {void}
84
+ */
85
+ build(options, compilation, resolver, fs, callback) {
86
+ this.buildMeta = {};
87
+ this.buildInfo = {
88
+ strict: true,
89
+ topLevelDeclarations: new Set([
90
+ "moduleMap",
91
+ "get",
92
+ "init"
93
+ ])
94
+ };
95
+ this.buildMeta.exportsType = "namespace";
96
+ this.clearDependenciesAndBlocks();
97
+ for (const [name, options] of this._exposes) {
98
+ const block = new AsyncDependenciesBlock({ name: options.name }, { name }, options.import[options.import.length - 1]);
99
+ let idx = 0;
100
+ for (const request of options.import) {
101
+ const dep = new require_lib_container_ContainerExposedDependency.default(name, request);
102
+ dep.loc = {
103
+ name,
104
+ index: idx++
105
+ };
106
+ block.addDependency(dep);
107
+ }
108
+ this.addBlock(block);
109
+ }
110
+ this.addDependency(new StaticExportsDependency(["get", "init"], false));
111
+ this.addDependency(new EntryDependency(this._injectRuntimeEntry));
112
+ callback();
113
+ }
114
+ /**
115
+ * @param {CodeGenerationContext} context context for code generation
116
+ * @returns {CodeGenerationResult} result
117
+ */
118
+ codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {
119
+ const sources = /* @__PURE__ */ new Map();
120
+ const runtimeRequirements = new Set([
121
+ RuntimeGlobals.definePropertyGetters,
122
+ RuntimeGlobals.hasOwnProperty,
123
+ RuntimeGlobals.exports
124
+ ]);
125
+ const getters = [];
126
+ for (const block of this.blocks) {
127
+ const { dependencies } = block;
128
+ const modules = dependencies.map((dependency) => {
129
+ const dep = dependency;
130
+ return {
131
+ name: dep.exposedName,
132
+ module: moduleGraph.getModule(dep),
133
+ request: dep.userRequest
134
+ };
135
+ });
136
+ let str;
137
+ if (modules.some((m) => !m.module)) {
138
+ (0, _module_federation_error_codes_node.logAndReport)(_module_federation_error_codes.BUILD_001, _module_federation_error_codes.buildDescMap, {
139
+ exposeModules: modules.filter((m) => !m.module),
140
+ FEDERATION_WEBPACK_PATH: process.env["FEDERATION_WEBPACK_PATH"]
141
+ }, _module_federation_sdk.infrastructureLogger.error.bind(_module_federation_sdk.infrastructureLogger), void 0, {
142
+ bundler: { name: "webpack" },
143
+ mfConfig: {
144
+ name: this._name,
145
+ exposes: Object.fromEntries(this._exposes.map(([key, opts]) => [key, opts.import[opts.import.length - 1]]))
146
+ }
147
+ });
148
+ process.exit(1);
149
+ } else str = `return ${runtimeTemplate.blockPromise({
150
+ block,
151
+ message: "",
152
+ chunkGraph,
153
+ runtimeRequirements
154
+ })}.then(${runtimeTemplate.returningFunction(runtimeTemplate.returningFunction(`(${modules.map(({ module, request }) => runtimeTemplate.moduleRaw({
155
+ module,
156
+ chunkGraph,
157
+ request,
158
+ weak: false,
159
+ runtimeRequirements
160
+ })).join(", ")})`))});`;
161
+ getters.push(`${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction("", str)}`);
162
+ }
163
+ const federationGlobal = require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals || {});
164
+ const source = Template.asString([
165
+ `var moduleMap = {`,
166
+ Template.indent(getters.join(",\n")),
167
+ "};",
168
+ `var get = ${runtimeTemplate.basicFunction("module, getScope", [
169
+ `${RuntimeGlobals.currentRemoteGetScope} = getScope;`,
170
+ "getScope = (",
171
+ Template.indent([`${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`, Template.indent(["? moduleMap[module]()", `: Promise.resolve().then(${runtimeTemplate.basicFunction("", "throw new Error('Module \"' + module + '\" does not exist in container.');")})`])]),
172
+ ");",
173
+ `${RuntimeGlobals.currentRemoteGetScope} = undefined;`,
174
+ "return getScope;"
175
+ ])};`,
176
+ `var init = ${runtimeTemplate.basicFunction("shareScope, initScope, remoteEntryInitOptions", [`return ${federationGlobal}.bundlerRuntime.initContainerEntry({${Template.indent([
177
+ `webpackRequire: ${RuntimeGlobals.require},`,
178
+ `shareScope: shareScope,`,
179
+ `initScope: initScope,`,
180
+ `remoteEntryInitOptions: remoteEntryInitOptions,`,
181
+ `shareScopeKey: ${JSON.stringify(this._shareScope)}`
182
+ ])}`, "})"])};`,
183
+ "// This exports getters to disallow modifications",
184
+ `${RuntimeGlobals.definePropertyGetters}(exports, {`,
185
+ Template.indent([`get: ${runtimeTemplate.returningFunction("get")},`, `init: ${runtimeTemplate.returningFunction("init")}`]),
186
+ "});"
187
+ ]);
188
+ sources.set("javascript", this.useSourceMap || this.useSimpleSourceMap ? new webpackSources.OriginalSource(source, "webpack/container-entry") : new webpackSources.RawSource(source));
189
+ return {
190
+ sources,
191
+ runtimeRequirements
192
+ };
193
+ }
194
+ /**
195
+ * @param {string=} type the source type for which the size should be estimated
196
+ * @returns {number} the estimated size of the module (must be non-zero)
197
+ */
198
+ size(type) {
199
+ return 42;
200
+ }
201
+ /**
202
+ * @param {ObjectSerializerContext} context context
203
+ */
204
+ serialize(context) {
205
+ const { write } = context;
206
+ write(this._name);
207
+ write(this._exposes);
208
+ write(this._shareScope);
209
+ write(this._injectRuntimeEntry);
210
+ super.serialize(context);
211
+ }
8
212
  };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
11
- const sdk_1 = require("@module-federation/sdk");
12
- const error_codes_1 = require("@module-federation/error-codes");
13
- const cli_1 = require("@module-federation/data-prefetch/cli");
14
- const Constants_1 = require("../Constants");
15
- const ContainerExposedDependency_1 = __importDefault(require("./ContainerExposedDependency"));
16
- const utils_1 = require("./runtime/utils");
17
- const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
18
- const { sources: webpackSources, AsyncDependenciesBlock, Template, Module, RuntimeGlobals, } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
19
- const StaticExportsDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/StaticExportsDependency'));
20
- const EntryDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/EntryDependency'));
21
- const SOURCE_TYPES = new Set(['javascript']);
22
- class ContainerEntryModule extends Module {
23
- /**
24
- * @param {string} name container entry name
25
- * @param {[string, ExposeOptions][]} exposes list of exposed modules
26
- * @param {string|string[]} shareScope name of the share scope
27
- * @param {string} injectRuntimeEntry the path of injectRuntime file.
28
- * @param {containerPlugin.ContainerPluginOptions['dataPrefetch']} dataPrefetch whether enable dataPrefetch
29
- */
30
- constructor(name, exposes, shareScope, injectRuntimeEntry, dataPrefetch) {
31
- super(Constants_1.JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
32
- this._name = name;
33
- this._exposes = exposes;
34
- this._shareScope = shareScope;
35
- this._injectRuntimeEntry = injectRuntimeEntry;
36
- this._dataPrefetch = dataPrefetch;
37
- }
38
- /**
39
- * @param {ObjectDeserializerContext} context context
40
- * @returns {ContainerEntryModule} deserialized container entry module
41
- */
42
- static deserialize(context) {
43
- const { read } = context;
44
- const obj = new ContainerEntryModule(read(), read(), read(), read(), read());
45
- obj.deserialize(context);
46
- return obj;
47
- }
48
- /**
49
- * @returns {Set<string>} types available (do not mutate)
50
- */
51
- getSourceTypes() {
52
- return SOURCE_TYPES;
53
- }
54
- /**
55
- * @returns {string} a unique identifier of the module
56
- */
57
- identifier() {
58
- const scopeStr = Array.isArray(this._shareScope)
59
- ? this._shareScope.join('|')
60
- : this._shareScope;
61
- return `container entry (${scopeStr}) ${JSON.stringify(this._exposes)} ${this._injectRuntimeEntry} ${JSON.stringify(this._dataPrefetch)}`;
62
- }
63
- /**
64
- * @param {RequestShortener} requestShortener the request shortener
65
- * @returns {string} a user readable identifier of the module
66
- */
67
- readableIdentifier(requestShortener) {
68
- return 'container entry';
69
- }
70
- /**
71
- * @param {LibIdentOptions} options options
72
- * @returns {string | null} an identifier for library inclusion
73
- */
74
- libIdent(options) {
75
- return `${this.layer ? `(${this.layer})/` : ''}webpack/container/entry/${this._name}`;
76
- }
77
- /**
78
- * @param {NeedBuildContext} context context info
79
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
80
- * @returns {void}
81
- */
82
- needBuild(context, callback) {
83
- callback(null, !this.buildMeta);
84
- }
85
- /**
86
- * @param {WebpackOptions} options webpack options
87
- * @param {Compilation} compilation the compilation
88
- * @param {ResolverWithOptions} resolver the resolver
89
- * @param {InputFileSystem} fs the file system
90
- * @param {function(WebpackError): void} callback callback function
91
- * @returns {void}
92
- */
93
- build(options, compilation, resolver, fs, callback) {
94
- this.buildMeta = {};
95
- this.buildInfo = {
96
- strict: true,
97
- topLevelDeclarations: new Set(['moduleMap', 'get', 'init']),
98
- };
99
- this.buildMeta.exportsType = 'namespace';
100
- this.clearDependenciesAndBlocks();
101
- for (const [name, options] of this._exposes) {
102
- const block = new AsyncDependenciesBlock({
103
- name: options.name,
104
- }, { name }, options.import[options.import.length - 1]);
105
- let idx = 0;
106
- for (const request of options.import) {
107
- const dep = new ContainerExposedDependency_1.default(name, request);
108
- dep.loc = {
109
- name,
110
- index: idx++,
111
- };
112
- block.addDependency(dep);
113
- }
114
- this.addBlock(block);
115
- }
116
- this.addDependency(new StaticExportsDependency(['get', 'init'], false));
117
- this.addDependency(new EntryDependency(this._injectRuntimeEntry));
118
- callback();
119
- }
120
- /**
121
- * @param {CodeGenerationContext} context context for code generation
122
- * @returns {CodeGenerationResult} result
123
- */
124
- codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {
125
- const sources = new Map();
126
- const runtimeRequirements = new Set([
127
- RuntimeGlobals.definePropertyGetters,
128
- RuntimeGlobals.hasOwnProperty,
129
- RuntimeGlobals.exports,
130
- ]);
131
- const getters = [];
132
- for (const block of this.blocks) {
133
- const { dependencies } = block;
134
- const modules = dependencies.map((dependency) => {
135
- const dep = dependency;
136
- return {
137
- name: dep.exposedName,
138
- module: moduleGraph.getModule(dep),
139
- request: dep.userRequest,
140
- };
141
- });
142
- let str;
143
- if (modules.some((m) => !m.module)) {
144
- sdk_1.infrastructureLogger.error((0, error_codes_1.getShortErrorMsg)(error_codes_1.BUILD_001, error_codes_1.buildDescMap, {
145
- exposeModules: modules.filter((m) => !m.module),
146
- FEDERATION_WEBPACK_PATH: process.env['FEDERATION_WEBPACK_PATH'],
147
- }));
148
- process.exit(1);
149
- }
150
- else {
151
- str = `return ${runtimeTemplate.blockPromise({
152
- block,
153
- message: '',
154
- chunkGraph,
155
- runtimeRequirements,
156
- })}.then(${runtimeTemplate.returningFunction(runtimeTemplate.returningFunction(`(${modules
157
- .map(({ module, request }) => runtimeTemplate.moduleRaw({
158
- module,
159
- chunkGraph,
160
- request,
161
- weak: false,
162
- runtimeRequirements,
163
- }))
164
- .join(', ')})`))});`;
165
- }
166
- getters.push(`${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction('', str)}`);
167
- }
168
- const federationGlobal = (0, utils_1.getFederationGlobalScope)(RuntimeGlobals || {});
169
- const source = Template.asString([
170
- `var moduleMap = {`,
171
- Template.indent(getters.join(',\n')),
172
- '};',
173
- `var get = ${runtimeTemplate.basicFunction('module, getScope', [
174
- `${RuntimeGlobals.currentRemoteGetScope} = getScope;`,
175
- // reusing the getScope variable to avoid creating a new var (and module is also used later)
176
- 'getScope = (',
177
- Template.indent([
178
- `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`,
179
- Template.indent([
180
- '? moduleMap[module]()',
181
- `: Promise.resolve().then(${runtimeTemplate.basicFunction('', "throw new Error('Module \"' + module + '\" does not exist in container.');")})`,
182
- ]),
183
- ]),
184
- ');',
185
- `${RuntimeGlobals.currentRemoteGetScope} = undefined;`,
186
- 'return getScope;',
187
- ])};`,
188
- `var init = ${runtimeTemplate.basicFunction('shareScope, initScope, remoteEntryInitOptions', [
189
- `return ${federationGlobal}.bundlerRuntime.initContainerEntry({${Template.indent([
190
- `webpackRequire: ${RuntimeGlobals.require},`,
191
- `shareScope: shareScope,`,
192
- `initScope: initScope,`,
193
- `remoteEntryInitOptions: remoteEntryInitOptions,`,
194
- `shareScopeKey: ${JSON.stringify(this._shareScope)}`,
195
- ])}`,
196
- '})',
197
- ])};`,
198
- this._dataPrefetch ? cli_1.PrefetchPlugin.setRemoteIdentifier() : '',
199
- this._dataPrefetch ? cli_1.PrefetchPlugin.removeRemoteIdentifier() : '',
200
- '// This exports getters to disallow modifications',
201
- `${RuntimeGlobals.definePropertyGetters}(exports, {`,
202
- Template.indent([
203
- `get: ${runtimeTemplate.returningFunction('get')},`,
204
- `init: ${runtimeTemplate.returningFunction('init')}`,
205
- ]),
206
- '});',
207
- ]);
208
- sources.set('javascript', this.useSourceMap || this.useSimpleSourceMap
209
- ? new webpackSources.OriginalSource(source, 'webpack/container-entry')
210
- : new webpackSources.RawSource(source));
211
- return {
212
- sources,
213
- runtimeRequirements,
214
- };
215
- }
216
- /**
217
- * @param {string=} type the source type for which the size should be estimated
218
- * @returns {number} the estimated size of the module (must be non-zero)
219
- */
220
- size(type) {
221
- return 42;
222
- }
223
- /**
224
- * @param {ObjectSerializerContext} context context
225
- */
226
- serialize(context) {
227
- const { write } = context;
228
- write(this._name);
229
- write(this._exposes);
230
- write(this._shareScope);
231
- write(this._injectRuntimeEntry);
232
- write(this._dataPrefetch);
233
- super.serialize(context);
234
- }
235
- }
236
- makeSerializable(ContainerEntryModule, 'enhanced/lib/container/ContainerEntryModule');
213
+ makeSerializable(ContainerEntryModule, "enhanced/lib/container/ContainerEntryModule");
214
+
215
+ //#endregion
237
216
  exports.default = ContainerEntryModule;
238
217
  //# sourceMappingURL=ContainerEntryModule.js.map