@kubb/plugin-valibot 0.0.0-stage → 0.0.0
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/LICENSE +21 -0
- package/README.md +73 -2
- package/dist/index.cjs +2105 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +308 -0
- package/dist/index.d.ts +308 -0
- package/dist/index.js +2096 -0
- package/dist/index.js.map +1 -0
- package/docs/guides/coercion.md +52 -0
- package/docs/guides/customization.md +131 -0
- package/docs/guides/format-mappings.md +98 -0
- package/docs/guides/inferred-types.md +70 -0
- package/docs/options.md +215 -0
- package/docs/overview.md +70 -0
- package/kubb-extension.json +224 -0
- package/package.json +93 -3
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kubb.dev/schemas/kubb-extension.json",
|
|
3
|
+
"kind": "plugin",
|
|
4
|
+
"name": "plugin-valibot",
|
|
5
|
+
"export": "pluginValibot",
|
|
6
|
+
"displayName": "Valibot",
|
|
7
|
+
"description": "Generates Valibot v1 schemas from your OpenAPI spec so you validate API responses, form input, and query params at runtime.",
|
|
8
|
+
"category": "validation",
|
|
9
|
+
"icon": {
|
|
10
|
+
"light": "https://kubb.dev/feature/valibot.svg"
|
|
11
|
+
},
|
|
12
|
+
"tags": ["valibot", "validation", "schema", "runtime-validation", "codegen", "openapi"],
|
|
13
|
+
"docs": "https://kubb.dev/extensions/kubb-labs/plugin-valibot",
|
|
14
|
+
"maintainers": [
|
|
15
|
+
{
|
|
16
|
+
"name": "Stijn Van Hulle",
|
|
17
|
+
"github": "stijnvanhulle"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"compatibility": {
|
|
21
|
+
"kubb": ">=5.19.0",
|
|
22
|
+
"node": ">=22.22"
|
|
23
|
+
},
|
|
24
|
+
"options": [
|
|
25
|
+
{
|
|
26
|
+
"key": "outputPath",
|
|
27
|
+
"path": ["output", "path"],
|
|
28
|
+
"label": "Output Path",
|
|
29
|
+
"description": "Output folder for generated files",
|
|
30
|
+
"type": "text",
|
|
31
|
+
"default": "valibot"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "barrel",
|
|
35
|
+
"path": ["output", "barrel"],
|
|
36
|
+
"label": "Barrel",
|
|
37
|
+
"description": "How index.ts barrel files are generated",
|
|
38
|
+
"type": "select",
|
|
39
|
+
"default": {
|
|
40
|
+
"type": "named"
|
|
41
|
+
},
|
|
42
|
+
"choices": [
|
|
43
|
+
{
|
|
44
|
+
"label": "named",
|
|
45
|
+
"value": {
|
|
46
|
+
"type": "named"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"label": "named (nested)",
|
|
51
|
+
"value": {
|
|
52
|
+
"type": "named",
|
|
53
|
+
"nested": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"label": "all",
|
|
58
|
+
"value": {
|
|
59
|
+
"type": "all"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"label": "all (nested)",
|
|
64
|
+
"value": {
|
|
65
|
+
"type": "all",
|
|
66
|
+
"nested": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"label": "false (disabled)",
|
|
71
|
+
"value": false
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"key": "outputMode",
|
|
77
|
+
"path": ["output", "mode"],
|
|
78
|
+
"label": "Output Mode",
|
|
79
|
+
"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.",
|
|
80
|
+
"type": "select",
|
|
81
|
+
"default": "directory",
|
|
82
|
+
"choices": [
|
|
83
|
+
{
|
|
84
|
+
"label": "directory (one file per schema)",
|
|
85
|
+
"value": "directory"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"label": "file (single file)",
|
|
89
|
+
"value": "file"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"key": "group",
|
|
95
|
+
"path": ["group"],
|
|
96
|
+
"label": "Group",
|
|
97
|
+
"description": "Group generated operations by OpenAPI tag or path",
|
|
98
|
+
"type": "select",
|
|
99
|
+
"default": null,
|
|
100
|
+
"choices": [
|
|
101
|
+
{
|
|
102
|
+
"label": "none",
|
|
103
|
+
"value": null
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"label": "by tag",
|
|
107
|
+
"value": {
|
|
108
|
+
"type": "tag"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"label": "by path",
|
|
113
|
+
"value": {
|
|
114
|
+
"type": "path"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"key": "excludeTags",
|
|
121
|
+
"path": ["exclude"],
|
|
122
|
+
"label": "Exclude Tags",
|
|
123
|
+
"description": "Comma-separated OpenAPI tags to exclude from generation",
|
|
124
|
+
"type": "list",
|
|
125
|
+
"item": {
|
|
126
|
+
"type": "tag",
|
|
127
|
+
"pattern": "$item"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"key": "includeTags",
|
|
132
|
+
"path": ["include"],
|
|
133
|
+
"label": "Include Tags",
|
|
134
|
+
"description": "Comma-separated OpenAPI tags to include. Only operations with these tags are generated",
|
|
135
|
+
"type": "list",
|
|
136
|
+
"item": {
|
|
137
|
+
"type": "tag",
|
|
138
|
+
"pattern": "$item"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"key": "importPath",
|
|
143
|
+
"path": ["importPath"],
|
|
144
|
+
"label": "Import Path",
|
|
145
|
+
"description": "Module specifier used in the import statement",
|
|
146
|
+
"type": "text",
|
|
147
|
+
"default": "valibot"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"key": "regexType",
|
|
151
|
+
"path": ["regexType"],
|
|
152
|
+
"label": "Regex Type",
|
|
153
|
+
"description": "Output form for an OpenAPI pattern inside v.regex(...)",
|
|
154
|
+
"type": "select",
|
|
155
|
+
"default": "literal",
|
|
156
|
+
"choices": [
|
|
157
|
+
{
|
|
158
|
+
"label": "literal",
|
|
159
|
+
"value": "literal"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"label": "constructor",
|
|
163
|
+
"value": "constructor"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"key": "oneOfType",
|
|
169
|
+
"path": ["oneOfType"],
|
|
170
|
+
"label": "oneOf Type",
|
|
171
|
+
"description": "How a oneOf is validated: v.union with strict object members, or a check that exactly one member matches",
|
|
172
|
+
"type": "select",
|
|
173
|
+
"default": "union",
|
|
174
|
+
"choices": [
|
|
175
|
+
{
|
|
176
|
+
"label": "union",
|
|
177
|
+
"value": "union"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"label": "xor",
|
|
181
|
+
"value": "xor"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"key": "inferred",
|
|
187
|
+
"path": ["inferred"],
|
|
188
|
+
"label": "Inferred",
|
|
189
|
+
"description": "Export a type alias next to every generated schema",
|
|
190
|
+
"type": "boolean",
|
|
191
|
+
"default": false
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"key": "coercion",
|
|
195
|
+
"path": ["coercion"],
|
|
196
|
+
"label": "Coercion",
|
|
197
|
+
"description": "Convert input with v.toString, v.toNumber, and v.toDate before validation",
|
|
198
|
+
"type": "boolean",
|
|
199
|
+
"default": false
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"key": "typeGuards",
|
|
203
|
+
"path": ["typeGuards"],
|
|
204
|
+
"label": "Type Guards",
|
|
205
|
+
"description": "Generate is* type guards and assert* functions for each schema",
|
|
206
|
+
"type": "boolean",
|
|
207
|
+
"default": false
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"key": "banner",
|
|
211
|
+
"path": ["output", "banner"],
|
|
212
|
+
"label": "Banner",
|
|
213
|
+
"description": "Text added at the top of every generated file",
|
|
214
|
+
"type": "text"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"key": "footer",
|
|
218
|
+
"path": ["output", "footer"],
|
|
219
|
+
"label": "Footer",
|
|
220
|
+
"description": "Text added at the end of every generated file",
|
|
221
|
+
"type": "text"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,96 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-valibot",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Generate Valibot validation schemas with Kubb for runtime data parsing and type safety.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"code-generation",
|
|
7
|
+
"codegen",
|
|
8
|
+
"kubb",
|
|
9
|
+
"meta-framework",
|
|
10
|
+
"parse",
|
|
11
|
+
"runtime-validation",
|
|
12
|
+
"schema",
|
|
13
|
+
"typescript",
|
|
14
|
+
"valibot",
|
|
15
|
+
"validation"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://kubb.dev/extensions/kubb-labs/plugin-valibot",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "stijnvanhulle",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/kubb-labs/plugins.git",
|
|
23
|
+
"directory": "packages/plugin-valibot"
|
|
24
|
+
},
|
|
25
|
+
"funding": [
|
|
26
|
+
{
|
|
27
|
+
"type": "github",
|
|
28
|
+
"url": "https://github.com/sponsors/stijnvanhulle"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "opencollective",
|
|
32
|
+
"url": "https://opencollective.com/kubb"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "custom",
|
|
36
|
+
"url": "https://kubb.dev/sponsors"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"kubb-extension.json",
|
|
42
|
+
"docs",
|
|
43
|
+
"!/**/**.test.**",
|
|
44
|
+
"!/**/__tests__/**",
|
|
45
|
+
"!/**/__snapshots__/**"
|
|
46
|
+
],
|
|
47
|
+
"type": "module",
|
|
48
|
+
"sideEffects": false,
|
|
49
|
+
"main": "./dist/index.cjs",
|
|
50
|
+
"module": "./dist/index.js",
|
|
51
|
+
"types": "./dist/index.d.ts",
|
|
52
|
+
"exports": {
|
|
53
|
+
".": {
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/index.d.ts",
|
|
56
|
+
"default": "./dist/index.js"
|
|
57
|
+
},
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./dist/index.d.cts",
|
|
60
|
+
"default": "./dist/index.cjs"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"./package.json": "./package.json",
|
|
64
|
+
"./kubb-extension.json": "./kubb-extension.json"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public",
|
|
68
|
+
"registry": "https://registry.npmjs.org/"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@kubb/kit": "^5.21.1",
|
|
72
|
+
"@kubb/renderer-jsx": "^5.21.1"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@internals/shared": "0.0.0",
|
|
76
|
+
"@internals/utils": "0.0.0",
|
|
77
|
+
"valibot": "^1.5.0"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"valibot": "^1.2.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"valibot": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=22.22"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"build": "tsdown",
|
|
92
|
+
"clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
|
|
93
|
+
"start": "tsdown --watch",
|
|
94
|
+
"typecheck": "tsc"
|
|
95
|
+
}
|
|
6
96
|
}
|