@kubb/plugin-react-query 5.0.0-alpha.2 → 5.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey } from './components'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport type { PluginReactQuery } from './types.ts'\n\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\nexport const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n suspense = {},\n infinite = false,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n generators = [\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n ].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n customOptions,\n paramsCasing,\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginReactQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/react-query',\n ...mutation,\n },\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : undefined,\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.upsertFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAuBA,MAAa,uBAAuB;AAEpC,MAAa,mBAAmB,cAAgC,YAAY;CAC1E,MAAM,EACJ,SA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AK,WAAW;IACpB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,OAAO,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAUA,WAAoBC;KAC3E,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,OAAI,CAAC,gBACH,OAAM,KAAK,WAAW;IACpB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAOC;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { createPlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey } from './components'\nimport { QueryKey } from './components/QueryKey.tsx'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport type { PluginReactQuery } from './types.ts'\n\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\nexport const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n suspense = {},\n infinite = false,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n generators = [\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n ].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n customOptions,\n paramsCasing,\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginReactQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/react-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/react-query',\n ...mutation,\n },\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : undefined,\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.upsertFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAuBA,MAAa,uBAAuB;AAEpC,MAAa,mBAAmB,cAAgC,YAAY;CAC1E,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,WAAW,EAAE,EACb,WAAW,OACX,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,OAAO,QAAQ,EACjB,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,eACA,cACA,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,QAAQ,QAAQ;IA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QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-react-query",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.20",
4
4
  "description": "React Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for React applications.",
5
5
  "keywords": [
6
6
  "react-query",
@@ -71,19 +71,19 @@
71
71
  }
72
72
  ],
73
73
  "dependencies": {
74
- "@kubb/fabric-core": "0.13.3",
75
- "@kubb/react-fabric": "0.13.3",
74
+ "@kubb/fabric-core": "0.15.1",
75
+ "@kubb/react-fabric": "0.15.1",
76
76
  "remeda": "^2.33.6",
77
- "@kubb/core": "5.0.0-alpha.2",
78
- "@kubb/oas": "5.0.0-alpha.2",
79
- "@kubb/plugin-client": "5.0.0-alpha.2",
80
- "@kubb/plugin-oas": "5.0.0-alpha.2",
81
- "@kubb/plugin-ts": "5.0.0-alpha.2",
82
- "@kubb/plugin-zod": "5.0.0-alpha.2"
77
+ "@kubb/core": "5.0.0-alpha.20",
78
+ "@kubb/oas": "5.0.0-alpha.20",
79
+ "@kubb/plugin-client": "5.0.0-alpha.20",
80
+ "@kubb/plugin-oas": "5.0.0-alpha.20",
81
+ "@kubb/plugin-ts": "5.0.0-alpha.20",
82
+ "@kubb/plugin-zod": "5.0.0-alpha.20"
83
83
  },
84
84
  "peerDependencies": {
85
- "@kubb/fabric-core": "0.13.3",
86
- "@kubb/react-fabric": "0.13.3"
85
+ "@kubb/fabric-core": "0.15.1",
86
+ "@kubb/react-fabric": "0.15.1"
87
87
  },
88
88
  "engines": {
89
89
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs'
2
2
  import path from 'node:path'
3
- import { usePluginManager } from '@kubb/core/hooks'
3
+ import { usePluginDriver } from '@kubb/core/hooks'
4
4
  import type { Operation } from '@kubb/oas'
5
5
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
6
6
  import { useOperationManager } from '@kubb/plugin-oas/hooks'
@@ -15,7 +15,7 @@ export const customHookOptionsFileGenerator = createReactGenerator<PluginReactQu
15
15
  options: { output },
16
16
  name: pluginName,
17
17
  } = plugin
18
- const pluginManager = usePluginManager()
18
+ const driver = usePluginDriver()
19
19
 
20
20
  const { getFile } = useOperationManager(generator)
21
21
 
@@ -37,7 +37,7 @@ export const customHookOptionsFileGenerator = createReactGenerator<PluginReactQu
37
37
  return getFile(firstOperation, { prefix: 'use' }).path
38
38
  }
39
39
  // Get the index file of the hooks directory
40
- return pluginManager.getFile({ name: 'index', extname: '.ts', pluginName }).path
40
+ return driver.getFile({ name: 'index', extname: '.ts', pluginName }).path
41
41
  }
42
42
 
43
43
  const ensureExtension = (filePath: string, extname: string) => {
@@ -1,4 +1,4 @@
1
- import { usePluginManager } from '@kubb/core/hooks'
1
+ import { usePluginDriver } from '@kubb/core/hooks'
2
2
  import type { Operation } from '@kubb/oas'
3
3
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
4
4
  import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
@@ -15,7 +15,7 @@ export const hookOptionsGenerator = createReactGenerator<PluginReactQuery>({
15
15
  options: { output },
16
16
  name: pluginName,
17
17
  } = plugin
18
- const pluginManager = usePluginManager()
18
+ const driver = usePluginDriver()
19
19
 
20
20
  const oas = useOas()
21
21
  const { getName, getFile } = useOperationManager(generator)
@@ -25,7 +25,7 @@ export const hookOptionsGenerator = createReactGenerator<PluginReactQuery>({
25
25
  }
26
26
 
27
27
  const name = 'HookOptions'
28
- const file = pluginManager.getFile({ name, extname: '.ts', pluginName })
28
+ const file = driver.getFile({ name, extname: '.ts', pluginName })
29
29
 
30
30
  const getOperationOptions = (operation: Operation) => {
31
31
  const operationOptions = generator.getOptions(operation, operation.method)
@@ -181,7 +181,7 @@ export const hookOptionsGenerator = createReactGenerator<PluginReactQuery>({
181
181
  baseName={file.baseName}
182
182
  path={file.path}
183
183
  meta={file.meta}
184
- banner={getBanner({ oas, output, config: pluginManager.config })}
184
+ banner={getBanner({ oas, output, config: driver.config })}
185
185
  footer={getFooter({ oas, output })}
186
186
  >
187
187
  {imports}
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
2
+ import { usePluginDriver } from '@kubb/core/hooks'
3
3
  import { pluginClientName } from '@kubb/plugin-client'
4
4
  import { Client } from '@kubb/plugin-client/components'
5
5
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
@@ -19,7 +19,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
19
19
  options,
20
20
  options: { output },
21
21
  } = plugin
22
- const pluginManager = usePluginManager()
22
+ const driver = usePluginDriver()
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -38,7 +38,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
38
38
  file: getFile(operation, { prefix: 'use', suffix: 'infinite' }),
39
39
  }
40
40
 
41
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
41
+ const hasClientPlugin = !!driver.getPluginByName(pluginClientName)
42
42
  // Class-based clients are not compatible with query hooks, so we generate inline clients
43
43
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
44
44
  const client = {
@@ -96,7 +96,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
96
96
  baseName={query.file.baseName}
97
97
  path={query.file.path}
98
98
  meta={query.file.meta}
99
- banner={getBanner({ oas, output, config: pluginManager.config })}
99
+ banner={getBanner({ oas, output, config: driver.config })}
100
100
  footer={getFooter({ oas, output })}
101
101
  >
102
102
  {options.parser === 'zod' && (
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
2
+ import { usePluginDriver } from '@kubb/core/hooks'
3
3
  import { pluginClientName } from '@kubb/plugin-client'
4
4
  import { Client } from '@kubb/plugin-client/components'
5
5
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
@@ -20,7 +20,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
20
20
  options,
21
21
  options: { output },
22
22
  } = plugin
23
- const pluginManager = usePluginManager()
23
+ const driver = usePluginDriver()
24
24
 
25
25
  const oas = useOas()
26
26
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -50,7 +50,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
50
50
  schemas: getSchemas(operation, { pluginName: pluginZodName, type: 'function' }),
51
51
  }
52
52
 
53
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
53
+ const hasClientPlugin = !!driver.getPluginByName(pluginClientName)
54
54
  // Class-based clients are not compatible with query hooks, so we generate inline clients
55
55
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
56
56
  const client = {
@@ -83,7 +83,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
83
83
  baseName={mutation.file.baseName}
84
84
  path={mutation.file.path}
85
85
  meta={mutation.file.meta}
86
- banner={getBanner({ oas, output, config: pluginManager.config })}
86
+ banner={getBanner({ oas, output, config: driver.config })}
87
87
  footer={getFooter({ oas, output })}
88
88
  >
89
89
  {options.parser === 'zod' && (
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
2
+ import { usePluginDriver } from '@kubb/core/hooks'
3
3
  import { pluginClientName } from '@kubb/plugin-client'
4
4
  import { Client } from '@kubb/plugin-client/components'
5
5
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
@@ -19,7 +19,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
19
19
  options,
20
20
  options: { output },
21
21
  } = plugin
22
- const pluginManager = usePluginManager()
22
+ const driver = usePluginDriver()
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -37,7 +37,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
37
37
  file: getFile(operation, { prefix: 'use' }),
38
38
  }
39
39
 
40
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
40
+ const hasClientPlugin = !!driver.getPluginByName(pluginClientName)
41
41
  // Class-based clients are not compatible with query hooks, so we generate inline clients
42
42
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
43
43
  const client = {
@@ -88,7 +88,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
88
88
  baseName={query.file.baseName}
89
89
  path={query.file.path}
90
90
  meta={query.file.meta}
91
- banner={getBanner({ oas, output, config: pluginManager.config })}
91
+ banner={getBanner({ oas, output, config: driver.config })}
92
92
  footer={getFooter({ oas, output })}
93
93
  >
94
94
  {options.parser === 'zod' && (
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
2
+ import { usePluginDriver } from '@kubb/core/hooks'
3
3
  import { pluginClientName } from '@kubb/plugin-client'
4
4
  import { Client } from '@kubb/plugin-client/components'
5
5
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
@@ -19,7 +19,7 @@ export const suspenseInfiniteQueryGenerator = createReactGenerator<PluginReactQu
19
19
  options,
20
20
  options: { output },
21
21
  } = plugin
22
- const pluginManager = usePluginManager()
22
+ const driver = usePluginDriver()
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -39,7 +39,7 @@ export const suspenseInfiniteQueryGenerator = createReactGenerator<PluginReactQu
39
39
  file: getFile(operation, { prefix: 'use', suffix: 'suspenseInfinite' }),
40
40
  }
41
41
 
42
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
42
+ const hasClientPlugin = !!driver.getPluginByName(pluginClientName)
43
43
  // Class-based clients are not compatible with query hooks, so we generate inline clients
44
44
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
45
45
  const client = {
@@ -84,7 +84,7 @@ export const suspenseInfiniteQueryGenerator = createReactGenerator<PluginReactQu
84
84
  baseName={query.file.baseName}
85
85
  path={query.file.path}
86
86
  meta={query.file.meta}
87
- banner={getBanner({ oas, output, config: pluginManager.config })}
87
+ banner={getBanner({ oas, output, config: driver.config })}
88
88
  footer={getFooter({ oas, output })}
89
89
  >
90
90
  {options.parser === 'zod' && (
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path'
2
- import { usePluginManager } from '@kubb/core/hooks'
2
+ import { usePluginDriver } from '@kubb/core/hooks'
3
3
  import { pluginClientName } from '@kubb/plugin-client'
4
4
  import { Client } from '@kubb/plugin-client/components'
5
5
  import { createReactGenerator } from '@kubb/plugin-oas/generators'
@@ -19,7 +19,7 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
19
19
  options,
20
20
  options: { output },
21
21
  } = plugin
22
- const pluginManager = usePluginManager()
22
+ const driver = usePluginDriver()
23
23
 
24
24
  const oas = useOas()
25
25
  const { getSchemas, getName, getFile } = useOperationManager(generator)
@@ -43,7 +43,7 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
43
43
  file: getFile(operation, { prefix: 'use', suffix: 'suspense' }),
44
44
  }
45
45
 
46
- const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
46
+ const hasClientPlugin = !!driver.getPluginByName(pluginClientName)
47
47
  // Class-based clients are not compatible with query hooks, so we generate inline clients
48
48
  const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
49
49
  const client = {
@@ -100,7 +100,7 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
100
100
  baseName={query.file.baseName}
101
101
  path={query.file.path}
102
102
  meta={query.file.meta}
103
- banner={getBanner({ oas, output, config: pluginManager.config })}
103
+ banner={getBanner({ oas, output, config: driver.config })}
104
104
  footer={getFooter({ oas, output })}
105
105
  >
106
106
  {options.parser === 'zod' && (
package/src/plugin.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase, pascalCase } from '@internals/utils'
3
- import { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'
3
+ import { createPlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'
4
4
  import { pluginClientName } from '@kubb/plugin-client'
5
5
  import { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'
6
6
  import { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'
@@ -23,7 +23,7 @@ import type { PluginReactQuery } from './types.ts'
23
23
 
24
24
  export const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']
25
25
 
26
- export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
26
+ export const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {
27
27
  const {
28
28
  output = { path: 'hooks', barrelType: 'named' },
29
29
  group,
@@ -171,7 +171,7 @@ export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
171
171
  this.plugin.options.client.baseURL = baseURL
172
172
  }
173
173
 
174
- const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)
174
+ const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName)
175
175
 
176
176
  if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {
177
177
  // pre add bundled fetch
@@ -211,7 +211,7 @@ export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
211
211
  const operationGenerator = new OperationGenerator(this.plugin.options, {
212
212
  fabric: this.fabric,
213
213
  oas,
214
- pluginManager: this.pluginManager,
214
+ driver: this.driver,
215
215
  events: this.events,
216
216
  plugin: this.plugin,
217
217
  contentType,