@module-federation/enhanced 2.0.1 → 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 -196
  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 -180
  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 -120
  55. package/dist/src/lib/container/RemoteRuntimeModule.js.map +1 -1
  56. package/dist/src/lib/container/RemoteToExternalDependency.d.ts +13 -8
  57. package/dist/src/lib/container/RemoteToExternalDependency.js +25 -23
  58. package/dist/src/lib/container/RemoteToExternalDependency.js.map +1 -1
  59. package/dist/src/lib/container/constant.d.ts +3 -0
  60. package/dist/src/lib/container/constant.js +11 -14
  61. package/dist/src/lib/container/constant.js.map +1 -1
  62. package/dist/src/lib/container/options.d.ts +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 -18
  81. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +266 -345
  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 -125
  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 -100
  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 -322
  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 +21 -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 -219
  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,415 +1,272 @@
1
- "use strict";
2
- /*
3
- MIT License http://www.opensource.org/licenses/mit-license.php
4
- Author Tobias Koppers @sokra
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.normalizeVersion = normalizeVersion;
8
- exports.getDescriptionFile = getDescriptionFile;
9
- exports.getRequiredVersionFromDescriptionFile = getRequiredVersionFromDescriptionFile;
10
- exports.normalizeConsumeShareOptions = normalizeConsumeShareOptions;
11
- exports.addSingletonFilterWarning = addSingletonFilterWarning;
12
- exports.testRequestFilters = testRequestFilters;
13
- exports.createLookupKeyForSharing = createLookupKeyForSharing;
14
- exports.extractPathAfterNodeModules = extractPathAfterNodeModules;
15
- const sdk_1 = require("@module-federation/sdk");
16
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
17
- const { join, dirname, readJson } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/fs'));
18
- const { WebpackError } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
19
- // Extreme shorthand only for github. eg: foo/bar
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
3
+ let _module_federation_sdk = require("@module-federation/sdk");
4
+ let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
5
+
6
+ //#region src/lib/sharing/utils.ts
7
+ const { join, dirname, readJson } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/fs"));
8
+ const { WebpackError } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
20
9
  const RE_URL_GITHUB_EXTREME_SHORT = /^[^/@:.\s][^/@:\s]*\/[^@:\s]*[^/@:\s]#\S+/;
21
- // Short url with specific protocol. eg: github:foo/bar
22
10
  const RE_GIT_URL_SHORT = /^(github|gitlab|bitbucket|gist):\/?[^/.]+\/?/i;
23
- // Currently supported protocols
24
11
  const RE_PROTOCOL = /^((git\+)?(ssh|https?|file)|git|github|gitlab|bitbucket|gist):$/i;
25
- // Has custom protocol
26
12
  const RE_CUSTOM_PROTOCOL = /^((git\+)?(ssh|https?|file)|git):\/\//i;
27
- // Valid hash format for npm / yarn ...
28
13
  const RE_URL_HASH_VERSION = /#(?:semver:)?(.+)/;
29
- // Simple hostname validate
30
14
  const RE_HOSTNAME = /^(?:[^/.]+(\.[^/]+)+|localhost)$/;
31
- // For hostname with colon. eg: ssh://user@github.com:foo/bar
32
15
  const RE_HOSTNAME_WITH_COLON = /([^/@#:.]+(?:\.[^/@#:.]+)+|localhost):([^#/0-9]+)/;
33
- // Reg for url without protocol
34
16
  const RE_NO_PROTOCOL = /^([^/@#:.]+(?:\.[^/@#:.]+)+)/;
35
- // Specific protocol for short url without normal hostname
36
17
  const PROTOCOLS_FOR_SHORT = [
37
- 'github:',
38
- 'gitlab:',
39
- 'bitbucket:',
40
- 'gist:',
41
- 'file:',
18
+ "github:",
19
+ "gitlab:",
20
+ "bitbucket:",
21
+ "gist:",
22
+ "file:"
42
23
  ];
43
- // Default protocol for git url
44
- const DEF_GIT_PROTOCOL = 'git+ssh://';
45
- // thanks to https://github.com/npm/hosted-git-info/blob/latest/git-host-info.js
24
+ const DEF_GIT_PROTOCOL = "git+ssh://";
46
25
  const extractCommithashByDomain = {
47
- /**
48
- * @param {string} pathname pathname
49
- * @param {string} hash hash
50
- * @returns {string | undefined} hash
51
- */
52
- 'github.com': (pathname, hash) => {
53
- const [, user, project, type, commithash] = pathname.split('/', 5);
54
- if (type && type !== 'tree') {
55
- return;
56
- }
57
- let commithashResult = commithash;
58
- if (!type) {
59
- commithashResult = hash;
60
- }
61
- else {
62
- commithashResult = '#' + commithash;
63
- }
64
- let projectResult = project;
65
- if (project && project.endsWith('.git')) {
66
- projectResult = project.slice(0, -4);
67
- }
68
- if (!user || !projectResult) {
69
- return;
70
- }
71
- return commithashResult;
72
- },
73
- /**
74
- * @param {string} pathname pathname
75
- * @param {string} hash hash
76
- * @returns {string | undefined} hash
77
- */
78
- 'gitlab.com': (pathname, hash) => {
79
- const path = pathname.slice(1);
80
- if (path.includes('/-/') || path.includes('/archive.tar.gz')) {
81
- return;
82
- }
83
- const segments = path.split('/');
84
- let project = segments.pop();
85
- if (project && project.endsWith('.git')) {
86
- project = project.slice(0, -4);
87
- }
88
- const user = segments.join('/');
89
- if (!user || !project) {
90
- return;
91
- }
92
- return hash;
93
- },
94
- /**
95
- * @param {string} pathname pathname
96
- * @param {string} hash hash
97
- * @returns {string | undefined} hash
98
- */
99
- 'bitbucket.org': (pathname, hash) => {
100
- const [, user, project, aux] = pathname.split('/', 4);
101
- if (['get'].includes(aux)) {
102
- return;
103
- }
104
- let projectResult = project;
105
- if (project && project.endsWith('.git')) {
106
- projectResult = project.slice(0, -4);
107
- }
108
- if (!user || !projectResult) {
109
- return;
110
- }
111
- return hash;
112
- },
113
- /**
114
- * @param {string} pathname pathname
115
- * @param {string} hash hash
116
- * @returns {string | undefined} hash
117
- */
118
- 'gist.github.com': (pathname, hash) => {
119
- const [, user, project, aux] = pathname.split('/', 4);
120
- if (aux === 'raw') {
121
- return;
122
- }
123
- let projectResult = project;
124
- if (!projectResult) {
125
- if (!user) {
126
- return;
127
- }
128
- projectResult = user;
129
- }
130
- if (projectResult.endsWith('.git')) {
131
- projectResult = projectResult.slice(0, -4);
132
- }
133
- return hash;
134
- },
26
+ "github.com": (pathname, hash) => {
27
+ const [, user, project, type, commithash] = pathname.split("/", 5);
28
+ if (type && type !== "tree") return;
29
+ let commithashResult = commithash;
30
+ if (!type) commithashResult = hash;
31
+ else commithashResult = "#" + commithash;
32
+ let projectResult = project;
33
+ if (project && project.endsWith(".git")) projectResult = project.slice(0, -4);
34
+ if (!user || !projectResult) return;
35
+ return commithashResult;
36
+ },
37
+ "gitlab.com": (pathname, hash) => {
38
+ const path = pathname.slice(1);
39
+ if (path.includes("/-/") || path.includes("/archive.tar.gz")) return;
40
+ const segments = path.split("/");
41
+ let project = segments.pop();
42
+ if (project && project.endsWith(".git")) project = project.slice(0, -4);
43
+ if (!segments.join("/") || !project) return;
44
+ return hash;
45
+ },
46
+ "bitbucket.org": (pathname, hash) => {
47
+ const [, user, project, aux] = pathname.split("/", 4);
48
+ if (["get"].includes(aux)) return;
49
+ let projectResult = project;
50
+ if (project && project.endsWith(".git")) projectResult = project.slice(0, -4);
51
+ if (!user || !projectResult) return;
52
+ return hash;
53
+ },
54
+ "gist.github.com": (pathname, hash) => {
55
+ const [, user, project, aux] = pathname.split("/", 4);
56
+ if (aux === "raw") return;
57
+ let projectResult = project;
58
+ if (!projectResult) {
59
+ if (!user) return;
60
+ projectResult = user;
61
+ }
62
+ if (projectResult.endsWith(".git")) projectResult = projectResult.slice(0, -4);
63
+ return hash;
64
+ }
135
65
  };
136
66
  /**
137
- * extract commit hash from parsed url
138
- *
139
- * @inner
140
- * @param {URL} urlParsed parsed url
141
- * @returns {string} commithash
142
- */
67
+ * extract commit hash from parsed url
68
+ *
69
+ * @inner
70
+ * @param {URL} urlParsed parsed url
71
+ * @returns {string} commithash
72
+ */
143
73
  function getCommithash(urlParsed) {
144
- const { hostname, pathname, hash } = urlParsed;
145
- const hostnameResult = hostname.replace(/^www\./, '');
146
- let hashResult = hash;
147
- try {
148
- hashResult = decodeURIComponent(hash);
149
- // eslint-disable-next-line no-empty
150
- }
151
- catch (e) { }
152
- if (
153
- /** @type {keyof extractCommithashByDomain} */ extractCommithashByDomain[hostnameResult]) {
154
- return (extractCommithashByDomain
155
- /** @type {keyof extractCommithashByDomain} */ [hostnameResult](pathname, hashResult) || '');
156
- }
157
- return hashResult;
74
+ const { hostname, pathname, hash } = urlParsed;
75
+ const hostnameResult = hostname.replace(/^www\./, "");
76
+ let hashResult = hash;
77
+ try {
78
+ hashResult = decodeURIComponent(hash);
79
+ } catch (e) {}
80
+ if (extractCommithashByDomain[hostnameResult]) return extractCommithashByDomain[hostnameResult](pathname, hashResult) || "";
81
+ return hashResult;
158
82
  }
159
83
  /**
160
- * make url right for URL parse
161
- *
162
- * @inner
163
- * @param {string} gitUrl git url
164
- * @returns {string} fixed url
165
- */
84
+ * make url right for URL parse
85
+ *
86
+ * @inner
87
+ * @param {string} gitUrl git url
88
+ * @returns {string} fixed url
89
+ */
166
90
  function correctUrl(gitUrl) {
167
- // like:
168
- // proto://hostname.com:user/repo -> proto://hostname.com/user/repo
169
- return gitUrl.replace(RE_HOSTNAME_WITH_COLON, '$1/$2');
91
+ return gitUrl.replace(RE_HOSTNAME_WITH_COLON, "$1/$2");
170
92
  }
171
93
  /**
172
- * make url protocol right for URL parse
173
- *
174
- * @inner
175
- * @param {string} gitUrl git url
176
- * @returns {string} fixed url
177
- */
94
+ * make url protocol right for URL parse
95
+ *
96
+ * @inner
97
+ * @param {string} gitUrl git url
98
+ * @returns {string} fixed url
99
+ */
178
100
  function correctProtocol(gitUrl) {
179
- // eg: github:foo/bar#v1.0. Should not add double slash, in case of error parsed `pathname`
180
- if (RE_GIT_URL_SHORT.test(gitUrl)) {
181
- return gitUrl;
182
- }
183
- // eg: user@github.com:foo/bar
184
- if (!RE_CUSTOM_PROTOCOL.test(gitUrl)) {
185
- return `${DEF_GIT_PROTOCOL}${gitUrl}`;
186
- }
187
- return gitUrl;
101
+ if (RE_GIT_URL_SHORT.test(gitUrl)) return gitUrl;
102
+ if (!RE_CUSTOM_PROTOCOL.test(gitUrl)) return `${DEF_GIT_PROTOCOL}${gitUrl}`;
103
+ return gitUrl;
188
104
  }
189
105
  /**
190
- * extract git dep version from hash
191
- *
192
- * @inner
193
- * @param {string} hash hash
194
- * @returns {string} git dep version
195
- */
106
+ * extract git dep version from hash
107
+ *
108
+ * @inner
109
+ * @param {string} hash hash
110
+ * @returns {string} git dep version
111
+ */
196
112
  function getVersionFromHash(hash) {
197
- const matched = hash.match(RE_URL_HASH_VERSION);
198
- return (matched && matched[1]) || '';
113
+ const matched = hash.match(RE_URL_HASH_VERSION);
114
+ return matched && matched[1] || "";
199
115
  }
200
116
  /**
201
- * if string can be decoded
202
- *
203
- * @inner
204
- * @param {string} str str to be checked
205
- * @returns {boolean} if can be decoded
206
- */
117
+ * if string can be decoded
118
+ *
119
+ * @inner
120
+ * @param {string} str str to be checked
121
+ * @returns {boolean} if can be decoded
122
+ */
207
123
  function canBeDecoded(str) {
208
- try {
209
- decodeURIComponent(str);
210
- }
211
- catch (e) {
212
- return false;
213
- }
214
- return true;
124
+ return true;
215
125
  }
216
126
  /**
217
- * get right dep version from git url
218
- *
219
- * @inner
220
- * @param {string} gitUrl git url
221
- * @returns {string} dep version
222
- */
127
+ * get right dep version from git url
128
+ *
129
+ * @inner
130
+ * @param {string} gitUrl git url
131
+ * @returns {string} dep version
132
+ */
223
133
  function getGitUrlVersion(gitUrl) {
224
- const oriGitUrl = gitUrl;
225
- // github extreme shorthand
226
- if (RE_URL_GITHUB_EXTREME_SHORT.test(gitUrl)) {
227
- gitUrl = 'github:' + gitUrl;
228
- }
229
- else {
230
- gitUrl = correctProtocol(gitUrl);
231
- }
232
- gitUrl = correctUrl(gitUrl);
233
- let parsed;
234
- try {
235
- parsed = new URL(gitUrl);
236
- // eslint-disable-next-line no-empty
237
- }
238
- catch (e) { }
239
- if (!parsed) {
240
- return '';
241
- }
242
- const { protocol, hostname, pathname, username, password } = parsed;
243
- if (!RE_PROTOCOL.test(protocol)) {
244
- return '';
245
- }
246
- // pathname shouldn't be empty or URL malformed
247
- if (!pathname || !canBeDecoded(pathname)) {
248
- return '';
249
- }
250
- // without protocol, there should have auth info
251
- if (RE_NO_PROTOCOL.test(oriGitUrl) && !username && !password) {
252
- return '';
253
- }
254
- if (!PROTOCOLS_FOR_SHORT.includes(protocol.toLowerCase())) {
255
- if (!RE_HOSTNAME.test(hostname)) {
256
- return '';
257
- }
258
- const commithash = getCommithash(parsed);
259
- return getVersionFromHash(commithash) || commithash;
260
- }
261
- // for protocol short
262
- return getVersionFromHash(gitUrl);
134
+ const oriGitUrl = gitUrl;
135
+ if (RE_URL_GITHUB_EXTREME_SHORT.test(gitUrl)) gitUrl = "github:" + gitUrl;
136
+ else gitUrl = correctProtocol(gitUrl);
137
+ gitUrl = correctUrl(gitUrl);
138
+ let parsed;
139
+ try {
140
+ parsed = new URL(gitUrl);
141
+ } catch (e) {}
142
+ if (!parsed) return "";
143
+ const { protocol, hostname, pathname, username, password } = parsed;
144
+ if (!RE_PROTOCOL.test(protocol)) return "";
145
+ if (!pathname || !canBeDecoded(pathname)) return "";
146
+ if (RE_NO_PROTOCOL.test(oriGitUrl) && !username && !password) return "";
147
+ if (!PROTOCOLS_FOR_SHORT.includes(protocol.toLowerCase())) {
148
+ if (!RE_HOSTNAME.test(hostname)) return "";
149
+ const commithash = getCommithash(parsed);
150
+ return getVersionFromHash(commithash) || commithash;
151
+ }
152
+ return getVersionFromHash(gitUrl);
263
153
  }
264
154
  /**
265
- * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies
266
- * @param {string} versionDesc version to be normalized
267
- * @returns {string} normalized version
268
- */
155
+ * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies
156
+ * @param {string} versionDesc version to be normalized
157
+ * @returns {string} normalized version
158
+ */
269
159
  function normalizeVersion(versionDesc) {
270
- versionDesc = (versionDesc && versionDesc.trim()) || '';
271
- if ((0, sdk_1.isRequiredVersion)(versionDesc)) {
272
- return versionDesc;
273
- }
274
- // add handle for URL Dependencies
275
- return getGitUrlVersion(versionDesc.toLowerCase());
160
+ versionDesc = versionDesc && versionDesc.trim() || "";
161
+ if ((0, _module_federation_sdk.isRequiredVersion)(versionDesc)) return versionDesc;
162
+ return getGitUrlVersion(versionDesc.toLowerCase());
276
163
  }
277
164
  /**
278
- *
279
- * @param {InputFileSystem} fs file system
280
- * @param {string} directory directory to start looking into
281
- * @param {string[]} descriptionFiles possible description filenames
282
- * @param {function((Error | null)=, {data?: DescriptionFile, path?: string}=, (checkedDescriptionFilePaths: string[])=): void} callback callback
283
- * @param {function({data: DescriptionFile}=): boolean} satisfiesDescriptionFileData file data compliance check
284
- * @param {Set<string>} [checkedFilePaths] optional set to track checked file paths
285
- */
286
- function getDescriptionFile(fs, directory, descriptionFiles, callback, satisfiesDescriptionFileData, checkedFilePaths = new Set()) {
287
- let i = 0;
288
- // Create an object to hold the function and the shared checkedFilePaths
289
- const satisfiesDescriptionFileDataInternal = {
290
- check: satisfiesDescriptionFileData,
291
- checkedFilePaths: checkedFilePaths, // Use the passed Set instance
292
- };
293
- const tryLoadCurrent = () => {
294
- if (i >= descriptionFiles.length) {
295
- const parentDirectory = dirname(fs, directory);
296
- if (!parentDirectory || parentDirectory === directory) {
297
- return callback(null, undefined, Array.from(satisfiesDescriptionFileDataInternal.checkedFilePaths));
298
- }
299
- return getDescriptionFile(fs, parentDirectory, descriptionFiles, callback, satisfiesDescriptionFileDataInternal.check, satisfiesDescriptionFileDataInternal.checkedFilePaths);
300
- }
301
- const filePath = join(fs, directory, descriptionFiles[i]);
302
- readJson(fs, filePath, (err, data) => {
303
- if (err) {
304
- if ('code' in err && err.code === 'ENOENT') {
305
- i++;
306
- return tryLoadCurrent();
307
- }
308
- return callback(err);
309
- }
310
- if (!data || typeof data !== 'object' || Array.isArray(data)) {
311
- return callback(new Error(`Description file ${filePath} is not an object`));
312
- }
313
- if (typeof satisfiesDescriptionFileDataInternal.check === 'function' &&
314
- !satisfiesDescriptionFileDataInternal.check({ data, path: filePath })) {
315
- i++;
316
- satisfiesDescriptionFileDataInternal.checkedFilePaths.add(filePath);
317
- return tryLoadCurrent();
318
- }
319
- callback(null, { data, path: filePath });
320
- });
321
- };
322
- tryLoadCurrent();
165
+ *
166
+ * @param {InputFileSystem} fs file system
167
+ * @param {string} directory directory to start looking into
168
+ * @param {string[]} descriptionFiles possible description filenames
169
+ * @param {function((Error | null)=, {data?: DescriptionFile, path?: string}=, (checkedDescriptionFilePaths: string[])=): void} callback callback
170
+ * @param {function({data: DescriptionFile}=): boolean} satisfiesDescriptionFileData file data compliance check
171
+ * @param {Set<string>} [checkedFilePaths] optional set to track checked file paths
172
+ */
173
+ function getDescriptionFile(fs, directory, descriptionFiles, callback, satisfiesDescriptionFileData, checkedFilePaths = /* @__PURE__ */ new Set()) {
174
+ let i = 0;
175
+ const satisfiesDescriptionFileDataInternal = {
176
+ check: satisfiesDescriptionFileData,
177
+ checkedFilePaths
178
+ };
179
+ const tryLoadCurrent = () => {
180
+ if (i >= descriptionFiles.length) {
181
+ const parentDirectory = dirname(fs, directory);
182
+ if (!parentDirectory || parentDirectory === directory) return callback(null, void 0, Array.from(satisfiesDescriptionFileDataInternal.checkedFilePaths));
183
+ return getDescriptionFile(fs, parentDirectory, descriptionFiles, callback, satisfiesDescriptionFileDataInternal.check, satisfiesDescriptionFileDataInternal.checkedFilePaths);
184
+ }
185
+ const filePath = join(fs, directory, descriptionFiles[i]);
186
+ readJson(fs, filePath, (err, data) => {
187
+ if (err) {
188
+ if ("code" in err && err.code === "ENOENT") {
189
+ i++;
190
+ return tryLoadCurrent();
191
+ }
192
+ return callback(err);
193
+ }
194
+ if (!data || typeof data !== "object" || Array.isArray(data)) return callback(/* @__PURE__ */ new Error(`Description file ${filePath} is not an object`));
195
+ if (typeof satisfiesDescriptionFileDataInternal.check === "function" && !satisfiesDescriptionFileDataInternal.check({
196
+ data,
197
+ path: filePath
198
+ })) {
199
+ i++;
200
+ satisfiesDescriptionFileDataInternal.checkedFilePaths.add(filePath);
201
+ return tryLoadCurrent();
202
+ }
203
+ callback(null, {
204
+ data,
205
+ path: filePath
206
+ });
207
+ });
208
+ };
209
+ tryLoadCurrent();
323
210
  }
324
211
  /**
325
- * Get required version from description file
326
- * @param {Record<string, any>} data - The data object
327
- * @param {string} packageName - The package name
328
- * @returns {string | undefined} The normalized version
329
- */
212
+ * Get required version from description file
213
+ * @param {Record<string, any>} data - The data object
214
+ * @param {string} packageName - The package name
215
+ * @returns {string | undefined} The normalized version
216
+ */
330
217
  function getRequiredVersionFromDescriptionFile(data, packageName) {
331
- if (data['optionalDependencies'] &&
332
- typeof data['optionalDependencies'] === 'object' &&
333
- packageName in data['optionalDependencies']) {
334
- return normalizeVersion(data['optionalDependencies'][packageName]);
335
- }
336
- if (data['dependencies'] &&
337
- typeof data['dependencies'] === 'object' &&
338
- packageName in data['dependencies']) {
339
- return normalizeVersion(data['dependencies'][packageName]);
340
- }
341
- if (data['peerDependencies'] &&
342
- typeof data['peerDependencies'] === 'object' &&
343
- packageName in data['peerDependencies']) {
344
- return normalizeVersion(data['peerDependencies'][packageName]);
345
- }
346
- if (data['devDependencies'] &&
347
- typeof data['devDependencies'] === 'object' &&
348
- packageName in data['devDependencies']) {
349
- return normalizeVersion(data['devDependencies'][packageName]);
350
- }
218
+ if (data["optionalDependencies"] && typeof data["optionalDependencies"] === "object" && packageName in data["optionalDependencies"]) return normalizeVersion(data["optionalDependencies"][packageName]);
219
+ if (data["dependencies"] && typeof data["dependencies"] === "object" && packageName in data["dependencies"]) return normalizeVersion(data["dependencies"][packageName]);
220
+ if (data["peerDependencies"] && typeof data["peerDependencies"] === "object" && packageName in data["peerDependencies"]) return normalizeVersion(data["peerDependencies"][packageName]);
221
+ if (data["devDependencies"] && typeof data["devDependencies"] === "object" && packageName in data["devDependencies"]) return normalizeVersion(data["devDependencies"][packageName]);
351
222
  }
352
223
  function normalizeConsumeShareOptions(consumeOptions) {
353
- const { requiredVersion = false, strictVersion, singleton = false, eager, shareKey, shareScope, layer, treeShakingMode, } = consumeOptions;
354
- return {
355
- shareConfig: {
356
- fixedDependencies: false,
357
- requiredVersion,
358
- strictVersion,
359
- singleton,
360
- eager,
361
- layer,
362
- },
363
- shareScope,
364
- shareKey,
365
- treeShakingMode,
366
- };
224
+ const { requiredVersion = false, strictVersion, singleton = false, eager, shareKey, shareScope, layer, treeShakingMode } = consumeOptions;
225
+ return {
226
+ shareConfig: {
227
+ fixedDependencies: false,
228
+ requiredVersion,
229
+ strictVersion,
230
+ singleton,
231
+ eager,
232
+ layer
233
+ },
234
+ shareScope,
235
+ shareKey,
236
+ treeShakingMode
237
+ };
367
238
  }
368
- function addSingletonFilterWarning(compilation, shareKey, // The shareKey or a relevant identifier for the shared module
369
- filterType, filterProperty, filterValue, moduleRequest, // original request that led to this shared module
370
- moduleResource) {
371
- if (typeof compilation.warnings.push !== 'function') {
372
- return;
373
- }
374
- const filterValueStr = filterValue instanceof RegExp ? filterValue.toString() : `"${filterValue}"`;
375
- const warningMessage = `"singleton: true" is used together with "${filterType}.${filterProperty}: ${filterValueStr}". This might lead to multiple instances of the shared module "${shareKey}" in the shared scope.`;
376
- const warning = new WebpackError(warningMessage);
377
- if (moduleResource) {
378
- warning.file = `shared module ${moduleRequest} -> ${moduleResource}`;
379
- }
380
- else {
381
- warning.file = `shared module ${moduleRequest}`; // Fallback if resource is not available
382
- }
383
- compilation.warnings.push(warning);
239
+ function addSingletonFilterWarning(compilation, shareKey, filterType, filterProperty, filterValue, moduleRequest, moduleResource) {
240
+ if (typeof compilation.warnings.push !== "function") return;
241
+ const warning = new WebpackError(`"singleton: true" is used together with "${filterType}.${filterProperty}: ${filterValue instanceof RegExp ? filterValue.toString() : `"${filterValue}"`}". This might lead to multiple instances of the shared module "${shareKey}" in the shared scope.`);
242
+ if (moduleResource) warning.file = `shared module ${moduleRequest} -> ${moduleResource}`;
243
+ else warning.file = `shared module ${moduleRequest}`;
244
+ compilation.warnings.push(warning);
384
245
  }
385
246
  function testRequestFilters(remainder, includeRequest, excludeRequest) {
386
- if (includeRequest &&
387
- !(includeRequest instanceof RegExp
388
- ? includeRequest.test(remainder)
389
- : remainder === includeRequest)) {
390
- return false; // Skip if include doesn't match
391
- }
392
- if (excludeRequest &&
393
- (excludeRequest instanceof RegExp
394
- ? excludeRequest.test(remainder)
395
- : remainder === excludeRequest)) {
396
- return false; // Skip if exclude matches
397
- }
398
- return true; // Process if no filters skip it
247
+ if (includeRequest && !(includeRequest instanceof RegExp ? includeRequest.test(remainder) : remainder === includeRequest)) return false;
248
+ if (excludeRequest && (excludeRequest instanceof RegExp ? excludeRequest.test(remainder) : remainder === excludeRequest)) return false;
249
+ return true;
399
250
  }
400
251
  function createLookupKeyForSharing(request, layer) {
401
- if (layer) {
402
- return `(${layer})${request}`;
403
- }
404
- return request;
252
+ if (layer) return `(${layer})${request}`;
253
+ return request;
405
254
  }
406
255
  function extractPathAfterNodeModules(filePath) {
407
- // Fast check for 'node_modules' substring
408
- if (~filePath.indexOf('node_modules')) {
409
- const nodeModulesIndex = filePath.lastIndexOf('node_modules');
410
- const result = filePath.substring(nodeModulesIndex + 13); // 13 = 'node_modules/'.length
411
- return result;
412
- }
413
- return null;
256
+ if (~filePath.indexOf("node_modules")) {
257
+ const nodeModulesIndex = filePath.lastIndexOf("node_modules");
258
+ return filePath.substring(nodeModulesIndex + 13);
259
+ }
260
+ return null;
414
261
  }
262
+
263
+ //#endregion
264
+ exports.addSingletonFilterWarning = addSingletonFilterWarning;
265
+ exports.createLookupKeyForSharing = createLookupKeyForSharing;
266
+ exports.extractPathAfterNodeModules = extractPathAfterNodeModules;
267
+ exports.getDescriptionFile = getDescriptionFile;
268
+ exports.getRequiredVersionFromDescriptionFile = getRequiredVersionFromDescriptionFile;
269
+ exports.normalizeConsumeShareOptions = normalizeConsumeShareOptions;
270
+ exports.normalizeVersion = normalizeVersion;
271
+ exports.testRequestFilters = testRequestFilters;
415
272
  //# sourceMappingURL=utils.js.map