@kubb/plugin-swr 5.2.4 → 5.2.6

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/index.cjs CHANGED
@@ -342,7 +342,7 @@ var compatibility = {
342
342
  };
343
343
  //#endregion
344
344
  //#region package.json
345
- var version = "5.2.4";
345
+ var version = "5.2.6";
346
346
  //#endregion
347
347
  //#region ../../internals/client/src/resolveClient.ts
348
348
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
- import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ResolverPatch, ast } from "kubb/kit";
2
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
3
3
  import "@kubb/plugin-ts";
4
4
  import "kubb/jsx";
5
5
  import "@kubb/plugin-zod";
@@ -245,7 +245,7 @@ type ResolvedOptions = {
245
245
  mutation: NonNullable<Required<Mutation>> | false;
246
246
  resolver: ResolverSwr;
247
247
  };
248
- type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, ResolverSwr>;
248
+ type PluginSwr = PluginType<'plugin-swr', Options, ResolvedOptions, ResolverSwr>;
249
249
  declare global {
250
250
  namespace Kubb {
251
251
  interface PluginRegistry {
package/dist/index.js CHANGED
@@ -312,7 +312,7 @@ var compatibility = {
312
312
  };
313
313
  //#endregion
314
314
  //#region package.json
315
- var version = "5.2.4";
315
+ var version = "5.2.6";
316
316
  //#endregion
317
317
  //#region ../../internals/client/src/resolveClient.ts
318
318
  /**
package/docs/overview.md CHANGED
@@ -1,22 +1,28 @@
1
1
  # SWR
2
2
 
3
- Generates typed SWR hooks from your OpenAPI spec: `useSWR` for reads and `useSWRMutation` for writes.
3
+ The SWR plugin generates a `useSWR` hook for each query and a `useSWRMutation` hook for each mutation.
4
4
 
5
5
  The plugin ships no HTTP client. Each hook calls a function generated by a client plugin.
6
6
 
7
7
  ## Setup
8
8
 
9
- - Add `@kubb/plugin-ts` and a client plugin: `@kubb/plugin-fetch` or `@kubb/plugin-axios`.
10
- - Install SWR v2 or higher in the app that uses the generated code.
9
+ - Add `@kubb/plugin-ts` and a client plugin: `@kubb/plugin-fetch` or `@kubb/plugin-axios`. Leave `sdk` unset on the client plugin.
10
+ - Install `swr` 2.2 or a later v2 release in the app that uses the generated code.
11
11
  - Configure validation on the client plugin, not here.
12
12
 
13
13
  ## Options worth knowing
14
14
 
15
15
  - `client` picks `fetch` or `axios` when both client plugins are registered. A single client is detected automatically.
16
- - `query` and `mutation` set which HTTP methods become queries (`GET`) and mutations (`POST`, `PUT`, `PATCH`, `DELETE`), and where SWR is imported from (`swr` and `swr/mutation`). Set either to `false` to skip it.
16
+ - `query` and `mutation` set which HTTP methods become queries (`GET`) and mutations (`POST`, `PUT`, `PATCH`, `DELETE`). They also set where SWR is imported from (`swr` and `swr/mutation`). Set either to `false` to skip those hooks.
17
+
18
+ The plugin does not generate `useSWRInfinite` hooks.
19
+
20
+ See [Options](https://kubb.dev/extensions/kubb-labs/plugin-swr/options) for every option and its default.
17
21
 
18
22
  ## Example
19
23
 
24
+ The config below generates `useSWR` and `useSWRMutation` hooks that call the Fetch client.
25
+
20
26
  ```typescript [kubb.config.ts]
21
27
  import { defineConfig } from 'kubb/config'
22
28
  import { pluginTs } from '@kubb/plugin-ts'
@@ -33,7 +39,3 @@ export default defineConfig({
33
39
  ],
34
40
  })
35
41
  ```
36
-
37
- ## See also
38
-
39
- - [SWR](https://swr.vercel.app)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-swr",
3
- "version": "5.2.4",
3
+ "version": "5.2.6",
4
4
  "description": "Generate type-safe SWR hooks with Kubb. Covers useSWR and useSWRMutation with full TypeScript support.",
5
5
  "keywords": [
6
6
  "code-generation",
@@ -74,19 +74,19 @@
74
74
  "registry": "https://registry.npmjs.org/"
75
75
  },
76
76
  "dependencies": {
77
- "@kubb/plugin-ts": "^5.0.9"
77
+ "@kubb/plugin-ts": "^5.0.11"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@internals/client": "0.0.0",
81
81
  "@internals/shared": "0.0.0",
82
82
  "@internals/tanstack-query": "0.0.0",
83
83
  "@internals/utils": "0.0.0",
84
- "kubb": "^5.8.3",
84
+ "kubb": "^5.9.2",
85
85
  "swr": "^2.5.1"
86
86
  },
87
87
  "peerDependencies": {
88
- "kubb": "^5.8.3",
89
- "swr": "^2.0.0"
88
+ "kubb": "^5.9.2",
89
+ "swr": "^2.2.0"
90
90
  },
91
91
  "peerDependenciesMeta": {
92
92
  "swr": {