@kubb/renderer-jsx 5.0.0-beta.99 → 5.0.0
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 +25 -19
- package/dist/index.d.ts +507 -5
- package/dist/index.js +15 -9
- package/dist/jsx-dev-runtime.d.ts +1 -8
- package/dist/jsx-runtime.d.ts +9 -11
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
require("./rolldown-runtime-ClG-MNz_.cjs");
|
|
3
3
|
const require_jsx_runtime = require("./jsx-runtime.cjs");
|
|
4
4
|
let yaml = require("yaml");
|
|
5
|
-
let
|
|
5
|
+
let _kubb_kit = require("@kubb/kit");
|
|
6
6
|
//#region src/components/md/Callout.tsx
|
|
7
7
|
const CALLOUT_LABEL = {
|
|
8
8
|
tip: "TIP",
|
|
@@ -30,9 +30,11 @@ const CALLOUT_LABEL = {
|
|
|
30
30
|
*/
|
|
31
31
|
function Callout({ type, title, children }) {
|
|
32
32
|
const label = CALLOUT_LABEL[type];
|
|
33
|
+
const header = title ? `> [!${label}] ${title}` : `> [!${label}]`;
|
|
34
|
+
const quoted = children.trimEnd().split("\n").map((line) => line.length > 0 ? `> ${line}` : ">").join("\n");
|
|
33
35
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-source", {
|
|
34
36
|
name: "callout",
|
|
35
|
-
children: `${
|
|
37
|
+
children: `${header}\n${quoted}`
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
Callout.displayName = "Callout";
|
|
@@ -210,9 +212,10 @@ File.Source = FileSource;
|
|
|
210
212
|
* ```
|
|
211
213
|
*/
|
|
212
214
|
function Frontmatter({ data }) {
|
|
215
|
+
const envelope = Object.keys(data).length === 0 ? "" : `---\n${(0, yaml.stringify)(data).trimEnd()}\n---`;
|
|
213
216
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-source", {
|
|
214
217
|
name: "frontmatter",
|
|
215
|
-
children:
|
|
218
|
+
children: envelope
|
|
216
219
|
});
|
|
217
220
|
}
|
|
218
221
|
Frontmatter.displayName = "Frontmatter";
|
|
@@ -233,13 +236,14 @@ Frontmatter.displayName = "Frontmatter";
|
|
|
233
236
|
*/
|
|
234
237
|
function Function({ children, ...props }) {
|
|
235
238
|
const { name, default: isDefault, export: canExport, async: isAsync, generics, params, returnType, JSDoc } = props;
|
|
239
|
+
const genericsString = Array.isArray(generics) ? generics.join(", ").trim() : generics;
|
|
236
240
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-function", {
|
|
237
241
|
name,
|
|
238
242
|
params,
|
|
239
243
|
export: canExport,
|
|
240
244
|
default: isDefault,
|
|
241
245
|
async: isAsync,
|
|
242
|
-
generics:
|
|
246
|
+
generics: genericsString,
|
|
243
247
|
returnType,
|
|
244
248
|
JSDoc,
|
|
245
249
|
children
|
|
@@ -261,13 +265,14 @@ Function.displayName = "Function";
|
|
|
261
265
|
*/
|
|
262
266
|
function ArrowFunction({ children, ...props }) {
|
|
263
267
|
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props;
|
|
268
|
+
const genericsString = Array.isArray(generics) ? generics.join(", ").trim() : generics;
|
|
264
269
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-arrow-function", {
|
|
265
270
|
name,
|
|
266
271
|
params,
|
|
267
272
|
export: canExport,
|
|
268
273
|
default: isDefault,
|
|
269
274
|
async,
|
|
270
|
-
generics:
|
|
275
|
+
generics: genericsString,
|
|
271
276
|
returnType,
|
|
272
277
|
singleLine,
|
|
273
278
|
JSDoc,
|
|
@@ -338,9 +343,10 @@ Jsx.displayName = "Jsx";
|
|
|
338
343
|
* ```
|
|
339
344
|
*/
|
|
340
345
|
function List({ ordered, items }) {
|
|
346
|
+
const body = items.map((item, index) => `${ordered ? `${index + 1}.` : "-"} ${item}`).join("\n");
|
|
341
347
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-source", {
|
|
342
348
|
name: "list",
|
|
343
|
-
children:
|
|
349
|
+
children: body
|
|
344
350
|
});
|
|
345
351
|
}
|
|
346
352
|
List.displayName = "List";
|
|
@@ -439,12 +445,12 @@ function collectCodeNodes(props) {
|
|
|
439
445
|
}
|
|
440
446
|
function collectCode(element, nodes) {
|
|
441
447
|
walkElement(element, (text) => {
|
|
442
|
-
if (text.trim()) nodes.push(
|
|
448
|
+
if (text.trim()) nodes.push(_kubb_kit.ast.factory.createText(text));
|
|
443
449
|
}, (type, props) => resolveCodeNode(type, props, nodes));
|
|
444
450
|
}
|
|
445
451
|
function resolveCodeNode(type, props, nodes) {
|
|
446
452
|
if (type === "br") {
|
|
447
|
-
nodes.push(
|
|
453
|
+
nodes.push(_kubb_kit.ast.factory.createBreak());
|
|
448
454
|
return;
|
|
449
455
|
}
|
|
450
456
|
if (type === "kubb-jsx") {
|
|
@@ -452,11 +458,11 @@ function resolveCodeNode(type, props, nodes) {
|
|
|
452
458
|
walkElement(props["children"], (t) => {
|
|
453
459
|
value += t;
|
|
454
460
|
}, () => {});
|
|
455
|
-
if (value) nodes.push(
|
|
461
|
+
if (value) nodes.push(_kubb_kit.ast.factory.createJsx(value));
|
|
456
462
|
return;
|
|
457
463
|
}
|
|
458
464
|
if (type === "kubb-function") {
|
|
459
|
-
nodes.push(
|
|
465
|
+
nodes.push(_kubb_kit.ast.factory.createFunction({
|
|
460
466
|
name: props["name"],
|
|
461
467
|
params: props["params"],
|
|
462
468
|
export: props["export"],
|
|
@@ -470,7 +476,7 @@ function resolveCodeNode(type, props, nodes) {
|
|
|
470
476
|
return;
|
|
471
477
|
}
|
|
472
478
|
if (type === "kubb-arrow-function") {
|
|
473
|
-
nodes.push(
|
|
479
|
+
nodes.push(_kubb_kit.ast.factory.createArrowFunction({
|
|
474
480
|
name: props["name"],
|
|
475
481
|
params: props["params"],
|
|
476
482
|
export: props["export"],
|
|
@@ -485,7 +491,7 @@ function resolveCodeNode(type, props, nodes) {
|
|
|
485
491
|
return;
|
|
486
492
|
}
|
|
487
493
|
if (type === "kubb-const") {
|
|
488
|
-
nodes.push(
|
|
494
|
+
nodes.push(_kubb_kit.ast.factory.createConst({
|
|
489
495
|
name: props["name"],
|
|
490
496
|
type: props["type"],
|
|
491
497
|
export: props["export"],
|
|
@@ -496,7 +502,7 @@ function resolveCodeNode(type, props, nodes) {
|
|
|
496
502
|
return;
|
|
497
503
|
}
|
|
498
504
|
if (type === "kubb-type") {
|
|
499
|
-
nodes.push(
|
|
505
|
+
nodes.push(_kubb_kit.ast.factory.createType({
|
|
500
506
|
name: props["name"],
|
|
501
507
|
export: props["export"],
|
|
502
508
|
JSDoc: props["JSDoc"],
|
|
@@ -513,7 +519,7 @@ function collectFileChildren(element) {
|
|
|
513
519
|
if (text.trim()) throw new Error(`[jsx] '${text}' should be part of <File.Source> component when using the <File/> component`);
|
|
514
520
|
}, (type, props) => {
|
|
515
521
|
if (type === "kubb-source") {
|
|
516
|
-
sources.push(
|
|
522
|
+
sources.push(_kubb_kit.ast.factory.createSource({
|
|
517
523
|
name: props["name"]?.toString(),
|
|
518
524
|
isTypeOnly: !!props["isTypeOnly"],
|
|
519
525
|
isExportable: !!props["isExportable"],
|
|
@@ -523,7 +529,7 @@ function collectFileChildren(element) {
|
|
|
523
529
|
return;
|
|
524
530
|
}
|
|
525
531
|
if (type === "kubb-export") {
|
|
526
|
-
exports.push(
|
|
532
|
+
exports.push(_kubb_kit.ast.factory.createExport({
|
|
527
533
|
name: props["name"],
|
|
528
534
|
path: props["path"],
|
|
529
535
|
isTypeOnly: !!props["isTypeOnly"],
|
|
@@ -532,7 +538,7 @@ function collectFileChildren(element) {
|
|
|
532
538
|
return;
|
|
533
539
|
}
|
|
534
540
|
if (type === "kubb-import") {
|
|
535
|
-
imports.push(
|
|
541
|
+
imports.push(_kubb_kit.ast.factory.createImport({
|
|
536
542
|
name: props["name"],
|
|
537
543
|
path: props["path"],
|
|
538
544
|
root: props["root"],
|
|
@@ -589,7 +595,7 @@ function* walkFiles(element) {
|
|
|
589
595
|
}
|
|
590
596
|
/**
|
|
591
597
|
* Synchronous JSX renderer that walks the element tree in a single pass,
|
|
592
|
-
* producing {@link FileNode} objects directly without an intermediate virtual
|
|
598
|
+
* producing {@link ast.FileNode} objects directly without an intermediate virtual
|
|
593
599
|
* DOM. No React fiber, scheduler, or work loop is involved.
|
|
594
600
|
*
|
|
595
601
|
* All components must be pure functions. Hooks and class components are not
|
|
@@ -597,12 +603,12 @@ function* walkFiles(element) {
|
|
|
597
603
|
*/
|
|
598
604
|
var Runtime = class {
|
|
599
605
|
/**
|
|
600
|
-
* Accumulated {@link FileNode} results from every {@link render} call.
|
|
606
|
+
* Accumulated {@link ast.FileNode} results from every {@link render} call.
|
|
601
607
|
*/
|
|
602
608
|
nodes = [];
|
|
603
609
|
/**
|
|
604
610
|
* Walks `element` synchronously, converts every `<kubb-file>` subtree into
|
|
605
|
-
* a {@link FileNode} with no intermediate virtual DOM, and appends the results
|
|
611
|
+
* a {@link ast.FileNode} with no intermediate virtual DOM, and appends the results
|
|
606
612
|
* to {@link nodes}.
|
|
607
613
|
*/
|
|
608
614
|
render(element) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
2
|
import { i as KubbReactNode, n as Key, r as KubbReactElement, t as JSDoc } from "./types-seYG0czS.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ast } from "@kubb/kit";
|
|
4
4
|
//#region src/components/md/Callout.d.ts
|
|
5
5
|
declare const CALLOUT_LABEL: {
|
|
6
6
|
readonly tip: "TIP";
|
|
@@ -190,7 +190,7 @@ declare namespace File {
|
|
|
190
190
|
var Import: typeof FileImport;
|
|
191
191
|
var Source: typeof FileSource;
|
|
192
192
|
}
|
|
193
|
-
type FileSourceProps = Omit<SourceNode, 'kind' | 'value'> & {
|
|
193
|
+
type FileSourceProps = Omit<ast.SourceNode, 'kind' | 'value'> & {
|
|
194
194
|
key?: Key;
|
|
195
195
|
/**
|
|
196
196
|
* Child nodes rendered as the source content of this block.
|
|
@@ -221,7 +221,7 @@ declare function FileSource({ children, ...props }: FileSourceProps): KubbReactE
|
|
|
221
221
|
declare namespace FileSource {
|
|
222
222
|
var displayName: string;
|
|
223
223
|
}
|
|
224
|
-
type FileExportProps = Omit<ExportNode, 'kind'> & {
|
|
224
|
+
type FileExportProps = Omit<ast.ExportNode, 'kind'> & {
|
|
225
225
|
key?: Key;
|
|
226
226
|
};
|
|
227
227
|
/**
|
|
@@ -245,7 +245,7 @@ declare function FileExport(props: FileExportProps): KubbReactElement;
|
|
|
245
245
|
declare namespace FileExport {
|
|
246
246
|
var displayName: string;
|
|
247
247
|
}
|
|
248
|
-
type FileImportProps = Omit<ImportNode, 'kind'> & {
|
|
248
|
+
type FileImportProps = Omit<ast.ImportNode, 'kind'> & {
|
|
249
249
|
key?: Key;
|
|
250
250
|
};
|
|
251
251
|
/**
|
|
@@ -596,6 +596,508 @@ declare namespace Type {
|
|
|
596
596
|
var displayName: string;
|
|
597
597
|
}
|
|
598
598
|
//#endregion
|
|
599
|
+
//#region ../ast/src/nodes/base.d.ts
|
|
600
|
+
/**
|
|
601
|
+
* `kind` values used by AST nodes.
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```ts
|
|
605
|
+
* const kind: NodeKind = 'Schema'
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
type NodeKind = 'Input' | 'Output' | 'Operation' | 'Schema' | 'Property' | 'Parameter' | 'Response' | 'RequestBody' | 'Content' | 'Type' | 'File' | 'Import' | 'Export' | 'Source' | 'Const' | 'Function' | 'ArrowFunction' | 'Text' | 'Break' | 'Jsx';
|
|
609
|
+
/**
|
|
610
|
+
* Base shape shared by all AST nodes.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```ts
|
|
614
|
+
* const base: BaseNode = { kind: 'Input' }
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
type BaseNode = {
|
|
618
|
+
/**
|
|
619
|
+
* Node discriminator.
|
|
620
|
+
*/
|
|
621
|
+
kind: NodeKind;
|
|
622
|
+
};
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region ../ast/src/nodes/code.d.ts
|
|
625
|
+
/**
|
|
626
|
+
* JSDoc documentation metadata attached to code declarations.
|
|
627
|
+
*/
|
|
628
|
+
type JSDocNode = {
|
|
629
|
+
/**
|
|
630
|
+
* JSDoc comment lines. `undefined` entries are filtered out during rendering.
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* ['@description A pet resource', '@deprecated']
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
comments?: Array<string | undefined>;
|
|
638
|
+
};
|
|
639
|
+
/**
|
|
640
|
+
* AST node representing a TypeScript `const` declaration.
|
|
641
|
+
*
|
|
642
|
+
* Mirrors the props of the `Const` component from `@kubb/renderer-jsx`.
|
|
643
|
+
* The `children` prop of the component is represented as `nodes`.
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* ```ts
|
|
647
|
+
* createConst({ name: 'pet', export: true, asConst: true })
|
|
648
|
+
* // export const pet = ... as const
|
|
649
|
+
* ```
|
|
650
|
+
*/
|
|
651
|
+
type ConstNode = BaseNode & {
|
|
652
|
+
kind: 'Const';
|
|
653
|
+
/**
|
|
654
|
+
* Name of the constant declaration.
|
|
655
|
+
*/
|
|
656
|
+
name: string;
|
|
657
|
+
/**
|
|
658
|
+
* Whether the declaration should be exported.
|
|
659
|
+
*/
|
|
660
|
+
export?: boolean | null;
|
|
661
|
+
/**
|
|
662
|
+
* Explicit type annotation.
|
|
663
|
+
*
|
|
664
|
+
* @example Type reference
|
|
665
|
+
* `'Pet'`
|
|
666
|
+
*/
|
|
667
|
+
type?: string | null;
|
|
668
|
+
/**
|
|
669
|
+
* JSDoc documentation metadata.
|
|
670
|
+
*/
|
|
671
|
+
JSDoc?: JSDocNode | null;
|
|
672
|
+
/**
|
|
673
|
+
* Whether to append `as const` to the declaration.
|
|
674
|
+
*/
|
|
675
|
+
asConst?: boolean | null;
|
|
676
|
+
/**
|
|
677
|
+
* Child nodes representing the value of the constant (children of the `Const` component).
|
|
678
|
+
* Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
|
|
679
|
+
*/
|
|
680
|
+
nodes?: Array<CodeNode>;
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* AST node representing a TypeScript `type` alias declaration.
|
|
684
|
+
*
|
|
685
|
+
* Mirrors the props of the `Type` component from `@kubb/renderer-jsx`.
|
|
686
|
+
* The `children` prop of the component is represented as `nodes`.
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* ```ts
|
|
690
|
+
* createType({ name: 'Pet', export: true })
|
|
691
|
+
* // export type Pet = ...
|
|
692
|
+
* ```
|
|
693
|
+
*/
|
|
694
|
+
type TypeNode = BaseNode & {
|
|
695
|
+
kind: 'Type';
|
|
696
|
+
/**
|
|
697
|
+
* Name of the type alias.
|
|
698
|
+
*/
|
|
699
|
+
name: string;
|
|
700
|
+
/**
|
|
701
|
+
* Whether the declaration should be exported.
|
|
702
|
+
*/
|
|
703
|
+
export?: boolean | null;
|
|
704
|
+
/**
|
|
705
|
+
* JSDoc documentation metadata.
|
|
706
|
+
*/
|
|
707
|
+
JSDoc?: JSDocNode | null;
|
|
708
|
+
/**
|
|
709
|
+
* Child nodes representing the type body (children of the `Type` component).
|
|
710
|
+
* Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
|
|
711
|
+
*/
|
|
712
|
+
nodes?: Array<CodeNode>;
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* AST node representing a TypeScript `function` declaration.
|
|
716
|
+
*
|
|
717
|
+
* Mirrors the props of the `Function` component from `@kubb/renderer-jsx`.
|
|
718
|
+
* The `children` prop of the component is represented as `nodes`.
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```ts
|
|
722
|
+
* createFunction({ name: 'getPet', export: true, async: true, returnType: 'Pet' })
|
|
723
|
+
* // export async function getPet(): Promise<Pet> { ... }
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
type FunctionNode = BaseNode & {
|
|
727
|
+
kind: 'Function';
|
|
728
|
+
/**
|
|
729
|
+
* Name of the function.
|
|
730
|
+
*/
|
|
731
|
+
name: string;
|
|
732
|
+
/**
|
|
733
|
+
* Whether the function is a default export.
|
|
734
|
+
*/
|
|
735
|
+
default?: boolean | null;
|
|
736
|
+
/**
|
|
737
|
+
* Function parameter list as a pre-rendered string, written verbatim between the parentheses.
|
|
738
|
+
*
|
|
739
|
+
* @example
|
|
740
|
+
* `'id: string, config: Config = {}'`
|
|
741
|
+
*/
|
|
742
|
+
params?: string | null;
|
|
743
|
+
/**
|
|
744
|
+
* Whether the function should be exported.
|
|
745
|
+
*/
|
|
746
|
+
export?: boolean | null;
|
|
747
|
+
/**
|
|
748
|
+
* Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.
|
|
749
|
+
*/
|
|
750
|
+
async?: boolean | null;
|
|
751
|
+
/**
|
|
752
|
+
* TypeScript generic type parameters.
|
|
753
|
+
*
|
|
754
|
+
* @example Constrained generics
|
|
755
|
+
* `['T', 'U extends string']`
|
|
756
|
+
*/
|
|
757
|
+
generics?: string | Array<string> | null;
|
|
758
|
+
/**
|
|
759
|
+
* Return type annotation.
|
|
760
|
+
*
|
|
761
|
+
* @example Type reference
|
|
762
|
+
* `'Pet'`
|
|
763
|
+
*/
|
|
764
|
+
returnType?: string | null;
|
|
765
|
+
/**
|
|
766
|
+
* JSDoc documentation metadata.
|
|
767
|
+
*/
|
|
768
|
+
JSDoc?: JSDocNode | null;
|
|
769
|
+
/**
|
|
770
|
+
* Child nodes representing the function body (children of the `Function` component).
|
|
771
|
+
* Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
|
|
772
|
+
*/
|
|
773
|
+
nodes?: Array<CodeNode>;
|
|
774
|
+
};
|
|
775
|
+
/**
|
|
776
|
+
* AST node representing a TypeScript arrow function (`const name = () => { ... }`).
|
|
777
|
+
*
|
|
778
|
+
* Mirrors the props of the `Function.Arrow` component from `@kubb/renderer-jsx`.
|
|
779
|
+
* The `children` prop of the component is represented as `nodes`.
|
|
780
|
+
*
|
|
781
|
+
* @example
|
|
782
|
+
* ```ts
|
|
783
|
+
* createArrowFunction({ name: 'getPet', export: true, singleLine: true })
|
|
784
|
+
* // export const getPet = () => ...
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
type ArrowFunctionNode = Omit<FunctionNode, 'kind'> & {
|
|
788
|
+
kind: 'ArrowFunction';
|
|
789
|
+
/**
|
|
790
|
+
* Render the arrow function body as a single-line expression.
|
|
791
|
+
*/
|
|
792
|
+
singleLine?: boolean | null;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* AST node representing a raw text/string fragment in the source output.
|
|
796
|
+
*
|
|
797
|
+
* Used instead of bare `string` values so that all entries in `nodes` arrays
|
|
798
|
+
* are typed `CodeNode` objects rather than a mixed `CodeNode | string` union.
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```ts
|
|
802
|
+
* createText('return fetch(id)')
|
|
803
|
+
* // { kind: 'Text', value: 'return fetch(id)' }
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
806
|
+
type TextNode = BaseNode & {
|
|
807
|
+
kind: 'Text';
|
|
808
|
+
/**
|
|
809
|
+
* The raw string content.
|
|
810
|
+
*/
|
|
811
|
+
value: string;
|
|
812
|
+
};
|
|
813
|
+
/**
|
|
814
|
+
* AST node representing a blank line in the source output.
|
|
815
|
+
*
|
|
816
|
+
* Corresponds to `<br/>` in JSX components. `printNodes` turns a `Break` between two
|
|
817
|
+
* statements into one blank line. Consecutive breaks, and breaks at the start or end of
|
|
818
|
+
* the list, are folded away, so a `Break` never produces more than one blank line.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```ts
|
|
822
|
+
* createBreak()
|
|
823
|
+
* // { kind: 'Break' }
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
826
|
+
type BreakNode = BaseNode & {
|
|
827
|
+
kind: 'Break';
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* AST node representing a raw JSX fragment in the source output.
|
|
831
|
+
*
|
|
832
|
+
* Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Embeds raw JSX/TSX markup
|
|
833
|
+
* (including fragments `<>…</>`) directly in generated code.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```ts
|
|
837
|
+
* createJsx('<>\n <a href={href}>Open</a>\n</>')
|
|
838
|
+
* // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
type JsxNode = BaseNode & {
|
|
842
|
+
kind: 'Jsx';
|
|
843
|
+
/**
|
|
844
|
+
* The raw JSX string content.
|
|
845
|
+
*/
|
|
846
|
+
value: string;
|
|
847
|
+
};
|
|
848
|
+
/**
|
|
849
|
+
* Union of all code-generation AST nodes.
|
|
850
|
+
*
|
|
851
|
+
* These nodes mirror the JSX components from `@kubb/renderer-jsx` and are used as
|
|
852
|
+
* structured children in {@link SourceNode.nodes}.
|
|
853
|
+
*/
|
|
854
|
+
type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region ../ast/src/nodes/file.d.ts
|
|
857
|
+
/**
|
|
858
|
+
* Supported file extensions.
|
|
859
|
+
*/
|
|
860
|
+
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
861
|
+
type ImportName = string | Array<string | {
|
|
862
|
+
propertyName: string;
|
|
863
|
+
name?: string;
|
|
864
|
+
}>;
|
|
865
|
+
/**
|
|
866
|
+
* Represents a language-agnostic import/dependency declaration.
|
|
867
|
+
*
|
|
868
|
+
* @example Named import (TypeScript: `import { useState } from 'react'`)
|
|
869
|
+
* ```ts
|
|
870
|
+
* createImport({ name: ['useState'], path: 'react' })
|
|
871
|
+
* ```
|
|
872
|
+
*
|
|
873
|
+
* @example Default import (TypeScript: `import React from 'react'`)
|
|
874
|
+
* ```ts
|
|
875
|
+
* createImport({ name: 'React', path: 'react' })
|
|
876
|
+
* ```
|
|
877
|
+
*
|
|
878
|
+
* @example Type-only import (TypeScript: `import type { FC } from 'react'`)
|
|
879
|
+
* ```ts
|
|
880
|
+
* createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
|
|
881
|
+
* ```
|
|
882
|
+
*
|
|
883
|
+
* @example Namespace import (TypeScript: `import * as React from 'react'`)
|
|
884
|
+
* ```ts
|
|
885
|
+
* createImport({ name: 'React', path: 'react', isNameSpace: true })
|
|
886
|
+
* ```
|
|
887
|
+
*/
|
|
888
|
+
type ImportNode = BaseNode & {
|
|
889
|
+
kind: 'Import';
|
|
890
|
+
/**
|
|
891
|
+
* Import name(s) to be used.
|
|
892
|
+
*
|
|
893
|
+
* @example Named imports
|
|
894
|
+
* `['useState']`
|
|
895
|
+
*
|
|
896
|
+
* @example Default import
|
|
897
|
+
* `'React'`
|
|
898
|
+
*/
|
|
899
|
+
name: ImportName;
|
|
900
|
+
/**
|
|
901
|
+
* Path for the import.
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* `'@kubb/core'`
|
|
905
|
+
*/
|
|
906
|
+
path: string;
|
|
907
|
+
/**
|
|
908
|
+
* Add a type-only import prefix.
|
|
909
|
+
* - `true` generates `import type { Type } from './path'`
|
|
910
|
+
* - `false` generates `import { Type } from './path'`
|
|
911
|
+
*/
|
|
912
|
+
isTypeOnly?: boolean | null;
|
|
913
|
+
/**
|
|
914
|
+
* Import the entire module as a namespace.
|
|
915
|
+
* - `true` generates `import * as Name from './path'`
|
|
916
|
+
* - `false` generates a standard import
|
|
917
|
+
*/
|
|
918
|
+
isNameSpace?: boolean | null;
|
|
919
|
+
/**
|
|
920
|
+
* When set, the import path is resolved relative to this root.
|
|
921
|
+
*/
|
|
922
|
+
root?: string | null;
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* Represents a language-agnostic export/public API declaration.
|
|
926
|
+
*
|
|
927
|
+
* @example Named export (TypeScript: `export { Pets } from './Pets'`)
|
|
928
|
+
* ```ts
|
|
929
|
+
* createExport({ name: ['Pets'], path: './Pets' })
|
|
930
|
+
* ```
|
|
931
|
+
*
|
|
932
|
+
* @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)
|
|
933
|
+
* ```ts
|
|
934
|
+
* createExport({ name: ['Pet'], path: './Pet', isTypeOnly: true })
|
|
935
|
+
* ```
|
|
936
|
+
*
|
|
937
|
+
* @example Wildcard export (TypeScript: `export * from './utils'`)
|
|
938
|
+
* ```ts
|
|
939
|
+
* createExport({ path: './utils' })
|
|
940
|
+
* ```
|
|
941
|
+
*
|
|
942
|
+
* @example Namespace alias (TypeScript: `export * as utils from './utils'`)
|
|
943
|
+
* ```ts
|
|
944
|
+
* createExport({ name: 'utils', path: './utils', asAlias: true })
|
|
945
|
+
* ```
|
|
946
|
+
*/
|
|
947
|
+
type ExportNode = BaseNode & {
|
|
948
|
+
kind: 'Export';
|
|
949
|
+
/**
|
|
950
|
+
* Export name(s) to be used. When omitted, generates a wildcard export.
|
|
951
|
+
*
|
|
952
|
+
* @example Named exports
|
|
953
|
+
* `['useState']`
|
|
954
|
+
*
|
|
955
|
+
* @example Single export
|
|
956
|
+
* `'React'`
|
|
957
|
+
*/
|
|
958
|
+
name?: string | Array<string> | null;
|
|
959
|
+
/**
|
|
960
|
+
* Path for the export.
|
|
961
|
+
*
|
|
962
|
+
* @example
|
|
963
|
+
* `'@kubb/core'`
|
|
964
|
+
*/
|
|
965
|
+
path: string;
|
|
966
|
+
/**
|
|
967
|
+
* Add a type-only export prefix.
|
|
968
|
+
* - `true` generates `export type { Type } from './path'`
|
|
969
|
+
* - `false` generates `export { Type } from './path'`
|
|
970
|
+
*/
|
|
971
|
+
isTypeOnly?: boolean | null;
|
|
972
|
+
/**
|
|
973
|
+
* Export as an aliased namespace.
|
|
974
|
+
* - `true` generates `export * as aliasName from './path'`
|
|
975
|
+
* - `false` generates a standard export
|
|
976
|
+
*/
|
|
977
|
+
asAlias?: boolean | null;
|
|
978
|
+
};
|
|
979
|
+
/**
|
|
980
|
+
* Represents a fragment of source code within a file.
|
|
981
|
+
*
|
|
982
|
+
* @example Named exportable source
|
|
983
|
+
* ```ts
|
|
984
|
+
* createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true, isIndexable: true })
|
|
985
|
+
* ```
|
|
986
|
+
*
|
|
987
|
+
* @example Inline unnamed code block
|
|
988
|
+
* ```ts
|
|
989
|
+
* createSource({ nodes: [createText('const x = 1')] })
|
|
990
|
+
* ```
|
|
991
|
+
*/
|
|
992
|
+
type SourceNode = BaseNode & {
|
|
993
|
+
kind: 'Source';
|
|
994
|
+
/**
|
|
995
|
+
* Optional name identifying this source (used for deduplication and barrel generation).
|
|
996
|
+
*/
|
|
997
|
+
name?: string | null;
|
|
998
|
+
/**
|
|
999
|
+
* Mark this source as a type-only export.
|
|
1000
|
+
*/
|
|
1001
|
+
isTypeOnly?: boolean | null;
|
|
1002
|
+
/**
|
|
1003
|
+
* Include the `export` keyword in the generated source.
|
|
1004
|
+
*/
|
|
1005
|
+
isExportable?: boolean | null;
|
|
1006
|
+
/**
|
|
1007
|
+
* Include this source in barrel/index file generation.
|
|
1008
|
+
*/
|
|
1009
|
+
isIndexable?: boolean | null;
|
|
1010
|
+
/**
|
|
1011
|
+
* Child nodes that make up this source fragment, in DOM order.
|
|
1012
|
+
* Use a {@link TextNode} for raw string content.
|
|
1013
|
+
*/
|
|
1014
|
+
nodes?: Array<CodeNode>;
|
|
1015
|
+
};
|
|
1016
|
+
/**
|
|
1017
|
+
* Represents a fully resolved file in the AST.
|
|
1018
|
+
*
|
|
1019
|
+
* Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input
|
|
1020
|
+
* and deduplicates `imports`, `exports`, and `sources`.
|
|
1021
|
+
*
|
|
1022
|
+
* @example
|
|
1023
|
+
* ```ts
|
|
1024
|
+
* const file = createFile({
|
|
1025
|
+
* baseName: 'petStore.ts',
|
|
1026
|
+
* path: 'src/models/petStore.ts',
|
|
1027
|
+
* sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })],
|
|
1028
|
+
* imports: [createImport({ name: ['z'], path: 'zod' })],
|
|
1029
|
+
* exports: [createExport({ name: ['Pet'], path: './petStore' })],
|
|
1030
|
+
* })
|
|
1031
|
+
* // file.id = SHA256 hash of the path
|
|
1032
|
+
* // file.name = 'petStore'
|
|
1033
|
+
* // file.extname = '.ts'
|
|
1034
|
+
* ```
|
|
1035
|
+
*/
|
|
1036
|
+
type FileNode<TMeta extends object = object> = BaseNode & {
|
|
1037
|
+
kind: 'File';
|
|
1038
|
+
/**
|
|
1039
|
+
* Unique identifier derived from a SHA256 hash of the file path. `createFile`
|
|
1040
|
+
* computes it, so callers do not need to provide it.
|
|
1041
|
+
*/
|
|
1042
|
+
id: string;
|
|
1043
|
+
/**
|
|
1044
|
+
* File name without extension, derived from `baseName`.
|
|
1045
|
+
*
|
|
1046
|
+
* @see https://nodejs.org/api/path.html#pathformatpathobject
|
|
1047
|
+
*/
|
|
1048
|
+
name: string;
|
|
1049
|
+
/**
|
|
1050
|
+
* File base name, including extension, shaped like `${name}${extname}`.
|
|
1051
|
+
*
|
|
1052
|
+
* @see https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
1053
|
+
*/
|
|
1054
|
+
baseName: `${string}.${string}`;
|
|
1055
|
+
/**
|
|
1056
|
+
* Full qualified path to the file.
|
|
1057
|
+
*/
|
|
1058
|
+
path: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* File extension extracted from `baseName`.
|
|
1061
|
+
*/
|
|
1062
|
+
extname: Extname;
|
|
1063
|
+
/**
|
|
1064
|
+
* Deduplicated list of source code fragments.
|
|
1065
|
+
*/
|
|
1066
|
+
sources: Array<SourceNode>;
|
|
1067
|
+
/**
|
|
1068
|
+
* Deduplicated list of import declarations.
|
|
1069
|
+
*/
|
|
1070
|
+
imports: Array<ImportNode>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Deduplicated list of export declarations.
|
|
1073
|
+
*/
|
|
1074
|
+
exports: Array<ExportNode>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Optional metadata attached to this file, read by plugins during barrel generation.
|
|
1077
|
+
*/
|
|
1078
|
+
meta?: TMeta;
|
|
1079
|
+
/**
|
|
1080
|
+
* Optional banner prepended to the generated file content.
|
|
1081
|
+
* Accepts `null` so `resolver.default.banner()` results can be passed directly.
|
|
1082
|
+
*/
|
|
1083
|
+
banner?: string | null;
|
|
1084
|
+
/**
|
|
1085
|
+
* Optional footer appended to the generated file content.
|
|
1086
|
+
* Accepts `null` so `resolver.default.footer()` results can be passed directly.
|
|
1087
|
+
*/
|
|
1088
|
+
footer?: string | null;
|
|
1089
|
+
/**
|
|
1090
|
+
* Absolute on-disk path to copy verbatim into the output, bypassing the parser.
|
|
1091
|
+
*
|
|
1092
|
+
* Use to emit a real source file shipped inside a package (a template) into the generated
|
|
1093
|
+
* folder without reformatting or import reordering. Only `banner` and `footer` are applied
|
|
1094
|
+
* around the copied content. When set, `copy` provides the file content and any `sources`
|
|
1095
|
+
* nodes are ignored for output; `sources` may still carry `name`/`isExportable`/`isIndexable`
|
|
1096
|
+
* so barrel generation treats the file the same as a rendered one.
|
|
1097
|
+
*/
|
|
1098
|
+
copy?: string | null;
|
|
1099
|
+
};
|
|
1100
|
+
//#endregion
|
|
599
1101
|
//#region src/jsxRenderer.d.ts
|
|
600
1102
|
/**
|
|
601
1103
|
* Factory for a renderer that walks the JSX tree in a single recursive pass,
|
|
@@ -626,7 +1128,7 @@ declare namespace Type {
|
|
|
626
1128
|
*/
|
|
627
1129
|
declare const jsxRenderer: () => {
|
|
628
1130
|
render(element: KubbReactElement): Promise<void>;
|
|
629
|
-
readonly files:
|
|
1131
|
+
readonly files: FileNode[];
|
|
630
1132
|
[Symbol.dispose](): void;
|
|
631
1133
|
};
|
|
632
1134
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
2
|
import { Fragment, jsx } from "./jsx-runtime.js";
|
|
3
3
|
import { stringify } from "yaml";
|
|
4
|
-
import { ast } from "@kubb/
|
|
4
|
+
import { ast } from "@kubb/kit";
|
|
5
5
|
//#region src/components/md/Callout.tsx
|
|
6
6
|
const CALLOUT_LABEL = {
|
|
7
7
|
tip: "TIP",
|
|
@@ -29,9 +29,11 @@ const CALLOUT_LABEL = {
|
|
|
29
29
|
*/
|
|
30
30
|
function Callout({ type, title, children }) {
|
|
31
31
|
const label = CALLOUT_LABEL[type];
|
|
32
|
+
const header = title ? `> [!${label}] ${title}` : `> [!${label}]`;
|
|
33
|
+
const quoted = children.trimEnd().split("\n").map((line) => line.length > 0 ? `> ${line}` : ">").join("\n");
|
|
32
34
|
return /* @__PURE__ */ jsx("kubb-source", {
|
|
33
35
|
name: "callout",
|
|
34
|
-
children: `${
|
|
36
|
+
children: `${header}\n${quoted}`
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
Callout.displayName = "Callout";
|
|
@@ -209,9 +211,10 @@ File.Source = FileSource;
|
|
|
209
211
|
* ```
|
|
210
212
|
*/
|
|
211
213
|
function Frontmatter({ data }) {
|
|
214
|
+
const envelope = Object.keys(data).length === 0 ? "" : `---\n${stringify(data).trimEnd()}\n---`;
|
|
212
215
|
return /* @__PURE__ */ jsx("kubb-source", {
|
|
213
216
|
name: "frontmatter",
|
|
214
|
-
children:
|
|
217
|
+
children: envelope
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
220
|
Frontmatter.displayName = "Frontmatter";
|
|
@@ -232,13 +235,14 @@ Frontmatter.displayName = "Frontmatter";
|
|
|
232
235
|
*/
|
|
233
236
|
function Function({ children, ...props }) {
|
|
234
237
|
const { name, default: isDefault, export: canExport, async: isAsync, generics, params, returnType, JSDoc } = props;
|
|
238
|
+
const genericsString = Array.isArray(generics) ? generics.join(", ").trim() : generics;
|
|
235
239
|
return /* @__PURE__ */ jsx("kubb-function", {
|
|
236
240
|
name,
|
|
237
241
|
params,
|
|
238
242
|
export: canExport,
|
|
239
243
|
default: isDefault,
|
|
240
244
|
async: isAsync,
|
|
241
|
-
generics:
|
|
245
|
+
generics: genericsString,
|
|
242
246
|
returnType,
|
|
243
247
|
JSDoc,
|
|
244
248
|
children
|
|
@@ -260,13 +264,14 @@ Function.displayName = "Function";
|
|
|
260
264
|
*/
|
|
261
265
|
function ArrowFunction({ children, ...props }) {
|
|
262
266
|
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props;
|
|
267
|
+
const genericsString = Array.isArray(generics) ? generics.join(", ").trim() : generics;
|
|
263
268
|
return /* @__PURE__ */ jsx("kubb-arrow-function", {
|
|
264
269
|
name,
|
|
265
270
|
params,
|
|
266
271
|
export: canExport,
|
|
267
272
|
default: isDefault,
|
|
268
273
|
async,
|
|
269
|
-
generics:
|
|
274
|
+
generics: genericsString,
|
|
270
275
|
returnType,
|
|
271
276
|
singleLine,
|
|
272
277
|
JSDoc,
|
|
@@ -337,9 +342,10 @@ Jsx.displayName = "Jsx";
|
|
|
337
342
|
* ```
|
|
338
343
|
*/
|
|
339
344
|
function List({ ordered, items }) {
|
|
345
|
+
const body = items.map((item, index) => `${ordered ? `${index + 1}.` : "-"} ${item}`).join("\n");
|
|
340
346
|
return /* @__PURE__ */ jsx("kubb-source", {
|
|
341
347
|
name: "list",
|
|
342
|
-
children:
|
|
348
|
+
children: body
|
|
343
349
|
});
|
|
344
350
|
}
|
|
345
351
|
List.displayName = "List";
|
|
@@ -588,7 +594,7 @@ function* walkFiles(element) {
|
|
|
588
594
|
}
|
|
589
595
|
/**
|
|
590
596
|
* Synchronous JSX renderer that walks the element tree in a single pass,
|
|
591
|
-
* producing {@link FileNode} objects directly without an intermediate virtual
|
|
597
|
+
* producing {@link ast.FileNode} objects directly without an intermediate virtual
|
|
592
598
|
* DOM. No React fiber, scheduler, or work loop is involved.
|
|
593
599
|
*
|
|
594
600
|
* All components must be pure functions. Hooks and class components are not
|
|
@@ -596,12 +602,12 @@ function* walkFiles(element) {
|
|
|
596
602
|
*/
|
|
597
603
|
var Runtime = class {
|
|
598
604
|
/**
|
|
599
|
-
* Accumulated {@link FileNode} results from every {@link render} call.
|
|
605
|
+
* Accumulated {@link ast.FileNode} results from every {@link render} call.
|
|
600
606
|
*/
|
|
601
607
|
nodes = [];
|
|
602
608
|
/**
|
|
603
609
|
* Walks `element` synchronously, converts every `<kubb-file>` subtree into
|
|
604
|
-
* a {@link FileNode} with no intermediate virtual DOM, and appends the results
|
|
610
|
+
* a {@link ast.FileNode} with no intermediate virtual DOM, and appends the results
|
|
605
611
|
* to {@link nodes}.
|
|
606
612
|
*/
|
|
607
613
|
render(element) {
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { i as KubbReactNode, r as KubbReactElement } from "./types-seYG0czS.js";
|
|
3
1
|
import { Fragment, JSX, jsxDEV } from "./jsx-runtime.js";
|
|
4
|
-
|
|
5
|
-
type JSXElement = KubbReactElement;
|
|
6
|
-
type ReactNode = KubbReactNode;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { Fragment, type JSX, JSXElement, ReactNode, jsxDEV };
|
|
9
|
-
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
2
|
+
export { Fragment, type JSX, jsxDEV };
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
2
|
import { i as KubbReactNode, n as Key, r as KubbReactElement } from "./types-seYG0czS.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ast } from "@kubb/kit";
|
|
4
4
|
//#region src/jsx-namespace.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* JSX contract for `@kubb/renderer-jsx`, resolved through `jsxImportSource`.
|
|
@@ -43,21 +43,21 @@ declare namespace JSX {
|
|
|
43
43
|
copy?: string | null;
|
|
44
44
|
meta?: FileNode['meta'] | null;
|
|
45
45
|
};
|
|
46
|
-
['kubb-source']: Omit<SourceNode, 'kind'> & {
|
|
46
|
+
['kubb-source']: Omit<ast.SourceNode, 'kind'> & {
|
|
47
47
|
children?: KubbReactNode;
|
|
48
48
|
};
|
|
49
|
-
['kubb-import']: Omit<ImportNode, 'kind'> & {};
|
|
50
|
-
['kubb-export']: Omit<ExportNode, 'kind'> & {};
|
|
51
|
-
['kubb-function']: Omit<FunctionNode, 'kind'> & {
|
|
49
|
+
['kubb-import']: Omit<ast.ImportNode, 'kind'> & {};
|
|
50
|
+
['kubb-export']: Omit<ast.ExportNode, 'kind'> & {};
|
|
51
|
+
['kubb-function']: Omit<ast.FunctionNode, 'kind'> & {
|
|
52
52
|
children?: KubbReactNode;
|
|
53
53
|
};
|
|
54
|
-
['kubb-arrow-function']: Omit<ArrowFunctionNode, 'kind'> & {
|
|
54
|
+
['kubb-arrow-function']: Omit<ast.ArrowFunctionNode, 'kind'> & {
|
|
55
55
|
children?: KubbReactNode;
|
|
56
56
|
};
|
|
57
|
-
['kubb-const']: Omit<ConstNode, 'kind'> & {
|
|
57
|
+
['kubb-const']: Omit<ast.ConstNode, 'kind'> & {
|
|
58
58
|
children?: KubbReactNode;
|
|
59
59
|
};
|
|
60
|
-
['kubb-type']: Omit<TypeNode, 'kind'> & {
|
|
60
|
+
['kubb-type']: Omit<ast.TypeNode, 'kind'> & {
|
|
61
61
|
children?: KubbReactNode;
|
|
62
62
|
};
|
|
63
63
|
br: {};
|
|
@@ -81,8 +81,6 @@ declare function createElement(type: unknown, props: Record<string, unknown> | n
|
|
|
81
81
|
declare const jsx: typeof createElement;
|
|
82
82
|
declare const jsxs: typeof createElement;
|
|
83
83
|
declare const jsxDEV: typeof createElement;
|
|
84
|
-
type JSXElement = KubbReactElement;
|
|
85
|
-
type ReactNode = KubbReactNode;
|
|
86
84
|
//#endregion
|
|
87
|
-
export { Fragment, type JSX,
|
|
85
|
+
export { Fragment, type JSX, jsx, jsxDEV, jsxs };
|
|
88
86
|
//# sourceMappingURL=jsx-runtime.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/renderer-jsx",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
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/
|
|
72
|
+
"@kubb/kit": "5.0.0"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=22"
|