@shopware/nuxt-module 1.4.4 → 1.5.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/README.md +14 -17
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +26 -7
- package/package.json +13 -14
- package/plugin.ts +4 -1
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
Nuxt [module](https://nuxt.com/docs/guide/going-further/modules) that allows you to set up a Nuxt 3 project with Shopware Frontends. It provides the composables and api-client packages.
|
|
9
9
|
|
|
10
|
-
If you want to use these packages with a different Vue.js framework, see [the guide](https://
|
|
10
|
+
If you want to use these packages with a different Vue.js framework, see [the guide](https://developer.shopware.com/frontends/introduction/templates/custom-vue-project.html) for using Shopware Frontends in a custom project.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- Business logic covered by [Composables](https://npmjs.com/package/@shopware/composables) package. Registering all composable functions globally. [See the reference](https://
|
|
14
|
+
- Business logic covered by [Composables](https://npmjs.com/package/@shopware/composables) package. Registering all composable functions globally. [See the reference](https://developer.shopware.com/frontends/packages/composables.html).
|
|
15
15
|
- Shopware context shared in Nuxt application.
|
|
16
16
|
- Configured [API Client](https://npmjs.com/package/@shopware/api-client) package.
|
|
17
17
|
|
|
@@ -67,7 +67,7 @@ Now you can use any composable function you need without extra import:
|
|
|
67
67
|
<script setup>
|
|
68
68
|
const { login } = useUser();
|
|
69
69
|
const { refreshSessionContext } = useSessionContext();
|
|
70
|
-
refreshSessionContext();
|
|
70
|
+
await refreshSessionContext();
|
|
71
71
|
</script>
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -132,8 +132,9 @@ declare module "#shopware" {
|
|
|
132
132
|
// import("@shopware/api-client/store-api-types").components["schemas"];
|
|
133
133
|
|
|
134
134
|
// Or use your locally generated types (placed in ./api-types folder):
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
export type operations = import("./api-types/storeApiTypes").operations;
|
|
136
|
+
export type Schemas =
|
|
137
|
+
import("./api-types/storeApiTypes").components["schemas"];
|
|
137
138
|
|
|
138
139
|
// Export your own Api Client definition:
|
|
139
140
|
export type ApiClient = ReturnType<typeof createAPIClient<operations>>;
|
|
@@ -144,33 +145,29 @@ Import your custom types from local files and export them as shown above. This a
|
|
|
144
145
|
|
|
145
146
|
### Apply custom types for `@shopware/api-client`
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
The API Client instance is aware of your custom API types thanks to declaring `#shopware` module from the step above. So now, whenever `apiClient` instance is used, the proper types are registered.
|
|
148
149
|
|
|
149
150
|
## Links
|
|
150
151
|
|
|
151
|
-
- [📘 Documentation](https://
|
|
152
|
+
- [📘 Documentation](https://developer.shopware.com/frontends)
|
|
152
153
|
|
|
153
154
|
- [📦 API Gen - Types Generator for Shopware 6 OpenAPI Schema](https://npmjs.com/@shopware/api-gen)
|
|
154
155
|
|
|
155
156
|
- [📦 API Client - REST API Client for Shopware 6](https://npmjs.com/@shopware/api-client)
|
|
156
157
|
|
|
157
158
|
- [👥 Community](https://discord.com/channels/1308047705309708348/1405501315160739951) (`#composable-frontend`)
|
|
159
|
+
|
|
158
160
|
<!-- AUTO GENERATED CHANGELOG -->
|
|
159
161
|
|
|
160
162
|
## Changelog
|
|
161
163
|
|
|
162
164
|
Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/nuxt-module/CHANGELOG.md)
|
|
163
165
|
|
|
164
|
-
### Latest changes: 1.
|
|
166
|
+
### Latest changes: 1.5.1
|
|
165
167
|
|
|
166
168
|
### Patch Changes
|
|
167
169
|
|
|
168
|
-
- [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
`endpoint` and deprecated `shopwareEndpoint` values during server rendering.
|
|
173
|
-
|
|
174
|
-
- Updated dependencies [[`22fc8a7`](https://github.com/shopware/frontends/commit/22fc8a7301f6a7d2612d907ab73555978b651c00), [`bea7f58`](https://github.com/shopware/frontends/commit/bea7f5882cb58c6d47c84a82db5c8ecaf9bcf8ef), [`b8c0091`](https://github.com/shopware/frontends/commit/b8c00913c3afb5e1e63de9565105f8f8e3bf299f)]:
|
|
175
|
-
- @shopware/helpers@1.7.1
|
|
176
|
-
- @shopware/composables@1.11.1
|
|
170
|
+
- Updated dependencies [[`6315350`](https://github.com/shopware/frontends/commit/6315350add0464abef153343897d42f5808f2003), [`b767721`](https://github.com/shopware/frontends/commit/b767721847bf3391f9067eca7a045089fb22fce0), [`f16c5a0`](https://github.com/shopware/frontends/commit/f16c5a0785d6187b73c3edcf37feab7c90bd7988), [`978b02c`](https://github.com/shopware/frontends/commit/978b02c969ca4b16f5fc1d7a953ec4cce3d98173), [`6572aa8`](https://github.com/shopware/frontends/commit/6572aa84431e1f4a34d6cf04e549037692d638a6), [`744833b`](https://github.com/shopware/frontends/commit/744833b9d7d2f8ea1f5dfe65be3fa554dbe4a09f), [`e03c91b`](https://github.com/shopware/frontends/commit/e03c91be172374894d90b7a0111855b76719fee1), [`33facb1`](https://github.com/shopware/frontends/commit/33facb178792c8cb26b47ab984ac48c08ab4b72b), [`9137475`](https://github.com/shopware/frontends/commit/91374753cedb2034385f642e6af11314f2971caa), [`474d3fe`](https://github.com/shopware/frontends/commit/474d3fed346816135b0c7c797990b215a8b691c0), [`38379a5`](https://github.com/shopware/frontends/commit/38379a5d52ab09008774533ef417ebe2cde3f7fd)]:
|
|
171
|
+
- @shopware/composables@1.12.1
|
|
172
|
+
- @shopware/api-client@1.5.1
|
|
173
|
+
- @shopware/helpers@1.7.2
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,17 @@ type ShopwareNuxtOptions = {
|
|
|
23
23
|
* @default false
|
|
24
24
|
*/
|
|
25
25
|
useUserContextInSSR?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Read anonymous Store API data through cacheable GET routes instead of POST.
|
|
28
|
+
* Criteria is compressed into the `_criteria` query param, which lets CDNs /
|
|
29
|
+
* reverse proxies / the browser cache the responses.
|
|
30
|
+
*
|
|
31
|
+
* Requires a Shopware backend that supports the GET read routes and the
|
|
32
|
+
* `_criteria` query param. Leave disabled unless your caching layer is set up.
|
|
33
|
+
*
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
cacheableReads?: boolean;
|
|
26
37
|
};
|
|
27
38
|
|
|
28
39
|
export { _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,17 @@ type ShopwareNuxtOptions = {
|
|
|
23
23
|
* @default false
|
|
24
24
|
*/
|
|
25
25
|
useUserContextInSSR?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Read anonymous Store API data through cacheable GET routes instead of POST.
|
|
28
|
+
* Criteria is compressed into the `_criteria` query param, which lets CDNs /
|
|
29
|
+
* reverse proxies / the browser cache the responses.
|
|
30
|
+
*
|
|
31
|
+
* Requires a Shopware backend that supports the GET read routes and the
|
|
32
|
+
* `_criteria` query param. Leave disabled unless your caching layer is set up.
|
|
33
|
+
*
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
cacheableReads?: boolean;
|
|
26
37
|
};
|
|
27
38
|
|
|
28
39
|
export { _default as default };
|
package/dist/index.mjs
CHANGED
|
@@ -56,11 +56,30 @@ const index = defineNuxtModule({
|
|
|
56
56
|
src: resolver.resolve("../plugin.ts")
|
|
57
57
|
});
|
|
58
58
|
const projectShopwareTypes = resolve(nuxt.options.rootDir, "shopware.d.ts");
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const shopwareTypeContexts = {
|
|
60
|
+
nuxt: true,
|
|
61
|
+
nitro: true,
|
|
62
|
+
node: true,
|
|
63
|
+
shared: true
|
|
64
|
+
};
|
|
65
|
+
if (existsSync(projectShopwareTypes)) {
|
|
66
|
+
const referencePath = projectShopwareTypes.replace(/\\/g, "/");
|
|
67
|
+
addTypeTemplate(
|
|
68
|
+
{
|
|
69
|
+
filename: "shopware.d.ts",
|
|
70
|
+
getContents: () => `/// <reference path="${referencePath}" />
|
|
71
|
+
`
|
|
72
|
+
},
|
|
73
|
+
shopwareTypeContexts
|
|
74
|
+
);
|
|
75
|
+
} else {
|
|
76
|
+
addTypeTemplate(
|
|
77
|
+
{
|
|
78
|
+
filename: "shopware.d.ts",
|
|
79
|
+
src: resolver.resolve("../shopware.d.ts")
|
|
80
|
+
},
|
|
81
|
+
shopwareTypeContexts
|
|
82
|
+
);
|
|
64
83
|
}
|
|
65
84
|
addCustomTab({
|
|
66
85
|
name: "shopware-frontends",
|
|
@@ -68,7 +87,7 @@ const index = defineNuxtModule({
|
|
|
68
87
|
icon: "fa6-brands:shopware",
|
|
69
88
|
view: {
|
|
70
89
|
type: "iframe",
|
|
71
|
-
src: "https://
|
|
90
|
+
src: "https://developer.shopware.com/frontends/"
|
|
72
91
|
}
|
|
73
92
|
});
|
|
74
93
|
addCustomTab({
|
|
@@ -77,7 +96,7 @@ const index = defineNuxtModule({
|
|
|
77
96
|
icon: "carbon:assembly-cluster",
|
|
78
97
|
view: {
|
|
79
98
|
type: "iframe",
|
|
80
|
-
src: "https://
|
|
99
|
+
src: "https://developer.shopware.com/frontends/guides/cms/"
|
|
81
100
|
}
|
|
82
101
|
});
|
|
83
102
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopware/nuxt-module",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Nuxt 3 module for Shopware Frontends",
|
|
5
5
|
"author": "Shopware",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/shopware/frontends.git"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://
|
|
10
|
+
"homepage": "https://developer.shopware.com/frontends/concepts/internal-structure.html#nuxt-module",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"Nuxt",
|
|
13
13
|
"Shopware",
|
|
@@ -34,28 +34,27 @@
|
|
|
34
34
|
"index.cjs"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nuxt/kit": "4.4.
|
|
37
|
+
"@nuxt/kit": "4.4.8",
|
|
38
38
|
"defu": "6.1.7",
|
|
39
39
|
"h3": "1.15.11",
|
|
40
|
-
"js-cookie": "3.0.
|
|
41
|
-
"@shopware/composables": "1.
|
|
42
|
-
"@shopware/helpers": "1.7.
|
|
43
|
-
"@shopware/api-client": "1.5.
|
|
40
|
+
"js-cookie": "3.0.7",
|
|
41
|
+
"@shopware/composables": "1.12.1",
|
|
42
|
+
"@shopware/helpers": "1.7.2",
|
|
43
|
+
"@shopware/api-client": "1.5.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@nuxt/schema": "4.4.6",
|
|
46
|
+
"@nuxt/schema": "4.4.8",
|
|
48
47
|
"@typescript/native-preview": "7.0.0-dev.20260205.1",
|
|
49
|
-
"nuxt": "4.4.
|
|
50
|
-
"unbuild": "
|
|
51
|
-
"vitest": "4.1.
|
|
48
|
+
"nuxt": "4.4.8",
|
|
49
|
+
"unbuild": "3.6.1",
|
|
50
|
+
"vitest": "4.1.10",
|
|
52
51
|
"tsconfig": "0.0.0"
|
|
53
52
|
},
|
|
54
53
|
"scripts": {
|
|
55
54
|
"build": "unbuild",
|
|
56
55
|
"dev": "unbuild --stub",
|
|
57
|
-
"lint": "
|
|
58
|
-
"lint:fix": "
|
|
56
|
+
"lint": "oxlint . && oxfmt --check .",
|
|
57
|
+
"lint:fix": "oxlint --fix . && oxfmt --write . && pnpm run typecheck",
|
|
59
58
|
"typecheck": "tsgo --noEmit",
|
|
60
59
|
"test": "vitest run"
|
|
61
60
|
}
|
package/plugin.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { isMaintenanceMode } from "@shopware/helpers";
|
|
|
3
3
|
import { getCookie } from "h3";
|
|
4
4
|
import Cookies from "js-cookie";
|
|
5
5
|
import { ref } from "vue";
|
|
6
|
+
|
|
6
7
|
import {
|
|
7
8
|
createShopwareContext,
|
|
8
9
|
defineNuxtPlugin,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
useState,
|
|
13
14
|
} from "#imports";
|
|
14
15
|
import type { ApiClient } from "#shopware";
|
|
16
|
+
|
|
15
17
|
import type { ShopwareNuxtOptions } from "./src";
|
|
16
18
|
|
|
17
19
|
declare module "#app" {
|
|
@@ -120,11 +122,12 @@ export default defineNuxtPlugin((NuxtApp) => {
|
|
|
120
122
|
NuxtApp.vueApp.provide("apiClient", apiClient);
|
|
121
123
|
// Shopware context
|
|
122
124
|
// TODO fix type App<Element>
|
|
123
|
-
//
|
|
125
|
+
// TODO: Improve this typing.
|
|
124
126
|
const shopwareContext = createShopwareContext(NuxtApp.vueApp as any, {
|
|
125
127
|
enableDevtools: true,
|
|
126
128
|
devStorefrontUrl: shopwareRuntimeConfigPublic?.devStorefrontUrl || null,
|
|
127
129
|
browserLocale,
|
|
130
|
+
cacheableReads: shopwareRuntimeConfigPublic?.cacheableReads ?? false,
|
|
128
131
|
});
|
|
129
132
|
NuxtApp.vueApp.provide("shopware", shopwareContext);
|
|
130
133
|
|