@kubb/core 5.0.0-alpha.9 → 5.0.0-beta.1

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 (64) hide show
  1. package/README.md +23 -20
  2. package/dist/PluginDriver-BXibeQk-.cjs +1036 -0
  3. package/dist/PluginDriver-BXibeQk-.cjs.map +1 -0
  4. package/dist/PluginDriver-DV3p2Hky.js +945 -0
  5. package/dist/PluginDriver-DV3p2Hky.js.map +1 -0
  6. package/dist/index.cjs +729 -1641
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +271 -225
  9. package/dist/index.js +713 -1609
  10. package/dist/index.js.map +1 -1
  11. package/dist/mocks.cjs +145 -0
  12. package/dist/mocks.cjs.map +1 -0
  13. package/dist/mocks.d.ts +80 -0
  14. package/dist/mocks.js +140 -0
  15. package/dist/mocks.js.map +1 -0
  16. package/dist/types-CuNocrbJ.d.ts +2148 -0
  17. package/package.json +51 -57
  18. package/src/FileManager.ts +115 -0
  19. package/src/FileProcessor.ts +86 -0
  20. package/src/Kubb.ts +207 -131
  21. package/src/PluginDriver.ts +325 -564
  22. package/src/constants.ts +20 -47
  23. package/src/createAdapter.ts +13 -6
  24. package/src/createKubb.ts +548 -0
  25. package/src/createRenderer.ts +57 -0
  26. package/src/createStorage.ts +13 -1
  27. package/src/defineGenerator.ts +77 -124
  28. package/src/defineLogger.ts +4 -2
  29. package/src/defineMiddleware.ts +62 -0
  30. package/src/defineParser.ts +44 -0
  31. package/src/definePlugin.ts +83 -0
  32. package/src/defineResolver.ts +418 -28
  33. package/src/devtools.ts +14 -14
  34. package/src/index.ts +13 -15
  35. package/src/mocks.ts +178 -0
  36. package/src/renderNode.ts +35 -0
  37. package/src/storages/fsStorage.ts +41 -11
  38. package/src/storages/memoryStorage.ts +4 -2
  39. package/src/types.ts +1031 -283
  40. package/src/utils/diagnostics.ts +4 -1
  41. package/src/utils/isInputPath.ts +10 -0
  42. package/src/utils/packageJSON.ts +50 -12
  43. package/dist/PluginDriver-BkFepPdm.d.ts +0 -1054
  44. package/dist/chunk-ByKO4r7w.cjs +0 -38
  45. package/dist/hooks.cjs +0 -103
  46. package/dist/hooks.cjs.map +0 -1
  47. package/dist/hooks.d.ts +0 -77
  48. package/dist/hooks.js +0 -98
  49. package/dist/hooks.js.map +0 -1
  50. package/src/build.ts +0 -418
  51. package/src/config.ts +0 -56
  52. package/src/createPlugin.ts +0 -28
  53. package/src/hooks/index.ts +0 -4
  54. package/src/hooks/useKubb.ts +0 -143
  55. package/src/hooks/useMode.ts +0 -11
  56. package/src/hooks/usePlugin.ts +0 -11
  57. package/src/hooks/usePluginDriver.ts +0 -11
  58. package/src/utils/FunctionParams.ts +0 -155
  59. package/src/utils/TreeNode.ts +0 -215
  60. package/src/utils/executeStrategies.ts +0 -81
  61. package/src/utils/formatters.ts +0 -56
  62. package/src/utils/getBarrelFiles.ts +0 -141
  63. package/src/utils/getConfigs.ts +0 -12
  64. package/src/utils/linters.ts +0 -25
package/README.md CHANGED
@@ -1,18 +1,20 @@
1
1
  <div align="center">
2
- <a href="https://kubb.dev/kubb" target="_blank" rel="noopener noreferrer">
2
+ <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
3
3
  <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
4
4
  </a>
5
5
 
6
-
7
6
  [![npm version][npm-version-src]][npm-version-href]
8
7
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
9
8
  [![Coverage][coverage-src]][coverage-href]
10
9
  [![License][license-src]][license-href]
11
10
  [![Sponsors][sponsors-src]][sponsors-href]
11
+
12
+ ### The meta framework for code generation
13
+
14
+ **Stop writing glue code. Define your API once and Kubb generates types, clients, hooks, validators, mocks and more.**
15
+
12
16
  <h4>
13
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main/examples/typescript" target="_blank">View Demo</a>
14
- <span> · </span>
15
- <a href="https://kubb.dev/kubb" target="_blank">Documentation</a>
17
+ <a href="https://kubb.dev" target="_blank">Documentation</a>
16
18
  <span> · </span>
17
19
  <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
18
20
  <span> · </span>
@@ -22,6 +24,14 @@
22
24
 
23
25
  <br />
24
26
 
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install @kubb/core
31
+ # or
32
+ pnpm add @kubb/core
33
+ ```
34
+
25
35
  ## Quick Start
26
36
 
27
37
  Get started with Kubb in seconds:
@@ -31,6 +41,7 @@ npx kubb init
31
41
  ```
32
42
 
33
43
  The interactive setup will:
44
+
34
45
  - Create a `package.json` (if needed)
35
46
  - Guide you through plugin selection
36
47
  - Install packages automatically
@@ -45,14 +56,14 @@ npx kubb generate
45
56
  See the [documentation](https://kubb.dev) for detailed usage and advanced features.
46
57
 
47
58
  ## Features
48
- - Works with Node.js 20+.
49
- - Convert Swagger 2.0, OpenAPI 3.0, and OpenAPI 3.1 to TypeScript, Zod, React-Query, ...
50
- - Plugin ecosystem to extend beyond the default plugins we provide.
51
- - CLI support with progress bar and detailed logs.
59
+
60
+ - Works with Node.js 22+ and TypeScript 6.
61
+ - Convert Swagger 2.0, OpenAPI 3.0, and OpenAPI 3.1 to TypeScript types, API clients, and more via the [plugin ecosystem](https://github.com/kubb-labs/kubb-plugins).
62
+ - Extensible plugin and middleware system for customizing and composing code generation.
63
+ - CLI support with interactive setup, progress bar, and detailed logs.
52
64
  - Model Context Protocol (MCP) server for AI assistants like [Claude](https://claude.ai), [Cursor](https://cursor.sh), and other MCP-compatible tools.
53
- - Debug tools with React DevTools.
54
- - Generates barrel files (index.ts).
55
- - And so much more ...
65
+ - JSX-based renderer (`@kubb/renderer-jsx`) for building custom plugin output.
66
+ - Barrel file generation via the `@kubb/middleware-barrel` middleware.
56
67
 
57
68
  ## Supporting Kubb
58
69
 
@@ -149,13 +160,6 @@ Kubb is an open source project with its ongoing development made possible entire
149
160
  <!-- markdownlint-restore -->
150
161
  <!-- prettier-ignore-end -->
151
162
 
152
- <!-- ALL-CONTRIBUTORS-LIST:END -->
153
- <!-- prettier-ignore-start -->
154
- <!-- markdownlint-disable -->
155
-
156
- <!-- markdownlint-restore -->
157
- <!-- prettier-ignore-end -->
158
-
159
163
  <!-- ALL-CONTRIBUTORS-LIST:END -->
160
164
 
161
165
  ## License
@@ -178,7 +182,6 @@ See [LICENSE](./LICENSE) for details.
178
182
  </picture>
179
183
  </a>
180
184
 
181
-
182
185
  <!-- Badges -->
183
186
 
184
187
  [npm-version-src]: https://img.shields.io/npm/v/@kubb/core?flat&colorA=18181B&colorB=f58517