@kubb/plugin-ts 5.5.0 → 5.5.2
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 +5 -5
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +5 -5
- package/docs/guides/customization.md +3 -3
- package/docs/options.md +6 -5
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -8,14 +8,14 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
8
8
|
value,
|
|
9
9
|
configurable: true
|
|
10
10
|
});
|
|
11
|
-
var __exportAll = (all,
|
|
12
|
-
let target = {};
|
|
11
|
+
var __exportAll = (all, flags) => {
|
|
12
|
+
let target = Object.setPrototypeOf({}, null);
|
|
13
13
|
for (var name in all) __defProp(target, name, {
|
|
14
14
|
get: all[name],
|
|
15
15
|
enumerable: true
|
|
16
16
|
});
|
|
17
|
-
if (!
|
|
18
|
-
return target;
|
|
17
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
19
19
|
};
|
|
20
20
|
let _kubb_kit = require("@kubb/kit");
|
|
21
21
|
let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
|
|
@@ -1956,7 +1956,7 @@ var compatibility = {
|
|
|
1956
1956
|
"node": ">=22.22"
|
|
1957
1957
|
};
|
|
1958
1958
|
// package.json
|
|
1959
|
-
var version = "5.5.
|
|
1959
|
+
var version = "5.5.2";
|
|
1960
1960
|
// src/resolvers/resolverTs.ts
|
|
1961
1961
|
/**
|
|
1962
1962
|
* Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
|
package/dist/index.d.cts
CHANGED
|
@@ -841,5 +841,4 @@ type BuildParamsSchemaOptions = {
|
|
|
841
841
|
* so the group is the only type these entries are exported as.
|
|
842
842
|
*/
|
|
843
843
|
export declare function buildParams({ params, serializedExamples }: BuildParamsSchemaOptions): ast.SchemaNode;
|
|
844
|
-
export { type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default };
|
|
845
|
-
//# sourceMappingURL=index.d.cts.map
|
|
844
|
+
export { type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -841,5 +841,4 @@ type BuildParamsSchemaOptions = {
|
|
|
841
841
|
* so the group is the only type these entries are exported as.
|
|
842
842
|
*/
|
|
843
843
|
export declare function buildParams({ params, serializedExamples }: BuildParamsSchemaOptions): ast.SchemaNode;
|
|
844
|
-
export { type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default };
|
|
845
|
-
//# sourceMappingURL=index.d.ts.map
|
|
844
|
+
export { type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default };
|
package/dist/index.js
CHANGED
|
@@ -9,14 +9,14 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
9
9
|
value,
|
|
10
10
|
configurable: true
|
|
11
11
|
});
|
|
12
|
-
var __exportAll = (all,
|
|
13
|
-
let target = {};
|
|
12
|
+
var __exportAll = (all, flags) => {
|
|
13
|
+
let target = Object.setPrototypeOf({}, null);
|
|
14
14
|
for (var name in all) __defProp(target, name, {
|
|
15
15
|
get: all[name],
|
|
16
16
|
enumerable: true
|
|
17
17
|
});
|
|
18
|
-
if (!
|
|
19
|
-
return target;
|
|
18
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
20
20
|
};
|
|
21
21
|
// ../../internals/utils/src/reserved.ts
|
|
22
22
|
/**
|
|
@@ -1952,7 +1952,7 @@ var compatibility = {
|
|
|
1952
1952
|
"node": ">=22.22"
|
|
1953
1953
|
};
|
|
1954
1954
|
// package.json
|
|
1955
|
-
var version = "5.5.
|
|
1955
|
+
var version = "5.5.2";
|
|
1956
1956
|
// src/resolvers/resolverTs.ts
|
|
1957
1957
|
/**
|
|
1958
1958
|
* Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
|
|
@@ -43,9 +43,9 @@ pluginTs({
|
|
|
43
43
|
})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
The example maps `date` fields to `Date` and `int32` integers to `bigint`. The separate `bigint` handler controls `int64` fields, which already use `bigint` by default. A `date-time` field uses the `datetime` handler.
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Handlers that return TypeScript compiler nodes are deprecated and are removed in the next major. They still work when your project installs `@kubb/parser-ts`, plus `typescript` 5 or 6 or `@typescript/typescript6` next to TypeScript 7. All are optional peer dependencies. If `@kubb/parser-ts` is missing, the build stops with an error that tells you to install it.
|
|
49
49
|
|
|
50
50
|
## Remove descriptions
|
|
51
51
|
|
|
@@ -67,4 +67,4 @@ const dropDescriptions = defineMacro({
|
|
|
67
67
|
pluginTs({ macros: [dropDescriptions] })
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
The generated types omit description JSDoc. The OpenAPI document stays unchanged. The same macro works with `pluginZod
|
|
70
|
+
The generated types omit description JSDoc. The OpenAPI document stays unchanged. The same macro works with `pluginZod`, with [one exception](https://kubb.dev/extensions/kubb-labs/plugin-zod/guides/customization#remove-descriptions).
|
package/docs/options.md
CHANGED
|
@@ -63,7 +63,7 @@ Emits a named union type with no runtime value.
|
|
|
63
63
|
:::
|
|
64
64
|
|
|
65
65
|
:::field{name="'inlineLiteral'"}
|
|
66
|
-
Emits the same union as `'literal'`
|
|
66
|
+
Emits the same union as `'literal'` and inlines it at each usage site for an enum declared on a property. A component enum that a `$ref` points to keeps its named type.
|
|
67
67
|
:::
|
|
68
68
|
|
|
69
69
|
::
|
|
@@ -118,7 +118,7 @@ Names the const `PetStatus`, matching the schema name.
|
|
|
118
118
|
|
|
119
119
|
#### enum.typeSuffix
|
|
120
120
|
|
|
121
|
-
Suffix on the companion type alias when `type` is `'asConst'`.
|
|
121
|
+
Suffix on the companion type alias when `type` is `'asConst'`. The suffix never changes the const object name. Set it to `''` to drop the suffix, which with `constCasing: 'pascalCase'` merges the const and the type under one name, `PetStatus`.
|
|
122
122
|
|
|
123
123
|
| | |
|
|
124
124
|
| -------- | -------- |
|
|
@@ -236,7 +236,7 @@ Uses `tags: Array<string>`, which reads better for complex elements like `Array<
|
|
|
236
236
|
|
|
237
237
|
### operations
|
|
238
238
|
|
|
239
|
-
Whether each operation gets its own types file (`AddPetOptions`, `AddPetResponses`, `AddPetStatus200`, `AddPetPath`). A response that declares `headers` also gets a type for them, such as `ListPetsStatus200Headers`.
|
|
239
|
+
Whether each operation gets its own types file (`AddPetOptions`, `AddPetResponses`, `AddPetStatus200`, `AddPetPath`). A response that declares `headers` also gets a type for them, such as `ListPetsStatus200Headers`. Cookie parameters get a type such as `ListPetsCookies`.
|
|
240
240
|
|
|
241
241
|
| | |
|
|
242
242
|
| -------- | ---------------------- |
|
|
@@ -251,7 +251,7 @@ Emits one file per operation with its aliases and aggregates, for example `expor
|
|
|
251
251
|
:::
|
|
252
252
|
|
|
253
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
|
|
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 `'inline'` needs a Kubb version with inline sources.
|
|
255
255
|
:::
|
|
256
256
|
|
|
257
257
|
::
|
|
@@ -275,6 +275,7 @@ type ResolverTsPatch = {
|
|
|
275
275
|
path?(node: OperationNode, param: ParameterNode): string // → 'GetPetByIdPath'
|
|
276
276
|
query?(node: OperationNode, param: ParameterNode): string // → 'FindPetsByStatusQuery'
|
|
277
277
|
headers?(node: OperationNode, param: ParameterNode): string // → 'DeletePetHeaders'
|
|
278
|
+
cookies?(node: OperationNode, param: ParameterNode): string // → 'GetCookiesCookies'
|
|
278
279
|
}
|
|
279
280
|
response?: {
|
|
280
281
|
status?(node: OperationNode, statusCode: StatusCode): string // → 'ListPetsStatus200'
|
|
@@ -294,7 +295,7 @@ type ResolverTsPatch = {
|
|
|
294
295
|
|
|
295
296
|
### printer
|
|
296
297
|
|
|
297
|
-
Replaces the
|
|
298
|
+
Replaces the handler for a schema type such as `'integer'` or `'date'`. Each handler returns the TypeScript type as a string. Inside a handler, `this.transform(node)` returns the printed type of a nested node and `this.options` holds the printer options. A handler that returns a TypeScript compiler node is deprecated. The [printer guide](https://kubb.dev/docs/5.x/how-to/printers) covers the handler context and how overrides compose with macros.
|
|
298
299
|
|
|
299
300
|
| | |
|
|
300
301
|
| -------- | ---------------------------- |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2",
|
|
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/kit": "^5.
|
|
71
|
-
"@kubb/renderer-jsx": "^5.
|
|
70
|
+
"@kubb/kit": "^5.19.0",
|
|
71
|
+
"@kubb/renderer-jsx": "^5.19.0",
|
|
72
72
|
"yuku-codegen": "^0.19.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@internals/shared": "0.0.0",
|
|
76
76
|
"@internals/utils": "0.0.0",
|
|
77
|
-
"@kubb/parser-ts": "^5.
|
|
77
|
+
"@kubb/parser-ts": "^5.19.0",
|
|
78
78
|
"typescript": "^7.0.2"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@kubb/parser-ts": "^5.
|
|
81
|
+
"@kubb/parser-ts": "^5.19.0",
|
|
82
82
|
"@typescript/typescript6": "^6.0.2",
|
|
83
83
|
"typescript": ">=5.0.0"
|
|
84
84
|
},
|