@shopify/hydrogen 0.21.0 → 0.23.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 (524) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/dist/esnext/client.d.ts +1 -0
  3. package/dist/esnext/client.js +1 -0
  4. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +5 -5
  5. package/dist/esnext/components/CartLines/{CartLines.d.ts → CartLines.client.d.ts} +0 -0
  6. package/dist/esnext/components/CartLines/{CartLines.js → CartLines.client.js} +0 -0
  7. package/dist/esnext/components/CartLines/index.d.ts +1 -1
  8. package/dist/esnext/components/CartLines/index.js +1 -1
  9. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +7 -4
  10. package/dist/esnext/components/CartProvider/CartProvider.client.js +22 -12
  11. package/dist/esnext/components/DevTools.client.js +1 -1
  12. package/dist/esnext/components/Image/Image.d.ts +11 -3
  13. package/dist/esnext/components/Image/Image.js +64 -13
  14. package/dist/esnext/components/Link/Link.client.d.ts +2 -0
  15. package/dist/esnext/components/Link/Link.client.js +7 -4
  16. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +1 -1
  17. package/dist/esnext/components/MediaFile/MediaFile.js +3 -2
  18. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
  19. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +140 -0
  20. package/dist/esnext/components/ProductOptionsProvider/context.d.ts +2 -0
  21. package/dist/esnext/components/{ProductProvider → ProductOptionsProvider}/context.js +0 -1
  22. package/dist/esnext/components/ProductOptionsProvider/index.d.ts +2 -0
  23. package/dist/esnext/components/ProductOptionsProvider/index.js +2 -0
  24. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -2
  25. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +10 -12
  26. package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +3 -0
  27. package/dist/esnext/components/Seo/NoIndexSeo.client.js +10 -0
  28. package/dist/esnext/components/Seo/Seo.client.d.ts +4 -0
  29. package/dist/esnext/components/Seo/Seo.client.js +3 -0
  30. package/dist/esnext/components/index.d.ts +1 -1
  31. package/dist/esnext/components/index.js +1 -1
  32. package/dist/esnext/config.d.ts +3 -3
  33. package/dist/esnext/entry-client.js +106 -9
  34. package/dist/esnext/entry-server.d.ts +3 -16
  35. package/dist/esnext/entry-server.js +281 -331
  36. package/dist/esnext/foundation/Analytics/Analytics.client.js +16 -14
  37. package/dist/esnext/foundation/Analytics/Analytics.server.js +27 -20
  38. package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +4 -2
  39. package/dist/esnext/foundation/Analytics/ClientAnalytics.js +17 -15
  40. package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
  41. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +2 -2
  42. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.server.d.ts +1 -0
  43. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/{PerformanceMetrics.server.js → ServerAnalyticsConnector.server.js} +7 -6
  44. package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.d.ts +1 -0
  45. package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.js +19 -0
  46. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.d.ts +3 -0
  47. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +190 -0
  48. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.d.ts +3 -0
  49. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +24 -0
  50. package/dist/esnext/foundation/Analytics/connectors/Shopify/const.d.ts +28 -0
  51. package/dist/esnext/foundation/Analytics/connectors/Shopify/const.js +51 -0
  52. package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.d.ts +3 -0
  53. package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.js +56 -0
  54. package/dist/esnext/foundation/Analytics/hook.js +4 -2
  55. package/dist/esnext/foundation/Analytics/index.d.ts +0 -1
  56. package/dist/esnext/foundation/Analytics/index.js +0 -1
  57. package/dist/esnext/foundation/Analytics/utils.d.ts +2 -0
  58. package/dist/esnext/foundation/Analytics/utils.js +21 -0
  59. package/dist/{node/framework → esnext/foundation/Cache}/cache-sub-request.d.ts +1 -1
  60. package/dist/esnext/{framework → foundation/Cache}/cache-sub-request.js +3 -3
  61. package/dist/esnext/{framework → foundation/Cache}/cache.d.ts +1 -1
  62. package/dist/esnext/{framework → foundation/Cache}/cache.js +3 -3
  63. package/dist/{node/framework/CachingStrategy → esnext/foundation/Cache/strategies}/index.d.ts +1 -1
  64. package/dist/esnext/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
  65. package/dist/esnext/foundation/Cookie/Cookie.d.ts +3 -3
  66. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -10
  67. package/dist/{node/framework/Hydration → esnext/foundation/Html}/Html.d.ts +3 -1
  68. package/dist/esnext/{framework/Hydration → foundation/Html}/Html.js +15 -2
  69. package/dist/{node/framework/Hydration/ServerComponentRequest.server.d.ts → esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +9 -5
  70. package/dist/esnext/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +1 -1
  71. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +23 -0
  72. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +46 -0
  73. package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +2 -1
  74. package/dist/esnext/foundation/Router/BrowserRouter.client.js +17 -10
  75. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
  76. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -3
  77. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
  78. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
  79. package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +1 -1
  80. package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +1 -1
  81. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +1 -1
  82. package/dist/esnext/foundation/index.d.ts +1 -1
  83. package/dist/esnext/foundation/index.js +1 -1
  84. package/dist/esnext/foundation/runtime.d.ts +2 -0
  85. package/dist/esnext/foundation/runtime.js +6 -0
  86. package/dist/esnext/foundation/session/session.d.ts +3 -3
  87. package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
  88. package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +2 -0
  89. package/dist/esnext/foundation/useNavigate/useNavigate.js +11 -4
  90. package/dist/esnext/foundation/useQuery/hooks.js +9 -6
  91. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +2 -1
  92. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +1 -1
  93. package/dist/esnext/framework/Hydration/rsc.js +4 -2
  94. package/dist/esnext/framework/middleware.js +1 -15
  95. package/dist/esnext/framework/plugin.js +4 -0
  96. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
  97. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +6 -3
  98. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +7 -48
  99. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -18
  100. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
  101. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +19 -0
  102. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
  103. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +99 -0
  104. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +4 -4
  105. package/dist/esnext/framework/viteception.d.ts +4 -0
  106. package/dist/esnext/framework/viteception.js +15 -0
  107. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +2 -2
  108. package/dist/esnext/hooks/useProductOptions/types.d.ts +16 -14
  109. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -15
  110. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +8 -107
  111. package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -2
  112. package/dist/esnext/hooks/useShopQuery/hooks.js +12 -7
  113. package/dist/esnext/index.d.ts +30 -16
  114. package/dist/esnext/index.js +30 -20
  115. package/dist/esnext/storefront-api-types.d.ts +1 -1
  116. package/dist/esnext/streaming.server.d.ts +3 -2
  117. package/dist/esnext/streaming.server.js +0 -4
  118. package/dist/esnext/types.d.ts +43 -27
  119. package/dist/esnext/utilities/apiRoutes.d.ts +5 -6
  120. package/dist/esnext/utilities/apiRoutes.js +2 -8
  121. package/dist/esnext/utilities/fetch.d.ts +1 -2
  122. package/dist/esnext/utilities/fetch.js +1 -3
  123. package/dist/esnext/utilities/graphql-tag.d.ts +1 -0
  124. package/dist/esnext/utilities/graphql-tag.js +6 -0
  125. package/dist/esnext/utilities/graphql-tracker.d.ts +1 -1
  126. package/dist/esnext/utilities/graphql-tracker.js +4 -0
  127. package/dist/esnext/utilities/html-encoding.d.ts +0 -1
  128. package/dist/esnext/utilities/html-encoding.js +0 -8
  129. package/dist/esnext/utilities/index.d.ts +2 -2
  130. package/dist/esnext/utilities/index.js +2 -2
  131. package/dist/esnext/utilities/isBrowser/index.d.ts +1 -0
  132. package/dist/esnext/utilities/isBrowser/index.js +1 -0
  133. package/dist/esnext/utilities/isBrowser/isBrowser.d.ts +4 -0
  134. package/dist/esnext/utilities/isBrowser/isBrowser.js +6 -0
  135. package/dist/esnext/utilities/isServer/isServer.js +2 -2
  136. package/dist/esnext/utilities/log/index.d.ts +1 -1
  137. package/dist/esnext/utilities/log/index.js +1 -1
  138. package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
  139. package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
  140. package/dist/esnext/utilities/log/log.d.ts +17 -11
  141. package/dist/esnext/utilities/log/log.js +29 -20
  142. package/dist/esnext/version.d.ts +1 -1
  143. package/dist/esnext/version.js +1 -1
  144. package/dist/node/client.d.ts +16 -0
  145. package/dist/node/client.js +43 -0
  146. package/dist/node/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
  147. package/dist/node/components/AddToCartButton/AddToCartButton.client.js +74 -0
  148. package/dist/node/components/AddToCartButton/index.d.ts +1 -0
  149. package/dist/node/components/AddToCartButton/index.js +5 -0
  150. package/dist/node/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
  151. package/dist/node/components/BuyNowButton/BuyNowButton.client.js +53 -0
  152. package/dist/node/components/BuyNowButton/index.d.ts +1 -0
  153. package/dist/node/components/BuyNowButton/index.js +5 -0
  154. package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
  155. package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.js +44 -0
  156. package/dist/node/components/CartCheckoutButton/index.d.ts +1 -0
  157. package/dist/node/components/CartCheckoutButton/index.js +5 -0
  158. package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
  159. package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.js +36 -0
  160. package/dist/node/components/CartEstimatedCost/index.d.ts +1 -0
  161. package/dist/node/components/CartEstimatedCost/index.js +5 -0
  162. package/dist/node/components/CartLineImage/CartLineImage.client.d.ts +9 -0
  163. package/dist/node/components/CartLineImage/CartLineImage.client.js +18 -0
  164. package/dist/node/components/CartLineImage/index.d.ts +1 -0
  165. package/dist/node/components/CartLineImage/index.js +5 -0
  166. package/dist/node/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
  167. package/dist/node/components/CartLinePrice/CartLinePrice.client.js +28 -0
  168. package/dist/node/components/CartLinePrice/index.d.ts +1 -0
  169. package/dist/node/components/CartLinePrice/index.js +5 -0
  170. package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
  171. package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.js +19 -0
  172. package/dist/node/components/CartLineProductTitle/index.d.ts +1 -0
  173. package/dist/node/components/CartLineProductTitle/index.js +5 -0
  174. package/dist/node/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
  175. package/dist/node/components/CartLineProvider/CartLineProvider.client.js +15 -0
  176. package/dist/node/components/CartLineProvider/context.d.ts +26 -0
  177. package/dist/node/components/CartLineProvider/context.js +5 -0
  178. package/dist/node/components/CartLineProvider/index.d.ts +2 -0
  179. package/dist/node/components/CartLineProvider/index.js +7 -0
  180. package/dist/node/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
  181. package/dist/node/components/CartLineQuantity/CartLineQuantity.client.js +19 -0
  182. package/dist/node/components/CartLineQuantity/index.d.ts +1 -0
  183. package/dist/node/components/CartLineQuantity/index.js +5 -0
  184. package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
  185. package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +31 -0
  186. package/dist/node/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
  187. package/dist/node/components/CartLineQuantityAdjustButton/index.js +5 -0
  188. package/dist/node/components/CartLines/CartLines.client.d.ts +15 -0
  189. package/dist/node/components/CartLines/CartLines.client.js +44 -0
  190. package/dist/node/components/CartLines/index.d.ts +1 -0
  191. package/dist/node/components/CartLines/index.js +5 -0
  192. package/dist/node/components/CartProvider/CartProvider.client.d.ts +41 -0
  193. package/dist/node/components/CartProvider/CartProvider.client.js +550 -0
  194. package/dist/node/components/CartProvider/cart-queries.d.ts +10 -0
  195. package/dist/node/components/CartProvider/cart-queries.js +203 -0
  196. package/dist/node/components/CartProvider/constants.d.ts +2 -0
  197. package/dist/node/components/CartProvider/constants.js +5 -0
  198. package/dist/node/components/CartProvider/context.d.ts +2 -0
  199. package/dist/node/components/CartProvider/context.js +5 -0
  200. package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +86 -0
  201. package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.js +2 -0
  202. package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +86 -0
  203. package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +2 -0
  204. package/dist/node/components/CartProvider/graphql/CartCreateMutation.d.ts +85 -0
  205. package/dist/node/components/CartProvider/graphql/CartCreateMutation.js +2 -0
  206. package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +86 -0
  207. package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +2 -0
  208. package/dist/node/components/CartProvider/graphql/CartFragment.d.ts +72 -0
  209. package/dist/node/components/CartProvider/graphql/CartFragment.js +2 -0
  210. package/dist/node/components/CartProvider/graphql/CartLineAddMutation.d.ts +86 -0
  211. package/dist/node/components/CartProvider/graphql/CartLineAddMutation.js +2 -0
  212. package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +86 -0
  213. package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.js +2 -0
  214. package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +86 -0
  215. package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.js +2 -0
  216. package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +86 -0
  217. package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.js +2 -0
  218. package/dist/node/components/CartProvider/graphql/CartQuery.d.ts +81 -0
  219. package/dist/node/components/CartProvider/graphql/CartQuery.js +2 -0
  220. package/dist/node/components/CartProvider/hooks.client.d.ts +15 -0
  221. package/dist/node/components/CartProvider/hooks.client.js +90 -0
  222. package/dist/node/components/CartProvider/index.d.ts +4 -0
  223. package/dist/node/components/CartProvider/index.js +10 -0
  224. package/dist/node/components/CartProvider/types.d.ts +102 -0
  225. package/dist/node/components/CartProvider/types.js +2 -0
  226. package/dist/node/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
  227. package/dist/node/components/CartShopPayButton/CartShopPayButton.client.js +46 -0
  228. package/dist/node/components/CartShopPayButton/index.d.ts +1 -0
  229. package/dist/node/components/CartShopPayButton/index.js +5 -0
  230. package/dist/node/components/ExternalVideo/ExternalVideo.d.ts +21 -0
  231. package/dist/node/components/ExternalVideo/ExternalVideo.js +21 -0
  232. package/dist/node/components/ExternalVideo/index.d.ts +1 -0
  233. package/dist/node/components/ExternalVideo/index.js +5 -0
  234. package/dist/node/components/Image/Image.d.ts +11 -3
  235. package/dist/node/components/Image/Image.js +63 -12
  236. package/dist/node/components/Link/Link.client.d.ts +25 -0
  237. package/dist/node/components/Link/Link.client.js +165 -0
  238. package/dist/node/components/Link/index.d.ts +1 -0
  239. package/dist/node/components/Link/index.js +5 -0
  240. package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
  241. package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.js +11 -0
  242. package/dist/node/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
  243. package/dist/node/components/LocalizationProvider/LocalizationContext.client.js +5 -0
  244. package/dist/node/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
  245. package/dist/node/components/LocalizationProvider/LocalizationProvider.server.js +51 -0
  246. package/dist/node/components/MediaFile/MediaFile.d.ts +19 -0
  247. package/dist/node/components/MediaFile/MediaFile.js +39 -0
  248. package/dist/node/components/MediaFile/index.d.ts +1 -0
  249. package/dist/node/components/MediaFile/index.js +5 -0
  250. package/dist/node/components/Metafield/Metafield.client.d.ts +21 -0
  251. package/dist/node/components/Metafield/Metafield.client.js +75 -0
  252. package/dist/node/components/Metafield/index.d.ts +2 -0
  253. package/dist/node/components/Metafield/index.js +5 -0
  254. package/dist/node/components/Metafield/types.d.ts +4 -0
  255. package/dist/node/components/Metafield/types.js +2 -0
  256. package/dist/node/components/ModelViewer/ModelViewer.client.d.ts +128 -0
  257. package/dist/node/components/ModelViewer/ModelViewer.client.js +132 -0
  258. package/dist/node/components/ModelViewer/index.d.ts +1 -0
  259. package/dist/node/components/ModelViewer/index.js +5 -0
  260. package/dist/node/components/Money/Money.client.d.ts +25 -0
  261. package/dist/node/components/Money/Money.client.js +46 -0
  262. package/dist/node/components/Money/index.d.ts +1 -0
  263. package/dist/node/components/Money/index.js +5 -0
  264. package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
  265. package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.js +167 -0
  266. package/dist/node/components/ProductOptionsProvider/context.d.ts +2 -0
  267. package/dist/node/components/ProductOptionsProvider/context.js +5 -0
  268. package/dist/node/components/ProductOptionsProvider/index.d.ts +2 -0
  269. package/dist/node/components/ProductOptionsProvider/index.js +7 -0
  270. package/dist/node/components/ProductPrice/ProductPrice.client.d.ts +18 -0
  271. package/dist/node/components/ProductPrice/ProductPrice.client.js +61 -0
  272. package/dist/node/components/ProductPrice/index.d.ts +1 -0
  273. package/dist/node/components/ProductPrice/index.js +5 -0
  274. package/dist/node/components/Seo/CollectionSeo.client.d.ts +3 -0
  275. package/dist/node/components/Seo/CollectionSeo.client.js +22 -0
  276. package/dist/node/components/Seo/DefaultPageSeo.client.d.ts +3 -0
  277. package/dist/node/components/Seo/DefaultPageSeo.client.js +25 -0
  278. package/dist/node/components/Seo/DescriptionSeo.client.d.ts +4 -0
  279. package/dist/node/components/Seo/DescriptionSeo.client.js +17 -0
  280. package/dist/node/components/Seo/HomePageSeo.client.d.ts +2 -0
  281. package/dist/node/components/Seo/HomePageSeo.client.js +32 -0
  282. package/dist/node/components/Seo/ImageSeo.client.d.ts +3 -0
  283. package/dist/node/components/Seo/ImageSeo.client.js +17 -0
  284. package/dist/node/components/Seo/NoIndexSeo.client.d.ts +3 -0
  285. package/dist/node/components/Seo/NoIndexSeo.client.js +17 -0
  286. package/dist/node/components/Seo/PageSeo.client.d.ts +3 -0
  287. package/dist/node/components/Seo/PageSeo.client.js +20 -0
  288. package/dist/node/components/Seo/ProductSeo.client.d.ts +5 -0
  289. package/dist/node/components/Seo/ProductSeo.client.js +70 -0
  290. package/dist/node/components/Seo/Seo.client.d.ts +30 -0
  291. package/dist/node/components/Seo/Seo.client.js +38 -0
  292. package/dist/node/components/Seo/TitleSeo.client.d.ts +3 -0
  293. package/dist/node/components/Seo/TitleSeo.client.js +17 -0
  294. package/dist/node/components/Seo/TwitterSeo.client.d.ts +2 -0
  295. package/dist/node/components/Seo/TwitterSeo.client.js +16 -0
  296. package/dist/node/components/Seo/index.d.ts +1 -0
  297. package/dist/node/components/Seo/index.js +5 -0
  298. package/dist/node/components/Seo/seo-types.d.ts +17 -0
  299. package/dist/node/components/Seo/seo-types.js +2 -0
  300. package/dist/node/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
  301. package/dist/node/components/ShopPayButton/ShopPayButton.client.js +60 -0
  302. package/dist/node/components/ShopPayButton/index.d.ts +1 -0
  303. package/dist/node/components/ShopPayButton/index.js +5 -0
  304. package/dist/node/components/Video/Video.d.ts +14 -0
  305. package/dist/node/components/Video/Video.js +31 -0
  306. package/dist/node/components/Video/index.d.ts +1 -0
  307. package/dist/node/components/Video/index.js +5 -0
  308. package/dist/node/components/index.d.ts +28 -0
  309. package/dist/node/components/index.js +59 -0
  310. package/dist/node/components/types.d.ts +71 -0
  311. package/dist/node/components/types.js +11 -0
  312. package/dist/node/entry-server.d.ts +3 -16
  313. package/dist/node/entry-server.js +280 -330
  314. package/dist/node/foundation/Analytics/Analytics.client.js +19 -17
  315. package/dist/node/foundation/Analytics/Analytics.server.js +27 -20
  316. package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +4 -2
  317. package/dist/node/foundation/Analytics/ClientAnalytics.js +16 -14
  318. package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
  319. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
  320. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +68 -0
  321. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
  322. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +27 -0
  323. package/dist/node/foundation/Analytics/hook.js +4 -2
  324. package/dist/node/foundation/Analytics/index.d.ts +0 -1
  325. package/dist/node/foundation/Analytics/index.js +1 -3
  326. package/dist/node/foundation/Analytics/utils.d.ts +2 -0
  327. package/dist/node/foundation/Analytics/utils.js +24 -1
  328. package/dist/{esnext/framework → node/foundation/Cache}/cache-sub-request.d.ts +1 -1
  329. package/dist/node/{framework → foundation/Cache}/cache-sub-request.js +4 -4
  330. package/dist/node/{framework → foundation/Cache}/cache.d.ts +1 -1
  331. package/dist/node/{framework → foundation/Cache}/cache.js +5 -5
  332. package/dist/{esnext/framework/CachingStrategy → node/foundation/Cache/strategies}/index.d.ts +1 -1
  333. package/dist/node/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
  334. package/dist/node/foundation/Head/Head.client.d.ts +5 -0
  335. package/dist/node/foundation/Head/Head.client.js +17 -0
  336. package/dist/node/foundation/Head/index.d.ts +1 -0
  337. package/dist/node/foundation/Head/index.js +5 -0
  338. package/dist/{esnext/framework/Hydration → node/foundation/Html}/Html.d.ts +3 -1
  339. package/dist/node/{framework/Hydration → foundation/Html}/Html.js +15 -2
  340. package/dist/{esnext/framework/Hydration/ServerComponentRequest.server.d.ts → node/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +9 -5
  341. package/dist/node/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +3 -3
  342. package/dist/node/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +23 -0
  343. package/dist/node/foundation/HydrogenResponse/HydrogenResponse.server.js +53 -0
  344. package/dist/node/foundation/Router/BrowserRouter.client.d.ts +2 -1
  345. package/dist/node/foundation/Router/BrowserRouter.client.js +17 -10
  346. package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
  347. package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -3
  348. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
  349. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
  350. package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
  351. package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.js +35 -0
  352. package/dist/node/foundation/ShopifyProvider/index.d.ts +1 -0
  353. package/dist/node/foundation/ShopifyProvider/index.js +5 -0
  354. package/dist/node/foundation/fetchSync/client/fetchSync.d.ts +10 -0
  355. package/dist/node/foundation/fetchSync/client/fetchSync.js +33 -0
  356. package/dist/node/foundation/fetchSync/server/fetchSync.d.ts +8 -0
  357. package/dist/node/foundation/fetchSync/server/fetchSync.js +33 -0
  358. package/dist/node/foundation/fetchSync/types.d.ts +5 -0
  359. package/dist/node/foundation/fetchSync/types.js +2 -0
  360. package/dist/node/foundation/index.d.ts +3 -0
  361. package/dist/node/foundation/index.js +10 -0
  362. package/dist/node/foundation/runtime.d.ts +2 -0
  363. package/dist/node/foundation/runtime.js +11 -0
  364. package/dist/node/foundation/session/session.d.ts +3 -3
  365. package/dist/node/foundation/ssr-interop.d.ts +2 -2
  366. package/dist/node/foundation/useNavigate/useNavigate.d.ts +2 -0
  367. package/dist/node/foundation/useNavigate/useNavigate.js +11 -4
  368. package/dist/node/foundation/useQuery/hooks.d.ts +36 -0
  369. package/dist/node/foundation/useQuery/hooks.js +104 -0
  370. package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.d.ts +10 -0
  371. package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.js +34 -0
  372. package/dist/node/foundation/useRouteParams/useRouteParams.d.ts +4 -0
  373. package/dist/node/foundation/useRouteParams/useRouteParams.js +13 -0
  374. package/dist/node/foundation/useServerProps/index.d.ts +1 -0
  375. package/dist/node/foundation/useServerProps/index.js +5 -0
  376. package/dist/node/foundation/useSession/useSession.d.ts +2 -0
  377. package/dist/node/foundation/useSession/useSession.js +12 -0
  378. package/dist/node/foundation/useShop/index.d.ts +1 -0
  379. package/dist/node/foundation/useShop/index.js +5 -0
  380. package/dist/node/foundation/useShop/use-shop.d.ts +6 -0
  381. package/dist/node/foundation/useShop/use-shop.js +18 -0
  382. package/dist/node/foundation/useUrl/index.d.ts +1 -0
  383. package/dist/node/foundation/useUrl/index.js +5 -0
  384. package/dist/node/foundation/useUrl/useUrl.d.ts +4 -0
  385. package/dist/node/foundation/useUrl/useUrl.js +32 -0
  386. package/dist/node/framework/Hydration/rsc.js +4 -2
  387. package/dist/node/framework/middleware.js +1 -15
  388. package/dist/node/framework/plugin.js +4 -0
  389. package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
  390. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +6 -3
  391. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -47
  392. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -18
  393. package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
  394. package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +21 -0
  395. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
  396. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +105 -0
  397. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +4 -4
  398. package/dist/node/framework/viteception.d.ts +4 -0
  399. package/dist/node/framework/viteception.js +19 -0
  400. package/dist/node/hooks/index.d.ts +6 -0
  401. package/dist/node/hooks/index.js +28 -0
  402. package/dist/node/hooks/useCart/index.d.ts +1 -0
  403. package/dist/node/hooks/useCart/index.js +5 -0
  404. package/dist/node/hooks/useCart/useCart.d.ts +4 -0
  405. package/dist/node/hooks/useCart/useCart.js +19 -0
  406. package/dist/node/hooks/useCartLine/index.d.ts +1 -0
  407. package/dist/node/hooks/useCartLine/index.js +5 -0
  408. package/dist/node/hooks/useCartLine/useCartLine.d.ts +29 -0
  409. package/dist/node/hooks/useCartLine/useCartLine.js +16 -0
  410. package/dist/node/hooks/useCountry/index.d.ts +1 -0
  411. package/dist/node/hooks/useCountry/index.js +5 -0
  412. package/dist/node/hooks/useCountry/useCountry.d.ts +7 -0
  413. package/dist/node/hooks/useCountry/useCountry.js +21 -0
  414. package/dist/node/hooks/useLoadScript/index.d.ts +1 -0
  415. package/dist/node/hooks/useLoadScript/index.js +5 -0
  416. package/dist/node/hooks/useLoadScript/useLoadScript.client.d.ts +8 -0
  417. package/dist/node/hooks/useLoadScript/useLoadScript.client.js +27 -0
  418. package/dist/node/hooks/useMeasurement/hooks.d.ts +9 -0
  419. package/dist/node/hooks/useMeasurement/hooks.js +17 -0
  420. package/dist/node/hooks/useMeasurement/index.d.ts +1 -0
  421. package/dist/node/hooks/useMeasurement/index.js +5 -0
  422. package/dist/node/hooks/useMoney/hooks.d.ts +54 -0
  423. package/dist/node/hooks/useMoney/hooks.js +70 -0
  424. package/dist/node/hooks/useMoney/index.d.ts +1 -0
  425. package/dist/node/hooks/useMoney/index.js +5 -0
  426. package/dist/node/hooks/useParsedMetafields/index.d.ts +1 -0
  427. package/dist/node/hooks/useParsedMetafields/index.js +5 -0
  428. package/dist/node/hooks/useParsedMetafields/useParsedMetafields.d.ts +21 -0
  429. package/dist/node/hooks/useParsedMetafields/useParsedMetafields.js +25 -0
  430. package/dist/node/hooks/useProductOptions/helpers.d.ts +6 -0
  431. package/dist/node/hooks/useProductOptions/helpers.js +46 -0
  432. package/dist/node/hooks/useProductOptions/index.d.ts +2 -0
  433. package/dist/node/hooks/useProductOptions/index.js +20 -0
  434. package/dist/node/hooks/useProductOptions/types.d.ts +44 -0
  435. package/dist/node/hooks/useProductOptions/types.js +2 -0
  436. package/dist/node/hooks/useProductOptions/useProductOptions.client.d.ts +1 -0
  437. package/dist/node/hooks/useProductOptions/useProductOptions.client.js +13 -0
  438. package/dist/node/hooks/useShopQuery/hooks.d.ts +28 -0
  439. package/dist/node/hooks/useShopQuery/hooks.js +171 -0
  440. package/dist/node/hooks/useShopQuery/index.d.ts +1 -0
  441. package/dist/node/hooks/useShopQuery/index.js +5 -0
  442. package/dist/node/storefront-api-types.d.ts +1 -1
  443. package/dist/node/streaming.server.d.ts +3 -2
  444. package/dist/node/streaming.server.js +1 -6
  445. package/dist/node/types.d.ts +43 -27
  446. package/dist/node/utilities/apiRoutes.d.ts +5 -6
  447. package/dist/node/utilities/apiRoutes.js +2 -8
  448. package/dist/node/utilities/devtools.d.ts +11 -0
  449. package/dist/node/utilities/devtools.js +15 -0
  450. package/dist/node/utilities/fetch.d.ts +1 -2
  451. package/dist/node/utilities/fetch.js +1 -3
  452. package/dist/node/utilities/graphql-tag.d.ts +1 -0
  453. package/dist/node/utilities/graphql-tag.js +10 -0
  454. package/dist/node/utilities/graphql-tracker.d.ts +17 -0
  455. package/dist/node/utilities/graphql-tracker.js +130 -0
  456. package/dist/node/utilities/html-encoding.d.ts +0 -1
  457. package/dist/node/utilities/html-encoding.js +1 -10
  458. package/dist/node/utilities/index.d.ts +2 -2
  459. package/dist/node/utilities/index.js +3 -4
  460. package/dist/node/utilities/isBrowser/index.d.ts +1 -0
  461. package/dist/node/utilities/isBrowser/index.js +5 -0
  462. package/dist/node/utilities/isBrowser/isBrowser.d.ts +4 -0
  463. package/dist/node/utilities/isBrowser/isBrowser.js +10 -0
  464. package/dist/node/utilities/isServer/isServer.js +2 -2
  465. package/dist/node/utilities/log/index.d.ts +1 -1
  466. package/dist/node/utilities/log/index.js +1 -3
  467. package/dist/node/utilities/log/log-cache-header.d.ts +4 -4
  468. package/dist/node/utilities/log/log-query-timeline.d.ts +3 -3
  469. package/dist/node/utilities/log/log.d.ts +17 -11
  470. package/dist/node/utilities/log/log.js +30 -23
  471. package/dist/node/version.d.ts +1 -1
  472. package/dist/node/version.js +1 -1
  473. package/package.json +6 -3
  474. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +219 -51
  475. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +77 -59
  476. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -30
  477. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +199 -70
  478. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +38 -35
  479. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +9 -8
  480. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +3 -3
  481. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +3 -7
  482. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +220 -52
  483. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +77 -59
  484. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +199 -70
  485. package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +9 -8
  486. package/vendor/react-server-dom-vite/package.json +1 -1
  487. package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +0 -8
  488. package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +0 -12
  489. package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +0 -24
  490. package/dist/esnext/components/ProductProvider/ProductProvider.client.js +0 -34
  491. package/dist/esnext/components/ProductProvider/context.d.ts +0 -29
  492. package/dist/esnext/components/ProductProvider/index.d.ts +0 -2
  493. package/dist/esnext/components/ProductProvider/index.js +0 -2
  494. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +0 -1
  495. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +0 -35
  496. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +0 -61
  497. package/dist/esnext/framework/config.d.ts +0 -6
  498. package/dist/esnext/framework/config.js +0 -6
  499. package/dist/esnext/framework/runtime.d.ts +0 -13
  500. package/dist/esnext/framework/runtime.js +0 -27
  501. package/dist/esnext/hooks/useProduct/index.d.ts +0 -1
  502. package/dist/esnext/hooks/useProduct/index.js +0 -1
  503. package/dist/esnext/hooks/useProduct/useProduct.d.ts +0 -52
  504. package/dist/esnext/hooks/useProduct/useProduct.js +0 -43
  505. package/dist/esnext/utilities/findRoutePrefix.d.ts +0 -1
  506. package/dist/esnext/utilities/findRoutePrefix.js +0 -17
  507. package/dist/esnext/utilities/isClient/index.d.ts +0 -1
  508. package/dist/esnext/utilities/isClient/index.js +0 -1
  509. package/dist/esnext/utilities/isClient/isClient.d.ts +0 -4
  510. package/dist/esnext/utilities/isClient/isClient.js +0 -6
  511. package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +0 -35
  512. package/dist/node/framework/Hydration/ServerComponentResponse.server.js +0 -68
  513. package/dist/node/framework/config.d.ts +0 -6
  514. package/dist/node/framework/config.js +0 -11
  515. package/dist/node/framework/runtime.d.ts +0 -13
  516. package/dist/node/framework/runtime.js +0 -35
  517. package/dist/node/utilities/defer.d.ts +0 -6
  518. package/dist/node/utilities/defer.js +0 -18
  519. package/dist/node/utilities/findRoutePrefix.d.ts +0 -1
  520. package/dist/node/utilities/findRoutePrefix.js +0 -21
  521. package/dist/node/utilities/isClient/index.d.ts +0 -1
  522. package/dist/node/utilities/isClient/index.js +0 -5
  523. package/dist/node/utilities/isClient/isClient.d.ts +0 -4
  524. package/dist/node/utilities/isClient/isClient.js +0 -10
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { init, parse } from 'es-module-lexer';
12
12
  import MagicString from 'magic-string';
13
- import { normalizePath, transformWithEsbuild } from 'vite';
13
+ import { normalizePath, transformWithEsbuild, createServer } from 'vite';
14
14
  import { promises } from 'fs';
15
15
  import path from 'path';
16
16
 
@@ -88,58 +88,43 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
88
88
  };
89
89
  }
90
90
 
91
+ var assign = Object.assign;
92
+
91
93
  var rscViteFileRE = /\/react-server-dom-vite.js/;
94
+ var noProxyRE = /[&?]no-proxy($|&)/;
95
+
96
+ var isClientComponent = function (id) {
97
+ return /\.client\.[jt]sx?($|\?)/.test(id);
98
+ };
99
+
92
100
  function ReactFlightVitePlugin() {
93
101
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
102
+ serverBuildEntries = _ref.serverBuildEntries,
94
103
  _ref$isServerComponen = _ref.isServerComponentImporterAllowed,
95
104
  isServerComponentImporterAllowed = _ref$isServerComponen === void 0 ? function (importer) {
96
105
  return false;
97
- } : _ref$isServerComponen,
98
- _ref$isClientComponen = _ref.isClientComponent,
99
- isClientComponent = _ref$isClientComponen === void 0 ? function (id) {
100
- return /\.client\.[jt]sx?($|\?)/.test(id);
101
- } : _ref$isClientComponen,
102
- findClientComponentsForClientBuild = _ref.findClientComponentsForClientBuild;
106
+ } : _ref$isServerComponen;
103
107
 
104
108
  var config;
105
109
  var server;
106
110
  var invalidateTimeout;
107
- var absoluteImporterPath;
111
+ var globImporterPath;
108
112
 
109
- function invalidateImporter() {
113
+ function invalidateGlobImporter() {
110
114
  clearTimeout(invalidateTimeout);
111
115
  invalidateTimeout = setTimeout(function () {
112
- return server.watcher.emit('change', absoluteImporterPath);
116
+ return server.watcher.emit('change', globImporterPath);
113
117
  }, 100);
114
118
  }
115
119
 
116
- function wrapIfClientComponent(id) {
117
- var handle = function (isClient) {
118
- if (!isClient) return null;
119
-
120
- if (server) {
121
- var moduleNode = server.moduleGraph.getModuleById(id);
122
-
123
- if (!moduleNode.__isClientComponent) {
124
- moduleNode.__isClientComponent = true;
125
- if (absoluteImporterPath) invalidateImporter();
126
- }
127
- }
128
-
129
- return proxyClientComponent(id.split('?')[0]);
130
- };
131
-
132
- var tmp = isClientComponent(id);
133
- return typeof tmp === 'boolean' ? handle(tmp) : tmp.then(handle);
134
- }
135
-
136
120
  return {
137
121
  name: 'vite-plugin-react-server-components',
138
122
  enforce: 'pre',
139
123
  configureServer: function (_server) {
140
124
  server = _server;
141
125
  },
142
- configResolved: function (_config) {
126
+ configResolved: async function (_config) {
127
+ await init;
143
128
  config = _config; // By pushing this plugin at the end of the existing array,
144
129
  // we enforce running it *after* Vite resolves import.meta.glob.
145
130
 
@@ -147,21 +132,68 @@ function ReactFlightVitePlugin() {
147
132
  },
148
133
  resolveId: function (source, importer) {
149
134
  if (!importer) return null;
135
+
136
+ if (noProxyRE.test(source)) {
137
+ var _source$split = source.split('?'),
138
+ id = _source$split[0],
139
+ query = _source$split[1];
140
+
141
+ return this.resolve(id, importer, {
142
+ skipSelf: true
143
+ }).then(function (result) {
144
+ if (!result) return null;
145
+ return assign({}, result, {
146
+ id: result.id + (query ? "?" + query : ''),
147
+ moduleSideEffects: false
148
+ });
149
+ });
150
+ }
150
151
  /**
151
152
  * Throw errors when non-Server Components try to load Server Components.
152
153
  */
153
154
 
155
+
154
156
  if (/\.server(\.[jt]sx?)?$/.test(source) && !(/(\.server\.[jt]sx?|index\.html)$/.test(importer) || isServerComponentImporterAllowed(importer, source))) {
155
157
  throw new Error("Cannot import " + source + " from \"" + importer + "\". " + 'By react-server convention, .server.js files can only be imported from other .server.js files. ' + 'That way nobody accidentally sends these to the client by indirectly importing it.');
156
158
  }
157
159
  },
158
160
  load: function (id) {
159
161
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
160
- return options.ssr && shouldCheckClientComponent(id) ? wrapIfClientComponent(id) : null;
162
+ if (!options.ssr || !isClientComponent(id) || noProxyRE.test(id)) return;
163
+
164
+ if (server) {
165
+ var mod = server.moduleGraph.idToModuleMap.get(id.replace('/@fs', ''));
166
+
167
+ if (mod && mod.importers) {
168
+ if (Array.from(mod.importers).every(function (impMod) {
169
+ return noProxyRE.test(impMod.id);
170
+ })) {
171
+ // This module is only imported from client components
172
+ // so we don't need to create a module reference
173
+ return;
174
+ }
175
+ } // Mark module as a client component.
176
+
177
+
178
+ var moduleNode = server.moduleGraph.getModuleById(id);
179
+ if (!moduleNode.meta) moduleNode.meta = {};
180
+
181
+ if (!moduleNode.meta.isClientComponent) {
182
+ moduleNode.meta.isClientComponent = true;
183
+ if (globImporterPath) invalidateGlobImporter();
184
+ }
185
+ }
186
+
187
+ return proxyClientComponent(id.split('?')[0]);
161
188
  },
162
189
  transform: function (code, id) {
163
190
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
164
191
 
192
+ // Add more information for this module in the graph.
193
+ // It will be used later to discover client boundaries.
194
+ if (server && options.ssr && /\.[jt]sx?($|\?)/.test(id)) {
195
+ augmentModuleGraph(server.moduleGraph, id, code);
196
+ }
165
197
  /**
166
198
  * In order to allow dynamic component imports from RSC, we use Vite's import.meta.glob.
167
199
  * This hook replaces the glob placeholders with resolved paths to all client components.
@@ -171,6 +203,8 @@ function ReactFlightVitePlugin() {
171
203
  * If the paths are relative to the root instead, Vite won't add the querystring
172
204
  * and we will have duplicated files in the browser (with duplicated contexts, etc).
173
205
  */
206
+
207
+
174
208
  if (rscViteFileRE.test(id)) {
175
209
  var INJECTING_RE = /\{\s*__INJECTED_CLIENT_IMPORTERS__[:\s]*null[,\s]*\}\s*;/;
176
210
  var s = new MagicString(code);
@@ -210,16 +244,15 @@ function ReactFlightVitePlugin() {
210
244
  };
211
245
 
212
246
  if (config.command === 'serve') {
213
- absoluteImporterPath = id;
214
- return injectGlobs(findClientComponentsForDev(server));
247
+ globImporterPath = id;
248
+ return injectGlobs(findClientBoundaries(server.moduleGraph));
215
249
  }
216
250
 
217
- if (!findClientComponentsForClientBuild) {
218
- throw new Error('[react-server-dom-vite] Parameter findClientComponentsForClientBuild is required for client build');
251
+ if (!serverBuildEntries) {
252
+ throw new Error('[react-server-dom-vite] Parameter serverBuildEntries is required for client build');
219
253
  }
220
254
 
221
- var tmp = findClientComponentsForClientBuild(config);
222
- return Array.isArray(tmp) ? injectGlobs(tmp) : tmp.then(injectGlobs);
255
+ return findClientBoundariesForClientBuild(serverBuildEntries).then(injectGlobs);
223
256
  }
224
257
  }
225
258
  };
@@ -273,29 +306,31 @@ async function proxyClientComponent(filepath, src) {
273
306
  exportStatements.forEach(function (key) {
274
307
  var isDefault = key === DEFAULT_EXPORT;
275
308
  var componentName = isDefault ? getComponentFilename(filepath) : key;
276
- proxyCode += "export " + (isDefault ? DEFAULT_EXPORT : "const " + componentName + " =") + " wrapInClientProxy({ name: '" + componentName + "', id: '" + getComponentId(filepath) + "', value: allImports['" + key + "'], isDefault: " + // eslint-disable-next-line react-internal/safe-string-coercion
309
+ proxyCode += "export " + (isDefault ? DEFAULT_EXPORT : "const " + componentName + " =") + " /* @__PURE__ */wrapInClientProxy({ name: '" + componentName + "', id: '" + getComponentId(filepath) + "', value: allImports['" + key + "'], isDefault: " + // eslint-disable-next-line react-internal/safe-string-coercion
277
310
  String(isDefault) + " });\n";
278
311
  });
279
- return proxyCode;
280
- }
281
-
282
- function shouldCheckClientComponent(id) {
283
- return /\.[jt]sx?($|\?)/.test(id) && !/[&?]no-proxy($|&)/.test(id);
312
+ return {
313
+ code: proxyCode,
314
+ moduleSideEffects: false
315
+ };
284
316
  }
285
317
 
286
- function findClientComponentsForDev(server) {
287
- var clientComponents = []; // eslint-disable-next-line no-for-of-loops/no-for-of-loops
318
+ function findClientBoundaries(moduleGraph) {
319
+ var clientBoundaries = []; // eslint-disable-next-line no-for-of-loops/no-for-of-loops
288
320
 
289
- var _iterator = _createForOfIteratorHelper(server.moduleGraph.fileToModulesMap.values()),
321
+ var _iterator = _createForOfIteratorHelper(moduleGraph.fileToModulesMap.values()),
290
322
  _step;
291
323
 
292
324
  try {
293
325
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
294
326
  var set = _step.value;
295
327
  var clientModule = Array.from(set).find(function (moduleNode) {
296
- return moduleNode.__isClientComponent;
328
+ return moduleNode.meta && moduleNode.meta.isClientComponent;
297
329
  });
298
- if (clientModule) clientComponents.push(clientModule.file);
330
+
331
+ if (clientModule && isDirectImportInServer(clientModule)) {
332
+ clientBoundaries.push(clientModule.file);
333
+ }
299
334
  }
300
335
  } catch (err) {
301
336
  _iterator.e(err);
@@ -303,7 +338,28 @@ function findClientComponentsForDev(server) {
303
338
  _iterator.f();
304
339
  }
305
340
 
306
- return clientComponents;
341
+ return clientBoundaries;
342
+ }
343
+
344
+ async function findClientBoundariesForClientBuild(serverEntries) {
345
+ // Viteception
346
+ var server = await createServer({
347
+ clearScreen: false,
348
+ server: {
349
+ middlewareMode: 'ssr'
350
+ }
351
+ });
352
+
353
+ try {
354
+ // Load server entries to discover client components
355
+ await Promise.all(serverEntries.map(server.ssrLoadModule));
356
+ } catch (error) {
357
+ error.message = 'Could not load server build entries: ' + error.message;
358
+ throw error;
359
+ }
360
+
361
+ await server.close();
362
+ return findClientBoundaries(server.moduleGraph);
307
363
  }
308
364
 
309
365
  var hashImportsPlugin = {
@@ -328,8 +384,120 @@ var hashImportsPlugin = {
328
384
  };
329
385
  }
330
386
  }
331
- }; // This can be used in custom findClientComponentsForClientBuild implementations
387
+ };
388
+ /**
389
+ * A client module should behave as a client boundary
390
+ * if it is imported by the server before encountering
391
+ * another boundary in the process.
392
+ * Traverse the module graph upwards to find non client
393
+ * components that import the current module.
394
+ */
395
+
396
+ function isDirectImportInServer(currentMod, originalMod) {
397
+ // TODO: this should use recursion in any module that exports
398
+ // the original one, not only in full facade files.
399
+ if (!originalMod || (currentMod.meta || {}).isFacade) {
400
+ return Array.from(currentMod.importers).some(function (importer) {
401
+ return (// eslint-disable-next-line no-unused-vars
402
+ isDirectImportInServer(importer, originalMod || currentMod)
403
+ );
404
+ });
405
+ } // Not enough information: safer to assume it is
406
+ // imported in server to create a new boundary.
407
+
408
+
409
+ if (!currentMod.meta || !originalMod.meta) return true; // If current module is a client component, stop checking
410
+ // parents since this can be the actual boundary.
411
+
412
+ if (isClientComponent(currentMod.file)) return false; // If current module is not a client component, assume
413
+ // it is a server component on a shared component
414
+ // that will be imported in the server to be safe.
415
+ // However, due to the lack of tree-shaking in the dev module graph,
416
+ // we need to manually make sure this module is importing something from
417
+ // the original module before marking it as client boundary.
418
+ // -- TODO: this only checks namedExports right now. It should
419
+ // consider default exports and variable renaming in facade modules.
420
+
421
+ return currentMod.meta.imports.some(function (imp) {
422
+ return imp.action === 'import' && (imp.from === originalMod.file || (imp.variables || []).some(function (_ref2) {
423
+ var name = _ref2[0];
424
+ return originalMod.meta.namedExports.includes(name);
425
+ }));
426
+ });
427
+ }
428
+
429
+ function resolveModPath(modPath, dirname, retryExtension) {
430
+ var absolutePath = '';
431
+
432
+ try {
433
+ absolutePath = modPath.startsWith('.') ? normalizePath(path.resolve(dirname, modPath)) : modPath;
434
+ return normalizePath(require.resolve(absolutePath + (retryExtension || '')));
435
+ } catch (error) {
436
+ if (!/\.[jt]sx?$/.test(absolutePath) && retryExtension !== '.tsx') {
437
+ // Node cannot infer .[jt]sx extensions.
438
+ // Append them here and retry a couple of times.
439
+ return resolveModPath(absolutePath, dirname, retryExtension ? '.tsx' : '.jsx');
440
+ }
441
+ }
442
+ }
443
+
444
+ function augmentModuleGraph(moduleGraph, id, code) {
445
+ var currentModule = moduleGraph.getModuleById(id);
446
+ if (!currentModule) return;
447
+
448
+ var _id$split = id.split('?'),
449
+ source = _id$split[0];
450
+
451
+ var dirname = normalizePath(path.dirname(source));
452
+
453
+ var _parse2 = parse(code),
454
+ rawImports = _parse2[0],
455
+ namedExports = _parse2[1],
456
+ isFacade = _parse2[2]; // This is currently not used but it should be considered
457
+ // to improve the crawling in `isDirectImportInServer`.
458
+
459
+
460
+ var imports = [];
461
+ rawImports.forEach(function (_ref3) {
462
+ var startMod = _ref3.s,
463
+ endMod = _ref3.e,
464
+ dynamicImportIndex = _ref3.d,
465
+ startStatement = _ref3.ss,
466
+ endStatement = _ref3.se;
467
+ if (dynamicImportIndex !== -1) return; // Skip dynamic imports for now
468
+
469
+ var modPath = code.slice(startMod, endMod);
470
+ var resolvedPath = resolveModPath(modPath.split('?')[0], dirname);
471
+ if (!resolvedPath) return; // Virtual modules or other exceptions
472
+
473
+ var _code$slice$split$0$s = code.slice(startStatement, endStatement).split(/\s+(from\s+)?['"]/m)[0].split(/\s+(.+)/m),
474
+ action = _code$slice$split$0$s[0],
475
+ _code$slice$split$0$s2 = _code$slice$split$0$s[1],
476
+ variables = _code$slice$split$0$s2 === void 0 ? '' : _code$slice$split$0$s2;
477
+
478
+ imports.push({
479
+ action: action,
480
+ // 'import' or 'export'
481
+ variables: variables // [['originalName', 'alias']]
482
+ .replace(/[{}]/gm, '').trim().split(/\s*,\s*/m).filter(Boolean).map(function (s) {
483
+ return s.split(/\s+as\s+/m);
484
+ }),
485
+ from: resolvedPath,
486
+ // '/absolute/path'
487
+ originalFrom: modPath // './path' or '3plib/subpath'
488
+
489
+ });
490
+ });
332
491
 
333
- ReactFlightVitePlugin.findClientComponentsFromServer = findClientComponentsForDev;
492
+ if (!currentModule.meta) {
493
+ currentModule.meta = {};
494
+ }
495
+
496
+ assign(currentModule.meta, {
497
+ isFacade: isFacade,
498
+ namedExports: namedExports,
499
+ imports: imports
500
+ });
501
+ }
334
502
 
335
503
  export default ReactFlightVitePlugin;
@@ -178,13 +178,15 @@ function processSymbolChunk(request, id, name) {
178
178
  // eslint-disable-next-line no-unused-vars
179
179
  var MODULE_TAG = Symbol.for('react.module.reference');
180
180
  function getModuleKey(reference) {
181
+ if (typeof reference === 'string') reference = globalThis.__STRING_REFERENCE_INDEX[reference];
181
182
  return reference.filepath + '#' + reference.name;
182
183
  }
183
- function getModuleReference(reference) {
184
- if (typeof reference === 'string') return globalThis.__STRING_REFERENCE_INDEX[reference];
185
- return reference && reference.$$typeof === MODULE_TAG ? reference : undefined;
184
+ function isModuleReference(reference) {
185
+ if (typeof reference === 'string') return !!globalThis.__STRING_REFERENCE_INDEX[reference];
186
+ return reference.$$typeof === MODULE_TAG;
186
187
  }
187
188
  function resolveModuleMetaData(config, moduleReference) {
189
+ if (typeof moduleReference === 'string') moduleReference = globalThis.__STRING_REFERENCE_INDEX[moduleReference];
188
190
  return {
189
191
  id: moduleReference.filepath,
190
192
  name: moduleReference.name
@@ -500,7 +502,7 @@ var startInlineScript = stringToPrecomputedChunk('<script>');
500
502
  var endInlineScript = stringToPrecomputedChunk('</script>');
501
503
  var startScriptSrc = stringToPrecomputedChunk('<script src="');
502
504
  var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
503
- var endAsyncScript = stringToPrecomputedChunk('" async=""></script>'); // Allows us to keep track of what we've already written so we can refer back to it.
505
+ var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
504
506
 
505
507
  var textSeparator = stringToPrecomputedChunk('<!-- -->');
506
508
 
@@ -535,6 +537,10 @@ var startPendingSuspenseBoundary1 = stringToPrecomputedChunk('<!--$?--><template
535
537
  var startPendingSuspenseBoundary2 = stringToPrecomputedChunk('"></template>');
536
538
  var startClientRenderedSuspenseBoundary = stringToPrecomputedChunk('<!--$!-->');
537
539
  var endSuspenseBoundary = stringToPrecomputedChunk('<!--/$-->');
540
+ var clientRenderedSuspenseBoundaryError1 = stringToPrecomputedChunk('<template data-hash="');
541
+ var clientRenderedSuspenseBoundaryError1A = stringToPrecomputedChunk('" data-msg="');
542
+ var clientRenderedSuspenseBoundaryError1B = stringToPrecomputedChunk('" data-stack="');
543
+ var clientRenderedSuspenseBoundaryError2 = stringToPrecomputedChunk('"></template>');
538
544
  var startSegmentHTML = stringToPrecomputedChunk('<div hidden id="');
539
545
  var startSegmentHTML2 = stringToPrecomputedChunk('">');
540
546
  var endSegmentHTML = stringToPrecomputedChunk('</div>');
@@ -564,7 +570,7 @@ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
564
570
  // const SUSPENSE_PENDING_START_DATA = '$?';
565
571
  // const SUSPENSE_FALLBACK_START_DATA = '$!';
566
572
  //
567
- // function clientRenderBoundary(suspenseBoundaryID) {
573
+ // function clientRenderBoundary(suspenseBoundaryID, errorHash, errorMsg, errorComponentStack) {
568
574
  // // Find the fallback's first element.
569
575
  // const suspenseIdNode = document.getElementById(suspenseBoundaryID);
570
576
  // if (!suspenseIdNode) {
@@ -576,6 +582,11 @@ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
576
582
  // const suspenseNode = suspenseIdNode.previousSibling;
577
583
  // // Tag it to be client rendered.
578
584
  // suspenseNode.data = SUSPENSE_FALLBACK_START_DATA;
585
+ // // assign error metadata to first sibling
586
+ // let dataset = suspenseIdNode.dataset;
587
+ // if (errorHash) dataset.hash = errorHash;
588
+ // if (errorMsg) dataset.msg = errorMsg;
589
+ // if (errorComponentStack) dataset.stack = errorComponentStack;
579
590
  // // Tell React to retry it if the parent already hydrated.
580
591
  // if (suspenseNode._reactRetry) {
581
592
  // suspenseNode._reactRetry();
@@ -659,7 +670,7 @@ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
659
670
 
660
671
  var completeSegmentFunction = 'function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)}';
661
672
  var completeBoundaryFunction = 'function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}}';
662
- var clientRenderFunction = 'function $RX(a){if(a=document.getElementById(a))a=a.previousSibling,a.data="$!",a._reactRetry&&a._reactRetry()}';
673
+ var clientRenderFunction = 'function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.hash=c),d&&(a.msg=d),e&&(a.stack=e),b._reactRetry&&b._reactRetry())}';
663
674
  var completeSegmentScript1Full = stringToPrecomputedChunk(completeSegmentFunction + ';$RS("');
664
675
  var completeSegmentScript1Partial = stringToPrecomputedChunk('$RS("');
665
676
  var completeSegmentScript2 = stringToPrecomputedChunk('","');
@@ -670,7 +681,9 @@ var completeBoundaryScript2 = stringToPrecomputedChunk('","');
670
681
  var completeBoundaryScript3 = stringToPrecomputedChunk('")</script>');
671
682
  var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderFunction + ';$RX("');
672
683
  var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
673
- var clientRenderScript2 = stringToPrecomputedChunk('")</script>');
684
+ var clientRenderScript1A = stringToPrecomputedChunk('"');
685
+ var clientRenderScript2 = stringToPrecomputedChunk(')</script>');
686
+ var clientRenderErrorScriptArgInterstitial = stringToPrecomputedChunk(',');
674
687
 
675
688
  var rendererSigil;
676
689
 
@@ -998,13 +1011,13 @@ function attemptResolveElement(type, key, ref, props) {
998
1011
  throw new Error('Refs cannot be used in server components, nor passed to client components.');
999
1012
  }
1000
1013
 
1001
- if (getModuleReference(type)) {
1002
- // This is a reference to a client component.
1003
- return [REACT_ELEMENT_TYPE, type, key, props];
1004
- }
1005
-
1006
1014
  if (typeof type === 'function') {
1007
- // This is a server-side component.
1015
+ if (isModuleReference(type)) {
1016
+ // This is a reference to a client component.
1017
+ return [REACT_ELEMENT_TYPE, type, key, props];
1018
+ } // This is a server-side component.
1019
+
1020
+
1008
1021
  return type(props);
1009
1022
  } else if (typeof type === 'string') {
1010
1023
  // This is a host element. E.g. HTML.
@@ -1022,6 +1035,11 @@ function attemptResolveElement(type, key, ref, props) {
1022
1035
 
1023
1036
  return [REACT_ELEMENT_TYPE, type, key, props];
1024
1037
  } else if (type != null && typeof type === 'object') {
1038
+ if (isModuleReference(type)) {
1039
+ // This is a reference to a client component.
1040
+ return [REACT_ELEMENT_TYPE, type, key, props];
1041
+ }
1042
+
1025
1043
  switch (type.$$typeof) {
1026
1044
  case REACT_LAZY_TYPE:
1027
1045
  {
@@ -1348,59 +1366,56 @@ function resolveModelToJSON(request, parent, key, value) {
1348
1366
  }
1349
1367
  }
1350
1368
 
1351
- if (value === null) {
1352
- return null;
1369
+ if (value == null) {
1370
+ return value;
1353
1371
  }
1354
1372
 
1355
- var moduleReference = getModuleReference(value);
1356
-
1357
- if (moduleReference) {
1358
- var moduleKey = getModuleKey(moduleReference);
1359
- var writtenModules = request.writtenModules;
1360
- var existingId = writtenModules.get(moduleKey);
1361
-
1362
- if (existingId !== undefined) {
1363
- if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1364
- // If we're encoding the "type" of an element, we can refer
1365
- // to that by a lazy reference instead of directly since React
1366
- // knows how to deal with lazy values. This lets us suspend
1367
- // on this component rather than its parent until the code has
1368
- // loaded.
1369
- return serializeByRefID(existingId);
1370
- }
1371
-
1372
- return serializeByValueID(existingId);
1373
- }
1373
+ if (typeof value === 'object' || isModuleReference(value)) {
1374
+ if (isModuleReference(value)) {
1375
+ var moduleReference = value;
1376
+ var moduleKey = getModuleKey(moduleReference);
1377
+ var writtenModules = request.writtenModules;
1378
+ var existingId = writtenModules.get(moduleKey);
1379
+
1380
+ if (existingId !== undefined) {
1381
+ if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1382
+ // If we're encoding the "type" of an element, we can refer
1383
+ // to that by a lazy reference instead of directly since React
1384
+ // knows how to deal with lazy values. This lets us suspend
1385
+ // on this component rather than its parent until the code has
1386
+ // loaded.
1387
+ return serializeByRefID(existingId);
1388
+ }
1374
1389
 
1375
- try {
1376
- var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
1377
- request.pendingChunks++;
1378
- var moduleId = request.nextChunkId++;
1379
- emitModuleChunk(request, moduleId, moduleMetaData);
1380
- writtenModules.set(moduleKey, moduleId);
1381
-
1382
- if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1383
- // If we're encoding the "type" of an element, we can refer
1384
- // to that by a lazy reference instead of directly since React
1385
- // knows how to deal with lazy values. This lets us suspend
1386
- // on this component rather than its parent until the code has
1387
- // loaded.
1388
- return serializeByRefID(moduleId);
1390
+ return serializeByValueID(existingId);
1389
1391
  }
1390
1392
 
1391
- return serializeByValueID(moduleId);
1392
- } catch (x) {
1393
- request.pendingChunks++;
1393
+ try {
1394
+ var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
1395
+ request.pendingChunks++;
1396
+ var moduleId = request.nextChunkId++;
1397
+ emitModuleChunk(request, moduleId, moduleMetaData);
1398
+ writtenModules.set(moduleKey, moduleId);
1399
+
1400
+ if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1401
+ // If we're encoding the "type" of an element, we can refer
1402
+ // to that by a lazy reference instead of directly since React
1403
+ // knows how to deal with lazy values. This lets us suspend
1404
+ // on this component rather than its parent until the code has
1405
+ // loaded.
1406
+ return serializeByRefID(moduleId);
1407
+ }
1394
1408
 
1395
- var _errorId = request.nextChunkId++;
1409
+ return serializeByValueID(moduleId);
1410
+ } catch (x) {
1411
+ request.pendingChunks++;
1396
1412
 
1397
- emitErrorChunk(request, _errorId, x);
1398
- return serializeByValueID(_errorId);
1399
- }
1400
- }
1413
+ var _errorId = request.nextChunkId++;
1401
1414
 
1402
- if (typeof value === 'object') {
1403
- if (value.$$typeof === REACT_PROVIDER_TYPE) {
1415
+ emitErrorChunk(request, _errorId, x);
1416
+ return serializeByValueID(_errorId);
1417
+ }
1418
+ } else if (value.$$typeof === REACT_PROVIDER_TYPE) {
1404
1419
  var providerKey = value._context._globalName;
1405
1420
  var writtenProviders = request.writtenProviders;
1406
1421
  var providerId = writtenProviders.get(key);
@@ -1429,7 +1444,7 @@ function resolveModelToJSON(request, parent, key, value) {
1429
1444
  // Verify that this is a simple plain object.
1430
1445
  if (objectName(value) !== 'Object') {
1431
1446
  error('Only plain objects can be passed to client components from server components. ' + 'Built-ins like %s are not supported. ' + 'Remove %s from these props: %s', objectName(value), describeKeyForErrorMessage(key), describeObjectForErrorMessage(parent));
1432
- } else if (!isSimpleObject(value)) {
1447
+ } else if (typeof value === 'object' && !isSimpleObject(value)) {
1433
1448
  error('Only plain objects can be passed to client components from server components. ' + 'Classes or other objects with methods are not supported. ' + 'Remove %s from these props: %s', describeKeyForErrorMessage(key), describeObjectForErrorMessage(parent, key));
1434
1449
  } else if (Object.getOwnPropertySymbols) {
1435
1450
  var symbols = Object.getOwnPropertySymbols(value);
@@ -1738,6 +1753,9 @@ function renderToReadableStream(model, options, context) {
1738
1753
  startFlowing(request, controller);
1739
1754
  },
1740
1755
  cancel: function (reason) {}
1756
+ }, // $FlowFixMe size() methods are not allowed on byte streams.
1757
+ {
1758
+ highWaterMark: 0
1741
1759
  });
1742
1760
  return stream;
1743
1761
  }