@kubb/react-fabric 0.1.6 → 0.1.7

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.
@@ -146,7 +156,7 @@ type AppEvents = {
146
156
  processed: number;
147
157
  total: number;
148
158
  percentage: number;
149
- source: string;
159
+ source?: string;
150
160
  file: ResolvedFile;
151
161
  }];
152
162
  /**
@@ -156,22 +166,23 @@ type AppEvents = {
156
166
  files: ResolvedFile[];
157
167
  }];
158
168
  };
159
- type AppContext<TOptions = unknown> = {
169
+ type AppContext<TOptions extends AppOptions> = {
160
170
  options?: TOptions;
161
171
  events: AsyncEventEmitter<AppEvents>;
162
172
  fileManager: FileManager;
163
173
  installedPlugins: Set<Plugin>;
164
174
  installedParsers: Set<Parser>;
165
175
  };
176
+ type AppMode = 'sequential' | 'parallel';
166
177
  type AllOptional<T> = {} extends T ? true : false;
167
178
  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
179
  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 {
180
+ interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
170
181
  context: AppContext<TOptions>;
171
182
  files: Array<ResolvedFile>;
172
183
  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
184
  addFile(...files: Array<File>): Promise<void>;
174
185
  }
175
186
  //#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
187
+ export { UserParser as a, Parser as i, AppOptions as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
188
+ //# sourceMappingURL=App-CFyJOzZ_.d.ts.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.
@@ -146,7 +156,7 @@ type AppEvents = {
146
156
  processed: number;
147
157
  total: number;
148
158
  percentage: number;
149
- source: string;
159
+ source?: string;
150
160
  file: ResolvedFile;
151
161
  }];
152
162
  /**
@@ -156,22 +166,23 @@ type AppEvents = {
156
166
  files: ResolvedFile[];
157
167
  }];
158
168
  };
159
- type AppContext<TOptions = unknown> = {
169
+ type AppContext<TOptions extends AppOptions> = {
160
170
  options?: TOptions;
161
171
  events: AsyncEventEmitter<AppEvents>;
162
172
  fileManager: FileManager;
163
173
  installedPlugins: Set<Plugin>;
164
174
  installedParsers: Set<Parser>;
165
175
  };
176
+ type AppMode = 'sequential' | 'parallel';
166
177
  type AllOptional<T> = {} extends T ? true : false;
167
178
  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
179
  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 {
180
+ interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
170
181
  context: AppContext<TOptions>;
171
182
  files: Array<ResolvedFile>;
172
183
  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
184
  addFile(...files: Array<File>): Promise<void>;
174
185
  }
175
186
  //#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
187
+ export { UserParser as a, Parser as i, AppOptions as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
188
+ //# sourceMappingURL=App-sZvw_4U6.d.cts.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-sZvw_4U6.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-CFyJOzZ_.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-sZvw_4U6.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-CFyJOzZ_.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-sZvw_4U6.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,47 @@ 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
+ type Options$1 = {};
70
+ declare module '@kubb/fabric-core' {
71
+ interface App {}
72
+ }
73
+ declare global {
74
+ namespace Kubb {
75
+ interface App {}
76
+ }
77
+ }
78
+ declare const progressPlugin: Plugin<Options$1, {}>;
62
79
  //#endregion
63
80
  //#region src/plugins/reactPlugin.d.ts
64
81
  type Options = {
@@ -93,5 +110,5 @@ declare global {
93
110
  }
94
111
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
95
112
  //#endregion
96
- export { barrelPlugin, createPlugin, fsPlugin, reactPlugin };
113
+ export { barrelPlugin, createPlugin, fsPlugin, progressPlugin, reactPlugin };
97
114
  //# 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-CFyJOzZ_.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,47 @@ 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
+ type Options$1 = {};
70
+ declare module '@kubb/fabric-core' {
71
+ interface App {}
72
+ }
73
+ declare global {
74
+ namespace Kubb {
75
+ interface App {}
76
+ }
77
+ }
78
+ declare const progressPlugin: Plugin<Options$1, {}>;
62
79
  //#endregion
63
80
  //#region src/plugins/reactPlugin.d.ts
64
81
  type Options = {
@@ -93,5 +110,5 @@ declare global {
93
110
  }
94
111
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
95
112
  //#endregion
96
- export { barrelPlugin, createPlugin, fsPlugin, reactPlugin };
113
+ export { barrelPlugin, createPlugin, fsPlugin, progressPlugin, reactPlugin };
97
114
  //# 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.7",
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.7"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/react": "^19.2.2",