@kubb/renderer-jsx 5.0.0-beta.9 → 5.0.0-beta.93

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.
@@ -1,11 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_jsx_runtime$1 = require("./jsx-runtime-DdmO3p0U.cjs");
3
- //#region src/jsx-dev-runtime.ts
4
- var import_jsx_runtime = /* @__PURE__ */ require_jsx_runtime$1.__toESM(require_jsx_runtime$1.require_jsx_runtime(), 1);
5
- const Fragment = import_jsx_runtime.Fragment;
6
- const jsxDEV = import_jsx_runtime.jsx;
7
- //#endregion
8
- exports.Fragment = Fragment;
9
- exports.jsxDEV = jsxDEV;
10
-
11
- //# sourceMappingURL=jsx-dev-runtime.cjs.map
2
+ const require_jsx_runtime = require("./jsx-runtime.cjs");
3
+ exports.Fragment = require_jsx_runtime.Fragment;
4
+ exports.jsxDEV = require_jsx_runtime.jsxDEV;
@@ -1,14 +1,10 @@
1
- import { n as __name } from "./chunk-Bb7HlUDG.js";
2
- import { h as KubbReactNode, m as KubbReactElement } from "./types-nAFMiWFw.js";
3
- import { t as JSX } from "./jsx-namespace-CNp0arTN.js";
4
- import * as _$react from "react";
5
- import * as React$1 from "react/jsx-runtime";
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
+ import { i as KubbReactNode, r as KubbReactElement } from "./types-1dqfG_Fl.js";
3
+ import { Fragment, JSX, jsxDEV } from "./jsx-runtime.js";
6
4
 
7
5
  //#region src/jsx-dev-runtime.d.ts
8
- declare const Fragment: _$react.ExoticComponent<_$react.FragmentProps>;
9
- declare const jsxDEV: typeof React$1.jsx;
10
6
  type JSXElement = KubbReactElement;
11
7
  type ReactNode = KubbReactNode;
12
8
  //#endregion
13
- export { Fragment, JSX, JSXElement, ReactNode, jsxDEV };
9
+ export { Fragment, type JSX, JSXElement, ReactNode, jsxDEV };
14
10
  //# sourceMappingURL=jsx-dev-runtime.d.ts.map
@@ -1,10 +1,2 @@
1
- import { r as __toESM } from "./chunk-Bb7HlUDG.js";
2
- import { t as require_jsx_runtime } from "./jsx-runtime-Cvu_ZYgL.js";
3
- //#region src/jsx-dev-runtime.ts
4
- var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
5
- const Fragment = import_jsx_runtime.Fragment;
6
- const jsxDEV = import_jsx_runtime.jsx;
7
- //#endregion
1
+ import { Fragment, jsxDEV } from "./jsx-runtime.js";
8
2
  export { Fragment, jsxDEV };
9
-
10
- //# sourceMappingURL=jsx-dev-runtime.js.map
@@ -1,11 +1,29 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_jsx_runtime$1 = require("./jsx-runtime-DdmO3p0U.cjs");
2
+ require("./rolldown-runtime-ClG-MNz_.cjs");
3
3
  //#region src/jsx-runtime.ts
4
- var import_jsx_runtime = /* @__PURE__ */ require_jsx_runtime$1.__toESM(require_jsx_runtime$1.require_jsx_runtime(), 1);
5
- const Fragment = import_jsx_runtime.Fragment;
6
- const jsx = import_jsx_runtime.jsx;
7
- const jsxDEV = import_jsx_runtime.jsx;
8
- const jsxs = import_jsx_runtime.jsxs;
4
+ const KUBB_ELEMENT = Symbol.for("kubb.element");
5
+ /**
6
+ * Fragment marker. A `<>…</>` compiles to `jsx(Fragment, …)`, and the renderer
7
+ * unwraps it while walking the tree.
8
+ */
9
+ const Fragment = Symbol.for("kubb.fragment");
10
+ /**
11
+ * Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
12
+ * so the renderer never depends on React at runtime. The `type` is a host
13
+ * string, a function component, or `Fragment`, and children are folded into
14
+ * `props`.
15
+ */
16
+ function createElement(type, props, key) {
17
+ return {
18
+ $$typeof: KUBB_ELEMENT,
19
+ type,
20
+ key: key ?? null,
21
+ props: props ?? {}
22
+ };
23
+ }
24
+ const jsx = createElement;
25
+ const jsxs = createElement;
26
+ const jsxDEV = createElement;
9
27
  //#endregion
10
28
  exports.Fragment = Fragment;
11
29
  exports.jsx = jsx;
@@ -1,16 +1,89 @@
1
- import { n as __name } from "./chunk-Bb7HlUDG.js";
2
- import { h as KubbReactNode, m as KubbReactElement } from "./types-nAFMiWFw.js";
3
- import { t as JSX } from "./jsx-namespace-CNp0arTN.js";
4
- import * as _$react from "react";
5
- import * as React$1 from "react/jsx-runtime";
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
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";
6
4
 
5
+ //#region src/jsx-namespace.d.ts
6
+ /**
7
+ * JSX contract for `@kubb/renderer-jsx`, resolved through `jsxImportSource`.
8
+ *
9
+ * It is self-contained and does not extend `React.JSX`. The renderer only emits
10
+ * the custom `kubb-*` hosts plus `br`, and supports pure function components, so
11
+ * the HTML element and class-component machinery from `@types/react` is not needed.
12
+ */
13
+ declare namespace JSX {
14
+ type ElementType = string | ((props: any) => KubbReactNode);
15
+ type Element = KubbReactElement;
16
+ interface ElementClass {
17
+ render(): KubbReactNode;
18
+ }
19
+ interface ElementAttributesProperty {
20
+ props: {};
21
+ }
22
+ interface ElementChildrenAttribute {
23
+ children: {};
24
+ }
25
+ interface IntrinsicAttributes {
26
+ key?: Key | null;
27
+ }
28
+ interface IntrinsicClassAttributes<T> {
29
+ key?: Key | null;
30
+ }
31
+ interface IntrinsicElements {
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: {};
65
+ }
66
+ type LibraryManagedAttributes<C, P> = P;
67
+ }
68
+ //#endregion
7
69
  //#region src/jsx-runtime.d.ts
8
- declare const Fragment: _$react.ExoticComponent<_$react.FragmentProps>;
9
- declare const jsx: typeof React$1.jsx;
10
- declare const jsxDEV: typeof React$1.jsx;
11
- declare const jsxs: typeof React$1.jsxs;
70
+ /**
71
+ * Fragment marker. A `<>…</>` compiles to `jsx(Fragment, …)`, and the renderer
72
+ * unwraps it while walking the tree.
73
+ */
74
+ declare const Fragment: unique symbol;
75
+ /**
76
+ * Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
77
+ * so the renderer never depends on React at runtime. The `type` is a host
78
+ * string, a function component, or `Fragment`, and children are folded into
79
+ * `props`.
80
+ */
81
+ declare function createElement(type: unknown, props: Record<string, unknown> | null, key?: Key | null): KubbReactElement;
82
+ declare const jsx: typeof createElement;
83
+ declare const jsxs: typeof createElement;
84
+ declare const jsxDEV: typeof createElement;
12
85
  type JSXElement = KubbReactElement;
13
86
  type ReactNode = KubbReactNode;
14
87
  //#endregion
15
- export { Fragment, JSX, JSXElement, ReactNode, jsx, jsxDEV, jsxs };
88
+ export { Fragment, type JSX, JSXElement, ReactNode, jsx, jsxDEV, jsxs };
16
89
  //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1,11 +1,28 @@
1
- import { r as __toESM } from "./chunk-Bb7HlUDG.js";
2
- import { t as require_jsx_runtime } from "./jsx-runtime-Cvu_ZYgL.js";
1
+ import "./rolldown-runtime-C0LytTxp.js";
3
2
  //#region src/jsx-runtime.ts
4
- var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
5
- const Fragment = import_jsx_runtime.Fragment;
6
- const jsx = import_jsx_runtime.jsx;
7
- const jsxDEV = import_jsx_runtime.jsx;
8
- const jsxs = import_jsx_runtime.jsxs;
3
+ const KUBB_ELEMENT = Symbol.for("kubb.element");
4
+ /**
5
+ * Fragment marker. A `<>…</>` compiles to `jsx(Fragment, …)`, and the renderer
6
+ * unwraps it while walking the tree.
7
+ */
8
+ const Fragment = Symbol.for("kubb.fragment");
9
+ /**
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 `type` is a host
12
+ * string, a function component, or `Fragment`, and children are folded into
13
+ * `props`.
14
+ */
15
+ function createElement(type, props, key) {
16
+ return {
17
+ $$typeof: KUBB_ELEMENT,
18
+ type,
19
+ key: key ?? null,
20
+ props: props ?? {}
21
+ };
22
+ }
23
+ const jsx = createElement;
24
+ const jsxs = createElement;
25
+ const jsxDEV = createElement;
9
26
  //#endregion
10
27
  export { Fragment, jsx, jsxDEV, jsxs };
11
28
 
@@ -0,0 +1,8 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ //#endregion
8
+ export { __name as t };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ //#endregion
8
+ Object.defineProperty(exports, "__name", {
9
+ enumerable: true,
10
+ get: function() {
11
+ return __name;
12
+ }
13
+ });
@@ -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 { _ 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-nAFMiWFw.js";
2
- export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbArrowFunctionProps, KubbConstProps, KubbExportProps, KubbFileProps, KubbFunctionProps, KubbImportProps, KubbJsxProps, KubbReactElement, KubbReactNode, KubbSourceProps, KubbTextProps, KubbTypeProps, LineBreakProps, TextNode };
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,13 +1,13 @@
1
1
  {
2
2
  "name": "@kubb/renderer-jsx",
3
- "version": "5.0.0-beta.9",
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.",
3
+ "version": "5.0.0-beta.93",
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",
7
7
  "jsx",
8
8
  "jsx-runtime",
9
9
  "kubb",
10
- "react",
10
+ "meta-framework",
11
11
  "typescript"
12
12
  ],
13
13
  "license": "MIT",
@@ -18,7 +18,6 @@
18
18
  "directory": "packages/renderer-jsx"
19
19
  },
20
20
  "files": [
21
- "src",
22
21
  "dist",
23
22
  "*.d.ts",
24
23
  "*.d.cts",
@@ -28,18 +27,12 @@
28
27
  "!/**/__snapshots__/**"
29
28
  ],
30
29
  "type": "module",
31
- "sideEffects": [
32
- "./dist/globals.js",
33
- "./dist/globals.cjs"
34
- ],
30
+ "sideEffects": false,
35
31
  "main": "./dist/index.cjs",
36
32
  "module": "./dist/index.js",
37
33
  "types": "./dist/index.d.ts",
38
34
  "typesVersions": {
39
35
  "*": {
40
- "globals": [
41
- "./dist/globals.d.ts"
42
- ],
43
36
  "jsx-dev-runtime": [
44
37
  "./dist/jsx-runtime.d.ts"
45
38
  ],
@@ -75,41 +68,19 @@
75
68
  "registry": "https://registry.npmjs.org/"
76
69
  },
77
70
  "dependencies": {
78
- "@kubb/ast": "5.0.0-beta.9"
79
- },
80
- "devDependencies": {
81
- "@types/react": "^19.2.14",
82
- "@types/react-reconciler": "0.33.0",
83
- "react": "19.2.5",
84
- "react-reconciler": "0.33.0",
85
- "@internals/utils": "0.0.0"
71
+ "yaml": "^2.9.0",
72
+ "@kubb/ast": "5.0.0-beta.93"
86
73
  },
87
- "size-limit": [
88
- {
89
- "path": "./dist/*.js",
90
- "limit": "510 KiB",
91
- "gzip": true
92
- }
93
- ],
94
74
  "engines": {
95
75
  "node": ">=22"
96
76
  },
97
- "inlinedDependencies": {
98
- "react": "19.2.5",
99
- "react-reconciler": "0.33.0",
100
- "scheduler": "0.27.0"
101
- },
102
77
  "scripts": {
103
- "build": "tsdown && size-limit",
78
+ "build": "tsdown",
104
79
  "clean": "node -e \"require('fs').rmSync('./dist', {recursive:true,force:true})\"",
105
80
  "lint": "oxlint .",
106
81
  "lint:fix": "oxlint --fix .",
107
- "release": "pnpm publish --no-git-check",
108
- "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check -tag canary",
109
82
  "start": "tsdown --watch ./src",
110
- "start:devtools": "npx react-devtools",
111
83
  "test": "vitest --passWithNoTests",
112
- "test:devtools": "node ./dist/runner.cjs",
113
84
  "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
114
85
  }
115
86
  }
@@ -1,28 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", {
5
- value,
6
- configurable: true
7
- });
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
- //#endregion
28
- export { __name as n, __toESM as r, __commonJSMin as t };
@@ -1,39 +0,0 @@
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-nAFMiWFw.js";
3
- import React from "react";
4
-
5
- //#region src/jsx-namespace.d.ts
6
- declare namespace JSX$1 {
7
- type ElementType = React.JSX.ElementType;
8
- type Element = KubbReactElement;
9
- interface ElementClass extends React.JSX.ElementClass {
10
- render(): KubbReactNode;
11
- }
12
- interface ElementAttributesProperty {
13
- props: {};
14
- }
15
- interface ElementChildrenAttribute {
16
- children: {};
17
- }
18
- interface IntrinsicElements extends React.JSX.IntrinsicElements {
19
- 'kubb-jsx': KubbJsxProps;
20
- 'kubb-text': KubbTextProps;
21
- 'kubb-file': KubbFileProps;
22
- 'kubb-source': KubbSourceProps;
23
- 'kubb-import': KubbImportProps;
24
- 'kubb-export': KubbExportProps;
25
- 'kubb-function': KubbFunctionProps;
26
- 'kubb-arrow-function': KubbArrowFunctionProps;
27
- 'kubb-const': KubbConstProps;
28
- 'kubb-type': KubbTypeProps;
29
- br: LineBreakProps;
30
- indent: {};
31
- dedent: {};
32
- }
33
- type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
34
- interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
35
- interface IntrinsicElements extends React.JSX.IntrinsicElements {}
36
- }
37
- //#endregion
38
- export { JSX$1 as t };
39
- //# sourceMappingURL=jsx-namespace-CNp0arTN.d.ts.map