@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.
Files changed (108) hide show
  1. package/dist/{Fabric-DitK3IEP.d.ts → Fabric-BELBf-bX.d.cts} +5 -5
  2. package/dist/{Fabric-C61uYmUy.d.cts → Fabric-DbJhvsCq.d.ts} +5 -5
  3. package/dist/{devtools-D6dZodXp.js → devtools-8_UKWDTl.js} +1 -1
  4. package/dist/{devtools-D6dZodXp.js.map → devtools-8_UKWDTl.js.map} +1 -1
  5. package/dist/{devtools-CRkwwngz.cjs → devtools-BOpUJhc_.cjs} +1 -1
  6. package/dist/{devtools-CRkwwngz.cjs.map → devtools-BOpUJhc_.cjs.map} +1 -1
  7. package/dist/devtools.cjs +1 -1
  8. package/dist/devtools.js +1 -1
  9. package/dist/globals.d.cts +2 -2
  10. package/dist/globals.d.ts +2 -2
  11. package/dist/index.cjs +166 -73
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +3 -359
  14. package/dist/index.d.ts +3 -359
  15. package/dist/index.js +151 -68
  16. package/dist/index.js.map +1 -1
  17. package/dist/jsx-dev-runtime.d.cts +5 -5
  18. package/dist/jsx-dev-runtime.d.ts +3 -3
  19. package/dist/{jsx-namespace-BAkGpU6g.d.ts → jsx-namespace-CBOEkCmJ.d.ts} +2 -2
  20. package/dist/{jsx-namespace-CCPa1Nut.d.cts → jsx-namespace-od7sqrmY.d.cts} +2 -2
  21. package/dist/{jsx-runtime-BEVcoJUm.cjs → jsx-runtime-Cq39dA50.cjs} +1 -1
  22. package/dist/{jsx-runtime-BEVcoJUm.cjs.map → jsx-runtime-Cq39dA50.cjs.map} +1 -1
  23. package/dist/{jsx-runtime-DDu0mFTI.js → jsx-runtime-Isgf9orn.js} +1 -1
  24. package/dist/{jsx-runtime-DDu0mFTI.js.map → jsx-runtime-Isgf9orn.js.map} +1 -1
  25. package/dist/jsx-runtime.cjs +1 -1
  26. package/dist/jsx-runtime.d.cts +5 -5
  27. package/dist/jsx-runtime.d.ts +3 -3
  28. package/dist/jsx-runtime.js +1 -1
  29. package/dist/parsers.d.cts +1 -1
  30. package/dist/parsers.d.ts +1 -1
  31. package/dist/plugins.cjs +2 -2
  32. package/dist/plugins.d.cts +2 -2
  33. package/dist/plugins.d.ts +2 -2
  34. package/dist/plugins.js +2 -2
  35. package/dist/{reactPlugin-CXaAO13f.cjs → reactPlugin-B8F6jVb5.cjs} +77 -64
  36. package/dist/reactPlugin-B8F6jVb5.cjs.map +1 -0
  37. package/dist/{reactPlugin-ixOr00MK.js → reactPlugin-CAtVV84d.js} +78 -53
  38. package/dist/reactPlugin-CAtVV84d.js.map +1 -0
  39. package/dist/types-C3ODUOKN.d.cts +675 -0
  40. package/dist/types-DwaohVJS.d.ts +675 -0
  41. package/dist/types.d.cts +3 -3
  42. package/dist/types.d.ts +3 -3
  43. package/package.json +3 -3
  44. package/src/Runtime.tsx +22 -12
  45. package/src/components/App.tsx +24 -15
  46. package/src/components/Const.tsx +19 -3
  47. package/src/components/File.tsx +107 -31
  48. package/src/components/Function.tsx +36 -5
  49. package/src/components/Indent.tsx +3 -0
  50. package/src/components/Root.tsx +26 -20
  51. package/src/components/Type.tsx +19 -2
  52. package/src/components/__snapshots__/arrow_function.ts +3 -0
  53. package/src/components/__snapshots__/arrow_function_default.ts +3 -0
  54. package/src/components/__snapshots__/arrow_function_generics.ts +3 -0
  55. package/src/components/__snapshots__/arrow_function_single_line.ts +1 -0
  56. package/src/components/__snapshots__/arrow_function_with_generics.ts +3 -0
  57. package/src/components/__snapshots__/async_arrow_function.ts +3 -0
  58. package/src/components/__snapshots__/async_function.ts +3 -0
  59. package/src/components/__snapshots__/async_function_with_Promise_return_type.ts +3 -0
  60. package/src/components/__snapshots__/basic_arrow_function.ts +3 -0
  61. package/src/components/__snapshots__/basic_const.ts +1 -0
  62. package/src/components/__snapshots__/basic_export.ts +1 -0
  63. package/src/components/__snapshots__/basic_function.ts +3 -0
  64. package/src/components/__snapshots__/basic_import.ts +1 -0
  65. package/src/components/__snapshots__/basic_type.ts +1 -0
  66. package/src/components/__snapshots__/const_with_JSDoc.ts +4 -0
  67. package/src/components/__snapshots__/const_with_as_const.ts +1 -0
  68. package/src/components/__snapshots__/const_with_type.ts +1 -0
  69. package/src/components/__snapshots__/default_exported_arrow_function.ts +3 -0
  70. package/src/components/__snapshots__/default_exported_function.ts +3 -0
  71. package/src/components/__snapshots__/exported_arrow_function.ts +3 -0
  72. package/src/components/__snapshots__/exported_const.ts +1 -0
  73. package/src/components/__snapshots__/exported_function.ts +3 -0
  74. package/src/components/__snapshots__/exported_type.ts +1 -0
  75. package/src/components/__snapshots__/function_generics.ts +3 -0
  76. package/src/components/__snapshots__/function_with_JSDoc.ts +6 -0
  77. package/src/components/__snapshots__/function_with_comments.ts +6 -0
  78. package/src/components/__snapshots__/function_with_generics.ts +3 -0
  79. package/src/components/__snapshots__/function_with_parameters.ts +3 -0
  80. package/src/components/__snapshots__/function_with_params.ts +3 -0
  81. package/src/components/__snapshots__/function_with_returnType.ts +3 -0
  82. package/src/components/__snapshots__/function_with_return_type.ts +3 -0
  83. package/src/components/__snapshots__/matches_with_root_import.ts +1 -0
  84. package/src/components/__snapshots__/multiple_functions.ts +3 -0
  85. package/src/components/__snapshots__/named_export.ts +1 -0
  86. package/src/components/__snapshots__/named_export_(object_advanced).ts +1 -0
  87. package/src/components/__snapshots__/named_import.ts +1 -0
  88. package/src/components/__snapshots__/named_import_(object).ts +1 -0
  89. package/src/components/__snapshots__/named_import_(object_advanced).ts +1 -0
  90. package/src/components/__snapshots__/named_typed_export.ts +1 -0
  91. package/src/components/__snapshots__/named_typed_import.ts +1 -0
  92. package/src/components/__snapshots__/single_line_arrow_function.ts +1 -0
  93. package/src/components/__snapshots__/type_with_JSDoc.ts +4 -0
  94. package/src/components/__snapshots__/typed_export.ts +1 -0
  95. package/src/components/__snapshots__/typed_import.ts +1 -0
  96. package/src/composables/useApp.ts +1 -15
  97. package/src/composables/useFile.ts +1 -12
  98. package/src/composables/useLifecycle.tsx +7 -8
  99. package/src/index.ts +5 -1
  100. package/src/plugins/reactPlugin.ts +7 -6
  101. package/src/types.ts +0 -4
  102. package/src/utils/createJSDoc.ts +1 -8
  103. package/dist/reactPlugin-4-kcMKwZ.d.ts +0 -31
  104. package/dist/reactPlugin-B4xarQJX.d.cts +0 -31
  105. package/dist/reactPlugin-CXaAO13f.cjs.map +0 -1
  106. package/dist/reactPlugin-ixOr00MK.js.map +0 -1
  107. package/dist/types-CSUzVTpn.d.ts +0 -104
  108. 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?: Array<Import>;
92
- exports?: Array<Export>;
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>): Promise<ResolvedFile<object>[]>;
201
- upsert(...files: Array<File>): Promise<ResolvedFile<object>[]>;
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-DitK3IEP.d.ts.map
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?: Array<Import>;
92
- exports?: Array<Export>;
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>): Promise<ResolvedFile<object>[]>;
201
- upsert(...files: Array<File>): Promise<ResolvedFile<object>[]>;
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-C61uYmUy.d.cts.map
418
+ //# sourceMappingURL=Fabric-DbJhvsCq.d.ts.map
@@ -90,4 +90,4 @@ function open() {
90
90
 
91
91
  //#endregion
92
92
  export { open as t };
93
- //# sourceMappingURL=devtools-D6dZodXp.js.map
93
+ //# sourceMappingURL=devtools-8_UKWDTl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"devtools-D6dZodXp.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
+ {"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"}
@@ -97,4 +97,4 @@ Object.defineProperty(exports, 'open', {
97
97
  return open;
98
98
  }
99
99
  });
100
- //# sourceMappingURL=devtools-CRkwwngz.cjs.map
100
+ //# sourceMappingURL=devtools-BOpUJhc_.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"devtools-CRkwwngz.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"}
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
@@ -1,3 +1,3 @@
1
- const require_devtools = require('./devtools-CRkwwngz.cjs');
1
+ const require_devtools = require('./devtools-BOpUJhc_.cjs');
2
2
 
3
3
  exports.open = require_devtools.open;
package/dist/devtools.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as open } from "./devtools-D6dZodXp.js";
1
+ import { t as open } from "./devtools-8_UKWDTl.js";
2
2
 
3
3
  export { open };
@@ -1,5 +1,5 @@
1
- import "./Fabric-C61uYmUy.cjs";
2
- import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-DP2mgqeb.cjs";
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-DitK3IEP.js";
2
- import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-CSUzVTpn.js";
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 require_reactPlugin = require('./reactPlugin-CXaAO13f.cjs');
4
- const require_jsx_runtime = require('./jsx-runtime-BEVcoJUm.cjs');
5
- const require_devtools = require('./devtools-CRkwwngz.cjs');
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
- const AppContext = (0, import_react.createContext)(void 0);
14
- function App({ meta, children }) {
15
- const { exit } = (0, import_react.useContext)(require_reactPlugin.RootContext);
16
- return /* @__PURE__ */ require_jsx_runtime.jsx(AppContext.Provider, {
17
- value: {
18
- exit,
19
- meta
20
- },
21
- children
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
- function Const({ name, export: canExport, type, JSDoc, asConst, children }) {
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
- const FileContext = (0, import_react.createContext)({});
59
- function File({ children, ...rest }) {
60
- if (!rest.baseName || !rest.path) return /* @__PURE__ */ require_jsx_runtime.jsx(require_jsx_runtime.Fragment, { children });
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
- ...rest,
63
- children: /* @__PURE__ */ require_jsx_runtime.jsx(FileContext.Provider, {
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
- function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }) {
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
- function FileExport({ name, path, isTypeOnly, asAlias }) {
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: isTypeOnly || false,
139
+ isTypeOnly,
89
140
  asAlias
90
141
  });
91
142
  }
92
143
  FileExport.displayName = "KubbFileExport";
93
- function FileImport({ name, root, path, isTypeOnly, isNameSpace }) {
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: isTypeOnly || false
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
- function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }) {
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
- function ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }) {
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
- function Type({ name, export: canExport, JSDoc, children }) {
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
- * `useLifecycle` will return some helpers to exit/restart the generation.
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, import_react.useContext)(require_reactPlugin.Root.Context);
356
+ const { exit } = (0, _kubb_fabric_core.useContext)(_kubb_fabric_core.RootContext);
273
357
  return { exit: () => {
274
- const timeout = setTimeout(() => {
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.useApp = useApp;
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.useFile = useFile;
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;