@shopify/hydrogen 0.25.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/dist/esnext/components/{CartEstimatedCost/CartEstimatedCost.client.d.ts → CartCost/CartCost.client.d.ts} +3 -3
- package/dist/esnext/components/{CartEstimatedCost/CartEstimatedCost.client.js → CartCost/CartCost.client.js} +7 -7
- package/dist/esnext/components/CartCost/index.d.ts +1 -0
- package/dist/esnext/components/CartCost/index.js +1 -0
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +2 -2
- package/dist/esnext/components/CartLineProvider/context.d.ts +3 -3
- package/dist/esnext/components/CartProvider/CartProvider.client.js +37 -27
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
- package/dist/esnext/components/CartProvider/cart-queries.js +3 -3
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +5 -5
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +5 -5
- package/dist/esnext/components/CartProvider/hooks.client.d.ts +1 -1
- package/dist/esnext/components/CartProvider/hooks.client.js +16 -11
- package/dist/esnext/components/CartProvider/types.d.ts +3 -3
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +1 -3
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +2 -4
- package/dist/esnext/components/Link/Link.client.d.ts +2 -0
- package/dist/esnext/components/Link/Link.client.js +8 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +2 -2
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -3
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +8 -20
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +17 -33
- package/dist/esnext/components/LocalizationProvider/index.d.ts +0 -1
- package/dist/esnext/components/LocalizationProvider/index.js +0 -1
- package/dist/esnext/components/Metafield/Metafield.client.js +3 -3
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +3 -3
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.js +3 -3
- package/dist/esnext/components/Seo/ImageSeo.client.js +1 -1
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +3 -3
- package/dist/esnext/components/Seo/ProductSeo.client.js +2 -2
- package/dist/esnext/components/Seo/Seo.client.js +1 -1
- package/dist/esnext/components/Seo/TitleSeo.client.js +1 -1
- package/dist/esnext/components/Seo/TwitterSeo.client.js +1 -1
- package/dist/esnext/components/Seo/seo-types.d.ts +1 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +3 -1
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +8 -3
- package/dist/esnext/components/index.d.ts +2 -2
- package/dist/esnext/components/index.js +2 -2
- package/dist/esnext/constants.d.ts +1 -1
- package/dist/esnext/constants.js +1 -1
- package/dist/esnext/entry-client.js +7 -5
- package/dist/esnext/entry-server.js +21 -34
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +1 -1
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +1 -1
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +9 -1
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +6 -0
- package/dist/esnext/foundation/Route/Route.server.js +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +5 -4
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +9 -7
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +4 -0
- package/dist/esnext/foundation/ShopifyProvider/types.d.ts +1 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.js +13 -0
- package/dist/esnext/foundation/useQuery/hooks.js +1 -4
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +3 -0
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +8 -3
- package/dist/esnext/framework/cache/in-memory.d.ts +12 -7
- package/dist/esnext/framework/cache/in-memory.js +49 -21
- package/dist/esnext/framework/load-config.d.ts +6 -0
- package/dist/esnext/framework/load-config.js +10 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.js +2 -3
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +21 -4
- package/dist/esnext/framework/viteception.d.ts +2 -1
- package/dist/esnext/framework/viteception.js +2 -1
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +3 -3
- package/dist/esnext/hooks/useLocalization/useLocalization.d.ts +4 -0
- package/dist/esnext/hooks/useLocalization/useLocalization.js +14 -0
- package/dist/esnext/hooks/useMeasurement/hooks.js +2 -2
- package/dist/esnext/hooks/useMoney/hooks.js +2 -2
- package/dist/esnext/index.d.ts +3 -0
- package/dist/esnext/index.js +1 -0
- package/dist/esnext/platforms/node.d.ts +1 -1
- package/dist/esnext/platforms/node.js +2 -1
- package/dist/esnext/storefront-api-types.d.ts +105 -3
- package/dist/esnext/storefront-api-types.js +8 -0
- package/dist/esnext/types.d.ts +10 -0
- package/dist/esnext/utilities/apiRoutes.d.ts +4 -3
- package/dist/esnext/utilities/log/log-cache-api-status.js +3 -0
- package/dist/esnext/utilities/storefrontApi.d.ts +1 -0
- package/dist/esnext/utilities/storefrontApi.js +1 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/framework/cache/in-memory.d.ts +12 -7
- package/dist/node/framework/cache/in-memory.js +49 -21
- package/dist/node/framework/load-config.d.ts +6 -0
- package/dist/node/framework/load-config.js +14 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.js +2 -3
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +21 -4
- package/dist/node/framework/viteception.d.ts +2 -1
- package/dist/node/framework/viteception.js +2 -1
- package/package.json +13 -3
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +21 -6
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +2 -1
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +21 -6
- package/dist/esnext/components/CartEstimatedCost/index.d.ts +0 -1
- package/dist/esnext/components/CartEstimatedCost/index.js +0 -1
- package/dist/esnext/hooks/useCountry/index.d.ts +0 -1
- package/dist/esnext/hooks/useCountry/index.js +0 -1
- package/dist/esnext/hooks/useCountry/useCountry.d.ts +0 -7
- package/dist/esnext/hooks/useCountry/useCountry.js +0 -17
|
@@ -15,9 +15,8 @@ exports.default = () => {
|
|
|
15
15
|
server.middlewares.use(async (req, res, next) => {
|
|
16
16
|
const url = req.url;
|
|
17
17
|
try {
|
|
18
|
-
if (url
|
|
19
|
-
url
|
|
20
|
-
!url.includes('node_modules')) {
|
|
18
|
+
if (/\.client\.[jt]sx?\?v=/.test(url) &&
|
|
19
|
+
!/\/node_modules\//.test(url)) {
|
|
21
20
|
const result = await server.transformRequest(url, { html: false });
|
|
22
21
|
if (result) {
|
|
23
22
|
return (0, vite_1.send)(req, res, result.code, 'js', {
|
|
@@ -21,20 +21,25 @@ exports.VIRTUAL_PROXY_HYDROGEN_ROUTES_ID = VIRTUAL_PREFIX + PROXY_PREFIX + HYDRO
|
|
|
21
21
|
exports.default = (pluginOptions) => {
|
|
22
22
|
let config;
|
|
23
23
|
let server;
|
|
24
|
+
let resolvedConfigPath;
|
|
24
25
|
return {
|
|
25
26
|
name: 'hydrogen:virtual-files',
|
|
26
27
|
configResolved(_config) {
|
|
27
28
|
config = _config;
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
config.plugins.push(addPathToConfigProxy());
|
|
28
31
|
},
|
|
29
32
|
configureServer(_server) {
|
|
30
33
|
server = _server;
|
|
31
34
|
},
|
|
32
35
|
resolveId(source, importer) {
|
|
33
36
|
if (source === VIRTUAL_HYDROGEN_CONFIG_ID) {
|
|
34
|
-
return findHydrogenConfigPath(config.root, pluginOptions.configPath).then((hcPath) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
return findHydrogenConfigPath(config.root, pluginOptions.configPath).then((hcPath) => {
|
|
38
|
+
resolvedConfigPath = hcPath;
|
|
39
|
+
// This direct dependency on a real file
|
|
40
|
+
// makes HMR work for the virtual module.
|
|
41
|
+
return this.resolve(hcPath, importer, { skipSelf: true });
|
|
42
|
+
});
|
|
38
43
|
}
|
|
39
44
|
if ([
|
|
40
45
|
exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID,
|
|
@@ -87,6 +92,18 @@ exports.default = (pluginOptions) => {
|
|
|
87
92
|
const { loaded } = await (0, viteception_1.viteception)([exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID]);
|
|
88
93
|
return loaded[0].default;
|
|
89
94
|
}
|
|
95
|
+
function addPathToConfigProxy() {
|
|
96
|
+
return {
|
|
97
|
+
name: 'hydrogen:virtual-files-post',
|
|
98
|
+
enforce: 'post',
|
|
99
|
+
transform(code, id) {
|
|
100
|
+
if (id === '\0' + exports.VIRTUAL_PROXY_HYDROGEN_CONFIG_ID) {
|
|
101
|
+
// The CLI needs to import the Hydrogen config path
|
|
102
|
+
return (code + ` export const configPath = '${resolvedConfigPath || ''}';`);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
90
107
|
};
|
|
91
108
|
async function findHydrogenConfigPath(root, userProvidedPath) {
|
|
92
109
|
let configPath = userProvidedPath;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { InlineConfig } from 'vite';
|
|
2
|
+
export declare function viteception(paths: string[], options?: InlineConfig): Promise<{
|
|
2
3
|
server: import("vite").ViteDevServer;
|
|
3
4
|
loaded: Record<string, any>[];
|
|
4
5
|
}>;
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.viteception = void 0;
|
|
4
4
|
const vite_1 = require("vite");
|
|
5
|
-
async function viteception(paths) {
|
|
5
|
+
async function viteception(paths, options) {
|
|
6
6
|
const isWorker = process.env.WORKER;
|
|
7
7
|
delete process.env.WORKER;
|
|
8
8
|
const server = await (0, vite_1.createServer)({
|
|
9
9
|
clearScreen: false,
|
|
10
10
|
server: { middlewareMode: 'ssr' },
|
|
11
|
+
...options,
|
|
11
12
|
});
|
|
12
13
|
if (isWorker) {
|
|
13
14
|
process.env.WORKER = isWorker;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=14"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.26.0",
|
|
11
11
|
"description": "Modern custom Shopify storefronts",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"main": "dist/esnext/index.js",
|
|
@@ -22,11 +22,19 @@
|
|
|
22
22
|
"import": "./dist/esnext/framework/middleware.js",
|
|
23
23
|
"require": "./dist/node/framework/middleware.js"
|
|
24
24
|
},
|
|
25
|
+
"./load-config": {
|
|
26
|
+
"import": "./dist/esnext/framework/load-config.js",
|
|
27
|
+
"require": "./dist/node/framework/load-config.js"
|
|
28
|
+
},
|
|
25
29
|
"./web-polyfills": {
|
|
26
30
|
"import": "./dist/esnext/utilities/web-api-polyfill",
|
|
27
31
|
"require": "./dist/node/utilities/web-api-polyfill"
|
|
28
32
|
},
|
|
29
33
|
"./vendor/*": "./vendor/*",
|
|
34
|
+
"./cache/*": {
|
|
35
|
+
"import": "./dist/esnext/framework/cache/*.js",
|
|
36
|
+
"require": "./dist/node/framework/cache/*.js"
|
|
37
|
+
},
|
|
30
38
|
"./package.json": "./package.json",
|
|
31
39
|
"./*": "./dist/esnext/*.js"
|
|
32
40
|
},
|
|
@@ -111,6 +119,7 @@
|
|
|
111
119
|
"@vitejs/plugin-react": "^1.3.0",
|
|
112
120
|
"abort-controller": "^3.0.0",
|
|
113
121
|
"body-parser": "^1.20.0",
|
|
122
|
+
"compression": "^1.7.4",
|
|
114
123
|
"connect": "^3.7.0",
|
|
115
124
|
"es-module-lexer": "^0.10.0",
|
|
116
125
|
"fast-glob": "^3.2.11",
|
|
@@ -123,11 +132,12 @@
|
|
|
123
132
|
"path-to-regexp": "^6.2.0",
|
|
124
133
|
"react-error-boundary": "^3.1.3",
|
|
125
134
|
"react-helmet-async": "^1.2.3",
|
|
135
|
+
"serve-static": "^1.15.0",
|
|
126
136
|
"set-cookie-parser": "^2.5.0",
|
|
137
|
+
"undici": "^5.5.1",
|
|
127
138
|
"uuid": "^8.3.2",
|
|
128
139
|
"vite-plugin-inspect": "^0.3.6",
|
|
129
140
|
"web-streams-polyfill": "^3.2.0",
|
|
130
|
-
"worktop": "^0.7.3"
|
|
131
|
-
"undici": "^5.5.1"
|
|
141
|
+
"worktop": "^0.7.3"
|
|
132
142
|
}
|
|
133
143
|
}
|
|
@@ -111,8 +111,9 @@ function ReactFlightVitePlugin() {
|
|
|
111
111
|
|
|
112
112
|
var config;
|
|
113
113
|
var server;
|
|
114
|
-
var globImporterPath;
|
|
115
114
|
var resolveAlias;
|
|
115
|
+
var globImporterPath;
|
|
116
|
+
var allClientBoundaries = new Set();
|
|
116
117
|
return {
|
|
117
118
|
name: 'vite-plugin-react-server-components',
|
|
118
119
|
enforce: 'pre',
|
|
@@ -250,7 +251,7 @@ function ReactFlightVitePlugin() {
|
|
|
250
251
|
});
|
|
251
252
|
var injectedGlobs = "Object.assign(Object.create(null), " + importers.map(function (glob) {
|
|
252
253
|
return (// Mark the globs to modify the result after Vite resolves them.
|
|
253
|
-
"/* HASH_BEGIN */ " + ("import.meta.glob('" + vite.normalizePath(glob) + "') /* HASH_END */")
|
|
254
|
+
"\n/* HASH_BEGIN */ " + ("import.meta.glob('" + vite.normalizePath(glob) + "') /* HASH_END */")
|
|
254
255
|
);
|
|
255
256
|
}).join(', ') + ");";
|
|
256
257
|
s.replace(INJECTING_RE, injectedGlobs);
|
|
@@ -264,8 +265,17 @@ function ReactFlightVitePlugin() {
|
|
|
264
265
|
};
|
|
265
266
|
|
|
266
267
|
if (config.command === 'serve') {
|
|
267
|
-
globImporterPath = id;
|
|
268
|
-
|
|
268
|
+
globImporterPath = id; // When mixing client and server components from the same
|
|
269
|
+
// facade file, the module graph can break and miss certain
|
|
270
|
+
// import connections (bug in Vite?) due to HMR. Instead of
|
|
271
|
+
// creating a new list of discovered components from scratch,
|
|
272
|
+
// reuse the already discovered ones and simply add new ones
|
|
273
|
+
// to the list without removing anything.
|
|
274
|
+
|
|
275
|
+
findClientBoundaries(server.moduleGraph).forEach(function (boundary) {
|
|
276
|
+
return allClientBoundaries.add(boundary);
|
|
277
|
+
});
|
|
278
|
+
return injectGlobs(Array.from(allClientBoundaries));
|
|
269
279
|
}
|
|
270
280
|
|
|
271
281
|
if (!serverBuildEntries) {
|
|
@@ -457,7 +467,7 @@ function isDirectImportInServer(originalMod, currentMod, accModInfo) {
|
|
|
457
467
|
});
|
|
458
468
|
}
|
|
459
469
|
|
|
460
|
-
return Array.from((currentMod || originalMod).importers).some(function (importer) {
|
|
470
|
+
return Array.from((currentMod || originalMod).importers || []).some(function (importer) {
|
|
461
471
|
return (// eslint-disable-next-line no-unused-vars
|
|
462
472
|
isDirectImportInServer(originalMod, importer, accModInfo)
|
|
463
473
|
);
|
|
@@ -531,10 +541,15 @@ function augmentModuleGraph(moduleGraph, id, code, root, resolveAlias) {
|
|
|
531
541
|
var resolvedAliasPath = resolveAlias(modPath, 'rsc_importer', {});
|
|
532
542
|
|
|
533
543
|
if (resolvedAliasPath && resolvedAliasPath.id) {
|
|
534
|
-
modPath =
|
|
544
|
+
modPath = resolvedAliasPath.id;
|
|
535
545
|
}
|
|
536
546
|
}
|
|
537
547
|
|
|
548
|
+
if (modPath && modPath.startsWith('/src/')) {
|
|
549
|
+
// Vite default alias
|
|
550
|
+
modPath = vite.normalizePath(path.join(root, modPath));
|
|
551
|
+
}
|
|
552
|
+
|
|
538
553
|
var resolvedPath = resolveModPath(modPath, dirname);
|
|
539
554
|
if (!resolvedPath) return; // Virtual modules or other exceptions
|
|
540
555
|
|
|
@@ -20,7 +20,8 @@ var MODULE_TAG = Symbol.for('react.module.reference');
|
|
|
20
20
|
var STRING_SIZE_LIMIT = 64;
|
|
21
21
|
var FN_RSC_ERROR = 'Functions exported from client components cannot be called or used as constructors from a server component.';
|
|
22
22
|
function isRsc() {
|
|
23
|
-
|
|
23
|
+
var currentDispatcher = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;
|
|
24
|
+
return !!(currentDispatcher && currentDispatcher.isRsc);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
function createModuleReference(id, value, name, isDefault) {
|
|
@@ -107,8 +107,9 @@ function ReactFlightVitePlugin() {
|
|
|
107
107
|
|
|
108
108
|
var config;
|
|
109
109
|
var server;
|
|
110
|
-
var globImporterPath;
|
|
111
110
|
var resolveAlias;
|
|
111
|
+
var globImporterPath;
|
|
112
|
+
var allClientBoundaries = new Set();
|
|
112
113
|
return {
|
|
113
114
|
name: 'vite-plugin-react-server-components',
|
|
114
115
|
enforce: 'pre',
|
|
@@ -246,7 +247,7 @@ function ReactFlightVitePlugin() {
|
|
|
246
247
|
});
|
|
247
248
|
var injectedGlobs = "Object.assign(Object.create(null), " + importers.map(function (glob) {
|
|
248
249
|
return (// Mark the globs to modify the result after Vite resolves them.
|
|
249
|
-
"/* HASH_BEGIN */ " + ("import.meta.glob('" + normalizePath(glob) + "') /* HASH_END */")
|
|
250
|
+
"\n/* HASH_BEGIN */ " + ("import.meta.glob('" + normalizePath(glob) + "') /* HASH_END */")
|
|
250
251
|
);
|
|
251
252
|
}).join(', ') + ");";
|
|
252
253
|
s.replace(INJECTING_RE, injectedGlobs);
|
|
@@ -260,8 +261,17 @@ function ReactFlightVitePlugin() {
|
|
|
260
261
|
};
|
|
261
262
|
|
|
262
263
|
if (config.command === 'serve') {
|
|
263
|
-
globImporterPath = id;
|
|
264
|
-
|
|
264
|
+
globImporterPath = id; // When mixing client and server components from the same
|
|
265
|
+
// facade file, the module graph can break and miss certain
|
|
266
|
+
// import connections (bug in Vite?) due to HMR. Instead of
|
|
267
|
+
// creating a new list of discovered components from scratch,
|
|
268
|
+
// reuse the already discovered ones and simply add new ones
|
|
269
|
+
// to the list without removing anything.
|
|
270
|
+
|
|
271
|
+
findClientBoundaries(server.moduleGraph).forEach(function (boundary) {
|
|
272
|
+
return allClientBoundaries.add(boundary);
|
|
273
|
+
});
|
|
274
|
+
return injectGlobs(Array.from(allClientBoundaries));
|
|
265
275
|
}
|
|
266
276
|
|
|
267
277
|
if (!serverBuildEntries) {
|
|
@@ -453,7 +463,7 @@ function isDirectImportInServer(originalMod, currentMod, accModInfo) {
|
|
|
453
463
|
});
|
|
454
464
|
}
|
|
455
465
|
|
|
456
|
-
return Array.from((currentMod || originalMod).importers).some(function (importer) {
|
|
466
|
+
return Array.from((currentMod || originalMod).importers || []).some(function (importer) {
|
|
457
467
|
return (// eslint-disable-next-line no-unused-vars
|
|
458
468
|
isDirectImportInServer(originalMod, importer, accModInfo)
|
|
459
469
|
);
|
|
@@ -527,10 +537,15 @@ function augmentModuleGraph(moduleGraph, id, code, root, resolveAlias) {
|
|
|
527
537
|
var resolvedAliasPath = resolveAlias(modPath, 'rsc_importer', {});
|
|
528
538
|
|
|
529
539
|
if (resolvedAliasPath && resolvedAliasPath.id) {
|
|
530
|
-
modPath =
|
|
540
|
+
modPath = resolvedAliasPath.id;
|
|
531
541
|
}
|
|
532
542
|
}
|
|
533
543
|
|
|
544
|
+
if (modPath && modPath.startsWith('/src/')) {
|
|
545
|
+
// Vite default alias
|
|
546
|
+
modPath = normalizePath(path.join(root, modPath));
|
|
547
|
+
}
|
|
548
|
+
|
|
534
549
|
var resolvedPath = resolveModPath(modPath, dirname);
|
|
535
550
|
if (!resolvedPath) return; // Virtual modules or other exceptions
|
|
536
551
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CartEstimatedCost } from './CartEstimatedCost.client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CartEstimatedCost } from './CartEstimatedCost.client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useCountry } from './useCountry';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useCountry } from './useCountry';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `useCountry` hook returns a tuple of the current localization country and a function for updating it.
|
|
3
|
-
* It must be a descendent of a `LocalizationProvider` component.
|
|
4
|
-
*/
|
|
5
|
-
export declare function useCountry(): (({
|
|
6
|
-
__typename?: "Country" | undefined;
|
|
7
|
-
} & Pick<import("../../storefront-api-types").Country, "name" | "isoCode">) | undefined)[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { LocalizationContext } from '../../components/LocalizationProvider/LocalizationContext.client';
|
|
3
|
-
function useLocalization() {
|
|
4
|
-
const context = useContext(LocalizationContext);
|
|
5
|
-
if (context == null) {
|
|
6
|
-
throw new Error('No Localization Context available');
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* The `useCountry` hook returns a tuple of the current localization country and a function for updating it.
|
|
12
|
-
* It must be a descendent of a `LocalizationProvider` component.
|
|
13
|
-
*/
|
|
14
|
-
export function useCountry() {
|
|
15
|
-
const context = useLocalization();
|
|
16
|
-
return [context.country];
|
|
17
|
-
}
|