@kubb/renderer-jsx 5.0.0-beta.20 → 5.0.0-beta.21

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
@@ -486,7 +486,7 @@ const createNode = (nodeName) => {
486
486
  nodeName,
487
487
  attributes: Object.create(null),
488
488
  childNodes: [],
489
- parentNode: void 0
489
+ parentNode: null
490
490
  };
491
491
  };
492
492
  /**
@@ -524,7 +524,7 @@ const insertBeforeNode = (node, newChildNode, beforeChildNode) => {
524
524
  * Does nothing if `removeNode` is not a direct child of `node`.
525
525
  */
526
526
  const removeChildNode = (node, removeNode) => {
527
- removeNode.parentNode = void 0;
527
+ removeNode.parentNode = null;
528
528
  const index = node.childNodes.indexOf(removeNode);
529
529
  if (index >= 0) node.childNodes.splice(index, 1);
530
530
  };
@@ -541,7 +541,7 @@ const createTextNode = (text) => {
541
541
  return {
542
542
  nodeName: TEXT_NODE_NAME,
543
543
  nodeValue: text,
544
- parentNode: void 0
544
+ parentNode: null
545
545
  };
546
546
  };
547
547
  /**
@@ -18408,8 +18408,14 @@ const jsxRenderer = () => {
18408
18408
  get files() {
18409
18409
  return runtime.nodes;
18410
18410
  },
18411
+ dispose() {
18412
+ runtime.unmount();
18413
+ },
18411
18414
  unmount(error) {
18412
18415
  runtime.unmount(error);
18416
+ },
18417
+ [Symbol.dispose]() {
18418
+ this.dispose();
18413
18419
  }
18414
18420
  };
18415
18421
  };
@@ -18451,7 +18457,11 @@ const jsxRendererSync = () => {
18451
18457
  stream(element) {
18452
18458
  return runtime.stream(element);
18453
18459
  },
18454
- unmount(_error) {}
18460
+ dispose() {},
18461
+ unmount(_error) {},
18462
+ [Symbol.dispose]() {
18463
+ this.dispose();
18464
+ }
18455
18465
  };
18456
18466
  };
18457
18467
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as __name } from "./chunk-Bb7HlUDG.js";
2
- import { a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key } from "./types-Dk7A1Y5U.js";
2
+ import { a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key } from "./types-D3-ni438.js";
3
3
  import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast";
4
4
  import * as _$react from "react";
5
5
 
@@ -540,7 +540,9 @@ declare namespace Type {
540
540
  declare const jsxRenderer: () => {
541
541
  render(element: KubbReactElement): Promise<void>;
542
542
  readonly files: FileNode[];
543
+ dispose(): void;
543
544
  unmount(error?: Error | number | null): void;
545
+ [Symbol.dispose](): void;
544
546
  };
545
547
  /**
546
548
  * Lightweight renderer factory with no React fiber, scheduler, or work loop.
@@ -572,7 +574,9 @@ declare const jsxRendererSync: () => {
572
574
  render(element: KubbReactElement): Promise<void>;
573
575
  readonly files: FileNode[];
574
576
  stream(element: KubbReactElement): Generator<FileNode>;
577
+ dispose(): void;
575
578
  unmount(_error?: Error | number | null): void;
579
+ [Symbol.dispose](): void;
576
580
  };
577
581
  //#endregion
578
582
  export { Const, File, Function, Jsx, Root, Type, createContext, inject, jsxRenderer, jsxRendererSync, provide, unprovide };
package/dist/index.js CHANGED
@@ -486,7 +486,7 @@ const createNode = (nodeName) => {
486
486
  nodeName,
487
487
  attributes: Object.create(null),
488
488
  childNodes: [],
489
- parentNode: void 0
489
+ parentNode: null
490
490
  };
491
491
  };
492
492
  /**
@@ -524,7 +524,7 @@ const insertBeforeNode = (node, newChildNode, beforeChildNode) => {
524
524
  * Does nothing if `removeNode` is not a direct child of `node`.
525
525
  */
526
526
  const removeChildNode = (node, removeNode) => {
527
- removeNode.parentNode = void 0;
527
+ removeNode.parentNode = null;
528
528
  const index = node.childNodes.indexOf(removeNode);
529
529
  if (index >= 0) node.childNodes.splice(index, 1);
530
530
  };
@@ -541,7 +541,7 @@ const createTextNode = (text) => {
541
541
  return {
542
542
  nodeName: TEXT_NODE_NAME,
543
543
  nodeValue: text,
544
- parentNode: void 0
544
+ parentNode: null
545
545
  };
546
546
  };
547
547
  /**
@@ -18405,8 +18405,14 @@ const jsxRenderer = () => {
18405
18405
  get files() {
18406
18406
  return runtime.nodes;
18407
18407
  },
18408
+ dispose() {
18409
+ runtime.unmount();
18410
+ },
18408
18411
  unmount(error) {
18409
18412
  runtime.unmount(error);
18413
+ },
18414
+ [Symbol.dispose]() {
18415
+ this.dispose();
18410
18416
  }
18411
18417
  };
18412
18418
  };
@@ -18448,7 +18454,11 @@ const jsxRendererSync = () => {
18448
18454
  stream(element) {
18449
18455
  return runtime.stream(element);
18450
18456
  },
18451
- unmount(_error) {}
18457
+ dispose() {},
18458
+ unmount(_error) {},
18459
+ [Symbol.dispose]() {
18460
+ this.dispose();
18461
+ }
18452
18462
  };
18453
18463
  };
18454
18464
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { n as __name } from "./chunk-Bb7HlUDG.js";
2
- import { h as KubbReactNode, m as KubbReactElement } from "./types-Dk7A1Y5U.js";
3
- import { t as JSX } from "./jsx-namespace-BLGeMDcR.js";
2
+ import { h as KubbReactNode, m as KubbReactElement } from "./types-D3-ni438.js";
3
+ import { t as JSX } from "./jsx-namespace-C7dcxEyT.js";
4
4
  import * as _$react from "react";
5
5
  import * as React$1 from "react/jsx-runtime";
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { n as __name } from "./chunk-Bb7HlUDG.js";
2
- import { _ as KubbTextProps, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, l as KubbExportProps, m as KubbReactElement, p as KubbJsxProps, s as KubbArrowFunctionProps, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-Dk7A1Y5U.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-D3-ni438.js";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/jsx-namespace.d.ts
@@ -36,4 +36,4 @@ declare namespace JSX$1 {
36
36
  }
37
37
  //#endregion
38
38
  export { JSX$1 as t };
39
- //# sourceMappingURL=jsx-namespace-BLGeMDcR.d.ts.map
39
+ //# sourceMappingURL=jsx-namespace-C7dcxEyT.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { n as __name } from "./chunk-Bb7HlUDG.js";
2
- import { h as KubbReactNode, m as KubbReactElement } from "./types-Dk7A1Y5U.js";
3
- import { t as JSX } from "./jsx-namespace-BLGeMDcR.js";
2
+ import { h as KubbReactNode, m as KubbReactElement } from "./types-D3-ni438.js";
3
+ import { t as JSX } from "./jsx-namespace-C7dcxEyT.js";
4
4
  import * as _$react from "react";
5
5
  import * as React$1 from "react/jsx-runtime";
6
6
 
@@ -13,7 +13,7 @@ type Key = string | number | bigint;
13
13
  */
14
14
  type ElementNames = 'br' | 'div' | 'indent' | 'dedent' | 'kubb-jsx' | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-function' | 'kubb-arrow-function' | 'kubb-const' | 'kubb-type' | 'kubb-root' | 'kubb-app';
15
15
  type Node = {
16
- parentNode: DOMElement | undefined;
16
+ parentNode: DOMElement | null;
17
17
  internal_static?: boolean;
18
18
  };
19
19
  /**
@@ -165,4 +165,4 @@ type JSDoc = {
165
165
  };
166
166
  //#endregion
167
167
  export { KubbTextProps as _, JSDoc as a, TextNode as b, KubbConstProps as c, KubbFunctionProps as d, KubbImportProps as f, KubbSourceProps as g, KubbReactNode as h, ElementNames as i, KubbExportProps as l, KubbReactElement as m, DOMNode as n, Key as o, KubbJsxProps as p, DOMNodeAttribute as r, KubbArrowFunctionProps as s, DOMElement as t, KubbFileProps as u, KubbTypeProps as v, LineBreakProps as y };
168
- //# sourceMappingURL=types-Dk7A1Y5U.d.ts.map
168
+ //# sourceMappingURL=types-D3-ni438.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-Dk7A1Y5U.js";
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-D3-ni438.js";
2
2
  export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbArrowFunctionProps, KubbConstProps, KubbExportProps, KubbFileProps, KubbFunctionProps, KubbImportProps, KubbJsxProps, KubbReactElement, KubbReactNode, KubbSourceProps, KubbTextProps, KubbTypeProps, LineBreakProps, TextNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/renderer-jsx",
3
- "version": "5.0.0-beta.20",
3
+ "version": "5.0.0-beta.21",
4
4
  "description": "JSX-based renderer for Kubb. Provides a custom React runtime, reconciler, and built-in components (File, Function, Type, Const) for component-based, type-safe code generation.",
5
5
  "keywords": [
6
6
  "codegen",
@@ -75,7 +75,7 @@
75
75
  "registry": "https://registry.npmjs.org/"
76
76
  },
77
77
  "dependencies": {
78
- "@kubb/ast": "5.0.0-beta.20"
78
+ "@kubb/ast": "5.0.0-beta.21"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@types/react": "^19.2.14",
@@ -30,9 +30,15 @@ export const jsxRenderer = () => {
30
30
  get files() {
31
31
  return runtime.nodes
32
32
  },
33
+ dispose() {
34
+ runtime.unmount()
35
+ },
33
36
  unmount(error?: Error | number | null) {
34
37
  runtime.unmount(error)
35
38
  },
39
+ [Symbol.dispose]() {
40
+ this.dispose()
41
+ },
36
42
  }
37
43
  }
38
44
 
@@ -75,6 +81,10 @@ export const jsxRendererSync = () => {
75
81
  stream(element: KubbReactElement): Generator<FileNode> {
76
82
  return runtime.stream(element)
77
83
  },
84
+ dispose() {},
78
85
  unmount(_error?: Error | number | null) {},
86
+ [Symbol.dispose]() {
87
+ this.dispose()
88
+ },
79
89
  }
80
90
  }
package/src/dom.ts CHANGED
@@ -10,7 +10,7 @@ export const createNode = (nodeName: string): DOMElement => {
10
10
  nodeName: nodeName as DOMElement['nodeName'],
11
11
  attributes: Object.create(null) as Record<string, DOMNodeAttribute>,
12
12
  childNodes: [],
13
- parentNode: undefined,
13
+ parentNode: null,
14
14
  }
15
15
  }
16
16
 
@@ -59,7 +59,7 @@ export const insertBeforeNode = (node: DOMElement, newChildNode: DOMNode, before
59
59
  * Does nothing if `removeNode` is not a direct child of `node`.
60
60
  */
61
61
  export const removeChildNode = (node: DOMElement, removeNode: DOMNode): void => {
62
- removeNode.parentNode = undefined
62
+ removeNode.parentNode = null
63
63
 
64
64
  const index = node.childNodes.indexOf(removeNode)
65
65
  if (index >= 0) {
@@ -81,7 +81,7 @@ export const createTextNode = (text: string): TextNode => {
81
81
  return {
82
82
  nodeName: TEXT_NODE_NAME,
83
83
  nodeValue: text,
84
- parentNode: undefined,
84
+ parentNode: null,
85
85
  }
86
86
  }
87
87
 
package/src/types.ts CHANGED
@@ -30,7 +30,7 @@ export type ElementNames =
30
30
  | 'kubb-app'
31
31
 
32
32
  type Node = {
33
- parentNode: DOMElement | undefined
33
+ parentNode: DOMElement | null
34
34
  internal_static?: boolean
35
35
  }
36
36