@shopify/hydrogen 1.0.2 → 1.3.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.
- package/README.md +1 -1
- package/dist/esnext/FileSessionStorage.d.ts +1 -1
- package/dist/esnext/FileSessionStorage.js +1 -1
- package/dist/esnext/client.d.ts +16 -16
- package/dist/esnext/client.js +16 -16
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +5 -2
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +6 -5
- package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
- package/dist/esnext/components/AddToCartButton/index.js +1 -1
- package/dist/esnext/components/BaseButton/BaseButton.client.d.ts +7 -5
- package/dist/esnext/components/BaseButton/BaseButton.client.js +5 -4
- package/dist/esnext/components/BaseButton/index.d.ts +1 -1
- package/dist/esnext/components/BaseButton/index.js +1 -1
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +3 -2
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.js +2 -2
- package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
- package/dist/esnext/components/BuyNowButton/index.js +1 -1
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.js +1 -1
- package/dist/esnext/components/CartCheckoutButton/index.d.ts +1 -1
- package/dist/esnext/components/CartCheckoutButton/index.js +1 -1
- package/dist/esnext/components/CartCost/CartCost.client.d.ts +1 -1
- package/dist/esnext/components/CartCost/CartCost.client.js +2 -2
- package/dist/esnext/components/CartCost/index.d.ts +1 -1
- package/dist/esnext/components/CartCost/index.js +1 -1
- package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +1 -1
- package/dist/esnext/components/CartLineImage/CartLineImage.client.js +2 -2
- package/dist/esnext/components/CartLineImage/index.d.ts +1 -1
- package/dist/esnext/components/CartLineImage/index.js +1 -1
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +2 -2
- package/dist/esnext/components/CartLinePrice/index.d.ts +1 -1
- package/dist/esnext/components/CartLinePrice/index.js +1 -1
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.js +1 -1
- package/dist/esnext/components/CartLineProductTitle/index.d.ts +1 -1
- package/dist/esnext/components/CartLineProductTitle/index.js +1 -1
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.d.ts +1 -1
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.js +1 -1
- package/dist/esnext/components/CartLineProvider/context.d.ts +13 -13
- package/dist/esnext/components/CartLineProvider/index.d.ts +2 -2
- package/dist/esnext/components/CartLineProvider/index.js +2 -2
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js +1 -1
- package/dist/esnext/components/CartLineQuantity/index.d.ts +1 -1
- package/dist/esnext/components/CartLineQuantity/index.js +1 -1
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +7 -8
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +3 -3
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.d.ts +1 -1
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.js +1 -1
- package/dist/esnext/components/CartLines/CartLines.client.d.ts +1 -1
- package/dist/esnext/components/CartLines/CartLines.client.js +2 -2
- package/dist/esnext/components/CartLines/index.d.ts +1 -1
- package/dist/esnext/components/CartLines/index.js +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +2 -2
- package/dist/esnext/components/CartProvider/CartProvider.client.js +13 -7
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
- package/dist/esnext/components/CartProvider/cart-queries.js +1 -0
- package/dist/esnext/components/CartProvider/context.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +1 -1
- package/dist/esnext/components/CartProvider/hooks.client.d.ts +2 -2
- package/dist/esnext/components/CartProvider/hooks.client.js +4 -4
- package/dist/esnext/components/CartProvider/index.d.ts +4 -4
- package/dist/esnext/components/CartProvider/index.js +3 -3
- package/dist/esnext/components/CartProvider/types.d.ts +2 -2
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +1 -1
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +2 -2
- package/dist/esnext/components/CartShopPayButton/index.d.ts +1 -1
- package/dist/esnext/components/CartShopPayButton/index.js +1 -1
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +2 -2
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +1 -1
- package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
- package/dist/esnext/components/ExternalVideo/index.js +1 -1
- package/dist/esnext/components/Image/Image.d.ts +2 -2
- package/dist/esnext/components/Image/Image.js +5 -5
- package/dist/esnext/components/Image/index.d.ts +2 -2
- package/dist/esnext/components/Image/index.js +1 -1
- package/dist/esnext/components/Link/Link.client.js +5 -5
- package/dist/esnext/components/Link/index.d.ts +1 -1
- package/dist/esnext/components/Link/index.js +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +5 -5
- package/dist/esnext/components/LocalizationProvider/index.d.ts +1 -1
- package/dist/esnext/components/LocalizationProvider/index.js +1 -1
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +4 -4
- package/dist/esnext/components/MediaFile/MediaFile.js +4 -4
- package/dist/esnext/components/MediaFile/index.d.ts +1 -1
- package/dist/esnext/components/MediaFile/index.js +1 -1
- package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -2
- package/dist/esnext/components/Metafield/Metafield.client.js +6 -6
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -1
- package/dist/esnext/components/Metafield/components/StarRating/index.d.ts +1 -1
- package/dist/esnext/components/Metafield/components/StarRating/index.js +1 -1
- package/dist/esnext/components/Metafield/components/index.d.ts +1 -1
- package/dist/esnext/components/Metafield/components/index.js +1 -1
- package/dist/esnext/components/Metafield/index.d.ts +2 -2
- package/dist/esnext/components/Metafield/index.js +1 -1
- package/dist/esnext/components/Metafield/types.d.ts +1 -1
- package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +2 -2
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +1 -1
- package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
- package/dist/esnext/components/ModelViewer/index.js +1 -1
- package/dist/esnext/components/Money/Money.client.d.ts +1 -1
- package/dist/esnext/components/Money/Money.client.js +1 -1
- package/dist/esnext/components/Money/index.d.ts +1 -1
- package/dist/esnext/components/Money/index.js +1 -1
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +1 -1
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +3 -3
- package/dist/esnext/components/ProductOptionsProvider/context.d.ts +1 -1
- package/dist/esnext/components/ProductOptionsProvider/index.d.ts +1 -1
- package/dist/esnext/components/ProductOptionsProvider/index.js +1 -1
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +2 -2
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
- package/dist/esnext/components/ProductPrice/index.d.ts +1 -1
- package/dist/esnext/components/ProductPrice/index.js +1 -1
- package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/CollectionSeo.client.js +4 -4
- package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +5 -5
- package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.js +3 -3
- package/dist/esnext/components/Seo/ImageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/ImageSeo.client.js +1 -1
- package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +2 -2
- package/dist/esnext/components/Seo/PageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/PageSeo.client.js +3 -3
- package/dist/esnext/components/Seo/ProductSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/ProductSeo.client.js +6 -6
- package/dist/esnext/components/Seo/Seo.client.d.ts +4 -4
- package/dist/esnext/components/Seo/Seo.client.js +7 -7
- package/dist/esnext/components/Seo/TitleSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/TitleSeo.client.js +1 -1
- package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/TwitterSeo.client.js +1 -1
- package/dist/esnext/components/Seo/index.d.ts +1 -1
- package/dist/esnext/components/Seo/index.js +1 -1
- package/dist/esnext/components/Seo/seo-types.d.ts +1 -1
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +2 -2
- package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
- package/dist/esnext/components/ShopPayButton/index.js +1 -1
- package/dist/esnext/components/Video/Video.d.ts +7 -2
- package/dist/esnext/components/Video/Video.js +3 -3
- package/dist/esnext/components/Video/index.d.ts +1 -1
- package/dist/esnext/components/Video/index.js +1 -1
- package/dist/esnext/components/index.d.ts +27 -27
- package/dist/esnext/components/index.js +25 -25
- package/dist/esnext/config.d.ts +5 -5
- package/dist/esnext/config.js +4 -4
- package/dist/esnext/constants.d.ts +1 -0
- package/dist/esnext/constants.js +1 -0
- package/dist/esnext/entry-client.d.ts +1 -1
- package/dist/esnext/entry-client.js +35 -14
- package/dist/esnext/entry-server.d.ts +1 -1
- package/dist/esnext/entry-server.js +86 -60
- package/dist/esnext/experimental.d.ts +2 -0
- package/dist/esnext/experimental.js +2 -0
- package/dist/esnext/foundation/Analytics/Analytics.client.js +1 -1
- package/dist/esnext/foundation/Analytics/Analytics.server.js +5 -5
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +4 -4
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +7 -5
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +3 -3
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +9 -9
- package/dist/esnext/foundation/Analytics/hook.js +2 -2
- package/dist/esnext/foundation/Analytics/index.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/index.js +1 -1
- package/dist/esnext/foundation/Analytics/utils.js +1 -1
- package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.d.ts +1 -1
- package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.js +3 -3
- package/dist/esnext/foundation/Cache/cache-sub-request.d.ts +1 -1
- package/dist/esnext/foundation/Cache/cache-sub-request.js +4 -4
- package/dist/esnext/foundation/Cache/cache.d.ts +1 -1
- package/dist/esnext/foundation/Cache/cache.js +3 -4
- package/dist/esnext/foundation/Cache/strategies/index.d.ts +1 -1
- package/dist/esnext/foundation/Cookie/Cookie.js +2 -2
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.d.ts +2 -2
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.js +2 -1
- package/dist/esnext/foundation/DevTools/DevTools.client.js +1 -1
- package/dist/esnext/foundation/DevTools/DevTools.server.js +4 -3
- package/dist/esnext/foundation/DevTools/components/Heading.js +1 -1
- package/dist/esnext/foundation/DevTools/components/Interface.client.js +1 -1
- package/dist/esnext/foundation/DevTools/components/Panels.d.ts +2 -2
- package/dist/esnext/foundation/DevTools/components/Panels.js +28 -22
- package/dist/esnext/foundation/DevTools/components/Performance.client.js +1 -2
- package/dist/esnext/foundation/DevTools/components/Settings.client.d.ts +2 -1
- package/dist/esnext/foundation/DevTools/components/Settings.client.js +2 -5
- package/dist/esnext/foundation/DevTools/components/Table.js +3 -3
- package/dist/esnext/foundation/DevTools/components/index.d.ts +2 -2
- package/dist/esnext/foundation/DevTools/components/index.js +2 -2
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +1 -1
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -5
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.d.ts +3 -3
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.js +2 -2
- package/dist/esnext/foundation/Form/Form.client.d.ts +11 -0
- package/dist/esnext/foundation/Form/Form.client.js +51 -0
- package/dist/esnext/foundation/Head/Head.client.js +1 -1
- package/dist/esnext/foundation/Head/index.d.ts +1 -1
- package/dist/esnext/foundation/Head/index.js +1 -1
- package/dist/esnext/foundation/Html/Html.d.ts +1 -1
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +6 -5
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +6 -7
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +2 -4
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +4 -18
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.d.ts +2 -2
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.js +1 -1
- package/dist/esnext/foundation/Redirect/Redirect.client.js +1 -1
- package/dist/esnext/foundation/Route/Route.server.js +3 -3
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +2 -2
- package/dist/esnext/foundation/Router/Router.server.js +1 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +3 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +7 -7
- package/dist/esnext/foundation/ServerPropsProvider/index.d.ts +1 -1
- package/dist/esnext/foundation/ServerPropsProvider/index.js +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -2
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +3 -3
- package/dist/esnext/foundation/ServerRequestProvider/index.d.ts +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/index.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.d.ts +2 -2
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +7 -6
- package/dist/esnext/foundation/ShopifyProvider/index.d.ts +1 -1
- package/dist/esnext/foundation/ShopifyProvider/index.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/types.d.ts +4 -3
- package/dist/esnext/foundation/fetchSync/ResponseSync.d.ts +14 -0
- package/dist/esnext/foundation/fetchSync/ResponseSync.js +38 -0
- package/dist/esnext/foundation/fetchSync/client/fetchSync.d.ts +2 -2
- package/dist/esnext/foundation/fetchSync/client/fetchSync.js +5 -10
- package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +3 -3
- package/dist/esnext/foundation/fetchSync/server/fetchSync.js +7 -13
- package/dist/esnext/foundation/index.d.ts +3 -3
- package/dist/esnext/foundation/index.js +3 -3
- package/dist/esnext/foundation/session/session-types.d.ts +15 -0
- package/dist/esnext/foundation/{fetchSync/types.js → session/session-types.js} +0 -0
- package/dist/esnext/foundation/session/session.d.ts +7 -16
- package/dist/esnext/foundation/session/session.js +17 -1
- package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
- package/dist/esnext/foundation/ssr-interop.js +2 -2
- package/dist/esnext/foundation/useNavigate/useNavigate.js +2 -2
- package/dist/esnext/foundation/useQuery/hooks.d.ts +4 -1
- package/dist/esnext/foundation/useQuery/hooks.js +5 -5
- package/dist/esnext/foundation/useQuery/index.d.ts +1 -1
- package/dist/esnext/foundation/useQuery/index.js +1 -1
- package/dist/esnext/foundation/useRequestContext/index.js +1 -1
- package/dist/esnext/foundation/useRouteParams/useRouteParams.js +2 -2
- package/dist/esnext/foundation/useServerProps/index.d.ts +1 -1
- package/dist/esnext/foundation/useServerProps/index.js +1 -1
- package/dist/esnext/foundation/useServerProps/use-server-props.d.ts +1 -1
- package/dist/esnext/foundation/useServerProps/use-server-props.js +1 -1
- package/dist/esnext/foundation/useSession/useSession.d.ts +1 -0
- package/dist/esnext/foundation/useSession/useSession.js +14 -1
- package/dist/esnext/foundation/useShop/index.d.ts +1 -1
- package/dist/esnext/foundation/useShop/index.js +1 -1
- package/dist/esnext/foundation/useShop/use-shop.d.ts +1 -1
- package/dist/esnext/foundation/useShop/use-shop.js +2 -2
- package/dist/esnext/foundation/useUrl/index.d.ts +1 -1
- package/dist/esnext/foundation/useUrl/index.js +1 -1
- package/dist/esnext/foundation/useUrl/useUrl.js +4 -4
- package/dist/esnext/framework/graphiql.js +26 -30
- package/dist/esnext/framework/load-config.js +2 -2
- package/dist/esnext/framework/middleware.d.ts +1 -1
- package/dist/esnext/framework/middleware.js +2 -2
- package/dist/esnext/framework/plugin.d.ts +1 -1
- package/dist/esnext/framework/plugin.js +17 -15
- package/dist/esnext/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-assets-version.js +8 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-rsc.js +108 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +8 -4
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +3 -3
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +2 -2
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +35 -7
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +36 -7
- package/dist/esnext/framework/types.d.ts +14 -0
- package/dist/esnext/hooks/index.d.ts +6 -6
- package/dist/esnext/hooks/index.js +6 -6
- package/dist/esnext/hooks/useCart/index.d.ts +1 -1
- package/dist/esnext/hooks/useCart/index.js +1 -1
- package/dist/esnext/hooks/useCart/useCart.d.ts +1 -1
- package/dist/esnext/hooks/useCart/useCart.js +1 -1
- package/dist/esnext/hooks/useCartLine/index.d.ts +1 -1
- package/dist/esnext/hooks/useCartLine/index.js +1 -1
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +13 -13
- package/dist/esnext/hooks/useCartLine/useCartLine.js +1 -1
- package/dist/esnext/hooks/useLoadScript/index.d.ts +1 -1
- package/dist/esnext/hooks/useLoadScript/index.js +1 -1
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.d.ts +1 -1
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.js +1 -1
- package/dist/esnext/hooks/useLocalization/useLocalization.d.ts +2 -3
- package/dist/esnext/hooks/useLocalization/useLocalization.js +2 -2
- package/dist/esnext/hooks/useMeasurement/hooks.d.ts +1 -1
- package/dist/esnext/hooks/useMeasurement/hooks.js +2 -2
- package/dist/esnext/hooks/useMeasurement/index.d.ts +1 -1
- package/dist/esnext/hooks/useMeasurement/index.js +1 -1
- package/dist/esnext/hooks/useMoney/hooks.d.ts +1 -1
- package/dist/esnext/hooks/useMoney/hooks.js +1 -1
- package/dist/esnext/hooks/useMoney/index.d.ts +1 -1
- package/dist/esnext/hooks/useMoney/index.js +1 -1
- package/dist/esnext/hooks/useProductOptions/helpers.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/index.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/index.js +2 -2
- package/dist/esnext/hooks/useProductOptions/types.d.ts +1 -1
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -1
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +1 -1
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -1
- package/dist/esnext/hooks/useShopQuery/hooks.js +25 -17
- package/dist/esnext/hooks/useShopQuery/index.d.ts +1 -1
- package/dist/esnext/hooks/useShopQuery/index.js +1 -1
- package/dist/esnext/index.d.ts +26 -26
- package/dist/esnext/index.js +22 -22
- package/dist/esnext/node.d.ts +1 -1
- package/dist/esnext/node.js +1 -1
- package/dist/esnext/platforms/index.d.ts +1 -0
- package/dist/esnext/platforms/index.js +1 -0
- package/dist/esnext/platforms/node.d.ts +1 -1
- package/dist/esnext/platforms/node.js +5 -11
- package/dist/esnext/platforms/virtual.d.ts +8 -0
- package/dist/esnext/platforms/virtual.js +12 -0
- package/dist/esnext/platforms/worker-event.js +1 -1
- package/dist/esnext/platforms/worker.js +7 -7
- package/dist/esnext/shared-types.d.ts +3 -0
- package/dist/esnext/types.d.ts +8 -7
- package/dist/esnext/types.js +1 -1
- package/dist/esnext/utilities/apiRoutes.d.ts +4 -4
- package/dist/esnext/utilities/apiRoutes.js +51 -6
- package/dist/esnext/utilities/error.js +1 -1
- package/dist/esnext/utilities/fetch.js +1 -1
- package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +1 -1
- package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -1
- package/dist/esnext/utilities/flattenConnection/index.js +1 -1
- package/dist/esnext/utilities/hash.d.ts +1 -1
- package/dist/esnext/utilities/hash.js +1 -1
- package/dist/esnext/utilities/image_size.d.ts +1 -1
- package/dist/esnext/utilities/index.d.ts +12 -12
- package/dist/esnext/utilities/index.js +12 -12
- package/dist/esnext/utilities/isBrowser/index.d.ts +1 -1
- package/dist/esnext/utilities/isBrowser/index.js +1 -1
- package/dist/esnext/utilities/isServer/index.d.ts +1 -1
- package/dist/esnext/utilities/isServer/index.js +1 -1
- package/dist/esnext/utilities/isServer/isServer.js +1 -1
- package/dist/esnext/utilities/load_script.d.ts +1 -0
- package/dist/esnext/utilities/load_script.js +6 -1
- package/dist/esnext/utilities/locale/index.d.ts +1 -0
- package/dist/esnext/utilities/locale/index.js +1 -0
- package/dist/esnext/utilities/locale/locale.d.ts +7 -0
- package/dist/esnext/utilities/locale/locale.js +22 -0
- package/dist/esnext/utilities/log/index.d.ts +4 -4
- package/dist/esnext/utilities/log/index.js +4 -4
- package/dist/esnext/utilities/log/log-cache-api-status.js +1 -1
- package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/esnext/utilities/log/log-cache-header.js +3 -3
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/esnext/utilities/log/log-query-timeline.js +13 -10
- package/dist/esnext/utilities/log/log.d.ts +1 -1
- package/dist/esnext/utilities/log/log.js +2 -2
- package/dist/esnext/utilities/log/utils.d.ts +1 -1
- package/dist/esnext/utilities/log/utils.js +1 -1
- package/dist/esnext/utilities/measurement.d.ts +1 -1
- package/dist/esnext/utilities/parseMetafield/index.d.ts +1 -1
- package/dist/esnext/utilities/parseMetafield/index.js +1 -1
- package/dist/esnext/utilities/parseMetafield/parseMetafield.d.ts +2 -2
- package/dist/esnext/utilities/parseMetafield/parseMetafield.js +1 -1
- package/dist/esnext/utilities/storefrontApi.js +1 -1
- package/dist/esnext/utilities/suspense.d.ts +1 -1
- package/dist/esnext/utilities/suspense.js +1 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/foundation/session/session-types.d.ts +15 -0
- package/dist/node/foundation/session/session-types.js +2 -0
- package/dist/node/framework/graphiql.js +26 -30
- package/dist/node/framework/load-config.js +3 -3
- package/dist/node/framework/middleware.d.ts +1 -1
- package/dist/node/framework/middleware.js +3 -3
- package/dist/node/framework/plugin.d.ts +1 -1
- package/dist/node/framework/plugin.js +26 -24
- package/dist/node/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-assets-version.js +11 -0
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +3 -3
- package/dist/node/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-css-rsc.js +114 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +11 -4
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +7 -7
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -5
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +35 -7
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +36 -7
- package/dist/node/framework/types.d.ts +14 -0
- package/dist/node/shared-types.d.ts +3 -0
- package/package.json +20 -3
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +36 -14
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +36 -14
- package/dist/esnext/foundation/fetchSync/types.d.ts +0 -5
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.d.ts +0 -3
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.js +0 -11
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.d.ts +0 -3
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.js +0 -16
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { CountryCode, LanguageCode } from '../../storefront-api-types';
|
|
1
|
+
import type { CountryCode, LanguageCode } from '../../storefront-api-types.js';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import type { ShopifyConfigFetcher, ShopifyConfig } from '../../types';
|
|
3
|
+
import type { ShopifyConfigFetcher, ShopifyConfig } from '../../types.js';
|
|
4
4
|
export interface ShopifyContextValue extends Omit<ShopifyConfig, 'defaultLanguageCode' | 'defaultCountryCode'> {
|
|
5
5
|
defaultLanguageCode: `${LanguageCode}`;
|
|
6
6
|
defaultCountryCode: `${CountryCode}`;
|
|
7
7
|
storefrontId: string | null;
|
|
8
8
|
}
|
|
9
|
+
export declare type Locale = string;
|
|
9
10
|
export interface LocalizationContextValue {
|
|
10
11
|
country: {
|
|
11
12
|
isoCode: `${CountryCode}`;
|
|
@@ -13,7 +14,7 @@ export interface LocalizationContextValue {
|
|
|
13
14
|
language: {
|
|
14
15
|
isoCode: `${LanguageCode}`;
|
|
15
16
|
};
|
|
16
|
-
locale:
|
|
17
|
+
locale: Locale;
|
|
17
18
|
}
|
|
18
19
|
export declare type ShopifyProviderProps = {
|
|
19
20
|
/** Shopify connection information. Defaults to the `shopify` property in the `hydrogen.config.js` file. */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare type ResponseSyncInit = [string, ResponseInit];
|
|
2
|
+
export declare class ResponseSync extends Response {
|
|
3
|
+
#private;
|
|
4
|
+
bodyUsed: boolean;
|
|
5
|
+
constructor(init: ResponseSyncInit);
|
|
6
|
+
text(): string;
|
|
7
|
+
json(): any;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Access response properties at the top level instead.
|
|
10
|
+
*/
|
|
11
|
+
get response(): this;
|
|
12
|
+
static toSerializable(response: Response): Promise<ResponseSyncInit>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { parseJSON } from '../../utilities/parse.js';
|
|
2
|
+
import { log } from '../../utilities/log/index.js';
|
|
3
|
+
export class ResponseSync extends Response {
|
|
4
|
+
bodyUsed = true;
|
|
5
|
+
#text;
|
|
6
|
+
#json;
|
|
7
|
+
constructor(init) {
|
|
8
|
+
super(...init);
|
|
9
|
+
this.#text = init[0];
|
|
10
|
+
}
|
|
11
|
+
// @ts-expect-error Changing inherited types
|
|
12
|
+
text() {
|
|
13
|
+
return this.#text;
|
|
14
|
+
}
|
|
15
|
+
json() {
|
|
16
|
+
return (this.#json ??= parseJSON(this.#text));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Access response properties at the top level instead.
|
|
20
|
+
*/
|
|
21
|
+
get response() {
|
|
22
|
+
if (__HYDROGEN_DEV__) {
|
|
23
|
+
log.warn(`Property 'response' is deprecated from the result of 'fetchSync'.` +
|
|
24
|
+
` Access response properties at the top level instead.`);
|
|
25
|
+
}
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
static async toSerializable(response) {
|
|
29
|
+
return [
|
|
30
|
+
await response.text(),
|
|
31
|
+
{
|
|
32
|
+
status: response.status,
|
|
33
|
+
statusText: response.statusText,
|
|
34
|
+
headers: Array.from(response.headers.entries()),
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ResponseSync } from '../ResponseSync.js';
|
|
2
2
|
/**
|
|
3
3
|
* Fetch a URL for use in a client component Suspense boundary.
|
|
4
4
|
*/
|
|
5
|
-
export declare function fetchSync(url: string, options?: RequestInit):
|
|
5
|
+
export declare function fetchSync(url: string, options?: RequestInit): ResponseSync;
|
|
6
6
|
/**
|
|
7
7
|
* Preload a URL for use in a client component Suspense boundary.
|
|
8
8
|
* Useful for placing higher in the tree to avoid waterfalls.
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { suspendFunction, preloadFunction } from '../../../utilities/suspense.js';
|
|
2
|
+
import { ResponseSync } from '../ResponseSync.js';
|
|
3
3
|
/**
|
|
4
4
|
* Fetch a URL for use in a client component Suspense boundary.
|
|
5
5
|
*/
|
|
6
6
|
export function fetchSync(url, options) {
|
|
7
|
-
const
|
|
7
|
+
const responseSyncInit = suspendFunction([url, options], async () => {
|
|
8
8
|
const response = await globalThis.fetch(new URL(url, window.location.origin), options);
|
|
9
|
-
|
|
10
|
-
return [text, response];
|
|
9
|
+
return ResponseSync.toSerializable(response);
|
|
11
10
|
});
|
|
12
|
-
return
|
|
13
|
-
response,
|
|
14
|
-
json: () => parseJSON(text),
|
|
15
|
-
text: () => text,
|
|
16
|
-
};
|
|
11
|
+
return new ResponseSync(responseSyncInit);
|
|
17
12
|
}
|
|
18
13
|
/**
|
|
19
14
|
* Preload a URL for use in a client component Suspense boundary.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type HydrogenUseQueryOptions } from '../../useQuery/
|
|
2
|
-
import
|
|
1
|
+
import { type HydrogenUseQueryOptions } from '../../useQuery/index.js';
|
|
2
|
+
import { ResponseSync } from '../ResponseSync.js';
|
|
3
3
|
/**
|
|
4
4
|
* The `fetchSync` hook makes API requests and is the recommended way to make simple fetch calls on the server and the client.
|
|
5
5
|
* It's designed similar to the [Web API's `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch), only in a way
|
|
6
6
|
* that supports [Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html).
|
|
7
7
|
*/
|
|
8
|
-
export declare function fetchSync(url: string, options?: Omit<RequestInit, 'cache'> & HydrogenUseQueryOptions):
|
|
8
|
+
export declare function fetchSync(url: string, options?: Omit<RequestInit, 'cache'> & HydrogenUseQueryOptions): ResponseSync;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useQuery } from '../../useQuery/index.js';
|
|
2
|
+
import { useUrl } from '../../useUrl/index.js';
|
|
3
|
+
import { ResponseSync } from '../ResponseSync.js';
|
|
4
4
|
/**
|
|
5
5
|
* The `fetchSync` hook makes API requests and is the recommended way to make simple fetch calls on the server and the client.
|
|
6
6
|
* It's designed similar to the [Web API's `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch), only in a way
|
|
@@ -10,11 +10,10 @@ export function fetchSync(url, options) {
|
|
|
10
10
|
const { cache, preload, shouldCacheResponse, ...requestInit } = options ?? {};
|
|
11
11
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
12
12
|
const { origin } = useUrl();
|
|
13
|
-
|
|
14
|
-
[url, requestInit], async () => {
|
|
13
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
+
const { data, error } = useQuery([url, requestInit], async () => {
|
|
15
15
|
const response = await globalThis.fetch(new URL(url, origin), requestInit);
|
|
16
|
-
|
|
17
|
-
return [text, response];
|
|
16
|
+
return ResponseSync.toSerializable(response);
|
|
18
17
|
}, {
|
|
19
18
|
cache,
|
|
20
19
|
preload,
|
|
@@ -23,10 +22,5 @@ export function fetchSync(url, options) {
|
|
|
23
22
|
if (error) {
|
|
24
23
|
throw error;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
response,
|
|
29
|
-
json: () => parseJSON(data),
|
|
30
|
-
text: () => data,
|
|
31
|
-
};
|
|
25
|
+
return new ResponseSync(data);
|
|
32
26
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ServerPropsProvider, ServerPropsContext, type ServerProps, type ServerPropsContextValue, } from './ServerPropsProvider';
|
|
2
|
-
export { useShop } from './useShop';
|
|
3
|
-
export { useUrl } from './useUrl';
|
|
1
|
+
export { ServerPropsProvider, ServerPropsContext, type ServerProps, type ServerPropsContextValue, } from './ServerPropsProvider/index.js';
|
|
2
|
+
export { useShop } from './useShop/index.js';
|
|
3
|
+
export { useUrl } from './useUrl/index.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ServerPropsProvider, ServerPropsContext, } from './ServerPropsProvider';
|
|
2
|
-
export { useShop } from './useShop';
|
|
3
|
-
export { useUrl } from './useUrl';
|
|
1
|
+
export { ServerPropsProvider, ServerPropsContext, } from './ServerPropsProvider/index.js';
|
|
2
|
+
export { useShop } from './useShop/index.js';
|
|
3
|
+
export { useUrl } from './useUrl/index.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type SessionSyncApi = {
|
|
2
|
+
get: () => Record<string, string>;
|
|
3
|
+
set: (data: Record<string, any>) => any;
|
|
4
|
+
};
|
|
5
|
+
export declare type SessionApi = {
|
|
6
|
+
get: () => Promise<Record<string, string>>;
|
|
7
|
+
set: (key: string, value: string) => Promise<void>;
|
|
8
|
+
destroy: () => Promise<void>;
|
|
9
|
+
getFlash: (key: string) => any;
|
|
10
|
+
};
|
|
11
|
+
export declare type SessionStorageAdapter = {
|
|
12
|
+
get: (request: Request) => Promise<Record<string, string>>;
|
|
13
|
+
set: (request: Request, value: Record<string, string>) => Promise<string>;
|
|
14
|
+
destroy: (request: Request) => Promise<string>;
|
|
15
|
+
};
|
|
File without changes
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
import { Logger } from '../../utilities/log';
|
|
2
|
-
import type { HydrogenResponse } from '../HydrogenResponse/HydrogenResponse.server';
|
|
3
|
-
import type { HydrogenRequest } from '../HydrogenRequest/HydrogenRequest.server';
|
|
4
|
-
|
|
5
|
-
get: () => Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
export declare type SessionApi = {
|
|
8
|
-
get: () => Promise<Record<string, string>>;
|
|
9
|
-
set: (key: string, value: string) => Promise<void>;
|
|
10
|
-
destroy: () => Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
export declare type SessionStorageAdapter = {
|
|
13
|
-
get: (request: Request) => Promise<Record<string, string>>;
|
|
14
|
-
set: (request: Request, value: Record<string, string>) => Promise<string>;
|
|
15
|
-
destroy: (request: Request) => Promise<string>;
|
|
16
|
-
};
|
|
1
|
+
import { Logger } from '../../utilities/log/index.js';
|
|
2
|
+
import type { HydrogenResponse } from '../HydrogenResponse/HydrogenResponse.server.js';
|
|
3
|
+
import type { HydrogenRequest } from '../HydrogenRequest/HydrogenRequest.server.js';
|
|
4
|
+
import type { SessionStorageAdapter } from './session-types.js';
|
|
17
5
|
export declare function getSyncSessionApi(request: HydrogenRequest, componentResponse: HydrogenResponse, log: Logger, session?: SessionStorageAdapter): {
|
|
18
6
|
get(): any;
|
|
7
|
+
set(data: Record<string, any>): any;
|
|
19
8
|
};
|
|
20
9
|
export declare const emptySessionImplementation: (log: Logger) => {
|
|
10
|
+
getFlash(key: string): Promise<null>;
|
|
21
11
|
get(): Promise<{}>;
|
|
22
12
|
set(key: string, value: string): Promise<void>;
|
|
23
13
|
destroy(): Promise<void>;
|
|
24
14
|
};
|
|
25
15
|
export declare const emptySyncSessionImplementation: (log: Logger) => {
|
|
26
16
|
get(): {};
|
|
17
|
+
set(data: Record<string, any>): null;
|
|
27
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { wrapPromise } from '../../utilities/suspense';
|
|
1
|
+
import { wrapPromise } from '../../utilities/suspense.js';
|
|
2
2
|
export function getSyncSessionApi(request, componentResponse, log, session) {
|
|
3
3
|
const sessionPromises = {};
|
|
4
4
|
return session
|
|
@@ -9,11 +9,23 @@ export function getSyncSessionApi(request, componentResponse, log, session) {
|
|
|
9
9
|
}
|
|
10
10
|
return sessionPromises.getPromise.read();
|
|
11
11
|
},
|
|
12
|
+
set(data) {
|
|
13
|
+
if (!sessionPromises.setPromise) {
|
|
14
|
+
sessionPromises.setPromise = wrapPromise(session.set(request, data));
|
|
15
|
+
}
|
|
16
|
+
const cookie = sessionPromises.setPromise.read();
|
|
17
|
+
componentResponse.headers.set('Set-Cookie', cookie);
|
|
18
|
+
return cookie;
|
|
19
|
+
},
|
|
12
20
|
}
|
|
13
21
|
: emptySyncSessionImplementation(log);
|
|
14
22
|
}
|
|
15
23
|
export const emptySessionImplementation = function (log) {
|
|
16
24
|
return {
|
|
25
|
+
async getFlash(key) {
|
|
26
|
+
log.warn('No session adapter has been configured!');
|
|
27
|
+
return null;
|
|
28
|
+
},
|
|
17
29
|
async get() {
|
|
18
30
|
log.warn('No session adapter has been configured!');
|
|
19
31
|
return {};
|
|
@@ -33,5 +45,9 @@ export const emptySyncSessionImplementation = function (log) {
|
|
|
33
45
|
log.warn('No session adapter has been configured!');
|
|
34
46
|
return {};
|
|
35
47
|
},
|
|
48
|
+
set(data) {
|
|
49
|
+
log.warn('No session adapter has been configured!');
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
36
52
|
};
|
|
37
53
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* In the server, this file is transformed by Vite to inject server logic.
|
|
5
5
|
* NOTE: Do not remove SSR-prefixed comments in this file.
|
|
6
6
|
*/
|
|
7
|
-
import type { HydrogenRequest } from './HydrogenRequest/HydrogenRequest.server';
|
|
7
|
+
import type { HydrogenRequest } from './HydrogenRequest/HydrogenRequest.server.js';
|
|
8
8
|
export declare const META_ENV_SSR = false;
|
|
9
9
|
declare type ServerGetter<T> = (request: HydrogenRequest) => T;
|
|
10
10
|
/**
|
|
@@ -21,7 +21,7 @@ declare type ServerGetter<T> = (request: HydrogenRequest) => T;
|
|
|
21
21
|
* The returned type depends on what the server getter returns.
|
|
22
22
|
* @example
|
|
23
23
|
* ```js
|
|
24
|
-
* import {MyClientContext} from './my-client-react-context-provider';
|
|
24
|
+
* import {MyClientContext} from './my-client-react-context-provider.js';
|
|
25
25
|
* useEnvContext(req => req.ctx.myServerContext, MyClientContext)
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* NOTE: Do not remove SSR-prefixed comments in this file.
|
|
6
6
|
*/
|
|
7
7
|
import { useContext } from 'react';
|
|
8
|
-
//@SSR import {useServerRequest} from './ServerRequestProvider';
|
|
8
|
+
//@SSR import {useServerRequest} from './ServerRequestProvider/index.js';
|
|
9
9
|
// This is replaced by Vite to import.meta.env.SSR
|
|
10
10
|
export const META_ENV_SSR = false;
|
|
11
11
|
const reactContextType = Symbol.for('react.context');
|
|
@@ -23,7 +23,7 @@ const reactContextType = Symbol.for('react.context');
|
|
|
23
23
|
* The returned type depends on what the server getter returns.
|
|
24
24
|
* @example
|
|
25
25
|
* ```js
|
|
26
|
-
* import {MyClientContext} from './my-client-react-context-provider';
|
|
26
|
+
* import {MyClientContext} from './my-client-react-context-provider.js';
|
|
27
27
|
* useEnvContext(req => req.ctx.myServerContext, MyClientContext)
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRouter } from '../Router/BrowserRouter.client';
|
|
2
|
-
import { useBasePath } from '../useRouteParams/RouteParamsProvider.client';
|
|
1
|
+
import { useRouter } from '../Router/BrowserRouter.client.js';
|
|
2
|
+
import { useBasePath } from '../useRouteParams/RouteParamsProvider.client.js';
|
|
3
3
|
/**
|
|
4
4
|
* The useNavigate hook imperatively navigates between routes.
|
|
5
5
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CachingStrategy, PreloadOptions, QueryKey } from '../../types';
|
|
1
|
+
import type { CachingStrategy, PreloadOptions, QueryKey } from '../../types.js';
|
|
2
2
|
export interface HydrogenUseQueryOptions {
|
|
3
3
|
/** The [caching strategy](https://shopify.dev/custom-storefronts/hydrogen/framework/cache#caching-strategies) to help you
|
|
4
4
|
* determine which cache control header to set.
|
|
@@ -13,6 +13,9 @@ export interface HydrogenUseQueryOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
shouldCacheResponse?: (body: any) => boolean;
|
|
15
15
|
}
|
|
16
|
+
declare global {
|
|
17
|
+
var __HYDROGEN_CACHE_ID__: string;
|
|
18
|
+
}
|
|
16
19
|
/**
|
|
17
20
|
* The `useQuery` hook executes an asynchronous operation like `fetch` in a way that
|
|
18
21
|
* supports [Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html). You can use this
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getLoggerWithContext, collectQueryCacheControlHeaders, collectQueryTimings, } from '../../utilities/log';
|
|
2
|
-
import { deleteItemFromCache, generateSubRequestCacheControlHeader, getItemFromCache, isStale, setItemInCache, } from '../Cache/cache-sub-request';
|
|
3
|
-
import { useRequestCacheData, useServerRequest } from '../ServerRequestProvider';
|
|
4
|
-
import { CacheShort, NO_STORE } from '../Cache/strategies';
|
|
1
|
+
import { getLoggerWithContext, collectQueryCacheControlHeaders, collectQueryTimings, } from '../../utilities/log/index.js';
|
|
2
|
+
import { deleteItemFromCache, generateSubRequestCacheControlHeader, getItemFromCache, isStale, setItemInCache, } from '../Cache/cache-sub-request.js';
|
|
3
|
+
import { useRequestCacheData, useServerRequest, } from '../ServerRequestProvider/index.js';
|
|
4
|
+
import { CacheShort, NO_STORE } from '../Cache/strategies/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* The `useQuery` hook executes an asynchronous operation like `fetch` in a way that
|
|
7
7
|
* supports [Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html). You can use this
|
|
@@ -19,7 +19,7 @@ queryFn,
|
|
|
19
19
|
queryOptions) {
|
|
20
20
|
const request = useServerRequest();
|
|
21
21
|
const withCacheIdKey = [
|
|
22
|
-
|
|
22
|
+
__HYDROGEN_CACHE_ID__,
|
|
23
23
|
...(typeof key === 'string' ? [key] : key),
|
|
24
24
|
];
|
|
25
25
|
const fetcher = cachedQueryFnBuilder(withCacheIdKey, queryFn, queryOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useQuery } from './hooks';
|
|
1
|
+
export { useQuery, type HydrogenUseQueryOptions, shouldPreloadQuery, } from './hooks.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useQuery } from './hooks';
|
|
1
|
+
export { useQuery, shouldPreloadQuery, } from './hooks.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { META_ENV_SSR, useEnvContext } from '../ssr-interop';
|
|
1
|
+
import { META_ENV_SSR, useEnvContext } from '../ssr-interop.js';
|
|
2
2
|
/**
|
|
3
3
|
* Provides access to the current request context.
|
|
4
4
|
* @param scope - An optional string used to scope the request context. It is recommended to
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useEnvContext } from '../ssr-interop';
|
|
2
|
-
import { RouteParamsContext } from './RouteParamsProvider.client';
|
|
1
|
+
import { useEnvContext } from '../ssr-interop.js';
|
|
2
|
+
import { RouteParamsContext } from './RouteParamsProvider.client.js';
|
|
3
3
|
/**
|
|
4
4
|
* The `useRouteParams` hook retrieves the parameters of an active route. The hook is available in both server and client components.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useServerProps } from './use-server-props';
|
|
1
|
+
export { useServerProps } from './use-server-props.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useServerProps } from './use-server-props';
|
|
1
|
+
export { useServerProps } from './use-server-props.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerPropsContextValue, InternalServerPropsContextValue } from '../ServerPropsProvider/ServerPropsProvider';
|
|
1
|
+
import { ServerPropsContextValue, InternalServerPropsContextValue } from '../ServerPropsProvider/ServerPropsProvider.js';
|
|
2
2
|
/**
|
|
3
3
|
* The `useServerProps` hook allows you to manage the [server props](https://shopify.dev/custom-storefronts/hydrogen/framework/server-props) passed to your server components when using Hydrogen as a React Server Component framework. The server props get cleared when you navigate from one route to another.
|
|
4
4
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { ServerPropsContext, } from '../ServerPropsProvider/ServerPropsProvider';
|
|
2
|
+
import { ServerPropsContext, } from '../ServerPropsProvider/ServerPropsProvider.js';
|
|
3
3
|
/**
|
|
4
4
|
* The `useServerProps` hook allows you to manage the [server props](https://shopify.dev/custom-storefronts/hydrogen/framework/server-props) passed to your server components when using Hydrogen as a React Server Component framework. The server props get cleared when you navigate from one route to another.
|
|
5
5
|
*
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import { useServerRequest } from '../ServerRequestProvider';
|
|
1
|
+
import { useServerRequest } from '../ServerRequestProvider/index.js';
|
|
2
2
|
/** The `useSession` hook reads session data in server components. */
|
|
3
3
|
export const useSession = function () {
|
|
4
4
|
const request = useServerRequest();
|
|
5
5
|
const session = request.ctx.session?.get() || {};
|
|
6
6
|
return session;
|
|
7
7
|
};
|
|
8
|
+
export const useFlashSession = function (key) {
|
|
9
|
+
const request = useServerRequest();
|
|
10
|
+
const data = request.ctx.session?.get() || {};
|
|
11
|
+
let value = data[key];
|
|
12
|
+
if (value) {
|
|
13
|
+
delete data[key];
|
|
14
|
+
request.ctx.flashSession[key] = value;
|
|
15
|
+
}
|
|
16
|
+
request.ctx.session?.set(data);
|
|
17
|
+
value = request.ctx.flashSession[key];
|
|
18
|
+
delete request.ctx.flashSession[key];
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useShop } from './use-shop';
|
|
1
|
+
export { useShop } from './use-shop.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useShop } from './use-shop';
|
|
1
|
+
export { useShop } from './use-shop.js';
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* [the `shopify` property in the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
|
|
4
4
|
* The `useShop` hook must be a descendent of a `ShopifyProvider` component.
|
|
5
5
|
*/
|
|
6
|
-
export declare function useShop(): import("../ShopifyProvider/types").ShopifyContextValue;
|
|
6
|
+
export declare function useShop(): import("../ShopifyProvider/types.js").ShopifyContextValue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShopifyContext } from '../ShopifyProvider';
|
|
2
|
-
import { useEnvContext } from '../ssr-interop';
|
|
1
|
+
import { ShopifyContext } from '../ShopifyProvider/index.js';
|
|
2
|
+
import { useEnvContext } from '../ssr-interop.js';
|
|
3
3
|
/**
|
|
4
4
|
* The `useShop` hook provides access to values within
|
|
5
5
|
* [the `shopify` property in the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useUrl } from './useUrl';
|
|
1
|
+
export { useUrl } from './useUrl.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useUrl } from './useUrl';
|
|
1
|
+
export { useUrl } from './useUrl.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'react';
|
|
2
|
-
import { RSC_PATHNAME } from '../../constants';
|
|
3
|
-
import { parseJSON } from '../../utilities/parse';
|
|
4
|
-
import { RouterContext } from '../Router/BrowserRouter.client';
|
|
5
|
-
import { useEnvContext, META_ENV_SSR } from '../ssr-interop';
|
|
2
|
+
import { RSC_PATHNAME } from '../../constants.js';
|
|
3
|
+
import { parseJSON } from '../../utilities/parse.js';
|
|
4
|
+
import { RouterContext } from '../Router/BrowserRouter.client.js';
|
|
5
|
+
import { useEnvContext, META_ENV_SSR } from '../ssr-interop.js';
|
|
6
6
|
/**
|
|
7
7
|
* The `useUrl` hook retrieves the current URL in a server or client component.
|
|
8
8
|
*/
|
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
export function graphiqlHtml(shop, token, apiVersion) {
|
|
2
|
-
return
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
></script>
|
|
21
|
-
<script>
|
|
22
|
-
const fetcher = GraphiQL.createFetcher({
|
|
23
|
-
url: 'https://${shop}/api/${apiVersion}/graphql.json',
|
|
24
|
-
headers: {
|
|
2
|
+
return `
|
|
3
|
+
<!DOCTYPE html>
|
|
4
|
+
<html>
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset=utf-8/>
|
|
7
|
+
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
|
|
8
|
+
<title>Shopify Storefront API</title>
|
|
9
|
+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/css/index.css" />
|
|
10
|
+
<link rel="shortcut icon" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/favicon.png" />
|
|
11
|
+
<script src="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/js/middleware.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root"></div>
|
|
15
|
+
<script>window.addEventListener('load', function (event) {
|
|
16
|
+
GraphQLPlayground.init(document.getElementById('root'), {
|
|
17
|
+
endpoint:'https://${shop}/api/${apiVersion}/graphql.json',
|
|
18
|
+
settings:{
|
|
19
|
+
'request.globalHeaders': {
|
|
25
20
|
Accept: 'application/json',
|
|
26
21
|
'Content-Type': 'application/graphql',
|
|
27
22
|
'X-Shopify-Storefront-Access-Token': '${token}'
|
|
28
23
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</
|
|
24
|
+
},
|
|
25
|
+
tabs: [{
|
|
26
|
+
endpoint: 'https://${shop}/api/${apiVersion}/graphql.json',
|
|
27
|
+
query: '{ shop { name } }'
|
|
28
|
+
}]
|
|
29
|
+
})
|
|
30
|
+
})</script>
|
|
31
|
+
</body>
|
|
36
32
|
</html>
|
|
37
33
|
`;
|
|
38
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Provide Hydrogen config loader to external tools like the CLI
|
|
2
|
-
import { VIRTUAL_PROXY_HYDROGEN_CONFIG_ID } from './plugins/vite-plugin-hydrogen-virtual-files';
|
|
3
|
-
import { viteception } from './viteception';
|
|
2
|
+
import { VIRTUAL_PROXY_HYDROGEN_CONFIG_ID } from './plugins/vite-plugin-hydrogen-virtual-files.js';
|
|
3
|
+
import { viteception } from './viteception.js';
|
|
4
4
|
export async function loadConfig(options = { root: process.cwd() }) {
|
|
5
5
|
const { loaded } = await viteception([VIRTUAL_PROXY_HYDROGEN_CONFIG_ID], options);
|
|
6
6
|
return { configuration: loaded[0].default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { graphiqlHtml } from './graphiql';
|
|
1
|
+
import { graphiqlHtml } from './graphiql.js';
|
|
2
2
|
export function graphiqlMiddleware({ getShopifyConfig, dev, }) {
|
|
3
3
|
return async function (request, response, next) {
|
|
4
4
|
if (dev && isGraphiqlRequest(request)) {
|
|
@@ -24,7 +24,7 @@ export function hydrogenMiddleware({ dev, cache, indexTemplate, getServerEntrypo
|
|
|
24
24
|
* which is needed for proxy requests and server-side API requests.
|
|
25
25
|
*/
|
|
26
26
|
const webPolyfills = !globalThis.fetch || !globalThis.ReadableStream
|
|
27
|
-
? import('../utilities/web-api-polyfill')
|
|
27
|
+
? import('../utilities/web-api-polyfill.js')
|
|
28
28
|
: undefined;
|
|
29
29
|
return async function (request, response, next) {
|
|
30
30
|
try {
|