@kubb/renderer-jsx 5.0.0-beta.7 → 5.0.0-beta.71
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/LICENSE +17 -10
- package/README.md +37 -27
- package/dist/index.cjs +388 -17919
- package/dist/index.d.ts +248 -165
- package/dist/index.js +373 -17901
- package/dist/jsx-dev-runtime.cjs +3 -10
- package/dist/jsx-dev-runtime.d.ts +4 -8
- package/dist/jsx-dev-runtime.js +1 -9
- package/dist/jsx-runtime.cjs +24 -6
- package/dist/jsx-runtime.d.ts +59 -10
- package/dist/jsx-runtime.js +24 -7
- package/dist/rolldown-runtime-C0LytTxp.js +8 -0
- package/dist/rolldown-runtime-ClG-MNz_.cjs +13 -0
- package/dist/types-OZ23urxc.d.ts +119 -0
- package/dist/types.d.ts +2 -2
- package/package.json +8 -31
- package/dist/chunk-Bb7HlUDG.js +0 -28
- package/dist/jsx-namespace-CNp0arTN.d.ts +0 -39
- package/dist/jsx-runtime-Cvu_ZYgL.js +0 -1448
- package/dist/jsx-runtime-DdmO3p0U.cjs +0 -1503
- package/dist/types-nAFMiWFw.d.ts +0 -168
- package/src/Renderer.ts +0 -182
- package/src/Runtime.tsx +0 -159
- package/src/components/Const.tsx +0 -72
- package/src/components/File.tsx +0 -186
- package/src/components/Function.tsx +0 -152
- package/src/components/Jsx.tsx +0 -34
- package/src/components/Root.tsx +0 -70
- package/src/components/Type.tsx +0 -66
- package/src/constants.ts +0 -28
- package/src/createRenderer.tsx +0 -93
- package/src/dom.ts +0 -105
- package/src/globals.ts +0 -34
- package/src/index.ts +0 -8
- package/src/jsx-dev-runtime.ts +0 -10
- package/src/jsx-namespace.d.ts +0 -52
- package/src/jsx-runtime.ts +0 -12
- package/src/types.ts +0 -207
- package/src/utils.ts +0 -267
package/LICENSE
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This repository contains software under two licenses:
|
|
1
|
+
MIT License
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
MIT License — see licenses/LICENSE-MIT for the full license text.
|
|
3
|
+
Copyright (c) 2026 Stijn Van Hulle
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,17 +1,16 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1>@kubb/renderer-jsx</h1>
|
|
3
2
|
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
|
-
<img
|
|
3
|
+
<img src="https://kubb.dev/og.png" alt="Kubb banner">
|
|
5
4
|
</a>
|
|
6
5
|
|
|
7
6
|
[![npm version][npm-version-src]][npm-version-href]
|
|
8
7
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
|
-
[![
|
|
8
|
+
[![Stars][stars-src]][stars-href]
|
|
10
9
|
[![License][license-src]][license-href]
|
|
11
|
-
[![
|
|
10
|
+
[![Node][node-src]][node-href]
|
|
12
11
|
|
|
13
12
|
<h4>
|
|
14
|
-
<a href="https://kubb.dev
|
|
13
|
+
<a href="https://kubb.dev" target="_blank">Documentation</a>
|
|
15
14
|
<span> · </span>
|
|
16
15
|
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
17
16
|
<span> · </span>
|
|
@@ -19,7 +18,13 @@
|
|
|
19
18
|
</h4>
|
|
20
19
|
</div>
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
<br />
|
|
22
|
+
|
|
23
|
+
# @kubb/renderer-jsx
|
|
24
|
+
|
|
25
|
+
### JSX-based renderer for Kubb
|
|
26
|
+
|
|
27
|
+
Provides a React-free JSX runtime and built-in components (`File`, `Function`, `Type`, `Const`) for component-based, type-safe code generation inside Kubb plugins.
|
|
23
28
|
|
|
24
29
|
## Installation
|
|
25
30
|
|
|
@@ -36,10 +41,10 @@ npm install @kubb/renderer-jsx
|
|
|
36
41
|
Use the built-in components inside a Kubb plugin to emit generated files:
|
|
37
42
|
|
|
38
43
|
```tsx
|
|
39
|
-
import {
|
|
44
|
+
import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
40
45
|
import { File, Function, Type } from '@kubb/renderer-jsx'
|
|
41
46
|
|
|
42
|
-
const renderer =
|
|
47
|
+
const renderer = jsxRenderer()
|
|
43
48
|
|
|
44
49
|
await renderer.render(
|
|
45
50
|
<File baseName="petStore.ts" path="src/gen/petStore.ts">
|
|
@@ -53,7 +58,6 @@ await renderer.render(
|
|
|
53
58
|
)
|
|
54
59
|
|
|
55
60
|
const files = renderer.files
|
|
56
|
-
renderer.unmount()
|
|
57
61
|
```
|
|
58
62
|
|
|
59
63
|
## Built-in Components
|
|
@@ -66,24 +70,25 @@ renderer.unmount()
|
|
|
66
70
|
| `<Type>` | Generates a TypeScript type alias |
|
|
67
71
|
| `<Const>` | Generates a `const` variable declaration |
|
|
68
72
|
| `<Jsx>` | Renders JSX expressions inside generated output |
|
|
69
|
-
| `<
|
|
73
|
+
| `<Callout>` | Generates a callout block in markdown output |
|
|
74
|
+
| `<Frontmatter>` | Generates a frontmatter block in markdown output |
|
|
75
|
+
| `<Heading>` | Generates a heading in markdown output |
|
|
76
|
+
| `<List>` | Generates a list in markdown output |
|
|
77
|
+
| `<Paragraph>` | Generates a paragraph in markdown output |
|
|
70
78
|
|
|
71
79
|
## API
|
|
72
80
|
|
|
73
|
-
### `
|
|
81
|
+
### `jsxRenderer()`
|
|
74
82
|
|
|
75
|
-
Creates a
|
|
83
|
+
Creates a renderer instance with `render`, `files`, and `stream`:
|
|
76
84
|
|
|
77
85
|
```typescript
|
|
78
|
-
const renderer =
|
|
86
|
+
const renderer = jsxRenderer()
|
|
79
87
|
await renderer.render(<MyComponent />)
|
|
80
88
|
const files = renderer.files // FileNode[]
|
|
81
|
-
renderer.unmount()
|
|
82
89
|
```
|
|
83
90
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Pre-built renderer instance for use directly in Kubb plugins as the `jsxRenderer` plugin option.
|
|
91
|
+
Use `stream(element)` instead of `render` to consume files one at a time as they are produced.
|
|
87
92
|
|
|
88
93
|
## JSX Runtime
|
|
89
94
|
|
|
@@ -100,9 +105,10 @@ Pre-built renderer instance for use directly in Kubb plugins as the `jsxRenderer
|
|
|
100
105
|
|
|
101
106
|
## Supporting Kubb
|
|
102
107
|
|
|
103
|
-
Kubb is an open source project
|
|
108
|
+
Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
|
|
104
109
|
|
|
105
110
|
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
111
|
+
- [See sponsorship tiers and our sponsors](https://kubb.dev/sponsors)
|
|
106
112
|
|
|
107
113
|
<p align="center">
|
|
108
114
|
<a href="https://github.com/sponsors/stijnvanhulle">
|
|
@@ -110,15 +116,19 @@ Kubb is an open source project with its ongoing development made possible entire
|
|
|
110
116
|
</a>
|
|
111
117
|
</p>
|
|
112
118
|
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
[MIT](https://github.com/kubb-labs/kubb/blob/main/licenses/LICENSE-MIT)
|
|
122
|
+
|
|
113
123
|
<!-- Badges -->
|
|
114
124
|
|
|
115
|
-
[npm-version-src]: https://
|
|
116
|
-
[npm-version-href]: https://
|
|
117
|
-
[npm-downloads-src]: https://
|
|
118
|
-
[npm-downloads-href]: https://
|
|
119
|
-
[
|
|
125
|
+
[npm-version-src]: https://shieldcn.dev/npm/v/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
126
|
+
[npm-version-href]: https://npmx.dev/package/@kubb/renderer-jsx
|
|
127
|
+
[npm-downloads-src]: https://shieldcn.dev/npm/dm/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
128
|
+
[npm-downloads-href]: https://npmx.dev/package/@kubb/renderer-jsx
|
|
129
|
+
[stars-src]: https://shieldcn.dev/github/stars/kubb-labs/kubb.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
130
|
+
[stars-href]: https://github.com/kubb-labs/kubb
|
|
131
|
+
[license-src]: https://shieldcn.dev/npm/license/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc
|
|
120
132
|
[license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
121
|
-
[
|
|
122
|
-
[
|
|
123
|
-
[sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
|
|
124
|
-
[sponsors-href]: https://github.com/sponsors/stijnvanhulle/
|
|
133
|
+
[node-src]: https://shieldcn.dev/npm/node/@kubb/renderer-jsx.svg?variant=secondary&size=xs&theme=zinc&mode=dark
|
|
134
|
+
[node-href]: https://npmx.dev/package/@kubb/renderer-jsx
|