@kubb/renderer-jsx 5.0.0-beta.25 → 5.0.0-beta.27
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/dist/index.d.ts +2 -2
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/{jsx-namespace-BW3LepJB.d.ts → jsx-namespace-D_TStJE_.d.ts} +2 -2
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/{types-ChkUbtyQ.d.ts → types-Cur_nGCL.d.ts} +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
- package/src/Runtime.tsx +1 -1
- package/src/SyncRuntime.tsx +11 -11
- package/src/components/Function.tsx +1 -1
- package/src/types.ts +1 -1
- package/src/utils.ts +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-Bb7HlUDG.js";
|
|
2
|
-
import { a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key } from "./types-
|
|
2
|
+
import { a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key } from "./types-Cur_nGCL.js";
|
|
3
3
|
import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast";
|
|
4
4
|
import * as _$react from "react";
|
|
5
5
|
|
|
@@ -452,7 +452,7 @@ type Props$4 = {
|
|
|
452
452
|
* @example Multiple generics
|
|
453
453
|
* `generics: ['TData', 'TError = unknown']`
|
|
454
454
|
*/
|
|
455
|
-
generics?: string | string
|
|
455
|
+
generics?: string | Array<string> | null;
|
|
456
456
|
/**
|
|
457
457
|
* TypeScript return type annotation written verbatim after `:`.
|
|
458
458
|
* When `async` is `true`, the value is automatically wrapped in `Promise<…>`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-Bb7HlUDG.js";
|
|
2
|
-
import { h as KubbReactNode, m as KubbReactElement } from "./types-
|
|
3
|
-
import { t as JSX } from "./jsx-namespace-
|
|
2
|
+
import { h as KubbReactNode, m as KubbReactElement } from "./types-Cur_nGCL.js";
|
|
3
|
+
import { t as JSX } from "./jsx-namespace-D_TStJE_.js";
|
|
4
4
|
import * as _$react from "react";
|
|
5
5
|
import * as React$1 from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-Bb7HlUDG.js";
|
|
2
|
-
import { _ as KubbTextProps, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, l as KubbExportProps, m as KubbReactElement, p as KubbJsxProps, s as KubbArrowFunctionProps, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-
|
|
2
|
+
import { _ as KubbTextProps, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, l as KubbExportProps, m as KubbReactElement, p as KubbJsxProps, s as KubbArrowFunctionProps, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-Cur_nGCL.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/jsx-namespace.d.ts
|
|
@@ -36,4 +36,4 @@ declare namespace JSX$1 {
|
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
38
|
export { JSX$1 as t };
|
|
39
|
-
//# sourceMappingURL=jsx-namespace-
|
|
39
|
+
//# sourceMappingURL=jsx-namespace-D_TStJE_.d.ts.map
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-Bb7HlUDG.js";
|
|
2
|
-
import { h as KubbReactNode, m as KubbReactElement } from "./types-
|
|
3
|
-
import { t as JSX } from "./jsx-namespace-
|
|
2
|
+
import { h as KubbReactNode, m as KubbReactElement } from "./types-Cur_nGCL.js";
|
|
3
|
+
import { t as JSX } from "./jsx-namespace-D_TStJE_.js";
|
|
4
4
|
import * as _$react from "react";
|
|
5
5
|
import * as React$1 from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -51,7 +51,7 @@ type DOMElement = {
|
|
|
51
51
|
/**
|
|
52
52
|
* Ordered list of child nodes attached to this element.
|
|
53
53
|
*/
|
|
54
|
-
childNodes: DOMNode
|
|
54
|
+
childNodes: Array<DOMNode>;
|
|
55
55
|
internal_transform?: OutputTransformer;
|
|
56
56
|
isStaticDirty?: boolean;
|
|
57
57
|
staticNode?: DOMElement;
|
|
@@ -166,4 +166,4 @@ type JSDoc = {
|
|
|
166
166
|
};
|
|
167
167
|
//#endregion
|
|
168
168
|
export { KubbTextProps as _, JSDoc as a, TextNode as b, KubbConstProps as c, KubbFunctionProps as d, KubbImportProps as f, KubbSourceProps as g, KubbReactNode as h, ElementNames as i, KubbExportProps as l, KubbReactElement as m, DOMNode as n, Key as o, KubbJsxProps as p, DOMNodeAttribute as r, KubbArrowFunctionProps as s, DOMElement as t, KubbFileProps as u, KubbTypeProps as v, LineBreakProps as y };
|
|
169
|
-
//# sourceMappingURL=types-
|
|
169
|
+
//# sourceMappingURL=types-Cur_nGCL.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as KubbTextProps, a as JSDoc, b as TextNode, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, i as ElementNames, l as KubbExportProps, m as KubbReactElement, n as DOMNode, o as Key, p as KubbJsxProps, r as DOMNodeAttribute, s as KubbArrowFunctionProps, t as DOMElement, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-
|
|
1
|
+
import { _ as KubbTextProps, a as JSDoc, b as TextNode, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, i as ElementNames, l as KubbExportProps, m as KubbReactElement, n as DOMNode, o as Key, p as KubbJsxProps, r as DOMNodeAttribute, s as KubbArrowFunctionProps, t as DOMElement, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-Cur_nGCL.js";
|
|
2
2
|
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbArrowFunctionProps, KubbConstProps, KubbExportProps, KubbFileProps, KubbFunctionProps, KubbImportProps, KubbJsxProps, KubbReactElement, KubbReactNode, KubbSourceProps, KubbTextProps, KubbTypeProps, LineBreakProps, TextNode };
|
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.27",
|
|
4
4
|
"description": "JSX-based renderer for Kubb. Provides a custom React runtime, reconciler, and built-in components (File, Function, Type, Const) for component-based, type-safe code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"registry": "https://registry.npmjs.org/"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"yaml": "^2.
|
|
79
|
-
"@kubb/ast": "5.0.0-beta.
|
|
78
|
+
"yaml": "^2.9.0",
|
|
79
|
+
"@kubb/ast": "5.0.0-beta.27"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/react": "^19.2.14",
|
package/src/Runtime.tsx
CHANGED
package/src/SyncRuntime.tsx
CHANGED
|
@@ -60,13 +60,13 @@ function toBool(val: unknown): boolean {
|
|
|
60
60
|
return (val ?? false) as boolean
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function collectCodeNodes(props: Record<string, unknown>): CodeNode
|
|
64
|
-
const nodes: CodeNode
|
|
63
|
+
function collectCodeNodes(props: Record<string, unknown>): Array<CodeNode> {
|
|
64
|
+
const nodes: Array<CodeNode> = []
|
|
65
65
|
collectCode(props['children'], nodes)
|
|
66
66
|
return nodes
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function collectCode(element: unknown, nodes: CodeNode
|
|
69
|
+
function collectCode(element: unknown, nodes: Array<CodeNode>): void {
|
|
70
70
|
walkElement(
|
|
71
71
|
element,
|
|
72
72
|
(text) => {
|
|
@@ -76,7 +76,7 @@ function collectCode(element: unknown, nodes: CodeNode[]): void {
|
|
|
76
76
|
)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: CodeNode
|
|
79
|
+
function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Array<CodeNode>): void {
|
|
80
80
|
if (type === 'br') {
|
|
81
81
|
nodes.push(createBreak())
|
|
82
82
|
return
|
|
@@ -103,7 +103,7 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Co
|
|
|
103
103
|
export: props['export'] as boolean | null | undefined,
|
|
104
104
|
default: props['default'] as boolean | null | undefined,
|
|
105
105
|
async: props['async'] as boolean | null | undefined,
|
|
106
|
-
generics: props['generics'] as string | string
|
|
106
|
+
generics: props['generics'] as string | Array<string> | null | undefined,
|
|
107
107
|
returnType: props['returnType'] as string | null | undefined,
|
|
108
108
|
JSDoc: props['JSDoc'] as JSDocNode | null | undefined,
|
|
109
109
|
nodes: collectCodeNodes(props),
|
|
@@ -120,7 +120,7 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Co
|
|
|
120
120
|
export: props['export'] as boolean | null | undefined,
|
|
121
121
|
default: props['default'] as boolean | null | undefined,
|
|
122
122
|
async: props['async'] as boolean | null | undefined,
|
|
123
|
-
generics: props['generics'] as string | string
|
|
123
|
+
generics: props['generics'] as string | Array<string> | null | undefined,
|
|
124
124
|
returnType: props['returnType'] as string | null | undefined,
|
|
125
125
|
singleLine: props['singleLine'] as boolean | null | undefined,
|
|
126
126
|
JSDoc: props['JSDoc'] as JSDocNode | null | undefined,
|
|
@@ -157,12 +157,12 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Co
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
type FileChildren = { sources: SourceNode
|
|
160
|
+
type FileChildren = { sources: Array<SourceNode>; exports: Array<ExportNode>; imports: Array<ImportNode> }
|
|
161
161
|
|
|
162
162
|
function collectFileChildren(element: unknown): FileChildren {
|
|
163
|
-
const sources: SourceNode
|
|
164
|
-
const exports: ExportNode
|
|
165
|
-
const imports: ImportNode
|
|
163
|
+
const sources: Array<SourceNode> = []
|
|
164
|
+
const exports: Array<ExportNode> = []
|
|
165
|
+
const imports: Array<ImportNode> = []
|
|
166
166
|
|
|
167
167
|
walkElement(
|
|
168
168
|
element,
|
|
@@ -278,7 +278,7 @@ export class SyncRuntime {
|
|
|
278
278
|
/**
|
|
279
279
|
* Accumulated {@link FileNode} results from every {@link render} call.
|
|
280
280
|
*/
|
|
281
|
-
nodes: FileNode
|
|
281
|
+
nodes: Array<FileNode> = []
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
284
|
* Walks `element` synchronously, converts every `<kubb-file>` subtree into
|
|
@@ -46,7 +46,7 @@ type Props = {
|
|
|
46
46
|
* @example Multiple generics
|
|
47
47
|
* `generics: ['TData', 'TError = unknown']`
|
|
48
48
|
*/
|
|
49
|
-
generics?: string | string
|
|
49
|
+
generics?: string | Array<string> | null
|
|
50
50
|
/**
|
|
51
51
|
* TypeScript return type annotation written verbatim after `:`.
|
|
52
52
|
* When `async` is `true`, the value is automatically wrapped in `Promise<…>`.
|
package/src/types.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -37,8 +37,8 @@ function toBool(val: unknown): boolean {
|
|
|
37
37
|
* `kubb-type`, and similar elements are converted into their respective {@link CodeNode}s.
|
|
38
38
|
* Any unrecognized element names are silently skipped.
|
|
39
39
|
*/
|
|
40
|
-
function collectCodeNodes(element: DOMElement): CodeNode
|
|
41
|
-
const result: CodeNode
|
|
40
|
+
function collectCodeNodes(element: DOMElement): Array<CodeNode> {
|
|
41
|
+
const result: Array<CodeNode> = []
|
|
42
42
|
|
|
43
43
|
for (const child of element.childNodes) {
|
|
44
44
|
if (!child) continue
|
|
@@ -63,7 +63,7 @@ function collectCodeNodes(element: DOMElement): CodeNode[] {
|
|
|
63
63
|
export: attrs['export'] as boolean | null | undefined,
|
|
64
64
|
default: attrs['default'] as boolean | null | undefined,
|
|
65
65
|
async: attrs['async'] as boolean | null | undefined,
|
|
66
|
-
generics: attrs['generics'] as string | string
|
|
66
|
+
generics: attrs['generics'] as string | Array<string> | null | undefined,
|
|
67
67
|
returnType: attrs['returnType'] as string | null | undefined,
|
|
68
68
|
JSDoc: attrs['JSDoc'] as JSDocNode | null | undefined,
|
|
69
69
|
nodes: collectCodeNodes(child),
|
|
@@ -81,7 +81,7 @@ function collectCodeNodes(element: DOMElement): CodeNode[] {
|
|
|
81
81
|
export: attrs['export'] as boolean | null | undefined,
|
|
82
82
|
default: attrs['default'] as boolean | null | undefined,
|
|
83
83
|
async: attrs['async'] as boolean | null | undefined,
|
|
84
|
-
generics: attrs['generics'] as string | string
|
|
84
|
+
generics: attrs['generics'] as string | Array<string> | null | undefined,
|
|
85
85
|
returnType: attrs['returnType'] as string | null | undefined,
|
|
86
86
|
singleLine: attrs['singleLine'] as boolean | null | undefined,
|
|
87
87
|
JSDoc: attrs['JSDoc'] as JSDocNode | null | undefined,
|
|
@@ -187,9 +187,9 @@ function* collectFileEntries(node: DOMElement): Generator<SourceNode | ExportNod
|
|
|
187
187
|
* node by its `.kind`.
|
|
188
188
|
*/
|
|
189
189
|
function createFileNode(child: DOMElement): FileNode {
|
|
190
|
-
const sources: SourceNode
|
|
191
|
-
const exports: ExportNode
|
|
192
|
-
const imports: ImportNode
|
|
190
|
+
const sources: Array<SourceNode> = []
|
|
191
|
+
const exports: Array<ExportNode> = []
|
|
192
|
+
const imports: Array<ImportNode> = []
|
|
193
193
|
|
|
194
194
|
for (const node of collectFileEntries(child)) {
|
|
195
195
|
if (node.kind === 'Source') {
|
|
@@ -241,6 +241,6 @@ export function* streamFiles(node: DOMElement): Generator<FileNode> {
|
|
|
241
241
|
* Returns the list of file nodes in document order. Nested files are supported;
|
|
242
242
|
* the walker descends into non-file elements and recurses through them.
|
|
243
243
|
*/
|
|
244
|
-
export function collectFiles(node: DOMElement): FileNode
|
|
244
|
+
export function collectFiles(node: DOMElement): Array<FileNode> {
|
|
245
245
|
return [...streamFiles(node)]
|
|
246
246
|
}
|