@kubb/react-fabric 0.11.4 → 0.11.6
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/{Fabric-BELBf-bX.d.cts → Fabric-4Ac6xwwR.d.ts} +4 -2
- package/dist/{Fabric-DbJhvsCq.d.ts → Fabric-xd8epqSF.d.cts} +1 -2
- package/dist/{TreeNode-Dqmg64Vf.d.cts → TreeNode-CoigrXFC.d.ts} +3 -3
- package/dist/{TreeNode-tc-jO4rk.d.ts → TreeNode-Pwm74f2F.d.cts} +2 -3
- package/dist/{chunk-BCPZiDLE.js → chunk-DkQCb-7t.js} +5 -1
- package/dist/globals.d.cts +3 -4
- package/dist/globals.d.ts +4 -4
- package/dist/index.cjs +110 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -24
- package/dist/index.d.ts +27 -24
- package/dist/index.js +107 -8
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +28 -12
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +6 -7
- package/dist/jsx-dev-runtime.d.ts +5 -5
- package/dist/jsx-dev-runtime.js +25 -8
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/{jsx-namespace-Cwg_oGAF.d.cts → jsx-namespace-CDB8OdrC.d.cts} +3 -3
- package/dist/{jsx-namespace-bLrscF7g.d.ts → jsx-namespace-rawlYj_g.d.ts} +3 -3
- package/dist/{jsx-runtime-Cq39dA50.cjs → jsx-runtime-6sQc68DD.cjs} +30 -13
- package/dist/{jsx-runtime-Cq39dA50.cjs.map → jsx-runtime-6sQc68DD.cjs.map} +1 -1
- package/dist/{jsx-runtime-Isgf9orn.js → jsx-runtime-CT8FKS42.js} +27 -9
- package/dist/{jsx-runtime-Isgf9orn.js.map → jsx-runtime-CT8FKS42.js.map} +1 -1
- package/dist/jsx-runtime.cjs +2 -2
- package/dist/jsx-runtime.d.cts +6 -7
- package/dist/jsx-runtime.d.ts +5 -5
- package/dist/jsx-runtime.js +2 -2
- package/dist/parsers.d.cts +2 -3
- package/dist/parsers.d.ts +3 -3
- package/dist/plugins.cjs +3 -3
- package/dist/plugins.d.cts +3 -4
- package/dist/plugins.d.ts +4 -4
- package/dist/plugins.js +3 -3
- package/dist/{react-DfIUVisP.js → react-CDrFaZVO.js} +92 -32
- package/dist/{react-DfIUVisP.js.map → react-CDrFaZVO.js.map} +1 -1
- package/dist/{react-CWV4qQg2.cjs → react-DgrQzKJp.cjs} +144 -35
- package/dist/{react-CWV4qQg2.cjs.map → react-DgrQzKJp.cjs.map} +1 -1
- package/dist/{reactPlugin-BHE3X6-B.d.ts → reactPlugin-6pWd-WfZ.d.cts} +2 -3
- package/dist/{reactPlugin-B8F6jVb5.cjs → reactPlugin-BzGD_nR7.cjs} +6507 -4219
- package/dist/reactPlugin-BzGD_nR7.cjs.map +1 -0
- package/dist/{reactPlugin-yhmHKdUw.d.cts → reactPlugin-CpMrftCn.d.ts} +3 -3
- package/dist/{reactPlugin-CAtVV84d.js → reactPlugin-lOa0xpGM.js} +6492 -4209
- package/dist/reactPlugin-lOa0xpGM.js.map +1 -0
- package/dist/{types-BKNiqRcq.d.cts → types-125Qu-Uh.d.ts} +4 -4
- package/dist/{types-BKXB0ewg.d.ts → types-BrE57KWH.d.cts} +3 -4
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +5 -12
- package/shims.d.ts +1 -0
- package/src/Runtime.tsx +0 -6
- package/src/components/App.tsx +5 -0
- package/src/createReactFabric.ts +2 -2
- package/src/devtools.ts +17 -2
- package/src/index.ts +1 -1
- package/dist/chunk-BrXtsOCC.cjs +0 -41
- package/dist/devtools-BRzetYQI.js +0 -94
- package/dist/devtools-BRzetYQI.js.map +0 -1
- package/dist/devtools-D3a3Jrcj.cjs +0 -101
- package/dist/devtools-D3a3Jrcj.cjs.map +0 -1
- package/dist/devtools.cjs +0 -3
- package/dist/devtools.d.cts +0 -11
- package/dist/devtools.d.ts +0 -11
- package/dist/devtools.js +0 -3
- package/dist/reactPlugin-B8F6jVb5.cjs.map +0 -1
- package/dist/reactPlugin-CAtVV84d.js.map +0 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { n as __exportAll, r as __name } from "./chunk-DkQCb-7t.js";
|
|
2
|
+
|
|
3
|
+
//#region ../fabric-core/src/KubbFile.d.ts
|
|
1
4
|
declare namespace KubbFile_d_exports {
|
|
2
5
|
export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
|
|
3
6
|
}
|
|
@@ -414,5 +417,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
414
417
|
upsertFile(...files: File[]): Promise<void>;
|
|
415
418
|
}
|
|
416
419
|
//#endregion
|
|
417
|
-
export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
|
|
418
|
-
//# sourceMappingURL=Fabric-BELBf-bX.d.cts.map
|
|
420
|
+
export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
|
|
@@ -414,5 +414,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
414
414
|
upsertFile(...files: File[]): Promise<void>;
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
|
-
export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
|
|
418
|
-
//# sourceMappingURL=Fabric-DbJhvsCq.d.ts.map
|
|
417
|
+
export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, __name as x, ResolvedFile as y };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as __name } from "./chunk-DkQCb-7t.js";
|
|
2
|
+
import { h as File } from "./Fabric-4Ac6xwwR.js";
|
|
2
3
|
|
|
3
4
|
//#region ../fabric-core/src/utils/TreeNode.d.ts
|
|
4
5
|
type BarrelData = {
|
|
@@ -31,5 +32,4 @@ declare class TreeNode<TData = unknown> {
|
|
|
31
32
|
static fromFiles(files: Array<File>, rootFolder?: string): TreeNode<BarrelData> | null;
|
|
32
33
|
}
|
|
33
34
|
//#endregion
|
|
34
|
-
export { TreeNode as t };
|
|
35
|
-
//# sourceMappingURL=TreeNode-Dqmg64Vf.d.cts.map
|
|
35
|
+
export { TreeNode as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as File } from "./Fabric-
|
|
1
|
+
import { h as File, x as __name } from "./Fabric-xd8epqSF.cjs";
|
|
2
2
|
|
|
3
3
|
//#region ../fabric-core/src/utils/TreeNode.d.ts
|
|
4
4
|
type BarrelData = {
|
|
@@ -31,5 +31,4 @@ declare class TreeNode<TData = unknown> {
|
|
|
31
31
|
static fromFiles(files: Array<File>, rootFolder?: string): TreeNode<BarrelData> | null;
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
export { TreeNode as t };
|
|
35
|
-
//# sourceMappingURL=TreeNode-tc-jO4rk.d.ts.map
|
|
34
|
+
export { TreeNode as t };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
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;
|
|
@@ -39,4 +43,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
43
|
}) : target, mod));
|
|
40
44
|
|
|
41
45
|
//#endregion
|
|
42
|
-
export { __exportAll as n,
|
|
46
|
+
export { __toESM as i, __exportAll as n, __name as r, __commonJSMin as t };
|
package/dist/globals.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./Fabric-
|
|
2
|
-
import { c as KubbFileProps, d as KubbSourceProps, f as KubbTextProps, l as KubbImportProps, o as KubbElement, p as LineBreakProps, s as KubbExportProps, u as KubbNode } from "./types-
|
|
1
|
+
import { x as __name } from "./Fabric-xd8epqSF.cjs";
|
|
2
|
+
import { c as KubbFileProps, d as KubbSourceProps, f as KubbTextProps, l as KubbImportProps, o as KubbElement, p as LineBreakProps, s as KubbExportProps, u as KubbNode } from "./types-BrE57KWH.cjs";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/globals.d.ts
|
|
@@ -18,5 +18,4 @@ declare global {
|
|
|
18
18
|
br: LineBreakProps;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=globals.d.cts.map
|
|
21
|
+
}
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
1
|
+
import { r as __name } from "./chunk-DkQCb-7t.js";
|
|
2
|
+
import "./Fabric-4Ac6xwwR.js";
|
|
3
|
+
import { c as KubbFileProps, d as KubbSourceProps, f as KubbTextProps, l as KubbImportProps, o as KubbElement, p as LineBreakProps, s as KubbExportProps, u as KubbNode } from "./types-125Qu-Uh.js";
|
|
3
4
|
import React from "react";
|
|
4
5
|
|
|
5
6
|
//#region src/globals.d.ts
|
|
@@ -18,5 +19,4 @@ declare global {
|
|
|
18
19
|
br: LineBreakProps;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=globals.d.ts.map
|
|
22
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_devtools = require('./devtools-D3a3Jrcj.cjs');
|
|
5
|
-
const require_reactPlugin = require('./reactPlugin-B8F6jVb5.cjs');
|
|
1
|
+
const require_react$1 = require('./react-DgrQzKJp.cjs');
|
|
2
|
+
const require_jsx_runtime = require('./jsx-runtime-6sQc68DD.cjs');
|
|
3
|
+
const require_reactPlugin = require('./reactPlugin-BzGD_nR7.cjs');
|
|
6
4
|
let _kubb_fabric_core = require("@kubb/fabric-core");
|
|
7
5
|
let dedent = require("dedent");
|
|
8
|
-
dedent =
|
|
6
|
+
dedent = require_react$1.__toESM(dedent);
|
|
7
|
+
let execa = require("execa");
|
|
8
|
+
let signal_exit = require("signal-exit");
|
|
9
|
+
let ws = require("ws");
|
|
10
|
+
ws = require_react$1.__toESM(ws);
|
|
9
11
|
let natural_orderby = require("natural-orderby");
|
|
10
12
|
|
|
11
13
|
//#region src/components/App.tsx
|
|
12
|
-
var import_react = /* @__PURE__ */
|
|
14
|
+
var import_react = /* @__PURE__ */ require_react$1.__toESM(require_react$1.require_react());
|
|
15
|
+
function Div(props) {
|
|
16
|
+
return /* @__PURE__ */ require_jsx_runtime.jsx("div", { children: props.children });
|
|
17
|
+
}
|
|
13
18
|
/**
|
|
14
19
|
* App container containing the AppContext carrying `meta` and an `exit` hook.
|
|
15
20
|
*/
|
|
@@ -361,11 +366,106 @@ function useLifecycle() {
|
|
|
361
366
|
} };
|
|
362
367
|
}
|
|
363
368
|
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/devtools.ts
|
|
371
|
+
function open() {
|
|
372
|
+
const customGlobal = global;
|
|
373
|
+
customGlobal.WebSocket || (customGlobal.WebSocket = ws.default);
|
|
374
|
+
customGlobal.window || (customGlobal.window = global);
|
|
375
|
+
customGlobal.self || (customGlobal.self = global);
|
|
376
|
+
customGlobal.isDevtoolsEnabled = true;
|
|
377
|
+
customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [
|
|
378
|
+
{
|
|
379
|
+
type: 2,
|
|
380
|
+
value: "Context.Provider",
|
|
381
|
+
isEnabled: true,
|
|
382
|
+
isValid: true
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
type: 2,
|
|
386
|
+
value: "KubbRoot",
|
|
387
|
+
isEnabled: true,
|
|
388
|
+
isValid: true
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
type: 2,
|
|
392
|
+
value: "KubbErrorBoundary",
|
|
393
|
+
isEnabled: true,
|
|
394
|
+
isValid: true
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
type: 2,
|
|
398
|
+
value: "kubb-file",
|
|
399
|
+
isEnabled: true,
|
|
400
|
+
isValid: true
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
type: 2,
|
|
404
|
+
value: "kubb-text",
|
|
405
|
+
isEnabled: true,
|
|
406
|
+
isValid: true
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
type: 2,
|
|
410
|
+
value: "kubb-import",
|
|
411
|
+
isEnabled: true,
|
|
412
|
+
isValid: true
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
type: 2,
|
|
416
|
+
value: "kubb-export",
|
|
417
|
+
isEnabled: true,
|
|
418
|
+
isValid: true
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
type: 2,
|
|
422
|
+
value: "kubb-source",
|
|
423
|
+
isEnabled: true,
|
|
424
|
+
isValid: true
|
|
425
|
+
}
|
|
426
|
+
];
|
|
427
|
+
import("react-devtools-core").then(async (devtools) => {
|
|
428
|
+
console.info("Opening devtools");
|
|
429
|
+
const controller = new AbortController();
|
|
430
|
+
(0, execa.execa)({
|
|
431
|
+
stdio: "pipe",
|
|
432
|
+
preferLocal: true,
|
|
433
|
+
cancelSignal: controller.signal,
|
|
434
|
+
gracefulCancel: true
|
|
435
|
+
})`npx react-devtools@6.1.5`;
|
|
436
|
+
const { initialize, connectToDevTools } = devtools;
|
|
437
|
+
initialize();
|
|
438
|
+
console.info("Initializing devtools");
|
|
439
|
+
require_reactPlugin.Renderer.injectIntoDevTools({
|
|
440
|
+
bundleType: 1,
|
|
441
|
+
version: "19.1.0",
|
|
442
|
+
rendererPackageName: "kubb",
|
|
443
|
+
findFiberByHostInstance: () => null
|
|
444
|
+
});
|
|
445
|
+
console.info("Connecting devtools");
|
|
446
|
+
try {
|
|
447
|
+
connectToDevTools({
|
|
448
|
+
host: "localhost",
|
|
449
|
+
port: 8097,
|
|
450
|
+
useHttps: false,
|
|
451
|
+
isAppActive: () => true
|
|
452
|
+
});
|
|
453
|
+
} catch (e) {
|
|
454
|
+
console.error(e);
|
|
455
|
+
console.info("Error when connecting the devtools");
|
|
456
|
+
}
|
|
457
|
+
(0, signal_exit.onExit)(() => {
|
|
458
|
+
console.info("Disconnecting devtools");
|
|
459
|
+
controller.abort();
|
|
460
|
+
}, { alwaysLast: false });
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
364
464
|
//#endregion
|
|
365
465
|
//#region src/createReactFabric.ts
|
|
366
466
|
function createReactFabric(config = {}) {
|
|
467
|
+
if (config.devtools) open();
|
|
367
468
|
const fabric = (0, _kubb_fabric_core.createFabric)({ mode: config.mode });
|
|
368
|
-
if (config.devtools) require_devtools.open();
|
|
369
469
|
fabric.use(require_reactPlugin.reactPlugin, {
|
|
370
470
|
stdout: config.stdout,
|
|
371
471
|
stderr: config.stderr,
|
|
@@ -504,6 +604,7 @@ const useRef = import_react.useRef;
|
|
|
504
604
|
//#endregion
|
|
505
605
|
exports.App = App;
|
|
506
606
|
exports.Const = Const;
|
|
607
|
+
exports.Div = Div;
|
|
507
608
|
exports.File = File;
|
|
508
609
|
Object.defineProperty(exports, 'FileManager', {
|
|
509
610
|
enumerable: true,
|
|
@@ -557,5 +658,4 @@ Object.defineProperty(exports, 'useFile', {
|
|
|
557
658
|
exports.useLifecycle = useLifecycle;
|
|
558
659
|
exports.useReducer = useReducer;
|
|
559
660
|
exports.useRef = useRef;
|
|
560
|
-
exports.useState = useState;
|
|
561
|
-
//# sourceMappingURL=index.cjs.map
|
|
661
|
+
exports.useState = useState;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["RootContext","NodeTreeContext","AppContext","NodeTreeContext","NodeTreeContext","file: KubbFile.File","FileContext","result: React.ReactNode[]","NodeTreeContext","NodeTreeContext","RootContext","reactPlugin","types: string[]","names: string[]","item","key","name","acc: string[]","parsedItem"],"sources":["../src/components/App.tsx","../src/components/Const.tsx","../src/components/File.tsx","../../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js","../src/components/Indent.tsx","../src/components/Function.tsx","../src/components/Type.tsx","../src/composables/useLifecycle.tsx","../src/createReactFabric.ts","../src/utils/getFunctionParams.ts","../src/index.ts"],"sourcesContent":["import { AppContext, NodeTreeContext, provide, RootContext, useContext, useNodeTree } from '@kubb/fabric-core'\nimport type { KubbNode } 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?: KubbNode\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>) {\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 = 'KubbApp'\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbNode } 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?: KubbNode\n}\n\n/**\n * Generates a TypeScript constant declaration.\n */\nexport function Const({ children, ...props }: ConstProps) {\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 = {children}\n {asConst && <> as const</>}\n </>\n )\n}\n\nConst.displayName = 'KubbConst'\n","import { FileContext, NodeTreeContext, provide, useFile, useFileManager, useNodeTree } from '@kubb/fabric-core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Key, KubbNode } 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?: KubbNode\n}\n\n/**\n * Adds files to the FileManager\n */\nexport function File<TMeta extends object = object>({ children, ...props }: Props<TMeta>) {\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 = 'KubbFile'\n\ntype FileSourceProps = Omit<KubbFile.Source, 'value'> & {\n key?: Key\n children?: KubbNode\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) {\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 = 'KubbFileSource'\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) {\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 = 'KubbFileExport'\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) {\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 = 'KubbFileImport'\n\nFile.Export = FileExport\nFile.Import = FileImport\nFile.Source = FileSource\n","export default function indentString(string, count = 1, options = {}) {\n\tconst {\n\t\tindent = ' ',\n\t\tincludeEmptyLines = false\n\t} = options;\n\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`input\\` to be a \\`string\\`, got \\`${typeof string}\\``\n\t\t);\n\t}\n\n\tif (typeof count !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`count\\` to be a \\`number\\`, got \\`${typeof count}\\``\n\t\t);\n\t}\n\n\tif (count < 0) {\n\t\tthrow new RangeError(\n\t\t\t`Expected \\`count\\` to be at least 0, got \\`${count}\\``\n\t\t);\n\t}\n\n\tif (typeof indent !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`options.indent\\` to be a \\`string\\`, got \\`${typeof indent}\\``\n\t\t);\n\t}\n\n\tif (count === 0) {\n\t\treturn string;\n\t}\n\n\tconst regex = includeEmptyLines ? /^/gm : /^(?!\\s*$)/gm;\n\n\treturn string.replace(regex, indent.repeat(count));\n}\n","import dedent from 'dedent'\nimport indentString from 'indent-string'\nimport React from 'react'\n\ntype IndentProps = {\n size?: number\n children?: React.ReactNode\n}\n\n/**\n * Indents all children by `size` spaces.\n * Collapses consecutive <br /> tags to at most 2.\n *\n * Indent will dedent and re-indent string children and will prefix\n * non-string children with the requested number of spaces.\n */\nexport function Indent({ size = 2, children }: IndentProps) {\n if (!children) return null\n\n const childrenArray = React.Children.toArray(children)\n const result: React.ReactNode[] = []\n\n let prevWasBr = false\n let brCount = 0\n\n for (const child of childrenArray) {\n if (React.isValidElement(child) && child.type === 'br') {\n if (!prevWasBr || brCount < 2) {\n result.push(child)\n brCount++\n }\n prevWasBr = true\n } else {\n prevWasBr = false\n brCount = 0\n result.push(child)\n }\n }\n\n return (\n <>\n {result.map((child) => {\n if (typeof child === 'string') {\n const cleaned = dedent(child)\n return <>{indentString(cleaned, size)}</>\n }\n return (\n <>\n {' '.repeat(size)}\n {child}\n </>\n )\n })}\n </>\n )\n}\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\nimport { Indent } from './Indent.tsx'\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 behaviour.\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?: KubbNode\n}\n\n/**\n * Generates a TypeScript function declaration.\n */\nexport function Function({ children, ...props }: Props) {\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 size={2}>{children}</Indent>\n <br />\n {'}'}\n </>\n )\n}\n\nFunction.displayName = 'KubbFunction'\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 size={2}>{children}</Indent>\n <br />\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'KubbArrowFunction'\nFunction.Arrow = ArrowFunction\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbNode } 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?: KubbNode\n}\n\n/**\n * Generates a TypeScript type declaration.\n */\nexport function Type({ children, ...props }: TypeProps) {\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 = 'KubbType'\n","import { RootContext, useContext } from '@kubb/fabric-core'\n\n/**\n * Provides lifecycle helpers that integrate with the Fabric runtime. The\n * `exit` helper schedules a call to the RootContext exit function on the\n * next tick to allow React to complete its render cycle first.\n */\nexport function useLifecycle() {\n const { exit } = useContext(RootContext)\n\n return {\n exit: () => {\n // need this to let React finish its current render cycle\n setTimeout(() => {\n exit()\n }, 0)\n },\n }\n}\n","import type { Fabric } from '@kubb/fabric-core'\nimport { createFabric } from '@kubb/fabric-core'\nimport type { FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { open } 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 const fabric = createFabric({ mode: config.mode })\n\n if (config.devtools) {\n open()\n }\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 { orderBy } from 'natural-orderby'\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 orderBy(\n items.filter(Boolean),\n [\n ([_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 ['asc'],\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 { createFabric, createFile, type Fabric, FileManager, FileProcessor } from '@kubb/fabric-core'\n\n// react helpers\nexport const useState = React.useState\nexport const createContext = React.createContext\nexport const createElement = React.createElement\nexport const Fragment = React.Fragment\nexport const use = React.use\nexport const useContext = React.useContext\nexport const useEffect = React.useEffect\nexport const useReducer = React.useReducer\nexport const useRef = React.useRef\n// components\nexport { App } from './components/App.tsx'\nexport { Const } from './components/Const.tsx'\nexport { File } from './components/File.tsx'\nexport { Function } from './components/Function.tsx'\nexport { Indent } from './components/Indent.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 { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"x_google_ignoreList":[3],"mappings":";;;;;;;;;;;;;;;AAiBA;;;;AAOE;;;;AAMA;;;;AAEA;;AAGF;;;;;;;ACAA,SAAgB,MAAM,EAAE,UAAU,GAAG,SAAqB;CACxD,MAAM,EAAE,MAAM,QAAQ,WAAW,MAAM,OAAO,YAAY;CAE1D,MAAM,+CAAwB;AAE9B,KAAI,SAGF,gCAAQG,mCAFU,SAAS,SAAS;EAAE,MAAM;EAAS;EAAO,CAAC,CAE1B;AAGrC,QACE;iDACG,MAAO,aACN,uHACe,EAAE,wDAAU,MAAO,UAAU,CAAC,EAC3C,wCAAC,SAAK,IACL;EAEJ,aAAa,kFAAE,YAAU;EAAC;EACpB;EAAM;EACZ,QACC;GACG;GACA;GAAM;MACN;EACH;EACC;EACF,WAAW,kFAAE,cAAY;KACzB;;AAIP,MAAM,cAAc;;;;;;;AC9BpB,SAAgB,KAAoC,EAAE,UAAU,GAAG,SAAuB;CACxF,MAAM,EAAE,UAAU,MAAM,OAAO,EAAE,EAAE,QAAQ,WAAW;CAEtD,MAAM,qDAA8B;CACpC,MAAM,+CAAwB;AAE9B,KAAI,SAGF,gCAAQC,mCAFU,SAAS,SAAS;EAAE,MAAM;EAAQ;EAAO,CAAC,CAEzB;AAGrC,KAAI,CAAC,YAAY,CAAC,KAChB,QAAO,wEAAG,WA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eTreeContext","NodeTreeContext","FileContext","NodeTreeContext","NodeTreeContext","RootContext","reactPlugin","item","key","name","parsedItem"],"sources":["../src/components/App.tsx","../src/components/Const.tsx","../src/components/File.tsx","../../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js","../src/components/Indent.tsx","../src/components/Function.tsx","../src/components/Type.tsx","../src/composables/useLifecycle.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 * as React from 'react'\nimport type { KubbNode } 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?: KubbNode\n}\n\nexport function Div(props: { children: React.ReactNode }) {\n return <div>{props.children}</div>\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>) {\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 = 'KubbApp'\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbNode } 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?: KubbNode\n}\n\n/**\n * Generates a TypeScript constant declaration.\n */\nexport function Const({ children, ...props }: ConstProps) {\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 = {children}\n {asConst && <> as const</>}\n </>\n )\n}\n\nConst.displayName = 'KubbConst'\n","import { FileContext, NodeTreeContext, provide, useFile, useFileManager, useNodeTree } from '@kubb/fabric-core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Key, KubbNode } 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?: KubbNode\n}\n\n/**\n * Adds files to the FileManager\n */\nexport function File<TMeta extends object = object>({ children, ...props }: Props<TMeta>) {\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 = 'KubbFile'\n\ntype FileSourceProps = Omit<KubbFile.Source, 'value'> & {\n key?: Key\n children?: KubbNode\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) {\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 = 'KubbFileSource'\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) {\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 = 'KubbFileExport'\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) {\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 = 'KubbFileImport'\n\nFile.Export = FileExport\nFile.Import = FileImport\nFile.Source = FileSource\n","export default function indentString(string, count = 1, options = {}) {\n\tconst {\n\t\tindent = ' ',\n\t\tincludeEmptyLines = false\n\t} = options;\n\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`input\\` to be a \\`string\\`, got \\`${typeof string}\\``\n\t\t);\n\t}\n\n\tif (typeof count !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`count\\` to be a \\`number\\`, got \\`${typeof count}\\``\n\t\t);\n\t}\n\n\tif (count < 0) {\n\t\tthrow new RangeError(\n\t\t\t`Expected \\`count\\` to be at least 0, got \\`${count}\\``\n\t\t);\n\t}\n\n\tif (typeof indent !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`options.indent\\` to be a \\`string\\`, got \\`${typeof indent}\\``\n\t\t);\n\t}\n\n\tif (count === 0) {\n\t\treturn string;\n\t}\n\n\tconst regex = includeEmptyLines ? /^/gm : /^(?!\\s*$)/gm;\n\n\treturn string.replace(regex, indent.repeat(count));\n}\n","import dedent from 'dedent'\nimport indentString from 'indent-string'\nimport React from 'react'\n\ntype IndentProps = {\n size?: number\n children?: React.ReactNode\n}\n\n/**\n * Indents all children by `size` spaces.\n * Collapses consecutive <br /> tags to at most 2.\n *\n * Indent will dedent and re-indent string children and will prefix\n * non-string children with the requested number of spaces.\n */\nexport function Indent({ size = 2, children }: IndentProps) {\n if (!children) return null\n\n const childrenArray = React.Children.toArray(children)\n const result: React.ReactNode[] = []\n\n let prevWasBr = false\n let brCount = 0\n\n for (const child of childrenArray) {\n if (React.isValidElement(child) && child.type === 'br') {\n if (!prevWasBr || brCount < 2) {\n result.push(child)\n brCount++\n }\n prevWasBr = true\n } else {\n prevWasBr = false\n brCount = 0\n result.push(child)\n }\n }\n\n return (\n <>\n {result.map((child) => {\n if (typeof child === 'string') {\n const cleaned = dedent(child)\n return <>{indentString(cleaned, size)}</>\n }\n return (\n <>\n {' '.repeat(size)}\n {child}\n </>\n )\n })}\n </>\n )\n}\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\nimport { Indent } from './Indent.tsx'\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 behaviour.\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?: KubbNode\n}\n\n/**\n * Generates a TypeScript function declaration.\n */\nexport function Function({ children, ...props }: Props) {\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 size={2}>{children}</Indent>\n <br />\n {'}'}\n </>\n )\n}\n\nFunction.displayName = 'KubbFunction'\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 size={2}>{children}</Indent>\n <br />\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'KubbArrowFunction'\nFunction.Arrow = ArrowFunction\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbNode } 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?: KubbNode\n}\n\n/**\n * Generates a TypeScript type declaration.\n */\nexport function Type({ children, ...props }: TypeProps) {\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 = 'KubbType'\n","import { RootContext, useContext } from '@kubb/fabric-core'\n\n/**\n * Provides lifecycle helpers that integrate with the Fabric runtime. The\n * `exit` helper schedules a call to the RootContext exit function on the\n * next tick to allow React to complete its render cycle first.\n */\nexport function useLifecycle() {\n const { exit } = useContext(RootContext)\n\n return {\n exit: () => {\n // need this to let React finish its current render cycle\n setTimeout(() => {\n exit()\n }, 0)\n },\n }\n}\n","import { execa } from 'execa'\nimport { onExit } from 'signal-exit'\nimport ws from 'ws'\n\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\nexport function open() {\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 Kubbs's 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: 'KubbRoot',\n isEnabled: true,\n isValid: true,\n },\n {\n // ComponentFilterDisplayName\n type: 2,\n value: 'KubbErrorBoundary',\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 execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools@6.1.5`\n\n // Destructure the functions from the module\n const { initialize, connectToDevTools } = 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.1.0',\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 onExit(\n () => {\n console.info('Disconnecting devtools')\n controller.abort()\n },\n { alwaysLast: false },\n )\n })\n}\n","import type { Fabric } from '@kubb/fabric-core'\nimport { createFabric } from '@kubb/fabric-core'\nimport type { FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { open } 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 open()\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 { orderBy } from 'natural-orderby'\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 orderBy(\n items.filter(Boolean),\n [\n ([_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 ['asc'],\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 { createFabric, createFile, type Fabric, FileManager, FileProcessor } from '@kubb/fabric-core'\n\n// react helpers\nexport const useState = React.useState\nexport const createContext = React.createContext\nexport const createElement = React.createElement\nexport const Fragment = React.Fragment\nexport const use = React.use\nexport const useContext = React.useContext\nexport const useEffect = React.useEffect\nexport const useReducer = React.useReducer\nexport const useRef = React.useRef\n// components\nexport { App, Div } from './components/App.tsx'\nexport { Const } from './components/Const.tsx'\nexport { File } from './components/File.tsx'\nexport { Function } from './components/Function.tsx'\nexport { Indent } from './components/Indent.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 { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"x_google_ignoreList":[3],"mappings":";;;;;;;;;;;;;;AAeA;AACE;;;;;AAMF;;;;AAOE;;;;AAMA;;;;AAEA;;AAGF;;;;;;;ACLA,SAAgB,MAAM,EAAE,UAAU,GAAG,SAAqB;CACxD,MAAM,EAAE,MAAM,QAAQ,WAAW,MAAM,OAAO,YAAY;CAE1D,MAAM,+CAAwB;AAE9B,KAAI,SAGF,gCAAQG,mCAFU,SAAS,SAAS;EAAE,MAAM;EAAS;EAAO,CAAC,CAE1B;AAGrC,QACE;iDACG,MAAO,aACN,uHACe,EAAE,wDAAU,MAAO,UAAU,CAAC,EAC3C,wCAAC,SAAK,IACL;EAEJ,aAAa,kFAAE,YAAU;EAAC;EACpB;EAAM;EACZ,QACC;GACG;GACA;GAAM;MACN;EACH;EACC;EACF,WAAW,kFAAE,cAAY;KACzB;;AAIP,MAAM,cAAc;;;;;;;AC9BpB,SAAgB,KAAoC,EAAE,UAAU,GAAG,SAAuB;CACxF,MAAM,EAAE,UAAU,MAAM,OAAO,EAAE,EAAE,QAAQ,WAAW;CAEtD,MAAM,qDAA8B;CACpC,MAAM,+CAAwB;AAE9B,KAAI,SAGF,gCAAQC,mCAFU,SAAS,SAAS;EAAE,MAAM;EAAQ;EAAO,CAAC,CAEzB;AAGrC,KAAI,CAAC,YAAY,CAAC,KAChB,QAAO,wEAAG,WAAY;CAGxB,MAAM,OAAsB;EAC1B;EACA;EACA;EACA;EACA;E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Mode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-
|
|
2
|
-
import { a as Key, h as FunctionParams, u as KubbNode, v as createFunctionParams, y as JSDoc } from "./types-
|
|
3
|
-
import { t as Options$1 } from "./reactPlugin-
|
|
4
|
-
import * as
|
|
1
|
+
import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, x as __name, y as ResolvedFile } from "./Fabric-xd8epqSF.cjs";
|
|
2
|
+
import { a as Key, h as FunctionParams, u as KubbNode, v as createFunctionParams, y as JSDoc } from "./types-BrE57KWH.cjs";
|
|
3
|
+
import { t as Options$1 } from "./reactPlugin-6pWd-WfZ.cjs";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
5
|
import React, { ReactNode } from "react";
|
|
6
6
|
|
|
7
7
|
//#region ../fabric-core/src/contexts/AppContext.d.ts
|
|
@@ -57,13 +57,16 @@ type AppProps<TMeta extends object = object> = {
|
|
|
57
57
|
*/
|
|
58
58
|
children?: KubbNode;
|
|
59
59
|
};
|
|
60
|
+
declare function Div(props: {
|
|
61
|
+
children: React$1.ReactNode;
|
|
62
|
+
}): React$1.JSX.Element;
|
|
60
63
|
/**
|
|
61
64
|
* App container containing the AppContext carrying `meta` and an `exit` hook.
|
|
62
65
|
*/
|
|
63
66
|
declare function App<TMeta extends object = object>({
|
|
64
67
|
children,
|
|
65
68
|
...props
|
|
66
|
-
}: AppProps<TMeta>):
|
|
69
|
+
}: AppProps<TMeta>): React$1.ReactNode;
|
|
67
70
|
declare namespace App {
|
|
68
71
|
var displayName: string;
|
|
69
72
|
}
|
|
@@ -102,7 +105,7 @@ type ConstProps = {
|
|
|
102
105
|
declare function Const({
|
|
103
106
|
children,
|
|
104
107
|
...props
|
|
105
|
-
}: ConstProps):
|
|
108
|
+
}: ConstProps): React$1.JSX.Element;
|
|
106
109
|
declare namespace Const {
|
|
107
110
|
var displayName: string;
|
|
108
111
|
}
|
|
@@ -141,7 +144,7 @@ type Props$1<TMeta> = BaseProps & {
|
|
|
141
144
|
declare function File<TMeta extends object = object>({
|
|
142
145
|
children,
|
|
143
146
|
...props
|
|
144
|
-
}: Props$1<TMeta>):
|
|
147
|
+
}: Props$1<TMeta>): React$1.JSX.Element;
|
|
145
148
|
declare namespace File {
|
|
146
149
|
var displayName: string;
|
|
147
150
|
var Export: typeof FileExport;
|
|
@@ -161,7 +164,7 @@ type FileSourceProps = Omit<Source, 'value'> & {
|
|
|
161
164
|
declare function FileSource({
|
|
162
165
|
children,
|
|
163
166
|
...props
|
|
164
|
-
}: FileSourceProps):
|
|
167
|
+
}: FileSourceProps): React$1.JSX.Element;
|
|
165
168
|
declare namespace FileSource {
|
|
166
169
|
var displayName: string;
|
|
167
170
|
}
|
|
@@ -174,7 +177,7 @@ type FileExportProps = Export & {
|
|
|
174
177
|
* Declares an export entry for the current file. This will be collected by
|
|
175
178
|
* the FileCollector for later emission.
|
|
176
179
|
*/
|
|
177
|
-
declare function FileExport(props: FileExportProps):
|
|
180
|
+
declare function FileExport(props: FileExportProps): React$1.JSX.Element;
|
|
178
181
|
declare namespace FileExport {
|
|
179
182
|
var displayName: string;
|
|
180
183
|
}
|
|
@@ -186,7 +189,7 @@ type FileImportProps = Import & {
|
|
|
186
189
|
*
|
|
187
190
|
* Declares an import entry for the current file.
|
|
188
191
|
*/
|
|
189
|
-
declare function FileImport(props: FileImportProps):
|
|
192
|
+
declare function FileImport(props: FileImportProps): React$1.JSX.Element;
|
|
190
193
|
declare namespace FileImport {
|
|
191
194
|
var displayName: string;
|
|
192
195
|
}
|
|
@@ -238,7 +241,7 @@ type Props = {
|
|
|
238
241
|
declare function Function({
|
|
239
242
|
children,
|
|
240
243
|
...props
|
|
241
|
-
}: Props):
|
|
244
|
+
}: Props): React$1.JSX.Element;
|
|
242
245
|
declare namespace Function {
|
|
243
246
|
var displayName: string;
|
|
244
247
|
var Arrow: typeof ArrowFunction;
|
|
@@ -258,7 +261,7 @@ type ArrowFunctionProps = Props & {
|
|
|
258
261
|
declare function ArrowFunction({
|
|
259
262
|
children,
|
|
260
263
|
...props
|
|
261
|
-
}: ArrowFunctionProps):
|
|
264
|
+
}: ArrowFunctionProps): React$1.JSX.Element;
|
|
262
265
|
declare namespace ArrowFunction {
|
|
263
266
|
var displayName: string;
|
|
264
267
|
}
|
|
@@ -306,7 +309,7 @@ type TypeProps = {
|
|
|
306
309
|
declare function Type({
|
|
307
310
|
children,
|
|
308
311
|
...props
|
|
309
|
-
}: TypeProps):
|
|
312
|
+
}: TypeProps): React$1.JSX.Element;
|
|
310
313
|
declare namespace Type {
|
|
311
314
|
var displayName: string;
|
|
312
315
|
}
|
|
@@ -359,15 +362,14 @@ declare class Runtime {
|
|
|
359
362
|
}
|
|
360
363
|
//#endregion
|
|
361
364
|
//#region src/index.d.ts
|
|
362
|
-
declare const useState: typeof
|
|
363
|
-
declare const createContext: typeof
|
|
364
|
-
declare const createElement: typeof
|
|
365
|
-
declare const Fragment:
|
|
366
|
-
declare const use: typeof
|
|
367
|
-
declare const useContext: typeof
|
|
368
|
-
declare const useEffect: typeof
|
|
369
|
-
declare const useReducer: typeof
|
|
370
|
-
declare const useRef: typeof
|
|
365
|
+
declare const useState: typeof React$1.useState;
|
|
366
|
+
declare const createContext: typeof React$1.createContext;
|
|
367
|
+
declare const createElement: typeof React$1.createElement;
|
|
368
|
+
declare const Fragment: React$1.ExoticComponent<React$1.FragmentProps>;
|
|
369
|
+
declare const use: typeof React$1.use;
|
|
370
|
+
declare const useContext: typeof React$1.useContext;
|
|
371
|
+
declare const useEffect: typeof React$1.useEffect;
|
|
372
|
+
declare const useReducer: typeof React$1.useReducer;
|
|
373
|
+
declare const useRef: typeof React$1.useRef;
|
|
371
374
|
//#endregion
|
|
372
|
-
export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
373
|
-
//# sourceMappingURL=index.d.cts.map
|
|
375
|
+
export { App, Const, Div, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|