@module-federation/enhanced 2.1.0 → 2.2.1

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 +2375 -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 +23 -14
  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,31 +1,35 @@
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 makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
5
- const { Dependency } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
6
- class SharedEntryDependency extends Dependency {
7
- /**
8
- * @param {string} name entry name
9
- * @param {string} request the request of the entry
10
- */
11
- constructor(name, request) {
12
- super();
13
- this.name = name;
14
- this.request = request;
15
- }
16
- /**
17
- * @returns {string | null} an identifier to merge equal requests
18
- */
19
- getResourceIdentifier() {
20
- return `shared-entry-${this.name}`;
21
- }
22
- get type() {
23
- return 'shared entry';
24
- }
25
- get category() {
26
- return 'esm';
27
- }
28
- }
29
- makeSerializable(SharedEntryDependency, 'enhanced/lib/container/SharedEntryDependency');
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/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.ts
6
+ const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
7
+ const { Dependency } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
8
+ var SharedEntryDependency = class extends Dependency {
9
+ /**
10
+ * @param {string} name entry name
11
+ * @param {string} request the request of the entry
12
+ */
13
+ constructor(name, request) {
14
+ super();
15
+ this.name = name;
16
+ this.request = request;
17
+ }
18
+ /**
19
+ * @returns {string | null} an identifier to merge equal requests
20
+ */
21
+ getResourceIdentifier() {
22
+ return `shared-entry-${this.name}`;
23
+ }
24
+ get type() {
25
+ return "shared entry";
26
+ }
27
+ get category() {
28
+ return "esm";
29
+ }
30
+ };
31
+ makeSerializable(SharedEntryDependency, "enhanced/lib/container/SharedEntryDependency");
32
+
33
+ //#endregion
30
34
  exports.default = SharedEntryDependency;
31
35
  //# sourceMappingURL=SharedEntryDependency.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SharedEntryDependency.js","sourceRoot":"","sources":["../../../../../../src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.ts"],"names":[],"mappings":";;AAAA,0FAAqF;AAErF,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CAC1D,CAAC;AACF,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAC5B,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,qBAAsB,SAAQ,UAAU;IAI5C;;;OAGG;IACH,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACM,qBAAqB;QAC5B,OAAO,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC;IACrC,CAAC;IAED,IAAa,IAAI;QACf,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,IAAa,QAAQ;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,gBAAgB,CACd,qBAAqB,EACrB,8CAA8C,CAC/C,CAAC;AAEF,kBAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"SharedEntryDependency.js","names":[],"sources":["../../../../../../src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n);\nconst { Dependency } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\nclass SharedEntryDependency extends Dependency {\n public name: string;\n public request: string;\n\n /**\n * @param {string} name entry name\n * @param {string} request the request of the entry\n */\n constructor(name: string, request: string) {\n super();\n this.name = name;\n this.request = request;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `shared-entry-${this.name}`;\n }\n\n override get type(): string {\n return 'shared entry';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n SharedEntryDependency,\n 'enhanced/lib/container/SharedEntryDependency',\n);\n\nexport default SharedEntryDependency;\n"],"mappings":";;;;;AAEA,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;AACD,MAAM,EAAE,eAAe,gFACA,UAAU,CAChC;AAED,IAAM,wBAAN,cAAoC,WAAW;;;;;CAQ7C,YAAY,MAAc,SAAiB;AACzC,SAAO;AACP,OAAK,OAAO;AACZ,OAAK,UAAU;;;;;CAMjB,AAAS,wBAAuC;AAC9C,SAAO,gBAAgB,KAAK;;CAG9B,IAAa,OAAe;AAC1B,SAAO;;CAGT,IAAa,WAAmB;AAC9B,SAAO;;;AAIX,iBACE,uBACA,+CACD"}
@@ -1,79 +1,87 @@
1
- import type { Compilation } from 'webpack';
2
- import type { CodeGenerationResult, InputFileSystem, LibIdentOptions, NeedBuildContext, ObjectDeserializerContext, ObjectSerializerContext, RequestShortener, ResolverWithOptions, WebpackOptions } from 'webpack/lib/Module';
3
- import type WebpackError from 'webpack/lib/WebpackError';
4
- declare const Module: typeof import("webpack").Module;
5
- export type ExposeOptions = {
6
- /**
7
- * requests to exposed modules (last one is exported)
8
- */
9
- import: string[];
10
- /**
11
- * custom chunk name for the exposed module
12
- */
13
- name: string;
1
+ import * as webpack$1 from "webpack";
2
+ import { Compilation } from "webpack";
3
+ import { CodeGenerationResult, InputFileSystem, LibIdentOptions, NeedBuildContext, ObjectDeserializerContext, ObjectSerializerContext, RequestShortener, ResolverWithOptions, WebpackOptions } from "webpack/lib/Module";
4
+ import WebpackError$1 from "webpack/lib/WebpackError";
5
+
6
+ //#region src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.d.ts
7
+ declare const Module$1: typeof webpack$1.Module;
8
+ type ExposeOptions = {
9
+ /**
10
+ * requests to exposed modules (last one is exported)
11
+ */
12
+ import: string[];
13
+ /**
14
+ * custom chunk name for the exposed module
15
+ */
16
+ name: string;
14
17
  };
15
- declare class SharedEntryModule extends Module {
16
- private _name;
17
- private _request;
18
- /**
19
- * @param {string} name shared name
20
- * @param {string} request request
21
- */
22
- constructor(name: string, request: string);
23
- /**
24
- * @param {ObjectDeserializerContext} context context
25
- * @returns {SharedEntryModule} deserialized container entry module
26
- */
27
- static deserialize(context: ObjectDeserializerContext): SharedEntryModule;
28
- /**
29
- * @returns {Set<string>} types available (do not mutate)
30
- */
31
- getSourceTypes(): Set<string>;
32
- /**
33
- * @returns {string} a unique identifier of the module
34
- */
35
- identifier(): string;
36
- /**
37
- * @param {RequestShortener} requestShortener the request shortener
38
- * @returns {string} a user readable identifier of the module
39
- */
40
- readableIdentifier(requestShortener: RequestShortener): string;
41
- /**
42
- * @param {LibIdentOptions} options options
43
- * @returns {string | null} an identifier for library inclusion
44
- */
45
- libIdent(options: LibIdentOptions): string | null;
46
- /**
47
- * @param {NeedBuildContext} context context info
48
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
49
- * @returns {void}
50
- */
51
- needBuild(context: NeedBuildContext, callback: (arg0: (WebpackError | null) | undefined, arg1: boolean | undefined) => void): void;
52
- /**
53
- * @param {WebpackOptions} options webpack options
54
- * @param {Compilation} compilation the compilation
55
- * @param {ResolverWithOptions} resolver the resolver
56
- * @param {InputFileSystem} fs the file system
57
- * @param {function(WebpackError): void} callback callback function
58
- * @returns {void}
59
- */
60
- build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError) => void): void;
61
- /**
62
- * @param {CodeGenerationContext} context context for code generation
63
- * @returns {CodeGenerationResult} result
64
- */
65
- codeGeneration({ chunkGraph, runtimeTemplate, }: CodeGenerationResult): {
66
- sources: Map<any, any>;
67
- runtimeRequirements: Set<"__webpack_require__.d" | "__webpack_require__.o" | "__webpack_exports__">;
68
- };
69
- /**
70
- * @param {string=} type the source type for which the size should be estimated
71
- * @returns {number} the estimated size of the module (must be non-zero)
72
- */
73
- size(type?: string): number;
74
- /**
75
- * @param {ObjectSerializerContext} context context
76
- */
77
- serialize(context: ObjectSerializerContext): void;
18
+ declare class SharedEntryModule extends Module$1 {
19
+ private _name;
20
+ private _request;
21
+ /**
22
+ * @param {string} name shared name
23
+ * @param {string} request request
24
+ */
25
+ constructor(name: string, request: string);
26
+ /**
27
+ * @param {ObjectDeserializerContext} context context
28
+ * @returns {SharedEntryModule} deserialized container entry module
29
+ */
30
+ static deserialize(context: ObjectDeserializerContext): SharedEntryModule;
31
+ /**
32
+ * @returns {Set<string>} types available (do not mutate)
33
+ */
34
+ getSourceTypes(): Set<string>;
35
+ /**
36
+ * @returns {string} a unique identifier of the module
37
+ */
38
+ identifier(): string;
39
+ /**
40
+ * @param {RequestShortener} requestShortener the request shortener
41
+ * @returns {string} a user readable identifier of the module
42
+ */
43
+ readableIdentifier(requestShortener: RequestShortener): string;
44
+ /**
45
+ * @param {LibIdentOptions} options options
46
+ * @returns {string | null} an identifier for library inclusion
47
+ */
48
+ libIdent(options: LibIdentOptions): string | null;
49
+ /**
50
+ * @param {NeedBuildContext} context context info
51
+ * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
52
+ * @returns {void}
53
+ */
54
+ needBuild(context: NeedBuildContext, callback: (arg0: (WebpackError$1 | null) | undefined, arg1: boolean | undefined) => void): void;
55
+ /**
56
+ * @param {WebpackOptions} options webpack options
57
+ * @param {Compilation} compilation the compilation
58
+ * @param {ResolverWithOptions} resolver the resolver
59
+ * @param {InputFileSystem} fs the file system
60
+ * @param {function(WebpackError): void} callback callback function
61
+ * @returns {void}
62
+ */
63
+ build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError$1) => void): void;
64
+ /**
65
+ * @param {CodeGenerationContext} context context for code generation
66
+ * @returns {CodeGenerationResult} result
67
+ */
68
+ codeGeneration({
69
+ chunkGraph,
70
+ runtimeTemplate
71
+ }: CodeGenerationResult): {
72
+ sources: Map<any, any>;
73
+ runtimeRequirements: Set<"__webpack_require__.d" | "__webpack_require__.o" | "__webpack_exports__">;
74
+ };
75
+ /**
76
+ * @param {string=} type the source type for which the size should be estimated
77
+ * @returns {number} the estimated size of the module (must be non-zero)
78
+ */
79
+ size(type?: string): number;
80
+ /**
81
+ * @param {ObjectSerializerContext} context context
82
+ */
83
+ serialize(context: ObjectSerializerContext): void;
78
84
  }
79
- export default SharedEntryModule;
85
+ //#endregion
86
+ export { ExposeOptions, SharedEntryModule as default };
87
+ //# sourceMappingURL=SharedEntryModule.d.ts.map
@@ -1,156 +1,144 @@
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_utils = require('../../../container/runtime/utils.js');
4
+ const require_lib_sharing_tree_shaking_SharedContainerPlugin_SharedDependency = require('./SharedDependency.js');
5
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
6
+
7
+ //#region src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.ts
8
+ const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
9
+ const { sources: webpackSources, Template, Module, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
10
+ const StaticExportsDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/StaticExportsDependency"));
11
+ const SOURCE_TYPES = new Set(["javascript"]);
12
+ var SharedEntryModule = class SharedEntryModule extends Module {
13
+ /**
14
+ * @param {string} name shared name
15
+ * @param {string} request request
16
+ */
17
+ constructor(name, request) {
18
+ super("shared-entry-module", null);
19
+ this._name = name;
20
+ this._request = request;
21
+ }
22
+ /**
23
+ * @param {ObjectDeserializerContext} context context
24
+ * @returns {SharedEntryModule} deserialized container entry module
25
+ */
26
+ static deserialize(context) {
27
+ const { read } = context;
28
+ const obj = new SharedEntryModule(read(), read());
29
+ obj.deserialize(context);
30
+ return obj;
31
+ }
32
+ /**
33
+ * @returns {Set<string>} types available (do not mutate)
34
+ */
35
+ getSourceTypes() {
36
+ return SOURCE_TYPES;
37
+ }
38
+ /**
39
+ * @returns {string} a unique identifier of the module
40
+ */
41
+ identifier() {
42
+ return `shared module ${this._name} ${this._request}`;
43
+ }
44
+ /**
45
+ * @param {RequestShortener} requestShortener the request shortener
46
+ * @returns {string} a user readable identifier of the module
47
+ */
48
+ readableIdentifier(requestShortener) {
49
+ return `shared module ${this._name} ${requestShortener.shorten(this._request)}`;
50
+ }
51
+ /**
52
+ * @param {LibIdentOptions} options options
53
+ * @returns {string | null} an identifier for library inclusion
54
+ */
55
+ libIdent(options) {
56
+ return `shared module ${this._name}`;
57
+ }
58
+ /**
59
+ * @param {NeedBuildContext} context context info
60
+ * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
61
+ * @returns {void}
62
+ */
63
+ needBuild(context, callback) {
64
+ callback(null, !this.buildMeta);
65
+ }
66
+ /**
67
+ * @param {WebpackOptions} options webpack options
68
+ * @param {Compilation} compilation the compilation
69
+ * @param {ResolverWithOptions} resolver the resolver
70
+ * @param {InputFileSystem} fs the file system
71
+ * @param {function(WebpackError): void} callback callback function
72
+ * @returns {void}
73
+ */
74
+ build(options, compilation, resolver, fs, callback) {
75
+ this.buildMeta = {};
76
+ this.buildInfo = {
77
+ strict: true,
78
+ topLevelDeclarations: new Set(["get", "init"])
79
+ };
80
+ this.buildMeta.exportsType = "namespace";
81
+ this.clearDependenciesAndBlocks();
82
+ this.addDependency(new StaticExportsDependency(["get", "init"], false));
83
+ this.addDependency(new require_lib_sharing_tree_shaking_SharedContainerPlugin_SharedDependency.default(this._name, this._request));
84
+ callback();
85
+ }
86
+ /**
87
+ * @param {CodeGenerationContext} context context for code generation
88
+ * @returns {CodeGenerationResult} result
89
+ */
90
+ codeGeneration({ chunkGraph, runtimeTemplate }) {
91
+ const sources = /* @__PURE__ */ new Map();
92
+ const runtimeRequirements = new Set([
93
+ RuntimeGlobals.definePropertyGetters,
94
+ RuntimeGlobals.hasOwnProperty,
95
+ RuntimeGlobals.exports
96
+ ]);
97
+ const moduleGetter = runtimeTemplate.syncModuleFactory({
98
+ dependency: this.dependencies[1],
99
+ chunkGraph,
100
+ request: this._request,
101
+ runtimeRequirements
102
+ });
103
+ const source = Template.asString([
104
+ `var moduleGetter = ${moduleGetter};`,
105
+ `var get = ${runtimeTemplate.basicFunction("module, getScope", ["return moduleGetter();"])};`,
106
+ `var init = ${runtimeTemplate.basicFunction("mfInstance, bundlerRuntime", [
107
+ `${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.instance = mfInstance;`,
108
+ `${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.bundlerRuntime = bundlerRuntime;`,
109
+ `if(!${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes) { return Promise.resolve(); }`,
110
+ `return ${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes({ asyncLoad: true });`
111
+ ])};`,
112
+ "// This exports getters to disallow modifications",
113
+ `${RuntimeGlobals.definePropertyGetters}(exports, {`,
114
+ Template.indent([`get: ${runtimeTemplate.returningFunction("get")},`, `init: ${runtimeTemplate.returningFunction("init")}`]),
115
+ "});"
116
+ ]);
117
+ sources.set("javascript", this.useSourceMap || this.useSimpleSourceMap ? new webpackSources.OriginalSource(source, "webpack/shared-entry") : new webpackSources.RawSource(source));
118
+ return {
119
+ sources,
120
+ runtimeRequirements
121
+ };
122
+ }
123
+ /**
124
+ * @param {string=} type the source type for which the size should be estimated
125
+ * @returns {number} the estimated size of the module (must be non-zero)
126
+ */
127
+ size(type) {
128
+ return 42;
129
+ }
130
+ /**
131
+ * @param {ObjectSerializerContext} context context
132
+ */
133
+ serialize(context) {
134
+ const { write } = context;
135
+ write(this._name);
136
+ write(this._request);
137
+ super.serialize(context);
138
+ }
4
139
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
7
- const SharedDependency_1 = __importDefault(require("./SharedDependency"));
8
- const utils_1 = require("../../../container/runtime/utils");
9
- const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
10
- const { sources: webpackSources, Template, Module, RuntimeGlobals, } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
11
- const StaticExportsDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/StaticExportsDependency'));
12
- const SOURCE_TYPES = new Set(['javascript']);
13
- class SharedEntryModule extends Module {
14
- /**
15
- * @param {string} name shared name
16
- * @param {string} request request
17
- */
18
- constructor(name, request) {
19
- super('shared-entry-module', null);
20
- // super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
21
- this._name = name;
22
- this._request = request;
23
- }
24
- /**
25
- * @param {ObjectDeserializerContext} context context
26
- * @returns {SharedEntryModule} deserialized container entry module
27
- */
28
- static deserialize(context) {
29
- const { read } = context;
30
- const obj = new SharedEntryModule(read(), read());
31
- obj.deserialize(context);
32
- return obj;
33
- }
34
- /**
35
- * @returns {Set<string>} types available (do not mutate)
36
- */
37
- getSourceTypes() {
38
- return SOURCE_TYPES;
39
- }
40
- /**
41
- * @returns {string} a unique identifier of the module
42
- */
43
- identifier() {
44
- return `shared module ${this._name} ${this._request}`;
45
- }
46
- /**
47
- * @param {RequestShortener} requestShortener the request shortener
48
- * @returns {string} a user readable identifier of the module
49
- */
50
- readableIdentifier(requestShortener) {
51
- return `shared module ${this._name} ${requestShortener.shorten(this._request)}`;
52
- }
53
- /**
54
- * @param {LibIdentOptions} options options
55
- * @returns {string | null} an identifier for library inclusion
56
- */
57
- libIdent(options) {
58
- return `shared module ${this._name}`;
59
- }
60
- /**
61
- * @param {NeedBuildContext} context context info
62
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
63
- * @returns {void}
64
- */
65
- needBuild(context, callback) {
66
- callback(null, !this.buildMeta);
67
- }
68
- /**
69
- * @param {WebpackOptions} options webpack options
70
- * @param {Compilation} compilation the compilation
71
- * @param {ResolverWithOptions} resolver the resolver
72
- * @param {InputFileSystem} fs the file system
73
- * @param {function(WebpackError): void} callback callback function
74
- * @returns {void}
75
- */
76
- build(options, compilation, resolver, fs, callback) {
77
- this.buildMeta = {};
78
- this.buildInfo = {
79
- strict: true,
80
- topLevelDeclarations: new Set(['get', 'init']),
81
- };
82
- this.buildMeta.exportsType = 'namespace';
83
- this.clearDependenciesAndBlocks();
84
- this.addDependency(new StaticExportsDependency(['get', 'init'], false));
85
- this.addDependency(new SharedDependency_1.default(this._name, this._request));
86
- callback();
87
- }
88
- /**
89
- * @param {CodeGenerationContext} context context for code generation
90
- * @returns {CodeGenerationResult} result
91
- */
92
- // @ts-ignore
93
- codeGeneration({
94
- // @ts-ignore
95
- chunkGraph,
96
- // @ts-ignore
97
- runtimeTemplate, }) {
98
- const sources = new Map();
99
- const runtimeRequirements = new Set([
100
- RuntimeGlobals.definePropertyGetters,
101
- RuntimeGlobals.hasOwnProperty,
102
- RuntimeGlobals.exports,
103
- ]);
104
- const moduleGetter = runtimeTemplate.syncModuleFactory({
105
- dependency: this.dependencies[1],
106
- chunkGraph,
107
- request: this._request,
108
- runtimeRequirements,
109
- });
110
- const source = Template.asString([
111
- `var moduleGetter = ${moduleGetter};`,
112
- `var get = ${runtimeTemplate.basicFunction('module, getScope', [
113
- 'return moduleGetter();',
114
- ])};`,
115
- `var init = ${runtimeTemplate.basicFunction('mfInstance, bundlerRuntime', [
116
- `${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.instance = mfInstance;`,
117
- `${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.bundlerRuntime = bundlerRuntime;`,
118
- `if(!${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.installInitialConsumes) { return Promise.resolve(); }`,
119
- `return ${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.installInitialConsumes({ asyncLoad: true });`,
120
- ])};`,
121
- '// This exports getters to disallow modifications',
122
- `${RuntimeGlobals.definePropertyGetters}(exports, {`,
123
- Template.indent([
124
- `get: ${runtimeTemplate.returningFunction('get')},`,
125
- `init: ${runtimeTemplate.returningFunction('init')}`,
126
- ]),
127
- '});',
128
- ]);
129
- sources.set('javascript', this.useSourceMap || this.useSimpleSourceMap
130
- ? new webpackSources.OriginalSource(source, 'webpack/shared-entry')
131
- : new webpackSources.RawSource(source));
132
- return {
133
- sources,
134
- runtimeRequirements,
135
- };
136
- }
137
- /**
138
- * @param {string=} type the source type for which the size should be estimated
139
- * @returns {number} the estimated size of the module (must be non-zero)
140
- */
141
- size(type) {
142
- return 42;
143
- }
144
- /**
145
- * @param {ObjectSerializerContext} context context
146
- */
147
- serialize(context) {
148
- const { write } = context;
149
- write(this._name);
150
- write(this._request);
151
- super.serialize(context);
152
- }
153
- }
154
- makeSerializable(SharedEntryModule, 'SharedEntryModule');
140
+ makeSerializable(SharedEntryModule, "SharedEntryModule");
141
+
142
+ //#endregion
155
143
  exports.default = SharedEntryModule;
156
144
  //# sourceMappingURL=SharedEntryModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SharedEntryModule.js","sourceRoot":"","sources":["../../../../../../src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.ts"],"names":[],"mappings":";;;;;AAAA,0FAAqF;AAcrF,0EAAkD;AAClD,4DAA4E;AAE5E,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CACJ,CAAC;AACxD,MAAM,EACJ,OAAO,EAAE,cAAc,EACvB,QAAQ,EACR,MAAM,EACN,cAAc,GACf,GAAG,OAAO,CAAC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CAA6B,CAAC;AACzE,MAAM,uBAAuB,GAAG,OAAO,CACrC,IAAA,6CAAoB,EAAC,kDAAkD,CAAC,CACJ,CAAC;AAEvE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AAa7C,MAAM,iBAAkB,SAAQ,MAAM;IAIpC;;;OAGG;IACH,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;QACnC,+CAA+C;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAkC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,MAAM,GAAG,G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YAEF,KAAK;SACN,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CACT,YAAY,EACZ,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,kBAAkB;YAC1C,CAAC,CAAC,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,EAAE,sBAAsB,CAAC;YACnE,CAAC,CAAC,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CACzC,CAAC;QAEF,OAAO;YACL,OAAO;YACP,mBAAmB;SACpB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACM,IAAI,CAAC,IAAa;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD;;OAEG;IACM,SAAS,CAAC,OAAgC;QACjD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAEzD,kBAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"SharedEntryModule.js","names":["SharedDependency","getFederationGlobalScope"],"sources":["../../../../../../src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type { Compilation, Dependency } from 'webpack';\nimport type {\n CodeGenerationResult,\n InputFileSystem,\n LibIdentOptions,\n NeedBuildContext,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackOptions,\n} from 'webpack/lib/Module';\nimport type WebpackError from 'webpack/lib/WebpackError';\nimport SharedDependency from './SharedDependency';\nimport { getFederationGlobalScope } from '../../../container/runtime/utils';\n\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\nconst {\n sources: webpackSources,\n Template,\n Module,\n RuntimeGlobals,\n} = require(normalizeWebpackPath('webpack')) as typeof import('webpack');\nconst StaticExportsDependency = require(\n normalizeWebpackPath('webpack/lib/dependencies/StaticExportsDependency'),\n) as typeof import('webpack/lib/dependencies/StaticExportsDependency');\n\nconst SOURCE_TYPES = new Set(['javascript']);\n\nexport type ExposeOptions = {\n /**\n * requests to exposed modules (last one is exported)\n */\n import: string[];\n /**\n * custom chunk name for the exposed module\n */\n name: string;\n};\n\nclass SharedEntryModule extends Module {\n private _name: string;\n private _request: string;\n\n /**\n * @param {string} name shared name\n * @param {string} request request\n */\n constructor(name: string, request: string) {\n super('shared-entry-module', null);\n // super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);\n this._name = name;\n this._request = request;\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {SharedEntryModule} deserialized container entry module\n */\n static deserialize(context: ObjectDeserializerContext): SharedEntryModule {\n const { read } = context;\n const obj = new SharedEntryModule(read(), read());\n obj.deserialize(context);\n return obj;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return SOURCE_TYPES;\n }\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return `shared module ${this._name} ${this._request}`;\n }\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n return `shared module ${this._name} ${requestShortener.shorten(this._request)}`;\n }\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n return `shared module ${this._name}`;\n }\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (\n arg0: (WebpackError | null) | undefined,\n arg1: boolean | undefined,\n ) => void,\n ): void {\n callback(null, !this.buildMeta);\n }\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError): void} callback callback function\n * @returns {void}\n */\n override build(\n options: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n topLevelDeclarations: new Set(['get', 'init']),\n };\n this.buildMeta.exportsType = 'namespace';\n this.clearDependenciesAndBlocks();\n\n this.addDependency(\n new StaticExportsDependency(\n ['get', 'init'],\n false,\n ) as unknown as Dependency,\n );\n\n this.addDependency(new SharedDependency(this._name, this._request));\n callback();\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n // @ts-ignore\n override codeGeneration({\n // @ts-ignore\n chunkGraph,\n // @ts-ignore\n runtimeTemplate,\n }: CodeGenerationResult) {\n const sources = new Map();\n const runtimeRequirements = new Set([\n RuntimeGlobals.definePropertyGetters,\n RuntimeGlobals.hasOwnProperty,\n RuntimeGlobals.exports,\n ]);\n const moduleGetter = runtimeTemplate.syncModuleFactory({\n dependency: this.dependencies[1],\n chunkGraph,\n request: this._request,\n runtimeRequirements,\n });\n const source = Template.asString([\n `var moduleGetter = ${moduleGetter};`,\n `var get = ${runtimeTemplate.basicFunction('module, getScope', [\n 'return moduleGetter();',\n ])};`,\n `var init = ${runtimeTemplate.basicFunction(\n 'mfInstance, bundlerRuntime',\n [\n `${getFederationGlobalScope(RuntimeGlobals)}.instance = mfInstance;`,\n `${getFederationGlobalScope(RuntimeGlobals)}.bundlerRuntime = bundlerRuntime;`,\n `if(!${getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes) { return Promise.resolve(); }`,\n `return ${getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes({ asyncLoad: true });`,\n ],\n )};`,\n '// This exports getters to disallow modifications',\n `${RuntimeGlobals.definePropertyGetters}(exports, {`,\n Template.indent([\n `get: ${runtimeTemplate.returningFunction('get')},`,\n `init: ${runtimeTemplate.returningFunction('init')}`,\n ]),\n\n '});',\n ]);\n\n sources.set(\n 'javascript',\n this.useSourceMap || this.useSimpleSourceMap\n ? new webpackSources.OriginalSource(source, 'webpack/shared-entry')\n : new webpackSources.RawSource(source),\n );\n\n return {\n sources,\n runtimeRequirements,\n };\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this._name);\n write(this._request);\n super.serialize(context);\n }\n}\n\nmakeSerializable(SharedEntryModule, 'SharedEntryModule');\n\nexport default SharedEntryModule;\n"],"mappings":";;;;;;;AAiBA,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;AACD,MAAM,EACJ,SAAS,gBACT,UACA,QACA,mBACE,gFAA6B,UAAU,CAAC;AAC5C,MAAM,0BAA0B,gFACT,mDAAmD,CACzE;AAED,MAAM,eAAe,IAAI,IAAI,CAAC,aAAa,CAAC;AAa5C,IAAM,oBAAN,MAAM,0BAA0B,OAAO;;;;;CAQrC,YAAY,MAAc,SAAiB;AACzC,QAAM,uBAAuB,KAAK;AAElC,OAAK,QAAQ;AACb,OAAK,WAAW;;;;;;CAOlB,OAAO,YAAY,SAAuD;EACxE,MAAM,EAAE,SAAS;EACjB,MAAM,MAAM,IAAI,kBAAkB,MAAM,EAAE,MAAM,CAAC;AACjD,MAAI,YAAY,QAAQ;AACxB,SAAO;;;;;CAMT,AAAS,iBAA8B;AACrC,SAAO;;;;;CAKT,AAAS,aAAqB;AAC5B,SAAO,iBAAiB,KAAK,MAAM,GAAG,KAAK;;;;;;CAM7C,AAAS,mBAAmB,kBAA4C;AACtE,SAAO,iBAAiB,KAAK,MAAM,G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AAK,gBAAgB,KAAK,qBACtB,IAAI,eAAe,eAAe,QAAQ,uBAAuB,GACjE,IAAI,eAAe,UAAU,OAAO,CACzC;AAED,SAAO;GACL;GACA;GACD;;;;;;CAOH,AAAS,KAAK,MAAuB;AACnC,SAAO;;;;;CAKT,AAAS,UAAU,SAAwC;EACzD,MAAM,EAAE,UAAU;AAClB,QAAM,KAAK,MAAM;AACjB,QAAM,KAAK,SAAS;AACpB,QAAM,UAAU,QAAQ;;;AAI5B,iBAAiB,mBAAmB,oBAAoB"}
@@ -1,11 +1,16 @@
1
- declare const ModuleFactory: typeof import("webpack/lib/ModuleFactory");
2
- import type { ModuleFactoryCreateData, ModuleFactoryResult } from 'webpack/lib/ModuleFactory';
3
- export default class SharedEntryModuleFactory extends ModuleFactory {
4
- /**
5
- * @param {ModuleFactoryCreateData} data data object
6
- * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
7
- * @returns {void}
8
- */
9
- create(data: ModuleFactoryCreateData, callback: (error: Error | null, result: ModuleFactoryResult) => void): void;
1
+ import * as webpack_lib_ModuleFactory0 from "webpack/lib/ModuleFactory";
2
+ import { ModuleFactoryCreateData, ModuleFactoryResult } from "webpack/lib/ModuleFactory";
3
+
4
+ //#region src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts
5
+ declare const ModuleFactory: typeof webpack_lib_ModuleFactory0;
6
+ declare class SharedEntryModuleFactory extends ModuleFactory {
7
+ /**
8
+ * @param {ModuleFactoryCreateData} data data object
9
+ * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
10
+ * @returns {void}
11
+ */
12
+ create(data: ModuleFactoryCreateData, callback: (error: Error | null, result: ModuleFactoryResult) => void): void;
10
13
  }
11
- export {};
14
+ //#endregion
15
+ export { SharedEntryModuleFactory as default };
16
+ //# sourceMappingURL=SharedEntryModuleFactory.d.ts.map