@kubb/plugin-swr 5.0.0-beta.64 → 5.0.0-beta.73
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 +2 -2
- package/dist/index.cjs +1273 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +365 -3
- package/dist/index.js +1244 -48
- package/dist/index.js.map +1 -1
- package/package.json +10 -19
- package/dist/components-DxWGjLWg.cjs +0 -947
- package/dist/components-DxWGjLWg.cjs.map +0 -1
- package/dist/components-mWBRE6E4.js +0 -851
- package/dist/components-mWBRE6E4.js.map +0 -1
- package/dist/components.cjs +0 -7
- package/dist/components.d.ts +0 -100
- package/dist/components.js +0 -2
- package/dist/generators-CJ4ziuNk.cjs +0 -422
- package/dist/generators-CJ4ziuNk.cjs.map +0 -1
- package/dist/generators-D2blgLOY.js +0 -411
- package/dist/generators-D2blgLOY.js.map +0 -1
- package/dist/generators.cjs +0 -4
- package/dist/generators.d.ts +0 -16
- package/dist/generators.js +0 -2
- package/dist/types-DcBaH0gA.d.ts +0 -217
- /package/dist/{chunk-C0LytTxp.js → rolldown-runtime-C0LytTxp.js} +0 -0
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
import "./chunk-C0LytTxp.js";
|
|
2
|
-
import { a as QueryKey, i as Mutation, l as resolveOperationTypeNames, n as QueryOptions, r as MutationKey, s as resolveZodSchemaNames, t as Query } from "./components-mWBRE6E4.js";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { ast, defineGenerator } from "@kubb/core";
|
|
5
|
-
import { Client, isParserEnabled, pluginClientName } from "@kubb/plugin-client";
|
|
6
|
-
import { pluginTsName } from "@kubb/plugin-ts";
|
|
7
|
-
import { pluginZodName } from "@kubb/plugin-zod";
|
|
8
|
-
import { File, jsxRenderer } from "@kubb/renderer-jsx";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
10
|
-
//#region src/generators/mutationGenerator.tsx
|
|
11
|
-
/**
|
|
12
|
-
* Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook
|
|
13
|
-
* per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus
|
|
14
|
-
* the matching `fooMutationKey` helper.
|
|
15
|
-
*/
|
|
16
|
-
const mutationGenerator = defineGenerator({
|
|
17
|
-
name: "swr-mutation",
|
|
18
|
-
renderer: jsxRenderer,
|
|
19
|
-
operation(node, ctx) {
|
|
20
|
-
if (!ast.isHttpOperationNode(node)) return null;
|
|
21
|
-
const { config, driver, resolver, root } = ctx;
|
|
22
|
-
const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options;
|
|
23
|
-
const pluginTs = driver.getPlugin(pluginTsName);
|
|
24
|
-
if (!pluginTs) return null;
|
|
25
|
-
const tsResolver = driver.getResolver(pluginTsName);
|
|
26
|
-
const isQuery = query === false || !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
|
|
27
|
-
const queryMethods = new Set(query ? query.methods : []);
|
|
28
|
-
if (!(mutation !== false && !isQuery && (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase()))) return null;
|
|
29
|
-
const importPath = mutation ? mutation.importPath : "swr/mutation";
|
|
30
|
-
const mutationHookName = resolver.resolveMutationName(node);
|
|
31
|
-
const mutationKeyName = resolver.resolveMutationKeyName(node);
|
|
32
|
-
const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node);
|
|
33
|
-
const mutationArgTypeName = resolver.resolveMutationArgTypeName(node);
|
|
34
|
-
const clientName = resolver.resolveClientName(node);
|
|
35
|
-
const meta = {
|
|
36
|
-
file: resolver.resolveFile({
|
|
37
|
-
name: mutationHookName,
|
|
38
|
-
extname: ".ts",
|
|
39
|
-
tag: node.tags[0] ?? "default",
|
|
40
|
-
path: node.path
|
|
41
|
-
}, {
|
|
42
|
-
root,
|
|
43
|
-
output,
|
|
44
|
-
group
|
|
45
|
-
}),
|
|
46
|
-
fileTs: tsResolver.resolveFile({
|
|
47
|
-
name: node.operationId,
|
|
48
|
-
extname: ".ts",
|
|
49
|
-
tag: node.tags[0] ?? "default",
|
|
50
|
-
path: node.path
|
|
51
|
-
}, {
|
|
52
|
-
root,
|
|
53
|
-
output: pluginTs.options?.output ?? output,
|
|
54
|
-
group: pluginTs.options?.group
|
|
55
|
-
})
|
|
56
|
-
};
|
|
57
|
-
const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {
|
|
58
|
-
paramsCasing,
|
|
59
|
-
order: "body-response-first"
|
|
60
|
-
});
|
|
61
|
-
const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : void 0;
|
|
62
|
-
const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
|
|
63
|
-
const fileZod = zodResolver ? zodResolver.resolveFile({
|
|
64
|
-
name: node.operationId,
|
|
65
|
-
extname: ".ts",
|
|
66
|
-
tag: node.tags[0] ?? "default",
|
|
67
|
-
path: node.path
|
|
68
|
-
}, {
|
|
69
|
-
root,
|
|
70
|
-
output: pluginZod?.options?.output ?? output,
|
|
71
|
-
group: pluginZod?.options?.group
|
|
72
|
-
}) : void 0;
|
|
73
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser);
|
|
74
|
-
const clientPlugin = driver.getPlugin(pluginClientName);
|
|
75
|
-
const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
|
|
76
|
-
const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
|
|
77
|
-
const clientFile = shouldUseClientPlugin ? clientResolver?.resolveFile({
|
|
78
|
-
name: node.operationId,
|
|
79
|
-
extname: ".ts",
|
|
80
|
-
tag: node.tags[0] ?? "default",
|
|
81
|
-
path: node.path
|
|
82
|
-
}, {
|
|
83
|
-
root,
|
|
84
|
-
output: clientPlugin?.options?.output ?? output,
|
|
85
|
-
group: clientPlugin?.options?.group
|
|
86
|
-
}) : void 0;
|
|
87
|
-
const resolvedClientName = shouldUseClientPlugin ? clientResolver?.resolveName(node.operationId) ?? clientName : clientName;
|
|
88
|
-
return /* @__PURE__ */ jsxs(File, {
|
|
89
|
-
baseName: meta.file.baseName,
|
|
90
|
-
path: meta.file.path,
|
|
91
|
-
meta: meta.file.meta,
|
|
92
|
-
banner: resolver.resolveBanner(ctx.meta, {
|
|
93
|
-
output,
|
|
94
|
-
config,
|
|
95
|
-
file: {
|
|
96
|
-
path: meta.file.path,
|
|
97
|
-
baseName: meta.file.baseName
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
footer: resolver.resolveFooter(ctx.meta, {
|
|
101
|
-
output,
|
|
102
|
-
config,
|
|
103
|
-
file: {
|
|
104
|
-
path: meta.file.path,
|
|
105
|
-
baseName: meta.file.baseName
|
|
106
|
-
}
|
|
107
|
-
}),
|
|
108
|
-
children: [
|
|
109
|
-
fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
110
|
-
name: zodSchemaNames,
|
|
111
|
-
root: meta.file.path,
|
|
112
|
-
path: fileZod.path
|
|
113
|
-
}),
|
|
114
|
-
clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
115
|
-
name: "client",
|
|
116
|
-
path: clientOptions.importPath
|
|
117
|
-
}), /* @__PURE__ */ jsx(File.Import, {
|
|
118
|
-
name: [
|
|
119
|
-
"Client",
|
|
120
|
-
"RequestConfig",
|
|
121
|
-
"ResponseErrorConfig"
|
|
122
|
-
],
|
|
123
|
-
path: clientOptions.importPath,
|
|
124
|
-
isTypeOnly: true
|
|
125
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
126
|
-
name: ["client"],
|
|
127
|
-
root: meta.file.path,
|
|
128
|
-
path: path.resolve(root, ".kubb/client.ts")
|
|
129
|
-
}), /* @__PURE__ */ jsx(File.Import, {
|
|
130
|
-
name: [
|
|
131
|
-
"Client",
|
|
132
|
-
"RequestConfig",
|
|
133
|
-
"ResponseErrorConfig"
|
|
134
|
-
],
|
|
135
|
-
root: meta.file.path,
|
|
136
|
-
path: path.resolve(root, ".kubb/client.ts"),
|
|
137
|
-
isTypeOnly: true
|
|
138
|
-
})] }),
|
|
139
|
-
shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
|
|
140
|
-
name: [resolvedClientName],
|
|
141
|
-
root: meta.file.path,
|
|
142
|
-
path: clientFile.path
|
|
143
|
-
}),
|
|
144
|
-
!shouldUseClientPlugin && node.requestBody?.content?.some((e) => e.contentType === "multipart/form-data") && /* @__PURE__ */ jsx(File.Import, {
|
|
145
|
-
name: ["buildFormData"],
|
|
146
|
-
root: meta.file.path,
|
|
147
|
-
path: path.resolve(root, ".kubb/config.ts")
|
|
148
|
-
}),
|
|
149
|
-
!shouldUseClientPlugin && parser === "zod" && zodResolver && node.requestBody?.content?.[0]?.schema && /* @__PURE__ */ jsx(File.Import, {
|
|
150
|
-
name: ["z"],
|
|
151
|
-
path: "zod",
|
|
152
|
-
isTypeOnly: true
|
|
153
|
-
}),
|
|
154
|
-
meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
155
|
-
name: Array.from(new Set(importedTypeNames)),
|
|
156
|
-
root: meta.file.path,
|
|
157
|
-
path: meta.fileTs.path,
|
|
158
|
-
isTypeOnly: true
|
|
159
|
-
}),
|
|
160
|
-
/* @__PURE__ */ jsx(MutationKey, {
|
|
161
|
-
name: mutationKeyName,
|
|
162
|
-
typeName: mutationKeyTypeName,
|
|
163
|
-
node,
|
|
164
|
-
pathParamsType,
|
|
165
|
-
paramsCasing,
|
|
166
|
-
transformer: ctx.options.mutationKey
|
|
167
|
-
}),
|
|
168
|
-
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
169
|
-
name: resolvedClientName,
|
|
170
|
-
baseURL: clientOptions.baseURL,
|
|
171
|
-
dataReturnType: clientOptions.dataReturnType || "data",
|
|
172
|
-
paramsCasing: clientOptions.paramsCasing || paramsCasing,
|
|
173
|
-
paramsType,
|
|
174
|
-
pathParamsType,
|
|
175
|
-
parser,
|
|
176
|
-
node,
|
|
177
|
-
tsResolver,
|
|
178
|
-
zodResolver
|
|
179
|
-
}),
|
|
180
|
-
mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
181
|
-
/* @__PURE__ */ jsx(File.Import, {
|
|
182
|
-
name: "useSWRMutation",
|
|
183
|
-
path: importPath
|
|
184
|
-
}),
|
|
185
|
-
/* @__PURE__ */ jsx(File.Import, {
|
|
186
|
-
name: ["SWRMutationConfiguration"],
|
|
187
|
-
path: importPath,
|
|
188
|
-
isTypeOnly: true
|
|
189
|
-
}),
|
|
190
|
-
/* @__PURE__ */ jsx(Mutation, {
|
|
191
|
-
name: mutationHookName,
|
|
192
|
-
clientName: resolvedClientName,
|
|
193
|
-
mutationKeyName,
|
|
194
|
-
mutationKeyTypeName,
|
|
195
|
-
mutationArgTypeName,
|
|
196
|
-
node,
|
|
197
|
-
tsResolver,
|
|
198
|
-
dataReturnType: clientOptions.dataReturnType || "data",
|
|
199
|
-
paramsCasing,
|
|
200
|
-
paramsType,
|
|
201
|
-
pathParamsType
|
|
202
|
-
})
|
|
203
|
-
] })
|
|
204
|
-
]
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region src/generators/queryGenerator.tsx
|
|
210
|
-
const queryGenerator = defineGenerator({
|
|
211
|
-
name: "swr-query",
|
|
212
|
-
renderer: jsxRenderer,
|
|
213
|
-
operation(node, ctx) {
|
|
214
|
-
if (!ast.isHttpOperationNode(node)) return null;
|
|
215
|
-
const { config, driver, resolver, root } = ctx;
|
|
216
|
-
const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options;
|
|
217
|
-
const pluginTs = driver.getPlugin(pluginTsName);
|
|
218
|
-
if (!pluginTs) return null;
|
|
219
|
-
const tsResolver = driver.getResolver(pluginTsName);
|
|
220
|
-
const isQuery = query === false || !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
|
|
221
|
-
const queryMethods = new Set(query ? query.methods : []);
|
|
222
|
-
const isMutation = mutation !== false && !isQuery && (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase());
|
|
223
|
-
if (!isQuery || isMutation) return null;
|
|
224
|
-
const importPath = query ? query.importPath : "swr";
|
|
225
|
-
const queryName = resolver.resolveQueryName(node);
|
|
226
|
-
const queryOptionsName = resolver.resolveQueryOptionsName(node);
|
|
227
|
-
const queryKeyName = resolver.resolveQueryKeyName(node);
|
|
228
|
-
const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node);
|
|
229
|
-
const clientName = resolver.resolveClientName(node);
|
|
230
|
-
const meta = {
|
|
231
|
-
file: resolver.resolveFile({
|
|
232
|
-
name: queryName,
|
|
233
|
-
extname: ".ts",
|
|
234
|
-
tag: node.tags[0] ?? "default",
|
|
235
|
-
path: node.path
|
|
236
|
-
}, {
|
|
237
|
-
root,
|
|
238
|
-
output,
|
|
239
|
-
group
|
|
240
|
-
}),
|
|
241
|
-
fileTs: tsResolver.resolveFile({
|
|
242
|
-
name: node.operationId,
|
|
243
|
-
extname: ".ts",
|
|
244
|
-
tag: node.tags[0] ?? "default",
|
|
245
|
-
path: node.path
|
|
246
|
-
}, {
|
|
247
|
-
root,
|
|
248
|
-
output: pluginTs.options?.output ?? output,
|
|
249
|
-
group: pluginTs.options?.group
|
|
250
|
-
})
|
|
251
|
-
};
|
|
252
|
-
const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {
|
|
253
|
-
paramsCasing,
|
|
254
|
-
exclude: [queryKeyTypeName],
|
|
255
|
-
order: "body-response-first"
|
|
256
|
-
});
|
|
257
|
-
const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : void 0;
|
|
258
|
-
const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
|
|
259
|
-
const fileZod = zodResolver ? zodResolver.resolveFile({
|
|
260
|
-
name: node.operationId,
|
|
261
|
-
extname: ".ts",
|
|
262
|
-
tag: node.tags[0] ?? "default",
|
|
263
|
-
path: node.path
|
|
264
|
-
}, {
|
|
265
|
-
root,
|
|
266
|
-
output: pluginZod?.options?.output ?? output,
|
|
267
|
-
group: pluginZod?.options?.group
|
|
268
|
-
}) : void 0;
|
|
269
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser);
|
|
270
|
-
const clientPlugin = driver.getPlugin(pluginClientName);
|
|
271
|
-
const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
|
|
272
|
-
const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
|
|
273
|
-
const clientFile = shouldUseClientPlugin ? clientResolver?.resolveFile({
|
|
274
|
-
name: node.operationId,
|
|
275
|
-
extname: ".ts",
|
|
276
|
-
tag: node.tags[0] ?? "default",
|
|
277
|
-
path: node.path
|
|
278
|
-
}, {
|
|
279
|
-
root,
|
|
280
|
-
output: clientPlugin?.options?.output ?? output,
|
|
281
|
-
group: clientPlugin?.options?.group
|
|
282
|
-
}) : void 0;
|
|
283
|
-
const resolvedClientName = shouldUseClientPlugin ? clientResolver?.resolveName(node.operationId) ?? clientName : clientName;
|
|
284
|
-
return /* @__PURE__ */ jsxs(File, {
|
|
285
|
-
baseName: meta.file.baseName,
|
|
286
|
-
path: meta.file.path,
|
|
287
|
-
meta: meta.file.meta,
|
|
288
|
-
banner: resolver.resolveBanner(ctx.meta, {
|
|
289
|
-
output,
|
|
290
|
-
config,
|
|
291
|
-
file: {
|
|
292
|
-
path: meta.file.path,
|
|
293
|
-
baseName: meta.file.baseName
|
|
294
|
-
}
|
|
295
|
-
}),
|
|
296
|
-
footer: resolver.resolveFooter(ctx.meta, {
|
|
297
|
-
output,
|
|
298
|
-
config,
|
|
299
|
-
file: {
|
|
300
|
-
path: meta.file.path,
|
|
301
|
-
baseName: meta.file.baseName
|
|
302
|
-
}
|
|
303
|
-
}),
|
|
304
|
-
children: [
|
|
305
|
-
fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
306
|
-
name: zodSchemaNames,
|
|
307
|
-
root: meta.file.path,
|
|
308
|
-
path: fileZod.path
|
|
309
|
-
}),
|
|
310
|
-
clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
311
|
-
name: "client",
|
|
312
|
-
path: clientOptions.importPath
|
|
313
|
-
}), /* @__PURE__ */ jsx(File.Import, {
|
|
314
|
-
name: [
|
|
315
|
-
"Client",
|
|
316
|
-
"RequestConfig",
|
|
317
|
-
"ResponseErrorConfig"
|
|
318
|
-
],
|
|
319
|
-
path: clientOptions.importPath,
|
|
320
|
-
isTypeOnly: true
|
|
321
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
322
|
-
name: ["client"],
|
|
323
|
-
root: meta.file.path,
|
|
324
|
-
path: path.resolve(root, ".kubb/client.ts")
|
|
325
|
-
}), /* @__PURE__ */ jsx(File.Import, {
|
|
326
|
-
name: [
|
|
327
|
-
"Client",
|
|
328
|
-
"RequestConfig",
|
|
329
|
-
"ResponseErrorConfig"
|
|
330
|
-
],
|
|
331
|
-
root: meta.file.path,
|
|
332
|
-
path: path.resolve(root, ".kubb/client.ts"),
|
|
333
|
-
isTypeOnly: true
|
|
334
|
-
})] }),
|
|
335
|
-
shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
|
|
336
|
-
name: [resolvedClientName],
|
|
337
|
-
root: meta.file.path,
|
|
338
|
-
path: clientFile.path
|
|
339
|
-
}),
|
|
340
|
-
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
341
|
-
name: ["buildFormData"],
|
|
342
|
-
root: meta.file.path,
|
|
343
|
-
path: path.resolve(root, ".kubb/config.ts")
|
|
344
|
-
}),
|
|
345
|
-
meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
346
|
-
name: Array.from(new Set(importedTypeNames)),
|
|
347
|
-
root: meta.file.path,
|
|
348
|
-
path: meta.fileTs.path,
|
|
349
|
-
isTypeOnly: true
|
|
350
|
-
}),
|
|
351
|
-
/* @__PURE__ */ jsx(QueryKey, {
|
|
352
|
-
name: queryKeyName,
|
|
353
|
-
typeName: queryKeyTypeName,
|
|
354
|
-
node,
|
|
355
|
-
tsResolver,
|
|
356
|
-
pathParamsType,
|
|
357
|
-
paramsCasing,
|
|
358
|
-
transformer: ctx.options.queryKey
|
|
359
|
-
}),
|
|
360
|
-
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
361
|
-
name: resolvedClientName,
|
|
362
|
-
baseURL: clientOptions.baseURL,
|
|
363
|
-
dataReturnType: clientOptions.dataReturnType || "data",
|
|
364
|
-
paramsCasing: clientOptions.paramsCasing || paramsCasing,
|
|
365
|
-
paramsType,
|
|
366
|
-
pathParamsType,
|
|
367
|
-
parser,
|
|
368
|
-
node,
|
|
369
|
-
tsResolver,
|
|
370
|
-
zodResolver
|
|
371
|
-
}),
|
|
372
|
-
/* @__PURE__ */ jsx(QueryOptions, {
|
|
373
|
-
name: queryOptionsName,
|
|
374
|
-
clientName: resolvedClientName,
|
|
375
|
-
node,
|
|
376
|
-
tsResolver,
|
|
377
|
-
paramsCasing,
|
|
378
|
-
paramsType,
|
|
379
|
-
pathParamsType
|
|
380
|
-
}),
|
|
381
|
-
query && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
382
|
-
/* @__PURE__ */ jsx(File.Import, {
|
|
383
|
-
name: "useSWR",
|
|
384
|
-
path: importPath
|
|
385
|
-
}),
|
|
386
|
-
/* @__PURE__ */ jsx(File.Import, {
|
|
387
|
-
name: ["SWRConfiguration"],
|
|
388
|
-
path: importPath,
|
|
389
|
-
isTypeOnly: true
|
|
390
|
-
}),
|
|
391
|
-
/* @__PURE__ */ jsx(Query, {
|
|
392
|
-
name: queryName,
|
|
393
|
-
queryOptionsName,
|
|
394
|
-
queryKeyName,
|
|
395
|
-
queryKeyTypeName,
|
|
396
|
-
node,
|
|
397
|
-
tsResolver,
|
|
398
|
-
paramsCasing,
|
|
399
|
-
paramsType,
|
|
400
|
-
pathParamsType,
|
|
401
|
-
dataReturnType: clientOptions.dataReturnType || "data"
|
|
402
|
-
})
|
|
403
|
-
] })
|
|
404
|
-
]
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
//#endregion
|
|
409
|
-
export { mutationGenerator as n, queryGenerator as t };
|
|
410
|
-
|
|
411
|
-
//# sourceMappingURL=generators-D2blgLOY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-D2blgLOY.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { Client, isParserEnabled, pluginClientName } from '@kubb/plugin-client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\n/**\n * Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` helper.\n */\nexport const mutationGenerator = defineGenerator<PluginSwr>({\n name: 'swr-mutation',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : 'swr/mutation'\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node)\n const mutationArgTypeName = resolver.resolveMutationArgTypeName(node)\n const clientName = resolver.resolveClientName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: mutationHookName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, order: 'body-response-first' })\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const clientPlugin = driver.getPlugin(pluginClientName)\n const hasClientPlugin = clientPlugin?.name === pluginClientName\n const shouldUseClientPlugin = hasClientPlugin && clientOptions.clientType !== 'class'\n const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : undefined\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group,\n },\n )\n : undefined\n\n const resolvedClientName = shouldUseClientPlugin ? (clientResolver?.resolveName(node.operationId) ?? clientName) : clientName\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n {clientOptions.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/client.ts')}\n isTypeOnly\n />\n </>\n )}\n {shouldUseClientPlugin && clientFile && <File.Import name={[resolvedClientName]} root={meta.file.path} path={clientFile.path} />}\n {!shouldUseClientPlugin && node.requestBody?.content?.some((e) => e.contentType === 'multipart/form-data') && (\n <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />\n )}\n {!shouldUseClientPlugin && parser === 'zod' && zodResolver && node.requestBody?.content?.[0]?.schema && (\n <File.Import name={['z']} path=\"zod\" isTypeOnly />\n )}\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n\n <MutationKey\n name={mutationKeyName}\n typeName={mutationKeyTypeName}\n node={node}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n transformer={ctx.options.mutationKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={resolvedClientName}\n baseURL={clientOptions.baseURL}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={clientOptions.paramsCasing || paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n parser={parser}\n node={node}\n tsResolver={tsResolver}\n zodResolver={zodResolver}\n />\n )}\n\n {mutation && (\n <>\n <File.Import name={'useSWRMutation'} path={importPath} />\n <File.Import name={['SWRMutationConfiguration']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n clientName={resolvedClientName}\n mutationKeyName={mutationKeyName}\n mutationKeyTypeName={mutationKeyTypeName}\n mutationArgTypeName={mutationArgTypeName}\n node={node}\n tsResolver={tsResolver}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { Client, isParserEnabled, pluginClientName } from '@kubb/plugin-client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = defineGenerator<PluginSwr>({\n name: 'swr-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : 'swr'\n\n const queryName = resolver.resolveQueryName(node)\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryKeyName = resolver.resolveQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node)\n const clientName = resolver.resolveClientName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: queryName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {\n paramsCasing,\n exclude: [queryKeyTypeName],\n order: 'body-response-first',\n })\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const clientPlugin = driver.getPlugin(pluginClientName)\n const hasClientPlugin = clientPlugin?.name === pluginClientName\n const shouldUseClientPlugin = hasClientPlugin && clientOptions.clientType !== 'class'\n const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : undefined\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group,\n },\n )\n : undefined\n\n const resolvedClientName = shouldUseClientPlugin ? (clientResolver?.resolveName(node.operationId) ?? clientName) : clientName\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n {clientOptions.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/client.ts')}\n isTypeOnly\n />\n </>\n )}\n {shouldUseClientPlugin && clientFile && <File.Import name={[resolvedClientName]} root={meta.file.path} path={clientFile.path} />}\n {!shouldUseClientPlugin && <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />}\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n transformer={ctx.options.queryKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={resolvedClientName}\n baseURL={clientOptions.baseURL}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={clientOptions.paramsCasing || paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n parser={parser}\n node={node}\n tsResolver={tsResolver}\n zodResolver={zodResolver}\n />\n )}\n\n <QueryOptions\n name={queryOptionsName}\n clientName={resolvedClientName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n />\n\n {query && (\n <>\n <File.Import name={'useSWR'} path={importPath} />\n <File.Import name={['SWRConfiguration']} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAa,oBAAoB,gBAA2B;CAC1D,MAAM;CACN,UAAU;CACV,UAAU,MAAM,KAAK;EACnB,IAAI,CAAC,IAAI,oBAAoB,IAAI,GAAG,OAAO;EAC3C,MAAM,EAAE,QAAQ,QAAQ,UAAU,SAAS;EAC3C,MAAM,EAAE,QAAQ,OAAO,UAAU,cAAc,YAAY,gBAAgB,QAAQ,QAAQ,eAAe,UAAU,IAAI;EAExH,MAAM,WAAW,OAAO,UAAU,YAAY;EAC9C,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,aAAa,OAAO,YAAY,YAAY;EAElD,MAAM,UAAU,UAAU,SAAU,CAAC,CAAC,SAAS,MAAM,QAAQ,MAAM,WAAW,KAAK,OAAO,YAAY,MAAM,OAAO,YAAY,CAAC;EAChI,MAAM,eAAe,IAAI,IAAI,QAAQ,MAAM,UAAU,CAAC,CAAC;EAMvD,IAAI,EAJF,aAAa,S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H,CAAC,yBAAyB,oBAAC,KAAK,QAAN;KAAa,MAAM,CAAC,eAAe;KAAG,MAAM,KAAK,KAAK;KAAM,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAAI,CAAA;IACpI,KAAK,UAAU,kBAAkB,SAAS,KACzC,oBAAC,KAAK,QAAN;KAAa,MAAM,MAAM,KAAK,IAAI,IAAI,iBAAiB,CAAC;KAAG,MAAM,KAAK,KAAK;KAAM,MAAM,KAAK,OAAO;KAAM,YAAA;IAAY,CAAA;IAGvH,oBAAC,UAAD;KACE,MAAM;KACN,UAAU;KACJ;KACM;KACI;KACF;KACd,aAAa,IAAI,QAAQ;IAC1B,CAAA;IAEA,CAAC,yBACA,oBAAC,QAAD;KACE,MAAM;KACN,SAAS,cAAc;KACvB,gBAAgB,cAAc,kBAAkB;KAChD,cAAc,cAAc,gBAAgB;KAChC;KACI;KACR;KACF;KACM;KACC;IACd,CAAA;IAGH,oBAAC,cAAD;KACE,MAAM;KACN,YAAY;KACN;KACM;KACE;KACF;KACI;IACjB,CAAA;IAEA,SACC,qBAAA,UAAA,EAAA,UAAA;KACE,oBAAC,KAAK,QAAN;MAAa,MAAM;MAAU,MAAM;KAAa,CAAA;KAChD,oBAAC,KAAK,QAAN;MAAa,MAAM,CAAC,kBAAkB;MAAG,MAAM;MAAY,YAAA;KAAY,CAAA;KACvE,oBAAC,OAAD;MACE,MAAM;MACY;MACJ;MACI;MACZ;MACM;MACE;MACF;MACI;MAChB,gBAAgB,cAAc,kBAAkB;KACjD,CAAA;IACD,EAAA,CAAA;GAEA;;CAEV;AACF,CAAC"}
|
package/dist/generators.cjs
DELETED
package/dist/generators.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-C0LytTxp.js";
|
|
2
|
-
import { n as PluginSwr } from "./types-DcBaH0gA.js";
|
|
3
|
-
|
|
4
|
-
//#region src/generators/mutationGenerator.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook
|
|
7
|
-
* per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus
|
|
8
|
-
* the matching `fooMutationKey` helper.
|
|
9
|
-
*/
|
|
10
|
-
declare const mutationGenerator: import("@kubb/core").Generator<PluginSwr, unknown>;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/generators/queryGenerator.d.ts
|
|
13
|
-
declare const queryGenerator: import("@kubb/core").Generator<PluginSwr, unknown>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { mutationGenerator, queryGenerator };
|
|
16
|
-
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
DELETED