@shopify/hydrogen 0.11.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/CHANGELOG.md +500 -3
  2. package/dist/esnext/client.d.ts +2 -0
  3. package/dist/esnext/client.js +2 -0
  4. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +3 -4
  5. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +9 -22
  6. package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
  7. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +4 -5
  8. package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
  9. package/dist/esnext/components/BuyNowButton/index.js +1 -1
  10. package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +2 -3
  11. package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +3 -3
  12. package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +5 -3
  13. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +5 -5
  14. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +1 -1
  15. package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +1 -3
  16. package/dist/esnext/components/CartLineProvider/context.d.ts +10 -16
  17. package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +1 -3
  18. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +1 -1
  19. package/dist/esnext/components/CartProvider/CartProvider.client.js +8 -2
  20. package/dist/esnext/components/CartProvider/cart-queries.d.ts +9 -0
  21. package/dist/esnext/components/CartProvider/cart-queries.js +876 -0
  22. package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +72 -5
  23. package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +72 -5
  24. package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +72 -5
  25. package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +73 -6
  26. package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +13 -11
  27. package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +72 -5
  28. package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +72 -5
  29. package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +72 -5
  30. package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +73 -6
  31. package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +72 -5
  32. package/dist/esnext/components/CartProvider/hooks.d.ts +1 -1
  33. package/dist/esnext/components/CartProvider/hooks.js +4 -1
  34. package/dist/esnext/components/CartProvider/types.d.ts +1 -1
  35. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +3 -2
  36. package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +8 -13
  37. package/dist/esnext/components/ExternalVideo/ExternalVideo.js +7 -7
  38. package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
  39. package/dist/esnext/components/ExternalVideo/index.js +1 -1
  40. package/dist/esnext/components/Image/Image.d.ts +14 -16
  41. package/dist/esnext/components/Image/Image.js +17 -17
  42. package/dist/esnext/components/Image/index.d.ts +1 -1
  43. package/dist/esnext/components/Image/index.js +1 -1
  44. package/dist/esnext/components/Link/Link.client.d.ts +4 -5
  45. package/dist/esnext/components/Link/Link.client.js +5 -4
  46. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -3
  47. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +0 -1
  48. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +4 -5
  49. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +15 -4
  50. package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +5 -8
  51. package/dist/esnext/components/LocalizationProvider/index.d.ts +0 -1
  52. package/dist/esnext/components/LocalizationProvider/index.js +0 -1
  53. package/dist/esnext/components/MediaFile/MediaFile.d.ts +10 -21
  54. package/dist/esnext/components/MediaFile/MediaFile.js +7 -5
  55. package/dist/esnext/components/MediaFile/index.d.ts +1 -1
  56. package/dist/esnext/components/MediaFile/index.js +1 -1
  57. package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -6
  58. package/dist/esnext/components/Metafield/Metafield.client.js +8 -8
  59. package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -3
  60. package/dist/esnext/components/Metafield/index.d.ts +1 -2
  61. package/dist/esnext/components/Metafield/index.js +1 -1
  62. package/dist/esnext/components/Metafield/types.d.ts +1 -1
  63. package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +58 -66
  64. package/dist/esnext/components/ModelViewer/ModelViewer.client.js +10 -7
  65. package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
  66. package/dist/esnext/components/Money/Money.client.d.ts +8 -12
  67. package/dist/esnext/components/Money/Money.client.js +1 -4
  68. package/dist/esnext/components/Money/index.d.ts +1 -1
  69. package/dist/esnext/components/Money/index.js +1 -1
  70. package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +7 -2
  71. package/dist/esnext/components/ProductDescription/ProductDescription.client.js +4 -3
  72. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +3 -3
  73. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -5
  74. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
  75. package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +8 -8
  76. package/dist/esnext/components/ProductProvider/ProductProvider.client.js +2 -4
  77. package/dist/esnext/components/ProductProvider/context.d.ts +23 -14
  78. package/dist/esnext/components/ProductProvider/index.d.ts +1 -1
  79. package/dist/esnext/components/ProductProvider/index.js +1 -1
  80. package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +3 -2
  81. package/dist/esnext/components/Seo/CollectionSeo.client.js +3 -3
  82. package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -2
  83. package/dist/esnext/components/Seo/DefaultPageSeo.client.js +2 -2
  84. package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +3 -3
  85. package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
  86. package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
  87. package/dist/esnext/components/Seo/ImageSeo.client.d.ts +3 -2
  88. package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -2
  89. package/dist/esnext/components/Seo/PageSeo.client.js +2 -2
  90. package/dist/esnext/components/Seo/ProductSeo.client.d.ts +5 -2
  91. package/dist/esnext/components/Seo/ProductSeo.client.js +10 -5
  92. package/dist/esnext/components/Seo/Seo.client.d.ts +11 -7
  93. package/dist/esnext/components/Seo/Seo.client.js +8 -14
  94. package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -4
  95. package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
  96. package/dist/esnext/components/Seo/seo-types.d.ts +17 -0
  97. package/dist/esnext/components/{ExternalVideo/ExternalVideoFragment.js → Seo/seo-types.js} +0 -0
  98. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +2 -1
  99. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +1 -9
  100. package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
  101. package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +8 -13
  102. package/dist/esnext/components/UnitPrice/UnitPrice.client.js +9 -4
  103. package/dist/esnext/components/UnitPrice/index.d.ts +1 -1
  104. package/dist/esnext/components/UnitPrice/index.js +1 -1
  105. package/dist/esnext/components/Video/Video.d.ts +8 -16
  106. package/dist/esnext/components/Video/Video.js +11 -6
  107. package/dist/esnext/components/Video/index.d.ts +1 -2
  108. package/dist/esnext/components/Video/index.js +1 -1
  109. package/dist/esnext/components/index.d.ts +3 -16
  110. package/dist/esnext/components/index.js +2 -5
  111. package/dist/esnext/entry-client.js +27 -8
  112. package/dist/esnext/entry-server.d.ts +2 -1
  113. package/dist/esnext/entry-server.js +127 -160
  114. package/dist/esnext/foundation/Boomerang/Boomerang.client.d.ts +3 -1
  115. package/dist/esnext/foundation/Boomerang/Boomerang.client.js +17 -3
  116. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
  117. package/dist/esnext/foundation/{Router/DefaultRoutes.js → FileRoutes/FileRoutes.server.js} +24 -23
  118. package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
  119. package/dist/esnext/foundation/Redirect/Redirect.client.js +14 -0
  120. package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
  121. package/dist/esnext/foundation/Route/Route.server.js +33 -0
  122. package/dist/esnext/foundation/Router/{Router.client.d.ts → BrowserRouter.client.d.ts} +3 -2
  123. package/dist/esnext/foundation/Router/{Router.client.js → BrowserRouter.client.js} +11 -7
  124. package/dist/esnext/foundation/Router/Router.server.d.ts +10 -0
  125. package/dist/esnext/foundation/Router/Router.server.js +8 -0
  126. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +19 -24
  127. package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
  128. package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +0 -0
  129. package/dist/esnext/foundation/ServerStateProvider/index.d.ts +2 -2
  130. package/dist/esnext/foundation/ServerStateProvider/index.js +1 -1
  131. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +3 -0
  132. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +3 -0
  133. package/dist/esnext/foundation/ShopifyProvider/index.d.ts +0 -1
  134. package/dist/esnext/foundation/ShopifyProvider/index.js +0 -1
  135. package/dist/esnext/foundation/index.d.ts +0 -2
  136. package/dist/esnext/foundation/index.js +0 -2
  137. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.d.ts +6 -3
  138. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.js +4 -1
  139. package/dist/esnext/foundation/useQuery/hooks.d.ts +5 -4
  140. package/dist/esnext/foundation/useQuery/hooks.js +13 -4
  141. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +9 -0
  142. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +7 -0
  143. package/dist/esnext/foundation/useRouteParams/useRouteParams.d.ts +4 -0
  144. package/dist/esnext/foundation/useRouteParams/useRouteParams.js +9 -0
  145. package/dist/esnext/foundation/useUrl/useUrl.js +1 -1
  146. package/dist/esnext/framework/Hydration/Html.d.ts +2 -0
  147. package/dist/esnext/framework/Hydration/Html.js +71 -2
  148. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  149. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +28 -7
  150. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  151. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +5 -0
  152. package/dist/esnext/framework/Hydration/rsc.js +1 -1
  153. package/dist/esnext/framework/cache/in-memory.d.ts +1 -0
  154. package/dist/esnext/framework/cache/in-memory.js +15 -5
  155. package/dist/esnext/framework/middleware.js +25 -3
  156. package/dist/esnext/framework/plugin.js +6 -1
  157. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  158. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +28 -0
  159. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
  160. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
  161. package/dist/esnext/hooks/index.d.ts +0 -1
  162. package/dist/esnext/hooks/index.js +0 -1
  163. package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +10 -18
  164. package/dist/esnext/hooks/useCountry/useCountry.d.ts +4 -4
  165. package/dist/esnext/hooks/useMoney/hooks.d.ts +3 -3
  166. package/dist/esnext/hooks/useMoney/hooks.js +2 -2
  167. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +17 -2
  168. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +7 -3
  169. package/dist/esnext/hooks/useProduct/useProduct.d.ts +36 -138
  170. package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -4
  171. package/dist/esnext/hooks/useProductOptions/helpers.js +13 -6
  172. package/dist/esnext/hooks/useProductOptions/types.d.ts +15 -35
  173. package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +6 -5
  174. package/dist/esnext/hooks/useProductOptions/useProductOptions.js +13 -3
  175. package/dist/esnext/hooks/useShopQuery/hooks.js +79 -21
  176. package/dist/esnext/index.d.ts +8 -2
  177. package/dist/esnext/index.js +8 -2
  178. package/dist/esnext/platforms/node.d.ts +2 -3
  179. package/dist/esnext/platforms/node.js +5 -3
  180. package/dist/esnext/platforms/worker-event.d.ts +0 -8
  181. package/dist/esnext/platforms/worker-event.js +2 -23
  182. package/dist/esnext/platforms/worker.d.ts +14 -0
  183. package/dist/esnext/platforms/worker.js +25 -0
  184. package/dist/esnext/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
  185. package/dist/esnext/{graphql/types/types.js → storefront-api-types.js} +1025 -732
  186. package/dist/esnext/streaming.server.d.ts +9 -6
  187. package/dist/esnext/streaming.server.js +2 -27
  188. package/dist/esnext/types.d.ts +3 -18
  189. package/dist/esnext/utilities/apiRoutes.d.ts +19 -3
  190. package/dist/esnext/utilities/apiRoutes.js +27 -5
  191. package/dist/esnext/utilities/devtools.d.ts +11 -0
  192. package/dist/esnext/utilities/devtools.js +11 -0
  193. package/dist/esnext/utilities/fetch.d.ts +7 -1
  194. package/dist/esnext/utilities/fetch.js +9 -18
  195. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +3 -2
  196. package/dist/esnext/utilities/flattenConnection/flattenConnection.js +6 -2
  197. package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
  198. package/dist/esnext/utilities/graphql-tracker.js +119 -0
  199. package/dist/esnext/utilities/image_size.d.ts +5 -4
  200. package/dist/esnext/utilities/log/log-query-timeline.d.ts +1 -1
  201. package/dist/esnext/utilities/log/log-query-timeline.js +1 -2
  202. package/dist/esnext/utilities/log/log.d.ts +1 -0
  203. package/dist/esnext/utilities/log/utils.js +3 -0
  204. package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +3 -2
  205. package/dist/esnext/utilities/video_parameters.js +0 -4
  206. package/dist/esnext/version.d.ts +1 -1
  207. package/dist/esnext/version.js +1 -1
  208. package/dist/node/entry-server.d.ts +2 -1
  209. package/dist/node/entry-server.js +129 -158
  210. package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
  211. package/dist/node/foundation/Redirect/Redirect.client.js +17 -0
  212. package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
  213. package/dist/node/foundation/Router/BrowserRouter.client.js +77 -0
  214. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +24 -25
  215. package/dist/node/foundation/ServerRequestProvider/index.js +5 -1
  216. package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
  217. package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +5 -1
  218. package/dist/node/foundation/ServerStateProvider/index.d.ts +2 -2
  219. package/dist/node/foundation/ServerStateProvider/index.js +3 -3
  220. package/dist/node/foundation/ssr-interop.d.ts +29 -0
  221. package/dist/node/foundation/ssr-interop.js +39 -0
  222. package/dist/node/foundation/useNavigate/useNavigate.d.ts +13 -0
  223. package/dist/node/foundation/useNavigate/useNavigate.js +18 -0
  224. package/dist/node/foundation/useServerState/index.d.ts +1 -0
  225. package/dist/node/foundation/useServerState/index.js +5 -0
  226. package/dist/node/foundation/useServerState/use-server-state.d.ts +16 -0
  227. package/dist/node/foundation/useServerState/use-server-state.js +24 -0
  228. package/dist/node/framework/Hydration/Html.d.ts +2 -0
  229. package/dist/node/framework/Hydration/Html.js +73 -3
  230. package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  231. package/dist/node/framework/Hydration/ServerComponentRequest.server.js +28 -7
  232. package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  233. package/dist/node/framework/Hydration/ServerComponentResponse.server.js +8 -0
  234. package/dist/node/framework/Hydration/rsc.js +1 -1
  235. package/dist/node/framework/cache/in-memory.d.ts +1 -0
  236. package/dist/node/framework/cache/in-memory.js +15 -5
  237. package/dist/node/framework/middleware.js +30 -4
  238. package/dist/node/framework/plugin.js +11 -2
  239. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  240. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +31 -0
  241. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
  242. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +1 -1
  243. package/dist/node/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
  244. package/dist/node/{graphql/types/types.js → storefront-api-types.js} +1026 -733
  245. package/dist/node/streaming.server.d.ts +9 -6
  246. package/dist/node/streaming.server.js +3 -29
  247. package/dist/node/types.d.ts +3 -18
  248. package/dist/node/utilities/apiRoutes.d.ts +19 -3
  249. package/dist/node/utilities/apiRoutes.js +29 -7
  250. package/dist/node/utilities/fetch.d.ts +10 -0
  251. package/dist/node/utilities/fetch.js +39 -0
  252. package/dist/node/utilities/log/log-query-timeline.d.ts +1 -1
  253. package/dist/node/utilities/log/log-query-timeline.js +1 -2
  254. package/dist/node/utilities/log/log.d.ts +1 -0
  255. package/dist/node/utilities/log/utils.js +3 -0
  256. package/dist/node/utilities/web-api-polyfill.js +5 -1
  257. package/dist/node/version.d.ts +1 -0
  258. package/dist/node/version.js +4 -0
  259. package/package.json +21 -21
  260. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +43 -104
  261. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1566 -848
  262. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +36 -421
  263. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1523 -864
  264. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +35 -437
  265. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +507 -517
  266. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +10 -246
  267. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +18 -25
  268. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +47 -108
  269. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1033 -306
  270. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +965 -293
  271. package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +98 -108
  272. package/vendor/react-server-dom-vite/package.json +0 -2
  273. package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.d.ts +0 -4
  274. package/dist/esnext/components/Image/ImageFragment.d.ts +0 -4
  275. package/dist/esnext/components/Image/ImageFragment.js +0 -1
  276. package/dist/esnext/components/MediaFile/MediaFileFragment.d.ts +0 -22
  277. package/dist/esnext/components/MediaFile/MediaFileFragment.js +0 -1
  278. package/dist/esnext/components/Metafield/MetafieldFragment.d.ts +0 -19
  279. package/dist/esnext/components/Metafield/MetafieldFragment.js +0 -1
  280. package/dist/esnext/components/ModelViewer/Model3DFragment.d.ts +0 -11
  281. package/dist/esnext/components/ModelViewer/Model3DFragment.js +0 -1
  282. package/dist/esnext/components/Money/MoneyFragment.d.ts +0 -4
  283. package/dist/esnext/components/Money/MoneyFragment.js +0 -1
  284. package/dist/esnext/components/ProductProvider/ProductProviderFragment.d.ts +0 -80
  285. package/dist/esnext/components/ProductProvider/ProductProviderFragment.js +0 -1
  286. package/dist/esnext/components/ProductProvider/types.d.ts +0 -19
  287. package/dist/esnext/components/ProductProvider/types.js +0 -1
  288. package/dist/esnext/components/RawHtml/RawHtml.d.ts +0 -19
  289. package/dist/esnext/components/RawHtml/RawHtml.js +0 -21
  290. package/dist/esnext/components/RawHtml/index.d.ts +0 -1
  291. package/dist/esnext/components/RawHtml/index.js +0 -1
  292. package/dist/esnext/components/Router/index.d.ts +0 -1
  293. package/dist/esnext/components/Router/index.js +0 -1
  294. package/dist/esnext/components/Seo/types.d.ts +0 -67
  295. package/dist/esnext/components/Seo/types.js +0 -1
  296. package/dist/esnext/components/UnitPrice/UnitPriceFragment.d.ts +0 -12
  297. package/dist/esnext/components/UnitPrice/UnitPriceFragment.js +0 -1
  298. package/dist/esnext/components/Video/VideoFragment.d.ts +0 -11
  299. package/dist/esnext/components/Video/VideoFragment.js +0 -1
  300. package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.d.ts +0 -3
  301. package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.js +0 -14
  302. package/dist/esnext/foundation/Router/DefaultRoutes.d.ts +0 -22
  303. package/dist/esnext/foundation/Router/index.d.ts +0 -1
  304. package/dist/esnext/foundation/Router/index.js +0 -1
  305. package/dist/esnext/graphql/graphql-constants.d.ts +0 -1751
  306. package/dist/esnext/graphql/graphql-constants.js +0 -3364
  307. package/dist/esnext/hooks/useAvailableCountries/index.d.ts +0 -1
  308. package/dist/esnext/hooks/useAvailableCountries/index.js +0 -1
  309. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.d.ts +0 -11
  310. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.js +0 -17
  311. package/dist/esnext/hooks/useNavigate/index.d.ts +0 -1
  312. package/dist/esnext/hooks/useNavigate/index.js +0 -1
  313. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.d.ts +0 -28
  314. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.js +0 -1
  315. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.d.ts +0 -20
  316. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.js +0 -1
  317. package/dist/esnext/hooks/useProductOptions/VariantFragment.d.ts +0 -64
  318. package/dist/esnext/hooks/useProductOptions/VariantFragment.js +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license React
2
+ * @license React
3
3
  * react-server-dom-vite-writer.node.server.js
4
4
  *
5
5
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -8,20 +8,14 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
 
11
- import {__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from 'react';
11
+ import { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, createServerContext } from 'react';
12
12
 
13
13
  var ReactSharedInternals = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
14
14
 
15
15
  function error(format) {
16
16
  {
17
17
  {
18
- for (
19
- var _len2 = arguments.length,
20
- args = new Array(_len2 > 1 ? _len2 - 1 : 0),
21
- _key2 = 1;
22
- _key2 < _len2;
23
- _key2++
24
- ) {
18
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
25
19
  args[_key2 - 1] = arguments[_key2];
26
20
  }
27
21
 
@@ -42,6 +36,7 @@ function printWarning(level, format, args) {
42
36
  args = args.concat([stack]);
43
37
  } // eslint-disable-next-line react-internal/safe-string-coercion
44
38
 
39
+
45
40
  var argsWithFormat = args.map(function (item) {
46
41
  return String(item);
47
42
  }); // Careful: RN currently depends on this prefix
@@ -72,7 +67,7 @@ function beginWriting(destination) {
72
67
  destination.cork();
73
68
  }
74
69
  }
75
- function writeChunk(destination, chunk) {
70
+ function writeChunkAndReturn(destination, chunk) {
76
71
  var nodeBuffer = chunk; // close enough
77
72
 
78
73
  return destination.write(nodeBuffer);
@@ -89,6 +84,9 @@ function close(destination) {
89
84
  function stringToChunk(content) {
90
85
  return content;
91
86
  }
87
+ function stringToPrecomputedChunk(content) {
88
+ return Buffer.from(content, 'utf8');
89
+ }
92
90
  function closeWithError(destination, error) {
93
91
  // $FlowFixMe: This is an Error object or the destination accepts other types.
94
92
  destination.destroy(error);
@@ -104,7 +102,7 @@ function serializeRowHeader(tag, id) {
104
102
  function processErrorChunk(request, id, message, stack) {
105
103
  var errorInfo = {
106
104
  message: message,
107
- stack: stack,
105
+ stack: stack
108
106
  };
109
107
  var row = serializeRowHeader('E', id) + stringify(errorInfo) + '\n';
110
108
  return stringToChunk(row);
@@ -119,6 +117,10 @@ function processModuleChunk(request, id, moduleMetaData) {
119
117
  var row = serializeRowHeader('M', id) + json + '\n';
120
118
  return stringToChunk(row);
121
119
  }
120
+ function processProviderChunk(request, id, contextName) {
121
+ var row = serializeRowHeader('P', id) + contextName + '\n';
122
+ return stringToChunk(row);
123
+ }
122
124
  function processSymbolChunk(request, id, name) {
123
125
  var json = stringify(name);
124
126
  var row = serializeRowHeader('S', id) + json + '\n';
@@ -136,60 +138,765 @@ function isModuleReference(reference) {
136
138
  function resolveModuleMetaData(config, moduleReference) {
137
139
  return {
138
140
  id: moduleReference.filepath,
139
- name: moduleReference.name,
141
+ name: moduleReference.name
140
142
  };
141
143
  }
142
144
 
143
145
  // ATTENTION
144
146
  // When adding new symbols to this file,
145
147
  // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
146
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
147
- // nor polyfill, then a plain number is used for performance.
148
- var REACT_ELEMENT_TYPE = 0xeac7;
149
- var REACT_PORTAL_TYPE = 0xeaca;
150
- var REACT_FRAGMENT_TYPE = 0xeacb;
151
- var REACT_STRICT_MODE_TYPE = 0xeacc;
152
- var REACT_PROFILER_TYPE = 0xead2;
153
- var REACT_PROVIDER_TYPE = 0xeacd;
154
- var REACT_CONTEXT_TYPE = 0xeace;
155
- var REACT_FORWARD_REF_TYPE = 0xead0;
156
- var REACT_SUSPENSE_TYPE = 0xead1;
157
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
158
- var REACT_MEMO_TYPE = 0xead3;
159
- var REACT_LAZY_TYPE = 0xead4;
160
- var REACT_SCOPE_TYPE = 0xead7;
161
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
162
- var REACT_OFFSCREEN_TYPE = 0xeae2;
163
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
164
- var REACT_CACHE_TYPE = 0xeae4;
165
-
166
- if (typeof Symbol === 'function' && Symbol.for) {
167
- var symbolFor = Symbol.for;
168
- REACT_ELEMENT_TYPE = symbolFor('react.element');
169
- REACT_PORTAL_TYPE = symbolFor('react.portal');
170
- REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
171
- REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
172
- REACT_PROFILER_TYPE = symbolFor('react.profiler');
173
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
174
- REACT_CONTEXT_TYPE = symbolFor('react.context');
175
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
176
- REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
177
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
178
- REACT_MEMO_TYPE = symbolFor('react.memo');
179
- REACT_LAZY_TYPE = symbolFor('react.lazy');
180
- REACT_SCOPE_TYPE = symbolFor('react.scope');
181
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
182
- REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
183
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
184
- REACT_CACHE_TYPE = symbolFor('react.cache');
148
+ // The Symbol used to tag the ReactElement-like types.
149
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
150
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
151
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
152
+ var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
153
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
154
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
155
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
156
+ var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
157
+
158
+ // A reserved attribute.
159
+ // It is handled by React separately and shouldn't be written to the DOM.
160
+ var RESERVED = 0; // A simple string attribute.
161
+ // Attributes that aren't in the filter are presumed to have this type.
162
+
163
+ var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
164
+ // "enumerated" attributes with "true" and "false" as possible values.
165
+ // When true, it should be set to a "true" string.
166
+ // When false, it should be set to a "false" string.
167
+
168
+ var BOOLEANISH_STRING = 2; // A real boolean attribute.
169
+ // When true, it should be present (set either to an empty string or its name).
170
+ // When false, it should be omitted.
171
+
172
+ var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
173
+ // When true, it should be present (set either to an empty string or its name).
174
+ // When false, it should be omitted.
175
+ // For any other value, should be present with that value.
176
+
177
+ var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
178
+ // When falsy, it should be removed.
179
+
180
+ var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
181
+ // When falsy, it should be removed.
182
+
183
+ var POSITIVE_NUMERIC = 6;
184
+
185
+ function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
186
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
187
+ this.attributeName = attributeName;
188
+ this.attributeNamespace = attributeNamespace;
189
+ this.mustUseProperty = mustUseProperty;
190
+ this.propertyName = name;
191
+ this.type = type;
192
+ this.sanitizeURL = sanitizeURL;
193
+ this.removeEmptyString = removeEmptyString;
194
+ } // When adding attributes to this list, be sure to also add them to
195
+ // the `possibleStandardNames` module to ensure casing and incorrect
196
+ // name warnings.
197
+
198
+
199
+ var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
200
+
201
+ var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
202
+ // elements (not just inputs). Now that ReactDOMInput assigns to the
203
+ // defaultValue property -- do we need this?
204
+ 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
205
+
206
+ {
207
+ reservedProps.push('innerText', 'textContent');
185
208
  }
186
209
 
210
+ reservedProps.forEach(function (name) {
211
+ properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
212
+ name, // attributeName
213
+ null, // attributeNamespace
214
+ false, // sanitizeURL
215
+ false);
216
+ }); // A few React string attributes have a different name.
217
+ // This is a mapping from React prop names to the attribute names.
218
+
219
+ [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
220
+ var name = _ref[0],
221
+ attributeName = _ref[1];
222
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
223
+ attributeName, // attributeName
224
+ null, // attributeNamespace
225
+ false, // sanitizeURL
226
+ false);
227
+ }); // These are "enumerated" HTML attributes that accept "true" and "false".
228
+ // In React, we let users pass `true` and `false` even though technically
229
+ // these aren't boolean attributes (they are coerced to strings).
230
+
231
+ ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
232
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
233
+ name.toLowerCase(), // attributeName
234
+ null, // attributeNamespace
235
+ false, // sanitizeURL
236
+ false);
237
+ }); // These are "enumerated" SVG attributes that accept "true" and "false".
238
+ // In React, we let users pass `true` and `false` even though technically
239
+ // these aren't boolean attributes (they are coerced to strings).
240
+ // Since these are SVG attributes, their attribute names are case-sensitive.
241
+
242
+ ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
243
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
244
+ name, // attributeName
245
+ null, // attributeNamespace
246
+ false, // sanitizeURL
247
+ false);
248
+ }); // These are HTML boolean attributes.
249
+
250
+ ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
251
+ // on the client side because the browsers are inconsistent. Instead we call focus().
252
+ 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
253
+ 'itemScope'].forEach(function (name) {
254
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
255
+ name.toLowerCase(), // attributeName
256
+ null, // attributeNamespace
257
+ false, // sanitizeURL
258
+ false);
259
+ }); // These are the few React props that we set as DOM properties
260
+ // rather than attributes. These are all booleans.
261
+
262
+ ['checked', // Note: `option.selected` is not updated if `select.multiple` is
263
+ // disabled with `removeAttribute`. We have special logic for handling this.
264
+ 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
265
+ // you'll need to set attributeName to name.toLowerCase()
266
+ // instead in the assignment below.
267
+ ].forEach(function (name) {
268
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
269
+ name, // attributeName
270
+ null, // attributeNamespace
271
+ false, // sanitizeURL
272
+ false);
273
+ }); // These are HTML attributes that are "overloaded booleans": they behave like
274
+ // booleans, but can also accept a string value.
275
+
276
+ ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
277
+ // you'll need to set attributeName to name.toLowerCase()
278
+ // instead in the assignment below.
279
+ ].forEach(function (name) {
280
+ properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
281
+ name, // attributeName
282
+ null, // attributeNamespace
283
+ false, // sanitizeURL
284
+ false);
285
+ }); // These are HTML attributes that must be positive numbers.
286
+
287
+ ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
288
+ // you'll need to set attributeName to name.toLowerCase()
289
+ // instead in the assignment below.
290
+ ].forEach(function (name) {
291
+ properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
292
+ name, // attributeName
293
+ null, // attributeNamespace
294
+ false, // sanitizeURL
295
+ false);
296
+ }); // These are HTML attributes that must be numbers.
297
+
298
+ ['rowSpan', 'start'].forEach(function (name) {
299
+ properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
300
+ name.toLowerCase(), // attributeName
301
+ null, // attributeNamespace
302
+ false, // sanitizeURL
303
+ false);
304
+ });
305
+ var CAMELIZE = /[\-\:]([a-z])/g;
306
+
307
+ var capitalize = function (token) {
308
+ return token[1].toUpperCase();
309
+ }; // This is a list of all SVG attributes that need special casing, namespacing,
310
+ // or boolean value assignment. Regular attributes that just accept strings
311
+ // and have the same names are omitted, just like in the HTML attribute filter.
312
+ // Some of these attributes can be hard to find. This list was created by
313
+ // scraping the MDN documentation.
314
+
315
+
316
+ ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
317
+ // you'll need to set attributeName to name.toLowerCase()
318
+ // instead in the assignment below.
319
+ ].forEach(function (attributeName) {
320
+ var name = attributeName.replace(CAMELIZE, capitalize);
321
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
322
+ attributeName, null, // attributeNamespace
323
+ false, // sanitizeURL
324
+ false);
325
+ }); // String SVG attributes with the xlink namespace.
326
+
327
+ ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
328
+ // you'll need to set attributeName to name.toLowerCase()
329
+ // instead in the assignment below.
330
+ ].forEach(function (attributeName) {
331
+ var name = attributeName.replace(CAMELIZE, capitalize);
332
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
333
+ attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL
334
+ false);
335
+ }); // String SVG attributes with the xml namespace.
336
+
337
+ ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
338
+ // you'll need to set attributeName to name.toLowerCase()
339
+ // instead in the assignment below.
340
+ ].forEach(function (attributeName) {
341
+ var name = attributeName.replace(CAMELIZE, capitalize);
342
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
343
+ attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL
344
+ false);
345
+ }); // These attribute exists both in HTML and SVG.
346
+ // The attribute name is case-sensitive in SVG so we can't just use
347
+ // the React name like we do for attributes that exist only in HTML.
348
+
349
+ ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
350
+ properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
351
+ attributeName.toLowerCase(), // attributeName
352
+ null, // attributeNamespace
353
+ false, // sanitizeURL
354
+ false);
355
+ }); // These attributes accept URLs. These must not allow javascript: URLS.
356
+ // These will also need to accept Trusted Types object in the future.
357
+
358
+ var xlinkHref = 'xlinkHref';
359
+ properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
360
+ 'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL
361
+ false);
362
+ ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
363
+ properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
364
+ attributeName.toLowerCase(), // attributeName
365
+ null, // attributeNamespace
366
+ true, // sanitizeURL
367
+ true);
368
+ });
369
+
370
+ /**
371
+ * CSS properties which accept numbers but are not in units of "px".
372
+ */
373
+ var isUnitlessNumber = {
374
+ animationIterationCount: true,
375
+ aspectRatio: true,
376
+ borderImageOutset: true,
377
+ borderImageSlice: true,
378
+ borderImageWidth: true,
379
+ boxFlex: true,
380
+ boxFlexGroup: true,
381
+ boxOrdinalGroup: true,
382
+ columnCount: true,
383
+ columns: true,
384
+ flex: true,
385
+ flexGrow: true,
386
+ flexPositive: true,
387
+ flexShrink: true,
388
+ flexNegative: true,
389
+ flexOrder: true,
390
+ gridArea: true,
391
+ gridRow: true,
392
+ gridRowEnd: true,
393
+ gridRowSpan: true,
394
+ gridRowStart: true,
395
+ gridColumn: true,
396
+ gridColumnEnd: true,
397
+ gridColumnSpan: true,
398
+ gridColumnStart: true,
399
+ fontWeight: true,
400
+ lineClamp: true,
401
+ lineHeight: true,
402
+ opacity: true,
403
+ order: true,
404
+ orphans: true,
405
+ tabSize: true,
406
+ widows: true,
407
+ zIndex: true,
408
+ zoom: true,
409
+ // SVG-related properties
410
+ fillOpacity: true,
411
+ floodOpacity: true,
412
+ stopOpacity: true,
413
+ strokeDasharray: true,
414
+ strokeDashoffset: true,
415
+ strokeMiterlimit: true,
416
+ strokeOpacity: true,
417
+ strokeWidth: true
418
+ };
419
+ /**
420
+ * @param {string} prefix vendor-specific prefix, eg: Webkit
421
+ * @param {string} key style name, eg: transitionDuration
422
+ * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
423
+ * WebkitTransitionDuration
424
+ */
425
+
426
+ function prefixKey(prefix, key) {
427
+ return prefix + key.charAt(0).toUpperCase() + key.substring(1);
428
+ }
429
+ /**
430
+ * Support style names that may come passed in prefixed by adding permutations
431
+ * of vendor prefixes.
432
+ */
433
+
434
+
435
+ var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
436
+ // infinite loop, because it iterates over the newly added props too.
437
+
438
+ Object.keys(isUnitlessNumber).forEach(function (prop) {
439
+ prefixes.forEach(function (prefix) {
440
+ isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
441
+ });
442
+ });
443
+
187
444
  var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
188
445
 
189
446
  function isArray(a) {
190
447
  return isArrayImpl(a);
191
448
  }
192
449
 
450
+ var startInlineScript = stringToPrecomputedChunk('<script>');
451
+ var endInlineScript = stringToPrecomputedChunk('</script>');
452
+ var startScriptSrc = stringToPrecomputedChunk('<script src="');
453
+ var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
454
+ var endAsyncScript = stringToPrecomputedChunk('" async=""></script>'); // Allows us to keep track of what we've already written so we can refer back to it.
455
+
456
+ var textSeparator = stringToPrecomputedChunk('<!-- -->');
457
+
458
+ var styleAttributeStart = stringToPrecomputedChunk(' style="');
459
+ var styleAssign = stringToPrecomputedChunk(':');
460
+ var styleSeparator = stringToPrecomputedChunk(';');
461
+
462
+ var attributeSeparator = stringToPrecomputedChunk(' ');
463
+ var attributeAssign = stringToPrecomputedChunk('="');
464
+ var attributeEnd = stringToPrecomputedChunk('"');
465
+ var attributeEmptyString = stringToPrecomputedChunk('=""');
466
+
467
+ var endOfStartTag = stringToPrecomputedChunk('>');
468
+ var endOfStartTagSelfClosing = stringToPrecomputedChunk('/>');
469
+
470
+ var selectedMarkerAttribute = stringToPrecomputedChunk(' selected=""');
471
+
472
+ var leadingNewline = stringToPrecomputedChunk('\n');
473
+
474
+ var DOCTYPE = stringToPrecomputedChunk('<!DOCTYPE html>');
475
+ var endTag1 = stringToPrecomputedChunk('</');
476
+ var endTag2 = stringToPrecomputedChunk('>');
477
+ // A placeholder is a node inside a hidden partial tree that can be filled in later, but before
478
+ // display. It's never visible to users. We use the template tag because it can be used in every
479
+ // type of parent. <script> tags also work in every other tag except <colgroup>.
480
+
481
+ var placeholder1 = stringToPrecomputedChunk('<template id="');
482
+ var placeholder2 = stringToPrecomputedChunk('"></template>');
483
+
484
+ var startCompletedSuspenseBoundary = stringToPrecomputedChunk('<!--$-->');
485
+ var startPendingSuspenseBoundary1 = stringToPrecomputedChunk('<!--$?--><template id="');
486
+ var startPendingSuspenseBoundary2 = stringToPrecomputedChunk('"></template>');
487
+ var startClientRenderedSuspenseBoundary = stringToPrecomputedChunk('<!--$!-->');
488
+ var endSuspenseBoundary = stringToPrecomputedChunk('<!--/$-->');
489
+ var startSegmentHTML = stringToPrecomputedChunk('<div hidden id="');
490
+ var startSegmentHTML2 = stringToPrecomputedChunk('">');
491
+ var endSegmentHTML = stringToPrecomputedChunk('</div>');
492
+ var startSegmentSVG = stringToPrecomputedChunk('<svg aria-hidden="true" style="display:none" id="');
493
+ var startSegmentSVG2 = stringToPrecomputedChunk('">');
494
+ var endSegmentSVG = stringToPrecomputedChunk('</svg>');
495
+ var startSegmentMathML = stringToPrecomputedChunk('<math aria-hidden="true" style="display:none" id="');
496
+ var startSegmentMathML2 = stringToPrecomputedChunk('">');
497
+ var endSegmentMathML = stringToPrecomputedChunk('</math>');
498
+ var startSegmentTable = stringToPrecomputedChunk('<table hidden id="');
499
+ var startSegmentTable2 = stringToPrecomputedChunk('">');
500
+ var endSegmentTable = stringToPrecomputedChunk('</table>');
501
+ var startSegmentTableBody = stringToPrecomputedChunk('<table hidden><tbody id="');
502
+ var startSegmentTableBody2 = stringToPrecomputedChunk('">');
503
+ var endSegmentTableBody = stringToPrecomputedChunk('</tbody></table>');
504
+ var startSegmentTableRow = stringToPrecomputedChunk('<table hidden><tr id="');
505
+ var startSegmentTableRow2 = stringToPrecomputedChunk('">');
506
+ var endSegmentTableRow = stringToPrecomputedChunk('</tr></table>');
507
+ var startSegmentColGroup = stringToPrecomputedChunk('<table hidden><colgroup id="');
508
+ var startSegmentColGroup2 = stringToPrecomputedChunk('">');
509
+ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
510
+ // The following code is the source scripts that we then minify and inline below,
511
+ // with renamed function names that we hope don't collide:
512
+ // const COMMENT_NODE = 8;
513
+ // const SUSPENSE_START_DATA = '$';
514
+ // const SUSPENSE_END_DATA = '/$';
515
+ // const SUSPENSE_PENDING_START_DATA = '$?';
516
+ // const SUSPENSE_FALLBACK_START_DATA = '$!';
517
+ //
518
+ // function clientRenderBoundary(suspenseBoundaryID) {
519
+ // // Find the fallback's first element.
520
+ // const suspenseIdNode = document.getElementById(suspenseBoundaryID);
521
+ // if (!suspenseIdNode) {
522
+ // // The user must have already navigated away from this tree.
523
+ // // E.g. because the parent was hydrated.
524
+ // return;
525
+ // }
526
+ // // Find the boundary around the fallback. This is always the previous node.
527
+ // const suspenseNode = suspenseIdNode.previousSibling;
528
+ // // Tag it to be client rendered.
529
+ // suspenseNode.data = SUSPENSE_FALLBACK_START_DATA;
530
+ // // Tell React to retry it if the parent already hydrated.
531
+ // if (suspenseNode._reactRetry) {
532
+ // suspenseNode._reactRetry();
533
+ // }
534
+ // }
535
+ //
536
+ // function completeBoundary(suspenseBoundaryID, contentID) {
537
+ // // Find the fallback's first element.
538
+ // const suspenseIdNode = document.getElementById(suspenseBoundaryID);
539
+ // const contentNode = document.getElementById(contentID);
540
+ // // We'll detach the content node so that regardless of what happens next we don't leave in the tree.
541
+ // // This might also help by not causing recalcing each time we move a child from here to the target.
542
+ // contentNode.parentNode.removeChild(contentNode);
543
+ // if (!suspenseIdNode) {
544
+ // // The user must have already navigated away from this tree.
545
+ // // E.g. because the parent was hydrated. That's fine there's nothing to do
546
+ // // but we have to make sure that we already deleted the container node.
547
+ // return;
548
+ // }
549
+ // // Find the boundary around the fallback. This is always the previous node.
550
+ // const suspenseNode = suspenseIdNode.previousSibling;
551
+ //
552
+ // // Clear all the existing children. This is complicated because
553
+ // // there can be embedded Suspense boundaries in the fallback.
554
+ // // This is similar to clearSuspenseBoundary in ReactDOMHostConfig.
555
+ // // TODO: We could avoid this if we never emitted suspense boundaries in fallback trees.
556
+ // // They never hydrate anyway. However, currently we support incrementally loading the fallback.
557
+ // const parentInstance = suspenseNode.parentNode;
558
+ // let node = suspenseNode.nextSibling;
559
+ // let depth = 0;
560
+ // do {
561
+ // if (node && node.nodeType === COMMENT_NODE) {
562
+ // const data = node.data;
563
+ // if (data === SUSPENSE_END_DATA) {
564
+ // if (depth === 0) {
565
+ // break;
566
+ // } else {
567
+ // depth--;
568
+ // }
569
+ // } else if (
570
+ // data === SUSPENSE_START_DATA ||
571
+ // data === SUSPENSE_PENDING_START_DATA ||
572
+ // data === SUSPENSE_FALLBACK_START_DATA
573
+ // ) {
574
+ // depth++;
575
+ // }
576
+ // }
577
+ //
578
+ // const nextNode = node.nextSibling;
579
+ // parentInstance.removeChild(node);
580
+ // node = nextNode;
581
+ // } while (node);
582
+ //
583
+ // const endOfBoundary = node;
584
+ //
585
+ // // Insert all the children from the contentNode between the start and end of suspense boundary.
586
+ // while (contentNode.firstChild) {
587
+ // parentInstance.insertBefore(contentNode.firstChild, endOfBoundary);
588
+ // }
589
+ // suspenseNode.data = SUSPENSE_START_DATA;
590
+ // if (suspenseNode._reactRetry) {
591
+ // suspenseNode._reactRetry();
592
+ // }
593
+ // }
594
+ //
595
+ // function completeSegment(containerID, placeholderID) {
596
+ // const segmentContainer = document.getElementById(containerID);
597
+ // const placeholderNode = document.getElementById(placeholderID);
598
+ // // We always expect both nodes to exist here because, while we might
599
+ // // have navigated away from the main tree, we still expect the detached
600
+ // // tree to exist.
601
+ // segmentContainer.parentNode.removeChild(segmentContainer);
602
+ // while (segmentContainer.firstChild) {
603
+ // placeholderNode.parentNode.insertBefore(
604
+ // segmentContainer.firstChild,
605
+ // placeholderNode,
606
+ // );
607
+ // }
608
+ // placeholderNode.parentNode.removeChild(placeholderNode);
609
+ // }
610
+
611
+ 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)}';
612
+ 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()}}';
613
+ var clientRenderFunction = 'function $RX(a){if(a=document.getElementById(a))a=a.previousSibling,a.data="$!",a._reactRetry&&a._reactRetry()}';
614
+ var completeSegmentScript1Full = stringToPrecomputedChunk(completeSegmentFunction + ';$RS("');
615
+ var completeSegmentScript1Partial = stringToPrecomputedChunk('$RS("');
616
+ var completeSegmentScript2 = stringToPrecomputedChunk('","');
617
+ var completeSegmentScript3 = stringToPrecomputedChunk('")</script>');
618
+ var completeBoundaryScript1Full = stringToPrecomputedChunk(completeBoundaryFunction + ';$RC("');
619
+ var completeBoundaryScript1Partial = stringToPrecomputedChunk('$RC("');
620
+ var completeBoundaryScript2 = stringToPrecomputedChunk('","');
621
+ var completeBoundaryScript3 = stringToPrecomputedChunk('")</script>');
622
+ var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderFunction + ';$RX("');
623
+ var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
624
+ var clientRenderScript2 = stringToPrecomputedChunk('")</script>');
625
+
626
+ var rendererSigil;
627
+
628
+ {
629
+ // Use this to detect multiple renderers using the same context
630
+ rendererSigil = {};
631
+ } // Used to store the parent path of all context overrides in a shared linked list.
632
+ // Forming a reverse tree.
633
+
634
+
635
+ var rootContextSnapshot = null; // We assume that this runtime owns the "current" field on all ReactContext instances.
636
+ // This global (actually thread local) state represents what state all those "current",
637
+ // fields are currently in.
638
+
639
+ var currentActiveSnapshot = null;
640
+
641
+ function popNode(prev) {
642
+ {
643
+ prev.context._currentValue = prev.parentValue;
644
+ }
645
+ }
646
+
647
+ function pushNode(next) {
648
+ {
649
+ next.context._currentValue = next.value;
650
+ }
651
+ }
652
+
653
+ function popToNearestCommonAncestor(prev, next) {
654
+ if (prev === next) ; else {
655
+ popNode(prev);
656
+ var parentPrev = prev.parent;
657
+ var parentNext = next.parent;
658
+
659
+ if (parentPrev === null) {
660
+ if (parentNext !== null) {
661
+ throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
662
+ }
663
+ } else {
664
+ if (parentNext === null) {
665
+ throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
666
+ }
667
+
668
+ popToNearestCommonAncestor(parentPrev, parentNext); // On the way back, we push the new ones that weren't common.
669
+
670
+ pushNode(next);
671
+ }
672
+ }
673
+ }
674
+
675
+ function popAllPrevious(prev) {
676
+ popNode(prev);
677
+ var parentPrev = prev.parent;
678
+
679
+ if (parentPrev !== null) {
680
+ popAllPrevious(parentPrev);
681
+ }
682
+ }
683
+
684
+ function pushAllNext(next) {
685
+ var parentNext = next.parent;
686
+
687
+ if (parentNext !== null) {
688
+ pushAllNext(parentNext);
689
+ }
690
+
691
+ pushNode(next);
692
+ }
693
+
694
+ function popPreviousToCommonLevel(prev, next) {
695
+ popNode(prev);
696
+ var parentPrev = prev.parent;
697
+
698
+ if (parentPrev === null) {
699
+ throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
700
+ }
701
+
702
+ if (parentPrev.depth === next.depth) {
703
+ // We found the same level. Now we just need to find a shared ancestor.
704
+ popToNearestCommonAncestor(parentPrev, next);
705
+ } else {
706
+ // We must still be deeper.
707
+ popPreviousToCommonLevel(parentPrev, next);
708
+ }
709
+ }
710
+
711
+ function popNextToCommonLevel(prev, next) {
712
+ var parentNext = next.parent;
713
+
714
+ if (parentNext === null) {
715
+ throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
716
+ }
717
+
718
+ if (prev.depth === parentNext.depth) {
719
+ // We found the same level. Now we just need to find a shared ancestor.
720
+ popToNearestCommonAncestor(prev, parentNext);
721
+ } else {
722
+ // We must still be deeper.
723
+ popNextToCommonLevel(prev, parentNext);
724
+ }
725
+
726
+ pushNode(next);
727
+ } // Perform context switching to the new snapshot.
728
+ // To make it cheap to read many contexts, while not suspending, we make the switch eagerly by
729
+ // updating all the context's current values. That way reads, always just read the current value.
730
+ // At the cost of updating contexts even if they're never read by this subtree.
731
+
732
+
733
+ function switchContext(newSnapshot) {
734
+ // The basic algorithm we need to do is to pop back any contexts that are no longer on the stack.
735
+ // We also need to update any new contexts that are now on the stack with the deepest value.
736
+ // The easiest way to update new contexts is to just reapply them in reverse order from the
737
+ // perspective of the backpointers. To avoid allocating a lot when switching, we use the stack
738
+ // for that. Therefore this algorithm is recursive.
739
+ // 1) First we pop which ever snapshot tree was deepest. Popping old contexts as we go.
740
+ // 2) Then we find the nearest common ancestor from there. Popping old contexts as we go.
741
+ // 3) Then we reapply new contexts on the way back up the stack.
742
+ var prev = currentActiveSnapshot;
743
+ var next = newSnapshot;
744
+
745
+ if (prev !== next) {
746
+ if (prev === null) {
747
+ // $FlowFixMe: This has to be non-null since it's not equal to prev.
748
+ pushAllNext(next);
749
+ } else if (next === null) {
750
+ popAllPrevious(prev);
751
+ } else if (prev.depth === next.depth) {
752
+ popToNearestCommonAncestor(prev, next);
753
+ } else if (prev.depth > next.depth) {
754
+ popPreviousToCommonLevel(prev, next);
755
+ } else {
756
+ popNextToCommonLevel(prev, next);
757
+ }
758
+
759
+ currentActiveSnapshot = next;
760
+ }
761
+ }
762
+ function pushProvider(context, nextValue) {
763
+ var prevValue;
764
+
765
+ {
766
+ prevValue = context._currentValue;
767
+ context._currentValue = nextValue;
768
+
769
+ {
770
+ if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
771
+ error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
772
+ }
773
+
774
+ context._currentRenderer = rendererSigil;
775
+ }
776
+ }
777
+
778
+ var prevNode = currentActiveSnapshot;
779
+ var newNode = {
780
+ parent: prevNode,
781
+ depth: prevNode === null ? 0 : prevNode.depth + 1,
782
+ context: context,
783
+ parentValue: prevValue,
784
+ value: nextValue
785
+ };
786
+ currentActiveSnapshot = newNode;
787
+ return newNode;
788
+ }
789
+ function popProvider() {
790
+ var prevSnapshot = currentActiveSnapshot;
791
+
792
+ if (prevSnapshot === null) {
793
+ throw new Error('Tried to pop a Context at the root of the app. This is a bug in React.');
794
+ }
795
+
796
+ {
797
+ var value = prevSnapshot.parentValue;
798
+
799
+ if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
800
+ prevSnapshot.context._currentValue = prevSnapshot.context._defaultValue;
801
+ } else {
802
+ prevSnapshot.context._currentValue = value;
803
+ }
804
+ }
805
+
806
+ return currentActiveSnapshot = prevSnapshot.parent;
807
+ }
808
+ function getActiveContext() {
809
+ return currentActiveSnapshot;
810
+ }
811
+ function readContext(context) {
812
+ var value = context._currentValue ;
813
+ return value;
814
+ }
815
+
816
+ function readContext$1(context) {
817
+ {
818
+ if (context.$$typeof !== REACT_SERVER_CONTEXT_TYPE) {
819
+ error('Only ServerContext is supported in Flight');
820
+ }
821
+
822
+ if (currentCache === null) {
823
+ error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
824
+ }
825
+ }
826
+
827
+ return readContext(context);
828
+ }
829
+
830
+ var Dispatcher = {
831
+ useMemo: function (nextCreate) {
832
+ return nextCreate();
833
+ },
834
+ useCallback: function (callback) {
835
+ return callback;
836
+ },
837
+ useDebugValue: function () {},
838
+ useDeferredValue: unsupportedHook,
839
+ useTransition: unsupportedHook,
840
+ getCacheForType: function (resourceType) {
841
+ if (!currentCache) {
842
+ throw new Error('Reading the cache is only supported while rendering.');
843
+ }
844
+
845
+ var entry = currentCache.get(resourceType);
846
+
847
+ if (entry === undefined) {
848
+ entry = resourceType(); // TODO: Warn if undefined?
849
+
850
+ currentCache.set(resourceType, entry);
851
+ }
852
+
853
+ return entry;
854
+ },
855
+ readContext: readContext$1,
856
+ useContext: readContext$1,
857
+ useReducer: unsupportedHook,
858
+ useRef: unsupportedHook,
859
+ useState: unsupportedHook,
860
+ useInsertionEffect: unsupportedHook,
861
+ useLayoutEffect: unsupportedHook,
862
+ useImperativeHandle: unsupportedHook,
863
+ useEffect: unsupportedHook,
864
+ useId: unsupportedHook,
865
+ useMutableSource: unsupportedHook,
866
+ useSyncExternalStore: unsupportedHook,
867
+ useCacheRefresh: function () {
868
+ return unsupportedRefresh;
869
+ }
870
+ };
871
+
872
+ function unsupportedHook() {
873
+ throw new Error('This Hook is not supported in Server Components.');
874
+ }
875
+
876
+ function unsupportedRefresh() {
877
+ if (!currentCache) {
878
+ throw new Error('Refreshing the cache is not supported in Server Components.');
879
+ }
880
+ }
881
+
882
+ var currentCache = null;
883
+ function setCurrentCache(cache) {
884
+ currentCache = cache;
885
+ return currentCache;
886
+ }
887
+ function getCurrentCache() {
888
+ return currentCache;
889
+ }
890
+
891
+ var ContextRegistry = ReactSharedInternals.ContextRegistry;
892
+ function getOrCreateServerContext(globalName) {
893
+ if (!ContextRegistry[globalName]) {
894
+ ContextRegistry[globalName] = createServerContext(globalName, REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED);
895
+ }
896
+
897
+ return ContextRegistry[globalName];
898
+ }
899
+
193
900
  var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
194
901
 
195
902
  function defaultErrorHandler(error) {
@@ -199,7 +906,7 @@ function defaultErrorHandler(error) {
199
906
  var OPEN = 0;
200
907
  var CLOSING = 1;
201
908
  var CLOSED = 2;
202
- function createRequest(model, bundlerConfig, onError) {
909
+ function createRequest(model, bundlerConfig, onError, context) {
203
910
  var pingedSegments = [];
204
911
  var request = {
205
912
  status: OPEN,
@@ -215,25 +922,31 @@ function createRequest(model, bundlerConfig, onError) {
215
922
  completedErrorChunks: [],
216
923
  writtenSymbols: new Map(),
217
924
  writtenModules: new Map(),
925
+ writtenProviders: new Map(),
218
926
  onError: onError === undefined ? defaultErrorHandler : onError,
219
927
  toJSON: function (key, value) {
220
928
  return resolveModelToJSON(request, this, key, value);
221
- },
929
+ }
222
930
  };
223
931
  request.pendingChunks++;
224
- var rootSegment = createSegment(request, model);
932
+ var rootContext = createRootContext(context);
933
+ var rootSegment = createSegment(request, model, rootContext);
225
934
  pingedSegments.push(rootSegment);
226
935
  return request;
227
936
  }
228
937
 
938
+ function createRootContext(reqContext) {
939
+ return importServerContexts(reqContext);
940
+ }
941
+
942
+ var POP = {};
943
+
229
944
  function attemptResolveElement(type, key, ref, props) {
230
945
  if (ref !== null && ref !== undefined) {
231
946
  // When the ref moves to the regular props object this will implicitly
232
947
  // throw for functions. We could probably relax it to a DEV warning for other
233
948
  // cases.
234
- throw new Error(
235
- 'Refs cannot be used in server components, nor passed to client components.'
236
- );
949
+ throw new Error('Refs cannot be used in server components, nor passed to client components.');
237
950
  }
238
951
 
239
952
  if (typeof type === 'function') {
@@ -252,6 +965,7 @@ function attemptResolveElement(type, key, ref, props) {
252
965
  } // This might be a built-in React component. We'll let the client decide.
253
966
  // Any built-in works as long as its props are serializable.
254
967
 
968
+
255
969
  return [REACT_ELEMENT_TYPE, type, key, props];
256
970
  } else if (type != null && typeof type === 'object') {
257
971
  if (isModuleReference(type)) {
@@ -260,20 +974,54 @@ function attemptResolveElement(type, key, ref, props) {
260
974
  }
261
975
 
262
976
  switch (type.$$typeof) {
263
- case REACT_FORWARD_REF_TYPE: {
264
- var render = type.render;
265
- return render(props, undefined);
266
- }
977
+ case REACT_LAZY_TYPE:
978
+ {
979
+ var payload = type._payload;
980
+ var init = type._init;
981
+ var wrappedType = init(payload);
982
+ return attemptResolveElement(wrappedType, key, ref, props);
983
+ }
267
984
 
268
- case REACT_MEMO_TYPE: {
269
- return attemptResolveElement(type.type, key, ref, props);
270
- }
985
+ case REACT_FORWARD_REF_TYPE:
986
+ {
987
+ var render = type.render;
988
+ return render(props, undefined);
989
+ }
990
+
991
+ case REACT_MEMO_TYPE:
992
+ {
993
+ return attemptResolveElement(type.type, key, ref, props);
994
+ }
995
+
996
+ case REACT_PROVIDER_TYPE:
997
+ {
998
+ pushProvider(type._context, props.value);
999
+
1000
+ {
1001
+ var extraKeys = Object.keys(props).filter(function (value) {
1002
+ if (value === 'children' || value === 'value') {
1003
+ return false;
1004
+ }
1005
+
1006
+ return true;
1007
+ });
1008
+
1009
+ if (extraKeys.length !== 0) {
1010
+ error('ServerContext can only have a value prop and children. Found: %s', JSON.stringify(extraKeys));
1011
+ }
1012
+ }
1013
+
1014
+ return [REACT_ELEMENT_TYPE, type, key, // Rely on __popProvider being serialized last to pop the provider.
1015
+ {
1016
+ value: props.value,
1017
+ children: props.children,
1018
+ __pop: POP
1019
+ }];
1020
+ }
271
1021
  }
272
1022
  }
273
1023
 
274
- throw new Error(
275
- 'Unsupported server component type: ' + describeValueForErrorMessage(type)
276
- );
1024
+ throw new Error("Unsupported server component type: " + describeValueForErrorMessage(type));
277
1025
  }
278
1026
 
279
1027
  function pingSegment(request, segment) {
@@ -287,14 +1035,15 @@ function pingSegment(request, segment) {
287
1035
  }
288
1036
  }
289
1037
 
290
- function createSegment(request, model) {
1038
+ function createSegment(request, model, context) {
291
1039
  var id = request.nextChunkId++;
292
1040
  var segment = {
293
1041
  id: id,
294
1042
  model: model,
1043
+ context: context,
295
1044
  ping: function () {
296
1045
  return pingSegment(request, segment);
297
- },
1046
+ }
298
1047
  };
299
1048
  return segment;
300
1049
  }
@@ -320,7 +1069,7 @@ function escapeStringValue(value) {
320
1069
  function isObjectPrototype(object) {
321
1070
  if (!object) {
322
1071
  return false;
323
- } // $FlowFixMe
1072
+ }
324
1073
 
325
1074
  var ObjectPrototype = Object.prototype;
326
1075
 
@@ -329,6 +1078,7 @@ function isObjectPrototype(object) {
329
1078
  } // It might be an object from a different Realm which is
330
1079
  // still just a plain simple object.
331
1080
 
1081
+
332
1082
  if (Object.getPrototypeOf(object)) {
333
1083
  return false;
334
1084
  }
@@ -359,10 +1109,7 @@ function isSimpleObject(object) {
359
1109
  }
360
1110
 
361
1111
  if (!descriptor.enumerable) {
362
- if (
363
- (names[i] === 'key' || names[i] === 'ref') &&
364
- typeof descriptor.get === 'function'
365
- ) {
1112
+ if ((names[i] === 'key' || names[i] === 'ref') && typeof descriptor.get === 'function') {
366
1113
  // React adds key and ref getters to props objects to issue warnings.
367
1114
  // Those getters will not be transferred to the client, but that's ok,
368
1115
  // so we'll special case them.
@@ -390,25 +1137,25 @@ function describeKeyForErrorMessage(key) {
390
1137
 
391
1138
  function describeValueForErrorMessage(value) {
392
1139
  switch (typeof value) {
393
- case 'string': {
394
- return JSON.stringify(
395
- value.length <= 10 ? value : value.substr(0, 10) + '...'
396
- );
397
- }
398
-
399
- case 'object': {
400
- if (isArray(value)) {
401
- return '[...]';
1140
+ case 'string':
1141
+ {
1142
+ return JSON.stringify(value.length <= 10 ? value : value.substr(0, 10) + '...');
402
1143
  }
403
1144
 
404
- var name = objectName(value);
1145
+ case 'object':
1146
+ {
1147
+ if (isArray(value)) {
1148
+ return '[...]';
1149
+ }
405
1150
 
406
- if (name === 'Object') {
407
- return '{...}';
408
- }
1151
+ var name = objectName(value);
409
1152
 
410
- return name;
411
- }
1153
+ if (name === 'Object') {
1154
+ return '{...}';
1155
+ }
1156
+
1157
+ return name;
1158
+ }
412
1159
 
413
1160
  case 'function':
414
1161
  return 'function';
@@ -421,8 +1168,7 @@ function describeValueForErrorMessage(value) {
421
1168
 
422
1169
  function describeObjectForErrorMessage(objectOrArray, expandedName) {
423
1170
  if (isArray(objectOrArray)) {
424
- var str = '['; // $FlowFixMe: Should be refined by now.
425
-
1171
+ var str = '[';
426
1172
  var array = objectOrArray;
427
1173
 
428
1174
  for (var i = 0; i < array.length; i++) {
@@ -437,11 +1183,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
437
1183
 
438
1184
  var _value = array[i];
439
1185
 
440
- if (
441
- '' + i === expandedName &&
442
- typeof _value === 'object' &&
443
- _value !== null
444
- ) {
1186
+ if ('' + i === expandedName && typeof _value === 'object' && _value !== null) {
445
1187
  str += describeObjectForErrorMessage(_value);
446
1188
  } else {
447
1189
  str += describeValueForErrorMessage(_value);
@@ -451,8 +1193,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
451
1193
  str += ']';
452
1194
  return str;
453
1195
  } else {
454
- var _str = '{'; // $FlowFixMe: Should be refined by now.
455
-
1196
+ var _str = '{';
456
1197
  var object = objectOrArray;
457
1198
  var names = Object.keys(object);
458
1199
 
@@ -470,11 +1211,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
470
1211
  _str += describeKeyForErrorMessage(name) + ': ';
471
1212
  var _value2 = object[name];
472
1213
 
473
- if (
474
- name === expandedName &&
475
- typeof _value2 === 'object' &&
476
- _value2 !== null
477
- ) {
1214
+ if (name === expandedName && typeof _value2 === 'object' && _value2 !== null) {
478
1215
  _str += describeObjectForErrorMessage(_value2);
479
1216
  } else {
480
1217
  _str += describeValueForErrorMessage(_value2);
@@ -486,59 +1223,71 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
486
1223
  }
487
1224
  }
488
1225
 
1226
+ var insideContextProps = null;
1227
+ var isInsideContextValue = false;
489
1228
  function resolveModelToJSON(request, parent, key, value) {
490
1229
  {
491
1230
  // $FlowFixMe
492
1231
  var originalValue = parent[key];
493
1232
 
494
1233
  if (typeof originalValue === 'object' && originalValue !== value) {
495
- error(
496
- 'Only plain objects can be passed to client components from server components. ' +
497
- 'Objects with toJSON methods are not supported. Convert it manually ' +
498
- 'to a simple value before passing it to props. ' +
499
- 'Remove %s from these props: %s',
500
- describeKeyForErrorMessage(key),
501
- describeObjectForErrorMessage(parent)
502
- );
1234
+ error('Only plain objects can be passed to client components from server components. ' + 'Objects with toJSON methods are not supported. Convert it manually ' + 'to a simple value before passing it to props. ' + 'Remove %s from these props: %s', describeKeyForErrorMessage(key), describeObjectForErrorMessage(parent));
503
1235
  }
504
1236
  } // Special Symbols
505
1237
 
1238
+
506
1239
  switch (value) {
507
1240
  case REACT_ELEMENT_TYPE:
508
1241
  return '$';
1242
+ }
509
1243
 
510
- case REACT_LAZY_TYPE:
511
- throw new Error(
512
- 'React Lazy Components are not yet supported on the server.'
513
- );
1244
+ {
1245
+ if (parent[0] === REACT_ELEMENT_TYPE && parent[1] && parent[1].$$typeof === REACT_PROVIDER_TYPE && key === '3') {
1246
+ insideContextProps = value;
1247
+ } else if (insideContextProps === parent && key === 'value') {
1248
+ isInsideContextValue = true;
1249
+ } else if (insideContextProps === parent && key === 'children') {
1250
+ isInsideContextValue = false;
1251
+ }
514
1252
  } // Resolve server components.
515
1253
 
516
- while (
517
- typeof value === 'object' &&
518
- value !== null &&
519
- value.$$typeof === REACT_ELEMENT_TYPE
520
- ) {
521
- // TODO: Concatenate keys of parents onto children.
522
- var element = value;
1254
+
1255
+ while (typeof value === 'object' && value !== null && (value.$$typeof === REACT_ELEMENT_TYPE || value.$$typeof === REACT_LAZY_TYPE)) {
1256
+ {
1257
+ if (isInsideContextValue) {
1258
+ error('React elements are not allowed in ServerContext');
1259
+ }
1260
+ }
523
1261
 
524
1262
  try {
525
- // Attempt to render the server component.
526
- value = attemptResolveElement(
527
- element.type,
528
- element.key,
529
- element.ref,
530
- element.props
531
- );
1263
+ switch (value.$$typeof) {
1264
+ case REACT_ELEMENT_TYPE:
1265
+ {
1266
+ // TODO: Concatenate keys of parents onto children.
1267
+ var element = value; // Attempt to render the server component.
1268
+
1269
+ value = attemptResolveElement(element.type, element.key, element.ref, element.props);
1270
+ break;
1271
+ }
1272
+
1273
+ case REACT_LAZY_TYPE:
1274
+ {
1275
+ var payload = value._payload;
1276
+ var init = value._init;
1277
+ value = init(payload);
1278
+ break;
1279
+ }
1280
+ }
532
1281
  } catch (x) {
533
1282
  if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
534
1283
  // Something suspended, we'll need to create a new segment and resolve it later.
535
1284
  request.pendingChunks++;
536
- var newSegment = createSegment(request, value);
1285
+ var newSegment = createSegment(request, value, getActiveContext());
537
1286
  var ping = newSegment.ping;
538
1287
  x.then(ping, ping);
539
1288
  return serializeByRefID(newSegment.id);
540
1289
  } else {
541
- reportError(request, x); // Something errored. We'll still send everything we have up until this point.
1290
+ logRecoverableError(request, x); // Something errored. We'll still send everything we have up until this point.
542
1291
  // We'll replace this element with a lazy reference that throws on the client
543
1292
  // once it gets rendered.
544
1293
 
@@ -575,10 +1324,7 @@ function resolveModelToJSON(request, parent, key, value) {
575
1324
  }
576
1325
 
577
1326
  try {
578
- var moduleMetaData = resolveModuleMetaData(
579
- request.bundlerConfig,
580
- moduleReference
581
- );
1327
+ var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
582
1328
  request.pendingChunks++;
583
1329
  var moduleId = request.nextChunkId++;
584
1330
  emitModuleChunk(request, moduleId, moduleMetaData);
@@ -602,40 +1348,42 @@ function resolveModelToJSON(request, parent, key, value) {
602
1348
  emitErrorChunk(request, _errorId, x);
603
1349
  return serializeByValueID(_errorId);
604
1350
  }
1351
+ } else if (value.$$typeof === REACT_PROVIDER_TYPE) {
1352
+ var providerKey = value._context._globalName;
1353
+ var writtenProviders = request.writtenProviders;
1354
+ var providerId = writtenProviders.get(key);
1355
+
1356
+ if (providerId === undefined) {
1357
+ request.pendingChunks++;
1358
+ providerId = request.nextChunkId++;
1359
+ writtenProviders.set(providerKey, providerId);
1360
+ emitProviderChunk(request, providerId, providerKey);
1361
+ }
1362
+
1363
+ return serializeByValueID(providerId);
1364
+ } else if (value === POP) {
1365
+ popProvider();
1366
+
1367
+ {
1368
+ insideContextProps = null;
1369
+ isInsideContextValue = false;
1370
+ }
1371
+
1372
+ return undefined;
605
1373
  }
606
1374
 
607
1375
  {
608
1376
  if (value !== null && !isArray(value)) {
609
1377
  // Verify that this is a simple plain object.
610
1378
  if (objectName(value) !== 'Object') {
611
- error(
612
- 'Only plain objects can be passed to client components from server components. ' +
613
- 'Built-ins like %s are not supported. ' +
614
- 'Remove %s from these props: %s',
615
- objectName(value),
616
- describeKeyForErrorMessage(key),
617
- describeObjectForErrorMessage(parent)
618
- );
1379
+ 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));
619
1380
  } else if (!isSimpleObject(value)) {
620
- error(
621
- 'Only plain objects can be passed to client components from server components. ' +
622
- 'Classes or other objects with methods are not supported. ' +
623
- 'Remove %s from these props: %s',
624
- describeKeyForErrorMessage(key),
625
- describeObjectForErrorMessage(parent, key)
626
- );
1381
+ 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));
627
1382
  } else if (Object.getOwnPropertySymbols) {
628
1383
  var symbols = Object.getOwnPropertySymbols(value);
629
1384
 
630
1385
  if (symbols.length > 0) {
631
- error(
632
- 'Only plain objects can be passed to client components from server components. ' +
633
- 'Objects with symbol properties like %s are not supported. ' +
634
- 'Remove %s from these props: %s',
635
- symbols[0].description,
636
- describeKeyForErrorMessage(key),
637
- describeObjectForErrorMessage(parent, key)
638
- );
1386
+ error('Only plain objects can be passed to client components from server components. ' + 'Objects with symbol properties like %s are not supported. ' + 'Remove %s from these props: %s', symbols[0].description, describeKeyForErrorMessage(key), describeObjectForErrorMessage(parent, key));
639
1387
  }
640
1388
  }
641
1389
  }
@@ -648,36 +1396,15 @@ function resolveModelToJSON(request, parent, key, value) {
648
1396
  return escapeStringValue(value);
649
1397
  }
650
1398
 
651
- if (
652
- typeof value === 'boolean' ||
653
- typeof value === 'number' ||
654
- typeof value === 'undefined'
655
- ) {
1399
+ if (typeof value === 'boolean' || typeof value === 'number' || typeof value === 'undefined') {
656
1400
  return value;
657
1401
  }
658
1402
 
659
1403
  if (typeof value === 'function') {
660
1404
  if (/^on[A-Z]/.test(key)) {
661
- throw new Error(
662
- 'Event handlers cannot be passed to client component props. ' +
663
- ('Remove ' +
664
- describeKeyForErrorMessage(key) +
665
- ' from these props if possible: ' +
666
- describeObjectForErrorMessage(parent) +
667
- '\n') +
668
- 'If you need interactivity, consider converting part of this to a client component.'
669
- );
1405
+ throw new Error('Event handlers cannot be passed to client component props. ' + ("Remove " + describeKeyForErrorMessage(key) + " from these props if possible: " + describeObjectForErrorMessage(parent) + "\n") + 'If you need interactivity, consider converting part of this to a client component.');
670
1406
  } else {
671
- throw new Error(
672
- 'Functions cannot be passed directly to client components ' +
673
- "because they're not serializable. " +
674
- ('Remove ' +
675
- describeKeyForErrorMessage(key) +
676
- ' (' +
677
- (value.displayName || value.name || 'function') +
678
- ') from this object, or avoid the entire object: ' +
679
- describeObjectForErrorMessage(parent))
680
- );
1407
+ throw new Error('Functions cannot be passed directly to client components ' + "because they're not serializable. " + ("Remove " + describeKeyForErrorMessage(key) + " (" + (value.displayName || value.name || 'function') + ") from this object, or avoid the entire object: " + describeObjectForErrorMessage(parent)));
681
1408
  }
682
1409
  }
683
1410
 
@@ -693,16 +1420,7 @@ function resolveModelToJSON(request, parent, key, value) {
693
1420
  var name = value.description;
694
1421
 
695
1422
  if (Symbol.for(name) !== value) {
696
- throw new Error(
697
- 'Only global symbols received from Symbol.for(...) can be passed to client components. ' +
698
- ('The symbol Symbol.for(' +
699
- value.description +
700
- ') cannot be found among global symbols. ') +
701
- ('Remove ' +
702
- describeKeyForErrorMessage(key) +
703
- ' from this object, or avoid the entire object: ' +
704
- describeObjectForErrorMessage(parent))
705
- );
1423
+ throw new Error('Only global symbols received from Symbol.for(...) can be passed to client components. ' + ("The symbol Symbol.for(" + value.description + ") cannot be found among global symbols. ") + ("Remove " + describeKeyForErrorMessage(key) + " from this object, or avoid the entire object: " + describeObjectForErrorMessage(parent)));
706
1424
  }
707
1425
 
708
1426
  request.pendingChunks++;
@@ -712,30 +1430,15 @@ function resolveModelToJSON(request, parent, key, value) {
712
1430
  return serializeByValueID(symbolId);
713
1431
  } // $FlowFixMe: bigint isn't added to Flow yet.
714
1432
 
1433
+
715
1434
  if (typeof value === 'bigint') {
716
- throw new Error(
717
- 'BigInt (' +
718
- value +
719
- ') is not yet supported in client component props. ' +
720
- ('Remove ' +
721
- describeKeyForErrorMessage(key) +
722
- ' from this object or use a plain number instead: ' +
723
- describeObjectForErrorMessage(parent))
724
- );
1435
+ throw new Error("BigInt (" + value + ") is not yet supported in client component props. " + ("Remove " + describeKeyForErrorMessage(key) + " from this object or use a plain number instead: " + describeObjectForErrorMessage(parent)));
725
1436
  }
726
1437
 
727
- throw new Error(
728
- 'Type ' +
729
- typeof value +
730
- ' is not supported in client component props. ' +
731
- ('Remove ' +
732
- describeKeyForErrorMessage(key) +
733
- ' from this object, or avoid the entire object: ' +
734
- describeObjectForErrorMessage(parent))
735
- );
1438
+ throw new Error("Type " + typeof value + " is not supported in client component props. " + ("Remove " + describeKeyForErrorMessage(key) + " from this object, or avoid the entire object: " + describeObjectForErrorMessage(parent)));
736
1439
  }
737
1440
 
738
- function reportError(request, error) {
1441
+ function logRecoverableError(request, error) {
739
1442
  var onError = request.onError;
740
1443
  onError(error);
741
1444
  }
@@ -785,27 +1488,25 @@ function emitSymbolChunk(request, id, name) {
785
1488
  request.completedModuleChunks.push(processedChunk);
786
1489
  }
787
1490
 
1491
+ function emitProviderChunk(request, id, contextName) {
1492
+ var processedChunk = processProviderChunk(request, id, contextName);
1493
+ request.completedJSONChunks.push(processedChunk);
1494
+ }
1495
+
788
1496
  function retrySegment(request, segment) {
1497
+ switchContext(segment.context);
1498
+
789
1499
  try {
790
1500
  var _value3 = segment.model;
791
1501
 
792
- while (
793
- typeof _value3 === 'object' &&
794
- _value3 !== null &&
795
- _value3.$$typeof === REACT_ELEMENT_TYPE
796
- ) {
1502
+ while (typeof _value3 === 'object' && _value3 !== null && _value3.$$typeof === REACT_ELEMENT_TYPE) {
797
1503
  // TODO: Concatenate keys of parents onto children.
798
1504
  var element = _value3; // Attempt to render the server component.
799
1505
  // Doing this here lets us reuse this same segment if the next component
800
1506
  // also suspends.
801
1507
 
802
1508
  segment.model = _value3;
803
- _value3 = attemptResolveElement(
804
- element.type,
805
- element.key,
806
- element.ref,
807
- element.props
808
- );
1509
+ _value3 = attemptResolveElement(element.type, element.key, element.ref, element.props);
809
1510
  }
810
1511
 
811
1512
  var processedChunk = processModelChunk(request, segment.id, _value3);
@@ -817,7 +1518,7 @@ function retrySegment(request, segment) {
817
1518
  x.then(ping, ping);
818
1519
  return;
819
1520
  } else {
820
- reportError(request, x); // This errored, we need to serialize this error to the
1521
+ logRecoverableError(request, x); // This errored, we need to serialize this error to the
821
1522
 
822
1523
  emitErrorChunk(request, segment.id, x);
823
1524
  }
@@ -826,9 +1527,9 @@ function retrySegment(request, segment) {
826
1527
 
827
1528
  function performWork(request) {
828
1529
  var prevDispatcher = ReactCurrentDispatcher.current;
829
- var prevCache = currentCache;
1530
+ var prevCache = getCurrentCache();
830
1531
  ReactCurrentDispatcher.current = Dispatcher;
831
- currentCache = request.cache;
1532
+ setCurrentCache(request.cache);
832
1533
 
833
1534
  try {
834
1535
  var pingedSegments = request.pingedSegments;
@@ -843,11 +1544,11 @@ function performWork(request) {
843
1544
  flushCompletedChunks(request, request.destination);
844
1545
  }
845
1546
  } catch (error) {
846
- reportError(request, error);
1547
+ logRecoverableError(request, error);
847
1548
  fatalError(request, error);
848
1549
  } finally {
849
1550
  ReactCurrentDispatcher.current = prevDispatcher;
850
- currentCache = prevCache;
1551
+ setCurrentCache(prevCache);
851
1552
  }
852
1553
  }
853
1554
 
@@ -863,8 +1564,9 @@ function flushCompletedChunks(request, destination) {
863
1564
  for (; i < moduleChunks.length; i++) {
864
1565
  request.pendingChunks--;
865
1566
  var chunk = moduleChunks[i];
1567
+ var keepWriting = writeChunkAndReturn(destination, chunk);
866
1568
 
867
- if (!writeChunk(destination, chunk)) {
1569
+ if (!keepWriting) {
868
1570
  request.destination = null;
869
1571
  i++;
870
1572
  break;
@@ -880,7 +1582,9 @@ function flushCompletedChunks(request, destination) {
880
1582
  request.pendingChunks--;
881
1583
  var _chunk = jsonChunks[i];
882
1584
 
883
- if (!writeChunk(destination, _chunk)) {
1585
+ var _keepWriting = writeChunkAndReturn(destination, _chunk);
1586
+
1587
+ if (!_keepWriting) {
884
1588
  request.destination = null;
885
1589
  i++;
886
1590
  break;
@@ -898,7 +1602,9 @@ function flushCompletedChunks(request, destination) {
898
1602
  request.pendingChunks--;
899
1603
  var _chunk2 = errorChunks[i];
900
1604
 
901
- if (!writeChunk(destination, _chunk2)) {
1605
+ var _keepWriting2 = writeChunkAndReturn(destination, _chunk2);
1606
+
1607
+ if (!_keepWriting2) {
902
1608
  request.destination = null;
903
1609
  i++;
904
1610
  break;
@@ -934,70 +1640,41 @@ function startFlowing(request, destination) {
934
1640
  return;
935
1641
  }
936
1642
 
1643
+ if (request.destination !== null) {
1644
+ // We're already flowing.
1645
+ return;
1646
+ }
1647
+
937
1648
  request.destination = destination;
938
1649
 
939
1650
  try {
940
1651
  flushCompletedChunks(request, destination);
941
1652
  } catch (error) {
942
- reportError(request, error);
1653
+ logRecoverableError(request, error);
943
1654
  fatalError(request, error);
944
1655
  }
945
1656
  }
946
1657
 
947
- function unsupportedHook() {
948
- throw new Error('This Hook is not supported in Server Components.');
949
- }
950
-
951
- function unsupportedRefresh() {
952
- if (!currentCache) {
953
- throw new Error(
954
- 'Refreshing the cache is not supported in Server Components.'
955
- );
956
- }
957
- }
958
-
959
- var currentCache = null;
960
- var Dispatcher = {
961
- useMemo: function (nextCreate) {
962
- return nextCreate();
963
- },
964
- useCallback: function (callback) {
965
- return callback;
966
- },
967
- useDebugValue: function () {},
968
- useDeferredValue: unsupportedHook,
969
- useTransition: unsupportedHook,
970
- getCacheForType: function (resourceType) {
971
- if (!currentCache) {
972
- throw new Error('Reading the cache is only supported while rendering.');
1658
+ function importServerContexts(contexts) {
1659
+ if (contexts) {
1660
+ var prevContext = getActiveContext();
1661
+ switchContext(rootContextSnapshot);
1662
+
1663
+ for (var i = 0; i < contexts.length; i++) {
1664
+ var _contexts$i = contexts[i],
1665
+ name = _contexts$i[0],
1666
+ _value4 = _contexts$i[1];
1667
+ var context = getOrCreateServerContext(name);
1668
+ pushProvider(context, _value4);
973
1669
  }
974
1670
 
975
- var entry = currentCache.get(resourceType);
976
-
977
- if (entry === undefined) {
978
- entry = resourceType(); // TODO: Warn if undefined?
979
-
980
- currentCache.set(resourceType, entry);
981
- }
1671
+ var importedContext = getActiveContext();
1672
+ switchContext(prevContext);
1673
+ return importedContext;
1674
+ }
982
1675
 
983
- return entry;
984
- },
985
- readContext: unsupportedHook,
986
- useContext: unsupportedHook,
987
- useReducer: unsupportedHook,
988
- useRef: unsupportedHook,
989
- useState: unsupportedHook,
990
- useInsertionEffect: unsupportedHook,
991
- useLayoutEffect: unsupportedHook,
992
- useImperativeHandle: unsupportedHook,
993
- useEffect: unsupportedHook,
994
- useId: unsupportedHook,
995
- useMutableSource: unsupportedHook,
996
- useSyncExternalStore: unsupportedHook,
997
- useCacheRefresh: function () {
998
- return unsupportedRefresh;
999
- },
1000
- };
1676
+ return rootContextSnapshot;
1677
+ }
1001
1678
 
1002
1679
  function createDrainHandler(destination, request) {
1003
1680
  return function () {
@@ -1005,28 +1682,23 @@ function createDrainHandler(destination, request) {
1005
1682
  };
1006
1683
  }
1007
1684
 
1008
- function renderToPipeableStream(model, options) {
1009
- var request = createRequest(
1010
- model,
1011
- {}, // Manifest, not used
1012
- options ? options.onError : undefined
1013
- );
1685
+ function renderToPipeableStream(model, options, context) {
1686
+ var request = createRequest(model, {}, // Manifest, not used
1687
+ options ? options.onError : undefined, context);
1014
1688
  var hasStartedFlowing = false;
1015
1689
  startWork(request);
1016
1690
  return {
1017
1691
  pipe: function (destination) {
1018
1692
  if (hasStartedFlowing) {
1019
- throw new Error(
1020
- 'React currently only supports piping to one writable stream.'
1021
- );
1693
+ throw new Error('React currently only supports piping to one writable stream.');
1022
1694
  }
1023
1695
 
1024
1696
  hasStartedFlowing = true;
1025
1697
  startFlowing(request, destination);
1026
1698
  destination.on('drain', createDrainHandler(destination, request));
1027
1699
  return destination;
1028
- },
1700
+ }
1029
1701
  };
1030
1702
  }
1031
1703
 
1032
- export {renderToPipeableStream};
1704
+ export { renderToPipeableStream };