@scayle/storefront-nuxt 8.63.0 → 8.65.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 CHANGED
@@ -1,5 +1,73 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.65.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Aligned the Nuxt version ranges of `@scayle/storefront-nuxt` with the Nuxt versions the module supports. Nuxt 4 support has started at `4.2.0` since `8.58.0`, and the `nuxt` peer dependency has required `>=3.15.0 || >=4.2.2` since `8.62.8`. The module still declared `>=3.13` as its Nuxt compatibility, and both peer ranges matched every Nuxt 4 release, `4.0.0` to `4.2.1` included.
8
+
9
+ ## Affected Nuxt versions
10
+ - The module compatibility and the `nuxt` peer dependency are now `>=3.15.0 <4.0.0 || >=4.2.2`. The `@nuxt/kit` peer dependency is now `>=3.15.0 <4.0.0 || >=4.2.0`.
11
+ - On Nuxt `3.13`, `3.14` or `4.0.0` to `4.2.1`, Nuxt now disables the module at build time and logs that `@scayle/storefront-nuxt` is disabled due to incompatibility issues. Its composables, RPC methods and sessions then stop working. With `experimental.enforceModuleCompatibility` enabled, the build fails instead. pnpm also reports a peer dependency warning on install.
12
+ - Before you update to this release, update Nuxt to `3.15.0` or later on Nuxt 3, or to `4.2.2` or later on Nuxt 4.
13
+
14
+ ### Patch Changes
15
+
16
+ **Dependencies**
17
+
18
+ **@scayle/storefront-core v8.65.0**
19
+
20
+ - No changes in this release.
21
+
22
+ ## 8.64.0
23
+
24
+ ### Minor Changes
25
+
26
+ - Added the `redirects.lookupAbsoluteUrl` runtime config option, so your shop can halve its SCAYLE Panel redirect lookups. Each request looks up its path and its absolute URL, such as `https://example.com/men`, and each lookup costs a Storefront API call on a cache miss and counts against your rate limit. The absolute lookup finds only sources stored as absolute URLs and regular expressions that match the host. If none of your shops has such a source, set the option to `false` to send only the path lookup, for the `before-request` and the `on-missing` strategy. A redirect whose source is an absolute URL or a regular expression that matches the host then never applies. The option applies to every shop of the application, so keep the default if any shop has such a source. To check, list the redirects of every shop with `GET /v1/redirects` of the Storefront API.
27
+
28
+ The default `true` keeps the current behavior, and `NUXT_STOREFRONT_REDIRECTS_LOOKUP_ABSOLUTE_URL` overrides it.
29
+
30
+ - Added the `redirects.skipLookupPaths` and `redirects.skipLookupPatterns` runtime config options, so your shop can skip the SCAYLE Panel redirect lookup for paths you know have no redirect, such as crawler and AI agent requests for `/llms.txt` or `/.well-known/` paths. Each lookup costs Storefront API calls on a cache miss and counts against your rate limit, and Storefront Core can't skip these paths by default, because a regex redirect in the SCAYLE Panel can match a file path.
31
+
32
+ A `skipLookupPaths` entry matches that path and every path below it, so `'/de/.well-known'` covers the directory and its files but not `/de/.well-known-guide`. A trailing slash on the entry makes no difference. The entry `'/'` or `''` would match every path, so it fails the runtime config validation at startup. A `skipLookupPatterns` entry is the source of a regular expression, compiled with `new RegExp(pattern)` without flags. An entry that doesn't compile fails the runtime config validation at startup. Both match the path the relative lookup sends: decoded, without the query string and a trailing slash, and with `app.baseURL` and the shop path prefix, so with the `path` shop selector `/llms.txt` arrives as `/de/llms.txt`. A matching request skips the cache read and both Storefront API lookups, for the `before-request` and the `on-missing` strategy. The default `[]` keeps the current behavior.
33
+
34
+ `NUXT_STOREFRONT_REDIRECTS_SKIP_LOOKUP_PATHS` and `NUXT_STOREFRONT_REDIRECTS_SKIP_LOOKUP_PATTERNS` override the lists, each with a JSON array. The module now also sets `redirects.enabled` to `false` by default, so `NUXT_STOREFRONT_REDIRECTS_ENABLED` takes effect even when your Nuxt config has no `redirects` key.
35
+
36
+ ```ts
37
+ export default defineNuxtConfig({
38
+ runtimeConfig: {
39
+ storefront: {
40
+ redirects: {
41
+ enabled: true,
42
+ skipLookupPaths: ['/de/.well-known'],
43
+ skipLookupPatterns: ['/llms\\.txt$'],
44
+ },
45
+ },
46
+ },
47
+ })
48
+ ```
49
+
50
+ - Changed the redirects middleware to send fewer redirect lookups to the Storefront API. Every lookup counts against the rate limit that all Storefront API endpoints share, and many of them could never return a Panel redirect.
51
+
52
+ - Requests with a method other than `GET` or `HEAD` no longer send a lookup.
53
+ - Requests whose path after `app.baseURL` starts with `/_i18n/`, `/_ipx/` or `app.buildAssetsDir` no longer send a lookup.
54
+ - Lookup results, with or without a matching redirect, are now cached for 15 minutes instead of 120 seconds. The Storefront API already caches each match for 15 minutes, so the shorter cache repeated lookups without applying Panel changes sooner. A new or changed redirect in the SCAYLE Panel can now take up to about 30 minutes to apply, up from about 17.
55
+
56
+ All three changes apply to the `before-request` and the `on-missing` strategy.
57
+
58
+ ### Patch Changes
59
+
60
+ - Updated dependency `@vercel/nft@1.11.1` to `@vercel/nft@1.11.12`
61
+ - Fixed `originalIp` on the RPC context returning the address of the proxy in front of the Storefront Application instead of the user's IP. The Authentication API received that proxy address in the `x-original-client-ip` header, which made sign-in requests from different users indistinguishable. `originalIp` now reads the last entry of the `X-Forwarded-For` header and is `undefined` when that entry is missing or not a valid IP address, so the header is left out instead of carrying an internal address.
62
+
63
+ **Dependencies**
64
+
65
+ **@scayle/storefront-core v8.64.0**
66
+
67
+ - Patch
68
+ - Fixed the `getOrderById` RPC accepting an `orderId` that is not a positive integer. It now returns its `404` `ErrorResponse` for such a value without calling the Customer Account API, and `CustomerAPIClient.getOrder` URL-encodes the `orderId` in the request path.
69
+ - Fixed the `updatePassword` RPC reporting success when the Authentication API or the Customer Account API rejected the password change with a status other than 401, 403 or 404, such as a 400 or 422. It now returns an `ErrorResponse` with that status, so `useUser().updatePassword` rejects instead of resolving while the old password stays valid.
70
+
3
71
  ## 8.63.0
4
72
 
5
73
  ### Minor Changes
package/dist/module.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.63.0",
3
+ "version": "8.65.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
- "nuxt": ">=3.13"
6
+ "nuxt": ">=3.15.0 <4.0.0 || >=4.2.2"
7
7
  },
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.3",
9
+ "@nuxt/module-builder": "1.0.4",
10
10
  "unbuild": "3.6.1"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -57,7 +57,7 @@ export default {
57
57
  }`;
58
58
  }
59
59
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
60
- const PACKAGE_VERSION = "8.63.0";
60
+ const PACKAGE_VERSION = "8.65.0";
61
61
  const logger = createConsola({
62
62
  fancy: true,
63
63
  formatOptions: {
@@ -345,7 +345,7 @@ const module$1 = defineNuxtModule({
345
345
  version: PACKAGE_VERSION,
346
346
  configKey: "storefront",
347
347
  compatibility: {
348
- nuxt: ">=3.13"
348
+ nuxt: ">=3.15.0 <4.0.0 || >=4.2.2"
349
349
  }
350
350
  },
351
351
  // Default configuration options of the Nuxt module
@@ -391,6 +391,15 @@ const module$1 = defineNuxtModule({
391
391
  // maxAge: undefined,
392
392
  },
393
393
  shopSelector: "domain",
394
+ // Nuxt applies a `NUXT_` environment variable only to a key that exists
395
+ // at build time, so the skip lists and `lookupAbsoluteUrl` need a
396
+ // default here.
397
+ redirects: {
398
+ enabled: false,
399
+ skipLookupPaths: [],
400
+ skipLookupPatterns: [],
401
+ lookupAbsoluteUrl: true
402
+ },
394
403
  oauth: {
395
404
  apiHost: "",
396
405
  clientId: "",
@@ -1,4 +1,4 @@
1
- import { getRequestIP, getRequestHeaders } from "h3";
1
+ import { getRequestIP, getRequestHeader, getRequestHeaders } from "h3";
2
2
  import {
3
3
  createAndPurifyHeaders,
4
4
  StorefrontAPIClient,
@@ -11,6 +11,7 @@ import { useNitroApp } from "nitropack/runtime";
11
11
  import { getCachedFunction } from "./cached.js";
12
12
  import { getApiBasePath } from "./server/middleware/bootstrap-utils.js";
13
13
  import { fetchCampaignKey } from "./campaignKey.js";
14
+ import { getClientIpFromForwardedFor } from "./utils/clientIp.js";
14
15
  import * as moduleOptions from "#internal/storefront-options.mjs";
15
16
  import { rpcHttpMethods } from "#virtual/rpcHttpMethods";
16
17
  async function getWishlistKey(appKeys, session, $log, $shopConfig) {
@@ -121,8 +122,11 @@ export const buildContext = async (context) => {
121
122
  get ip() {
122
123
  return getRequestIP(event, { xForwardedFor: true });
123
124
  },
125
+ // The socket peer is the hosting proxy, not the user, so it is never a fallback.
124
126
  get originalIp() {
125
- return getRequestIP(event, { xForwardedFor: false });
127
+ return getClientIpFromForwardedFor(
128
+ getRequestHeader(event, "x-forwarded-for")
129
+ );
126
130
  },
127
131
  get headers() {
128
132
  return createAndPurifyHeaders(getRequestHeaders(event));
@@ -11,10 +11,10 @@ import type { Log } from '@scayle/storefront-core';
11
11
  *
12
12
  * @returns helper on the `NuxtApp` containing the 'log' and 'coreLog' instances.
13
13
  */
14
- declare const _default: import("#app").Plugin<{
14
+ declare const _default: import("nuxt/app").Plugin<{
15
15
  log: Log;
16
16
  coreLog: Log;
17
- }> & import("#app").ObjectPlugin<{
17
+ }> & import("nuxt/app").ObjectPlugin<{
18
18
  log: Log;
19
19
  coreLog: Log;
20
20
  }>;
@@ -10,10 +10,10 @@
10
10
  * @returns A helper on the `NuxtApp` containing the `log` and
11
11
  * `coreLog`instances, or undefined if ssrContext is missing.
12
12
  */
13
- declare const _default: import("#app").Plugin<{
13
+ declare const _default: import("nuxt/app").Plugin<{
14
14
  log: import("@scayle/storefront-core").Log;
15
15
  coreLog: import("@scayle/storefront-core").Log;
16
- }> & import("#app").ObjectPlugin<{
16
+ }> & import("nuxt/app").ObjectPlugin<{
17
17
  log: import("@scayle/storefront-core").Log;
18
18
  coreLog: import("@scayle/storefront-core").Log;
19
19
  }>;
@@ -13,10 +13,10 @@
13
13
  * const { currentShop, availableShop } = useNuxtApp()
14
14
  * ```
15
15
  */
16
- declare const _default: import("#app").Plugin<{
16
+ declare const _default: import("nuxt/app").Plugin<{
17
17
  currentShop: import("../../index.js").PublicShopConfig;
18
18
  availableShops: import("../../index.js").PublicShopConfig[];
19
- }> & import("#app").ObjectPlugin<{
19
+ }> & import("nuxt/app").ObjectPlugin<{
20
20
  currentShop: import("../../index.js").PublicShopConfig;
21
21
  availableShops: import("../../index.js").PublicShopConfig[];
22
22
  }>;
@@ -7,6 +7,15 @@ import type { H3Event } from 'h3';
7
7
  * It utilizes a cache to store redirect results and falls back to the
8
8
  * Storefront API if no cached redirect is available.
9
9
  *
10
+ * Requests with a method other than `GET` or `HEAD`, requests for the
11
+ * `/_i18n/`, `/_ipx/` and `app.buildAssetsDir` routes, and requests whose path
12
+ * matches `redirects.skipLookupPaths` or `redirects.skipLookupPatterns` return
13
+ * without a lookup.
14
+ *
15
+ * A request looks up its path and its absolute URL in parallel, and a match
16
+ * for the path wins. With `redirects.lookupAbsoluteUrl` set to `false`, it
17
+ * looks up only the path.
18
+ *
10
19
  * @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/features/redirects#overview
11
20
  * @see https://scayle.dev/en/core-documentation/the-basics/shops/redirects
12
21
  *
@@ -1,10 +1,51 @@
1
1
  import { sendRedirect, getRequestURL } from "h3";
2
+ import { withoutBase } from "ufo";
2
3
  import { UnstorageCache } from "@scayle/storefront-core";
3
4
  import { getRedirectLookupUrls, getTargetLocation } from "./redirects.utils.js";
4
5
  import { useRuntimeConfig } from "#imports";
5
6
  const REDIS_REDIRECT_PREFIX = ":REDIRECT";
6
7
  const REDIRECT_NOT_SET = "REDIRECT_NOT_SET";
7
- const REDIRECT_CACHE_TTL = 120;
8
+ const REDIRECT_CACHE_TTL = 900;
9
+ const APPLICATION_ROUTE_PREFIXES = ["/_i18n/", "/_ipx/"];
10
+ function isRedirectLookupCandidate(event, url, app) {
11
+ if (event.method !== "GET" && event.method !== "HEAD") {
12
+ return false;
13
+ }
14
+ const path = withoutBase(url.pathname, app.baseURL);
15
+ const skippedPrefixes = [...APPLICATION_ROUTE_PREFIXES, app.buildAssetsDir];
16
+ return !skippedPrefixes.some((prefix) => path.startsWith(prefix));
17
+ }
18
+ const compiledSkipLookupPatterns = /* @__PURE__ */ new WeakMap();
19
+ function compileSkipLookupPatterns(skipLookupPatterns, log) {
20
+ const cached = compiledSkipLookupPatterns.get(skipLookupPatterns);
21
+ if (cached) {
22
+ return cached;
23
+ }
24
+ const compiled = skipLookupPatterns.flatMap((pattern) => {
25
+ try {
26
+ return [new RegExp(pattern)];
27
+ } catch (error) {
28
+ log.error(
29
+ `Ignoring the redirects.skipLookupPatterns entry ${JSON.stringify(pattern)}, it is not a valid regular expression`,
30
+ error
31
+ );
32
+ return [];
33
+ }
34
+ });
35
+ compiledSkipLookupPatterns.set(skipLookupPatterns, compiled);
36
+ return compiled;
37
+ }
38
+ function isSkippedLookupPath(url, skipLookupPaths, skipLookupPatterns) {
39
+ if (skipLookupPaths.length === 0 && skipLookupPatterns.length === 0) {
40
+ return false;
41
+ }
42
+ const { relativeSourceUrl: lookupPath } = getRedirectLookupUrls(url);
43
+ return skipLookupPaths.some((rulePath) => isAtOrBelowPath(lookupPath, rulePath)) || skipLookupPatterns.some((pattern) => pattern.test(lookupPath));
44
+ }
45
+ function isAtOrBelowPath(path, rulePath) {
46
+ const base = rulePath.endsWith("/") ? rulePath.slice(0, -1) : rulePath;
47
+ return path === base || path.startsWith(`${base}/`);
48
+ }
8
49
  async function fetchRedirectWithCache(sourceUrl, storefrontAPIClient, redirectCache, log, waitUntil) {
9
50
  const cacheKey = encodeURIComponent(sourceUrl);
10
51
  try {
@@ -63,7 +104,17 @@ export async function useRedirects(event) {
63
104
  xForwardedProto: true,
64
105
  xForwardedHost: true
65
106
  });
107
+ if (!isRedirectLookupCandidate(event, url, config.app)) {
108
+ return;
109
+ }
66
110
  const log = event.context.$rpcContext.log.space("sfc").space("redirects");
111
+ if (isSkippedLookupPath(
112
+ url,
113
+ options?.skipLookupPaths ?? [],
114
+ compileSkipLookupPatterns(options?.skipLookupPatterns ?? [], log)
115
+ )) {
116
+ return;
117
+ }
67
118
  const shopCache = event.context.$cache;
68
119
  const redirectCache = new UnstorageCache(
69
120
  shopCache.storage,
@@ -76,6 +127,7 @@ export async function useRedirects(event) {
76
127
  url,
77
128
  queryParamWhitelist
78
129
  );
130
+ const lookupAbsoluteUrl = options?.lookupAbsoluteUrl ?? true;
79
131
  const [relativeRedirect, absoluteRedirect] = await Promise.all([
80
132
  fetchRedirectWithCache(
81
133
  relativeSourceUrl,
@@ -84,16 +136,20 @@ export async function useRedirects(event) {
84
136
  log,
85
137
  event.waitUntil
86
138
  ),
87
- fetchRedirectWithCache(
139
+ lookupAbsoluteUrl ? fetchRedirectWithCache(
88
140
  absoluteSourceUrl,
89
141
  sapiClient,
90
142
  redirectCache,
91
143
  log,
92
144
  event.waitUntil
93
- )
145
+ ) : null
94
146
  ]);
95
147
  if (relativeRedirect && absoluteRedirect) {
96
148
  log.info(`There are multiple valid redirects for: ${url.toString()}`);
149
+ } else if (absoluteRedirect) {
150
+ log.debug(
151
+ `Only the absolute URL lookup found a redirect for: ${url.toString()} (source: ${absoluteRedirect.source})`
152
+ );
97
153
  }
98
154
  const redirect = relativeRedirect ?? absoluteRedirect;
99
155
  if (!redirect) {
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Extracts the user's IP address from an `X-Forwarded-For` header value.
3
+ *
4
+ * Used for `originalIp` on the RPC context, which the Authentication API
5
+ * requests forward as `x-original-client-ip`.
6
+ *
7
+ * Proxies append to `X-Forwarded-For`, so a request that passed several hops
8
+ * carries `client, proxy-1, proxy-2`. Only the last entry was written by the
9
+ * proxy in front of this server; entries to its left can be set by the client.
10
+ * Storefront Hosting overwrites the header with the IP address Cloudflare
11
+ * reports for the user.
12
+ *
13
+ * @param forwardedFor The raw `X-Forwarded-For` header value.
14
+ *
15
+ * @returns The last entry when it is a valid IPv4 or IPv6 address, otherwise
16
+ * `undefined`.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * getClientIpFromForwardedFor('198.51.100.1, 203.0.113.7') // '203.0.113.7'
21
+ * ```
22
+ */
23
+ export declare function getClientIpFromForwardedFor(forwardedFor: string | undefined): string | undefined;
@@ -0,0 +1,8 @@
1
+ import { isIP } from "node:net";
2
+ export function getClientIpFromForwardedFor(forwardedFor) {
3
+ const lastEntry = forwardedFor?.split(",").at(-1)?.trim();
4
+ if (!lastEntry || isIP(lastEntry) === 0) {
5
+ return void 0;
6
+ }
7
+ return lastEntry;
8
+ }
@@ -7,6 +7,9 @@ export declare const RedirectsSchema: z.ZodMiniObject<{
7
7
  "before-request": "before-request";
8
8
  "on-missing": "on-missing";
9
9
  }>>;
10
+ skipLookupPaths: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
11
+ skipLookupPatterns: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
12
+ lookupAbsoluteUrl: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
10
13
  }, z.core.$strip>;
11
14
  declare const SessionSchema: z.ZodMiniObject<{
12
15
  sameSite: z.ZodMiniOptional<z.ZodMiniEnum<{
@@ -326,15 +329,15 @@ declare const ShopConfigSchema: z.ZodMiniObject<{
326
329
  isDefault: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniString<string>]>>;
327
330
  }, z.core.$strip>;
328
331
  declare const ShopSelectorSchema: z.ZodMiniEnum<{
329
- domain: "domain";
330
332
  path: "path";
333
+ domain: "domain";
331
334
  path_or_default: "path_or_default";
332
335
  }>;
333
336
  type ShopConfigType = z.infer<typeof ShopConfigSchema>;
334
337
  declare const StorefrontRuntimeConfigSchema: z.ZodMiniObject<{
335
338
  shopSelector: z.ZodMiniEnum<{
336
- domain: "domain";
337
339
  path: "path";
340
+ domain: "domain";
338
341
  path_or_default: "path_or_default";
339
342
  }>;
340
343
  redirects: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -344,6 +347,9 @@ declare const StorefrontRuntimeConfigSchema: z.ZodMiniObject<{
344
347
  "before-request": "before-request";
345
348
  "on-missing": "on-missing";
346
349
  }>>;
350
+ skipLookupPaths: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
351
+ skipLookupPatterns: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
352
+ lookupAbsoluteUrl: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
347
353
  }, z.core.$strip>>;
348
354
  shops: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
349
355
  idp: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -781,8 +787,8 @@ declare const StorefrontPublicRuntimeConfigSchema: z.ZodMiniObject<{
781
787
  export declare const RuntimeConfigSchema: z.ZodMiniObject<{
782
788
  storefront: z.ZodMiniObject<{
783
789
  shopSelector: z.ZodMiniEnum<{
784
- domain: "domain";
785
790
  path: "path";
791
+ domain: "domain";
786
792
  path_or_default: "path_or_default";
787
793
  }>;
788
794
  redirects: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -792,6 +798,9 @@ export declare const RuntimeConfigSchema: z.ZodMiniObject<{
792
798
  "before-request": "before-request";
793
799
  "on-missing": "on-missing";
794
800
  }>>;
801
+ skipLookupPaths: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
802
+ skipLookupPatterns: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
803
+ lookupAbsoluteUrl: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
795
804
  }, z.core.$strip>>;
796
805
  shops: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
797
806
  idp: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -1,10 +1,74 @@
1
1
  import * as z from "zod/mini";
2
2
  import { rpcMethods } from "@scayle/storefront-core";
3
3
  import { builtinDrivers } from "unstorage";
4
+ function isRegExpSource(pattern) {
5
+ try {
6
+ return new RegExp(pattern) instanceof RegExp;
7
+ } catch {
8
+ return false;
9
+ }
10
+ }
4
11
  export const RedirectsSchema = z.object({
5
12
  enabled: z.boolean(),
6
13
  queryParamWhitelist: z.optional(z.array(z.string())),
7
- strategy: z.optional(z.enum(["before-request", "on-missing"]))
14
+ strategy: z.optional(z.enum(["before-request", "on-missing"])),
15
+ /**
16
+ * Paths that skip the redirect lookup, because you know the SCAYLE Panel
17
+ * has no redirect for them. A path matches itself and every path below it,
18
+ * so `'/de/.well-known'` covers the directory and its files but not
19
+ * `/de/.well-known-guide`. A trailing slash makes no difference. Defaults
20
+ * to `[]`.
21
+ *
22
+ * Entries match the path the lookup sends: decoded, without the query
23
+ * string and a trailing slash, and with `app.baseURL` and the shop path
24
+ * prefix. The entry `'/'` or `''` would match every path, so it fails the
25
+ * runtime config validation at startup. To skip every lookup, set
26
+ * `enabled` to `false`.
27
+ *
28
+ * Override with `NUXT_STOREFRONT_REDIRECTS_SKIP_LOOKUP_PATHS`, a JSON array.
29
+ */
30
+ skipLookupPaths: z.optional(
31
+ z.array(
32
+ z.string().check(
33
+ z.refine((path) => path !== "/" && path !== "", {
34
+ error: (issue) => `${JSON.stringify(issue.input)} matches every path, set redirects.enabled to false to skip every lookup`
35
+ })
36
+ )
37
+ )
38
+ ),
39
+ /**
40
+ * Regular expressions, as source strings, for paths that skip the redirect
41
+ * lookup, such as `'/llms\\.txt$'` for crawler requests for `/llms.txt`
42
+ * under every shop path. Each entry is compiled with `new RegExp(pattern)`,
43
+ * without flags, and tested against the same path as `skipLookupPaths`. An
44
+ * entry that doesn't compile fails the runtime config validation at
45
+ * startup. Defaults to `[]`.
46
+ *
47
+ * Override with `NUXT_STOREFRONT_REDIRECTS_SKIP_LOOKUP_PATTERNS`, a JSON
48
+ * array.
49
+ */
50
+ skipLookupPatterns: z.optional(
51
+ z.array(
52
+ z.string().check(
53
+ z.refine(isRegExpSource, {
54
+ error: (issue) => `Invalid regular expression ${JSON.stringify(issue.input)}`
55
+ })
56
+ )
57
+ )
58
+ ),
59
+ /**
60
+ * Looks up the absolute URL of a request, such as
61
+ * `https://example.com/men`, in addition to its path. The Storefront API
62
+ * compares a plain redirect source with the lookup URL character by
63
+ * character, so only sources stored as absolute URLs and regular
64
+ * expressions that match the host need this lookup. Set it to `false` when
65
+ * none of your shops has such a source, to halve the redirect lookups. The
66
+ * option applies to every shop, so keep the default if any shop has one.
67
+ * Defaults to `true`.
68
+ *
69
+ * Override with `NUXT_STOREFRONT_REDIRECTS_LOOKUP_ABSOLUTE_URL`.
70
+ */
71
+ lookupAbsoluteUrl: z.optional(z.boolean())
8
72
  });
9
73
  const SessionSchema = z.object({
10
74
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.63.0",
4
+ "version": "8.65.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -67,21 +67,21 @@
67
67
  "node": ">= 22.0.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@nuxt/kit": ">=3.15.0 || >=4.2.0",
70
+ "@nuxt/kit": ">=3.15.0 <4.0.0 || >=4.2.0",
71
71
  "@scayle/storefront-api": "^19.9.0",
72
72
  "fishery": "^2.2.2",
73
73
  "h3": "^1.10.0",
74
74
  "nitropack": "^2.9.7",
75
- "nuxt": ">=3.15.0 || >=4.2.2",
75
+ "nuxt": ">=3.15.0 <4.0.0 || >=4.2.2",
76
76
  "unstorage": "^1.10.1",
77
77
  "vue": "^3.4.0"
78
78
  },
79
79
  "dependencies": {
80
80
  "@opentelemetry/api": "^1.9.1",
81
81
  "@scayle/h3-session": "0.7.2",
82
- "@scayle/storefront-core": "8.63.0",
83
- "@scayle/unstorage-compression-driver": "1.6.0",
84
- "@vercel/nft": "1.11.1",
82
+ "@scayle/storefront-core": "8.65.0",
83
+ "@scayle/unstorage-compression-driver": "1.6.3",
84
+ "@vercel/nft": "1.11.12",
85
85
  "@vueuse/core": "15.0.0",
86
86
  "consola": "^3.4.2",
87
87
  "core-js": "^3.49.0",
@@ -96,7 +96,7 @@
96
96
  "uncrypto": "^0.1.3",
97
97
  "unstorage": "1.17.6",
98
98
  "utility-types": "^3.11.0",
99
- "vue-router": "4.6.4",
99
+ "vue-router": "4.6.5",
100
100
  "zod": "^4.6.7"
101
101
  },
102
102
  "devDependencies": {
@@ -104,7 +104,7 @@
104
104
  "@nuxt/eslint-config": "1.16.0",
105
105
  "@nuxt/kit": "^3.21.10",
106
106
  "@nuxtjs/i18n": "10.5.0",
107
- "@nuxt/module-builder": "1.0.3",
107
+ "@nuxt/module-builder": "1.0.4",
108
108
  "@nuxt/schema": "^3.21.10",
109
109
  "@nuxt/test-utils": "4.0.3",
110
110
  "@opentelemetry/context-async-hooks": "^2.8.0",
@@ -114,8 +114,8 @@
114
114
  "@scayle/unstorage-scayle-kv-driver": "^3.0.0",
115
115
  "@scayle/vitest-config-storefront": "1.0.0",
116
116
  "@types/node": "^24",
117
- "@vitest/coverage-v8": "5.1.0",
118
- "eslint": "10.14.0",
117
+ "@vitest/coverage-v8": "5.1.2",
118
+ "eslint": "10.15.0",
119
119
  "eslint-formatter-gitlab": "7.2.0",
120
120
  "fishery": "2.4.0",
121
121
  "h3": "1.15.11",
@@ -127,7 +127,7 @@
127
127
  "publint": "0.3.25",
128
128
  "typescript": "6.0.3",
129
129
  "unbuild": "3.6.1",
130
- "vitest": "5.1.0",
130
+ "vitest": "5.1.2",
131
131
  "vue-tsc": "3.3.14"
132
132
  },
133
133
  "scripts": {