@shopify/hydrogen 2026.4.2 → 2026.4.3

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.
@@ -1,12 +1,12 @@
1
1
  import { Preset } from '@react-router/dev/config';
2
2
 
3
3
  /**
4
- * Official Hydrogen Preset for React Router 7.12.x
4
+ * Official Hydrogen Preset for React Router 7.16.x
5
5
  *
6
6
  * Provides optimal React Router configuration for Hydrogen applications on Oxygen.
7
7
  * Enables validated performance optimizations while ensuring CLI compatibility.
8
8
  *
9
- * React Router 7.12.x Feature Support Matrix for Hydrogen 2025.7.0
9
+ * React Router 7.16.x Feature Support Matrix for Hydrogen 2025.7.0
10
10
  *
11
11
  * +----------------------------------+----------+----------------------------------+
12
12
  * | Feature | Status | Notes |
@@ -34,7 +34,7 @@ import { Preset } from '@react-router/dev/config';
34
34
  * | prerender: ['/routes'] | Blocked | Plugin incompatibility |
35
35
  * | serverBundles: () => {} | Blocked | Manifest incompatibility |
36
36
  * | buildEnd: () => {} | Blocked | CLI bypasses hook execution |
37
- * | unstable_subResourceIntegrity | Blocked | CSP nonce/hash conflict |
37
+ * | subResourceIntegrity | Blocked | CSP nonce/hash conflict |
38
38
  * | v8_viteEnvironmentApi | Blocked | CLI fallback detection used |
39
39
  * +----------------------------------+----------+----------------------------------+
40
40
  *
@@ -1,4 +1,4 @@
1
- function r(){return{name:"hydrogen-2025.7.0",reactRouterConfig:()=>({appDirectory:"app",buildDirectory:"dist",ssr:!0,future:{v8_middleware:!0,v8_splitRouteModules:!0,v8_viteEnvironmentApi:!1,unstable_optimizeDeps:!0,unstable_subResourceIntegrity:!1}}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
1
+ function r(){return{name:"hydrogen-2025.7.0",reactRouterConfig:()=>({appDirectory:"app",buildDirectory:"dist",ssr:!0,future:{v8_middleware:!0,v8_splitRouteModules:!0,v8_viteEnvironmentApi:!1,unstable_optimizeDeps:!0},subResourceIntegrity:!1}),reactRouterConfigResolved:({reactRouterConfig:e})=>{if(e.basename&&e.basename!=="/")throw new Error(`[Hydrogen Preset] basename is not supported in Hydrogen 2025.7.0.
2
2
  Reason: Requires major CLI infrastructure modernization.
3
3
  Workaround: Use reverse proxy or CDN path rewriting for subdirectory hosting.`);if(e.prerender)throw new Error(`[Hydrogen Preset] prerender is not supported in Hydrogen 2025.7.0.
4
4
  Reason: React Router plugin incompatibility with Hydrogen CLI build pipeline.
@@ -6,6 +6,6 @@ Workaround: Use external static generation tools or server-side caching.`);if(e.
6
6
  Reason: React Router plugin manifest incompatibility with Hydrogen CLI.
7
7
  Alternative: Route-level code splitting via v8_splitRouteModules is enabled.`);if(e.buildEnd)throw new Error(`[Hydrogen Preset] buildEnd is not supported in Hydrogen 2025.7.0.
8
8
  Reason: Hydrogen CLI bypasses React Router buildEnd hook execution.
9
- Workaround: Use external build scripts or package.json post-build hooks.`);if(e.future?.unstable_subResourceIntegrity===!0)throw new Error(`[Hydrogen Preset] unstable_subResourceIntegrity cannot be enabled.
9
+ Workaround: Use external build scripts or package.json post-build hooks.`);if(e.subResourceIntegrity===!0)throw new Error(`[Hydrogen Preset] subResourceIntegrity cannot be enabled.
10
10
  Reason: Conflicts with Hydrogen CSP nonce-based authentication.
11
11
  Impact: Would break Content Security Policy and cause script execution failures.`)}}}export{r as hydrogenPreset};
@@ -30,6 +30,16 @@ declare global {
30
30
  // updateLineByOptions: (productId: string, selectedOptions: SelectedOptionInput[], line: CartLineUpdateInput) => Promise<CartQueryDataReturn>;
31
31
  // }
32
32
  }
33
+
34
+ /**
35
+ * The cart type used for `context.cart` in route files.
36
+ *
37
+ * `HydrogenCart`'s default type parameter already includes
38
+ * `HydrogenCustomCartFragment & Cart`, so no explicit intersection is needed
39
+ * here. The augmentable `HydrogenCustomCartFragment` interface is declared
40
+ * in `cart/queries/cart-types.ts`.
41
+ */
42
+ type HydrogenCartWithFragment = HydrogenCart & HydrogenCustomCartMethods;
33
43
  }
34
44
 
35
45
  declare module 'react-router' {
@@ -37,7 +47,7 @@ declare module 'react-router' {
37
47
  interface RouterContextProvider extends HydrogenAdditionalContext {
38
48
  // Standard Hydrogen context properties from HydrogenRouterContextProvider
39
49
  storefront: HydrogenRouterContextProvider['storefront'];
40
- cart: HydrogenCart & HydrogenCustomCartMethods;
50
+ cart: HydrogenCartWithFragment;
41
51
  customerAccount: HydrogenRouterContextProvider['customerAccount'];
42
52
  env: HydrogenRouterContextProvider['env'];
43
53
  session: HydrogenRouterContextProvider['session'];
@@ -48,7 +58,7 @@ declare module 'react-router' {
48
58
  interface AppLoadContext extends HydrogenAdditionalContext {
49
59
  // Standard Hydrogen context properties from HydrogenRouterContextProvider
50
60
  storefront: HydrogenRouterContextProvider['storefront'];
51
- cart: HydrogenCart & HydrogenCustomCartMethods;
61
+ cart: HydrogenCartWithFragment;
52
62
  customerAccount: HydrogenRouterContextProvider['customerAccount'];
53
63
  env: HydrogenRouterContextProvider['env'];
54
64
  session: HydrogenRouterContextProvider['session'];
@@ -1,6 +1,30 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import { CountryCode, LanguageCode } from '@shopify/hydrogen-react/storefront-api-types';
3
3
 
4
+ declare global {
5
+ /**
6
+ * Extensible interface for typing cart results with a custom cart fragment.
7
+ * Augment this interface with your codegen'd fragment type to get full type
8
+ * safety on every cart operation — whether accessed via `context.cart`,
9
+ * `createCartHandler`, or `createHydrogenContext`.
10
+ *
11
+ * When empty (the default), `HydrogenCustomCartFragment & Cart` collapses
12
+ * to `Cart`, so existing behaviour is unchanged.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // In app/lib/context.ts
17
+ * import type {CartApiQueryFragment} from 'storefrontapi.generated';
18
+ *
19
+ * declare global {
20
+ * interface HydrogenCustomCartFragment extends CartApiQueryFragment {}
21
+ * }
22
+ * ```
23
+ */
24
+ interface HydrogenCustomCartFragment {
25
+ }
26
+ }
27
+
4
28
  type ConsentStatus = boolean | undefined;
5
29
  type VisitorConsent = {
6
30
  marketing: ConsentStatus;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
7
  "type": "module",
8
- "version": "2026.4.2",
8
+ "version": "2026.4.3",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.cjs",
11
11
  "module": "dist/production/index.js",
@@ -80,12 +80,12 @@
80
80
  "use-resize-observer": "^9.1.0",
81
81
  "worktop": "^0.7.3",
82
82
  "@shopify/graphql-client": "1.4.1",
83
- "@shopify/hydrogen-react": "2026.4.2"
83
+ "@shopify/hydrogen-react": "2026.4.3"
84
84
  },
85
85
  "devDependencies": {
86
- "react-router": "7.14.0",
87
- "@react-router/dev": "7.14.0",
88
- "@shopify/generate-docs": "1.1.4",
86
+ "react-router": "7.16.0",
87
+ "@react-router/dev": "7.16.0",
88
+ "@shopify/generate-docs": "1.2.2",
89
89
  "@testing-library/jest-dom": "^6.6.3",
90
90
  "@types/node": "22.19.15",
91
91
  "@types/react": "^18.3.28",
@@ -102,8 +102,8 @@
102
102
  "@shopify/hydrogen-codegen": "0.3.3"
103
103
  },
104
104
  "peerDependencies": {
105
- "react-router": "7.14.0",
106
- "@react-router/dev": "7.14.0",
105
+ "react-router": "~7.16.0",
106
+ "@react-router/dev": "~7.16.0",
107
107
  "react": "^18.3.1 || ~19.0.3 || ~19.1.4 || ^19.2.3",
108
108
  "vite": "^5.1.0 || ^6.2.1 || ^7.0.0 || ^8.0.0"
109
109
  },