@kubb/react-fabric 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +162 -39
- package/dist/index.d.ts +162 -39
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ReactTemplate.tsx +3 -3
- package/src/createApp.ts +3 -3
- package/src/utils/processFiles.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,73 +4,196 @@ import * as react1 from "react";
|
|
|
4
4
|
import React, { ReactNode } from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
|
-
//#region ../fabric-core/src/
|
|
8
|
-
type
|
|
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>;
|
|
9
51
|
extension?: Record<Extname, Extname | ''>;
|
|
10
52
|
dryRun?: boolean;
|
|
11
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
|
+
};
|
|
12
82
|
declare class FileManager {
|
|
13
83
|
#private;
|
|
14
|
-
|
|
84
|
+
processor: FileProcessor;
|
|
85
|
+
constructor({
|
|
86
|
+
events
|
|
87
|
+
}?: Options);
|
|
15
88
|
add(...files: Array<File$1>): Promise<ResolvedFile<object>[]>;
|
|
16
89
|
flush(): void;
|
|
17
90
|
getByPath(path: Path): ResolvedFile | null;
|
|
18
91
|
deleteByPath(path: Path): void;
|
|
19
92
|
clear(): void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
dryRun,
|
|
23
|
-
extension
|
|
24
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
93
|
+
get files(): Array<ResolvedFile>;
|
|
94
|
+
write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
|
|
25
95
|
}
|
|
26
96
|
//#endregion
|
|
27
|
-
//#region ../fabric-core/src/
|
|
97
|
+
//#region ../fabric-core/src/App.d.ts
|
|
28
98
|
type Component = any;
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
}];
|
|
32
157
|
};
|
|
33
|
-
type
|
|
34
|
-
|
|
35
|
-
|
|
158
|
+
type AppContext<TOptions$1 = unknown> = {
|
|
159
|
+
options?: TOptions$1;
|
|
160
|
+
events: AsyncEventEmitter<AppEvents>;
|
|
36
161
|
fileManager: FileManager;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
clear: () => void;
|
|
40
|
-
};
|
|
41
|
-
type Plugin<Options$1 = any[], P extends unknown[] = (Options$1 extends unknown[] ? Options$1 : [Options$1])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
42
|
-
type WriteOptions = {
|
|
43
|
-
extension?: Record<Extname, Extname | ''>;
|
|
44
|
-
dryRun?: boolean;
|
|
162
|
+
installedPlugins: Set<Plugin>;
|
|
163
|
+
installedParsers: Set<Parser>;
|
|
45
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>;
|
|
46
167
|
interface App$1 {
|
|
47
168
|
_component: Component;
|
|
48
169
|
render(): Promise<void>;
|
|
49
170
|
renderToString(): Promise<string>;
|
|
50
|
-
|
|
51
|
-
use<
|
|
52
|
-
|
|
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;
|
|
53
174
|
addFile(...files: Array<File$1>): Promise<void>;
|
|
54
175
|
waitUntilExit(): Promise<void>;
|
|
55
176
|
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../fabric-core/src/defineApp.d.ts
|
|
56
179
|
type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App$1;
|
|
57
180
|
//#endregion
|
|
58
181
|
//#region src/components/App.d.ts
|
|
59
|
-
type AppContextProps<TMeta = unknown> = {
|
|
182
|
+
type AppContextProps<TMeta$1 = unknown> = {
|
|
60
183
|
/**
|
|
61
184
|
* Exit (unmount)
|
|
62
185
|
*/
|
|
63
186
|
readonly exit: (error?: Error) => void;
|
|
64
|
-
readonly meta: TMeta;
|
|
187
|
+
readonly meta: TMeta$1;
|
|
65
188
|
};
|
|
66
|
-
type Props$4<TMeta = unknown> = {
|
|
189
|
+
type Props$4<TMeta$1 = unknown> = {
|
|
67
190
|
readonly children?: KubbNode;
|
|
68
|
-
readonly meta: TMeta;
|
|
191
|
+
readonly meta: TMeta$1;
|
|
69
192
|
};
|
|
70
|
-
declare function App<TMeta = unknown>({
|
|
193
|
+
declare function App<TMeta$1 = unknown>({
|
|
71
194
|
meta,
|
|
72
195
|
children
|
|
73
|
-
}: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
196
|
+
}: Props$4<TMeta$1>): react_jsx_runtime0.JSX.Element;
|
|
74
197
|
declare namespace App {
|
|
75
198
|
var Context: react1.Context<AppContextProps<unknown> | undefined>;
|
|
76
199
|
var displayName: string;
|
|
@@ -114,7 +237,7 @@ declare namespace Const {
|
|
|
114
237
|
}
|
|
115
238
|
//#endregion
|
|
116
239
|
//#region src/components/File.d.ts
|
|
117
|
-
type FileContextProps<TMeta extends object = object> = {
|
|
240
|
+
type FileContextProps<TMeta$1 extends object = object> = {
|
|
118
241
|
/**
|
|
119
242
|
* Name to be used to dynamicly create the baseName(based on input.path).
|
|
120
243
|
* Based on UNIX basename
|
|
@@ -125,7 +248,7 @@ type FileContextProps<TMeta extends object = object> = {
|
|
|
125
248
|
* Path will be full qualified path to a specified file.
|
|
126
249
|
*/
|
|
127
250
|
path: Path;
|
|
128
|
-
meta?: TMeta;
|
|
251
|
+
meta?: TMeta$1;
|
|
129
252
|
};
|
|
130
253
|
type BasePropsWithBaseName = {
|
|
131
254
|
/**
|
|
@@ -147,17 +270,17 @@ type BasePropsWithoutBaseName = {
|
|
|
147
270
|
path?: Path;
|
|
148
271
|
};
|
|
149
272
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
150
|
-
type Props$2<TMeta> = BaseProps & {
|
|
273
|
+
type Props$2<TMeta$1> = BaseProps & {
|
|
151
274
|
key?: Key;
|
|
152
|
-
meta?: TMeta;
|
|
275
|
+
meta?: TMeta$1;
|
|
153
276
|
banner?: string;
|
|
154
277
|
footer?: string;
|
|
155
278
|
children?: KubbNode;
|
|
156
279
|
};
|
|
157
|
-
declare function File<TMeta extends object = object>({
|
|
280
|
+
declare function File<TMeta$1 extends object = object>({
|
|
158
281
|
children,
|
|
159
282
|
...rest
|
|
160
|
-
}: Props$2<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
283
|
+
}: Props$2<TMeta$1>): react_jsx_runtime0.JSX.Element;
|
|
161
284
|
declare namespace File {
|
|
162
285
|
var displayName: string;
|
|
163
286
|
var Export: typeof FileExport;
|
|
@@ -339,7 +462,7 @@ declare const createApp: DefineApp<ReactAppContext>;
|
|
|
339
462
|
/**
|
|
340
463
|
* `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
|
|
341
464
|
*/
|
|
342
|
-
declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
|
|
465
|
+
declare function useApp<TMeta$1 = unknown>(): AppContextProps<TMeta$1>;
|
|
343
466
|
//#endregion
|
|
344
467
|
//#region src/composables/useFile.d.ts
|
|
345
468
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -4,73 +4,196 @@ import * as react1 from "react";
|
|
|
4
4
|
import React, { ReactNode } from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
|
-
//#region ../fabric-core/src/
|
|
8
|
-
type
|
|
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>;
|
|
9
51
|
extension?: Record<Extname, Extname | ''>;
|
|
10
52
|
dryRun?: boolean;
|
|
11
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
|
+
};
|
|
12
82
|
declare class FileManager {
|
|
13
83
|
#private;
|
|
14
|
-
|
|
84
|
+
processor: FileProcessor;
|
|
85
|
+
constructor({
|
|
86
|
+
events
|
|
87
|
+
}?: Options);
|
|
15
88
|
add(...files: Array<File$1>): Promise<ResolvedFile<object>[]>;
|
|
16
89
|
flush(): void;
|
|
17
90
|
getByPath(path: Path): ResolvedFile | null;
|
|
18
91
|
deleteByPath(path: Path): void;
|
|
19
92
|
clear(): void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
dryRun,
|
|
23
|
-
extension
|
|
24
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
93
|
+
get files(): Array<ResolvedFile>;
|
|
94
|
+
write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
|
|
25
95
|
}
|
|
26
96
|
//#endregion
|
|
27
|
-
//#region ../fabric-core/src/
|
|
97
|
+
//#region ../fabric-core/src/App.d.ts
|
|
28
98
|
type Component = any;
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
}];
|
|
32
157
|
};
|
|
33
|
-
type
|
|
34
|
-
|
|
35
|
-
|
|
158
|
+
type AppContext<TOptions$1 = unknown> = {
|
|
159
|
+
options?: TOptions$1;
|
|
160
|
+
events: AsyncEventEmitter<AppEvents>;
|
|
36
161
|
fileManager: FileManager;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
clear: () => void;
|
|
40
|
-
};
|
|
41
|
-
type Plugin<Options$1 = any[], P extends unknown[] = (Options$1 extends unknown[] ? Options$1 : [Options$1])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
42
|
-
type WriteOptions = {
|
|
43
|
-
extension?: Record<Extname, Extname | ''>;
|
|
44
|
-
dryRun?: boolean;
|
|
162
|
+
installedPlugins: Set<Plugin>;
|
|
163
|
+
installedParsers: Set<Parser>;
|
|
45
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>;
|
|
46
167
|
interface App$1 {
|
|
47
168
|
_component: Component;
|
|
48
169
|
render(): Promise<void>;
|
|
49
170
|
renderToString(): Promise<string>;
|
|
50
|
-
|
|
51
|
-
use<
|
|
52
|
-
|
|
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;
|
|
53
174
|
addFile(...files: Array<File$1>): Promise<void>;
|
|
54
175
|
waitUntilExit(): Promise<void>;
|
|
55
176
|
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../fabric-core/src/defineApp.d.ts
|
|
56
179
|
type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App$1;
|
|
57
180
|
//#endregion
|
|
58
181
|
//#region src/components/App.d.ts
|
|
59
|
-
type AppContextProps<TMeta = unknown> = {
|
|
182
|
+
type AppContextProps<TMeta$1 = unknown> = {
|
|
60
183
|
/**
|
|
61
184
|
* Exit (unmount)
|
|
62
185
|
*/
|
|
63
186
|
readonly exit: (error?: Error) => void;
|
|
64
|
-
readonly meta: TMeta;
|
|
187
|
+
readonly meta: TMeta$1;
|
|
65
188
|
};
|
|
66
|
-
type Props$4<TMeta = unknown> = {
|
|
189
|
+
type Props$4<TMeta$1 = unknown> = {
|
|
67
190
|
readonly children?: KubbNode;
|
|
68
|
-
readonly meta: TMeta;
|
|
191
|
+
readonly meta: TMeta$1;
|
|
69
192
|
};
|
|
70
|
-
declare function App<TMeta = unknown>({
|
|
193
|
+
declare function App<TMeta$1 = unknown>({
|
|
71
194
|
meta,
|
|
72
195
|
children
|
|
73
|
-
}: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
196
|
+
}: Props$4<TMeta$1>): react_jsx_runtime0.JSX.Element;
|
|
74
197
|
declare namespace App {
|
|
75
198
|
var Context: react1.Context<AppContextProps<unknown> | undefined>;
|
|
76
199
|
var displayName: string;
|
|
@@ -114,7 +237,7 @@ declare namespace Const {
|
|
|
114
237
|
}
|
|
115
238
|
//#endregion
|
|
116
239
|
//#region src/components/File.d.ts
|
|
117
|
-
type FileContextProps<TMeta extends object = object> = {
|
|
240
|
+
type FileContextProps<TMeta$1 extends object = object> = {
|
|
118
241
|
/**
|
|
119
242
|
* Name to be used to dynamicly create the baseName(based on input.path).
|
|
120
243
|
* Based on UNIX basename
|
|
@@ -125,7 +248,7 @@ type FileContextProps<TMeta extends object = object> = {
|
|
|
125
248
|
* Path will be full qualified path to a specified file.
|
|
126
249
|
*/
|
|
127
250
|
path: Path;
|
|
128
|
-
meta?: TMeta;
|
|
251
|
+
meta?: TMeta$1;
|
|
129
252
|
};
|
|
130
253
|
type BasePropsWithBaseName = {
|
|
131
254
|
/**
|
|
@@ -147,17 +270,17 @@ type BasePropsWithoutBaseName = {
|
|
|
147
270
|
path?: Path;
|
|
148
271
|
};
|
|
149
272
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
150
|
-
type Props$2<TMeta> = BaseProps & {
|
|
273
|
+
type Props$2<TMeta$1> = BaseProps & {
|
|
151
274
|
key?: Key;
|
|
152
|
-
meta?: TMeta;
|
|
275
|
+
meta?: TMeta$1;
|
|
153
276
|
banner?: string;
|
|
154
277
|
footer?: string;
|
|
155
278
|
children?: KubbNode;
|
|
156
279
|
};
|
|
157
|
-
declare function File<TMeta extends object = object>({
|
|
280
|
+
declare function File<TMeta$1 extends object = object>({
|
|
158
281
|
children,
|
|
159
282
|
...rest
|
|
160
|
-
}: Props$2<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
283
|
+
}: Props$2<TMeta$1>): react_jsx_runtime0.JSX.Element;
|
|
161
284
|
declare namespace File {
|
|
162
285
|
var displayName: string;
|
|
163
286
|
var Export: typeof FileExport;
|
|
@@ -339,7 +462,7 @@ declare const createApp: DefineApp<ReactAppContext>;
|
|
|
339
462
|
/**
|
|
340
463
|
* `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
|
|
341
464
|
*/
|
|
342
|
-
declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
|
|
465
|
+
declare function useApp<TMeta$1 = unknown>(): AppContextProps<TMeta$1>;
|
|
343
466
|
//#endregion
|
|
344
467
|
//#region src/composables/useFile.d.ts
|
|
345
468
|
/**
|
package/dist/index.js
CHANGED
|
@@ -15546,7 +15546,7 @@ function processFiles(node, context) {
|
|
|
15546
15546
|
footer: attributes.footer,
|
|
15547
15547
|
banner: attributes.banner
|
|
15548
15548
|
};
|
|
15549
|
-
context.
|
|
15549
|
+
context.fileManager.add(file);
|
|
15550
15550
|
}
|
|
15551
15551
|
}
|
|
15552
15552
|
}
|
|
@@ -15611,7 +15611,7 @@ var ReactTemplate = class {
|
|
|
15611
15611
|
_defineProperty(this, "onRender", async () => {
|
|
15612
15612
|
var _classPrivateFieldGet2$1, _classPrivateFieldGet3, _classPrivateFieldGet4, _classPrivateFieldGet5;
|
|
15613
15613
|
if (_classPrivateFieldGet2(_isUnmounted, this)) return;
|
|
15614
|
-
_classPrivateFieldGet2(_context, this).clear();
|
|
15614
|
+
_classPrivateFieldGet2(_context, this).fileManager.clear();
|
|
15615
15615
|
processFiles(_classPrivateFieldGet2(_rootNode, this), _classPrivateFieldGet2(_context, this));
|
|
15616
15616
|
if (!((_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_context, this).options) === null || _classPrivateFieldGet2$1 === void 0 ? void 0 : _classPrivateFieldGet2$1.debug) && !((_classPrivateFieldGet3 = _classPrivateFieldGet2(_context, this).options) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.stdout)) return;
|
|
15617
15617
|
const output = await _assertClassBrand(_ReactTemplate_brand, this, _getOutput).call(this, _classPrivateFieldGet2(_rootNode, this), _classPrivateFieldGet2(_context, this));
|
|
@@ -15684,7 +15684,7 @@ var ReactTemplate = class {
|
|
|
15684
15684
|
});
|
|
15685
15685
|
KubbRenderer.updateContainerSync(element, _classPrivateFieldGet2(_container, this), null, null);
|
|
15686
15686
|
KubbRenderer.flushSyncWork();
|
|
15687
|
-
_classPrivateFieldGet2(_context, this).clear();
|
|
15687
|
+
_classPrivateFieldGet2(_context, this).fileManager.clear();
|
|
15688
15688
|
return _assertClassBrand(_ReactTemplate_brand, this, _getOutput).call(this, _classPrivateFieldGet2(_rootNode, this), _classPrivateFieldGet2(_context, this));
|
|
15689
15689
|
}
|
|
15690
15690
|
unmount(error) {
|
|
@@ -15711,20 +15711,20 @@ var ReactTemplate = class {
|
|
|
15711
15711
|
};
|
|
15712
15712
|
async function _getOutput(node, context) {
|
|
15713
15713
|
const text = squashTextNodes(node);
|
|
15714
|
-
const files = context.files;
|
|
15714
|
+
const files = context.fileManager.files;
|
|
15715
15715
|
return files.length ? [...files].flatMap((file) => [...file.sources].map((item) => item.value)).filter(Boolean).join("\n\n") : text;
|
|
15716
15716
|
}
|
|
15717
15717
|
|
|
15718
15718
|
//#endregion
|
|
15719
15719
|
//#region src/createApp.ts
|
|
15720
|
-
const createApp = defineApp((
|
|
15720
|
+
const createApp = defineApp((App$1, context) => {
|
|
15721
15721
|
const template = new ReactTemplate(context);
|
|
15722
15722
|
return {
|
|
15723
15723
|
render() {
|
|
15724
|
-
template.render((0, import_react.createElement)(
|
|
15724
|
+
template.render((0, import_react.createElement)(App$1));
|
|
15725
15725
|
},
|
|
15726
15726
|
async renderToString() {
|
|
15727
|
-
return template.renderToString((0, import_react.createElement)(
|
|
15727
|
+
return template.renderToString((0, import_react.createElement)(App$1));
|
|
15728
15728
|
},
|
|
15729
15729
|
waitUntilExit() {
|
|
15730
15730
|
return template.waitUntilExit();
|