@kubb/renderer-jsx 5.0.0-beta.66 → 5.0.0-beta.68

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,9 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_runtime = require("./rolldown-runtime-Bx3C2hgW.cjs");
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 _kubb_ast_factory = require("@kubb/ast/factory");
6
- _kubb_ast_factory = require_rolldown_runtime.__toESM(_kubb_ast_factory, 1);
5
+ let _kubb_ast = require("@kubb/ast");
7
6
  //#region src/components/Callout.tsx
8
7
  const CALLOUT_LABEL = {
9
8
  tip: "TIP",
@@ -443,12 +442,12 @@ function collectCodeNodes(props) {
443
442
  }
444
443
  function collectCode(element, nodes) {
445
444
  walkElement(element, (text) => {
446
- if (text.trim()) nodes.push(_kubb_ast_factory.createText(text));
445
+ if (text.trim()) nodes.push(_kubb_ast.ast.factory.createText(text));
447
446
  }, (type, props) => resolveCodeNode(type, props, nodes));
448
447
  }
449
448
  function resolveCodeNode(type, props, nodes) {
450
449
  if (type === "br") {
451
- nodes.push(_kubb_ast_factory.createBreak());
450
+ nodes.push(_kubb_ast.ast.factory.createBreak());
452
451
  return;
453
452
  }
454
453
  if (type === "kubb-jsx") {
@@ -456,11 +455,11 @@ function resolveCodeNode(type, props, nodes) {
456
455
  walkElement(props["children"], (t) => {
457
456
  value += t;
458
457
  }, () => {});
459
- if (value) nodes.push(_kubb_ast_factory.createJsx(value));
458
+ if (value) nodes.push(_kubb_ast.ast.factory.createJsx(value));
460
459
  return;
461
460
  }
462
461
  if (type === "kubb-function") {
463
- nodes.push(_kubb_ast_factory.createFunction({
462
+ nodes.push(_kubb_ast.ast.factory.createFunction({
464
463
  name: props["name"],
465
464
  params: props["params"],
466
465
  export: props["export"],
@@ -474,7 +473,7 @@ function resolveCodeNode(type, props, nodes) {
474
473
  return;
475
474
  }
476
475
  if (type === "kubb-arrow-function") {
477
- nodes.push(_kubb_ast_factory.createArrowFunction({
476
+ nodes.push(_kubb_ast.ast.factory.createArrowFunction({
478
477
  name: props["name"],
479
478
  params: props["params"],
480
479
  export: props["export"],
@@ -489,7 +488,7 @@ function resolveCodeNode(type, props, nodes) {
489
488
  return;
490
489
  }
491
490
  if (type === "kubb-const") {
492
- nodes.push(_kubb_ast_factory.createConst({
491
+ nodes.push(_kubb_ast.ast.factory.createConst({
493
492
  name: props["name"],
494
493
  type: props["type"],
495
494
  export: props["export"],
@@ -500,7 +499,7 @@ function resolveCodeNode(type, props, nodes) {
500
499
  return;
501
500
  }
502
501
  if (type === "kubb-type") {
503
- nodes.push(_kubb_ast_factory.createType({
502
+ nodes.push(_kubb_ast.ast.factory.createType({
504
503
  name: props["name"],
505
504
  export: props["export"],
506
505
  JSDoc: props["JSDoc"],
@@ -517,7 +516,7 @@ function collectFileChildren(element) {
517
516
  if (text.trim()) throw new Error(`[react] '${text}' should be part of <File.Source> component when using the <File/> component`);
518
517
  }, (type, props) => {
519
518
  if (type === "kubb-source") {
520
- sources.push(_kubb_ast_factory.createSource({
519
+ sources.push(_kubb_ast.ast.factory.createSource({
521
520
  name: props["name"]?.toString(),
522
521
  isTypeOnly: toBool(props["isTypeOnly"]),
523
522
  isExportable: toBool(props["isExportable"]),
@@ -527,7 +526,7 @@ function collectFileChildren(element) {
527
526
  return;
528
527
  }
529
528
  if (type === "kubb-export") {
530
- exports.push(_kubb_ast_factory.createExport({
529
+ exports.push(_kubb_ast.ast.factory.createExport({
531
530
  name: props["name"],
532
531
  path: props["path"],
533
532
  isTypeOnly: toBool(props["isTypeOnly"]),
@@ -536,7 +535,7 @@ function collectFileChildren(element) {
536
535
  return;
537
536
  }
538
537
  if (type === "kubb-import") {
539
- imports.push(_kubb_ast_factory.createImport({
538
+ imports.push(_kubb_ast.ast.factory.createImport({
540
539
  name: props["name"],
541
540
  path: props["path"],
542
541
  root: props["root"],
@@ -583,6 +582,7 @@ function* walkFiles(element) {
583
582
  meta: props["meta"] || {},
584
583
  footer: props["footer"],
585
584
  banner: props["banner"],
585
+ copy: props["copy"],
586
586
  sources,
587
587
  exports,
588
588
  imports
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
- import { d as KubbReactNode, n as Key, t as JSDoc, u as KubbReactElement } from "./types-CC4v2M00.js";
2
+ import { d as KubbReactNode, n as Key, t as JSDoc, u as KubbReactElement } from "./types-OZ23urxc.js";
3
3
  import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast";
4
4
 
5
5
  //#region src/components/Callout.d.ts
@@ -163,6 +163,13 @@ type Props$6<TMeta> = BaseProps & {
163
163
  * Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
164
164
  */
165
165
  footer?: string | null;
166
+ /**
167
+ * Absolute on-disk path to copy verbatim into the output, bypassing the parser. Use to emit a
168
+ * real source file shipped inside a package (a template) into the generated folder. Only
169
+ * `banner`/`footer` are applied around the copied content; child source blocks are ignored for
170
+ * output but still drive barrel generation.
171
+ */
172
+ copy?: string | null;
166
173
  /**
167
174
  * Child nodes rendered as the content of this file (source blocks, imports, exports).
168
175
  */
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 * as factory from "@kubb/ast/factory";
4
+ import { ast } from "@kubb/ast";
5
5
  //#region src/components/Callout.tsx
6
6
  const CALLOUT_LABEL = {
7
7
  tip: "TIP",
@@ -441,12 +441,12 @@ function collectCodeNodes(props) {
441
441
  }
442
442
  function collectCode(element, nodes) {
443
443
  walkElement(element, (text) => {
444
- if (text.trim()) nodes.push(factory.createText(text));
444
+ if (text.trim()) nodes.push(ast.factory.createText(text));
445
445
  }, (type, props) => resolveCodeNode(type, props, nodes));
446
446
  }
447
447
  function resolveCodeNode(type, props, nodes) {
448
448
  if (type === "br") {
449
- nodes.push(factory.createBreak());
449
+ nodes.push(ast.factory.createBreak());
450
450
  return;
451
451
  }
452
452
  if (type === "kubb-jsx") {
@@ -454,11 +454,11 @@ function resolveCodeNode(type, props, nodes) {
454
454
  walkElement(props["children"], (t) => {
455
455
  value += t;
456
456
  }, () => {});
457
- if (value) nodes.push(factory.createJsx(value));
457
+ if (value) nodes.push(ast.factory.createJsx(value));
458
458
  return;
459
459
  }
460
460
  if (type === "kubb-function") {
461
- nodes.push(factory.createFunction({
461
+ nodes.push(ast.factory.createFunction({
462
462
  name: props["name"],
463
463
  params: props["params"],
464
464
  export: props["export"],
@@ -472,7 +472,7 @@ function resolveCodeNode(type, props, nodes) {
472
472
  return;
473
473
  }
474
474
  if (type === "kubb-arrow-function") {
475
- nodes.push(factory.createArrowFunction({
475
+ nodes.push(ast.factory.createArrowFunction({
476
476
  name: props["name"],
477
477
  params: props["params"],
478
478
  export: props["export"],
@@ -487,7 +487,7 @@ function resolveCodeNode(type, props, nodes) {
487
487
  return;
488
488
  }
489
489
  if (type === "kubb-const") {
490
- nodes.push(factory.createConst({
490
+ nodes.push(ast.factory.createConst({
491
491
  name: props["name"],
492
492
  type: props["type"],
493
493
  export: props["export"],
@@ -498,7 +498,7 @@ function resolveCodeNode(type, props, nodes) {
498
498
  return;
499
499
  }
500
500
  if (type === "kubb-type") {
501
- nodes.push(factory.createType({
501
+ nodes.push(ast.factory.createType({
502
502
  name: props["name"],
503
503
  export: props["export"],
504
504
  JSDoc: props["JSDoc"],
@@ -515,7 +515,7 @@ function collectFileChildren(element) {
515
515
  if (text.trim()) throw new Error(`[react] '${text}' should be part of <File.Source> component when using the <File/> component`);
516
516
  }, (type, props) => {
517
517
  if (type === "kubb-source") {
518
- sources.push(factory.createSource({
518
+ sources.push(ast.factory.createSource({
519
519
  name: props["name"]?.toString(),
520
520
  isTypeOnly: toBool(props["isTypeOnly"]),
521
521
  isExportable: toBool(props["isExportable"]),
@@ -525,7 +525,7 @@ function collectFileChildren(element) {
525
525
  return;
526
526
  }
527
527
  if (type === "kubb-export") {
528
- exports.push(factory.createExport({
528
+ exports.push(ast.factory.createExport({
529
529
  name: props["name"],
530
530
  path: props["path"],
531
531
  isTypeOnly: toBool(props["isTypeOnly"]),
@@ -534,7 +534,7 @@ function collectFileChildren(element) {
534
534
  return;
535
535
  }
536
536
  if (type === "kubb-import") {
537
- imports.push(factory.createImport({
537
+ imports.push(ast.factory.createImport({
538
538
  name: props["name"],
539
539
  path: props["path"],
540
540
  root: props["root"],
@@ -581,6 +581,7 @@ function* walkFiles(element) {
581
581
  meta: props["meta"] || {},
582
582
  footer: props["footer"],
583
583
  banner: props["banner"],
584
+ copy: props["copy"],
584
585
  sources,
585
586
  exports,
586
587
  imports
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
- import { d as KubbReactNode, u as KubbReactElement } from "./types-CC4v2M00.js";
2
+ import { d as KubbReactNode, u as KubbReactElement } from "./types-OZ23urxc.js";
3
3
  import { Fragment, JSX, jsxDEV } from "./jsx-runtime.js";
4
4
 
5
5
  //#region src/jsx-dev-runtime.d.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./rolldown-runtime-Bx3C2hgW.cjs");
2
+ require("./rolldown-runtime-ClG-MNz_.cjs");
3
3
  //#region src/jsx-runtime.ts
4
4
  const KUBB_ELEMENT = Symbol.for("kubb.element");
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./rolldown-runtime-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-CC4v2M00.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-OZ23urxc.js";
3
3
 
4
4
  //#region src/jsx-namespace.d.ts
5
5
  /**
@@ -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
+ });
@@ -36,7 +36,11 @@ type KubbFileProps = {
36
36
  children?: KubbReactNode;
37
37
  baseName: string;
38
38
  path: string;
39
- override?: boolean | null;
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;
40
44
  meta?: FileNode['meta'] | null;
41
45
  };
42
46
  /**
@@ -112,4 +116,4 @@ type JSDoc = {
112
116
  };
113
117
  //#endregion
114
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 };
115
- //# sourceMappingURL=types-CC4v2M00.d.ts.map
119
+ //# sourceMappingURL=types-OZ23urxc.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-CC4v2M00.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-OZ23urxc.js";
2
2
  export { JSDoc, Key, KubbArrowFunctionProps, KubbConstProps, KubbExportProps, KubbFileProps, KubbFunctionProps, KubbImportProps, KubbJsxProps, KubbReactElement, KubbReactNode, KubbSourceProps, KubbTypeProps, LineBreakProps };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@kubb/renderer-jsx",
3
- "version": "5.0.0-beta.66",
3
+ "version": "5.0.0-beta.68",
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",
7
7
  "jsx",
8
8
  "jsx-runtime",
9
9
  "kubb",
10
+ "meta-framework",
10
11
  "typescript"
11
12
  ],
12
13
  "license": "MIT",
@@ -68,7 +69,7 @@
68
69
  },
69
70
  "dependencies": {
70
71
  "yaml": "^2.9.0",
71
- "@kubb/ast": "5.0.0-beta.66"
72
+ "@kubb/ast": "5.0.0-beta.68"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@internals/utils": "0.0.0"
@@ -1,38 +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 __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));
26
- //#endregion
27
- Object.defineProperty(exports, "__name", {
28
- enumerable: true,
29
- get: function() {
30
- return __name;
31
- }
32
- });
33
- Object.defineProperty(exports, "__toESM", {
34
- enumerable: true,
35
- get: function() {
36
- return __toESM;
37
- }
38
- });