@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,149 +1,137 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy
4
- */
5
1
  'use strict';
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
11
- const Constants_1 = require("../Constants");
12
- const FallbackItemDependency_1 = __importDefault(require("./FallbackItemDependency"));
13
- const { sources: webpackSources } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
14
- const { Template, Module, RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
15
- const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
16
- const TYPES = new Set(['javascript']);
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_lib_Constants = require('../Constants.js');
6
+ const require_lib_container_FallbackItemDependency = require('./FallbackItemDependency.js');
7
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
8
+
9
+ //#region src/lib/container/FallbackModule.ts
10
+ const { sources: webpackSources } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
11
+ const { Template, Module, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
12
+ const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
13
+ const TYPES = new Set(["javascript"]);
17
14
  const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);
18
- class FallbackModule extends Module {
19
- /**
20
- * @param {string[]} requests list of requests to choose one
21
- */
22
- constructor(requests) {
23
- super(Constants_1.WEBPACK_MODULE_TYPE_FALLBACK);
24
- this.requests = requests;
25
- this._identifier = `fallback ${this.requests.join(' ')}`;
26
- }
27
- /**
28
- * @returns {string} a unique identifier of the module
29
- */
30
- identifier() {
31
- return this._identifier;
32
- }
33
- /**
34
- * @param {RequestShortener} requestShortener the request shortener
35
- * @returns {string} a user readable identifier of the module
36
- */
37
- readableIdentifier(requestShortener) {
38
- return this._identifier;
39
- }
40
- /**
41
- * @param {LibIdentOptions} options options
42
- * @returns {string | null} an identifier for library inclusion
43
- */
44
- libIdent(options) {
45
- return `${this.layer ? `(${this.layer})/` : ''}webpack/container/fallback/${this.requests[0]}/and ${this.requests.length - 1} more`;
46
- }
47
- /**
48
- * @param {Chunk} chunk the chunk which condition should be checked
49
- * @param {Compilation} compilation the compilation
50
- * @returns {boolean} true, if the chunk is ok for the module
51
- */
52
- chunkCondition(chunk, { chunkGraph }) {
53
- return chunkGraph.getNumberOfEntryModules(chunk) > 0;
54
- }
55
- /**
56
- * @param {NeedBuildContext} context context info
57
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
58
- * @returns {void}
59
- */
60
- needBuild(context, callback) {
61
- callback(null, !this.buildInfo);
62
- }
63
- /**
64
- * @param {WebpackOptions} options webpack options
65
- * @param {Compilation} compilation the compilation
66
- * @param {ResolverWithOptions} resolver the resolver
67
- * @param {InputFileSystem} fs the file system
68
- * @param {function(WebpackError=): void} callback callback function
69
- * @returns {void}
70
- */
71
- build(options, compilation, resolver, fs, callback) {
72
- this.buildMeta = {};
73
- this.buildInfo = {
74
- strict: true,
75
- };
76
- this.clearDependenciesAndBlocks();
77
- for (const request of this.requests)
78
- this.addDependency(new FallbackItemDependency_1.default(request));
79
- callback();
80
- }
81
- /**
82
- * @param {string=} type the source type for which the size should be estimated
83
- * @returns {number} the estimated size of the module (must be non-zero)
84
- */
85
- size(type) {
86
- return this.requests.length * 5 + 42;
87
- }
88
- /**
89
- * @returns {Set<string>} types available (do not mutate)
90
- */
91
- getSourceTypes() {
92
- return TYPES;
93
- }
94
- /**
95
- * @param {CodeGenerationContext} context context for code generation
96
- * @returns {CodeGenerationResult} result
97
- */
98
- codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph, }) {
99
- const ids = this.dependencies.map((dep) =>
100
- // @ts-expect-error incompatible dependency type
101
- chunkGraph.getModuleId(moduleGraph.getModule(dep)));
102
- const code = Template.asString([
103
- `var ids = ${JSON.stringify(ids)};`,
104
- 'var error, result, i = 0;',
105
- `var loop = ${runtimeTemplate.basicFunction('next', [
106
- 'while(i < ids.length) {',
107
- Template.indent([
108
- `try { next = ${RuntimeGlobals.require}(ids[i++]); } catch(e) { return handleError(e); }`,
109
- 'if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);',
110
- ]),
111
- '}',
112
- 'if(error) throw error;',
113
- ])}`,
114
- `var handleResult = ${runtimeTemplate.basicFunction('result', [
115
- 'if(result) return result;',
116
- 'return loop();',
117
- ])};`,
118
- `var handleError = ${runtimeTemplate.basicFunction('e', [
119
- 'error = e;',
120
- 'return loop();',
121
- ])};`,
122
- 'module.exports = loop();',
123
- ]);
124
- const sources = new Map();
125
- sources.set('javascript', new webpackSources.RawSource(code));
126
- return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS };
127
- }
128
- /**
129
- * @param {ObjectSerializerContext} context context
130
- */
131
- serialize(context) {
132
- const { write } = context;
133
- write(this.requests);
134
- super.serialize(context);
135
- }
136
- /**
137
- * @param {ObjectDeserializerContext} context context
138
- * @returns {FallbackModule} deserialized fallback module
139
- */
140
- static deserialize(context) {
141
- const { read } = context;
142
- const obj = new FallbackModule(read());
143
- obj.deserialize(context);
144
- return obj;
145
- }
146
- }
147
- makeSerializable(FallbackModule, 'enhanced/lib/container/FallbackModule');
15
+ var FallbackModule = class FallbackModule extends Module {
16
+ /**
17
+ * @param {string[]} requests list of requests to choose one
18
+ */
19
+ constructor(requests) {
20
+ super(require_lib_Constants.WEBPACK_MODULE_TYPE_FALLBACK);
21
+ this.requests = requests;
22
+ this._identifier = `fallback ${this.requests.join(" ")}`;
23
+ }
24
+ /**
25
+ * @returns {string} a unique identifier of the module
26
+ */
27
+ identifier() {
28
+ return this._identifier;
29
+ }
30
+ /**
31
+ * @param {RequestShortener} requestShortener the request shortener
32
+ * @returns {string} a user readable identifier of the module
33
+ */
34
+ readableIdentifier(requestShortener) {
35
+ return this._identifier;
36
+ }
37
+ /**
38
+ * @param {LibIdentOptions} options options
39
+ * @returns {string | null} an identifier for library inclusion
40
+ */
41
+ libIdent(options) {
42
+ return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${this.requests[0]}/and ${this.requests.length - 1} more`;
43
+ }
44
+ /**
45
+ * @param {Chunk} chunk the chunk which condition should be checked
46
+ * @param {Compilation} compilation the compilation
47
+ * @returns {boolean} true, if the chunk is ok for the module
48
+ */
49
+ chunkCondition(chunk, { chunkGraph }) {
50
+ return chunkGraph.getNumberOfEntryModules(chunk) > 0;
51
+ }
52
+ /**
53
+ * @param {NeedBuildContext} context context info
54
+ * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
55
+ * @returns {void}
56
+ */
57
+ needBuild(context, callback) {
58
+ callback(null, !this.buildInfo);
59
+ }
60
+ /**
61
+ * @param {WebpackOptions} options webpack options
62
+ * @param {Compilation} compilation the compilation
63
+ * @param {ResolverWithOptions} resolver the resolver
64
+ * @param {InputFileSystem} fs the file system
65
+ * @param {function(WebpackError=): void} callback callback function
66
+ * @returns {void}
67
+ */
68
+ build(options, compilation, resolver, fs, callback) {
69
+ this.buildMeta = {};
70
+ this.buildInfo = { strict: true };
71
+ this.clearDependenciesAndBlocks();
72
+ for (const request of this.requests) this.addDependency(new require_lib_container_FallbackItemDependency.default(request));
73
+ callback();
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) {
80
+ return this.requests.length * 5 + 42;
81
+ }
82
+ /**
83
+ * @returns {Set<string>} types available (do not mutate)
84
+ */
85
+ getSourceTypes() {
86
+ return TYPES;
87
+ }
88
+ /**
89
+ * @param {CodeGenerationContext} context context for code generation
90
+ * @returns {CodeGenerationResult} result
91
+ */
92
+ codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) {
93
+ const ids = this.dependencies.map((dep) => chunkGraph.getModuleId(moduleGraph.getModule(dep)));
94
+ const code = Template.asString([
95
+ `var ids = ${JSON.stringify(ids)};`,
96
+ "var error, result, i = 0;",
97
+ `var loop = ${runtimeTemplate.basicFunction("next", [
98
+ "while(i < ids.length) {",
99
+ Template.indent([`try { next = ${RuntimeGlobals.require}(ids[i++]); } catch(e) { return handleError(e); }`, "if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);"]),
100
+ "}",
101
+ "if(error) throw error;"
102
+ ])}`,
103
+ `var handleResult = ${runtimeTemplate.basicFunction("result", ["if(result) return result;", "return loop();"])};`,
104
+ `var handleError = ${runtimeTemplate.basicFunction("e", ["error = e;", "return loop();"])};`,
105
+ "module.exports = loop();"
106
+ ]);
107
+ const sources = /* @__PURE__ */ new Map();
108
+ sources.set("javascript", new webpackSources.RawSource(code));
109
+ return {
110
+ sources,
111
+ runtimeRequirements: RUNTIME_REQUIREMENTS
112
+ };
113
+ }
114
+ /**
115
+ * @param {ObjectSerializerContext} context context
116
+ */
117
+ serialize(context) {
118
+ const { write } = context;
119
+ write(this.requests);
120
+ super.serialize(context);
121
+ }
122
+ /**
123
+ * @param {ObjectDeserializerContext} context context
124
+ * @returns {FallbackModule} deserialized fallback module
125
+ */
126
+ static deserialize(context) {
127
+ const { read } = context;
128
+ const obj = new FallbackModule(read());
129
+ obj.deserialize(context);
130
+ return obj;
131
+ }
132
+ };
133
+ makeSerializable(FallbackModule, "enhanced/lib/container/FallbackModule");
134
+
135
+ //#endregion
148
136
  exports.default = FallbackModule;
149
137
  //# sourceMappingURL=FallbackModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackModule.js","sourceRoot":"","sources":["../../../../src/lib/container/FallbackModule.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AAEb,0FAAqF;AAgBrF,4CAA4D;AAC5D,sFAA8D;AAE9D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CACzC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAClD,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CACJ,CAAC;AAExD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AACtC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE9D,MAAM,cAAe,SAAQ,MAAM;IAIjC;;OAEG;IACH,YAAY,QAAkB;QAC5B,KAAK,CAAC,wCAA4B,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,YAAY,IAAI,CA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,OAAO,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAkC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;QACvC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,gBAAgB,CAAC,cAAc,EAAE,uCAAuC,CAAC,CAAC;AAE1E,kBAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FallbackModule.js","names":["WEBPACK_MODULE_TYPE_FALLBACK","FallbackItemDependency"],"sources":["../../../../src/lib/container/FallbackModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type { Chunk, ChunkGraph } from 'webpack';\nimport type {\n CodeGenerationContext,\n CodeGenerationResult,\n Compilation,\n InputFileSystem,\n LibIdentOptions,\n NeedBuildContext,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackError,\n WebpackOptions,\n} from 'webpack/lib/Module';\nimport { WEBPACK_MODULE_TYPE_FALLBACK } from '../Constants';\nimport FallbackItemDependency from './FallbackItemDependency';\n\nconst { sources: webpackSources } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst { Template, Module, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\n\nconst TYPES = new Set(['javascript']);\nconst RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);\n\nclass FallbackModule extends Module {\n public requests: string[];\n private _identifier: string;\n\n /**\n * @param {string[]} requests list of requests to choose one\n */\n constructor(requests: string[]) {\n super(WEBPACK_MODULE_TYPE_FALLBACK);\n this.requests = requests;\n this._identifier = `fallback ${this.requests.join(' ')}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\n }\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 this._identifier;\n }\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 `${this.layer ? `(${this.layer})/` : ''}webpack/container/fallback/${\n this.requests[0]\n }/and ${this.requests.length - 1} more`;\n }\n\n /**\n * @param {Chunk} chunk the chunk which condition should be checked\n * @param {Compilation} compilation the compilation\n * @returns {boolean} true, if the chunk is ok for the module\n */\n override chunkCondition(\n chunk: Chunk,\n { chunkGraph }: { chunkGraph: ChunkGraph },\n ): boolean {\n return chunkGraph.getNumberOfEntryModules(chunk) > 0;\n }\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: (error: WebpackError | null, result?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\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: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n for (const request of this.requests)\n this.addDependency(new FallbackItemDependency(request));\n\n callback();\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 this.requests.length * 5 + 42;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n runtimeTemplate,\n moduleGraph,\n chunkGraph,\n }: CodeGenerationContext): CodeGenerationResult {\n const ids = this.dependencies.map((dep) =>\n // @ts-expect-error incompatible dependency type\n chunkGraph.getModuleId(moduleGraph.getModule(dep)),\n );\n const code = Template.asString([\n `var ids = ${JSON.stringify(ids)};`,\n 'var error, result, i = 0;',\n `var loop = ${runtimeTemplate.basicFunction('next', [\n 'while(i < ids.length) {',\n Template.indent([\n `try { next = ${RuntimeGlobals.require}(ids[i++]); } catch(e) { return handleError(e); }`,\n 'if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);',\n ]),\n '}',\n 'if(error) throw error;',\n ])}`,\n `var handleResult = ${runtimeTemplate.basicFunction('result', [\n 'if(result) return result;',\n 'return loop();',\n ])};`,\n `var handleError = ${runtimeTemplate.basicFunction('e', [\n 'error = e;',\n 'return loop();',\n ])};`,\n 'module.exports = loop();',\n ]);\n const sources = new Map();\n sources.set('javascript', new webpackSources.RawSource(code));\n return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.requests);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackModule} deserialized fallback module\n */\n static deserialize(context: ObjectDeserializerContext): FallbackModule {\n const { read } = context;\n const obj = new FallbackModule(read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(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ACA,aACA,cAC8C;EAC9C,MAAM,MAAM,KAAK,aAAa,KAAK,QAEjC,WAAW,YAAY,YAAY,UAAU,IAAI,CAAC,CACnD;EACD,MAAM,OAAO,SAAS,SAAS;GAC7B,aAAa,KAAK,UAAU,IAAI,CAAC;GACjC;GACA,cAAc,gBAAgB,cAAc,QAAQ;IAClD;IACA,SAAS,OAAO,CACd,gBAAgB,eAAe,QAAQ,oDACvC,yFACD,CAAC;IACF;IACA;IACD,CAAC;GACF,sBAAsB,gBAAgB,cAAc,UAAU,CAC5D,6BACA,iBACD,CAAC,CAAC;GACH,qBAAqB,gBAAgB,cAAc,KAAK,CACtD,cACA,iBACD,CAAC,CAAC;GACH;GACD,CAAC;EACF,MAAM,0BAAU,IAAI,KAAK;AACzB,UAAQ,IAAI,cAAc,IAAI,eAAe,UAAU,KAAK,CAAC;AAC7D,SAAO;GAAE;GAAS,qBAAqB;GAAsB;;;;;CAM/D,AAAS,UAAU,SAAwC;EACzD,MAAM,EAAE,UAAU;AAClB,QAAM,KAAK,SAAS;AACpB,QAAM,UAAU,QAAQ;;;;;;CAO1B,OAAO,YAAY,SAAoD;EACrE,MAAM,EAAE,SAAS;EACjB,MAAM,MAAM,IAAI,eAAe,MAAM,CAAC;AACtC,MAAI,YAAY,QAAQ;AACxB,SAAO;;;AAIX,iBAAiB,gBAAgB,wCAAwC"}
@@ -1,11 +1,16 @@
1
- import type { ModuleFactoryCreateData, ModuleFactoryResult } from 'webpack/lib/ModuleFactory';
2
- declare const ModuleFactory: typeof import("webpack/lib/ModuleFactory");
3
- export default class FallbackModuleFactory 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/container/FallbackModuleFactory.d.ts
5
+ declare const ModuleFactory: typeof webpack_lib_ModuleFactory0;
6
+ declare class FallbackModuleFactory 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 { FallbackModuleFactory as default };
16
+ //# sourceMappingURL=FallbackModuleFactory.d.ts.map
@@ -1,28 +1,24 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
4
- */
5
1
  'use strict';
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
5
+ const require_lib_container_FallbackModule = require('./FallbackModule.js');
6
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
7
+
8
+ //#region src/lib/container/FallbackModuleFactory.ts
9
+ const ModuleFactory = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/ModuleFactory"));
10
+ var FallbackModuleFactory = class extends ModuleFactory {
11
+ /**
12
+ * @param {ModuleFactoryCreateData} data data object
13
+ * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
14
+ * @returns {void}
15
+ */
16
+ create(data, callback) {
17
+ const dependency = data.dependencies[0];
18
+ callback(null, { module: new require_lib_container_FallbackModule.default(dependency.requests) });
19
+ }
8
20
  };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
11
- const FallbackModule_1 = __importDefault(require("./FallbackModule"));
12
- const ModuleFactory = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/ModuleFactory'));
13
- class FallbackModuleFactory extends ModuleFactory {
14
- /**
15
- * @param {ModuleFactoryCreateData} data data object
16
- * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
17
- * @returns {void}
18
- */
19
- create(data, callback) {
20
- const dependency = data.dependencies[0];
21
- callback(null, {
22
- // @ts-expect-error Module !== FallbackModule
23
- module: new FallbackModule_1.default(dependency.requests),
24
- });
25
- }
26
- }
21
+
22
+ //#endregion
27
23
  exports.default = FallbackModuleFactory;
28
24
  //# sourceMappingURL=FallbackModuleFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackModuleFactory.js","sourceRoot":"","sources":["../../../../src/lib/container/FallbackModuleFactory.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AACb,0FAAqF;AAKrF,sEAA8C;AAE9C,MAAM,aAAa,GAAG,OAAO,CAC3B,IAAA,6CAAoB,EAAC,2BAA2B,CAAC,CACJ,CAAC;AAEhD,MAAqB,qBAAsB,SAAQ,aAAa;IAC9D;;;;OAIG;IACM,MAAM,CACb,IAA6B,EAC7B,QAAqE;QAErE,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACxC,QAAQ,CAAC,IAAI,EAAE;YACb,6CAA6C;YAC7C,MAAM,EAAE,IAAI,wBAAc,CAAC,UAAU,CAAC,QAAQ,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;CACF;AAhBD,wCAgBC"}
1
+ {"version":3,"file":"FallbackModuleFactory.js","names":["FallbackModule"],"sources":["../../../../src/lib/container/FallbackModuleFactory.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\n'use strict';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type {\n ModuleFactoryCreateData,\n ModuleFactoryResult,\n} from 'webpack/lib/ModuleFactory';\nimport FallbackModule from './FallbackModule';\n\nconst ModuleFactory = require(\n normalizeWebpackPath('webpack/lib/ModuleFactory'),\n) as typeof import('webpack/lib/ModuleFactory');\n\nexport default class FallbackModuleFactory extends ModuleFactory {\n /**\n * @param {ModuleFactoryCreateData} data data object\n * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback\n * @returns {void}\n */\n override create(\n data: ModuleFactoryCreateData,\n callback: (error: Error | null, result?: ModuleFactoryResult) => void,\n ): void {\n const dependency = data.dependencies[0];\n callback(null, {\n // @ts-expect-error Module !== FallbackModule\n module: new FallbackModule(dependency.requests),\n });\n }\n}\n"],"mappings":";;;;;;;;AAaA,MAAM,gBAAgB,gFACC,4BAA4B,CAClD;AAED,IAAqB,wBAArB,cAAmD,cAAc;;;;;;CAM/D,AAAS,OACP,MACA,UACM;EACN,MAAM,aAAa,KAAK,aAAa;AACrC,WAAS,MAAM,EAEb,QAAQ,IAAIA,6CAAe,WAAW,SAAS,EAChD,CAAC"}
@@ -1,12 +1,16 @@
1
- import type { Compiler, Compilation, WebpackPluginInstance, Module } from 'webpack';
1
+ import { Compilation, Compiler, Module, WebpackPluginInstance } from "webpack";
2
+
3
+ //#region src/lib/container/HoistContainerReferencesPlugin.d.ts
2
4
  /**
3
5
  * This plugin hoists container-related modules into runtime chunks when using runtimeChunk: single configuration.
4
6
  */
5
7
  declare class HoistContainerReferences implements WebpackPluginInstance {
6
- apply(compiler: Compiler): void;
7
- private hoistModulesInChunks;
8
- private cleanUpChunks;
9
- private getRuntimeChunks;
8
+ apply(compiler: Compiler): void;
9
+ private hoistModulesInChunks;
10
+ private cleanUpChunks;
11
+ private getRuntimeChunks;
10
12
  }
11
- export declare function getAllReferencedModules(compilation: Compilation, module: Module, type?: 'all' | 'initial' | 'external'): Set<Module>;
12
- export default HoistContainerReferences;
13
+ declare function getAllReferencedModules(compilation: Compilation, module: Module, type?: 'all' | 'initial' | 'external'): Set<Module>;
14
+ //#endregion
15
+ export { HoistContainerReferences as default, getAllReferencedModules };
16
+ //# sourceMappingURL=HoistContainerReferencesPlugin.d.ts.map