@shopify/hydrogen 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/dist/esnext/FileSessionStorage.d.ts +1 -1
  2. package/dist/esnext/FileSessionStorage.js +1 -1
  3. package/dist/esnext/client.d.ts +16 -16
  4. package/dist/esnext/client.js +16 -16
  5. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +5 -2
  6. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +6 -5
  7. package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
  8. package/dist/esnext/components/AddToCartButton/index.js +1 -1
  9. package/dist/esnext/components/BaseButton/BaseButton.client.d.ts +7 -5
  10. package/dist/esnext/components/BaseButton/BaseButton.client.js +5 -4
  11. package/dist/esnext/components/BaseButton/index.d.ts +1 -1
  12. package/dist/esnext/components/BaseButton/index.js +1 -1
  13. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +3 -2
  14. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.js +2 -2
  15. package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
  16. package/dist/esnext/components/BuyNowButton/index.js +1 -1
  17. package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.js +1 -1
  18. package/dist/esnext/components/CartCheckoutButton/index.d.ts +1 -1
  19. package/dist/esnext/components/CartCheckoutButton/index.js +1 -1
  20. package/dist/esnext/components/CartCost/CartCost.client.d.ts +1 -1
  21. package/dist/esnext/components/CartCost/CartCost.client.js +2 -2
  22. package/dist/esnext/components/CartCost/index.d.ts +1 -1
  23. package/dist/esnext/components/CartCost/index.js +1 -1
  24. package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +1 -1
  25. package/dist/esnext/components/CartLineImage/CartLineImage.client.js +2 -2
  26. package/dist/esnext/components/CartLineImage/index.d.ts +1 -1
  27. package/dist/esnext/components/CartLineImage/index.js +1 -1
  28. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
  29. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +2 -2
  30. package/dist/esnext/components/CartLinePrice/index.d.ts +1 -1
  31. package/dist/esnext/components/CartLinePrice/index.js +1 -1
  32. package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.js +1 -1
  33. package/dist/esnext/components/CartLineProductTitle/index.d.ts +1 -1
  34. package/dist/esnext/components/CartLineProductTitle/index.js +1 -1
  35. package/dist/esnext/components/CartLineProvider/CartLineProvider.client.d.ts +1 -1
  36. package/dist/esnext/components/CartLineProvider/CartLineProvider.client.js +1 -1
  37. package/dist/esnext/components/CartLineProvider/context.d.ts +13 -13
  38. package/dist/esnext/components/CartLineProvider/index.d.ts +2 -2
  39. package/dist/esnext/components/CartLineProvider/index.js +2 -2
  40. package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js +1 -1
  41. package/dist/esnext/components/CartLineQuantity/index.d.ts +1 -1
  42. package/dist/esnext/components/CartLineQuantity/index.js +1 -1
  43. package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +7 -8
  44. package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +3 -3
  45. package/dist/esnext/components/CartLineQuantityAdjustButton/index.d.ts +1 -1
  46. package/dist/esnext/components/CartLineQuantityAdjustButton/index.js +1 -1
  47. package/dist/esnext/components/CartLines/CartLines.client.d.ts +1 -1
  48. package/dist/esnext/components/CartLines/CartLines.client.js +2 -2
  49. package/dist/esnext/components/CartLines/index.d.ts +1 -1
  50. package/dist/esnext/components/CartLines/index.js +1 -1
  51. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +2 -2
  52. package/dist/esnext/components/CartProvider/CartProvider.client.js +7 -7
  53. package/dist/esnext/components/CartProvider/context.d.ts +1 -1
  54. package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +1 -1
  55. package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +1 -1
  56. package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +1 -1
  57. package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +1 -1
  58. package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +1 -1
  59. package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +1 -1
  60. package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +1 -1
  61. package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +1 -1
  62. package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +1 -1
  63. package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +1 -1
  64. package/dist/esnext/components/CartProvider/hooks.client.d.ts +2 -2
  65. package/dist/esnext/components/CartProvider/hooks.client.js +4 -4
  66. package/dist/esnext/components/CartProvider/index.d.ts +4 -4
  67. package/dist/esnext/components/CartProvider/index.js +3 -3
  68. package/dist/esnext/components/CartProvider/types.d.ts +2 -2
  69. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +1 -1
  70. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +2 -2
  71. package/dist/esnext/components/CartShopPayButton/index.d.ts +1 -1
  72. package/dist/esnext/components/CartShopPayButton/index.js +1 -1
  73. package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +2 -2
  74. package/dist/esnext/components/ExternalVideo/ExternalVideo.js +1 -1
  75. package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
  76. package/dist/esnext/components/ExternalVideo/index.js +1 -1
  77. package/dist/esnext/components/Image/Image.d.ts +1 -1
  78. package/dist/esnext/components/Image/Image.js +22 -13
  79. package/dist/esnext/components/Image/index.d.ts +2 -2
  80. package/dist/esnext/components/Image/index.js +1 -1
  81. package/dist/esnext/components/Link/Link.client.js +5 -5
  82. package/dist/esnext/components/Link/index.d.ts +1 -1
  83. package/dist/esnext/components/Link/index.js +1 -1
  84. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +1 -1
  85. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -1
  86. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +3 -2
  87. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +9 -13
  88. package/dist/esnext/components/LocalizationProvider/index.d.ts +1 -1
  89. package/dist/esnext/components/LocalizationProvider/index.js +1 -1
  90. package/dist/esnext/components/MediaFile/MediaFile.d.ts +4 -4
  91. package/dist/esnext/components/MediaFile/MediaFile.js +4 -4
  92. package/dist/esnext/components/MediaFile/index.d.ts +1 -1
  93. package/dist/esnext/components/MediaFile/index.js +1 -1
  94. package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -2
  95. package/dist/esnext/components/Metafield/Metafield.client.js +6 -6
  96. package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -1
  97. package/dist/esnext/components/Metafield/components/StarRating/index.d.ts +1 -1
  98. package/dist/esnext/components/Metafield/components/StarRating/index.js +1 -1
  99. package/dist/esnext/components/Metafield/components/index.d.ts +1 -1
  100. package/dist/esnext/components/Metafield/components/index.js +1 -1
  101. package/dist/esnext/components/Metafield/index.d.ts +2 -2
  102. package/dist/esnext/components/Metafield/index.js +1 -1
  103. package/dist/esnext/components/Metafield/types.d.ts +1 -1
  104. package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +2 -2
  105. package/dist/esnext/components/ModelViewer/ModelViewer.client.js +1 -1
  106. package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
  107. package/dist/esnext/components/ModelViewer/index.js +1 -1
  108. package/dist/esnext/components/Money/Money.client.d.ts +1 -1
  109. package/dist/esnext/components/Money/Money.client.js +1 -1
  110. package/dist/esnext/components/Money/index.d.ts +1 -1
  111. package/dist/esnext/components/Money/index.js +1 -1
  112. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +1 -1
  113. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +3 -3
  114. package/dist/esnext/components/ProductOptionsProvider/context.d.ts +1 -1
  115. package/dist/esnext/components/ProductOptionsProvider/index.d.ts +1 -2
  116. package/dist/esnext/components/ProductOptionsProvider/index.js +1 -2
  117. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +2 -2
  118. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
  119. package/dist/esnext/components/ProductPrice/index.d.ts +1 -1
  120. package/dist/esnext/components/ProductPrice/index.js +1 -1
  121. package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +1 -1
  122. package/dist/esnext/components/Seo/CollectionSeo.client.js +4 -4
  123. package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +1 -1
  124. package/dist/esnext/components/Seo/DefaultPageSeo.client.js +5 -5
  125. package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +1 -1
  126. package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
  127. package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
  128. package/dist/esnext/components/Seo/HomePageSeo.client.js +3 -3
  129. package/dist/esnext/components/Seo/ImageSeo.client.d.ts +1 -1
  130. package/dist/esnext/components/Seo/ImageSeo.client.js +1 -1
  131. package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +1 -1
  132. package/dist/esnext/components/Seo/NoIndexSeo.client.js +2 -2
  133. package/dist/esnext/components/Seo/PageSeo.client.d.ts +1 -1
  134. package/dist/esnext/components/Seo/PageSeo.client.js +3 -3
  135. package/dist/esnext/components/Seo/ProductSeo.client.d.ts +1 -1
  136. package/dist/esnext/components/Seo/ProductSeo.client.js +6 -6
  137. package/dist/esnext/components/Seo/Seo.client.d.ts +4 -4
  138. package/dist/esnext/components/Seo/Seo.client.js +7 -7
  139. package/dist/esnext/components/Seo/TitleSeo.client.d.ts +1 -1
  140. package/dist/esnext/components/Seo/TitleSeo.client.js +1 -1
  141. package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
  142. package/dist/esnext/components/Seo/TwitterSeo.client.js +1 -1
  143. package/dist/esnext/components/Seo/index.d.ts +1 -1
  144. package/dist/esnext/components/Seo/index.js +1 -1
  145. package/dist/esnext/components/Seo/seo-types.d.ts +1 -1
  146. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +2 -2
  147. package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
  148. package/dist/esnext/components/ShopPayButton/index.js +1 -1
  149. package/dist/esnext/components/Video/Video.d.ts +7 -2
  150. package/dist/esnext/components/Video/Video.js +3 -3
  151. package/dist/esnext/components/Video/index.d.ts +1 -1
  152. package/dist/esnext/components/Video/index.js +1 -1
  153. package/dist/esnext/components/index.d.ts +27 -28
  154. package/dist/esnext/components/index.js +25 -26
  155. package/dist/esnext/config.d.ts +5 -5
  156. package/dist/esnext/config.js +4 -4
  157. package/dist/esnext/entry-client.d.ts +1 -1
  158. package/dist/esnext/entry-client.js +35 -14
  159. package/dist/esnext/entry-server.d.ts +1 -1
  160. package/dist/esnext/entry-server.js +76 -57
  161. package/dist/esnext/experimental.d.ts +1 -0
  162. package/dist/esnext/experimental.js +1 -0
  163. package/dist/esnext/foundation/Analytics/Analytics.client.js +1 -1
  164. package/dist/esnext/foundation/Analytics/Analytics.server.js +5 -5
  165. package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +1 -1
  166. package/dist/esnext/foundation/Analytics/ClientAnalytics.js +4 -4
  167. package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.d.ts +1 -1
  168. package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.js +1 -1
  169. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +7 -5
  170. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +1 -1
  171. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.js +1 -1
  172. package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.js +1 -1
  173. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +4 -4
  174. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +9 -9
  175. package/dist/esnext/foundation/Analytics/hook.js +2 -2
  176. package/dist/esnext/foundation/Analytics/index.d.ts +1 -1
  177. package/dist/esnext/foundation/Analytics/index.js +1 -1
  178. package/dist/esnext/foundation/Analytics/utils.js +1 -1
  179. package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.d.ts +1 -1
  180. package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.js +3 -3
  181. package/dist/esnext/foundation/Cache/cache-sub-request.d.ts +1 -1
  182. package/dist/esnext/foundation/Cache/cache-sub-request.js +4 -4
  183. package/dist/esnext/foundation/Cache/cache.d.ts +1 -1
  184. package/dist/esnext/foundation/Cache/cache.js +3 -3
  185. package/dist/esnext/foundation/Cache/strategies/index.d.ts +1 -1
  186. package/dist/esnext/foundation/Cookie/Cookie.js +2 -2
  187. package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.d.ts +2 -2
  188. package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.js +2 -1
  189. package/dist/esnext/foundation/DevTools/DevTools.client.js +1 -1
  190. package/dist/esnext/foundation/DevTools/DevTools.server.js +4 -3
  191. package/dist/esnext/foundation/DevTools/components/Heading.js +1 -1
  192. package/dist/esnext/foundation/DevTools/components/Interface.client.js +1 -1
  193. package/dist/esnext/foundation/DevTools/components/Panels.d.ts +2 -2
  194. package/dist/esnext/foundation/DevTools/components/Panels.js +28 -22
  195. package/dist/esnext/foundation/DevTools/components/Performance.client.js +1 -2
  196. package/dist/esnext/foundation/DevTools/components/Settings.client.d.ts +2 -1
  197. package/dist/esnext/foundation/DevTools/components/Settings.client.js +2 -5
  198. package/dist/esnext/foundation/DevTools/components/Table.js +3 -3
  199. package/dist/esnext/foundation/DevTools/components/index.d.ts +2 -2
  200. package/dist/esnext/foundation/DevTools/components/index.js +2 -2
  201. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +1 -1
  202. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -5
  203. package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.d.ts +3 -3
  204. package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.js +2 -2
  205. package/dist/esnext/foundation/Form/Form.client.d.ts +11 -0
  206. package/dist/esnext/foundation/Form/Form.client.js +51 -0
  207. package/dist/esnext/foundation/Head/Head.client.js +1 -1
  208. package/dist/esnext/foundation/Head/index.d.ts +1 -1
  209. package/dist/esnext/foundation/Head/index.js +1 -1
  210. package/dist/esnext/foundation/Html/Html.d.ts +1 -1
  211. package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +5 -6
  212. package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +6 -8
  213. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +2 -2
  214. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +2 -2
  215. package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.d.ts +2 -2
  216. package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.js +1 -1
  217. package/dist/esnext/foundation/Redirect/Redirect.client.js +1 -1
  218. package/dist/esnext/foundation/Route/Route.server.js +3 -3
  219. package/dist/esnext/foundation/Router/BrowserRouter.client.js +2 -2
  220. package/dist/esnext/foundation/Router/Router.server.js +1 -1
  221. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +3 -1
  222. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +6 -4
  223. package/dist/esnext/foundation/ServerPropsProvider/index.d.ts +1 -2
  224. package/dist/esnext/foundation/ServerPropsProvider/index.js +1 -1
  225. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -2
  226. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +3 -3
  227. package/dist/esnext/foundation/ServerRequestProvider/index.d.ts +1 -1
  228. package/dist/esnext/foundation/ServerRequestProvider/index.js +1 -1
  229. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +4 -2
  230. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +4 -2
  231. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.d.ts +4 -2
  232. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +25 -7
  233. package/dist/esnext/foundation/ShopifyProvider/index.d.ts +1 -1
  234. package/dist/esnext/foundation/ShopifyProvider/index.js +1 -1
  235. package/dist/esnext/foundation/ShopifyProvider/types.d.ts +20 -2
  236. package/dist/esnext/foundation/fetchSync/ResponseSync.d.ts +14 -0
  237. package/dist/esnext/foundation/fetchSync/ResponseSync.js +38 -0
  238. package/dist/esnext/foundation/fetchSync/client/fetchSync.d.ts +2 -2
  239. package/dist/esnext/foundation/fetchSync/client/fetchSync.js +5 -10
  240. package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +3 -3
  241. package/dist/esnext/foundation/fetchSync/server/fetchSync.js +7 -13
  242. package/dist/esnext/foundation/index.d.ts +3 -3
  243. package/dist/esnext/foundation/index.js +3 -3
  244. package/dist/esnext/foundation/session/session-types.d.ts +13 -0
  245. package/dist/esnext/foundation/{fetchSync/types.js → session/session-types.js} +0 -0
  246. package/dist/esnext/foundation/session/session.d.ts +4 -16
  247. package/dist/esnext/foundation/session/session.js +1 -1
  248. package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
  249. package/dist/esnext/foundation/ssr-interop.js +2 -2
  250. package/dist/esnext/foundation/useNavigate/useNavigate.js +2 -2
  251. package/dist/esnext/foundation/useQuery/hooks.d.ts +1 -1
  252. package/dist/esnext/foundation/useQuery/hooks.js +4 -4
  253. package/dist/esnext/foundation/useQuery/index.d.ts +1 -1
  254. package/dist/esnext/foundation/useQuery/index.js +1 -1
  255. package/dist/esnext/foundation/useRequestContext/index.js +1 -1
  256. package/dist/esnext/foundation/useRouteParams/useRouteParams.js +2 -2
  257. package/dist/esnext/foundation/useServerProps/index.d.ts +1 -1
  258. package/dist/esnext/foundation/useServerProps/index.js +1 -1
  259. package/dist/esnext/foundation/useServerProps/use-server-props.d.ts +1 -1
  260. package/dist/esnext/foundation/useServerProps/use-server-props.js +1 -1
  261. package/dist/esnext/foundation/useSession/useSession.js +1 -1
  262. package/dist/esnext/foundation/useShop/index.d.ts +1 -1
  263. package/dist/esnext/foundation/useShop/index.js +1 -1
  264. package/dist/esnext/foundation/useShop/use-shop.d.ts +1 -1
  265. package/dist/esnext/foundation/useShop/use-shop.js +2 -2
  266. package/dist/esnext/foundation/useUrl/index.d.ts +1 -1
  267. package/dist/esnext/foundation/useUrl/index.js +1 -1
  268. package/dist/esnext/foundation/useUrl/useUrl.js +4 -4
  269. package/dist/esnext/framework/graphiql.js +26 -30
  270. package/dist/esnext/framework/load-config.js +2 -2
  271. package/dist/esnext/framework/middleware.d.ts +1 -1
  272. package/dist/esnext/framework/middleware.js +2 -2
  273. package/dist/esnext/framework/plugin.d.ts +1 -1
  274. package/dist/esnext/framework/plugin.js +14 -13
  275. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +1 -1
  276. package/dist/esnext/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
  277. package/dist/esnext/framework/plugins/vite-plugin-css-rsc.js +113 -0
  278. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
  279. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +3 -3
  280. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
  281. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +2 -2
  282. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
  283. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +11 -1
  284. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +36 -7
  285. package/dist/esnext/framework/types.d.ts +13 -0
  286. package/dist/esnext/hooks/index.d.ts +6 -5
  287. package/dist/esnext/hooks/index.js +6 -5
  288. package/dist/esnext/hooks/useCart/index.d.ts +1 -1
  289. package/dist/esnext/hooks/useCart/index.js +1 -1
  290. package/dist/esnext/hooks/useCart/useCart.d.ts +1 -1
  291. package/dist/esnext/hooks/useCart/useCart.js +1 -1
  292. package/dist/esnext/hooks/useCartLine/index.d.ts +1 -1
  293. package/dist/esnext/hooks/useCartLine/index.js +1 -1
  294. package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +13 -13
  295. package/dist/esnext/hooks/useCartLine/useCartLine.js +1 -1
  296. package/dist/esnext/hooks/useLoadScript/index.d.ts +1 -1
  297. package/dist/esnext/hooks/useLoadScript/index.js +1 -1
  298. package/dist/esnext/hooks/useLoadScript/useLoadScript.client.d.ts +1 -1
  299. package/dist/esnext/hooks/useLoadScript/useLoadScript.client.js +1 -1
  300. package/dist/esnext/hooks/useLocalization/useLocalization.d.ts +2 -2
  301. package/dist/esnext/hooks/useLocalization/useLocalization.js +3 -8
  302. package/dist/esnext/hooks/useMeasurement/hooks.d.ts +1 -1
  303. package/dist/esnext/hooks/useMeasurement/hooks.js +2 -2
  304. package/dist/esnext/hooks/useMeasurement/index.d.ts +1 -1
  305. package/dist/esnext/hooks/useMeasurement/index.js +1 -1
  306. package/dist/esnext/hooks/useMoney/hooks.d.ts +1 -1
  307. package/dist/esnext/hooks/useMoney/hooks.js +1 -1
  308. package/dist/esnext/hooks/useMoney/index.d.ts +1 -1
  309. package/dist/esnext/hooks/useMoney/index.js +1 -1
  310. package/dist/esnext/hooks/useProductOptions/helpers.d.ts +2 -2
  311. package/dist/esnext/hooks/useProductOptions/helpers.js +1 -1
  312. package/dist/esnext/hooks/useProductOptions/index.d.ts +2 -2
  313. package/dist/esnext/hooks/useProductOptions/index.js +2 -2
  314. package/dist/esnext/hooks/useProductOptions/types.d.ts +1 -1
  315. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -1
  316. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +1 -1
  317. package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -1
  318. package/dist/esnext/hooks/useShopQuery/hooks.js +25 -17
  319. package/dist/esnext/hooks/useShopQuery/index.d.ts +1 -1
  320. package/dist/esnext/hooks/useShopQuery/index.js +1 -1
  321. package/dist/esnext/index.d.ts +26 -25
  322. package/dist/esnext/index.js +22 -21
  323. package/dist/esnext/node.d.ts +1 -1
  324. package/dist/esnext/node.js +1 -1
  325. package/dist/esnext/platforms/index.d.ts +1 -0
  326. package/dist/esnext/platforms/index.js +1 -0
  327. package/dist/esnext/platforms/node.d.ts +1 -1
  328. package/dist/esnext/platforms/node.js +5 -11
  329. package/dist/esnext/platforms/virtual.d.ts +8 -0
  330. package/dist/esnext/platforms/virtual.js +12 -0
  331. package/dist/esnext/platforms/worker-event.js +1 -1
  332. package/dist/esnext/platforms/worker.js +7 -7
  333. package/dist/esnext/shared-types.d.ts +3 -0
  334. package/dist/esnext/types.d.ts +8 -7
  335. package/dist/esnext/types.js +1 -1
  336. package/dist/esnext/utilities/apiRoutes.d.ts +4 -4
  337. package/dist/esnext/utilities/apiRoutes.js +41 -6
  338. package/dist/esnext/utilities/error.js +1 -1
  339. package/dist/esnext/utilities/fetch.js +1 -1
  340. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +1 -1
  341. package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -1
  342. package/dist/esnext/utilities/flattenConnection/index.js +1 -1
  343. package/dist/esnext/utilities/hash.d.ts +1 -1
  344. package/dist/esnext/utilities/hash.js +1 -1
  345. package/dist/esnext/utilities/image_size.d.ts +2 -1
  346. package/dist/esnext/utilities/image_size.js +27 -26
  347. package/dist/esnext/utilities/index.d.ts +12 -12
  348. package/dist/esnext/utilities/index.js +12 -12
  349. package/dist/esnext/utilities/isBrowser/index.d.ts +1 -1
  350. package/dist/esnext/utilities/isBrowser/index.js +1 -1
  351. package/dist/esnext/utilities/isServer/index.d.ts +1 -1
  352. package/dist/esnext/utilities/isServer/index.js +1 -1
  353. package/dist/esnext/utilities/isServer/isServer.js +1 -1
  354. package/dist/esnext/utilities/load_script.d.ts +1 -0
  355. package/dist/esnext/utilities/load_script.js +6 -1
  356. package/dist/esnext/utilities/locale/index.d.ts +1 -0
  357. package/dist/esnext/utilities/locale/index.js +1 -0
  358. package/dist/esnext/utilities/locale/locale.d.ts +7 -0
  359. package/dist/esnext/utilities/locale/locale.js +22 -0
  360. package/dist/esnext/utilities/log/index.d.ts +4 -4
  361. package/dist/esnext/utilities/log/index.js +4 -4
  362. package/dist/esnext/utilities/log/log-cache-api-status.js +1 -1
  363. package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
  364. package/dist/esnext/utilities/log/log-cache-header.js +3 -3
  365. package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
  366. package/dist/esnext/utilities/log/log-query-timeline.js +13 -10
  367. package/dist/esnext/utilities/log/log.d.ts +1 -1
  368. package/dist/esnext/utilities/log/log.js +2 -2
  369. package/dist/esnext/utilities/log/utils.d.ts +1 -1
  370. package/dist/esnext/utilities/measurement.d.ts +1 -1
  371. package/dist/esnext/utilities/parseMetafield/index.d.ts +1 -1
  372. package/dist/esnext/utilities/parseMetafield/index.js +1 -1
  373. package/dist/esnext/utilities/parseMetafield/parseMetafield.d.ts +2 -2
  374. package/dist/esnext/utilities/parseMetafield/parseMetafield.js +1 -1
  375. package/dist/esnext/utilities/storefrontApi.js +1 -1
  376. package/dist/esnext/utilities/suspense.d.ts +1 -1
  377. package/dist/esnext/utilities/suspense.js +1 -1
  378. package/dist/esnext/version.d.ts +1 -1
  379. package/dist/esnext/version.js +1 -1
  380. package/dist/node/foundation/session/session-types.d.ts +13 -0
  381. package/dist/node/foundation/session/session-types.js +2 -0
  382. package/dist/node/framework/graphiql.js +26 -30
  383. package/dist/node/framework/load-config.js +3 -3
  384. package/dist/node/framework/middleware.d.ts +1 -1
  385. package/dist/node/framework/middleware.js +3 -3
  386. package/dist/node/framework/plugin.d.ts +1 -1
  387. package/dist/node/framework/plugin.js +25 -24
  388. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +3 -3
  389. package/dist/node/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
  390. package/dist/node/framework/plugins/vite-plugin-css-rsc.js +119 -0
  391. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
  392. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +7 -7
  393. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
  394. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -5
  395. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
  396. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +12 -2
  397. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +36 -7
  398. package/dist/node/framework/types.d.ts +13 -0
  399. package/dist/node/shared-types.d.ts +3 -0
  400. package/package.json +20 -4
  401. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +33 -12
  402. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +33 -12
  403. package/CHANGELOG.md +0 -2206
  404. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +0 -9
  405. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.js +0 -2
  406. package/dist/esnext/foundation/fetchSync/types.d.ts +0 -5
@@ -0,0 +1,113 @@
1
+ import path from 'path';
2
+ import MagicString from 'magic-string';
3
+ import { normalizePath } from 'vite';
4
+ const VITE_CSS_CHUNK_NAME = 'style.css';
5
+ const INJECT_STYLES_COMMENT = '<!--__INJECT_STYLES__-->';
6
+ // Keep this in the outer scope to share it
7
+ // across client <> server builds.
8
+ let clientBuildPath;
9
+ export default function cssRsc() {
10
+ let config;
11
+ return {
12
+ name: 'hydrogen:css-rsc',
13
+ enforce: 'post',
14
+ config() {
15
+ // Disable CSS code split to avoid preloading styles
16
+ // that are already included in index.html
17
+ return { build: { cssCodeSplit: false } };
18
+ },
19
+ configResolved(_config) {
20
+ config = _config;
21
+ },
22
+ transform(code, id, options) {
23
+ if (options?.ssr && id.includes('index.html?raw')) {
24
+ // Mark the client build index.html to inject styles later
25
+ const s = new MagicString(code);
26
+ s.replace('</head>', INJECT_STYLES_COMMENT + '</head>');
27
+ return {
28
+ code: s.toString(),
29
+ map: s.generateMap({ file: id, source: id }),
30
+ };
31
+ }
32
+ },
33
+ transformIndexHtml(html, { server }) {
34
+ // Add discovered styles during dev
35
+ if (server) {
36
+ const tags = [];
37
+ const foundCssFiles = new Set();
38
+ const { browserHash = '' } = server._optimizedDeps?.metadata || {};
39
+ for (const [key, value] of server.moduleGraph.idToModuleMap.entries()) {
40
+ if (
41
+ // Note: Some CSS-in-JS libraries use `.css.js`
42
+ // extension and we should match it here:
43
+ /\.(css|sass|scss|stylus|less)(\.|\?|$)/.test(normalizePath(key).split('/').pop())) {
44
+ let { url, file, lastHMRTimestamp, importers } = value;
45
+ if (!foundCssFiles.has(file) &&
46
+ !Array.from(importers).some((importer) => foundCssFiles.has(importer.file))) {
47
+ foundCssFiles.add(file);
48
+ // Vite is adding hash and timestamp to the CSS files downloaded
49
+ // from client components. Adding the same query string params
50
+ // here prevents this file from being downloaded twice.
51
+ if (lastHMRTimestamp) {
52
+ const timestampQuery = `?t=${lastHMRTimestamp}`;
53
+ // The timestamp needs to be the first query string param.
54
+ url = url.includes('?')
55
+ ? url.replace('?', timestampQuery + '&')
56
+ : url + timestampQuery;
57
+ }
58
+ if (browserHash && !url.includes('v=')) {
59
+ // Append the hash at the end
60
+ url += (url.includes('?') ? '&' : '?') + `v=${browserHash}`;
61
+ }
62
+ tags.push(value.type === 'css'
63
+ ? { tag: 'link', attrs: { rel: 'stylesheet', href: url } }
64
+ : { tag: 'script', attrs: { type: 'module', src: url } });
65
+ }
66
+ }
67
+ }
68
+ return tags;
69
+ }
70
+ },
71
+ generateBundle(options, bundle, isWrite) {
72
+ if (config.build?.ssr) {
73
+ // -- Server build
74
+ if (!clientBuildPath) {
75
+ // Default value
76
+ clientBuildPath = normalizePath(path.resolve(config.root, config.build.outDir, '..', 'client'));
77
+ }
78
+ const relativeClientPath = normalizePath(path.relative(normalizePath(path.resolve(config.root, config.build.outDir)), clientBuildPath));
79
+ let cssAssetFileName = '';
80
+ const cssAsset = Object.values(bundle).find((file) => file.type === 'asset' && file.name === VITE_CSS_CHUNK_NAME);
81
+ const outputChunk = Object.values(bundle).find((file) => file.type === 'chunk' && file.isEntry);
82
+ if (cssAsset) {
83
+ cssAssetFileName = cssAsset.fileName;
84
+ // Move the CSS file to the client build assets
85
+ cssAsset.fileName = normalizePath(path.join(relativeClientPath, cssAsset.fileName));
86
+ }
87
+ let assetPrefix = process.env.HYDROGEN_ASSET_BASE_URL || '/';
88
+ if (!assetPrefix.endsWith('/'))
89
+ assetPrefix += '/';
90
+ // Add a reference to the CSS file in indexTemplate
91
+ outputChunk.code = outputChunk.code.replace(INJECT_STYLES_COMMENT, cssAssetFileName &&
92
+ `<link rel="stylesheet" href="${assetPrefix + cssAssetFileName}">`);
93
+ }
94
+ else {
95
+ // -- Client build
96
+ // Save outDir from client build in the outer scope
97
+ // to read it during the server build. The CLI runs Vite in
98
+ // the same process so the scope is shared across builds.
99
+ clientBuildPath = normalizePath(path.resolve(config.root, config.build.outDir));
100
+ const indexHtml = bundle['index.html'];
101
+ const cssAsset = Object.values(bundle).find((file) => file.type === 'asset' && file.name === VITE_CSS_CHUNK_NAME);
102
+ if (cssAsset) {
103
+ // The client build CSS is incomplete because it only includes
104
+ // CSS imported in client components (server components are not
105
+ // discovered in this build). Remove it from this build and
106
+ // let it be added by the server build after this.
107
+ delete bundle[cssAsset.fileName];
108
+ indexHtml.source = indexHtml.source.replace(new RegExp(`\\s*<link[^<>]+${cssAsset.fileName.replace('.', '\\.')}.*?>`, ''), '');
109
+ }
110
+ }
111
+ },
112
+ };
113
+ }
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import type { HydrogenVitePluginOptions } from '../types';
2
+ import type { HydrogenVitePluginOptions } from '../types.js';
3
3
  export declare const HYDROGEN_DEFAULT_SERVER_ENTRY: string;
4
4
  declare const _default: (pluginOptions: HydrogenVitePluginOptions) => Plugin;
5
5
  export default _default;
@@ -2,9 +2,9 @@ import { loadEnv } from 'vite';
2
2
  import bodyParser from 'body-parser';
3
3
  import path from 'path';
4
4
  import { promises as fs } from 'fs';
5
- import { hydrogenMiddleware, graphiqlMiddleware } from '../middleware';
6
- import { InMemoryCache } from '../cache/in-memory';
7
- import { VIRTUAL_PROXY_HYDROGEN_CONFIG_ID } from './vite-plugin-hydrogen-virtual-files';
5
+ import { hydrogenMiddleware, graphiqlMiddleware } from '../middleware.js';
6
+ import { InMemoryCache } from '../cache/in-memory.js';
7
+ import { VIRTUAL_PROXY_HYDROGEN_CONFIG_ID } from './vite-plugin-hydrogen-virtual-files.js';
8
8
  export const HYDROGEN_DEFAULT_SERVER_ENTRY = process.env.HYDROGEN_SERVER_ENTRY || '/src/App.server';
9
9
  export default (pluginOptions) => {
10
10
  return {
@@ -1,2 +1,2 @@
1
- import { HydrogenVitePluginOptions } from '../types';
1
+ import { HydrogenVitePluginOptions } from '../types.js';
2
2
  export default function (options?: HydrogenVitePluginOptions): any;
@@ -1,7 +1,7 @@
1
1
  // @ts-ignore
2
2
  import reactServerDomVite from '@shopify/hydrogen/vendor/react-server-dom-vite/plugin.js';
3
- import { HYDROGEN_DEFAULT_SERVER_ENTRY } from './vite-plugin-hydrogen-middleware';
4
- import { VIRTUAL_PROXY_HYDROGEN_ROUTES_ID } from './vite-plugin-hydrogen-virtual-files';
3
+ import { HYDROGEN_DEFAULT_SERVER_ENTRY } from './vite-plugin-hydrogen-middleware.js';
4
+ import { VIRTUAL_PROXY_HYDROGEN_ROUTES_ID } from './vite-plugin-hydrogen-virtual-files.js';
5
5
  export default function (options) {
6
6
  return reactServerDomVite({
7
7
  serverBuildEntries: [
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import type { HydrogenVitePluginOptions } from '../types';
2
+ import type { HydrogenVitePluginOptions } from '../types.js';
3
3
  export declare const HYDROGEN_DEFAULT_SERVER_ENTRY: string;
4
4
  export declare const VIRTUAL_PROXY_HYDROGEN_CONFIG_ID: string;
5
5
  export declare const VIRTUAL_PROXY_HYDROGEN_ROUTES_ID: string;
@@ -1,11 +1,13 @@
1
1
  import { normalizePath } from 'vite';
2
2
  import path from 'path';
3
3
  import { promises as fs } from 'fs';
4
- import { viteception } from '../viteception';
4
+ import { viteception } from '../viteception.js';
5
5
  export const HYDROGEN_DEFAULT_SERVER_ENTRY = process.env.HYDROGEN_SERVER_ENTRY || '/src/App.server';
6
6
  // The character ":" breaks Vite with Node >= 16.15. Use "_" instead
7
7
  const VIRTUAL_PREFIX = 'virtual__';
8
8
  const PROXY_PREFIX = 'proxy__';
9
+ const ERROR_FILE = 'error.jsx';
10
+ const VIRTUAL_ERROR_FILE = VIRTUAL_PREFIX + ERROR_FILE;
9
11
  const HYDROGEN_CONFIG_ID = 'hydrogen.config.ts';
10
12
  const VIRTUAL_HYDROGEN_CONFIG_ID = VIRTUAL_PREFIX + HYDROGEN_CONFIG_ID;
11
13
  export const VIRTUAL_PROXY_HYDROGEN_CONFIG_ID = VIRTUAL_PREFIX + PROXY_PREFIX + HYDROGEN_CONFIG_ID;
@@ -34,6 +36,7 @@ export default (pluginOptions) => {
34
36
  VIRTUAL_PROXY_HYDROGEN_CONFIG_ID,
35
37
  VIRTUAL_PROXY_HYDROGEN_ROUTES_ID,
36
38
  VIRTUAL_HYDROGEN_ROUTES_ID,
39
+ VIRTUAL_ERROR_FILE,
37
40
  ].includes(source)) {
38
41
  // Virtual modules convention
39
42
  // https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention
@@ -71,6 +74,13 @@ export default (pluginOptions) => {
71
74
  return { code };
72
75
  });
73
76
  }
77
+ if (id === '\0' + VIRTUAL_ERROR_FILE) {
78
+ return importHydrogenConfig().then((hc) => {
79
+ const errorPath = hc.serverErrorPage ?? '/src/Error.{jsx,tsx}';
80
+ const code = `const errorPage = import.meta.glob("${errorPath}");\n export default Object.values(errorPage)[0];`;
81
+ return { code };
82
+ });
83
+ }
74
84
  },
75
85
  };
76
86
  async function importHydrogenConfig() {
@@ -1,14 +1,18 @@
1
1
  import { normalizePath } from 'vite';
2
- import { HYDROGEN_DEFAULT_SERVER_ENTRY } from './vite-plugin-hydrogen-middleware';
2
+ import { HYDROGEN_DEFAULT_SERVER_ENTRY } from './vite-plugin-hydrogen-middleware.js';
3
3
  import MagicString from 'magic-string';
4
4
  import path from 'path';
5
5
  import fs from 'fs';
6
+ import fastGlob from 'fast-glob';
6
7
  const SSR_BUNDLE_NAME = 'index.js';
8
+ // Keep this in the outer scope to share it
9
+ // across client <> server builds.
10
+ let clientBuildPath;
7
11
  export default () => {
8
12
  let config;
9
13
  let isESM;
10
14
  return {
11
- name: 'vite-plugin-platform-entry',
15
+ name: 'hydrogen:platform-entry',
12
16
  enforce: 'pre',
13
17
  configResolved(_config) {
14
18
  config = _config;
@@ -29,18 +33,43 @@ export default () => {
29
33
  }
30
34
  return null;
31
35
  },
32
- transform(code, id) {
33
- if (normalizePath(id).includes('/hydrogen/dist/esnext/platforms/')) {
36
+ async transform(code, id, options) {
37
+ if (config.command === 'build' &&
38
+ options?.ssr &&
39
+ /@shopify\/hydrogen\/.+platforms\/virtual\./.test(normalizePath(id))) {
34
40
  const ms = new MagicString(code);
35
- ms.replace('__SERVER_ENTRY__', HYDROGEN_DEFAULT_SERVER_ENTRY);
36
- const indexTemplatePath = normalizePath(path.resolve(config.root, config.build.outDir, '..', 'client', 'index.html'));
37
- ms.replace('__INDEX_TEMPLATE__', indexTemplatePath);
41
+ ms.replace('__HYDROGEN_ENTRY__', HYDROGEN_DEFAULT_SERVER_ENTRY);
42
+ if (!clientBuildPath) {
43
+ // Default value
44
+ clientBuildPath = normalizePath(path.resolve(config.root, config.build.outDir, '..', 'client'));
45
+ }
46
+ ms.replace('__HYDROGEN_HTML_TEMPLATE__', normalizePath(path.resolve(clientBuildPath, 'index.html')));
47
+ ms.replace('__HYDROGEN_RELATIVE_CLIENT_BUILD__', normalizePath(path.relative(normalizePath(path.resolve(config.root, config.build.outDir)), clientBuildPath)));
48
+ const files = clientBuildPath
49
+ ? (await fastGlob('**/*', {
50
+ cwd: clientBuildPath,
51
+ ignore: ['**/index.html', `**/${config.build.assetsDir}/**`],
52
+ })).map((file) => '/' + file)
53
+ : [];
54
+ ms.replace("\\['__HYDROGEN_ASSETS__'\\]", JSON.stringify(files));
55
+ ms.replace('__HYDROGEN_ASSETS_DIR__', config.build.assetsDir);
56
+ ms.replace('__HYDROGEN_ASSETS_BASE_URL__', (process.env.HYDROGEN_ASSET_BASE_URL || '').replace(/\/$/, ''));
57
+ // Remove the poison pill
58
+ ms.replace('throw', '//');
38
59
  return {
39
60
  code: ms.toString(),
40
61
  map: ms.generateMap({ file: id, source: id }),
41
62
  };
42
63
  }
43
64
  },
65
+ buildEnd(err) {
66
+ if (!err && !config.build.ssr && config.command === 'build') {
67
+ // Save outDir from client build in the outer scope in order
68
+ // to read it during the server build. The CLI runs Vite in
69
+ // the same process so the scope is shared across builds.
70
+ clientBuildPath = normalizePath(path.resolve(config.root, config.build.outDir));
71
+ }
72
+ },
44
73
  generateBundle(options, bundle) {
45
74
  if (config.build.ssr) {
46
75
  const [key, value] = Object.entries(bundle).find(([, value]) => value.type === 'chunk' && value.isEntry);
@@ -3,4 +3,17 @@ export interface HydrogenVitePluginOptions {
3
3
  purgeQueryCacheOnBuild?: boolean;
4
4
  configPath?: string;
5
5
  optimizeBoundaries?: boolean | 'build';
6
+ /**
7
+ * Experimental features
8
+ */
9
+ experimental?: {
10
+ /**
11
+ * CSS compatibility with React Server Components.
12
+ * - `global` inlines all the styles in the DOM and works for all types of CSS.
13
+ * - `modules-only` inlines the styles in RSC responses and only works for CSS Modules.
14
+ * @defaultValue `modules-only`
15
+ * @experimental
16
+ */
17
+ css: 'global' | 'modules-only';
18
+ };
6
19
  }
@@ -1,5 +1,6 @@
1
- export { useProductOptions } from './useProductOptions';
2
- export * from './useProductOptions/types';
3
- export { useMoney } from './useMoney';
4
- export { useMeasurement } from './useMeasurement';
5
- export { useLoadScript } from './useLoadScript';
1
+ export { useProductOptions } from './useProductOptions/index.js';
2
+ export * from './useProductOptions/types.js';
3
+ export { useMoney } from './useMoney/index.js';
4
+ export { useMeasurement } from './useMeasurement/index.js';
5
+ export { useLoadScript } from './useLoadScript/index.js';
6
+ export { useLocalization } from './useLocalization/useLocalization.js';
@@ -1,5 +1,6 @@
1
- export { useProductOptions } from './useProductOptions';
2
- export * from './useProductOptions/types';
3
- export { useMoney } from './useMoney';
4
- export { useMeasurement } from './useMeasurement';
5
- export { useLoadScript } from './useLoadScript';
1
+ export { useProductOptions } from './useProductOptions/index.js';
2
+ export * from './useProductOptions/types.js';
3
+ export { useMoney } from './useMoney/index.js';
4
+ export { useMeasurement } from './useMeasurement/index.js';
5
+ export { useLoadScript } from './useLoadScript/index.js';
6
+ export { useLocalization } from './useLocalization/useLocalization.js';
@@ -1 +1 @@
1
- export { useCart } from './useCart';
1
+ export { useCart } from './useCart.js';
@@ -1 +1 @@
1
- export { useCart } from './useCart';
1
+ export { useCart } from './useCart.js';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * The `useCart` hook provides access to the cart object. It must be a descendent of a `CartProvider` component.
3
3
  */
4
- export declare function useCart(): import("../..").CartWithActions;
4
+ export declare function useCart(): import("../../client.js").CartWithActions;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CartContext } from '../../components/CartProvider/context';
2
+ import { CartContext } from '../../components/CartProvider/context.js';
3
3
  /**
4
4
  * The `useCart` hook provides access to the cart object. It must be a descendent of a `CartProvider` component.
5
5
  */
@@ -1 +1 @@
1
- export { useCartLine } from './useCartLine';
1
+ export { useCartLine } from './useCartLine.js';
@@ -1 +1 @@
1
- export { useCartLine } from './useCartLine';
1
+ export { useCartLine } from './useCartLine.js';
@@ -3,37 +3,37 @@
3
3
  */
4
4
  export declare function useCartLine(): {
5
5
  __typename?: "CartLine" | undefined;
6
- } & Pick<import("../../storefront-api-types").CartLine, "id" | "quantity"> & {
6
+ } & Pick<import("../../storefront-api-types.js").CartLine, "id" | "quantity"> & {
7
7
  attributes: ({
8
8
  __typename?: "Attribute" | undefined;
9
- } & Pick<import("../../storefront-api-types").Attribute, "key" | "value">)[];
9
+ } & Pick<import("../../storefront-api-types.js").Attribute, "key" | "value">)[];
10
10
  cost: {
11
11
  __typename?: "CartLineCost" | undefined;
12
12
  } & {
13
13
  totalAmount: {
14
14
  __typename?: "MoneyV2" | undefined;
15
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">;
16
- compareAtAmountPerQuantity?: import("../../storefront-api-types").Maybe<{
15
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">;
16
+ compareAtAmountPerQuantity?: import("../../storefront-api-types.js").Maybe<{
17
17
  __typename?: "MoneyV2" | undefined;
18
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">> | undefined;
18
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">> | undefined;
19
19
  };
20
20
  merchandise: {
21
21
  __typename?: "ProductVariant" | undefined;
22
- } & Pick<import("../../storefront-api-types").ProductVariant, "id" | "title" | "availableForSale" | "requiresShipping"> & {
23
- compareAtPriceV2?: import("../../storefront-api-types").Maybe<{
22
+ } & Pick<import("../../storefront-api-types.js").ProductVariant, "id" | "title" | "availableForSale" | "requiresShipping"> & {
23
+ compareAtPriceV2?: import("../../storefront-api-types.js").Maybe<{
24
24
  __typename?: "MoneyV2" | undefined;
25
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">> | undefined;
25
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">> | undefined;
26
26
  priceV2: {
27
27
  __typename?: "MoneyV2" | undefined;
28
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">;
29
- image?: import("../../storefront-api-types").Maybe<{
28
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">;
29
+ image?: import("../../storefront-api-types.js").Maybe<{
30
30
  __typename?: "Image" | undefined;
31
- } & Pick<import("../../storefront-api-types").Image, "id" | "height" | "width" | "url" | "altText">> | undefined;
31
+ } & Pick<import("../../storefront-api-types.js").Image, "id" | "height" | "width" | "url" | "altText">> | undefined;
32
32
  product: {
33
33
  __typename?: "Product" | undefined;
34
- } & Pick<import("../../storefront-api-types").Product, "title" | "handle">;
34
+ } & Pick<import("../../storefront-api-types.js").Product, "title" | "handle">;
35
35
  selectedOptions: ({
36
36
  __typename?: "SelectedOption" | undefined;
37
- } & Pick<import("../../storefront-api-types").SelectedOption, "name" | "value">)[];
37
+ } & Pick<import("../../storefront-api-types.js").SelectedOption, "name" | "value">)[];
38
38
  };
39
39
  };
@@ -1,5 +1,5 @@
1
1
  import { useContext } from 'react';
2
- import { CartLineContext } from '../../components/CartLineProvider/context';
2
+ import { CartLineContext } from '../../components/CartLineProvider/context.js';
3
3
  /**
4
4
  * The `useCartLine` hook provides access to the cart line object. It must be a descendent of a `CartProvider` component.
5
5
  */
@@ -1 +1 @@
1
- export { useLoadScript } from './useLoadScript.client';
1
+ export { useLoadScript } from './useLoadScript.client.js';
@@ -1 +1 @@
1
- export { useLoadScript } from './useLoadScript.client';
1
+ export { useLoadScript } from './useLoadScript.client.js';
@@ -1,4 +1,4 @@
1
- import { loadScript } from '../../utilities/load_script';
1
+ import { loadScript } from '../../utilities/load_script.js';
2
2
  declare type LoadScriptParams = Parameters<typeof loadScript>;
3
3
  /**
4
4
  * The `useLoadScript` hook loads an external script tag on the client-side.
@@ -1,4 +1,4 @@
1
- import { loadScript } from '../../utilities/load_script';
1
+ import { loadScript } from '../../utilities/load_script.js';
2
2
  import { useState, useEffect } from 'react';
3
3
  /**
4
4
  * The `useLoadScript` hook loads an external script tag on the client-side.
@@ -1,4 +1,4 @@
1
- import { type LocalizationContextValue } from '../../components/LocalizationProvider/LocalizationContext.client';
1
+ import type { Locale, LocalizationContextValue } from '../../foundation/ShopifyProvider/types.js';
2
2
  export declare function useLocalization(): LocalizationContextValue & {
3
- locale: string;
3
+ locale: Locale;
4
4
  };
@@ -1,14 +1,9 @@
1
- import { useMemo } from 'react';
2
- import { LocalizationContext, } from '../../components/LocalizationProvider/LocalizationContext.client';
3
- import { useEnvContext } from '../../foundation/ssr-interop';
1
+ import { LocalizationContext } from '../../foundation/ShopifyProvider/ShopifyProvider.client.js';
2
+ import { useEnvContext } from '../../foundation/ssr-interop.js';
4
3
  export function useLocalization() {
5
4
  const localization = useEnvContext((req) => req.ctx.localization, LocalizationContext);
6
5
  if (localization == null) {
7
6
  throw new Error('No Localization Context available');
8
7
  }
9
- const localizationValue = useMemo(() => ({
10
- ...localization,
11
- locale: localization.language.isoCode + '-' + localization.country.isoCode,
12
- }), [localization]);
13
- return localizationValue;
8
+ return localization;
14
9
  }
@@ -1,4 +1,4 @@
1
- import { Measurement } from '../../types';
1
+ import { Measurement } from '../../types.js';
2
2
  export interface UseMeasurementValue {
3
3
  localizedString: string;
4
4
  amount?: string;
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from 'react';
2
- import { useLocalization } from '../useLocalization/useLocalization';
3
- import { getMeasurementAsParts, getMeasurementAsString } from '../../utilities';
2
+ import { useLocalization } from '../useLocalization/useLocalization.js';
3
+ import { getMeasurementAsParts, getMeasurementAsString, } from '../../utilities/index.js';
4
4
  export function useMeasurement(measurement, options = {}) {
5
5
  const { locale } = useLocalization();
6
6
  return useMemo(() => {
@@ -1 +1 @@
1
- export { useMeasurement } from './hooks';
1
+ export { useMeasurement } from './hooks.js';
@@ -1 +1 @@
1
- export { useMeasurement } from './hooks';
1
+ export { useMeasurement } from './hooks.js';
@@ -1,4 +1,4 @@
1
- import { CurrencyCode, MoneyV2 } from '../../storefront-api-types';
1
+ import { CurrencyCode, MoneyV2 } from '../../storefront-api-types.js';
2
2
  export declare type UseMoneyValue = {
3
3
  /**
4
4
  * The currency code from the `MoneyV2` object.
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { useLocalization } from '../useLocalization/useLocalization';
2
+ import { useLocalization } from '../useLocalization/useLocalization.js';
3
3
  /**
4
4
  * The `useMoney` hook takes a [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) and returns a
5
5
  * default-formatted string of the amount with the correct currency indicator, along with some of the parts provided by
@@ -1 +1 @@
1
- export { useMoney } from './hooks';
1
+ export { useMoney } from './hooks.js';
@@ -1 +1 @@
1
- export { useMoney } from './hooks';
1
+ export { useMoney } from './hooks.js';
@@ -1,5 +1,5 @@
1
- import { SelectedOptions, OptionWithValues } from './types';
2
- import type { ProductVariant as ProductVariantType } from '../../storefront-api-types';
1
+ import { SelectedOptions, OptionWithValues } from './types.js';
2
+ import type { ProductVariant as ProductVariantType } from '../../storefront-api-types.js';
3
3
  import type { PartialDeep } from 'type-fest';
4
4
  export declare function getAllOptionValues(variants: ProductVariantType[], option: string): string[];
5
5
  export declare function getSelectedVariant(variants: PartialDeep<ProductVariantType>[], choices: SelectedOptions): PartialDeep<ProductVariantType> | undefined;
@@ -19,7 +19,7 @@ export function getSelectedVariant(variants, choices) {
19
19
  export function getOptions(variants) {
20
20
  const map = variants.reduce((memo, variant) => {
21
21
  if (!variant.selectedOptions) {
22
- throw new Error(`getOptions requires 'variant.selectedOptions`);
22
+ throw new Error(`'getOptions' requires 'variant.selectedOptions'`);
23
23
  }
24
24
  variant?.selectedOptions?.forEach((opt) => {
25
25
  memo[opt?.name ?? ''] = memo[opt?.name ?? ''] || new Set();
@@ -1,2 +1,2 @@
1
- export { useProductOptions } from './useProductOptions.client';
2
- export * from './types';
1
+ export { useProductOptions } from './useProductOptions.client.js';
2
+ export * from './types.js';
@@ -1,2 +1,2 @@
1
- export { useProductOptions } from './useProductOptions.client';
2
- export * from './types';
1
+ export { useProductOptions } from './useProductOptions.client.js';
2
+ export * from './types.js';
@@ -1,4 +1,4 @@
1
- import type { SelectedOption as SelectedOptionType, ProductVariant as ProductVariantType, ProductVariantConnection, SellingPlan as SellingPlanType, SellingPlanAllocation as SellingPlanAllocationType, SellingPlanGroup as SellingPlanGroupType, SellingPlanGroupConnection } from '../../storefront-api-types';
1
+ import type { SelectedOption as SelectedOptionType, ProductVariant as ProductVariantType, ProductVariantConnection, SellingPlan as SellingPlanType, SellingPlanAllocation as SellingPlanAllocationType, SellingPlanGroup as SellingPlanGroupType, SellingPlanGroupConnection } from '../../storefront-api-types.js';
2
2
  import type { PartialDeep } from 'type-fest';
3
3
  export declare type SelectedOptions = {
4
4
  [key: string]: string;
@@ -1 +1 @@
1
- export declare function useProductOptions(): import("./types").ProductOptionsHookValue;
1
+ export declare function useProductOptions(): import("./types.js").ProductOptionsHookValue;
@@ -1,5 +1,5 @@
1
1
  import { useContext } from 'react';
2
- import { ProductOptionsContext } from '../../components/ProductOptionsProvider/context';
2
+ import { ProductOptionsContext } from '../../components/ProductOptionsProvider/context.js';
3
3
  export function useProductOptions() {
4
4
  const context = useContext(ProductOptionsContext);
5
5
  if (!context) {
@@ -1,4 +1,4 @@
1
- import type { CachingStrategy, PreloadOptions } from '../../types';
1
+ import type { CachingStrategy, PreloadOptions } from '../../types.js';
2
2
  export interface UseShopQueryResponse<T> {
3
3
  /** The data returned by the query. */
4
4
  data: T;