@kubb/react-fabric 0.12.0 → 0.12.2
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/{chunk-DkQCb-7t.js → chunk-CrnDzoTS.js} +2 -1
- package/dist/globals.d.cts +1 -1
- package/dist/globals.d.ts +2 -2
- package/dist/index.cjs +14 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -14
- package/dist/index.d.ts +17 -15
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +4 -4
- package/dist/jsx-dev-runtime.d.ts +3 -3
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/{jsx-namespace-Lr0pS1AG.d.ts → jsx-namespace-fB1bxOIg.d.ts} +2 -2
- package/dist/{jsx-namespace-BUHfo3FK.d.cts → jsx-namespace-r-JXq_rp.d.cts} +1 -1
- package/dist/{jsx-runtime-CT8FKS42.js → jsx-runtime-CpElaHq6.js} +2 -2
- package/dist/{jsx-runtime-CT8FKS42.js.map → jsx-runtime-CpElaHq6.js.map} +1 -1
- package/dist/jsx-runtime.d.cts +4 -4
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js +2 -2
- package/dist/parsers.d.cts +1 -16
- package/dist/parsers.d.ts +1 -17
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +3 -125
- package/dist/plugins.d.ts +4 -126
- package/dist/plugins.js +3 -3
- package/dist/{react-CDrFaZVO.js → react-Cfp4vMID.js} +1 -1
- package/dist/{react-CDrFaZVO.js.map → react-Cfp4vMID.js.map} +1 -1
- package/dist/{reactPlugin-CicgALtR.cjs → reactPlugin-BzHuVlbO.cjs} +1757 -1757
- package/dist/reactPlugin-BzHuVlbO.cjs.map +1 -0
- package/dist/{types-yKh-a1UP.d.cts → reactPlugin-CVS9VJ5P.d.ts} +41 -202
- package/dist/{reactPlugin-BHxx8AjV.js → reactPlugin-CwuxUcyY.js} +1760 -1760
- package/dist/reactPlugin-CwuxUcyY.js.map +1 -0
- package/dist/{types-C-nm6Bqx.d.ts → reactPlugin-EQOIOEA2.d.cts} +39 -202
- package/dist/types-J_S-h-Ae.d.cts +104 -0
- package/dist/types-XiObCuPy.d.ts +103 -0
- package/dist/types.d.cts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +3 -2
- package/dist/reactPlugin-BHxx8AjV.js.map +0 -1
- package/dist/reactPlugin-CWHmkuUz.d.cts +0 -72
- package/dist/reactPlugin-CicgALtR.cjs.map +0 -1
- package/dist/reactPlugin-DseDoGSU.d.ts +0 -73
|
@@ -37,10 +37,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
37
37
|
}
|
|
38
38
|
return to;
|
|
39
39
|
};
|
|
40
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
40
41
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
41
42
|
value: mod,
|
|
42
43
|
enumerable: true
|
|
43
44
|
}) : target, mod));
|
|
44
45
|
|
|
45
46
|
//#endregion
|
|
46
|
-
export { __toESM as i, __exportAll as n, __name as r, __commonJSMin as t };
|
|
47
|
+
export { __toESM as a, __reExport as i, __exportAll as n, __name as r, __commonJSMin as t };
|
package/dist/globals.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as __name, 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-J_S-h-Ae.cjs";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/globals.d.ts
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as __name } from "./chunk-
|
|
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 { r as __name } from "./chunk-CrnDzoTS.js";
|
|
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-XiObCuPy.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/globals.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_react$1 = require('./react-DgrQzKJp.cjs');
|
|
2
2
|
const require_jsx_runtime = require('./jsx-runtime-6sQc68DD.cjs');
|
|
3
|
-
const require_reactPlugin = require('./reactPlugin-
|
|
3
|
+
const require_reactPlugin = require('./reactPlugin-BzHuVlbO.cjs');
|
|
4
4
|
let _kubb_fabric_core = require("@kubb/fabric-core");
|
|
5
5
|
let execa = require("execa");
|
|
6
6
|
let signal_exit = require("signal-exit");
|
|
@@ -440,22 +440,22 @@ function parseChild(key, item, options) {
|
|
|
440
440
|
const entries = order(Object.entries(item.children));
|
|
441
441
|
const types = [];
|
|
442
442
|
const names = [];
|
|
443
|
-
const optional = entries.every(([_key, item
|
|
444
|
-
entries.forEach(([key
|
|
443
|
+
const optional = entries.every(([_key, item]) => (item === null || item === void 0 ? void 0 : item.optional) || !!(item === null || item === void 0 ? void 0 : item.default));
|
|
444
|
+
entries.forEach(([key, entryItem]) => {
|
|
445
445
|
if (entryItem) {
|
|
446
|
-
const name
|
|
446
|
+
const name = parseItem(key, {
|
|
447
447
|
...entryItem,
|
|
448
448
|
type: void 0
|
|
449
449
|
}, options);
|
|
450
450
|
if (entryItem.children) {
|
|
451
|
-
const subTypes = Object.entries(entryItem.children).map(([key
|
|
452
|
-
return key
|
|
451
|
+
const subTypes = Object.entries(entryItem.children).map(([key]) => {
|
|
452
|
+
return key;
|
|
453
453
|
}).join(", ");
|
|
454
|
-
if (subTypes) names.push(`${name
|
|
455
|
-
else names.push(name
|
|
456
|
-
} else if (options.type === "call" && options.transformName) names.push(`${key
|
|
457
|
-
else names.push(name
|
|
458
|
-
if (entries.some(([_key, item
|
|
454
|
+
if (subTypes) names.push(`${name}: { ${subTypes} }`);
|
|
455
|
+
else names.push(name);
|
|
456
|
+
} else if (options.type === "call" && options.transformName) names.push(`${key}: ${name}`);
|
|
457
|
+
else names.push(name);
|
|
458
|
+
if (entries.some(([_key, item]) => item === null || item === void 0 ? void 0 : item.type)) types.push(parseItem(key, {
|
|
459
459
|
...entryItem,
|
|
460
460
|
default: void 0
|
|
461
461
|
}, options));
|
|
@@ -491,9 +491,9 @@ function getFunctionParams(params, options) {
|
|
|
491
491
|
if (item.children) {
|
|
492
492
|
if (Object.keys(item.children).length === 0) return acc;
|
|
493
493
|
if (item.mode === "inlineSpread") return [...acc, getFunctionParams(item.children, options)];
|
|
494
|
-
const parsedItem
|
|
495
|
-
if (!parsedItem
|
|
496
|
-
return [...acc, parsedItem
|
|
494
|
+
const parsedItem = parseChild(key, item, options);
|
|
495
|
+
if (!parsedItem) return acc;
|
|
496
|
+
return [...acc, parsedItem];
|
|
497
497
|
}
|
|
498
498
|
const parsedItem = parseItem(key, item, options);
|
|
499
499
|
return [...acc, parsedItem];
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["RootContext","NodeTreeContext","AppContext","NodeTreeContext","NodeTreeContext","FileContext","NodeTreeContext","NodeTreeContext","RootContext","reactPlugin","item","key","name","parsedItem"],"sources":["../src/components/App.tsx","../src/components/Const.tsx","../src/components/File.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 { KubbElement, 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>): KubbElement {\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, KubbElement, 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): KubbElement {\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, KubbElement, 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>): KubbElement {\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): KubbElement {\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): KubbElement {\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): KubbElement {\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","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbElement, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the function.\n */\n name: string\n /**\n * Add default when export is being used\n */\n default?: boolean\n /**\n * Parameters/options/props that need to be used.\n */\n params?: string\n /**\n * Does this function need to be exported.\n */\n export?: boolean\n /**\n * Does the function has async/promise 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): KubbElement {\n const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Function', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n {async && <>async </>}\n function {name}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {' {'}\n <br />\n <indent />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n </>\n )\n}\n\nFunction.displayName = '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 />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'KubbArrowFunction'\nFunction.Arrow = ArrowFunction\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbElement, 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): KubbElement {\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\nlet isOpen = false\n\nexport function openDevtools() {\n if (isOpen) {\n return undefined\n }\n // Set up global polyfills BEFORE importing react-devtools-core\n // This is required because react-devtools-core expects these to be available\n const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\n\n // Filter out 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 if (!isOpen) {\n execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools@6.1.5`\n }\n\n isOpen = true\n\n // Destructure the functions from the module\n const { initialize, connectToDevTools } = devtools?.default || devtools\n\n // Initialize DevTools BEFORE importing Renderer (which imports React)\n initialize()\n console.info('Initializing devtools')\n\n // Inject the renderer BEFORE connecting to DevTools\n // This ensures DevTools can properly discover the custom renderer\n Renderer.injectIntoDevTools({\n bundleType: 1,\n version: '19.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 { createFabric } from '@kubb/fabric-core'\nimport type { Fabric, FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { openDevtools } from './devtools.ts'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport { reactPlugin } from './plugins/reactPlugin.ts'\n\nexport function createReactFabric(\n config: FabricConfig<Options & { mode?: FabricMode; devtools?: boolean }> = {},\n): Fabric<Options & { mode?: FabricMode; devtools?: boolean }> {\n if (config.devtools) {\n openDevtools()\n }\n\n const fabric = createFabric({ mode: config.mode })\n\n fabric.use(reactPlugin, {\n stdout: config.stdout,\n stderr: config.stderr,\n debug: config.debug,\n stdin: config.stdin,\n })\n\n return fabric\n}\n","import { 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, 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 { Type } from './components/Type.tsx'\n\n// composables\nexport { useApp } from './composables/useApp.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\n\n// factories\nexport { createReactFabric } from './createReactFabric.ts'\nexport { openDevtools } from './devtools.ts'\nexport { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"mappings":";;;;;;;;;;;;;;;AAiBA;;;;AAOE;;;;AAMA;;;;AAEA;;AAGF;;;;;;;ACAA,SAAgB,MAAM,EAAE,UAAU,GAAG,SAAkC;CACrE,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,SAAoC;CACrG,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;EACA,SAAS,EAAE;EACX,SAAS,EAAE;EACX,SAAS,EAAE;EACZ;CAED,MAAM,CAAC,gBAAgB,YAAY,IAAI,KAAK;AAC5C,gCAAQC,+BAAa,aAAa;AAElC,QAAO,wCAAC;EAAU,GAAI;EAAQ;GAAqB;;AAGrD,KAAK,cAAc;;;;;;;AAanB,SAAS,WAAW,EAAE,UAAU,GAAG,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,aAAa,UAAU,KAAK,MAAM,QAAQ;AAEhD,SAAO,CAAC,GAAG,KAAK,WAAW;IAC1B,EAAE,CAAa,CACjB,KAAK,KAAK;;AAGf,SAAgB,qBAAqB,QAAwB;AAC3D,QAAO;;;AAIT,IAAa,iBAAb,MAAa,eAAe;CAG1B,OAAO,QAAQ,QAAgB;AAC7B,SAAO,IAAI,eAAe,OAAO;;CAEnC,YAAY,QAAgB;;AAC1B,4DAAe,OAAM;;CAGvB,IAAI,SAAiB;AACnB,6DAAO,KAAY;;CAGrB,IAAI,aAAqB;EACvB,MAAM,WAAW,KAAa,CAAC,KAAK,UAA+C;AACjF,mDAAI,KAAM,SACR,QAAO,OAAO,QAAQ,KAAK,SAAS,CAAC,OAAO,SAAS,IAAI;AAE3D,OAAI,KACF,KAAI,OAAO;AAGb,UAAO;;AAET,SAAO,OAAO,4DAAQ,KAAY,CAAC,CAAC,OAAO,SAAS,EAAE,CAAW;;CAGnE,OAAO,EAAE,eAAe,kBAAoE,EAAE,EAAU;AACtG,SAAO,sEAAkB,KAAY,EAAE;GAAE,MAAM;GAAQ;GAAe;GAAe,CAAC;;CAGxF,WAAmB;AACjB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,UAAU,CAAC;;CAE5D,gBAAwB;AACtB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;;;;;AC9OnE,MAAa,wBAAiB;AAC9B,MAAa,6BAAsB;AACnC,MAAa,6BAAsB;AACnC,MAAa,wBAAiB;AAC9B,MAAa,mBAAY;AACzB,MAAa,0BAAmB;AAChC,MAAa,yBAAkB;AAC/B,MAAa,0BAAmB;AAChC,MAAa,sBAAe"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["RootContext","NodeTreeContext","AppContext","NodeTreeContext","NodeTreeContext","FileContext","NodeTreeContext","NodeTreeContext","RootContext","reactPlugin"],"sources":["../src/components/App.tsx","../src/components/Const.tsx","../src/components/File.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 { KubbElement, 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>): KubbElement {\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, KubbElement, 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): KubbElement {\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, KubbElement, 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>): KubbElement {\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): KubbElement {\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): KubbElement {\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): KubbElement {\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","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbElement, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the function.\n */\n name: string\n /**\n * Add default when export is being used\n */\n default?: boolean\n /**\n * Parameters/options/props that need to be used.\n */\n params?: string\n /**\n * Does this function need to be exported.\n */\n export?: boolean\n /**\n * Does the function has async/promise 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): KubbElement {\n const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props\n\n const nodeTree = useNodeTree()\n\n if (nodeTree) {\n const childTree = nodeTree.addChild({ type: 'Function', props })\n\n provide(NodeTreeContext, childTree)\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n {async && <>async </>}\n function {name}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {' {'}\n <br />\n <indent />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n </>\n )\n}\n\nFunction.displayName = '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 />\n {/* Indent component to handle indentation*/}\n {children}\n <br />\n <dedent />\n {/* Indent component to handle indentation*/}\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'KubbArrowFunction'\nFunction.Arrow = ArrowFunction\n","import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'\nimport type { JSDoc, Key, KubbElement, 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): KubbElement {\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\nlet isOpen = false\n\nexport function openDevtools() {\n if (isOpen) {\n return undefined\n }\n // Set up global polyfills BEFORE importing react-devtools-core\n // This is required because react-devtools-core expects these to be available\n const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\n\n // Filter out 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 if (!isOpen) {\n execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools@6.1.5`\n }\n\n isOpen = true\n\n // Destructure the functions from the module\n const { initialize, connectToDevTools } = devtools?.default || devtools\n\n // Initialize DevTools BEFORE importing Renderer (which imports React)\n initialize()\n console.info('Initializing devtools')\n\n // Inject the renderer BEFORE connecting to DevTools\n // This ensures DevTools can properly discover the custom renderer\n Renderer.injectIntoDevTools({\n bundleType: 1,\n version: '19.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 { createFabric } from '@kubb/fabric-core'\nimport type { Fabric, FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { openDevtools } from './devtools.ts'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport { reactPlugin } from './plugins/reactPlugin.ts'\n\nexport function createReactFabric(\n config: FabricConfig<Options & { mode?: FabricMode; devtools?: boolean }> = {},\n): Fabric<Options & { mode?: FabricMode; devtools?: boolean }> {\n if (config.devtools) {\n openDevtools()\n }\n\n const fabric = createFabric({ mode: config.mode })\n\n fabric.use(reactPlugin, {\n stdout: config.stdout,\n stderr: config.stderr,\n debug: config.debug,\n stdin: config.stdin,\n })\n\n return fabric\n}\n","import { 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, 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 { Type } from './components/Type.tsx'\n\n// composables\nexport { useApp } from './composables/useApp.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\n\n// factories\nexport { createReactFabric } from './createReactFabric.ts'\nexport { openDevtools } from './devtools.ts'\nexport { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"mappings":";;;;;;;;;;;;;;;AAiBA;;;;AAOE;;;;AAMA;;;;AAEA;;AAGF;;;;;;;ACAA,SAAgB,MAAM,EAAE,UAAU,GAAG,SAAkC;CACrE,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,SAAoC;CACrG,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;EACA,SAAS,EAAE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AY;AACzB,MAAa,0BAAmB;AAChC,MAAa,yBAAkB;AAC/B,MAAa,0BAAmB;AAChC,MAAa,sBAAe"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as Key, b as __name, g as FunctionParams, h as types_d_exports, o as KubbElement, u as KubbNode, y as createFunctionParams } from "./types-J_S-h-Ae.cjs";
|
|
2
|
+
import { t as Options$1 } from "./reactPlugin-EQOIOEA2.cjs";
|
|
3
3
|
import * as react3 from "react";
|
|
4
|
+
import { Fabric, FabricConfig, FabricMode, KubbFile } from "@kubb/fabric-core/types";
|
|
5
|
+
import { FileManager, FileManager as FileManager$1, FileProcessor, TreeNode, createFabric, createFile, useApp, useFile } from "@kubb/fabric-core";
|
|
4
6
|
|
|
5
7
|
//#region src/components/App.d.ts
|
|
6
8
|
type AppProps<TMeta extends object = object> = {
|
|
@@ -42,7 +44,7 @@ type ConstProps = {
|
|
|
42
44
|
/**
|
|
43
45
|
* Options for JSdocs.
|
|
44
46
|
*/
|
|
45
|
-
JSDoc?: JSDoc;
|
|
47
|
+
JSDoc?: types_d_exports.JSDoc;
|
|
46
48
|
/**
|
|
47
49
|
* Use of `const` assertions
|
|
48
50
|
*/
|
|
@@ -70,18 +72,18 @@ type BasePropsWithBaseName = {
|
|
|
70
72
|
* Based on UNIX basename
|
|
71
73
|
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
72
74
|
*/
|
|
73
|
-
baseName: BaseName;
|
|
75
|
+
baseName: KubbFile.BaseName;
|
|
74
76
|
/**
|
|
75
77
|
* Path will be full qualified path to a specified file.
|
|
76
78
|
*/
|
|
77
|
-
path: Path;
|
|
79
|
+
path: KubbFile.Path;
|
|
78
80
|
};
|
|
79
81
|
type BasePropsWithoutBaseName = {
|
|
80
82
|
baseName?: never;
|
|
81
83
|
/**
|
|
82
84
|
* Path will be full qualified path to a specified file.
|
|
83
85
|
*/
|
|
84
|
-
path?: Path;
|
|
86
|
+
path?: KubbFile.Path;
|
|
85
87
|
};
|
|
86
88
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
87
89
|
type Props$1<TMeta> = BaseProps & {
|
|
@@ -104,7 +106,7 @@ declare namespace File {
|
|
|
104
106
|
var Import: typeof FileImport;
|
|
105
107
|
var Source: typeof FileSource;
|
|
106
108
|
}
|
|
107
|
-
type FileSourceProps = Omit<Source, 'value'> & {
|
|
109
|
+
type FileSourceProps = Omit<KubbFile.Source, 'value'> & {
|
|
108
110
|
key?: Key;
|
|
109
111
|
children?: KubbNode;
|
|
110
112
|
};
|
|
@@ -121,7 +123,7 @@ declare function FileSource({
|
|
|
121
123
|
declare namespace FileSource {
|
|
122
124
|
var displayName: string;
|
|
123
125
|
}
|
|
124
|
-
type FileExportProps = Export & {
|
|
126
|
+
type FileExportProps = KubbFile.Export & {
|
|
125
127
|
key?: Key;
|
|
126
128
|
};
|
|
127
129
|
/**
|
|
@@ -134,7 +136,7 @@ declare function FileExport(props: FileExportProps): KubbElement;
|
|
|
134
136
|
declare namespace FileExport {
|
|
135
137
|
var displayName: string;
|
|
136
138
|
}
|
|
137
|
-
type FileImportProps = Import & {
|
|
139
|
+
type FileImportProps = KubbFile.Import & {
|
|
138
140
|
key?: Key;
|
|
139
141
|
};
|
|
140
142
|
/**
|
|
@@ -182,7 +184,7 @@ type Props = {
|
|
|
182
184
|
/**
|
|
183
185
|
* Options for JSdocs.
|
|
184
186
|
*/
|
|
185
|
-
JSDoc?: JSDoc;
|
|
187
|
+
JSDoc?: types_d_exports.JSDoc;
|
|
186
188
|
/**
|
|
187
189
|
* Children nodes.
|
|
188
190
|
*/
|
|
@@ -233,7 +235,7 @@ type TypeProps = {
|
|
|
233
235
|
/**
|
|
234
236
|
* Options for JSdocs.
|
|
235
237
|
*/
|
|
236
|
-
JSDoc?: JSDoc;
|
|
238
|
+
JSDoc?: types_d_exports.JSDoc;
|
|
237
239
|
/**
|
|
238
240
|
* Children nodes.
|
|
239
241
|
*/
|
|
@@ -280,8 +282,8 @@ declare function openDevtools(): undefined;
|
|
|
280
282
|
//#endregion
|
|
281
283
|
//#region src/Runtime.d.ts
|
|
282
284
|
type Options = {
|
|
283
|
-
fileManager: FileManager;
|
|
284
|
-
treeNode?: TreeNode<ComponentNode>;
|
|
285
|
+
fileManager: FileManager$1;
|
|
286
|
+
treeNode?: TreeNode<types_d_exports.ComponentNode>;
|
|
285
287
|
stdout?: NodeJS.WriteStream;
|
|
286
288
|
stdin?: NodeJS.ReadStream;
|
|
287
289
|
stderr?: NodeJS.WriteStream;
|
|
@@ -294,7 +296,7 @@ declare class Runtime {
|
|
|
294
296
|
#private;
|
|
295
297
|
exitPromise?: Promise<void>;
|
|
296
298
|
constructor(options: Options);
|
|
297
|
-
get fileManager(): FileManager;
|
|
299
|
+
get fileManager(): FileManager$1;
|
|
298
300
|
resolveExitPromise: () => void;
|
|
299
301
|
rejectExitPromise: (reason?: Error) => void;
|
|
300
302
|
unsubscribeExit: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { r as __name } from "./chunk-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as __name } from "./chunk-CrnDzoTS.js";
|
|
2
|
+
import { a as Key, g as FunctionParams, h as types_d_exports, o as KubbElement, u as KubbNode, y as createFunctionParams } from "./types-XiObCuPy.js";
|
|
3
|
+
import { t as Options$1 } from "./reactPlugin-CVS9VJ5P.js";
|
|
4
|
+
import { FileManager, FileManager as FileManager$1, FileProcessor, TreeNode, createFabric, createFile, useApp, useFile } from "@kubb/fabric-core";
|
|
5
|
+
import { Fabric, FabricConfig, FabricMode, KubbFile } from "@kubb/fabric-core/types";
|
|
4
6
|
import * as react3 from "react";
|
|
5
7
|
|
|
6
8
|
//#region src/components/App.d.ts
|
|
@@ -43,7 +45,7 @@ type ConstProps = {
|
|
|
43
45
|
/**
|
|
44
46
|
* Options for JSdocs.
|
|
45
47
|
*/
|
|
46
|
-
JSDoc?: JSDoc;
|
|
48
|
+
JSDoc?: types_d_exports.JSDoc;
|
|
47
49
|
/**
|
|
48
50
|
* Use of `const` assertions
|
|
49
51
|
*/
|
|
@@ -71,18 +73,18 @@ type BasePropsWithBaseName = {
|
|
|
71
73
|
* Based on UNIX basename
|
|
72
74
|
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
73
75
|
*/
|
|
74
|
-
baseName: BaseName;
|
|
76
|
+
baseName: KubbFile.BaseName;
|
|
75
77
|
/**
|
|
76
78
|
* Path will be full qualified path to a specified file.
|
|
77
79
|
*/
|
|
78
|
-
path: Path;
|
|
80
|
+
path: KubbFile.Path;
|
|
79
81
|
};
|
|
80
82
|
type BasePropsWithoutBaseName = {
|
|
81
83
|
baseName?: never;
|
|
82
84
|
/**
|
|
83
85
|
* Path will be full qualified path to a specified file.
|
|
84
86
|
*/
|
|
85
|
-
path?: Path;
|
|
87
|
+
path?: KubbFile.Path;
|
|
86
88
|
};
|
|
87
89
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
88
90
|
type Props$1<TMeta> = BaseProps & {
|
|
@@ -105,7 +107,7 @@ declare namespace File {
|
|
|
105
107
|
var Import: typeof FileImport;
|
|
106
108
|
var Source: typeof FileSource;
|
|
107
109
|
}
|
|
108
|
-
type FileSourceProps = Omit<Source, 'value'> & {
|
|
110
|
+
type FileSourceProps = Omit<KubbFile.Source, 'value'> & {
|
|
109
111
|
key?: Key;
|
|
110
112
|
children?: KubbNode;
|
|
111
113
|
};
|
|
@@ -122,7 +124,7 @@ declare function FileSource({
|
|
|
122
124
|
declare namespace FileSource {
|
|
123
125
|
var displayName: string;
|
|
124
126
|
}
|
|
125
|
-
type FileExportProps = Export & {
|
|
127
|
+
type FileExportProps = KubbFile.Export & {
|
|
126
128
|
key?: Key;
|
|
127
129
|
};
|
|
128
130
|
/**
|
|
@@ -135,7 +137,7 @@ declare function FileExport(props: FileExportProps): KubbElement;
|
|
|
135
137
|
declare namespace FileExport {
|
|
136
138
|
var displayName: string;
|
|
137
139
|
}
|
|
138
|
-
type FileImportProps = Import & {
|
|
140
|
+
type FileImportProps = KubbFile.Import & {
|
|
139
141
|
key?: Key;
|
|
140
142
|
};
|
|
141
143
|
/**
|
|
@@ -183,7 +185,7 @@ type Props = {
|
|
|
183
185
|
/**
|
|
184
186
|
* Options for JSdocs.
|
|
185
187
|
*/
|
|
186
|
-
JSDoc?: JSDoc;
|
|
188
|
+
JSDoc?: types_d_exports.JSDoc;
|
|
187
189
|
/**
|
|
188
190
|
* Children nodes.
|
|
189
191
|
*/
|
|
@@ -234,7 +236,7 @@ type TypeProps = {
|
|
|
234
236
|
/**
|
|
235
237
|
* Options for JSdocs.
|
|
236
238
|
*/
|
|
237
|
-
JSDoc?: JSDoc;
|
|
239
|
+
JSDoc?: types_d_exports.JSDoc;
|
|
238
240
|
/**
|
|
239
241
|
* Children nodes.
|
|
240
242
|
*/
|
|
@@ -281,8 +283,8 @@ declare function openDevtools(): undefined;
|
|
|
281
283
|
//#endregion
|
|
282
284
|
//#region src/Runtime.d.ts
|
|
283
285
|
type Options = {
|
|
284
|
-
fileManager: FileManager;
|
|
285
|
-
treeNode?: TreeNode<ComponentNode>;
|
|
286
|
+
fileManager: FileManager$1;
|
|
287
|
+
treeNode?: TreeNode<types_d_exports.ComponentNode>;
|
|
286
288
|
stdout?: NodeJS.WriteStream;
|
|
287
289
|
stdin?: NodeJS.ReadStream;
|
|
288
290
|
stderr?: NodeJS.WriteStream;
|
|
@@ -295,7 +297,7 @@ declare class Runtime {
|
|
|
295
297
|
#private;
|
|
296
298
|
exitPromise?: Promise<void>;
|
|
297
299
|
constructor(options: Options);
|
|
298
|
-
get fileManager(): FileManager;
|
|
300
|
+
get fileManager(): FileManager$1;
|
|
299
301
|
resolveExitPromise: () => void;
|
|
300
302
|
rejectExitPromise: (reason?: Error) => void;
|
|
301
303
|
unsubscribeExit: () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as require_react } from "./react-
|
|
3
|
-
import { i as jsxs, n as jsx, t as Fragment$1 } from "./jsx-runtime-
|
|
4
|
-
import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Renderer, r as _classPrivateFieldSet2, t as reactPlugin } from "./reactPlugin-
|
|
1
|
+
import { a as __toESM, r as __name } from "./chunk-CrnDzoTS.js";
|
|
2
|
+
import { t as require_react } from "./react-Cfp4vMID.js";
|
|
3
|
+
import { i as jsxs, n as jsx, t as Fragment$1 } from "./jsx-runtime-CpElaHq6.js";
|
|
4
|
+
import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Renderer, r as _classPrivateFieldSet2, t as reactPlugin } from "./reactPlugin-CwuxUcyY.js";
|
|
5
5
|
import { AppContext, FileContext, FileManager, FileProcessor, NodeTreeContext, RootContext, createFabric, createFabric as createFabric$1, createFile, createJSDoc, provide, useApp, useContext as useContext$1, useFile, useFile as useFile$1, useFileManager, useNodeTree } from "@kubb/fabric-core";
|
|
6
6
|
import { execa } from "execa";
|
|
7
7
|
import { onExit } from "signal-exit";
|
|
@@ -440,22 +440,22 @@ function parseChild(key, item, options) {
|
|
|
440
440
|
const entries = order(Object.entries(item.children));
|
|
441
441
|
const types = [];
|
|
442
442
|
const names = [];
|
|
443
|
-
const optional = entries.every(([_key, item
|
|
444
|
-
entries.forEach(([key
|
|
443
|
+
const optional = entries.every(([_key, item]) => (item === null || item === void 0 ? void 0 : item.optional) || !!(item === null || item === void 0 ? void 0 : item.default));
|
|
444
|
+
entries.forEach(([key, entryItem]) => {
|
|
445
445
|
if (entryItem) {
|
|
446
|
-
const name
|
|
446
|
+
const name = parseItem(key, {
|
|
447
447
|
...entryItem,
|
|
448
448
|
type: void 0
|
|
449
449
|
}, options);
|
|
450
450
|
if (entryItem.children) {
|
|
451
|
-
const subTypes = Object.entries(entryItem.children).map(([key
|
|
452
|
-
return key
|
|
451
|
+
const subTypes = Object.entries(entryItem.children).map(([key]) => {
|
|
452
|
+
return key;
|
|
453
453
|
}).join(", ");
|
|
454
|
-
if (subTypes) names.push(`${name
|
|
455
|
-
else names.push(name
|
|
456
|
-
} else if (options.type === "call" && options.transformName) names.push(`${key
|
|
457
|
-
else names.push(name
|
|
458
|
-
if (entries.some(([_key, item
|
|
454
|
+
if (subTypes) names.push(`${name}: { ${subTypes} }`);
|
|
455
|
+
else names.push(name);
|
|
456
|
+
} else if (options.type === "call" && options.transformName) names.push(`${key}: ${name}`);
|
|
457
|
+
else names.push(name);
|
|
458
|
+
if (entries.some(([_key, item]) => item === null || item === void 0 ? void 0 : item.type)) types.push(parseItem(key, {
|
|
459
459
|
...entryItem,
|
|
460
460
|
default: void 0
|
|
461
461
|
}, options));
|
|
@@ -491,9 +491,9 @@ function getFunctionParams(params, options) {
|
|
|
491
491
|
if (item.children) {
|
|
492
492
|
if (Object.keys(item.children).length === 0) return acc;
|
|
493
493
|
if (item.mode === "inlineSpread") return [...acc, getFunctionParams(item.children, options)];
|
|
494
|
-
const parsedItem
|
|
495
|
-
if (!parsedItem
|
|
496
|
-
return [...acc, parsedItem
|
|
494
|
+
const parsedItem = parseChild(key, item, options);
|
|
495
|
+
if (!parsedItem) return acc;
|
|
496
|
+
return [...acc, parsedItem];
|
|
497
497
|
}
|
|
498
498
|
const parsedItem = parseItem(key, item, options);
|
|
499
499
|
return [...acc, parsedItem];
|