@kubb/plugin-client 5.0.0-alpha.32 → 5.0.0-alpha.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "5.0.0-alpha.32",
3
+ "version": "5.0.0-alpha.33",
4
4
  "description": "API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -94,19 +94,19 @@
94
94
  }
95
95
  ],
96
96
  "dependencies": {
97
- "@kubb/react-fabric": "0.15.1",
98
- "@kubb/ast": "5.0.0-alpha.32",
99
- "@kubb/core": "5.0.0-alpha.32",
100
- "@kubb/plugin-ts": "5.0.0-alpha.32",
101
- "@kubb/plugin-zod": "5.0.0-alpha.32"
97
+ "@kubb/ast": "5.0.0-alpha.33",
98
+ "@kubb/core": "5.0.0-alpha.33",
99
+ "@kubb/plugin-ts": "5.0.0-alpha.33",
100
+ "@kubb/plugin-zod": "5.0.0-alpha.33",
101
+ "@kubb/renderer-jsx": "5.0.0-alpha.33"
102
102
  },
103
103
  "devDependencies": {
104
104
  "axios": "^1.14.0",
105
105
  "@internals/utils": "0.0.0"
106
106
  },
107
107
  "peerDependencies": {
108
- "@kubb/react-fabric": "0.15.1",
109
- "axios": "^1.7.2"
108
+ "axios": "^1.7.2",
109
+ "@kubb/renderer-jsx": "5.0.0-alpha.33"
110
110
  },
111
111
  "peerDependenciesMeta": {
112
112
  "axios": {
@@ -3,8 +3,8 @@ import type { OperationNode } from '@kubb/ast/types'
3
3
  import type { PluginTs } from '@kubb/plugin-ts'
4
4
  import { functionPrinter } from '@kubb/plugin-ts'
5
5
  import type { PluginZod } from '@kubb/plugin-zod'
6
- import { File } from '@kubb/react-fabric'
7
- import type { FabricReactNode } from '@kubb/react-fabric/types'
6
+ import { File } from '@kubb/renderer-jsx'
7
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
8
8
  import type { PluginClient } from '../types.ts'
9
9
  import { buildClassClientParams, buildFormDataLine, buildGenerics, buildHeaders, buildRequestDataLine, buildReturnStatement, getComments } from '../utils.ts'
10
10
 
@@ -28,7 +28,7 @@ type Props = {
28
28
  paramsType: PluginClient['resolvedOptions']['pathParamsType']
29
29
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
30
30
  parser: PluginClient['resolvedOptions']['parser'] | undefined
31
- children?: FabricReactNode
31
+ children?: KubbReactNode
32
32
  }
33
33
 
34
34
  type GenerateMethodProps = {
@@ -103,7 +103,7 @@ export function ClassClient({
103
103
  paramsCasing,
104
104
  pathParamsType,
105
105
  children,
106
- }: Props): FabricReactNode {
106
+ }: Props): KubbReactNode {
107
107
  const methods = operations.map(({ node, name: methodName, tsResolver, zodResolver }) =>
108
108
  generateMethod({
109
109
  node,
@@ -1,11 +1,12 @@
1
1
  import { isValidVarName, URLPath } from '@internals/utils'
2
2
  import { caseParams, createFunctionParameter, createOperationParams, createParamsType } from '@kubb/ast'
3
3
  import type { FunctionParametersNode, OperationNode } from '@kubb/ast/types'
4
+ import { FunctionParams } from '@kubb/core'
4
5
  import type { PluginTs } from '@kubb/plugin-ts'
5
6
  import { functionPrinter } from '@kubb/plugin-ts'
6
7
  import type { PluginZod } from '@kubb/plugin-zod'
7
- import { File, Function, FunctionParams } from '@kubb/react-fabric'
8
- import type { FabricReactNode } from '@kubb/react-fabric/types'
8
+ import { File, Function } from '@kubb/renderer-jsx'
9
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
9
10
  import type { PluginClient } from '../types.ts'
10
11
  import { buildParamsMapping, getComments } from '../utils.ts'
11
12
  import { Url } from './Url.tsx'
@@ -27,7 +28,7 @@ type Props = {
27
28
  node: OperationNode
28
29
  tsResolver: PluginTs['resolver']
29
30
  zodResolver?: PluginZod['resolver']
30
- children?: FabricReactNode
31
+ children?: KubbReactNode
31
32
  }
32
33
 
33
34
  type GetParamsProps = {
@@ -81,7 +82,7 @@ export function Client({
81
82
  urlName,
82
83
  children,
83
84
  isConfigurable = true,
84
- }: Props): FabricReactNode {
85
+ }: Props): KubbReactNode {
85
86
  const path = new URLPath(node.path)
86
87
  const contentType = node.requestBody?.contentType ?? 'application/json'
87
88
  const isFormData = contentType === 'multipart/form-data'
@@ -1,6 +1,8 @@
1
1
  import { camelCase, isValidVarName, URLPath } from '@internals/utils'
2
- import { Const, File, Function, FunctionParams } from '@kubb/react-fabric'
3
- import type { FabricReactNode, Params } from '@kubb/react-fabric/types'
2
+ import type { Params } from '@kubb/core'
3
+ import { FunctionParams } from '@kubb/core'
4
+ import { Const, File, Function } from '@kubb/renderer-jsx'
5
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
4
6
 
5
7
  /**
6
8
  * Structural type matching OperationSchema from @kubb/plugin-oas.
@@ -148,7 +150,7 @@ type Props = {
148
150
  typeSchemas: LegacyOperationSchemas
149
151
  zodSchemas: LegacyOperationSchemas | undefined
150
152
  operation: LegacyOperation
151
- children?: FabricReactNode
153
+ children?: KubbReactNode
152
154
  }
153
155
 
154
156
  type GetParamsProps = {
@@ -264,7 +266,7 @@ export function ClientLegacy({
264
266
  urlName,
265
267
  children,
266
268
  isConfigurable = true,
267
- }: Props): FabricReactNode {
269
+ }: Props): KubbReactNode {
268
270
  const path = new URLPath(operation.path)
269
271
  const contentType = operation.getContentType?.() ?? 'application/json'
270
272
  const isFormData = contentType === 'multipart/form-data'
@@ -470,7 +472,7 @@ export function UrlLegacy({
470
472
  paramsCasing,
471
473
  pathParamsType,
472
474
  operation,
473
- }: UrlProps): FabricReactNode {
475
+ }: UrlProps): KubbReactNode {
474
476
  const path = new URLPath(operation.path)
475
477
  const params = getUrlParams({
476
478
  paramsType,
@@ -1,14 +1,14 @@
1
1
  import { URLPath } from '@internals/utils'
2
2
  import type { OperationNode } from '@kubb/ast/types'
3
- import { Const, File } from '@kubb/react-fabric'
4
- import type { FabricReactNode } from '@kubb/react-fabric/types'
3
+ import { Const, File } from '@kubb/renderer-jsx'
4
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
5
5
 
6
6
  type OperationsProps = {
7
7
  name: string
8
8
  nodes: Array<OperationNode>
9
9
  }
10
10
 
11
- export function Operations({ name, nodes }: OperationsProps): FabricReactNode {
11
+ export function Operations({ name, nodes }: OperationsProps): KubbReactNode {
12
12
  const operationsObject: Record<string, { path: string; method: string }> = {}
13
13
 
14
14
  nodes.forEach((node) => {
@@ -3,8 +3,8 @@ import type { OperationNode } from '@kubb/ast/types'
3
3
  import type { PluginTs } from '@kubb/plugin-ts'
4
4
  import { functionPrinter } from '@kubb/plugin-ts'
5
5
  import type { PluginZod } from '@kubb/plugin-zod'
6
- import { File } from '@kubb/react-fabric'
7
- import type { FabricReactNode } from '@kubb/react-fabric/types'
6
+ import { File } from '@kubb/renderer-jsx'
7
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
8
8
  import type { PluginClient } from '../types.ts'
9
9
  import { buildClassClientParams, buildFormDataLine, buildGenerics, buildHeaders, buildRequestDataLine, buildReturnStatement, getComments } from '../utils.ts'
10
10
  import { Client } from './Client.tsx'
@@ -27,7 +27,7 @@ type Props = {
27
27
  paramsType: PluginClient['resolvedOptions']['pathParamsType']
28
28
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
29
29
  parser: PluginClient['resolvedOptions']['parser'] | undefined
30
- children?: FabricReactNode
30
+ children?: KubbReactNode
31
31
  }
32
32
 
33
33
  type GenerateMethodProps = {
@@ -102,7 +102,7 @@ export function StaticClassClient({
102
102
  paramsCasing,
103
103
  pathParamsType,
104
104
  children,
105
- }: Props): FabricReactNode {
105
+ }: Props): KubbReactNode {
106
106
  const methods = operations.map(({ node, name: methodName, tsResolver, zodResolver }) =>
107
107
  generateMethod({
108
108
  node,
@@ -3,8 +3,8 @@ import { caseParams, createOperationParams } from '@kubb/ast'
3
3
  import type { FunctionParametersNode, OperationNode } from '@kubb/ast/types'
4
4
  import type { PluginTs } from '@kubb/plugin-ts'
5
5
  import { functionPrinter } from '@kubb/plugin-ts'
6
- import { Const, File, Function } from '@kubb/react-fabric'
7
- import type { FabricReactNode } from '@kubb/react-fabric/types'
6
+ import { Const, File, Function } from '@kubb/renderer-jsx'
7
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
8
8
  import type { PluginClient } from '../types.ts'
9
9
  import { buildParamsMapping } from '../utils.ts'
10
10
 
@@ -57,7 +57,7 @@ export function Url({
57
57
  pathParamsType,
58
58
  node,
59
59
  tsResolver,
60
- }: Props): FabricReactNode {
60
+ }: Props): KubbReactNode {
61
61
  const path = new URLPath(node.path)
62
62
 
63
63
  const paramsNode = getParams({
@@ -1,6 +1,6 @@
1
1
  import { camelCase } from '@internals/utils'
2
- import { File } from '@kubb/react-fabric'
3
- import type { FabricReactNode } from '@kubb/react-fabric/types'
2
+ import { File } from '@kubb/renderer-jsx'
3
+ import type { KubbReactNode } from '@kubb/renderer-jsx/types'
4
4
 
5
5
  type Props = {
6
6
  name: string
@@ -9,7 +9,7 @@ type Props = {
9
9
  isIndexable?: boolean
10
10
  }
11
11
 
12
- export function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }: Props): FabricReactNode {
12
+ export function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }: Props): KubbReactNode {
13
13
  const properties = classNames.map((className) => ` readonly ${camelCase(className)}: ${className}`).join('\n')
14
14
  const assignments = classNames.map((className) => ` this.${camelCase(className)} = new ${className}(config)`).join('\n')
15
15
 
@@ -6,7 +6,7 @@ import type { PluginTs } from '@kubb/plugin-ts'
6
6
  import { pluginTsName } from '@kubb/plugin-ts'
7
7
  import type { PluginZod } from '@kubb/plugin-zod'
8
8
  import { pluginZodName } from '@kubb/plugin-zod'
9
- import { File } from '@kubb/react-fabric'
9
+ import { File } from '@kubb/renderer-jsx'
10
10
  import { ClassClient } from '../components/ClassClient'
11
11
  import { WrapperClient } from '../components/WrapperClient'
12
12
  import type { PluginClient } from '../types'
@@ -3,7 +3,7 @@ import { caseParams } from '@kubb/ast'
3
3
  import { defineGenerator } from '@kubb/core'
4
4
  import { pluginTsName } from '@kubb/plugin-ts'
5
5
  import { pluginZodName } from '@kubb/plugin-zod'
6
- import { File } from '@kubb/react-fabric'
6
+ import { File } from '@kubb/renderer-jsx'
7
7
  import { Client } from '../components/Client'
8
8
  import { Url } from '../components/Url.tsx'
9
9
  import type { PluginClient } from '../types'
@@ -1,7 +1,7 @@
1
1
  import { camelCase } from '@internals/utils'
2
2
  import type { FileNode } from '@kubb/ast/types'
3
3
  import { defineGenerator } from '@kubb/core'
4
- import { File, Function } from '@kubb/react-fabric'
4
+ import { File, Function } from '@kubb/renderer-jsx'
5
5
  import type { PluginClient } from '../types'
6
6
 
7
7
  export const groupedClientGenerator = defineGenerator<PluginClient>({
@@ -1,5 +1,5 @@
1
1
  import { defineGenerator } from '@kubb/core'
2
- import { File } from '@kubb/react-fabric'
2
+ import { File } from '@kubb/renderer-jsx'
3
3
  import { Operations } from '../components/Operations'
4
4
  import type { PluginClient } from '../types'
5
5
 
@@ -6,7 +6,7 @@ import type { PluginTs } from '@kubb/plugin-ts'
6
6
  import { pluginTsName } from '@kubb/plugin-ts'
7
7
  import type { PluginZod } from '@kubb/plugin-zod'
8
8
  import { pluginZodName } from '@kubb/plugin-zod'
9
- import { File } from '@kubb/react-fabric'
9
+ import { File } from '@kubb/renderer-jsx'
10
10
  import { StaticClassClient } from '../components/StaticClassClient'
11
11
  import type { PluginClient } from '../types'
12
12
 
package/src/plugin.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase } from '@internals/utils'
3
- import { createFile, createSource } from '@kubb/ast'
3
+ import { createFile, createSource, createText } from '@kubb/ast'
4
4
  import { createPlugin, type Group, getPreset, mergeGenerators } from '@kubb/core'
5
5
  import { pluginTsName } from '@kubb/plugin-ts'
6
6
  import { pluginZodName } from '@kubb/plugin-zod'
@@ -169,7 +169,7 @@ export const pluginClient = createPlugin<PluginClient>((options) => {
169
169
  sources: [
170
170
  createSource({
171
171
  name: 'fetch',
172
- value: plugin.options.client === 'fetch' ? fetchClientSource : axiosClientSource,
172
+ nodes: [createText(plugin.options.client === 'fetch' ? fetchClientSource : axiosClientSource)],
173
173
  isExportable: true,
174
174
  isIndexable: true,
175
175
  }),
@@ -185,7 +185,7 @@ export const pluginClient = createPlugin<PluginClient>((options) => {
185
185
  sources: [
186
186
  createSource({
187
187
  name: 'config',
188
- value: configSource,
188
+ nodes: [createText(configSource)],
189
189
  isExportable: false,
190
190
  isIndexable: false,
191
191
  }),
package/src/utils.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { URLPath } from '@internals/utils'
2
2
  import type { OperationNode, ParameterNode } from '@kubb/ast/types'
3
+ import { FunctionParams } from '@kubb/core'
3
4
  import type { PluginTs } from '@kubb/plugin-ts'
4
5
  import type { PluginZod } from '@kubb/plugin-zod'
5
- import { FunctionParams } from '@kubb/react-fabric'
6
6
  import type { PluginClient } from './types.ts'
7
7
 
8
8
  export function getComments(node: OperationNode): Array<string> {