@vue-storefront/nuxt 6.2.0 → 7.0.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/README.md CHANGED
@@ -67,7 +67,7 @@ export default defineSdkConfig(
67
67
  contentful: buildModule<ContentfulModuleType>(contentfulModule, {
68
68
  apiUrl: middlewareUrl + "/cntf",
69
69
  }),
70
- }),
70
+ })
71
71
  );
72
72
  ```
73
73
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "6.2.0",
7
+ "version": "7.0.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.7.1",
10
10
  "unbuild": "2.0.0"
@@ -1,14 +1,23 @@
1
- import { initSDK } from "@vue-storefront/sdk"
2
- import sdkConfig from "~/sdk.config"
3
- import { defineNuxtPlugin } from '#app'
1
+ import { initSDK, type SDKApi } from "@vue-storefront/sdk";
2
+ import sdkConfig from "~/sdk.config";
3
+ import type { SdkConfig } from "./sdk.config";
4
+ import { defineNuxtPlugin } from '#app';
4
5
 
5
6
  export default defineNuxtPlugin(() => {
6
- const config = sdkConfig();
7
- const sdk = initSDK<typeof config>(config);
7
+ let sdk: SDKApi<ReturnType<SdkConfig>>;
8
+
9
+ const getSdk = () => {
10
+ if (!sdk) {
11
+ const config = sdkConfig();
12
+ sdk = initSDK(config);
13
+ }
14
+
15
+ return sdk;
16
+ };
8
17
 
9
18
  return {
10
19
  provide: {
11
- alokai: { sdk }
12
- }
13
- }
14
- })
20
+ alokai: { getSdk },
21
+ },
22
+ };
23
+ });
@@ -4,7 +4,7 @@ import { useNuxtApp } from "#imports";
4
4
 
5
5
  export const useSdk = () => {
6
6
  const nuxtApp = useNuxtApp();
7
- const { sdk } = nuxtApp.$alokai as { sdk: SDKApi<ReturnType<SdkConfig>> };
7
+ const { getSdk } = nuxtApp.$alokai as { getSdk: ()=> SDKApi<ReturnType<SdkConfig>> };
8
8
 
9
- return sdk;
9
+ return getSdk();
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-storefront/nuxt",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
4
4
  "description": "Alokai dedicated features for Nuxt",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,7 +20,8 @@
20
20
  "build": "nuxt-module-build build",
21
21
  "lint": "biome ci .",
22
22
  "format": "prettier --write .",
23
- "prepare": "nuxi prepare"
23
+ "prepare": "nuxi prepare",
24
+ "version": "cp CHANGELOG.md ../../docs/content/storefront/6.change-log/nuxt.md"
24
25
  },
25
26
  "dependencies": {
26
27
  "@nuxt/kit": "^3.7.4",