@kubb/agent 5.0.0-alpha.34 → 5.0.0-alpha.36
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1790 -20812
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +16 -14
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +16 -14
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/buffer-util.js +131 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/event-target.js +292 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/extension.js +203 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/limiter.js +55 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/receiver.js +706 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/subprotocol.js +62 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/validation.js +152 -0
- package/.output/server/node_modules/@clack/core/dist/index.mjs +11 -0
- package/.output/server/node_modules/@clack/core/package.json +60 -0
- package/.output/server/node_modules/@clack/prompts/dist/index.mjs +137 -0
- package/.output/server/node_modules/@clack/prompts/package.json +65 -0
- package/.output/server/node_modules/@kubb/ast/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/ast/dist/index.js +423 -0
- package/.output/server/node_modules/@kubb/ast/package.json +70 -0
- package/.output/server/node_modules/@kubb/core/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/core/dist/hooks.js +23 -0
- package/.output/server/node_modules/@kubb/core/dist/index.js +2311 -0
- package/.output/server/node_modules/@kubb/core/package.json +109 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-O_arW02_.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-iCpMSYCp.js +15 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-NAm_Y-vp.js +55 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +653 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/onProcessExit-Cput7j2c.js +742 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +101 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +375 -0
- package/.output/server/node_modules/@kubb/fabric-core/package.json +111 -0
- package/.output/server/node_modules/@kubb/oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/oas/dist/index.js +918 -0
- package/.output/server/node_modules/@kubb/oas/package.json +94 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/StaticClassClient-bCe7RG_w.js +636 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/components.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/generators-BffddRNu.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/index.js +124 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/axios.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/fetch.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/config.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/package.json +153 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/components-BK_6GU4v.js +257 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/generators-D5YFtyyC.js +71 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/index.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/package.json +108 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/components-BkBIov4R.js +419 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/fakerGenerator-BztogaeO.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/index.js +141 -0
- package/.output/server/node_modules/@kubb/plugin-faker/package.json +103 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/Server-H3SwqhwF.js +178 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/generators-BqkMrcs9.js +274 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/index.js +122 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/package.json +107 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/components-DgtTZkWX.js +277 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/generators-C34kqa1L.js +161 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/index.js +84 -0
- package/.output/server/node_modules/@kubb/plugin-msw/package.json +109 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/SchemaMapper-CqMkO2T1.js +58 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators-D7C3CXsN.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/getFooter-Pw3tLCiV.js +112 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/hooks.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/index.js +408 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/requestBody-pRavthCw.js +1336 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/utils.js +268 -0
- package/.output/server/node_modules/@kubb/plugin-oas/package.json +122 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/components-CpyHYGOw.js +1520 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/generators-CpiBv5eE.js +1427 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/index.js +166 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/package.json +112 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/index.js +65 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/package.json +85 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/static/redoc.hbs +22 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/components-BhStIi1M.js +665 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/generators-CQClzsST.js +415 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/components-DntKBsnB.js +666 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/generators-BtTsGGrM.js +414 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/components-DRDGvgXG.js +702 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/generators-ClWZJ-YG.js +399 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/index.js +144 -0
- package/.output/server/node_modules/@kubb/plugin-swr/package.json +115 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/components-C7fu-sK1.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/index.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/plugin-CYC-FGXe.js +479 -0
- package/.output/server/node_modules/@kubb/plugin-ts/package.json +105 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/components-_AMBl0g-.js +1029 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/generators-Zb1s5Wmb.js +661 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/index.js +157 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/package.json +114 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/components-eECfXVou.js +842 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/generators-D1R6NNf2.js +290 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/index.js +175 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/templates/ToZod.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-zod/package.json +112 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-BGCRLu6H.js +38 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +525 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-Bl0DfUmV.js +1448 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +12 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +2 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +4 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-QQPrjNuQ.js +17813 -0
- package/.output/server/node_modules/@kubb/react-fabric/package.json +143 -0
- package/.output/server/node_modules/@redocly/config/lib/root-config-schema.js +11 -1
- package/.output/server/node_modules/@redocly/config/package.json +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-document.js +25 -10
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-visitor.js +32 -29
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/config.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/index.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/remove-unused-components.js +47 -38
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/index.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/remove-unused-components.js +45 -41
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-http-verbs-in-paths.js +3 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-required-schema-properties-undefined.js +41 -55
- package/.output/server/node_modules/@redocly/openapi-core/lib/walk.js +28 -16
- package/.output/server/node_modules/@redocly/openapi-core/package.json +2 -2
- package/.output/server/node_modules/buffer-from/index.js +72 -0
- package/.output/server/node_modules/buffer-from/package.json +19 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
- package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
- package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
- package/.output/server/node_modules/fast-string-width/package.json +34 -0
- package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
- package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
- package/.output/server/node_modules/p-limit/index.js +127 -0
- package/.output/server/node_modules/p-limit/package.json +58 -0
- package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
- package/.output/server/node_modules/react-devtools-core/package.json +38 -0
- package/.output/server/node_modules/sisteransi/package.json +34 -0
- package/.output/server/node_modules/sisteransi/src/index.js +58 -0
- package/.output/server/node_modules/source-map-support/package.json +31 -0
- package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
- package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
- package/.output/server/node_modules/typescript/package.json +120 -0
- package/.output/server/node_modules/yocto-queue/index.js +90 -0
- package/.output/server/node_modules/yocto-queue/package.json +48 -0
- package/.output/server/package.json +35 -4
- package/package.json +20 -20
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { a as MutationKey, i as QueryKey, n as QueryOptions, r as Mutation, t as Query } from "./components-DRDGvgXG.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { pluginClientName } from "@kubb/plugin-client";
|
|
5
|
+
import { pluginTsName } from "@kubb/plugin-ts";
|
|
6
|
+
import { pluginZodName } from "@kubb/plugin-zod";
|
|
7
|
+
import { Client } from "@kubb/plugin-client/components";
|
|
8
|
+
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
9
|
+
import { File } from "@kubb/react-fabric";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
11
|
+
import { usePluginManager } from "@kubb/core/hooks";
|
|
12
|
+
import { createReactGenerator } from "@kubb/plugin-oas/generators";
|
|
13
|
+
import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
14
|
+
import { difference } from "remeda";
|
|
15
|
+
//#region src/generators/mutationGenerator.tsx
|
|
16
|
+
const mutationGenerator = createReactGenerator({
|
|
17
|
+
name: "swr-mutation",
|
|
18
|
+
Operation({ config, operation, generator, plugin }) {
|
|
19
|
+
const { options, options: { output } } = plugin;
|
|
20
|
+
const pluginManager = usePluginManager();
|
|
21
|
+
const oas = useOas();
|
|
22
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
23
|
+
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
|
|
24
|
+
const isMutation = options.mutation !== false && !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
25
|
+
const importPath = options.mutation ? options.mutation.importPath : "swr";
|
|
26
|
+
const mutation = {
|
|
27
|
+
name: getName(operation, {
|
|
28
|
+
type: "function",
|
|
29
|
+
prefix: "use"
|
|
30
|
+
}),
|
|
31
|
+
typeName: getName(operation, { type: "type" }),
|
|
32
|
+
file: getFile(operation, { prefix: "use" })
|
|
33
|
+
};
|
|
34
|
+
const type = {
|
|
35
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
36
|
+
schemas: getSchemas(operation, {
|
|
37
|
+
pluginKey: [pluginTsName],
|
|
38
|
+
type: "type"
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
const zod = {
|
|
42
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
43
|
+
schemas: getSchemas(operation, {
|
|
44
|
+
pluginKey: [pluginZodName],
|
|
45
|
+
type: "function"
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
|
|
49
|
+
const client = {
|
|
50
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
51
|
+
type: "function",
|
|
52
|
+
pluginKey: [pluginClientName]
|
|
53
|
+
}) : getName(operation, { type: "function" }),
|
|
54
|
+
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
55
|
+
};
|
|
56
|
+
const mutationKey = {
|
|
57
|
+
name: getName(operation, {
|
|
58
|
+
type: "const",
|
|
59
|
+
suffix: "MutationKey"
|
|
60
|
+
}),
|
|
61
|
+
typeName: getName(operation, {
|
|
62
|
+
type: "type",
|
|
63
|
+
suffix: "MutationKey"
|
|
64
|
+
})
|
|
65
|
+
};
|
|
66
|
+
if (!isMutation) return null;
|
|
67
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
68
|
+
baseName: mutation.file.baseName,
|
|
69
|
+
path: mutation.file.path,
|
|
70
|
+
meta: mutation.file.meta,
|
|
71
|
+
banner: getBanner({
|
|
72
|
+
oas,
|
|
73
|
+
output,
|
|
74
|
+
config: pluginManager.config
|
|
75
|
+
}),
|
|
76
|
+
footer: getFooter({
|
|
77
|
+
oas,
|
|
78
|
+
output
|
|
79
|
+
}),
|
|
80
|
+
children: [
|
|
81
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
82
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
83
|
+
root: mutation.file.path,
|
|
84
|
+
path: zod.file.path
|
|
85
|
+
}),
|
|
86
|
+
options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
88
|
+
name: "fetch",
|
|
89
|
+
path: options.client.importPath
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
92
|
+
name: [
|
|
93
|
+
"Client",
|
|
94
|
+
"RequestConfig",
|
|
95
|
+
"ResponseErrorConfig"
|
|
96
|
+
],
|
|
97
|
+
path: options.client.importPath,
|
|
98
|
+
isTypeOnly: true
|
|
99
|
+
}),
|
|
100
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
101
|
+
name: ["ResponseConfig"],
|
|
102
|
+
path: options.client.importPath,
|
|
103
|
+
isTypeOnly: true
|
|
104
|
+
})
|
|
105
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
107
|
+
name: ["fetch"],
|
|
108
|
+
root: mutation.file.path,
|
|
109
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
112
|
+
name: [
|
|
113
|
+
"Client",
|
|
114
|
+
"RequestConfig",
|
|
115
|
+
"ResponseErrorConfig"
|
|
116
|
+
],
|
|
117
|
+
root: mutation.file.path,
|
|
118
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
119
|
+
isTypeOnly: true
|
|
120
|
+
}),
|
|
121
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
122
|
+
name: ["ResponseConfig"],
|
|
123
|
+
root: mutation.file.path,
|
|
124
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
125
|
+
isTypeOnly: true
|
|
126
|
+
})
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
129
|
+
name: "useSWRMutation",
|
|
130
|
+
path: importPath
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
133
|
+
name: ["SWRMutationConfiguration", "SWRMutationResponse"],
|
|
134
|
+
path: importPath,
|
|
135
|
+
isTypeOnly: true
|
|
136
|
+
}),
|
|
137
|
+
shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
138
|
+
name: [client.name],
|
|
139
|
+
root: mutation.file.path,
|
|
140
|
+
path: client.file.path
|
|
141
|
+
}),
|
|
142
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
143
|
+
name: ["buildFormData"],
|
|
144
|
+
root: mutation.file.path,
|
|
145
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
148
|
+
name: [
|
|
149
|
+
type.schemas.request?.name,
|
|
150
|
+
type.schemas.response.name,
|
|
151
|
+
type.schemas.pathParams?.name,
|
|
152
|
+
type.schemas.queryParams?.name,
|
|
153
|
+
type.schemas.headerParams?.name,
|
|
154
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
155
|
+
].filter(Boolean),
|
|
156
|
+
root: mutation.file.path,
|
|
157
|
+
path: type.file.path,
|
|
158
|
+
isTypeOnly: true
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ jsx(MutationKey, {
|
|
161
|
+
name: mutationKey.name,
|
|
162
|
+
typeName: mutationKey.typeName,
|
|
163
|
+
operation,
|
|
164
|
+
pathParamsType: options.pathParamsType,
|
|
165
|
+
typeSchemas: type.schemas,
|
|
166
|
+
paramsCasing: options.paramsCasing,
|
|
167
|
+
transformer: options.mutationKey
|
|
168
|
+
}),
|
|
169
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
170
|
+
name: client.name,
|
|
171
|
+
baseURL: options.client.baseURL,
|
|
172
|
+
operation,
|
|
173
|
+
typeSchemas: type.schemas,
|
|
174
|
+
zodSchemas: zod.schemas,
|
|
175
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
176
|
+
paramsCasing: options.client?.paramsCasing || options.paramsCasing,
|
|
177
|
+
paramsType: options.paramsType,
|
|
178
|
+
pathParamsType: options.pathParamsType,
|
|
179
|
+
parser: options.parser
|
|
180
|
+
}),
|
|
181
|
+
options.mutation && /* @__PURE__ */ jsx(Mutation, {
|
|
182
|
+
name: mutation.name,
|
|
183
|
+
clientName: client.name,
|
|
184
|
+
typeName: mutation.typeName,
|
|
185
|
+
typeSchemas: type.schemas,
|
|
186
|
+
operation,
|
|
187
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
188
|
+
paramsType: options.paramsType,
|
|
189
|
+
paramsCasing: options.paramsCasing,
|
|
190
|
+
pathParamsType: options.pathParamsType,
|
|
191
|
+
mutationKeyName: mutationKey.name,
|
|
192
|
+
mutationKeyTypeName: mutationKey.typeName,
|
|
193
|
+
paramsToTrigger: options.mutation.paramsToTrigger
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/generators/queryGenerator.tsx
|
|
201
|
+
const queryGenerator = createReactGenerator({
|
|
202
|
+
name: "swr-query",
|
|
203
|
+
Operation({ config, operation, generator, plugin }) {
|
|
204
|
+
const { options, options: { output } } = plugin;
|
|
205
|
+
const pluginManager = usePluginManager();
|
|
206
|
+
const oas = useOas();
|
|
207
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
208
|
+
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
209
|
+
const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
210
|
+
const importPath = options.query ? options.query.importPath : "swr/mutation";
|
|
211
|
+
const query = {
|
|
212
|
+
name: getName(operation, {
|
|
213
|
+
type: "function",
|
|
214
|
+
prefix: "use"
|
|
215
|
+
}),
|
|
216
|
+
typeName: getName(operation, { type: "type" }),
|
|
217
|
+
file: getFile(operation, { prefix: "use" })
|
|
218
|
+
};
|
|
219
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
|
|
220
|
+
const client = {
|
|
221
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
222
|
+
type: "function",
|
|
223
|
+
pluginKey: [pluginClientName]
|
|
224
|
+
}) : getName(operation, { type: "function" }),
|
|
225
|
+
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
226
|
+
};
|
|
227
|
+
const queryOptions = { name: getName(operation, {
|
|
228
|
+
type: "function",
|
|
229
|
+
suffix: "QueryOptions"
|
|
230
|
+
}) };
|
|
231
|
+
const queryKey = {
|
|
232
|
+
name: getName(operation, {
|
|
233
|
+
type: "const",
|
|
234
|
+
suffix: "QueryKey"
|
|
235
|
+
}),
|
|
236
|
+
typeName: getName(operation, {
|
|
237
|
+
type: "type",
|
|
238
|
+
suffix: "QueryKey"
|
|
239
|
+
})
|
|
240
|
+
};
|
|
241
|
+
const type = {
|
|
242
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
243
|
+
schemas: getSchemas(operation, {
|
|
244
|
+
pluginKey: [pluginTsName],
|
|
245
|
+
type: "type"
|
|
246
|
+
})
|
|
247
|
+
};
|
|
248
|
+
const zod = {
|
|
249
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
250
|
+
schemas: getSchemas(operation, {
|
|
251
|
+
pluginKey: [pluginZodName],
|
|
252
|
+
type: "function"
|
|
253
|
+
})
|
|
254
|
+
};
|
|
255
|
+
if (!isQuery || isMutation) return null;
|
|
256
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
257
|
+
baseName: query.file.baseName,
|
|
258
|
+
path: query.file.path,
|
|
259
|
+
meta: query.file.meta,
|
|
260
|
+
banner: getBanner({
|
|
261
|
+
oas,
|
|
262
|
+
output,
|
|
263
|
+
config: pluginManager.config
|
|
264
|
+
}),
|
|
265
|
+
footer: getFooter({
|
|
266
|
+
oas,
|
|
267
|
+
output
|
|
268
|
+
}),
|
|
269
|
+
children: [
|
|
270
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
271
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
272
|
+
root: query.file.path,
|
|
273
|
+
path: zod.file.path
|
|
274
|
+
}),
|
|
275
|
+
options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
276
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
277
|
+
name: "fetch",
|
|
278
|
+
path: options.client.importPath
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
281
|
+
name: [
|
|
282
|
+
"Client",
|
|
283
|
+
"RequestConfig",
|
|
284
|
+
"ResponseErrorConfig"
|
|
285
|
+
],
|
|
286
|
+
path: options.client.importPath,
|
|
287
|
+
isTypeOnly: true
|
|
288
|
+
}),
|
|
289
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
290
|
+
name: ["ResponseConfig"],
|
|
291
|
+
path: options.client.importPath,
|
|
292
|
+
isTypeOnly: true
|
|
293
|
+
})
|
|
294
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
295
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
296
|
+
name: ["fetch"],
|
|
297
|
+
root: query.file.path,
|
|
298
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
301
|
+
name: [
|
|
302
|
+
"Client",
|
|
303
|
+
"RequestConfig",
|
|
304
|
+
"ResponseErrorConfig"
|
|
305
|
+
],
|
|
306
|
+
root: query.file.path,
|
|
307
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
308
|
+
isTypeOnly: true
|
|
309
|
+
}),
|
|
310
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
311
|
+
name: ["ResponseConfig"],
|
|
312
|
+
root: query.file.path,
|
|
313
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
314
|
+
isTypeOnly: true
|
|
315
|
+
})
|
|
316
|
+
] }),
|
|
317
|
+
shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
318
|
+
name: [client.name],
|
|
319
|
+
root: query.file.path,
|
|
320
|
+
path: client.file.path
|
|
321
|
+
}),
|
|
322
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
323
|
+
name: ["buildFormData"],
|
|
324
|
+
root: query.file.path,
|
|
325
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
328
|
+
name: [
|
|
329
|
+
type.schemas.request?.name,
|
|
330
|
+
type.schemas.response.name,
|
|
331
|
+
type.schemas.pathParams?.name,
|
|
332
|
+
type.schemas.queryParams?.name,
|
|
333
|
+
type.schemas.headerParams?.name,
|
|
334
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
335
|
+
].filter(Boolean),
|
|
336
|
+
root: query.file.path,
|
|
337
|
+
path: type.file.path,
|
|
338
|
+
isTypeOnly: true
|
|
339
|
+
}),
|
|
340
|
+
/* @__PURE__ */ jsx(QueryKey, {
|
|
341
|
+
name: queryKey.name,
|
|
342
|
+
typeName: queryKey.typeName,
|
|
343
|
+
operation,
|
|
344
|
+
pathParamsType: options.pathParamsType,
|
|
345
|
+
typeSchemas: type.schemas,
|
|
346
|
+
paramsCasing: options.paramsCasing,
|
|
347
|
+
transformer: options.queryKey
|
|
348
|
+
}),
|
|
349
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
350
|
+
name: client.name,
|
|
351
|
+
baseURL: options.client.baseURL,
|
|
352
|
+
operation,
|
|
353
|
+
typeSchemas: type.schemas,
|
|
354
|
+
zodSchemas: zod.schemas,
|
|
355
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
356
|
+
paramsCasing: options.client.paramsCasing || options.paramsCasing,
|
|
357
|
+
paramsType: options.paramsType,
|
|
358
|
+
pathParamsType: options.pathParamsType,
|
|
359
|
+
parser: options.parser
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ jsx(QueryOptions, {
|
|
362
|
+
name: queryOptions.name,
|
|
363
|
+
clientName: client.name,
|
|
364
|
+
typeSchemas: type.schemas,
|
|
365
|
+
paramsType: options.paramsType,
|
|
366
|
+
paramsCasing: options.paramsCasing,
|
|
367
|
+
pathParamsType: options.pathParamsType
|
|
368
|
+
}),
|
|
369
|
+
options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
370
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
371
|
+
name: "useSWR",
|
|
372
|
+
path: importPath
|
|
373
|
+
}),
|
|
374
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
375
|
+
name: ["SWRResponse"],
|
|
376
|
+
path: importPath,
|
|
377
|
+
isTypeOnly: true
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ jsx(Query, {
|
|
380
|
+
name: query.name,
|
|
381
|
+
queryOptionsName: queryOptions.name,
|
|
382
|
+
typeSchemas: type.schemas,
|
|
383
|
+
paramsType: options.paramsType,
|
|
384
|
+
pathParamsType: options.pathParamsType,
|
|
385
|
+
operation,
|
|
386
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
387
|
+
queryKeyName: queryKey.name,
|
|
388
|
+
paramsCasing: options.paramsCasing,
|
|
389
|
+
queryKeyTypeName: queryKey.typeName
|
|
390
|
+
})
|
|
391
|
+
] })
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
//#endregion
|
|
397
|
+
export { mutationGenerator as n, queryGenerator as t };
|
|
398
|
+
|
|
399
|
+
//# sourceMappingURL=generators-ClWZJ-YG.js.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { a as MutationKey, i as QueryKey, o as camelCase, s as pascalCase } from "./components-DRDGvgXG.js";
|
|
3
|
+
import { n as mutationGenerator, t as queryGenerator } from "./generators-ClWZJ-YG.js";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
6
|
+
import { pluginClientName } from "@kubb/plugin-client";
|
|
7
|
+
import { source } from "@kubb/plugin-client/templates/clients/axios.source";
|
|
8
|
+
import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
|
|
9
|
+
import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
|
|
10
|
+
import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
|
|
11
|
+
import { pluginTsName } from "@kubb/plugin-ts";
|
|
12
|
+
import { pluginZodName } from "@kubb/plugin-zod";
|
|
13
|
+
//#region src/plugin.ts
|
|
14
|
+
const pluginSwrName = "plugin-swr";
|
|
15
|
+
const pluginSwr = definePlugin((options) => {
|
|
16
|
+
const { output = {
|
|
17
|
+
path: "hooks",
|
|
18
|
+
barrelType: "named"
|
|
19
|
+
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, query, mutation, client, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutationKey = MutationKey.getTransformer, queryKey = QueryKey.getTransformer, generators = [queryGenerator, mutationGenerator].filter(Boolean), paramsCasing, contentType } = options;
|
|
20
|
+
const clientName = client?.client ?? "axios";
|
|
21
|
+
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
|
|
22
|
+
return {
|
|
23
|
+
name: pluginSwrName,
|
|
24
|
+
options: {
|
|
25
|
+
output,
|
|
26
|
+
client: {
|
|
27
|
+
bundle: client?.bundle,
|
|
28
|
+
baseURL: client?.baseURL,
|
|
29
|
+
client: clientName,
|
|
30
|
+
clientType: client?.clientType ?? "function",
|
|
31
|
+
importPath: clientImportPath,
|
|
32
|
+
dataReturnType: client?.dataReturnType ?? "data",
|
|
33
|
+
paramsCasing
|
|
34
|
+
},
|
|
35
|
+
queryKey,
|
|
36
|
+
query: query === false ? false : {
|
|
37
|
+
importPath: "swr",
|
|
38
|
+
methods: ["get"],
|
|
39
|
+
...query
|
|
40
|
+
},
|
|
41
|
+
mutationKey,
|
|
42
|
+
mutation: mutation === false ? false : {
|
|
43
|
+
importPath: "swr/mutation",
|
|
44
|
+
methods: [
|
|
45
|
+
"post",
|
|
46
|
+
"put",
|
|
47
|
+
"delete",
|
|
48
|
+
"patch"
|
|
49
|
+
],
|
|
50
|
+
...mutation
|
|
51
|
+
},
|
|
52
|
+
parser,
|
|
53
|
+
paramsType,
|
|
54
|
+
pathParamsType,
|
|
55
|
+
paramsCasing,
|
|
56
|
+
group
|
|
57
|
+
},
|
|
58
|
+
pre: [
|
|
59
|
+
pluginOasName,
|
|
60
|
+
pluginTsName,
|
|
61
|
+
parser === "zod" ? pluginZodName : void 0
|
|
62
|
+
].filter(Boolean),
|
|
63
|
+
resolvePath(baseName, pathMode, options) {
|
|
64
|
+
const root = path.resolve(this.config.root, this.config.output.path);
|
|
65
|
+
if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
|
|
66
|
+
/**
|
|
67
|
+
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
68
|
+
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
69
|
+
*/
|
|
70
|
+
return path.resolve(root, output.path);
|
|
71
|
+
if (group && (options?.group?.path || options?.group?.tag)) {
|
|
72
|
+
const groupName = group?.name ? group.name : (ctx) => {
|
|
73
|
+
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
74
|
+
return `${camelCase(ctx.group)}Controller`;
|
|
75
|
+
};
|
|
76
|
+
return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
|
|
77
|
+
}
|
|
78
|
+
return path.resolve(root, output.path, baseName);
|
|
79
|
+
},
|
|
80
|
+
resolveName(name, type) {
|
|
81
|
+
let resolvedName = camelCase(name);
|
|
82
|
+
if (type === "file" || type === "function") resolvedName = camelCase(name, { isFile: type === "file" });
|
|
83
|
+
if (type === "type") resolvedName = pascalCase(name);
|
|
84
|
+
if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
|
|
85
|
+
return resolvedName;
|
|
86
|
+
},
|
|
87
|
+
async install() {
|
|
88
|
+
const root = path.resolve(this.config.root, this.config.output.path);
|
|
89
|
+
const mode = getMode(path.resolve(root, output.path));
|
|
90
|
+
const oas = await this.getOas();
|
|
91
|
+
const baseURL = await this.getBaseURL();
|
|
92
|
+
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
93
|
+
const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName]);
|
|
94
|
+
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
95
|
+
baseName: "fetch.ts",
|
|
96
|
+
path: path.resolve(root, ".kubb/fetch.ts"),
|
|
97
|
+
sources: [{
|
|
98
|
+
name: "fetch",
|
|
99
|
+
value: this.plugin.options.client.client === "fetch" ? source$1 : source,
|
|
100
|
+
isExportable: true,
|
|
101
|
+
isIndexable: true
|
|
102
|
+
}],
|
|
103
|
+
imports: [],
|
|
104
|
+
exports: []
|
|
105
|
+
});
|
|
106
|
+
if (!hasClientPlugin) await this.addFile({
|
|
107
|
+
baseName: "config.ts",
|
|
108
|
+
path: path.resolve(root, ".kubb/config.ts"),
|
|
109
|
+
sources: [{
|
|
110
|
+
name: "config",
|
|
111
|
+
value: source$2,
|
|
112
|
+
isExportable: false,
|
|
113
|
+
isIndexable: false
|
|
114
|
+
}],
|
|
115
|
+
imports: [],
|
|
116
|
+
exports: []
|
|
117
|
+
});
|
|
118
|
+
const files = await new OperationGenerator(this.plugin.options, {
|
|
119
|
+
fabric: this.fabric,
|
|
120
|
+
oas,
|
|
121
|
+
pluginManager: this.pluginManager,
|
|
122
|
+
events: this.events,
|
|
123
|
+
plugin: this.plugin,
|
|
124
|
+
contentType,
|
|
125
|
+
exclude,
|
|
126
|
+
include,
|
|
127
|
+
override,
|
|
128
|
+
mode
|
|
129
|
+
}).build(...generators);
|
|
130
|
+
await this.upsertFile(...files);
|
|
131
|
+
const barrelFiles = await getBarrelFiles(this.fabric.files, {
|
|
132
|
+
type: output.barrelType ?? "named",
|
|
133
|
+
root,
|
|
134
|
+
output,
|
|
135
|
+
meta: { pluginKey: this.plugin.key }
|
|
136
|
+
});
|
|
137
|
+
await this.upsertFile(...barrelFiles);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
//#endregion
|
|
142
|
+
export { pluginSwr, pluginSwrName };
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kubb/plugin-swr",
|
|
3
|
+
"version": "4.37.2",
|
|
4
|
+
"description": "SWR hooks generator plugin for Kubb, creating type-safe data fetching hooks from OpenAPI specifications for React and Next.js applications.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"swr",
|
|
7
|
+
"react",
|
|
8
|
+
"nextjs",
|
|
9
|
+
"next",
|
|
10
|
+
"next.js",
|
|
11
|
+
"vercel",
|
|
12
|
+
"data-fetching",
|
|
13
|
+
"react-hooks",
|
|
14
|
+
"hooks",
|
|
15
|
+
"api-client",
|
|
16
|
+
"sdk-generator",
|
|
17
|
+
"typescript",
|
|
18
|
+
"type-safe",
|
|
19
|
+
"openapi",
|
|
20
|
+
"swagger",
|
|
21
|
+
"oas",
|
|
22
|
+
"code-generator",
|
|
23
|
+
"codegen",
|
|
24
|
+
"plugins",
|
|
25
|
+
"kubb"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/kubb-labs/kubb.git",
|
|
30
|
+
"directory": "packages/plugin-swr"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"author": "stijnvanhulle",
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"import": "./dist/index.js",
|
|
39
|
+
"require": "./dist/index.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./components": {
|
|
42
|
+
"import": "./dist/components.js",
|
|
43
|
+
"require": "./dist/components.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./generators": {
|
|
46
|
+
"import": "./dist/generators.js",
|
|
47
|
+
"require": "./dist/generators.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./package.json": "./package.json"
|
|
50
|
+
},
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
52
|
+
"typesVersions": {
|
|
53
|
+
"*": {
|
|
54
|
+
"components": [
|
|
55
|
+
"./dist/components.d.ts"
|
|
56
|
+
],
|
|
57
|
+
"generators": [
|
|
58
|
+
"./dist/generators.d.ts"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"src",
|
|
64
|
+
"dist",
|
|
65
|
+
"!/**/**.test.**",
|
|
66
|
+
"!/**/__tests__/**",
|
|
67
|
+
"!/**/__snapshots__/**"
|
|
68
|
+
],
|
|
69
|
+
"size-limit": [
|
|
70
|
+
{
|
|
71
|
+
"path": "./dist/*.js",
|
|
72
|
+
"limit": "510 KiB",
|
|
73
|
+
"gzip": true
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@kubb/fabric-core": "0.14.0",
|
|
78
|
+
"@kubb/react-fabric": "0.14.0",
|
|
79
|
+
"remeda": "^2.33.6",
|
|
80
|
+
"@kubb/core": "4.37.2",
|
|
81
|
+
"@kubb/oas": "4.37.2",
|
|
82
|
+
"@kubb/plugin-client": "4.37.2",
|
|
83
|
+
"@kubb/plugin-oas": "4.37.2",
|
|
84
|
+
"@kubb/plugin-ts": "4.37.2",
|
|
85
|
+
"@kubb/plugin-zod": "4.37.2"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"@kubb/fabric-core": "0.14.0",
|
|
89
|
+
"@kubb/react-fabric": "0.14.0"
|
|
90
|
+
},
|
|
91
|
+
"engines": {
|
|
92
|
+
"node": ">=20"
|
|
93
|
+
},
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public",
|
|
96
|
+
"registry": "https://registry.npmjs.org/"
|
|
97
|
+
},
|
|
98
|
+
"main": "./dist/index.cjs",
|
|
99
|
+
"module": "./dist/index.js",
|
|
100
|
+
"devDependencies": {
|
|
101
|
+
"@internals/tanstack-query": "0.0.0",
|
|
102
|
+
"@internals/utils": "0.0.0"
|
|
103
|
+
},
|
|
104
|
+
"scripts": {
|
|
105
|
+
"build": "tsdown && size-limit",
|
|
106
|
+
"clean": "rimraf ./dist",
|
|
107
|
+
"lint": "bun biome lint .",
|
|
108
|
+
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
109
|
+
"release": "pnpm publish --no-git-check",
|
|
110
|
+
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
111
|
+
"start": "tsdown --watch",
|
|
112
|
+
"test": "vitest --passWithNoTests",
|
|
113
|
+
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
|
114
|
+
}
|
|
115
|
+
}
|