@kubb/plugin-vue-query 5.0.0-beta.42 → 5.0.0-beta.64

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 (43) hide show
  1. package/dist/{components-Bxe1EuWf.js → components-CAlEf7Oh.js} +273 -388
  2. package/dist/components-CAlEf7Oh.js.map +1 -0
  3. package/dist/{components-BwFPMwK7.cjs → components-CfU59l8V.cjs} +274 -389
  4. package/dist/components-CfU59l8V.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-BSN6A0ED.cjs → generators-DpMLVmyi.cjs} +91 -137
  9. package/dist/generators-DpMLVmyi.cjs.map +1 -0
  10. package/dist/{generators-D9TUvYRN.js → generators-fWBjs0CN.js} +93 -139
  11. package/dist/generators-fWBjs0CN.js.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +1 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +41 -18
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +42 -19
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-HHnnlEhK.d.ts → types-C6a_58nb.d.ts} +12 -16
  21. package/package.json +10 -18
  22. package/dist/components-BwFPMwK7.cjs.map +0 -1
  23. package/dist/components-Bxe1EuWf.js.map +0 -1
  24. package/dist/generators-BSN6A0ED.cjs.map +0 -1
  25. package/dist/generators-D9TUvYRN.js.map +0 -1
  26. package/extension.yaml +0 -1248
  27. package/src/components/InfiniteQuery.tsx +0 -127
  28. package/src/components/InfiniteQueryOptions.tsx +0 -194
  29. package/src/components/Mutation.tsx +0 -150
  30. package/src/components/MutationKey.tsx +0 -1
  31. package/src/components/Query.tsx +0 -126
  32. package/src/components/QueryKey.tsx +0 -52
  33. package/src/components/QueryOptions.tsx +0 -137
  34. package/src/components/index.ts +0 -7
  35. package/src/generators/index.ts +0 -3
  36. package/src/generators/infiniteQueryGenerator.tsx +0 -200
  37. package/src/generators/mutationGenerator.tsx +0 -158
  38. package/src/generators/queryGenerator.tsx +0 -184
  39. package/src/index.ts +0 -2
  40. package/src/plugin.ts +0 -183
  41. package/src/resolvers/resolverVueQuery.ts +0 -76
  42. package/src/types.ts +0 -272
  43. package/src/utils.ts +0 -56
package/dist/index.cjs CHANGED
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_components = require("./components-BwFPMwK7.cjs");
6
- const require_generators = require("./generators-BSN6A0ED.cjs");
5
+ const require_components = require("./components-CfU59l8V.cjs");
6
+ const require_generators = require("./generators-DpMLVmyi.cjs");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_components.__toESM(node_path, 1);
9
9
  let _kubb_core = require("@kubb/core");
@@ -13,32 +13,55 @@ let _kubb_plugin_client_templates_clients_fetch_source = require("@kubb/plugin-c
13
13
  let _kubb_plugin_client_templates_config_source = require("@kubb/plugin-client/templates/config.source");
14
14
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
15
15
  let _kubb_plugin_zod = require("@kubb/plugin-zod");
16
+ //#region ../../internals/utils/src/fs.ts
17
+ /**
18
+ * Builds a nested file path from a dotted name. Splits on dots that precede a letter
19
+ * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
20
+ * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
21
+ *
22
+ * Empty segments are dropped before joining. They arise when the name starts with a dot
23
+ * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
24
+ * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
25
+ * absolute path, letting generated files escape the configured output directory.
26
+ *
27
+ * @example Nested path from a dotted name
28
+ * `toFilePath('pet.petId') // 'pet/petId'`
29
+ *
30
+ * @example PascalCase the final segment
31
+ * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
32
+ *
33
+ * @example Suffix applied to the final segment only
34
+ * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
35
+ */
36
+ function toFilePath(name, caseLast = require_components.camelCase) {
37
+ const parts = name.split(/\.(?=[a-zA-Z])/);
38
+ return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : require_components.camelCase(part)).filter(Boolean).join("/");
39
+ }
40
+ //#endregion
16
41
  //#region ../../internals/shared/src/group.ts
17
42
  /**
18
43
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
19
44
  * shared default naming so every plugin groups output consistently:
20
45
  *
21
46
  * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
22
- * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).
47
+ * - other groups use the camelCased group (`pet store``petStore`).
23
48
  *
24
49
  * A user-provided `group.name` always wins over the default namer, so callers stay in
25
50
  * control of their output folders. Returns `null` when grouping is disabled, matching the
26
51
  * per-plugin convention.
27
52
  *
28
53
  * @param group - The user-supplied group option, or `undefined` to disable grouping.
29
- * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.
30
54
  *
31
55
  * @example
32
56
  * ```ts
33
- * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …
34
- * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp
57
+ * createGroupConfig(group) // shared across every plugin
35
58
  * ```
36
59
  */
37
- function createGroupConfig(group, options) {
60
+ function createGroupConfig(group) {
38
61
  if (!group) return null;
39
62
  const defaultName = (ctx) => {
40
63
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
41
- return `${require_components.camelCase(ctx.group)}${options.suffix}`;
64
+ return require_components.camelCase(ctx.group);
42
65
  };
43
66
  return {
44
67
  ...group,
@@ -70,7 +93,7 @@ const resolverVueQuery = (0, _kubb_core.defineResolver)(() => ({
70
93
  name: "default",
71
94
  pluginName: "plugin-vue-query",
72
95
  default(name, type) {
73
- return require_components.camelCase(name, { isFile: type === "file" });
96
+ return type === "file" ? toFilePath(name) : require_components.camelCase(name);
74
97
  },
75
98
  resolveName(name) {
76
99
  return this.default(name, "function");
@@ -152,8 +175,8 @@ const pluginVueQueryName = "plugin-vue-query";
152
175
  const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
153
176
  const { output = {
154
177
  path: "hooks",
155
- barrelType: "named"
156
- }, group, exclude = [], include, override = [], parser = false, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = require_components.mutationKeyTransformer, queryKey = require_components.queryKeyTransformer, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
178
+ barrel: { type: "named" }
179
+ }, group, exclude = [], include, override = [], parser = false, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = require_components.mutationKeyTransformer, queryKey = require_components.queryKeyTransformer, paramsCasing, client, resolver: userResolver, macros: userMacros, generators: userGenerators = [] } = options;
157
180
  const clientName = client?.client ?? "axios";
158
181
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
159
182
  const selectedGenerators = options.generators ?? [
@@ -161,11 +184,11 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
161
184
  require_generators.infiniteQueryGenerator,
162
185
  require_generators.mutationGenerator
163
186
  ].filter((generator) => Boolean(generator));
164
- const groupConfig = createGroupConfig(group, { suffix: "Controller" });
187
+ const groupConfig = createGroupConfig(group);
165
188
  return {
166
189
  name: pluginVueQueryName,
167
190
  options,
168
- dependencies: [_kubb_plugin_ts.pluginTsName, parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
191
+ dependencies: [_kubb_plugin_ts.pluginTsName, (0, _kubb_plugin_client.isParserEnabled)(parser) ? _kubb_plugin_zod.pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
169
192
  hooks: { "kubb:plugin:setup"(ctx) {
170
193
  const resolver = userResolver ? {
171
194
  ...resolverVueQuery,
@@ -218,7 +241,7 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
218
241
  resolver
219
242
  });
220
243
  ctx.setResolver(resolver);
221
- if (userTransformer) ctx.setTransformer(userTransformer);
244
+ if (userMacros?.length) ctx.setMacros(userMacros);
222
245
  for (const gen of selectedGenerators) ctx.addGenerator(gen);
223
246
  for (const gen of userGenerators) ctx.addGenerator(gen);
224
247
  const root = node_path.default.resolve(ctx.config.root, ctx.config.output.path);
@@ -226,9 +249,9 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
226
249
  if (client?.bundle && !hasClientPlugin && !clientImportPath) ctx.injectFile({
227
250
  baseName: "client.ts",
228
251
  path: node_path.default.resolve(root, ".kubb/client.ts"),
229
- sources: [_kubb_core.ast.createSource({
252
+ sources: [_kubb_core.ast.factory.createSource({
230
253
  name: "client",
231
- nodes: [_kubb_core.ast.createText(clientName === "fetch" ? _kubb_plugin_client_templates_clients_fetch_source.source : _kubb_plugin_client_templates_clients_axios_source.source)],
254
+ nodes: [_kubb_core.ast.factory.createText(clientName === "fetch" ? _kubb_plugin_client_templates_clients_fetch_source.source : _kubb_plugin_client_templates_clients_axios_source.source)],
232
255
  isExportable: true,
233
256
  isIndexable: true
234
257
  })]
@@ -236,9 +259,9 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
236
259
  if (!hasClientPlugin) ctx.injectFile({
237
260
  baseName: "config.ts",
238
261
  path: node_path.default.resolve(root, ".kubb/config.ts"),
239
- sources: [_kubb_core.ast.createSource({
262
+ sources: [_kubb_core.ast.factory.createSource({
240
263
  name: "config",
241
- nodes: [_kubb_core.ast.createText(_kubb_plugin_client_templates_config_source.source)],
264
+ nodes: [_kubb_core.ast.factory.createText(_kubb_plugin_client_templates_config_source.source)],
242
265
  isExportable: false,
243
266
  isIndexable: false
244
267
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["camelCase","camelCase","mutationKeyTransformer","queryKeyTransformer","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/shared/src/group.ts","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.\n *\n * @example\n * ```ts\n * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …\n * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp\n * ```\n */\nexport function createGroupConfig(group: Group | undefined, options: { suffix: string }): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return `${camelCase(ctx.group)}${options.suffix}`\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.\n *\n * Functions and files use camelCase; composables get the `use` prefix.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-query',\n default(name, type) {\n return camelCase(name, { isFile: type === 'file' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } 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 { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFooQuery` (and optionally\n * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\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 = false,\n infinite = false,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group, { suffix: 'Controller' })\n\n return {\n name: pluginVueQueryName,\n options,\n dependencies: [pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\n\n ctx.setOptions({\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n ...infinite,\n }\n : false,\n parser,\n paramsType,\n pathParamsType,\n paramsCasing,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = !!ctx.config.plugins?.some((p) => (p as { name?: string }).name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.createSource({\n name: 'client',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginVueQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,kBAAkB,OAA0B,SAA2C;CACrG,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,eAAe,QAAmC;EACtD,IAAI,MAAM,SAAS,QACjB,OAAO,GAAG,IAAI,MAAM,MAAM,GAAG,EAAE;EAGjC,OAAO,GAAGA,mBAAAA,UAAU,IAAI,KAAK,IAAI,QAAQ;CAC3C;CAEA,OAAO;EACL,GAAG;EACH,MAAM,MAAM,OAAO,MAAM,OAAO;CAClC;AACF;;;ACpCA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC;AACvD;;;;;;;;;;;;;;;;;AAkBA,MAAa,oBAAA,GAAA,WAAA,uBAAyD;CACpE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;EAClB,OAAOC,mBAAAA,UAAU,MAAM,EAAE,QAAQ,SAAS,OAAO,CAAC;CACpD;CACA,YAAY,MAAM;EAChB,OAAO,KAAK,QAAQ,MAAM,UAAU;CACtC;CACA,gBAAgB,MAAM,MAAM;EAC1B,OAAO,KAAK,QAAQ,MAAM,IAAI;CAChC;CACA,iBAAiB,MAAM;EACrB,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,WAAW,CAAC;CAC5D;CACA,yBAAyB,MAAM;EAC7B,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,WAAW,CAA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,OAAO,gBAChB,IAAI,aAAa,GAAG;GAGtB,MAAM,OAAOC,UAAAA,QAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI;GACjE,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,SAAS,MAAM,MAAO,EAAwB,SAASC,oBAAAA,gBAAgB;GAE5G,IAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,kBACzC,IAAI,WAAW;IACb,UAAU;IACV,MAAMD,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,MAAiB,CAAC;KACtF,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;GAGH,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,MAAY,CAAC;KACpC,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;EAEL,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["camelCase","camelCase","camelCase","mutationKeyTransformer","queryKeyTransformer","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/fs.ts","../../../internals/shared/src/group.ts","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n .filter(Boolean)\n .join('/')\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.\n *\n * Functions and files use camelCase; composables get the `use` prefix.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-query',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : camelCase(name)\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } from '@kubb/core'\nimport { isParserEnabled, 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 { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFooQuery` (and optionally\n * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n infinite = false,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n paramsCasing,\n client,\n resolver: userResolver,\n macros: userMacros,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginVueQueryName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\n\n ctx.setOptions({\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n ...infinite,\n }\n : false,\n parser,\n paramsType,\n pathParamsType,\n paramsCasing,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = !!ctx.config.plugins?.some((p) => (p as { name?: string }).name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.factory.createSource({\n name: 'client',\n nodes: [ast.factory.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.factory.createSource({\n name: 'config',\n nodes: [ast.factory.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginVueQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,WAAW,MAAc,WAAqCA,mBAAAA,WAAmB;CAC/F,MAAM,QAAQ,KAAK,MAAM,gBAAgB;CACzC,OAAO,MACJ,KAAK,MAAM,MAAO,MAAM,MAAM,SAAS,IAAI,SAAS,IAAI,IAAIA,mBAAAA,UAAU,IAAI,CAAE,CAAC,CAC7E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;AACb;;;;;;;;;;;;;;;;;;;;;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AAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,QAAQ,aAAa;KACvB,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,QAAQ,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,MAAiB,CAAC;KAC9F,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;GAGH,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,QAAQ,aAAa;KACvB,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,QAAQ,WAAWG,4CAAAA,MAAY,CAAC;KAC5C,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;EAEL,EACF;CACF;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { n as Options, r as PluginVueQuery } from "./types-HHnnlEhK.js";
2
+ import { n as Options, r as PluginVueQuery } from "./types-C6a_58nb.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  /**
package/dist/index.js CHANGED
@@ -1,40 +1,63 @@
1
1
  import "./chunk-C0LytTxp.js";
2
- import { m as camelCase, s as queryKeyTransformer, u as mutationKeyTransformer } from "./components-Bxe1EuWf.js";
3
- import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-D9TUvYRN.js";
2
+ import { m as camelCase, s as queryKeyTransformer, u as mutationKeyTransformer } from "./components-CAlEf7Oh.js";
3
+ import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-fWBjs0CN.js";
4
4
  import path from "node:path";
5
5
  import { ast, definePlugin, defineResolver } from "@kubb/core";
6
- import { pluginClientName } from "@kubb/plugin-client";
6
+ import { isParserEnabled, 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";
9
9
  import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
10
  import { pluginTsName } from "@kubb/plugin-ts";
11
11
  import { pluginZodName } from "@kubb/plugin-zod";
12
+ //#region ../../internals/utils/src/fs.ts
13
+ /**
14
+ * Builds a nested file path from a dotted name. Splits on dots that precede a letter
15
+ * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
16
+ * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
17
+ *
18
+ * Empty segments are dropped before joining. They arise when the name starts with a dot
19
+ * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
20
+ * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
21
+ * absolute path, letting generated files escape the configured output directory.
22
+ *
23
+ * @example Nested path from a dotted name
24
+ * `toFilePath('pet.petId') // 'pet/petId'`
25
+ *
26
+ * @example PascalCase the final segment
27
+ * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
28
+ *
29
+ * @example Suffix applied to the final segment only
30
+ * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
31
+ */
32
+ function toFilePath(name, caseLast = camelCase) {
33
+ const parts = name.split(/\.(?=[a-zA-Z])/);
34
+ return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : camelCase(part)).filter(Boolean).join("/");
35
+ }
36
+ //#endregion
12
37
  //#region ../../internals/shared/src/group.ts
13
38
  /**
14
39
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
15
40
  * shared default naming so every plugin groups output consistently:
16
41
  *
17
42
  * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
18
- * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).
43
+ * - other groups use the camelCased group (`pet store``petStore`).
19
44
  *
20
45
  * A user-provided `group.name` always wins over the default namer, so callers stay in
21
46
  * control of their output folders. Returns `null` when grouping is disabled, matching the
22
47
  * per-plugin convention.
23
48
  *
24
49
  * @param group - The user-supplied group option, or `undefined` to disable grouping.
25
- * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.
26
50
  *
27
51
  * @example
28
52
  * ```ts
29
- * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …
30
- * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp
53
+ * createGroupConfig(group) // shared across every plugin
31
54
  * ```
32
55
  */
33
- function createGroupConfig(group, options) {
56
+ function createGroupConfig(group) {
34
57
  if (!group) return null;
35
58
  const defaultName = (ctx) => {
36
59
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
37
- return `${camelCase(ctx.group)}${options.suffix}`;
60
+ return camelCase(ctx.group);
38
61
  };
39
62
  return {
40
63
  ...group,
@@ -66,7 +89,7 @@ const resolverVueQuery = defineResolver(() => ({
66
89
  name: "default",
67
90
  pluginName: "plugin-vue-query",
68
91
  default(name, type) {
69
- return camelCase(name, { isFile: type === "file" });
92
+ return type === "file" ? toFilePath(name) : camelCase(name);
70
93
  },
71
94
  resolveName(name) {
72
95
  return this.default(name, "function");
@@ -148,8 +171,8 @@ const pluginVueQueryName = "plugin-vue-query";
148
171
  const pluginVueQuery = definePlugin((options) => {
149
172
  const { output = {
150
173
  path: "hooks",
151
- barrelType: "named"
152
- }, group, exclude = [], include, override = [], parser = false, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
174
+ barrel: { type: "named" }
175
+ }, group, exclude = [], include, override = [], parser = false, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, paramsCasing, client, resolver: userResolver, macros: userMacros, generators: userGenerators = [] } = options;
153
176
  const clientName = client?.client ?? "axios";
154
177
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
155
178
  const selectedGenerators = options.generators ?? [
@@ -157,11 +180,11 @@ const pluginVueQuery = definePlugin((options) => {
157
180
  infiniteQueryGenerator,
158
181
  mutationGenerator
159
182
  ].filter((generator) => Boolean(generator));
160
- const groupConfig = createGroupConfig(group, { suffix: "Controller" });
183
+ const groupConfig = createGroupConfig(group);
161
184
  return {
162
185
  name: pluginVueQueryName,
163
186
  options,
164
- dependencies: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
187
+ dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
165
188
  hooks: { "kubb:plugin:setup"(ctx) {
166
189
  const resolver = userResolver ? {
167
190
  ...resolverVueQuery,
@@ -214,7 +237,7 @@ const pluginVueQuery = definePlugin((options) => {
214
237
  resolver
215
238
  });
216
239
  ctx.setResolver(resolver);
217
- if (userTransformer) ctx.setTransformer(userTransformer);
240
+ if (userMacros?.length) ctx.setMacros(userMacros);
218
241
  for (const gen of selectedGenerators) ctx.addGenerator(gen);
219
242
  for (const gen of userGenerators) ctx.addGenerator(gen);
220
243
  const root = path.resolve(ctx.config.root, ctx.config.output.path);
@@ -222,9 +245,9 @@ const pluginVueQuery = definePlugin((options) => {
222
245
  if (client?.bundle && !hasClientPlugin && !clientImportPath) ctx.injectFile({
223
246
  baseName: "client.ts",
224
247
  path: path.resolve(root, ".kubb/client.ts"),
225
- sources: [ast.createSource({
248
+ sources: [ast.factory.createSource({
226
249
  name: "client",
227
- nodes: [ast.createText(clientName === "fetch" ? source$1 : source)],
250
+ nodes: [ast.factory.createText(clientName === "fetch" ? source$1 : source)],
228
251
  isExportable: true,
229
252
  isIndexable: true
230
253
  })]
@@ -232,9 +255,9 @@ const pluginVueQuery = definePlugin((options) => {
232
255
  if (!hasClientPlugin) ctx.injectFile({
233
256
  baseName: "config.ts",
234
257
  path: path.resolve(root, ".kubb/config.ts"),
235
- sources: [ast.createSource({
258
+ sources: [ast.factory.createSource({
236
259
  name: "config",
237
- nodes: [ast.createText(source$2)],
260
+ nodes: [ast.factory.createText(source$2)],
238
261
  isExportable: false,
239
262
  isIndexable: false
240
263
  })]
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/shared/src/group.ts","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.\n *\n * @example\n * ```ts\n * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …\n * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp\n * ```\n */\nexport function createGroupConfig(group: Group | undefined, options: { suffix: string }): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return `${camelCase(ctx.group)}${options.suffix}`\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.\n *\n * Functions and files use camelCase; composables get the `use` prefix.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-query',\n default(name, type) {\n return camelCase(name, { isFile: type === 'file' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } 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 { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFooQuery` (and optionally\n * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\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 = false,\n infinite = false,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group, { suffix: 'Controller' })\n\n return {\n name: pluginVueQueryName,\n options,\n dependencies: [pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\n\n ctx.setOptions({\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n ...infinite,\n }\n : false,\n parser,\n paramsType,\n pathParamsType,\n paramsCasing,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = !!ctx.config.plugins?.some((p) => (p as { name?: string }).name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.createSource({\n name: 'client',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginVueQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,kBAAkB,OAA0B,SAA2C;CACrG,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,eAAe,QAAmC;EACtD,IAAI,MAAM,SAAS,QACjB,OAAO,GAAG,IAAI,MAAM,MAAM,GAAG,EAAE;EAGjC,OAAO,GAAG,UAAU,IAAI,KAAK,IAAI,QAAQ;CAC3C;CAEA,OAAO;EACL,GAAG;EACH,MAAM,MAAM,OAAO,MAAM,OAAO;CAClC;AACF;;;ACpCA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC;AACvD;;;;;;;;;;;;;;;;;AAkBA,MAAa,mBAAmB,sBAAsC;CACpE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;EAClB,OAAO,UAAU,MAAM,EAAE,QAAQ,SAAS,OAAO,CAAC;CACpD;CACA,YAAY,MAAM;EAChB,OAAO,KAAK,QAAQ,MAAM,UAAU;CACtC;CACA,gBAAgB,MAAM,MAAM;EAC1B,OAAO,KAAK,QAAQ,MAAM,IAAI;CAChC;CACA,iBAAiB,MAAM;EACrB,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,WAAW,CAAC;CAC5D;CACA,yBAAyB,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AAI,aAAa,GAAG;GAGtB,MAAM,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI;GACjE,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,SAAS,MAAM,MAAO,EAAwB,SAAS,gBAAgB;GAE5G,IAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,kBACzC,IAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAW,eAAe,UAAUA,WAAoBC,MAAiB,CAAC;KACtF,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;GAGH,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAWC,QAAY,CAAC;KACpC,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;EAEL,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/fs.ts","../../../internals/shared/src/group.ts","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n .filter(Boolean)\n .join('/')\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.\n *\n * Functions and files use camelCase; composables get the `use` prefix.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-query',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : camelCase(name)\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } from '@kubb/core'\nimport { isParserEnabled, 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 { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFooQuery` (and optionally\n * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n infinite = false,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n paramsCasing,\n client,\n resolver: userResolver,\n macros: userMacros,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginVueQueryName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\n\n ctx.setOptions({\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-query',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n ...infinite,\n }\n : false,\n parser,\n paramsType,\n pathParamsType,\n paramsCasing,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = !!ctx.config.plugins?.some((p) => (p as { name?: string }).name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.factory.createSource({\n name: 'client',\n nodes: [ast.factory.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.factory.createSource({\n name: 'config',\n nodes: [ast.factory.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginVueQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,WAAW,MAAc,WAAqC,WAAmB;CAC/F,MAAM,QAAQ,KAAK,MAAM,gBAAgB;CACzC,OAAO,MACJ,KAAK,MAAM,MAAO,MAAM,MAAM,SAAS,IAAI,SAAS,IAAI,IAAI,UAAU,IAAI,CAAE,CAAC,CAC7E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;AACb;;;;;;;;;;;;;;;;;;;;;AChCA,SAAgB,kBAAkB,OAAwC;CACxE,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,eAAe,QAAmC;EACtD,IAAI,MAAM,SAAS,QACjB,OAAO,GAAG,IAAI,MAAM,MAAM,GAAG,CAAC,CAAC;EAGjC,OAAO,UAAU,IAAI,KAAK;CAC5B;CAEA,OAAO;EACL,GAAG;EACH,MAAM,MAAM,O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AAC;EAEL,EACF;CACF;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
2
+ import { Exclude, Generator, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
3
3
  import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
4
4
 
5
5
  //#region src/types.d.ts
@@ -147,17 +147,13 @@ type Infinite = {
147
147
  */
148
148
  initialPageParam?: unknown;
149
149
  };
150
- type Options = {
151
- /**
152
- * Where the generated composables are written and how they are exported.
153
- *
154
- * @default { path: 'hooks', barrel: { type: 'named' } }
155
- */
156
- output?: Output;
157
- /**
158
- * Split generated files into subfolders based on the operation's tag.
159
- */
160
- group?: Group;
150
+ /**
151
+ * Where the generated composables are written and how they are exported, plus the optional
152
+ * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
153
+ *
154
+ * @default { path: 'hooks', barrel: { type: 'named' } }
155
+ */
156
+ type Options = OutputOptions & {
161
157
  /**
162
158
  * HTTP client used inside every generated composable. Mirrors a subset of
163
159
  * `pluginClient` options.
@@ -228,9 +224,9 @@ type Options = {
228
224
  */
229
225
  resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
230
226
  /**
231
- * AST visitor applied to each operation node before printing.
227
+ * Macros applied to each operation node before printing.
232
228
  */
233
- transformer?: ast.Visitor;
229
+ macros?: Array<ast.Macro>;
234
230
  /**
235
231
  * Custom generators that run alongside the built-in Vue Query generators.
236
232
  */
@@ -243,7 +239,7 @@ type ResolvedOptions = {
243
239
  include: Options['include'];
244
240
  override: NonNullable<Options['override']>;
245
241
  client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
246
- parser: Required<NonNullable<Options['parser']>>;
242
+ parser: NonNullable<Options['parser']>;
247
243
  pathParamsType: NonNullable<Options['pathParamsType']>;
248
244
  paramsCasing: Options['paramsCasing'];
249
245
  paramsType: NonNullable<Options['paramsType']>;
@@ -267,4 +263,4 @@ declare global {
267
263
  }
268
264
  //#endregion
269
265
  export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
270
- //# sourceMappingURL=types-HHnnlEhK.d.ts.map
266
+ //# sourceMappingURL=types-C6a_58nb.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-beta.42",
3
+ "version": "5.0.0-beta.64",
4
4
  "description": "Generate type-safe TanStack Query (Vue Query) composables from your OpenAPI specification. Covers useQuery, useMutation, useInfiniteQuery, and queryOptions with Vue 3 Composition API support.",
5
5
  "keywords": [
6
6
  "code-generation",
@@ -28,9 +28,7 @@
28
28
  "directory": "packages/plugin-vue-query"
29
29
  },
30
30
  "files": [
31
- "src",
32
31
  "dist",
33
- "extension.yaml",
34
32
  "!/**/**.test.**",
35
33
  "!/**/__tests__/**",
36
34
  "!/**/__snapshots__/**"
@@ -70,11 +68,12 @@
70
68
  "registry": "https://registry.npmjs.org/"
71
69
  },
72
70
  "dependencies": {
73
- "@kubb/core": "5.0.0-beta.42",
74
- "@kubb/renderer-jsx": "5.0.0-beta.42",
75
- "@kubb/plugin-client": "5.0.0-beta.42",
76
- "@kubb/plugin-ts": "5.0.0-beta.42",
77
- "@kubb/plugin-zod": "5.0.0-beta.42"
71
+ "@kubb/ast": "5.0.0-beta.63",
72
+ "@kubb/core": "5.0.0-beta.63",
73
+ "@kubb/renderer-jsx": "5.0.0-beta.63",
74
+ "@kubb/plugin-client": "5.0.0-beta.64",
75
+ "@kubb/plugin-ts": "5.0.0-beta.64",
76
+ "@kubb/plugin-zod": "5.0.0-beta.64"
78
77
  },
79
78
  "devDependencies": {
80
79
  "@internals/shared": "0.0.0",
@@ -82,21 +81,14 @@
82
81
  "@internals/utils": "0.0.0"
83
82
  },
84
83
  "peerDependencies": {
85
- "@kubb/renderer-jsx": "5.0.0-beta.42"
84
+ "@kubb/renderer-jsx": "5.0.0-beta.63"
86
85
  },
87
- "size-limit": [
88
- {
89
- "path": "./dist/*.js",
90
- "limit": "510 KiB",
91
- "gzip": true
92
- }
93
- ],
94
86
  "engines": {
95
87
  "node": ">=22"
96
88
  },
97
89
  "scripts": {
98
- "build": "tsdown && size-limit",
99
- "clean": "npx rimraf ./dist",
90
+ "build": "tsdown",
91
+ "clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
100
92
  "lint": "oxlint .",
101
93
  "lint:fix": "oxlint --fix .",
102
94
  "release": "pnpm publish --no-git-check",