@vue-storefront/nuxt 4.1.1 → 5.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/dist/module.json +2 -2
- package/dist/module.mjs +13 -9
- package/dist/runtime/useSfState.template +17 -0
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/package.json +6 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addTypeTemplate, addImports, addTemplate, addPluginTemplate, addImportsSources } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, installModule, addTypeTemplate, addImports, addTemplate, addPluginTemplate, addImportsSources } from '@nuxt/kit';
|
|
2
2
|
import { genInlineTypeImport } from 'knitwork';
|
|
3
3
|
import { defu } from 'defu';
|
|
4
4
|
|
|
5
5
|
const module = defineNuxtModule({
|
|
6
6
|
meta: {
|
|
7
7
|
name: "@vue-storefront/nuxt",
|
|
8
|
-
configKey: "
|
|
8
|
+
configKey: "alokai",
|
|
9
9
|
compatibility: {
|
|
10
10
|
nuxt: "^3.0.0"
|
|
11
11
|
}
|
|
@@ -19,19 +19,14 @@ const module = defineNuxtModule({
|
|
|
19
19
|
enabled: false
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
setup(options, nuxt) {
|
|
22
|
+
async setup(options, nuxt) {
|
|
23
23
|
const projectLayer = nuxt.options._layers[0];
|
|
24
24
|
const projectRootResolver = createResolver(projectLayer.config.rootDir);
|
|
25
25
|
const buildDirectoryResolver = createResolver(nuxt.options.buildDir);
|
|
26
26
|
const localResolver = createResolver(import.meta.url);
|
|
27
|
-
|
|
28
|
-
nuxt.options.runtimeConfig.public?.vsf,
|
|
29
|
-
options
|
|
30
|
-
);
|
|
27
|
+
await installModule("@pinia/nuxt");
|
|
31
28
|
nuxt.options.runtimeConfig.public.alokai = defu(
|
|
32
29
|
nuxt.options.runtimeConfig.public?.alokai,
|
|
33
|
-
{ middleware: { cdnCacheBustingId: process.env?.GIT_SHA } },
|
|
34
|
-
nuxt.options.runtimeConfig.public?.vsf,
|
|
35
30
|
options
|
|
36
31
|
);
|
|
37
32
|
nuxt.options.app.head.meta = [
|
|
@@ -76,6 +71,11 @@ export type SdkConfig = ${genInlineTypeImport(
|
|
|
76
71
|
moduleConfig: JSON.stringify(options)
|
|
77
72
|
}
|
|
78
73
|
});
|
|
74
|
+
addTemplate({
|
|
75
|
+
src: localResolver.resolve("./runtime/useSfState.template"),
|
|
76
|
+
filename: "useSfState.ts",
|
|
77
|
+
write: true
|
|
78
|
+
});
|
|
79
79
|
addPluginTemplate({
|
|
80
80
|
src: localResolver.resolve("./runtime/plugin.template"),
|
|
81
81
|
filename: "alokaiSdkPlugin.ts",
|
|
@@ -89,6 +89,10 @@ export type SdkConfig = ${genInlineTypeImport(
|
|
|
89
89
|
{
|
|
90
90
|
imports: ["defineSdkConfig"],
|
|
91
91
|
from: buildDirectoryResolver.resolve("defineSdkConfig.ts")
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
imports: ["useSfState"],
|
|
95
|
+
from: buildDirectoryResolver.resolve("useSfState.ts")
|
|
92
96
|
}
|
|
93
97
|
]);
|
|
94
98
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SfCart,
|
|
3
|
+
SfCurrency,
|
|
4
|
+
SfCustomer,
|
|
5
|
+
SfLocale,
|
|
6
|
+
} from "~/types";
|
|
7
|
+
|
|
8
|
+
export const useSfState = defineStore("SfState", () => {
|
|
9
|
+
const cart = ref<SfCart | null>(null);
|
|
10
|
+
const customer = ref<SfCustomer | null>(null);
|
|
11
|
+
const currencies = ref<SfCurrency[]>([]);
|
|
12
|
+
const currency = ref<SfCurrency>();
|
|
13
|
+
const locale = ref<SfLocale>();
|
|
14
|
+
const locales = ref<SfLocale[]>([]);
|
|
15
|
+
|
|
16
|
+
return { customer, cart, currencies, currency, locales, locale };
|
|
17
|
+
});
|
package/dist/types.d.mts
CHANGED
|
@@ -17,13 +17,13 @@ import type { } from './module.js'
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
declare module '@nuxt/schema' {
|
|
20
|
-
interface NuxtConfig { ['
|
|
21
|
-
interface NuxtOptions { ['
|
|
20
|
+
interface NuxtConfig { ['alokai']?: Partial<ModuleOptions> }
|
|
21
|
+
interface NuxtOptions { ['alokai']?: ModuleOptions }
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
declare module 'nuxt/schema' {
|
|
25
|
-
interface NuxtConfig { ['
|
|
26
|
-
interface NuxtOptions { ['
|
|
25
|
+
interface NuxtConfig { ['alokai']?: Partial<ModuleOptions> }
|
|
26
|
+
interface NuxtOptions { ['alokai']?: ModuleOptions }
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
package/dist/types.d.ts
CHANGED
|
@@ -17,13 +17,13 @@ import type { } from './module'
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
declare module '@nuxt/schema' {
|
|
20
|
-
interface NuxtConfig { ['
|
|
21
|
-
interface NuxtOptions { ['
|
|
20
|
+
interface NuxtConfig { ['alokai']?: Partial<ModuleOptions> }
|
|
21
|
+
interface NuxtOptions { ['alokai']?: ModuleOptions }
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
declare module 'nuxt/schema' {
|
|
25
|
-
interface NuxtConfig { ['
|
|
26
|
-
interface NuxtOptions { ['
|
|
25
|
+
interface NuxtConfig { ['alokai']?: Partial<ModuleOptions> }
|
|
26
|
+
interface NuxtOptions { ['alokai']?: ModuleOptions }
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-storefront/nuxt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Vue Storefront dedicated features for Nuxt",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,15 +30,18 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@nuxt/kit": "^3.7.4",
|
|
32
32
|
"@nuxt/schema": "^3.7.4",
|
|
33
|
-
"@
|
|
33
|
+
"@pinia/nuxt": "^0.5.1",
|
|
34
|
+
"@vue-storefront/sdk": "^3.2.0",
|
|
35
|
+
"defu": "^6.0.0",
|
|
34
36
|
"knitwork": "^1.0.0",
|
|
35
|
-
"
|
|
37
|
+
"pinia": "^2.1.7"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@types/node": "^18.11.17",
|
|
39
41
|
"@nuxt/devtools": "1.3.3",
|
|
40
42
|
"@nuxt/module-builder": "0.7.1",
|
|
41
43
|
"@nuxt/test-utils": "3.13.1",
|
|
44
|
+
"@vue-storefront/unified-data-model": "^2.0.0",
|
|
42
45
|
"nuxt": "3.12.2",
|
|
43
46
|
"start-server-and-test": "^2.0.3",
|
|
44
47
|
"vitest": "1.6.0"
|