@kubb/plugin-vue-query 4.2.0 → 4.2.1

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.
@@ -1,4 +1,4 @@
1
- import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginVueQuery, t as Infinite } from "./types-BCH4Mgn6.cjs";
1
+ import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginVueQuery, t as Infinite } from "./types-CQyewZZm.cjs";
2
2
 
3
3
  //#region rolldown:runtime
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginVueQuery, t as Infinite } from "./types-qy0sCbVT.js";
1
+ import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginVueQuery, t as Infinite } from "./types-Dzaigjql.js";
2
2
 
3
3
  //#region rolldown:runtime
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { a as Generator, r as PluginVueQuery } from "./types-BCH4Mgn6.cjs";
1
+ import { a as Generator, r as PluginVueQuery } from "./types-CQyewZZm.cjs";
2
2
 
3
3
  //#region src/generators/queryGenerator.d.ts
4
4
  declare const queryGenerator: Generator<PluginVueQuery>;
@@ -1,4 +1,4 @@
1
- import { a as Generator, r as PluginVueQuery } from "./types-qy0sCbVT.js";
1
+ import { a as Generator, r as PluginVueQuery } from "./types-Dzaigjql.js";
2
2
 
3
3
  //#region src/generators/queryGenerator.d.ts
4
4
  declare const queryGenerator: Generator<PluginVueQuery>;
package/dist/index.cjs CHANGED
@@ -70,7 +70,7 @@ const pluginVueQuery = (0, __kubb_core.createPlugin)((options) => {
70
70
  ].filter(Boolean),
71
71
  resolvePath(baseName, pathMode, options$1) {
72
72
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
73
- if ((pathMode ?? __kubb_core.FileManager.getMode(node_path.default.resolve(root, output.path))) === "single")
73
+ if ((pathMode ?? (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
74
74
  /**
75
75
  * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
76
76
  * Other plugins then need to call addOrAppend instead of just add from the fileManager class
@@ -96,7 +96,7 @@ const pluginVueQuery = (0, __kubb_core.createPlugin)((options) => {
96
96
  const [swaggerPlugin] = __kubb_core.PluginManager.getDependedPlugins(this.plugins, [__kubb_plugin_oas.pluginOasName]);
97
97
  const oas = await swaggerPlugin.context.getOas();
98
98
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
99
- const mode = __kubb_core.FileManager.getMode(node_path.default.resolve(root, output.path));
99
+ const mode = (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path));
100
100
  const baseURL = await swaggerPlugin.context.getBaseURL();
101
101
  if (baseURL) this.plugin.options.client.baseURL = baseURL;
102
102
  const files = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
@@ -110,7 +110,7 @@ const pluginVueQuery = (0, __kubb_core.createPlugin)((options) => {
110
110
  mode
111
111
  }).build(...generators);
112
112
  await this.addFile(...files);
113
- const barrelFiles = await this.fileManager.getBarrelFiles({
113
+ const barrelFiles = await (0, __kubb_core.getBarrelFiles)(this.fileManager.files, {
114
114
  type: output.barrelType ?? "named",
115
115
  root,
116
116
  output,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","FileManager","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\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 } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: 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 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 ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (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 buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,qBAAqB;AAElC,MAAa,gDAA+C,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,cAAcA,+BAAY,gBAC1B,WAAWC,4BAAS,gBACpB,aAAa;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S,UAAU,SAAS,WAC9B,wDAAyB,MAAM,EAC7B,QAAQ,SAAS,QAClB,CAAC;AAEJ,OAAI,SAAS,OACX,yDAA0B,KAAK;AAGjC,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAsCI,0BAAc,mBAA8B,KAAK,SAAS,CAACP,gCAAc,CAAC;GAEvH,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOG,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAOC,wBAAY,QAAQD,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACjE,MAAM,UAAU,MAAM,cAAc,QAAQ,YAAY;AAExD,OAAI,QACF,MAAK,OAAO,QAAQ,OAAO,UAAU;GAavC,MAAM,QAAQ,MAXa,IAAIK,qCAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '@kubb/plugin-oas'\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 = 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 } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: 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 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 buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,MAAa,qBAAqB;AAElC,MAAa,gDAA+C,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,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UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,IAAI,uDAAyB,KAAK;AAElC,OAAI,SAAS,UAAU,SAAS,WAC9B,wDAAyB,MAAM,EAC7B,QAAQ,SAAS,QAClB,CAAC;AAEJ,OAAI,SAAS,OACX,yDAA0B,KAAK;AAGjC,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAsCG,0BAAc,mBAA8B,KAAK,SAAS,CAACN,gCAAc,CAAC;GAEvH,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOG,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,UAAU,MAAM,cAAc,QAAQ,YAAY;AAExD,OAAI,QACF,MAAK,OAAO,QAAQ,OAAO,UAAU;GAavC,MAAM,QAAQ,MAXa,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,sCAAqB,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-BCH4Mgn6.cjs";
1
+ import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-CQyewZZm.cjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginVueQueryName = "plugin-vue-query";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-qy0sCbVT.js";
1
+ import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-Dzaigjql.js";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginVueQueryName = "plugin-vue-query";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as QueryKey, s as MutationKey } from "./components-Dvi_jRkJ.js";
2
2
  import { n as mutationGenerator, r as queryGenerator, t as infiniteQueryGenerator } from "./generators-DBMY3PQ4.js";
3
3
  import path from "node:path";
4
- import { FileManager, PluginManager, createPlugin } from "@kubb/core";
4
+ import { PluginManager, createPlugin, getBarrelFiles, getMode } from "@kubb/core";
5
5
  import { camelCase, pascalCase } from "@kubb/core/transformers";
6
6
  import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
7
7
  import { pluginTsName } from "@kubb/plugin-ts";
@@ -64,7 +64,7 @@ const pluginVueQuery = createPlugin((options) => {
64
64
  ].filter(Boolean),
65
65
  resolvePath(baseName, pathMode, options$1) {
66
66
  const root = path.resolve(this.config.root, this.config.output.path);
67
- if ((pathMode ?? FileManager.getMode(path.resolve(root, output.path))) === "single")
67
+ if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
68
68
  /**
69
69
  * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
70
70
  * Other plugins then need to call addOrAppend instead of just add from the fileManager class
@@ -90,7 +90,7 @@ const pluginVueQuery = createPlugin((options) => {
90
90
  const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
91
91
  const oas = await swaggerPlugin.context.getOas();
92
92
  const root = path.resolve(this.config.root, this.config.output.path);
93
- const mode = FileManager.getMode(path.resolve(root, output.path));
93
+ const mode = getMode(path.resolve(root, output.path));
94
94
  const baseURL = await swaggerPlugin.context.getBaseURL();
95
95
  if (baseURL) this.plugin.options.client.baseURL = baseURL;
96
96
  const files = await new OperationGenerator(this.plugin.options, {
@@ -104,7 +104,7 @@ const pluginVueQuery = createPlugin((options) => {
104
104
  mode
105
105
  }).build(...generators);
106
106
  await this.addFile(...files);
107
- const barrelFiles = await this.fileManager.getBarrelFiles({
107
+ const barrelFiles = await getBarrelFiles(this.fileManager.files, {
108
108
  type: output.barrelType ?? "named",
109
109
  root,
110
110
  output,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\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 } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: 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 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 ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (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 buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAeA,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,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB;IACA,GAAG,QAAQ;IACZ;GACD,UAAU,WACN;IACE,YAAY;IACZ,kBAAkB;IAClB,aAAa;IACb,GAAG;IACJ,GACD;GACJ;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;IACZ,GAAG;IACJ;GACP;GACA,UAAU;IACR,SAAS;KAAC;KAAQ;KAAO;KAAS;KAAS;IAC3C,YAAY;IACZ,GAAG;IACJ;GACD;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GAAC;GAAe;GAAc,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AAM,cAAc,QAAQ,YAAY;AAExD,OAAI,QACF,MAAK,OAAO,QAAQ,OAAO,UAAU;GAavC,MAAM,QAAQ,MAXa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '@kubb/plugin-oas'\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 = 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 } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: 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 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 buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAWA,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,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB;IACA,GAAG,QAAQ;IACZ;GACD,UAAU,WACN;IACE,YAAY;IACZ,kBAAkB;IAClB,aAAa;IACb,GAAG;IACJ,GACD;GACJ;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;IACZ,GAAG;IACJ;GACP;GACA,UAAU;IACR,SAAS;KAAC;KAAQ;KAAO;KAAS;KAAS;IAC3C,YAAY;IACZ,GAAG;IACJ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Q,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,UAAU,MAAM,cAAc,QAAQ,YAAY;AAExD,OAAI,QACF,MAAK,OAAO,QAAQ,OAAO,UAAU;GAavC,MAAM,QAAQ,MAXa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,eAAe,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
@@ -5,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
5
5
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
6
  import BaseOas from "oas";
7
7
  import { ConsolaInstance, LogLevel } from "consola";
8
+ import { FileManager } from "@kubb/fabric-core";
8
9
 
9
10
  //#region ../oas/src/types.d.ts
10
11
  type contentType = 'application/json' | (string & {});
@@ -220,8 +221,6 @@ type Logger = {
220
221
  //#endregion
221
222
  //#region ../core/src/utils/types.d.ts
222
223
  type PossiblePromise<T$1> = Promise<T$1> | T$1;
223
- type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
224
- type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
225
224
  //#endregion
226
225
  //#region ../core/src/types.d.ts
227
226
  type InputPath = {
@@ -464,6 +463,9 @@ type ResolveNameParams = {
464
463
  };
465
464
  type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
466
465
  config: Config;
466
+ /**
467
+ * @deprecated
468
+ */
467
469
  fileManager: FileManager;
468
470
  pluginManager: PluginManager;
469
471
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
@@ -515,60 +517,6 @@ type Group = {
515
517
  name?: (context: GroupContext) => string;
516
518
  };
517
519
  //#endregion
518
- //#region ../core/src/FileManager.d.ts
519
- type FileMetaBase = {
520
- pluginKey?: Plugin['key'];
521
- };
522
- type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
523
- type AddIndexesProps = {
524
- type: BarrelType | false | undefined;
525
- /**
526
- * Root based on root and output.path specified in the config
527
- */
528
- root: string;
529
- /**
530
- * Output for plugin
531
- */
532
- output: {
533
- path: string;
534
- };
535
- group?: {
536
- output: string;
537
- exportAs: string;
538
- };
539
- logger?: Logger;
540
- meta?: FileMetaBase;
541
- };
542
- type WriteFilesProps = {
543
- root: Config['root'];
544
- extension?: Record<Extname, Extname | ''>;
545
- logger?: Logger;
546
- dryRun?: boolean;
547
- };
548
- declare class FileManager {
549
- #private;
550
- constructor();
551
- add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
552
- getByPath(path: Path): Promise<ResolvedFile | null>;
553
- deleteByPath(path: Path): Promise<void>;
554
- clear(): Promise<void>;
555
- getFiles(): Promise<Array<ResolvedFile>>;
556
- processFiles({
557
- dryRun,
558
- root,
559
- extension,
560
- logger
561
- }: WriteFilesProps): Promise<Array<ResolvedFile>>;
562
- getBarrelFiles({
563
- type,
564
- meta,
565
- root,
566
- output,
567
- logger
568
- }: AddIndexesProps): Promise<File[]>;
569
- static getMode(path: string | undefined | null): Mode;
570
- }
571
- //#endregion
572
520
  //#region ../core/src/PluginManager.d.ts
573
521
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
574
522
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
@@ -607,6 +555,9 @@ type GetFileProps<TOptions$1 = object> = {
607
555
  declare class PluginManager {
608
556
  #private;
609
557
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
558
+ /**
559
+ * @deprecated do not use from pluginManager
560
+ */
610
561
  readonly fileManager: FileManager;
611
562
  readonly events: EventEmitter<Events>;
612
563
  readonly config: Config;
@@ -715,6 +666,11 @@ declare class PluginManager {
715
666
  static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
716
667
  }
717
668
  //#endregion
669
+ //#region ../core/src/FileManager.d.ts
670
+ type FileMetaBase = {
671
+ pluginKey?: Plugin['key'];
672
+ };
673
+ //#endregion
718
674
  //#region ../plugin-oas/src/SchemaMapper.d.ts
719
675
  type SchemaKeywordMapper = {
720
676
  object: {
@@ -1403,4 +1359,4 @@ type ResolvedOptions = {
1403
1359
  type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1404
1360
  //#endregion
1405
1361
  export { Generator as a, Operation$1 as c, Transformer as i, Options$1 as n, OperationSchemas as o, PluginVueQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
1406
- //# sourceMappingURL=types-qy0sCbVT.d.ts.map
1362
+ //# sourceMappingURL=types-CQyewZZm.d.cts.map
@@ -5,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
5
5
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
6
  import BaseOas from "oas";
7
7
  import { ConsolaInstance, LogLevel } from "consola";
8
+ import { FileManager } from "@kubb/fabric-core";
8
9
 
9
10
  //#region ../oas/src/types.d.ts
10
11
  type contentType = 'application/json' | (string & {});
@@ -220,8 +221,6 @@ type Logger = {
220
221
  //#endregion
221
222
  //#region ../core/src/utils/types.d.ts
222
223
  type PossiblePromise<T$1> = Promise<T$1> | T$1;
223
- type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
224
- type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
225
224
  //#endregion
226
225
  //#region ../core/src/types.d.ts
227
226
  type InputPath = {
@@ -464,6 +463,9 @@ type ResolveNameParams = {
464
463
  };
465
464
  type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
466
465
  config: Config;
466
+ /**
467
+ * @deprecated
468
+ */
467
469
  fileManager: FileManager;
468
470
  pluginManager: PluginManager;
469
471
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
@@ -515,60 +517,6 @@ type Group = {
515
517
  name?: (context: GroupContext) => string;
516
518
  };
517
519
  //#endregion
518
- //#region ../core/src/FileManager.d.ts
519
- type FileMetaBase = {
520
- pluginKey?: Plugin['key'];
521
- };
522
- type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
523
- type AddIndexesProps = {
524
- type: BarrelType | false | undefined;
525
- /**
526
- * Root based on root and output.path specified in the config
527
- */
528
- root: string;
529
- /**
530
- * Output for plugin
531
- */
532
- output: {
533
- path: string;
534
- };
535
- group?: {
536
- output: string;
537
- exportAs: string;
538
- };
539
- logger?: Logger;
540
- meta?: FileMetaBase;
541
- };
542
- type WriteFilesProps = {
543
- root: Config['root'];
544
- extension?: Record<Extname, Extname | ''>;
545
- logger?: Logger;
546
- dryRun?: boolean;
547
- };
548
- declare class FileManager {
549
- #private;
550
- constructor();
551
- add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
552
- getByPath(path: Path): Promise<ResolvedFile | null>;
553
- deleteByPath(path: Path): Promise<void>;
554
- clear(): Promise<void>;
555
- getFiles(): Promise<Array<ResolvedFile>>;
556
- processFiles({
557
- dryRun,
558
- root,
559
- extension,
560
- logger
561
- }: WriteFilesProps): Promise<Array<ResolvedFile>>;
562
- getBarrelFiles({
563
- type,
564
- meta,
565
- root,
566
- output,
567
- logger
568
- }: AddIndexesProps): Promise<File[]>;
569
- static getMode(path: string | undefined | null): Mode;
570
- }
571
- //#endregion
572
520
  //#region ../core/src/PluginManager.d.ts
573
521
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
574
522
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
@@ -607,6 +555,9 @@ type GetFileProps<TOptions$1 = object> = {
607
555
  declare class PluginManager {
608
556
  #private;
609
557
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
558
+ /**
559
+ * @deprecated do not use from pluginManager
560
+ */
610
561
  readonly fileManager: FileManager;
611
562
  readonly events: EventEmitter<Events>;
612
563
  readonly config: Config;
@@ -715,6 +666,11 @@ declare class PluginManager {
715
666
  static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
716
667
  }
717
668
  //#endregion
669
+ //#region ../core/src/FileManager.d.ts
670
+ type FileMetaBase = {
671
+ pluginKey?: Plugin['key'];
672
+ };
673
+ //#endregion
718
674
  //#region ../plugin-oas/src/SchemaMapper.d.ts
719
675
  type SchemaKeywordMapper = {
720
676
  object: {
@@ -1403,4 +1359,4 @@ type ResolvedOptions = {
1403
1359
  type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1404
1360
  //#endregion
1405
1361
  export { Generator as a, Operation$1 as c, Transformer as i, Options$1 as n, OperationSchemas as o, PluginVueQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
1406
- //# sourceMappingURL=types-BCH4Mgn6.d.cts.map
1362
+ //# sourceMappingURL=types-Dzaigjql.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-vue-query",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
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",
@@ -62,13 +62,13 @@
62
62
  ],
63
63
  "dependencies": {
64
64
  "remeda": "^2.32.0",
65
- "@kubb/core": "4.2.0",
66
- "@kubb/oas": "4.2.0",
67
- "@kubb/plugin-client": "4.2.0",
68
- "@kubb/plugin-oas": "4.2.0",
69
- "@kubb/plugin-ts": "4.2.0",
70
- "@kubb/plugin-zod": "4.2.0",
71
- "@kubb/react": "4.2.0"
65
+ "@kubb/core": "4.2.1",
66
+ "@kubb/oas": "4.2.1",
67
+ "@kubb/plugin-client": "4.2.1",
68
+ "@kubb/plugin-oas": "4.2.1",
69
+ "@kubb/plugin-ts": "4.2.1",
70
+ "@kubb/plugin-zod": "4.2.1",
71
+ "@kubb/react": "4.2.1"
72
72
  },
73
73
  "devDependencies": {
74
74
  "tsdown": "^0.15.9",
package/src/plugin.ts CHANGED
@@ -1,14 +1,10 @@
1
1
  import path from 'node:path'
2
-
3
- import { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'
2
+ import { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'
4
3
  import { camelCase, pascalCase } from '@kubb/core/transformers'
4
+ import type { PluginOas } from '@kubb/plugin-oas'
5
5
  import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
6
-
7
6
  import { pluginTsName } from '@kubb/plugin-ts'
8
7
  import { pluginZodName } from '@kubb/plugin-zod'
9
-
10
- import type { Plugin } from '@kubb/core'
11
- import type { PluginOas } from '@kubb/plugin-oas'
12
8
  import { MutationKey, QueryKey } from './components'
13
9
  import { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'
14
10
  import type { PluginVueQuery } from './types.ts'
@@ -78,7 +74,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
78
74
  pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
79
75
  resolvePath(baseName, pathMode, options) {
80
76
  const root = path.resolve(this.config.root, this.config.output.path)
81
- const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))
77
+ const mode = pathMode ?? getMode(path.resolve(root, output.path))
82
78
 
83
79
  if (mode === 'single') {
84
80
  /**
@@ -133,7 +129,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
133
129
 
134
130
  const oas = await swaggerPlugin.context.getOas()
135
131
  const root = path.resolve(this.config.root, this.config.output.path)
136
- const mode = FileManager.getMode(path.resolve(root, output.path))
132
+ const mode = getMode(path.resolve(root, output.path))
137
133
  const baseURL = await swaggerPlugin.context.getBaseURL()
138
134
 
139
135
  if (baseURL) {
@@ -153,7 +149,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
153
149
  const files = await operationGenerator.build(...generators)
154
150
  await this.addFile(...files)
155
151
 
156
- const barrelFiles = await this.fileManager.getBarrelFiles({
152
+ const barrelFiles = await getBarrelFiles(this.fileManager.files, {
157
153
  type: output.barrelType ?? 'named',
158
154
  root,
159
155
  output,