@kubb/agent 5.0.0-alpha.35 → 5.0.0-alpha.36
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1293 -20554
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +16 -14
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +16 -14
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/buffer-util.js +131 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/event-target.js +292 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/extension.js +203 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/limiter.js +55 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/receiver.js +706 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/subprotocol.js +62 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/validation.js +152 -0
- package/.output/server/node_modules/@clack/core/dist/index.mjs +11 -0
- package/.output/server/node_modules/@clack/core/package.json +60 -0
- package/.output/server/node_modules/@clack/prompts/dist/index.mjs +137 -0
- package/.output/server/node_modules/@clack/prompts/package.json +65 -0
- package/.output/server/node_modules/@kubb/ast/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/ast/dist/index.js +423 -0
- package/.output/server/node_modules/@kubb/ast/package.json +70 -0
- package/.output/server/node_modules/@kubb/core/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/core/dist/hooks.js +23 -0
- package/.output/server/node_modules/@kubb/core/dist/index.js +2311 -0
- package/.output/server/node_modules/@kubb/core/package.json +109 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-O_arW02_.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-iCpMSYCp.js +15 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-NAm_Y-vp.js +55 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +653 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/onProcessExit-Cput7j2c.js +742 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +101 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +375 -0
- package/.output/server/node_modules/@kubb/fabric-core/package.json +111 -0
- package/.output/server/node_modules/@kubb/oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/oas/dist/index.js +918 -0
- package/.output/server/node_modules/@kubb/oas/package.json +94 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/StaticClassClient-bCe7RG_w.js +636 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/components.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/generators-BffddRNu.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/index.js +124 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/axios.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/fetch.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/config.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/package.json +153 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/components-BK_6GU4v.js +257 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/generators-D5YFtyyC.js +71 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/index.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/package.json +108 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/components-BkBIov4R.js +419 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/fakerGenerator-BztogaeO.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/index.js +141 -0
- package/.output/server/node_modules/@kubb/plugin-faker/package.json +103 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/Server-H3SwqhwF.js +178 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/generators-BqkMrcs9.js +274 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/index.js +122 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/package.json +107 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/components-DgtTZkWX.js +277 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/generators-C34kqa1L.js +161 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/index.js +84 -0
- package/.output/server/node_modules/@kubb/plugin-msw/package.json +109 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/SchemaMapper-CqMkO2T1.js +58 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators-D7C3CXsN.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/getFooter-Pw3tLCiV.js +112 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/hooks.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/index.js +408 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/requestBody-pRavthCw.js +1336 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/utils.js +268 -0
- package/.output/server/node_modules/@kubb/plugin-oas/package.json +122 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/components-CpyHYGOw.js +1520 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/generators-CpiBv5eE.js +1427 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/index.js +166 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/package.json +112 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/index.js +65 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/package.json +85 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/static/redoc.hbs +22 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/components-BhStIi1M.js +665 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/generators-CQClzsST.js +415 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/components-DntKBsnB.js +666 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/generators-BtTsGGrM.js +414 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/components-DRDGvgXG.js +702 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/generators-ClWZJ-YG.js +399 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/index.js +144 -0
- package/.output/server/node_modules/@kubb/plugin-swr/package.json +115 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/components-C7fu-sK1.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/index.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/plugin-CYC-FGXe.js +479 -0
- package/.output/server/node_modules/@kubb/plugin-ts/package.json +105 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/components-_AMBl0g-.js +1029 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/generators-Zb1s5Wmb.js +661 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/index.js +157 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/package.json +114 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/components-eECfXVou.js +842 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/generators-D1R6NNf2.js +290 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/index.js +175 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/templates/ToZod.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-zod/package.json +112 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-BGCRLu6H.js +38 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +525 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-Bl0DfUmV.js +1448 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +12 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +2 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +4 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-QQPrjNuQ.js +17813 -0
- package/.output/server/node_modules/@kubb/react-fabric/package.json +143 -0
- package/.output/server/node_modules/buffer-from/index.js +72 -0
- package/.output/server/node_modules/buffer-from/package.json +19 -0
- package/.output/server/node_modules/empathic/access.js +39 -0
- package/.output/server/node_modules/empathic/access.mjs +34 -0
- package/.output/server/node_modules/empathic/find.js +81 -0
- package/.output/server/node_modules/empathic/find.mjs +76 -0
- package/.output/server/node_modules/empathic/package.json +49 -0
- package/.output/server/node_modules/empathic/package.mjs +52 -0
- package/.output/server/node_modules/empathic/resolve.js +31 -0
- package/.output/server/node_modules/empathic/resolve.mjs +27 -0
- package/.output/server/node_modules/empathic/walk.js +22 -0
- package/.output/server/node_modules/empathic/walk.mjs +20 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
- package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
- package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
- package/.output/server/node_modules/fast-string-width/package.json +34 -0
- package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
- package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
- package/.output/server/node_modules/p-limit/index.js +127 -0
- package/.output/server/node_modules/p-limit/package.json +58 -0
- package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
- package/.output/server/node_modules/react-devtools-core/package.json +38 -0
- package/.output/server/node_modules/sisteransi/package.json +34 -0
- package/.output/server/node_modules/sisteransi/src/index.js +58 -0
- package/.output/server/node_modules/source-map-support/package.json +31 -0
- package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
- package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
- package/.output/server/node_modules/typescript/package.json +120 -0
- package/.output/server/node_modules/yocto-queue/index.js +90 -0
- package/.output/server/node_modules/yocto-queue/package.json +48 -0
- package/.output/server/package.json +34 -2
- package/package.json +20 -20
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { a as __toESM } from "./chunk-BGCRLu6H.js";
|
|
2
|
+
import { n as require_react } from "./jsx-runtime-Bl0DfUmV.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "./jsx-runtime.js";
|
|
4
|
+
import { i as Root, n as Runtime, r as Renderer, t as reactPlugin } from "./reactPlugin-QQPrjNuQ.js";
|
|
5
|
+
import { FabricContext, FileContext, FileManager, FileProcessor, NodeTreeContext, RootContext, TreeNode, createContext, createFabric, createFabric as createFabric$1, createFile, createJSDoc, onProcessExit, provide, useContext, useContext as useContext$1, useFabric, useFile, useFile as useFile$1, useFileManager, useLifecycle, useNodeTree } from "@kubb/fabric-core";
|
|
6
|
+
import { spawn } from "node:child_process";
|
|
7
|
+
import ws from "ws";
|
|
8
|
+
import { sortBy } from "remeda";
|
|
9
|
+
//#region src/utils/createJSDoc.ts
|
|
10
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/Const.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Generates a TypeScript constant declaration.
|
|
15
|
+
*/
|
|
16
|
+
function Const({ children, ...props }) {
|
|
17
|
+
const { name, export: canExport, type, JSDoc, asConst } = props;
|
|
18
|
+
const nodeTree = useNodeTree();
|
|
19
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
20
|
+
type: "Const",
|
|
21
|
+
props
|
|
22
|
+
}));
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
JSDoc?.comments && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc?.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
25
|
+
canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
|
|
26
|
+
"const ",
|
|
27
|
+
name,
|
|
28
|
+
type ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
":",
|
|
30
|
+
type,
|
|
31
|
+
" "
|
|
32
|
+
] }) : " ",
|
|
33
|
+
"= ",
|
|
34
|
+
children,
|
|
35
|
+
asConst && /* @__PURE__ */ jsx(Fragment, { children: " as const" })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
Const.displayName = "Const";
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/components/Fabric.tsx
|
|
41
|
+
/**
|
|
42
|
+
* Fabric container containing the FabricContext carrying `meta` and an `exit` hook.
|
|
43
|
+
*/
|
|
44
|
+
function Fabric({ children, ...props }) {
|
|
45
|
+
const { meta = {} } = props;
|
|
46
|
+
const { exit } = useContext$1(RootContext);
|
|
47
|
+
const nodeTree = useNodeTree();
|
|
48
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
49
|
+
type: "App",
|
|
50
|
+
props
|
|
51
|
+
}));
|
|
52
|
+
provide(FabricContext, {
|
|
53
|
+
exit,
|
|
54
|
+
meta
|
|
55
|
+
});
|
|
56
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
57
|
+
}
|
|
58
|
+
Fabric.displayName = "Fabric";
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/components/File.tsx
|
|
61
|
+
/**
|
|
62
|
+
* Adds files to the FileManager
|
|
63
|
+
*/
|
|
64
|
+
function File({ children, ...props }) {
|
|
65
|
+
const { baseName, path, meta = {}, footer, banner } = props;
|
|
66
|
+
const fileManager = useFileManager();
|
|
67
|
+
const nodeTree = useNodeTree();
|
|
68
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
69
|
+
type: "File",
|
|
70
|
+
props
|
|
71
|
+
}));
|
|
72
|
+
if (!baseName || !path) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
73
|
+
const file = {
|
|
74
|
+
baseName,
|
|
75
|
+
path,
|
|
76
|
+
meta,
|
|
77
|
+
banner,
|
|
78
|
+
footer,
|
|
79
|
+
sources: [],
|
|
80
|
+
imports: [],
|
|
81
|
+
exports: []
|
|
82
|
+
};
|
|
83
|
+
const [resolvedFile] = fileManager.add(file);
|
|
84
|
+
provide(FileContext, resolvedFile);
|
|
85
|
+
return /* @__PURE__ */ jsx("kubb-file", {
|
|
86
|
+
...props,
|
|
87
|
+
children
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
File.displayName = "File";
|
|
91
|
+
/**
|
|
92
|
+
* File.Source
|
|
93
|
+
*
|
|
94
|
+
* Marks a block of source text to be associated with the current file when
|
|
95
|
+
* rendering with the FileCollector. Children are treated as the source string.
|
|
96
|
+
*/
|
|
97
|
+
function FileSource({ children, ...props }) {
|
|
98
|
+
const { name, isExportable, isIndexable, isTypeOnly } = props;
|
|
99
|
+
const nodeTree = useNodeTree();
|
|
100
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
101
|
+
type: "FileSource",
|
|
102
|
+
props
|
|
103
|
+
}));
|
|
104
|
+
return /* @__PURE__ */ jsx("kubb-source", {
|
|
105
|
+
name,
|
|
106
|
+
isTypeOnly,
|
|
107
|
+
isExportable,
|
|
108
|
+
isIndexable,
|
|
109
|
+
children
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
FileSource.displayName = "FileSource";
|
|
113
|
+
/**
|
|
114
|
+
* File.Export
|
|
115
|
+
*
|
|
116
|
+
* Declares an export entry for the current file. This will be collected by
|
|
117
|
+
* the FileCollector for later emission.
|
|
118
|
+
*/
|
|
119
|
+
function FileExport(props) {
|
|
120
|
+
const { name, path, isTypeOnly, asAlias } = props;
|
|
121
|
+
const nodeTree = useNodeTree();
|
|
122
|
+
const file = useFile$1();
|
|
123
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
124
|
+
type: "FileExport",
|
|
125
|
+
props
|
|
126
|
+
}));
|
|
127
|
+
if (file) file.exports.push({
|
|
128
|
+
name,
|
|
129
|
+
path,
|
|
130
|
+
asAlias,
|
|
131
|
+
isTypeOnly
|
|
132
|
+
});
|
|
133
|
+
return /* @__PURE__ */ jsx("kubb-export", {
|
|
134
|
+
name,
|
|
135
|
+
path,
|
|
136
|
+
isTypeOnly,
|
|
137
|
+
asAlias
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
FileExport.displayName = "FileExport";
|
|
141
|
+
/**
|
|
142
|
+
* File.Import
|
|
143
|
+
*
|
|
144
|
+
* Declares an import entry for the current file.
|
|
145
|
+
*/
|
|
146
|
+
function FileImport(props) {
|
|
147
|
+
const { name, root, path, isTypeOnly, isNameSpace } = props;
|
|
148
|
+
const nodeTree = useNodeTree();
|
|
149
|
+
const file = useFile$1();
|
|
150
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
151
|
+
type: "FileImport",
|
|
152
|
+
props
|
|
153
|
+
}));
|
|
154
|
+
if (file) file.imports.push({
|
|
155
|
+
name,
|
|
156
|
+
path,
|
|
157
|
+
root,
|
|
158
|
+
isNameSpace,
|
|
159
|
+
isTypeOnly
|
|
160
|
+
});
|
|
161
|
+
return /* @__PURE__ */ jsx("kubb-import", {
|
|
162
|
+
name,
|
|
163
|
+
root,
|
|
164
|
+
path,
|
|
165
|
+
isNameSpace,
|
|
166
|
+
isTypeOnly
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
FileImport.displayName = "FileImport";
|
|
170
|
+
File.Export = FileExport;
|
|
171
|
+
File.Import = FileImport;
|
|
172
|
+
File.Source = FileSource;
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/components/Function.tsx
|
|
175
|
+
/**
|
|
176
|
+
* Generates a TypeScript function declaration.
|
|
177
|
+
*/
|
|
178
|
+
function Function({ children, ...props }) {
|
|
179
|
+
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props;
|
|
180
|
+
const nodeTree = useNodeTree();
|
|
181
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
182
|
+
type: "Function",
|
|
183
|
+
props
|
|
184
|
+
}));
|
|
185
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
186
|
+
JSDoc?.comments && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc?.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
187
|
+
canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
|
|
188
|
+
isDefault && /* @__PURE__ */ jsx(Fragment, { children: "default " }),
|
|
189
|
+
async && /* @__PURE__ */ jsx(Fragment, { children: "async " }),
|
|
190
|
+
"function ",
|
|
191
|
+
name,
|
|
192
|
+
generics && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
193
|
+
"<",
|
|
194
|
+
Array.isArray(generics) ? generics.join(", ").trim() : generics,
|
|
195
|
+
">"
|
|
196
|
+
] }),
|
|
197
|
+
"(",
|
|
198
|
+
params,
|
|
199
|
+
")",
|
|
200
|
+
returnType && !async && /* @__PURE__ */ jsxs(Fragment, { children: [": ", returnType] }),
|
|
201
|
+
returnType && async && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
202
|
+
": Promise",
|
|
203
|
+
"<",
|
|
204
|
+
returnType,
|
|
205
|
+
">"
|
|
206
|
+
] }),
|
|
207
|
+
" {",
|
|
208
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
209
|
+
/* @__PURE__ */ jsx("indent", {}),
|
|
210
|
+
children,
|
|
211
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
212
|
+
/* @__PURE__ */ jsx("dedent", {}),
|
|
213
|
+
"}"
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
Function.displayName = "Function";
|
|
217
|
+
/**
|
|
218
|
+
* ArrowFunction
|
|
219
|
+
*
|
|
220
|
+
* Renders an arrow function definition. Supports the same flags as `Function`.
|
|
221
|
+
* Use `singleLine` to render the body as a single-line expression.
|
|
222
|
+
*/
|
|
223
|
+
function ArrowFunction({ children, ...props }) {
|
|
224
|
+
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props;
|
|
225
|
+
const nodeTree = useNodeTree();
|
|
226
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
227
|
+
type: "ArrowFunction",
|
|
228
|
+
props
|
|
229
|
+
}));
|
|
230
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
231
|
+
JSDoc?.comments && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc?.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
232
|
+
canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
|
|
233
|
+
isDefault && /* @__PURE__ */ jsx(Fragment, { children: "default " }),
|
|
234
|
+
"const ",
|
|
235
|
+
name,
|
|
236
|
+
" = ",
|
|
237
|
+
async && /* @__PURE__ */ jsx(Fragment, { children: "async " }),
|
|
238
|
+
generics && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
239
|
+
"<",
|
|
240
|
+
Array.isArray(generics) ? generics.join(", ").trim() : generics,
|
|
241
|
+
">"
|
|
242
|
+
] }),
|
|
243
|
+
"(",
|
|
244
|
+
params,
|
|
245
|
+
")",
|
|
246
|
+
returnType && !async && /* @__PURE__ */ jsxs(Fragment, { children: [": ", returnType] }),
|
|
247
|
+
returnType && async && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
248
|
+
": Promise",
|
|
249
|
+
"<",
|
|
250
|
+
returnType,
|
|
251
|
+
">"
|
|
252
|
+
] }),
|
|
253
|
+
singleLine && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
254
|
+
" => ",
|
|
255
|
+
children,
|
|
256
|
+
/* @__PURE__ */ jsx("br", {})
|
|
257
|
+
] }),
|
|
258
|
+
!singleLine && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
259
|
+
" => {",
|
|
260
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
261
|
+
/* @__PURE__ */ jsx("indent", {}),
|
|
262
|
+
children,
|
|
263
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
264
|
+
/* @__PURE__ */ jsx("dedent", {}),
|
|
265
|
+
"}",
|
|
266
|
+
/* @__PURE__ */ jsx("br", {})
|
|
267
|
+
] })
|
|
268
|
+
] });
|
|
269
|
+
}
|
|
270
|
+
ArrowFunction.displayName = "ArrowFunction";
|
|
271
|
+
Function.Arrow = ArrowFunction;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/components/Type.tsx
|
|
274
|
+
/**
|
|
275
|
+
* Generates a TypeScript type declaration.
|
|
276
|
+
*/
|
|
277
|
+
function Type({ children, ...props }) {
|
|
278
|
+
const { name, export: canExport, JSDoc } = props;
|
|
279
|
+
const nodeTree = useNodeTree();
|
|
280
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
281
|
+
type: "Type",
|
|
282
|
+
props
|
|
283
|
+
}));
|
|
284
|
+
if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
|
|
285
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
286
|
+
JSDoc?.comments && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc?.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
287
|
+
canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
|
|
288
|
+
"type ",
|
|
289
|
+
name,
|
|
290
|
+
" = ",
|
|
291
|
+
children
|
|
292
|
+
] });
|
|
293
|
+
}
|
|
294
|
+
Type.displayName = "Type";
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/devtools.ts
|
|
297
|
+
let isOpen = false;
|
|
298
|
+
function openDevtools() {
|
|
299
|
+
if (isOpen) return;
|
|
300
|
+
const customGlobal = global;
|
|
301
|
+
customGlobal.WebSocket ||= ws;
|
|
302
|
+
customGlobal.window ||= global;
|
|
303
|
+
customGlobal.self ||= global;
|
|
304
|
+
customGlobal.isDevtoolsEnabled = true;
|
|
305
|
+
customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [
|
|
306
|
+
{
|
|
307
|
+
type: 2,
|
|
308
|
+
value: "Context.Provider",
|
|
309
|
+
isEnabled: true,
|
|
310
|
+
isValid: true
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
type: 2,
|
|
314
|
+
value: "Root",
|
|
315
|
+
isEnabled: true,
|
|
316
|
+
isValid: true
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: 2,
|
|
320
|
+
value: "ErrorBoundary",
|
|
321
|
+
isEnabled: true,
|
|
322
|
+
isValid: true
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
type: 2,
|
|
326
|
+
value: "kubb-file",
|
|
327
|
+
isEnabled: true,
|
|
328
|
+
isValid: true
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
type: 2,
|
|
332
|
+
value: "kubb-text",
|
|
333
|
+
isEnabled: true,
|
|
334
|
+
isValid: true
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
type: 2,
|
|
338
|
+
value: "kubb-import",
|
|
339
|
+
isEnabled: true,
|
|
340
|
+
isValid: true
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type: 2,
|
|
344
|
+
value: "kubb-export",
|
|
345
|
+
isEnabled: true,
|
|
346
|
+
isValid: true
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
type: 2,
|
|
350
|
+
value: "kubb-source",
|
|
351
|
+
isEnabled: true,
|
|
352
|
+
isValid: true
|
|
353
|
+
}
|
|
354
|
+
];
|
|
355
|
+
import("react-devtools-core").then(async (devtools) => {
|
|
356
|
+
console.info("Opening devtools");
|
|
357
|
+
const controller = new AbortController();
|
|
358
|
+
if (!isOpen) spawn("npx", ["react-devtools@6.1.5"], {
|
|
359
|
+
signal: controller.signal,
|
|
360
|
+
stdio: "pipe",
|
|
361
|
+
detached: true
|
|
362
|
+
}).unref();
|
|
363
|
+
isOpen = true;
|
|
364
|
+
const { initialize, connectToDevTools } = devtools?.default || devtools;
|
|
365
|
+
initialize();
|
|
366
|
+
console.info("Initializing devtools");
|
|
367
|
+
Renderer.injectIntoDevTools({
|
|
368
|
+
bundleType: 1,
|
|
369
|
+
version: "19.2.3",
|
|
370
|
+
rendererPackageName: "kubb",
|
|
371
|
+
findFiberByHostInstance: () => null
|
|
372
|
+
});
|
|
373
|
+
console.info("Connecting devtools");
|
|
374
|
+
try {
|
|
375
|
+
connectToDevTools({
|
|
376
|
+
host: "localhost",
|
|
377
|
+
port: 8097,
|
|
378
|
+
useHttps: false,
|
|
379
|
+
isAppActive: () => true
|
|
380
|
+
});
|
|
381
|
+
} catch (e) {
|
|
382
|
+
console.error(e);
|
|
383
|
+
console.info("Error when connecting the devtools");
|
|
384
|
+
}
|
|
385
|
+
onProcessExit(() => {
|
|
386
|
+
console.info("Disconnecting devtools");
|
|
387
|
+
controller.abort();
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/createReactFabric.ts
|
|
393
|
+
function createReactFabric(config = {}) {
|
|
394
|
+
if (config.devtools) openDevtools();
|
|
395
|
+
const fabric = createFabric$1({ mode: config.mode });
|
|
396
|
+
fabric.use(reactPlugin, {
|
|
397
|
+
stdout: config.stdout,
|
|
398
|
+
stderr: config.stderr,
|
|
399
|
+
debug: config.debug,
|
|
400
|
+
stdin: config.stdin
|
|
401
|
+
});
|
|
402
|
+
return fabric;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/utils/getFunctionParams.ts
|
|
406
|
+
function order(items) {
|
|
407
|
+
return sortBy(items.filter(Boolean), ([_key, item]) => {
|
|
408
|
+
if (item?.children) return 0;
|
|
409
|
+
if (item?.optional) return 1;
|
|
410
|
+
if (item?.default) return 2;
|
|
411
|
+
return 0;
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function parseChild(key, item, options) {
|
|
415
|
+
const entries = order(Object.entries(item.children));
|
|
416
|
+
const types = [];
|
|
417
|
+
const names = [];
|
|
418
|
+
const optional = entries.every(([_key, item]) => item?.optional || !!item?.default);
|
|
419
|
+
entries.forEach(([key, entryItem]) => {
|
|
420
|
+
if (entryItem) {
|
|
421
|
+
const name = parseItem(key, {
|
|
422
|
+
...entryItem,
|
|
423
|
+
type: void 0
|
|
424
|
+
}, options);
|
|
425
|
+
if (entryItem.children) {
|
|
426
|
+
const subTypes = Object.entries(entryItem.children).map(([key]) => {
|
|
427
|
+
return key;
|
|
428
|
+
}).join(", ");
|
|
429
|
+
if (subTypes) names.push(`${name}: { ${subTypes} }`);
|
|
430
|
+
else names.push(name);
|
|
431
|
+
} else if (options.type === "call" && options.transformName) names.push(`${key}: ${name}`);
|
|
432
|
+
else names.push(name);
|
|
433
|
+
if (entries.some(([_key, item]) => item?.type)) types.push(parseItem(key, {
|
|
434
|
+
...entryItem,
|
|
435
|
+
default: void 0
|
|
436
|
+
}, options));
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
const name = item.mode === "inline" ? key : names.length ? `{ ${names.join(", ")} }` : void 0;
|
|
440
|
+
const type = item.type ? item.type : types.length ? `{ ${types.join("; ")} }` : void 0;
|
|
441
|
+
if (!name) return null;
|
|
442
|
+
return parseItem(name, {
|
|
443
|
+
type,
|
|
444
|
+
default: item.default,
|
|
445
|
+
optional: !item.default ? optional : void 0
|
|
446
|
+
}, options);
|
|
447
|
+
}
|
|
448
|
+
function parseItem(name, item, options) {
|
|
449
|
+
const acc = [];
|
|
450
|
+
const transformedName = options.transformName ? options.transformName(name) : name;
|
|
451
|
+
const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type;
|
|
452
|
+
if (options.type === "object") return transformedName;
|
|
453
|
+
if (options.type === "objectValue") return item.value ? `${transformedName}: ${item.value}` : transformedName;
|
|
454
|
+
if (item.type && options.type === "constructor") if (item.optional) if (transformedName.startsWith("{")) acc.push(`${transformedName}: ${transformedType} = {}`);
|
|
455
|
+
else acc.push(`${transformedName}?: ${transformedType}`);
|
|
456
|
+
else acc.push(`${transformedName}: ${transformedType}${item.default ? ` = ${item.default}` : ""}`);
|
|
457
|
+
else if (item.default && options.type === "constructor") acc.push(`${transformedName} = ${item.default}`);
|
|
458
|
+
else if (item.value) acc.push(`${transformedName} : ${item.value}`);
|
|
459
|
+
else if (item.mode === "inlineSpread") acc.push(`... ${transformedName}`);
|
|
460
|
+
else acc.push(transformedName);
|
|
461
|
+
return acc[0];
|
|
462
|
+
}
|
|
463
|
+
function getFunctionParams(params, options) {
|
|
464
|
+
return order(Object.entries(params)).reduce((acc, [key, item]) => {
|
|
465
|
+
if (!item) return acc;
|
|
466
|
+
if (item.children) {
|
|
467
|
+
if (Object.keys(item.children).length === 0) return acc;
|
|
468
|
+
if (item.mode === "inlineSpread") return [...acc, getFunctionParams(item.children, options)];
|
|
469
|
+
const parsedItem = parseChild(key, item, options);
|
|
470
|
+
if (!parsedItem) return acc;
|
|
471
|
+
return [...acc, parsedItem];
|
|
472
|
+
}
|
|
473
|
+
const parsedItem = parseItem(key, item, options);
|
|
474
|
+
return [...acc, parsedItem];
|
|
475
|
+
}, []).join(", ");
|
|
476
|
+
}
|
|
477
|
+
function createFunctionParams(params) {
|
|
478
|
+
return params;
|
|
479
|
+
}
|
|
480
|
+
var FunctionParams = class FunctionParams {
|
|
481
|
+
#params;
|
|
482
|
+
static factory(params) {
|
|
483
|
+
return new FunctionParams(params);
|
|
484
|
+
}
|
|
485
|
+
constructor(params) {
|
|
486
|
+
this.#params = params;
|
|
487
|
+
}
|
|
488
|
+
get params() {
|
|
489
|
+
return this.#params;
|
|
490
|
+
}
|
|
491
|
+
get flatParams() {
|
|
492
|
+
const flatter = (acc, [key, item]) => {
|
|
493
|
+
if (item?.children) return Object.entries(item.children).reduce(flatter, acc);
|
|
494
|
+
if (item) acc[key] = item;
|
|
495
|
+
return acc;
|
|
496
|
+
};
|
|
497
|
+
return Object.entries(this.#params).reduce(flatter, {});
|
|
498
|
+
}
|
|
499
|
+
toCall({ transformName, transformType } = {}) {
|
|
500
|
+
return getFunctionParams(this.#params, {
|
|
501
|
+
type: "call",
|
|
502
|
+
transformName,
|
|
503
|
+
transformType
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
toObject() {
|
|
507
|
+
return getFunctionParams(this.#params, { type: "object" });
|
|
508
|
+
}
|
|
509
|
+
toObjectValue() {
|
|
510
|
+
return getFunctionParams(this.#params, { type: "objectValue" });
|
|
511
|
+
}
|
|
512
|
+
toConstructor() {
|
|
513
|
+
return getFunctionParams(this.#params, { type: "constructor" });
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/index.ts
|
|
518
|
+
const useState = import_react.useState;
|
|
519
|
+
const useEffect = import_react.useEffect;
|
|
520
|
+
const useReducer = import_react.useReducer;
|
|
521
|
+
const useRef = import_react.useRef;
|
|
522
|
+
//#endregion
|
|
523
|
+
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 };
|
|
524
|
+
|
|
525
|
+
//# sourceMappingURL=index.js.map
|