@shopify/hydrogen 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +7 -7
- 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 +1 -1
- package/dist/esnext/components/Image/Image.js +1 -1
- 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/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 +66 -48
- package/dist/esnext/experimental.d.ts +1 -0
- package/dist/esnext/experimental.js +1 -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 +3 -3
- 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 -3
- 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/Interface.client.js +1 -1
- package/dist/esnext/foundation/DevTools/components/Panels.d.ts +2 -2
- package/dist/esnext/foundation/DevTools/components/Panels.js +3 -3
- package/dist/esnext/foundation/DevTools/components/Performance.client.js +1 -1
- package/dist/esnext/foundation/DevTools/components/Settings.client.d.ts +2 -1
- package/dist/esnext/foundation/DevTools/components/Settings.client.js +1 -1
- 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 +5 -5
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +4 -4
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +2 -2
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +2 -2
- 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 +3 -1
- 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.js +2 -2
- package/dist/esnext/foundation/fetchSync/client/fetchSync.d.ts +1 -1
- package/dist/esnext/foundation/fetchSync/client/fetchSync.js +2 -2
- package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +2 -2
- package/dist/esnext/foundation/fetchSync/server/fetchSync.js +3 -3
- 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 +13 -0
- package/dist/esnext/foundation/session/session-types.js +1 -0
- package/dist/esnext/foundation/session/session.d.ts +4 -16
- package/dist/esnext/foundation/session/session.js +1 -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 +1 -1
- package/dist/esnext/foundation/useQuery/hooks.js +4 -4
- 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.js +1 -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/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 +14 -13
- 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 +113 -0
- 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 +11 -1
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
- package/dist/esnext/framework/types.d.ts +13 -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 +16 -11
- 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 -1
- package/dist/esnext/platforms/index.js +1 -1
- package/dist/esnext/platforms/node.d.ts +1 -1
- package/dist/esnext/platforms/node.js +4 -4
- package/dist/esnext/platforms/virtual.d.ts +1 -1
- package/dist/esnext/platforms/virtual.js +0 -2
- package/dist/esnext/platforms/worker-event.js +1 -1
- package/dist/esnext/platforms/worker.js +1 -1
- 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 +41 -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/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 +13 -0
- package/dist/node/foundation/session/session-types.js +2 -0
- 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 +25 -24
- 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 +119 -0
- 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 +12 -2
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +2 -2
- package/dist/node/framework/types.d.ts +13 -0
- package/dist/node/shared-types.d.ts +3 -0
- package/package.json +14 -3
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +7 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +7 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HydrogenRequest } from '../../foundation/HydrogenRequest/HydrogenRequest.server';
|
|
2
|
-
import { HydrogenResponse } from '../../foundation/HydrogenResponse/HydrogenResponse.server';
|
|
3
|
-
import { QueryKey } from '../../types';
|
|
4
|
-
import type
|
|
1
|
+
import { HydrogenRequest } from '../../foundation/HydrogenRequest/HydrogenRequest.server.js';
|
|
2
|
+
import { HydrogenResponse } from '../../foundation/HydrogenResponse/HydrogenResponse.server.js';
|
|
3
|
+
import { QueryKey } from '../../types.js';
|
|
4
|
+
import { type RenderType } from './log.js';
|
|
5
5
|
export declare type QueryCacheControlHeaders = {
|
|
6
6
|
name: string;
|
|
7
7
|
header: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { hashKey } from '../hash';
|
|
2
|
-
import { findQueryName, parseUrl } from './utils';
|
|
1
|
+
import { hashKey } from '../hash.js';
|
|
2
|
+
import { findQueryName, parseUrl } from './utils.js';
|
|
3
3
|
import { gray } from 'kolorist';
|
|
4
|
-
import { getLoggerWithContext } from './log';
|
|
4
|
+
import { getLoggerWithContext } from './log.js';
|
|
5
5
|
const color = gray;
|
|
6
6
|
export function collectQueryCacheControlHeaders(request, queryKey, cacheControlHeader) {
|
|
7
7
|
request.ctx.queryCacheControl.push({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HydrogenRequest } from '../../foundation/HydrogenRequest/HydrogenRequest.server';
|
|
2
|
-
import { QueryKey } from '../../types';
|
|
3
|
-
import type
|
|
1
|
+
import { HydrogenRequest } from '../../foundation/HydrogenRequest/HydrogenRequest.server.js';
|
|
2
|
+
import { QueryKey } from '../../types.js';
|
|
3
|
+
import { type RenderType } from './log.js';
|
|
4
4
|
export declare type TimingType = 'requested' | 'resolved' | 'rendered' | 'preload';
|
|
5
5
|
export declare type QueryTiming = {
|
|
6
6
|
name: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { hashKey } from '../hash';
|
|
2
|
-
import { findQueryName, parseUrl } from './utils';
|
|
1
|
+
import { hashKey } from '../hash.js';
|
|
2
|
+
import { findQueryName, parseUrl } from './utils.js';
|
|
3
3
|
import { gray, red, yellow, green } from 'kolorist';
|
|
4
|
-
import { getLoggerWithContext } from './log';
|
|
5
|
-
import { getTime } from '../timing';
|
|
4
|
+
import { getLoggerWithContext } from './log.js';
|
|
5
|
+
import { getTime } from '../timing.js';
|
|
6
6
|
const color = gray;
|
|
7
7
|
const TIMING_MAPPING = {
|
|
8
8
|
requested: 'Requested',
|
|
@@ -11,12 +11,15 @@ const TIMING_MAPPING = {
|
|
|
11
11
|
preload: 'Preload',
|
|
12
12
|
};
|
|
13
13
|
export function collectQueryTimings(request, queryKey, timingType, duration) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const hashedKey = hashKey(queryKey);
|
|
15
|
+
if (hashedKey !== 'hydrogen-shopify-config') {
|
|
16
|
+
request.ctx.queryTimings.push({
|
|
17
|
+
name: findQueryName(hashedKey),
|
|
18
|
+
timingType,
|
|
19
|
+
timestamp: getTime(),
|
|
20
|
+
duration,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
export function logQueryTimings(type, request) {
|
|
22
25
|
const log = getLoggerWithContext(request);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HydrogenRequest } from '../../foundation/HydrogenRequest/HydrogenRequest.server';
|
|
1
|
+
import { HydrogenRequest } from '../../foundation/HydrogenRequest/HydrogenRequest.server.js';
|
|
2
2
|
/** The `log` utility is a function that's used for logging debugging, warning, and error information about the application.
|
|
3
3
|
* Use this utility by importing `log` from `@shopify/hydrogen`, or by using a `log` prop passed to each page
|
|
4
4
|
* component. We recommend using the `log` prop passed to each page because it will associated your log to the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { yellow, red, green, italic, lightBlue } from 'kolorist';
|
|
2
|
-
import { getTime } from '../timing';
|
|
3
|
-
import { parseUrl } from './utils';
|
|
2
|
+
import { getTime } from '../timing.js';
|
|
3
|
+
import { parseUrl } from './utils.js';
|
|
4
4
|
const defaultLogger = {
|
|
5
5
|
trace(context, ...args) {
|
|
6
6
|
// Re-enable following line to show trace debugging information
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Measurement } from '../types';
|
|
1
|
+
import { Measurement } from '../types.js';
|
|
2
2
|
export declare function getMeasurementAsString(measurement: Measurement, locale?: string, options?: Intl.NumberFormatOptions): string;
|
|
3
3
|
export declare function getMeasurementAsParts(measurement: Measurement, locale?: string, options?: Intl.NumberFormatOptions): Intl.NumberFormatPart[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { parseMetafield, parseMetafieldValue } from './parseMetafield';
|
|
1
|
+
export { parseMetafield, parseMetafieldValue } from './parseMetafield.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { parseMetafield, parseMetafieldValue } from './parseMetafield';
|
|
1
|
+
export { parseMetafield, parseMetafieldValue } from './parseMetafield.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Metafield } from '../../storefront-api-types';
|
|
2
|
-
import type { ParsedMetafield } from '../../types';
|
|
1
|
+
import type { Metafield } from '../../storefront-api-types.js';
|
|
2
|
+
import type { ParsedMetafield } from '../../types.js';
|
|
3
3
|
import type { PartialDeep } from 'type-fest';
|
|
4
4
|
/**
|
|
5
5
|
* The `parseMetafield` utility transforms a [Metafield](https://shopify.dev/api/storefront/reference/common-objects/Metafield)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseJSON } from '../parse';
|
|
1
|
+
import { parseJSON } from '../parse.js';
|
|
2
2
|
/**
|
|
3
3
|
* The `parseMetafield` utility transforms a [Metafield](https://shopify.dev/api/storefront/reference/common-objects/Metafield)
|
|
4
4
|
* into a new object whose `values` have been parsed according to the metafield `type`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* global Oxygen */
|
|
2
|
-
import { OXYGEN_SECRET_TOKEN_ENVIRONMENT_VARIABLE, STOREFRONT_API_SECRET_TOKEN_HEADER, STOREFRONT_API_PUBLIC_TOKEN_HEADER, STOREFRONT_API_BUYER_IP_HEADER, SHOPIFY_STOREFRONT_ID_VARIABLE, SHOPIFY_STOREFRONT_ID_HEADER, } from '../constants';
|
|
2
|
+
import { OXYGEN_SECRET_TOKEN_ENVIRONMENT_VARIABLE, STOREFRONT_API_SECRET_TOKEN_HEADER, STOREFRONT_API_PUBLIC_TOKEN_HEADER, STOREFRONT_API_BUYER_IP_HEADER, SHOPIFY_STOREFRONT_ID_VARIABLE, SHOPIFY_STOREFRONT_ID_HEADER, } from '../constants.js';
|
|
3
3
|
export function getStorefrontApiRequestHeaders({ buyerIp, storefrontToken, }) {
|
|
4
4
|
const headers = {};
|
|
5
5
|
const secretToken = getOxygenVariable(OXYGEN_SECRET_TOKEN_ENVIRONMENT_VARIABLE);
|
package/dist/esnext/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.
|
|
1
|
+
export declare const LIB_VERSION = "1.2.0";
|
package/dist/esnext/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = '1.
|
|
1
|
+
export const LIB_VERSION = '1.2.0';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare type SessionSyncApi = {
|
|
2
|
+
get: () => Record<string, string>;
|
|
3
|
+
};
|
|
4
|
+
export declare type SessionApi = {
|
|
5
|
+
get: () => Promise<Record<string, string>>;
|
|
6
|
+
set: (key: string, value: string) => Promise<void>;
|
|
7
|
+
destroy: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare type SessionStorageAdapter = {
|
|
10
|
+
get: (request: Request) => Promise<Record<string, string>>;
|
|
11
|
+
set: (request: Request, value: Record<string, string>) => Promise<string>;
|
|
12
|
+
destroy: (request: Request) => Promise<string>;
|
|
13
|
+
};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Provide Hydrogen config loader to external tools like the CLI
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.loadConfig = void 0;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const vite_plugin_hydrogen_virtual_files_js_1 = require("./plugins/vite-plugin-hydrogen-virtual-files.js");
|
|
6
|
+
const viteception_js_1 = require("./viteception.js");
|
|
7
7
|
async function loadConfig(options = { root: process.cwd() }) {
|
|
8
|
-
const { loaded } = await (0,
|
|
8
|
+
const { loaded } = await (0, viteception_js_1.viteception)([vite_plugin_hydrogen_virtual_files_js_1.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID], options);
|
|
9
9
|
return { configuration: loaded[0].default };
|
|
10
10
|
}
|
|
11
11
|
exports.loadConfig = loadConfig;
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.hydrogenMiddleware = exports.graphiqlMiddleware = void 0;
|
|
27
|
-
const
|
|
27
|
+
const graphiql_js_1 = require("./graphiql.js");
|
|
28
28
|
function graphiqlMiddleware({ getShopifyConfig, dev, }) {
|
|
29
29
|
return async function (request, response, next) {
|
|
30
30
|
if (dev && isGraphiqlRequest(request)) {
|
|
@@ -51,7 +51,7 @@ function hydrogenMiddleware({ dev, cache, indexTemplate, getServerEntrypoint, de
|
|
|
51
51
|
* which is needed for proxy requests and server-side API requests.
|
|
52
52
|
*/
|
|
53
53
|
const webPolyfills = !globalThis.fetch || !globalThis.ReadableStream
|
|
54
|
-
? Promise.resolve().then(() => __importStar(require('../utilities/web-api-polyfill'))) : undefined;
|
|
54
|
+
? Promise.resolve().then(() => __importStar(require('../utilities/web-api-polyfill.js'))) : undefined;
|
|
55
55
|
return async function (request, response, next) {
|
|
56
56
|
try {
|
|
57
57
|
await webPolyfills;
|
|
@@ -120,5 +120,5 @@ async function respondWithGraphiql(response, shopifyConfig) {
|
|
|
120
120
|
}
|
|
121
121
|
const { storeDomain, storefrontToken, storefrontApiVersion } = shopifyConfig;
|
|
122
122
|
response.setHeader('Content-Type', 'text/html');
|
|
123
|
-
response.end((0,
|
|
123
|
+
response.end((0, graphiql_js_1.graphiqlHtml)(storeDomain?.replace(/^https?:\/\//, ''), storefrontToken, storefrontApiVersion));
|
|
124
124
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HydrogenVitePluginOptions } from './types';
|
|
1
|
+
import type { HydrogenVitePluginOptions } from './types.js';
|
|
2
2
|
import type { Plugin } from 'vite';
|
|
3
3
|
declare const hydrogenPlugin: (pluginOptions?: HydrogenVitePluginOptions) => Plugin[];
|
|
4
4
|
export = hydrogenPlugin;
|
|
@@ -2,36 +2,37 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
5
|
+
const vite_plugin_hydrogen_config_js_1 = __importDefault(require("./plugins/vite-plugin-hydrogen-config.js"));
|
|
6
|
+
const vite_plugin_hydrogen_middleware_js_1 = __importDefault(require("./plugins/vite-plugin-hydrogen-middleware.js"));
|
|
7
|
+
const vite_plugin_hydrogen_client_middleware_js_1 = __importDefault(require("./plugins/vite-plugin-hydrogen-client-middleware.js"));
|
|
8
|
+
const vite_plugin_hydrogen_virtual_files_js_1 = __importDefault(require("./plugins/vite-plugin-hydrogen-virtual-files.js"));
|
|
9
|
+
const vite_plugin_platform_entry_js_1 = __importDefault(require("./plugins/vite-plugin-platform-entry.js"));
|
|
10
|
+
const vite_plugin_hydrogen_rsc_js_1 = __importDefault(require("./plugins/vite-plugin-hydrogen-rsc.js"));
|
|
11
|
+
const vite_plugin_ssr_interop_js_1 = __importDefault(require("./plugins/vite-plugin-ssr-interop.js"));
|
|
12
|
+
const vite_plugin_purge_query_cache_js_1 = __importDefault(require("./plugins/vite-plugin-purge-query-cache.js"));
|
|
13
|
+
const vite_plugin_hydration_auto_import_js_1 = __importDefault(require("./plugins/vite-plugin-hydration-auto-import.js"));
|
|
14
14
|
const vite_plugin_inspect_1 = __importDefault(require("vite-plugin-inspect"));
|
|
15
15
|
const plugin_react_1 = __importDefault(require("@vitejs/plugin-react"));
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
16
|
+
const vite_plugin_css_rsc_js_1 = __importDefault(require("./plugins/vite-plugin-css-rsc.js"));
|
|
17
|
+
const vite_plugin_css_modules_rsc_js_1 = __importDefault(require("./plugins/vite-plugin-css-modules-rsc.js"));
|
|
18
|
+
const vite_plugin_client_imports_js_1 = __importDefault(require("./plugins/vite-plugin-client-imports.js"));
|
|
19
|
+
const vite_plugin_hydrogen_suppress_warnings_js_1 = __importDefault(require("./plugins/vite-plugin-hydrogen-suppress-warnings.js"));
|
|
19
20
|
const hydrogenPlugin = (pluginOptions = {}) => {
|
|
20
21
|
return [
|
|
21
22
|
process.env.VITE_INSPECT && (0, vite_plugin_inspect_1.default)(),
|
|
22
|
-
(0,
|
|
23
|
-
(0,
|
|
24
|
-
(0,
|
|
25
|
-
(0,
|
|
26
|
-
(0,
|
|
23
|
+
(0, vite_plugin_hydrogen_config_js_1.default)(),
|
|
24
|
+
(0, vite_plugin_hydrogen_client_middleware_js_1.default)(),
|
|
25
|
+
(0, vite_plugin_client_imports_js_1.default)(),
|
|
26
|
+
(0, vite_plugin_hydrogen_middleware_js_1.default)(pluginOptions),
|
|
27
|
+
(0, vite_plugin_hydrogen_virtual_files_js_1.default)(pluginOptions),
|
|
27
28
|
(0, plugin_react_1.default)(),
|
|
28
|
-
(0,
|
|
29
|
-
(0,
|
|
30
|
-
(0,
|
|
31
|
-
(0,
|
|
32
|
-
(0,
|
|
33
|
-
(0,
|
|
34
|
-
pluginOptions.purgeQueryCacheOnBuild && (0,
|
|
29
|
+
(0, vite_plugin_hydration_auto_import_js_1.default)(),
|
|
30
|
+
(0, vite_plugin_ssr_interop_js_1.default)(),
|
|
31
|
+
pluginOptions.experimental?.css === 'global' ? (0, vite_plugin_css_rsc_js_1.default)() : (0, vite_plugin_css_modules_rsc_js_1.default)(),
|
|
32
|
+
(0, vite_plugin_hydrogen_rsc_js_1.default)(pluginOptions),
|
|
33
|
+
(0, vite_plugin_platform_entry_js_1.default)(),
|
|
34
|
+
(0, vite_plugin_hydrogen_suppress_warnings_js_1.default)(),
|
|
35
|
+
pluginOptions.purgeQueryCacheOnBuild && (0, vite_plugin_purge_query_cache_js_1.default)(),
|
|
35
36
|
];
|
|
36
37
|
};
|
|
37
38
|
exports.default = hydrogenPlugin; // For ESM
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const vite_plugin_hydrogen_middleware_js_1 = require("./vite-plugin-hydrogen-middleware.js");
|
|
7
7
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const cssModuleRE = /\.module\.(s?css|sass|less|stylus)/;
|
|
@@ -60,9 +60,9 @@ function autoStyleTagPlugin() {
|
|
|
60
60
|
transform(code, id) {
|
|
61
61
|
id = id.split('?')[0];
|
|
62
62
|
if (/\.[jt]sx$/.test(id) &&
|
|
63
|
-
!id.endsWith(
|
|
63
|
+
!id.endsWith(vite_plugin_hydrogen_middleware_js_1.HYDROGEN_DEFAULT_SERVER_ENTRY) &&
|
|
64
64
|
!id.endsWith(path_1.default.format({
|
|
65
|
-
name:
|
|
65
|
+
name: vite_plugin_hydrogen_middleware_js_1.HYDROGEN_DEFAULT_SERVER_ENTRY,
|
|
66
66
|
ext: path_1.default.extname(id),
|
|
67
67
|
})) &&
|
|
68
68
|
cssModuleRE.test(code) &&
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const magic_string_1 = __importDefault(require("magic-string"));
|
|
8
|
+
const vite_1 = require("vite");
|
|
9
|
+
const VITE_CSS_CHUNK_NAME = 'style.css';
|
|
10
|
+
const INJECT_STYLES_COMMENT = '<!--__INJECT_STYLES__-->';
|
|
11
|
+
// Keep this in the outer scope to share it
|
|
12
|
+
// across client <> server builds.
|
|
13
|
+
let clientBuildPath;
|
|
14
|
+
function cssRsc() {
|
|
15
|
+
let config;
|
|
16
|
+
return {
|
|
17
|
+
name: 'hydrogen:css-rsc',
|
|
18
|
+
enforce: 'post',
|
|
19
|
+
config() {
|
|
20
|
+
// Disable CSS code split to avoid preloading styles
|
|
21
|
+
// that are already included in index.html
|
|
22
|
+
return { build: { cssCodeSplit: false } };
|
|
23
|
+
},
|
|
24
|
+
configResolved(_config) {
|
|
25
|
+
config = _config;
|
|
26
|
+
},
|
|
27
|
+
transform(code, id, options) {
|
|
28
|
+
if (options?.ssr && id.includes('index.html?raw')) {
|
|
29
|
+
// Mark the client build index.html to inject styles later
|
|
30
|
+
const s = new magic_string_1.default(code);
|
|
31
|
+
s.replace('</head>', INJECT_STYLES_COMMENT + '</head>');
|
|
32
|
+
return {
|
|
33
|
+
code: s.toString(),
|
|
34
|
+
map: s.generateMap({ file: id, source: id }),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
transformIndexHtml(html, { server }) {
|
|
39
|
+
// Add discovered styles during dev
|
|
40
|
+
if (server) {
|
|
41
|
+
const tags = [];
|
|
42
|
+
const foundCssFiles = new Set();
|
|
43
|
+
const { browserHash = '' } = server._optimizedDeps?.metadata || {};
|
|
44
|
+
for (const [key, value] of server.moduleGraph.idToModuleMap.entries()) {
|
|
45
|
+
if (
|
|
46
|
+
// Note: Some CSS-in-JS libraries use `.css.js`
|
|
47
|
+
// extension and we should match it here:
|
|
48
|
+
/\.(css|sass|scss|stylus|less)(\.|\?|$)/.test((0, vite_1.normalizePath)(key).split('/').pop())) {
|
|
49
|
+
let { url, file, lastHMRTimestamp, importers } = value;
|
|
50
|
+
if (!foundCssFiles.has(file) &&
|
|
51
|
+
!Array.from(importers).some((importer) => foundCssFiles.has(importer.file))) {
|
|
52
|
+
foundCssFiles.add(file);
|
|
53
|
+
// Vite is adding hash and timestamp to the CSS files downloaded
|
|
54
|
+
// from client components. Adding the same query string params
|
|
55
|
+
// here prevents this file from being downloaded twice.
|
|
56
|
+
if (lastHMRTimestamp) {
|
|
57
|
+
const timestampQuery = `?t=${lastHMRTimestamp}`;
|
|
58
|
+
// The timestamp needs to be the first query string param.
|
|
59
|
+
url = url.includes('?')
|
|
60
|
+
? url.replace('?', timestampQuery + '&')
|
|
61
|
+
: url + timestampQuery;
|
|
62
|
+
}
|
|
63
|
+
if (browserHash && !url.includes('v=')) {
|
|
64
|
+
// Append the hash at the end
|
|
65
|
+
url += (url.includes('?') ? '&' : '?') + `v=${browserHash}`;
|
|
66
|
+
}
|
|
67
|
+
tags.push(value.type === 'css'
|
|
68
|
+
? { tag: 'link', attrs: { rel: 'stylesheet', href: url } }
|
|
69
|
+
: { tag: 'script', attrs: { type: 'module', src: url } });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return tags;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
generateBundle(options, bundle, isWrite) {
|
|
77
|
+
if (config.build?.ssr) {
|
|
78
|
+
// -- Server build
|
|
79
|
+
if (!clientBuildPath) {
|
|
80
|
+
// Default value
|
|
81
|
+
clientBuildPath = (0, vite_1.normalizePath)(path_1.default.resolve(config.root, config.build.outDir, '..', 'client'));
|
|
82
|
+
}
|
|
83
|
+
const relativeClientPath = (0, vite_1.normalizePath)(path_1.default.relative((0, vite_1.normalizePath)(path_1.default.resolve(config.root, config.build.outDir)), clientBuildPath));
|
|
84
|
+
let cssAssetFileName = '';
|
|
85
|
+
const cssAsset = Object.values(bundle).find((file) => file.type === 'asset' && file.name === VITE_CSS_CHUNK_NAME);
|
|
86
|
+
const outputChunk = Object.values(bundle).find((file) => file.type === 'chunk' && file.isEntry);
|
|
87
|
+
if (cssAsset) {
|
|
88
|
+
cssAssetFileName = cssAsset.fileName;
|
|
89
|
+
// Move the CSS file to the client build assets
|
|
90
|
+
cssAsset.fileName = (0, vite_1.normalizePath)(path_1.default.join(relativeClientPath, cssAsset.fileName));
|
|
91
|
+
}
|
|
92
|
+
let assetPrefix = process.env.HYDROGEN_ASSET_BASE_URL || '/';
|
|
93
|
+
if (!assetPrefix.endsWith('/'))
|
|
94
|
+
assetPrefix += '/';
|
|
95
|
+
// Add a reference to the CSS file in indexTemplate
|
|
96
|
+
outputChunk.code = outputChunk.code.replace(INJECT_STYLES_COMMENT, cssAssetFileName &&
|
|
97
|
+
`<link rel="stylesheet" href="${assetPrefix + cssAssetFileName}">`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// -- Client build
|
|
101
|
+
// Save outDir from client build in the outer scope
|
|
102
|
+
// to read it during the server build. The CLI runs Vite in
|
|
103
|
+
// the same process so the scope is shared across builds.
|
|
104
|
+
clientBuildPath = (0, vite_1.normalizePath)(path_1.default.resolve(config.root, config.build.outDir));
|
|
105
|
+
const indexHtml = bundle['index.html'];
|
|
106
|
+
const cssAsset = Object.values(bundle).find((file) => file.type === 'asset' && file.name === VITE_CSS_CHUNK_NAME);
|
|
107
|
+
if (cssAsset) {
|
|
108
|
+
// The client build CSS is incomplete because it only includes
|
|
109
|
+
// CSS imported in client components (server components are not
|
|
110
|
+
// discovered in this build). Remove it from this build and
|
|
111
|
+
// let it be added by the server build after this.
|
|
112
|
+
delete bundle[cssAsset.fileName];
|
|
113
|
+
indexHtml.source = indexHtml.source.replace(new RegExp(`\\s*<link[^<>]+${cssAsset.fileName.replace('.', '\\.')}.*?>`, ''), '');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
exports.default = cssRsc;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import type { HydrogenVitePluginOptions } from '../types';
|
|
2
|
+
import type { HydrogenVitePluginOptions } from '../types.js';
|
|
3
3
|
export declare const HYDROGEN_DEFAULT_SERVER_ENTRY: string;
|
|
4
4
|
declare const _default: (pluginOptions: HydrogenVitePluginOptions) => Plugin;
|
|
5
5
|
export default _default;
|
|
@@ -8,9 +8,9 @@ const vite_1 = require("vite");
|
|
|
8
8
|
const body_parser_1 = __importDefault(require("body-parser"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const fs_1 = require("fs");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const middleware_js_1 = require("../middleware.js");
|
|
12
|
+
const in_memory_js_1 = require("../cache/in-memory.js");
|
|
13
|
+
const vite_plugin_hydrogen_virtual_files_js_1 = require("./vite-plugin-hydrogen-virtual-files.js");
|
|
14
14
|
exports.HYDROGEN_DEFAULT_SERVER_ENTRY = process.env.HYDROGEN_SERVER_ENTRY || '/src/App.server';
|
|
15
15
|
exports.default = (pluginOptions) => {
|
|
16
16
|
return {
|
|
@@ -30,10 +30,10 @@ exports.default = (pluginOptions) => {
|
|
|
30
30
|
await polyfillOxygenEnv(server.config);
|
|
31
31
|
// The default vite middleware rewrites the URL `/graphqil` to `/index.html`
|
|
32
32
|
// By running this middleware first, we avoid that.
|
|
33
|
-
server.middlewares.use((0,
|
|
33
|
+
server.middlewares.use((0, middleware_js_1.graphiqlMiddleware)({
|
|
34
34
|
dev: true,
|
|
35
35
|
getShopifyConfig: async (incomingMessage) => {
|
|
36
|
-
const { default: hydrogenConfig } = await server.ssrLoadModule(
|
|
36
|
+
const { default: hydrogenConfig } = await server.ssrLoadModule(vite_plugin_hydrogen_virtual_files_js_1.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID);
|
|
37
37
|
// @ts-ignore
|
|
38
38
|
const { address = 'localhost', port = '3000' } = server.httpServer?.address() || {};
|
|
39
39
|
const url = new URL(`http://${address}:${port}${incomingMessage.url}`);
|
|
@@ -48,13 +48,13 @@ exports.default = (pluginOptions) => {
|
|
|
48
48
|
},
|
|
49
49
|
}));
|
|
50
50
|
server.middlewares.use(body_parser_1.default.raw({ type: '*/*' }));
|
|
51
|
-
return () => server.middlewares.use((0,
|
|
51
|
+
return () => server.middlewares.use((0, middleware_js_1.hydrogenMiddleware)({
|
|
52
52
|
dev: true,
|
|
53
53
|
indexTemplate: getIndexTemplate,
|
|
54
54
|
getServerEntrypoint: () => server.ssrLoadModule(exports.HYDROGEN_DEFAULT_SERVER_ENTRY),
|
|
55
55
|
devServer: server,
|
|
56
56
|
cache: pluginOptions?.devCache
|
|
57
|
-
? new
|
|
57
|
+
? new in_memory_js_1.InMemoryCache()
|
|
58
58
|
: undefined,
|
|
59
59
|
}));
|
|
60
60
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HydrogenVitePluginOptions } from '../types';
|
|
1
|
+
import { HydrogenVitePluginOptions } from '../types.js';
|
|
2
2
|
export default function (options?: HydrogenVitePluginOptions): any;
|
|
@@ -5,19 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
const plugin_js_1 = __importDefault(require("@shopify/hydrogen/vendor/react-server-dom-vite/plugin.js"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const vite_plugin_hydrogen_middleware_js_1 = require("./vite-plugin-hydrogen-middleware.js");
|
|
9
|
+
const vite_plugin_hydrogen_virtual_files_js_1 = require("./vite-plugin-hydrogen-virtual-files.js");
|
|
10
10
|
function default_1(options) {
|
|
11
11
|
return (0, plugin_js_1.default)({
|
|
12
12
|
serverBuildEntries: [
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
vite_plugin_hydrogen_middleware_js_1.HYDROGEN_DEFAULT_SERVER_ENTRY,
|
|
14
|
+
vite_plugin_hydrogen_virtual_files_js_1.VIRTUAL_PROXY_HYDROGEN_ROUTES_ID,
|
|
15
15
|
],
|
|
16
16
|
isServerComponentImporterAllowed(importer, source) {
|
|
17
17
|
return (
|
|
18
18
|
// Always allow the entry server (e.g. App.server.jsx) to be imported
|
|
19
19
|
// in other files such as worker.js or server.js.
|
|
20
|
-
source.includes(
|
|
20
|
+
source.includes(vite_plugin_hydrogen_middleware_js_1.HYDROGEN_DEFAULT_SERVER_ENTRY) ||
|
|
21
21
|
/(index|entry-server|hydrogen\.config)\.[jt]s/.test(importer) ||
|
|
22
22
|
// Support importing server components for testing
|
|
23
23
|
// TODO: revisit this when RSC splits into two bundles
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import type { HydrogenVitePluginOptions } from '../types';
|
|
2
|
+
import type { HydrogenVitePluginOptions } from '../types.js';
|
|
3
3
|
export declare const HYDROGEN_DEFAULT_SERVER_ENTRY: string;
|
|
4
4
|
export declare const VIRTUAL_PROXY_HYDROGEN_CONFIG_ID: string;
|
|
5
5
|
export declare const VIRTUAL_PROXY_HYDROGEN_ROUTES_ID: string;
|
|
@@ -7,11 +7,13 @@ exports.VIRTUAL_PROXY_HYDROGEN_ROUTES_ID = exports.VIRTUAL_PROXY_HYDROGEN_CONFIG
|
|
|
7
7
|
const vite_1 = require("vite");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
|
-
const
|
|
10
|
+
const viteception_js_1 = require("../viteception.js");
|
|
11
11
|
exports.HYDROGEN_DEFAULT_SERVER_ENTRY = process.env.HYDROGEN_SERVER_ENTRY || '/src/App.server';
|
|
12
12
|
// The character ":" breaks Vite with Node >= 16.15. Use "_" instead
|
|
13
13
|
const VIRTUAL_PREFIX = 'virtual__';
|
|
14
14
|
const PROXY_PREFIX = 'proxy__';
|
|
15
|
+
const ERROR_FILE = 'error.jsx';
|
|
16
|
+
const VIRTUAL_ERROR_FILE = VIRTUAL_PREFIX + ERROR_FILE;
|
|
15
17
|
const HYDROGEN_CONFIG_ID = 'hydrogen.config.ts';
|
|
16
18
|
const VIRTUAL_HYDROGEN_CONFIG_ID = VIRTUAL_PREFIX + HYDROGEN_CONFIG_ID;
|
|
17
19
|
exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID = VIRTUAL_PREFIX + PROXY_PREFIX + HYDROGEN_CONFIG_ID;
|
|
@@ -40,6 +42,7 @@ exports.default = (pluginOptions) => {
|
|
|
40
42
|
exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID,
|
|
41
43
|
exports.VIRTUAL_PROXY_HYDROGEN_ROUTES_ID,
|
|
42
44
|
VIRTUAL_HYDROGEN_ROUTES_ID,
|
|
45
|
+
VIRTUAL_ERROR_FILE,
|
|
43
46
|
].includes(source)) {
|
|
44
47
|
// Virtual modules convention
|
|
45
48
|
// https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention
|
|
@@ -77,6 +80,13 @@ exports.default = (pluginOptions) => {
|
|
|
77
80
|
return { code };
|
|
78
81
|
});
|
|
79
82
|
}
|
|
83
|
+
if (id === '\0' + VIRTUAL_ERROR_FILE) {
|
|
84
|
+
return importHydrogenConfig().then((hc) => {
|
|
85
|
+
const errorPath = hc.serverErrorPage ?? '/src/Error.{jsx,tsx}';
|
|
86
|
+
const code = `const errorPage = import.meta.glob("${errorPath}");\n export default Object.values(errorPage)[0];`;
|
|
87
|
+
return { code };
|
|
88
|
+
});
|
|
89
|
+
}
|
|
80
90
|
},
|
|
81
91
|
};
|
|
82
92
|
async function importHydrogenConfig() {
|
|
@@ -84,7 +94,7 @@ exports.default = (pluginOptions) => {
|
|
|
84
94
|
const loaded = await server.ssrLoadModule(exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID);
|
|
85
95
|
return loaded.default;
|
|
86
96
|
}
|
|
87
|
-
const { loaded } = await (0,
|
|
97
|
+
const { loaded } = await (0, viteception_js_1.viteception)([exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID]);
|
|
88
98
|
return loaded[0].default;
|
|
89
99
|
}
|
|
90
100
|
};
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const vite_1 = require("vite");
|
|
7
|
-
const
|
|
7
|
+
const vite_plugin_hydrogen_middleware_js_1 = require("./vite-plugin-hydrogen-middleware.js");
|
|
8
8
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -43,7 +43,7 @@ exports.default = () => {
|
|
|
43
43
|
options?.ssr &&
|
|
44
44
|
/@shopify\/hydrogen\/.+platforms\/virtual\./.test((0, vite_1.normalizePath)(id))) {
|
|
45
45
|
const ms = new magic_string_1.default(code);
|
|
46
|
-
ms.replace('__HYDROGEN_ENTRY__',
|
|
46
|
+
ms.replace('__HYDROGEN_ENTRY__', vite_plugin_hydrogen_middleware_js_1.HYDROGEN_DEFAULT_SERVER_ENTRY);
|
|
47
47
|
if (!clientBuildPath) {
|
|
48
48
|
// Default value
|
|
49
49
|
clientBuildPath = (0, vite_1.normalizePath)(path_1.default.resolve(config.root, config.build.outDir, '..', 'client'));
|
|
@@ -3,4 +3,17 @@ export interface HydrogenVitePluginOptions {
|
|
|
3
3
|
purgeQueryCacheOnBuild?: boolean;
|
|
4
4
|
configPath?: string;
|
|
5
5
|
optimizeBoundaries?: boolean | 'build';
|
|
6
|
+
/**
|
|
7
|
+
* Experimental features
|
|
8
|
+
*/
|
|
9
|
+
experimental?: {
|
|
10
|
+
/**
|
|
11
|
+
* CSS compatibility with React Server Components.
|
|
12
|
+
* - `global` inlines all the styles in the DOM and works for all types of CSS.
|
|
13
|
+
* - `modules-only` inlines the styles in RSC responses and only works for CSS Modules.
|
|
14
|
+
* @defaultValue `modules-only`
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
css: 'global' | 'modules-only';
|
|
18
|
+
};
|
|
6
19
|
}
|