@kubb/renderer-jsx 5.0.0-beta.84 → 5.0.0-beta.85
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.cjs +14 -41
- package/dist/index.d.ts +16 -26
- package/dist/index.js +14 -41
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-runtime.d.ts +35 -11
- package/dist/types-1dqfG_Fl.d.ts +45 -0
- package/dist/types.d.ts +2 -2
- package/package.json +2 -2
- package/dist/types-OZ23urxc.d.ts +0 -119
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ require("./rolldown-runtime-ClG-MNz_.cjs");
|
|
|
3
3
|
const require_jsx_runtime = require("./jsx-runtime.cjs");
|
|
4
4
|
let yaml = require("yaml");
|
|
5
5
|
let _kubb_ast = require("@kubb/ast");
|
|
6
|
-
//#region src/components/Callout.tsx
|
|
6
|
+
//#region src/components/md/Callout.tsx
|
|
7
7
|
const CALLOUT_LABEL = {
|
|
8
8
|
tip: "TIP",
|
|
9
9
|
note: "NOTE",
|
|
@@ -37,7 +37,7 @@ function Callout({ type, title, children }) {
|
|
|
37
37
|
}
|
|
38
38
|
Callout.displayName = "Callout";
|
|
39
39
|
//#endregion
|
|
40
|
-
//#region src/components/Const.tsx
|
|
40
|
+
//#region src/components/js/Const.tsx
|
|
41
41
|
/**
|
|
42
42
|
* Generates a TypeScript constant declaration.
|
|
43
43
|
*
|
|
@@ -191,7 +191,7 @@ File.Export = FileExport;
|
|
|
191
191
|
File.Import = FileImport;
|
|
192
192
|
File.Source = FileSource;
|
|
193
193
|
//#endregion
|
|
194
|
-
//#region src/components/Frontmatter.tsx
|
|
194
|
+
//#region src/components/md/Frontmatter.tsx
|
|
195
195
|
/**
|
|
196
196
|
* Emits a YAML frontmatter envelope at the top of a generated markdown file.
|
|
197
197
|
*
|
|
@@ -217,7 +217,7 @@ function Frontmatter({ data }) {
|
|
|
217
217
|
}
|
|
218
218
|
Frontmatter.displayName = "Frontmatter";
|
|
219
219
|
//#endregion
|
|
220
|
-
//#region src/components/Function.tsx
|
|
220
|
+
//#region src/components/js/Function.tsx
|
|
221
221
|
/**
|
|
222
222
|
* Generates a TypeScript function declaration.
|
|
223
223
|
*
|
|
@@ -277,7 +277,7 @@ function ArrowFunction({ children, ...props }) {
|
|
|
277
277
|
ArrowFunction.displayName = "ArrowFunction";
|
|
278
278
|
Function.Arrow = ArrowFunction;
|
|
279
279
|
//#endregion
|
|
280
|
-
//#region src/components/Heading.tsx
|
|
280
|
+
//#region src/components/md/Heading.tsx
|
|
281
281
|
/**
|
|
282
282
|
* Renders an ATX-style markdown heading.
|
|
283
283
|
*
|
|
@@ -298,7 +298,7 @@ function Heading({ level, children }) {
|
|
|
298
298
|
}
|
|
299
299
|
Heading.displayName = "Heading";
|
|
300
300
|
//#endregion
|
|
301
|
-
//#region src/components/Jsx.tsx
|
|
301
|
+
//#region src/components/jsx/Jsx.tsx
|
|
302
302
|
/**
|
|
303
303
|
* Embeds a raw JSX string verbatim in the generated source code.
|
|
304
304
|
*
|
|
@@ -319,7 +319,7 @@ function Jsx({ children }) {
|
|
|
319
319
|
}
|
|
320
320
|
Jsx.displayName = "Jsx";
|
|
321
321
|
//#endregion
|
|
322
|
-
//#region src/components/List.tsx
|
|
322
|
+
//#region src/components/md/List.tsx
|
|
323
323
|
/**
|
|
324
324
|
* Renders a markdown list.
|
|
325
325
|
*
|
|
@@ -345,7 +345,7 @@ function List({ ordered, items }) {
|
|
|
345
345
|
}
|
|
346
346
|
List.displayName = "List";
|
|
347
347
|
//#endregion
|
|
348
|
-
//#region src/components/Paragraph.tsx
|
|
348
|
+
//#region src/components/md/Paragraph.tsx
|
|
349
349
|
/**
|
|
350
350
|
* Renders a markdown paragraph.
|
|
351
351
|
*
|
|
@@ -366,7 +366,7 @@ function Paragraph({ children }) {
|
|
|
366
366
|
}
|
|
367
367
|
Paragraph.displayName = "Paragraph";
|
|
368
368
|
//#endregion
|
|
369
|
-
//#region src/components/Type.tsx
|
|
369
|
+
//#region src/components/js/Type.tsx
|
|
370
370
|
/**
|
|
371
371
|
* Generates a TypeScript type alias declaration.
|
|
372
372
|
*
|
|
@@ -400,7 +400,7 @@ function Type({ children, ...props }) {
|
|
|
400
400
|
}
|
|
401
401
|
Type.displayName = "Type";
|
|
402
402
|
//#endregion
|
|
403
|
-
//#region src/
|
|
403
|
+
//#region src/Runtime.tsx
|
|
404
404
|
/**
|
|
405
405
|
* Walks `element`, resolving arrays, Fragments, and function components, then
|
|
406
406
|
* calls `onText` for primitive values and `onHost` for each host element.
|
|
@@ -595,7 +595,7 @@ function* walkFiles(element) {
|
|
|
595
595
|
* All components must be pure functions. Hooks and class components are not
|
|
596
596
|
* supported.
|
|
597
597
|
*/
|
|
598
|
-
var
|
|
598
|
+
var Runtime = class {
|
|
599
599
|
/**
|
|
600
600
|
* Accumulated {@link FileNode} results from every {@link render} call.
|
|
601
601
|
*/
|
|
@@ -608,24 +608,9 @@ var SyncRuntime = class {
|
|
|
608
608
|
render(element) {
|
|
609
609
|
for (const file of walkFiles(element)) this.nodes.push(file);
|
|
610
610
|
}
|
|
611
|
-
/**
|
|
612
|
-
* Walks `element` synchronously and yields each {@link FileNode} as it is
|
|
613
|
-
* produced, without buffering into an intermediate array first. Callers can
|
|
614
|
-
* begin processing each file before the rest of the element tree is traversed.
|
|
615
|
-
*
|
|
616
|
-
* @example
|
|
617
|
-
* ```ts
|
|
618
|
-
* for (const file of runtime.stream(element)) {
|
|
619
|
-
* await writeFile(file)
|
|
620
|
-
* }
|
|
621
|
-
* ```
|
|
622
|
-
*/
|
|
623
|
-
*stream(element) {
|
|
624
|
-
yield* walkFiles(element);
|
|
625
|
-
}
|
|
626
611
|
};
|
|
627
612
|
//#endregion
|
|
628
|
-
//#region src/
|
|
613
|
+
//#region src/jsxRenderer.tsx
|
|
629
614
|
/**
|
|
630
615
|
* Factory for a renderer that walks the JSX tree in a single recursive pass,
|
|
631
616
|
* with no React reconciler or scheduler. Pass it as the `renderer` property on
|
|
@@ -633,8 +618,7 @@ var SyncRuntime = class {
|
|
|
633
618
|
* generic, with no hard dependency on `@kubb/renderer-jsx`.
|
|
634
619
|
*
|
|
635
620
|
* Every component must be a pure function. Hooks, suspense, and class
|
|
636
|
-
* components are not supported.
|
|
637
|
-
* for incremental file emission.
|
|
621
|
+
* components are not supported.
|
|
638
622
|
*
|
|
639
623
|
* @example Wire up a JSX generator
|
|
640
624
|
* ```tsx
|
|
@@ -653,17 +637,9 @@ var SyncRuntime = class {
|
|
|
653
637
|
* },
|
|
654
638
|
* })
|
|
655
639
|
* ```
|
|
656
|
-
*
|
|
657
|
-
* @example Stream files as they are produced
|
|
658
|
-
* ```tsx
|
|
659
|
-
* const renderer = jsxRenderer()
|
|
660
|
-
* for (const file of renderer.stream(element)) {
|
|
661
|
-
* await writeFile(file.path, file.sources[0])
|
|
662
|
-
* }
|
|
663
|
-
* ```
|
|
664
640
|
*/
|
|
665
641
|
const jsxRenderer = () => {
|
|
666
|
-
const runtime = new
|
|
642
|
+
const runtime = new Runtime();
|
|
667
643
|
return {
|
|
668
644
|
async render(element) {
|
|
669
645
|
runtime.render(element);
|
|
@@ -671,9 +647,6 @@ const jsxRenderer = () => {
|
|
|
671
647
|
get files() {
|
|
672
648
|
return runtime.nodes;
|
|
673
649
|
},
|
|
674
|
-
stream(element) {
|
|
675
|
-
return runtime.stream(element);
|
|
676
|
-
},
|
|
677
650
|
[Symbol.dispose]() {}
|
|
678
651
|
};
|
|
679
652
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import {
|
|
3
|
-
import { ExportNode,
|
|
2
|
+
import { i as KubbReactNode, n as Key, r as KubbReactElement, t as JSDoc } from "./types-1dqfG_Fl.js";
|
|
3
|
+
import { ExportNode, ImportNode, SourceNode } from "@kubb/ast";
|
|
4
4
|
|
|
5
|
-
//#region src/components/Callout.d.ts
|
|
5
|
+
//#region src/components/md/Callout.d.ts
|
|
6
6
|
declare const CALLOUT_LABEL: {
|
|
7
7
|
readonly tip: "TIP";
|
|
8
8
|
readonly note: "NOTE";
|
|
@@ -53,7 +53,7 @@ declare namespace Callout {
|
|
|
53
53
|
var displayName: string;
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region src/components/Const.d.ts
|
|
56
|
+
//#region src/components/js/Const.d.ts
|
|
57
57
|
type ConstProps = {
|
|
58
58
|
key?: Key;
|
|
59
59
|
/**
|
|
@@ -155,12 +155,12 @@ type Props$6<TMeta> = BaseProps & {
|
|
|
155
155
|
meta?: TMeta | null;
|
|
156
156
|
/**
|
|
157
157
|
* Text prepended to the generated file content before any source blocks.
|
|
158
|
-
* Accepts `null` so `resolver.
|
|
158
|
+
* Accepts `null` so `resolver.default.banner()` results can be passed directly.
|
|
159
159
|
*/
|
|
160
160
|
banner?: string | null;
|
|
161
161
|
/**
|
|
162
162
|
* Text appended to the generated file content after all source blocks.
|
|
163
|
-
* Accepts `null` so `resolver.
|
|
163
|
+
* Accepts `null` so `resolver.default.footer()` results can be passed directly.
|
|
164
164
|
*/
|
|
165
165
|
footer?: string | null;
|
|
166
166
|
/**
|
|
@@ -290,7 +290,7 @@ declare namespace FileImport {
|
|
|
290
290
|
var displayName: string;
|
|
291
291
|
}
|
|
292
292
|
//#endregion
|
|
293
|
-
//#region src/components/Frontmatter.d.ts
|
|
293
|
+
//#region src/components/md/Frontmatter.d.ts
|
|
294
294
|
type Props$5 = {
|
|
295
295
|
key?: Key;
|
|
296
296
|
/**
|
|
@@ -325,7 +325,7 @@ declare namespace Frontmatter {
|
|
|
325
325
|
var displayName: string;
|
|
326
326
|
}
|
|
327
327
|
//#endregion
|
|
328
|
-
//#region src/components/Function.d.ts
|
|
328
|
+
//#region src/components/js/Function.d.ts
|
|
329
329
|
type Props$4 = {
|
|
330
330
|
key?: Key;
|
|
331
331
|
/**
|
|
@@ -438,7 +438,7 @@ declare namespace ArrowFunction {
|
|
|
438
438
|
var displayName: string;
|
|
439
439
|
}
|
|
440
440
|
//#endregion
|
|
441
|
-
//#region src/components/Heading.d.ts
|
|
441
|
+
//#region src/components/md/Heading.d.ts
|
|
442
442
|
type Level = 1 | 2 | 3 | 4 | 5 | 6;
|
|
443
443
|
type Props$3 = {
|
|
444
444
|
key?: Key;
|
|
@@ -472,7 +472,7 @@ declare namespace Heading {
|
|
|
472
472
|
var displayName: string;
|
|
473
473
|
}
|
|
474
474
|
//#endregion
|
|
475
|
-
//#region src/components/Jsx.d.ts
|
|
475
|
+
//#region src/components/jsx/Jsx.d.ts
|
|
476
476
|
type Props$2 = {
|
|
477
477
|
/**
|
|
478
478
|
* Raw JSX string embedded verbatim in the generated code, including
|
|
@@ -507,7 +507,7 @@ declare namespace Jsx {
|
|
|
507
507
|
var displayName: string;
|
|
508
508
|
}
|
|
509
509
|
//#endregion
|
|
510
|
-
//#region src/components/List.d.ts
|
|
510
|
+
//#region src/components/md/List.d.ts
|
|
511
511
|
type Props$1 = {
|
|
512
512
|
key?: Key;
|
|
513
513
|
/**
|
|
@@ -547,7 +547,7 @@ declare namespace List {
|
|
|
547
547
|
var displayName: string;
|
|
548
548
|
}
|
|
549
549
|
//#endregion
|
|
550
|
-
//#region src/components/Paragraph.d.ts
|
|
550
|
+
//#region src/components/md/Paragraph.d.ts
|
|
551
551
|
type Props = {
|
|
552
552
|
key?: Key;
|
|
553
553
|
/**
|
|
@@ -575,7 +575,7 @@ declare namespace Paragraph {
|
|
|
575
575
|
var displayName: string;
|
|
576
576
|
}
|
|
577
577
|
//#endregion
|
|
578
|
-
//#region src/components/Type.d.ts
|
|
578
|
+
//#region src/components/js/Type.d.ts
|
|
579
579
|
type TypeProps = {
|
|
580
580
|
key?: Key;
|
|
581
581
|
/**
|
|
@@ -631,7 +631,7 @@ declare namespace Type {
|
|
|
631
631
|
var displayName: string;
|
|
632
632
|
}
|
|
633
633
|
//#endregion
|
|
634
|
-
//#region src/
|
|
634
|
+
//#region src/jsxRenderer.d.ts
|
|
635
635
|
/**
|
|
636
636
|
* Factory for a renderer that walks the JSX tree in a single recursive pass,
|
|
637
637
|
* with no React reconciler or scheduler. Pass it as the `renderer` property on
|
|
@@ -639,8 +639,7 @@ declare namespace Type {
|
|
|
639
639
|
* generic, with no hard dependency on `@kubb/renderer-jsx`.
|
|
640
640
|
*
|
|
641
641
|
* Every component must be a pure function. Hooks, suspense, and class
|
|
642
|
-
* components are not supported.
|
|
643
|
-
* for incremental file emission.
|
|
642
|
+
* components are not supported.
|
|
644
643
|
*
|
|
645
644
|
* @example Wire up a JSX generator
|
|
646
645
|
* ```tsx
|
|
@@ -659,19 +658,10 @@ declare namespace Type {
|
|
|
659
658
|
* },
|
|
660
659
|
* })
|
|
661
660
|
* ```
|
|
662
|
-
*
|
|
663
|
-
* @example Stream files as they are produced
|
|
664
|
-
* ```tsx
|
|
665
|
-
* const renderer = jsxRenderer()
|
|
666
|
-
* for (const file of renderer.stream(element)) {
|
|
667
|
-
* await writeFile(file.path, file.sources[0])
|
|
668
|
-
* }
|
|
669
|
-
* ```
|
|
670
661
|
*/
|
|
671
662
|
declare const jsxRenderer: () => {
|
|
672
663
|
render(element: KubbReactElement): Promise<void>;
|
|
673
|
-
readonly files: FileNode[];
|
|
674
|
-
stream(element: KubbReactElement): Generator<FileNode>;
|
|
664
|
+
readonly files: import("@kubb/ast").FileNode[];
|
|
675
665
|
[Symbol.dispose](): void;
|
|
676
666
|
};
|
|
677
667
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "./rolldown-runtime-C0LytTxp.js";
|
|
|
2
2
|
import { Fragment, jsx } from "./jsx-runtime.js";
|
|
3
3
|
import { stringify } from "yaml";
|
|
4
4
|
import { ast } from "@kubb/ast";
|
|
5
|
-
//#region src/components/Callout.tsx
|
|
5
|
+
//#region src/components/md/Callout.tsx
|
|
6
6
|
const CALLOUT_LABEL = {
|
|
7
7
|
tip: "TIP",
|
|
8
8
|
note: "NOTE",
|
|
@@ -36,7 +36,7 @@ function Callout({ type, title, children }) {
|
|
|
36
36
|
}
|
|
37
37
|
Callout.displayName = "Callout";
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region src/components/Const.tsx
|
|
39
|
+
//#region src/components/js/Const.tsx
|
|
40
40
|
/**
|
|
41
41
|
* Generates a TypeScript constant declaration.
|
|
42
42
|
*
|
|
@@ -190,7 +190,7 @@ File.Export = FileExport;
|
|
|
190
190
|
File.Import = FileImport;
|
|
191
191
|
File.Source = FileSource;
|
|
192
192
|
//#endregion
|
|
193
|
-
//#region src/components/Frontmatter.tsx
|
|
193
|
+
//#region src/components/md/Frontmatter.tsx
|
|
194
194
|
/**
|
|
195
195
|
* Emits a YAML frontmatter envelope at the top of a generated markdown file.
|
|
196
196
|
*
|
|
@@ -216,7 +216,7 @@ function Frontmatter({ data }) {
|
|
|
216
216
|
}
|
|
217
217
|
Frontmatter.displayName = "Frontmatter";
|
|
218
218
|
//#endregion
|
|
219
|
-
//#region src/components/Function.tsx
|
|
219
|
+
//#region src/components/js/Function.tsx
|
|
220
220
|
/**
|
|
221
221
|
* Generates a TypeScript function declaration.
|
|
222
222
|
*
|
|
@@ -276,7 +276,7 @@ function ArrowFunction({ children, ...props }) {
|
|
|
276
276
|
ArrowFunction.displayName = "ArrowFunction";
|
|
277
277
|
Function.Arrow = ArrowFunction;
|
|
278
278
|
//#endregion
|
|
279
|
-
//#region src/components/Heading.tsx
|
|
279
|
+
//#region src/components/md/Heading.tsx
|
|
280
280
|
/**
|
|
281
281
|
* Renders an ATX-style markdown heading.
|
|
282
282
|
*
|
|
@@ -297,7 +297,7 @@ function Heading({ level, children }) {
|
|
|
297
297
|
}
|
|
298
298
|
Heading.displayName = "Heading";
|
|
299
299
|
//#endregion
|
|
300
|
-
//#region src/components/Jsx.tsx
|
|
300
|
+
//#region src/components/jsx/Jsx.tsx
|
|
301
301
|
/**
|
|
302
302
|
* Embeds a raw JSX string verbatim in the generated source code.
|
|
303
303
|
*
|
|
@@ -318,7 +318,7 @@ function Jsx({ children }) {
|
|
|
318
318
|
}
|
|
319
319
|
Jsx.displayName = "Jsx";
|
|
320
320
|
//#endregion
|
|
321
|
-
//#region src/components/List.tsx
|
|
321
|
+
//#region src/components/md/List.tsx
|
|
322
322
|
/**
|
|
323
323
|
* Renders a markdown list.
|
|
324
324
|
*
|
|
@@ -344,7 +344,7 @@ function List({ ordered, items }) {
|
|
|
344
344
|
}
|
|
345
345
|
List.displayName = "List";
|
|
346
346
|
//#endregion
|
|
347
|
-
//#region src/components/Paragraph.tsx
|
|
347
|
+
//#region src/components/md/Paragraph.tsx
|
|
348
348
|
/**
|
|
349
349
|
* Renders a markdown paragraph.
|
|
350
350
|
*
|
|
@@ -365,7 +365,7 @@ function Paragraph({ children }) {
|
|
|
365
365
|
}
|
|
366
366
|
Paragraph.displayName = "Paragraph";
|
|
367
367
|
//#endregion
|
|
368
|
-
//#region src/components/Type.tsx
|
|
368
|
+
//#region src/components/js/Type.tsx
|
|
369
369
|
/**
|
|
370
370
|
* Generates a TypeScript type alias declaration.
|
|
371
371
|
*
|
|
@@ -399,7 +399,7 @@ function Type({ children, ...props }) {
|
|
|
399
399
|
}
|
|
400
400
|
Type.displayName = "Type";
|
|
401
401
|
//#endregion
|
|
402
|
-
//#region src/
|
|
402
|
+
//#region src/Runtime.tsx
|
|
403
403
|
/**
|
|
404
404
|
* Walks `element`, resolving arrays, Fragments, and function components, then
|
|
405
405
|
* calls `onText` for primitive values and `onHost` for each host element.
|
|
@@ -594,7 +594,7 @@ function* walkFiles(element) {
|
|
|
594
594
|
* All components must be pure functions. Hooks and class components are not
|
|
595
595
|
* supported.
|
|
596
596
|
*/
|
|
597
|
-
var
|
|
597
|
+
var Runtime = class {
|
|
598
598
|
/**
|
|
599
599
|
* Accumulated {@link FileNode} results from every {@link render} call.
|
|
600
600
|
*/
|
|
@@ -607,24 +607,9 @@ var SyncRuntime = class {
|
|
|
607
607
|
render(element) {
|
|
608
608
|
for (const file of walkFiles(element)) this.nodes.push(file);
|
|
609
609
|
}
|
|
610
|
-
/**
|
|
611
|
-
* Walks `element` synchronously and yields each {@link FileNode} as it is
|
|
612
|
-
* produced, without buffering into an intermediate array first. Callers can
|
|
613
|
-
* begin processing each file before the rest of the element tree is traversed.
|
|
614
|
-
*
|
|
615
|
-
* @example
|
|
616
|
-
* ```ts
|
|
617
|
-
* for (const file of runtime.stream(element)) {
|
|
618
|
-
* await writeFile(file)
|
|
619
|
-
* }
|
|
620
|
-
* ```
|
|
621
|
-
*/
|
|
622
|
-
*stream(element) {
|
|
623
|
-
yield* walkFiles(element);
|
|
624
|
-
}
|
|
625
610
|
};
|
|
626
611
|
//#endregion
|
|
627
|
-
//#region src/
|
|
612
|
+
//#region src/jsxRenderer.tsx
|
|
628
613
|
/**
|
|
629
614
|
* Factory for a renderer that walks the JSX tree in a single recursive pass,
|
|
630
615
|
* with no React reconciler or scheduler. Pass it as the `renderer` property on
|
|
@@ -632,8 +617,7 @@ var SyncRuntime = class {
|
|
|
632
617
|
* generic, with no hard dependency on `@kubb/renderer-jsx`.
|
|
633
618
|
*
|
|
634
619
|
* Every component must be a pure function. Hooks, suspense, and class
|
|
635
|
-
* components are not supported.
|
|
636
|
-
* for incremental file emission.
|
|
620
|
+
* components are not supported.
|
|
637
621
|
*
|
|
638
622
|
* @example Wire up a JSX generator
|
|
639
623
|
* ```tsx
|
|
@@ -652,17 +636,9 @@ var SyncRuntime = class {
|
|
|
652
636
|
* },
|
|
653
637
|
* })
|
|
654
638
|
* ```
|
|
655
|
-
*
|
|
656
|
-
* @example Stream files as they are produced
|
|
657
|
-
* ```tsx
|
|
658
|
-
* const renderer = jsxRenderer()
|
|
659
|
-
* for (const file of renderer.stream(element)) {
|
|
660
|
-
* await writeFile(file.path, file.sources[0])
|
|
661
|
-
* }
|
|
662
|
-
* ```
|
|
663
639
|
*/
|
|
664
640
|
const jsxRenderer = () => {
|
|
665
|
-
const runtime = new
|
|
641
|
+
const runtime = new Runtime();
|
|
666
642
|
return {
|
|
667
643
|
async render(element) {
|
|
668
644
|
runtime.render(element);
|
|
@@ -670,9 +646,6 @@ const jsxRenderer = () => {
|
|
|
670
646
|
get files() {
|
|
671
647
|
return runtime.nodes;
|
|
672
648
|
},
|
|
673
|
-
stream(element) {
|
|
674
|
-
return runtime.stream(element);
|
|
675
|
-
},
|
|
676
649
|
[Symbol.dispose]() {}
|
|
677
650
|
};
|
|
678
651
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as KubbReactNode, r as KubbReactElement } from "./types-1dqfG_Fl.js";
|
|
3
3
|
import { Fragment, JSX, jsxDEV } from "./jsx-runtime.js";
|
|
4
4
|
|
|
5
5
|
//#region src/jsx-dev-runtime.d.ts
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as KubbReactNode, n as Key, r as KubbReactElement } from "./types-1dqfG_Fl.js";
|
|
3
|
+
import { ArrowFunctionNode, ConstNode, ExportNode, FunctionNode, ImportNode, SourceNode, TypeNode } from "@kubb/ast";
|
|
3
4
|
|
|
4
5
|
//#region src/jsx-namespace.d.ts
|
|
5
6
|
/**
|
|
@@ -28,16 +29,39 @@ declare namespace JSX {
|
|
|
28
29
|
key?: Key | null;
|
|
29
30
|
}
|
|
30
31
|
interface IntrinsicElements {
|
|
31
|
-
'kubb-jsx':
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'kubb-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
['kubb-jsx']: {
|
|
33
|
+
children?: string;
|
|
34
|
+
};
|
|
35
|
+
['kubb-file']: {
|
|
36
|
+
id?: string | null;
|
|
37
|
+
children?: KubbReactNode;
|
|
38
|
+
baseName: string;
|
|
39
|
+
path: string;
|
|
40
|
+
/**
|
|
41
|
+
* Absolute on-disk path to copy verbatim into the output, bypassing the parser. Use to emit a
|
|
42
|
+
* real source file shipped inside a package (a template) into the generated folder.
|
|
43
|
+
*/
|
|
44
|
+
copy?: string | null;
|
|
45
|
+
meta?: FileNode['meta'] | null;
|
|
46
|
+
};
|
|
47
|
+
['kubb-source']: Omit<SourceNode, 'kind'> & {
|
|
48
|
+
children?: KubbReactNode;
|
|
49
|
+
};
|
|
50
|
+
['kubb-import']: Omit<ImportNode, 'kind'> & {};
|
|
51
|
+
['kubb-export']: Omit<ExportNode, 'kind'> & {};
|
|
52
|
+
['kubb-function']: Omit<FunctionNode, 'kind'> & {
|
|
53
|
+
children?: KubbReactNode;
|
|
54
|
+
};
|
|
55
|
+
['kubb-arrow-function']: Omit<ArrowFunctionNode, 'kind'> & {
|
|
56
|
+
children?: KubbReactNode;
|
|
57
|
+
};
|
|
58
|
+
['kubb-const']: Omit<ConstNode, 'kind'> & {
|
|
59
|
+
children?: KubbReactNode;
|
|
60
|
+
};
|
|
61
|
+
['kubb-type']: Omit<TypeNode, 'kind'> & {
|
|
62
|
+
children?: KubbReactNode;
|
|
63
|
+
};
|
|
64
|
+
br: {};
|
|
41
65
|
}
|
|
42
66
|
type LibraryManagedAttributes<C, P> = P;
|
|
43
67
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Unique key for a Kubb JSX element in lists or conditional renders.
|
|
6
|
+
*/
|
|
7
|
+
type Key = string | number | bigint;
|
|
8
|
+
/**
|
|
9
|
+
* Element produced by a Kubb JSX component. The renderer walks these at runtime,
|
|
10
|
+
* so the fields stay opaque to type-checking.
|
|
11
|
+
*/
|
|
12
|
+
type KubbReactElement = {
|
|
13
|
+
type: unknown;
|
|
14
|
+
props: unknown;
|
|
15
|
+
key: Key | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Anything a Kubb JSX component accepts as children: an element, a primitive
|
|
19
|
+
* rendered as text, a nullish value that is skipped, or an iterable of nodes.
|
|
20
|
+
*/
|
|
21
|
+
type KubbReactNode = KubbReactElement | string | number | bigint | boolean | null | undefined | Iterable<KubbReactNode>;
|
|
22
|
+
/**
|
|
23
|
+
* JSDoc comment block to attach to a generated declaration.
|
|
24
|
+
* Each string in `comments` becomes one line inside the `/** … *\/` block.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* { comments: ['@description A pet object.', '@deprecated Use PetV2 instead.'] }
|
|
29
|
+
* // Emits:
|
|
30
|
+
* // /**
|
|
31
|
+
* // * @description A pet object.
|
|
32
|
+
* // * @deprecated Use PetV2 instead.
|
|
33
|
+
* // *\/
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
type JSDoc = {
|
|
37
|
+
/**
|
|
38
|
+
* Lines to emit inside the JSDoc block, in source order.
|
|
39
|
+
* Use standard JSDoc tags such as `@description`, `@deprecated`, `@see`, etc.
|
|
40
|
+
*/
|
|
41
|
+
comments: Array<string>;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { KubbReactNode as i, Key as n, KubbReactElement as r, JSDoc as t };
|
|
45
|
+
//# sourceMappingURL=types-1dqfG_Fl.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { JSDoc, Key,
|
|
1
|
+
import { i as KubbReactNode, n as Key, r as KubbReactElement, t as JSDoc } from "./types-1dqfG_Fl.js";
|
|
2
|
+
export { JSDoc, Key, KubbReactElement, KubbReactNode };
|
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.85",
|
|
4
4
|
"description": "Self-contained synchronous JSX renderer for Kubb. Turns JSX into FileNodes with built-in components (File, Function, Type, Const). An alternative for the ast.factory syntax.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"yaml": "^2.9.0",
|
|
72
|
-
"@kubb/ast": "5.0.0-beta.
|
|
72
|
+
"@kubb/ast": "5.0.0-beta.85"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@internals/utils": "0.0.0"
|
package/dist/types-OZ23urxc.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { ArrowFunctionNode, ConstNode, ExportNode, FileNode, FunctionNode, ImportNode, SourceNode, TypeNode } from "@kubb/ast";
|
|
3
|
-
|
|
4
|
-
//#region src/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Unique key for a Kubb JSX element in lists or conditional renders.
|
|
7
|
-
*/
|
|
8
|
-
type Key = string | number | bigint;
|
|
9
|
-
/**
|
|
10
|
-
* Element produced by a Kubb JSX component. The renderer walks these at runtime,
|
|
11
|
-
* so the fields stay opaque to type-checking.
|
|
12
|
-
*/
|
|
13
|
-
type KubbReactElement = {
|
|
14
|
-
type: unknown;
|
|
15
|
-
props: unknown;
|
|
16
|
-
key: Key | null;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Anything a Kubb JSX component accepts as children: an element, a primitive
|
|
20
|
-
* rendered as text, a nullish value that is skipped, or an iterable of nodes.
|
|
21
|
-
*/
|
|
22
|
-
type KubbReactNode = KubbReactElement | string | number | bigint | boolean | null | undefined | Iterable<KubbReactNode>;
|
|
23
|
-
/**
|
|
24
|
-
* Props for the `<kubb-jsx>` element.
|
|
25
|
-
* Embeds a raw JSX string verbatim in generated output.
|
|
26
|
-
*/
|
|
27
|
-
type KubbJsxProps = {
|
|
28
|
-
children?: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Props for the `<kubb-file>` element.
|
|
32
|
-
* Represents a generated file.
|
|
33
|
-
*/
|
|
34
|
-
type KubbFileProps = {
|
|
35
|
-
id?: string | null;
|
|
36
|
-
children?: KubbReactNode;
|
|
37
|
-
baseName: string;
|
|
38
|
-
path: string;
|
|
39
|
-
/**
|
|
40
|
-
* Absolute on-disk path to copy verbatim into the output, bypassing the parser. Use to emit a
|
|
41
|
-
* real source file shipped inside a package (a template) into the generated folder.
|
|
42
|
-
*/
|
|
43
|
-
copy?: string | null;
|
|
44
|
-
meta?: FileNode['meta'] | null;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Props for the `<kubb-source>` element.
|
|
48
|
-
* Marks a block of source text associated with a file.
|
|
49
|
-
*/
|
|
50
|
-
type KubbSourceProps = Omit<SourceNode, 'kind'> & {
|
|
51
|
-
children?: KubbReactNode;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Props for the `<kubb-import>` element.
|
|
55
|
-
* Declares an import statement in the generated file.
|
|
56
|
-
*/
|
|
57
|
-
type KubbImportProps = Omit<ImportNode, 'kind'> & {};
|
|
58
|
-
/**
|
|
59
|
-
* Props for the `<kubb-export>` element.
|
|
60
|
-
* Declares an export statement in the generated file.
|
|
61
|
-
*/
|
|
62
|
-
type KubbExportProps = Omit<ExportNode, 'kind'> & {};
|
|
63
|
-
/**
|
|
64
|
-
* Props for the `<kubb-function>` element.
|
|
65
|
-
* Generates a function declaration.
|
|
66
|
-
*/
|
|
67
|
-
type KubbFunctionProps = Omit<FunctionNode, 'kind'> & {
|
|
68
|
-
children?: KubbReactNode;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Props for the `<kubb-arrow-function>` element.
|
|
72
|
-
* Generates an arrow function declaration.
|
|
73
|
-
*/
|
|
74
|
-
type KubbArrowFunctionProps = Omit<ArrowFunctionNode, 'kind'> & {
|
|
75
|
-
children?: KubbReactNode;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Props for the `<kubb-const>` element.
|
|
79
|
-
* Generates a constant declaration.
|
|
80
|
-
*/
|
|
81
|
-
type KubbConstProps = Omit<ConstNode, 'kind'> & {
|
|
82
|
-
children?: KubbReactNode;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Props for the `<kubb-type>` element.
|
|
86
|
-
* Generates a TypeScript type alias declaration.
|
|
87
|
-
*/
|
|
88
|
-
type KubbTypeProps = Omit<TypeNode, 'kind'> & {
|
|
89
|
-
children?: KubbReactNode;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Props for the `<br>` element. It emits a single line break and takes no
|
|
93
|
-
* attributes of its own.
|
|
94
|
-
*/
|
|
95
|
-
type LineBreakProps = {};
|
|
96
|
-
/**
|
|
97
|
-
* JSDoc comment block to attach to a generated declaration.
|
|
98
|
-
* Each string in `comments` becomes one line inside the `/** … *\/` block.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```ts
|
|
102
|
-
* { comments: ['@description A pet object.', '@deprecated Use PetV2 instead.'] }
|
|
103
|
-
* // Emits:
|
|
104
|
-
* // /**
|
|
105
|
-
* // * @description A pet object.
|
|
106
|
-
* // * @deprecated Use PetV2 instead.
|
|
107
|
-
* // *\/
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
type JSDoc = {
|
|
111
|
-
/**
|
|
112
|
-
* Lines to emit inside the JSDoc block, in source order.
|
|
113
|
-
* Use standard JSDoc tags such as `@description`, `@deprecated`, `@see`, etc.
|
|
114
|
-
*/
|
|
115
|
-
comments: Array<string>;
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
export { KubbExportProps as a, KubbImportProps as c, KubbReactNode as d, KubbSourceProps as f, KubbConstProps as i, KubbJsxProps as l, LineBreakProps as m, Key as n, KubbFileProps as o, KubbTypeProps as p, KubbArrowFunctionProps as r, KubbFunctionProps as s, JSDoc as t, KubbReactElement as u };
|
|
119
|
-
//# sourceMappingURL=types-OZ23urxc.d.ts.map
|