@kubb/agent 5.0.0-alpha.34 → 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 +1790 -20812
- 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/@redocly/config/lib/root-config-schema.js +11 -1
- package/.output/server/node_modules/@redocly/config/package.json +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-document.js +25 -10
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-visitor.js +32 -29
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/config.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/index.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/remove-unused-components.js +47 -38
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/index.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/remove-unused-components.js +45 -41
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-http-verbs-in-paths.js +3 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-required-schema-properties-undefined.js +41 -55
- package/.output/server/node_modules/@redocly/openapi-core/lib/walk.js +28 -16
- package/.output/server/node_modules/@redocly/openapi-core/package.json +2 -2
- 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/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 +35 -4
- 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,653 @@
|
|
|
1
|
+
import "./chunk-O_arW02_.js";
|
|
2
|
+
import { _ as provide, a as FileManager, c as createFile, d as createIntrinsic, f as renderIndent, g as inject, h as createContext, i as TreeNode, l as NodeTreeContext, m as RenderContext, n as Root, o as FileProcessor, p as renderIntrinsic, r as RootContext, s as AsyncEventEmitter, t as onProcessExit, u as createComponent, v as unprovide } from "./onProcessExit-Cput7j2c.js";
|
|
3
|
+
import { t as getRelativePath } from "./getRelativePath-NAm_Y-vp.js";
|
|
4
|
+
import { createExport, createImport, print } from "./parsers/typescript.js";
|
|
5
|
+
import { isFunction } from "remeda";
|
|
6
|
+
//#region src/components/Br.ts
|
|
7
|
+
/**
|
|
8
|
+
* Generates a line break in the output.
|
|
9
|
+
*
|
|
10
|
+
* Use this component to add newlines in generated code.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <>
|
|
15
|
+
* const x = 1
|
|
16
|
+
* <Br />
|
|
17
|
+
* const y = 2
|
|
18
|
+
* </>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
const Br = createComponent("br", () => {
|
|
22
|
+
return createIntrinsic("br");
|
|
23
|
+
});
|
|
24
|
+
Br.displayName = "Br";
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/composables/useContext.ts
|
|
27
|
+
function useContext(key, defaultValue) {
|
|
28
|
+
return inject(key, defaultValue);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/composables/useNodeTree.ts
|
|
32
|
+
/**
|
|
33
|
+
* Accesses the current node tree for tracking component hierarchy.
|
|
34
|
+
*
|
|
35
|
+
* Use this composable to inspect or manipulate the component tree structure.
|
|
36
|
+
* Returns null if not within a component that provides NodeTreeContext.
|
|
37
|
+
*
|
|
38
|
+
* @returns The current TreeNode or null
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const nodeTree = useNodeTree()
|
|
43
|
+
* if (nodeTree) {
|
|
44
|
+
* const childTree = nodeTree.addChild({ type: 'MyComponent', props: {} })
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
function useNodeTree() {
|
|
49
|
+
return useContext(NodeTreeContext);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/utils/createJSDoc.ts
|
|
53
|
+
/**
|
|
54
|
+
* Create JSDoc comment block from comments array
|
|
55
|
+
*/
|
|
56
|
+
function createJSDoc({ comments }) {
|
|
57
|
+
if (!comments || comments.length === 0) return "";
|
|
58
|
+
const lines = comments.flatMap((c) => String(c ?? "").split(/\r?\n/)).map((l) => l.replace(/\*\//g, "*\\/").replace(/\r/g, "")).filter((l) => l.trim().length > 0);
|
|
59
|
+
if (lines.length === 0) return "";
|
|
60
|
+
return [
|
|
61
|
+
"/**",
|
|
62
|
+
...lines.map((l) => ` * ${l}`),
|
|
63
|
+
" */"
|
|
64
|
+
].join("\n");
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/components/Const.ts
|
|
68
|
+
/**
|
|
69
|
+
* Generates a TypeScript constant declaration.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Const name="API_URL" export type="string">
|
|
74
|
+
* 'https://api.example.com'
|
|
75
|
+
* </Const>
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
const Const = createComponent("Const", ({ children, ...props }) => {
|
|
79
|
+
const { name, export: canExport, type, JSDoc, asConst } = props;
|
|
80
|
+
const nodeTree = useNodeTree();
|
|
81
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
82
|
+
type: "Const",
|
|
83
|
+
props
|
|
84
|
+
}));
|
|
85
|
+
const value = renderIntrinsic(children);
|
|
86
|
+
let result = "";
|
|
87
|
+
if (JSDoc?.comments) {
|
|
88
|
+
result += createJSDoc({ comments: JSDoc.comments });
|
|
89
|
+
result += "\n";
|
|
90
|
+
}
|
|
91
|
+
if (canExport) result += "export ";
|
|
92
|
+
result += `const ${name}`;
|
|
93
|
+
if (type) result += `: ${type}`;
|
|
94
|
+
result += ` = ${children ? value : ""}`;
|
|
95
|
+
if (asConst) result += " as const";
|
|
96
|
+
return result;
|
|
97
|
+
});
|
|
98
|
+
Const.displayName = "Const";
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/Dedent.ts
|
|
101
|
+
/**
|
|
102
|
+
* Decreases indentation level in the output.
|
|
103
|
+
*
|
|
104
|
+
* Use this component to reduce indentation after an indented code block.
|
|
105
|
+
* Typically paired with Indent to control indentation levels.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* <>
|
|
110
|
+
* function example() {'{'}<Br />
|
|
111
|
+
* <Indent />
|
|
112
|
+
* return true<Br />
|
|
113
|
+
* <Dedent />
|
|
114
|
+
* {'}'}
|
|
115
|
+
* </>
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
const Dedent = createComponent("dedent", () => {
|
|
119
|
+
return createIntrinsic("dedent");
|
|
120
|
+
});
|
|
121
|
+
Dedent.displayName = "Dedent";
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/contexts/FabricContext.ts
|
|
124
|
+
/**
|
|
125
|
+
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
126
|
+
* components and composables within a Fabric runtime.
|
|
127
|
+
*/
|
|
128
|
+
const FabricContext = createContext({
|
|
129
|
+
exit: () => {},
|
|
130
|
+
meta: {}
|
|
131
|
+
});
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/components/Fabric.ts
|
|
134
|
+
/**
|
|
135
|
+
* Container component providing App context with metadata and lifecycle.
|
|
136
|
+
*
|
|
137
|
+
* Use this component to wrap your application and provide shared metadata
|
|
138
|
+
* that can be accessed by child components using the useApp composable.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* <Fabric meta={{ version: '1.0.0', author: 'John Doe' }}>
|
|
143
|
+
* <File baseName="user.ts" path="./user.ts">
|
|
144
|
+
* <File.Source>export type User = {}</File.Source>
|
|
145
|
+
* </File>
|
|
146
|
+
* </Fabric>
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
const Fabric = createComponent("Fabric", ({ children, ...props }) => {
|
|
150
|
+
const { meta = {} } = props;
|
|
151
|
+
const { exit } = useContext(RootContext);
|
|
152
|
+
const nodeTree = useNodeTree();
|
|
153
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
154
|
+
type: "Fabric",
|
|
155
|
+
props
|
|
156
|
+
}));
|
|
157
|
+
provide(FabricContext, {
|
|
158
|
+
exit,
|
|
159
|
+
meta
|
|
160
|
+
});
|
|
161
|
+
return children;
|
|
162
|
+
});
|
|
163
|
+
Fabric.displayName = "Fabric";
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/contexts/FileContext.ts
|
|
166
|
+
/**
|
|
167
|
+
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
168
|
+
* components and composables within a Fabric runtime.
|
|
169
|
+
*/
|
|
170
|
+
const FileContext = createContext(null);
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/composables/useFile.ts
|
|
173
|
+
/**
|
|
174
|
+
* Accesses the current File context.
|
|
175
|
+
*
|
|
176
|
+
* Use this composable to access or modify the current file's properties,
|
|
177
|
+
* sources, imports, or exports.
|
|
178
|
+
*
|
|
179
|
+
* @returns The current file object or null if not within a File component
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* const file = useFile()
|
|
184
|
+
* if (file) {
|
|
185
|
+
* console.log(file.path)
|
|
186
|
+
* file.sources.push({ value: 'export const x = 1', isExportable: true })
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
function useFile() {
|
|
191
|
+
return useContext(FileContext);
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/composables/useFileManager.ts
|
|
195
|
+
/**
|
|
196
|
+
* Accesses the FileManager from the Root context.
|
|
197
|
+
*
|
|
198
|
+
* Use this composable to interact with the FileManager directly,
|
|
199
|
+
* such as adding, retrieving, or managing files.
|
|
200
|
+
*
|
|
201
|
+
* @returns The current FileManager instance
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* const fileManager = useFileManager()
|
|
206
|
+
* fileManager.add({
|
|
207
|
+
* baseName: 'user.ts',
|
|
208
|
+
* path: './generated/user.ts',
|
|
209
|
+
* sources: []
|
|
210
|
+
* })
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
function useFileManager() {
|
|
214
|
+
const { fileManager } = useContext(RootContext);
|
|
215
|
+
return fileManager;
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/components/File.ts
|
|
219
|
+
/**
|
|
220
|
+
* Component for generating files with sources, imports, and exports.
|
|
221
|
+
*
|
|
222
|
+
* Creates files in the FileManager that can be written to disk.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <File baseName="user.ts" path="./generated/user.ts">
|
|
227
|
+
* <File.Source isExportable>
|
|
228
|
+
* export type User = {{ '{' }} id: number {{ '}' }}
|
|
229
|
+
* </File.Source>
|
|
230
|
+
* </File>
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
const File = createComponent("File", ({ children, ...props }) => {
|
|
234
|
+
const { baseName, path, meta = {}, footer, banner } = props;
|
|
235
|
+
const fileManager = useFileManager();
|
|
236
|
+
const nodeTree = useNodeTree();
|
|
237
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
238
|
+
type: "File",
|
|
239
|
+
props
|
|
240
|
+
}));
|
|
241
|
+
const file = {
|
|
242
|
+
baseName,
|
|
243
|
+
path,
|
|
244
|
+
meta,
|
|
245
|
+
banner,
|
|
246
|
+
footer,
|
|
247
|
+
sources: [],
|
|
248
|
+
imports: [],
|
|
249
|
+
exports: []
|
|
250
|
+
};
|
|
251
|
+
const [resolvedFile] = fileManager.add(file);
|
|
252
|
+
provide(FileContext, resolvedFile);
|
|
253
|
+
return children;
|
|
254
|
+
});
|
|
255
|
+
/**
|
|
256
|
+
* Adds source code to a file.
|
|
257
|
+
*
|
|
258
|
+
* Use this component inside a File component to add code blocks.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```tsx
|
|
262
|
+
* <File.Source isExportable name="User">
|
|
263
|
+
* export type User = {{ '{' }} id: number {{ '}' }}
|
|
264
|
+
* </File.Source>
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
const FileSource = createComponent("FileSource", ({ children, ...props }) => {
|
|
268
|
+
const { name, isExportable, isIndexable, isTypeOnly } = props;
|
|
269
|
+
const nodeTree = useNodeTree();
|
|
270
|
+
const file = useFile();
|
|
271
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
272
|
+
type: "FileSource",
|
|
273
|
+
props
|
|
274
|
+
}));
|
|
275
|
+
const value = renderIntrinsic(children);
|
|
276
|
+
if (file) file.sources.push({
|
|
277
|
+
name,
|
|
278
|
+
isExportable,
|
|
279
|
+
isIndexable,
|
|
280
|
+
isTypeOnly,
|
|
281
|
+
value
|
|
282
|
+
});
|
|
283
|
+
return value;
|
|
284
|
+
});
|
|
285
|
+
/**
|
|
286
|
+
* Adds export statements to a file.
|
|
287
|
+
*
|
|
288
|
+
* Use this component to create re-exports from other files.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```tsx
|
|
292
|
+
* <File.Export name="User" path="./types/user" isTypeOnly />
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
const FileExport = createComponent("FileExport", (props) => {
|
|
296
|
+
const { name, path, isTypeOnly, asAlias } = props;
|
|
297
|
+
const nodeTree = useNodeTree();
|
|
298
|
+
const file = useFile();
|
|
299
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
300
|
+
type: "FileExport",
|
|
301
|
+
props
|
|
302
|
+
}));
|
|
303
|
+
if (file) file.exports.push({
|
|
304
|
+
name,
|
|
305
|
+
path,
|
|
306
|
+
asAlias,
|
|
307
|
+
isTypeOnly
|
|
308
|
+
});
|
|
309
|
+
return print(createExport({
|
|
310
|
+
name,
|
|
311
|
+
path,
|
|
312
|
+
isTypeOnly,
|
|
313
|
+
asAlias
|
|
314
|
+
}));
|
|
315
|
+
});
|
|
316
|
+
/**
|
|
317
|
+
* Adds import statements to a file.
|
|
318
|
+
*
|
|
319
|
+
* Use this component to import types or values from other files.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```tsx
|
|
323
|
+
* <File.Import name="User" path="./types/user" isTypeOnly />
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
const FileImport = createComponent("FileImport", (props) => {
|
|
327
|
+
const { name, path, root, isNameSpace, isTypeOnly } = props;
|
|
328
|
+
const nodeTree = useNodeTree();
|
|
329
|
+
const file = useFile();
|
|
330
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
331
|
+
type: "FileImport",
|
|
332
|
+
props
|
|
333
|
+
}));
|
|
334
|
+
if (file) file.imports.push({
|
|
335
|
+
name,
|
|
336
|
+
path,
|
|
337
|
+
root,
|
|
338
|
+
isNameSpace,
|
|
339
|
+
isTypeOnly
|
|
340
|
+
});
|
|
341
|
+
return print(createImport({
|
|
342
|
+
name,
|
|
343
|
+
path,
|
|
344
|
+
root,
|
|
345
|
+
isNameSpace,
|
|
346
|
+
isTypeOnly
|
|
347
|
+
}));
|
|
348
|
+
});
|
|
349
|
+
File.Source = FileSource;
|
|
350
|
+
File.Import = FileImport;
|
|
351
|
+
File.Export = FileExport;
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/components/Indent.ts
|
|
354
|
+
/**
|
|
355
|
+
* Increases indentation level in the output.
|
|
356
|
+
*
|
|
357
|
+
* Use this component to add indentation for nested code blocks.
|
|
358
|
+
* Typically paired with Dedent to control indentation levels.
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```tsx
|
|
362
|
+
* <>
|
|
363
|
+
* function example() {'{'}<Br />
|
|
364
|
+
* <Indent />
|
|
365
|
+
* return true<Br />
|
|
366
|
+
* <Dedent />
|
|
367
|
+
* {'}'}
|
|
368
|
+
* </>
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
const Indent = createComponent("indent", () => {
|
|
372
|
+
return createIntrinsic("indent");
|
|
373
|
+
});
|
|
374
|
+
Indent.displayName = "Indent";
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/components/Function.ts
|
|
377
|
+
/**
|
|
378
|
+
* Generates a TypeScript function declaration.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```tsx
|
|
382
|
+
* <Function
|
|
383
|
+
* name="getUser"
|
|
384
|
+
* export
|
|
385
|
+
* async
|
|
386
|
+
* params="id: number"
|
|
387
|
+
* returnType="User"
|
|
388
|
+
* >
|
|
389
|
+
* return fetch(`/users/${id}`).then(r => r.json())
|
|
390
|
+
* </Function>
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
const Function = createComponent("Function", ({ children, ...props }) => {
|
|
394
|
+
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props;
|
|
395
|
+
const nodeTree = useNodeTree();
|
|
396
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
397
|
+
type: "Function",
|
|
398
|
+
props
|
|
399
|
+
}));
|
|
400
|
+
const parts = [];
|
|
401
|
+
if (JSDoc?.comments) {
|
|
402
|
+
parts.push(createJSDoc({ comments: JSDoc.comments }));
|
|
403
|
+
parts.push("\n");
|
|
404
|
+
}
|
|
405
|
+
if (canExport) parts.push("export ");
|
|
406
|
+
if (isDefault) parts.push("default ");
|
|
407
|
+
if (async) parts.push("async ");
|
|
408
|
+
parts.push(`function ${name}`);
|
|
409
|
+
if (generics) {
|
|
410
|
+
parts.push("<");
|
|
411
|
+
parts.push(Array.isArray(generics) ? generics.join(", ").trim() : generics);
|
|
412
|
+
parts.push(">");
|
|
413
|
+
}
|
|
414
|
+
parts.push(`(${params || ""})`);
|
|
415
|
+
if (returnType && !async) parts.push(`: ${returnType}`);
|
|
416
|
+
if (returnType && async) parts.push(`: Promise<${returnType}>`);
|
|
417
|
+
parts.push(" {");
|
|
418
|
+
if (children) return [
|
|
419
|
+
parts.join(""),
|
|
420
|
+
Br(),
|
|
421
|
+
Indent(),
|
|
422
|
+
children,
|
|
423
|
+
Br(),
|
|
424
|
+
Dedent(),
|
|
425
|
+
"}"
|
|
426
|
+
];
|
|
427
|
+
return [parts.join(""), "}"];
|
|
428
|
+
});
|
|
429
|
+
Function.displayName = "Function";
|
|
430
|
+
/**
|
|
431
|
+
* ArrowFunction
|
|
432
|
+
*
|
|
433
|
+
* Builds an arrow function declaration string for the fsx renderer. Supports
|
|
434
|
+
* the same options as `Function`. Use `singleLine` to produce a one-line
|
|
435
|
+
* arrow expression.
|
|
436
|
+
*/
|
|
437
|
+
const ArrowFunction = createComponent("ArrowFunction", ({ children, ...props }) => {
|
|
438
|
+
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props;
|
|
439
|
+
const nodeTree = useNodeTree();
|
|
440
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
441
|
+
type: "ArrowFunction",
|
|
442
|
+
props
|
|
443
|
+
}));
|
|
444
|
+
const parts = [];
|
|
445
|
+
if (JSDoc?.comments) {
|
|
446
|
+
parts.push(createJSDoc({ comments: JSDoc.comments }));
|
|
447
|
+
parts.push("\n");
|
|
448
|
+
}
|
|
449
|
+
if (canExport) parts.push("export ");
|
|
450
|
+
if (isDefault) parts.push("default ");
|
|
451
|
+
parts.push(`const ${name} = `);
|
|
452
|
+
if (async) parts.push("async ");
|
|
453
|
+
if (generics) {
|
|
454
|
+
parts.push("<");
|
|
455
|
+
parts.push(Array.isArray(generics) ? generics.join(", ").trim() : generics);
|
|
456
|
+
parts.push(">");
|
|
457
|
+
}
|
|
458
|
+
parts.push(`(${params || ""})`);
|
|
459
|
+
if (returnType && !async) parts.push(`: ${returnType}`);
|
|
460
|
+
if (returnType && async) parts.push(`: Promise<${returnType}>`);
|
|
461
|
+
if (singleLine) {
|
|
462
|
+
parts.push(` => ${children || ""}\n`);
|
|
463
|
+
return parts.join("");
|
|
464
|
+
}
|
|
465
|
+
if (children) return [
|
|
466
|
+
parts.join(""),
|
|
467
|
+
" => {",
|
|
468
|
+
Br(),
|
|
469
|
+
Indent(),
|
|
470
|
+
children,
|
|
471
|
+
Br(),
|
|
472
|
+
Dedent(),
|
|
473
|
+
"}"
|
|
474
|
+
];
|
|
475
|
+
return [parts.join(""), " => {}"];
|
|
476
|
+
});
|
|
477
|
+
ArrowFunction.displayName = "ArrowFunction";
|
|
478
|
+
Function.Arrow = ArrowFunction;
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/components/Type.ts
|
|
481
|
+
/**
|
|
482
|
+
* Generates a TypeScript type declaration.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```tsx
|
|
486
|
+
* <Type name="User" export>
|
|
487
|
+
* {'{'} id: number; name: string {'}'}
|
|
488
|
+
* </Type>
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
const Type = createComponent("Type", ({ children, ...props }) => {
|
|
492
|
+
const { name, export: canExport, JSDoc } = props;
|
|
493
|
+
const nodeTree = useNodeTree();
|
|
494
|
+
if (nodeTree) provide(NodeTreeContext, nodeTree.addChild({
|
|
495
|
+
type: "Type",
|
|
496
|
+
props
|
|
497
|
+
}));
|
|
498
|
+
if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter (see TypeScript types)");
|
|
499
|
+
const value = renderIntrinsic(children);
|
|
500
|
+
let result = "";
|
|
501
|
+
if (JSDoc?.comments) {
|
|
502
|
+
result += createJSDoc({ comments: JSDoc.comments });
|
|
503
|
+
result += "\n";
|
|
504
|
+
}
|
|
505
|
+
if (canExport) result += "export ";
|
|
506
|
+
result += `type ${name} = ${value || ""}`;
|
|
507
|
+
return result;
|
|
508
|
+
});
|
|
509
|
+
Type.displayName = "Type";
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/composables/useFabric.ts
|
|
512
|
+
/**
|
|
513
|
+
* Accesses the App context with metadata and exit function.
|
|
514
|
+
*
|
|
515
|
+
* Use this composable to access metadata defined in the App component
|
|
516
|
+
* or to exit the rendering process early.
|
|
517
|
+
*
|
|
518
|
+
* @throws Error when no AppContext is available
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts
|
|
522
|
+
* const { meta, exit } = useFabric<{ version: string }>()
|
|
523
|
+
* console.log(meta.version)
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
function useFabric() {
|
|
527
|
+
return useContext(FabricContext);
|
|
528
|
+
}
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/composables/useLifecycle.ts
|
|
531
|
+
/**
|
|
532
|
+
* Accesses lifecycle helpers for controlling generation flow.
|
|
533
|
+
*
|
|
534
|
+
* Use this composable to exit the rendering process early or perform
|
|
535
|
+
* cleanup operations.
|
|
536
|
+
*
|
|
537
|
+
* @returns Object with lifecycle methods (exit)
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```ts
|
|
541
|
+
* const { exit } = useLifecycle()
|
|
542
|
+
*
|
|
543
|
+
* // Stop generation on error
|
|
544
|
+
* if (invalidData) {
|
|
545
|
+
* exit(new Error('Invalid data'))
|
|
546
|
+
* }
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
function useLifecycle() {
|
|
550
|
+
const { exit } = useContext(RootContext);
|
|
551
|
+
return { exit };
|
|
552
|
+
}
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region src/createFabric.ts
|
|
555
|
+
/**
|
|
556
|
+
* Creates a new Fabric instance for file generation.
|
|
557
|
+
*
|
|
558
|
+
* The Fabric instance provides methods for registering plugins,
|
|
559
|
+
* adding files, and triggering file generation.
|
|
560
|
+
*
|
|
561
|
+
* @param config - Optional configuration object
|
|
562
|
+
* @returns A new Fabric instance
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* ```ts
|
|
566
|
+
* import { createFabric } from '@kubb/fabric-core'
|
|
567
|
+
* import { fsPlugin } from '@kubb/fabric-core/plugins'
|
|
568
|
+
* import { typescriptParser } from '@kubb/fabric-core/parsers'
|
|
569
|
+
*
|
|
570
|
+
* const fabric = createFabric()
|
|
571
|
+
* fabric.use(fsPlugin)
|
|
572
|
+
* fabric.use(typescriptParser)
|
|
573
|
+
*
|
|
574
|
+
* await fabric.addFile({
|
|
575
|
+
* baseName: 'user.ts',
|
|
576
|
+
* path: './generated/user.ts',
|
|
577
|
+
* sources: [{ value: 'export type User = {}', isExportable: true }],
|
|
578
|
+
* imports: [],
|
|
579
|
+
* exports: [],
|
|
580
|
+
* })
|
|
581
|
+
*
|
|
582
|
+
* await fabric.write({ extension: { '.ts': '.ts' } })
|
|
583
|
+
* ```
|
|
584
|
+
*/
|
|
585
|
+
function createFabric(config = { mode: "sequential" }) {
|
|
586
|
+
const events = new AsyncEventEmitter();
|
|
587
|
+
const installedPlugins = /* @__PURE__ */ new Set();
|
|
588
|
+
const installedParsers = /* @__PURE__ */ new Map();
|
|
589
|
+
const installedParserNames = /* @__PURE__ */ new Set();
|
|
590
|
+
const fileManager = new FileManager({ events });
|
|
591
|
+
const context = {
|
|
592
|
+
get files() {
|
|
593
|
+
return fileManager.files;
|
|
594
|
+
},
|
|
595
|
+
async addFile(...files) {
|
|
596
|
+
await fileManager.add(...files);
|
|
597
|
+
},
|
|
598
|
+
config,
|
|
599
|
+
fileManager,
|
|
600
|
+
installedPlugins,
|
|
601
|
+
installedParsers,
|
|
602
|
+
on: events.on.bind(events),
|
|
603
|
+
off: events.off.bind(events),
|
|
604
|
+
onOnce: events.onOnce.bind(events),
|
|
605
|
+
removeAll: events.removeAll.bind(events),
|
|
606
|
+
emit: events.emit.bind(events)
|
|
607
|
+
};
|
|
608
|
+
const fabric = {
|
|
609
|
+
context,
|
|
610
|
+
get files() {
|
|
611
|
+
return fileManager.files;
|
|
612
|
+
},
|
|
613
|
+
async addFile(...files) {
|
|
614
|
+
fileManager.add(...files);
|
|
615
|
+
},
|
|
616
|
+
async upsertFile(...files) {
|
|
617
|
+
fileManager.upsert(...files);
|
|
618
|
+
},
|
|
619
|
+
unmount(_error) {
|
|
620
|
+
events.removeAll();
|
|
621
|
+
},
|
|
622
|
+
async use(pluginOrParser, ...options) {
|
|
623
|
+
if (pluginOrParser.type === "plugin") {
|
|
624
|
+
if (installedPlugins.has(pluginOrParser)) console.warn(`Plugin "${pluginOrParser.name}" already applied.`);
|
|
625
|
+
else installedPlugins.add(pluginOrParser);
|
|
626
|
+
if (isFunction(pluginOrParser.inject)) {
|
|
627
|
+
const injecter = pluginOrParser.inject;
|
|
628
|
+
const injected = injecter(context, ...options);
|
|
629
|
+
Object.assign(fabric, injected);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (pluginOrParser.type === "parser") {
|
|
633
|
+
if (installedParserNames.has(pluginOrParser.name)) console.warn(`Parser "${pluginOrParser.name}" already applied.`);
|
|
634
|
+
else installedParserNames.add(pluginOrParser.name);
|
|
635
|
+
if (pluginOrParser.extNames) for (const extName of pluginOrParser.extNames) {
|
|
636
|
+
const existing = installedParsers.get(extName);
|
|
637
|
+
if (existing && existing.name !== pluginOrParser.name) console.warn(`Parser "${pluginOrParser.name}" is overriding parser "${existing.name}" for extension "${extName}".`);
|
|
638
|
+
installedParsers.set(extName, pluginOrParser);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (isFunction(pluginOrParser.install)) {
|
|
642
|
+
const installer = pluginOrParser.install;
|
|
643
|
+
await installer(context, ...options);
|
|
644
|
+
}
|
|
645
|
+
return fabric;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
return fabric;
|
|
649
|
+
}
|
|
650
|
+
//#endregion
|
|
651
|
+
export { Br, Const, Dedent, Fabric, FabricContext, File, FileContext, FileManager, FileProcessor, Function, Indent, NodeTreeContext, RenderContext, Root, RootContext, TreeNode, Type, createComponent, createContext, createFabric, createFile, createJSDoc, getRelativePath, inject, onProcessExit, provide, renderIndent, renderIntrinsic, unprovide, useContext, useFabric, useFile, useFileManager, useLifecycle, useNodeTree };
|
|
652
|
+
|
|
653
|
+
//# sourceMappingURL=index.js.map
|