@module-federation/enhanced 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/dist/CHANGELOG.md +2357 -0
  2. package/dist/README.md +213 -0
  3. package/dist/rstestmigrate.md +140 -0
  4. package/dist/src/_virtual/_rolldown/runtime.js +47 -0
  5. package/dist/src/index.d.ts +22 -19
  6. package/dist/src/index.js +47 -43
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/lib/Constants.d.ts +25 -29
  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 -200
  13. package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
  14. package/dist/src/lib/container/ContainerEntryDependency.d.ts +28 -23
  15. package/dist/src/lib/container/ContainerEntryDependency.js +39 -39
  16. package/dist/src/lib/container/ContainerEntryDependency.js.map +1 -1
  17. package/dist/src/lib/container/ContainerEntryModule.d.ts +93 -84
  18. package/dist/src/lib/container/ContainerEntryModule.js +219 -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 +29 -24
  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 +147 -211
  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 +74 -102
  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 +125 -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 +143 -181
  49. package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -1
  50. package/dist/src/lib/container/RemoteModule.d.ts +79 -74
  51. package/dist/src/lib/container/RemoteModule.js +143 -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 -132
  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 +7 -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 +71 -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 +55 -47
  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 -20
  81. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +265 -358
  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/utils.d.ts +24 -13
  87. package/dist/src/lib/container/runtime/utils.js +83 -101
  88. package/dist/src/lib/container/runtime/utils.js.map +1 -1
  89. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +15 -10
  90. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js +27 -25
  91. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -1
  92. package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +77 -68
  93. package/dist/src/lib/sharing/ConsumeSharedModule.js +186 -214
  94. package/dist/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
  95. package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +13 -9
  96. package/dist/src/lib/sharing/ConsumeSharedPlugin.js +308 -475
  97. package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
  98. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +16 -11
  99. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +107 -137
  100. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
  101. package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +14 -9
  102. package/dist/src/lib/sharing/ProvideForSharedDependency.js +25 -25
  103. package/dist/src/lib/sharing/ProvideForSharedDependency.js.map +1 -1
  104. package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +44 -39
  105. package/dist/src/lib/sharing/ProvideSharedDependency.js +72 -76
  106. package/dist/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
  107. package/dist/src/lib/sharing/ProvideSharedModule.d.ts +91 -82
  108. package/dist/src/lib/sharing/ProvideSharedModule.js +177 -184
  109. package/dist/src/lib/sharing/ProvideSharedModule.js.map +1 -1
  110. package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +14 -9
  111. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +19 -25
  112. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
  113. package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +27 -21
  114. package/dist/src/lib/sharing/ProvideSharedPlugin.js +341 -550
  115. package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
  116. package/dist/src/lib/sharing/SharePlugin.d.ts +53 -49
  117. package/dist/src/lib/sharing/SharePlugin.js +86 -100
  118. package/dist/src/lib/sharing/SharePlugin.js.map +1 -1
  119. package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +12 -7
  120. package/dist/src/lib/sharing/ShareRuntimeModule.js +81 -103
  121. package/dist/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
  122. package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +11 -7
  123. package/dist/src/lib/sharing/resolveMatchedConfigs.js +58 -71
  124. package/dist/src/lib/sharing/resolveMatchedConfigs.js.map +1 -1
  125. package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.d.ts +18 -14
  126. package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js +74 -128
  127. package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js.map +1 -1
  128. package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.d.ts +39 -34
  129. package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js +234 -328
  130. package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js.map +1 -1
  131. package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.d.ts +16 -11
  132. package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js +30 -28
  133. package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js.map +1 -1
  134. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.d.ts +28 -24
  135. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js +91 -95
  136. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js.map +1 -1
  137. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.d.ts +29 -24
  138. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js +47 -43
  139. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js.map +1 -1
  140. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.d.ts +20 -15
  141. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js +33 -29
  142. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js.map +1 -1
  143. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.d.ts +85 -77
  144. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js +141 -153
  145. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js.map +1 -1
  146. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts +15 -10
  147. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js +20 -24
  148. package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js.map +1 -1
  149. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.d.ts +21 -16
  150. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js +157 -231
  151. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js.map +1 -1
  152. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.d.ts +14 -9
  153. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js +26 -27
  154. package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js.map +1 -1
  155. package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.d.ts +18 -13
  156. package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js +41 -49
  157. package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js.map +1 -1
  158. package/dist/src/lib/sharing/utils.d.ts +27 -24
  159. package/dist/src/lib/sharing/utils.js +224 -367
  160. package/dist/src/lib/sharing/utils.js.map +1 -1
  161. package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.d.ts +11 -7
  162. package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js +56 -75
  163. package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js.map +1 -1
  164. package/dist/src/lib/startup/StartupHelpers.d.ts +11 -6
  165. package/dist/src/lib/startup/StartupHelpers.js +128 -178
  166. package/dist/src/lib/startup/StartupHelpers.js.map +1 -1
  167. package/dist/src/prefetch.d.ts +3 -2
  168. package/dist/src/prefetch.js +17 -8
  169. package/dist/src/rspack.d.ts +3 -2
  170. package/dist/src/rspack.js +35 -11
  171. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +8 -4
  172. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -16
  173. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -1
  174. package/dist/src/runtime.d.ts +1 -1
  175. package/dist/src/runtime.js +11 -18
  176. package/dist/src/schemas/container/ContainerPlugin.check.d.ts +13 -5
  177. package/dist/src/schemas/container/ContainerPlugin.check.js +958 -1218
  178. package/dist/src/schemas/container/ContainerPlugin.check.js.map +1 -1
  179. package/dist/src/schemas/container/ContainerPlugin.d.ts +271 -268
  180. package/dist/src/schemas/container/ContainerPlugin.js +273 -361
  181. package/dist/src/schemas/container/ContainerPlugin.js.map +1 -1
  182. package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +13 -5
  183. package/dist/src/schemas/container/ContainerReferencePlugin.check.js +335 -443
  184. package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +1 -1
  185. package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +102 -99
  186. package/dist/src/schemas/container/ContainerReferencePlugin.js +122 -162
  187. package/dist/src/schemas/container/ContainerReferencePlugin.js.map +1 -1
  188. package/dist/src/schemas/container/ExternalsType.check.d.ts +13 -5
  189. package/dist/src/schemas/container/ExternalsType.check.js +36 -62
  190. package/dist/src/schemas/container/ExternalsType.check.js.map +1 -1
  191. package/dist/src/schemas/container/ExternalsType.d.ts +5 -2
  192. package/dist/src/schemas/container/ExternalsType.js +8 -11
  193. package/dist/src/schemas/container/ExternalsType.js.map +1 -1
  194. package/dist/src/schemas/container/ModuleFederationPlugin.check.js +3001 -4812
  195. package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -1
  196. package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +819 -814
  197. package/dist/src/schemas/container/ModuleFederationPlugin.js +780 -1053
  198. package/dist/src/schemas/container/ModuleFederationPlugin.js.map +1 -1
  199. package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.d.ts +13 -5
  200. package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js +568 -768
  201. package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js.map +1 -1
  202. package/dist/src/schemas/sharing/ConsumeSharedPlugin.d.ts +197 -194
  203. package/dist/src/schemas/sharing/ConsumeSharedPlugin.js +212 -238
  204. package/dist/src/schemas/sharing/ConsumeSharedPlugin.js.map +1 -1
  205. package/dist/src/schemas/sharing/ProvideSharedPlugin.check.d.ts +13 -5
  206. package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js +598 -804
  207. package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js.map +1 -1
  208. package/dist/src/schemas/sharing/ProvideSharedPlugin.d.ts +184 -181
  209. package/dist/src/schemas/sharing/ProvideSharedPlugin.js +196 -229
  210. package/dist/src/schemas/sharing/ProvideSharedPlugin.js.map +1 -1
  211. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +12 -4
  212. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +285 -482
  213. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +1 -1
  214. package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +103 -100
  215. package/dist/src/schemas/sharing/ProviderSharedPlugin.js +104 -126
  216. package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +1 -1
  217. package/dist/src/schemas/sharing/SharePlugin.check.d.ts +13 -5
  218. package/dist/src/schemas/sharing/SharePlugin.check.js +749 -965
  219. package/dist/src/schemas/sharing/SharePlugin.check.js.map +1 -1
  220. package/dist/src/schemas/sharing/SharePlugin.d.ts +245 -242
  221. package/dist/src/schemas/sharing/SharePlugin.js +256 -293
  222. package/dist/src/schemas/sharing/SharePlugin.js.map +1 -1
  223. package/dist/src/utils.d.ts +3 -0
  224. package/dist/src/utils.js +35 -26
  225. package/dist/src/utils.js.map +1 -1
  226. package/dist/src/webpack.d.ts +2 -2
  227. package/dist/src/webpack.js +6 -40
  228. package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +9 -4
  229. package/dist/src/wrapper/AsyncBoundaryPlugin.js +12 -11
  230. package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +1 -1
  231. package/dist/src/wrapper/BaseWrapperPlugin.d.ts +18 -13
  232. package/dist/src/wrapper/BaseWrapperPlugin.js +39 -39
  233. package/dist/src/wrapper/BaseWrapperPlugin.js.map +1 -1
  234. package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +10 -4
  235. package/dist/src/wrapper/ConsumeSharedPlugin.js +12 -11
  236. package/dist/src/wrapper/ConsumeSharedPlugin.js.map +1 -1
  237. package/dist/src/wrapper/ContainerPlugin.d.ts +9 -4
  238. package/dist/src/wrapper/ContainerPlugin.js +12 -11
  239. package/dist/src/wrapper/ContainerPlugin.js.map +1 -1
  240. package/dist/src/wrapper/ContainerReferencePlugin.d.ts +9 -4
  241. package/dist/src/wrapper/ContainerReferencePlugin.js +12 -11
  242. package/dist/src/wrapper/ContainerReferencePlugin.js.map +1 -1
  243. package/dist/src/wrapper/FederationModulesPlugin.d.ts +18 -10
  244. package/dist/src/wrapper/FederationModulesPlugin.js +19 -19
  245. package/dist/src/wrapper/FederationModulesPlugin.js.map +1 -1
  246. package/dist/src/wrapper/FederationRuntimePlugin.d.ts +11 -6
  247. package/dist/src/wrapper/FederationRuntimePlugin.js +18 -17
  248. package/dist/src/wrapper/FederationRuntimePlugin.js.map +1 -1
  249. package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +8 -3
  250. package/dist/src/wrapper/HoistContainerReferencesPlugin.js +12 -11
  251. package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +1 -1
  252. package/dist/src/wrapper/ModuleFederationPlugin.d.ts +12 -7
  253. package/dist/src/wrapper/ModuleFederationPlugin.js +73 -99
  254. package/dist/src/wrapper/ModuleFederationPlugin.js.map +1 -1
  255. package/dist/src/wrapper/ProvideSharedPlugin.d.ts +10 -4
  256. package/dist/src/wrapper/ProvideSharedPlugin.js +12 -11
  257. package/dist/src/wrapper/ProvideSharedPlugin.js.map +1 -1
  258. package/dist/src/wrapper/SharePlugin.d.ts +10 -4
  259. package/dist/src/wrapper/SharePlugin.js +12 -11
  260. package/dist/src/wrapper/SharePlugin.js.map +1 -1
  261. package/dist/src/wrapper/TreeShakingSharedPlugin.d.ts +9 -4
  262. package/dist/src/wrapper/TreeShakingSharedPlugin.js +12 -11
  263. package/dist/src/wrapper/TreeShakingSharedPlugin.js.map +1 -1
  264. package/package.json +20 -13
  265. package/dist/package.json +0 -110
  266. package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +0 -57
  267. package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +0 -33
  268. package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +0 -4
  269. package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +0 -28
  270. package/dist/src/declarations/plugins/container/Template.d.ts +0 -198
  271. package/dist/src/declarations/plugins/container/WebpackError.d.ts +0 -33
  272. package/dist/src/declarations/plugins/sharing/ConsumeSharedModule.d.ts +0 -86
  273. package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +0 -100
  274. package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +0 -102
  275. package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +0 -116
  276. package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.d.ts +0 -20
  277. package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js +0 -222
  278. package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js.map +0 -1
  279. package/dist/src/prefetch.js.map +0 -1
  280. package/dist/src/rspack.js.map +0 -1
  281. package/dist/src/runtime.js.map +0 -1
  282. package/dist/src/types/runtime.d.ts +0 -10
  283. package/dist/src/types/runtime.js +0 -3
  284. package/dist/src/types/runtime.js.map +0 -1
  285. package/dist/src/webpack.js.map +0 -1
@@ -1,104 +1,74 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
7
- const EmbedFederationRuntimeModule_1 = __importDefault(require("./EmbedFederationRuntimeModule"));
8
- const FederationModulesPlugin_1 = __importDefault(require("./FederationModulesPlugin"));
9
- const utils_1 = require("./utils");
10
- const { RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
11
- const PLUGIN_NAME = 'EmbedFederationRuntimePlugin';
12
- const federationGlobal = (0, utils_1.getFederationGlobalScope)(RuntimeGlobals);
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
3
+ const require_lib_container_runtime_FederationModulesPlugin = require('./FederationModulesPlugin.js');
4
+ const require_lib_container_runtime_utils = require('./utils.js');
5
+ const require_lib_container_runtime_EmbedFederationRuntimeModule = require('./EmbedFederationRuntimeModule.js');
6
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
7
+
8
+ //#region src/lib/container/runtime/EmbedFederationRuntimePlugin.ts
9
+ require_lib_container_runtime_FederationModulesPlugin.init_FederationModulesPlugin();
10
+ const { RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
11
+ const PLUGIN_NAME = "EmbedFederationRuntimePlugin";
12
+ const federationGlobal = require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals);
13
13
  /**
14
- * Plugin that embeds Module Federation runtime code into chunks.
15
- * It ensures proper initialization of federated modules and manages runtime requirements.
16
- */
17
- class EmbedFederationRuntimePlugin {
18
- constructor(options = {}) {
19
- this.processedChunks = new WeakMap();
20
- this.options = {
21
- enableForAllChunks: false,
22
- ...options,
23
- };
24
- }
25
- /**
26
- * Determines if runtime embedding should be enabled for a given chunk.
27
- */
28
- isEnabledForChunk(chunk) {
29
- // Disable for our special "build time chunk"
30
- if (chunk.id === 'build time chunk')
31
- return false;
32
- return this.options.enableForAllChunks || chunk.hasRuntime();
33
- }
34
- /**
35
- * Checks if a hook has already been tapped by this plugin.
36
- */
37
- isHookAlreadyTapped(taps, hookName) {
38
- return taps.some((tap) => tap.name === hookName);
39
- }
40
- apply(compiler) {
41
- // Prevent double application of the plugin.
42
- const compilationTaps = compiler.hooks.thisCompilation.taps || [];
43
- if (this.isHookAlreadyTapped(compilationTaps, PLUGIN_NAME)) {
44
- return;
45
- }
46
- // Tap into the compilation to modify renderStartup and runtime requirements.
47
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
48
- // --- Part 1: Modify renderStartup to append a startup call when none is added automatically ---
49
- const { renderStartup } = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
50
- renderStartup.tap(PLUGIN_NAME, (startupSource, _lastInlinedModule, renderContext) => {
51
- const { chunk, chunkGraph } = renderContext;
52
- if (!this.isEnabledForChunk(chunk)) {
53
- return startupSource;
54
- }
55
- const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
56
- const entryModuleCount = chunkGraph.getNumberOfEntryModules(chunk);
57
- // The default renderBootstrap automatically pushes a startup call when either:
58
- // - There is at least one entry module, OR
59
- // - runtimeRequirements.has(RuntimeGlobals.startupNoDefault) is true.
60
- if (entryModuleCount > 0 ||
61
- runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) {
62
- return startupSource;
63
- }
64
- // Otherwise, append a startup call.
65
- return new compiler.webpack.sources.ConcatSource(startupSource, '\n// Custom hook: appended startup call because none was added automatically\n', `${RuntimeGlobals.startup}();\n`);
66
- });
67
- // --- Part 2: Embed Federation Runtime Module and adjust runtime requirements ---
68
- const federationHooks = FederationModulesPlugin_1.default.getCompilationHooks(compilation);
69
- const containerEntrySet = new Set();
70
- // Proactively add startupOnlyBefore target chunks.
71
- compilation.hooks.additionalChunkRuntimeRequirements.tap(PLUGIN_NAME, (chunk, runtimeRequirements) => {
72
- if (!this.isEnabledForChunk(chunk)) {
73
- return;
74
- }
75
- runtimeRequirements.add(RuntimeGlobals.startupOnlyBefore);
76
- });
77
- // Collect federation runtime dependencies.
78
- federationHooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, (dependency) => {
79
- containerEntrySet.add(dependency);
80
- });
81
- // Handle additional runtime requirements when federation is enabled.
82
- const handleRuntimeRequirements = (chunk, runtimeRequirements) => {
83
- if (!this.isEnabledForChunk(chunk)) {
84
- return;
85
- }
86
- // Skip if already processed or if not a federation chunk.
87
- if (runtimeRequirements.has('embeddedFederationRuntime'))
88
- return;
89
- if (!runtimeRequirements.has(federationGlobal)) {
90
- return;
91
- }
92
- // Mark as embedded and add the runtime module.
93
- runtimeRequirements.add('embeddedFederationRuntime');
94
- const runtimeModule = new EmbedFederationRuntimeModule_1.default(containerEntrySet);
95
- compilation.addRuntimeModule(chunk, runtimeModule);
96
- };
97
- compilation.hooks.runtimeRequirementInTree
98
- .for(federationGlobal)
99
- .tap(PLUGIN_NAME, handleRuntimeRequirements);
100
- });
101
- }
102
- }
14
+ * Plugin that embeds Module Federation runtime code into chunks.
15
+ * It ensures proper initialization of federated modules and manages runtime requirements.
16
+ */
17
+ var EmbedFederationRuntimePlugin = class {
18
+ constructor(options = {}) {
19
+ this.processedChunks = /* @__PURE__ */ new WeakMap();
20
+ this.options = {
21
+ enableForAllChunks: false,
22
+ ...options
23
+ };
24
+ }
25
+ /**
26
+ * Determines if runtime embedding should be enabled for a given chunk.
27
+ */
28
+ isEnabledForChunk(chunk) {
29
+ if (chunk.id === "build time chunk") return false;
30
+ return this.options.enableForAllChunks || chunk.hasRuntime();
31
+ }
32
+ /**
33
+ * Checks if a hook has already been tapped by this plugin.
34
+ */
35
+ isHookAlreadyTapped(taps, hookName) {
36
+ return taps.some((tap) => tap.name === hookName);
37
+ }
38
+ apply(compiler) {
39
+ const compilationTaps = compiler.hooks.thisCompilation.taps || [];
40
+ if (this.isHookAlreadyTapped(compilationTaps, PLUGIN_NAME)) return;
41
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
42
+ const { renderStartup } = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
43
+ renderStartup.tap(PLUGIN_NAME, (startupSource, _lastInlinedModule, renderContext) => {
44
+ const { chunk, chunkGraph } = renderContext;
45
+ if (!this.isEnabledForChunk(chunk)) return startupSource;
46
+ const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
47
+ if (chunkGraph.getNumberOfEntryModules(chunk) > 0 || runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) return startupSource;
48
+ return new compiler.webpack.sources.ConcatSource(startupSource, "\n// Custom hook: appended startup call because none was added automatically\n", `${RuntimeGlobals.startup}();\n`);
49
+ });
50
+ const federationHooks = require_lib_container_runtime_FederationModulesPlugin.default.getCompilationHooks(compilation);
51
+ const containerEntrySet = /* @__PURE__ */ new Set();
52
+ compilation.hooks.additionalChunkRuntimeRequirements.tap(PLUGIN_NAME, (chunk, runtimeRequirements) => {
53
+ if (!this.isEnabledForChunk(chunk)) return;
54
+ runtimeRequirements.add(RuntimeGlobals.startupOnlyBefore);
55
+ });
56
+ federationHooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, (dependency) => {
57
+ containerEntrySet.add(dependency);
58
+ });
59
+ const handleRuntimeRequirements = (chunk, runtimeRequirements) => {
60
+ if (!this.isEnabledForChunk(chunk)) return;
61
+ if (runtimeRequirements.has("embeddedFederationRuntime")) return;
62
+ if (!runtimeRequirements.has(federationGlobal)) return;
63
+ runtimeRequirements.add("embeddedFederationRuntime");
64
+ const runtimeModule = new require_lib_container_runtime_EmbedFederationRuntimeModule.default(containerEntrySet);
65
+ compilation.addRuntimeModule(chunk, runtimeModule);
66
+ };
67
+ compilation.hooks.runtimeRequirementInTree.for(federationGlobal).tap(PLUGIN_NAME, handleRuntimeRequirements);
68
+ });
69
+ }
70
+ };
71
+
72
+ //#endregion
103
73
  exports.default = EmbedFederationRuntimePlugin;
104
74
  //# sourceMappingURL=EmbedFederationRuntimePlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedFederationRuntimePlugin.js","sourceRoot":"","sources":["../../../../../src/lib/container/runtime/EmbedFederationRuntimePlugin.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"EmbedFederationRuntimePlugin.js","names":["getFederationGlobalScope","FederationModulesPlugin","EmbedFederationRuntimeModule"],"sources":["../../../../../src/lib/container/runtime/EmbedFederationRuntimePlugin.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport EmbedFederationRuntimeModule from './EmbedFederationRuntimeModule';\nimport FederationModulesPlugin from './FederationModulesPlugin';\nimport type { Compiler, Chunk, Compilation } from 'webpack';\nimport { getFederationGlobalScope } from './utils';\nimport ContainerEntryDependency from '../ContainerEntryDependency';\nimport FederationRuntimeDependency from './FederationRuntimeDependency';\n\nconst { RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\nconst PLUGIN_NAME = 'EmbedFederationRuntimePlugin';\n\nconst federationGlobal = getFederationGlobalScope(RuntimeGlobals);\n\ninterface EmbedFederationRuntimePluginOptions {\n /**\n * Whether to enable runtime module embedding for all chunks.\n * If false, only chunks that explicitly require it will be embedded.\n */\n enableForAllChunks?: boolean;\n}\n\n/**\n * Plugin that embeds Module Federation runtime code into chunks.\n * It ensures proper initialization of federated modules and manages runtime requirements.\n */\nclass EmbedFederationRuntimePlugin {\n private readonly options: EmbedFederationRuntimePluginOptions;\n private readonly processedChunks = new WeakMap<Chunk, boolean>();\n\n constructor(options: EmbedFederationRuntimePluginOptions = {}) {\n this.options = {\n enableForAllChunks: false,\n ...options,\n };\n }\n\n /**\n * Determines if runtime embedding should be enabled for a given chunk.\n */\n private isEnabledForChunk(chunk: Chunk): boolean {\n // Disable for our special \"build time chunk\"\n if (chunk.id === 'build time chunk') return false;\n return this.options.enableForAllChunks || chunk.hasRuntime();\n }\n\n /**\n * Checks if a hook has already been tapped by this plugin.\n */\n private isHookAlreadyTapped(\n taps: Array<{ name: string }>,\n hookName: string,\n ): boolean {\n return taps.some((tap) => tap.name === hookName);\n }\n\n apply(compiler: Compiler): void {\n // Prevent double application of the plugin.\n const compilationTaps = compiler.hooks.thisCompilation.taps || [];\n if (this.isHookAlreadyTapped(compilationTaps, PLUGIN_NAME)) {\n return;\n }\n\n // Tap into the compilation to modify renderStartup and runtime requirements.\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: Compilation) => {\n // --- Part 1: Modify renderStartup to append a startup call when none is added automatically ---\n const { renderStartup } =\n compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(\n compilation,\n );\n\n renderStartup.tap(\n PLUGIN_NAME,\n (startupSource, _lastInlinedModule, renderContext) => {\n const { chunk, chunkGraph } = renderContext;\n\n if (!this.isEnabledForChunk(chunk)) {\n return startupSource;\n }\n\n const runtimeRequirements =\n chunkGraph.getTreeRuntimeRequirements(chunk);\n const entryModuleCount = chunkGraph.getNumberOfEntryModules(chunk);\n\n // The default renderBootstrap automatically pushes a startup call when either:\n // - There is at least one entry module, OR\n // - runtimeRequirements.has(RuntimeGlobals.startupNoDefault) is true.\n if (\n entryModuleCount > 0 ||\n runtimeRequirements.has(RuntimeGlobals.startupNoDefault)\n ) {\n return startupSource;\n }\n\n // Otherwise, append a startup call.\n return new compiler.webpack.sources.ConcatSource(\n startupSource,\n '\\n// Custom hook: appended startup call because none was added automatically\\n',\n `${RuntimeGlobals.startup}();\\n`,\n );\n },\n );\n\n // --- Part 2: Embed Federation Runtime Module and adjust runtime requirements ---\n const federationHooks =\n FederationModulesPlugin.getCompilationHooks(compilation);\n const containerEntrySet: Set<\n ContainerEntryDependency | FederationRuntimeDependency\n > = new Set();\n\n // Proactively add startupOnlyBefore target chunks.\n compilation.hooks.additionalChunkRuntimeRequirements.tap(\n PLUGIN_NAME,\n (chunk: Chunk, runtimeRequirements: Set<string>) => {\n if (!this.isEnabledForChunk(chunk)) {\n return;\n }\n runtimeRequirements.add(RuntimeGlobals.startupOnlyBefore);\n },\n );\n\n // Collect federation runtime dependencies.\n federationHooks.addFederationRuntimeDependency.tap(\n PLUGIN_NAME,\n (dependency: FederationRuntimeDependency) => {\n containerEntrySet.add(dependency);\n },\n );\n\n // Handle additional runtime requirements when federation is enabled.\n const handleRuntimeRequirements = (\n chunk: Chunk,\n runtimeRequirements: Set<string>,\n ) => {\n if (!this.isEnabledForChunk(chunk)) {\n return;\n }\n // Skip if already processed or if not a federation chunk.\n if (runtimeRequirements.has('embeddedFederationRuntime')) return;\n if (!runtimeRequirements.has(federationGlobal)) {\n return;\n }\n\n // Mark as embedded and add the runtime module.\n runtimeRequirements.add('embeddedFederationRuntime');\n const runtimeModule = new EmbedFederationRuntimeModule(\n containerEntrySet,\n );\n compilation.addRuntimeModule(chunk, runtimeModule);\n };\n\n compilation.hooks.runtimeRequirementInTree\n .for(federationGlobal)\n .tap(PLUGIN_NAME, handleRuntimeRequirements);\n },\n );\n }\n}\n\nexport default EmbedFederationRuntimePlugin;\n"],"mappings":";;;;;;;;oFAEgE;AAMhE,MAAM,EAAE,mBAAmB,gFACJ,UAAU,CAChC;AAED,MAAM,cAAc;AAEpB,MAAM,mBAAmBA,6DAAyB,eAAe;;;;;AAcjE,IAAM,+BAAN,MAAmC;CAIjC,YAAY,UAA+C,EAAE,EAAE;yCAF5B,IAAI,SAAyB;AAG9D,OAAK,UAAU;GACb,oBAAoB;GACpB,GAAG;GACJ;;;;;CAMH,AAAQ,kBAAkB,OAAuB;AAE/C,MAAI,MAAM,OAAO,mBAAoB,QAAO;AAC5C,SAAO,KAAK,QAAQ,sBAAsB,MAAM,YAAY;;;;;CAM9D,AAAQ,oBACN,MACA,UACS;AACT,SAAO,KAAK,MAAM,QAAQ,IAAI,SAAS,SAAS;;CAGlD,MAAM,UAA0B;EAE9B,MAAM,kBAAkB,SAAS,MAAM,gBAAgB,QAAQ,EAAE;AACjE,MAAI,KAAK,oBAAoB,iBAAiB,YAAY,CACxD;AAIF,WAAS,MAAM,gBAAgB,IAC7B,cACC,gBAA6B;GAE5B,MAAM,EAAE,kBACN,SAAS,QAAQ,WAAW,wBAAwB,oBAClD,YACD;AAEH,iBAAc,IACZ,cACC,eAAe,oBAAoB,kBAAkB;IACpD,MAAM,EAAE,OAAO,eAAe;AAE9B,QAAI,CAAC,KAAK,kBAAkB,MAAM,CAChC,QAAO;IAGT,MAAM,sBACJ,WAAW,2BAA2B,MAAM;AAM9C,QALyB,WAAW,wBAAwB,MAAM,GAM7C,KACnB,oBAAoB,IAAI,eAAe,iBAAiB,CAExD,QAAO;AAIT,WAAO,IAAI,SAAS,QAAQ,QAAQ,aAClC,eACA,kFACA,GAAG,eAAe,QAAQ,OAC3B;KAEJ;GAGD,MAAM,kBACJC,8DAAwB,oBAAoB,YAAY;GAC1D,MAAM,oCAEF,IAAI,KAAK;AAGb,eAAY,MAAM,mCAAmC,IACnD,cACC,OAAc,wBAAqC;AAClD,QAAI,CAAC,KAAK,kBAAkB,MAAM,CAChC;AAEF,wBAAoB,IAAI,eAAe,kBAAkB;KAE5D;AAGD,mBAAgB,+BAA+B,IAC7C,cACC,eAA4C;AAC3C,sBAAkB,IAAI,WAAW;KAEpC;GAGD,MAAM,6BACJ,OACA,wBACG;AACH,QAAI,CAAC,KAAK,kBAAkB,MAAM,CAChC;AAGF,QAAI,oBAAoB,IAAI,4BAA4B,CAAE;AAC1D,QAAI,CAAC,oBAAoB,IAAI,iBAAiB,CAC5C;AAIF,wBAAoB,IAAI,4BAA4B;IACpD,MAAM,gBAAgB,IAAIC,mEACxB,kBACD;AACD,gBAAY,iBAAiB,OAAO,cAAc;;AAGpD,eAAY,MAAM,yBACf,IAAI,iBAAiB,CACrB,IAAI,aAAa,0BAA0B;IAEjD"}
@@ -1,21 +1,25 @@
1
- import type { Compiler, Compilation as CompilationType } from 'webpack';
2
- import { SyncHook } from 'tapable';
3
- import ContainerEntryDependency from '../ContainerEntryDependency';
4
- import FederationRuntimeDependency from './FederationRuntimeDependency';
1
+ import ContainerEntryDependency from "../ContainerEntryDependency.js";
2
+ import FederationRuntimeDependency from "./FederationRuntimeDependency.js";
3
+ import { Compilation, Compiler } from "webpack";
4
+ import { SyncHook } from "tapable";
5
+
6
+ //#region src/lib/container/runtime/FederationModulesPlugin.d.ts
5
7
  /** @typedef {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} Bootstrap */
6
8
  type CompilationHooks = {
7
- addContainerEntryDependency: SyncHook<[ContainerEntryDependency], void>;
8
- addFederationRuntimeDependency: SyncHook<[FederationRuntimeDependency], void>;
9
- addRemoteDependency: SyncHook<[any], void>;
9
+ addContainerEntryDependency: SyncHook<[ContainerEntryDependency], void>;
10
+ addFederationRuntimeDependency: SyncHook<[FederationRuntimeDependency], void>;
11
+ addRemoteDependency: SyncHook<[any], void>;
10
12
  };
11
13
  declare class FederationModulesPlugin {
12
- options: any;
13
- /**
14
- * @param {Compilation} compilation the compilation
15
- * @returns {CompilationHooks} the attached hooks
16
- */
17
- static getCompilationHooks(compilation: CompilationType): CompilationHooks;
18
- constructor(options?: {});
19
- apply(compiler: Compiler): void;
14
+ options: any;
15
+ /**
16
+ * @param {Compilation} compilation the compilation
17
+ * @returns {CompilationHooks} the attached hooks
18
+ */
19
+ static getCompilationHooks(compilation: Compilation): CompilationHooks;
20
+ constructor(options?: {});
21
+ apply(compiler: Compiler): void;
20
22
  }
21
- export default FederationModulesPlugin;
23
+ //#endregion
24
+ export { FederationModulesPlugin as default };
25
+ //# sourceMappingURL=FederationModulesPlugin.d.ts.map
@@ -1,49 +1,57 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
4
- const Compilation = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/Compilation'));
5
- const tapable_1 = require("tapable");
6
- /** @type {WeakMap<import("webpack").Compilation, CompilationHooks>} */
7
- const compilationHooksMap = new WeakMap();
8
- const PLUGIN_NAME = 'FederationModulesPlugin';
9
- class FederationModulesPlugin {
10
- /**
11
- * @param {Compilation} compilation the compilation
12
- * @returns {CompilationHooks} the attached hooks
13
- */
14
- static getCompilationHooks(compilation) {
15
- // Avoid cross-realm instanceof checks (e.g., Jest VM modules) by using
16
- // a duck-typed verification of a Webpack Compilation-like object.
17
- const isLikelyCompilation = compilation &&
18
- typeof compilation === 'object' &&
19
- // @ts-ignore
20
- typeof compilation.hooks === 'object' &&
21
- // A couple of well-known hooks available on Webpack 5 compilations
22
- // @ts-ignore
23
- typeof compilation.hooks.processAssets?.tap === 'function';
24
- if (!isLikelyCompilation) {
25
- throw new TypeError("Invalid 'compilation' argument: expected a Webpack Compilation-like object");
26
- }
27
- let hooks = compilationHooksMap.get(compilation);
28
- if (hooks === undefined) {
29
- hooks = {
30
- addContainerEntryDependency: new tapable_1.SyncHook(['dependency']),
31
- addFederationRuntimeDependency: new tapable_1.SyncHook(['dependency']),
32
- addRemoteDependency: new tapable_1.SyncHook(['dependency']),
33
- };
34
- compilationHooksMap.set(compilation, hooks);
35
- }
36
- return hooks;
37
- }
38
- constructor(options = {}) {
39
- this.options = options;
40
- }
41
- apply(compiler) {
42
- compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation, { normalModuleFactory }) => {
43
- //@ts-ignore
44
- const hooks = FederationModulesPlugin.getCompilationHooks(compilation);
45
- });
46
- }
47
- }
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
3
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
4
+ let tapable = require("tapable");
5
+
6
+ //#region src/lib/container/runtime/FederationModulesPlugin.ts
7
+ var FederationModulesPlugin_exports = /* @__PURE__ */ require_runtime.__exportAll({ default: () => FederationModulesPlugin });
8
+ var compilationHooksMap, PLUGIN_NAME, FederationModulesPlugin;
9
+ var init_FederationModulesPlugin = require_runtime.__esmMin((() => {
10
+ require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/Compilation"));
11
+ compilationHooksMap = /* @__PURE__ */ new WeakMap();
12
+ PLUGIN_NAME = "FederationModulesPlugin";
13
+ FederationModulesPlugin = class FederationModulesPlugin {
14
+ /**
15
+ * @param {Compilation} compilation the compilation
16
+ * @returns {CompilationHooks} the attached hooks
17
+ */
18
+ static getCompilationHooks(compilation) {
19
+ if (!(compilation && typeof compilation === "object" && typeof compilation.hooks === "object" && typeof compilation.hooks.processAssets?.tap === "function")) throw new TypeError("Invalid 'compilation' argument: expected a Webpack Compilation-like object");
20
+ let hooks = compilationHooksMap.get(compilation);
21
+ if (hooks === void 0) {
22
+ hooks = {
23
+ addContainerEntryDependency: new tapable.SyncHook(["dependency"]),
24
+ addFederationRuntimeDependency: new tapable.SyncHook(["dependency"]),
25
+ addRemoteDependency: new tapable.SyncHook(["dependency"])
26
+ };
27
+ compilationHooksMap.set(compilation, hooks);
28
+ }
29
+ return hooks;
30
+ }
31
+ constructor(options = {}) {
32
+ this.options = options;
33
+ }
34
+ apply(compiler) {
35
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation, { normalModuleFactory }) => {
36
+ FederationModulesPlugin.getCompilationHooks(compilation);
37
+ });
38
+ }
39
+ };
40
+ }));
41
+
42
+ //#endregion
43
+ init_FederationModulesPlugin();
44
+ Object.defineProperty(exports, 'FederationModulesPlugin_exports', {
45
+ enumerable: true,
46
+ get: function () {
47
+ return FederationModulesPlugin_exports;
48
+ }
49
+ });
48
50
  exports.default = FederationModulesPlugin;
51
+ Object.defineProperty(exports, 'init_FederationModulesPlugin', {
52
+ enumerable: true,
53
+ get: function () {
54
+ return init_FederationModulesPlugin;
55
+ }
56
+ });
49
57
  //# sourceMappingURL=FederationModulesPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FederationModulesPlugin.js","sourceRoot":"","sources":["../../../../../src/lib/container/runtime/FederationModulesPlugin.ts"],"names":[],"mappings":";;AACA,0FAAqF;AAErF,MAAM,WAAW,GAAG,OAAO,CACzB,IAAA,6CAAoB,EAAC,yBAAyB,CAAC,CACJ,CAAC;AAC9C,qCAAmC;AAInC,uEAAuE;AACvE,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAqC,CAAC;AAE7E,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAU9C,MAAM,uBAAuB;IAG3B;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,WAA4B;QACrD,uEAAuE;QACvE,kEAAkE;QAClE,MAAM,mBAAmB,GACvB,WAAW;YACX,OAAO,WAAW,KAAK,QAAQ;YAC/B,aAAa;YACb,OAAQ,WAAmB,CAAC,KAAK,KAAK,QAAQ;YAC9C,mEAAmE;YACnE,aAAa;YACb,OAAQ,WAAmB,CAAC,KAAK,CAAC,aAAa,EAAE,GAAG,KAAK,UAAU,CAAC;QAEtE,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,MAAM,IAAI,SAAS,CACjB,4EAA4E,CAC7E,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,KAAK,GAAG;gBACN,2BAA2B,EAAE,IAAI,kBAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;gBACzD,8BAA8B,EAAE,IAAI,kBAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;gBAC5D,mBAAmB,EAAE,IAAI,kBAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;aAClD,CAAC;YACF,mBAAmB,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,YAAY,OAAO,GAAG,EAAE;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAC5B,WAAW,EACX,CAAC,WAA4B,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE;YACxD,YAAY;YACZ,MAAM,KAAK,GAAG,uBAAuB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACzE,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"FederationModulesPlugin.js","names":["SyncHook"],"sources":["../../../../../src/lib/container/runtime/FederationModulesPlugin.ts"],"sourcesContent":["import type { Compiler, Compilation as CompilationType } from 'webpack';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\nconst Compilation = require(\n normalizeWebpackPath('webpack/lib/Compilation'),\n) as typeof import('webpack/lib/Compilation');\nimport { SyncHook } from 'tapable';\nimport ContainerEntryDependency from '../ContainerEntryDependency';\nimport FederationRuntimeDependency from './FederationRuntimeDependency';\n\n/** @type {WeakMap<import(\"webpack\").Compilation, CompilationHooks>} */\nconst compilationHooksMap = new WeakMap<CompilationType, CompilationHooks>();\n\nconst PLUGIN_NAME = 'FederationModulesPlugin';\n\n/** @typedef {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} Bootstrap */\n\ntype CompilationHooks = {\n addContainerEntryDependency: SyncHook<[ContainerEntryDependency], void>;\n addFederationRuntimeDependency: SyncHook<[FederationRuntimeDependency], void>;\n addRemoteDependency: SyncHook<[any], void>;\n};\n\nclass FederationModulesPlugin {\n options: any;\n\n /**\n * @param {Compilation} compilation the compilation\n * @returns {CompilationHooks} the attached hooks\n */\n static getCompilationHooks(compilation: CompilationType): CompilationHooks {\n // Avoid cross-realm instanceof checks (e.g., Jest VM modules) by using\n // a duck-typed verification of a Webpack Compilation-like object.\n const isLikelyCompilation =\n compilation &&\n typeof compilation === 'object' &&\n // @ts-ignore\n typeof (compilation as any).hooks === 'object' &&\n // A couple of well-known hooks available on Webpack 5 compilations\n // @ts-ignore\n typeof (compilation as any).hooks.processAssets?.tap === 'function';\n\n if (!isLikelyCompilation) {\n throw new TypeError(\n \"Invalid 'compilation' argument: expected a Webpack Compilation-like object\",\n );\n }\n let hooks = compilationHooksMap.get(compilation);\n if (hooks === undefined) {\n hooks = {\n addContainerEntryDependency: new SyncHook(['dependency']),\n addFederationRuntimeDependency: new SyncHook(['dependency']),\n addRemoteDependency: new SyncHook(['dependency']),\n };\n compilationHooksMap.set(compilation, hooks);\n }\n return hooks;\n }\n\n constructor(options = {}) {\n this.options = options;\n }\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(\n PLUGIN_NAME,\n (compilation: CompilationType, { normalModuleFactory }) => {\n //@ts-ignore\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n },\n );\n }\n}\n\nexport default FederationModulesPlugin;\n"],"mappings":";;;;;;;;;AAGoB,iFACG,0BAA0B,CAChD;CAMK,sCAAsB,IAAI,SAA4C;CAEtE,cAAc;CAUd,0BAAN,MAAM,wBAAwB;;;;;EAO5B,OAAO,oBAAoB,aAAgD;AAYzE,OAAI,EARF,eACA,OAAO,gBAAgB,YAEvB,OAAQ,YAAoB,UAAU,YAGtC,OAAQ,YAAoB,MAAM,eAAe,QAAQ,YAGzD,OAAM,IAAI,UACR,6EACD;GAEH,IAAI,QAAQ,oBAAoB,IAAI,YAAY;AAChD,OAAI,UAAU,QAAW;AACvB,YAAQ;KACN,6BAA6B,IAAIA,iBAAS,CAAC,aAAa,CAAC;KACzD,gCAAgC,IAAIA,iBAAS,CAAC,aAAa,CAAC;KAC5D,qBAAqB,IAAIA,iBAAS,CAAC,aAAa,CAAC;KAClD;AACD,wBAAoB,IAAI,aAAa,MAAM;;AAE7C,UAAO;;EAGT,YAAY,UAAU,EAAE,EAAE;AACxB,QAAK,UAAU;;EAGjB,MAAM,UAAoB;AACxB,YAAS,MAAM,YAAY,IACzB,cACC,aAA8B,EAAE,0BAA0B;AAE3C,4BAAwB,oBAAoB,YAAY;KAEzE"}
@@ -1,6 +1,11 @@
1
- declare const ModuleDependency: typeof import("webpack/lib/dependencies/ModuleDependency");
1
+ import * as webpack_lib_dependencies_ModuleDependency0 from "webpack/lib/dependencies/ModuleDependency";
2
+
3
+ //#region src/lib/container/runtime/FederationRuntimeDependency.d.ts
4
+ declare const ModuleDependency: typeof webpack_lib_dependencies_ModuleDependency0;
2
5
  declare class FederationRuntimeDependency extends ModuleDependency {
3
- constructor(request: string);
4
- get type(): string;
6
+ constructor(request: string);
7
+ get type(): string;
5
8
  }
6
- export default FederationRuntimeDependency;
9
+ //#endregion
10
+ export { FederationRuntimeDependency as default };
11
+ //# sourceMappingURL=FederationRuntimeDependency.d.ts.map
@@ -1,14 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
4
- const ModuleDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/ModuleDependency'));
5
- class FederationRuntimeDependency extends ModuleDependency {
6
- constructor(request) {
7
- super(request);
8
- }
9
- get type() {
10
- return 'federation runtime dependency';
11
- }
12
- }
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
3
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
4
+
5
+ //#region src/lib/container/runtime/FederationRuntimeDependency.ts
6
+ const ModuleDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/ModuleDependency"));
7
+ var FederationRuntimeDependency = class extends ModuleDependency {
8
+ constructor(request) {
9
+ super(request);
10
+ }
11
+ get type() {
12
+ return "federation runtime dependency";
13
+ }
14
+ };
15
+
16
+ //#endregion
13
17
  exports.default = FederationRuntimeDependency;
14
18
  //# sourceMappingURL=FederationRuntimeDependency.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FederationRuntimeDependency.js","sourceRoot":"","sources":["../../../../../src/lib/container/runtime/FederationRuntimeDependency.ts"],"names":[],"mappings":";;AAAA,0FAAqF;AAErF,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,2CAA2C,CAAC,CACJ,CAAC;AAEhE,MAAM,2BAA4B,SAAQ,gBAAgB;IACxD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,IAAa,IAAI;QACf,OAAO,+BAA+B,CAAC;IACzC,CAAC;CACF;AAED,kBAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"FederationRuntimeDependency.js","names":[],"sources":["../../../../../src/lib/container/runtime/FederationRuntimeDependency.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\nconst ModuleDependency = require(\n normalizeWebpackPath('webpack/lib/dependencies/ModuleDependency'),\n) as typeof import('webpack/lib/dependencies/ModuleDependency');\n\nclass FederationRuntimeDependency extends ModuleDependency {\n constructor(request: string) {\n super(request);\n }\n\n override get type() {\n return 'federation runtime dependency';\n }\n}\n\nexport default FederationRuntimeDependency;\n"],"mappings":";;;;;AAEA,MAAM,mBAAmB,gFACF,4CAA4C,CAClE;AAED,IAAM,8BAAN,cAA0C,iBAAiB;CACzD,YAAY,SAAiB;AAC3B,QAAM,QAAQ;;CAGhB,IAAa,OAAO;AAClB,SAAO"}
@@ -1,13 +1,18 @@
1
- import { NormalizedRuntimeInitOptionsWithOutShared } from '../../../types/runtime';
2
- declare const RuntimeModule: typeof import("webpack").RuntimeModule;
1
+ import { NormalizedRuntimeInitOptionsWithOutShared } from "./utils.js";
2
+ import * as webpack$1 from "webpack";
3
+
4
+ //#region src/lib/container/runtime/FederationRuntimeModule.d.ts
5
+ declare const RuntimeModule: typeof webpack$1.RuntimeModule;
3
6
  declare class FederationRuntimeModule extends RuntimeModule {
4
- runtimeRequirements: ReadonlySet<string>;
5
- containerName: string;
6
- initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared;
7
- constructor(runtimeRequirements: ReadonlySet<string>, containerName: string, initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared);
8
- /**
9
- * @returns {string | null} runtime code
10
- */
11
- generate(): string;
7
+ runtimeRequirements: ReadonlySet<string>;
8
+ containerName: string;
9
+ initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared;
10
+ constructor(runtimeRequirements: ReadonlySet<string>, containerName: string, initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared);
11
+ /**
12
+ * @returns {string | null} runtime code
13
+ */
14
+ generate(): string;
12
15
  }
13
- export default FederationRuntimeModule;
16
+ //#endregion
17
+ export { FederationRuntimeModule as default };
18
+ //# sourceMappingURL=FederationRuntimeModule.d.ts.map
@@ -1,49 +1,42 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
3
+ const require_lib_container_runtime_getFederationGlobal = require('./getFederationGlobal.js');
4
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
5
+
6
+ //#region src/lib/container/runtime/FederationRuntimeModule.ts
7
+ const compileBooleanMatcher = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/compileBooleanMatcher"));
8
+ const { getUndoPath } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/identifier"));
9
+ const { RuntimeModule, RuntimeGlobals, Template } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
10
+ var FederationRuntimeModule = class extends RuntimeModule {
11
+ constructor(runtimeRequirements, containerName, initOptionsWithoutShared) {
12
+ super("federation runtime", RuntimeModule.STAGE_NORMAL - 1);
13
+ this.runtimeRequirements = runtimeRequirements;
14
+ this.containerName = containerName;
15
+ this.initOptionsWithoutShared = initOptionsWithoutShared;
16
+ }
17
+ /**
18
+ * @returns {string | null} runtime code
19
+ */
20
+ generate() {
21
+ let matcher = false;
22
+ let rootOutputDir;
23
+ if (this.compilation && this.chunk) {
24
+ const jsModulePlugin = this.compilation.compiler.webpack?.javascript?.JavascriptModulesPlugin || require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/javascript/JavascriptModulesPlugin"));
25
+ const { chunkHasJs } = jsModulePlugin;
26
+ if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) {
27
+ const hasJsMatcher = compileBooleanMatcher(this.compilation.chunkGraph.getChunkConditionMap(this.chunk, chunkHasJs));
28
+ if (typeof hasJsMatcher === "boolean") matcher = hasJsMatcher;
29
+ else matcher = hasJsMatcher("chunkId");
30
+ rootOutputDir = getUndoPath(this.compilation.getPath(jsModulePlugin.getChunkFilenameTemplate(this.chunk, this.compilation.outputOptions), {
31
+ chunk: this.chunk,
32
+ contentHashType: "javascript"
33
+ }), this.compilation.outputOptions.path || "", false);
34
+ }
35
+ }
36
+ return Template.asString([require_lib_container_runtime_getFederationGlobal.default(Template, RuntimeGlobals, matcher, rootOutputDir, this.initOptionsWithoutShared)]);
37
+ }
4
38
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
7
- const compileBooleanMatcher = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/compileBooleanMatcher'));
8
- const { getUndoPath } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/identifier'));
9
- // inspired by react-refresh-webpack-plugin
10
- const getFederationGlobal_1 = __importDefault(require("./getFederationGlobal"));
11
- const { RuntimeModule, RuntimeGlobals, Template } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
12
- class FederationRuntimeModule extends RuntimeModule {
13
- constructor(runtimeRequirements, containerName, initOptionsWithoutShared) {
14
- super('federation runtime', RuntimeModule.STAGE_NORMAL - 1);
15
- this.runtimeRequirements = runtimeRequirements;
16
- this.containerName = containerName;
17
- this.initOptionsWithoutShared = initOptionsWithoutShared;
18
- }
19
- /**
20
- * @returns {string | null} runtime code
21
- */
22
- generate() {
23
- let matcher = false;
24
- let rootOutputDir;
25
- if (this.compilation && this.chunk) {
26
- const jsModulePlugin = this.compilation.compiler.webpack?.javascript
27
- ?.JavascriptModulesPlugin ||
28
- require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/javascript/JavascriptModulesPlugin'));
29
- const { chunkHasJs } = jsModulePlugin;
30
- if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) {
31
- const conditionMap = this.compilation.chunkGraph.getChunkConditionMap(this.chunk, chunkHasJs);
32
- const hasJsMatcher = compileBooleanMatcher(conditionMap);
33
- if (typeof hasJsMatcher === 'boolean') {
34
- matcher = hasJsMatcher;
35
- }
36
- else {
37
- matcher = hasJsMatcher('chunkId');
38
- }
39
- const outputName = this.compilation.getPath(jsModulePlugin.getChunkFilenameTemplate(this.chunk, this.compilation.outputOptions), { chunk: this.chunk, contentHashType: 'javascript' });
40
- rootOutputDir = getUndoPath(outputName, this.compilation.outputOptions.path || '', false);
41
- }
42
- }
43
- return Template.asString([
44
- (0, getFederationGlobal_1.default)(Template, RuntimeGlobals, matcher, rootOutputDir, this.initOptionsWithoutShared),
45
- ]);
46
- }
47
- }
39
+
40
+ //#endregion
48
41
  exports.default = FederationRuntimeModule;
49
42
  //# sourceMappingURL=FederationRuntimeModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FederationRuntimeModule.js","sourceRoot":"","sources":["../../../../../src/lib/container/runtime/FederationRuntimeModule.ts"],"names":[],"mappings":";;;;;AAAA,0FAAqF;AACrF,MAAM,qBAAqB,GAAG,OAAO,CACnC,IAAA,6CAAoB,EAAC,wCAAwC,CAAC,CACJ,CAAC;AAC7D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAC7B,IAAA,6CAAoB,EAAC,6BAA6B,CAAC,CACJ,CAAC;AAClD,2CAA2C;AAC3C,gFAAwD;AAGxD,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CACzD,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,uBAAwB,SAAQ,aAAa;IAKjD,YACE,mBAAwC,EACxC,aAAqB,EACrB,wBAAmE;QAEnE,KAAK,CAAC,oBAAoB,EAAE,aAAa,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;IAC3D,CAAC;IAED;;OAEG;IACM,QAAQ;QACf,IAAI,OAAO,GAAqB,KAAK,CAAC;QACtC,IAAI,aAAiC,CAAC;QACtC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACnC,MAAM,cAAc,GAClB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU;gBAC3C,EAAE,uBAAuB;gBAC3B,OAAO,CACL,IAAA,6CAAoB,EAClB,gDAAgD,CACjD,CACF,CAAC;YACJ,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC;YACtC,IAAI,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBACrE,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,oBAAoB,CACnE,IAAI,CAAC,KAAK,EACV,UAAU,CACX,CAAC;gBACF,MAAM,YAAY,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;gBACzD,IAAI,OAAO,YAAY,KAAK,SAAS,EAAE,CAAC;oBACtC,OAAO,GAAG,YAAY,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;gBACpC,CAAC;gBACD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CACzC,cAAc,CAAC,wBAAwB,CACrC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,WAAW,CAAC,aAAa,CAC/B,EACD,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,CACrD,CAAC;gBACF,aAAa,GAAG,WAAW,CACzB,UAAU,EACV,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,EACzC,KAAK,CACN,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,IAAA,6BAAmB,EACjB,QAAQ,EACR,cAAc,EACd,OAAO,EACP,aAAa,EACb,IAAI,CAAC,wBAAwB,CAC9B;SACF,CAAC,CAAC;IACL,CAAC;CACF;AACD,kBAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"FederationRuntimeModule.js","names":["getFederationGlobal"],"sources":["../../../../../src/lib/container/runtime/FederationRuntimeModule.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nconst compileBooleanMatcher = require(\n normalizeWebpackPath('webpack/lib/util/compileBooleanMatcher'),\n) as typeof import('webpack/lib/util/compileBooleanMatcher');\nconst { getUndoPath } = require(\n normalizeWebpackPath('webpack/lib/util/identifier'),\n) as typeof import('webpack/lib/util/identifier');\n// inspired by react-refresh-webpack-plugin\nimport getFederationGlobal from './getFederationGlobal';\nimport type { NormalizedRuntimeInitOptionsWithOutShared } from './utils';\n\nconst { RuntimeModule, RuntimeGlobals, Template } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\nclass FederationRuntimeModule extends RuntimeModule {\n runtimeRequirements: ReadonlySet<string>;\n containerName: string;\n initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared;\n\n constructor(\n runtimeRequirements: ReadonlySet<string>,\n containerName: string,\n initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared,\n ) {\n super('federation runtime', RuntimeModule.STAGE_NORMAL - 1);\n this.runtimeRequirements = runtimeRequirements;\n this.containerName = containerName;\n this.initOptionsWithoutShared = initOptionsWithoutShared;\n }\n\n /**\n * @returns {string | null} runtime code\n */\n override generate() {\n let matcher: string | boolean = false;\n let rootOutputDir: string | undefined;\n if (this.compilation && this.chunk) {\n const jsModulePlugin =\n this.compilation.compiler.webpack?.javascript\n ?.JavascriptModulesPlugin ||\n require(\n normalizeWebpackPath(\n 'webpack/lib/javascript/JavascriptModulesPlugin',\n ),\n );\n const { chunkHasJs } = jsModulePlugin;\n if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) {\n const conditionMap = this.compilation.chunkGraph.getChunkConditionMap(\n this.chunk,\n chunkHasJs,\n );\n const hasJsMatcher = compileBooleanMatcher(conditionMap);\n if (typeof hasJsMatcher === 'boolean') {\n matcher = hasJsMatcher;\n } else {\n matcher = hasJsMatcher('chunkId');\n }\n const outputName = this.compilation.getPath(\n jsModulePlugin.getChunkFilenameTemplate(\n this.chunk,\n this.compilation.outputOptions,\n ),\n { chunk: this.chunk, contentHashType: 'javascript' },\n );\n rootOutputDir = getUndoPath(\n outputName,\n this.compilation.outputOptions.path || '',\n false,\n );\n }\n }\n\n return Template.asString([\n getFederationGlobal(\n Template,\n RuntimeGlobals,\n matcher,\n rootOutputDir,\n this.initOptionsWithoutShared,\n ),\n ]);\n }\n}\nexport default FederationRuntimeModule;\n"],"mappings":";;;;;;AACA,MAAM,wBAAwB,gFACP,yCAAyC,CAC/D;AACD,MAAM,EAAE,gBAAgB,gFACD,8BAA8B,CACpD;AAKD,MAAM,EAAE,eAAe,gBAAgB,aAAa,gFAC7B,UAAU,CAChC;AAED,IAAM,0BAAN,cAAsC,cAAc;CAKlD,YACE,qBACA,eACA,0BACA;AACA,QAAM,sBAAsB,cAAc,eAAe,EAAE;AAC3D,OAAK,sBAAsB;AAC3B,OAAK,gBAAgB;AACrB,OAAK,2BAA2B;;;;;CAMlC,AAAS,WAAW;EAClB,IAAI,UAA4B;EAChC,IAAI;AACJ,MAAI,KAAK,eAAe,KAAK,OAAO;GAClC,MAAM,iBACJ,KAAK,YAAY,SAAS,SAAS,YAC/B,2BACJ,gFAEI,iDACD,CACF;GACH,MAAM,EAAE,eAAe;AACvB,OAAI,KAAK,oBAAoB,IAAI,eAAe,oBAAoB,EAAE;IAKpE,MAAM,eAAe,sBAJA,KAAK,YAAY,WAAW,qBAC/C,KAAK,OACL,WACD,CACuD;AACxD,QAAI,OAAO,iBAAiB,UAC1B,WAAU;QAEV,WAAU,aAAa,UAAU;AASnC,oBAAgB,YAPG,KAAK,YAAY,QAClC,eAAe,yBACb,KAAK,OACL,KAAK,YAAY,cAClB,EACD;KAAE,OAAO,KAAK;KAAO,iBAAiB;KAAc,CACrD,EAGC,KAAK,YAAY,cAAc,QAAQ,IACvC,MACD;;;AAIL,SAAO,SAAS,SAAS,CACvBA,0DACE,UACA,gBACA,SACA,eACA,KAAK,yBACN,CACF,CAAC"}