@shopify/hydrogen 2026.4.5 → 2026.10.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -13
- package/bin/hydrogen.mjs +7 -0
- package/dist/cli/index.mjs +330 -0
- package/dist/client/client.d.mts +34 -0
- package/dist/client/client.mjs +193 -0
- package/dist/client/client.mjs.map +1 -0
- package/dist/client/errors.d.mts +48 -0
- package/dist/client/errors.mjs +52 -0
- package/dist/client/errors.mjs.map +1 -0
- package/dist/client/index.d.mts +4 -0
- package/dist/client/types.d.mts +147 -0
- package/dist/core/analytics/cart-tracker.d.mts +8 -0
- package/dist/core/analytics/cart-tracker.mjs +144 -0
- package/dist/core/analytics/cart-tracker.mjs.map +1 -0
- package/dist/core/analytics/events.d.mts +15 -0
- package/dist/core/analytics/events.mjs +15 -0
- package/dist/core/analytics/events.mjs.map +1 -0
- package/dist/core/analytics/index.d.mts +3 -0
- package/dist/core/analytics/types.d.mts +143 -0
- package/dist/core/analytics/utils/flatten-connection.d.mts +19 -0
- package/dist/core/analytics/utils/flatten-connection.mjs +25 -0
- package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -0
- package/dist/core/cache/cache-status.mjs +17 -0
- package/dist/core/cache/cache-status.mjs.map +1 -0
- package/dist/core/cache/fetch-with-cache.d.mts +43 -0
- package/dist/core/cache/fetch-with-cache.mjs +188 -0
- package/dist/core/cache/fetch-with-cache.mjs.map +1 -0
- package/dist/core/cache/key.d.mts +6 -0
- package/dist/core/cache/key.mjs +27 -0
- package/dist/core/cache/key.mjs.map +1 -0
- package/dist/core/cache/run-with-cache.d.mts +36 -0
- package/dist/core/cache/run-with-cache.mjs +114 -0
- package/dist/core/cache/run-with-cache.mjs.map +1 -0
- package/dist/core/cache/store.d.mts +19 -0
- package/dist/core/cache/store.mjs +62 -0
- package/dist/core/cache/store.mjs.map +1 -0
- package/dist/core/cache/strategies.d.mts +39 -0
- package/dist/core/cache/strategies.mjs +70 -0
- package/dist/core/cache/strategies.mjs.map +1 -0
- package/dist/core/cart/actions.d.mts +50 -0
- package/dist/core/cart/actions.mjs +240 -0
- package/dist/core/cart/actions.mjs.map +1 -0
- package/dist/core/cart/attach-quantity-input.d.mts +5 -0
- package/dist/core/cart/attach-quantity-input.mjs +17 -0
- package/dist/core/cart/attach-quantity-input.mjs.map +1 -0
- package/dist/core/cart/buyer-identity-sync.d.mts +23 -0
- package/dist/core/cart/buyer-identity-sync.mjs +9 -0
- package/dist/core/cart/buyer-identity-sync.mjs.map +1 -0
- package/dist/core/cart/cart.d.mts +32 -0
- package/dist/core/cart/cart.mjs +1687 -0
- package/dist/core/cart/cart.mjs.map +1 -0
- package/dist/core/cart/cookie.d.mts +5 -0
- package/dist/core/cart/cookie.mjs +28 -0
- package/dist/core/cart/cookie.mjs.map +1 -0
- package/dist/core/cart/form.d.mts +130 -0
- package/dist/core/cart/form.mjs +75 -0
- package/dist/core/cart/form.mjs.map +1 -0
- package/dist/core/cart/get-cart.d.mts +25 -0
- package/dist/core/cart/get-cart.mjs +32 -0
- package/dist/core/cart/get-cart.mjs.map +1 -0
- package/dist/core/cart/index.d.mts +10 -0
- package/dist/core/cart/quantity.d.mts +10 -0
- package/dist/core/cart/quantity.mjs +14 -0
- package/dist/core/cart/quantity.mjs.map +1 -0
- package/dist/core/cart/queries.d.mts +4296 -0
- package/dist/core/cart/queries.mjs +70 -0
- package/dist/core/cart/queries.mjs.map +1 -0
- package/dist/core/cart/server-handlers.d.mts +82 -0
- package/dist/core/cart/server-handlers.mjs +322 -0
- package/dist/core/cart/server-handlers.mjs.map +1 -0
- package/dist/core/cart/state.d.mts +137 -0
- package/dist/core/cart/state.mjs +76 -0
- package/dist/core/cart/state.mjs.map +1 -0
- package/dist/core/cart/sync-quantity-inputs.mjs +16 -0
- package/dist/core/cart/sync-quantity-inputs.mjs.map +1 -0
- package/dist/core/collection/collection.d.mts +134 -0
- package/dist/core/collection/collection.mjs +170 -0
- package/dist/core/collection/collection.mjs.map +1 -0
- package/dist/core/collection/index.d.mts +6 -0
- package/dist/core/collection/reconciler.d.mts +32 -0
- package/dist/core/collection/reconciler.mjs +89 -0
- package/dist/core/collection/reconciler.mjs.map +1 -0
- package/dist/core/collection/state.d.mts +66 -0
- package/dist/core/collection/state.mjs +20 -0
- package/dist/core/collection/state.mjs.map +1 -0
- package/dist/core/collection/url.d.mts +70 -0
- package/dist/core/collection/url.mjs +367 -0
- package/dist/core/collection/url.mjs.map +1 -0
- package/dist/core/constants.d.mts +5 -0
- package/dist/core/constants.mjs +8 -0
- package/dist/core/constants.mjs.map +1 -0
- package/dist/core/headers.mjs +44 -0
- package/dist/core/headers.mjs.map +1 -0
- package/dist/core/index.d.mts +55 -0
- package/dist/core/index.mjs +44 -0
- package/dist/core/logging/logging.d.mts +21 -0
- package/dist/core/logging/logging.mjs +99 -0
- package/dist/core/logging/logging.mjs.map +1 -0
- package/dist/core/logging/types.d.mts +40 -0
- package/dist/core/logging/types.mjs +18 -0
- package/dist/core/logging/types.mjs.map +1 -0
- package/dist/core/money/cache.mjs +25 -0
- package/dist/core/money/cache.mjs.map +1 -0
- package/dist/core/money/format.d.mts +15 -0
- package/dist/core/money/format.mjs +243 -0
- package/dist/core/money/format.mjs.map +1 -0
- package/dist/core/money/types.d.mts +47 -0
- package/dist/core/observable.mjs +46 -0
- package/dist/core/observable.mjs.map +1 -0
- package/dist/core/predictive-search/constants.d.mts +5 -0
- package/dist/core/predictive-search/constants.mjs +6 -0
- package/dist/core/predictive-search/constants.mjs.map +1 -0
- package/dist/core/predictive-search/form.d.mts +31 -0
- package/dist/core/predictive-search/form.mjs +31 -0
- package/dist/core/predictive-search/form.mjs.map +1 -0
- package/dist/core/predictive-search/index.d.mts +6 -0
- package/dist/core/predictive-search/queries.d.mts +118 -0
- package/dist/core/predictive-search/queries.mjs +81 -0
- package/dist/core/predictive-search/queries.mjs.map +1 -0
- package/dist/core/predictive-search/search.d.mts +32 -0
- package/dist/core/predictive-search/search.mjs +74 -0
- package/dist/core/predictive-search/search.mjs.map +1 -0
- package/dist/core/predictive-search/server-handlers.d.mts +36 -0
- package/dist/core/predictive-search/server-handlers.mjs +113 -0
- package/dist/core/predictive-search/server-handlers.mjs.map +1 -0
- package/dist/core/predictive-search/store.d.mts +44 -0
- package/dist/core/predictive-search/store.mjs +224 -0
- package/dist/core/predictive-search/store.mjs.map +1 -0
- package/dist/core/predictive-search/url.d.mts +41 -0
- package/dist/core/predictive-search/url.mjs +71 -0
- package/dist/core/predictive-search/url.mjs.map +1 -0
- package/dist/core/product/form.d.mts +63 -0
- package/dist/core/product/form.mjs +44 -0
- package/dist/core/product/form.mjs.map +1 -0
- package/dist/core/product/index.d.mts +4 -0
- package/dist/core/product/options.d.mts +40 -0
- package/dist/core/product/options.mjs +291 -0
- package/dist/core/product/options.mjs.map +1 -0
- package/dist/core/product/product-form.d.mts +72 -0
- package/dist/core/product/product-form.mjs +158 -0
- package/dist/core/product/product-form.mjs.map +1 -0
- package/dist/core/product/state.d.mts +68 -0
- package/dist/core/request-context.d.mts +70 -0
- package/dist/core/request-context.mjs +120 -0
- package/dist/core/request-context.mjs.map +1 -0
- package/dist/core/request-routing/handle-shopify-redirects.d.mts +17 -0
- package/dist/core/request-routing/handle-shopify-redirects.mjs +31 -0
- package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -0
- package/dist/core/request-routing/handle-shopify-routes.d.mts +14 -0
- package/dist/core/request-routing/handle-shopify-routes.mjs +42 -0
- package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/admin-redirect.mjs +12 -0
- package/dist/core/request-routing/interceptors/admin-redirect.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/agent-proxy.mjs +19 -0
- package/dist/core/request-routing/interceptors/agent-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/ajax-api.mjs +16 -0
- package/dist/core/request-routing/interceptors/ajax-api.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/api-proxy.mjs +20 -0
- package/dist/core/request-routing/interceptors/api-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/checkout.mjs +58 -0
- package/dist/core/request-routing/interceptors/checkout.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/mcp-proxy.mjs +23 -0
- package/dist/core/request-routing/interceptors/mcp-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/proxy.mjs +68 -0
- package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/query-param-redirect.mjs +22 -0
- package/dist/core/request-routing/interceptors/query-param-redirect.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/sfapi-proxy.mjs +27 -0
- package/dist/core/request-routing/interceptors/sfapi-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/standard-routes.mjs +19 -0
- package/dist/core/request-routing/interceptors/standard-routes.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/url-redirects.mjs +27 -0
- package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/well-known.mjs +19 -0
- package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -0
- package/dist/core/request-routing/registered-routes.d.mts +7 -0
- package/dist/core/request-routing/registered-routes.mjs +59 -0
- package/dist/core/request-routing/registered-routes.mjs.map +1 -0
- package/dist/core/request-routing/route-types.d.mts +51 -0
- package/dist/core/request-routing/safe-apply-response-headers.mjs +16 -0
- package/dist/core/request-routing/safe-apply-response-headers.mjs.map +1 -0
- package/dist/core/shop-pay/shop-pay.d.mts +102 -0
- package/dist/core/shop-pay/shop-pay.mjs +289 -0
- package/dist/core/shop-pay/shop-pay.mjs.map +1 -0
- package/dist/core/shopify-scripts/analytics.mjs +26 -0
- package/dist/core/shopify-scripts/analytics.mjs.map +1 -0
- package/dist/core/shopify-scripts/consent.mjs +17 -0
- package/dist/core/shopify-scripts/consent.mjs.map +1 -0
- package/dist/core/shopify-scripts/constants.mjs +19 -0
- package/dist/core/shopify-scripts/constants.mjs.map +1 -0
- package/dist/core/shopify-scripts/deprecated-cookies.mjs +97 -0
- package/dist/core/shopify-scripts/deprecated-cookies.mjs.map +1 -0
- package/dist/core/shopify-scripts/global.d.mts +1 -0
- package/dist/core/shopify-scripts/global.mjs +86 -0
- package/dist/core/shopify-scripts/global.mjs.map +1 -0
- package/dist/core/shopify-scripts/index.d.mts +27 -0
- package/dist/core/shopify-scripts/index.mjs +135 -0
- package/dist/core/shopify-scripts/index.mjs.map +1 -0
- package/dist/core/shopify-scripts/initialize.d.mts +18 -0
- package/dist/core/shopify-scripts/initialize.mjs +27 -0
- package/dist/core/shopify-scripts/initialize.mjs.map +1 -0
- package/dist/core/shopify-scripts/page-view.mjs +49 -0
- package/dist/core/shopify-scripts/page-view.mjs.map +1 -0
- package/dist/core/shopify-scripts/perfkit.mjs +33 -0
- package/dist/core/shopify-scripts/perfkit.mjs.map +1 -0
- package/dist/core/shopify-scripts/render.d.mts +1 -0
- package/dist/core/shopify-scripts/render.mjs +23 -0
- package/dist/core/shopify-scripts/render.mjs.map +1 -0
- package/dist/core/shopify-scripts/types.d.mts +76 -0
- package/dist/core/shopify-scripts/utils/cookie-domain.mjs +43 -0
- package/dist/core/shopify-scripts/utils/cookie-domain.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/inline-script.mjs +8 -0
- package/dist/core/shopify-scripts/utils/inline-script.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/navigation.mjs +46 -0
- package/dist/core/shopify-scripts/utils/navigation.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/tracking-values.mjs +65 -0
- package/dist/core/shopify-scripts/utils/tracking-values.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/uuid.mjs +17 -0
- package/dist/core/shopify-scripts/utils/uuid.mjs.map +1 -0
- package/dist/core/shopify-scripts/webmcp.mjs +22 -0
- package/dist/core/shopify-scripts/webmcp.mjs.map +1 -0
- package/dist/core/standard-routes/build.d.mts +34 -0
- package/dist/core/standard-routes/build.mjs +54 -0
- package/dist/core/standard-routes/build.mjs.map +1 -0
- package/dist/core/standard-routes/defaults.mjs +31 -0
- package/dist/core/standard-routes/defaults.mjs.map +1 -0
- package/dist/core/standard-routes/match.mjs +108 -0
- package/dist/core/standard-routes/match.mjs.map +1 -0
- package/dist/core/standard-routes/path.mjs +58 -0
- package/dist/core/standard-routes/path.mjs.map +1 -0
- package/dist/core/standard-routes/redirects.mjs +51 -0
- package/dist/core/standard-routes/redirects.mjs.map +1 -0
- package/dist/core/standard-routes/types.d.mts +95 -0
- package/dist/core/url.mjs +35 -0
- package/dist/core/url.mjs.map +1 -0
- package/dist/core/utils/load-script.mjs +34 -0
- package/dist/core/utils/load-script.mjs.map +1 -0
- package/dist/core/utils/parse-gid.mjs +33 -0
- package/dist/core/utils/parse-gid.mjs.map +1 -0
- package/dist/core/utils/record.mjs +8 -0
- package/dist/core/utils/record.mjs.map +1 -0
- package/dist/customer-account/client.d.mts +50 -0
- package/dist/customer-account/client.mjs +239 -0
- package/dist/customer-account/client.mjs.map +1 -0
- package/dist/customer-account/errors.d.mts +28 -0
- package/dist/customer-account/errors.mjs +39 -0
- package/dist/customer-account/errors.mjs.map +1 -0
- package/dist/customer-account/graphql.d.mts +29 -0
- package/dist/customer-account/graphql.mjs +39 -0
- package/dist/customer-account/graphql.mjs.map +1 -0
- package/dist/customer-account/index.d.mts +7 -0
- package/dist/customer-account/index.mjs +7 -0
- package/dist/customer-account/session.d.mts +117 -0
- package/dist/customer-account/session.mjs +733 -0
- package/dist/customer-account/session.mjs.map +1 -0
- package/dist/customer-account/type-resolver.d.mts +11 -0
- package/dist/customer-account-api-types.d.ts +3269 -3270
- package/dist/customer-account.schema.json +50753 -1
- package/dist/development/_virtual/_@oxc-project_runtime@0.127.0/helpers/taggedTemplateLiteral.mjs +7 -0
- package/dist/development/client/client.d.mts +34 -0
- package/dist/development/client/client.mjs +193 -0
- package/dist/development/client/client.mjs.map +1 -0
- package/dist/development/client/errors.d.mts +48 -0
- package/dist/development/client/errors.mjs +57 -0
- package/dist/development/client/errors.mjs.map +1 -0
- package/dist/development/client/index.d.mts +4 -0
- package/dist/development/client/types.d.mts +147 -0
- package/dist/development/core/analytics/cart-tracker.d.mts +8 -0
- package/dist/development/core/analytics/cart-tracker.mjs +144 -0
- package/dist/development/core/analytics/cart-tracker.mjs.map +1 -0
- package/dist/development/core/analytics/events.d.mts +15 -0
- package/dist/development/core/analytics/events.mjs +15 -0
- package/dist/development/core/analytics/events.mjs.map +1 -0
- package/dist/development/core/analytics/index.d.mts +3 -0
- package/dist/development/core/analytics/types.d.mts +143 -0
- package/dist/development/core/analytics/utils/flatten-connection.d.mts +19 -0
- package/dist/development/core/analytics/utils/flatten-connection.mjs +25 -0
- package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -0
- package/dist/development/core/cache/cache-status.mjs +17 -0
- package/dist/development/core/cache/cache-status.mjs.map +1 -0
- package/dist/development/core/cache/fetch-with-cache.d.mts +43 -0
- package/dist/development/core/cache/fetch-with-cache.mjs +188 -0
- package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -0
- package/dist/development/core/cache/key.d.mts +6 -0
- package/dist/development/core/cache/key.mjs +27 -0
- package/dist/development/core/cache/key.mjs.map +1 -0
- package/dist/development/core/cache/run-with-cache.d.mts +36 -0
- package/dist/development/core/cache/run-with-cache.mjs +114 -0
- package/dist/development/core/cache/run-with-cache.mjs.map +1 -0
- package/dist/development/core/cache/store.d.mts +19 -0
- package/dist/development/core/cache/store.mjs +62 -0
- package/dist/development/core/cache/store.mjs.map +1 -0
- package/dist/development/core/cache/strategies.d.mts +39 -0
- package/dist/development/core/cache/strategies.mjs +70 -0
- package/dist/development/core/cache/strategies.mjs.map +1 -0
- package/dist/development/core/cart/actions.d.mts +50 -0
- package/dist/development/core/cart/actions.mjs +240 -0
- package/dist/development/core/cart/actions.mjs.map +1 -0
- package/dist/development/core/cart/attach-quantity-input.d.mts +5 -0
- package/dist/development/core/cart/attach-quantity-input.mjs +17 -0
- package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -0
- package/dist/development/core/cart/buyer-identity-sync.d.mts +19 -0
- package/dist/development/core/cart/buyer-identity-sync.mjs +6 -0
- package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -0
- package/dist/development/core/cart/cart.d.mts +32 -0
- package/dist/development/core/cart/cart.mjs +1687 -0
- package/dist/development/core/cart/cart.mjs.map +1 -0
- package/dist/development/core/cart/cookie.d.mts +5 -0
- package/dist/development/core/cart/cookie.mjs +28 -0
- package/dist/development/core/cart/cookie.mjs.map +1 -0
- package/dist/development/core/cart/form.d.mts +130 -0
- package/dist/development/core/cart/form.mjs +75 -0
- package/dist/development/core/cart/form.mjs.map +1 -0
- package/dist/development/core/cart/get-cart.d.mts +25 -0
- package/dist/development/core/cart/get-cart.mjs +32 -0
- package/dist/development/core/cart/get-cart.mjs.map +1 -0
- package/dist/development/core/cart/index.d.mts +10 -0
- package/dist/development/core/cart/quantity.d.mts +10 -0
- package/dist/development/core/cart/quantity.mjs +14 -0
- package/dist/development/core/cart/quantity.mjs.map +1 -0
- package/dist/development/core/cart/queries.d.mts +4296 -0
- package/dist/development/core/cart/queries.mjs +70 -0
- package/dist/development/core/cart/queries.mjs.map +1 -0
- package/dist/development/core/cart/server-handlers.d.mts +82 -0
- package/dist/development/core/cart/server-handlers.mjs +322 -0
- package/dist/development/core/cart/server-handlers.mjs.map +1 -0
- package/dist/development/core/cart/state.d.mts +137 -0
- package/dist/development/core/cart/state.mjs +76 -0
- package/dist/development/core/cart/state.mjs.map +1 -0
- package/dist/development/core/cart/sync-quantity-inputs.mjs +16 -0
- package/dist/development/core/cart/sync-quantity-inputs.mjs.map +1 -0
- package/dist/development/core/collection/collection.d.mts +134 -0
- package/dist/development/core/collection/collection.mjs +170 -0
- package/dist/development/core/collection/collection.mjs.map +1 -0
- package/dist/development/core/collection/index.d.mts +6 -0
- package/dist/development/core/collection/reconciler.d.mts +32 -0
- package/dist/development/core/collection/reconciler.mjs +89 -0
- package/dist/development/core/collection/reconciler.mjs.map +1 -0
- package/dist/development/core/collection/state.d.mts +66 -0
- package/dist/development/core/collection/state.mjs +20 -0
- package/dist/development/core/collection/state.mjs.map +1 -0
- package/dist/development/core/collection/url.d.mts +70 -0
- package/dist/development/core/collection/url.mjs +367 -0
- package/dist/development/core/collection/url.mjs.map +1 -0
- package/dist/development/core/constants.mjs +7 -0
- package/dist/development/core/constants.mjs.map +1 -0
- package/dist/development/core/development.d.mts +55 -0
- package/dist/development/core/development.mjs +44 -0
- package/dist/development/core/headers.mjs +44 -0
- package/dist/development/core/headers.mjs.map +1 -0
- package/dist/development/core/index.d.mts +53 -0
- package/dist/development/core/logging/logging.d.mts +21 -0
- package/dist/development/core/logging/logging.mjs +99 -0
- package/dist/development/core/logging/logging.mjs.map +1 -0
- package/dist/development/core/logging/types.d.mts +40 -0
- package/dist/development/core/logging/types.mjs +18 -0
- package/dist/development/core/logging/types.mjs.map +1 -0
- package/dist/development/core/money/cache.mjs +25 -0
- package/dist/development/core/money/cache.mjs.map +1 -0
- package/dist/development/core/money/format.d.mts +15 -0
- package/dist/development/core/money/format.mjs +243 -0
- package/dist/development/core/money/format.mjs.map +1 -0
- package/dist/development/core/money/types.d.mts +47 -0
- package/dist/development/core/observable.mjs +46 -0
- package/dist/development/core/observable.mjs.map +1 -0
- package/dist/development/core/predictive-search/constants.d.mts +5 -0
- package/dist/development/core/predictive-search/constants.mjs +6 -0
- package/dist/development/core/predictive-search/constants.mjs.map +1 -0
- package/dist/development/core/predictive-search/form.d.mts +31 -0
- package/dist/development/core/predictive-search/form.mjs +31 -0
- package/dist/development/core/predictive-search/form.mjs.map +1 -0
- package/dist/development/core/predictive-search/index.d.mts +6 -0
- package/dist/development/core/predictive-search/queries.d.mts +118 -0
- package/dist/development/core/predictive-search/queries.mjs +81 -0
- package/dist/development/core/predictive-search/queries.mjs.map +1 -0
- package/dist/development/core/predictive-search/search.d.mts +32 -0
- package/dist/development/core/predictive-search/search.mjs +74 -0
- package/dist/development/core/predictive-search/search.mjs.map +1 -0
- package/dist/development/core/predictive-search/server-handlers.d.mts +36 -0
- package/dist/development/core/predictive-search/server-handlers.mjs +113 -0
- package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -0
- package/dist/development/core/predictive-search/store.d.mts +44 -0
- package/dist/development/core/predictive-search/store.mjs +224 -0
- package/dist/development/core/predictive-search/store.mjs.map +1 -0
- package/dist/development/core/predictive-search/url.d.mts +41 -0
- package/dist/development/core/predictive-search/url.mjs +71 -0
- package/dist/development/core/predictive-search/url.mjs.map +1 -0
- package/dist/development/core/product/form.d.mts +63 -0
- package/dist/development/core/product/form.mjs +44 -0
- package/dist/development/core/product/form.mjs.map +1 -0
- package/dist/development/core/product/index.d.mts +4 -0
- package/dist/development/core/product/options.d.mts +40 -0
- package/dist/development/core/product/options.mjs +291 -0
- package/dist/development/core/product/options.mjs.map +1 -0
- package/dist/development/core/product/product-form.d.mts +72 -0
- package/dist/development/core/product/product-form.mjs +158 -0
- package/dist/development/core/product/product-form.mjs.map +1 -0
- package/dist/development/core/product/state.d.mts +68 -0
- package/dist/development/core/request-context.d.mts +70 -0
- package/dist/development/core/request-context.mjs +120 -0
- package/dist/development/core/request-context.mjs.map +1 -0
- package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +17 -0
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs +31 -0
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -0
- package/dist/development/core/request-routing/handle-shopify-routes.d.mts +1 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +11 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +16 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -0
- package/dist/development/core/request-routing/handle-shopify-routes.mjs +42 -0
- package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/admin-redirect.mjs +12 -0
- package/dist/development/core/request-routing/interceptors/admin-redirect.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/agent-proxy.mjs +19 -0
- package/dist/development/core/request-routing/interceptors/agent-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/ajax-api.mjs +16 -0
- package/dist/development/core/request-routing/interceptors/ajax-api.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/api-proxy.mjs +20 -0
- package/dist/development/core/request-routing/interceptors/api-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/checkout.mjs +58 -0
- package/dist/development/core/request-routing/interceptors/checkout.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/graphiql.mjs +46 -0
- package/dist/development/core/request-routing/interceptors/graphiql.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/mcp-proxy.mjs +23 -0
- package/dist/development/core/request-routing/interceptors/mcp-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/proxy.mjs +68 -0
- package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/query-param-redirect.mjs +22 -0
- package/dist/development/core/request-routing/interceptors/query-param-redirect.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/sfapi-proxy.mjs +27 -0
- package/dist/development/core/request-routing/interceptors/sfapi-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/standard-routes.mjs +19 -0
- package/dist/development/core/request-routing/interceptors/standard-routes.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs +27 -0
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/well-known.mjs +19 -0
- package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -0
- package/dist/development/core/request-routing/registered-routes.d.mts +7 -0
- package/dist/development/core/request-routing/registered-routes.mjs +59 -0
- package/dist/development/core/request-routing/registered-routes.mjs.map +1 -0
- package/dist/development/core/request-routing/route-types.d.mts +51 -0
- package/dist/development/core/request-routing/safe-apply-response-headers.mjs +16 -0
- package/dist/development/core/request-routing/safe-apply-response-headers.mjs.map +1 -0
- package/dist/development/core/shop-pay/shop-pay.d.mts +102 -0
- package/dist/development/core/shop-pay/shop-pay.mjs +289 -0
- package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/analytics.mjs +26 -0
- package/dist/development/core/shopify-scripts/analytics.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/consent.mjs +17 -0
- package/dist/development/core/shopify-scripts/consent.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/constants.mjs +19 -0
- package/dist/development/core/shopify-scripts/constants.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/deprecated-cookies.mjs +97 -0
- package/dist/development/core/shopify-scripts/deprecated-cookies.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/global.d.mts +1 -0
- package/dist/development/core/shopify-scripts/global.mjs +86 -0
- package/dist/development/core/shopify-scripts/global.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/index.d.mts +27 -0
- package/dist/development/core/shopify-scripts/index.mjs +145 -0
- package/dist/development/core/shopify-scripts/index.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/initialize.d.mts +18 -0
- package/dist/development/core/shopify-scripts/initialize.mjs +27 -0
- package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/page-view.mjs +49 -0
- package/dist/development/core/shopify-scripts/page-view.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/perfkit.mjs +33 -0
- package/dist/development/core/shopify-scripts/perfkit.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/render.d.mts +1 -0
- package/dist/development/core/shopify-scripts/render.mjs +23 -0
- package/dist/development/core/shopify-scripts/render.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/types.d.mts +76 -0
- package/dist/development/core/shopify-scripts/utils/cookie-domain.mjs +43 -0
- package/dist/development/core/shopify-scripts/utils/cookie-domain.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/inline-script.mjs +8 -0
- package/dist/development/core/shopify-scripts/utils/inline-script.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/navigation.mjs +46 -0
- package/dist/development/core/shopify-scripts/utils/navigation.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/tracking-values.mjs +65 -0
- package/dist/development/core/shopify-scripts/utils/tracking-values.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/uuid.mjs +17 -0
- package/dist/development/core/shopify-scripts/utils/uuid.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/webmcp.mjs +22 -0
- package/dist/development/core/shopify-scripts/webmcp.mjs.map +1 -0
- package/dist/development/core/standard-routes/build.d.mts +34 -0
- package/dist/development/core/standard-routes/build.mjs +54 -0
- package/dist/development/core/standard-routes/build.mjs.map +1 -0
- package/dist/development/core/standard-routes/defaults.mjs +31 -0
- package/dist/development/core/standard-routes/defaults.mjs.map +1 -0
- package/dist/development/core/standard-routes/match.mjs +108 -0
- package/dist/development/core/standard-routes/match.mjs.map +1 -0
- package/dist/development/core/standard-routes/path.mjs +58 -0
- package/dist/development/core/standard-routes/path.mjs.map +1 -0
- package/dist/development/core/standard-routes/redirects.mjs +51 -0
- package/dist/development/core/standard-routes/redirects.mjs.map +1 -0
- package/dist/development/core/standard-routes/types.d.mts +95 -0
- package/dist/development/core/types.d.mts +11 -0
- package/dist/development/core/url.mjs +35 -0
- package/dist/development/core/url.mjs.map +1 -0
- package/dist/development/core/utils/load-script.mjs +34 -0
- package/dist/development/core/utils/load-script.mjs.map +1 -0
- package/dist/development/core/utils/parse-gid.mjs +33 -0
- package/dist/development/core/utils/parse-gid.mjs.map +1 -0
- package/dist/development/customer-account/session.d.mts +46 -0
- package/dist/development/customer-account/session.mjs +21 -0
- package/dist/development/customer-account/session.mjs.map +1 -0
- package/dist/development/globals.d.mts +64 -0
- package/dist/development/graphql/generated/customer-account-api-types.d.mts +13 -0
- package/dist/development/graphql/generated/graphql-env.d.mts +19280 -0
- package/dist/development/graphql/generated/storefront-api-types.d.mts +47 -0
- package/dist/development/graphql/graphql.d.mts +40 -0
- package/dist/development/graphql/graphql.mjs +16 -0
- package/dist/development/graphql/graphql.mjs.map +1 -0
- package/dist/development/graphql/index.d.mts +2 -0
- package/dist/development/graphql/scalars.d.mts +15 -0
- package/dist/development/graphql/type-resolver.d.mts +229 -0
- package/dist/development/react/cart.d.mts +40 -0
- package/dist/development/react/cart.mjs +150 -0
- package/dist/development/react/cart.mjs.map +1 -0
- package/dist/development/react/collection.d.mts +91 -0
- package/dist/development/react/collection.mjs +129 -0
- package/dist/development/react/collection.mjs.map +1 -0
- package/dist/development/react/index.d.mts +13 -0
- package/dist/development/react/index.mjs +10 -0
- package/dist/development/react/predictive-search.d.mts +49 -0
- package/dist/development/react/predictive-search.mjs +133 -0
- package/dist/development/react/predictive-search.mjs.map +1 -0
- package/dist/development/react/product.d.mts +72 -0
- package/dist/development/react/product.mjs +127 -0
- package/dist/development/react/product.mjs.map +1 -0
- package/dist/development/react/shop-pay.d.mts +9 -0
- package/dist/development/react/shop-pay.mjs +16 -0
- package/dist/development/react/shop-pay.mjs.map +1 -0
- package/dist/development/react/shopify-scripts.d.mts +20 -0
- package/dist/development/react/shopify-scripts.mjs +39 -0
- package/dist/development/react/shopify-scripts.mjs.map +1 -0
- package/dist/development/vendor/standard-actions.d.mts +134 -0
- package/dist/development/vendor/standard-events.d.mts +1107 -0
- package/dist/development/vue/cart.d.mts +42 -0
- package/dist/development/vue/cart.mjs +118 -0
- package/dist/development/vue/cart.mjs.map +1 -0
- package/dist/development/vue/collection.d.mts +46 -0
- package/dist/development/vue/collection.mjs +108 -0
- package/dist/development/vue/collection.mjs.map +1 -0
- package/dist/development/vue/index.d.mts +11 -0
- package/dist/development/vue/index.mjs +8 -0
- package/dist/development/vue/predictive-search.d.mts +124 -0
- package/dist/development/vue/predictive-search.mjs +171 -0
- package/dist/development/vue/predictive-search.mjs.map +1 -0
- package/dist/development/vue/product.d.mts +57 -0
- package/dist/development/vue/product.mjs +167 -0
- package/dist/development/vue/product.mjs.map +1 -0
- package/dist/development/vue/shop-pay.d.mts +25 -0
- package/dist/development/vue/shop-pay.mjs +35 -0
- package/dist/development/vue/shop-pay.mjs.map +1 -0
- package/dist/development/vue/shopify-scripts.d.mts +127 -0
- package/dist/development/vue/shopify-scripts.mjs +79 -0
- package/dist/development/vue/shopify-scripts.mjs.map +1 -0
- package/dist/globals.d.mts +64 -0
- package/dist/graphql/generated/customer-account-api-types.d.mts +13 -0
- package/dist/graphql/generated/customer-account-graphql-env.d.mts +22170 -0
- package/dist/graphql/generated/graphql-env.d.mts +19280 -0
- package/dist/graphql/generated/storefront-api-types.d.mts +47 -0
- package/dist/graphql/graphql.d.mts +40 -0
- package/dist/graphql/graphql.mjs +16 -0
- package/dist/graphql/graphql.mjs.map +1 -0
- package/dist/graphql/index.d.mts +2 -0
- package/dist/graphql/scalars.d.mts +26 -0
- package/dist/graphql/type-resolver.d.mts +229 -0
- package/dist/react/cart.d.mts +40 -0
- package/dist/react/cart.mjs +150 -0
- package/dist/react/cart.mjs.map +1 -0
- package/dist/react/collection.d.mts +91 -0
- package/dist/react/collection.mjs +129 -0
- package/dist/react/collection.mjs.map +1 -0
- package/dist/react/index.d.mts +13 -0
- package/dist/react/index.mjs +10 -0
- package/dist/react/predictive-search.d.mts +49 -0
- package/dist/react/predictive-search.mjs +133 -0
- package/dist/react/predictive-search.mjs.map +1 -0
- package/dist/react/product.d.mts +72 -0
- package/dist/react/product.mjs +127 -0
- package/dist/react/product.mjs.map +1 -0
- package/dist/react/shop-pay.d.mts +9 -0
- package/dist/react/shop-pay.mjs +16 -0
- package/dist/react/shop-pay.mjs.map +1 -0
- package/dist/react/shopify-scripts.d.mts +20 -0
- package/dist/react/shopify-scripts.mjs +39 -0
- package/dist/react/shopify-scripts.mjs.map +1 -0
- package/dist/storefront-api-types.d.ts +2351 -2390
- package/dist/storefront.schema.json +41534 -1
- package/dist/ts-plugin/index.cjs +68 -0
- package/dist/ts-plugin/index.cjs.map +1 -0
- package/dist/ts-plugin/index.d.cts +4 -0
- package/dist/vendor/standard-actions.d.mts +134 -0
- package/dist/vendor/standard-events.d.mts +1107 -0
- package/dist/vite/index.d.mts +2 -0
- package/dist/vite/index.mjs +3 -0
- package/dist/vite/local-https.d.mts +35 -0
- package/dist/vite/local-https.mjs +202 -0
- package/dist/vite/local-https.mjs.map +1 -0
- package/dist/vue/cart.d.mts +42 -0
- package/dist/vue/cart.mjs +118 -0
- package/dist/vue/cart.mjs.map +1 -0
- package/dist/vue/collection.d.mts +46 -0
- package/dist/vue/collection.mjs +108 -0
- package/dist/vue/collection.mjs.map +1 -0
- package/dist/vue/index.d.mts +11 -0
- package/dist/vue/index.mjs +8 -0
- package/dist/vue/predictive-search.d.mts +124 -0
- package/dist/vue/predictive-search.mjs +171 -0
- package/dist/vue/predictive-search.mjs.map +1 -0
- package/dist/vue/product.d.mts +57 -0
- package/dist/vue/product.mjs +167 -0
- package/dist/vue/product.mjs.map +1 -0
- package/dist/vue/shop-pay.d.mts +25 -0
- package/dist/vue/shop-pay.mjs +35 -0
- package/dist/vue/shop-pay.mjs.map +1 -0
- package/dist/vue/shopify-scripts.d.mts +127 -0
- package/dist/vue/shopify-scripts.mjs +79 -0
- package/dist/vue/shopify-scripts.mjs.map +1 -0
- package/package.json +116 -86
- package/skills/hydrogen-analytics/SKILL.md +80 -0
- package/skills/hydrogen-analytics/references/react.md +160 -0
- package/skills/hydrogen-analytics/references/vue.md +80 -0
- package/skills/hydrogen-cart-drawer/SKILL.md +248 -0
- package/skills/hydrogen-cart-drawer/references/accessibility.md +109 -0
- package/skills/hydrogen-cart-drawer/references/css.md +67 -0
- package/skills/hydrogen-cart-ui/SKILL.md +218 -0
- package/skills/hydrogen-cart-ui/references/nextjs.md +89 -0
- package/skills/hydrogen-cart-ui/references/react.md +263 -0
- package/skills/hydrogen-cart-ui/references/vue.md +204 -0
- package/skills/hydrogen-collection-browser/SKILL.md +80 -0
- package/skills/hydrogen-collection-browser/references/nextjs.md +118 -0
- package/skills/hydrogen-collection-browser/references/nuxt.md +108 -0
- package/skills/hydrogen-collection-browser/references/react.md +237 -0
- package/skills/hydrogen-customer-account/SKILL.md +107 -0
- package/skills/hydrogen-image/SKILL.md +65 -0
- package/skills/hydrogen-local-https/SKILL.md +144 -0
- package/skills/hydrogen-markets/SKILL.md +221 -0
- package/skills/hydrogen-markets/references/nextjs.md +157 -0
- package/skills/hydrogen-money/SKILL.md +67 -0
- package/skills/hydrogen-oxygen/SKILL.md +245 -0
- package/skills/hydrogen-oxygen/references/react-router.md +230 -0
- package/skills/hydrogen-predictive-search/SKILL.md +130 -0
- package/skills/hydrogen-predictive-search/references/react.md +32 -0
- package/skills/hydrogen-predictive-search/references/vue.md +40 -0
- package/skills/hydrogen-request-handlers/SKILL.md +90 -0
- package/skills/hydrogen-request-handlers/references/frameworks.md +174 -0
- package/skills/hydrogen-request-handlers/references/nextjs.md +136 -0
- package/skills/hydrogen-request-handlers/references/nuxt.md +214 -0
- package/skills/hydrogen-routing/SKILL.md +154 -0
- package/skills/hydrogen-setup/SKILL.md +50 -0
- package/skills/hydrogen-setup/references/analytics.md +624 -0
- package/skills/hydrogen-setup/steps/1-inspect-app.md +62 -0
- package/skills/hydrogen-setup/steps/10-analytics.md +10 -0
- package/skills/hydrogen-setup/steps/11-verify.md +31 -0
- package/skills/hydrogen-setup/steps/2-scaffold.md +86 -0
- package/skills/hydrogen-setup/steps/3-build-home-page.md +37 -0
- package/skills/hydrogen-setup/steps/4-collection-and-search.md +13 -0
- package/skills/hydrogen-setup/steps/5-cart.md +10 -0
- package/skills/hydrogen-setup/steps/6-product-detail-page.md +390 -0
- package/skills/hydrogen-setup/steps/7-shopify-runtime-scripts.md +69 -0
- package/skills/hydrogen-setup/steps/8-cart-drawer-and-navbar.md +35 -0
- package/skills/hydrogen-setup/steps/9-account-page.md +54 -0
- package/skills/hydrogen-shop-pay/SKILL.md +79 -0
- package/skills/hydrogen-shop-pay/references/core.md +66 -0
- package/skills/hydrogen-shop-pay/references/react.md +50 -0
- package/skills/hydrogen-shop-pay/references/vue.md +39 -0
- package/skills/hydrogen-smoke-test/SKILL.md +203 -0
- package/skills/hydrogen-storefront-client/SKILL.md +322 -0
- package/skills/hydrogen-storefront-client/references/astro.md +125 -0
- package/skills/hydrogen-storefront-client/references/caching.md +25 -0
- package/skills/hydrogen-storefront-client/references/nextjs.md +121 -0
- package/skills/hydrogen-storefront-client/references/nuxt.md +121 -0
- package/skills/hydrogen-storefront-client/references/query-validation.md +95 -0
- package/skills/hydrogen-storefront-client/references/react-router.md +81 -0
- package/skills/hydrogen-storefront-client/references/solidstart.md +131 -0
- package/skills/hydrogen-storefront-client/references/sveltekit.md +169 -0
- package/skills/hydrogen-variant-form/SKILL.md +250 -0
- package/skills/hydrogen-variant-form/references/nextjs.md +203 -0
- package/skills/hydrogen-variant-form/references/nuxt.md +95 -0
- package/skills/hydrogen-variant-form/references/react.md +71 -0
- package/dist/dev/get-virtual-routes-H72465VB.js +0 -74
- package/dist/dev/hydrogen-routes.d.ts +0 -5
- package/dist/dev/hydrogen-routes.js +0 -25
- package/dist/development/get-virtual-routes-ACFZHU42.js +0 -71
- package/dist/development/get-virtual-routes-ACFZHU42.js.map +0 -1
- package/dist/development/index.cjs +0 -6978
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -6631
- package/dist/development/index.js.map +0 -1
- package/dist/development/log-seo-tags-IG37ONQ2.js +0 -74
- package/dist/development/log-seo-tags-IG37ONQ2.js.map +0 -1
- package/dist/development/react-router-preset.d.ts +0 -45
- package/dist/development/react-router-preset.js +0 -49
- package/dist/development/react-router-preset.js.map +0 -1
- package/dist/index.cjs +0 -1
- package/dist/oxygen/index.d.ts +0 -197
- package/dist/oxygen/index.js +0 -107
- package/dist/production/get-virtual-routes-ZZEGQQDV.js +0 -3
- package/dist/production/get-virtual-routes-ZZEGQQDV.js.map +0 -1
- package/dist/production/index.cjs +0 -1019
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.d.cts +0 -3260
- package/dist/production/index.d.ts +0 -3260
- package/dist/production/index.js +0 -1019
- package/dist/production/index.js.map +0 -1
- package/dist/production/log-seo-tags-TY72EQWZ.js +0 -2
- package/dist/production/log-seo-tags-TY72EQWZ.js.map +0 -1
- package/dist/production/react-router-preset.d.ts +0 -45
- package/dist/production/react-router-preset.js +0 -11
- package/dist/react-router.d.ts +0 -75
- package/dist/vite/chunk-4O5OI3OO.js +0 -127
- package/dist/vite/chunk-FAQ7TVHC.js +0 -9
- package/dist/vite/chunk-QXBQVDMY.js +0 -68
- package/dist/vite/compat-date.d.ts +0 -3
- package/dist/vite/compat-date.js +0 -6
- package/dist/vite/get-virtual-routes.d.ts +0 -21
- package/dist/vite/get-virtual-routes.js +0 -74
- package/dist/vite/hydrogen-middleware.d.ts +0 -9
- package/dist/vite/hydrogen-middleware.js +0 -7
- package/dist/vite/plugin.d.ts +0 -22
- package/dist/vite/plugin.js +0 -171
- package/dist/vite/request-events.d.ts +0 -144
- package/dist/vite/request-events.js +0 -10
- package/dist/vite/types.d.ts +0 -5
- package/dist/vite/types.js +0 -0
- package/dist/vite/virtual-routes/assets/debug-network.css +0 -609
- package/dist/vite/virtual-routes/assets/favicon-dark.svg +0 -20
- package/dist/vite/virtual-routes/assets/favicon.svg +0 -28
- package/dist/vite/virtual-routes/assets/inter-variable-font.woff2 +0 -0
- package/dist/vite/virtual-routes/assets/jetbrainsmono-variable-font.woff2 +0 -0
- package/dist/vite/virtual-routes/assets/styles.css +0 -249
- package/dist/vite/virtual-routes/components/FlameChartWrapper.jsx +0 -123
- package/dist/vite/virtual-routes/components/HydrogenLogoBaseBW.jsx +0 -32
- package/dist/vite/virtual-routes/components/HydrogenLogoBaseColor.jsx +0 -47
- package/dist/vite/virtual-routes/components/IconBanner.jsx +0 -292
- package/dist/vite/virtual-routes/components/IconClose.jsx +0 -38
- package/dist/vite/virtual-routes/components/IconDiscard.jsx +0 -44
- package/dist/vite/virtual-routes/components/IconError.jsx +0 -61
- package/dist/vite/virtual-routes/components/IconGithub.jsx +0 -23
- package/dist/vite/virtual-routes/components/IconTwitter.jsx +0 -21
- package/dist/vite/virtual-routes/components/Layout.jsx +0 -7
- package/dist/vite/virtual-routes/components/RequestDetails.jsx +0 -171
- package/dist/vite/virtual-routes/components/RequestTable.jsx +0 -91
- package/dist/vite/virtual-routes/components/RequestWaterfall.jsx +0 -151
- package/dist/vite/virtual-routes/layout.jsx +0 -33
- package/dist/vite/virtual-routes/lib/useDebugNetworkServer.jsx +0 -178
- package/dist/vite/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx +0 -37
- package/dist/vite/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.tsx +0 -79
- package/dist/vite/virtual-routes/routes/graphiql.jsx +0 -5
- package/dist/vite/virtual-routes/routes/index.jsx +0 -265
- package/dist/vite/virtual-routes/routes/subrequest-profiler.jsx +0 -243
- package/dist/vite/virtual-routes/virtual-root-with-layout.jsx +0 -63
- package/dist/vite/virtual-routes/virtual-root.jsx +0 -67
package/README.md
CHANGED
|
@@ -1,22 +1,82 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
1
|
# Hydrogen
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
[](https://npmcharts.com/compare/@shopify/hydrogen?minimal=true)
|
|
3
|
+
Framework agnostic Shopify storefront SDK and packaged agent skills.
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
## Setup
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
Run the setup CLI in a storefront project.
|
|
11
8
|
|
|
12
9
|
```bash
|
|
13
|
-
|
|
10
|
+
npx @shopify/hydrogen setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The setup command installs `@shopify/hydrogen` into the local project using the detected package manager, then copies the packaged skills into local agent skill directories.
|
|
14
|
+
|
|
15
|
+
## GraphQL Tooling
|
|
16
|
+
|
|
17
|
+
Enable Storefront and Customer Account API editor diagnostics with Hydrogen's packed TypeScript plugin:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"compilerOptions": {
|
|
22
|
+
"plugins": [{"name": "@shopify/hydrogen/ts-plugin"}]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Run the same GraphQL validation headlessly with `npx @shopify/hydrogen gql check --fail-on-warn`, or use `hydrogen gql check --fail-on-warn` in a package script. Both commands use the Shopify schemas packaged with Hydrogen.
|
|
28
|
+
|
|
29
|
+
The editor plugin generates `storefront-graphql-env.d.ts` and `customer-account-graphql-env.d.ts` at the project root. Add both files to `.gitignore`.
|
|
30
|
+
|
|
31
|
+
## Customer Account API
|
|
32
|
+
|
|
33
|
+
Use `@shopify/hydrogen/customer-account` for type-safe Customer Account API requests from server code:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { createShopifyRequestContext } from "@shopify/hydrogen";
|
|
37
|
+
import * as CAAPI from "@shopify/hydrogen/customer-account";
|
|
38
|
+
|
|
39
|
+
const CUSTOMER_QUERY = CAAPI.gql(`query { customer { firstName emailAddress { emailAddress } } }`);
|
|
40
|
+
const requestContext = createShopifyRequestContext({
|
|
41
|
+
request,
|
|
42
|
+
i18n: { country: "US", language: "EN" },
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const customerAccount = CAAPI.createCustomerAccountClient({
|
|
46
|
+
shopId: env.SHOP_ID,
|
|
47
|
+
requestContext,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const accessToken = await getAccessTokenFromYourServerSession(request);
|
|
51
|
+
const customerResult = await customerAccount.graphql(CUSTOMER_QUERY, {
|
|
52
|
+
accessToken,
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use a numeric Shopify shop ID string from `SHOP_ID`, not a Shop GID or domain. The GraphQL client intentionally receives only the access token that your server-side auth flow has already obtained.
|
|
57
|
+
|
|
58
|
+
Hydrogen also ships framework-neutral Customer Account OAuth/session helpers. Construct `createCustomerSession()` at module scope with `SHOP_ID` and `PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID`, then pass request-scoped session managers into its methods:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const customerSession = CAAPI.createCustomerSession({
|
|
62
|
+
shopId: env.SHOP_ID,
|
|
63
|
+
customerAccountApiClientId: env.PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const isLoggedIn = await customerSession.isLoggedIn(
|
|
67
|
+
sessionManager,
|
|
68
|
+
requestContext,
|
|
69
|
+
);
|
|
14
70
|
```
|
|
15
71
|
|
|
16
|
-
|
|
72
|
+
Customer Account OAuth methods require a public HTTPS origin. The writable session manager should expose the request origin; explicit `origin` options are only needed as overrides. For local development, use a tunnel or trusted local HTTPS through `localHttps` from `@shopify/hydrogen/vite`, and pass the framework's canonical request URL rather than an untrusted forwarded host.
|
|
73
|
+
|
|
74
|
+
Pass `customerSession` to `createCartServerHandlers({customerSession})` to associate newly created carts with the current customer when the session has a usable access token or successfully refreshed access token, and mark checkout URLs in authenticated cart GET responses with `logged_in=true`.
|
|
75
|
+
|
|
76
|
+
Use `createCustomerAccountServerHandlers({customerSession})` with `handleShopifyRoutes` to install the default `GET /account/login`, `GET /account/authorize`, `GET /account/refresh`, and `POST /account/logout` handlers. Pass those cart server handlers as `cartServerHandlers` to also keep the browser cart's buyer identity in step with the customer session: authorization and refresh attach the customer to the cart, a definitive refresh rejection and logout detach it. Sync is best-effort — a failed cart mutation never blocks the route's redirect; a failed detach during logout or definitive refresh rejection expires the cart cookie instead. `cartServerHandlers` requires the `customerSession` returned by `createCustomerSession` shared by both handler groups. Pass the same request-scoped `requestContext` and `sessionManager` into `handleShopifyRoutes` once alongside the `storefrontClient`. Session managers can be read-only for `isLoggedIn()` / `getAccessToken()` and writable for cart POST handlers configured with `customerSession`, `getOrRefreshAccessToken()`, `prepareLoginUrl()`, `handleOAuthCallback()`, `logout()`, and registered account handlers. `isLoggedIn()` is a read-only UI/session-presence check: it returns true for a usable access token or a refresh token that can attempt to restore one later. `getAccessToken()` still returns only a currently usable access token and never refreshes.
|
|
77
|
+
|
|
78
|
+
The login handler respects a sanitized `return_to` search parameter and otherwise redirects back to `defaultPostLoginRedirectPathname` (default `/`). The logout handler redirects through Shopify using `postLogoutRedirectUri` (default `/`) when an ID token is present; otherwise, it redirects directly to `postLogoutRedirectUri`. Apps can still implement their own framework routes when they need custom behavior.
|
|
79
|
+
|
|
80
|
+
When a writable method can update cookie-backed session state, commit once while finalizing the response and append headers from `await sessionManager.commit?.()` there. After committing session headers, call `requestContext.applyResponseHeaders(response.headers)`. Customer Account session reads and GraphQL calls mark the request context private so the finalizer can prevent public/CDN caching of personalized responses.
|
|
17
81
|
|
|
18
|
-
|
|
19
|
-
- Want to learn more? [Check out the Hydrogen docs on Shopify.dev](https://shopify.dev/custom-storefronts/hydrogen)
|
|
20
|
-
- Questions? Feedback? Feature requests? [Discussions](https://github.com/Shopify/hydrogen/discussions)
|
|
21
|
-
- Upgrading from a previous version? [View the Changelog](./packages/hydrogen/CHANGELOG.md)
|
|
22
|
-
- Looking for Hydrogen v1? [The source code has been moved](https://github.com/Shopify/hydrogen-v1)
|
|
82
|
+
Use the GraphQL client from server or edge routes only. Keep Customer Account tokens in protected server session storage or encrypted HttpOnly cookies, not browser-readable storage. Pass the same Shopify request context used by the Storefront client so the Customer Account client can derive the `Origin` header, default language, and final response cache policy from request-scoped data. Keep GraphQL documents static and pass user input through variables. Do not retry Customer Account mutations after a timeout unless the operation is externally idempotent.
|
package/bin/hydrogen.mjs
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
import { dirname, join, parse, resolve } from "node:path";
|
|
8
|
+
import { parseArgs } from "node:util";
|
|
9
|
+
|
|
10
|
+
//#region src/graphql/plugin-config.ts
|
|
11
|
+
const STOREFRONT_SCHEMA_FILE_NAME = "storefront.schema.json";
|
|
12
|
+
const CUSTOMER_ACCOUNT_SCHEMA_FILE_NAME = "customer-account.schema.json";
|
|
13
|
+
const STOREFRONT_OUTPUT_FILE_NAME = "storefront-graphql-env.d.ts";
|
|
14
|
+
const CUSTOMER_ACCOUNT_OUTPUT_FILE_NAME = "customer-account-graphql-env.d.ts";
|
|
15
|
+
function createGraphQLPluginConfig(schemaDirectory) {
|
|
16
|
+
return {
|
|
17
|
+
name: "gql.tada/ts-plugin",
|
|
18
|
+
schemas: [{
|
|
19
|
+
name: "storefront",
|
|
20
|
+
schema: join(schemaDirectory, STOREFRONT_SCHEMA_FILE_NAME),
|
|
21
|
+
tadaOutputLocation: STOREFRONT_OUTPUT_FILE_NAME
|
|
22
|
+
}, {
|
|
23
|
+
name: "customer-account",
|
|
24
|
+
schema: join(schemaDirectory, CUSTOMER_ACCOUNT_SCHEMA_FILE_NAME),
|
|
25
|
+
tadaOutputLocation: CUSTOMER_ACCOUNT_OUTPUT_FILE_NAME
|
|
26
|
+
}],
|
|
27
|
+
trackFieldUsage: false
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/cli/gql.ts
|
|
33
|
+
const GQL_TADA_CLI_PATH_FROM_PACKAGE_ROOT = "bin/cli.js";
|
|
34
|
+
const PACKAGE_ROOT_FROM_CLI_MODULE$1 = "../../";
|
|
35
|
+
const SUCCESS_EXIT_CODE$1 = 0;
|
|
36
|
+
const TSCONFIG_FILE_NAME = "tsconfig.json";
|
|
37
|
+
const TEMPORARY_TSCONFIG_PREFIX = ".hydrogen-gql-";
|
|
38
|
+
const CHECK_LEVELS = new Set([
|
|
39
|
+
"info",
|
|
40
|
+
"warn",
|
|
41
|
+
"error"
|
|
42
|
+
]);
|
|
43
|
+
function findTsconfig(cwd, configuredPath) {
|
|
44
|
+
if (configuredPath) return resolve(cwd, configuredPath);
|
|
45
|
+
let directory = cwd;
|
|
46
|
+
const root = parse(directory).root;
|
|
47
|
+
while (directory !== root) {
|
|
48
|
+
const candidate = join(directory, TSCONFIG_FILE_NAME);
|
|
49
|
+
if (existsSync(candidate)) return candidate;
|
|
50
|
+
directory = dirname(directory);
|
|
51
|
+
}
|
|
52
|
+
const rootCandidate = join(root, TSCONFIG_FILE_NAME);
|
|
53
|
+
if (existsSync(rootCandidate)) return rootCandidate;
|
|
54
|
+
throw new Error(`Could not find ${TSCONFIG_FILE_NAME}.`);
|
|
55
|
+
}
|
|
56
|
+
function spawnRunCommand$1(command, args, options) {
|
|
57
|
+
return new Promise((resolvePromise, reject) => {
|
|
58
|
+
const child = spawn(command, args, {
|
|
59
|
+
cwd: options.cwd,
|
|
60
|
+
stdio: "inherit"
|
|
61
|
+
});
|
|
62
|
+
child.on("error", reject);
|
|
63
|
+
child.on("close", (code) => {
|
|
64
|
+
if (code === SUCCESS_EXIT_CODE$1) {
|
|
65
|
+
resolvePromise();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
reject(/* @__PURE__ */ new Error(`Command failed with exit code ${code}: ${command} ${args.join(" ")}`));
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function getPackageRoot$1() {
|
|
73
|
+
return resolve(import.meta.dirname, PACKAGE_ROOT_FROM_CLI_MODULE$1);
|
|
74
|
+
}
|
|
75
|
+
function getGqlTadaCliPath() {
|
|
76
|
+
return join(dirname(createRequire(import.meta.url).resolve("gql.tada/package.json")), GQL_TADA_CLI_PATH_FROM_PACKAGE_ROOT);
|
|
77
|
+
}
|
|
78
|
+
function parseCheckArgs(args) {
|
|
79
|
+
const { values } = parseArgs({
|
|
80
|
+
args,
|
|
81
|
+
options: {
|
|
82
|
+
"fail-on-warn": {
|
|
83
|
+
type: "boolean",
|
|
84
|
+
short: "w",
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
level: {
|
|
88
|
+
type: "string",
|
|
89
|
+
short: "l",
|
|
90
|
+
default: "info"
|
|
91
|
+
},
|
|
92
|
+
tsconfig: {
|
|
93
|
+
type: "string",
|
|
94
|
+
short: "c"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
strict: true
|
|
98
|
+
});
|
|
99
|
+
if (!CHECK_LEVELS.has(values.level)) throw new Error(`Invalid diagnostic level: ${values.level}`);
|
|
100
|
+
return values;
|
|
101
|
+
}
|
|
102
|
+
async function checkGraphQL(options = {}) {
|
|
103
|
+
const cwd = options.cwd ?? process.cwd();
|
|
104
|
+
const packageRoot = options.packageRoot ?? getPackageRoot$1();
|
|
105
|
+
const gqlTadaCliPath = options.gqlTadaCliPath ?? getGqlTadaCliPath();
|
|
106
|
+
const runCommand = options.runCommand ?? spawnRunCommand$1;
|
|
107
|
+
const values = parseCheckArgs(options.args ?? []);
|
|
108
|
+
const tsconfigPath = findTsconfig(cwd, values.tsconfig);
|
|
109
|
+
const temporaryTsconfigPath = join(dirname(tsconfigPath), `${TEMPORARY_TSCONFIG_PREFIX}${randomUUID()}.json`);
|
|
110
|
+
const pluginConfig = createGraphQLPluginConfig(join(packageRoot, "dist"));
|
|
111
|
+
writeFileSync(temporaryTsconfigPath, JSON.stringify({
|
|
112
|
+
extends: tsconfigPath,
|
|
113
|
+
compilerOptions: { plugins: [pluginConfig] }
|
|
114
|
+
}), { flag: "wx" });
|
|
115
|
+
const cliArgs = [
|
|
116
|
+
gqlTadaCliPath,
|
|
117
|
+
"check",
|
|
118
|
+
"--tsconfig",
|
|
119
|
+
temporaryTsconfigPath,
|
|
120
|
+
"--level",
|
|
121
|
+
values.level
|
|
122
|
+
];
|
|
123
|
+
if (values["fail-on-warn"]) cliArgs.push("--fail-on-warn");
|
|
124
|
+
const cleanup = () => rmSync(temporaryTsconfigPath, { force: true });
|
|
125
|
+
process.once("exit", cleanup);
|
|
126
|
+
try {
|
|
127
|
+
await runCommand(process.execPath, cliArgs, { cwd });
|
|
128
|
+
} finally {
|
|
129
|
+
process.off("exit", cleanup);
|
|
130
|
+
cleanup();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/core/utils/record.ts
|
|
136
|
+
function isObjectRecord(value) {
|
|
137
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/cli/setup.ts
|
|
142
|
+
const PACKAGE_NAME = "@shopify/hydrogen";
|
|
143
|
+
const PACKAGE_INSTALL_SPEC = `${PACKAGE_NAME}@preview`;
|
|
144
|
+
const PACKAGE_ROOT_FROM_CLI_MODULE = "../../";
|
|
145
|
+
const SKILLS_DIRECTORY_NAME = "skills";
|
|
146
|
+
const CLAUDE_DIRECTORY_NAME = ".claude";
|
|
147
|
+
const AGENTS_DIRECTORY_NAME = ".agents";
|
|
148
|
+
const NODE_MODULES_DIRECTORY_NAME = "node_modules";
|
|
149
|
+
const PACKAGE_JSON_FILE_NAME = "package.json";
|
|
150
|
+
const SUCCESS_EXIT_CODE = 0;
|
|
151
|
+
const PACKAGE_MANAGER_LOCKFILES = [
|
|
152
|
+
["pnpm", "pnpm-lock.yaml"],
|
|
153
|
+
["yarn", "yarn.lock"],
|
|
154
|
+
["npm", "package-lock.json"],
|
|
155
|
+
["bun", "bun.lockb"],
|
|
156
|
+
["bun", "bun.lock"]
|
|
157
|
+
];
|
|
158
|
+
const INSTALL_ARGS = {
|
|
159
|
+
pnpm: ["add", PACKAGE_INSTALL_SPEC],
|
|
160
|
+
npm: ["install", PACKAGE_INSTALL_SPEC],
|
|
161
|
+
yarn: ["add", PACKAGE_INSTALL_SPEC],
|
|
162
|
+
bun: ["add", PACKAGE_INSTALL_SPEC]
|
|
163
|
+
};
|
|
164
|
+
function getStringRecord(value) {
|
|
165
|
+
if (!isObjectRecord(value)) return void 0;
|
|
166
|
+
const entries = Object.entries(value);
|
|
167
|
+
if (entries.some(([, entryValue]) => typeof entryValue !== "string")) return void 0;
|
|
168
|
+
return Object.fromEntries(entries);
|
|
169
|
+
}
|
|
170
|
+
function readPackageJson(appRoot) {
|
|
171
|
+
const packageJsonPath = join(appRoot, PACKAGE_JSON_FILE_NAME);
|
|
172
|
+
if (!existsSync(packageJsonPath)) throw new Error(`No ${PACKAGE_JSON_FILE_NAME} found. Run this command from the app root.`);
|
|
173
|
+
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
174
|
+
if (!isObjectRecord(parsed)) throw new Error(`${PACKAGE_JSON_FILE_NAME} must contain a JSON object.`);
|
|
175
|
+
return {
|
|
176
|
+
packageManager: typeof parsed.packageManager === "string" ? parsed.packageManager : void 0,
|
|
177
|
+
dependencies: getStringRecord(parsed.dependencies),
|
|
178
|
+
devDependencies: getStringRecord(parsed.devDependencies)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function parsePackageManager(value) {
|
|
182
|
+
if (!value) return void 0;
|
|
183
|
+
for (const packageManager of Object.keys(INSTALL_ARGS)) {
|
|
184
|
+
if (value === packageManager) return packageManager;
|
|
185
|
+
if (value.startsWith(`${packageManager}@`)) return packageManager;
|
|
186
|
+
if (value.startsWith(`${packageManager}/`)) return packageManager;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function detectPackageManager(appRoot, packageJson, env) {
|
|
190
|
+
const packageJsonManager = parsePackageManager(packageJson.packageManager);
|
|
191
|
+
if (packageJsonManager) return packageJsonManager;
|
|
192
|
+
for (const [packageManager, lockfile] of PACKAGE_MANAGER_LOCKFILES) if (existsSync(join(appRoot, lockfile))) return packageManager;
|
|
193
|
+
const userAgentManager = parsePackageManager(env.npm_config_user_agent);
|
|
194
|
+
if (userAgentManager) return userAgentManager;
|
|
195
|
+
throw new Error("Could not detect a package manager. Add a packageManager field or a lockfile before running setup.");
|
|
196
|
+
}
|
|
197
|
+
function hasHydrogenDependency(packageJson) {
|
|
198
|
+
return Boolean(packageJson.dependencies?.[PACKAGE_NAME] ?? packageJson.devDependencies?.[PACKAGE_NAME]);
|
|
199
|
+
}
|
|
200
|
+
async function installHydrogen(appRoot, packageManager, runCommand) {
|
|
201
|
+
await runCommand(packageManager, [...INSTALL_ARGS[packageManager]], { cwd: appRoot });
|
|
202
|
+
}
|
|
203
|
+
function assertDirectory(directoryPath, message) {
|
|
204
|
+
if (!existsSync(directoryPath) || !statSync(directoryPath).isDirectory()) throw new Error(message);
|
|
205
|
+
}
|
|
206
|
+
function getSkillsDestinationRoots(appRoot) {
|
|
207
|
+
const destinationRoots = [];
|
|
208
|
+
const claudeDirectory = join(appRoot, CLAUDE_DIRECTORY_NAME);
|
|
209
|
+
if (existsSync(claudeDirectory)) {
|
|
210
|
+
assertDirectory(claudeDirectory, `${CLAUDE_DIRECTORY_NAME} exists but is not a directory.`);
|
|
211
|
+
destinationRoots.push(join(claudeDirectory, SKILLS_DIRECTORY_NAME));
|
|
212
|
+
}
|
|
213
|
+
const agentsDirectory = join(appRoot, AGENTS_DIRECTORY_NAME);
|
|
214
|
+
if (existsSync(agentsDirectory)) {
|
|
215
|
+
assertDirectory(agentsDirectory, `${AGENTS_DIRECTORY_NAME} exists but is not a directory.`);
|
|
216
|
+
destinationRoots.push(join(agentsDirectory, SKILLS_DIRECTORY_NAME));
|
|
217
|
+
}
|
|
218
|
+
return destinationRoots.length > 0 ? destinationRoots : [join(appRoot, AGENTS_DIRECTORY_NAME, SKILLS_DIRECTORY_NAME)];
|
|
219
|
+
}
|
|
220
|
+
function getSkillNames(sourceSkillsRoot) {
|
|
221
|
+
assertDirectory(sourceSkillsRoot, `No packaged skills found at ${sourceSkillsRoot}.`);
|
|
222
|
+
return readdirSync(sourceSkillsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
223
|
+
}
|
|
224
|
+
function findConflictingSkills(destinationRoot, skillNames) {
|
|
225
|
+
return skillNames.filter((skillName) => existsSync(join(destinationRoot, skillName, "SKILL.md")));
|
|
226
|
+
}
|
|
227
|
+
function removeIncompleteSkills(destinationRoot, skillNames) {
|
|
228
|
+
for (const skillName of skillNames) {
|
|
229
|
+
const destinationPath = join(destinationRoot, skillName);
|
|
230
|
+
if (!existsSync(destinationPath)) continue;
|
|
231
|
+
if (existsSync(join(destinationPath, "SKILL.md"))) continue;
|
|
232
|
+
rmSync(destinationPath, {
|
|
233
|
+
recursive: true,
|
|
234
|
+
force: true
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function copySkills(packageRoot, appRoot) {
|
|
239
|
+
const sourceSkillsRoot = join(packageRoot, SKILLS_DIRECTORY_NAME);
|
|
240
|
+
const destinationRoots = getSkillsDestinationRoots(appRoot);
|
|
241
|
+
const skillNames = getSkillNames(sourceSkillsRoot);
|
|
242
|
+
const conflictingSkills = destinationRoots.flatMap((destinationRoot) => findConflictingSkills(destinationRoot, skillNames).map((skillName) => join(destinationRoot, skillName)));
|
|
243
|
+
if (conflictingSkills.length > 0) throw new Error(`Skill directories already exist: ${conflictingSkills.join(", ")}. Remove them and rerun setup.`);
|
|
244
|
+
for (const destinationRoot of destinationRoots) {
|
|
245
|
+
removeIncompleteSkills(destinationRoot, skillNames);
|
|
246
|
+
mkdirSync(destinationRoot, { recursive: true });
|
|
247
|
+
for (const skillName of skillNames) cpSync(join(sourceSkillsRoot, skillName), join(destinationRoot, skillName), {
|
|
248
|
+
recursive: true,
|
|
249
|
+
errorOnExist: true,
|
|
250
|
+
force: false
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
destinationRoots,
|
|
255
|
+
copiedCount: skillNames.length * destinationRoots.length
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function getPackageRoot() {
|
|
259
|
+
return fileURLToPath(new URL(PACKAGE_ROOT_FROM_CLI_MODULE, import.meta.url));
|
|
260
|
+
}
|
|
261
|
+
function getLocalPackageRoot(appRoot) {
|
|
262
|
+
const localPackageRoot = join(appRoot, NODE_MODULES_DIRECTORY_NAME, PACKAGE_NAME);
|
|
263
|
+
if (!existsSync(localPackageRoot)) return void 0;
|
|
264
|
+
assertDirectory(localPackageRoot, `${localPackageRoot} exists but is not a directory.`);
|
|
265
|
+
return realpathSync(localPackageRoot);
|
|
266
|
+
}
|
|
267
|
+
function spawnRunCommand(command, args, options) {
|
|
268
|
+
return new Promise((resolve, reject) => {
|
|
269
|
+
const child = spawn(command, args, {
|
|
270
|
+
cwd: options.cwd,
|
|
271
|
+
stdio: "inherit"
|
|
272
|
+
});
|
|
273
|
+
child.on("error", reject);
|
|
274
|
+
child.on("close", (code) => {
|
|
275
|
+
if (code === SUCCESS_EXIT_CODE) {
|
|
276
|
+
resolve();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
reject(/* @__PURE__ */ new Error(`Command failed with exit code ${code}: ${command} ${args.join(" ")}`));
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
async function setupHydrogen(options = {}) {
|
|
284
|
+
const appRoot = options.cwd ?? process.cwd();
|
|
285
|
+
const env = options.env ?? process.env;
|
|
286
|
+
const runCommand = options.runCommand ?? spawnRunCommand;
|
|
287
|
+
const log = options.log ?? console.log;
|
|
288
|
+
const packageJson = readPackageJson(appRoot);
|
|
289
|
+
if (!hasHydrogenDependency(packageJson)) {
|
|
290
|
+
const packageManager = detectPackageManager(appRoot, packageJson, env);
|
|
291
|
+
log(`Installing ${PACKAGE_NAME} with ${packageManager}...`);
|
|
292
|
+
await installHydrogen(appRoot, packageManager, runCommand);
|
|
293
|
+
}
|
|
294
|
+
const result = copySkills(options.packageRoot ?? getLocalPackageRoot(appRoot) ?? getPackageRoot(), appRoot);
|
|
295
|
+
log(`Copied ${result.copiedCount} Hydrogen skills to ${result.destinationRoots.join(", ")}.`);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/cli/index.ts
|
|
300
|
+
const CLI_ARGUMENTS_INDEX = 2;
|
|
301
|
+
const FAILURE_EXIT_CODE = 1;
|
|
302
|
+
const COMMANDS = [{
|
|
303
|
+
path: ["setup"],
|
|
304
|
+
run: async (_args) => setupHydrogen()
|
|
305
|
+
}, {
|
|
306
|
+
path: ["gql", "check"],
|
|
307
|
+
run: async (args) => checkGraphQL({ args })
|
|
308
|
+
}];
|
|
309
|
+
function commandMatches(path, args) {
|
|
310
|
+
return path.every((segment, index) => args[index] === segment);
|
|
311
|
+
}
|
|
312
|
+
function runCli() {
|
|
313
|
+
const args = process.argv.slice(CLI_ARGUMENTS_INDEX);
|
|
314
|
+
const command = COMMANDS.find(({ path }) => commandMatches(path, args));
|
|
315
|
+
if (!command) {
|
|
316
|
+
const commandName = args.join(" ");
|
|
317
|
+
const availableCommands = COMMANDS.map(({ path }) => path.join(" ")).join(", ");
|
|
318
|
+
console.error(commandName ? `Unknown command: ${commandName}` : "No command specified.");
|
|
319
|
+
console.error(`Available commands: ${availableCommands}`);
|
|
320
|
+
process.exit(FAILURE_EXIT_CODE);
|
|
321
|
+
}
|
|
322
|
+
command.run(args.slice(command.path.length)).catch((error) => {
|
|
323
|
+
console.error(error instanceof Error ? error.message : "An unexpected error occurred");
|
|
324
|
+
process.exit(FAILURE_EXIT_CODE);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
if (process.argv[1] !== void 0 && fileURLToPath(import.meta.url) === realpathSync(process.argv[1])) runCli();
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
export { runCli };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CachingStrategy } from "../core/cache/strategies.mjs";
|
|
2
|
+
import { CacheInstance } from "../core/cache/run-with-cache.mjs";
|
|
3
|
+
import { ShopifyRequestContext } from "../core/request-context.mjs";
|
|
4
|
+
import { ClientType, CreateStorefrontClientArgs, StorefrontClient } from "./types.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/client/client.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Creates a type-safe Storefront API client.
|
|
9
|
+
*
|
|
10
|
+
* Pick a `type` based on where your code runs and whether buyer context is available:
|
|
11
|
+
*
|
|
12
|
+
* | | public | private | private_no_buyer_context |
|
|
13
|
+
* |-----------------|--------------------------------|-------------------------------|--------------------------|
|
|
14
|
+
* | Runs in | Browser or mobile | Server (SSR) | Server (background) |
|
|
15
|
+
* | Token | Public access token, or none | Private access token | Private access token |
|
|
16
|
+
* | Buyer context | Browser request context | You forward trusted `buyerIp` | None |
|
|
17
|
+
* | Best for | Client-side fetches | SSR with buyer context | Webhooks, background jobs |
|
|
18
|
+
*
|
|
19
|
+
* Pass `requestContext` so the client's SFAPI requests carry request-scoped
|
|
20
|
+
* headers, follow the incoming request's abort signal, and read the resolved
|
|
21
|
+
* `i18n` used for Storefront API variable injection and localized routes.
|
|
22
|
+
*
|
|
23
|
+
* Token-based access is required for some Storefront API fields, including
|
|
24
|
+
* product tags, metaobjects, metafields, menus, and customers. Use a private
|
|
25
|
+
* client only in trusted server code where the token cannot leak to browsers.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://shopify.dev/docs/api/storefront#authentication | Storefront API authentication}
|
|
28
|
+
*/
|
|
29
|
+
declare function createStorefrontClient<const Type extends ClientType, const RequestContext extends ShopifyRequestContext, const CacheConfig extends CacheInstance | undefined = undefined>(args: CreateStorefrontClientArgs<RequestContext, Type, CacheConfig>): StorefrontClient<[CacheConfig] extends [CacheInstance] ? {
|
|
30
|
+
cache?: CachingStrategy;
|
|
31
|
+
} : {}, Type, RequestContext>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { createStorefrontClient };
|
|
34
|
+
//# sourceMappingURL=client.d.mts.map
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { HYDROGEN_VERSION_HEADER, REQUEST_GROUP_ID_HEADER, SDK_VARIANT_HEADER, SDK_VARIANT_SOURCE_HEADER, SDK_VERSION_HEADER, SHOPIFY_STOREFRONT_S_HEADER, SHOPIFY_STOREFRONT_Y_HEADER, SHOPIFY_UNIQUE_TOKEN_HEADER, SHOPIFY_VISIT_TOKEN_HEADER, STOREFRONT_ACCESS_TOKEN_HEADER, STOREFRONT_BUYER_IP_HEADER, STOREFRONT_ID_HEADER, STOREFRONT_PRIVATE_TOKEN_HEADER } from "../core/headers.mjs";
|
|
2
|
+
import { normalizeStoreDomain } from "../core/url.mjs";
|
|
3
|
+
import { getHydrogenCacheStatus } from "../core/cache/cache-status.mjs";
|
|
4
|
+
import { createFetchWithCache } from "../core/cache/fetch-with-cache.mjs";
|
|
5
|
+
import { DEFAULT_TIMEOUT_IN_MS, STOREFRONT_API_VERSION } from "../core/constants.mjs";
|
|
6
|
+
import { StorefrontApiError, StorefrontTimeoutError } from "./errors.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/client/client.ts
|
|
9
|
+
const COUNTRY_VAR_RE = /\$country\s*:/;
|
|
10
|
+
const LANGUAGE_VAR_RE = /\$language\s*:/;
|
|
11
|
+
const REQUEST_CACHE_KEY_HEADERS = new Set([
|
|
12
|
+
"content-type",
|
|
13
|
+
"user-agent",
|
|
14
|
+
SDK_VARIANT_HEADER.toLowerCase(),
|
|
15
|
+
SDK_VARIANT_SOURCE_HEADER.toLowerCase(),
|
|
16
|
+
SDK_VERSION_HEADER.toLowerCase(),
|
|
17
|
+
HYDROGEN_VERSION_HEADER.toLowerCase(),
|
|
18
|
+
STOREFRONT_ACCESS_TOKEN_HEADER.toLowerCase(),
|
|
19
|
+
STOREFRONT_PRIVATE_TOKEN_HEADER.toLowerCase()
|
|
20
|
+
]);
|
|
21
|
+
const REQUEST_IDENTITY_HEADERS = new Set([
|
|
22
|
+
"cookie",
|
|
23
|
+
REQUEST_GROUP_ID_HEADER.toLowerCase(),
|
|
24
|
+
STOREFRONT_BUYER_IP_HEADER.toLowerCase(),
|
|
25
|
+
SHOPIFY_UNIQUE_TOKEN_HEADER.toLowerCase(),
|
|
26
|
+
SHOPIFY_VISIT_TOKEN_HEADER.toLowerCase(),
|
|
27
|
+
SHOPIFY_STOREFRONT_Y_HEADER.toLowerCase(),
|
|
28
|
+
SHOPIFY_STOREFRONT_S_HEADER.toLowerCase()
|
|
29
|
+
]);
|
|
30
|
+
var StorefrontCacheConfigError = class extends Error {};
|
|
31
|
+
function createStorefrontClient(args) {
|
|
32
|
+
const { config, requestContext, type: clientType } = args;
|
|
33
|
+
if (!config.storeDomain) throw new Error("storeDomain is required and must be non-empty");
|
|
34
|
+
const storeUrl = normalizeStoreDomain(config.storeDomain);
|
|
35
|
+
const apiUrl = `${storeUrl}/api/${config.apiVersion ?? "2026-04"}/graphql.json`;
|
|
36
|
+
const originFetch = config.fetch ?? globalThis.fetch;
|
|
37
|
+
if (typeof originFetch !== "function") throw new Error("No fetch function available. Pass a fetch option or ensure globalThis.fetch exists.");
|
|
38
|
+
const resolvedFetch = config.cache ? createFetchWithCache({
|
|
39
|
+
cache: config.cache,
|
|
40
|
+
waitUntil: config.waitUntil,
|
|
41
|
+
fetch: originFetch
|
|
42
|
+
}) : originFetch;
|
|
43
|
+
const timeoutInMs = config.defaultTimeoutInMs ?? 3e4;
|
|
44
|
+
if (timeoutInMs < 0 || Number.isNaN(timeoutInMs)) throw new Error("defaultTimeoutInMs must be a non-negative number");
|
|
45
|
+
const staticHeaders = { "content-type": "application/json" };
|
|
46
|
+
if (config.storefrontId) staticHeaders[STOREFRONT_ID_HEADER] = config.storefrontId;
|
|
47
|
+
switch (clientType) {
|
|
48
|
+
case "private":
|
|
49
|
+
case "private_no_buyer_context":
|
|
50
|
+
if (typeof document !== "undefined") throw new Error("private storefront tokens cannot be used in a browser context. Use a publicStorefrontToken instead.");
|
|
51
|
+
if (!config.privateStorefrontToken) throw new Error("privateStorefrontToken is required");
|
|
52
|
+
staticHeaders[STOREFRONT_PRIVATE_TOKEN_HEADER] = config.privateStorefrontToken;
|
|
53
|
+
break;
|
|
54
|
+
case "public":
|
|
55
|
+
if (config.publicStorefrontToken !== void 0 && !config.publicStorefrontToken) throw new Error("publicStorefrontToken must be non-empty when provided");
|
|
56
|
+
if (config.publicStorefrontToken) staticHeaders[STOREFRONT_ACCESS_TOKEN_HEADER] = config.publicStorefrontToken;
|
|
57
|
+
break;
|
|
58
|
+
default: throw new Error(`Unsupported client type: ${clientType}`);
|
|
59
|
+
}
|
|
60
|
+
const i18n = requestContext.i18n;
|
|
61
|
+
const requestHeaders = new Headers(staticHeaders);
|
|
62
|
+
requestContext.applyStorefrontRequestHeaders(requestHeaders);
|
|
63
|
+
if (clientType === "private") {
|
|
64
|
+
const { buyerIp } = requestContext;
|
|
65
|
+
if (!buyerIp) throw new TypeError("requestContext.buyerIp is required for private Storefront API clients");
|
|
66
|
+
requestHeaders.set(STOREFRONT_BUYER_IP_HEADER, buyerIp);
|
|
67
|
+
}
|
|
68
|
+
async function graphql(doc, ...rest) {
|
|
69
|
+
const opts = rest[0] ?? {};
|
|
70
|
+
const queryText = typeof doc === "string" ? doc : doc;
|
|
71
|
+
if (typeof queryText !== "string") throw new StorefrontApiError("Expected gql() to return a string at runtime. Check gql.tada version compatibility.");
|
|
72
|
+
if (opts.cache && !config.cache) throw new StorefrontCacheConfigError("Storefront API cache options require a cache configured in createStorefrontClient().");
|
|
73
|
+
if (opts.cache?.mode === "private") throw new StorefrontCacheConfigError("Storefront API cache mode 'private' is not supported yet. Use Cache() without private mode, or cache buyer-specific work with createRunWithCache() and an explicit private key.");
|
|
74
|
+
const variables = buildVariables(queryText, opts.variables, i18n);
|
|
75
|
+
const externalSignals = [requestContext.signal, opts.signal].filter((signal) => Boolean(signal));
|
|
76
|
+
const earlyAbortSignal = externalSignals.find((signal) => signal.aborted);
|
|
77
|
+
if (earlyAbortSignal) throw earlyAbortSignal.reason ?? new DOMException("signal is aborted without reason", "AbortError");
|
|
78
|
+
let requestId;
|
|
79
|
+
let responseHeaders;
|
|
80
|
+
let responseText;
|
|
81
|
+
let status;
|
|
82
|
+
let timeoutSignal;
|
|
83
|
+
if (timeoutInMs > 0) {
|
|
84
|
+
timeoutSignal = AbortSignal.timeout(timeoutInMs);
|
|
85
|
+
externalSignals.push(timeoutSignal);
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const init = {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: new Headers(requestHeaders),
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
query: queryText,
|
|
93
|
+
variables
|
|
94
|
+
}),
|
|
95
|
+
signal: externalSignals.length > 0 ? AbortSignal.any(externalSignals) : void 0
|
|
96
|
+
};
|
|
97
|
+
const response = await resolvedFetch(apiUrl, init, createStorefrontCacheOptions(apiUrl, init, queryText, opts.cache));
|
|
98
|
+
responseHeaders = response.headers;
|
|
99
|
+
if (getHydrogenCacheStatus(responseHeaders) !== "hit") requestContext.captureSubrequestHeaders(responseHeaders);
|
|
100
|
+
requestId = responseHeaders.get("x-request-id") ?? void 0;
|
|
101
|
+
status = response.status;
|
|
102
|
+
if (!response.ok) {
|
|
103
|
+
const bodyHint = await response.text().catch(() => "");
|
|
104
|
+
throw new StorefrontApiError(`SFAPI responded with ${status}${bodyHint ? `: ${bodyHint.slice(0, 200)}` : ""}`, {
|
|
105
|
+
status,
|
|
106
|
+
requestId,
|
|
107
|
+
queryText,
|
|
108
|
+
variables
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
responseText = await response.text();
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (error instanceof StorefrontApiError) throw error;
|
|
114
|
+
if (error instanceof StorefrontTimeoutError) throw error;
|
|
115
|
+
if (error instanceof StorefrontCacheConfigError) throw error;
|
|
116
|
+
if (error instanceof DOMException && error.name === "TimeoutError" && timeoutSignal?.aborted) throw new StorefrontTimeoutError(timeoutInMs);
|
|
117
|
+
if (error instanceof DOMException && error.name === "AbortError") throw error;
|
|
118
|
+
throw new StorefrontApiError("SFAPI request failed", { cause: error });
|
|
119
|
+
}
|
|
120
|
+
let json;
|
|
121
|
+
try {
|
|
122
|
+
json = JSON.parse(responseText);
|
|
123
|
+
} catch (cause) {
|
|
124
|
+
throw new StorefrontApiError(`Failed to parse SFAPI response as JSON (${apiUrl}, status ${status})` + (responseText ? `: ${responseText.slice(0, 200)}` : ""), {
|
|
125
|
+
status,
|
|
126
|
+
requestId,
|
|
127
|
+
cause,
|
|
128
|
+
queryText,
|
|
129
|
+
variables
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (typeof json !== "object" || json === null || Array.isArray(json)) throw new StorefrontApiError(`SFAPI returned unexpected JSON type: ${Array.isArray(json) ? "array" : typeof json}`, {
|
|
133
|
+
status,
|
|
134
|
+
requestId,
|
|
135
|
+
queryText,
|
|
136
|
+
variables
|
|
137
|
+
});
|
|
138
|
+
const body = json;
|
|
139
|
+
if (body.errors) return {
|
|
140
|
+
data: body.data ?? null,
|
|
141
|
+
errors: body.errors,
|
|
142
|
+
headers: responseHeaders
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
data: body.data,
|
|
146
|
+
headers: responseHeaders
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
type: clientType,
|
|
151
|
+
i18n,
|
|
152
|
+
graphql,
|
|
153
|
+
apiUrl,
|
|
154
|
+
storeUrl,
|
|
155
|
+
storefrontId: config.storefrontId,
|
|
156
|
+
requestContext
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function buildVariables(queryText, userVariables, resolvedI18n) {
|
|
160
|
+
const variables = { ...userVariables };
|
|
161
|
+
if (COUNTRY_VAR_RE.test(queryText)) variables.country = resolvedI18n.country;
|
|
162
|
+
if (LANGUAGE_VAR_RE.test(queryText)) variables.language = resolvedI18n.language;
|
|
163
|
+
return variables;
|
|
164
|
+
}
|
|
165
|
+
function createStorefrontCacheOptions(apiUrl, init, queryText, strategy) {
|
|
166
|
+
if (!strategy) return void 0;
|
|
167
|
+
if (/\bmutation\b/.test(queryText)) return void 0;
|
|
168
|
+
return {
|
|
169
|
+
key: createStorefrontCacheKey(apiUrl, init),
|
|
170
|
+
strategy,
|
|
171
|
+
shouldCacheResponse: async ({ json }) => {
|
|
172
|
+
if (!json) return false;
|
|
173
|
+
const body = await json().catch(() => void 0);
|
|
174
|
+
return typeof body === "object" && body != null && !Array.isArray(body) && !("errors" in body);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function createStorefrontCacheKey(apiUrl, init) {
|
|
179
|
+
return [
|
|
180
|
+
"storefront-api",
|
|
181
|
+
apiUrl,
|
|
182
|
+
init.method,
|
|
183
|
+
init.body,
|
|
184
|
+
[...init.headers].filter(([name]) => {
|
|
185
|
+
const normalized = name.toLowerCase();
|
|
186
|
+
return REQUEST_CACHE_KEY_HEADERS.has(normalized) && !REQUEST_IDENTITY_HEADERS.has(normalized);
|
|
187
|
+
}).toSorted(([left], [right]) => left.localeCompare(right)).map(([name, value]) => `${name}:${value}`).join("\n")
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
export { createStorefrontClient };
|
|
193
|
+
//# sourceMappingURL=client.mjs.map
|