@scayle/storefront-nuxt 8.6.0 → 8.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Consider `baseURL` configuration when bootstrapping error pages. This ensures error pages have the correct `currentShop`.
8
+
3
9
  ## 8.6.0
4
10
 
5
11
  ### Minor Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 SCAYLE GmbH
3
+ Copyright (c) 2025 SCAYLE GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.6.0",
3
+ "version": "8.6.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -45,7 +45,7 @@ export default {
45
45
  }`;
46
46
  }
47
47
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
48
- const PACKAGE_VERSION = "8.6.0";
48
+ const PACKAGE_VERSION = "8.6.1";
49
49
  const logger = createConsola({
50
50
  fancy: true,
51
51
  formatOptions: {
@@ -5,7 +5,7 @@ type BootstrapPath = {
5
5
  path: string;
6
6
  originalPath: string;
7
7
  };
8
- export declare function getBootstrapPath(event: H3Event): BootstrapPath;
8
+ export declare function getBootstrapPath(url: URL, baseUrl: string): BootstrapPath;
9
9
  export declare const getShopByPath: (event: H3Event, shops: ShopConfig[], appBasePath: string) => ShopConfig | undefined;
10
10
  export declare const convertShopsToList: (shops: ShopConfig[] | ShopConfigIndexed) => ShopConfig[];
11
11
  export declare function getApiBasePath(storefrontConfig: ModuleBaseOptions, baseUrl: string): string;
@@ -4,9 +4,9 @@ import {
4
4
  getRequestURL
5
5
  } from "h3";
6
6
  import { joinURL } from "ufo";
7
- export function getBootstrapPath(event) {
8
- const url = getRequestURL(event);
9
- const path = url.pathname === "/__nuxt_error" ? url.searchParams.get("url") ?? url.pathname : url.pathname;
7
+ export function getBootstrapPath(url, baseUrl) {
8
+ const queryUrl = url.searchParams.get("url");
9
+ const path = url.pathname === joinURL(baseUrl, "/__nuxt_error") && queryUrl ? joinURL(baseUrl, queryUrl) : url.pathname;
10
10
  return { path, originalPath: url.pathname };
11
11
  }
12
12
  const getShopByDomain = (event, shops) => {
@@ -14,7 +14,8 @@ const getShopByDomain = (event, shops) => {
14
14
  return shops.find((s) => s.domain === host);
15
15
  };
16
16
  export const getShopByPath = (event, shops, appBasePath) => {
17
- const { path } = getBootstrapPath(event);
17
+ const url = getRequestURL(event);
18
+ const { path } = getBootstrapPath(url, appBasePath);
18
19
  const localeIndex = appBasePath !== "/" ? 2 : 1;
19
20
  const prefix = path.split("/")?.[localeIndex];
20
21
  const matchesShopPrefix = (shop) => Array.isArray(shop.path) ? shop.path.includes(prefix) : shop.path === prefix;
@@ -1,4 +1,4 @@
1
- import { defineEventHandler, getCookie, deleteCookie } from "h3";
1
+ import { defineEventHandler, getCookie, deleteCookie, getRequestURL } from "h3";
2
2
  import { decodeJwt } from "jose";
3
3
  import { randomUUID } from "uncrypto";
4
4
  import {
@@ -6,6 +6,7 @@ import {
6
6
  unsignCookie
7
7
  } from "@scayle/h3-session";
8
8
  import { trace, SpanStatusCode } from "@opentelemetry/api";
9
+ import { joinURL } from "ufo";
9
10
  import { buildContext } from "../../context.js";
10
11
  import { useCacheStorage, useSessionStorage } from "../utils/cacheStorage.js";
11
12
  import {
@@ -139,14 +140,15 @@ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, con
139
140
  });
140
141
  }
141
142
  export default defineEventHandler(async (event) => {
142
- const { path, originalPath } = getBootstrapPath(event);
143
- if (path.startsWith("/__nuxt")) {
143
+ const config = useRuntimeConfig(event);
144
+ const url = getRequestURL(event);
145
+ const { path, originalPath } = getBootstrapPath(url, config.app.baseURL);
146
+ if (path.startsWith(joinURL(config.app.baseURL, "/__nuxt"))) {
144
147
  return;
145
148
  }
146
149
  if (path === "/favicon.ico") {
147
150
  return;
148
151
  }
149
- const config = useRuntimeConfig(event);
150
152
  const $storefrontConfig = config.storefront;
151
153
  if (path === `${$storefrontConfig.apiBasePath ?? "/api"}/up`) {
152
154
  return;
@@ -187,7 +189,7 @@ export default defineEventHandler(async (event) => {
187
189
  config
188
190
  );
189
191
  }
190
- if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath) && originalPath !== "/__nuxt_error") {
192
+ if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath) && originalPath !== joinURL(config.app.baseURL, "/__nuxt_error")) {
191
193
  await tracer.startActiveSpan(
192
194
  `storefront-nuxt.middleware/redirects`,
193
195
  {},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.6.0",
4
+ "version": "8.6.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -90,27 +90,27 @@
90
90
  "schema-dts": "1.1.2"
91
91
  },
92
92
  "devDependencies": {
93
- "@nuxt/eslint": "0.7.5",
93
+ "@nuxt/eslint": "1.0.0",
94
94
  "@nuxt/kit": "3.14.1592",
95
95
  "@nuxt/module-builder": "0.8.4",
96
96
  "@nuxt/schema": "3.14.1592",
97
97
  "@nuxt/test-utils": "3.15.4",
98
98
  "@scayle/eslint-config-storefront": "4.4.1",
99
99
  "@scayle/eslint-plugin-vue-composable": "0.2.1",
100
- "@types/node": "22.10.10",
101
- "dprint": "0.48.0",
102
- "eslint": "9.18.0",
100
+ "@types/node": "22.13.1",
101
+ "dprint": "0.49.0",
102
+ "eslint": "9.19.0",
103
103
  "eslint-formatter-gitlab": "5.1.0",
104
- "fishery": "2.2.2",
104
+ "fishery": "2.2.3",
105
105
  "h3": "1.14.0",
106
106
  "nitropack": "2.9.7",
107
107
  "node-mocks-http": "1.16.2",
108
- "nuxi": "3.20.0",
108
+ "nuxi": "3.21.1",
109
109
  "nuxt": "3.14.1592",
110
110
  "publint": "0.2.12",
111
111
  "typescript": "5.7.3",
112
112
  "vue-tsc": "2.2.0",
113
- "vitest": "2.1.8"
113
+ "vitest": "2.1.9"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@nuxt/kit": "^3.12.2",
@@ -128,6 +128,6 @@
128
128
  "@nuxt/schema": "3.14.1592"
129
129
  },
130
130
  "volta": {
131
- "node": "22.13.0"
131
+ "node": "22.13.1"
132
132
  }
133
133
  }