@kubb/react-fabric 0.9.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Fabric-DitK3IEP.d.ts → Fabric-BELBf-bX.d.cts} +5 -5
- package/dist/{Fabric-C61uYmUy.d.cts → Fabric-DbJhvsCq.d.ts} +5 -5
- package/dist/{devtools-D6dZodXp.js → devtools-8_UKWDTl.js} +1 -1
- package/dist/{devtools-D6dZodXp.js.map → devtools-8_UKWDTl.js.map} +1 -1
- package/dist/{devtools-CRkwwngz.cjs → devtools-BOpUJhc_.cjs} +1 -1
- package/dist/{devtools-CRkwwngz.cjs.map → devtools-BOpUJhc_.cjs.map} +1 -1
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.js +1 -1
- package/dist/globals.d.cts +2 -2
- package/dist/globals.d.ts +2 -2
- package/dist/index.cjs +166 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -359
- package/dist/index.d.ts +3 -359
- package/dist/index.js +151 -68
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +5 -5
- package/dist/jsx-dev-runtime.d.ts +3 -3
- package/dist/{jsx-namespace-BAkGpU6g.d.ts → jsx-namespace-CBOEkCmJ.d.ts} +2 -2
- package/dist/{jsx-namespace-CCPa1Nut.d.cts → jsx-namespace-od7sqrmY.d.cts} +2 -2
- package/dist/{jsx-runtime-BEVcoJUm.cjs → jsx-runtime-Cq39dA50.cjs} +1 -1
- package/dist/{jsx-runtime-BEVcoJUm.cjs.map → jsx-runtime-Cq39dA50.cjs.map} +1 -1
- package/dist/{jsx-runtime-DDu0mFTI.js → jsx-runtime-Isgf9orn.js} +1 -1
- package/dist/{jsx-runtime-DDu0mFTI.js.map → jsx-runtime-Isgf9orn.js.map} +1 -1
- package/dist/jsx-runtime.cjs +1 -1
- package/dist/jsx-runtime.d.cts +5 -5
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js +1 -1
- package/dist/parsers.d.cts +1 -1
- package/dist/parsers.d.ts +1 -1
- package/dist/plugins.cjs +2 -2
- package/dist/plugins.d.cts +2 -2
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +2 -2
- package/dist/{reactPlugin-CXaAO13f.cjs → reactPlugin-B8F6jVb5.cjs} +77 -64
- package/dist/reactPlugin-B8F6jVb5.cjs.map +1 -0
- package/dist/{reactPlugin-ixOr00MK.js → reactPlugin-CAtVV84d.js} +78 -53
- package/dist/reactPlugin-CAtVV84d.js.map +1 -0
- package/dist/types-C3ODUOKN.d.cts +675 -0
- package/dist/types-DwaohVJS.d.ts +675 -0
- package/dist/types.d.cts +3 -3
- package/dist/types.d.ts +3 -3
- package/package.json +3 -3
- package/src/Runtime.tsx +22 -12
- package/src/components/App.tsx +24 -15
- package/src/components/Const.tsx +19 -3
- package/src/components/File.tsx +107 -31
- package/src/components/Function.tsx +36 -5
- package/src/components/Indent.tsx +3 -0
- package/src/components/Root.tsx +26 -20
- package/src/components/Type.tsx +19 -2
- package/src/components/__snapshots__/arrow_function.ts +3 -0
- package/src/components/__snapshots__/arrow_function_default.ts +3 -0
- package/src/components/__snapshots__/arrow_function_generics.ts +3 -0
- package/src/components/__snapshots__/arrow_function_single_line.ts +1 -0
- package/src/components/__snapshots__/arrow_function_with_generics.ts +3 -0
- package/src/components/__snapshots__/async_arrow_function.ts +3 -0
- package/src/components/__snapshots__/async_function.ts +3 -0
- package/src/components/__snapshots__/async_function_with_Promise_return_type.ts +3 -0
- package/src/components/__snapshots__/basic_arrow_function.ts +3 -0
- package/src/components/__snapshots__/basic_const.ts +1 -0
- package/src/components/__snapshots__/basic_export.ts +1 -0
- package/src/components/__snapshots__/basic_function.ts +3 -0
- package/src/components/__snapshots__/basic_import.ts +1 -0
- package/src/components/__snapshots__/basic_type.ts +1 -0
- package/src/components/__snapshots__/const_with_JSDoc.ts +4 -0
- package/src/components/__snapshots__/const_with_as_const.ts +1 -0
- package/src/components/__snapshots__/const_with_type.ts +1 -0
- package/src/components/__snapshots__/default_exported_arrow_function.ts +3 -0
- package/src/components/__snapshots__/default_exported_function.ts +3 -0
- package/src/components/__snapshots__/exported_arrow_function.ts +3 -0
- package/src/components/__snapshots__/exported_const.ts +1 -0
- package/src/components/__snapshots__/exported_function.ts +3 -0
- package/src/components/__snapshots__/exported_type.ts +1 -0
- package/src/components/__snapshots__/function_generics.ts +3 -0
- package/src/components/__snapshots__/function_with_JSDoc.ts +6 -0
- package/src/components/__snapshots__/function_with_comments.ts +6 -0
- package/src/components/__snapshots__/function_with_generics.ts +3 -0
- package/src/components/__snapshots__/function_with_parameters.ts +3 -0
- package/src/components/__snapshots__/function_with_params.ts +3 -0
- package/src/components/__snapshots__/function_with_returnType.ts +3 -0
- package/src/components/__snapshots__/function_with_return_type.ts +3 -0
- package/src/components/__snapshots__/matches_with_root_import.ts +1 -0
- package/src/components/__snapshots__/multiple_functions.ts +3 -0
- package/src/components/__snapshots__/named_export.ts +1 -0
- package/src/components/__snapshots__/named_export_(object_advanced).ts +1 -0
- package/src/components/__snapshots__/named_import.ts +1 -0
- package/src/components/__snapshots__/named_import_(object).ts +1 -0
- package/src/components/__snapshots__/named_import_(object_advanced).ts +1 -0
- package/src/components/__snapshots__/named_typed_export.ts +1 -0
- package/src/components/__snapshots__/named_typed_import.ts +1 -0
- package/src/components/__snapshots__/single_line_arrow_function.ts +1 -0
- package/src/components/__snapshots__/type_with_JSDoc.ts +4 -0
- package/src/components/__snapshots__/typed_export.ts +1 -0
- package/src/components/__snapshots__/typed_import.ts +1 -0
- package/src/composables/useApp.ts +1 -15
- package/src/composables/useFile.ts +1 -12
- package/src/composables/useLifecycle.tsx +7 -8
- package/src/index.ts +5 -1
- package/src/plugins/reactPlugin.ts +7 -6
- package/src/types.ts +0 -4
- package/src/utils/createJSDoc.ts +1 -8
- package/dist/reactPlugin-4-kcMKwZ.d.ts +0 -31
- package/dist/reactPlugin-B4xarQJX.d.cts +0 -31
- package/dist/reactPlugin-CXaAO13f.cjs.map +0 -1
- package/dist/reactPlugin-ixOr00MK.js.map +0 -1
- package/dist/types-CSUzVTpn.d.ts +0 -104
- package/dist/types-DP2mgqeb.d.cts +0 -104
|
@@ -88,8 +88,8 @@ type File<TMeta extends object = object> = {
|
|
|
88
88
|
*/
|
|
89
89
|
path: AdvancedPath<BaseName> | Path;
|
|
90
90
|
sources: Array<Source>;
|
|
91
|
-
imports
|
|
92
|
-
exports
|
|
91
|
+
imports: Array<Import>;
|
|
92
|
+
exports: Array<Export>;
|
|
93
93
|
/**
|
|
94
94
|
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
95
95
|
*/
|
|
@@ -197,8 +197,8 @@ declare class FileManager {
|
|
|
197
197
|
constructor({
|
|
198
198
|
events
|
|
199
199
|
}?: Options);
|
|
200
|
-
add(...files: Array<File>):
|
|
201
|
-
upsert(...files: Array<File>):
|
|
200
|
+
add(...files: Array<File>): Array<ResolvedFile>;
|
|
201
|
+
upsert(...files: Array<File>): Array<ResolvedFile>;
|
|
202
202
|
flush(): void;
|
|
203
203
|
getByPath(path: Path): ResolvedFile | null;
|
|
204
204
|
deleteByPath(path: Path): void;
|
|
@@ -415,4 +415,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
417
|
export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
|
|
418
|
-
//# sourceMappingURL=Fabric-
|
|
418
|
+
//# sourceMappingURL=Fabric-BELBf-bX.d.cts.map
|
|
@@ -88,8 +88,8 @@ type File<TMeta extends object = object> = {
|
|
|
88
88
|
*/
|
|
89
89
|
path: AdvancedPath<BaseName> | Path;
|
|
90
90
|
sources: Array<Source>;
|
|
91
|
-
imports
|
|
92
|
-
exports
|
|
91
|
+
imports: Array<Import>;
|
|
92
|
+
exports: Array<Export>;
|
|
93
93
|
/**
|
|
94
94
|
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
95
95
|
*/
|
|
@@ -197,8 +197,8 @@ declare class FileManager {
|
|
|
197
197
|
constructor({
|
|
198
198
|
events
|
|
199
199
|
}?: Options);
|
|
200
|
-
add(...files: Array<File>):
|
|
201
|
-
upsert(...files: Array<File>):
|
|
200
|
+
add(...files: Array<File>): Array<ResolvedFile>;
|
|
201
|
+
upsert(...files: Array<File>): Array<ResolvedFile>;
|
|
202
202
|
flush(): void;
|
|
203
203
|
getByPath(path: Path): ResolvedFile | null;
|
|
204
204
|
deleteByPath(path: Path): void;
|
|
@@ -415,4 +415,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
417
|
export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
|
|
418
|
-
//# sourceMappingURL=Fabric-
|
|
418
|
+
//# sourceMappingURL=Fabric-DbJhvsCq.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-
|
|
1
|
+
{"version":3,"file":"devtools-8_UKWDTl.js","names":[],"sources":["../src/devtools.ts"],"sourcesContent":["import { execa } from 'execa'\nimport { onExit } from 'signal-exit'\nimport ws from 'ws'\n\ndeclare global {\n var WebSocket: typeof WebSocket\n var self: any\n var window: any\n var isDevtoolsEnabled: any\n}\n\nexport function open() {\n // biome-ignore lint/suspicious/noTsIgnore: cannot find types\n // @ts-ignore\n import('react-devtools-core').then((devtools) => {\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 const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\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 console.info('Opening devtools')\n const controller = new AbortController()\n execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools`\n\n ;(devtools as any).initialize()\n console.info('Connecting devtools')\n\n try {\n ;(devtools as any).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"],"mappings":";;;;;AAWA,SAAgB,OAAO;AAGrB,QAAO,uBAAuB,MAAM,aAAa;EAG/C,MAAM,eAAe;AACrB,eAAa,cAAb,aAAa,YAAc;AAC3B,eAAa,WAAb,aAAa,SAAW;AACxB,eAAa,SAAb,aAAa,OAAS;AACtB,eAAa,oBAAoB;AACjC,eAAa,OAAO,uCAAuC;GACzD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACF;AAED,UAAQ,KAAK,mBAAmB;EAChC,MAAM,aAAa,IAAI,iBAAiB;AACxC,QAAM;GACJ,OAAO;GACP,aAAa;GACb,cAAc,WAAW;GACzB,gBAAgB;GACjB,CAAC;AAED,EAAC,SAAiB,YAAY;AAC/B,UAAQ,KAAK,sBAAsB;AAEnC,MAAI;AACD,GAAC,SAAiB,kBAAkB;IACnC,MAAM;IACN,MAAM;IACN,UAAU;IACV,mBAAmB;IACpB,CAAC;WACK,GAAG;AACV,WAAQ,MAAM,EAAE;AAChB,WAAQ,KAAK,qCAAqC;;AAGpD,eACQ;AACJ,WAAQ,KAAK,yBAAyB;AACtC,cAAW,OAAO;KAEpB,EAAE,YAAY,OAAO,CACtB;GACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-
|
|
1
|
+
{"version":3,"file":"devtools-BOpUJhc_.cjs","names":[],"sources":["../src/devtools.ts"],"sourcesContent":["import { execa } from 'execa'\nimport { onExit } from 'signal-exit'\nimport ws from 'ws'\n\ndeclare global {\n var WebSocket: typeof WebSocket\n var self: any\n var window: any\n var isDevtoolsEnabled: any\n}\n\nexport function open() {\n // biome-ignore lint/suspicious/noTsIgnore: cannot find types\n // @ts-ignore\n import('react-devtools-core').then((devtools) => {\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 const customGlobal = global as any\n customGlobal.WebSocket ||= ws\n customGlobal.window ||= global\n customGlobal.self ||= global\n customGlobal.isDevtoolsEnabled = true\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 console.info('Opening devtools')\n const controller = new AbortController()\n execa({\n stdio: 'pipe',\n preferLocal: true,\n cancelSignal: controller.signal,\n gracefulCancel: true,\n })`npx react-devtools`\n\n ;(devtools as any).initialize()\n console.info('Connecting devtools')\n\n try {\n ;(devtools as any).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"],"mappings":";;;;;;;AAWA,SAAgB,OAAO;AAGrB,QAAO,uBAAuB,MAAM,aAAa;EAG/C,MAAM,eAAe;AACrB,eAAa,cAAb,aAAa,YAAc;AAC3B,eAAa,WAAb,aAAa,SAAW;AACxB,eAAa,SAAb,aAAa,OAAS;AACtB,eAAa,oBAAoB;AACjC,eAAa,OAAO,uCAAuC;GACzD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACD;IAEE,MAAM;IACN,OAAO;IACP,WAAW;IACX,SAAS;IACV;GACF;AAED,UAAQ,KAAK,mBAAmB;EAChC,MAAM,aAAa,IAAI,iBAAiB;AACxC,mBAAM;GACJ,OAAO;GACP,aAAa;GACb,cAAc,WAAW;GACzB,gBAAgB;GACjB,CAAC;AAED,EAAC,SAAiB,YAAY;AAC/B,UAAQ,KAAK,sBAAsB;AAEnC,MAAI;AACD,GAAC,SAAiB,kBAAkB;IACnC,MAAM;IACN,MAAM;IACN,UAAU;IACV,mBAAmB;IACpB,CAAC;WACK,GAAG;AACV,WAAQ,MAAM,EAAE;AAChB,WAAQ,KAAK,qCAAqC;;AAGpD,gCACQ;AACJ,WAAQ,KAAK,yBAAyB;AACtC,cAAW,OAAO;KAEpB,EAAE,YAAY,OAAO,CACtB;GACD"}
|
package/dist/devtools.cjs
CHANGED
package/dist/devtools.js
CHANGED
package/dist/globals.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./Fabric-
|
|
2
|
-
import { c as
|
|
1
|
+
import "./Fabric-BELBf-bX.cjs";
|
|
2
|
+
import { c as KubbFileProps, d as KubbSourceProps, f as KubbTextProps, l as KubbImportProps, o as KubbElement, p as LineBreakProps, s as KubbExportProps, u as KubbNode } from "./types-C3ODUOKN.cjs";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/globals.d.ts
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./Fabric-
|
|
2
|
-
import { c as
|
|
1
|
+
import "./Fabric-DbJhvsCq.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-DwaohVJS.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/globals.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-BrXtsOCC.cjs');
|
|
2
2
|
const require_react$1 = require('./react-CWV4qQg2.cjs');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const require_jsx_runtime = require('./jsx-runtime-Cq39dA50.cjs');
|
|
4
|
+
const require_devtools = require('./devtools-BOpUJhc_.cjs');
|
|
5
|
+
const require_reactPlugin = require('./reactPlugin-B8F6jVb5.cjs');
|
|
6
6
|
let _kubb_fabric_core = require("@kubb/fabric-core");
|
|
7
7
|
let dedent = require("dedent");
|
|
8
8
|
dedent = require_chunk.__toESM(dedent);
|
|
@@ -10,33 +10,39 @@ let natural_orderby = require("natural-orderby");
|
|
|
10
10
|
|
|
11
11
|
//#region src/components/App.tsx
|
|
12
12
|
var import_react = /* @__PURE__ */ require_chunk.__toESM(require_react$1.require_react());
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
/**
|
|
14
|
+
* App container containing the AppContext carrying `meta` and an `exit` hook.
|
|
15
|
+
*/
|
|
16
|
+
function App({ children, ...props }) {
|
|
17
|
+
const { meta = {} } = props;
|
|
18
|
+
const { exit } = (0, _kubb_fabric_core.useContext)(_kubb_fabric_core.RootContext);
|
|
19
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
20
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
21
|
+
type: "App",
|
|
22
|
+
props
|
|
23
|
+
}));
|
|
24
|
+
(0, _kubb_fabric_core.provide)(_kubb_fabric_core.AppContext, {
|
|
25
|
+
exit,
|
|
26
|
+
meta
|
|
22
27
|
});
|
|
28
|
+
return children;
|
|
23
29
|
}
|
|
24
|
-
App.Context = AppContext;
|
|
25
30
|
App.displayName = "KubbApp";
|
|
26
31
|
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/utils/createJSDoc.ts
|
|
29
|
-
function createJSDoc({ comments }) {
|
|
30
|
-
const filtered = comments.filter((c) => c.trim());
|
|
31
|
-
if (!filtered.length) return "";
|
|
32
|
-
return `/**\n * ${filtered.join("\n * ")}\n */`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
32
|
//#endregion
|
|
36
33
|
//#region src/components/Const.tsx
|
|
37
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Generates a TypeScript constant declaration.
|
|
36
|
+
*/
|
|
37
|
+
function Const({ children, ...props }) {
|
|
38
|
+
const { name, export: canExport, type, JSDoc, asConst } = props;
|
|
39
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
40
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
41
|
+
type: "Const",
|
|
42
|
+
props
|
|
43
|
+
}));
|
|
38
44
|
return /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [
|
|
39
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
45
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [(0, _kubb_fabric_core.createJSDoc)({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
40
46
|
canExport && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "export " }),
|
|
41
47
|
"const ",
|
|
42
48
|
name,
|
|
@@ -55,23 +61,49 @@ Const.displayName = "KubbConst";
|
|
|
55
61
|
|
|
56
62
|
//#endregion
|
|
57
63
|
//#region src/components/File.tsx
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Adds files to the FileManager
|
|
66
|
+
*/
|
|
67
|
+
function File({ children, ...props }) {
|
|
68
|
+
const { baseName, path, meta = {}, footer, banner } = props;
|
|
69
|
+
const fileManager = (0, _kubb_fabric_core.useFileManager)();
|
|
70
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
71
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
72
|
+
type: "File",
|
|
73
|
+
props
|
|
74
|
+
}));
|
|
75
|
+
if (!baseName || !path) return /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children });
|
|
76
|
+
const file = {
|
|
77
|
+
baseName,
|
|
78
|
+
path,
|
|
79
|
+
meta,
|
|
80
|
+
banner,
|
|
81
|
+
footer,
|
|
82
|
+
sources: [],
|
|
83
|
+
imports: [],
|
|
84
|
+
exports: []
|
|
85
|
+
};
|
|
86
|
+
const [resolvedFile] = fileManager.add(file);
|
|
87
|
+
(0, _kubb_fabric_core.provide)(_kubb_fabric_core.FileContext, resolvedFile);
|
|
61
88
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-file", {
|
|
62
|
-
...
|
|
63
|
-
children
|
|
64
|
-
value: {
|
|
65
|
-
baseName: rest.baseName,
|
|
66
|
-
path: rest.path,
|
|
67
|
-
meta: rest.meta
|
|
68
|
-
},
|
|
69
|
-
children
|
|
70
|
-
})
|
|
89
|
+
...props,
|
|
90
|
+
children
|
|
71
91
|
});
|
|
72
92
|
}
|
|
73
93
|
File.displayName = "KubbFile";
|
|
74
|
-
|
|
94
|
+
/**
|
|
95
|
+
* File.Source
|
|
96
|
+
*
|
|
97
|
+
* Marks a block of source text to be associated with the current file when
|
|
98
|
+
* rendering with the FileCollector. Children are treated as the source string.
|
|
99
|
+
*/
|
|
100
|
+
function FileSource({ children, ...props }) {
|
|
101
|
+
const { name, isExportable, isIndexable, isTypeOnly } = props;
|
|
102
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
103
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
104
|
+
type: "FileSource",
|
|
105
|
+
props
|
|
106
|
+
}));
|
|
75
107
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-source", {
|
|
76
108
|
name,
|
|
77
109
|
isTypeOnly,
|
|
@@ -81,29 +113,66 @@ function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }) {
|
|
|
81
113
|
});
|
|
82
114
|
}
|
|
83
115
|
FileSource.displayName = "KubbFileSource";
|
|
84
|
-
|
|
116
|
+
/**
|
|
117
|
+
* File.Export
|
|
118
|
+
*
|
|
119
|
+
* Declares an export entry for the current file. This will be collected by
|
|
120
|
+
* the FileCollector for later emission.
|
|
121
|
+
*/
|
|
122
|
+
function FileExport(props) {
|
|
123
|
+
const { name, path, isTypeOnly, asAlias } = props;
|
|
124
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
125
|
+
const file = (0, _kubb_fabric_core.useFile)();
|
|
126
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
127
|
+
type: "FileExport",
|
|
128
|
+
props
|
|
129
|
+
}));
|
|
130
|
+
if (file) file.exports.push({
|
|
131
|
+
name,
|
|
132
|
+
path,
|
|
133
|
+
asAlias,
|
|
134
|
+
isTypeOnly
|
|
135
|
+
});
|
|
85
136
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-export", {
|
|
86
137
|
name,
|
|
87
138
|
path,
|
|
88
|
-
isTypeOnly
|
|
139
|
+
isTypeOnly,
|
|
89
140
|
asAlias
|
|
90
141
|
});
|
|
91
142
|
}
|
|
92
143
|
FileExport.displayName = "KubbFileExport";
|
|
93
|
-
|
|
144
|
+
/**
|
|
145
|
+
* File.Import
|
|
146
|
+
*
|
|
147
|
+
* Declares an import entry for the current file.
|
|
148
|
+
*/
|
|
149
|
+
function FileImport(props) {
|
|
150
|
+
const { name, root, path, isTypeOnly, isNameSpace } = props;
|
|
151
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
152
|
+
const file = (0, _kubb_fabric_core.useFile)();
|
|
153
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
154
|
+
type: "FileImport",
|
|
155
|
+
props
|
|
156
|
+
}));
|
|
157
|
+
if (file) file.imports.push({
|
|
158
|
+
name,
|
|
159
|
+
path,
|
|
160
|
+
root,
|
|
161
|
+
isNameSpace,
|
|
162
|
+
isTypeOnly
|
|
163
|
+
});
|
|
94
164
|
return /* @__PURE__ */ require_jsx_runtime.jsx("kubb-import", {
|
|
95
165
|
name,
|
|
96
166
|
root,
|
|
97
167
|
path,
|
|
98
168
|
isNameSpace,
|
|
99
|
-
isTypeOnly
|
|
169
|
+
isTypeOnly
|
|
100
170
|
});
|
|
101
171
|
}
|
|
102
172
|
FileImport.displayName = "KubbFileImport";
|
|
103
173
|
File.Export = FileExport;
|
|
104
174
|
File.Import = FileImport;
|
|
105
175
|
File.Source = FileSource;
|
|
106
|
-
File.Context = FileContext;
|
|
107
176
|
|
|
108
177
|
//#endregion
|
|
109
178
|
//#region ../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js
|
|
@@ -123,6 +192,9 @@ function indentString(string, count = 1, options = {}) {
|
|
|
123
192
|
/**
|
|
124
193
|
* Indents all children by `size` spaces.
|
|
125
194
|
* Collapses consecutive <br /> tags to at most 2.
|
|
195
|
+
*
|
|
196
|
+
* Indent will dedent and re-indent string children and will prefix
|
|
197
|
+
* non-string children with the requested number of spaces.
|
|
126
198
|
*/
|
|
127
199
|
function Indent({ size = 2, children }) {
|
|
128
200
|
if (!children) return null;
|
|
@@ -149,9 +221,18 @@ function Indent({ size = 2, children }) {
|
|
|
149
221
|
|
|
150
222
|
//#endregion
|
|
151
223
|
//#region src/components/Function.tsx
|
|
152
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Generates a TypeScript function declaration.
|
|
226
|
+
*/
|
|
227
|
+
function Function({ children, ...props }) {
|
|
228
|
+
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props;
|
|
229
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
230
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
231
|
+
type: "Function",
|
|
232
|
+
props
|
|
233
|
+
}));
|
|
153
234
|
return /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [
|
|
154
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
235
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [(0, _kubb_fabric_core.createJSDoc)({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
155
236
|
canExport && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "export " }),
|
|
156
237
|
isDefault && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "default " }),
|
|
157
238
|
async && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "async " }),
|
|
@@ -183,9 +264,21 @@ function Function({ name, default: isDefault, export: canExport, async, generics
|
|
|
183
264
|
] });
|
|
184
265
|
}
|
|
185
266
|
Function.displayName = "KubbFunction";
|
|
186
|
-
|
|
267
|
+
/**
|
|
268
|
+
* ArrowFunction
|
|
269
|
+
*
|
|
270
|
+
* Renders an arrow function definition. Supports the same flags as `Function`.
|
|
271
|
+
* Use `singleLine` to render the body as a single-line expression.
|
|
272
|
+
*/
|
|
273
|
+
function ArrowFunction({ children, ...props }) {
|
|
274
|
+
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props;
|
|
275
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
276
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
277
|
+
type: "ArrowFunction",
|
|
278
|
+
props
|
|
279
|
+
}));
|
|
187
280
|
return /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [
|
|
188
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
281
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [(0, _kubb_fabric_core.createJSDoc)({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
189
282
|
canExport && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "export " }),
|
|
190
283
|
isDefault && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "default " }),
|
|
191
284
|
"const ",
|
|
@@ -230,10 +323,19 @@ Function.Arrow = ArrowFunction;
|
|
|
230
323
|
|
|
231
324
|
//#endregion
|
|
232
325
|
//#region src/components/Type.tsx
|
|
233
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Generates a TypeScript type declaration.
|
|
328
|
+
*/
|
|
329
|
+
function Type({ children, ...props }) {
|
|
330
|
+
const { name, export: canExport, JSDoc } = props;
|
|
331
|
+
const nodeTree = (0, _kubb_fabric_core.useNodeTree)();
|
|
332
|
+
if (nodeTree) (0, _kubb_fabric_core.provide)(_kubb_fabric_core.NodeTreeContext, nodeTree.addChild({
|
|
333
|
+
type: "Type",
|
|
334
|
+
props
|
|
335
|
+
}));
|
|
234
336
|
if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
|
|
235
337
|
return /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [
|
|
236
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
338
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ require_jsx_runtime.jsxs(require_jsx_runtime.Fragment, { children: [(0, _kubb_fabric_core.createJSDoc)({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ require_jsx_runtime.jsx("br", {})] }),
|
|
237
339
|
canExport && /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children: "export " }),
|
|
238
340
|
"type ",
|
|
239
341
|
name,
|
|
@@ -243,36 +345,17 @@ function Type({ name, export: canExport, JSDoc, children }) {
|
|
|
243
345
|
}
|
|
244
346
|
Type.displayName = "KubbType";
|
|
245
347
|
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/composables/useApp.ts
|
|
248
|
-
/**
|
|
249
|
-
* `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
|
|
250
|
-
*/
|
|
251
|
-
function useApp() {
|
|
252
|
-
const app = (0, import_react.useContext)(App.Context);
|
|
253
|
-
if (!app) throw new Error("<App /> should be set");
|
|
254
|
-
return app;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region src/composables/useFile.ts
|
|
259
|
-
/**
|
|
260
|
-
* `useFile` will return the current file when <File/> is used.
|
|
261
|
-
*/
|
|
262
|
-
function useFile() {
|
|
263
|
-
return (0, import_react.useContext)(File.Context);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
348
|
//#endregion
|
|
267
349
|
//#region src/composables/useLifecycle.tsx
|
|
268
350
|
/**
|
|
269
|
-
*
|
|
351
|
+
* Provides lifecycle helpers that integrate with the Fabric runtime. The
|
|
352
|
+
* `exit` helper schedules a call to the RootContext exit function on the
|
|
353
|
+
* next tick to allow React to complete its render cycle first.
|
|
270
354
|
*/
|
|
271
355
|
function useLifecycle() {
|
|
272
|
-
const { exit } = (0,
|
|
356
|
+
const { exit } = (0, _kubb_fabric_core.useContext)(_kubb_fabric_core.RootContext);
|
|
273
357
|
return { exit: () => {
|
|
274
|
-
|
|
275
|
-
clearTimeout(timeout);
|
|
358
|
+
setTimeout(() => {
|
|
276
359
|
exit();
|
|
277
360
|
}, 0);
|
|
278
361
|
} };
|
|
@@ -433,10 +516,20 @@ exports.createElement = createElement;
|
|
|
433
516
|
exports.createFunctionParams = createFunctionParams;
|
|
434
517
|
exports.createReactFabric = createReactFabric;
|
|
435
518
|
exports.use = use;
|
|
436
|
-
exports
|
|
519
|
+
Object.defineProperty(exports, 'useApp', {
|
|
520
|
+
enumerable: true,
|
|
521
|
+
get: function () {
|
|
522
|
+
return _kubb_fabric_core.useApp;
|
|
523
|
+
}
|
|
524
|
+
});
|
|
437
525
|
exports.useContext = useContext;
|
|
438
526
|
exports.useEffect = useEffect;
|
|
439
|
-
exports
|
|
527
|
+
Object.defineProperty(exports, 'useFile', {
|
|
528
|
+
enumerable: true,
|
|
529
|
+
get: function () {
|
|
530
|
+
return _kubb_fabric_core.useFile;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
440
533
|
exports.useLifecycle = useLifecycle;
|
|
441
534
|
exports.useReducer = useReducer;
|
|
442
535
|
exports.useRef = useRef;
|