@kubb/plugin-swr 5.0.0-beta.85 → 5.0.0-beta.87
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 +152 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +75 -46
- package/dist/index.js +152 -174
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
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, ast } from "kubb/kit";
|
|
2
|
+
import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ResolverPatch, ast } from "kubb/kit";
|
|
3
3
|
//#region ../../internals/client/src/resolveClient.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
|
|
@@ -31,56 +31,85 @@ type Transformer = (props: {
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/types.d.ts
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* The concrete resolver type for `@kubb/plugin-swr`.
|
|
35
|
+
* Extends the base `Resolver` (which provides `default` naming and option helpers, the top-level
|
|
36
|
+
* `name` casing, and the `file` builder) with plugin-specific naming namespaces for the generated
|
|
37
|
+
* `useSWR` and `useSWRMutation` hooks and their companion helpers.
|
|
35
38
|
*/
|
|
36
39
|
type ResolverSwr = Resolver & {
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @example Resolving base operation names
|
|
41
|
-
* `resolver.resolveName('show pet by id') // -> 'showPetById'`
|
|
42
|
-
*/
|
|
43
|
-
resolveName(this: ResolverSwr, name: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Resolves the output file name for a hook module.
|
|
46
|
-
*/
|
|
47
|
-
resolvePathName(this: ResolverSwr, name: string, type?: 'file' | 'function' | 'type' | 'const'): string;
|
|
48
|
-
/**
|
|
49
|
-
* Resolves a query hook function name.
|
|
50
|
-
*/
|
|
51
|
-
resolveQueryName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
52
|
-
/**
|
|
53
|
-
* Resolves a mutation hook function name.
|
|
54
|
-
*/
|
|
55
|
-
resolveMutationName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
56
|
-
/**
|
|
57
|
-
* Resolves the query options helper name.
|
|
58
|
-
*/
|
|
59
|
-
resolveQueryOptionsName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
60
|
-
/**
|
|
61
|
-
* Resolves the query key helper name.
|
|
62
|
-
*/
|
|
63
|
-
resolveQueryKeyName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
64
|
-
/**
|
|
65
|
-
* Resolves the mutation key helper name.
|
|
66
|
-
*/
|
|
67
|
-
resolveMutationKeyName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
68
|
-
/**
|
|
69
|
-
* Resolves the query key type name.
|
|
70
|
-
*/
|
|
71
|
-
resolveQueryKeyTypeName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
72
|
-
/**
|
|
73
|
-
* Resolves the mutation key type name.
|
|
74
|
-
*/
|
|
75
|
-
resolveMutationKeyTypeName(this: ResolverSwr, node: ast.OperationNode): string;
|
|
76
|
-
/**
|
|
77
|
-
* Resolves the mutation argument type name emitted alongside the mutation hook.
|
|
41
|
+
* Naming for the generated `useSWR` hook and its companion helpers.
|
|
78
42
|
*/
|
|
79
|
-
|
|
43
|
+
query: {
|
|
44
|
+
/**
|
|
45
|
+
* Resolves a query hook function name.
|
|
46
|
+
*
|
|
47
|
+
* @example Query hook names
|
|
48
|
+
* `resolver.query.name(node) // → 'useGetPetById'`
|
|
49
|
+
*/
|
|
50
|
+
name(node: ast.OperationNode): string;
|
|
51
|
+
/**
|
|
52
|
+
* Resolves the query options helper name.
|
|
53
|
+
*
|
|
54
|
+
* @example Query options helper names
|
|
55
|
+
* `resolver.query.optionsName(node) // → 'getPetByIdQueryOptions'`
|
|
56
|
+
*/
|
|
57
|
+
optionsName(node: ast.OperationNode): string;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves the query key helper name.
|
|
60
|
+
*
|
|
61
|
+
* @example Query key helper names
|
|
62
|
+
* `resolver.query.keyName(node) // → 'getPetByIdQueryKey'`
|
|
63
|
+
*/
|
|
64
|
+
keyName(node: ast.OperationNode): string;
|
|
65
|
+
/**
|
|
66
|
+
* Resolves the query key type name.
|
|
67
|
+
*
|
|
68
|
+
* @example Query key type names
|
|
69
|
+
* `resolver.query.keyTypeName(node) // → 'GetPetByIdQueryKey'`
|
|
70
|
+
*/
|
|
71
|
+
keyTypeName(node: ast.OperationNode): string;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves the client function name generated inline by query hooks.
|
|
74
|
+
*
|
|
75
|
+
* @example Client function names
|
|
76
|
+
* `resolver.query.clientName(node) // → 'getPetById'`
|
|
77
|
+
*/
|
|
78
|
+
clientName(node: ast.OperationNode): string;
|
|
79
|
+
};
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Naming for the generated `useSWRMutation` hook and its companion helpers.
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
mutation: {
|
|
84
|
+
/**
|
|
85
|
+
* Resolves a mutation hook function name.
|
|
86
|
+
*
|
|
87
|
+
* @example Mutation hook names
|
|
88
|
+
* `resolver.mutation.name(node) // → 'useUpdatePet'`
|
|
89
|
+
*/
|
|
90
|
+
name(node: ast.OperationNode): string;
|
|
91
|
+
/**
|
|
92
|
+
* Resolves the mutation key helper name.
|
|
93
|
+
*
|
|
94
|
+
* @example Mutation key helper names
|
|
95
|
+
* `resolver.mutation.keyName(node) // → 'updatePetMutationKey'`
|
|
96
|
+
*/
|
|
97
|
+
keyName(node: ast.OperationNode): string;
|
|
98
|
+
/**
|
|
99
|
+
* Resolves the mutation key type name.
|
|
100
|
+
*
|
|
101
|
+
* @example Mutation key type names
|
|
102
|
+
* `resolver.mutation.keyTypeName(node) // → 'UpdatePetMutationKey'`
|
|
103
|
+
*/
|
|
104
|
+
keyTypeName(node: ast.OperationNode): string;
|
|
105
|
+
/**
|
|
106
|
+
* Resolves the mutation argument type name emitted alongside the mutation hook.
|
|
107
|
+
*
|
|
108
|
+
* @example Mutation argument type names
|
|
109
|
+
* `resolver.mutation.argTypeName(node) // → 'UpdatePetMutationArg'`
|
|
110
|
+
*/
|
|
111
|
+
argTypeName(node: ast.OperationNode): string;
|
|
112
|
+
};
|
|
84
113
|
};
|
|
85
114
|
/**
|
|
86
115
|
* Customize the queryKey.
|
|
@@ -173,7 +202,7 @@ type Options = OutputOptions & {
|
|
|
173
202
|
/**
|
|
174
203
|
* Override naming conventions for function names and types.
|
|
175
204
|
*/
|
|
176
|
-
resolver?:
|
|
205
|
+
resolver?: ResolverPatch<ResolverSwr>;
|
|
177
206
|
/**
|
|
178
207
|
* Macros that rewrite generated nodes before printing.
|
|
179
208
|
*/
|