@scayle/storefront-nuxt 8.1.6 → 8.2.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,26 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependency `@vueuse/core@12.0.0` to `@vueuse/core@12.3.0`
8
+
9
+ **Dependencies**
10
+
11
+ - Updated dependency to @scayle/unstorage-compression-driver@0.2.3
12
+ - Updated dependency to @scayle/storefront-core@8.1.3
13
+
14
+ ## 8.2.0
15
+
16
+ ### Minor Changes
17
+
18
+ - `storefront-nuxt` now includes experimental support for OpenTelemetry spans covering the bootstrapping and redirects middlewares. This aims to provide better insights into their performance impact. Please note that this is an experimental feature and its implementation and API might change in future releases.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependency `@scayle/h3-session@^0.5.0` to `@scayle/h3-session@0.5.0`
23
+
3
24
  ## 8.1.6
4
25
 
5
26
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.1.6",
3
+ "version": "8.2.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
7
7
  },
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
- "unbuild": "3.0.1"
10
+ "unbuild": "3.2.0"
11
11
  }
12
12
  }
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.1.6";
48
+ const PACKAGE_VERSION = "8.2.1";
49
49
  const logger = createConsola({
50
50
  fancy: true,
51
51
  formatOptions: {
@@ -1,8 +1,8 @@
1
1
  import type { Log } from '@scayle/storefront-core';
2
- declare const _default: import("nuxt/app").Plugin<{
2
+ declare const _default: import("#app/nuxt").Plugin<{
3
3
  log: Log;
4
4
  coreLog: Log;
5
- }> & import("nuxt/app").ObjectPlugin<{
5
+ }> & import("#app/nuxt").ObjectPlugin<{
6
6
  log: Log;
7
7
  coreLog: Log;
8
8
  }>;
@@ -1,7 +1,7 @@
1
- declare const _default: import("nuxt/app").Plugin<{
1
+ declare const _default: import("#app/nuxt").Plugin<{
2
2
  log: import("@scayle/storefront-core").Log;
3
3
  coreLog: import("@scayle/storefront-core").Log;
4
- }> & import("nuxt/app").ObjectPlugin<{
4
+ }> & import("#app/nuxt").ObjectPlugin<{
5
5
  log: import("@scayle/storefront-core").Log;
6
6
  coreLog: import("@scayle/storefront-core").Log;
7
7
  }>;
@@ -1,7 +1,7 @@
1
- declare const _default: import("nuxt/app").Plugin<{
1
+ declare const _default: import("#app/nuxt").Plugin<{
2
2
  currentShop: import("../..").PublicShopConfig;
3
3
  availableShops: import("../..").PublicShopConfig[];
4
- }> & import("nuxt/app").ObjectPlugin<{
4
+ }> & import("#app/nuxt").ObjectPlugin<{
5
5
  currentShop: import("../..").PublicShopConfig;
6
6
  availableShops: import("../..").PublicShopConfig[];
7
7
  }>;
@@ -5,6 +5,7 @@ import {
5
5
  useSession,
6
6
  unsignCookie
7
7
  } from "@scayle/h3-session";
8
+ import { trace, SpanStatusCode } from "@opentelemetry/api";
8
9
  import { buildContext } from "../../context.js";
9
10
  import { useCacheStorage, useSessionStorage } from "../utils/cacheStorage.js";
10
11
  import {
@@ -24,6 +25,10 @@ const generateSessionId = (event) => {
24
25
  }
25
26
  return userId ? `${userId}:${randomUUID()}` : randomUUID();
26
27
  };
28
+ const tracer = trace.getTracer(
29
+ "storefront-nuxt",
30
+ "__sfc_version"
31
+ );
27
32
  async function getOldSessionData(event, cookieName, store, secret) {
28
33
  const rawCookie = getCookie(event, cookieName);
29
34
  const normalizedSecrets = Array.isArray(secret) ? secret : [secret];
@@ -134,50 +139,73 @@ async function bootstrap(event, $shopConfig, $storefrontConfig, apiBasePath, con
134
139
  });
135
140
  }
136
141
  export default defineEventHandler(async (event) => {
137
- try {
138
- const { path, originalPath } = getBootstrapPath(event);
139
- if (path.startsWith("/__nuxt")) {
140
- return;
141
- }
142
- if (path === "/favicon.ico") {
143
- return;
144
- }
145
- const config = useRuntimeConfig(event);
146
- const $storefrontConfig = config.storefront;
147
- if (path === `${$storefrontConfig.apiBasePath ?? "/api"}/up`) {
148
- return;
149
- }
150
- const $shopConfig = getCurrentShopConfigForRequest(
151
- event,
152
- $storefrontConfig,
153
- config.app
154
- );
155
- if (!$shopConfig) {
156
- event.context.$log.debug(
157
- "Could not find shop config for this request",
158
- path
159
- );
160
- return;
161
- }
162
- const apiBasePath = getApiBasePath(
163
- $storefrontConfig,
164
- $shopConfig,
165
- config.app.baseURL
166
- );
167
- if (!event.context.$rpcContext) {
168
- event.context.$log.debug("Bootstrapping request: " + path);
169
- await bootstrap(
170
- event,
171
- $shopConfig,
172
- $storefrontConfig,
173
- apiBasePath,
174
- config
175
- );
176
- }
177
- if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath) && originalPath !== "/__nuxt_error") {
178
- await useRedirects(event);
179
- }
180
- } catch (e) {
181
- console.error(e);
142
+ const { path, originalPath } = getBootstrapPath(event);
143
+ if (path.startsWith("/__nuxt")) {
144
+ return;
182
145
  }
146
+ if (path === "/favicon.ico") {
147
+ return;
148
+ }
149
+ const config = useRuntimeConfig(event);
150
+ const $storefrontConfig = config.storefront;
151
+ if (path === `${$storefrontConfig.apiBasePath ?? "/api"}/up`) {
152
+ return;
153
+ }
154
+ await tracer.startActiveSpan(
155
+ `storefront-nuxt.middleware/bootstrap`,
156
+ {
157
+ attributes: {
158
+ path,
159
+ originalPath
160
+ }
161
+ },
162
+ async (span) => {
163
+ try {
164
+ const $shopConfig = getCurrentShopConfigForRequest(
165
+ event,
166
+ $storefrontConfig,
167
+ config.app
168
+ );
169
+ if (!$shopConfig) {
170
+ event.context.$log.debug(
171
+ "Could not find shop config for this request",
172
+ path
173
+ );
174
+ return;
175
+ }
176
+ const apiBasePath = getApiBasePath(
177
+ $storefrontConfig,
178
+ $shopConfig,
179
+ config.app.baseURL
180
+ );
181
+ if (!event.context.$rpcContext) {
182
+ event.context.$log.debug("Bootstrapping request: " + path);
183
+ await bootstrap(
184
+ event,
185
+ $shopConfig,
186
+ $storefrontConfig,
187
+ apiBasePath,
188
+ config
189
+ );
190
+ }
191
+ if ($storefrontConfig.redirects?.enabled && !path.startsWith(apiBasePath) && originalPath !== "/__nuxt_error") {
192
+ await tracer.startActiveSpan(
193
+ `storefront-nuxt.middleware/redirects`,
194
+ {},
195
+ async (innerSpan) => {
196
+ await useRedirects(event);
197
+ innerSpan.end();
198
+ }
199
+ );
200
+ }
201
+ } catch (e) {
202
+ console.error(e);
203
+ span.setStatus({ code: SpanStatusCode.ERROR });
204
+ if (e instanceof Error) {
205
+ span.recordException(e);
206
+ }
207
+ }
208
+ span.end();
209
+ }
210
+ );
183
211
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.1.6",
4
+ "version": "8.2.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -72,10 +72,10 @@
72
72
  "dependencies": {
73
73
  "@nuxt/kit": "^3.12.2",
74
74
  "@opentelemetry/api": "^1.9.0",
75
- "@scayle/h3-session": "^0.5.0",
76
- "@scayle/storefront-core": "8.1.2",
77
- "@scayle/unstorage-compression-driver": "^0.2.2",
78
- "@vueuse/core": "12.0.0",
75
+ "@scayle/h3-session": "0.5.0",
76
+ "@scayle/storefront-core": "8.1.3",
77
+ "@scayle/unstorage-compression-driver": "^0.2.3",
78
+ "@vueuse/core": "12.3.0",
79
79
  "consola": "^3.2.3",
80
80
  "core-js": "^3.37.1",
81
81
  "defu": "^6.1.4",
@@ -91,24 +91,24 @@
91
91
  "schema-dts": "1.1.2"
92
92
  },
93
93
  "devDependencies": {
94
- "@nuxt/eslint": "0.7.3",
94
+ "@nuxt/eslint": "0.7.4",
95
95
  "@nuxt/module-builder": "0.8.4",
96
96
  "@nuxt/schema": "3.14.1592",
97
97
  "@nuxt/test-utils": "3.15.1",
98
98
  "@scayle/eslint-config-storefront": "4.4.0",
99
99
  "@scayle/eslint-plugin-vue-composable": "0.2.1",
100
- "@types/node": "22.10.2",
101
- "dprint": "0.47.6",
100
+ "@types/node": "22.10.5",
101
+ "dprint": "0.48.0",
102
102
  "eslint": "9.17.0",
103
103
  "eslint-formatter-gitlab": "5.1.0",
104
104
  "fishery": "2.2.2",
105
105
  "h3": "1.13.0",
106
106
  "nitropack": "2.9.7",
107
107
  "node-mocks-http": "1.16.2",
108
- "nuxi": "3.17.0",
108
+ "nuxi": "3.17.2",
109
109
  "nuxt": "3.14.1592",
110
110
  "publint": "0.2.12",
111
- "vue-tsc": "2.1.10",
111
+ "vue-tsc": "2.2.0",
112
112
  "vitest": "2.1.8"
113
113
  },
114
114
  "peerDependencies": {