@kubb/renderer-jsx 5.0.0-beta.43 → 5.0.0-beta.45
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/README.md +12 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
### JSX-based renderer for Kubb
|
|
26
26
|
|
|
27
|
-
Provides a
|
|
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.
|
|
28
28
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
|
@@ -41,10 +41,10 @@ npm install @kubb/renderer-jsx
|
|
|
41
41
|
Use the built-in components inside a Kubb plugin to emit generated files:
|
|
42
42
|
|
|
43
43
|
```tsx
|
|
44
|
-
import {
|
|
44
|
+
import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
45
45
|
import { File, Function, Type } from '@kubb/renderer-jsx'
|
|
46
46
|
|
|
47
|
-
const renderer =
|
|
47
|
+
const renderer = jsxRenderer()
|
|
48
48
|
|
|
49
49
|
await renderer.render(
|
|
50
50
|
<File baseName="petStore.ts" path="src/gen/petStore.ts">
|
|
@@ -58,7 +58,6 @@ await renderer.render(
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
const files = renderer.files
|
|
61
|
-
renderer.unmount()
|
|
62
61
|
```
|
|
63
62
|
|
|
64
63
|
## Built-in Components
|
|
@@ -71,24 +70,25 @@ renderer.unmount()
|
|
|
71
70
|
| `<Type>` | Generates a TypeScript type alias |
|
|
72
71
|
| `<Const>` | Generates a `const` variable declaration |
|
|
73
72
|
| `<Jsx>` | Renders JSX expressions inside generated output |
|
|
74
|
-
| `<
|
|
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 |
|
|
75
78
|
|
|
76
79
|
## API
|
|
77
80
|
|
|
78
|
-
### `
|
|
81
|
+
### `jsxRenderer()`
|
|
79
82
|
|
|
80
|
-
Creates a
|
|
83
|
+
Creates a renderer instance with `render`, `files`, and `stream`:
|
|
81
84
|
|
|
82
85
|
```typescript
|
|
83
|
-
const renderer =
|
|
86
|
+
const renderer = jsxRenderer()
|
|
84
87
|
await renderer.render(<MyComponent />)
|
|
85
88
|
const files = renderer.files // FileNode[]
|
|
86
|
-
renderer.unmount()
|
|
87
89
|
```
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
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.
|
|
92
92
|
|
|
93
93
|
## JSX Runtime
|
|
94
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/renderer-jsx",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.45",
|
|
4
4
|
"description": "Self-contained synchronous JSX renderer for Kubb. Turns JSX into FileNodes with built-in components (File, Function, Type, Const) for component-based, type-safe code generation. No React dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"yaml": "^2.9.0",
|
|
78
|
-
"@kubb/ast": "5.0.0-beta.
|
|
78
|
+
"@kubb/ast": "5.0.0-beta.45"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@internals/utils": "0.0.0"
|