@kubb/plugin-ts 5.0.0-alpha.8 → 5.0.0-beta.10

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.
Files changed (43) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +26 -7
  3. package/dist/index.cjs +1526 -4
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +574 -4
  6. package/dist/index.js +1488 -2
  7. package/dist/index.js.map +1 -0
  8. package/extension.yaml +632 -0
  9. package/package.json +43 -65
  10. package/src/components/{v2/Enum.tsx → Enum.tsx} +33 -17
  11. package/src/components/Type.tsx +31 -161
  12. package/src/constants.ts +15 -5
  13. package/src/factory.ts +295 -39
  14. package/src/generators/typeGenerator.tsx +248 -420
  15. package/src/index.ts +9 -2
  16. package/src/plugin.ts +67 -205
  17. package/src/printers/functionPrinter.ts +197 -0
  18. package/src/printers/printerTs.ts +329 -0
  19. package/src/resolvers/resolverTs.ts +66 -0
  20. package/src/types.ts +238 -94
  21. package/src/utils.ts +129 -0
  22. package/dist/components-CRu8IKY3.js +0 -729
  23. package/dist/components-CRu8IKY3.js.map +0 -1
  24. package/dist/components-DeNDKlzf.cjs +0 -982
  25. package/dist/components-DeNDKlzf.cjs.map +0 -1
  26. package/dist/components.cjs +0 -3
  27. package/dist/components.d.ts +0 -36
  28. package/dist/components.js +0 -2
  29. package/dist/generators.cjs +0 -4
  30. package/dist/generators.d.ts +0 -480
  31. package/dist/generators.js +0 -2
  32. package/dist/plugin-D5NGPj0v.js +0 -1232
  33. package/dist/plugin-D5NGPj0v.js.map +0 -1
  34. package/dist/plugin-MLTxoa8p.cjs +0 -1279
  35. package/dist/plugin-MLTxoa8p.cjs.map +0 -1
  36. package/dist/types-CsvB6X5Y.d.ts +0 -167
  37. package/src/components/index.ts +0 -1
  38. package/src/components/v2/Type.tsx +0 -59
  39. package/src/generators/index.ts +0 -2
  40. package/src/generators/v2/typeGenerator.tsx +0 -171
  41. package/src/generators/v2/utils.ts +0 -140
  42. package/src/parser.ts +0 -389
  43. package/src/printer.ts +0 -368
package/LICENSE CHANGED
@@ -1,14 +1,21 @@
1
- Copyright (c) 2026 Stijn Van Hulle
1
+ MIT License
2
2
 
3
- This repository contains software under two licenses:
3
+ Copyright (c) 2026 Kubb Labs
4
4
 
5
- 1. Most of the code in this repository is licensed under the
6
- MIT License see licenses/LICENSE-MIT for the full license text.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
7
11
 
8
- 2. The following components are licensed under the
9
- GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later)
10
- — see licenses/LICENSE-AGPL-3.0 for the full license text:
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
11
14
 
12
- - packages/agent (published as @kubb/agent)
13
-
14
- Each package's own LICENSE file or package.json specifies its applicable license.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  <div align="center">
2
- <h1>Plugin TypeScript</h1>
2
+ <h1>@kubb/plugin-ts</h1>
3
3
  <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
4
  <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
5
5
  </a>
6
6
 
7
-
8
7
  [![npm version][npm-version-src]][npm-version-href]
9
8
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
10
9
  [![Coverage][coverage-src]][coverage-href]
11
10
  [![License][license-src]][license-href]
12
11
  [![Sponsors][sponsors-src]][sponsors-href]
12
+
13
13
  <h4>
14
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
14
+ <a href="https://codesandbox.io/s/github/kubb-labs/plugins/tree/main/examples/typescript" target="_blank">View Demo</a>
15
15
  <span> · </span>
16
- <a href="https://kubb.dev/" target="_blank">Documentation</a>
16
+ <a href="https://kubb.dev/plugins/ts" target="_blank">Documentation</a>
17
17
  <span> · </span>
18
18
  <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
19
19
  <span> · </span>
@@ -21,12 +21,32 @@
21
21
  </h4>
22
22
  </div>
23
23
 
24
- Swagger integration for TypeScript to generate all the different types based on an OpenAPI specification.
24
+ `@kubb/plugin-ts` generates TypeScript types from your OpenAPI specification. It produces interfaces, enums, union types, and string literals that other Kubb plugins import and build on.
25
+
26
+ ## Features
27
+
28
+ - Generates interfaces, enums, union types, and string literals from OpenAPI schemas
29
+ - Other plugins — `@kubb/plugin-client`, `@kubb/plugin-zod`, and the query plugins — import from its output
30
+ - Supports strict typing mode for required vs optional fields
31
+ - Controls output organization by tag, operation, or a custom grouping
25
32
 
33
+ ## Installation
34
+
35
+ ```bash
36
+ bun add @kubb/plugin-ts
37
+ # or
38
+ pnpm add @kubb/plugin-ts
39
+ # or
40
+ npm install @kubb/plugin-ts
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ See the [full documentation](https://kubb.dev/plugins/ts) for configuration options and examples.
26
46
 
27
47
  ## Supporting Kubb
28
48
 
29
- Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
49
+ Kubb is an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
30
50
 
31
51
  - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
32
52
 
@@ -36,7 +56,6 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
36
56
  </a>
37
57
  </p>
38
58
 
39
-
40
59
  <!-- Badges -->
41
60
 
42
61
  [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-ts?flat&colorA=18181B&colorB=f58517