@kubb/plugin-client 5.5.6 → 5.5.7
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/OVERVIEW.md +17 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +161 -0
- package/package.json +9 -6
- package/src/plugin.ts +2 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kubb.dev/schemas/kubb-extension.json",
|
|
3
|
+
"kind": "plugin",
|
|
4
|
+
"name": "plugin-client",
|
|
5
|
+
"export": "pluginClient",
|
|
6
|
+
"displayName": "Client",
|
|
7
|
+
"description": "Generates typed operation functions from your OpenAPI spec that call a client module you own, so you decide the transport, auth, and error handling.",
|
|
8
|
+
"category": "client",
|
|
9
|
+
"icon": {
|
|
10
|
+
"light": "https://kubb.dev/feature/javascript.svg"
|
|
11
|
+
},
|
|
12
|
+
"tags": ["api-client", "http-client", "codegen", "openapi"],
|
|
13
|
+
"docs": "https://kubb.dev/plugins/plugin-client",
|
|
14
|
+
"compatibility": {
|
|
15
|
+
"kubb": ">=5.8.0",
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"options": [
|
|
19
|
+
{
|
|
20
|
+
"key": "outputPath",
|
|
21
|
+
"path": ["output", "path"],
|
|
22
|
+
"label": "Output Path",
|
|
23
|
+
"description": "Output folder for generated files",
|
|
24
|
+
"type": "text",
|
|
25
|
+
"default": "clients"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"key": "importPath",
|
|
29
|
+
"path": ["importPath"],
|
|
30
|
+
"label": "Import Path",
|
|
31
|
+
"description": "Import specifier of your client module, as the generated files import it",
|
|
32
|
+
"type": "text"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"key": "barrel",
|
|
36
|
+
"path": ["output", "barrel"],
|
|
37
|
+
"label": "Barrel",
|
|
38
|
+
"description": "How index.ts barrel files are generated",
|
|
39
|
+
"type": "select",
|
|
40
|
+
"default": {
|
|
41
|
+
"type": "named"
|
|
42
|
+
},
|
|
43
|
+
"choices": [
|
|
44
|
+
{
|
|
45
|
+
"label": "named",
|
|
46
|
+
"value": {
|
|
47
|
+
"type": "named"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"label": "named (nested)",
|
|
52
|
+
"value": {
|
|
53
|
+
"type": "named",
|
|
54
|
+
"nested": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"label": "all",
|
|
59
|
+
"value": {
|
|
60
|
+
"type": "all"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"label": "all (nested)",
|
|
65
|
+
"value": {
|
|
66
|
+
"type": "all",
|
|
67
|
+
"nested": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"label": "false (disabled)",
|
|
72
|
+
"value": false
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"key": "outputMode",
|
|
78
|
+
"path": ["output", "mode"],
|
|
79
|
+
"label": "Output Mode",
|
|
80
|
+
"description": "How the plugin consolidates its code into files. File mode writes everything into a single file, so the output path must include a file extension and cannot be grouped.",
|
|
81
|
+
"type": "select",
|
|
82
|
+
"default": "directory",
|
|
83
|
+
"choices": [
|
|
84
|
+
{
|
|
85
|
+
"label": "directory (one file per schema)",
|
|
86
|
+
"value": "directory"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"label": "file (single file)",
|
|
90
|
+
"value": "file"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"key": "validator",
|
|
96
|
+
"path": ["validator"],
|
|
97
|
+
"label": "Validator",
|
|
98
|
+
"description": "Pass request and response schemas from @kubb/plugin-zod to your client",
|
|
99
|
+
"type": "select",
|
|
100
|
+
"default": false,
|
|
101
|
+
"choices": [
|
|
102
|
+
{
|
|
103
|
+
"label": "false (disabled)",
|
|
104
|
+
"value": false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"label": "zod",
|
|
108
|
+
"value": "zod"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"key": "group",
|
|
114
|
+
"path": ["group"],
|
|
115
|
+
"label": "Group",
|
|
116
|
+
"description": "Group generated operations by OpenAPI tag or path",
|
|
117
|
+
"type": "select",
|
|
118
|
+
"default": null,
|
|
119
|
+
"choices": [
|
|
120
|
+
{
|
|
121
|
+
"label": "none",
|
|
122
|
+
"value": null
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"label": "by tag",
|
|
126
|
+
"value": {
|
|
127
|
+
"type": "tag"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"label": "by path",
|
|
132
|
+
"value": {
|
|
133
|
+
"type": "path"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"key": "excludeTags",
|
|
140
|
+
"path": ["exclude"],
|
|
141
|
+
"label": "Exclude Tags",
|
|
142
|
+
"description": "Comma-separated OpenAPI tags to exclude from generation",
|
|
143
|
+
"type": "list",
|
|
144
|
+
"item": {
|
|
145
|
+
"type": "tag",
|
|
146
|
+
"pattern": "$item"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"key": "includeTags",
|
|
151
|
+
"path": ["include"],
|
|
152
|
+
"label": "Include Tags",
|
|
153
|
+
"description": "Comma-separated OpenAPI tags to include. Only operations with these tags are generated",
|
|
154
|
+
"type": "list",
|
|
155
|
+
"item": {
|
|
156
|
+
"type": "tag",
|
|
157
|
+
"pattern": "$item"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-client",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.7",
|
|
4
4
|
"description": "Generate typed API operations against your own client module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
24
|
"dist",
|
|
25
|
+
"kubb-extension.json",
|
|
26
|
+
"OVERVIEW.md",
|
|
25
27
|
"!/**/**.test.**",
|
|
26
28
|
"!/**/__tests__/**",
|
|
27
29
|
"!/**/__snapshots__/**"
|
|
@@ -37,24 +39,25 @@
|
|
|
37
39
|
"import": "./dist/index.js",
|
|
38
40
|
"require": "./dist/index.cjs"
|
|
39
41
|
},
|
|
40
|
-
"./package.json": "./package.json"
|
|
42
|
+
"./package.json": "./package.json",
|
|
43
|
+
"./kubb-extension.json": "./kubb-extension.json"
|
|
41
44
|
},
|
|
42
45
|
"publishConfig": {
|
|
43
46
|
"access": "public",
|
|
44
47
|
"registry": "https://registry.npmjs.org/"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"@kubb/plugin-ts": "^5.0.
|
|
48
|
-
"@kubb/plugin-zod": "^5.4.
|
|
50
|
+
"@kubb/plugin-ts": "^5.0.8",
|
|
51
|
+
"@kubb/plugin-zod": "^5.4.6"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
54
|
"@internals/client": "0.0.0",
|
|
52
55
|
"@internals/shared": "0.0.0",
|
|
53
|
-
"kubb": "^5.8.
|
|
56
|
+
"kubb": "^5.8.1",
|
|
54
57
|
"typescript": "^6.0.3"
|
|
55
58
|
},
|
|
56
59
|
"peerDependencies": {
|
|
57
|
-
"kubb": "^5.8.
|
|
60
|
+
"kubb": "^5.8.1"
|
|
58
61
|
},
|
|
59
62
|
"engines": {
|
|
60
63
|
"node": ">=22"
|
package/src/plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createGroupConfig } from '@internals/shared'
|
|
2
2
|
import { addGenerator, definePlugin, Resolver, setMacros, setResolver } from 'kubb/kit'
|
|
3
|
+
import { compatibility } from '../kubb-extension.json'
|
|
3
4
|
import { version } from '../package.json'
|
|
4
5
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
5
6
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
@@ -23,7 +24,7 @@ export const pluginClientName = 'plugin-client' satisfies PluginClient['name']
|
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
25
26
|
export const pluginClient = definePlugin<PluginClient>({
|
|
26
|
-
meta: { name: pluginClientName, version, compatibility
|
|
27
|
+
meta: { name: pluginClientName, version, compatibility },
|
|
27
28
|
dependencies: (options) => ({ [pluginTsName]: { optional: true }, [pluginZodName]: { optional: !options.validator } }),
|
|
28
29
|
setup(options) {
|
|
29
30
|
const {
|