@kubb/react-fabric 0.13.2 → 0.14.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/README.md +2 -2
- package/dist/{chunk-Cnw5r_-A.js → chunk-BGCRLu6H.js} +16 -21
- package/dist/globals.d.ts +2 -1
- package/dist/globals.js +1 -1
- package/dist/index.cjs +79 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -27
- package/dist/index.js +27 -35
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +6 -227
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +5 -4
- package/dist/jsx-dev-runtime.js +6 -227
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/{jsx-namespace-CFK460kI.d.ts → jsx-namespace-C9N4PA8a.d.ts} +3 -2
- package/dist/{react-DorQ0Kea.cjs → jsx-runtime-Bl0DfUmV.js} +347 -75
- package/dist/jsx-runtime-Bl0DfUmV.js.map +1 -0
- package/dist/{react-D652OKii.js → jsx-runtime-Cua1md-Z.cjs} +402 -31
- package/dist/jsx-runtime-Cua1md-Z.cjs.map +1 -0
- package/dist/jsx-runtime.cjs +4 -6
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.ts +3 -2
- package/dist/jsx-runtime.js +3 -5
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/parsers.cjs +7 -7
- package/dist/parsers.js +2 -3
- package/dist/plugins.cjs +10 -10
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +4 -7
- package/dist/{reactPlugin-CJEggKNs.d.ts → reactPlugin-CKiGUCKQ.d.ts} +11 -10
- package/dist/{reactPlugin-BGbgHJfV.cjs → reactPlugin-D74A1eG4.cjs} +1495 -377
- package/dist/{reactPlugin-BGbgHJfV.cjs.map → reactPlugin-D74A1eG4.cjs.map} +1 -1
- package/dist/{reactPlugin-tE73eBS_.js → reactPlugin-QQPrjNuQ.js} +1460 -342
- package/dist/{reactPlugin-tE73eBS_.js.map → reactPlugin-QQPrjNuQ.js.map} +1 -1
- package/dist/types-BJVZ7ita.d.ts +104 -0
- package/dist/types.cjs +7 -7
- package/dist/types.d.ts +2 -62
- package/dist/types.js +2 -3
- package/package.json +9 -3
- package/src/components/{App.tsx → Fabric.tsx} +6 -6
- package/src/composables/useFabric.ts +1 -0
- package/src/index.ts +2 -3
- package/src/jsx-dev-runtime.ts +2 -2
- package/src/plugins/reactPlugin.ts +8 -8
- package/dist/getFunctionParams-BJb7Kd-D.d.ts +0 -48
- package/dist/getFunctionParams-ClT1iMr_.d.ts +0 -47
- package/dist/jsx-namespace-BLQ6SvuD.d.ts +0 -33
- package/dist/jsx-runtime-7CEZevwV.cjs +0 -251
- package/dist/jsx-runtime-7CEZevwV.cjs.map +0 -1
- package/dist/jsx-runtime-Dm7PKVbc.js +0 -247
- package/dist/jsx-runtime-Dm7PKVbc.js.map +0 -1
- package/dist/react-D652OKii.js.map +0 -1
- package/dist/react-DorQ0Kea.cjs.map +0 -1
- package/dist/reactPlugin-DYARkyXy.d.ts +0 -462
- package/src/components/__snapshots__/arrow_function_with_generics.ts +0 -3
- package/src/components/__snapshots__/async_arrow_function.ts +0 -3
- package/src/components/__snapshots__/async_function.ts +0 -3
- package/src/components/__snapshots__/async_function_with_Promise_return_type.ts +0 -3
- package/src/components/__snapshots__/basic_arrow_function.ts +0 -3
- package/src/components/__snapshots__/basic_const.ts +0 -1
- package/src/components/__snapshots__/basic_export.ts +0 -1
- package/src/components/__snapshots__/basic_function.ts +0 -3
- package/src/components/__snapshots__/basic_import.ts +0 -1
- package/src/components/__snapshots__/basic_type.ts +0 -1
- package/src/components/__snapshots__/const_with_JSDoc.ts +0 -4
- package/src/components/__snapshots__/const_with_as_const.ts +0 -1
- package/src/components/__snapshots__/const_with_type.ts +0 -1
- package/src/components/__snapshots__/default_exported_arrow_function.ts +0 -3
- package/src/components/__snapshots__/default_exported_function.ts +0 -3
- package/src/components/__snapshots__/exported_arrow_function.ts +0 -3
- package/src/components/__snapshots__/exported_async_arrow_function_with_generics.ts +0 -3
- package/src/components/__snapshots__/exported_async_function_with_generics.ts +0 -3
- package/src/components/__snapshots__/exported_const.ts +0 -1
- package/src/components/__snapshots__/exported_function.ts +0 -3
- package/src/components/__snapshots__/exported_type.ts +0 -1
- package/src/components/__snapshots__/function_with_JSDoc.ts +0 -6
- package/src/components/__snapshots__/function_with_generics.ts +0 -3
- package/src/components/__snapshots__/function_with_parameters.ts +0 -3
- package/src/components/__snapshots__/function_with_return_type.ts +0 -3
- package/src/components/__snapshots__/matches_with_root_import.ts +0 -1
- package/src/components/__snapshots__/named_export.ts +0 -1
- package/src/components/__snapshots__/named_export_(object_advanced).ts +0 -1
- package/src/components/__snapshots__/named_import.ts +0 -1
- package/src/components/__snapshots__/named_import_(object).ts +0 -1
- package/src/components/__snapshots__/named_import_(object_advanced).ts +0 -1
- package/src/components/__snapshots__/named_typed_export.ts +0 -1
- package/src/components/__snapshots__/named_typed_import.ts +0 -1
- package/src/components/__snapshots__/single_line_arrow_function.ts +0 -1
- package/src/components/__snapshots__/type_with_JSDoc.ts +0 -4
- package/src/components/__snapshots__/typed_export.ts +0 -1
- package/src/components/__snapshots__/typed_import.ts +0 -1
- package/src/composables/useApp.ts +0 -1
package/README.md
CHANGED
|
@@ -172,8 +172,8 @@ Injected methods (via `reactPlugin`):
|
|
|
172
172
|
|
|
173
173
|
| Method | Signature | Description |
|
|
174
174
|
|---|---|----------------------------------------------------------------------------------------------------|
|
|
175
|
-
| `render` | `(
|
|
176
|
-
| `renderToString` | `(
|
|
175
|
+
| `render` | `(Fabric: React.ElementType) => Promise<void> \| void` | Render a React component tree to the terminal and emit the core `start` event. |
|
|
176
|
+
| `renderToString` | `(Fabric: React.ElementType) => Promise<string> \| string` | Render a React component tree and return the final output as a string (without writing to stdout). |
|
|
177
177
|
| `waitUntilExit` | `() => Promise<void>` | Wait until the rendered app exits, resolves when unmounted and emits the core `end` event. |
|
|
178
178
|
|
|
179
179
|
#### `definePlugin`
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
4
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -8,28 +12,20 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
8
12
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
13
|
var __exportAll = (all, no_symbols) => {
|
|
10
14
|
let target = {};
|
|
11
|
-
for (var name in all) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
if (!no_symbols) {
|
|
18
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
-
}
|
|
15
|
+
for (var name in all) __defProp(target, name, {
|
|
16
|
+
get: all[name],
|
|
17
|
+
enumerable: true
|
|
18
|
+
});
|
|
19
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
20
20
|
return target;
|
|
21
21
|
};
|
|
22
22
|
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
26
|
+
get: ((k) => from[k]).bind(null, key),
|
|
27
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
28
|
+
});
|
|
33
29
|
}
|
|
34
30
|
return to;
|
|
35
31
|
};
|
|
@@ -38,6 +34,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
34
|
value: mod,
|
|
39
35
|
enumerable: true
|
|
40
36
|
}) : target, mod));
|
|
41
|
-
|
|
42
37
|
//#endregion
|
|
43
|
-
export { __toESM as i, __exportAll as n,
|
|
38
|
+
export { __toESM as a, __reExport as i, __exportAll as n, __name as r, __commonJSMin as t };
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as __name } from "./chunk-BGCRLu6H.js";
|
|
2
|
+
import { a as FabricExportProps, c as FabricReactElement, d as FabricTextProps, l as FabricReactNode, o as FabricFileProps, p as LineBreakProps, s as FabricImportProps, u as FabricSourceProps } from "./types-BJVZ7ita.js";
|
|
2
3
|
import React from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/globals.d.ts
|
package/dist/globals.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
const
|
|
3
|
-
require(
|
|
4
|
-
const
|
|
5
|
-
const require_reactPlugin = require('./reactPlugin-BGbgHJfV.cjs');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_jsx_runtime = require("./jsx-runtime-Cua1md-Z.cjs");
|
|
3
|
+
const require_jsx_runtime$1 = require("./jsx-runtime.cjs");
|
|
4
|
+
const require_reactPlugin = require("./reactPlugin-D74A1eG4.cjs");
|
|
6
5
|
let _kubb_fabric_core = require("@kubb/fabric-core");
|
|
7
6
|
let node_child_process = require("node:child_process");
|
|
8
7
|
let ws = require("ws");
|
|
9
|
-
ws =
|
|
8
|
+
ws = require_jsx_runtime.__toESM(ws);
|
|
10
9
|
let remeda = require("remeda");
|
|
11
|
-
|
|
12
|
-
//#region src/components/App.tsx
|
|
13
|
-
var import_react = /* @__PURE__ */ require_react$1.__toESM(require_react$1.require_react(), 1);
|
|
14
|
-
/**
|
|
15
|
-
* App container containing the AppContext carrying `meta` and an `exit` hook.
|
|
16
|
-
*/
|
|
17
|
-
function App({ children, ...props }) {
|
|
18
|
-
const { meta = {} } = props;
|
|
19
|
-
const { exit } = (0, _kubb_fabric_core.useContext)(_kubb_fabric_core.RootContext);
|
|
20
|
-
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
21
|
-
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
22
|
-
type: "App",
|
|
23
|
-
props
|
|
24
|
-
}));
|
|
25
|
-
(0, _kubb_fabric_core.provide)(_kubb_fabric_core.AppContext, {
|
|
26
|
-
exit,
|
|
27
|
-
meta
|
|
28
|
-
});
|
|
29
|
-
return /* @__PURE__ */ require_jsx_runtime$1.jsx(require_jsx_runtime$1.Fragment, { children });
|
|
30
|
-
}
|
|
31
|
-
App.displayName = "App";
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
10
|
//#region src/components/Const.tsx
|
|
11
|
+
var import_react = /* @__PURE__ */ require_jsx_runtime.__toESM(require_jsx_runtime.require_react(), 1);
|
|
35
12
|
/**
|
|
36
13
|
* Generates a TypeScript constant declaration.
|
|
37
14
|
*/
|
|
@@ -58,7 +35,26 @@ function Const({ children, ...props }) {
|
|
|
58
35
|
] });
|
|
59
36
|
}
|
|
60
37
|
Const.displayName = "Const";
|
|
61
|
-
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/Fabric.tsx
|
|
40
|
+
/**
|
|
41
|
+
* Fabric container containing the FabricContext carrying `meta` and an `exit` hook.
|
|
42
|
+
*/
|
|
43
|
+
function Fabric({ children, ...props }) {
|
|
44
|
+
const { meta = {} } = props;
|
|
45
|
+
const { exit } = (0, _kubb_fabric_core.useContext)(_kubb_fabric_core.RootContext);
|
|
46
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
47
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
48
|
+
type: "App",
|
|
49
|
+
props
|
|
50
|
+
}));
|
|
51
|
+
(0, _kubb_fabric_core.provide)(_kubb_fabric_core.FabricContext, {
|
|
52
|
+
exit,
|
|
53
|
+
meta
|
|
54
|
+
});
|
|
55
|
+
return /* @__PURE__ */ require_jsx_runtime$1.jsx(require_jsx_runtime$1.Fragment, { children });
|
|
56
|
+
}
|
|
57
|
+
Fabric.displayName = "Fabric";
|
|
62
58
|
//#endregion
|
|
63
59
|
//#region src/components/File.tsx
|
|
64
60
|
/**
|
|
@@ -173,7 +169,6 @@ FileImport.displayName = "FileImport";
|
|
|
173
169
|
File.Export = FileExport;
|
|
174
170
|
File.Import = FileImport;
|
|
175
171
|
File.Source = FileSource;
|
|
176
|
-
|
|
177
172
|
//#endregion
|
|
178
173
|
//#region src/components/Function.tsx
|
|
179
174
|
/**
|
|
@@ -273,7 +268,6 @@ function ArrowFunction({ children, ...props }) {
|
|
|
273
268
|
}
|
|
274
269
|
ArrowFunction.displayName = "ArrowFunction";
|
|
275
270
|
Function.Arrow = ArrowFunction;
|
|
276
|
-
|
|
277
271
|
//#endregion
|
|
278
272
|
//#region src/components/Type.tsx
|
|
279
273
|
/**
|
|
@@ -297,7 +291,6 @@ function Type({ children, ...props }) {
|
|
|
297
291
|
] });
|
|
298
292
|
}
|
|
299
293
|
Type.displayName = "Type";
|
|
300
|
-
|
|
301
294
|
//#endregion
|
|
302
295
|
//#region src/devtools.ts
|
|
303
296
|
let isOpen = false;
|
|
@@ -394,7 +387,6 @@ function openDevtools() {
|
|
|
394
387
|
});
|
|
395
388
|
});
|
|
396
389
|
}
|
|
397
|
-
|
|
398
390
|
//#endregion
|
|
399
391
|
//#region src/createReactFabric.ts
|
|
400
392
|
function createReactFabric(config = {}) {
|
|
@@ -408,7 +400,6 @@ function createReactFabric(config = {}) {
|
|
|
408
400
|
});
|
|
409
401
|
return fabric;
|
|
410
402
|
}
|
|
411
|
-
|
|
412
403
|
//#endregion
|
|
413
404
|
//#region src/utils/getFunctionParams.ts
|
|
414
405
|
function order(items) {
|
|
@@ -521,88 +512,87 @@ var FunctionParams = class FunctionParams {
|
|
|
521
512
|
return getFunctionParams(this.#params, { type: "constructor" });
|
|
522
513
|
}
|
|
523
514
|
};
|
|
524
|
-
|
|
525
515
|
//#endregion
|
|
526
516
|
//#region src/index.ts
|
|
527
517
|
const useState = import_react.useState;
|
|
528
518
|
const useEffect = import_react.useEffect;
|
|
529
519
|
const useReducer = import_react.useReducer;
|
|
530
520
|
const useRef = import_react.useRef;
|
|
531
|
-
|
|
532
521
|
//#endregion
|
|
533
|
-
exports.App = App;
|
|
534
522
|
exports.Const = Const;
|
|
523
|
+
exports.Fabric = Fabric;
|
|
535
524
|
exports.File = File;
|
|
536
|
-
Object.defineProperty(exports,
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
525
|
+
Object.defineProperty(exports, "FileManager", {
|
|
526
|
+
enumerable: true,
|
|
527
|
+
get: function() {
|
|
528
|
+
return _kubb_fabric_core.FileManager;
|
|
529
|
+
}
|
|
541
530
|
});
|
|
542
|
-
Object.defineProperty(exports,
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
531
|
+
Object.defineProperty(exports, "FileProcessor", {
|
|
532
|
+
enumerable: true,
|
|
533
|
+
get: function() {
|
|
534
|
+
return _kubb_fabric_core.FileProcessor;
|
|
535
|
+
}
|
|
547
536
|
});
|
|
548
537
|
exports.Function = Function;
|
|
549
538
|
exports.FunctionParams = FunctionParams;
|
|
550
539
|
exports.Root = require_reactPlugin.Root;
|
|
551
540
|
exports.Runtime = require_reactPlugin.Runtime;
|
|
552
|
-
Object.defineProperty(exports,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
541
|
+
Object.defineProperty(exports, "TreeNode", {
|
|
542
|
+
enumerable: true,
|
|
543
|
+
get: function() {
|
|
544
|
+
return _kubb_fabric_core.TreeNode;
|
|
545
|
+
}
|
|
557
546
|
});
|
|
558
547
|
exports.Type = Type;
|
|
559
|
-
Object.defineProperty(exports,
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
548
|
+
Object.defineProperty(exports, "createContext", {
|
|
549
|
+
enumerable: true,
|
|
550
|
+
get: function() {
|
|
551
|
+
return _kubb_fabric_core.createContext;
|
|
552
|
+
}
|
|
564
553
|
});
|
|
565
|
-
Object.defineProperty(exports,
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
554
|
+
Object.defineProperty(exports, "createFabric", {
|
|
555
|
+
enumerable: true,
|
|
556
|
+
get: function() {
|
|
557
|
+
return _kubb_fabric_core.createFabric;
|
|
558
|
+
}
|
|
570
559
|
});
|
|
571
|
-
Object.defineProperty(exports,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
560
|
+
Object.defineProperty(exports, "createFile", {
|
|
561
|
+
enumerable: true,
|
|
562
|
+
get: function() {
|
|
563
|
+
return _kubb_fabric_core.createFile;
|
|
564
|
+
}
|
|
576
565
|
});
|
|
577
566
|
exports.createFunctionParams = createFunctionParams;
|
|
578
567
|
exports.createReactFabric = createReactFabric;
|
|
579
568
|
exports.openDevtools = openDevtools;
|
|
580
|
-
Object.defineProperty(exports,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
});
|
|
586
|
-
Object.defineProperty(exports, 'useContext', {
|
|
587
|
-
enumerable: true,
|
|
588
|
-
get: function () {
|
|
589
|
-
return _kubb_fabric_core.useContext;
|
|
590
|
-
}
|
|
569
|
+
Object.defineProperty(exports, "useContext", {
|
|
570
|
+
enumerable: true,
|
|
571
|
+
get: function() {
|
|
572
|
+
return _kubb_fabric_core.useContext;
|
|
573
|
+
}
|
|
591
574
|
});
|
|
592
575
|
exports.useEffect = useEffect;
|
|
593
|
-
Object.defineProperty(exports,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
576
|
+
Object.defineProperty(exports, "useFabric", {
|
|
577
|
+
enumerable: true,
|
|
578
|
+
get: function() {
|
|
579
|
+
return _kubb_fabric_core.useFabric;
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
Object.defineProperty(exports, "useFile", {
|
|
583
|
+
enumerable: true,
|
|
584
|
+
get: function() {
|
|
585
|
+
return _kubb_fabric_core.useFile;
|
|
586
|
+
}
|
|
598
587
|
});
|
|
599
|
-
Object.defineProperty(exports,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
588
|
+
Object.defineProperty(exports, "useLifecycle", {
|
|
589
|
+
enumerable: true,
|
|
590
|
+
get: function() {
|
|
591
|
+
return _kubb_fabric_core.useLifecycle;
|
|
592
|
+
}
|
|
604
593
|
});
|
|
605
594
|
exports.useReducer = useReducer;
|
|
606
595
|
exports.useRef = useRef;
|
|
607
596
|
exports.useState = useState;
|
|
597
|
+
|
|
608
598
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["RootContext","NodeTreeContext","AppContext","NodeTreeContext","NodeTreeContext","FileContext","NodeTreeContext","NodeTreeContext","reactPlugin","#params"],"sources":["../src/components/App.tsx","../src/components/Const.tsx","../src/components/File.tsx","../src/components/Function.tsx","../src/components/Type.tsx","../src/devtools.ts","../src/createReactFabric.ts","../src/utils/getFunctionParams.ts","../src/index.ts"],"sourcesContent":["import { AppContext, NodeTreeContext, provide, RootContext, useContext, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode } from '../types.ts'\n\nexport type AppProps<TMeta extends object = object> = {\n /**\n * Metadata associated with the App.\n */\n meta?: TMeta\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * App container containing the AppContext carrying `meta` and an `exit` hook.\n */\nexport function App<TMeta extends object = object>({ children, ...props }: AppProps<TMeta>): FabricReactElement {\n const { meta = {} } = props\n\n const { exit } = useContext(RootContext)\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'App', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n provide(AppContext, { exit, meta })\n\n return <>{children}</>\n}\n\nApp.displayName = 'App'\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\nexport type ConstProps = {\n key?: Key\n /**\n * Name of the const\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Type to make the const being typed\n */\n type?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Use of `const` assertions\n */\n asConst?: boolean\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Generates a TypeScript constant declaration.\n */\nexport function Const({ children, ...props }: ConstProps): FabricReactElement {\n const { name, export: canExport, type, JSDoc, asConst } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Const', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n const {name}\n {type ? (\n <>\n {':'}\n {type}{' '}\n </>\n ) : (\n ' '\n )}\n = {children}\n {asConst && <> as const</>}\n </>\n )\n}\n\nConst.displayName = 'Const'\n","import { FileContext, NodeTreeContext, provide, useFile, useFileManager, useNodeTree } from '@kubb/fabric-core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { FabricReactElement, FabricReactNode, Key } from '../types.ts'\n\ntype BasePropsWithBaseName = {\n /**\n * Name to be used to dynamicly create the baseName(based on input.path).\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: KubbFile.BaseName\n /**\n * Path will be full qualified path to a specified file.\n */\n path: KubbFile.Path\n}\n\ntype BasePropsWithoutBaseName = {\n baseName?: never\n /**\n * Path will be full qualified path to a specified file.\n */\n path?: KubbFile.Path\n}\n\ntype BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName\n\ntype Props<TMeta> = BaseProps & {\n key?: Key\n meta?: TMeta\n banner?: string\n footer?: string\n children?: FabricReactNode\n}\n\n/**\n * Adds files to the FileManager\n */\nexport function File<TMeta extends object = object>({ children, ...props }: Props<TMeta>): FabricReactElement {\n const { baseName, path, meta = {}, footer, banner } = props\n\n const fileManager = useFileManager()\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'File', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (!baseName || !path) {\n return <>{children}</>\n }\n\n const file: KubbFile.File = {\n baseName,\n path,\n meta,\n banner,\n footer,\n sources: [],\n imports: [],\n exports: [],\n }\n\n const [resolvedFile] = fileManager.add(file)\n provide(FileContext, resolvedFile)\n\n return <kubb-file {...props}>{children}</kubb-file>\n}\n\nFile.displayName = 'File'\n\ntype FileSourceProps = Omit<KubbFile.Source, 'value'> & {\n key?: Key\n children?: FabricReactNode\n}\n\n/**\n * File.Source\n *\n * Marks a block of source text to be associated with the current file when\n * rendering with the FileCollector. Children are treated as the source string.\n */\nfunction FileSource({ children, ...props }: FileSourceProps): FabricReactElement {\n const { name, isExportable, isIndexable, isTypeOnly } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'FileSource', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <kubb-source name={name} isTypeOnly={isTypeOnly} isExportable={isExportable} isIndexable={isIndexable}>\n {children}\n </kubb-source>\n )\n}\n\nFileSource.displayName = 'FileSource'\n\nexport type FileExportProps = KubbFile.Export & { key?: Key }\n\n/**\n * File.Export\n *\n * Declares an export entry for the current file. This will be collected by\n * the FileCollector for later emission.\n */\nfunction FileExport(props: FileExportProps): FabricReactElement {\n const { name, path, isTypeOnly, asAlias } = props\n\n const nodeTree = useNodeTree()\n const file = useFile()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'FileExport', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (file) {\n file.exports.push({\n name,\n path,\n asAlias,\n isTypeOnly,\n })\n }\n\n return <kubb-export name={name} path={path} isTypeOnly={isTypeOnly} asAlias={asAlias} />\n}\n\nFileExport.displayName = 'FileExport'\n\nexport type FileImportProps = KubbFile.Import & { key?: Key }\n\n/**\n * File.Import\n *\n * Declares an import entry for the current file.\n */\nfunction FileImport(props: FileImportProps): FabricReactElement {\n const { name, root, path, isTypeOnly, isNameSpace } = props\n\n const nodeTree = useNodeTree()\n const file = useFile()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'FileImport', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (file) {\n file.imports.push({\n name,\n path,\n root,\n isNameSpace,\n isTypeOnly,\n })\n }\n\n return <kubb-import name={name} root={root} path={path} isNameSpace={isNameSpace} isTypeOnly={isTypeOnly} />\n}\n\nFileImport.displayName = 'FileImport'\n\nFile.Export = FileExport\nFile.Import = FileImport\nFile.Source = FileSource\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the function.\n */\n name: string\n /**\n * Add default when export is being used\n */\n default?: boolean\n /**\n * Parameters/options/props that need to be used.\n */\n params?: string\n /**\n * Does this function need to be exported.\n */\n export?: boolean\n /**\n * Does the function has async/promise behavior.\n * This will also add `Promise<returnType>` as the returnType.\n */\n async?: boolean\n /**\n * Generics that needs to be added for TypeScript.\n */\n generics?: string | string[]\n /**\n * ReturnType(see async for adding Promise type).\n */\n returnType?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Generates a TypeScript function declaration.\n */\nexport function Function({ children, ...props }: Props): FabricReactElement {\n const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Function', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n {async && <>async </>}\n function {name}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {' {'}\n <br />\n <indent />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n </>\n )\n}\n\nFunction.displayName = 'Function'\n\ntype ArrowFunctionProps = Props & {\n /**\n * Create Arrow function in one line\n */\n singleLine?: boolean\n}\n\n/**\n * ArrowFunction\n *\n * Renders an arrow function definition. Supports the same flags as `Function`.\n * Use `singleLine` to render the body as a single-line expression.\n */\nfunction ArrowFunction({ children, ...props }: ArrowFunctionProps) {\n const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'ArrowFunction', props })\n\n provide(NodeTreeContext, childTree)\n }\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n const {name} = {async && <>async </>}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {singleLine && (\n <>\n {' => '}\n {children}\n <br />\n </>\n )}\n {!singleLine && (\n <>\n {' => {'}\n <br />\n <indent />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'ArrowFunction'\nFunction.Arrow = ArrowFunction\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\nexport type TypeProps = {\n key?: Key\n /**\n * Name of the type, this needs to start with a capital letter.\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Generates a TypeScript type declaration.\n */\nexport function Type({ children, ...props }: TypeProps): FabricReactElement {\n const { name, export: canExport, JSDoc } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Type', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (name.charAt(0).toUpperCase() !== name.charAt(0)) {\n throw new Error('Name should start with a capital letter(see TypeScript types)')\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n type {name} = {children}\n </>\n )\n}\n\nType.displayName = 'Type'\n","import { spawn } from 'node:child_process'\nimport { onProcessExit } from '@kubb/fabric-core'\nimport ws from 'ws'\nimport { Renderer } from './Renderer.ts'\n\ndeclare global {\n var WebSocket: typeof WebSocket\n var self: any\n var window: any\n var isDevtoolsEnabled: any\n}\n\nlet isOpen = false\n\nexport function openDevtools() {\n if (isOpen) {\n return undefined\n }\n // Set up global polyfills BEFORE importing react-devtools-core\n // This is required because react-devtools-core expects these to be available\n const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\n\n // Filter out Kubb internal components from devtools for a cleaner view.\n // See https://github.com/facebook/react/blob/edf6eac8a181860fd8a2d076a43806f1237495a1/packages/react-devtools-shared/src/types.js#L24\n customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'Context.Provider',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'Root',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'ErrorBoundary',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-file',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-text',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-import',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-export',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-source',\n isEnabled: true,\n isValid: true,\n },\n ]\n\n // biome-ignore lint/suspicious/noTsIgnore: cannot find types\n // @ts-ignore\n import('react-devtools-core').then(async (devtools) => {\n console.info('Opening devtools')\n const controller = new AbortController()\n if (!isOpen) {\n const child = spawn('npx', ['react-devtools@6.1.5'], {\n signal: controller.signal,\n stdio: 'pipe',\n detached: true,\n })\n child.unref()\n }\n\n isOpen = true\n\n // Destructure the functions from the module\n const { initialize, connectToDevTools } = devtools?.default || devtools\n\n // Initialize DevTools BEFORE importing Renderer (which imports React)\n initialize()\n console.info('Initializing devtools')\n\n // Inject the renderer BEFORE connecting to DevTools\n // This ensures DevTools can properly discover the custom renderer\n Renderer.injectIntoDevTools({\n bundleType: 1,\n version: '19.2.3',\n rendererPackageName: 'kubb',\n // findFiberByHostInstance is required for DevTools to map elements to fibers\n findFiberByHostInstance: () => null,\n })\n\n console.info('Connecting devtools')\n\n try {\n connectToDevTools({\n host: 'localhost',\n port: 8097,\n useHttps: false,\n isAppActive: () => true,\n })\n } catch (e) {\n console.error(e)\n console.info('Error when connecting the devtools')\n }\n\n onProcessExit(() => {\n console.info('Disconnecting devtools')\n controller.abort()\n })\n })\n}\n","import { createFabric } from '@kubb/fabric-core'\nimport type { Fabric, FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { openDevtools } from './devtools.ts'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport { reactPlugin } from './plugins/reactPlugin.ts'\n\nexport function createReactFabric(\n config: FabricConfig<Options & { mode?: FabricMode; devtools?: boolean }> = {},\n): Fabric<Options & { mode?: FabricMode; devtools?: boolean }> {\n if (config.devtools) {\n openDevtools()\n }\n\n const fabric = createFabric({ mode: config.mode })\n\n fabric.use(reactPlugin, {\n stdout: config.stdout,\n stderr: config.stderr,\n debug: config.debug,\n stdin: config.stdin,\n })\n\n return fabric\n}\n","import { sortBy } from 'remeda'\n\nexport type Param = {\n /**\n * `object` will return the pathParams as an object.\n *\n * `inline` will return the pathParams as comma separated params.\n * @default `'inline'`\n * @private\n */\n mode?: 'object' | 'inline' | 'inlineSpread'\n type?: 'string' | 'number' | (string & {})\n optional?: boolean\n /**\n * @example test = \"default\"\n */\n default?: string\n /**\n * Used for no TypeScript(with mode object)\n * @example test: \"default\"\n */\n value?: string\n children?: Params\n}\n\ntype ParamItem =\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: true\n default?: never\n children?: Params\n })\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: false\n default?: string\n children?: Params\n })\n\nexport type Params = Record<string, Param | undefined>\n\ntype Options = {\n type: 'constructor' | 'call' | 'object' | 'objectValue'\n transformName?: (name: string) => string\n transformType?: (type: string) => string\n}\n\nfunction order(items: Array<[key: string, item?: ParamItem]>) {\n return sortBy(items.filter(Boolean) as Array<[key: string, item?: ParamItem]>, ([_key, item]) => {\n if (item?.children) {\n return 0 // Treat items with children as required (they'll get = {} if all children are optional)\n }\n // Priority order: required (0) → optional (1) → default-only (2)\n if (item?.optional) {\n return 1 // Optional parameters (with or without default)\n }\n if (item?.default) {\n // Parameters with default only (not marked as optional)\n // Note: While the ParamItem type suggests optional and default are mutually exclusive,\n // this handles the case where a parameter has a default value but isn't explicitly marked as optional\n return 2\n }\n return 0 // Required parameters\n })\n}\n\nfunction parseChild(key: string, item: ParamItem, options: Options): string | null {\n // @ts-expect-error\n const entries = order(Object.entries(item.children))\n\n const types: string[] = []\n const names: string[] = []\n\n const optional = entries.every(([_key, item]) => item?.optional || !!item?.default)\n\n entries.forEach(([key, entryItem]) => {\n if (entryItem) {\n const name = parseItem(key, { ...entryItem, type: undefined }, options)\n if (entryItem.children) {\n const subTypes = Object.entries(entryItem.children)\n .map(([key]) => {\n return key\n })\n .join(', ')\n\n if (subTypes) {\n names.push(`${name}: { ${subTypes} }`)\n } else {\n names.push(name)\n }\n } else {\n if (options.type === 'call' && options.transformName) {\n names.push(`${key}: ${name}`)\n } else {\n names.push(name)\n }\n }\n\n if (entries.some(([_key, item]) => item?.type)) {\n types.push(parseItem(key, { ...entryItem, default: undefined }, options))\n }\n }\n })\n\n const name = item.mode === 'inline' ? key : names.length ? `{ ${names.join(', ')} }` : undefined\n const type = item.type ? item.type : types.length ? `{ ${types.join('; ')} }` : undefined\n\n if (!name) {\n return null\n }\n\n return parseItem(\n name,\n {\n type,\n default: item.default,\n optional: !item.default ? optional : undefined,\n } as ParamItem,\n options,\n )\n}\n\nfunction parseItem(name: string, item: ParamItem, options: Options): string {\n const acc: string[] = []\n const transformedName = options.transformName ? options.transformName(name) : name\n const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type\n\n if (options.type === 'object') {\n return transformedName\n }\n\n if (options.type === 'objectValue') {\n return item.value ? `${transformedName}: ${item.value}` : transformedName\n }\n\n //LEGACY\n if (item.type && options.type === 'constructor') {\n if (item.optional) {\n // Check if this is a destructured parameter (object mode)\n const isDestructured = transformedName.startsWith('{')\n if (isDestructured) {\n // For destructured parameters, use \": type = {}\" syntax to make it optional\n acc.push(`${transformedName}: ${transformedType} = {}`)\n } else {\n // For inline parameters, use \"?: type\" syntax\n acc.push(`${transformedName}?: ${transformedType}`)\n }\n } else {\n acc.push(`${transformedName}: ${transformedType}${item.default ? ` = ${item.default}` : ''}`)\n }\n } else if (item.default && options.type === 'constructor') {\n acc.push(`${transformedName} = ${item.default}`)\n } else if (item.value) {\n acc.push(`${transformedName} : ${item.value}`)\n } else if (item.mode === 'inlineSpread') {\n acc.push(`... ${transformedName}`)\n } else {\n acc.push(transformedName)\n }\n\n return acc[0] as string\n}\n\nexport function getFunctionParams(params: Params, options: Options): string {\n const entries = order(Object.entries(params as Record<string, ParamItem | undefined>))\n\n return entries\n .reduce((acc, [key, item]) => {\n if (!item) {\n return acc\n }\n\n if (item.children) {\n if (Object.keys(item.children).length === 0) {\n return acc\n }\n\n if (item.mode === 'inlineSpread') {\n return [...acc, getFunctionParams(item.children, options)]\n }\n\n const parsedItem = parseChild(key, item, options)\n if (!parsedItem) {\n return acc\n }\n\n return [...acc, parsedItem]\n }\n\n const parsedItem = parseItem(key, item, options)\n\n return [...acc, parsedItem]\n }, [] as string[])\n .join(', ')\n}\n\nexport function createFunctionParams(params: Params): Params {\n return params\n}\n// TODO use of zod\n//TODO use of string as `$name: $type` to create templates for functions instead of call/constructor\nexport class FunctionParams {\n #params: Params\n\n static factory(params: Params) {\n return new FunctionParams(params)\n }\n constructor(params: Params) {\n this.#params = params\n }\n\n get params(): Params {\n return this.#params\n }\n\n get flatParams(): Params {\n const flatter = (acc: Params, [key, item]: [key: string, item?: Param]): Params => {\n if (item?.children) {\n return Object.entries(item.children).reduce(flatter, acc)\n }\n if (item) {\n acc[key] = item\n }\n\n return acc\n }\n return Object.entries(this.#params).reduce(flatter, {} as Params)\n }\n\n toCall({ transformName, transformType }: Pick<Options, 'transformName' | 'transformType'> = {}): string {\n return getFunctionParams(this.#params, { type: 'call', transformName, transformType })\n }\n\n toObject(): string {\n return getFunctionParams(this.#params, { type: 'object' })\n }\n toObjectValue(): string {\n return getFunctionParams(this.#params, { type: 'objectValue' })\n }\n\n toConstructor(): string {\n return getFunctionParams(this.#params, { type: 'constructor' })\n }\n}\n","// import './globals.ts'\nimport * as React from 'react'\n\nexport type { Fabric } from '@kubb/fabric-core'\n// expose fabric core helpers\nexport { createContext, createFabric, createFile, FileManager, FileProcessor, TreeNode, useContext } from '@kubb/fabric-core'\n\n// react helpers\nexport const useState = React.useState\nexport const useEffect = React.useEffect\nexport const useReducer = React.useReducer\nexport const useRef = React.useRef\n\nexport { App } from './components/App.tsx'\nexport { Const } from './components/Const.tsx'\nexport { File } from './components/File.tsx'\nexport { Function } from './components/Function.tsx'\n// components\nexport { Root } from './components/Root.tsx'\nexport { Type } from './components/Type.tsx'\n\n// composables\nexport { useApp } from './composables/useApp.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\n\n// factories\nexport { createReactFabric } from './createReactFabric.ts'\nexport { openDevtools } from './devtools.ts'\nexport { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"mappings":";;;;;;;;;;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a,CAAC,KAAK,UAA+C;AACjF,OAAI,MAAM,SACR,QAAO,OAAO,QAAQ,KAAK,SAAS,CAAC,OAAO,SAAS,IAAI;AAE3D,OAAI,KACF,KAAI,OAAO;AAGb,UAAO;;AAET,SAAO,OAAO,QAAQ,MAAKA,OAAQ,CAAC,OAAO,SAAS,EAAE,CAAW;;CAGnE,OAAO,EAAE,eAAe,kBAAoE,EAAE,EAAU;AACtG,SAAO,kBAAkB,MAAKA,QAAS;GAAE,MAAM;GAAQ;GAAe;GAAe,CAAC;;CAGxF,WAAmB;AACjB,SAAO,kBAAkB,MAAKA,QAAS,EAAE,MAAM,UAAU,CAAC;;CAE5D,gBAAwB;AACtB,SAAO,kBAAkB,MAAKA,QAAS,EAAE,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,kBAAkB,MAAKA,QAAS,EAAE,MAAM,eAAe,CAAC;;;;;;ACvOnE,MAAa,wBAAiB;AAC9B,MAAa,yBAAkB;AAC/B,MAAa,0BAAmB;AAChC,MAAa,sBAAe"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["NodeTreeContext","RootContext","NodeTreeContext","FabricContext","NodeTreeContext","FileContext","NodeTreeContext","NodeTreeContext","reactPlugin","#params"],"sources":["../src/components/Const.tsx","../src/components/Fabric.tsx","../src/components/File.tsx","../src/components/Function.tsx","../src/components/Type.tsx","../src/devtools.ts","../src/createReactFabric.ts","../src/utils/getFunctionParams.ts","../src/index.ts"],"sourcesContent":["import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\nexport type ConstProps = {\n key?: Key\n /**\n * Name of the const\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Type to make the const being typed\n */\n type?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Use of `const` assertions\n */\n asConst?: boolean\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Generates a TypeScript constant declaration.\n */\nexport function Const({ children, ...props }: ConstProps): FabricReactElement {\n const { name, export: canExport, type, JSDoc, asConst } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Const', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n const {name}\n {type ? (\n <>\n {':'}\n {type}{' '}\n </>\n ) : (\n ' '\n )}\n = {children}\n {asConst && <> as const</>}\n </>\n )\n}\n\nConst.displayName = 'Const'\n","import { FabricContext, NodeTreeContext, provide, RootContext, useContext, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode } from '../types.ts'\n\nexport type FabricProps<TMeta extends object = object> = {\n /**\n * Metadata associated with the App.\n */\n meta?: TMeta\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Fabric container containing the FabricContext carrying `meta` and an `exit` hook.\n */\nexport function Fabric<TMeta extends object = object>({ children, ...props }: FabricProps<TMeta>): FabricReactElement {\n const { meta = {} } = props\n\n const { exit } = useContext(RootContext)\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'App', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n provide(FabricContext, { exit, meta })\n\n return <>{children}</>\n}\n\nFabric.displayName = 'Fabric'\n","import { FileContext, NodeTreeContext, provide, useFile, useFileManager, useNodeTree } from '@kubb/fabric-core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { FabricReactElement, FabricReactNode, Key } from '../types.ts'\n\ntype BasePropsWithBaseName = {\n /**\n * Name to be used to dynamicly create the baseName(based on input.path).\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: KubbFile.BaseName\n /**\n * Path will be full qualified path to a specified file.\n */\n path: KubbFile.Path\n}\n\ntype BasePropsWithoutBaseName = {\n baseName?: never\n /**\n * Path will be full qualified path to a specified file.\n */\n path?: KubbFile.Path\n}\n\ntype BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName\n\ntype Props<TMeta> = BaseProps & {\n key?: Key\n meta?: TMeta\n banner?: string\n footer?: string\n children?: FabricReactNode\n}\n\n/**\n * Adds files to the FileManager\n */\nexport function File<TMeta extends object = object>({ children, ...props }: Props<TMeta>): FabricReactElement {\n const { baseName, path, meta = {}, footer, banner } = props\n\n const fileManager = useFileManager()\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'File', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (!baseName || !path) {\n return <>{children}</>\n }\n\n const file: KubbFile.File = {\n baseName,\n path,\n meta,\n banner,\n footer,\n sources: [],\n imports: [],\n exports: [],\n }\n\n const [resolvedFile] = fileManager.add(file)\n provide(FileContext, resolvedFile)\n\n return <kubb-file {...props}>{children}</kubb-file>\n}\n\nFile.displayName = 'File'\n\ntype FileSourceProps = Omit<KubbFile.Source, 'value'> & {\n key?: Key\n children?: FabricReactNode\n}\n\n/**\n * File.Source\n *\n * Marks a block of source text to be associated with the current file when\n * rendering with the FileCollector. Children are treated as the source string.\n */\nfunction FileSource({ children, ...props }: FileSourceProps): FabricReactElement {\n const { name, isExportable, isIndexable, isTypeOnly } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'FileSource', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <kubb-source name={name} isTypeOnly={isTypeOnly} isExportable={isExportable} isIndexable={isIndexable}>\n {children}\n </kubb-source>\n )\n}\n\nFileSource.displayName = 'FileSource'\n\nexport type FileExportProps = KubbFile.Export & { key?: Key }\n\n/**\n * File.Export\n *\n * Declares an export entry for the current file. This will be collected by\n * the FileCollector for later emission.\n */\nfunction FileExport(props: FileExportProps): FabricReactElement {\n const { name, path, isTypeOnly, asAlias } = props\n\n const nodeTree = useNodeTree()\n const file = useFile()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'FileExport', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (file) {\n file.exports.push({\n name,\n path,\n asAlias,\n isTypeOnly,\n })\n }\n\n return <kubb-export name={name} path={path} isTypeOnly={isTypeOnly} asAlias={asAlias} />\n}\n\nFileExport.displayName = 'FileExport'\n\nexport type FileImportProps = KubbFile.Import & { key?: Key }\n\n/**\n * File.Import\n *\n * Declares an import entry for the current file.\n */\nfunction FileImport(props: FileImportProps): FabricReactElement {\n const { name, root, path, isTypeOnly, isNameSpace } = props\n\n const nodeTree = useNodeTree()\n const file = useFile()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'FileImport', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (file) {\n file.imports.push({\n name,\n path,\n root,\n isNameSpace,\n isTypeOnly,\n })\n }\n\n return <kubb-import name={name} root={root} path={path} isNameSpace={isNameSpace} isTypeOnly={isTypeOnly} />\n}\n\nFileImport.displayName = 'FileImport'\n\nFile.Export = FileExport\nFile.Import = FileImport\nFile.Source = FileSource\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the function.\n */\n name: string\n /**\n * Add default when export is being used\n */\n default?: boolean\n /**\n * Parameters/options/props that need to be used.\n */\n params?: string\n /**\n * Does this function need to be exported.\n */\n export?: boolean\n /**\n * Does the function has async/promise behavior.\n * This will also add `Promise<returnType>` as the returnType.\n */\n async?: boolean\n /**\n * Generics that needs to be added for TypeScript.\n */\n generics?: string | string[]\n /**\n * ReturnType(see async for adding Promise type).\n */\n returnType?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Generates a TypeScript function declaration.\n */\nexport function Function({ children, ...props }: Props): FabricReactElement {\n const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Function', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n {async && <>async </>}\n function {name}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {' {'}\n <br />\n <indent />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n </>\n )\n}\n\nFunction.displayName = 'Function'\n\ntype ArrowFunctionProps = Props & {\n /**\n * Create Arrow function in one line\n */\n singleLine?: boolean\n}\n\n/**\n * ArrowFunction\n *\n * Renders an arrow function definition. Supports the same flags as `Function`.\n * Use `singleLine` to render the body as a single-line expression.\n */\nfunction ArrowFunction({ children, ...props }: ArrowFunctionProps) {\n const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'ArrowFunction', props })\n\n provide(NodeTreeContext, childTree)\n }\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n const {name} = {async && <>async </>}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {singleLine && (\n <>\n {' => '}\n {children}\n <br />\n </>\n )}\n {!singleLine && (\n <>\n {' => {'}\n <br />\n <indent />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'ArrowFunction'\nFunction.Arrow = ArrowFunction\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\nexport type TypeProps = {\n key?: Key\n /**\n * Name of the type, this needs to start with a capital letter.\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Children nodes.\n */\n children?: FabricReactNode\n}\n\n/**\n * Generates a TypeScript type declaration.\n */\nexport function Type({ children, ...props }: TypeProps): FabricReactElement {\n const { name, export: canExport, JSDoc } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Type', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n if (name.charAt(0).toUpperCase() !== name.charAt(0)) {\n throw new Error('Name should start with a capital letter(see TypeScript types)')\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n type {name} = {children}\n </>\n )\n}\n\nType.displayName = 'Type'\n","import { spawn } from 'node:child_process'\nimport { onProcessExit } from '@kubb/fabric-core'\nimport ws from 'ws'\nimport { Renderer } from './Renderer.ts'\n\ndeclare global {\n var WebSocket: typeof WebSocket\n var self: any\n var window: any\n var isDevtoolsEnabled: any\n}\n\nlet isOpen = false\n\nexport function openDevtools() {\n if (isOpen) {\n return undefined\n }\n // Set up global polyfills BEFORE importing react-devtools-core\n // This is required because react-devtools-core expects these to be available\n const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\n\n // Filter out Kubb internal components from devtools for a cleaner view.\n // See https://github.com/facebook/react/blob/edf6eac8a181860fd8a2d076a43806f1237495a1/packages/react-devtools-shared/src/types.js#L24\n customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'Context.Provider',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'Root',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'ErrorBoundary',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-file',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-text',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-import',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-export',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'kubb-source',\n isEnabled: true,\n isValid: true,\n },\n ]\n\n // biome-ignore lint/suspicious/noTsIgnore: cannot find types\n // @ts-ignore\n import('react-devtools-core').then(async (devtools) => {\n console.info('Opening devtools')\n const controller = new AbortController()\n if (!isOpen) {\n const child = spawn('npx', ['react-devtools@6.1.5'], {\n signal: controller.signal,\n stdio: 'pipe',\n detached: true,\n })\n child.unref()\n }\n\n isOpen = true\n\n // Destructure the functions from the module\n const { initialize, connectToDevTools } = devtools?.default || devtools\n\n // Initialize DevTools BEFORE importing Renderer (which imports React)\n initialize()\n console.info('Initializing devtools')\n\n // Inject the renderer BEFORE connecting to DevTools\n // This ensures DevTools can properly discover the custom renderer\n Renderer.injectIntoDevTools({\n bundleType: 1,\n version: '19.2.3',\n rendererPackageName: 'kubb',\n // findFiberByHostInstance is required for DevTools to map elements to fibers\n findFiberByHostInstance: () => null,\n })\n\n console.info('Connecting devtools')\n\n try {\n connectToDevTools({\n host: 'localhost',\n port: 8097,\n useHttps: false,\n isAppActive: () => true,\n })\n } catch (e) {\n console.error(e)\n console.info('Error when connecting the devtools')\n }\n\n onProcessExit(() => {\n console.info('Disconnecting devtools')\n controller.abort()\n })\n })\n}\n","import { createFabric } from '@kubb/fabric-core'\nimport type { Fabric, FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { openDevtools } from './devtools.ts'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport { reactPlugin } from './plugins/reactPlugin.ts'\n\nexport function createReactFabric(\n config: FabricConfig<Options & { mode?: FabricMode; devtools?: boolean }> = {},\n): Fabric<Options & { mode?: FabricMode; devtools?: boolean }> {\n if (config.devtools) {\n openDevtools()\n }\n\n const fabric = createFabric({ mode: config.mode })\n\n fabric.use(reactPlugin, {\n stdout: config.stdout,\n stderr: config.stderr,\n debug: config.debug,\n stdin: config.stdin,\n })\n\n return fabric\n}\n","import { sortBy } from 'remeda'\n\nexport type Param = {\n /**\n * `object` will return the pathParams as an object.\n *\n * `inline` will return the pathParams as comma separated params.\n * @default `'inline'`\n * @private\n */\n mode?: 'object' | 'inline' | 'inlineSpread'\n type?: 'string' | 'number' | (string & {})\n optional?: boolean\n /**\n * @example test = \"default\"\n */\n default?: string\n /**\n * Used for no TypeScript(with mode object)\n * @example test: \"default\"\n */\n value?: string\n children?: Params\n}\n\ntype ParamItem =\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: true\n default?: never\n children?: Params\n })\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: false\n default?: string\n children?: Params\n })\n\nexport type Params = Record<string, Param | undefined>\n\ntype Options = {\n type: 'constructor' | 'call' | 'object' | 'objectValue'\n transformName?: (name: string) => string\n transformType?: (type: string) => string\n}\n\nfunction order(items: Array<[key: string, item?: ParamItem]>) {\n return sortBy(items.filter(Boolean) as Array<[key: string, item?: ParamItem]>, ([_key, item]) => {\n if (item?.children) {\n return 0 // Treat items with children as required (they'll get = {} if all children are optional)\n }\n // Priority order: required (0) → optional (1) → default-only (2)\n if (item?.optional) {\n return 1 // Optional parameters (with or without default)\n }\n if (item?.default) {\n // Parameters with default only (not marked as optional)\n // Note: While the ParamItem type suggests optional and default are mutually exclusive,\n // this handles the case where a parameter has a default value but isn't explicitly marked as optional\n return 2\n }\n return 0 // Required parameters\n })\n}\n\nfunction parseChild(key: string, item: ParamItem, options: Options): string | null {\n // @ts-expect-error\n const entries = order(Object.entries(item.children))\n\n const types: string[] = []\n const names: string[] = []\n\n const optional = entries.every(([_key, item]) => item?.optional || !!item?.default)\n\n entries.forEach(([key, entryItem]) => {\n if (entryItem) {\n const name = parseItem(key, { ...entryItem, type: undefined }, options)\n if (entryItem.children) {\n const subTypes = Object.entries(entryItem.children)\n .map(([key]) => {\n return key\n })\n .join(', ')\n\n if (subTypes) {\n names.push(`${name}: { ${subTypes} }`)\n } else {\n names.push(name)\n }\n } else {\n if (options.type === 'call' && options.transformName) {\n names.push(`${key}: ${name}`)\n } else {\n names.push(name)\n }\n }\n\n if (entries.some(([_key, item]) => item?.type)) {\n types.push(parseItem(key, { ...entryItem, default: undefined }, options))\n }\n }\n })\n\n const name = item.mode === 'inline' ? key : names.length ? `{ ${names.join(', ')} }` : undefined\n const type = item.type ? item.type : types.length ? `{ ${types.join('; ')} }` : undefined\n\n if (!name) {\n return null\n }\n\n return parseItem(\n name,\n {\n type,\n default: item.default,\n optional: !item.default ? optional : undefined,\n } as ParamItem,\n options,\n )\n}\n\nfunction parseItem(name: string, item: ParamItem, options: Options): string {\n const acc: string[] = []\n const transformedName = options.transformName ? options.transformName(name) : name\n const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type\n\n if (options.type === 'object') {\n return transformedName\n }\n\n if (options.type === 'objectValue') {\n return item.value ? `${transformedName}: ${item.value}` : transformedName\n }\n\n //LEGACY\n if (item.type && options.type === 'constructor') {\n if (item.optional) {\n // Check if this is a destructured parameter (object mode)\n const isDestructured = transformedName.startsWith('{')\n if (isDestructured) {\n // For destructured parameters, use \": type = {}\" syntax to make it optional\n acc.push(`${transformedName}: ${transformedType} = {}`)\n } else {\n // For inline parameters, use \"?: type\" syntax\n acc.push(`${transformedName}?: ${transformedType}`)\n }\n } else {\n acc.push(`${transformedName}: ${transformedType}${item.default ? ` = ${item.default}` : ''}`)\n }\n } else if (item.default && options.type === 'constructor') {\n acc.push(`${transformedName} = ${item.default}`)\n } else if (item.value) {\n acc.push(`${transformedName} : ${item.value}`)\n } else if (item.mode === 'inlineSpread') {\n acc.push(`... ${transformedName}`)\n } else {\n acc.push(transformedName)\n }\n\n return acc[0] as string\n}\n\nexport function getFunctionParams(params: Params, options: Options): string {\n const entries = order(Object.entries(params as Record<string, ParamItem | undefined>))\n\n return entries\n .reduce((acc, [key, item]) => {\n if (!item) {\n return acc\n }\n\n if (item.children) {\n if (Object.keys(item.children).length === 0) {\n return acc\n }\n\n if (item.mode === 'inlineSpread') {\n return [...acc, getFunctionParams(item.children, options)]\n }\n\n const parsedItem = parseChild(key, item, options)\n if (!parsedItem) {\n return acc\n }\n\n return [...acc, parsedItem]\n }\n\n const parsedItem = parseItem(key, item, options)\n\n return [...acc, parsedItem]\n }, [] as string[])\n .join(', ')\n}\n\nexport function createFunctionParams(params: Params): Params {\n return params\n}\n// TODO use of zod\n//TODO use of string as `$name: $type` to create templates for functions instead of call/constructor\nexport class FunctionParams {\n #params: Params\n\n static factory(params: Params) {\n return new FunctionParams(params)\n }\n constructor(params: Params) {\n this.#params = params\n }\n\n get params(): Params {\n return this.#params\n }\n\n get flatParams(): Params {\n const flatter = (acc: Params, [key, item]: [key: string, item?: Param]): Params => {\n if (item?.children) {\n return Object.entries(item.children).reduce(flatter, acc)\n }\n if (item) {\n acc[key] = item\n }\n\n return acc\n }\n return Object.entries(this.#params).reduce(flatter, {} as Params)\n }\n\n toCall({ transformName, transformType }: Pick<Options, 'transformName' | 'transformType'> = {}): string {\n return getFunctionParams(this.#params, { type: 'call', transformName, transformType })\n }\n\n toObject(): string {\n return getFunctionParams(this.#params, { type: 'object' })\n }\n toObjectValue(): string {\n return getFunctionParams(this.#params, { type: 'objectValue' })\n }\n\n toConstructor(): string {\n return getFunctionParams(this.#params, { type: 'constructor' })\n }\n}\n","// import './globals.ts'\nimport * as React from 'react'\n\n// expose fabric core helpers\nexport { createContext, createFabric, createFile, FileManager, FileProcessor, TreeNode, useContext } from '@kubb/fabric-core'\n\n// react helpers\nexport const useState = React.useState\nexport const useEffect = React.useEffect\nexport const useReducer = React.useReducer\nexport const useRef = React.useRef\n\nexport { Const } from './components/Const.tsx'\nexport { Fabric } from './components/Fabric.tsx'\nexport { File } from './components/File.tsx'\nexport { Function } from './components/Function.tsx'\n// components\nexport { Root } from './components/Root.tsx'\nexport { Type } from './components/Type.tsx'\n\n// composables\nexport { useFabric } from './composables/useFabric.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\n\n// factories\nexport { createReactFabric } from './createReactFabric.ts'\nexport { openDevtools } from './devtools.ts'\nexport { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"mappings":";;;;;;;;;;;;;;AAmCA,SAAA,MAAA,EAAA,UAAA,GAAA,SAAA;;;AAKE,KAAA,SAAA,EAAA,GAAA,kBAAA,SAAA,kBAAA,iBAAA,SAAA,SAAA;;;;AAMA,QAAA,sCAAA,KAAA,sBAAA,UAAA,EAAA,UAAA;;;;;;;;;;;;;;;AAwBF,MAAA,cAAA;;;;;;ACrDA,SAAgB,OAAsC,EAAE,UAAU,GAAG,SAAiD;CACpH,MAAM,EAAE,OAAO,EAAE,KAAK;CAEtB,MAAM,EAAE,UAAA,GAAA,kBAAA,YAAoBC,kBAAAA,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
|
4
|
-
import {
|
|
1
|
+
import { r as __name } from "./chunk-BGCRLu6H.js";
|
|
2
|
+
import { c as FabricReactElement, f as Key, g as FunctionParams, h as types_d_exports, l as FabricReactNode, y as createFunctionParams } from "./types-BJVZ7ita.js";
|
|
3
|
+
import { t as Options$1 } from "./reactPlugin-CKiGUCKQ.js";
|
|
4
|
+
import { FileManager, FileManager as FileManager$1, FileProcessor, TreeNode, TreeNode as TreeNode$1, createContext, createFabric, createFile, useContext, useFabric, useFile, useLifecycle } from "@kubb/fabric-core";
|
|
5
5
|
import { Fabric as Fabric$1, FabricConfig, FabricMode, KubbFile } from "@kubb/fabric-core/types";
|
|
6
6
|
import * as react from "react";
|
|
7
7
|
|
|
8
|
-
//#region src/components/App.d.ts
|
|
9
|
-
type AppProps<TMeta extends object = object> = {
|
|
10
|
-
/**
|
|
11
|
-
* Metadata associated with the App.
|
|
12
|
-
*/
|
|
13
|
-
meta?: TMeta;
|
|
14
|
-
/**
|
|
15
|
-
* Children nodes.
|
|
16
|
-
*/
|
|
17
|
-
children?: FabricReactNode;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* App container containing the AppContext carrying `meta` and an `exit` hook.
|
|
21
|
-
*/
|
|
22
|
-
declare function App<TMeta extends object = object>({
|
|
23
|
-
children,
|
|
24
|
-
...props
|
|
25
|
-
}: AppProps<TMeta>): FabricReactElement;
|
|
26
|
-
declare namespace App {
|
|
27
|
-
var displayName: string;
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
8
|
//#region src/components/Const.d.ts
|
|
31
9
|
type ConstProps = {
|
|
32
10
|
key?: Key;
|
|
@@ -66,6 +44,28 @@ declare namespace Const {
|
|
|
66
44
|
var displayName: string;
|
|
67
45
|
}
|
|
68
46
|
//#endregion
|
|
47
|
+
//#region src/components/Fabric.d.ts
|
|
48
|
+
type FabricProps<TMeta extends object = object> = {
|
|
49
|
+
/**
|
|
50
|
+
* Metadata associated with the App.
|
|
51
|
+
*/
|
|
52
|
+
meta?: TMeta;
|
|
53
|
+
/**
|
|
54
|
+
* Children nodes.
|
|
55
|
+
*/
|
|
56
|
+
children?: FabricReactNode;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Fabric container containing the FabricContext carrying `meta` and an `exit` hook.
|
|
60
|
+
*/
|
|
61
|
+
declare function Fabric<TMeta extends object = object>({
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}: FabricProps<TMeta>): FabricReactElement;
|
|
65
|
+
declare namespace Fabric {
|
|
66
|
+
var displayName: string;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
69
|
//#region src/components/File.d.ts
|
|
70
70
|
type BasePropsWithBaseName = {
|
|
71
71
|
/**
|
|
@@ -343,5 +343,5 @@ declare const useEffect: typeof react.useEffect;
|
|
|
343
343
|
declare const useReducer: typeof react.useReducer;
|
|
344
344
|
declare const useRef: typeof react.useRef;
|
|
345
345
|
//#endregion
|
|
346
|
-
export {
|
|
346
|
+
export { Const, Fabric, File, FileManager, FileProcessor, Function, FunctionParams, Root, Runtime, TreeNode, Type, createContext, createFabric, createFile, createFunctionParams, createReactFabric, openDevtools, useContext, useEffect, useFabric, useFile, useLifecycle, useReducer, useRef, useState };
|
|
347
347
|
//# sourceMappingURL=index.d.ts.map
|