@kubb/react-fabric 0.1.6 → 0.1.8

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.
@@ -49,6 +49,10 @@ type ProcessFilesProps = {
49
49
  parsers?: Set<Parser>;
50
50
  extension?: Record<Extname, Extname | ''>;
51
51
  dryRun?: boolean;
52
+ /**
53
+ * @default 'sequential'
54
+ */
55
+ mode?: AppMode;
52
56
  };
53
57
  type GetParseOptions = {
54
58
  parsers?: Set<Parser>;
@@ -69,6 +73,7 @@ declare class FileProcessor {
69
73
  }?: GetParseOptions): Promise<string>;
70
74
  run(files: Array<ResolvedFile>, {
71
75
  parsers,
76
+ mode,
72
77
  dryRun,
73
78
  extension
74
79
  }?: ProcessFilesProps): Promise<ResolvedFile[]>;
@@ -100,7 +105,12 @@ declare global {
100
105
  interface App {}
101
106
  }
102
107
  }
103
- type Component = any;
108
+ type AppOptions = {
109
+ /**
110
+ * @default 'sequential'
111
+ */
112
+ mode?: AppMode;
113
+ };
104
114
  type AppEvents = {
105
115
  /**
106
116
  * Called in the beginning of the app lifecycle.
@@ -122,6 +132,18 @@ type AppEvents = {
122
132
  'process:start': [{
123
133
  files: ResolvedFile[];
124
134
  }];
135
+ /**
136
+ * Called when FileManager is adding files to its cache
137
+ */
138
+ 'file:add': [{
139
+ files: ResolvedFile[];
140
+ }];
141
+ 'write:start': [{
142
+ files: ResolvedFile[];
143
+ }];
144
+ 'write:end': [{
145
+ files: ResolvedFile[];
146
+ }];
125
147
  /**
126
148
  * Called for each file when processing begins.
127
149
  */
@@ -146,7 +168,7 @@ type AppEvents = {
146
168
  processed: number;
147
169
  total: number;
148
170
  percentage: number;
149
- source: string;
171
+ source?: string;
150
172
  file: ResolvedFile;
151
173
  }];
152
174
  /**
@@ -156,22 +178,23 @@ type AppEvents = {
156
178
  files: ResolvedFile[];
157
179
  }];
158
180
  };
159
- type AppContext<TOptions = unknown> = {
181
+ type AppContext<TOptions extends AppOptions> = {
160
182
  options?: TOptions;
161
183
  events: AsyncEventEmitter<AppEvents>;
162
184
  fileManager: FileManager;
163
185
  installedPlugins: Set<Plugin>;
164
186
  installedParsers: Set<Parser>;
165
187
  };
188
+ type AppMode = 'sequential' | 'parallel';
166
189
  type AllOptional<T> = {} extends T ? true : false;
167
190
  type Install<TOptions = unknown> = TOptions extends any[] ? (app: App, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => void | Promise<void> : (app: App, options: TOptions) => void | Promise<void>;
168
191
  type Inject<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => Partial<TAppExtension$1> : (app: App, options: TOptions) => Partial<TAppExtension$1>;
169
- interface App<TOptions = unknown> extends Kubb.App {
192
+ interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
170
193
  context: AppContext<TOptions>;
171
194
  files: Array<ResolvedFile>;
172
195
  use<TPluginOptions = unknown, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TPluginOptions, TAppExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TAppExtension) | Promise<this & TAppExtension>;
173
196
  addFile(...files: Array<File>): Promise<void>;
174
197
  }
175
198
  //#endregion
176
- export { UserParser as a, Parser as i, Component as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
177
- //# sourceMappingURL=App-Bqmn4Mqu.d.cts.map
199
+ export { UserParser as a, Parser as i, AppOptions as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
200
+ //# sourceMappingURL=App-CbT7rbmH.d.cts.map
@@ -49,6 +49,10 @@ type ProcessFilesProps = {
49
49
  parsers?: Set<Parser>;
50
50
  extension?: Record<Extname, Extname | ''>;
51
51
  dryRun?: boolean;
52
+ /**
53
+ * @default 'sequential'
54
+ */
55
+ mode?: AppMode;
52
56
  };
53
57
  type GetParseOptions = {
54
58
  parsers?: Set<Parser>;
@@ -69,6 +73,7 @@ declare class FileProcessor {
69
73
  }?: GetParseOptions): Promise<string>;
70
74
  run(files: Array<ResolvedFile>, {
71
75
  parsers,
76
+ mode,
72
77
  dryRun,
73
78
  extension
74
79
  }?: ProcessFilesProps): Promise<ResolvedFile[]>;
@@ -100,7 +105,12 @@ declare global {
100
105
  interface App {}
101
106
  }
102
107
  }
103
- type Component = any;
108
+ type AppOptions = {
109
+ /**
110
+ * @default 'sequential'
111
+ */
112
+ mode?: AppMode;
113
+ };
104
114
  type AppEvents = {
105
115
  /**
106
116
  * Called in the beginning of the app lifecycle.
@@ -122,6 +132,18 @@ type AppEvents = {
122
132
  'process:start': [{
123
133
  files: ResolvedFile[];
124
134
  }];
135
+ /**
136
+ * Called when FileManager is adding files to its cache
137
+ */
138
+ 'file:add': [{
139
+ files: ResolvedFile[];
140
+ }];
141
+ 'write:start': [{
142
+ files: ResolvedFile[];
143
+ }];
144
+ 'write:end': [{
145
+ files: ResolvedFile[];
146
+ }];
125
147
  /**
126
148
  * Called for each file when processing begins.
127
149
  */
@@ -146,7 +168,7 @@ type AppEvents = {
146
168
  processed: number;
147
169
  total: number;
148
170
  percentage: number;
149
- source: string;
171
+ source?: string;
150
172
  file: ResolvedFile;
151
173
  }];
152
174
  /**
@@ -156,22 +178,23 @@ type AppEvents = {
156
178
  files: ResolvedFile[];
157
179
  }];
158
180
  };
159
- type AppContext<TOptions = unknown> = {
181
+ type AppContext<TOptions extends AppOptions> = {
160
182
  options?: TOptions;
161
183
  events: AsyncEventEmitter<AppEvents>;
162
184
  fileManager: FileManager;
163
185
  installedPlugins: Set<Plugin>;
164
186
  installedParsers: Set<Parser>;
165
187
  };
188
+ type AppMode = 'sequential' | 'parallel';
166
189
  type AllOptional<T> = {} extends T ? true : false;
167
190
  type Install<TOptions = unknown> = TOptions extends any[] ? (app: App, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => void | Promise<void> : (app: App, options: TOptions) => void | Promise<void>;
168
191
  type Inject<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => Partial<TAppExtension$1> : (app: App, options: TOptions) => Partial<TAppExtension$1>;
169
- interface App<TOptions = unknown> extends Kubb.App {
192
+ interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
170
193
  context: AppContext<TOptions>;
171
194
  files: Array<ResolvedFile>;
172
195
  use<TPluginOptions = unknown, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TPluginOptions, TAppExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TAppExtension) | Promise<this & TAppExtension>;
173
196
  addFile(...files: Array<File>): Promise<void>;
174
197
  }
175
198
  //#endregion
176
- export { UserParser as a, Parser as i, Component as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
177
- //# sourceMappingURL=App-DLp9W8mB.d.ts.map
199
+ export { UserParser as a, Parser as i, AppOptions as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
200
+ //# sourceMappingURL=App-D7ehObix.d.ts.map
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
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-Bqmn4Mqu.cjs";
2
+ import { n as AppOptions, r as FileManager, t as App$1 } from "./App-CbT7rbmH.cjs";
3
3
  import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-C3p0Ljxf.cjs";
4
4
  import "./globals-BRG2DOJd.cjs";
5
5
  import * as react1 from "react";
@@ -7,10 +7,10 @@ import React, { ReactNode } from "react";
7
7
  import * as react_jsx_runtime0 from "react/jsx-runtime";
8
8
 
9
9
  //#region ../fabric-core/src/createApp.d.ts
10
- declare const createApp: DefineApp<unknown>;
10
+ declare const createApp: DefineApp<AppOptions>;
11
11
  //#endregion
12
12
  //#region ../fabric-core/src/defineApp.d.ts
13
- type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App$1;
13
+ type DefineApp<TOptions> = (options?: TOptions) => App$1;
14
14
  //#endregion
15
15
  //#region src/components/App.d.ts
16
16
  type AppContextProps<TMeta = unknown> = {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
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-DLp9W8mB.js";
2
+ import { n as AppOptions, r as FileManager, t as App$1 } from "./App-D7ehObix.js";
3
3
  import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-Brnyan9B.js";
4
4
  import "./globals-D_1Lfe9-.js";
5
5
  import * as react1 from "react";
@@ -7,10 +7,10 @@ import React, { ReactNode } from "react";
7
7
  import * as react_jsx_runtime0 from "react/jsx-runtime";
8
8
 
9
9
  //#region ../fabric-core/src/createApp.d.ts
10
- declare const createApp: DefineApp<unknown>;
10
+ declare const createApp: DefineApp<AppOptions>;
11
11
  //#endregion
12
12
  //#region ../fabric-core/src/defineApp.d.ts
13
- type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App$1;
13
+ type DefineApp<TOptions> = (options?: TOptions) => App$1;
14
14
  //#endregion
15
15
  //#region src/components/App.d.ts
16
16
  type AppContextProps<TMeta = unknown> = {
@@ -1,5 +1,5 @@
1
1
  import "./KubbFile-FGXV713i.cjs";
2
- import { a as UserParser, i as Parser } from "./App-Bqmn4Mqu.cjs";
2
+ import { a as UserParser, i as Parser } from "./App-CbT7rbmH.cjs";
3
3
 
4
4
  //#region ../fabric-core/src/parsers/createParser.d.ts
5
5
  declare function createParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta>;
package/dist/parsers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./KubbFile-D4gyyfL-.js";
2
- import { a as UserParser, i as Parser } from "./App-DLp9W8mB.js";
2
+ import { a as UserParser, i as Parser } from "./App-D7ehObix.js";
3
3
 
4
4
  //#region ../fabric-core/src/parsers/createParser.d.ts
5
5
  declare function createParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta>;
@@ -1,21 +1,21 @@
1
1
  import { r as Extname } from "./KubbFile-FGXV713i.cjs";
2
- import { o as Plugin, s as UserPlugin } from "./App-Bqmn4Mqu.cjs";
2
+ import { o as Plugin, s as UserPlugin } from "./App-CbT7rbmH.cjs";
3
3
  import { ElementType } from "react";
4
4
 
5
5
  //#region ../fabric-core/src/plugins/createPlugin.d.ts
6
- declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
6
+ declare function createPlugin<Options$4 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$4, TAppExtension>): Plugin<Options$4, TAppExtension>;
7
7
  //#endregion
8
8
  //#region ../fabric-core/src/plugins/fsPlugin.d.ts
9
9
  type WriteOptions = {
10
10
  extension?: Record<Extname, Extname | ''>;
11
- dryRun?: boolean;
12
11
  };
13
- type Options$2 = {
12
+ type Options$3 = {
13
+ dryRun?: boolean;
14
14
  /**
15
15
  * Optional callback that is invoked whenever a file is written by the plugin.
16
16
  * Useful for tests to observe write operations without spying on internal functions.
17
17
  */
18
- onWrite?: (path: string, data: string) => void | Promise<void>;
18
+ onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>;
19
19
  clean?: {
20
20
  path: string;
21
21
  };
@@ -35,30 +35,48 @@ declare global {
35
35
  }
36
36
  }
37
37
  }
38
- declare const fsPlugin: Plugin<Options$2, ExtendOptions$2>;
38
+ declare const fsPlugin: Plugin<Options$3, ExtendOptions$2>;
39
39
  //#endregion
40
40
  //#region ../fabric-core/src/plugins/barrelPlugin.d.ts
41
41
  type Mode = 'all' | 'named' | 'propagate' | false;
42
- type Options$1 = {
42
+ type Options$2 = {
43
+ root: string;
44
+ mode: Mode;
45
+ dryRun?: boolean;
46
+ };
47
+ type WriteEntryOptions = {
43
48
  root: string;
44
49
  mode: Mode;
45
50
  };
46
51
  type ExtendOptions$1 = {
47
- writeEntry(options: Options$1): Promise<void>;
52
+ writeEntry(options: WriteEntryOptions): Promise<void>;
48
53
  };
49
54
  declare module '@kubb/fabric-core' {
50
55
  interface App {
51
- writeEntry(options: Options$1): Promise<void>;
56
+ writeEntry(options: WriteEntryOptions): Promise<void>;
52
57
  }
53
58
  }
54
59
  declare global {
55
60
  namespace Kubb {
56
61
  interface App {
57
- writeEntry(options: Options$1): Promise<void>;
62
+ writeEntry(options: WriteEntryOptions): Promise<void>;
58
63
  }
59
64
  }
60
65
  }
61
- declare const barrelPlugin: Plugin<Options$1, ExtendOptions$1>;
66
+ declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
67
+ //#endregion
68
+ //#region ../fabric-core/src/plugins/progressPlugin.d.ts
69
+ declare const progressPlugin: Plugin<[], {}>;
70
+ //#endregion
71
+ //#region ../fabric-core/src/plugins/graphPlugin.d.ts
72
+ type Options$1 = {
73
+ root: string;
74
+ /**
75
+ * @default false
76
+ */
77
+ open?: boolean;
78
+ };
79
+ declare const graphPlugin: Plugin<Options$1, {}>;
62
80
  //#endregion
63
81
  //#region src/plugins/reactPlugin.d.ts
64
82
  type Options = {
@@ -93,5 +111,5 @@ declare global {
93
111
  }
94
112
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
95
113
  //#endregion
96
- export { barrelPlugin, createPlugin, fsPlugin, reactPlugin };
114
+ export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
97
115
  //# sourceMappingURL=plugins.d.cts.map
package/dist/plugins.d.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  import { r as Extname } from "./KubbFile-D4gyyfL-.js";
2
- import { o as Plugin, s as UserPlugin } from "./App-DLp9W8mB.js";
2
+ import { o as Plugin, s as UserPlugin } from "./App-D7ehObix.js";
3
3
  import { ElementType } from "react";
4
4
 
5
5
  //#region ../fabric-core/src/plugins/createPlugin.d.ts
6
- declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
6
+ declare function createPlugin<Options$4 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$4, TAppExtension>): Plugin<Options$4, TAppExtension>;
7
7
  //#endregion
8
8
  //#region ../fabric-core/src/plugins/fsPlugin.d.ts
9
9
  type WriteOptions = {
10
10
  extension?: Record<Extname, Extname | ''>;
11
- dryRun?: boolean;
12
11
  };
13
- type Options$2 = {
12
+ type Options$3 = {
13
+ dryRun?: boolean;
14
14
  /**
15
15
  * Optional callback that is invoked whenever a file is written by the plugin.
16
16
  * Useful for tests to observe write operations without spying on internal functions.
17
17
  */
18
- onWrite?: (path: string, data: string) => void | Promise<void>;
18
+ onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>;
19
19
  clean?: {
20
20
  path: string;
21
21
  };
@@ -35,30 +35,48 @@ declare global {
35
35
  }
36
36
  }
37
37
  }
38
- declare const fsPlugin: Plugin<Options$2, ExtendOptions$2>;
38
+ declare const fsPlugin: Plugin<Options$3, ExtendOptions$2>;
39
39
  //#endregion
40
40
  //#region ../fabric-core/src/plugins/barrelPlugin.d.ts
41
41
  type Mode = 'all' | 'named' | 'propagate' | false;
42
- type Options$1 = {
42
+ type Options$2 = {
43
+ root: string;
44
+ mode: Mode;
45
+ dryRun?: boolean;
46
+ };
47
+ type WriteEntryOptions = {
43
48
  root: string;
44
49
  mode: Mode;
45
50
  };
46
51
  type ExtendOptions$1 = {
47
- writeEntry(options: Options$1): Promise<void>;
52
+ writeEntry(options: WriteEntryOptions): Promise<void>;
48
53
  };
49
54
  declare module '@kubb/fabric-core' {
50
55
  interface App {
51
- writeEntry(options: Options$1): Promise<void>;
56
+ writeEntry(options: WriteEntryOptions): Promise<void>;
52
57
  }
53
58
  }
54
59
  declare global {
55
60
  namespace Kubb {
56
61
  interface App {
57
- writeEntry(options: Options$1): Promise<void>;
62
+ writeEntry(options: WriteEntryOptions): Promise<void>;
58
63
  }
59
64
  }
60
65
  }
61
- declare const barrelPlugin: Plugin<Options$1, ExtendOptions$1>;
66
+ declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
67
+ //#endregion
68
+ //#region ../fabric-core/src/plugins/progressPlugin.d.ts
69
+ declare const progressPlugin: Plugin<[], {}>;
70
+ //#endregion
71
+ //#region ../fabric-core/src/plugins/graphPlugin.d.ts
72
+ type Options$1 = {
73
+ root: string;
74
+ /**
75
+ * @default false
76
+ */
77
+ open?: boolean;
78
+ };
79
+ declare const graphPlugin: Plugin<Options$1, {}>;
62
80
  //#endregion
63
81
  //#region src/plugins/reactPlugin.d.ts
64
82
  type Options = {
@@ -93,5 +111,5 @@ declare global {
93
111
  }
94
112
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
95
113
  //#endregion
96
- export { barrelPlugin, createPlugin, fsPlugin, reactPlugin };
114
+ export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
97
115
  //# sourceMappingURL=plugins.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/react-fabric",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "React integration for Kubb, providing JSX runtime support and React component generation capabilities for code generation plugins.",
5
5
  "keywords": [
6
6
  "react",
@@ -99,7 +99,7 @@
99
99
  "react-reconciler": "0.32.0",
100
100
  "signal-exit": "^4.1.0",
101
101
  "ws": "^8.18.3",
102
- "@kubb/fabric-core": "0.1.6"
102
+ "@kubb/fabric-core": "0.1.8"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/react": "^19.2.2",