@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 +6 -0
- package/LICENSE +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/server/middleware/bootstrap-utils.d.ts +1 -1
- package/dist/runtime/server/middleware/bootstrap-utils.js +5 -4
- package/dist/runtime/server/middleware/bootstrap.js +7 -5
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
package/LICENSE
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -5,7 +5,7 @@ type BootstrapPath = {
|
|
|
5
5
|
path: string;
|
|
6
6
|
originalPath: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function getBootstrapPath(
|
|
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(
|
|
8
|
-
const
|
|
9
|
-
const path = url.pathname === "/__nuxt_error" ?
|
|
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
|
|
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
|
|
143
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
101
|
-
"dprint": "0.
|
|
102
|
-
"eslint": "9.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
131
|
+
"node": "22.13.1"
|
|
132
132
|
}
|
|
133
133
|
}
|