@shopify/hydrogen 0.22.0 → 0.24.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/CHANGELOG.md +240 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +5 -5
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +5 -8
- package/dist/esnext/components/CartLineProvider/context.d.ts +12 -2
- package/dist/esnext/components/CartLines/{CartLines.d.ts → CartLines.client.d.ts} +0 -0
- package/dist/esnext/components/CartLines/{CartLines.js → CartLines.client.js} +0 -0
- 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.js +2 -5
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
- package/dist/esnext/components/CartProvider/cart-queries.js +11 -0
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +11 -1
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +11 -1
- package/dist/esnext/components/CartProvider/hooks.client.js +3 -5
- package/dist/esnext/components/CartProvider/types.d.ts +2 -0
- package/dist/esnext/components/DevTools.client.js +1 -1
- package/dist/esnext/components/Image/Image.d.ts +8 -0
- package/dist/esnext/components/Image/Image.js +58 -10
- package/dist/esnext/components/Link/Link.client.d.ts +2 -0
- package/dist/esnext/components/Link/Link.client.js +7 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +1 -1
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +141 -0
- package/dist/esnext/components/ProductOptionsProvider/context.d.ts +2 -0
- package/dist/esnext/components/{ProductProvider → ProductOptionsProvider}/context.js +0 -1
- package/dist/esnext/components/ProductOptionsProvider/index.d.ts +2 -0
- package/dist/esnext/components/ProductOptionsProvider/index.js +2 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -2
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +10 -12
- package/dist/esnext/components/index.d.ts +1 -1
- package/dist/esnext/components/index.js +1 -1
- package/dist/esnext/entry-client.js +106 -6
- package/dist/esnext/entry-server.d.ts +2 -15
- package/dist/esnext/entry-server.js +246 -322
- package/dist/esnext/foundation/Analytics/Analytics.client.js +15 -13
- package/dist/esnext/foundation/Analytics/Analytics.server.js +27 -20
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +4 -2
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +16 -14
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/{PerformanceMetrics.server.js → ServerAnalyticsConnector.server.js} +7 -6
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.js +19 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +190 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +24 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.d.ts +28 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.js +51 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.js +56 -0
- package/dist/esnext/foundation/Analytics/hook.js +4 -2
- package/dist/esnext/foundation/Analytics/utils.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/utils.js +21 -0
- package/dist/{node/framework → esnext/foundation/Cache}/cache-sub-request.d.ts +1 -1
- package/dist/esnext/{framework → foundation/Cache}/cache-sub-request.js +3 -3
- package/dist/esnext/{framework → foundation/Cache}/cache.d.ts +1 -1
- package/dist/esnext/{framework → foundation/Cache}/cache.js +3 -3
- package/dist/{node/framework/CachingStrategy → esnext/foundation/Cache/strategies}/index.d.ts +2 -1
- package/dist/esnext/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +1 -1
- package/dist/esnext/foundation/Cookie/Cookie.d.ts +3 -3
- package/dist/{node/framework/Hydration → esnext/foundation/Html}/Html.d.ts +3 -1
- package/dist/esnext/{framework/Hydration → foundation/Html}/Html.js +15 -2
- package/dist/{node/framework/Hydration/ServerComponentRequest.server.d.ts → esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +8 -3
- package/dist/esnext/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +3 -2
- package/dist/{node/framework/Hydration/ServerComponentResponse.server.d.ts → esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts} +7 -10
- package/dist/esnext/{framework/Hydration/ServerComponentResponse.server.js → foundation/HydrogenResponse/HydrogenResponse.server.js} +19 -15
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +16 -9
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +5 -6
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +18 -21
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +1 -1
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +1 -0
- package/dist/esnext/foundation/index.d.ts +1 -1
- package/dist/esnext/foundation/index.js +1 -1
- package/dist/esnext/foundation/runtime.d.ts +2 -0
- package/dist/esnext/foundation/runtime.js +6 -0
- package/dist/esnext/foundation/session/session.d.ts +3 -3
- package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
- package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.js +11 -4
- package/dist/esnext/foundation/useQuery/hooks.d.ts +1 -0
- package/dist/esnext/foundation/useQuery/hooks.js +24 -7
- package/dist/esnext/foundation/useRequestContext/index.d.ts +15 -0
- package/dist/esnext/foundation/useRequestContext/index.js +23 -0
- package/dist/esnext/framework/Hydration/rsc.js +2 -0
- package/dist/esnext/framework/plugin.js +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +5 -2
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +4 -12
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +19 -0
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +12 -2
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/types.d.ts +17 -15
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -15
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +8 -107
- package/dist/esnext/hooks/useShopQuery/hooks.js +12 -6
- package/dist/esnext/index.d.ts +9 -3
- package/dist/esnext/index.js +7 -3
- package/dist/esnext/storefront-api-types.d.ts +10 -339
- package/dist/esnext/streaming.server.d.ts +0 -1
- package/dist/esnext/streaming.server.js +0 -4
- package/dist/esnext/types.d.ts +32 -23
- package/dist/esnext/utilities/apiRoutes.d.ts +2 -2
- package/dist/esnext/utilities/graphql-tracker.js +1 -1
- package/dist/esnext/utilities/index.d.ts +1 -1
- package/dist/esnext/utilities/index.js +1 -1
- package/dist/esnext/utilities/isBrowser/index.d.ts +1 -0
- package/dist/esnext/utilities/isBrowser/index.js +1 -0
- package/dist/esnext/utilities/isBrowser/isBrowser.d.ts +4 -0
- package/dist/esnext/utilities/isBrowser/isBrowser.js +6 -0
- package/dist/esnext/utilities/isServer/isServer.js +2 -2
- package/dist/esnext/utilities/log/index.d.ts +1 -1
- package/dist/esnext/utilities/log/index.js +1 -1
- package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/esnext/utilities/log/log.d.ts +17 -11
- package/dist/esnext/utilities/log/log.js +29 -20
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/client.d.ts +16 -0
- package/dist/node/client.js +43 -0
- package/dist/node/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
- package/dist/node/components/AddToCartButton/AddToCartButton.client.js +74 -0
- package/dist/node/components/AddToCartButton/index.d.ts +1 -0
- package/dist/node/components/AddToCartButton/index.js +5 -0
- package/dist/node/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
- package/dist/node/components/BuyNowButton/BuyNowButton.client.js +53 -0
- package/dist/node/components/BuyNowButton/index.d.ts +1 -0
- package/dist/node/components/BuyNowButton/index.js +5 -0
- package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
- package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.js +44 -0
- package/dist/node/components/CartCheckoutButton/index.d.ts +1 -0
- package/dist/node/components/CartCheckoutButton/index.js +5 -0
- package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
- package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.js +36 -0
- package/dist/node/components/CartEstimatedCost/index.d.ts +1 -0
- package/dist/node/components/CartEstimatedCost/index.js +5 -0
- package/dist/node/components/CartLineImage/CartLineImage.client.d.ts +9 -0
- package/dist/node/components/CartLineImage/CartLineImage.client.js +18 -0
- package/dist/node/components/CartLineImage/index.d.ts +1 -0
- package/dist/node/components/CartLineImage/index.js +5 -0
- package/dist/node/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
- package/dist/node/components/CartLinePrice/CartLinePrice.client.js +25 -0
- package/dist/node/components/CartLinePrice/index.d.ts +1 -0
- package/dist/node/components/CartLinePrice/index.js +5 -0
- package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
- package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.js +19 -0
- package/dist/node/components/CartLineProductTitle/index.d.ts +1 -0
- package/dist/node/components/CartLineProductTitle/index.js +5 -0
- package/dist/node/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
- package/dist/node/components/CartLineProvider/CartLineProvider.client.js +15 -0
- package/dist/node/components/CartLineProvider/context.d.ts +36 -0
- package/dist/node/components/CartLineProvider/context.js +5 -0
- package/dist/node/components/CartLineProvider/index.d.ts +2 -0
- package/dist/node/components/CartLineProvider/index.js +7 -0
- package/dist/node/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
- package/dist/node/components/CartLineQuantity/CartLineQuantity.client.js +19 -0
- package/dist/node/components/CartLineQuantity/index.d.ts +1 -0
- package/dist/node/components/CartLineQuantity/index.js +5 -0
- package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
- package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +31 -0
- package/dist/node/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
- package/dist/node/components/CartLineQuantityAdjustButton/index.js +5 -0
- package/dist/node/components/CartLines/CartLines.client.d.ts +15 -0
- package/dist/node/components/CartLines/CartLines.client.js +44 -0
- package/dist/node/components/CartLines/index.d.ts +1 -0
- package/dist/node/components/CartLines/index.js +5 -0
- package/dist/node/components/CartProvider/CartProvider.client.d.ts +41 -0
- package/dist/node/components/CartProvider/CartProvider.client.js +547 -0
- package/dist/node/components/CartProvider/cart-queries.d.ts +10 -0
- package/dist/node/components/CartProvider/cart-queries.js +214 -0
- package/dist/node/components/CartProvider/constants.d.ts +2 -0
- package/dist/node/components/CartProvider/constants.js +5 -0
- package/dist/node/components/CartProvider/context.d.ts +2 -0
- package/dist/node/components/CartProvider/context.js +5 -0
- package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartCreateMutation.d.ts +95 -0
- package/dist/node/components/CartProvider/graphql/CartCreateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartFragment.d.ts +82 -0
- package/dist/node/components/CartProvider/graphql/CartFragment.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineAddMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartLineAddMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +96 -0
- package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartQuery.d.ts +91 -0
- package/dist/node/components/CartProvider/graphql/CartQuery.js +2 -0
- package/dist/node/components/CartProvider/hooks.client.d.ts +15 -0
- package/dist/node/components/CartProvider/hooks.client.js +88 -0
- package/dist/node/components/CartProvider/index.d.ts +4 -0
- package/dist/node/components/CartProvider/index.js +10 -0
- package/dist/node/components/CartProvider/types.d.ts +104 -0
- package/dist/node/components/CartProvider/types.js +2 -0
- package/dist/node/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
- package/dist/node/components/CartShopPayButton/CartShopPayButton.client.js +46 -0
- package/dist/node/components/CartShopPayButton/index.d.ts +1 -0
- package/dist/node/components/CartShopPayButton/index.js +5 -0
- package/dist/node/components/ExternalVideo/ExternalVideo.d.ts +21 -0
- package/dist/node/components/ExternalVideo/ExternalVideo.js +21 -0
- package/dist/node/components/ExternalVideo/index.d.ts +1 -0
- package/dist/node/components/ExternalVideo/index.js +5 -0
- package/dist/node/components/Image/Image.d.ts +8 -0
- package/dist/node/components/Image/Image.js +57 -9
- package/dist/node/components/Link/Link.client.d.ts +25 -0
- package/dist/node/components/Link/Link.client.js +165 -0
- package/dist/node/components/Link/index.d.ts +1 -0
- package/dist/node/components/Link/index.js +5 -0
- package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
- package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.js +11 -0
- package/dist/node/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
- package/dist/node/components/LocalizationProvider/LocalizationContext.client.js +5 -0
- package/dist/node/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
- package/dist/node/components/LocalizationProvider/LocalizationProvider.server.js +51 -0
- package/dist/node/components/MediaFile/MediaFile.d.ts +19 -0
- package/dist/node/components/MediaFile/MediaFile.js +39 -0
- package/dist/node/components/MediaFile/index.d.ts +1 -0
- package/dist/node/components/MediaFile/index.js +5 -0
- package/dist/node/components/Metafield/Metafield.client.d.ts +21 -0
- package/dist/node/components/Metafield/Metafield.client.js +75 -0
- package/dist/node/components/Metafield/index.d.ts +2 -0
- package/dist/node/components/Metafield/index.js +5 -0
- package/dist/node/components/Metafield/types.d.ts +4 -0
- package/dist/node/components/Metafield/types.js +2 -0
- package/dist/node/components/ModelViewer/ModelViewer.client.d.ts +128 -0
- package/dist/node/components/ModelViewer/ModelViewer.client.js +132 -0
- package/dist/node/components/ModelViewer/index.d.ts +1 -0
- package/dist/node/components/ModelViewer/index.js +5 -0
- package/dist/node/components/Money/Money.client.d.ts +25 -0
- package/dist/node/components/Money/Money.client.js +46 -0
- package/dist/node/components/Money/index.d.ts +1 -0
- package/dist/node/components/Money/index.js +5 -0
- package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
- package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.js +168 -0
- package/dist/node/components/ProductOptionsProvider/context.d.ts +2 -0
- package/dist/node/components/ProductOptionsProvider/context.js +5 -0
- package/dist/node/components/ProductOptionsProvider/index.d.ts +2 -0
- package/dist/node/components/ProductOptionsProvider/index.js +7 -0
- package/dist/node/components/ProductPrice/ProductPrice.client.d.ts +18 -0
- package/dist/node/components/ProductPrice/ProductPrice.client.js +61 -0
- package/dist/node/components/ProductPrice/index.d.ts +1 -0
- package/dist/node/components/ProductPrice/index.js +5 -0
- package/dist/node/components/Seo/CollectionSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/CollectionSeo.client.js +22 -0
- package/dist/node/components/Seo/DefaultPageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/DefaultPageSeo.client.js +25 -0
- package/dist/node/components/Seo/DescriptionSeo.client.d.ts +4 -0
- package/dist/node/components/Seo/DescriptionSeo.client.js +17 -0
- package/dist/node/components/Seo/HomePageSeo.client.d.ts +2 -0
- package/dist/node/components/Seo/HomePageSeo.client.js +32 -0
- package/dist/node/components/Seo/ImageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/ImageSeo.client.js +17 -0
- package/dist/node/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/NoIndexSeo.client.js +17 -0
- package/dist/node/components/Seo/PageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/PageSeo.client.js +20 -0
- package/dist/node/components/Seo/ProductSeo.client.d.ts +5 -0
- package/dist/node/components/Seo/ProductSeo.client.js +70 -0
- package/dist/node/components/Seo/Seo.client.d.ts +30 -0
- package/dist/node/components/Seo/Seo.client.js +38 -0
- package/dist/node/components/Seo/TitleSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/TitleSeo.client.js +17 -0
- package/dist/node/components/Seo/TwitterSeo.client.d.ts +2 -0
- package/dist/node/components/Seo/TwitterSeo.client.js +16 -0
- package/dist/node/components/Seo/index.d.ts +1 -0
- package/dist/node/components/Seo/index.js +5 -0
- package/dist/node/components/Seo/seo-types.d.ts +17 -0
- package/dist/node/components/Seo/seo-types.js +2 -0
- package/dist/node/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
- package/dist/node/components/ShopPayButton/ShopPayButton.client.js +60 -0
- package/dist/node/components/ShopPayButton/index.d.ts +1 -0
- package/dist/node/components/ShopPayButton/index.js +5 -0
- package/dist/node/components/Video/Video.d.ts +14 -0
- package/dist/node/components/Video/Video.js +31 -0
- package/dist/node/components/Video/index.d.ts +1 -0
- package/dist/node/components/Video/index.js +5 -0
- package/dist/node/components/index.d.ts +28 -0
- package/dist/node/components/index.js +59 -0
- package/dist/node/components/types.d.ts +71 -0
- package/dist/node/components/types.js +11 -0
- package/dist/node/entry-server.d.ts +2 -15
- package/dist/node/entry-server.js +245 -321
- package/dist/node/foundation/Analytics/Analytics.client.js +15 -13
- package/dist/node/foundation/Analytics/Analytics.server.js +27 -20
- package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +4 -2
- package/dist/node/foundation/Analytics/ClientAnalytics.js +15 -13
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +68 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +27 -0
- package/dist/node/foundation/Analytics/hook.js +4 -2
- package/dist/node/foundation/Analytics/index.d.ts +1 -0
- package/dist/node/foundation/Analytics/index.js +5 -0
- package/dist/node/foundation/Analytics/utils.d.ts +2 -0
- package/dist/node/foundation/Analytics/utils.js +24 -1
- package/dist/{esnext/framework → node/foundation/Cache}/cache-sub-request.d.ts +1 -1
- package/dist/node/{framework → foundation/Cache}/cache-sub-request.js +4 -4
- package/dist/node/{framework → foundation/Cache}/cache.d.ts +1 -1
- package/dist/node/{framework → foundation/Cache}/cache.js +5 -5
- package/dist/{esnext/framework/CachingStrategy → node/foundation/Cache/strategies}/index.d.ts +2 -1
- package/dist/node/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +3 -3
- package/dist/node/foundation/Head/Head.client.d.ts +5 -0
- package/dist/node/foundation/Head/Head.client.js +17 -0
- package/dist/node/foundation/Head/index.d.ts +1 -0
- package/dist/node/foundation/Head/index.js +5 -0
- package/dist/{esnext/framework/Hydration → node/foundation/Html}/Html.d.ts +3 -1
- package/dist/node/{framework/Hydration → foundation/Html}/Html.js +15 -2
- package/dist/{esnext/framework/Hydration/ServerComponentRequest.server.d.ts → node/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +8 -3
- package/dist/node/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +5 -4
- package/dist/{esnext/framework/Hydration/ServerComponentResponse.server.d.ts → node/foundation/HydrogenResponse/HydrogenResponse.server.d.ts} +7 -10
- package/dist/node/{framework/Hydration/ServerComponentResponse.server.js → foundation/HydrogenResponse/HydrogenResponse.server.js} +23 -19
- package/dist/node/foundation/Router/BrowserRouter.client.js +16 -9
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -1
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +5 -6
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +18 -21
- package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
- package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.js +35 -0
- package/dist/node/foundation/ShopifyProvider/index.d.ts +1 -0
- package/dist/node/foundation/ShopifyProvider/index.js +5 -0
- package/dist/node/foundation/fetchSync/client/fetchSync.d.ts +10 -0
- package/dist/node/foundation/fetchSync/client/fetchSync.js +33 -0
- package/dist/node/foundation/fetchSync/server/fetchSync.d.ts +8 -0
- package/dist/node/foundation/fetchSync/server/fetchSync.js +33 -0
- package/dist/node/foundation/fetchSync/types.d.ts +5 -0
- package/dist/node/foundation/fetchSync/types.js +2 -0
- package/dist/node/foundation/index.d.ts +3 -0
- package/dist/node/foundation/index.js +10 -0
- package/dist/node/foundation/runtime.d.ts +2 -0
- package/dist/node/foundation/runtime.js +11 -0
- package/dist/node/foundation/session/session.d.ts +3 -3
- package/dist/node/foundation/ssr-interop.d.ts +2 -2
- package/dist/node/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/node/foundation/useNavigate/useNavigate.js +11 -4
- package/dist/node/foundation/useQuery/hooks.d.ts +37 -0
- package/dist/node/foundation/useQuery/hooks.js +119 -0
- package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.d.ts +10 -0
- package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.js +34 -0
- package/dist/node/foundation/useRouteParams/useRouteParams.d.ts +4 -0
- package/dist/node/foundation/useRouteParams/useRouteParams.js +13 -0
- package/dist/node/foundation/useServerProps/index.d.ts +1 -0
- package/dist/node/foundation/useServerProps/index.js +5 -0
- package/dist/node/foundation/useSession/useSession.d.ts +2 -0
- package/dist/node/foundation/useSession/useSession.js +12 -0
- package/dist/node/foundation/useShop/index.d.ts +1 -0
- package/dist/node/foundation/useShop/index.js +5 -0
- package/dist/node/foundation/useShop/use-shop.d.ts +6 -0
- package/dist/node/foundation/useShop/use-shop.js +18 -0
- package/dist/node/foundation/useUrl/index.d.ts +1 -0
- package/dist/node/foundation/useUrl/index.js +5 -0
- package/dist/node/foundation/useUrl/useUrl.d.ts +4 -0
- package/dist/node/foundation/useUrl/useUrl.js +32 -0
- package/dist/node/framework/Hydration/rsc.js +2 -0
- package/dist/node/framework/plugin.js +2 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +5 -2
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +4 -12
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +21 -0
- package/dist/node/hooks/index.d.ts +6 -0
- package/dist/node/hooks/index.js +28 -0
- package/dist/node/hooks/useCart/index.d.ts +1 -0
- package/dist/node/hooks/useCart/index.js +5 -0
- package/dist/node/hooks/useCart/useCart.d.ts +4 -0
- package/dist/node/hooks/useCart/useCart.js +19 -0
- package/dist/node/hooks/useCartLine/index.d.ts +1 -0
- package/dist/node/hooks/useCartLine/index.js +5 -0
- package/dist/node/hooks/useCartLine/useCartLine.d.ts +39 -0
- package/dist/node/hooks/useCartLine/useCartLine.js +16 -0
- package/dist/node/hooks/useCountry/index.d.ts +1 -0
- package/dist/node/hooks/useCountry/index.js +5 -0
- package/dist/node/hooks/useCountry/useCountry.d.ts +7 -0
- package/dist/node/hooks/useCountry/useCountry.js +21 -0
- package/dist/node/hooks/useLoadScript/index.d.ts +1 -0
- package/dist/node/hooks/useLoadScript/index.js +5 -0
- package/dist/node/hooks/useLoadScript/useLoadScript.client.d.ts +8 -0
- package/dist/node/hooks/useLoadScript/useLoadScript.client.js +27 -0
- package/dist/node/hooks/useMeasurement/hooks.d.ts +9 -0
- package/dist/node/hooks/useMeasurement/hooks.js +17 -0
- package/dist/node/hooks/useMeasurement/index.d.ts +1 -0
- package/dist/node/hooks/useMeasurement/index.js +5 -0
- package/dist/node/hooks/useMoney/hooks.d.ts +54 -0
- package/dist/node/hooks/useMoney/hooks.js +70 -0
- package/dist/node/hooks/useMoney/index.d.ts +1 -0
- package/dist/node/hooks/useMoney/index.js +5 -0
- package/dist/node/hooks/useParsedMetafields/index.d.ts +1 -0
- package/dist/node/hooks/useParsedMetafields/index.js +5 -0
- package/dist/node/hooks/useParsedMetafields/useParsedMetafields.d.ts +21 -0
- package/dist/node/hooks/useParsedMetafields/useParsedMetafields.js +25 -0
- package/dist/node/hooks/useProductOptions/helpers.d.ts +6 -0
- package/dist/node/hooks/useProductOptions/helpers.js +46 -0
- package/dist/node/hooks/useProductOptions/index.d.ts +2 -0
- package/dist/node/hooks/useProductOptions/index.js +20 -0
- package/dist/node/hooks/useProductOptions/types.d.ts +44 -0
- package/dist/node/hooks/useProductOptions/types.js +2 -0
- package/dist/node/hooks/useProductOptions/useProductOptions.client.d.ts +1 -0
- package/dist/node/hooks/useProductOptions/useProductOptions.client.js +13 -0
- package/dist/node/hooks/useShopQuery/hooks.d.ts +28 -0
- package/dist/node/hooks/useShopQuery/hooks.js +171 -0
- package/dist/node/hooks/useShopQuery/index.d.ts +1 -0
- package/dist/node/hooks/useShopQuery/index.js +5 -0
- package/dist/node/storefront-api-types.d.ts +10 -339
- package/dist/node/streaming.server.d.ts +0 -1
- package/dist/node/streaming.server.js +1 -6
- package/dist/node/types.d.ts +32 -23
- package/dist/node/utilities/apiRoutes.d.ts +2 -2
- package/dist/node/utilities/devtools.d.ts +11 -0
- package/dist/node/utilities/devtools.js +15 -0
- package/dist/node/utilities/graphql-tag.d.ts +1 -0
- package/dist/node/utilities/graphql-tag.js +10 -0
- package/dist/node/utilities/graphql-tracker.d.ts +17 -0
- package/dist/node/utilities/graphql-tracker.js +130 -0
- package/dist/node/utilities/index.d.ts +1 -1
- package/dist/node/utilities/index.js +3 -3
- package/dist/node/utilities/isBrowser/index.d.ts +1 -0
- package/dist/node/utilities/isBrowser/index.js +5 -0
- package/dist/node/utilities/isBrowser/isBrowser.d.ts +4 -0
- package/dist/node/utilities/isBrowser/isBrowser.js +10 -0
- package/dist/node/utilities/isServer/isServer.js +2 -2
- package/dist/node/utilities/log/index.d.ts +1 -1
- package/dist/node/utilities/log/index.js +1 -3
- package/dist/node/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/node/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/node/utilities/log/log.d.ts +17 -11
- package/dist/node/utilities/log/log.js +30 -23
- package/dist/node/version.d.ts +1 -1
- package/dist/node/version.js +1 -1
- package/package.json +4 -2
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +234 -53
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +77 -59
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -30
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +199 -70
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +38 -35
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +9 -8
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +3 -3
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +3 -7
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +235 -54
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +77 -59
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +199 -70
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +9 -8
- package/vendor/react-server-dom-vite/package.json +1 -1
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +0 -8
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +0 -12
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +0 -24
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +0 -34
- package/dist/esnext/components/ProductProvider/context.d.ts +0 -29
- package/dist/esnext/components/ProductProvider/index.d.ts +0 -2
- package/dist/esnext/components/ProductProvider/index.js +0 -2
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +0 -1
- package/dist/esnext/framework/config.d.ts +0 -6
- package/dist/esnext/framework/config.js +0 -6
- package/dist/esnext/framework/runtime.d.ts +0 -13
- package/dist/esnext/framework/runtime.js +0 -27
- package/dist/esnext/hooks/useProduct/index.d.ts +0 -1
- package/dist/esnext/hooks/useProduct/index.js +0 -1
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +0 -52
- package/dist/esnext/hooks/useProduct/useProduct.js +0 -43
- package/dist/esnext/utilities/isClient/index.d.ts +0 -1
- package/dist/esnext/utilities/isClient/index.js +0 -1
- package/dist/esnext/utilities/isClient/isClient.d.ts +0 -4
- package/dist/esnext/utilities/isClient/isClient.js +0 -6
- package/dist/node/framework/config.d.ts +0 -6
- package/dist/node/framework/config.js +0 -11
- package/dist/node/framework/runtime.d.ts +0 -13
- package/dist/node/framework/runtime.js +0 -35
- package/dist/node/utilities/defer.d.ts +0 -6
- package/dist/node/utilities/defer.js +0 -18
- package/dist/node/utilities/isClient/index.d.ts +0 -1
- package/dist/node/utilities/isClient/index.js +0 -5
- package/dist/node/utilities/isClient/isClient.d.ts +0 -4
- package/dist/node/utilities/isClient/isClient.js +0 -10
|
@@ -92,77 +92,98 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
var assign = Object.assign;
|
|
96
|
+
|
|
95
97
|
var rscViteFileRE = /\/react-server-dom-vite.js/;
|
|
96
98
|
var noProxyRE = /[&?]no-proxy($|&)/;
|
|
99
|
+
|
|
100
|
+
var isClientComponent = function (id) {
|
|
101
|
+
return /\.client\.[jt]sx?($|\?)/.test(id);
|
|
102
|
+
};
|
|
103
|
+
|
|
97
104
|
function ReactFlightVitePlugin() {
|
|
98
105
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
106
|
+
serverBuildEntries = _ref.serverBuildEntries,
|
|
99
107
|
_ref$isServerComponen = _ref.isServerComponentImporterAllowed,
|
|
100
108
|
isServerComponentImporterAllowed = _ref$isServerComponen === void 0 ? function (importer) {
|
|
101
109
|
return false;
|
|
102
|
-
} : _ref$isServerComponen
|
|
103
|
-
_ref$isClientComponen = _ref.isClientComponent,
|
|
104
|
-
isClientComponent = _ref$isClientComponen === void 0 ? function (id) {
|
|
105
|
-
return /\.client\.[jt]sx?($|\?)/.test(id);
|
|
106
|
-
} : _ref$isClientComponen,
|
|
107
|
-
findClientComponentsForClientBuild = _ref.findClientComponentsForClientBuild;
|
|
110
|
+
} : _ref$isServerComponen;
|
|
108
111
|
|
|
109
112
|
var config;
|
|
110
113
|
var server;
|
|
111
114
|
var invalidateTimeout;
|
|
112
|
-
var
|
|
115
|
+
var globImporterPath;
|
|
116
|
+
var resolveAlias;
|
|
113
117
|
|
|
114
|
-
function
|
|
118
|
+
function invalidateGlobImporter() {
|
|
115
119
|
clearTimeout(invalidateTimeout);
|
|
116
120
|
invalidateTimeout = setTimeout(function () {
|
|
117
|
-
return server.watcher.emit('change',
|
|
121
|
+
return server.watcher.emit('change', globImporterPath);
|
|
118
122
|
}, 100);
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
function wrapIfClientComponent(id) {
|
|
122
|
-
var handle = function (isClient) {
|
|
123
|
-
if (!isClient) return null;
|
|
124
|
-
|
|
125
|
-
if (server) {
|
|
126
|
-
var moduleNode = server.moduleGraph.getModuleById(id);
|
|
127
|
-
|
|
128
|
-
if (!moduleNode.__isClientComponent) {
|
|
129
|
-
moduleNode.__isClientComponent = true;
|
|
130
|
-
if (absoluteImporterPath) invalidateImporter();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return proxyClientComponent(id.split('?')[0]);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
var tmp = isClientComponent(id);
|
|
138
|
-
return typeof tmp === 'boolean' ? handle(tmp) : tmp.then(handle);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
125
|
return {
|
|
142
126
|
name: 'vite-plugin-react-server-components',
|
|
143
127
|
enforce: 'pre',
|
|
144
128
|
configureServer: function (_server) {
|
|
145
129
|
server = _server;
|
|
146
130
|
},
|
|
147
|
-
configResolved: function (_config) {
|
|
148
|
-
|
|
131
|
+
configResolved: async function (_config) {
|
|
132
|
+
await esModuleLexer.init;
|
|
133
|
+
config = _config;
|
|
134
|
+
var aliasPlugin = config.plugins.find(function (plugin) {
|
|
135
|
+
return plugin.name === 'alias';
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
if (aliasPlugin) {
|
|
139
|
+
resolveAlias = aliasPlugin.resolveId.bind({
|
|
140
|
+
// Mock Rollup instance
|
|
141
|
+
resolve: function (id) {
|
|
142
|
+
return {
|
|
143
|
+
then: function () {
|
|
144
|
+
return id ? {
|
|
145
|
+
id: id
|
|
146
|
+
} : null;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
} // By pushing this plugin at the end of the existing array,
|
|
149
152
|
// we enforce running it *after* Vite resolves import.meta.glob.
|
|
150
153
|
|
|
154
|
+
|
|
151
155
|
config.plugins.push(hashImportsPlugin);
|
|
152
156
|
},
|
|
153
157
|
resolveId: function (source, importer) {
|
|
154
158
|
if (!importer) return null;
|
|
159
|
+
|
|
160
|
+
if (noProxyRE.test(source)) {
|
|
161
|
+
var _source$split = source.split('?'),
|
|
162
|
+
id = _source$split[0],
|
|
163
|
+
query = _source$split[1];
|
|
164
|
+
|
|
165
|
+
return this.resolve(id, importer, {
|
|
166
|
+
skipSelf: true
|
|
167
|
+
}).then(function (result) {
|
|
168
|
+
if (!result) return null;
|
|
169
|
+
return assign({}, result, {
|
|
170
|
+
id: result.id + (query ? "?" + query : ''),
|
|
171
|
+
moduleSideEffects: false
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
155
175
|
/**
|
|
156
176
|
* Throw errors when non-Server Components try to load Server Components.
|
|
157
177
|
*/
|
|
158
178
|
|
|
179
|
+
|
|
159
180
|
if (/\.server(\.[jt]sx?)?$/.test(source) && !(/(\.server\.[jt]sx?|index\.html)$/.test(importer) || isServerComponentImporterAllowed(importer, source))) {
|
|
160
181
|
throw new Error("Cannot import " + source + " from \"" + importer + "\". " + 'By react-server convention, .server.js files can only be imported from other .server.js files. ' + 'That way nobody accidentally sends these to the client by indirectly importing it.');
|
|
161
182
|
}
|
|
162
183
|
},
|
|
163
184
|
load: function (id) {
|
|
164
185
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
165
|
-
if (!options.ssr || !
|
|
186
|
+
if (!options.ssr || !isClientComponent(id) || noProxyRE.test(id)) return;
|
|
166
187
|
|
|
167
188
|
if (server) {
|
|
168
189
|
var mod = server.moduleGraph.idToModuleMap.get(id.replace('/@fs', ''));
|
|
@@ -175,14 +196,28 @@ function ReactFlightVitePlugin() {
|
|
|
175
196
|
// so we don't need to create a module reference
|
|
176
197
|
return;
|
|
177
198
|
}
|
|
199
|
+
} // Mark module as a client component.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
var moduleNode = server.moduleGraph.getModuleById(id);
|
|
203
|
+
if (!moduleNode.meta) moduleNode.meta = {};
|
|
204
|
+
|
|
205
|
+
if (!moduleNode.meta.isClientComponent) {
|
|
206
|
+
moduleNode.meta.isClientComponent = true;
|
|
207
|
+
if (globImporterPath) invalidateGlobImporter();
|
|
178
208
|
}
|
|
179
209
|
}
|
|
180
210
|
|
|
181
|
-
return
|
|
211
|
+
return proxyClientComponent(id.split('?')[0]);
|
|
182
212
|
},
|
|
183
213
|
transform: function (code, id) {
|
|
184
214
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
185
215
|
|
|
216
|
+
// Add more information for this module in the graph.
|
|
217
|
+
// It will be used later to discover client boundaries.
|
|
218
|
+
if (server && options.ssr && /\.[jt]sx?($|\?)/.test(id)) {
|
|
219
|
+
augmentModuleGraph(server.moduleGraph, id, code, config.root, resolveAlias);
|
|
220
|
+
}
|
|
186
221
|
/**
|
|
187
222
|
* In order to allow dynamic component imports from RSC, we use Vite's import.meta.glob.
|
|
188
223
|
* This hook replaces the glob placeholders with resolved paths to all client components.
|
|
@@ -192,6 +227,8 @@ function ReactFlightVitePlugin() {
|
|
|
192
227
|
* If the paths are relative to the root instead, Vite won't add the querystring
|
|
193
228
|
* and we will have duplicated files in the browser (with duplicated contexts, etc).
|
|
194
229
|
*/
|
|
230
|
+
|
|
231
|
+
|
|
195
232
|
if (rscViteFileRE.test(id)) {
|
|
196
233
|
var INJECTING_RE = /\{\s*__INJECTED_CLIENT_IMPORTERS__[:\s]*null[,\s]*\}\s*;/;
|
|
197
234
|
var s = new MagicString(code);
|
|
@@ -231,16 +268,15 @@ function ReactFlightVitePlugin() {
|
|
|
231
268
|
};
|
|
232
269
|
|
|
233
270
|
if (config.command === 'serve') {
|
|
234
|
-
|
|
235
|
-
return injectGlobs(
|
|
271
|
+
globImporterPath = id;
|
|
272
|
+
return injectGlobs(findClientBoundaries(server.moduleGraph));
|
|
236
273
|
}
|
|
237
274
|
|
|
238
|
-
if (!
|
|
239
|
-
throw new Error('[react-server-dom-vite] Parameter
|
|
275
|
+
if (!serverBuildEntries) {
|
|
276
|
+
throw new Error('[react-server-dom-vite] Parameter serverBuildEntries is required for client build');
|
|
240
277
|
}
|
|
241
278
|
|
|
242
|
-
|
|
243
|
-
return Array.isArray(tmp) ? injectGlobs(tmp) : tmp.then(injectGlobs);
|
|
279
|
+
return findClientBoundariesForClientBuild(serverBuildEntries).then(injectGlobs);
|
|
244
280
|
}
|
|
245
281
|
}
|
|
246
282
|
};
|
|
@@ -294,29 +330,31 @@ async function proxyClientComponent(filepath, src) {
|
|
|
294
330
|
exportStatements.forEach(function (key) {
|
|
295
331
|
var isDefault = key === DEFAULT_EXPORT;
|
|
296
332
|
var componentName = isDefault ? getComponentFilename(filepath) : key;
|
|
297
|
-
proxyCode += "export " + (isDefault ? DEFAULT_EXPORT : "const " + componentName + " =") + " wrapInClientProxy({ name: '" + componentName + "', id: '" + getComponentId(filepath) + "', value: allImports['" + key + "'], isDefault: " + // eslint-disable-next-line react-internal/safe-string-coercion
|
|
333
|
+
proxyCode += "export " + (isDefault ? DEFAULT_EXPORT : "const " + componentName + " =") + " /* @__PURE__ */wrapInClientProxy({ name: '" + componentName + "', id: '" + getComponentId(filepath) + "', value: allImports['" + key + "'], isDefault: " + // eslint-disable-next-line react-internal/safe-string-coercion
|
|
298
334
|
String(isDefault) + " });\n";
|
|
299
335
|
});
|
|
300
|
-
return
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
return /\.[jt]sx?($|\?)/.test(id) && !noProxyRE.test(id);
|
|
336
|
+
return {
|
|
337
|
+
code: proxyCode,
|
|
338
|
+
moduleSideEffects: false
|
|
339
|
+
};
|
|
305
340
|
}
|
|
306
341
|
|
|
307
|
-
function
|
|
308
|
-
var
|
|
342
|
+
function findClientBoundaries(moduleGraph) {
|
|
343
|
+
var clientBoundaries = []; // eslint-disable-next-line no-for-of-loops/no-for-of-loops
|
|
309
344
|
|
|
310
|
-
var _iterator = _createForOfIteratorHelper(
|
|
345
|
+
var _iterator = _createForOfIteratorHelper(moduleGraph.fileToModulesMap.values()),
|
|
311
346
|
_step;
|
|
312
347
|
|
|
313
348
|
try {
|
|
314
349
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
315
350
|
var set = _step.value;
|
|
316
351
|
var clientModule = Array.from(set).find(function (moduleNode) {
|
|
317
|
-
return moduleNode.
|
|
352
|
+
return moduleNode.meta && moduleNode.meta.isClientComponent;
|
|
318
353
|
});
|
|
319
|
-
|
|
354
|
+
|
|
355
|
+
if (clientModule && isDirectImportInServer(clientModule)) {
|
|
356
|
+
clientBoundaries.push(clientModule.file);
|
|
357
|
+
}
|
|
320
358
|
}
|
|
321
359
|
} catch (err) {
|
|
322
360
|
_iterator.e(err);
|
|
@@ -324,7 +362,28 @@ function findClientComponentsForDev(server) {
|
|
|
324
362
|
_iterator.f();
|
|
325
363
|
}
|
|
326
364
|
|
|
327
|
-
return
|
|
365
|
+
return clientBoundaries;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async function findClientBoundariesForClientBuild(serverEntries) {
|
|
369
|
+
// Viteception
|
|
370
|
+
var server = await vite.createServer({
|
|
371
|
+
clearScreen: false,
|
|
372
|
+
server: {
|
|
373
|
+
middlewareMode: 'ssr'
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
try {
|
|
378
|
+
// Load server entries to discover client components
|
|
379
|
+
await Promise.all(serverEntries.map(server.ssrLoadModule));
|
|
380
|
+
} catch (error) {
|
|
381
|
+
error.message = 'Could not load server build entries: ' + error.message;
|
|
382
|
+
throw error;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
await server.close();
|
|
386
|
+
return findClientBoundaries(server.moduleGraph);
|
|
328
387
|
}
|
|
329
388
|
|
|
330
389
|
var hashImportsPlugin = {
|
|
@@ -349,8 +408,130 @@ var hashImportsPlugin = {
|
|
|
349
408
|
};
|
|
350
409
|
}
|
|
351
410
|
}
|
|
352
|
-
};
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* A client module should behave as a client boundary
|
|
414
|
+
* if it is imported by the server before encountering
|
|
415
|
+
* another boundary in the process.
|
|
416
|
+
* Traverse the module graph upwards to find non client
|
|
417
|
+
* components that import the current module.
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
function isDirectImportInServer(currentMod, originalMod) {
|
|
421
|
+
// TODO: this should use recursion in any module that exports
|
|
422
|
+
// the original one, not only in full facade files.
|
|
423
|
+
if (!originalMod || (currentMod.meta || {}).isFacade) {
|
|
424
|
+
return Array.from(currentMod.importers).some(function (importer) {
|
|
425
|
+
return (// eslint-disable-next-line no-unused-vars
|
|
426
|
+
isDirectImportInServer(importer, originalMod || currentMod)
|
|
427
|
+
);
|
|
428
|
+
});
|
|
429
|
+
} // Not enough information: safer to assume it is
|
|
430
|
+
// imported in server to create a new boundary.
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
if (!currentMod.meta || !originalMod.meta) return true; // If current module is a client component, stop checking
|
|
434
|
+
// parents since this can be the actual boundary.
|
|
435
|
+
|
|
436
|
+
if (isClientComponent(currentMod.file)) return false; // If current module is not a client component, assume
|
|
437
|
+
// it is a server component on a shared component
|
|
438
|
+
// that will be imported in the server to be safe.
|
|
439
|
+
// However, due to the lack of tree-shaking in the dev module graph,
|
|
440
|
+
// we need to manually make sure this module is importing something from
|
|
441
|
+
// the original module before marking it as client boundary.
|
|
442
|
+
// -- TODO: this only checks namedExports right now. It should
|
|
443
|
+
// consider default exports and variable renaming in facade modules.
|
|
444
|
+
|
|
445
|
+
return currentMod.meta.imports.some(function (imp) {
|
|
446
|
+
return imp.action === 'import' && (imp.from === originalMod.file || (imp.variables || []).some(function (_ref2) {
|
|
447
|
+
var name = _ref2[0];
|
|
448
|
+
return originalMod.meta.namedExports.includes(name);
|
|
449
|
+
}));
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function resolveModPath(modPath, dirname, retryExtension) {
|
|
454
|
+
var absolutePath = '';
|
|
455
|
+
|
|
456
|
+
try {
|
|
457
|
+
absolutePath = modPath.startsWith('.') ? vite.normalizePath(path.resolve(dirname, modPath)) : modPath;
|
|
458
|
+
return vite.normalizePath(require.resolve(absolutePath + (retryExtension || '')));
|
|
459
|
+
} catch (error) {
|
|
460
|
+
if (!/\.[jt]sx?$/.test(absolutePath) && retryExtension !== '.tsx') {
|
|
461
|
+
// Node cannot infer .[jt]sx extensions.
|
|
462
|
+
// Append them here and retry a couple of times.
|
|
463
|
+
return resolveModPath(absolutePath, dirname, retryExtension ? '.tsx' : '.jsx');
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function augmentModuleGraph(moduleGraph, id, code, root, resolveAlias) {
|
|
469
|
+
var currentModule = moduleGraph.getModuleById(id);
|
|
470
|
+
if (!currentModule) return;
|
|
471
|
+
|
|
472
|
+
var _id$split = id.split('?'),
|
|
473
|
+
source = _id$split[0];
|
|
474
|
+
|
|
475
|
+
var dirname = vite.normalizePath(path.dirname(source));
|
|
476
|
+
|
|
477
|
+
var _parse2 = esModuleLexer.parse(code),
|
|
478
|
+
rawImports = _parse2[0],
|
|
479
|
+
namedExports = _parse2[1],
|
|
480
|
+
isFacade = _parse2[2]; // This is currently not used but it should be considered
|
|
481
|
+
// to improve the crawling in `isDirectImportInServer`.
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
var imports = [];
|
|
485
|
+
rawImports.forEach(function (_ref3) {
|
|
486
|
+
var startMod = _ref3.s,
|
|
487
|
+
endMod = _ref3.e,
|
|
488
|
+
dynamicImportIndex = _ref3.d,
|
|
489
|
+
startStatement = _ref3.ss,
|
|
490
|
+
endStatement = _ref3.se;
|
|
491
|
+
if (dynamicImportIndex !== -1) return; // Skip dynamic imports for now
|
|
492
|
+
|
|
493
|
+
var rawModPath = code.slice(startMod, endMod);
|
|
494
|
+
var modPath = rawModPath.split('?')[0];
|
|
495
|
+
|
|
496
|
+
if (resolveAlias) {
|
|
497
|
+
var resolvedAliasPath = resolveAlias(modPath, 'rsc_importer', {});
|
|
353
498
|
|
|
354
|
-
|
|
499
|
+
if (resolvedAliasPath && resolvedAliasPath.id) {
|
|
500
|
+
modPath = vite.normalizePath(path.join(root, resolvedAliasPath.id));
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
var resolvedPath = resolveModPath(modPath, dirname);
|
|
505
|
+
if (!resolvedPath) return; // Virtual modules or other exceptions
|
|
506
|
+
|
|
507
|
+
var _code$slice$split$0$s = code.slice(startStatement, endStatement).split(/\s+(from\s+)?['"]/m)[0].split(/\s+(.+)/m),
|
|
508
|
+
action = _code$slice$split$0$s[0],
|
|
509
|
+
_code$slice$split$0$s2 = _code$slice$split$0$s[1],
|
|
510
|
+
variables = _code$slice$split$0$s2 === void 0 ? '' : _code$slice$split$0$s2;
|
|
511
|
+
|
|
512
|
+
imports.push({
|
|
513
|
+
action: action,
|
|
514
|
+
// 'import' or 'export'
|
|
515
|
+
variables: variables // [['originalName', 'alias']]
|
|
516
|
+
.replace(/[{}]/gm, '').trim().split(/\s*,\s*/m).filter(Boolean).map(function (s) {
|
|
517
|
+
return s.split(/\s+as\s+/m);
|
|
518
|
+
}),
|
|
519
|
+
from: resolvedPath,
|
|
520
|
+
// '/absolute/path'
|
|
521
|
+
originalFrom: rawModPath // './path' or '3plib/subpath'
|
|
522
|
+
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
if (!currentModule.meta) {
|
|
527
|
+
currentModule.meta = {};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
assign(currentModule.meta, {
|
|
531
|
+
isFacade: isFacade,
|
|
532
|
+
namedExports: namedExports,
|
|
533
|
+
imports: imports
|
|
534
|
+
});
|
|
535
|
+
}
|
|
355
536
|
|
|
356
537
|
module.exports = ReactFlightVitePlugin;
|
package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js
CHANGED
|
@@ -184,13 +184,15 @@ function processSymbolChunk(request, id, name) {
|
|
|
184
184
|
// eslint-disable-next-line no-unused-vars
|
|
185
185
|
var MODULE_TAG = Symbol.for('react.module.reference');
|
|
186
186
|
function getModuleKey(reference) {
|
|
187
|
+
if (typeof reference === 'string') reference = globalThis.__STRING_REFERENCE_INDEX[reference];
|
|
187
188
|
return reference.filepath + '#' + reference.name;
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
-
if (typeof reference === 'string') return globalThis.__STRING_REFERENCE_INDEX[reference];
|
|
191
|
-
return reference
|
|
190
|
+
function isModuleReference(reference) {
|
|
191
|
+
if (typeof reference === 'string') return !!globalThis.__STRING_REFERENCE_INDEX[reference];
|
|
192
|
+
return reference.$$typeof === MODULE_TAG;
|
|
192
193
|
}
|
|
193
194
|
function resolveModuleMetaData(config, moduleReference) {
|
|
195
|
+
if (typeof moduleReference === 'string') moduleReference = globalThis.__STRING_REFERENCE_INDEX[moduleReference];
|
|
194
196
|
return {
|
|
195
197
|
id: moduleReference.filepath,
|
|
196
198
|
name: moduleReference.name
|
|
@@ -506,7 +508,7 @@ var startInlineScript = stringToPrecomputedChunk('<script>');
|
|
|
506
508
|
var endInlineScript = stringToPrecomputedChunk('</script>');
|
|
507
509
|
var startScriptSrc = stringToPrecomputedChunk('<script src="');
|
|
508
510
|
var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
|
|
509
|
-
var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
|
|
511
|
+
var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
|
|
510
512
|
|
|
511
513
|
var textSeparator = stringToPrecomputedChunk('<!-- -->');
|
|
512
514
|
|
|
@@ -541,6 +543,10 @@ var startPendingSuspenseBoundary1 = stringToPrecomputedChunk('<!--$?--><template
|
|
|
541
543
|
var startPendingSuspenseBoundary2 = stringToPrecomputedChunk('"></template>');
|
|
542
544
|
var startClientRenderedSuspenseBoundary = stringToPrecomputedChunk('<!--$!-->');
|
|
543
545
|
var endSuspenseBoundary = stringToPrecomputedChunk('<!--/$-->');
|
|
546
|
+
var clientRenderedSuspenseBoundaryError1 = stringToPrecomputedChunk('<template data-hash="');
|
|
547
|
+
var clientRenderedSuspenseBoundaryError1A = stringToPrecomputedChunk('" data-msg="');
|
|
548
|
+
var clientRenderedSuspenseBoundaryError1B = stringToPrecomputedChunk('" data-stack="');
|
|
549
|
+
var clientRenderedSuspenseBoundaryError2 = stringToPrecomputedChunk('"></template>');
|
|
544
550
|
var startSegmentHTML = stringToPrecomputedChunk('<div hidden id="');
|
|
545
551
|
var startSegmentHTML2 = stringToPrecomputedChunk('">');
|
|
546
552
|
var endSegmentHTML = stringToPrecomputedChunk('</div>');
|
|
@@ -570,7 +576,7 @@ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
|
|
|
570
576
|
// const SUSPENSE_PENDING_START_DATA = '$?';
|
|
571
577
|
// const SUSPENSE_FALLBACK_START_DATA = '$!';
|
|
572
578
|
//
|
|
573
|
-
// function clientRenderBoundary(suspenseBoundaryID) {
|
|
579
|
+
// function clientRenderBoundary(suspenseBoundaryID, errorHash, errorMsg, errorComponentStack) {
|
|
574
580
|
// // Find the fallback's first element.
|
|
575
581
|
// const suspenseIdNode = document.getElementById(suspenseBoundaryID);
|
|
576
582
|
// if (!suspenseIdNode) {
|
|
@@ -582,6 +588,11 @@ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
|
|
|
582
588
|
// const suspenseNode = suspenseIdNode.previousSibling;
|
|
583
589
|
// // Tag it to be client rendered.
|
|
584
590
|
// suspenseNode.data = SUSPENSE_FALLBACK_START_DATA;
|
|
591
|
+
// // assign error metadata to first sibling
|
|
592
|
+
// let dataset = suspenseIdNode.dataset;
|
|
593
|
+
// if (errorHash) dataset.hash = errorHash;
|
|
594
|
+
// if (errorMsg) dataset.msg = errorMsg;
|
|
595
|
+
// if (errorComponentStack) dataset.stack = errorComponentStack;
|
|
585
596
|
// // Tell React to retry it if the parent already hydrated.
|
|
586
597
|
// if (suspenseNode._reactRetry) {
|
|
587
598
|
// suspenseNode._reactRetry();
|
|
@@ -665,7 +676,7 @@ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
|
|
|
665
676
|
|
|
666
677
|
var completeSegmentFunction = 'function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)}';
|
|
667
678
|
var completeBoundaryFunction = 'function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}}';
|
|
668
|
-
var clientRenderFunction = 'function $RX(
|
|
679
|
+
var clientRenderFunction = 'function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.hash=c),d&&(a.msg=d),e&&(a.stack=e),b._reactRetry&&b._reactRetry())}';
|
|
669
680
|
var completeSegmentScript1Full = stringToPrecomputedChunk(completeSegmentFunction + ';$RS("');
|
|
670
681
|
var completeSegmentScript1Partial = stringToPrecomputedChunk('$RS("');
|
|
671
682
|
var completeSegmentScript2 = stringToPrecomputedChunk('","');
|
|
@@ -676,7 +687,9 @@ var completeBoundaryScript2 = stringToPrecomputedChunk('","');
|
|
|
676
687
|
var completeBoundaryScript3 = stringToPrecomputedChunk('")</script>');
|
|
677
688
|
var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderFunction + ';$RX("');
|
|
678
689
|
var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
|
|
679
|
-
var
|
|
690
|
+
var clientRenderScript1A = stringToPrecomputedChunk('"');
|
|
691
|
+
var clientRenderScript2 = stringToPrecomputedChunk(')</script>');
|
|
692
|
+
var clientRenderErrorScriptArgInterstitial = stringToPrecomputedChunk(',');
|
|
680
693
|
|
|
681
694
|
var rendererSigil;
|
|
682
695
|
|
|
@@ -1004,13 +1017,13 @@ function attemptResolveElement(type, key, ref, props) {
|
|
|
1004
1017
|
throw new Error('Refs cannot be used in server components, nor passed to client components.');
|
|
1005
1018
|
}
|
|
1006
1019
|
|
|
1007
|
-
if (getModuleReference(type)) {
|
|
1008
|
-
// This is a reference to a client component.
|
|
1009
|
-
return [REACT_ELEMENT_TYPE, type, key, props];
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
1020
|
if (typeof type === 'function') {
|
|
1013
|
-
|
|
1021
|
+
if (isModuleReference(type)) {
|
|
1022
|
+
// This is a reference to a client component.
|
|
1023
|
+
return [REACT_ELEMENT_TYPE, type, key, props];
|
|
1024
|
+
} // This is a server-side component.
|
|
1025
|
+
|
|
1026
|
+
|
|
1014
1027
|
return type(props);
|
|
1015
1028
|
} else if (typeof type === 'string') {
|
|
1016
1029
|
// This is a host element. E.g. HTML.
|
|
@@ -1028,6 +1041,11 @@ function attemptResolveElement(type, key, ref, props) {
|
|
|
1028
1041
|
|
|
1029
1042
|
return [REACT_ELEMENT_TYPE, type, key, props];
|
|
1030
1043
|
} else if (type != null && typeof type === 'object') {
|
|
1044
|
+
if (isModuleReference(type)) {
|
|
1045
|
+
// This is a reference to a client component.
|
|
1046
|
+
return [REACT_ELEMENT_TYPE, type, key, props];
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1031
1049
|
switch (type.$$typeof) {
|
|
1032
1050
|
case REACT_LAZY_TYPE:
|
|
1033
1051
|
{
|
|
@@ -1354,59 +1372,56 @@ function resolveModelToJSON(request, parent, key, value) {
|
|
|
1354
1372
|
}
|
|
1355
1373
|
}
|
|
1356
1374
|
|
|
1357
|
-
if (value
|
|
1358
|
-
return
|
|
1375
|
+
if (value == null) {
|
|
1376
|
+
return value;
|
|
1359
1377
|
}
|
|
1360
1378
|
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
return serializeByValueID(existingId);
|
|
1379
|
-
}
|
|
1379
|
+
if (typeof value === 'object' || isModuleReference(value)) {
|
|
1380
|
+
if (isModuleReference(value)) {
|
|
1381
|
+
var moduleReference = value;
|
|
1382
|
+
var moduleKey = getModuleKey(moduleReference);
|
|
1383
|
+
var writtenModules = request.writtenModules;
|
|
1384
|
+
var existingId = writtenModules.get(moduleKey);
|
|
1385
|
+
|
|
1386
|
+
if (existingId !== undefined) {
|
|
1387
|
+
if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
|
|
1388
|
+
// If we're encoding the "type" of an element, we can refer
|
|
1389
|
+
// to that by a lazy reference instead of directly since React
|
|
1390
|
+
// knows how to deal with lazy values. This lets us suspend
|
|
1391
|
+
// on this component rather than its parent until the code has
|
|
1392
|
+
// loaded.
|
|
1393
|
+
return serializeByRefID(existingId);
|
|
1394
|
+
}
|
|
1380
1395
|
|
|
1381
|
-
|
|
1382
|
-
var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
|
|
1383
|
-
request.pendingChunks++;
|
|
1384
|
-
var moduleId = request.nextChunkId++;
|
|
1385
|
-
emitModuleChunk(request, moduleId, moduleMetaData);
|
|
1386
|
-
writtenModules.set(moduleKey, moduleId);
|
|
1387
|
-
|
|
1388
|
-
if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
|
|
1389
|
-
// If we're encoding the "type" of an element, we can refer
|
|
1390
|
-
// to that by a lazy reference instead of directly since React
|
|
1391
|
-
// knows how to deal with lazy values. This lets us suspend
|
|
1392
|
-
// on this component rather than its parent until the code has
|
|
1393
|
-
// loaded.
|
|
1394
|
-
return serializeByRefID(moduleId);
|
|
1396
|
+
return serializeByValueID(existingId);
|
|
1395
1397
|
}
|
|
1396
1398
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1399
|
+
try {
|
|
1400
|
+
var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
|
|
1401
|
+
request.pendingChunks++;
|
|
1402
|
+
var moduleId = request.nextChunkId++;
|
|
1403
|
+
emitModuleChunk(request, moduleId, moduleMetaData);
|
|
1404
|
+
writtenModules.set(moduleKey, moduleId);
|
|
1405
|
+
|
|
1406
|
+
if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
|
|
1407
|
+
// If we're encoding the "type" of an element, we can refer
|
|
1408
|
+
// to that by a lazy reference instead of directly since React
|
|
1409
|
+
// knows how to deal with lazy values. This lets us suspend
|
|
1410
|
+
// on this component rather than its parent until the code has
|
|
1411
|
+
// loaded.
|
|
1412
|
+
return serializeByRefID(moduleId);
|
|
1413
|
+
}
|
|
1400
1414
|
|
|
1401
|
-
|
|
1415
|
+
return serializeByValueID(moduleId);
|
|
1416
|
+
} catch (x) {
|
|
1417
|
+
request.pendingChunks++;
|
|
1402
1418
|
|
|
1403
|
-
|
|
1404
|
-
return serializeByValueID(_errorId);
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1419
|
+
var _errorId = request.nextChunkId++;
|
|
1407
1420
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1421
|
+
emitErrorChunk(request, _errorId, x);
|
|
1422
|
+
return serializeByValueID(_errorId);
|
|
1423
|
+
}
|
|
1424
|
+
} else if (value.$$typeof === REACT_PROVIDER_TYPE) {
|
|
1410
1425
|
var providerKey = value._context._globalName;
|
|
1411
1426
|
var writtenProviders = request.writtenProviders;
|
|
1412
1427
|
var providerId = writtenProviders.get(key);
|
|
@@ -1435,7 +1450,7 @@ function resolveModelToJSON(request, parent, key, value) {
|
|
|
1435
1450
|
// Verify that this is a simple plain object.
|
|
1436
1451
|
if (objectName(value) !== 'Object') {
|
|
1437
1452
|
error('Only plain objects can be passed to client components from server components. ' + 'Built-ins like %s are not supported. ' + 'Remove %s from these props: %s', objectName(value), describeKeyForErrorMessage(key), describeObjectForErrorMessage(parent));
|
|
1438
|
-
} else if (!isSimpleObject(value)) {
|
|
1453
|
+
} else if (typeof value === 'object' && !isSimpleObject(value)) {
|
|
1439
1454
|
error('Only plain objects can be passed to client components from server components. ' + 'Classes or other objects with methods are not supported. ' + 'Remove %s from these props: %s', describeKeyForErrorMessage(key), describeObjectForErrorMessage(parent, key));
|
|
1440
1455
|
} else if (Object.getOwnPropertySymbols) {
|
|
1441
1456
|
var symbols = Object.getOwnPropertySymbols(value);
|
|
@@ -1744,6 +1759,9 @@ function renderToReadableStream(model, options, context) {
|
|
|
1744
1759
|
startFlowing(request, controller);
|
|
1745
1760
|
},
|
|
1746
1761
|
cancel: function (reason) {}
|
|
1762
|
+
}, // $FlowFixMe size() methods are not allowed on byte streams.
|
|
1763
|
+
{
|
|
1764
|
+
highWaterMark: 0
|
|
1747
1765
|
});
|
|
1748
1766
|
return stream;
|
|
1749
1767
|
}
|