@kubb/plugin-ts 5.2.0-canary.20261024T235331 → 5.2.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/dist/index.cjs +78 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +78 -41
- package/dist/index.js.map +1 -1
- package/docs/options.md +27 -0
- package/kubb-extension.json +1 -1
- package/package.json +6 -6
package/docs/options.md
CHANGED
|
@@ -12,6 +12,7 @@ Pass these options to `pluginTs()`. Shared options link to [Shared plugin option
|
|
|
12
12
|
| [`syntaxType`](#syntaxtype) | Emit object schemas as type aliases or interfaces. | `'type'` |
|
|
13
13
|
| [`optionalType`](#optionaltype) | How optional properties are written. | `'questionToken'` |
|
|
14
14
|
| [`arrayType`](#arraytype) | `Type[]` or `Array<Type>`. | `'array'` |
|
|
15
|
+
| [`operations`](#operations) | Emit per-operation types, or print them inline in consumers. | `'export'` |
|
|
15
16
|
| [`include`](https://kubb.dev/docs/5.x/reference/plugin-options#include) | Keep only operations and schemas that match. | None |
|
|
16
17
|
| [`exclude`](https://kubb.dev/docs/5.x/reference/plugin-options#exclude) | Skip operations and schemas that match. | `[]` |
|
|
17
18
|
| [`override`](https://kubb.dev/docs/5.x/reference/plugin-options#override) | Apply different options per pattern. | `[]` |
|
|
@@ -233,6 +234,32 @@ Uses `tags: Array<string>`, which reads better for complex elements like `Array<
|
|
|
233
234
|
|
|
234
235
|
::
|
|
235
236
|
|
|
237
|
+
### operations
|
|
238
|
+
|
|
239
|
+
Whether each operation gets its own types file (`AddPetOptions`, `AddPetResponses`, `AddPetStatus200`, `AddPetPath`).
|
|
240
|
+
|
|
241
|
+
| | |
|
|
242
|
+
| -------- | ---------------------- |
|
|
243
|
+
| Type | `'export' \| 'inline'` |
|
|
244
|
+
| Required | `false` |
|
|
245
|
+
| Default | `'export'` |
|
|
246
|
+
|
|
247
|
+
::field-group
|
|
248
|
+
|
|
249
|
+
:::field{name="'export'"}
|
|
250
|
+
Emits one file per operation with its aliases and aggregates, for example `export type AddPetStatus200 = Pet`.
|
|
251
|
+
:::
|
|
252
|
+
|
|
253
|
+
:::field{name="'inline'"}
|
|
254
|
+
Emits only the schema types. Clients, query hooks, MSW handlers, Faker mocks, Cypress requests, and MCP handlers reference those directly and print the rest inline, for example `Options<{ body: Order; path?: never; query?: never; headers?: never }>` and `mutationOptions<Order, ResponseErrorConfig<unknown>, …>`. An enum declared inside an operation becomes a literal union such as `'available' | 'pending' | 'sold'`. Kubb moves each operation type into the files that use it, so this needs a Kubb version with inline sources.
|
|
255
|
+
:::
|
|
256
|
+
|
|
257
|
+
::
|
|
258
|
+
|
|
259
|
+
```ts [kubb.config.ts]
|
|
260
|
+
pluginTs({ operations: 'inline' })
|
|
261
|
+
```
|
|
262
|
+
|
|
236
263
|
### resolver
|
|
237
264
|
|
|
238
265
|
Overrides generated file and symbol names. Omitted members keep `resolverTs`. The shared members (`name`, `file`, `imports`) and the `this` context are described under [`resolver`](https://kubb.dev/docs/5.x/reference/plugin-options#resolver).
|
package/kubb-extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "5.2.0
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Generate TypeScript types, interfaces, and enums with Kubb. The base plugin other Kubb plugins build on for type safety.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generation",
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
"registry": "https://registry.npmjs.org/"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@kubb/parser-ts": "^5.
|
|
70
|
+
"@kubb/parser-ts": "^5.14.0",
|
|
71
71
|
"yuku-codegen": "^0.19.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@internals/shared": "0.
|
|
75
|
-
"@internals/utils": "0.
|
|
76
|
-
"kubb": "^5.
|
|
74
|
+
"@internals/shared": "0.0.0",
|
|
75
|
+
"@internals/utils": "0.0.0",
|
|
76
|
+
"kubb": "^5.14.0",
|
|
77
77
|
"typescript": "^7.0.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@typescript/typescript6": "^6.0.2",
|
|
81
|
-
"kubb": "^5.
|
|
81
|
+
"kubb": "^5.14.0",
|
|
82
82
|
"typescript": ">=5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|