@kubb/renderer-jsx 5.0.0-beta.57 → 5.0.0-beta.59

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 CHANGED
@@ -1,7 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_jsx_runtime = require("./jsx-runtime-CzH00oSR.cjs");
2
+ const require_jsx_runtime = require("./jsx-runtime-3ncySO6L.cjs");
3
3
  let yaml = require("yaml");
4
- let _kubb_ast = require("@kubb/ast");
4
+ let _kubb_ast_factory = require("@kubb/ast/factory");
5
+ _kubb_ast_factory = require_jsx_runtime.__toESM(_kubb_ast_factory);
5
6
  //#region src/components/Callout.tsx
6
7
  const CALLOUT_LABEL = {
7
8
  tip: "TIP",
@@ -443,12 +444,12 @@ function collectCodeNodes(props) {
443
444
  }
444
445
  function collectCode(element, nodes) {
445
446
  walkElement(element, (text) => {
446
- if (text.trim()) nodes.push((0, _kubb_ast.createText)(text));
447
+ if (text.trim()) nodes.push(_kubb_ast_factory.createText(text));
447
448
  }, (type, props) => resolveCodeNode(type, props, nodes));
448
449
  }
449
450
  function resolveCodeNode(type, props, nodes) {
450
451
  if (type === "br") {
451
- nodes.push((0, _kubb_ast.createBreak)());
452
+ nodes.push(_kubb_ast_factory.createBreak());
452
453
  return;
453
454
  }
454
455
  if (type === "kubb-jsx") {
@@ -456,11 +457,11 @@ function resolveCodeNode(type, props, nodes) {
456
457
  walkElement(props["children"], (t) => {
457
458
  value += t;
458
459
  }, () => {});
459
- if (value) nodes.push((0, _kubb_ast.createJsx)(value));
460
+ if (value) nodes.push(_kubb_ast_factory.createJsx(value));
460
461
  return;
461
462
  }
462
463
  if (type === "kubb-function") {
463
- nodes.push((0, _kubb_ast.createFunction)({
464
+ nodes.push(_kubb_ast_factory.createFunction({
464
465
  name: props["name"],
465
466
  params: props["params"],
466
467
  export: props["export"],
@@ -474,7 +475,7 @@ function resolveCodeNode(type, props, nodes) {
474
475
  return;
475
476
  }
476
477
  if (type === "kubb-arrow-function") {
477
- nodes.push((0, _kubb_ast.createArrowFunction)({
478
+ nodes.push(_kubb_ast_factory.createArrowFunction({
478
479
  name: props["name"],
479
480
  params: props["params"],
480
481
  export: props["export"],
@@ -489,7 +490,7 @@ function resolveCodeNode(type, props, nodes) {
489
490
  return;
490
491
  }
491
492
  if (type === "kubb-const") {
492
- nodes.push((0, _kubb_ast.createConst)({
493
+ nodes.push(_kubb_ast_factory.createConst({
493
494
  name: props["name"],
494
495
  type: props["type"],
495
496
  export: props["export"],
@@ -500,7 +501,7 @@ function resolveCodeNode(type, props, nodes) {
500
501
  return;
501
502
  }
502
503
  if (type === "kubb-type") {
503
- nodes.push((0, _kubb_ast.createType)({
504
+ nodes.push(_kubb_ast_factory.createType({
504
505
  name: props["name"],
505
506
  export: props["export"],
506
507
  JSDoc: props["JSDoc"],
@@ -517,7 +518,7 @@ function collectFileChildren(element) {
517
518
  if (text.trim()) throw new Error(`[react] '${text}' should be part of <File.Source> component when using the <File/> component`);
518
519
  }, (type, props) => {
519
520
  if (type === "kubb-source") {
520
- sources.push((0, _kubb_ast.createSource)({
521
+ sources.push(_kubb_ast_factory.createSource({
521
522
  name: props["name"]?.toString(),
522
523
  isTypeOnly: toBool(props["isTypeOnly"]),
523
524
  isExportable: toBool(props["isExportable"]),
@@ -527,7 +528,7 @@ function collectFileChildren(element) {
527
528
  return;
528
529
  }
529
530
  if (type === "kubb-export") {
530
- exports.push((0, _kubb_ast.createExport)({
531
+ exports.push(_kubb_ast_factory.createExport({
531
532
  name: props["name"],
532
533
  path: props["path"],
533
534
  isTypeOnly: toBool(props["isTypeOnly"]),
@@ -536,7 +537,7 @@ function collectFileChildren(element) {
536
537
  return;
537
538
  }
538
539
  if (type === "kubb-import") {
539
- imports.push((0, _kubb_ast.createImport)({
540
+ imports.push(_kubb_ast_factory.createImport({
540
541
  name: props["name"],
541
542
  path: props["path"],
542
543
  root: props["root"],
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { d as KubbReactNode, n as Key, t as JSDoc, u as KubbReactElement } from "./types-DBdp_5qR.js";
2
+ import { d as KubbReactNode, n as Key, t as JSDoc, u as KubbReactElement } from "./types-UI1cZVah.js";
3
3
  import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast";
4
4
 
5
5
  //#region src/components/Callout.d.ts
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./chunk-C0LytTxp.js";
2
2
  import { Fragment, jsx } from "./jsx-runtime.js";
3
3
  import { stringify } from "yaml";
4
- import { createArrowFunction, createBreak, createConst, createExport, createFunction, createImport, createJsx, createSource, createText, createType } from "@kubb/ast";
4
+ import * as factory from "@kubb/ast/factory";
5
5
  //#region src/components/Callout.tsx
6
6
  const CALLOUT_LABEL = {
7
7
  tip: "TIP",
@@ -443,12 +443,12 @@ function collectCodeNodes(props) {
443
443
  }
444
444
  function collectCode(element, nodes) {
445
445
  walkElement(element, (text) => {
446
- if (text.trim()) nodes.push(createText(text));
446
+ if (text.trim()) nodes.push(factory.createText(text));
447
447
  }, (type, props) => resolveCodeNode(type, props, nodes));
448
448
  }
449
449
  function resolveCodeNode(type, props, nodes) {
450
450
  if (type === "br") {
451
- nodes.push(createBreak());
451
+ nodes.push(factory.createBreak());
452
452
  return;
453
453
  }
454
454
  if (type === "kubb-jsx") {
@@ -456,11 +456,11 @@ function resolveCodeNode(type, props, nodes) {
456
456
  walkElement(props["children"], (t) => {
457
457
  value += t;
458
458
  }, () => {});
459
- if (value) nodes.push(createJsx(value));
459
+ if (value) nodes.push(factory.createJsx(value));
460
460
  return;
461
461
  }
462
462
  if (type === "kubb-function") {
463
- nodes.push(createFunction({
463
+ nodes.push(factory.createFunction({
464
464
  name: props["name"],
465
465
  params: props["params"],
466
466
  export: props["export"],
@@ -474,7 +474,7 @@ function resolveCodeNode(type, props, nodes) {
474
474
  return;
475
475
  }
476
476
  if (type === "kubb-arrow-function") {
477
- nodes.push(createArrowFunction({
477
+ nodes.push(factory.createArrowFunction({
478
478
  name: props["name"],
479
479
  params: props["params"],
480
480
  export: props["export"],
@@ -489,7 +489,7 @@ function resolveCodeNode(type, props, nodes) {
489
489
  return;
490
490
  }
491
491
  if (type === "kubb-const") {
492
- nodes.push(createConst({
492
+ nodes.push(factory.createConst({
493
493
  name: props["name"],
494
494
  type: props["type"],
495
495
  export: props["export"],
@@ -500,7 +500,7 @@ function resolveCodeNode(type, props, nodes) {
500
500
  return;
501
501
  }
502
502
  if (type === "kubb-type") {
503
- nodes.push(createType({
503
+ nodes.push(factory.createType({
504
504
  name: props["name"],
505
505
  export: props["export"],
506
506
  JSDoc: props["JSDoc"],
@@ -517,7 +517,7 @@ function collectFileChildren(element) {
517
517
  if (text.trim()) throw new Error(`[react] '${text}' should be part of <File.Source> component when using the <File/> component`);
518
518
  }, (type, props) => {
519
519
  if (type === "kubb-source") {
520
- sources.push(createSource({
520
+ sources.push(factory.createSource({
521
521
  name: props["name"]?.toString(),
522
522
  isTypeOnly: toBool(props["isTypeOnly"]),
523
523
  isExportable: toBool(props["isExportable"]),
@@ -527,7 +527,7 @@ function collectFileChildren(element) {
527
527
  return;
528
528
  }
529
529
  if (type === "kubb-export") {
530
- exports.push(createExport({
530
+ exports.push(factory.createExport({
531
531
  name: props["name"],
532
532
  path: props["path"],
533
533
  isTypeOnly: toBool(props["isTypeOnly"]),
@@ -536,7 +536,7 @@ function collectFileChildren(element) {
536
536
  return;
537
537
  }
538
538
  if (type === "kubb-import") {
539
- imports.push(createImport({
539
+ imports.push(factory.createImport({
540
540
  name: props["name"],
541
541
  path: props["path"],
542
542
  root: props["root"],
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_jsx_runtime = require("./jsx-runtime-CzH00oSR.cjs");
2
+ const require_jsx_runtime = require("./jsx-runtime-3ncySO6L.cjs");
3
3
  exports.Fragment = require_jsx_runtime.Fragment;
4
4
  exports.jsxDEV = require_jsx_runtime.jsxDEV;
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { d as KubbReactNode, u as KubbReactElement } from "./types-DBdp_5qR.js";
2
+ import { d as KubbReactNode, u as KubbReactElement } from "./types-UI1cZVah.js";
3
3
  import { Fragment, JSX, jsxDEV } from "./jsx-runtime.js";
4
4
 
5
5
  //#region src/jsx-dev-runtime.d.ts
@@ -1,9 +1,28 @@
1
1
  //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __name = (target, value) => __defProp(target, "name", {
4
5
  value,
5
6
  configurable: true
6
7
  });
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
7
26
  //#endregion
8
27
  //#region src/jsx-runtime.ts
9
28
  const KUBB_ELEMENT = Symbol.for("kubb.element");
@@ -14,9 +33,9 @@ const KUBB_ELEMENT = Symbol.for("kubb.element");
14
33
  const Fragment = Symbol.for("kubb.fragment");
15
34
  /**
16
35
  * Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
17
- * so the renderer never depends on React at runtime. The element carries a
18
- * `$$typeof` marker, its `type` (a host string, a function component, or
19
- * `Fragment`), and its `props`, with children included.
36
+ * so the renderer never depends on React at runtime. The `type` is a host
37
+ * string, a function component, or `Fragment`, and children are folded into
38
+ * `props`.
20
39
  */
21
40
  function createElement(type, props, key) {
22
41
  return {
@@ -42,6 +61,12 @@ Object.defineProperty(exports, "__name", {
42
61
  return __name;
43
62
  }
44
63
  });
64
+ Object.defineProperty(exports, "__toESM", {
65
+ enumerable: true,
66
+ get: function() {
67
+ return __toESM;
68
+ }
69
+ });
45
70
  Object.defineProperty(exports, "jsx", {
46
71
  enumerable: true,
47
72
  get: function() {
@@ -61,4 +86,4 @@ Object.defineProperty(exports, "jsxs", {
61
86
  }
62
87
  });
63
88
 
64
- //# sourceMappingURL=jsx-runtime-CzH00oSR.cjs.map
89
+ //# sourceMappingURL=jsx-runtime-3ncySO6L.cjs.map
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_jsx_runtime = require("./jsx-runtime-CzH00oSR.cjs");
2
+ const require_jsx_runtime = require("./jsx-runtime-3ncySO6L.cjs");
3
3
  exports.Fragment = require_jsx_runtime.Fragment;
4
4
  exports.jsx = require_jsx_runtime.jsx;
5
5
  exports.jsxDEV = require_jsx_runtime.jsxDEV;
@@ -1,11 +1,11 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { a as KubbExportProps, c as KubbImportProps, d as KubbReactNode, f as KubbSourceProps, i as KubbConstProps, l as KubbJsxProps, m as LineBreakProps, n as Key, o as KubbFileProps, p as KubbTypeProps, r as KubbArrowFunctionProps, s as KubbFunctionProps, u as KubbReactElement } from "./types-DBdp_5qR.js";
2
+ import { a as KubbExportProps, c as KubbImportProps, d as KubbReactNode, f as KubbSourceProps, i as KubbConstProps, l as KubbJsxProps, m as LineBreakProps, n as Key, o as KubbFileProps, p as KubbTypeProps, r as KubbArrowFunctionProps, s as KubbFunctionProps, u as KubbReactElement } from "./types-UI1cZVah.js";
3
3
 
4
4
  //#region src/jsx-namespace.d.ts
5
5
  /**
6
6
  * JSX contract for `@kubb/renderer-jsx`, resolved through `jsxImportSource`.
7
7
  *
8
- * It is self-contained and does not extend `React.JSX`: the renderer only emits
8
+ * It is self-contained and does not extend `React.JSX`. The renderer only emits
9
9
  * the custom `kubb-*` hosts plus `br`, `indent`, and `dedent`, and supports
10
10
  * pure function components, so the HTML element and class-component machinery
11
11
  * from `@types/react` is not needed.
@@ -51,9 +51,9 @@ declare namespace JSX {
51
51
  declare const Fragment: unique symbol;
52
52
  /**
53
53
  * Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
54
- * so the renderer never depends on React at runtime. The element carries a
55
- * `$$typeof` marker, its `type` (a host string, a function component, or
56
- * `Fragment`), and its `props`, with children included.
54
+ * so the renderer never depends on React at runtime. The `type` is a host
55
+ * string, a function component, or `Fragment`, and children are folded into
56
+ * `props`.
57
57
  */
58
58
  declare function createElement(type: unknown, props: Record<string, unknown> | null, key?: Key | null): KubbReactElement;
59
59
  declare const jsx: typeof createElement;
@@ -8,9 +8,9 @@ const KUBB_ELEMENT = Symbol.for("kubb.element");
8
8
  const Fragment = Symbol.for("kubb.fragment");
9
9
  /**
10
10
  * Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
11
- * so the renderer never depends on React at runtime. The element carries a
12
- * `$$typeof` marker, its `type` (a host string, a function component, or
13
- * `Fragment`), and its `props`, with children included.
11
+ * so the renderer never depends on React at runtime. The `type` is a host
12
+ * string, a function component, or `Fragment`, and children are folded into
13
+ * `props`.
14
14
  */
15
15
  function createElement(type, props, key) {
16
16
  return {
@@ -7,9 +7,8 @@ import { ArrowFunctionNode, ConstNode, ExportNode, FileNode, FunctionNode, Impor
7
7
  */
8
8
  type Key = string | number | bigint;
9
9
  /**
10
- * Element produced by a Kubb JSX component. It carries the host or component
11
- * `type`, its `props`, and an optional list `key`. The renderer walks these at
12
- * runtime, so the fields stay opaque to type-checking.
10
+ * Element produced by a Kubb JSX component. The renderer walks these at runtime,
11
+ * so the fields stay opaque to type-checking.
13
12
  */
14
13
  type KubbReactElement = {
15
14
  type: unknown;
@@ -113,4 +112,4 @@ type JSDoc = {
113
112
  };
114
113
  //#endregion
115
114
  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 };
116
- //# sourceMappingURL=types-DBdp_5qR.d.ts.map
115
+ //# sourceMappingURL=types-UI1cZVah.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as KubbExportProps, c as KubbImportProps, d as KubbReactNode, f as KubbSourceProps, i as KubbConstProps, l as KubbJsxProps, m as LineBreakProps, n as Key, o as KubbFileProps, p as KubbTypeProps, r as KubbArrowFunctionProps, s as KubbFunctionProps, t as JSDoc, u as KubbReactElement } from "./types-DBdp_5qR.js";
1
+ import { a as KubbExportProps, c as KubbImportProps, d as KubbReactNode, f as KubbSourceProps, i as KubbConstProps, l as KubbJsxProps, m as LineBreakProps, n as Key, o as KubbFileProps, p as KubbTypeProps, r as KubbArrowFunctionProps, s as KubbFunctionProps, t as JSDoc, u as KubbReactElement } from "./types-UI1cZVah.js";
2
2
  export { JSDoc, Key, KubbArrowFunctionProps, KubbConstProps, KubbExportProps, KubbFileProps, KubbFunctionProps, KubbImportProps, KubbJsxProps, KubbReactElement, KubbReactNode, KubbSourceProps, KubbTypeProps, LineBreakProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/renderer-jsx",
3
- "version": "5.0.0-beta.57",
3
+ "version": "5.0.0-beta.59",
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.57"
78
+ "@kubb/ast": "5.0.0-beta.59"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@internals/utils": "0.0.0"
@@ -1,16 +1,5 @@
1
1
  import type { ArrowFunctionNode, CodeNode, ExportNode, FileNode, ImportNode, JSDocNode, SourceNode } from '@kubb/ast'
2
- import {
3
- createArrowFunction,
4
- createBreak,
5
- createConst,
6
- createExport,
7
- createFunction,
8
- createImport,
9
- createJsx,
10
- createSource,
11
- createText,
12
- createType,
13
- } from '@kubb/ast'
2
+ import * as factory from '@kubb/ast/factory'
14
3
  import { KUBB_ARROW_FUNCTION, KUBB_CONST, KUBB_EXPORT, KUBB_FILE, KUBB_FUNCTION, KUBB_IMPORT, KUBB_JSX, KUBB_SOURCE, KUBB_TYPE } from './constants.ts'
15
4
  import { Fragment } from './jsx-runtime.ts'
16
5
  import type { KubbReactElement } from './types.ts'
@@ -70,7 +59,7 @@ function collectCode(element: unknown, nodes: Array<CodeNode>): void {
70
59
  walkElement(
71
60
  element,
72
61
  (text) => {
73
- if (text.trim()) nodes.push(createText(text))
62
+ if (text.trim()) nodes.push(factory.createText(text))
74
63
  },
75
64
  (type, props) => resolveCodeNode(type, props, nodes),
76
65
  )
@@ -78,7 +67,7 @@ function collectCode(element: unknown, nodes: Array<CodeNode>): void {
78
67
 
79
68
  function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Array<CodeNode>): void {
80
69
  if (type === 'br') {
81
- nodes.push(createBreak())
70
+ nodes.push(factory.createBreak())
82
71
  return
83
72
  }
84
73
 
@@ -91,13 +80,13 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Ar
91
80
  },
92
81
  () => {},
93
82
  )
94
- if (value) nodes.push(createJsx(value))
83
+ if (value) nodes.push(factory.createJsx(value))
95
84
  return
96
85
  }
97
86
 
98
87
  if (type === KUBB_FUNCTION) {
99
88
  nodes.push(
100
- createFunction({
89
+ factory.createFunction({
101
90
  name: props['name'] as string,
102
91
  params: props['params'] as string | null | undefined,
103
92
  export: props['export'] as boolean | null | undefined,
@@ -114,7 +103,7 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Ar
114
103
 
115
104
  if (type === KUBB_ARROW_FUNCTION) {
116
105
  nodes.push(
117
- createArrowFunction({
106
+ factory.createArrowFunction({
118
107
  name: props['name'] as string,
119
108
  params: props['params'] as string | null | undefined,
120
109
  export: props['export'] as boolean | null | undefined,
@@ -132,7 +121,7 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Ar
132
121
 
133
122
  if (type === KUBB_CONST) {
134
123
  nodes.push(
135
- createConst({
124
+ factory.createConst({
136
125
  name: props['name'] as string,
137
126
  type: props['type'] as string | null | undefined,
138
127
  export: props['export'] as boolean | null | undefined,
@@ -146,7 +135,7 @@ function resolveCodeNode(type: string, props: Record<string, unknown>, nodes: Ar
146
135
 
147
136
  if (type === KUBB_TYPE) {
148
137
  nodes.push(
149
- createType({
138
+ factory.createType({
150
139
  name: props['name'] as string,
151
140
  export: props['export'] as boolean | null | undefined,
152
141
  JSDoc: props['JSDoc'] as JSDocNode | null | undefined,
@@ -174,7 +163,7 @@ function collectFileChildren(element: unknown): FileChildren {
174
163
  (type, props) => {
175
164
  if (type === KUBB_SOURCE) {
176
165
  sources.push(
177
- createSource({
166
+ factory.createSource({
178
167
  name: props['name']?.toString(),
179
168
  isTypeOnly: toBool(props['isTypeOnly']),
180
169
  isExportable: toBool(props['isExportable']),
@@ -187,7 +176,7 @@ function collectFileChildren(element: unknown): FileChildren {
187
176
 
188
177
  if (type === KUBB_EXPORT) {
189
178
  exports.push(
190
- createExport({
179
+ factory.createExport({
191
180
  name: props['name'] as ExportNode['name'],
192
181
  path: props['path'] as string,
193
182
  isTypeOnly: toBool(props['isTypeOnly']),
@@ -199,7 +188,7 @@ function collectFileChildren(element: unknown): FileChildren {
199
188
 
200
189
  if (type === KUBB_IMPORT) {
201
190
  imports.push(
202
- createImport({
191
+ factory.createImport({
203
192
  name: props['name'] as ImportNode['name'],
204
193
  path: props['path'] as string,
205
194
  root: props['root'] as string | null | undefined,
@@ -17,7 +17,7 @@ import type {
17
17
  /**
18
18
  * JSX contract for `@kubb/renderer-jsx`, resolved through `jsxImportSource`.
19
19
  *
20
- * It is self-contained and does not extend `React.JSX`: the renderer only emits
20
+ * It is self-contained and does not extend `React.JSX`. The renderer only emits
21
21
  * the custom `kubb-*` hosts plus `br`, `indent`, and `dedent`, and supports
22
22
  * pure function components, so the HTML element and class-component machinery
23
23
  * from `@types/react` is not needed.
@@ -10,9 +10,9 @@ export const Fragment = Symbol.for('kubb.fragment')
10
10
 
11
11
  /**
12
12
  * Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
13
- * so the renderer never depends on React at runtime. The element carries a
14
- * `$$typeof` marker, its `type` (a host string, a function component, or
15
- * `Fragment`), and its `props`, with children included.
13
+ * so the renderer never depends on React at runtime. The `type` is a host
14
+ * string, a function component, or `Fragment`, and children are folded into
15
+ * `props`.
16
16
  */
17
17
  function createElement(type: unknown, props: Record<string, unknown> | null, key?: Key | null): KubbReactElement {
18
18
  return { $$typeof: KUBB_ELEMENT, type, key: key ?? null, props: props ?? {} } as unknown as KubbReactElement
package/src/types.ts CHANGED
@@ -6,9 +6,8 @@ import type { ArrowFunctionNode, ConstNode, ExportNode, FileNode, FunctionNode,
6
6
  export type Key = string | number | bigint
7
7
 
8
8
  /**
9
- * Element produced by a Kubb JSX component. It carries the host or component
10
- * `type`, its `props`, and an optional list `key`. The renderer walks these at
11
- * runtime, so the fields stay opaque to type-checking.
9
+ * Element produced by a Kubb JSX component. The renderer walks these at runtime,
10
+ * so the fields stay opaque to type-checking.
12
11
  */
13
12
  export type KubbReactElement = {
14
13
  type: unknown