@kubb/react-fabric 0.1.3 → 0.1.5

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 (61) hide show
  1. package/dist/App-BSJU0vg2.d.ts +177 -0
  2. package/dist/App-Cdnk4C-T.d.cts +177 -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-CmpwGMfo.js +15482 -0
  6. package/dist/Runtime-CmpwGMfo.js.map +1 -0
  7. package/dist/Runtime-DuxjdecG.cjs +15520 -0
  8. package/dist/Runtime-DuxjdecG.cjs.map +1 -0
  9. package/dist/devtools.cjs +5 -5
  10. package/dist/devtools.cjs.map +1 -1
  11. package/dist/devtools.js +5 -5
  12. package/dist/devtools.js.map +1 -1
  13. package/dist/globals-BRG2DOJd.d.cts +52 -0
  14. package/dist/globals-D_1Lfe9-.d.ts +52 -0
  15. package/dist/globals.d.cts +3 -2
  16. package/dist/globals.d.ts +3 -2
  17. package/dist/index.cjs +152 -15637
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +49 -201
  20. package/dist/index.d.ts +49 -201
  21. package/dist/index.js +7 -15495
  22. package/dist/index.js.map +1 -1
  23. package/dist/{jsx-runtime-B3MMb3PL.cjs → jsx-runtime-CxtdoFyp.cjs} +8 -8
  24. package/dist/jsx-runtime-CxtdoFyp.cjs.map +1 -0
  25. package/dist/{jsx-runtime-BPQkRAg2.js → jsx-runtime-dzWW5eHB.js} +8 -8
  26. package/dist/jsx-runtime-dzWW5eHB.js.map +1 -0
  27. package/dist/jsx-runtime.cjs +2 -2
  28. package/dist/jsx-runtime.d.cts +3 -2
  29. package/dist/jsx-runtime.d.ts +3 -2
  30. package/dist/jsx-runtime.js +2 -2
  31. package/dist/parsers.cjs +9 -0
  32. package/dist/parsers.d.cts +18 -0
  33. package/dist/parsers.d.ts +18 -0
  34. package/dist/parsers.js +3 -0
  35. package/dist/plugins.cjs +40 -0
  36. package/dist/plugins.cjs.map +1 -0
  37. package/dist/plugins.d.cts +74 -0
  38. package/dist/plugins.d.ts +74 -0
  39. package/dist/plugins.js +34 -0
  40. package/dist/plugins.js.map +1 -0
  41. package/dist/{react-BBkwFtZV.js → react-DA-4hb8R.js} +7 -7
  42. package/dist/react-DA-4hb8R.js.map +1 -0
  43. package/dist/{react-Bq0UOw6S.cjs → react-m108td-u.cjs} +7 -7
  44. package/dist/react-m108td-u.cjs.map +1 -0
  45. package/dist/{types-D9OfSq91.d.ts → types-Brnyan9B.d.ts} +1 -1
  46. package/dist/{types-CUKR3KZn.d.cts → types-C3p0Ljxf.d.cts} +1 -1
  47. package/dist/types.d.cts +1 -1
  48. package/dist/types.d.ts +1 -1
  49. package/package.json +16 -2
  50. package/src/{kubbRenderer.ts → Renderer.ts} +1 -1
  51. package/src/{ReactTemplate.tsx → Runtime.tsx} +36 -30
  52. package/src/index.ts +9 -1
  53. package/src/parsers/index.ts +1 -0
  54. package/src/plugins/index.ts +3 -0
  55. package/src/plugins/reactPlugin.ts +59 -0
  56. package/src/utils/processFiles.ts +5 -4
  57. package/dist/jsx-runtime-B3MMb3PL.cjs.map +0 -1
  58. package/dist/jsx-runtime-BPQkRAg2.js.map +0 -1
  59. package/dist/react-BBkwFtZV.js.map +0 -1
  60. package/dist/react-Bq0UOw6S.cjs.map +0 -1
  61. package/src/createApp.ts +0 -19
package/dist/index.d.cts CHANGED
@@ -1,199 +1,33 @@
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-Cdnk4C-T.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
- extension?: Record<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
- extension
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
- }
9
+ //#region ../fabric-core/src/createApp.d.ts
10
+ declare const createApp: DefineApp<unknown>;
177
11
  //#endregion
178
12
  //#region ../fabric-core/src/defineApp.d.ts
179
- type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App$1;
13
+ type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App$1;
180
14
  //#endregion
181
15
  //#region src/components/App.d.ts
182
- type AppContextProps<TMeta$1 = unknown> = {
16
+ type AppContextProps<TMeta = unknown> = {
183
17
  /**
184
18
  * Exit (unmount)
185
19
  */
186
20
  readonly exit: (error?: Error) => void;
187
- readonly meta: TMeta$1;
21
+ readonly meta: TMeta;
188
22
  };
189
- type Props$4<TMeta$1 = unknown> = {
23
+ type Props$4<TMeta = unknown> = {
190
24
  readonly children?: KubbNode;
191
- readonly meta: TMeta$1;
25
+ readonly meta: TMeta;
192
26
  };
193
- declare function App<TMeta$1 = unknown>({
27
+ declare function App<TMeta = unknown>({
194
28
  meta,
195
29
  children
196
- }: Props$4<TMeta$1>): react_jsx_runtime0.JSX.Element;
30
+ }: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
197
31
  declare namespace App {
198
32
  var Context: react1.Context<AppContextProps<unknown> | undefined>;
199
33
  var displayName: string;
@@ -237,7 +71,7 @@ declare namespace Const {
237
71
  }
238
72
  //#endregion
239
73
  //#region src/components/File.d.ts
240
- type FileContextProps<TMeta$1 extends object = object> = {
74
+ type FileContextProps<TMeta extends object = object> = {
241
75
  /**
242
76
  * Name to be used to dynamicly create the baseName(based on input.path).
243
77
  * Based on UNIX basename
@@ -248,7 +82,7 @@ type FileContextProps<TMeta$1 extends object = object> = {
248
82
  * Path will be full qualified path to a specified file.
249
83
  */
250
84
  path: Path;
251
- meta?: TMeta$1;
85
+ meta?: TMeta;
252
86
  };
253
87
  type BasePropsWithBaseName = {
254
88
  /**
@@ -270,17 +104,17 @@ type BasePropsWithoutBaseName = {
270
104
  path?: Path;
271
105
  };
272
106
  type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
273
- type Props$2<TMeta$1> = BaseProps & {
107
+ type Props$2<TMeta> = BaseProps & {
274
108
  key?: Key;
275
- meta?: TMeta$1;
109
+ meta?: TMeta;
276
110
  banner?: string;
277
111
  footer?: string;
278
112
  children?: KubbNode;
279
113
  };
280
- declare function File<TMeta$1 extends object = object>({
114
+ declare function File<TMeta extends object = object>({
281
115
  children,
282
116
  ...rest
283
- }: Props$2<TMeta$1>): react_jsx_runtime0.JSX.Element;
117
+ }: Props$2<TMeta>): react_jsx_runtime0.JSX.Element;
284
118
  declare namespace File {
285
119
  var displayName: string;
286
120
  var Export: typeof FileExport;
@@ -444,25 +278,11 @@ declare namespace Type {
444
278
  var displayName: string;
445
279
  }
446
280
  //#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
281
  //#region src/composables/useApp.d.ts
462
282
  /**
463
283
  * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
464
284
  */
465
- declare function useApp<TMeta$1 = unknown>(): AppContextProps<TMeta$1>;
285
+ declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
466
286
  //#endregion
467
287
  //#region src/composables/useFile.d.ts
468
288
  /**
@@ -478,6 +298,34 @@ declare function useLifecycle(): {
478
298
  exit: () => void;
479
299
  };
480
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,33 @@
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-BSJU0vg2.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
- extension?: Record<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
- extension
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
- }
9
+ //#region ../fabric-core/src/createApp.d.ts
10
+ declare const createApp: DefineApp<unknown>;
177
11
  //#endregion
178
12
  //#region ../fabric-core/src/defineApp.d.ts
179
- type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App$1;
13
+ type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App$1;
180
14
  //#endregion
181
15
  //#region src/components/App.d.ts
182
- type AppContextProps<TMeta$1 = unknown> = {
16
+ type AppContextProps<TMeta = unknown> = {
183
17
  /**
184
18
  * Exit (unmount)
185
19
  */
186
20
  readonly exit: (error?: Error) => void;
187
- readonly meta: TMeta$1;
21
+ readonly meta: TMeta;
188
22
  };
189
- type Props$4<TMeta$1 = unknown> = {
23
+ type Props$4<TMeta = unknown> = {
190
24
  readonly children?: KubbNode;
191
- readonly meta: TMeta$1;
25
+ readonly meta: TMeta;
192
26
  };
193
- declare function App<TMeta$1 = unknown>({
27
+ declare function App<TMeta = unknown>({
194
28
  meta,
195
29
  children
196
- }: Props$4<TMeta$1>): react_jsx_runtime0.JSX.Element;
30
+ }: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
197
31
  declare namespace App {
198
32
  var Context: react1.Context<AppContextProps<unknown> | undefined>;
199
33
  var displayName: string;
@@ -237,7 +71,7 @@ declare namespace Const {
237
71
  }
238
72
  //#endregion
239
73
  //#region src/components/File.d.ts
240
- type FileContextProps<TMeta$1 extends object = object> = {
74
+ type FileContextProps<TMeta extends object = object> = {
241
75
  /**
242
76
  * Name to be used to dynamicly create the baseName(based on input.path).
243
77
  * Based on UNIX basename
@@ -248,7 +82,7 @@ type FileContextProps<TMeta$1 extends object = object> = {
248
82
  * Path will be full qualified path to a specified file.
249
83
  */
250
84
  path: Path;
251
- meta?: TMeta$1;
85
+ meta?: TMeta;
252
86
  };
253
87
  type BasePropsWithBaseName = {
254
88
  /**
@@ -270,17 +104,17 @@ type BasePropsWithoutBaseName = {
270
104
  path?: Path;
271
105
  };
272
106
  type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
273
- type Props$2<TMeta$1> = BaseProps & {
107
+ type Props$2<TMeta> = BaseProps & {
274
108
  key?: Key;
275
- meta?: TMeta$1;
109
+ meta?: TMeta;
276
110
  banner?: string;
277
111
  footer?: string;
278
112
  children?: KubbNode;
279
113
  };
280
- declare function File<TMeta$1 extends object = object>({
114
+ declare function File<TMeta extends object = object>({
281
115
  children,
282
116
  ...rest
283
- }: Props$2<TMeta$1>): react_jsx_runtime0.JSX.Element;
117
+ }: Props$2<TMeta>): react_jsx_runtime0.JSX.Element;
284
118
  declare namespace File {
285
119
  var displayName: string;
286
120
  var Export: typeof FileExport;
@@ -444,25 +278,11 @@ declare namespace Type {
444
278
  var displayName: string;
445
279
  }
446
280
  //#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
281
  //#region src/composables/useApp.d.ts
462
282
  /**
463
283
  * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
464
284
  */
465
- declare function useApp<TMeta$1 = unknown>(): AppContextProps<TMeta$1>;
285
+ declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
466
286
  //#endregion
467
287
  //#region src/composables/useFile.d.ts
468
288
  /**
@@ -478,6 +298,34 @@ declare function useLifecycle(): {
478
298
  exit: () => void;
479
299
  };
480
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