@shopware/nuxt-module 1.4.4 → 1.5.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
@@ -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
- export type operations = import("./api-types/storeApiTypes").operations;
136
- export type Schemas = import("./api-types/storeApiTypes").components["schemas"];
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,7 +145,7 @@ 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
- 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
+ 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
 
@@ -161,16 +162,21 @@ Import your custom types from local files and export them as shown above. This a
161
162
 
162
163
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/nuxt-module/CHANGELOG.md)
163
164
 
164
- ### Latest changes: 1.4.4
165
+ ### Latest changes: 1.5.0
165
166
 
166
- ### Patch Changes
167
+ ### Minor Changes
168
+
169
+ - [#2473](https://github.com/shopware/frontends/pull/2473) [`22611e5`](https://github.com/shopware/frontends/commit/22611e542b8f42a4f34dce5186f628f9a17f457b) Thanks [@mkucmus](https://github.com/mkucmus)! - Add an opt-in `cacheableReads` flag that routes anonymous Store API reads through their cacheable GET variants instead of POST. Criteria is compressed into the `_criteria` query param via `encodeForQuery` from `@shopware/api-client/helpers`, which lets CDNs / reverse proxies / the browser cache the responses.
170
+
171
+ Disabled by default — fully backwards compatible. Enable it in `nuxt.config` (`shopware: { cacheableReads: true }`) or via `createShopwareContext(app, { cacheableReads: true })` for non-Nuxt setups. It is surfaced on the Shopware context and read by the affected composables; public composable signatures are unchanged.
167
172
 
168
- - [#2370](https://github.com/shopware/frontends/pull/2370) [`9661432`](https://github.com/shopware/frontends/commit/96614324dfed3d9d83fbf85710145dd529a23f46) Thanks [@patzick](https://github.com/patzick)! - Fix SSR and CSR Shopware endpoint handling in the Nuxt module.
173
+ Affected composables: `useNavigation`, `useNavigationSearch`, `useCountries`, `useUser` (country + salutation lookups), `useSalutations`, `useInternationalization`, `useProductConfigurator`, `useProductSearch`, and `useCategorySearch.advancedSearch`.
174
+
175
+ `useListing` (product-listing), single-category `useCategorySearch.search`, and `useLandingSearch` remain POST for now: the generated Store API schema does not type `_criteria` on those GET routes (a Shopware OpenAPI gap). The backend does honor `_criteria` on product-listing GET at runtime, so that one can be migrated later once the types are augmented.
176
+
177
+ ### Patch Changes
169
178
 
170
- The module now persists the resolved SSR endpoint into private runtime config,
171
- avoids reading private runtime config on the client, and correctly honors both
172
- `endpoint` and deprecated `shopwareEndpoint` values during server rendering.
179
+ - [#2488](https://github.com/shopware/frontends/pull/2488) [`c56b89e`](https://github.com/shopware/frontends/commit/c56b89e16a9fbd9283e40a4e2c0f7cc6034226a1) Thanks [@mkucmus](https://github.com/mkucmus)! - Register the `#shopware` types in every TypeScript context (app, server/nitro, node, shared) instead of only the app one. This fixes `Cannot find module '#shopware'` in server-side code (e.g. `server/` routes and API builders) when a project uses the Nuxt 4 project-references `tsconfig.json` layout. Projects that ship their own `shopware.d.ts` are referenced in place so their relative imports keep resolving.
173
180
 
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
181
+ - Updated dependencies [[`8be060d`](https://github.com/shopware/frontends/commit/8be060de825ca799f98a8f045a5e7fea61f5d1a2), [`5678fb0`](https://github.com/shopware/frontends/commit/5678fb008cbd86eaddd061e004de89e6f45bb7ec), [`22611e5`](https://github.com/shopware/frontends/commit/22611e542b8f42a4f34dce5186f628f9a17f457b)]:
182
+ - @shopware/composables@1.12.0
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
- if (!existsSync(projectShopwareTypes)) {
60
- addTypeTemplate({
61
- filename: "shopware.d.ts",
62
- src: resolver.resolve("../shopware.d.ts")
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/nuxt-module",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
4
4
  "description": "Nuxt 3 module for Shopware Frontends",
5
5
  "author": "Shopware",
6
6
  "repository": {
@@ -34,28 +34,27 @@
34
34
  "index.cjs"
35
35
  ],
36
36
  "dependencies": {
37
- "@nuxt/kit": "4.4.6",
37
+ "@nuxt/kit": "4.4.8",
38
38
  "defu": "6.1.7",
39
39
  "h3": "1.15.11",
40
- "js-cookie": "3.0.5",
41
- "@shopware/composables": "1.11.1",
40
+ "js-cookie": "3.0.7",
41
+ "@shopware/composables": "1.12.0",
42
42
  "@shopware/helpers": "1.7.1",
43
43
  "@shopware/api-client": "1.5.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@biomejs/biome": "1.8.3",
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.6",
50
- "unbuild": "2.0.0",
51
- "vitest": "4.1.6",
48
+ "nuxt": "4.4.8",
49
+ "unbuild": "3.6.1",
50
+ "vitest": "4.1.9",
52
51
  "tsconfig": "0.0.0"
53
52
  },
54
53
  "scripts": {
55
54
  "build": "unbuild",
56
55
  "dev": "unbuild --stub",
57
- "lint": "biome check .",
58
- "lint:fix": "biome check . --write && pnpm run typecheck",
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
- // biome-ignore lint: ignore type error
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