@shopify/hydrogen 0.0.0-experimental-20220526194818
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/CHANGELOG.md +1643 -0
- package/README.md +29 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/config.d.ts +1 -0
- package/config.js +1 -0
- package/dist/esnext/FileSessionStorage.d.ts +1 -0
- package/dist/esnext/FileSessionStorage.js +1 -0
- package/dist/esnext/client.d.ts +16 -0
- package/dist/esnext/client.js +16 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +47 -0
- package/dist/esnext/components/AddToCartButton/index.d.ts +1 -0
- package/dist/esnext/components/AddToCartButton/index.js +1 -0
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.js +26 -0
- package/dist/esnext/components/BuyNowButton/index.d.ts +1 -0
- package/dist/esnext/components/BuyNowButton/index.js +1 -0
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.js +17 -0
- package/dist/esnext/components/CartCheckoutButton/index.d.ts +1 -0
- package/dist/esnext/components/CartCheckoutButton/index.js +1 -0
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.js +29 -0
- package/dist/esnext/components/CartEstimatedCost/index.d.ts +1 -0
- package/dist/esnext/components/CartEstimatedCost/index.js +1 -0
- package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +9 -0
- package/dist/esnext/components/CartLineImage/CartLineImage.client.js +11 -0
- package/dist/esnext/components/CartLineImage/index.d.ts +1 -0
- package/dist/esnext/components/CartLineImage/index.js +1 -0
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +21 -0
- package/dist/esnext/components/CartLinePrice/index.d.ts +1 -0
- package/dist/esnext/components/CartLinePrice/index.js +1 -0
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.js +12 -0
- package/dist/esnext/components/CartLineProductTitle/index.d.ts +1 -0
- package/dist/esnext/components/CartLineProductTitle/index.js +1 -0
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.js +8 -0
- package/dist/esnext/components/CartLineProvider/context.d.ts +26 -0
- package/dist/esnext/components/CartLineProvider/context.js +2 -0
- package/dist/esnext/components/CartLineProvider/index.d.ts +2 -0
- package/dist/esnext/components/CartLineProvider/index.js +2 -0
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js +12 -0
- package/dist/esnext/components/CartLineQuantity/index.d.ts +1 -0
- package/dist/esnext/components/CartLineQuantity/index.js +1 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +24 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.js +1 -0
- package/dist/esnext/components/CartLines/CartLines.d.ts +15 -0
- package/dist/esnext/components/CartLines/CartLines.js +17 -0
- package/dist/esnext/components/CartLines/index.d.ts +1 -0
- package/dist/esnext/components/CartLines/index.js +1 -0
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +41 -0
- package/dist/esnext/components/CartProvider/CartProvider.client.js +523 -0
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +10 -0
- package/dist/esnext/components/CartProvider/cart-queries.js +191 -0
- package/dist/esnext/components/CartProvider/constants.d.ts +2 -0
- package/dist/esnext/components/CartProvider/constants.js +2 -0
- package/dist/esnext/components/CartProvider/context.d.ts +2 -0
- package/dist/esnext/components/CartProvider/context.js +2 -0
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +85 -0
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +72 -0
- package/dist/esnext/components/CartProvider/graphql/CartFragment.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +81 -0
- package/dist/esnext/components/CartProvider/graphql/CartQuery.js +1 -0
- package/dist/esnext/components/CartProvider/hooks.client.d.ts +15 -0
- package/dist/esnext/components/CartProvider/hooks.client.js +62 -0
- package/dist/esnext/components/CartProvider/index.d.ts +4 -0
- package/dist/esnext/components/CartProvider/index.js +3 -0
- package/dist/esnext/components/CartProvider/types.d.ts +102 -0
- package/dist/esnext/components/CartProvider/types.js +1 -0
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +19 -0
- package/dist/esnext/components/CartShopPayButton/index.d.ts +1 -0
- package/dist/esnext/components/CartShopPayButton/index.js +1 -0
- package/dist/esnext/components/DevTools.client.d.ts +1 -0
- package/dist/esnext/components/DevTools.client.js +129 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +21 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +14 -0
- package/dist/esnext/components/ExternalVideo/index.d.ts +1 -0
- package/dist/esnext/components/ExternalVideo/index.js +1 -0
- package/dist/esnext/components/Image/Image.d.ts +84 -0
- package/dist/esnext/components/Image/Image.js +59 -0
- package/dist/esnext/components/Image/index.d.ts +2 -0
- package/dist/esnext/components/Image/index.js +1 -0
- package/dist/esnext/components/Link/Link.client.d.ts +23 -0
- package/dist/esnext/components/Link/Link.client.js +135 -0
- package/dist/esnext/components/Link/index.d.ts +1 -0
- package/dist/esnext/components/Link/index.js +1 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +5 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.js +2 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +44 -0
- package/dist/esnext/components/LocalizationProvider/index.d.ts +2 -0
- package/dist/esnext/components/LocalizationProvider/index.js +2 -0
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +19 -0
- package/dist/esnext/components/MediaFile/MediaFile.js +31 -0
- package/dist/esnext/components/MediaFile/index.d.ts +1 -0
- package/dist/esnext/components/MediaFile/index.js +1 -0
- package/dist/esnext/components/Metafield/Metafield.client.d.ts +21 -0
- package/dist/esnext/components/Metafield/Metafield.client.js +68 -0
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +12 -0
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.js +48 -0
- package/dist/esnext/components/Metafield/components/StarRating/index.d.ts +1 -0
- package/dist/esnext/components/Metafield/components/StarRating/index.js +1 -0
- package/dist/esnext/components/Metafield/components/index.d.ts +1 -0
- package/dist/esnext/components/Metafield/components/index.js +1 -0
- package/dist/esnext/components/Metafield/index.d.ts +2 -0
- package/dist/esnext/components/Metafield/index.js +1 -0
- package/dist/esnext/components/Metafield/types.d.ts +4 -0
- package/dist/esnext/components/Metafield/types.js +1 -0
- package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +128 -0
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +105 -0
- package/dist/esnext/components/ModelViewer/index.d.ts +1 -0
- package/dist/esnext/components/ModelViewer/index.js +1 -0
- package/dist/esnext/components/Money/Money.client.d.ts +25 -0
- package/dist/esnext/components/Money/Money.client.js +39 -0
- package/dist/esnext/components/Money/index.d.ts +1 -0
- package/dist/esnext/components/Money/index.js +1 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +15 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +56 -0
- package/dist/esnext/components/ProductPrice/index.d.ts +1 -0
- package/dist/esnext/components/ProductPrice/index.js +1 -0
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +8 -0
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +12 -0
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +24 -0
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +34 -0
- package/dist/esnext/components/ProductProvider/context.d.ts +29 -0
- package/dist/esnext/components/ProductProvider/context.js +3 -0
- package/dist/esnext/components/ProductProvider/index.d.ts +2 -0
- package/dist/esnext/components/ProductProvider/index.js +2 -0
- package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/CollectionSeo.client.js +15 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +18 -0
- package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +4 -0
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +10 -0
- package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/HomePageSeo.client.js +25 -0
- package/dist/esnext/components/Seo/ImageSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/ImageSeo.client.js +10 -0
- package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +10 -0
- package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/PageSeo.client.js +13 -0
- package/dist/esnext/components/Seo/ProductSeo.client.d.ts +5 -0
- package/dist/esnext/components/Seo/ProductSeo.client.js +63 -0
- package/dist/esnext/components/Seo/Seo.client.d.ts +30 -0
- package/dist/esnext/components/Seo/Seo.client.js +31 -0
- package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/TitleSeo.client.js +10 -0
- package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/TwitterSeo.client.js +9 -0
- package/dist/esnext/components/Seo/index.d.ts +1 -0
- package/dist/esnext/components/Seo/index.js +1 -0
- package/dist/esnext/components/Seo/seo-types.d.ts +17 -0
- package/dist/esnext/components/Seo/seo-types.js +1 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +52 -0
- package/dist/esnext/components/ShopPayButton/index.d.ts +1 -0
- package/dist/esnext/components/ShopPayButton/index.js +1 -0
- package/dist/esnext/components/Video/Video.d.ts +14 -0
- package/dist/esnext/components/Video/Video.js +24 -0
- package/dist/esnext/components/Video/index.d.ts +1 -0
- package/dist/esnext/components/Video/index.js +1 -0
- package/dist/esnext/components/index.d.ts +28 -0
- package/dist/esnext/components/index.js +26 -0
- package/dist/esnext/components/types.d.ts +71 -0
- package/dist/esnext/components/types.js +10 -0
- package/dist/esnext/config.d.ts +3 -0
- package/dist/esnext/config.js +1 -0
- package/dist/esnext/constants.d.ts +7 -0
- package/dist/esnext/constants.js +7 -0
- package/dist/esnext/entry-client.d.ts +3 -0
- package/dist/esnext/entry-client.js +73 -0
- package/dist/esnext/entry-server.d.ts +35 -0
- package/dist/esnext/entry-server.js +529 -0
- package/dist/esnext/foundation/Analytics/Analytics.client.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/Analytics.client.js +28 -0
- package/dist/esnext/foundation/Analytics/Analytics.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/Analytics.server.js +40 -0
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +25 -0
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +97 -0
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +33 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +64 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.js +24 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +23 -0
- package/dist/esnext/foundation/Analytics/const.d.ts +9 -0
- package/dist/esnext/foundation/Analytics/const.js +9 -0
- package/dist/esnext/foundation/Analytics/hook.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/hook.js +7 -0
- package/dist/esnext/foundation/Analytics/index.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/index.js +2 -0
- package/dist/esnext/foundation/Analytics/types.d.ts +5 -0
- package/dist/esnext/foundation/Analytics/types.js +1 -0
- package/dist/esnext/foundation/Analytics/utils.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/utils.js +8 -0
- package/dist/esnext/foundation/AnalyticsErrorBoundary.client.d.ts +4 -0
- package/dist/esnext/foundation/AnalyticsErrorBoundary.client.js +8 -0
- package/dist/esnext/foundation/Cookie/Cookie.d.ts +48 -0
- package/dist/esnext/foundation/Cookie/Cookie.js +67 -0
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.d.ts +5 -0
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.js +31 -0
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +74 -0
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.d.ts +6 -0
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.js +149 -0
- package/dist/esnext/foundation/Head/Head.client.d.ts +5 -0
- package/dist/esnext/foundation/Head/Head.client.js +10 -0
- package/dist/esnext/foundation/Head/index.d.ts +1 -0
- package/dist/esnext/foundation/Head/index.js +1 -0
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.d.ts +5 -0
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.js +53 -0
- package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
- package/dist/esnext/foundation/Redirect/Redirect.client.js +15 -0
- package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
- package/dist/esnext/foundation/Route/Route.server.js +28 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +13 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +130 -0
- package/dist/esnext/foundation/Router/Router.server.d.ts +10 -0
- package/dist/esnext/foundation/Router/Router.server.js +8 -0
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +40 -0
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +67 -0
- package/dist/esnext/foundation/ServerPropsProvider/index.d.ts +2 -0
- package/dist/esnext/foundation/ServerPropsProvider/index.js +1 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +128 -0
- package/dist/esnext/foundation/ServerRequestProvider/index.d.ts +1 -0
- package/dist/esnext/foundation/ServerRequestProvider/index.js +1 -0
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +30 -0
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +59 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +8 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.d.ts +16 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +58 -0
- package/dist/esnext/foundation/ShopifyProvider/index.d.ts +1 -0
- package/dist/esnext/foundation/ShopifyProvider/index.js +1 -0
- package/dist/esnext/foundation/ShopifyProvider/types.d.ts +13 -0
- package/dist/esnext/foundation/ShopifyProvider/types.js +1 -0
- package/dist/esnext/foundation/constants.d.ts +1 -0
- package/dist/esnext/foundation/constants.js +3 -0
- package/dist/esnext/foundation/fetchSync/client/fetchSync.d.ts +10 -0
- package/dist/esnext/foundation/fetchSync/client/fetchSync.js +28 -0
- package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +8 -0
- package/dist/esnext/foundation/fetchSync/server/fetchSync.js +29 -0
- package/dist/esnext/foundation/fetchSync/types.d.ts +5 -0
- package/dist/esnext/foundation/fetchSync/types.js +1 -0
- package/dist/esnext/foundation/index.d.ts +3 -0
- package/dist/esnext/foundation/index.js +3 -0
- package/dist/esnext/foundation/session/session.d.ts +27 -0
- package/dist/esnext/foundation/session/session.js +37 -0
- package/dist/esnext/foundation/ssr-interop.d.ts +29 -0
- package/dist/esnext/foundation/ssr-interop.js +35 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +13 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.js +14 -0
- package/dist/esnext/foundation/useQuery/hooks.d.ts +36 -0
- package/dist/esnext/foundation/useQuery/hooks.js +97 -0
- package/dist/esnext/foundation/useQuery/index.d.ts +1 -0
- package/dist/esnext/foundation/useQuery/index.js +1 -0
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +9 -0
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +7 -0
- package/dist/esnext/foundation/useRouteParams/useRouteParams.d.ts +4 -0
- package/dist/esnext/foundation/useRouteParams/useRouteParams.js +9 -0
- package/dist/esnext/foundation/useServerProps/index.d.ts +1 -0
- package/dist/esnext/foundation/useServerProps/index.js +1 -0
- package/dist/esnext/foundation/useServerProps/use-server-props.d.ts +21 -0
- package/dist/esnext/foundation/useServerProps/use-server-props.js +35 -0
- package/dist/esnext/foundation/useSession/useSession.d.ts +2 -0
- package/dist/esnext/foundation/useSession/useSession.js +8 -0
- package/dist/esnext/foundation/useShop/index.d.ts +1 -0
- package/dist/esnext/foundation/useShop/index.js +1 -0
- package/dist/esnext/foundation/useShop/use-shop.d.ts +6 -0
- package/dist/esnext/foundation/useShop/use-shop.js +14 -0
- package/dist/esnext/foundation/useUrl/index.d.ts +1 -0
- package/dist/esnext/foundation/useUrl/index.js +1 -0
- package/dist/esnext/foundation/useUrl/useUrl.d.ts +4 -0
- package/dist/esnext/foundation/useUrl/useUrl.js +28 -0
- package/dist/esnext/framework/CachingStrategy/index.d.ts +10 -0
- package/dist/esnext/framework/CachingStrategy/index.js +96 -0
- package/dist/esnext/framework/Hydration/Html.d.ts +11 -0
- package/dist/esnext/framework/Hydration/Html.js +86 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +58 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +146 -0
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +26 -0
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +42 -0
- package/dist/esnext/framework/Hydration/rsc.d.ts +8 -0
- package/dist/esnext/framework/Hydration/rsc.js +100 -0
- package/dist/esnext/framework/cache/in-memory.d.ts +12 -0
- package/dist/esnext/framework/cache/in-memory.js +52 -0
- package/dist/esnext/framework/cache-sub-request.d.ts +17 -0
- package/dist/esnext/framework/cache-sub-request.js +64 -0
- package/dist/esnext/framework/cache.d.ts +17 -0
- package/dist/esnext/framework/cache.js +127 -0
- package/dist/esnext/framework/config.d.ts +6 -0
- package/dist/esnext/framework/config.js +6 -0
- package/dist/esnext/framework/graphiql.d.ts +1 -0
- package/dist/esnext/framework/graphiql.js +38 -0
- package/dist/esnext/framework/middleware.d.ts +21 -0
- package/dist/esnext/framework/middleware.js +98 -0
- package/dist/esnext/framework/plugin.d.ts +4 -0
- package/dist/esnext/framework/plugin.js +28 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.js +25 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +98 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.js +35 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +9 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.js +37 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +96 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +11 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +110 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +35 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +70 -0
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.js +11 -0
- package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.js +16 -0
- package/dist/esnext/framework/runtime.d.ts +13 -0
- package/dist/esnext/framework/runtime.js +27 -0
- package/dist/esnext/hooks/index.d.ts +6 -0
- package/dist/esnext/hooks/index.js +6 -0
- package/dist/esnext/hooks/useCart/index.d.ts +1 -0
- package/dist/esnext/hooks/useCart/index.js +1 -0
- package/dist/esnext/hooks/useCart/useCart.d.ts +4 -0
- package/dist/esnext/hooks/useCart/useCart.js +12 -0
- package/dist/esnext/hooks/useCartLine/index.d.ts +1 -0
- package/dist/esnext/hooks/useCartLine/index.js +1 -0
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +29 -0
- package/dist/esnext/hooks/useCartLine/useCartLine.js +12 -0
- package/dist/esnext/hooks/useCountry/index.d.ts +1 -0
- package/dist/esnext/hooks/useCountry/index.js +1 -0
- package/dist/esnext/hooks/useCountry/useCountry.d.ts +7 -0
- package/dist/esnext/hooks/useCountry/useCountry.js +17 -0
- package/dist/esnext/hooks/useLoadScript/index.d.ts +1 -0
- package/dist/esnext/hooks/useLoadScript/index.js +1 -0
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.d.ts +8 -0
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.js +23 -0
- package/dist/esnext/hooks/useMeasurement/hooks.d.ts +9 -0
- package/dist/esnext/hooks/useMeasurement/hooks.js +13 -0
- package/dist/esnext/hooks/useMeasurement/index.d.ts +1 -0
- package/dist/esnext/hooks/useMeasurement/index.js +1 -0
- package/dist/esnext/hooks/useMoney/hooks.d.ts +54 -0
- package/dist/esnext/hooks/useMoney/hooks.js +66 -0
- package/dist/esnext/hooks/useMoney/index.d.ts +1 -0
- package/dist/esnext/hooks/useMoney/index.js +1 -0
- package/dist/esnext/hooks/useParsedMetafields/index.d.ts +1 -0
- package/dist/esnext/hooks/useParsedMetafields/index.js +1 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +21 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +21 -0
- package/dist/esnext/hooks/useProduct/index.d.ts +1 -0
- package/dist/esnext/hooks/useProduct/index.js +1 -0
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +52 -0
- package/dist/esnext/hooks/useProduct/useProduct.js +43 -0
- package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -0
- package/dist/esnext/hooks/useProductOptions/helpers.js +40 -0
- package/dist/esnext/hooks/useProductOptions/index.d.ts +2 -0
- package/dist/esnext/hooks/useProductOptions/index.js +2 -0
- package/dist/esnext/hooks/useProductOptions/types.d.ts +42 -0
- package/dist/esnext/hooks/useProductOptions/types.js +1 -0
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +15 -0
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +108 -0
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +28 -0
- package/dist/esnext/hooks/useShopQuery/hooks.js +161 -0
- package/dist/esnext/hooks/useShopQuery/index.d.ts +1 -0
- package/dist/esnext/hooks/useShopQuery/index.js +1 -0
- package/dist/esnext/index.d.ts +27 -0
- package/dist/esnext/index.js +31 -0
- package/dist/esnext/node.d.ts +1 -0
- package/dist/esnext/node.js +1 -0
- package/dist/esnext/platforms/node.d.ts +9 -0
- package/dist/esnext/platforms/node.js +40 -0
- package/dist/esnext/platforms/worker-event.d.ts +1 -0
- package/dist/esnext/platforms/worker-event.js +3 -0
- package/dist/esnext/platforms/worker.d.ts +14 -0
- package/dist/esnext/platforms/worker.js +25 -0
- package/dist/esnext/storefront-api-types.d.ts +6405 -0
- package/dist/esnext/storefront-api-types.js +1763 -0
- package/dist/esnext/streaming.server.d.ts +24 -0
- package/dist/esnext/streaming.server.js +33 -0
- package/dist/esnext/types.d.ts +98 -0
- package/dist/esnext/types.js +1 -0
- package/dist/esnext/utilities/apiRoutes.d.ts +37 -0
- package/dist/esnext/utilities/apiRoutes.js +156 -0
- package/dist/esnext/utilities/bot-ua.d.ts +4 -0
- package/dist/esnext/utilities/bot-ua.js +61 -0
- package/dist/esnext/utilities/defer.d.ts +6 -0
- package/dist/esnext/utilities/defer.js +14 -0
- package/dist/esnext/utilities/devtools.d.ts +11 -0
- package/dist/esnext/utilities/devtools.js +11 -0
- package/dist/esnext/utilities/empty-hydrogen-config.d.ts +2 -0
- package/dist/esnext/utilities/empty-hydrogen-config.js +2 -0
- package/dist/esnext/utilities/error.d.ts +1 -0
- package/dist/esnext/utilities/error.js +6 -0
- package/dist/esnext/utilities/fetch.d.ts +9 -0
- package/dist/esnext/utilities/fetch.js +31 -0
- package/dist/esnext/utilities/findRoutePrefix.d.ts +1 -0
- package/dist/esnext/utilities/findRoutePrefix.js +17 -0
- package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +6 -0
- package/dist/esnext/utilities/flattenConnection/flattenConnection.js +11 -0
- package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -0
- package/dist/esnext/utilities/flattenConnection/index.js +1 -0
- package/dist/esnext/utilities/graphql-tag.d.ts +1 -0
- package/dist/esnext/utilities/graphql-tag.js +6 -0
- package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
- package/dist/esnext/utilities/graphql-tracker.js +123 -0
- package/dist/esnext/utilities/hash.d.ts +2 -0
- package/dist/esnext/utilities/hash.js +7 -0
- package/dist/esnext/utilities/html-encoding.d.ts +2 -0
- package/dist/esnext/utilities/html-encoding.js +16 -0
- package/dist/esnext/utilities/image_size.d.ts +12 -0
- package/dist/esnext/utilities/image_size.js +62 -0
- package/dist/esnext/utilities/index.d.ts +12 -0
- package/dist/esnext/utilities/index.js +12 -0
- package/dist/esnext/utilities/isClient/index.d.ts +1 -0
- package/dist/esnext/utilities/isClient/index.js +1 -0
- package/dist/esnext/utilities/isClient/isClient.d.ts +4 -0
- package/dist/esnext/utilities/isClient/isClient.js +6 -0
- package/dist/esnext/utilities/isServer/index.d.ts +1 -0
- package/dist/esnext/utilities/isServer/index.js +1 -0
- package/dist/esnext/utilities/isServer/isServer.d.ts +4 -0
- package/dist/esnext/utilities/isServer/isServer.js +7 -0
- package/dist/esnext/utilities/load_script.d.ts +3 -0
- package/dist/esnext/utilities/load_script.js +23 -0
- package/dist/esnext/utilities/log/index.d.ts +4 -0
- package/dist/esnext/utilities/log/index.js +4 -0
- package/dist/esnext/utilities/log/log-cache-api-status.d.ts +1 -0
- package/dist/esnext/utilities/log/log-cache-api-status.js +13 -0
- package/dist/esnext/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/esnext/utilities/log/log-cache-header.js +30 -0
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/esnext/utilities/log/log-query-timeline.js +83 -0
- package/dist/esnext/utilities/log/log.d.ts +22 -0
- package/dist/esnext/utilities/log/log.js +66 -0
- package/dist/esnext/utilities/log/utils.d.ts +3 -0
- package/dist/esnext/utilities/log/utils.js +16 -0
- package/dist/esnext/utilities/matchPath.d.ts +10 -0
- package/dist/esnext/utilities/matchPath.js +54 -0
- package/dist/esnext/utilities/measurement.d.ts +3 -0
- package/dist/esnext/utilities/measurement.js +98 -0
- package/dist/esnext/utilities/object.d.ts +5 -0
- package/dist/esnext/utilities/object.js +7 -0
- package/dist/esnext/utilities/parse.d.ts +1 -0
- package/dist/esnext/utilities/parse.js +9 -0
- package/dist/esnext/utilities/parseMetafieldValue/index.d.ts +1 -0
- package/dist/esnext/utilities/parseMetafieldValue/index.js +1 -0
- package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +6 -0
- package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.js +36 -0
- package/dist/esnext/utilities/storefrontApi.d.ts +4 -0
- package/dist/esnext/utilities/storefrontApi.js +22 -0
- package/dist/esnext/utilities/suspense.d.ts +12 -0
- package/dist/esnext/utilities/suspense.js +58 -0
- package/dist/esnext/utilities/template.d.ts +9 -0
- package/dist/esnext/utilities/template.js +23 -0
- package/dist/esnext/utilities/timing.d.ts +7 -0
- package/dist/esnext/utilities/timing.js +14 -0
- package/dist/esnext/utilities/video_parameters.d.ts +47 -0
- package/dist/esnext/utilities/video_parameters.js +22 -0
- package/dist/esnext/utilities/web-api-polyfill.d.ts +1 -0
- package/dist/esnext/utilities/web-api-polyfill.js +19 -0
- package/dist/esnext/version.d.ts +1 -0
- package/dist/esnext/version.js +1 -0
- package/dist/node/components/Image/Image.d.ts +84 -0
- package/dist/node/components/Image/Image.js +86 -0
- package/dist/node/components/Image/index.d.ts +2 -0
- package/dist/node/components/Image/index.js +5 -0
- package/dist/node/constants.d.ts +7 -0
- package/dist/node/constants.js +10 -0
- package/dist/node/entry-server.d.ts +35 -0
- package/dist/node/entry-server.js +556 -0
- package/dist/node/foundation/Analytics/Analytics.client.d.ts +3 -0
- package/dist/node/foundation/Analytics/Analytics.client.js +32 -0
- package/dist/node/foundation/Analytics/Analytics.server.d.ts +1 -0
- package/dist/node/foundation/Analytics/Analytics.server.js +70 -0
- package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +25 -0
- package/dist/node/foundation/Analytics/ClientAnalytics.js +100 -0
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.d.ts +2 -0
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +37 -0
- package/dist/node/foundation/Analytics/const.d.ts +9 -0
- package/dist/node/foundation/Analytics/const.js +12 -0
- package/dist/node/foundation/Analytics/hook.d.ts +1 -0
- package/dist/node/foundation/Analytics/hook.js +11 -0
- package/dist/node/foundation/Analytics/index.d.ts +2 -0
- package/dist/node/foundation/Analytics/index.js +7 -0
- package/dist/node/foundation/Analytics/types.d.ts +5 -0
- package/dist/node/foundation/Analytics/types.js +2 -0
- package/dist/node/foundation/Analytics/utils.d.ts +1 -0
- package/dist/node/foundation/Analytics/utils.js +12 -0
- package/dist/node/foundation/AnalyticsErrorBoundary.client.d.ts +4 -0
- package/dist/node/foundation/AnalyticsErrorBoundary.client.js +14 -0
- package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
- package/dist/node/foundation/Redirect/Redirect.client.js +18 -0
- package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
- package/dist/node/foundation/Router/BrowserRouter.client.js +159 -0
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +40 -0
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +92 -0
- package/dist/node/foundation/ServerPropsProvider/index.d.ts +2 -0
- package/dist/node/foundation/ServerPropsProvider/index.js +6 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +158 -0
- package/dist/node/foundation/ServerRequestProvider/index.d.ts +1 -0
- package/dist/node/foundation/ServerRequestProvider/index.js +17 -0
- package/dist/node/foundation/ShopifyProvider/types.d.ts +13 -0
- package/dist/node/foundation/ShopifyProvider/types.js +2 -0
- package/dist/node/foundation/session/session.d.ts +27 -0
- package/dist/node/foundation/session/session.js +43 -0
- package/dist/node/foundation/ssr-interop.d.ts +29 -0
- package/dist/node/foundation/ssr-interop.js +39 -0
- package/dist/node/foundation/useNavigate/useNavigate.d.ts +13 -0
- package/dist/node/foundation/useNavigate/useNavigate.js +18 -0
- package/dist/node/foundation/useServerProps/use-server-props.d.ts +21 -0
- package/dist/node/foundation/useServerProps/use-server-props.js +40 -0
- package/dist/node/framework/CachingStrategy/index.d.ts +10 -0
- package/dist/node/framework/CachingStrategy/index.js +108 -0
- package/dist/node/framework/Hydration/Html.d.ts +11 -0
- package/dist/node/framework/Hydration/Html.js +94 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +58 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.js +150 -0
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +26 -0
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +49 -0
- package/dist/node/framework/Hydration/rsc.d.ts +8 -0
- package/dist/node/framework/Hydration/rsc.js +103 -0
- package/dist/node/framework/cache/in-memory.d.ts +12 -0
- package/dist/node/framework/cache/in-memory.js +56 -0
- package/dist/node/framework/cache-sub-request.d.ts +17 -0
- package/dist/node/framework/cache-sub-request.js +95 -0
- package/dist/node/framework/cache.d.ts +17 -0
- package/dist/node/framework/cache.js +135 -0
- package/dist/node/framework/config.d.ts +6 -0
- package/dist/node/framework/config.js +11 -0
- package/dist/node/framework/graphiql.d.ts +1 -0
- package/dist/node/framework/graphiql.js +42 -0
- package/dist/node/framework/middleware.d.ts +21 -0
- package/dist/node/framework/middleware.js +125 -0
- package/dist/node/framework/plugin.d.ts +4 -0
- package/dist/node/framework/plugin.js +33 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.js +28 -0
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +104 -0
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.js +40 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +9 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.js +39 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +98 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +11 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +116 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +41 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +75 -0
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.js +16 -0
- package/dist/node/framework/plugins/vite-plugin-ssr-interop.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-ssr-interop.js +18 -0
- package/dist/node/framework/runtime.d.ts +13 -0
- package/dist/node/framework/runtime.js +35 -0
- package/dist/node/storefront-api-types.d.ts +6405 -0
- package/dist/node/storefront-api-types.js +1766 -0
- package/dist/node/streaming.server.d.ts +24 -0
- package/dist/node/streaming.server.js +33 -0
- package/dist/node/types.d.ts +98 -0
- package/dist/node/types.js +2 -0
- package/dist/node/utilities/apiRoutes.d.ts +37 -0
- package/dist/node/utilities/apiRoutes.js +163 -0
- package/dist/node/utilities/bot-ua.d.ts +4 -0
- package/dist/node/utilities/bot-ua.js +65 -0
- package/dist/node/utilities/defer.d.ts +6 -0
- package/dist/node/utilities/defer.js +18 -0
- package/dist/node/utilities/error.d.ts +1 -0
- package/dist/node/utilities/error.js +10 -0
- package/dist/node/utilities/fetch.d.ts +9 -0
- package/dist/node/utilities/fetch.js +37 -0
- package/dist/node/utilities/findRoutePrefix.d.ts +1 -0
- package/dist/node/utilities/findRoutePrefix.js +21 -0
- package/dist/node/utilities/flattenConnection/flattenConnection.d.ts +6 -0
- package/dist/node/utilities/flattenConnection/flattenConnection.js +15 -0
- package/dist/node/utilities/flattenConnection/index.d.ts +1 -0
- package/dist/node/utilities/flattenConnection/index.js +5 -0
- package/dist/node/utilities/hash.d.ts +2 -0
- package/dist/node/utilities/hash.js +11 -0
- package/dist/node/utilities/html-encoding.d.ts +2 -0
- package/dist/node/utilities/html-encoding.js +21 -0
- package/dist/node/utilities/image_size.d.ts +12 -0
- package/dist/node/utilities/image_size.js +68 -0
- package/dist/node/utilities/index.d.ts +12 -0
- package/dist/node/utilities/index.js +34 -0
- package/dist/node/utilities/isClient/index.d.ts +1 -0
- package/dist/node/utilities/isClient/index.js +5 -0
- package/dist/node/utilities/isClient/isClient.d.ts +4 -0
- package/dist/node/utilities/isClient/isClient.js +10 -0
- package/dist/node/utilities/isServer/index.d.ts +1 -0
- package/dist/node/utilities/isServer/index.js +5 -0
- package/dist/node/utilities/isServer/isServer.d.ts +4 -0
- package/dist/node/utilities/isServer/isServer.js +11 -0
- package/dist/node/utilities/load_script.d.ts +3 -0
- package/dist/node/utilities/load_script.js +27 -0
- package/dist/node/utilities/log/index.d.ts +4 -0
- package/dist/node/utilities/log/index.js +18 -0
- package/dist/node/utilities/log/log-cache-api-status.d.ts +1 -0
- package/dist/node/utilities/log/log-cache-api-status.js +17 -0
- package/dist/node/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/node/utilities/log/log-cache-header.js +35 -0
- package/dist/node/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/node/utilities/log/log-query-timeline.js +88 -0
- package/dist/node/utilities/log/log.d.ts +22 -0
- package/dist/node/utilities/log/log.js +74 -0
- package/dist/node/utilities/log/utils.d.ts +3 -0
- package/dist/node/utilities/log/utils.js +21 -0
- package/dist/node/utilities/matchPath.d.ts +10 -0
- package/dist/node/utilities/matchPath.js +58 -0
- package/dist/node/utilities/measurement.d.ts +3 -0
- package/dist/node/utilities/measurement.js +103 -0
- package/dist/node/utilities/parse.d.ts +1 -0
- package/dist/node/utilities/parse.js +13 -0
- package/dist/node/utilities/parseMetafieldValue/index.d.ts +1 -0
- package/dist/node/utilities/parseMetafieldValue/index.js +5 -0
- package/dist/node/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +6 -0
- package/dist/node/utilities/parseMetafieldValue/parseMetafieldValue.js +40 -0
- package/dist/node/utilities/storefrontApi.d.ts +4 -0
- package/dist/node/utilities/storefrontApi.js +26 -0
- package/dist/node/utilities/suspense.d.ts +12 -0
- package/dist/node/utilities/suspense.js +64 -0
- package/dist/node/utilities/template.d.ts +9 -0
- package/dist/node/utilities/template.js +27 -0
- package/dist/node/utilities/timing.d.ts +7 -0
- package/dist/node/utilities/timing.js +18 -0
- package/dist/node/utilities/video_parameters.d.ts +47 -0
- package/dist/node/utilities/video_parameters.js +27 -0
- package/dist/node/utilities/web-api-polyfill.d.ts +1 -0
- package/dist/node/utilities/web-api-polyfill.js +47 -0
- package/dist/node/version.d.ts +1 -0
- package/dist/node/version.js +4 -0
- package/entry-client.d.ts +1 -0
- package/entry-client.js +1 -0
- package/entry-server.d.ts +1 -0
- package/entry-server.js +1 -0
- package/middleware.d.ts +1 -0
- package/middleware.js +1 -0
- package/package.json +125 -0
- package/plugin.d.ts +1 -0
- package/plugin.js +1 -0
- package/vendor/react-server-dom-vite/LICENSE +21 -0
- package/vendor/react-server-dom-vite/README.md +5 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +356 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1753 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +46 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1716 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +44 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +613 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +19 -0
- package/vendor/react-server-dom-vite/esm/package.json +3 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +88 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +352 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1745 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +1708 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +603 -0
- package/vendor/react-server-dom-vite/index.js +7 -0
- package/vendor/react-server-dom-vite/package.json +67 -0
- package/vendor/react-server-dom-vite/plugin.js +3 -0
- package/vendor/react-server-dom-vite/writer.browser.server.js +7 -0
- package/vendor/react-server-dom-vite/writer.node.server.js +7 -0
- package/web-polyfills.js +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { getLoggerWithContext, collectQueryCacheControlHeaders, collectQueryTimings, } from '../../utilities/log';
|
|
2
|
+
import { deleteItemFromCache, generateSubRequestCacheControlHeader, getItemFromCache, isStale, setItemInCache, } from '../../framework/cache-sub-request';
|
|
3
|
+
import { runDelayedFunction } from '../../framework/runtime';
|
|
4
|
+
import { useRequestCacheData, useServerRequest } from '../ServerRequestProvider';
|
|
5
|
+
import { CacheSeconds } from '../../framework/CachingStrategy';
|
|
6
|
+
/**
|
|
7
|
+
* The `useQuery` hook executes an asynchronous operation like `fetch` in a way that
|
|
8
|
+
* supports [Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html). You can use this
|
|
9
|
+
* hook to call any third-party APIs from a server component.
|
|
10
|
+
*
|
|
11
|
+
* \> Note:
|
|
12
|
+
* \> If you're making a simple fetch call on the server, then we recommend using the [`fetchSync`](https://shopify.dev/api/hydrogen/hooks/global/fetchsync) hook instead.
|
|
13
|
+
*/
|
|
14
|
+
export function useQuery(
|
|
15
|
+
/** A string or array to uniquely identify the current query. */
|
|
16
|
+
key,
|
|
17
|
+
/** An asynchronous query function like `fetch` which returns data. */
|
|
18
|
+
queryFn,
|
|
19
|
+
/** The options to manage the cache behavior of the sub-request. */
|
|
20
|
+
queryOptions) {
|
|
21
|
+
const request = useServerRequest();
|
|
22
|
+
const withCacheIdKey = [
|
|
23
|
+
'__QUERY_CACHE_ID__',
|
|
24
|
+
...(typeof key === 'string' ? [key] : key),
|
|
25
|
+
];
|
|
26
|
+
const fetcher = cachedQueryFnBuilder(withCacheIdKey, queryFn, queryOptions);
|
|
27
|
+
collectQueryTimings(request, withCacheIdKey, 'requested');
|
|
28
|
+
if (queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.preload) {
|
|
29
|
+
request.savePreloadQuery({
|
|
30
|
+
preload: queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.preload,
|
|
31
|
+
key: withCacheIdKey,
|
|
32
|
+
fetcher,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return useRequestCacheData(withCacheIdKey, fetcher);
|
|
36
|
+
}
|
|
37
|
+
function cachedQueryFnBuilder(key, queryFn, queryOptions) {
|
|
38
|
+
var _a;
|
|
39
|
+
const resolvedQueryOptions = {
|
|
40
|
+
...(queryOptions !== null && queryOptions !== void 0 ? queryOptions : {}),
|
|
41
|
+
};
|
|
42
|
+
const shouldCacheResponse = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.shouldCacheResponse) !== null && _a !== void 0 ? _a : (() => true);
|
|
43
|
+
/**
|
|
44
|
+
* Attempt to read the query from cache. If it doesn't exist or if it's stale, regenerate it.
|
|
45
|
+
*/
|
|
46
|
+
async function useCachedQueryFn() {
|
|
47
|
+
// Call this hook before running any async stuff
|
|
48
|
+
// to prevent losing the current React cycle.
|
|
49
|
+
const request = useServerRequest();
|
|
50
|
+
const log = getLoggerWithContext(request);
|
|
51
|
+
const cacheResponse = await getItemFromCache(key);
|
|
52
|
+
async function generateNewOutput() {
|
|
53
|
+
return await queryFn();
|
|
54
|
+
}
|
|
55
|
+
if (cacheResponse) {
|
|
56
|
+
const [output, response] = cacheResponse;
|
|
57
|
+
collectQueryCacheControlHeaders(request, key, response.headers.get('cache-control'));
|
|
58
|
+
/**
|
|
59
|
+
* Important: Do this async
|
|
60
|
+
*/
|
|
61
|
+
if (isStale(key, response)) {
|
|
62
|
+
const lockKey = ['lock', ...(typeof key === 'string' ? [key] : key)];
|
|
63
|
+
runDelayedFunction(async () => {
|
|
64
|
+
const lockExists = await getItemFromCache(lockKey);
|
|
65
|
+
if (lockExists)
|
|
66
|
+
return;
|
|
67
|
+
await setItemInCache(lockKey, true, CacheSeconds({
|
|
68
|
+
maxAge: 10,
|
|
69
|
+
}));
|
|
70
|
+
try {
|
|
71
|
+
const output = await generateNewOutput();
|
|
72
|
+
if (shouldCacheResponse(output)) {
|
|
73
|
+
await setItemInCache(key, output, resolvedQueryOptions === null || resolvedQueryOptions === void 0 ? void 0 : resolvedQueryOptions.cache);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
log.error(`Error generating async response: ${e.message}`);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await deleteItemFromCache(lockKey);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return output;
|
|
85
|
+
}
|
|
86
|
+
const newOutput = await generateNewOutput();
|
|
87
|
+
/**
|
|
88
|
+
* Important: Do this async
|
|
89
|
+
*/
|
|
90
|
+
if (shouldCacheResponse(newOutput)) {
|
|
91
|
+
runDelayedFunction(() => setItemInCache(key, newOutput, resolvedQueryOptions === null || resolvedQueryOptions === void 0 ? void 0 : resolvedQueryOptions.cache));
|
|
92
|
+
}
|
|
93
|
+
collectQueryCacheControlHeaders(request, key, generateSubRequestCacheControlHeader(resolvedQueryOptions === null || resolvedQueryOptions === void 0 ? void 0 : resolvedQueryOptions.cache));
|
|
94
|
+
return newOutput;
|
|
95
|
+
}
|
|
96
|
+
return useCachedQueryFn;
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useQuery } from './hooks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useQuery } from './hooks';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
declare type RouteParamsContextValue = {
|
|
3
|
+
routeParams: Record<string, string>;
|
|
4
|
+
};
|
|
5
|
+
export declare const RouteParamsContext: React.Context<RouteParamsContextValue>;
|
|
6
|
+
export declare const RouteParamsProvider: FC<{
|
|
7
|
+
routeParams: Record<string, string>;
|
|
8
|
+
}>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { createContext } from 'react';
|
|
2
|
+
export const RouteParamsContext = createContext({
|
|
3
|
+
routeParams: {},
|
|
4
|
+
});
|
|
5
|
+
export const RouteParamsProvider = ({ children, routeParams, }) => {
|
|
6
|
+
return (React.createElement(RouteParamsContext.Provider, { value: { routeParams } }, children));
|
|
7
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEnvContext } from '../ssr-interop';
|
|
2
|
+
import { RouteParamsContext } from './RouteParamsProvider.client';
|
|
3
|
+
/**
|
|
4
|
+
* The `useRouteParams` hook retrieves the parameters of an active route. The hook is available in both server and client components.
|
|
5
|
+
*/
|
|
6
|
+
export function useRouteParams() {
|
|
7
|
+
const router = useEnvContext((req) => req.ctx.router, RouteParamsContext);
|
|
8
|
+
return router.routeParams;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useServerProps } from './use-server-props';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useServerProps } from './use-server-props';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ServerPropsContextValue, InternalServerPropsContextValue } from '../ServerPropsProvider/ServerPropsProvider';
|
|
2
|
+
/**
|
|
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
|
+
*
|
|
5
|
+
* ## Return value
|
|
6
|
+
*
|
|
7
|
+
* The `useServerProps` hook returns an object with the following keys:
|
|
8
|
+
*
|
|
9
|
+
* | Key | Description |
|
|
10
|
+
* | ---------------- | -------------------------------------------------------------------------------------- |
|
|
11
|
+
* | `serverProps` | The current server props. |
|
|
12
|
+
* | `setServerProps` | A function used to modify server props. |
|
|
13
|
+
* | `pending` | Whether a [transition is pending](https://github.com/reactwg/react-18/discussions/41). |
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare function useServerProps(): ServerPropsContextValue;
|
|
17
|
+
/**
|
|
18
|
+
* Internal-only hook to manage server state, including to set location server state
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function useInternalServerProps(): InternalServerPropsContextValue;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ServerPropsContext, } from '../ServerPropsProvider/ServerPropsProvider';
|
|
3
|
+
/**
|
|
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
|
+
*
|
|
6
|
+
* ## Return value
|
|
7
|
+
*
|
|
8
|
+
* The `useServerProps` hook returns an object with the following keys:
|
|
9
|
+
*
|
|
10
|
+
* | Key | Description |
|
|
11
|
+
* | ---------------- | -------------------------------------------------------------------------------------- |
|
|
12
|
+
* | `serverProps` | The current server props. |
|
|
13
|
+
* | `setServerProps` | A function used to modify server props. |
|
|
14
|
+
* | `pending` | Whether a [transition is pending](https://github.com/reactwg/react-18/discussions/41). |
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export function useServerProps() {
|
|
18
|
+
const internalServerPropsContext = useContext(ServerPropsContext);
|
|
19
|
+
if (!internalServerPropsContext) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
serverProps: internalServerPropsContext.serverProps,
|
|
24
|
+
setServerProps: internalServerPropsContext.setServerProps,
|
|
25
|
+
pending: internalServerPropsContext.pending,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Internal-only hook to manage server state, including to set location server state
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export function useInternalServerProps() {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = useContext(ServerPropsContext)) !== null && _a !== void 0 ? _a : {});
|
|
35
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useServerRequest } from '../ServerRequestProvider';
|
|
2
|
+
/** The `useSession` hook reads session data in server components. */
|
|
3
|
+
export const useSession = function () {
|
|
4
|
+
var _a;
|
|
5
|
+
const request = useServerRequest();
|
|
6
|
+
const session = ((_a = request.ctx.session) === null || _a === void 0 ? void 0 : _a.get()) || {};
|
|
7
|
+
return session;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useShop } from './use-shop';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useShop } from './use-shop';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `useShop` hook provides access to values within
|
|
3
|
+
* [the `shopify` property in the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
|
|
4
|
+
* The `useShop` hook must be a descendent of a `ShopifyProvider` component.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useShop(): import("../ShopifyProvider/types").ShopifyContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShopifyContext } from '../ShopifyProvider';
|
|
2
|
+
import { useEnvContext } from '../ssr-interop';
|
|
3
|
+
/**
|
|
4
|
+
* The `useShop` hook provides access to values within
|
|
5
|
+
* [the `shopify` property in the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
|
|
6
|
+
* The `useShop` hook must be a descendent of a `ShopifyProvider` component.
|
|
7
|
+
*/
|
|
8
|
+
export function useShop() {
|
|
9
|
+
const config = useEnvContext((req) => req.ctx.shopifyConfig, ShopifyContext);
|
|
10
|
+
if (!config) {
|
|
11
|
+
throw new Error('No Shopify Context found');
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useUrl } from './useUrl';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useUrl } from './useUrl';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RSC_PATHNAME } from '../../constants';
|
|
3
|
+
import { parseJSON } from '../../utilities/parse';
|
|
4
|
+
import { useLocation } from '../Router/BrowserRouter.client';
|
|
5
|
+
import { useEnvContext, META_ENV_SSR } from '../ssr-interop';
|
|
6
|
+
/**
|
|
7
|
+
* The `useUrl` hook retrieves the current URL in a server or client component.
|
|
8
|
+
*/
|
|
9
|
+
export function useUrl() {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
if (META_ENV_SSR) {
|
|
12
|
+
const serverUrl = new URL(useEnvContext((req) => req.url) // eslint-disable-line react-hooks/rules-of-hooks
|
|
13
|
+
);
|
|
14
|
+
if (serverUrl.pathname === RSC_PATHNAME) {
|
|
15
|
+
const state = parseJSON(serverUrl.searchParams.get('state') || '{}');
|
|
16
|
+
const parsedUrl = `${serverUrl.origin}${(_a = state.pathname) !== null && _a !== void 0 ? _a : ''}${(_b = state.search) !== null && _b !== void 0 ? _b : ''}`;
|
|
17
|
+
return new URL(parsedUrl);
|
|
18
|
+
}
|
|
19
|
+
return new URL(serverUrl);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* We return a `URL` object instead of passing through `location` because
|
|
23
|
+
* the URL object contains important info like hostname, etc.
|
|
24
|
+
*/
|
|
25
|
+
const location = useLocation(); // eslint-disable-line react-hooks/rules-of-hooks
|
|
26
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
|
+
return useMemo(() => new URL(window.location.href), [location]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CachingStrategy, AllCacheOptions, NoStoreStrategy } from '../../types';
|
|
2
|
+
export declare function generateCacheControlHeader(cacheOptions: CachingStrategy): string;
|
|
3
|
+
export declare function NoStore(): NoStoreStrategy;
|
|
4
|
+
export declare function CacheSeconds(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
5
|
+
export declare function CacheMinutes(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
6
|
+
export declare function CacheHours(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
7
|
+
export declare function CacheDays(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
8
|
+
export declare function CacheWeeks(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
9
|
+
export declare function CacheMonths(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
10
|
+
export declare function CacheCustom(overrideOptions: CachingStrategy): AllCacheOptions;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const PUBLIC = 'public';
|
|
2
|
+
const PRIVATE = 'private';
|
|
3
|
+
const NO_STORE = 'no-store';
|
|
4
|
+
const optionMapping = {
|
|
5
|
+
maxAge: 'max-age',
|
|
6
|
+
staleWhileRevalidate: 'stale-while-revalidate',
|
|
7
|
+
sMaxAge: 's-maxage',
|
|
8
|
+
staleIfError: 'stale-if-error',
|
|
9
|
+
};
|
|
10
|
+
export function generateCacheControlHeader(cacheOptions) {
|
|
11
|
+
const cacheControl = [];
|
|
12
|
+
Object.keys(cacheOptions).forEach((key) => {
|
|
13
|
+
if (key === 'mode') {
|
|
14
|
+
cacheControl.push(cacheOptions[key]);
|
|
15
|
+
}
|
|
16
|
+
else if (optionMapping[key]) {
|
|
17
|
+
cacheControl.push(`${optionMapping[key]}=${cacheOptions[key]}`);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return cacheControl.join(', ');
|
|
21
|
+
}
|
|
22
|
+
export function NoStore() {
|
|
23
|
+
return {
|
|
24
|
+
mode: NO_STORE,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function guardExpirableModeType(overrideOptions) {
|
|
28
|
+
if ((overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.mode) &&
|
|
29
|
+
(overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.mode) !== PUBLIC &&
|
|
30
|
+
(overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.mode) !== PRIVATE) {
|
|
31
|
+
throw Error("'mode' must be either 'public' or 'private'");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// 10 seconds
|
|
35
|
+
export function CacheSeconds(overrideOptions) {
|
|
36
|
+
guardExpirableModeType(overrideOptions);
|
|
37
|
+
return {
|
|
38
|
+
mode: PUBLIC,
|
|
39
|
+
maxAge: 1,
|
|
40
|
+
staleWhileRevalidate: 9,
|
|
41
|
+
...overrideOptions,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// 30 minutes
|
|
45
|
+
export function CacheMinutes(overrideOptions) {
|
|
46
|
+
guardExpirableModeType(overrideOptions);
|
|
47
|
+
return {
|
|
48
|
+
mode: PUBLIC,
|
|
49
|
+
maxAge: 900,
|
|
50
|
+
staleWhileRevalidate: 900,
|
|
51
|
+
...overrideOptions,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// 1 hour
|
|
55
|
+
export function CacheHours(overrideOptions) {
|
|
56
|
+
guardExpirableModeType(overrideOptions);
|
|
57
|
+
return {
|
|
58
|
+
mode: PUBLIC,
|
|
59
|
+
maxAge: 1800,
|
|
60
|
+
staleWhileRevalidate: 1800,
|
|
61
|
+
...overrideOptions,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// 1 day
|
|
65
|
+
export function CacheDays(overrideOptions) {
|
|
66
|
+
guardExpirableModeType(overrideOptions);
|
|
67
|
+
return {
|
|
68
|
+
mode: PUBLIC,
|
|
69
|
+
maxAge: 3600,
|
|
70
|
+
staleWhileRevalidate: 82800,
|
|
71
|
+
...overrideOptions,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// 2 weeks
|
|
75
|
+
export function CacheWeeks(overrideOptions) {
|
|
76
|
+
guardExpirableModeType(overrideOptions);
|
|
77
|
+
return {
|
|
78
|
+
mode: PUBLIC,
|
|
79
|
+
maxAge: 604800,
|
|
80
|
+
staleWhileRevalidate: 604800,
|
|
81
|
+
...overrideOptions,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// 1 month
|
|
85
|
+
export function CacheMonths(overrideOptions) {
|
|
86
|
+
guardExpirableModeType(overrideOptions);
|
|
87
|
+
return {
|
|
88
|
+
mode: PUBLIC,
|
|
89
|
+
maxAge: 1296000,
|
|
90
|
+
staleWhileRevalidate: 1296000,
|
|
91
|
+
...overrideOptions,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function CacheCustom(overrideOptions) {
|
|
95
|
+
return overrideOptions;
|
|
96
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { HelmetData as HeadData } from 'react-helmet-async';
|
|
3
|
+
declare type HtmlOptions = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
template: string;
|
|
6
|
+
htmlAttrs?: Record<string, string>;
|
|
7
|
+
bodyAttrs?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
export declare function Html({ children, template, htmlAttrs, bodyAttrs }: HtmlOptions): JSX.Element;
|
|
10
|
+
export declare function applyHtmlHead(html: string, head: HeadData, template: string): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const HTML_ATTR_SEP_RE = /(?<!=)"\s+/gim;
|
|
4
|
+
const getHtmlAttrs = (template) => { var _a; return ((_a = template.match(/<html\s+([^>]+?)\s*>/s)) === null || _a === void 0 ? void 0 : _a[1]) || ''; };
|
|
5
|
+
const getBodyAttrs = (template) => { var _a; return ((_a = template.match(/<body\s+([^>]+?)\s*>/s)) === null || _a === void 0 ? void 0 : _a[1]) || ''; };
|
|
6
|
+
const REACT_ATTR_MAP = Object.create(null);
|
|
7
|
+
REACT_ATTR_MAP.class = 'className';
|
|
8
|
+
REACT_ATTR_MAP.style = 'data-style'; // Ignore string styles, it breaks React
|
|
9
|
+
function attrsToProps(attrs) {
|
|
10
|
+
attrs = attrs === null || attrs === void 0 ? void 0 : attrs.trim();
|
|
11
|
+
// Assume all attributes are surrounded by double quotes.
|
|
12
|
+
return attrs
|
|
13
|
+
? Object.fromEntries(attrs.split(HTML_ATTR_SEP_RE).map((attr) => {
|
|
14
|
+
const [key, value] = attr.replace(/"/g, '').split(/=(.+)/);
|
|
15
|
+
return [REACT_ATTR_MAP[key.toLowerCase()] || key, value];
|
|
16
|
+
}))
|
|
17
|
+
: {};
|
|
18
|
+
}
|
|
19
|
+
function propsToAttrs(props) {
|
|
20
|
+
return Object.entries(props)
|
|
21
|
+
.map(([key, value]) => `${key === REACT_ATTR_MAP.class ? 'class' : key}="${value}"`)
|
|
22
|
+
.join(' ');
|
|
23
|
+
}
|
|
24
|
+
export function Html({ children, template, htmlAttrs, bodyAttrs }) {
|
|
25
|
+
let head = template.match(/<head>(.+?)<\/head>/s)[1] || '';
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
if (import.meta.env.DEV) {
|
|
28
|
+
// Fix React Refresh for async scripts.
|
|
29
|
+
// https://github.com/vitejs/vite/issues/6759
|
|
30
|
+
head =
|
|
31
|
+
'<script></script>' + // Fix for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1737882
|
|
32
|
+
head.replace(/>(\s*?import[\s\w]+?['"]\/@react-refresh)/, ' async="">$1');
|
|
33
|
+
}
|
|
34
|
+
return (React.createElement("html", { ...attrsToProps(getHtmlAttrs(template)), ...htmlAttrs },
|
|
35
|
+
React.createElement("head", { dangerouslySetInnerHTML: { __html: head } }),
|
|
36
|
+
React.createElement("body", { ...attrsToProps(getBodyAttrs(template)), ...bodyAttrs },
|
|
37
|
+
React.createElement("div", { id: "root" }, children))));
|
|
38
|
+
}
|
|
39
|
+
export function applyHtmlHead(html, head, template) {
|
|
40
|
+
const { bodyAttrs, htmlAttrs, ...headTags } = extractHeadElements(head, template);
|
|
41
|
+
return html
|
|
42
|
+
.replace(/<head>(.*?)<\/head>/s, generateHeadTag(headTags))
|
|
43
|
+
.replace(/<html[^>]*?>/s, htmlAttrs ? `<html ${htmlAttrs}>` : '$&')
|
|
44
|
+
.replace(/<body[^>]*?>/s, bodyAttrs ? `<body ${bodyAttrs}>` : '$&');
|
|
45
|
+
}
|
|
46
|
+
function extractHeadElements({ context: { helmet } }, template) {
|
|
47
|
+
// There might be existing attributes in the template that are
|
|
48
|
+
// duplicated in the helmet. Transform them to props and back
|
|
49
|
+
// to string attributes to remove duplicates.
|
|
50
|
+
const htmlUniqueProps = attrsToProps(`${getHtmlAttrs(template)} ${helmet.htmlAttributes}`);
|
|
51
|
+
const bodyUniqueProps = attrsToProps(`${getBodyAttrs(template)} ${helmet.bodyAttributes}`);
|
|
52
|
+
return {
|
|
53
|
+
htmlAttrs: propsToAttrs(htmlUniqueProps),
|
|
54
|
+
bodyAttrs: propsToAttrs(bodyUniqueProps),
|
|
55
|
+
base: helmet.base.toString(),
|
|
56
|
+
link: helmet.link.toString(),
|
|
57
|
+
meta: helmet.meta.toString(),
|
|
58
|
+
noscript: helmet.noscript.toString(),
|
|
59
|
+
script: helmet.script.toString(),
|
|
60
|
+
style: helmet.style.toString(),
|
|
61
|
+
title: helmet.title.toString(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Generate the contents of the `head` tag, and update the existing `<title>` tag
|
|
66
|
+
* if one exists, and if a title is passed.
|
|
67
|
+
*/
|
|
68
|
+
function generateHeadTag({ title, ...rest }) {
|
|
69
|
+
const headProps = ['base', 'meta', 'style', 'noscript', 'script', 'link'];
|
|
70
|
+
const otherHeadProps = headProps
|
|
71
|
+
.map((prop) => rest[prop])
|
|
72
|
+
.filter(Boolean)
|
|
73
|
+
.join('\n');
|
|
74
|
+
return (_outerHtml, innerHtml) => {
|
|
75
|
+
let headHtml = otherHeadProps + innerHtml;
|
|
76
|
+
if (title) {
|
|
77
|
+
if (headHtml.includes('<title>')) {
|
|
78
|
+
headHtml = headHtml.replace(/(<title>(?:.|\n)*?<\/title>)/, title);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
headHtml += title;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return `<head>${headHtml}</head>`;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ShopifyContextValue } from '../../foundation/ShopifyProvider/types';
|
|
2
|
+
import type { QueryCacheControlHeaders } from '../../utilities/log/log-cache-header';
|
|
3
|
+
import type { QueryTiming } from '../../utilities/log/log-query-timeline';
|
|
4
|
+
import type { HydrogenConfig, PreloadOptions, QueryKey } from '../../types';
|
|
5
|
+
import { HelmetData as HeadData } from 'react-helmet-async';
|
|
6
|
+
import { SessionSyncApi } from '../../foundation/session/session';
|
|
7
|
+
export declare type PreloadQueryEntry = {
|
|
8
|
+
key: QueryKey;
|
|
9
|
+
fetcher: () => Promise<unknown>;
|
|
10
|
+
preload?: PreloadOptions;
|
|
11
|
+
};
|
|
12
|
+
export declare type PreloadQueriesByURL = Map<string, PreloadQueryEntry>;
|
|
13
|
+
export declare type AllPreloadQueries = Map<string, PreloadQueriesByURL>;
|
|
14
|
+
export declare type RouterContextData = {
|
|
15
|
+
routeRendered: boolean;
|
|
16
|
+
serverProps: Record<string, any>;
|
|
17
|
+
routeParams: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* This augments the `Request` object from the Fetch API:
|
|
21
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
22
|
+
*
|
|
23
|
+
* - Adds a `cookies` map for easy access
|
|
24
|
+
* - Adds a static constructor to convert a Node.js `IncomingMessage` to a Request.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ServerComponentRequest extends Request {
|
|
27
|
+
cookies: Map<string, string>;
|
|
28
|
+
id: string;
|
|
29
|
+
time: number;
|
|
30
|
+
normalizedUrl: string;
|
|
31
|
+
ctx: {
|
|
32
|
+
cache: Map<string, any>;
|
|
33
|
+
head: HeadData;
|
|
34
|
+
hydrogenConfig?: HydrogenConfig;
|
|
35
|
+
shopifyConfig?: ShopifyContextValue;
|
|
36
|
+
queryCacheControl: Array<QueryCacheControlHeaders>;
|
|
37
|
+
queryTimings: Array<QueryTiming>;
|
|
38
|
+
preloadQueries: PreloadQueriesByURL;
|
|
39
|
+
analyticsData: any;
|
|
40
|
+
router: RouterContextData;
|
|
41
|
+
buyerIpHeader?: string;
|
|
42
|
+
session?: SessionSyncApi;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
constructor(input: any);
|
|
46
|
+
constructor(input: RequestInfo, init?: RequestInit);
|
|
47
|
+
private parseCookies;
|
|
48
|
+
isRscRequest(): boolean;
|
|
49
|
+
savePreloadQuery(query: PreloadQueryEntry): void;
|
|
50
|
+
getPreloadQueries(): PreloadQueriesByURL | undefined;
|
|
51
|
+
savePreloadQueries(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Buyer IP varies by hosting provider and runtime. The developer should provide this
|
|
54
|
+
* as an argument to the `handleRequest` function for their runtime.
|
|
55
|
+
* Defaults to `x-forwarded-for` header value.
|
|
56
|
+
*/
|
|
57
|
+
getBuyerIp(): string | null;
|
|
58
|
+
}
|