@kubb/plugin-ts 5.1.0-canary.20261023T200213 → 5.1.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.
@@ -24,26 +24,27 @@ A generated `Pet` becomes `ApiPet`. File names stay unchanged unless you also cu
24
24
 
25
25
  ## Map schema types
26
26
 
27
- Replace [printer handlers](https://kubb.dev/extensions/kubb-labs/plugin-ts/options#printer) with TypeScript AST nodes. Install `@typescript/typescript6` first, because `typescript` 7 no longer exports the compiler API.
27
+ Replace [printer handlers](https://kubb.dev/extensions/kubb-labs/plugin-ts/options#printer) with your own. Each handler returns the TypeScript type as a string.
28
28
 
29
29
  ```typescript [kubb.config.ts]
30
- import ts from '@typescript/typescript6'
31
30
  import { pluginTs } from '@kubb/plugin-ts'
32
31
 
33
32
  pluginTs({
34
33
  printer: {
35
34
  nodes: {
36
35
  date() {
37
- return ts.factory.createTypeReferenceNode('Date', [])
36
+ return 'Date'
38
37
  },
39
38
  integer() {
40
- return ts.factory.createKeywordTypeNode(ts.SyntaxKind.BigIntKeyword)
39
+ return 'bigint'
41
40
  },
42
41
  },
43
42
  },
44
43
  })
45
44
  ```
46
45
 
46
+ Handlers that return TypeScript compiler nodes still work when your project installs `typescript` 5 or 6, or `@typescript/typescript6` next to TypeScript 7. Both are optional peer dependencies. That form is deprecated and is removed in the next major.
47
+
47
48
  This 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.
48
49
 
49
50
  ## Remove descriptions
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "compatibility": {
21
21
  "kubb": ">=5.8.3",
22
- "node": ">=22.12"
22
+ "node": ">=22.22"
23
23
  },
24
24
  "options": [
25
25
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-ts",
3
- "version": "5.1.0-canary.20261023T200213",
3
+ "version": "5.1.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,21 +67,30 @@
67
67
  "registry": "https://registry.npmjs.org/"
68
68
  },
69
69
  "dependencies": {
70
- "@kubb/parser-ts": "^5.12.8",
71
- "@typescript/typescript6": "^6.0.2"
70
+ "@kubb/parser-ts": "^5.13.0",
71
+ "yuku-codegen": "^0.19.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@internals/shared": "0.1.0-canary.20261023T200213",
75
- "@internals/utils": "0.1.0-canary.20261023T200213",
76
- "kubb": "^5.12.8",
74
+ "@internals/shared": "0.0.0",
75
+ "@internals/utils": "0.0.0",
76
+ "kubb": "^5.13.0",
77
77
  "typescript": "^7.0.2"
78
78
  },
79
79
  "peerDependencies": {
80
- "kubb": "^5.12.8",
81
- "typescript": "^7.0.2"
80
+ "@typescript/typescript6": "^6.0.2",
81
+ "kubb": "^5.13.0",
82
+ "typescript": ">=5.0.0"
83
+ },
84
+ "peerDependenciesMeta": {
85
+ "@typescript/typescript6": {
86
+ "optional": true
87
+ },
88
+ "typescript": {
89
+ "optional": true
90
+ }
82
91
  },
83
92
  "engines": {
84
- "node": ">=22.12"
93
+ "node": ">=22.22"
85
94
  },
86
95
  "scripts": {
87
96
  "build": "tsdown",