@shopify/hydrogen 2025.7.1 → 2025.7.2

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,7 +1,4 @@
1
1
  // src/vite/get-virtual-routes.ts
2
- import { fileURLToPath } from "url";
3
- import path from "path";
4
- import { readdir } from "fs/promises";
5
2
  var VIRTUAL_ROUTES_DIR = "vite/virtual-routes/routes";
6
3
  var VIRTUAL_ROUTES_ROUTES_DIR_PARTS = [
7
4
  "vite",
@@ -9,7 +6,6 @@ var VIRTUAL_ROUTES_ROUTES_DIR_PARTS = [
9
6
  "routes"
10
7
  ];
11
8
  var VIRTUAL_ROUTES_DIR_PARTS = ["vite", "virtual-routes"];
12
- var VIRTUAL_ROOT = "vite/virtual-routes/virtual-root";
13
9
  function getVirtualRoutesPath(pathParts, forFile) {
14
10
  const basePath = new URL("../", import.meta.url);
15
11
  const virtualRoutesPath = pathParts.reduce((working, dirPart) => {
@@ -65,41 +61,9 @@ async function getVirtualRoutesV3() {
65
61
  }
66
62
  };
67
63
  }
68
- var VIRTUAL_ROUTES_DIR_ORIG = "virtual-routes/routes";
69
- var VIRTUAL_ROOT_ORIG = "virtual-routes/virtual-root-with-layout";
70
- async function getVirtualRoutes() {
71
- const distPath = path.dirname(fileURLToPath(import.meta.url));
72
- const virtualRoutesPath = path.join(distPath, VIRTUAL_ROUTES_DIR_ORIG);
73
- const routes = await readdir(virtualRoutesPath, { recursive: true }).then(
74
- (files) => files.map((relativeFilePath) => {
75
- const absoluteFilePath = path.join(virtualRoutesPath, relativeFilePath);
76
- const id = relativeFilePath.replace(/\.[jt]sx?$/, "").replaceAll("\\", "/");
77
- const isIndex = /(^|\/)index$/.test(id);
78
- const routePath = id.replace(/(^|\/)index$/, "");
79
- return {
80
- id: `${VIRTUAL_ROUTES_DIR_ORIG}/${id}`,
81
- path: routePath,
82
- file: absoluteFilePath,
83
- index: isIndex
84
- };
85
- })
86
- );
87
- return {
88
- routes,
89
- root: {
90
- id: VIRTUAL_ROOT_ORIG,
91
- path: "",
92
- file: path.join(distPath, VIRTUAL_ROOT_ORIG + ".jsx")
93
- }
94
- };
95
- }
96
64
  export {
97
- VIRTUAL_ROOT,
98
- VIRTUAL_ROOT_ORIG,
99
65
  VIRTUAL_ROUTES_DIR,
100
- VIRTUAL_ROUTES_DIR_ORIG,
101
66
  VIRTUAL_ROUTES_DIR_PARTS,
102
67
  VIRTUAL_ROUTES_ROUTES_DIR_PARTS,
103
- getVirtualRoutes,
104
68
  getVirtualRoutesV3
105
69
  };
@@ -4,7 +4,7 @@ async function hydrogenRoutes(currentRoutes) {
4
4
  if (env === "production") {
5
5
  return currentRoutes;
6
6
  }
7
- const { getVirtualRoutesV3 } = await import("./get-virtual-routes-KWSSQH4L.js");
7
+ const { getVirtualRoutesV3 } = await import("./get-virtual-routes-ZEUPNZWL.js");
8
8
  const { layout, routes: virtualRoutes } = await getVirtualRoutesV3();
9
9
  const childVirtualRoutes = virtualRoutes.map(({ path, file, index, id }) => {
10
10
  return {
@@ -1,7 +1,3 @@
1
- import { fileURLToPath } from 'url';
2
- import path from 'path';
3
- import { readdir } from 'fs/promises';
4
-
5
1
  // src/vite/get-virtual-routes.ts
6
2
  var VIRTUAL_ROUTES_DIR = "vite/virtual-routes/routes";
7
3
  var VIRTUAL_ROUTES_ROUTES_DIR_PARTS = [
@@ -10,7 +6,6 @@ var VIRTUAL_ROUTES_ROUTES_DIR_PARTS = [
10
6
  "routes"
11
7
  ];
12
8
  var VIRTUAL_ROUTES_DIR_PARTS = ["vite", "virtual-routes"];
13
- var VIRTUAL_ROOT = "vite/virtual-routes/virtual-root";
14
9
  function getVirtualRoutesPath(pathParts, forFile) {
15
10
  const basePath = new URL("../", import.meta.url);
16
11
  const virtualRoutesPath = pathParts.reduce((working, dirPart) => {
@@ -66,35 +61,7 @@ async function getVirtualRoutesV3() {
66
61
  }
67
62
  };
68
63
  }
69
- var VIRTUAL_ROUTES_DIR_ORIG = "virtual-routes/routes";
70
- var VIRTUAL_ROOT_ORIG = "virtual-routes/virtual-root-with-layout";
71
- async function getVirtualRoutes() {
72
- const distPath = path.dirname(fileURLToPath(import.meta.url));
73
- const virtualRoutesPath = path.join(distPath, VIRTUAL_ROUTES_DIR_ORIG);
74
- const routes = await readdir(virtualRoutesPath, { recursive: true }).then(
75
- (files) => files.map((relativeFilePath) => {
76
- const absoluteFilePath = path.join(virtualRoutesPath, relativeFilePath);
77
- const id = relativeFilePath.replace(/\.[jt]sx?$/, "").replaceAll("\\", "/");
78
- const isIndex = /(^|\/)index$/.test(id);
79
- const routePath = id.replace(/(^|\/)index$/, "");
80
- return {
81
- id: `${VIRTUAL_ROUTES_DIR_ORIG}/${id}`,
82
- path: routePath,
83
- file: absoluteFilePath,
84
- index: isIndex
85
- };
86
- })
87
- );
88
- return {
89
- routes,
90
- root: {
91
- id: VIRTUAL_ROOT_ORIG,
92
- path: "",
93
- file: path.join(distPath, VIRTUAL_ROOT_ORIG + ".jsx")
94
- }
95
- };
96
- }
97
64
 
98
- export { VIRTUAL_ROOT, VIRTUAL_ROOT_ORIG, VIRTUAL_ROUTES_DIR, VIRTUAL_ROUTES_DIR_ORIG, VIRTUAL_ROUTES_DIR_PARTS, VIRTUAL_ROUTES_ROUTES_DIR_PARTS, getVirtualRoutes, getVirtualRoutesV3 };
99
- //# sourceMappingURL=get-virtual-routes-6PVSMJPH.js.map
100
- //# sourceMappingURL=get-virtual-routes-6PVSMJPH.js.map
65
+ export { VIRTUAL_ROUTES_DIR, VIRTUAL_ROUTES_DIR_PARTS, VIRTUAL_ROUTES_ROUTES_DIR_PARTS, getVirtualRoutesV3 };
66
+ //# sourceMappingURL=get-virtual-routes-XE7G57DS.js.map
67
+ //# sourceMappingURL=get-virtual-routes-XE7G57DS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/vite/get-virtual-routes.ts"],"names":[],"mappings":";AACO,IAAM,kBAAA,GAAqB;AAC3B,IAAM,+BAAA,GAAkC;AA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E,EAAA,EAAI,GAAG,kBAAkB,CAAA,MAAA,CAAA;AAAA,QACzB,IAAA,EAAM,EAAA;AAAA,QACN,IAAA,EAAM,oBAAA;AAAA,UACJ,+BAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,oBAAA,CAAqB,wBAAA,EAA0B,YAAY;AAAA;AACnE,GACF;AACF","file":"get-virtual-routes-XE7G57DS.js","sourcesContent":["// v3_routeConfig virtual routes constants\nexport const VIRTUAL_ROUTES_DIR = 'vite/virtual-routes/routes';\nexport const VIRTUAL_ROUTES_ROUTES_DIR_PARTS = [\n 'vite',\n 'virtual-routes',\n 'routes',\n];\nexport const VIRTUAL_ROUTES_DIR_PARTS = ['vite', 'virtual-routes'];\n\nfunction getVirtualRoutesPath(\n pathParts: Array<string>,\n forFile: string,\n): string {\n const basePath = new URL('../', import.meta.url);\n const virtualRoutesPath = pathParts.reduce((working, dirPart) => {\n return new URL(`${dirPart}/`, working);\n }, basePath);\n\n // Getting rid of the drive path (ie. '/C:/') in windows\n return new URL(forFile, virtualRoutesPath).pathname.replace(\n /^\\/[a-zA-Z]:\\//,\n '/',\n );\n}\n\nexport async function getVirtualRoutesV3() {\n return {\n routes: [\n {\n id: `${VIRTUAL_ROUTES_DIR}/graphiql`,\n path: 'graphiql',\n file: getVirtualRoutesPath(\n VIRTUAL_ROUTES_ROUTES_DIR_PARTS,\n 'graphiql.jsx',\n ),\n index: false,\n },\n {\n id: `${VIRTUAL_ROUTES_DIR}/subrequest-profiler`,\n path: 'subrequest-profiler',\n file: getVirtualRoutesPath(\n VIRTUAL_ROUTES_ROUTES_DIR_PARTS,\n 'subrequest-profiler.jsx',\n ),\n index: false,\n },\n {\n id: `${VIRTUAL_ROUTES_DIR}/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json`,\n path: '.well-known/appspecific/com.chrome.devtools.json',\n file: getVirtualRoutesPath(\n VIRTUAL_ROUTES_ROUTES_DIR_PARTS,\n '[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx',\n ),\n index: false,\n },\n {\n id: `${VIRTUAL_ROUTES_DIR}/index`,\n path: '',\n file: getVirtualRoutesPath(\n VIRTUAL_ROUTES_ROUTES_DIR_PARTS,\n 'index.jsx',\n ),\n index: true,\n },\n ],\n layout: {\n file: getVirtualRoutesPath(VIRTUAL_ROUTES_DIR_PARTS, 'layout.jsx'),\n },\n };\n}\n"]}
@@ -1,8 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var url = require('url');
4
- var path = require('path');
5
- var promises = require('fs/promises');
6
3
  var react = require('react');
7
4
  var reactRouter = require('react-router');
8
5
  var jsxRuntime = require('react/jsx-runtime');
@@ -15,7 +12,6 @@ var cspBuilder = require('content-security-policy-builder');
15
12
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
16
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
14
 
18
- var path__default = /*#__PURE__*/_interopDefault(path);
19
15
  var cspBuilder__default = /*#__PURE__*/_interopDefault(cspBuilder);
20
16
 
21
17
  var __defProp = Object.defineProperty;
@@ -31,13 +27,9 @@ var __export = (target, all) => {
31
27
  // src/vite/get-virtual-routes.ts
32
28
  var get_virtual_routes_exports = {};
33
29
  __export(get_virtual_routes_exports, {
34
- VIRTUAL_ROOT: () => VIRTUAL_ROOT,
35
- VIRTUAL_ROOT_ORIG: () => VIRTUAL_ROOT_ORIG,
36
30
  VIRTUAL_ROUTES_DIR: () => VIRTUAL_ROUTES_DIR,
37
- VIRTUAL_ROUTES_DIR_ORIG: () => VIRTUAL_ROUTES_DIR_ORIG,
38
31
  VIRTUAL_ROUTES_DIR_PARTS: () => VIRTUAL_ROUTES_DIR_PARTS,
39
32
  VIRTUAL_ROUTES_ROUTES_DIR_PARTS: () => VIRTUAL_ROUTES_ROUTES_DIR_PARTS,
40
- getVirtualRoutes: () => getVirtualRoutes,
41
33
  getVirtualRoutesV3: () => getVirtualRoutesV3
42
34
  });
43
35
  function getVirtualRoutesPath(pathParts, forFile) {
@@ -95,33 +87,7 @@ async function getVirtualRoutesV3() {
95
87
  }
96
88
  };
97
89
  }
98
- async function getVirtualRoutes() {
99
- const distPath = path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
100
- const virtualRoutesPath = path__default.default.join(distPath, VIRTUAL_ROUTES_DIR_ORIG);
101
- const routes = await promises.readdir(virtualRoutesPath, { recursive: true }).then(
102
- (files) => files.map((relativeFilePath) => {
103
- const absoluteFilePath = path__default.default.join(virtualRoutesPath, relativeFilePath);
104
- const id = relativeFilePath.replace(/\.[jt]sx?$/, "").replaceAll("\\", "/");
105
- const isIndex = /(^|\/)index$/.test(id);
106
- const routePath = id.replace(/(^|\/)index$/, "");
107
- return {
108
- id: `${VIRTUAL_ROUTES_DIR_ORIG}/${id}`,
109
- path: routePath,
110
- file: absoluteFilePath,
111
- index: isIndex
112
- };
113
- })
114
- );
115
- return {
116
- routes,
117
- root: {
118
- id: VIRTUAL_ROOT_ORIG,
119
- path: "",
120
- file: path__default.default.join(distPath, VIRTUAL_ROOT_ORIG + ".jsx")
121
- }
122
- };
123
- }
124
- var VIRTUAL_ROUTES_DIR, VIRTUAL_ROUTES_ROUTES_DIR_PARTS, VIRTUAL_ROUTES_DIR_PARTS, VIRTUAL_ROOT, VIRTUAL_ROUTES_DIR_ORIG, VIRTUAL_ROOT_ORIG;
90
+ var VIRTUAL_ROUTES_DIR, VIRTUAL_ROUTES_ROUTES_DIR_PARTS, VIRTUAL_ROUTES_DIR_PARTS;
125
91
  var init_get_virtual_routes = __esm({
126
92
  "src/vite/get-virtual-routes.ts"() {
127
93
  VIRTUAL_ROUTES_DIR = "vite/virtual-routes/routes";
@@ -131,9 +97,6 @@ var init_get_virtual_routes = __esm({
131
97
  "routes"
132
98
  ];
133
99
  VIRTUAL_ROUTES_DIR_PARTS = ["vite", "virtual-routes"];
134
- VIRTUAL_ROOT = "vite/virtual-routes/virtual-root";
135
- VIRTUAL_ROUTES_DIR_ORIG = "virtual-routes/routes";
136
- VIRTUAL_ROOT_ORIG = "virtual-routes/virtual-root-with-layout";
137
100
  }
138
101
  });
139
102
 
@@ -642,7 +605,7 @@ function getPrivacyBanner() {
642
605
  }
643
606
 
644
607
  // package.json
645
- var version = "2025.7.1";
608
+ var version = "2025.7.2";
646
609
 
647
610
  // src/analytics-manager/ShopifyAnalytics.tsx
648
611
  function getCustomerPrivacyRequired() {
@@ -2035,7 +1998,7 @@ function generateUUID() {
2035
1998
  }
2036
1999
 
2037
2000
  // src/version.ts
2038
- var LIB_VERSION = "2025.7.1";
2001
+ var LIB_VERSION = "2025.7.2";
2039
2002
 
2040
2003
  // src/utils/graphql.ts
2041
2004
  function minifyQuery(string) {
@@ -3567,9 +3530,9 @@ var logSubRequestEvent = ({
3567
3530
  }
3568
3531
  });
3569
3532
  } ;
3570
- function redirect(path2, options = {}) {
3533
+ function redirect(path, options = {}) {
3571
3534
  const headers = options.headers ? new Headers(options.headers) : new Headers({});
3572
- headers.set("location", path2);
3535
+ headers.set("location", path);
3573
3536
  return new Response(null, { status: options.status || 302, headers });
3574
3537
  }
3575
3538
  async function refreshToken({
@@ -4077,6 +4040,12 @@ function createCustomerAccountClient({
4077
4040
  if (options?.countryCode) {
4078
4041
  loginUrl.searchParams.append("region_country", options.countryCode);
4079
4042
  }
4043
+ if (options?.acrValues) {
4044
+ loginUrl.searchParams.append("acr_values", options.acrValues);
4045
+ }
4046
+ if (options?.loginHint) {
4047
+ loginUrl.searchParams.append("login_hint", options.loginHint);
4048
+ }
4080
4049
  const verifier = generateCodeVerifier();
4081
4050
  const challenge = await generateCodeChallenge(verifier);
4082
4051
  session.set(CUSTOMER_ACCOUNT_SESSION_KEY, {
@@ -4587,12 +4556,12 @@ function LazyScript({
4587
4556
  async function hydrogenRoutes(currentRoutes) {
4588
4557
  const { getVirtualRoutesV3: getVirtualRoutesV32 } = await Promise.resolve().then(() => (init_get_virtual_routes(), get_virtual_routes_exports));
4589
4558
  const { layout, routes: virtualRoutes } = await getVirtualRoutesV32();
4590
- const childVirtualRoutes = virtualRoutes.map(({ path: path2, file, index, id }) => {
4559
+ const childVirtualRoutes = virtualRoutes.map(({ path, file, index, id }) => {
4591
4560
  return {
4592
4561
  file,
4593
4562
  id,
4594
4563
  index,
4595
- path: path2
4564
+ path
4596
4565
  };
4597
4566
  });
4598
4567
  const virtualLayout = {
@@ -4953,7 +4922,7 @@ function VariantSelector({
4953
4922
  }
4954
4923
  }
4955
4924
  const variants = _variants instanceof Array ? _variants : hydrogenReact.flattenConnection(_variants);
4956
- const { searchParams, path: path2, alreadyOnProductPage } = useVariantPath(
4925
+ const { searchParams, path, alreadyOnProductPage } = useVariantPath(
4957
4926
  handle,
4958
4927
  productPath,
4959
4928
  waitForNavigation
@@ -5009,7 +4978,7 @@ function VariantSelector({
5009
4978
  value: value.name,
5010
4979
  optionValue: value,
5011
4980
  isAvailable: variant ? variant.availableForSale : true,
5012
- to: path2 + searchString,
4981
+ to: path + searchString,
5013
4982
  search: searchString,
5014
4983
  isActive: calculatedActiveValue,
5015
4984
  variant
@@ -5043,7 +5012,7 @@ function useVariantPath(handle, productPath, waitForNavigation) {
5043
5012
  const match = /(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(pathname);
5044
5013
  const isLocalePathname = match && match.length > 0;
5045
5014
  productPath = productPath.startsWith("/") ? productPath.substring(1) : productPath;
5046
- const path2 = isLocalePathname ? `${match[0]}${productPath}/${handle}` : `/${productPath}/${handle}`;
5015
+ const path = isLocalePathname ? `${match[0]}${productPath}/${handle}` : `/${productPath}/${handle}`;
5047
5016
  const searchParams = new URLSearchParams(
5048
5017
  // Remix doesn't update the location until pending loaders complete.
5049
5018
  // By default we use the destination search params to make selecting a variant
@@ -5056,8 +5025,8 @@ function useVariantPath(handle, productPath, waitForNavigation) {
5056
5025
  // If the current pathname matches the product page, we need to make sure
5057
5026
  // that we append to the current search params. Otherwise all the search
5058
5027
  // params can be generated new.
5059
- alreadyOnProductPage: path2 === pathname,
5060
- path: path2
5028
+ alreadyOnProductPage: path === pathname,
5029
+ path
5061
5030
  };
5062
5031
  }, [pathname, search, waitForNavigation, handle, productPath, navigation]);
5063
5032
  }