@kubb/renderer-jsx 5.0.0-beta.75 → 5.0.0-beta.76

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 (47) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +135 -0
  3. package/dist/index.cjs +385 -17926
  4. package/dist/index.d.ts +248 -165
  5. package/dist/index.js +370 -17908
  6. package/dist/jsx-dev-runtime.cjs +3 -10
  7. package/dist/jsx-dev-runtime.d.ts +4 -8
  8. package/dist/jsx-dev-runtime.js +1 -9
  9. package/dist/jsx-runtime.cjs +24 -6
  10. package/dist/jsx-runtime.d.ts +59 -10
  11. package/dist/jsx-runtime.js +24 -7
  12. package/dist/rolldown-runtime-C0LytTxp.js +8 -0
  13. package/dist/rolldown-runtime-ClG-MNz_.cjs +13 -0
  14. package/dist/types-OZ23urxc.d.ts +119 -0
  15. package/dist/types.d.ts +2 -2
  16. package/package.json +8 -37
  17. package/dist/chunk-Bb7HlUDG.js +0 -28
  18. package/dist/index.cjs.map +0 -1
  19. package/dist/index.js.map +0 -1
  20. package/dist/jsx-dev-runtime.cjs.map +0 -1
  21. package/dist/jsx-dev-runtime.js.map +0 -1
  22. package/dist/jsx-namespace-CNp0arTN.d.ts +0 -39
  23. package/dist/jsx-runtime-Cvu_ZYgL.js +0 -1448
  24. package/dist/jsx-runtime-Cvu_ZYgL.js.map +0 -1
  25. package/dist/jsx-runtime-DdmO3p0U.cjs +0 -1503
  26. package/dist/jsx-runtime-DdmO3p0U.cjs.map +0 -1
  27. package/dist/jsx-runtime.cjs.map +0 -1
  28. package/dist/jsx-runtime.js.map +0 -1
  29. package/dist/types-nAFMiWFw.d.ts +0 -168
  30. package/src/Renderer.ts +0 -184
  31. package/src/Runtime.tsx +0 -170
  32. package/src/components/Const.tsx +0 -72
  33. package/src/components/File.tsx +0 -186
  34. package/src/components/Function.tsx +0 -152
  35. package/src/components/Jsx.tsx +0 -34
  36. package/src/components/Root.tsx +0 -70
  37. package/src/components/Type.tsx +0 -66
  38. package/src/constants.ts +0 -28
  39. package/src/createRenderer.tsx +0 -93
  40. package/src/dom.ts +0 -105
  41. package/src/globals.ts +0 -34
  42. package/src/index.ts +0 -8
  43. package/src/jsx-dev-runtime.ts +0 -10
  44. package/src/jsx-namespace.d.ts +0 -52
  45. package/src/jsx-runtime.ts +0 -12
  46. package/src/types.ts +0 -207
  47. package/src/utils.ts +0 -267
package/LICENSE CHANGED
@@ -1,14 +1,21 @@
1
- Copyright (c) 2026 Stijn Van Hulle
2
-
3
- This repository contains software under two licenses:
1
+ MIT License
4
2
 
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.
3
+ Copyright (c) 2026 Stijn Van Hulle
7
4
 
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:
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:
11
11
 
12
- - packages/agent (published as @kubb/agent)
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
13
14
 
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 ADDED
@@ -0,0 +1,135 @@
1
+ <div align="center">
2
+ <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
3
+ <img src="https://kubb.dev/og.png" alt="Kubb banner">
4
+ </a>
5
+
6
+ [![npm version][npm-version-src]][npm-version-href]
7
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
8
+ [![Stars][stars-src]][stars-href]
9
+ [![License][license-src]][license-href]
10
+ [![Node][node-src]][node-href]
11
+
12
+ <h4>
13
+ <a href="https://kubb.dev" target="_blank">Documentation</a>
14
+ <span> · </span>
15
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
16
+ <span> · </span>
17
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
18
+ </h4>
19
+ </div>
20
+
21
+ <br />
22
+
23
+ # @kubb/renderer-jsx
24
+
25
+ ### JSX-based renderer for Kubb
26
+
27
+ Provides a JSX runtime and built-in components (`File`, `Function`, `Type`, `Const`) for component-based, type-safe code generation inside Kubb plugins.
28
+ An alternative for the ast.factory syntax.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ bun add @kubb/renderer-jsx
34
+ # or
35
+ pnpm add @kubb/renderer-jsx
36
+ # or
37
+ npm install @kubb/renderer-jsx
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ Use the built-in components inside a Kubb plugin to emit generated files:
43
+
44
+ ```tsx
45
+ import { jsxRenderer } from '@kubb/renderer-jsx'
46
+ import { File, Function, Type } from '@kubb/renderer-jsx'
47
+
48
+ const renderer = jsxRenderer()
49
+
50
+ await renderer.render(
51
+ <File baseName="petStore.ts" path="src/gen/petStore.ts">
52
+ <File.Source>
53
+ <Type name="Pet">{'{ id: number; name: string }'}</Type>
54
+ <Function name="getPet" async>
55
+ {"return fetch('/pets')"}
56
+ </Function>
57
+ </File.Source>
58
+ </File>,
59
+ )
60
+
61
+ const files = renderer.files
62
+ ```
63
+
64
+ ## Built-in Components
65
+
66
+ | Component | Description |
67
+ | --------------- | --------------------------------------------------------------------------- |
68
+ | `<File>` | Declares a generated output file with its path and optional imports/exports |
69
+ | `<File.Source>` | The source content block inside a `<File>` |
70
+ | `<Function>` | Generates a TypeScript function declaration |
71
+ | `<Type>` | Generates a TypeScript type alias |
72
+ | `<Const>` | Generates a `const` variable declaration |
73
+ | `<Jsx>` | Renders JSX expressions inside generated output |
74
+ | `<Callout>` | Generates a callout block in markdown output |
75
+ | `<Frontmatter>` | Generates a frontmatter block in markdown output |
76
+ | `<Heading>` | Generates a heading in markdown output |
77
+ | `<List>` | Generates a list in markdown output |
78
+ | `<Paragraph>` | Generates a paragraph in markdown output |
79
+
80
+ ## API
81
+
82
+ ### `jsxRenderer()`
83
+
84
+ Creates a renderer instance with `render`, `files`, and `stream`:
85
+
86
+ ```typescript
87
+ const renderer = jsxRenderer()
88
+ await renderer.render(<MyComponent />)
89
+ const files = renderer.files // FileNode[]
90
+ ```
91
+
92
+ Use `stream(element)` instead of `render` to consume files one at a time as they are produced.
93
+
94
+ ## JSX Runtime
95
+
96
+ `@kubb/renderer-jsx` ships its own JSX runtime (`jsx-runtime` and `jsx-dev-runtime`). Configure your `tsconfig.json` to use it:
97
+
98
+ ```json
99
+ {
100
+ "compilerOptions": {
101
+ "jsx": "react-jsx",
102
+ "jsxImportSource": "@kubb/renderer-jsx"
103
+ }
104
+ }
105
+ ```
106
+
107
+ ## Supporting Kubb
108
+
109
+ Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
110
+
111
+ - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
112
+ - [See sponsorship tiers and our sponsors](https://kubb.dev/sponsors)
113
+
114
+ <p align="center">
115
+ <a href="https://github.com/sponsors/stijnvanhulle">
116
+ <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
117
+ </a>
118
+ </p>
119
+
120
+ ## License
121
+
122
+ [MIT](https://github.com/kubb-labs/kubb/blob/main/licenses/LICENSE-MIT)
123
+
124
+ <!-- Badges -->
125
+
126
+ [npm-version-src]: https://shieldcn.dev/npm/v/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc&mode=dark
127
+ [npm-version-href]: https://npmx.dev/package/@kubb/renderer-jsx
128
+ [npm-downloads-src]: https://shieldcn.dev/npm/dm/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc&mode=dark
129
+ [npm-downloads-href]: https://npmx.dev/package/@kubb/renderer-jsx
130
+ [stars-src]: https://shieldcn.dev/github/stars/kubb-labs/kubb.svg?variant=secondary&size=xs&theme=zinc&mode=dark
131
+ [stars-href]: https://github.com/kubb-labs/kubb
132
+ [license-src]: https://shieldcn.dev/npm/license/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc
133
+ [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
134
+ [node-src]: https://shieldcn.dev/npm/node/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc&mode=dark
135
+ [node-href]: https://npmx.dev/package/@kubb/renderer-jsx