@vue-storefront/nuxt 9.0.0-rc.3 → 9.0.0-rc.4
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 +1 -1
- package/dist/module.d.mts +8 -8
- package/dist/module.d.ts +8 -8
- package/dist/module.json +3 -3
- package/dist/module.mjs +37 -37
- package/dist/runtime/defineSdkConfig.template +5 -1
- package/dist/runtime/plugin.template +3 -10
- package/dist/runtime/utils/defaults.d.ts +14 -14
- package/dist/runtime/utils/defaults.js +8 -8
- package/dist/types.d.mts +8 -8
- package/dist/types.d.ts +8 -8
- package/package.json +5 -5
package/README.md
CHANGED
package/dist/module.d.mts
CHANGED
|
@@ -6,11 +6,6 @@ interface MiddlewareConfig {
|
|
|
6
6
|
* @example "http://localhost:4000"
|
|
7
7
|
*/
|
|
8
8
|
apiUrl: string;
|
|
9
|
-
/**
|
|
10
|
-
* The URL of the middleware for server-side rendering.
|
|
11
|
-
* @example "http://localhost:4000"
|
|
12
|
-
*/
|
|
13
|
-
ssrApiUrl: string;
|
|
14
9
|
/**
|
|
15
10
|
* This is identifier used to invalidate the cache on CDN when the assets change.
|
|
16
11
|
* Usually it's a commit hash.
|
|
@@ -18,6 +13,11 @@ interface MiddlewareConfig {
|
|
|
18
13
|
* @default "no-cache-busting-id-set"
|
|
19
14
|
*/
|
|
20
15
|
cdnCacheBustingId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The URL of the middleware for server-side rendering.
|
|
18
|
+
* @example "http://localhost:4000"
|
|
19
|
+
*/
|
|
20
|
+
ssrApiUrl: string;
|
|
21
21
|
}
|
|
22
22
|
interface MultistoreConfig {
|
|
23
23
|
/**
|
|
@@ -27,15 +27,15 @@ interface MultistoreConfig {
|
|
|
27
27
|
*/
|
|
28
28
|
enabled: boolean;
|
|
29
29
|
}
|
|
30
|
-
type LogVerbosity = "
|
|
30
|
+
type LogVerbosity = "alert" | "critical" | "debug" | "emergency" | "error" | "info" | "notice" | "warning";
|
|
31
31
|
type LoggerOptions = Partial<{
|
|
32
|
-
verbosity: LogVerbosity;
|
|
33
32
|
includeStackTrace: boolean;
|
|
33
|
+
verbosity: LogVerbosity;
|
|
34
34
|
}>;
|
|
35
35
|
interface AlokaiModuleOptions {
|
|
36
|
+
logger?: LoggerOptions;
|
|
36
37
|
middleware: MiddlewareConfig;
|
|
37
38
|
multistore?: MultistoreConfig;
|
|
38
|
-
logger?: LoggerOptions;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
declare const _default: _nuxt_schema.NuxtModule<AlokaiModuleOptions, AlokaiModuleOptions, false>;
|
package/dist/module.d.ts
CHANGED
|
@@ -6,11 +6,6 @@ interface MiddlewareConfig {
|
|
|
6
6
|
* @example "http://localhost:4000"
|
|
7
7
|
*/
|
|
8
8
|
apiUrl: string;
|
|
9
|
-
/**
|
|
10
|
-
* The URL of the middleware for server-side rendering.
|
|
11
|
-
* @example "http://localhost:4000"
|
|
12
|
-
*/
|
|
13
|
-
ssrApiUrl: string;
|
|
14
9
|
/**
|
|
15
10
|
* This is identifier used to invalidate the cache on CDN when the assets change.
|
|
16
11
|
* Usually it's a commit hash.
|
|
@@ -18,6 +13,11 @@ interface MiddlewareConfig {
|
|
|
18
13
|
* @default "no-cache-busting-id-set"
|
|
19
14
|
*/
|
|
20
15
|
cdnCacheBustingId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The URL of the middleware for server-side rendering.
|
|
18
|
+
* @example "http://localhost:4000"
|
|
19
|
+
*/
|
|
20
|
+
ssrApiUrl: string;
|
|
21
21
|
}
|
|
22
22
|
interface MultistoreConfig {
|
|
23
23
|
/**
|
|
@@ -27,15 +27,15 @@ interface MultistoreConfig {
|
|
|
27
27
|
*/
|
|
28
28
|
enabled: boolean;
|
|
29
29
|
}
|
|
30
|
-
type LogVerbosity = "
|
|
30
|
+
type LogVerbosity = "alert" | "critical" | "debug" | "emergency" | "error" | "info" | "notice" | "warning";
|
|
31
31
|
type LoggerOptions = Partial<{
|
|
32
|
-
verbosity: LogVerbosity;
|
|
33
32
|
includeStackTrace: boolean;
|
|
33
|
+
verbosity: LogVerbosity;
|
|
34
34
|
}>;
|
|
35
35
|
interface AlokaiModuleOptions {
|
|
36
|
+
logger?: LoggerOptions;
|
|
36
37
|
middleware: MiddlewareConfig;
|
|
37
38
|
multistore?: MultistoreConfig;
|
|
38
|
-
logger?: LoggerOptions;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
declare const _default: _nuxt_schema.NuxtModule<AlokaiModuleOptions, AlokaiModuleOptions, false>;
|
package/dist/module.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@vue-storefront/nuxt",
|
|
3
|
-
"configKey": "alokai",
|
|
4
2
|
"compatibility": {
|
|
5
3
|
"nuxt": "^3.0.0"
|
|
6
4
|
},
|
|
7
|
-
"
|
|
5
|
+
"configKey": "alokai",
|
|
6
|
+
"name": "@vue-storefront/nuxt",
|
|
7
|
+
"version": "9.0.0-rc.4",
|
|
8
8
|
"builder": {
|
|
9
9
|
"@nuxt/module-builder": "0.7.1",
|
|
10
10
|
"unbuild": "2.0.0"
|
package/dist/module.mjs
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, installModule, addTypeTemplate, addImports, addTemplate, addPluginTemplate, addImportsSources } from '@nuxt/kit';
|
|
2
|
-
import { genInlineTypeImport } from 'knitwork';
|
|
3
2
|
import { defu } from 'defu';
|
|
3
|
+
import { genInlineTypeImport } from 'knitwork';
|
|
4
4
|
|
|
5
5
|
const module = defineNuxtModule({
|
|
6
|
-
meta: {
|
|
7
|
-
name: "@vue-storefront/nuxt",
|
|
8
|
-
configKey: "alokai",
|
|
9
|
-
compatibility: {
|
|
10
|
-
nuxt: "^3.0.0"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
6
|
defaults: {
|
|
7
|
+
logger: {
|
|
8
|
+
includeStackTrace: false,
|
|
9
|
+
verbosity: "debug"
|
|
10
|
+
},
|
|
14
11
|
/**
|
|
15
12
|
* In the `middleware` object, both `apiUrl` and `ssrApiUrl` keys have to be
|
|
16
13
|
* present to allow Nuxt replacing them with the actual values from the
|
|
17
14
|
* .env file at runtime.
|
|
18
|
-
*
|
|
15
|
+
*
|
|
19
16
|
* https://nuxt.com/docs/guide/going-further/runtime-config
|
|
20
17
|
*/
|
|
21
18
|
middleware: {
|
|
@@ -25,12 +22,15 @@ const module = defineNuxtModule({
|
|
|
25
22
|
},
|
|
26
23
|
multistore: {
|
|
27
24
|
enabled: false
|
|
28
|
-
},
|
|
29
|
-
logger: {
|
|
30
|
-
includeStackTrace: false,
|
|
31
|
-
verbosity: "debug"
|
|
32
25
|
}
|
|
33
26
|
},
|
|
27
|
+
meta: {
|
|
28
|
+
compatibility: {
|
|
29
|
+
nuxt: "^3.0.0"
|
|
30
|
+
},
|
|
31
|
+
configKey: "alokai",
|
|
32
|
+
name: "@vue-storefront/nuxt"
|
|
33
|
+
},
|
|
34
34
|
async setup(options, nuxt) {
|
|
35
35
|
const projectLayer = nuxt.options._layers[0];
|
|
36
36
|
const projectRootResolver = createResolver(projectLayer.config.rootDir);
|
|
@@ -44,8 +44,8 @@ const module = defineNuxtModule({
|
|
|
44
44
|
nuxt.options.app.head.meta = [
|
|
45
45
|
...nuxt.options.app.head.meta ?? [],
|
|
46
46
|
{
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
content: "Alokai Storefront",
|
|
48
|
+
name: "generator"
|
|
49
49
|
}
|
|
50
50
|
];
|
|
51
51
|
addTypeTemplate({
|
|
@@ -61,65 +61,65 @@ export type SdkConfig = ${genInlineTypeImport(
|
|
|
61
61
|
src: localResolver.resolve("./runtime/types.template")
|
|
62
62
|
});
|
|
63
63
|
addImports({
|
|
64
|
-
name: "getDefaultMethodsRequestConfig",
|
|
65
64
|
as: "getDefaultMethodsRequestConfig",
|
|
66
|
-
from: localResolver.resolve("./runtime/utils/defaults")
|
|
65
|
+
from: localResolver.resolve("./runtime/utils/defaults"),
|
|
66
|
+
name: "getDefaultMethodsRequestConfig"
|
|
67
67
|
});
|
|
68
68
|
addTemplate({
|
|
69
|
-
src: localResolver.resolve("./runtime/useSdk.template"),
|
|
70
69
|
filename: "useSdk.ts",
|
|
70
|
+
src: localResolver.resolve("./runtime/useSdk.template"),
|
|
71
71
|
write: true
|
|
72
72
|
});
|
|
73
73
|
addTemplate({
|
|
74
|
-
src: localResolver.resolve("./runtime/defineSdkConfig.template"),
|
|
75
74
|
filename: "defineSdkConfig.ts",
|
|
76
|
-
write: true,
|
|
77
75
|
options: {
|
|
78
76
|
moduleConfig: JSON.stringify(options)
|
|
79
|
-
}
|
|
77
|
+
},
|
|
78
|
+
src: localResolver.resolve("./runtime/defineSdkConfig.template"),
|
|
79
|
+
write: true
|
|
80
80
|
});
|
|
81
81
|
addTemplate({
|
|
82
|
-
src: localResolver.resolve("./runtime/useSfState.template"),
|
|
83
82
|
filename: "useSfState.ts",
|
|
83
|
+
src: localResolver.resolve("./runtime/useSfState.template"),
|
|
84
84
|
write: true
|
|
85
85
|
});
|
|
86
86
|
addTemplate({
|
|
87
|
-
src: localResolver.resolve("./runtime/logger.template"),
|
|
88
87
|
filename: "logger.ts",
|
|
89
|
-
write: true,
|
|
90
88
|
options: {
|
|
91
89
|
moduleConfig: JSON.stringify(options)
|
|
92
|
-
}
|
|
90
|
+
},
|
|
91
|
+
src: localResolver.resolve("./runtime/logger.template"),
|
|
92
|
+
write: true
|
|
93
93
|
});
|
|
94
94
|
addTemplate({
|
|
95
|
-
src: localResolver.resolve("./runtime/errorHandler.template"),
|
|
96
95
|
filename: "errorHandler.ts",
|
|
96
|
+
src: localResolver.resolve("./runtime/errorHandler.template"),
|
|
97
97
|
write: true
|
|
98
98
|
});
|
|
99
99
|
addPluginTemplate({
|
|
100
|
-
src: localResolver.resolve("./runtime/plugin.template"),
|
|
101
100
|
filename: "alokaiPlugin.ts",
|
|
102
|
-
write: true,
|
|
103
101
|
options: {
|
|
104
102
|
moduleConfig: JSON.stringify(options)
|
|
105
|
-
}
|
|
103
|
+
},
|
|
104
|
+
src: localResolver.resolve("./runtime/plugin.template"),
|
|
105
|
+
write: true
|
|
106
106
|
});
|
|
107
107
|
addImportsSources([
|
|
108
108
|
{
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
from: buildDirectoryResolver.resolve("useSdk.ts"),
|
|
110
|
+
imports: ["useSdk"]
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
from: buildDirectoryResolver.resolve("defineSdkConfig.ts"),
|
|
114
|
+
imports: ["defineSdkConfig"]
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
from: buildDirectoryResolver.resolve("useSfState.ts"),
|
|
118
|
+
imports: ["useSfState"]
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
from: buildDirectoryResolver.resolve("logger.ts"),
|
|
122
|
+
imports: ["logger"]
|
|
123
123
|
}
|
|
124
124
|
]);
|
|
125
125
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildModule, middlewareModule } from "@alokai/connect/sdk";
|
|
2
2
|
import { useNuxtApp, useRequestHeaders, getDefaultMethodsRequestConfig } from "#imports";
|
|
3
|
+
import type { Composer } from '#i18n';
|
|
3
4
|
import type { AlokaiModuleOptions } from "./alokaiModule";
|
|
4
5
|
|
|
5
6
|
type InjectedContext = {
|
|
@@ -67,7 +68,10 @@ export function defineSdkConfig<TConfig>(config: Config<TConfig>) {
|
|
|
67
68
|
const resolvedOptions = resolveOptions(runtimeConfig.public.alokai);
|
|
68
69
|
|
|
69
70
|
const getCookieHeader = () => useRequestHeaders(["cookie"]);
|
|
70
|
-
const getRequestHeaders = () =>
|
|
71
|
+
const getRequestHeaders = () => ({
|
|
72
|
+
"x-alokai-locale": (nuxtApp as unknown as { $i18n: Composer }).$i18n?.locale?.value,
|
|
73
|
+
...useRequestHeaders()
|
|
74
|
+
});
|
|
71
75
|
|
|
72
76
|
return config({
|
|
73
77
|
buildModule,
|
|
@@ -3,16 +3,9 @@ import sdkConfig from "~/sdk.config";
|
|
|
3
3
|
import type { SdkConfig } from "./sdk.config";
|
|
4
4
|
import { defineNuxtPlugin } from '#app';
|
|
5
5
|
|
|
6
|
-
export default defineNuxtPlugin(() => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const getSdk = () => {
|
|
10
|
-
if (!sdk) {
|
|
11
|
-
const config = sdkConfig();
|
|
12
|
-
sdk = initSDK(config);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return sdk;
|
|
6
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
7
|
+
const getSdk: () => SDKApi<ReturnType<SdkConfig>> = () => {
|
|
8
|
+
return initSDK(sdkConfig());
|
|
16
9
|
};
|
|
17
10
|
|
|
18
11
|
return {
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
export declare function getDefaultMethodsRequestConfig(): {
|
|
2
|
-
readonly
|
|
2
|
+
readonly unifiedCms: {
|
|
3
3
|
readonly middlewareModule: {
|
|
4
|
-
readonly
|
|
4
|
+
readonly getEntries: {
|
|
5
5
|
readonly method: "GET";
|
|
6
6
|
};
|
|
7
|
-
readonly
|
|
7
|
+
readonly getPage: {
|
|
8
8
|
readonly method: "GET";
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
readonly unifiedCommerce: {
|
|
13
|
+
readonly middlewareModule: {
|
|
14
|
+
readonly getCategories: {
|
|
11
15
|
readonly method: "GET";
|
|
12
16
|
};
|
|
13
|
-
readonly
|
|
17
|
+
readonly getCategory: {
|
|
14
18
|
readonly method: "GET";
|
|
15
19
|
};
|
|
16
|
-
readonly
|
|
20
|
+
readonly getCurrencies: {
|
|
17
21
|
readonly method: "GET";
|
|
18
22
|
};
|
|
19
|
-
readonly
|
|
23
|
+
readonly getProductDetails: {
|
|
20
24
|
readonly method: "GET";
|
|
21
25
|
};
|
|
22
|
-
readonly
|
|
26
|
+
readonly getProductReviews: {
|
|
23
27
|
readonly method: "GET";
|
|
24
28
|
};
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
readonly unifiedCms: {
|
|
28
|
-
readonly middlewareModule: {
|
|
29
|
-
readonly getPage: {
|
|
29
|
+
readonly getProducts: {
|
|
30
30
|
readonly method: "GET";
|
|
31
31
|
};
|
|
32
|
-
readonly
|
|
32
|
+
readonly searchProducts: {
|
|
33
33
|
readonly method: "GET";
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
export function getDefaultMethodsRequestConfig() {
|
|
2
2
|
return {
|
|
3
|
+
unifiedCms: {
|
|
4
|
+
middlewareModule: {
|
|
5
|
+
getEntries: { method: "GET" },
|
|
6
|
+
getPage: { method: "GET" }
|
|
7
|
+
}
|
|
8
|
+
},
|
|
3
9
|
unifiedCommerce: {
|
|
4
10
|
middlewareModule: {
|
|
5
|
-
getCategory: { method: "GET" },
|
|
6
11
|
getCategories: { method: "GET" },
|
|
12
|
+
getCategory: { method: "GET" },
|
|
13
|
+
getCurrencies: { method: "GET" },
|
|
7
14
|
getProductDetails: { method: "GET" },
|
|
8
15
|
getProductReviews: { method: "GET" },
|
|
9
16
|
getProducts: { method: "GET" },
|
|
10
|
-
getCurrencies: { method: "GET" },
|
|
11
17
|
searchProducts: { method: "GET" }
|
|
12
18
|
}
|
|
13
|
-
},
|
|
14
|
-
unifiedCms: {
|
|
15
|
-
middlewareModule: {
|
|
16
|
-
getPage: { method: "GET" },
|
|
17
|
-
getEntries: { method: "GET" }
|
|
18
|
-
}
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
package/dist/types.d.mts
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import type { } from './module.js'
|
|
3
3
|
|
|
4
4
|
export interface ModuleOptions {
|
|
5
|
+
logger: {
|
|
6
|
+
/** @default false */
|
|
7
|
+
includeStackTrace: boolean,
|
|
8
|
+
|
|
9
|
+
/** @default "debug" */
|
|
10
|
+
verbosity: string,
|
|
11
|
+
},
|
|
12
|
+
|
|
5
13
|
middleware: {
|
|
6
14
|
/** @default "" */
|
|
7
15
|
apiUrl: string,
|
|
@@ -17,14 +25,6 @@ import type { } from './module.js'
|
|
|
17
25
|
/** @default false */
|
|
18
26
|
enabled: boolean,
|
|
19
27
|
},
|
|
20
|
-
|
|
21
|
-
logger: {
|
|
22
|
-
/** @default false */
|
|
23
|
-
includeStackTrace: boolean,
|
|
24
|
-
|
|
25
|
-
/** @default "debug" */
|
|
26
|
-
verbosity: string,
|
|
27
|
-
},
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
declare module '@nuxt/schema' {
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import type { } from './module'
|
|
3
3
|
|
|
4
4
|
export interface ModuleOptions {
|
|
5
|
+
logger: {
|
|
6
|
+
/** @default false */
|
|
7
|
+
includeStackTrace: boolean,
|
|
8
|
+
|
|
9
|
+
/** @default "debug" */
|
|
10
|
+
verbosity: string,
|
|
11
|
+
},
|
|
12
|
+
|
|
5
13
|
middleware: {
|
|
6
14
|
/** @default "" */
|
|
7
15
|
apiUrl: string,
|
|
@@ -17,14 +25,6 @@ import type { } from './module'
|
|
|
17
25
|
/** @default false */
|
|
18
26
|
enabled: boolean,
|
|
19
27
|
},
|
|
20
|
-
|
|
21
|
-
logger: {
|
|
22
|
-
/** @default false */
|
|
23
|
-
includeStackTrace: boolean,
|
|
24
|
-
|
|
25
|
-
/** @default "debug" */
|
|
26
|
-
verbosity: string,
|
|
27
|
-
},
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
declare module '@nuxt/schema' {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-storefront/nuxt",
|
|
3
|
-
"version": "9.0.0-rc.
|
|
3
|
+
"version": "9.0.0-rc.4",
|
|
4
4
|
"description": "Alokai dedicated features for Nuxt",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "nuxt-module-build build",
|
|
21
|
-
"lint": "
|
|
21
|
+
"lint": "eslint",
|
|
22
|
+
"lint:fix": "eslint --fix",
|
|
22
23
|
"format": "prettier --write .",
|
|
23
24
|
"prepare": "nuxi prepare",
|
|
24
25
|
"version": "cp CHANGELOG.md ../../docs/enterprise/content/storefront/6.change-log/nuxt.md"
|
|
@@ -32,15 +33,14 @@
|
|
|
32
33
|
"pinia": "^2.1.7"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@alokai/connect": "^1.0.0-rc.
|
|
36
|
+
"@alokai/connect": "^1.0.0-rc.3",
|
|
36
37
|
"@types/node": "^18.11.17",
|
|
37
38
|
"@nuxt/devtools": "1.3.8",
|
|
38
39
|
"@nuxt/module-builder": "0.7.1",
|
|
39
|
-
"@biomejs/biome": "1.9.2",
|
|
40
40
|
"nuxt": "3.12.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@alokai/connect": "^1.0.0-rc.
|
|
43
|
+
"@alokai/connect": "^1.0.0-rc.3"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|