@kubb/react-fabric 0.1.2 → 0.1.4

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 (49) hide show
  1. package/dist/App-2SatilGX.d.ts +174 -0
  2. package/dist/App-DwUtyfk9.d.cts +174 -0
  3. package/dist/{globals-BQ_tJj2b.d.ts → KubbFile-D4gyyfL-.d.ts} +1 -52
  4. package/dist/{globals-C-9ezLk9.d.cts → KubbFile-FGXV713i.d.cts} +1 -52
  5. package/dist/Runtime-DWlDUeLZ.js +15482 -0
  6. package/dist/Runtime-DWlDUeLZ.js.map +1 -0
  7. package/dist/Runtime-JI640uK4.cjs +15520 -0
  8. package/dist/Runtime-JI640uK4.cjs.map +1 -0
  9. package/dist/globals-BRG2DOJd.d.cts +52 -0
  10. package/dist/globals-D_1Lfe9-.d.ts +52 -0
  11. package/dist/globals.d.cts +3 -2
  12. package/dist/globals.d.ts +3 -2
  13. package/dist/index.cjs +150 -15635
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +50 -202
  16. package/dist/index.d.ts +50 -202
  17. package/dist/index.js +6 -15494
  18. package/dist/index.js.map +1 -1
  19. package/dist/{jsx-runtime-BPQkRAg2.js → jsx-runtime-Dg-pJBHd.js} +1 -1
  20. package/dist/{jsx-runtime-BPQkRAg2.js.map → jsx-runtime-Dg-pJBHd.js.map} +1 -1
  21. package/dist/{jsx-runtime-B3MMb3PL.cjs → jsx-runtime-d2dmYscH.cjs} +1 -1
  22. package/dist/{jsx-runtime-B3MMb3PL.cjs.map → jsx-runtime-d2dmYscH.cjs.map} +1 -1
  23. package/dist/jsx-runtime.cjs +1 -1
  24. package/dist/jsx-runtime.d.cts +3 -2
  25. package/dist/jsx-runtime.d.ts +3 -2
  26. package/dist/jsx-runtime.js +1 -1
  27. package/dist/parsers.cjs +9 -0
  28. package/dist/parsers.d.cts +18 -0
  29. package/dist/parsers.d.ts +18 -0
  30. package/dist/parsers.js +3 -0
  31. package/dist/plugins.cjs +40 -0
  32. package/dist/plugins.cjs.map +1 -0
  33. package/dist/plugins.d.cts +55 -0
  34. package/dist/plugins.d.ts +55 -0
  35. package/dist/plugins.js +34 -0
  36. package/dist/plugins.js.map +1 -0
  37. package/dist/{types-D9OfSq91.d.ts → types-Brnyan9B.d.ts} +1 -1
  38. package/dist/{types-CUKR3KZn.d.cts → types-C3p0Ljxf.d.cts} +1 -1
  39. package/dist/types.d.cts +1 -1
  40. package/dist/types.d.ts +1 -1
  41. package/package.json +16 -2
  42. package/src/{kubbRenderer.ts → Renderer.ts} +1 -1
  43. package/src/{ReactTemplate.tsx → Runtime.tsx} +36 -30
  44. package/src/index.ts +9 -1
  45. package/src/parsers/index.ts +1 -0
  46. package/src/plugins/index.ts +3 -0
  47. package/src/plugins/reactPlugin.ts +47 -0
  48. package/src/utils/processFiles.ts +5 -4
  49. package/src/createApp.ts +0 -19
package/dist/index.d.cts CHANGED
@@ -1,199 +1,30 @@
1
- import { a as Import, c as Source, i as File$1, n as Export, o as Path, r as Extname, s as ResolvedFile, t as BaseName } from "./globals-C-9ezLk9.cjs";
2
- import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-CUKR3KZn.cjs";
1
+ import { a as Import, c as Source, n as Export, o as Path, t as BaseName } from "./KubbFile-FGXV713i.cjs";
2
+ import { n as Component, r as FileManager, t as App$1 } from "./App-DwUtyfk9.cjs";
3
+ import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-C3p0Ljxf.cjs";
4
+ import "./globals-BRG2DOJd.cjs";
3
5
  import * as react1 from "react";
4
6
  import React, { ReactNode } from "react";
5
7
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
8
 
7
- //#region ../fabric-core/src/plugins/types.d.ts
8
- type Plugin<TOptions$1 = any[], TAppExtension$1 extends Record<string, any> = {}> = {
9
- name: string;
10
- type: 'plugin';
11
- scope?: 'write' | 'read' | (string & {});
12
- install: Install<TOptions$1> | Promise<Install<TOptions$1>>;
13
- /**
14
- * Runtime app overrides or extensions.
15
- * Merged into the app instance after install.
16
- */
17
- override?: Override<TOptions$1, TAppExtension$1>;
18
- };
19
- //#endregion
20
- //#region ../fabric-core/src/parsers/types.d.ts
21
- type PrintOptions = {
22
- extname?: Extname;
23
- };
24
- type Parser<TOptions$1 = any[], TMeta$1 extends object = any> = {
25
- name: string;
26
- type: 'parser';
27
- /**
28
- * Undefined is being used for the defaultParser
29
- */
30
- extNames: Array<Extname> | undefined;
31
- install: Install<TOptions$1>;
32
- /**
33
- * Convert a file to string
34
- */
35
- parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
36
- };
37
- //#endregion
38
- //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
39
- declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
40
- #private;
41
- constructor(maxListener?: number);
42
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
43
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
44
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
45
- removeAll(): void;
46
- }
47
- //#endregion
48
- //#region ../fabric-core/src/FileProcessor.d.ts
49
- type ProcessFilesProps = {
50
- parsers?: Set<Parser>;
51
- extension?: Record<Extname, Extname | ''>;
52
- dryRun?: boolean;
53
- };
54
- type GetParseOptions = {
55
- parsers?: Set<Parser>;
56
- extname?: Extname;
57
- };
58
- type Options$1 = {
59
- events?: AsyncEventEmitter<AppEvents>;
60
- };
61
- declare class FileProcessor {
62
- #private;
63
- events: AsyncEventEmitter<AppEvents>;
64
- constructor({
65
- events
66
- }?: Options$1);
67
- parse(file: ResolvedFile, {
68
- parsers,
69
- extname
70
- }?: GetParseOptions): Promise<string>;
71
- run(files: Array<ResolvedFile>, {
72
- parsers,
73
- dryRun,
74
- extension
75
- }?: ProcessFilesProps): Promise<ResolvedFile[]>;
76
- }
77
- //#endregion
78
- //#region ../fabric-core/src/FileManager.d.ts
79
- type Options = {
80
- events?: AsyncEventEmitter<AppEvents>;
81
- };
82
- declare class FileManager {
83
- #private;
84
- processor: FileProcessor;
85
- constructor({
86
- events
87
- }?: Options);
88
- add(...files: Array<File$1>): Promise<ResolvedFile<object>[]>;
89
- flush(): void;
90
- getByPath(path: Path): ResolvedFile | null;
91
- deleteByPath(path: Path): void;
92
- clear(): void;
93
- get files(): Array<ResolvedFile>;
94
- write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
95
- }
96
- //#endregion
97
- //#region ../fabric-core/src/App.d.ts
98
- type Component = any;
99
- type AppEvents = {
100
- /**
101
- * Called in the beginning of the app lifecycle.
102
- */
103
- start: [{
104
- app: App$1;
105
- }];
106
- /**
107
- * Called in the end of the app lifecycle.
108
- */
109
- end: [{
110
- app: App$1;
111
- }];
112
- /**
113
- * Called when being rendered
114
- */
115
- render: [{
116
- app: App$1;
117
- }];
118
- /**
119
- * Called once before processing any files.
120
- */
121
- 'process:start': [{
122
- files: ResolvedFile[];
123
- }];
124
- /**
125
- * Called for each file when processing begins.
126
- */
127
- 'file:start': [{
128
- file: ResolvedFile;
129
- index: number;
130
- total: number;
131
- }];
132
- /**
133
- * Called for each file when processing finishes.
134
- */
135
- 'file:end': [{
136
- file: ResolvedFile;
137
- index: number;
138
- total: number;
139
- }];
140
- /**
141
- * Called periodically (or after each file) to indicate progress.
142
- * Useful for progress bars or logging.
143
- */
144
- 'process:progress': [{
145
- processed: number;
146
- total: number;
147
- percentage: number;
148
- source: string;
149
- file: ResolvedFile;
150
- }];
151
- /**
152
- * Called once all files have been processed successfully.
153
- */
154
- 'process:end': [{
155
- files: ResolvedFile[];
156
- }];
157
- };
158
- type AppContext<TOptions$1 = unknown> = {
159
- options?: TOptions$1;
160
- events: AsyncEventEmitter<AppEvents>;
161
- fileManager: FileManager;
162
- installedPlugins: Set<Plugin>;
163
- installedParsers: Set<Parser>;
164
- };
165
- type Install<TOptions$1 = any[] | object | undefined> = TOptions$1 extends any[] ? (app: App$1, context: AppContext, ...options: TOptions$1) => void : TOptions$1 extends object ? (app: App$1, context: AppContext, options?: TOptions$1) => void : (app: App$1, context: AppContext) => void;
166
- type Override<TOptions$1 = any[] | object | undefined, TAppExtension$1 extends Record<string, any> = {}> = TOptions$1 extends any[] ? (app: App$1, context: AppContext, ...options: TOptions$1) => Partial<TAppExtension$1> : TOptions$1 extends object ? (app: App$1, context: AppContext, options?: TOptions$1) => Partial<TAppExtension$1> : (app: App$1, context: AppContext) => Partial<TAppExtension$1>;
167
- interface App$1 {
168
- _component: Component;
169
- render(): Promise<void>;
170
- renderToString(): Promise<string>;
171
- files: Array<ResolvedFile>;
172
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): this & TAppExtension;
173
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): this & TAppExtension;
174
- addFile(...files: Array<File$1>): Promise<void>;
175
- waitUntilExit(): Promise<void>;
176
- }
177
- //#endregion
178
9
  //#region ../fabric-core/src/defineApp.d.ts
179
- type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App$1;
10
+ type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App$1;
180
11
  //#endregion
181
12
  //#region src/components/App.d.ts
182
- type AppContextProps<TMeta$1 = unknown> = {
13
+ type AppContextProps<TMeta = unknown> = {
183
14
  /**
184
15
  * Exit (unmount)
185
16
  */
186
17
  readonly exit: (error?: Error) => void;
187
- readonly meta: TMeta$1;
18
+ readonly meta: TMeta;
188
19
  };
189
- type Props$4<TMeta$1 = unknown> = {
20
+ type Props$4<TMeta = unknown> = {
190
21
  readonly children?: KubbNode;
191
- readonly meta: TMeta$1;
22
+ readonly meta: TMeta;
192
23
  };
193
- declare function App<TMeta$1 = unknown>({
24
+ declare function App<TMeta = unknown>({
194
25
  meta,
195
26
  children
196
- }: Props$4<TMeta$1>): react_jsx_runtime0.JSX.Element;
27
+ }: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
197
28
  declare namespace App {
198
29
  var Context: react1.Context<AppContextProps<unknown> | undefined>;
199
30
  var displayName: string;
@@ -237,7 +68,7 @@ declare namespace Const {
237
68
  }
238
69
  //#endregion
239
70
  //#region src/components/File.d.ts
240
- type FileContextProps<TMeta$1 extends object = object> = {
71
+ type FileContextProps<TMeta extends object = object> = {
241
72
  /**
242
73
  * Name to be used to dynamicly create the baseName(based on input.path).
243
74
  * Based on UNIX basename
@@ -248,7 +79,7 @@ type FileContextProps<TMeta$1 extends object = object> = {
248
79
  * Path will be full qualified path to a specified file.
249
80
  */
250
81
  path: Path;
251
- meta?: TMeta$1;
82
+ meta?: TMeta;
252
83
  };
253
84
  type BasePropsWithBaseName = {
254
85
  /**
@@ -270,17 +101,17 @@ type BasePropsWithoutBaseName = {
270
101
  path?: Path;
271
102
  };
272
103
  type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
273
- type Props$2<TMeta$1> = BaseProps & {
104
+ type Props$2<TMeta> = BaseProps & {
274
105
  key?: Key;
275
- meta?: TMeta$1;
106
+ meta?: TMeta;
276
107
  banner?: string;
277
108
  footer?: string;
278
109
  children?: KubbNode;
279
110
  };
280
- declare function File<TMeta$1 extends object = object>({
111
+ declare function File<TMeta extends object = object>({
281
112
  children,
282
113
  ...rest
283
- }: Props$2<TMeta$1>): react_jsx_runtime0.JSX.Element;
114
+ }: Props$2<TMeta>): react_jsx_runtime0.JSX.Element;
284
115
  declare namespace File {
285
116
  var displayName: string;
286
117
  var Export: typeof FileExport;
@@ -444,25 +275,11 @@ declare namespace Type {
444
275
  var displayName: string;
445
276
  }
446
277
  //#endregion
447
- //#region src/ReactTemplate.d.ts
448
- type ReactAppContext = AppContext<{
449
- stdout?: NodeJS.WriteStream;
450
- stdin?: NodeJS.ReadStream;
451
- stderr?: NodeJS.WriteStream;
452
- /**
453
- * Set this to true to always see the result of the render in the console(line per render)
454
- */
455
- debug?: boolean;
456
- }>;
457
- //#endregion
458
- //#region src/createApp.d.ts
459
- declare const createApp: DefineApp<ReactAppContext>;
460
- //#endregion
461
278
  //#region src/composables/useApp.d.ts
462
279
  /**
463
280
  * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
464
281
  */
465
- declare function useApp<TMeta$1 = unknown>(): AppContextProps<TMeta$1>;
282
+ declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
466
283
  //#endregion
467
284
  //#region src/composables/useFile.d.ts
468
285
  /**
@@ -478,6 +295,37 @@ declare function useLifecycle(): {
478
295
  exit: () => void;
479
296
  };
480
297
  //#endregion
298
+ //#region ../fabric-core/src/createApp.d.ts
299
+ declare const createApp: DefineApp<unknown>;
300
+ //#endregion
301
+ //#region src/Runtime.d.ts
302
+ type Options = {
303
+ fileManager: FileManager;
304
+ stdout?: NodeJS.WriteStream;
305
+ stdin?: NodeJS.ReadStream;
306
+ stderr?: NodeJS.WriteStream;
307
+ /**
308
+ * Set this to true to always see the result of the render in the console(line per render)
309
+ */
310
+ debug?: boolean;
311
+ };
312
+ declare class Runtime {
313
+ #private;
314
+ exitPromise?: Promise<void>;
315
+ constructor(options: Options);
316
+ get fileManager(): FileManager;
317
+ resolveExitPromise: () => void;
318
+ rejectExitPromise: (reason?: Error) => void;
319
+ unsubscribeExit: () => void;
320
+ onRender: () => void;
321
+ onError(error: Error): void;
322
+ onExit(error?: Error): void;
323
+ render(node: ReactNode): void;
324
+ renderToString(node: ReactNode): Promise<string>;
325
+ unmount(error?: Error | number | null): void;
326
+ waitUntilExit(): Promise<void>;
327
+ }
328
+ //#endregion
481
329
  //#region src/index.d.ts
482
330
  declare const createContext: typeof react1.createContext;
483
331
  declare const createElement: typeof react1.createElement;
@@ -488,5 +336,5 @@ declare const useRef: typeof react1.useRef;
488
336
  declare const use: typeof react1.use;
489
337
  declare const useReducer: typeof react1.useReducer;
490
338
  //#endregion
491
- export { App, Const, File, Function, FunctionParams, Indent, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
339
+ export { App, Const, File, Function, FunctionParams, Indent, Runtime, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
492
340
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,199 +1,30 @@
1
- import { a as Import, c as Source, i as File$1, n as Export, o as Path, r as Extname, s as ResolvedFile, t as BaseName } from "./globals-BQ_tJj2b.js";
2
- import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-D9OfSq91.js";
1
+ import { a as Import, c as Source, n as Export, o as Path, t as BaseName } from "./KubbFile-D4gyyfL-.js";
2
+ import { n as Component, r as FileManager, t as App$1 } from "./App-2SatilGX.js";
3
+ import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-Brnyan9B.js";
4
+ import "./globals-D_1Lfe9-.js";
3
5
  import * as react1 from "react";
4
6
  import React, { ReactNode } from "react";
5
7
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
8
 
7
- //#region ../fabric-core/src/plugins/types.d.ts
8
- type Plugin<TOptions$1 = any[], TAppExtension$1 extends Record<string, any> = {}> = {
9
- name: string;
10
- type: 'plugin';
11
- scope?: 'write' | 'read' | (string & {});
12
- install: Install<TOptions$1> | Promise<Install<TOptions$1>>;
13
- /**
14
- * Runtime app overrides or extensions.
15
- * Merged into the app instance after install.
16
- */
17
- override?: Override<TOptions$1, TAppExtension$1>;
18
- };
19
- //#endregion
20
- //#region ../fabric-core/src/parsers/types.d.ts
21
- type PrintOptions = {
22
- extname?: Extname;
23
- };
24
- type Parser<TOptions$1 = any[], TMeta$1 extends object = any> = {
25
- name: string;
26
- type: 'parser';
27
- /**
28
- * Undefined is being used for the defaultParser
29
- */
30
- extNames: Array<Extname> | undefined;
31
- install: Install<TOptions$1>;
32
- /**
33
- * Convert a file to string
34
- */
35
- parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
36
- };
37
- //#endregion
38
- //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
39
- declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
40
- #private;
41
- constructor(maxListener?: number);
42
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
43
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
44
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
45
- removeAll(): void;
46
- }
47
- //#endregion
48
- //#region ../fabric-core/src/FileProcessor.d.ts
49
- type ProcessFilesProps = {
50
- parsers?: Set<Parser>;
51
- extension?: Record<Extname, Extname | ''>;
52
- dryRun?: boolean;
53
- };
54
- type GetParseOptions = {
55
- parsers?: Set<Parser>;
56
- extname?: Extname;
57
- };
58
- type Options$1 = {
59
- events?: AsyncEventEmitter<AppEvents>;
60
- };
61
- declare class FileProcessor {
62
- #private;
63
- events: AsyncEventEmitter<AppEvents>;
64
- constructor({
65
- events
66
- }?: Options$1);
67
- parse(file: ResolvedFile, {
68
- parsers,
69
- extname
70
- }?: GetParseOptions): Promise<string>;
71
- run(files: Array<ResolvedFile>, {
72
- parsers,
73
- dryRun,
74
- extension
75
- }?: ProcessFilesProps): Promise<ResolvedFile[]>;
76
- }
77
- //#endregion
78
- //#region ../fabric-core/src/FileManager.d.ts
79
- type Options = {
80
- events?: AsyncEventEmitter<AppEvents>;
81
- };
82
- declare class FileManager {
83
- #private;
84
- processor: FileProcessor;
85
- constructor({
86
- events
87
- }?: Options);
88
- add(...files: Array<File$1>): Promise<ResolvedFile<object>[]>;
89
- flush(): void;
90
- getByPath(path: Path): ResolvedFile | null;
91
- deleteByPath(path: Path): void;
92
- clear(): void;
93
- get files(): Array<ResolvedFile>;
94
- write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
95
- }
96
- //#endregion
97
- //#region ../fabric-core/src/App.d.ts
98
- type Component = any;
99
- type AppEvents = {
100
- /**
101
- * Called in the beginning of the app lifecycle.
102
- */
103
- start: [{
104
- app: App$1;
105
- }];
106
- /**
107
- * Called in the end of the app lifecycle.
108
- */
109
- end: [{
110
- app: App$1;
111
- }];
112
- /**
113
- * Called when being rendered
114
- */
115
- render: [{
116
- app: App$1;
117
- }];
118
- /**
119
- * Called once before processing any files.
120
- */
121
- 'process:start': [{
122
- files: ResolvedFile[];
123
- }];
124
- /**
125
- * Called for each file when processing begins.
126
- */
127
- 'file:start': [{
128
- file: ResolvedFile;
129
- index: number;
130
- total: number;
131
- }];
132
- /**
133
- * Called for each file when processing finishes.
134
- */
135
- 'file:end': [{
136
- file: ResolvedFile;
137
- index: number;
138
- total: number;
139
- }];
140
- /**
141
- * Called periodically (or after each file) to indicate progress.
142
- * Useful for progress bars or logging.
143
- */
144
- 'process:progress': [{
145
- processed: number;
146
- total: number;
147
- percentage: number;
148
- source: string;
149
- file: ResolvedFile;
150
- }];
151
- /**
152
- * Called once all files have been processed successfully.
153
- */
154
- 'process:end': [{
155
- files: ResolvedFile[];
156
- }];
157
- };
158
- type AppContext<TOptions$1 = unknown> = {
159
- options?: TOptions$1;
160
- events: AsyncEventEmitter<AppEvents>;
161
- fileManager: FileManager;
162
- installedPlugins: Set<Plugin>;
163
- installedParsers: Set<Parser>;
164
- };
165
- type Install<TOptions$1 = any[] | object | undefined> = TOptions$1 extends any[] ? (app: App$1, context: AppContext, ...options: TOptions$1) => void : TOptions$1 extends object ? (app: App$1, context: AppContext, options?: TOptions$1) => void : (app: App$1, context: AppContext) => void;
166
- type Override<TOptions$1 = any[] | object | undefined, TAppExtension$1 extends Record<string, any> = {}> = TOptions$1 extends any[] ? (app: App$1, context: AppContext, ...options: TOptions$1) => Partial<TAppExtension$1> : TOptions$1 extends object ? (app: App$1, context: AppContext, options?: TOptions$1) => Partial<TAppExtension$1> : (app: App$1, context: AppContext) => Partial<TAppExtension$1>;
167
- interface App$1 {
168
- _component: Component;
169
- render(): Promise<void>;
170
- renderToString(): Promise<string>;
171
- files: Array<ResolvedFile>;
172
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): this & TAppExtension;
173
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): this & TAppExtension;
174
- addFile(...files: Array<File$1>): Promise<void>;
175
- waitUntilExit(): Promise<void>;
176
- }
177
- //#endregion
178
9
  //#region ../fabric-core/src/defineApp.d.ts
179
- type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App$1;
10
+ type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App$1;
180
11
  //#endregion
181
12
  //#region src/components/App.d.ts
182
- type AppContextProps<TMeta$1 = unknown> = {
13
+ type AppContextProps<TMeta = unknown> = {
183
14
  /**
184
15
  * Exit (unmount)
185
16
  */
186
17
  readonly exit: (error?: Error) => void;
187
- readonly meta: TMeta$1;
18
+ readonly meta: TMeta;
188
19
  };
189
- type Props$4<TMeta$1 = unknown> = {
20
+ type Props$4<TMeta = unknown> = {
190
21
  readonly children?: KubbNode;
191
- readonly meta: TMeta$1;
22
+ readonly meta: TMeta;
192
23
  };
193
- declare function App<TMeta$1 = unknown>({
24
+ declare function App<TMeta = unknown>({
194
25
  meta,
195
26
  children
196
- }: Props$4<TMeta$1>): react_jsx_runtime0.JSX.Element;
27
+ }: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
197
28
  declare namespace App {
198
29
  var Context: react1.Context<AppContextProps<unknown> | undefined>;
199
30
  var displayName: string;
@@ -237,7 +68,7 @@ declare namespace Const {
237
68
  }
238
69
  //#endregion
239
70
  //#region src/components/File.d.ts
240
- type FileContextProps<TMeta$1 extends object = object> = {
71
+ type FileContextProps<TMeta extends object = object> = {
241
72
  /**
242
73
  * Name to be used to dynamicly create the baseName(based on input.path).
243
74
  * Based on UNIX basename
@@ -248,7 +79,7 @@ type FileContextProps<TMeta$1 extends object = object> = {
248
79
  * Path will be full qualified path to a specified file.
249
80
  */
250
81
  path: Path;
251
- meta?: TMeta$1;
82
+ meta?: TMeta;
252
83
  };
253
84
  type BasePropsWithBaseName = {
254
85
  /**
@@ -270,17 +101,17 @@ type BasePropsWithoutBaseName = {
270
101
  path?: Path;
271
102
  };
272
103
  type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
273
- type Props$2<TMeta$1> = BaseProps & {
104
+ type Props$2<TMeta> = BaseProps & {
274
105
  key?: Key;
275
- meta?: TMeta$1;
106
+ meta?: TMeta;
276
107
  banner?: string;
277
108
  footer?: string;
278
109
  children?: KubbNode;
279
110
  };
280
- declare function File<TMeta$1 extends object = object>({
111
+ declare function File<TMeta extends object = object>({
281
112
  children,
282
113
  ...rest
283
- }: Props$2<TMeta$1>): react_jsx_runtime0.JSX.Element;
114
+ }: Props$2<TMeta>): react_jsx_runtime0.JSX.Element;
284
115
  declare namespace File {
285
116
  var displayName: string;
286
117
  var Export: typeof FileExport;
@@ -444,25 +275,11 @@ declare namespace Type {
444
275
  var displayName: string;
445
276
  }
446
277
  //#endregion
447
- //#region src/ReactTemplate.d.ts
448
- type ReactAppContext = AppContext<{
449
- stdout?: NodeJS.WriteStream;
450
- stdin?: NodeJS.ReadStream;
451
- stderr?: NodeJS.WriteStream;
452
- /**
453
- * Set this to true to always see the result of the render in the console(line per render)
454
- */
455
- debug?: boolean;
456
- }>;
457
- //#endregion
458
- //#region src/createApp.d.ts
459
- declare const createApp: DefineApp<ReactAppContext>;
460
- //#endregion
461
278
  //#region src/composables/useApp.d.ts
462
279
  /**
463
280
  * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
464
281
  */
465
- declare function useApp<TMeta$1 = unknown>(): AppContextProps<TMeta$1>;
282
+ declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
466
283
  //#endregion
467
284
  //#region src/composables/useFile.d.ts
468
285
  /**
@@ -478,6 +295,37 @@ declare function useLifecycle(): {
478
295
  exit: () => void;
479
296
  };
480
297
  //#endregion
298
+ //#region ../fabric-core/src/createApp.d.ts
299
+ declare const createApp: DefineApp<unknown>;
300
+ //#endregion
301
+ //#region src/Runtime.d.ts
302
+ type Options = {
303
+ fileManager: FileManager;
304
+ stdout?: NodeJS.WriteStream;
305
+ stdin?: NodeJS.ReadStream;
306
+ stderr?: NodeJS.WriteStream;
307
+ /**
308
+ * Set this to true to always see the result of the render in the console(line per render)
309
+ */
310
+ debug?: boolean;
311
+ };
312
+ declare class Runtime {
313
+ #private;
314
+ exitPromise?: Promise<void>;
315
+ constructor(options: Options);
316
+ get fileManager(): FileManager;
317
+ resolveExitPromise: () => void;
318
+ rejectExitPromise: (reason?: Error) => void;
319
+ unsubscribeExit: () => void;
320
+ onRender: () => void;
321
+ onError(error: Error): void;
322
+ onExit(error?: Error): void;
323
+ render(node: ReactNode): void;
324
+ renderToString(node: ReactNode): Promise<string>;
325
+ unmount(error?: Error | number | null): void;
326
+ waitUntilExit(): Promise<void>;
327
+ }
328
+ //#endregion
481
329
  //#region src/index.d.ts
482
330
  declare const createContext: typeof react1.createContext;
483
331
  declare const createElement: typeof react1.createElement;
@@ -488,5 +336,5 @@ declare const useRef: typeof react1.useRef;
488
336
  declare const use: typeof react1.use;
489
337
  declare const useReducer: typeof react1.useReducer;
490
338
  //#endregion
491
- export { App, Const, File, Function, FunctionParams, Indent, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
339
+ export { App, Const, File, Function, FunctionParams, Indent, Runtime, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
492
340
  //# sourceMappingURL=index.d.ts.map