@kubb/plugin-swr 3.0.0-alpha.9 → 3.0.0-beta.2

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.
Files changed (61) hide show
  1. package/README.md +14 -5
  2. package/dist/chunk-4EGGCGSE.js +217 -0
  3. package/dist/chunk-4EGGCGSE.js.map +1 -0
  4. package/dist/chunk-H23WKEYP.js +243 -0
  5. package/dist/chunk-H23WKEYP.js.map +1 -0
  6. package/dist/chunk-JWGWABV5.cjs +249 -0
  7. package/dist/chunk-JWGWABV5.cjs.map +1 -0
  8. package/dist/chunk-PTOQHHST.cjs +220 -0
  9. package/dist/chunk-PTOQHHST.cjs.map +1 -0
  10. package/dist/components.cjs +23 -6
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +88 -6
  13. package/dist/components.d.ts +88 -6
  14. package/dist/components.js +2 -10
  15. package/dist/components.js.map +1 -1
  16. package/dist/generators.cjs +17 -0
  17. package/dist/generators.cjs.map +1 -0
  18. package/dist/generators.d.cts +11 -0
  19. package/dist/generators.d.ts +11 -0
  20. package/dist/generators.js +4 -0
  21. package/dist/generators.js.map +1 -0
  22. package/dist/index.cjs +93 -123
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +2 -4
  25. package/dist/index.d.ts +2 -4
  26. package/dist/index.js +77 -114
  27. package/dist/index.js.map +1 -1
  28. package/dist/types-DaH2Sc1M.d.cts +103 -0
  29. package/dist/types-DaH2Sc1M.d.ts +103 -0
  30. package/package.json +23 -17
  31. package/src/components/Mutation.tsx +93 -227
  32. package/src/components/MutationKey.tsx +48 -0
  33. package/src/components/Query.tsx +93 -259
  34. package/src/components/QueryKey.tsx +73 -0
  35. package/src/components/QueryOptions.tsx +54 -177
  36. package/src/components/index.ts +2 -0
  37. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +43 -0
  38. package/src/generators/__snapshots__/clientGetImportPath.ts +43 -0
  39. package/src/generators/__snapshots__/clientPostImportPath.ts +32 -0
  40. package/src/generators/__snapshots__/findByTags.ts +43 -0
  41. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +43 -0
  42. package/src/generators/__snapshots__/findByTagsWithZod.ts +43 -0
  43. package/src/generators/__snapshots__/getAsMutation.ts +34 -0
  44. package/src/generators/__snapshots__/postAsQuery.ts +41 -0
  45. package/src/generators/__snapshots__/updatePetById.ts +32 -0
  46. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +36 -0
  47. package/src/generators/index.ts +2 -0
  48. package/src/generators/mutationGenerator.tsx +109 -0
  49. package/src/generators/queryGenerator.tsx +114 -0
  50. package/src/plugin.ts +71 -52
  51. package/src/types.ts +62 -78
  52. package/dist/chunk-TGLXUPN4.cjs +0 -536
  53. package/dist/chunk-TGLXUPN4.cjs.map +0 -1
  54. package/dist/chunk-XWXMQJD6.js +0 -536
  55. package/dist/chunk-XWXMQJD6.js.map +0 -1
  56. package/dist/index-B3C-JOIU.d.cts +0 -299
  57. package/dist/index-B3C-JOIU.d.ts +0 -299
  58. package/src/OperationGenerator.tsx +0 -75
  59. package/src/components/SchemaType.tsx +0 -63
  60. package/src/components/__snapshots__/Mutation/Pets.ts +0 -46
  61. package/src/components/__snapshots__/Query/showPetById.ts +0 -59
package/dist/index.js CHANGED
@@ -1,113 +1,71 @@
1
- import {
2
- Mutation,
3
- Query,
4
- QueryOptions
5
- } from "./chunk-XWXMQJD6.js";
1
+ import { queryGenerator, mutationGenerator } from './chunk-4EGGCGSE.js';
2
+ import './chunk-H23WKEYP.js';
3
+ import path from 'node:path';
4
+ import { createPlugin, FileManager, PluginManager } from '@kubb/core';
5
+ import { camelCase, pascalCase } from '@kubb/core/transformers';
6
+ import '@kubb/core/utils';
7
+ import { pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
8
+ import { pluginTsName } from '@kubb/plugin-ts';
9
+ import { pluginZodName } from '@kubb/plugin-zod';
6
10
 
7
- // src/plugin.ts
8
- import path from "node:path";
9
- import { FileManager, PluginManager, createPlugin } from "@kubb/core";
10
- import { camelCase, pascalCase } from "@kubb/core/transformers";
11
- import { renderTemplate } from "@kubb/core/utils";
12
- import { pluginOasName } from "@kubb/plugin-oas";
13
- import { pluginTsName } from "@kubb/plugin-ts";
14
- import { pluginZodName } from "@kubb/plugin-zod";
15
-
16
- // src/OperationGenerator.tsx
17
- import { OperationGenerator as Generator } from "@kubb/plugin-oas";
18
- import { Oas } from "@kubb/plugin-oas/components";
19
- import { App, createRoot } from "@kubb/react";
20
- import { jsx } from "@kubb/react/jsx-runtime";
21
- var OperationGenerator = class extends Generator {
22
- async get(operation, options) {
23
- const { oas, pluginManager, plugin, mode } = this.context;
24
- const root = createRoot({
25
- logger: pluginManager.logger
26
- });
27
- if (!options.templates?.query || !options.templates?.queryOptions) {
28
- return [];
29
- }
30
- root.render(
31
- /* @__PURE__ */ jsx(App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx(Oas, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ jsx(Oas.Operation, { operation, children: /* @__PURE__ */ jsx(
32
- Query.File,
33
- {
34
- templates: {
35
- query: options.templates.query,
36
- queryOptions: options.templates.queryOptions
37
- }
38
- }
39
- ) }) }) })
40
- );
41
- return root.files;
42
- }
43
- async post(operation, options) {
44
- const { oas, pluginManager, plugin, mode } = this.context;
45
- const root = createRoot({
46
- logger: pluginManager.logger
47
- });
48
- if (!options.templates?.mutation) {
49
- return [];
50
- }
51
- root.render(
52
- /* @__PURE__ */ jsx(App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx(Oas, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ jsx(Oas.Operation, { operation, children: /* @__PURE__ */ jsx(Mutation.File, { templates: options.templates.mutation }) }) }) })
53
- );
54
- return root.files;
55
- }
56
- async put(operation, options) {
57
- return this.post(operation, options);
58
- }
59
- async patch(operation, options) {
60
- return this.post(operation, options);
61
- }
62
- async delete(operation, options) {
63
- return this.post(operation, options);
64
- }
65
- };
66
-
67
- // src/plugin.ts
68
11
  var pluginSwrName = "plugin-swr";
69
12
  var pluginSwr = createPlugin((options) => {
70
- const { output = { path: "hooks" }, group, exclude = [], include, override = [], parser, transformers = {}, templates, dataReturnType = "data" } = options;
71
- const template = group?.output ? group.output : `${output.path}/{{tag}}SWRController`;
13
+ const {
14
+ output = { path: "hooks", barrelType: "named" },
15
+ group,
16
+ exclude = [],
17
+ include,
18
+ override = [],
19
+ parser = "client",
20
+ transformers = {},
21
+ query,
22
+ mutation,
23
+ client,
24
+ pathParamsType = "inline",
25
+ generators = [queryGenerator, mutationGenerator].filter(Boolean)
26
+ } = options;
72
27
  return {
73
28
  name: pluginSwrName,
74
- output: {
75
- exportType: "barrelNamed",
76
- ...output
77
- },
78
29
  options: {
79
- extName: output.extName,
80
- templates: {
81
- mutation: Mutation.templates,
82
- query: Query.templates,
83
- queryOptions: QueryOptions.templates,
84
- ...templates
85
- },
30
+ output,
31
+ pathParamsType,
86
32
  client: {
87
33
  importPath: "@kubb/plugin-client/client",
88
- ...options.client
34
+ dataReturnType: "data",
35
+ ...client
36
+ },
37
+ query: {
38
+ key: (key) => key,
39
+ importPath: "swr",
40
+ methods: ["get"],
41
+ ...query
89
42
  },
90
- dataReturnType,
91
- parser
43
+ mutation: {
44
+ key: (key) => key,
45
+ importPath: "swr/mutation",
46
+ methods: ["post", "put", "delete", "patch"],
47
+ ...mutation
48
+ },
49
+ parser,
50
+ baseURL: void 0
92
51
  },
93
52
  pre: [pluginOasName, pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
94
53
  resolvePath(baseName, pathMode, options2) {
95
54
  const root = path.resolve(this.config.root, this.config.output.path);
96
55
  const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
56
+ if (options2?.tag && group?.type === "tag") {
57
+ const groupName = group?.name ? group.name : (ctx) => `${ctx.group}Controller`;
58
+ return path.resolve(root, output.path, groupName({ group: camelCase(options2.tag) }), baseName);
59
+ }
97
60
  if (mode === "single") {
98
61
  return path.resolve(root, output.path);
99
62
  }
100
- if (options2?.tag && group?.type === "tag") {
101
- const tag = camelCase(options2.tag);
102
- return path.resolve(root, renderTemplate(template, { tag }), baseName);
103
- }
104
63
  return path.resolve(root, output.path, baseName);
105
64
  },
106
65
  resolveName(name, type) {
107
66
  let resolvedName = camelCase(name);
108
67
  if (type === "file" || type === "function") {
109
68
  resolvedName = camelCase(name, {
110
- prefix: "use",
111
69
  isFile: type === "file"
112
70
  });
113
71
  }
@@ -124,35 +82,40 @@ var pluginSwr = createPlugin((options) => {
124
82
  const oas = await swaggerPlugin.context.getOas();
125
83
  const root = path.resolve(this.config.root, this.config.output.path);
126
84
  const mode = FileManager.getMode(path.resolve(root, output.path));
127
- const operationGenerator = new OperationGenerator(this.plugin.options, {
128
- oas,
129
- pluginManager: this.pluginManager,
130
- plugin: this.plugin,
131
- contentType: swaggerPlugin.context.contentType,
132
- exclude,
133
- include,
134
- override,
135
- mode
136
- });
137
- const files = await operationGenerator.build();
85
+ const baseURL = await swaggerPlugin.context.getBaseURL();
86
+ const operationGenerator = new OperationGenerator(
87
+ {
88
+ ...this.plugin.options,
89
+ baseURL
90
+ },
91
+ {
92
+ oas,
93
+ pluginManager: this.pluginManager,
94
+ plugin: this.plugin,
95
+ contentType: swaggerPlugin.context.contentType,
96
+ exclude,
97
+ include,
98
+ override,
99
+ mode
100
+ }
101
+ );
102
+ const files = await operationGenerator.build(...generators);
138
103
  await this.addFile(...files);
139
- if (this.config.output.exportType) {
140
- const barrelFiles = await this.fileManager.getBarrelFiles({
141
- root,
142
- output,
143
- files: this.fileManager.files,
144
- meta: {
145
- pluginKey: this.plugin.key
146
- },
147
- logger: this.logger
148
- });
149
- await this.addFile(...barrelFiles);
150
- }
104
+ const barrelFiles = await this.fileManager.getBarrelFiles({
105
+ type: output.barrelType ?? "named",
106
+ root,
107
+ output,
108
+ files: this.fileManager.files,
109
+ meta: {
110
+ pluginKey: this.plugin.key
111
+ },
112
+ logger: this.logger
113
+ });
114
+ await this.addFile(...barrelFiles);
151
115
  }
152
116
  };
153
117
  });
154
- export {
155
- pluginSwr,
156
- pluginSwrName
157
- };
118
+
119
+ export { pluginSwr, pluginSwrName };
120
+ //# sourceMappingURL=index.js.map
158
121
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts","../src/OperationGenerator.tsx"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { Mutation, Query, QueryOptions } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport type { PluginSwr } from './types.ts'\n\nexport const pluginSwrName = 'plugin-swr' satisfies PluginSwr['name']\n\nexport const pluginSwr = createPlugin<PluginSwr>((options) => {\n const { output = { path: 'hooks' }, group, exclude = [], include, override = [], parser, transformers = {}, templates, dataReturnType = 'data' } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}SWRController`\n\n return {\n name: pluginSwrName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n extName: output.extName,\n templates: {\n mutation: Mutation.templates,\n query: Query.templates,\n queryOptions: QueryOptions.templates,\n ...templates,\n },\n client: {\n importPath: '@kubb/plugin-client/client',\n ...options.client,\n },\n dataReturnType,\n parser,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n prefix: 'use',\n isFile: type === 'file',\n })\n }\n\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build()\n await this.addFile(...files)\n\n if (this.config.output.exportType) {\n const barrelFiles = await this.fileManager.getBarrelFiles({\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n }\n },\n }\n})\n","import { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { Query } from './components/Query.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginSwr } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginSwr['resolvedOptions'], PluginSwr, FileMeta> {\n async get(operation: Operation, options: PluginSwr['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n if (!options.templates?.query || !options.templates?.queryOptions) {\n return []\n }\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <Query.File\n templates={{\n query: options.templates.query,\n queryOptions: options.templates.queryOptions,\n }}\n />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async post(operation: Operation, options: PluginSwr['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n if (!options.templates?.mutation) {\n return []\n }\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <Mutation.File templates={options.templates.mutation} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async put(operation: Operation, options: PluginSwr['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async patch(operation: Operation, options: PluginSwr['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async delete(operation: Operation, options: PluginSwr['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n}\n"],"mappings":";;;;;;;AAAA,OAAO,UAAU;AAEjB,SAAS,aAAa,eAAe,oBAAoB;AACzD,SAAS,WAAW,kBAAkB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAE9B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;;;ACR9B,SAAS,sBAAsB,iBAAiB;AAChD,SAAS,WAAW;AACpB,SAAS,KAAK,kBAAkB;AAyBpB;AAhBL,IAAM,qBAAN,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OAAA;AAAA,UACf,OAAA;AAAA,SACF;AAAA,QACA;AAAA,UACE,GAAA;AAAA,UACA,eAAe,IAAK,CAAA,aAAA;AAAA,UACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,WAAA,EAAa,cAAc,OAAQ,CAAA,WAAA;AAAA,UACnC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,QAAA;AAAA,UACA,IAAA;AAAA,SACF;AAAA,OACF,CAAA;AAEA,MAAA,MAAM,KAAQ,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA,CAAA;AAC1D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA,CAAA;AAE3B,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA,GAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA,MAAA;AAAA,OACd,CAAA,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,CAAA;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSwr } from './types.ts'\n\nexport const pluginSwrName = 'plugin-swr' satisfies PluginSwr['name']\n\nexport const pluginSwr = createPlugin<PluginSwr>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n query,\n mutation,\n client,\n pathParamsType = 'inline',\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n } = options\n\n return {\n name: pluginSwrName,\n options: {\n output,\n pathParamsType,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n ...client,\n },\n query: {\n key: (key: unknown[]) => key,\n importPath: 'swr',\n methods: ['get'],\n ...query,\n },\n mutation: {\n key: (key: unknown[]) => key,\n importPath: 'swr/mutation',\n methods: ['post', 'put', 'delete', 'patch'],\n ...mutation,\n },\n parser,\n baseURL: undefined,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
@@ -0,0 +1,103 @@
1
+ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
+ import { HttpMethod } from '@kubb/oas';
3
+ import { PluginClient } from '@kubb/plugin-client';
4
+ import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
5
+
6
+ type Options = {
7
+ /**
8
+ * @default 'hooks'
9
+ */
10
+ output?: Output;
11
+ /**
12
+ * Group the SWR hooks based on the provided name.
13
+ */
14
+ group?: Group;
15
+ /**
16
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
17
+ */
18
+ exclude?: Array<Exclude>;
19
+ /**
20
+ * Array containing include parameters to include tags/operations/methods/paths.
21
+ */
22
+ include?: Array<Include>;
23
+ /**
24
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
25
+ */
26
+ override?: Array<Override<ResolvedOptions>>;
27
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
28
+ query?: {
29
+ /**
30
+ * Customize the queryKey, here you can specify a suffix.
31
+ */
32
+ key: (key: unknown[]) => unknown[];
33
+ /**
34
+ * Define which HttpMethods can be used for queries
35
+ * @default ['get']
36
+ */
37
+ methods?: Array<HttpMethod>;
38
+ /**
39
+ * Path to the useQuery that will be used to do the useQuery functionality.
40
+ * It will be used as `import { useQuery } from '${importPath}'`.
41
+ * It allows both relative and absolute path.
42
+ * the path will be applied as is, so relative path should be based on the file being generated.
43
+ * @default '@tanstack/react-query' if 'framework' is set to 'react'
44
+ */
45
+ importPath?: string;
46
+ };
47
+ mutation?: {
48
+ /**
49
+ * Customize the queryKey, here you can specify a suffix.
50
+ */
51
+ key: (key: unknown[]) => unknown[];
52
+ /**
53
+ * Define which HttpMethods can be used for queries
54
+ * @default ['post', 'put', 'delete', 'patch']
55
+ */
56
+ methods?: Array<HttpMethod>;
57
+ /**
58
+ * Path to the useQuery that will be used to do the useQuery functionality.
59
+ * It will be used as `import { useQuery } from '${importPath}'`.
60
+ * It allows both relative and absolute path.
61
+ * the path will be applied as is, so relative path should be based on the file being generated.
62
+ * @default '@tanstack/react-query' if 'framework' is set to 'react'
63
+ */
64
+ importPath?: string;
65
+ };
66
+ /**
67
+ * How to pass your pathParams.
68
+ *
69
+ * `object` will return the pathParams as an object.
70
+ *
71
+ * `inline` will return the pathParams as comma separated params.
72
+ * @default `'inline'`
73
+ * @private
74
+ */
75
+ pathParamsType?: PluginClient['options']['pathParamsType'];
76
+ /**
77
+ * Which parser can be used before returning the data to `swr`.
78
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
79
+ */
80
+ parser?: PluginClient['options']['parser'];
81
+ transformers?: {
82
+ /**
83
+ * Customize the names based on the type that is provided by the plugin.
84
+ */
85
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
86
+ };
87
+ /**
88
+ * Define some generators next to the swr generators
89
+ */
90
+ generators?: Array<Generator<PluginSwr>>;
91
+ };
92
+ type ResolvedOptions = {
93
+ output: Output;
94
+ baseURL: string | undefined;
95
+ client: Required<NonNullable<Options['client']>>;
96
+ parser: Required<NonNullable<Options['parser']>>;
97
+ mutation: Required<NonNullable<Options['mutation']>>;
98
+ query: Required<NonNullable<Options['query']>>;
99
+ pathParamsType: NonNullable<Options['pathParamsType']>;
100
+ };
101
+ type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>;
102
+
103
+ export type { Options as O, PluginSwr as P };
@@ -0,0 +1,103 @@
1
+ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
+ import { HttpMethod } from '@kubb/oas';
3
+ import { PluginClient } from '@kubb/plugin-client';
4
+ import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
5
+
6
+ type Options = {
7
+ /**
8
+ * @default 'hooks'
9
+ */
10
+ output?: Output;
11
+ /**
12
+ * Group the SWR hooks based on the provided name.
13
+ */
14
+ group?: Group;
15
+ /**
16
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
17
+ */
18
+ exclude?: Array<Exclude>;
19
+ /**
20
+ * Array containing include parameters to include tags/operations/methods/paths.
21
+ */
22
+ include?: Array<Include>;
23
+ /**
24
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
25
+ */
26
+ override?: Array<Override<ResolvedOptions>>;
27
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
28
+ query?: {
29
+ /**
30
+ * Customize the queryKey, here you can specify a suffix.
31
+ */
32
+ key: (key: unknown[]) => unknown[];
33
+ /**
34
+ * Define which HttpMethods can be used for queries
35
+ * @default ['get']
36
+ */
37
+ methods?: Array<HttpMethod>;
38
+ /**
39
+ * Path to the useQuery that will be used to do the useQuery functionality.
40
+ * It will be used as `import { useQuery } from '${importPath}'`.
41
+ * It allows both relative and absolute path.
42
+ * the path will be applied as is, so relative path should be based on the file being generated.
43
+ * @default '@tanstack/react-query' if 'framework' is set to 'react'
44
+ */
45
+ importPath?: string;
46
+ };
47
+ mutation?: {
48
+ /**
49
+ * Customize the queryKey, here you can specify a suffix.
50
+ */
51
+ key: (key: unknown[]) => unknown[];
52
+ /**
53
+ * Define which HttpMethods can be used for queries
54
+ * @default ['post', 'put', 'delete', 'patch']
55
+ */
56
+ methods?: Array<HttpMethod>;
57
+ /**
58
+ * Path to the useQuery that will be used to do the useQuery functionality.
59
+ * It will be used as `import { useQuery } from '${importPath}'`.
60
+ * It allows both relative and absolute path.
61
+ * the path will be applied as is, so relative path should be based on the file being generated.
62
+ * @default '@tanstack/react-query' if 'framework' is set to 'react'
63
+ */
64
+ importPath?: string;
65
+ };
66
+ /**
67
+ * How to pass your pathParams.
68
+ *
69
+ * `object` will return the pathParams as an object.
70
+ *
71
+ * `inline` will return the pathParams as comma separated params.
72
+ * @default `'inline'`
73
+ * @private
74
+ */
75
+ pathParamsType?: PluginClient['options']['pathParamsType'];
76
+ /**
77
+ * Which parser can be used before returning the data to `swr`.
78
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
79
+ */
80
+ parser?: PluginClient['options']['parser'];
81
+ transformers?: {
82
+ /**
83
+ * Customize the names based on the type that is provided by the plugin.
84
+ */
85
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
86
+ };
87
+ /**
88
+ * Define some generators next to the swr generators
89
+ */
90
+ generators?: Array<Generator<PluginSwr>>;
91
+ };
92
+ type ResolvedOptions = {
93
+ output: Output;
94
+ baseURL: string | undefined;
95
+ client: Required<NonNullable<Options['client']>>;
96
+ parser: Required<NonNullable<Options['parser']>>;
97
+ mutation: Required<NonNullable<Options['mutation']>>;
98
+ query: Required<NonNullable<Options['query']>>;
99
+ pathParamsType: NonNullable<Options['pathParamsType']>;
100
+ };
101
+ type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>;
102
+
103
+ export type { Options as O, PluginSwr as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-swr",
3
- "version": "3.0.0-alpha.9",
3
+ "version": "3.0.0-beta.2",
4
4
  "description": "Generator plugin-swr",
5
5
  "keywords": [
6
6
  "typescript",
@@ -30,6 +30,11 @@
30
30
  "require": "./dist/index.cjs",
31
31
  "default": "./dist/index.cjs"
32
32
  },
33
+ "./generators": {
34
+ "import": "./dist/generators.js",
35
+ "require": "./dist/generators.cjs",
36
+ "default": "./dist/generators.cjs"
37
+ },
33
38
  "./components": {
34
39
  "import": "./dist/components.js",
35
40
  "require": "./dist/components.cjs",
@@ -45,6 +50,9 @@
45
50
  "*": {
46
51
  "components": [
47
52
  "./dist/components.d.ts"
53
+ ],
54
+ "generators": [
55
+ "./dist/generators.d.ts"
48
56
  ]
49
57
  }
50
58
  },
@@ -55,27 +63,25 @@
55
63
  "!/**/__tests__/**"
56
64
  ],
57
65
  "dependencies": {
58
- "@kubb/core": "3.0.0-alpha.9",
59
- "@kubb/fs": "3.0.0-alpha.9",
60
- "@kubb/oas": "3.0.0-alpha.9",
61
- "@kubb/parser-ts": "3.0.0-alpha.9",
62
- "@kubb/plugin-client": "3.0.0-alpha.9",
63
- "@kubb/plugin-oas": "3.0.0-alpha.9",
64
- "@kubb/plugin-ts": "3.0.0-alpha.9",
65
- "@kubb/plugin-zod": "3.0.0-alpha.9",
66
- "@kubb/react": "3.0.0-alpha.9"
66
+ "@kubb/core": "3.0.0-beta.2",
67
+ "@kubb/fs": "3.0.0-beta.2",
68
+ "@kubb/oas": "3.0.0-beta.2",
69
+ "@kubb/plugin-client": "3.0.0-beta.2",
70
+ "@kubb/plugin-oas": "3.0.0-beta.2",
71
+ "@kubb/plugin-ts": "3.0.0-beta.2",
72
+ "@kubb/plugin-zod": "3.0.0-beta.2",
73
+ "@kubb/react": "3.0.0-beta.2"
67
74
  },
68
75
  "devDependencies": {
69
- "@types/react": "^18.3.4",
76
+ "@types/react": "^18.3.11",
70
77
  "react": "^18.3.1",
71
- "tsup": "^8.2.4",
72
- "typescript": "^5.5.4",
73
- "@kubb/config-biome": "3.0.0-alpha.9",
74
- "@kubb/config-ts": "3.0.0-alpha.9",
75
- "@kubb/config-tsup": "3.0.0-alpha.9"
78
+ "tsup": "^8.3.0",
79
+ "typescript": "^5.6.2",
80
+ "@kubb/config-ts": "3.0.0-beta.2",
81
+ "@kubb/config-tsup": "3.0.0-beta.2"
76
82
  },
77
83
  "peerDependencies": {
78
- "@kubb/react": "3.0.0-alpha.9"
84
+ "@kubb/react": "3.0.0-beta.2"
79
85
  },
80
86
  "engines": {
81
87
  "node": ">=20"