@kubb/plugin-vue-query 5.0.0-alpha.3 → 5.0.0-alpha.31

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 (33) hide show
  1. package/dist/{components-_AMBl0g-.js → components-BqilTESI.js} +67 -14
  2. package/dist/components-BqilTESI.js.map +1 -0
  3. package/dist/{components-Yjoe78Y7.cjs → components-Dh9ETgiK.cjs} +67 -14
  4. package/dist/components-Dh9ETgiK.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +1 -1
  7. package/dist/components.js +1 -1
  8. package/dist/{generators-BzA136hL.js → generators-C_oXqIAr.js} +31 -29
  9. package/dist/generators-C_oXqIAr.js.map +1 -0
  10. package/dist/{generators-D8tKDZfU.cjs → generators-TcueY7eX.cjs} +29 -27
  11. package/dist/generators-TcueY7eX.cjs.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +5 -496
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +18 -11
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +19 -12
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-C4UKYw84.d.ts → types-Cx-x7vSU.d.ts} +13 -3
  21. package/package.json +12 -12
  22. package/src/components/InfiniteQueryOptions.tsx +1 -1
  23. package/src/components/Mutation.tsx +1 -1
  24. package/src/components/QueryOptions.tsx +1 -1
  25. package/src/generators/infiniteQueryGenerator.tsx +10 -14
  26. package/src/generators/mutationGenerator.tsx +10 -19
  27. package/src/generators/queryGenerator.tsx +10 -14
  28. package/src/plugin.ts +15 -10
  29. package/src/types.ts +13 -2
  30. package/dist/components-Yjoe78Y7.cjs.map +0 -1
  31. package/dist/components-_AMBl0g-.js.map +0 -1
  32. package/dist/generators-BzA136hL.js.map +0 -1
  33. package/dist/generators-D8tKDZfU.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { c as camelCase, l as pascalCase, r as MutationKey, s as QueryKey } from "./components-_AMBl0g-.js";
3
- import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-BzA136hL.js";
2
+ import { c as camelCase, l as pascalCase, r as MutationKey, s as QueryKey } from "./components-BqilTESI.js";
3
+ import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-C_oXqIAr.js";
4
4
  import path from "node:path";
5
- import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
5
+ import { createPlugin, getBarrelFiles } from "@kubb/core";
6
6
  import { pluginClientName } from "@kubb/plugin-client";
7
7
  import { source } from "@kubb/plugin-client/templates/clients/axios.source";
8
8
  import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
@@ -10,9 +10,12 @@ import { source as source$2 } from "@kubb/plugin-client/templates/config.source"
10
10
  import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
11
11
  import { pluginTsName } from "@kubb/plugin-ts";
12
12
  import { pluginZodName } from "@kubb/plugin-zod";
13
+ //#region package.json
14
+ var version = "5.0.0-alpha.31";
15
+ //#endregion
13
16
  //#region src/plugin.ts
14
17
  const pluginVueQueryName = "plugin-vue-query";
15
- const pluginVueQuery = definePlugin((options) => {
18
+ const pluginVueQuery = createPlugin((options) => {
16
19
  const { output = {
17
20
  path: "hooks",
18
21
  barrelType: "named"
@@ -25,6 +28,7 @@ const pluginVueQuery = definePlugin((options) => {
25
28
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
26
29
  return {
27
30
  name: pluginVueQueryName,
31
+ version,
28
32
  options: {
29
33
  output,
30
34
  client: {
@@ -66,7 +70,10 @@ const pluginVueQuery = definePlugin((options) => {
66
70
  pathParamsType,
67
71
  parser,
68
72
  paramsCasing,
69
- group
73
+ group,
74
+ exclude,
75
+ include,
76
+ override
70
77
  },
71
78
  pre: [
72
79
  pluginOasName,
@@ -74,8 +81,8 @@ const pluginVueQuery = definePlugin((options) => {
74
81
  parser === "zod" ? pluginZodName : void 0
75
82
  ].filter(Boolean),
76
83
  resolvePath(baseName, pathMode, options) {
77
- const root = path.resolve(this.config.root, this.config.output.path);
78
- if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
84
+ const root = this.root;
85
+ if ((pathMode ?? this.getMode(output)) === "single")
79
86
  /**
80
87
  * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
81
88
  * Other plugins then need to call addOrAppend instead of just add from the fileManager class
@@ -97,13 +104,13 @@ const pluginVueQuery = definePlugin((options) => {
97
104
  if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
98
105
  return resolvedName;
99
106
  },
100
- async install() {
101
- const root = path.resolve(this.config.root, this.config.output.path);
102
- const mode = getMode(path.resolve(root, output.path));
107
+ async buildStart() {
108
+ const root = this.root;
109
+ const mode = this.getMode(output);
103
110
  const oas = await this.getOas();
104
111
  const baseURL = await this.getBaseURL();
105
112
  if (baseURL) this.plugin.options.client.baseURL = baseURL;
106
- const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName);
113
+ const hasClientPlugin = !!this.getPlugin(pluginClientName);
107
114
  if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
108
115
  baseName: "fetch.ts",
109
116
  path: path.resolve(root, ".kubb/fetch.ts"),
@@ -131,7 +138,7 @@ const pluginVueQuery = definePlugin((options) => {
131
138
  const files = await new OperationGenerator(this.plugin.options, {
132
139
  fabric: this.fabric,
133
140
  oas,
134
- pluginManager: this.pluginManager,
141
+ driver: this.driver,
135
142
  events: this.events,
136
143
  plugin: this.plugin,
137
144
  contentType,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\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 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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,cAA8B,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,aAAa;EAAC;EAAgB;EAAwB;EAAkB,CAAC,OAAO,QAAQ,EACxF,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,QAAQ,QAAQ;IAChB,SAAS,QAAQ;IACjB,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,gBAAgB,QA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AM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../package.json","../src/plugin.ts"],"sourcesContent":["","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { version } from '../package.json'\nimport { MutationKey, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginVueQueryName,\n version,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n exclude,\n include,\n override,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\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 (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\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 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 root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.getPlugin(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;ACeA,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,cAA8B,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,aAAa;EAAC;EAAgB;EAA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A,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
2
+ import { Output, PluginFactoryOptions, ResolveNameParams, UserGroup } from "@kubb/core";
3
3
  import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
4
4
  import { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from "@kubb/plugin-oas";
5
5
  import { HttpMethod, Oas, Operation, contentType } from "@kubb/oas";
@@ -125,7 +125,7 @@ type Options = {
125
125
  /**
126
126
  * Group the @tanstack/query hooks based on the provided name.
127
127
  */
128
- group?: Group;
128
+ group?: UserGroup;
129
129
  client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
130
130
  /**
131
131
  * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
@@ -191,6 +191,9 @@ type Options = {
191
191
  type ResolvedOptions = {
192
192
  output: Output<Oas>;
193
193
  group: Options['group'];
194
+ exclude: NonNullable<Options['exclude']>;
195
+ include: Options['include'];
196
+ override: NonNullable<Options['override']>;
194
197
  client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
195
198
  parser: Required<NonNullable<Options['parser']>>;
196
199
  paramsCasing: Options['paramsCasing'];
@@ -206,6 +209,13 @@ type ResolvedOptions = {
206
209
  mutation: NonNullable<Required<Mutation>> | false;
207
210
  };
208
211
  type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, never, ResolvePathOptions>;
212
+ declare global {
213
+ namespace Kubb {
214
+ interface PluginRegistry {
215
+ 'plugin-vue-query': PluginVueQuery;
216
+ }
217
+ }
218
+ }
209
219
  //#endregion
210
220
  export { Transformer as a, MutationKey$1 as i, Options as n, PluginVueQuery as r, Infinite as t };
211
- //# sourceMappingURL=types-C4UKYw84.d.ts.map
221
+ //# sourceMappingURL=types-Cx-x7vSU.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-vue-query",
3
- "version": "5.0.0-alpha.3",
3
+ "version": "5.0.0-alpha.31",
4
4
  "description": "Vue Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Vue.js applications.",
5
5
  "keywords": [
6
6
  "vue-query",
@@ -73,19 +73,19 @@
73
73
  }
74
74
  ],
75
75
  "dependencies": {
76
- "@kubb/fabric-core": "0.13.3",
77
- "@kubb/react-fabric": "0.13.3",
78
- "remeda": "^2.33.6",
79
- "@kubb/oas": "5.0.0-alpha.3",
80
- "@kubb/plugin-client": "5.0.0-alpha.3",
81
- "@kubb/core": "5.0.0-alpha.3",
82
- "@kubb/plugin-oas": "5.0.0-alpha.3",
83
- "@kubb/plugin-ts": "5.0.0-alpha.3",
84
- "@kubb/plugin-zod": "5.0.0-alpha.3"
76
+ "@kubb/fabric-core": "0.15.1",
77
+ "@kubb/react-fabric": "0.15.1",
78
+ "remeda": "^2.33.7",
79
+ "@kubb/oas": "5.0.0-alpha.31",
80
+ "@kubb/plugin-client": "5.0.0-alpha.31",
81
+ "@kubb/core": "5.0.0-alpha.31",
82
+ "@kubb/plugin-oas": "5.0.0-alpha.31",
83
+ "@kubb/plugin-ts": "5.0.0-alpha.31",
84
+ "@kubb/plugin-zod": "5.0.0-alpha.31"
85
85
  },
86
86
  "peerDependencies": {
87
- "@kubb/fabric-core": "0.13.3",
88
- "@kubb/react-fabric": "0.13.3"
87
+ "@kubb/fabric-core": "0.15.1",
88
+ "@kubb/react-fabric": "0.15.1"
89
89
  },
90
90
  "engines": {
91
91
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  import { getNestedAccessor } from '@internals/utils'
2
2
  import { getDefaultValue, isOptional } from '@kubb/oas'
3
- import { Client } from '@kubb/plugin-client/components'
3
+ import { ClientLegacy as Client } from '@kubb/plugin-client'
4
4
  import type { OperationSchemas } from '@kubb/plugin-oas'
5
5
  import { getPathParams } from '@kubb/plugin-oas/utils'
6
6
  import { File, Function, FunctionParams } from '@kubb/react-fabric'
@@ -1,5 +1,5 @@
1
1
  import { isOptional, type Operation } from '@kubb/oas'
2
- import { Client } from '@kubb/plugin-client/components'
2
+ import { ClientLegacy as Client } from '@kubb/plugin-client'
3
3
  import type { OperationSchemas } from '@kubb/plugin-oas'
4
4
  import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
5
5
  import { File, Function, FunctionParams } from '@kubb/react-fabric'
@@ -1,5 +1,5 @@
1
1
  import { getDefaultValue, isOptional } from '@kubb/oas'
2
- import { Client } from '@kubb/plugin-client/components'
2
+ import { ClientLegacy as Client } from '@kubb/plugin-client'
3
3
  import type { OperationSchemas } from '@kubb/plugin-oas'
4
4
  import { getPathParams } from '@kubb/plugin-oas/utils'
5
5
  import { File, Function, FunctionParams } from '@kubb/react-fabric'
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
3
- import { pluginClientName } from '@kubb/plugin-client'
4
- import { Client } from '@kubb/plugin-client/components'
2
+ import { useDriver } from '@kubb/core/hooks'
3
+ import { ClientLegacy as Client, pluginClientName } from '@kubb/plugin-client'
5
4
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
6
5
  import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
7
6
  import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
@@ -19,7 +18,8 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
19
18
  options,
20
19
  options: { output },
21
20
  } = plugin
22
- const pluginManager = usePluginManager()
21
+ const driver = useDriver()
22
+ const root = path.resolve(config.root, config.output.path)
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -41,7 +41,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
41
41
  file: getFile(operation, { prefix: 'use', suffix: 'infinite' }),
42
42
  }
43
43
 
44
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
44
+ const hasClientPlugin = !!driver.getPlugin(pluginClientName)
45
45
  // Class-based clients are not compatible with query hooks, so we generate inline clients
46
46
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
47
47
  const client = {
@@ -98,7 +98,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
98
98
  baseName={query.file.baseName}
99
99
  path={query.file.path}
100
100
  meta={query.file.meta}
101
- banner={getBanner({ oas, output, config: pluginManager.config })}
101
+ banner={getBanner({ oas, output, config: driver.config })}
102
102
  footer={getFooter({ oas, output })}
103
103
  >
104
104
  {options.parser === 'zod' && (
@@ -112,26 +112,22 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
112
112
  </>
113
113
  ) : (
114
114
  <>
115
- {!shouldUseClientPlugin && (
116
- <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
117
- )}
115
+ {!shouldUseClientPlugin && <File.Import name={['fetch']} root={query.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />}
118
116
  <File.Import
119
117
  name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
120
118
  root={query.file.path}
121
- path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
119
+ path={path.resolve(root, '.kubb/fetch.ts')}
122
120
  isTypeOnly
123
121
  />
124
122
  {options.client.dataReturnType === 'full' && (
125
- <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />
123
+ <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />
126
124
  )}
127
125
  </>
128
126
  )}
129
127
  <File.Import name={['toValue']} path="vue" />
130
128
  <File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
131
129
  {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
132
- {!shouldUseClientPlugin && (
133
- <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
134
- )}
130
+ {!shouldUseClientPlugin && <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(root, '.kubb/config.ts')} />}
135
131
  <File.Import
136
132
  name={[
137
133
  type.schemas.request?.name,
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
3
- import { pluginClientName } from '@kubb/plugin-client'
4
- import { Client } from '@kubb/plugin-client/components'
2
+ import { useDriver } from '@kubb/core/hooks'
3
+ import { ClientLegacy as Client, pluginClientName } from '@kubb/plugin-client'
5
4
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
6
5
  import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
7
6
  import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
@@ -19,7 +18,8 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
19
18
  options,
20
19
  options: { output },
21
20
  } = plugin
22
- const pluginManager = usePluginManager()
21
+ const driver = useDriver()
22
+ const root = path.resolve(config.root, config.output.path)
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -49,7 +49,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
49
49
  schemas: getSchemas(operation, { pluginName: pluginZodName, type: 'function' }),
50
50
  }
51
51
 
52
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
52
+ const hasClientPlugin = !!driver.getPlugin(pluginClientName)
53
53
  // Class-based clients are not compatible with query hooks, so we generate inline clients
54
54
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
55
55
  const client = {
@@ -78,7 +78,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
78
78
  baseName={mutation.file.baseName}
79
79
  path={mutation.file.path}
80
80
  meta={mutation.file.meta}
81
- banner={getBanner({ oas, output, config: pluginManager.config })}
81
+ banner={getBanner({ oas, output, config: driver.config })}
82
82
  footer={getFooter({ oas, output })}
83
83
  >
84
84
  {options.parser === 'zod' && (
@@ -92,30 +92,21 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
92
92
  </>
93
93
  ) : (
94
94
  <>
95
- {!shouldUseClientPlugin && (
96
- <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
97
- )}
95
+ {!shouldUseClientPlugin && <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />}
98
96
  <File.Import
99
97
  name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
100
98
  root={mutation.file.path}
101
- path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
99
+ path={path.resolve(root, '.kubb/fetch.ts')}
102
100
  isTypeOnly
103
101
  />
104
102
  {options.client.dataReturnType === 'full' && (
105
- <File.Import
106
- name={['ResponseConfig']}
107
- root={mutation.file.path}
108
- path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
109
- isTypeOnly
110
- />
103
+ <File.Import name={['ResponseConfig']} root={mutation.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />
111
104
  )}
112
105
  </>
113
106
  )}
114
107
  <File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
115
108
  {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}
116
- {!shouldUseClientPlugin && (
117
- <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
118
- )}
109
+ {!shouldUseClientPlugin && <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(root, '.kubb/config.ts')} />}
119
110
  <File.Import
120
111
  name={[
121
112
  type.schemas.request?.name,
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
3
- import { pluginClientName } from '@kubb/plugin-client'
4
- import { Client } from '@kubb/plugin-client/components'
2
+ import { useDriver } from '@kubb/core/hooks'
3
+ import { ClientLegacy as Client, pluginClientName } from '@kubb/plugin-client'
5
4
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
6
5
  import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
7
6
  import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
@@ -19,7 +18,8 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
19
18
  options,
20
19
  options: { output },
21
20
  } = plugin
22
- const pluginManager = usePluginManager()
21
+ const driver = useDriver()
22
+ const root = path.resolve(config.root, config.output.path)
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -36,7 +36,7 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
36
36
  file: getFile(operation, { prefix: 'use' }),
37
37
  }
38
38
 
39
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
39
+ const hasClientPlugin = !!driver.getPlugin(pluginClientName)
40
40
  // Class-based clients are not compatible with query hooks, so we generate inline clients
41
41
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
42
42
  const client = {
@@ -86,7 +86,7 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
86
86
  baseName={query.file.baseName}
87
87
  path={query.file.path}
88
88
  meta={query.file.meta}
89
- banner={getBanner({ oas, output, config: pluginManager.config })}
89
+ banner={getBanner({ oas, output, config: driver.config })}
90
90
  footer={getFooter({ oas, output })}
91
91
  >
92
92
  {options.parser === 'zod' && (
@@ -100,26 +100,22 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
100
100
  </>
101
101
  ) : (
102
102
  <>
103
- {!shouldUseClientPlugin && (
104
- <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
105
- )}
103
+ {!shouldUseClientPlugin && <File.Import name={['fetch']} root={query.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />}
106
104
  <File.Import
107
105
  name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
108
106
  root={query.file.path}
109
- path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
107
+ path={path.resolve(root, '.kubb/fetch.ts')}
110
108
  isTypeOnly
111
109
  />
112
110
  {options.client.dataReturnType === 'full' && (
113
- <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />
111
+ <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />
114
112
  )}
115
113
  </>
116
114
  )}
117
115
  <File.Import name={['toValue']} path="vue" />
118
116
  <File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
119
117
  {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
120
- {!shouldUseClientPlugin && (
121
- <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
122
- )}
118
+ {!shouldUseClientPlugin && <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(root, '.kubb/config.ts')} />}
123
119
  <File.Import
124
120
  name={[
125
121
  type.schemas.request?.name,
package/src/plugin.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase, pascalCase } from '@internals/utils'
3
- import { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'
3
+ import { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'
4
4
  import { pluginClientName } from '@kubb/plugin-client'
5
5
  import { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'
6
6
  import { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'
@@ -8,13 +8,14 @@ import { source as configSource } from '@kubb/plugin-client/templates/config.sou
8
8
  import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
9
9
  import { pluginTsName } from '@kubb/plugin-ts'
10
10
  import { pluginZodName } from '@kubb/plugin-zod'
11
+ import { version } from '../package.json'
11
12
  import { MutationKey, QueryKey } from './components'
12
13
  import { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'
13
14
  import type { PluginVueQuery } from './types.ts'
14
15
 
15
16
  export const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']
16
17
 
17
- export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
18
+ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
18
19
  const {
19
20
  output = { path: 'hooks', barrelType: 'named' },
20
21
  group,
@@ -41,6 +42,7 @@ export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
41
42
 
42
43
  return {
43
44
  name: pluginVueQueryName,
45
+ version,
44
46
  options: {
45
47
  output,
46
48
  client: {
@@ -86,11 +88,14 @@ export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
86
88
  parser,
87
89
  paramsCasing,
88
90
  group,
91
+ exclude,
92
+ include,
93
+ override,
89
94
  },
90
95
  pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
91
96
  resolvePath(baseName, pathMode, options) {
92
- const root = path.resolve(this.config.root, this.config.output.path)
93
- const mode = pathMode ?? getMode(path.resolve(root, output.path))
97
+ const root = this.root
98
+ const mode = pathMode ?? this.getMode(output)
94
99
 
95
100
  if (mode === 'single') {
96
101
  /**
@@ -101,7 +106,7 @@ export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
101
106
  }
102
107
 
103
108
  if (group && (options?.group?.path || options?.group?.tag)) {
104
- const groupName: Group['name'] = group?.name
109
+ const groupName: UserGroup['name'] = group?.name
105
110
  ? group.name
106
111
  : (ctx) => {
107
112
  if (group?.type === 'path') {
@@ -140,9 +145,9 @@ export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
140
145
 
141
146
  return resolvedName
142
147
  },
143
- async install() {
144
- const root = path.resolve(this.config.root, this.config.output.path)
145
- const mode = getMode(path.resolve(root, output.path))
148
+ async buildStart() {
149
+ const root = this.root
150
+ const mode = this.getMode(output)
146
151
  const oas = await this.getOas()
147
152
  const baseURL = await this.getBaseURL()
148
153
 
@@ -150,7 +155,7 @@ export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
150
155
  this.plugin.options.client.baseURL = baseURL
151
156
  }
152
157
 
153
- const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)
158
+ const hasClientPlugin = !!this.getPlugin(pluginClientName)
154
159
 
155
160
  if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {
156
161
  // pre add bundled
@@ -190,7 +195,7 @@ export const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {
190
195
  const operationGenerator = new OperationGenerator(this.plugin.options, {
191
196
  fabric: this.fabric,
192
197
  oas,
193
- pluginManager: this.pluginManager,
198
+ driver: this.driver,
194
199
  events: this.events,
195
200
  plugin: this.plugin,
196
201
  contentType,
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Transformer } from '@internals/tanstack-query'
2
- import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
+ import type { Output, PluginFactoryOptions, ResolveNameParams, UserGroup } from '@kubb/core'
3
3
  import type { contentType, HttpMethod, Oas } from '@kubb/oas'
4
4
  import type { ClientImportPath, PluginClient } from '@kubb/plugin-client'
5
5
  import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
@@ -91,7 +91,7 @@ export type Options = {
91
91
  /**
92
92
  * Group the @tanstack/query hooks based on the provided name.
93
93
  */
94
- group?: Group
94
+ group?: UserGroup
95
95
  client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>
96
96
  /**
97
97
  * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
@@ -158,6 +158,9 @@ export type Options = {
158
158
  type ResolvedOptions = {
159
159
  output: Output<Oas>
160
160
  group: Options['group']
161
+ exclude: NonNullable<Options['exclude']>
162
+ include: Options['include']
163
+ override: NonNullable<Options['override']>
161
164
  client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>
162
165
  parser: Required<NonNullable<Options['parser']>>
163
166
  paramsCasing: Options['paramsCasing']
@@ -174,3 +177,11 @@ type ResolvedOptions = {
174
177
  }
175
178
 
176
179
  export type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, never, ResolvePathOptions>
180
+
181
+ declare global {
182
+ namespace Kubb {
183
+ interface PluginRegistry {
184
+ 'plugin-vue-query': PluginVueQuery
185
+ }
186
+ }
187
+ }