@kubb/react-fabric 0.13.2 → 0.13.3

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 (73) hide show
  1. package/dist/{chunk-Cnw5r_-A.js → chunk-DbZtQ4qb.js} +5 -1
  2. package/dist/{getFunctionParams-ClT1iMr_.d.ts → getFunctionParams-CINBJQGH.d.ts} +3 -1
  3. package/dist/globals.d.ts +1 -0
  4. package/dist/index.cjs +3 -3
  5. package/dist/index.d.ts +3 -2
  6. package/dist/index.js +4 -4
  7. package/dist/jsx-dev-runtime.cjs +20 -2
  8. package/dist/jsx-dev-runtime.cjs.map +1 -1
  9. package/dist/jsx-dev-runtime.d.ts +2 -1
  10. package/dist/jsx-dev-runtime.js +21 -3
  11. package/dist/jsx-dev-runtime.js.map +1 -1
  12. package/dist/{jsx-namespace-CFK460kI.d.ts → jsx-namespace-Bg7Kfg54.d.ts} +2 -1
  13. package/dist/{jsx-runtime-Dm7PKVbc.js → jsx-runtime-CZxrhUx8.js} +24 -5
  14. package/dist/{jsx-runtime-Dm7PKVbc.js.map → jsx-runtime-CZxrhUx8.js.map} +1 -1
  15. package/dist/{jsx-runtime-7CEZevwV.cjs → jsx-runtime-C_GM3QQI.cjs} +23 -4
  16. package/dist/{jsx-runtime-7CEZevwV.cjs.map → jsx-runtime-C_GM3QQI.cjs.map} +1 -1
  17. package/dist/jsx-runtime.cjs +2 -2
  18. package/dist/jsx-runtime.d.ts +2 -1
  19. package/dist/jsx-runtime.js +3 -3
  20. package/dist/plugins.cjs +3 -3
  21. package/dist/plugins.d.ts +1 -1
  22. package/dist/plugins.js +3 -3
  23. package/dist/{react-DorQ0Kea.cjs → react-B4mAwc8c.cjs} +96 -25
  24. package/dist/{react-DorQ0Kea.cjs.map → react-B4mAwc8c.cjs.map} +1 -1
  25. package/dist/{react-D652OKii.js → react-C2cYsofv.js} +87 -26
  26. package/dist/{react-D652OKii.js.map → react-C2cYsofv.js.map} +1 -1
  27. package/dist/{reactPlugin-BGbgHJfV.cjs → reactPlugin-BshFnF2Y.cjs} +1449 -316
  28. package/dist/{reactPlugin-BGbgHJfV.cjs.map → reactPlugin-BshFnF2Y.cjs.map} +1 -1
  29. package/dist/{reactPlugin-tE73eBS_.js → reactPlugin-DGKBWjiR.js} +1450 -317
  30. package/dist/{reactPlugin-tE73eBS_.js.map → reactPlugin-DGKBWjiR.js.map} +1 -1
  31. package/dist/{reactPlugin-CJEggKNs.d.ts → reactPlugin-OUKiWH1q.d.ts} +2 -1
  32. package/dist/types.d.ts +2 -2
  33. package/package.json +4 -3
  34. package/dist/getFunctionParams-BJb7Kd-D.d.ts +0 -48
  35. package/dist/jsx-namespace-BLQ6SvuD.d.ts +0 -33
  36. package/dist/reactPlugin-DYARkyXy.d.ts +0 -462
  37. package/src/components/__snapshots__/arrow_function_with_generics.ts +0 -3
  38. package/src/components/__snapshots__/async_arrow_function.ts +0 -3
  39. package/src/components/__snapshots__/async_function.ts +0 -3
  40. package/src/components/__snapshots__/async_function_with_Promise_return_type.ts +0 -3
  41. package/src/components/__snapshots__/basic_arrow_function.ts +0 -3
  42. package/src/components/__snapshots__/basic_const.ts +0 -1
  43. package/src/components/__snapshots__/basic_export.ts +0 -1
  44. package/src/components/__snapshots__/basic_function.ts +0 -3
  45. package/src/components/__snapshots__/basic_import.ts +0 -1
  46. package/src/components/__snapshots__/basic_type.ts +0 -1
  47. package/src/components/__snapshots__/const_with_JSDoc.ts +0 -4
  48. package/src/components/__snapshots__/const_with_as_const.ts +0 -1
  49. package/src/components/__snapshots__/const_with_type.ts +0 -1
  50. package/src/components/__snapshots__/default_exported_arrow_function.ts +0 -3
  51. package/src/components/__snapshots__/default_exported_function.ts +0 -3
  52. package/src/components/__snapshots__/exported_arrow_function.ts +0 -3
  53. package/src/components/__snapshots__/exported_async_arrow_function_with_generics.ts +0 -3
  54. package/src/components/__snapshots__/exported_async_function_with_generics.ts +0 -3
  55. package/src/components/__snapshots__/exported_const.ts +0 -1
  56. package/src/components/__snapshots__/exported_function.ts +0 -3
  57. package/src/components/__snapshots__/exported_type.ts +0 -1
  58. package/src/components/__snapshots__/function_with_JSDoc.ts +0 -6
  59. package/src/components/__snapshots__/function_with_generics.ts +0 -3
  60. package/src/components/__snapshots__/function_with_parameters.ts +0 -3
  61. package/src/components/__snapshots__/function_with_return_type.ts +0 -3
  62. package/src/components/__snapshots__/matches_with_root_import.ts +0 -1
  63. package/src/components/__snapshots__/named_export.ts +0 -1
  64. package/src/components/__snapshots__/named_export_(object_advanced).ts +0 -1
  65. package/src/components/__snapshots__/named_import.ts +0 -1
  66. package/src/components/__snapshots__/named_import_(object).ts +0 -1
  67. package/src/components/__snapshots__/named_import_(object_advanced).ts +0 -1
  68. package/src/components/__snapshots__/named_typed_export.ts +0 -1
  69. package/src/components/__snapshots__/named_typed_import.ts +0 -1
  70. package/src/components/__snapshots__/single_line_arrow_function.ts +0 -1
  71. package/src/components/__snapshots__/type_with_JSDoc.ts +0 -4
  72. package/src/components/__snapshots__/typed_export.ts +0 -1
  73. package/src/components/__snapshots__/typed_import.ts +0 -1
@@ -1,3 +1,4 @@
1
+ import { r as __name } from "./chunk-DbZtQ4qb.js";
1
2
  import { FabricReactElement, t as types_d_exports } from "./types.js";
2
3
  import { TreeNode } from "@kubb/fabric-core";
3
4
 
@@ -459,4 +460,4 @@ declare global {
459
460
  declare const reactPlugin: Plugin<Options, ExtendOptions>;
460
461
  //#endregion
461
462
  export { reactPlugin as n, Options as t };
462
- //# sourceMappingURL=reactPlugin-CJEggKNs.d.ts.map
463
+ //# sourceMappingURL=reactPlugin-OUKiWH1q.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as __exportAll, r as __reExport } from "./chunk-Cnw5r_-A.js";
2
- import { n as Param, r as Params } from "./getFunctionParams-ClT1iMr_.js";
1
+ import { i as __reExport, n as __exportAll, r as __name } from "./chunk-DbZtQ4qb.js";
2
+ import { n as Param, r as Params } from "./getFunctionParams-CINBJQGH.js";
3
3
  import { KubbFile } from "@kubb/fabric-core/types";
4
4
  import React, { JSX, ReactNode } from "react";
5
5
  export * from "@kubb/fabric-core/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/react-fabric",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "React integration for Kubb's fabric - JSX runtime and component-based code generation with React reconciler for building type-safe generators",
5
5
  "keywords": [
6
6
  "react",
@@ -92,7 +92,8 @@
92
92
  "*.d.cts",
93
93
  "!*.map",
94
94
  "!/**/**.test.**",
95
- "!/**/__tests__/**"
95
+ "!/**/__tests__/**",
96
+ "!/**/__snapshots__/**"
96
97
  ],
97
98
  "size-limit": [
98
99
  {
@@ -105,7 +106,7 @@
105
106
  "react-devtools-core": "6.1.5",
106
107
  "remeda": "^2.33.6",
107
108
  "ws": "8.18.0",
108
- "@kubb/fabric-core": "0.13.2"
109
+ "@kubb/fabric-core": "0.13.3"
109
110
  },
110
111
  "devDependencies": {
111
112
  "@types/react": "^19.2.14",
@@ -1,48 +0,0 @@
1
- //#endregion
2
- //#region src/utils/getFunctionParams.d.ts
3
- type Param = {
4
- /**
5
- * `object` will return the pathParams as an object.
6
- *
7
- * `inline` will return the pathParams as comma separated params.
8
- * @default `'inline'`
9
- * @private
10
- */
11
- mode?: 'object' | 'inline' | 'inlineSpread';
12
- type?: 'string' | 'number' | (string & {});
13
- optional?: boolean;
14
- /**
15
- * @example test = "default"
16
- */
17
- default?: string;
18
- /**
19
- * Used for no TypeScript(with mode object)
20
- * @example test: "default"
21
- */
22
- value?: string;
23
- children?: Params;
24
- };
25
- type Params = Record<string, Param | undefined>;
26
- type Options = {
27
- type: 'constructor' | 'call' | 'object' | 'objectValue';
28
- transformName?: (name: string) => string;
29
- transformType?: (type: string) => string;
30
- };
31
- declare function createFunctionParams(params: Params): Params;
32
- declare class FunctionParams {
33
- #private;
34
- static factory(params: Params): FunctionParams;
35
- constructor(params: Params);
36
- get params(): Params;
37
- get flatParams(): Params;
38
- toCall({
39
- transformName,
40
- transformType
41
- }?: Pick<Options, 'transformName' | 'transformType'>): string;
42
- toObject(): string;
43
- toObjectValue(): string;
44
- toConstructor(): string;
45
- }
46
- //#endregion
47
- export { __exportAll as a, createFunctionParams as i, Param as n, __reExport as o, Params as r, FunctionParams as t };
48
- //# sourceMappingURL=getFunctionParams-BJb7Kd-D.d.ts.map
@@ -1,33 +0,0 @@
1
- import { FabricExportProps, FabricFileProps, FabricImportProps, FabricReactElement, FabricReactNode, FabricSourceProps, FabricTextProps, LineBreakProps } from "./types.js";
2
- import React from "react";
3
-
4
- //#region src/jsx-namespace.d.ts
5
- declare namespace JSX$1 {
6
- type ElementType = React.JSX.ElementType;
7
- type Element = FabricReactElement;
8
- interface ElementClass extends React.JSX.ElementClass {
9
- render(): FabricReactNode;
10
- }
11
- interface ElementAttributesProperty {
12
- props: {};
13
- }
14
- interface ElementChildrenAttribute {
15
- children: {};
16
- }
17
- interface IntrinsicElements extends React.JSX.IntrinsicElements {
18
- 'kubb-text': FabricTextProps;
19
- 'kubb-file': FabricFileProps;
20
- 'kubb-source': FabricSourceProps;
21
- 'kubb-import': FabricImportProps;
22
- 'kubb-export': FabricExportProps;
23
- br: LineBreakProps;
24
- indent: {};
25
- dedent: {};
26
- }
27
- type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
28
- interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
29
- interface IntrinsicElements extends React.JSX.IntrinsicElements {}
30
- }
31
- //#endregion
32
- export { JSX$1 as t };
33
- //# sourceMappingURL=jsx-namespace-BLQ6SvuD.d.ts.map
@@ -1,462 +0,0 @@
1
- import { FabricReactElement, t as types_d_exports } from "./types.js";
2
- import { TreeNode } from "@kubb/fabric-core";
3
-
4
- //#region ../fabric-core/src/KubbFile.d.ts
5
- type ImportName = string | Array<string | {
6
- propertyName: string;
7
- name?: string;
8
- }>;
9
- type Import = {
10
- /**
11
- * Import name to be used
12
- * @example ["useState"]
13
- * @example "React"
14
- */
15
- name: ImportName;
16
- /**
17
- * Path for the import
18
- * @example '@kubb/core'
19
- */
20
- path: string;
21
- /**
22
- * Add type-only import prefix.
23
- * - `true` generates `import type { Type } from './path'`
24
- * - `false` generates `import { Type } from './path'`
25
- * @default false
26
- */
27
- isTypeOnly?: boolean;
28
- /**
29
- * Import entire module as namespace.
30
- * - `true` generates `import * as Name from './path'`
31
- * - `false` generates standard import
32
- * @default false
33
- */
34
- isNameSpace?: boolean;
35
- /**
36
- * When root is set it will get the path with relative getRelativePath(root, path).
37
- */
38
- root?: string;
39
- };
40
- type Source = {
41
- name?: string;
42
- value?: string;
43
- /**
44
- * Make this source a type-only export.
45
- * - `true` marks source as type export
46
- * - `false` marks source as value export
47
- * @default false
48
- */
49
- isTypeOnly?: boolean;
50
- /**
51
- * Include export keyword in source.
52
- * - `true` generates exportable const or type
53
- * - `false` generates internal declaration
54
- * @default false
55
- */
56
- isExportable?: boolean;
57
- /**
58
- * Include in barrel file generation.
59
- * - `true` adds to barrel exports
60
- * - `false` excludes from barrel exports
61
- * @default false
62
- */
63
- isIndexable?: boolean;
64
- };
65
- type Export = {
66
- /**
67
- * Export name to be used.
68
- * @example ["useState"]
69
- * @example "React"
70
- */
71
- name?: string | Array<string>;
72
- /**
73
- * Path for the import.
74
- * @example '@kubb/core'
75
- */
76
- path: string;
77
- /**
78
- * Add type-only export prefix.
79
- * - `true` generates `export type { Type } from './path'`
80
- * - `false` generates `export { Type } from './path'`
81
- * @default false
82
- */
83
- isTypeOnly?: boolean;
84
- /**
85
- * Export as aliased namespace.
86
- * - `true` generates `export * as aliasName from './path'`
87
- * - `false` generates standard export
88
- * @default false
89
- */
90
- asAlias?: boolean;
91
- };
92
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
93
- /**
94
- * Name to be used to dynamically create the baseName(based on input.path)
95
- * Based on UNIX basename
96
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
97
- */
98
- type BaseName = `${string}.${string}`;
99
- /**
100
- * Path will be full qualified path to a specified file
101
- */
102
- type Path = string;
103
- type File<TMeta extends object = object> = {
104
- /**
105
- * Name to be used to create the path
106
- * Based on UNIX basename, `${name}.extname`
107
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
108
- */
109
- baseName: BaseName;
110
- /**
111
- * Path will be full qualified path to a specified file
112
- */
113
- path: Path;
114
- sources: Array<Source>;
115
- imports: Array<Import>;
116
- exports: Array<Export>;
117
- /**
118
- * Use extra meta, this is getting used to generate the barrel/index files.
119
- */
120
- meta?: TMeta;
121
- banner?: string;
122
- footer?: string;
123
- };
124
- type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
125
- /**
126
- * @default hash
127
- */
128
- id: string;
129
- /**
130
- * Contains the first part of the baseName, generated based on baseName
131
- * @link https://nodejs.org/api/path.html#pathformatpathobject
132
- */
133
- name: string;
134
- extname: Extname;
135
- imports: Array<Import>;
136
- exports: Array<Export>;
137
- };
138
- //#endregion
139
- //#region ../fabric-core/src/parsers/types.d.ts
140
- type PrintOptions = {
141
- extname?: Extname;
142
- };
143
- type Parser<TOptions = unknown, TMeta extends object = any> = {
144
- name: string;
145
- type: 'parser';
146
- /**
147
- * Undefined is being used for the defaultParser
148
- */
149
- extNames: Array<Extname> | undefined;
150
- install: Install<TOptions>;
151
- /**
152
- * Convert a file to string
153
- */
154
- parse(file: ResolvedFile<TMeta>, options: PrintOptions): Promise<string> | string;
155
- };
156
- //#endregion
157
- //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
158
- type Options$3 = {
159
- mode?: FabricMode;
160
- maxListener?: number;
161
- };
162
- declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
163
- #private;
164
- constructor({
165
- maxListener,
166
- mode
167
- }?: Options$3);
168
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
169
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
170
- onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
171
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
172
- removeAll(): void;
173
- }
174
- //#endregion
175
- //#region ../fabric-core/src/FileProcessor.d.ts
176
- type ProcessFilesProps = {
177
- parsers?: Map<Extname, Parser>;
178
- extension?: Record<Extname, Extname | ''>;
179
- dryRun?: boolean;
180
- /**
181
- * @default 'sequential'
182
- */
183
- mode?: FabricMode;
184
- };
185
- type GetParseOptions = {
186
- parsers?: Map<Extname, Parser>;
187
- extension?: Record<Extname, Extname | ''>;
188
- };
189
- type Options$2 = {
190
- events?: AsyncEventEmitter<FabricEvents>;
191
- };
192
- declare class FileProcessor {
193
- #private;
194
- events: AsyncEventEmitter<FabricEvents>;
195
- constructor({
196
- events
197
- }?: Options$2);
198
- parse(file: ResolvedFile, {
199
- parsers,
200
- extension
201
- }?: GetParseOptions): Promise<string>;
202
- run(files: Array<ResolvedFile>, {
203
- parsers,
204
- mode,
205
- dryRun,
206
- extension
207
- }?: ProcessFilesProps): Promise<ResolvedFile[]>;
208
- }
209
- //#endregion
210
- //#region ../fabric-core/src/FileManager.d.ts
211
- type Options$1 = {
212
- events?: AsyncEventEmitter<FabricEvents>;
213
- };
214
- declare class FileManager$1 {
215
- #private;
216
- events: AsyncEventEmitter<FabricEvents>;
217
- processor: FileProcessor;
218
- constructor({
219
- events
220
- }?: Options$1);
221
- add(...files: Array<File>): Array<ResolvedFile>;
222
- upsert(...files: Array<File>): Array<ResolvedFile>;
223
- flush(): void;
224
- getByPath(path: Path): ResolvedFile | null;
225
- deleteByPath(path: Path): void;
226
- clear(): void;
227
- get files(): Array<ResolvedFile>;
228
- write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
229
- }
230
- //#endregion
231
- //#region ../fabric-core/src/Fabric.d.ts
232
- /**
233
- * Defines core runtime options for Fabric.
234
- */
235
- interface FabricOptions {
236
- /**
237
- * Determines how Fabric processes files.
238
- * - `sequential`: files are processed one by one
239
- * - `parallel`: files are processed concurrently
240
- *
241
- * @default 'sequential'
242
- */
243
- mode?: FabricMode;
244
- }
245
- /**
246
- * Available modes for file processing.
247
- * @default 'sequential'
248
- */
249
- type FabricMode = 'sequential' | 'parallel';
250
- /**
251
- * Event definitions emitted during the Fabric lifecycle.
252
- *
253
- * These events allow plugins and external code to hook into different stages
254
- * of the file generation process. All events are asynchronous and can be
255
- * listened to using `fabric.context.on()` or `fabric.context.onOnce()`.
256
- *
257
- * @example
258
- * ```ts
259
- * fabric.context.on('lifecycle:start', async () => {
260
- * console.log('Fabric started!')
261
- * })
262
- * ```
263
- */
264
- interface FabricEvents {
265
- /**
266
- * Emitted when the Fabric application lifecycle begins.
267
- * This is typically the first event fired when starting a Fabric run.
268
- * Use this to perform initial setup or logging.
269
- */
270
- 'lifecycle:start': [];
271
- /**
272
- * Emitted when the Fabric application lifecycle completes.
273
- * This is typically the last event fired after all processing is done.
274
- * Use this for cleanup tasks or final reporting.
275
- */
276
- 'lifecycle:end': [];
277
- /**
278
- * Emitted when Fabric starts rendering (used with reactPlugin).
279
- * Provides access to the Fabric instance for render-time operations.
280
- */
281
- 'lifecycle:render': [fabric: Fabric];
282
- /**
283
- * Emitted once before file processing begins.
284
- * Provides the complete list of files that will be processed.
285
- * Use this to prepare for batch operations or display initial file counts.
286
- */
287
- 'files:processing:start': [files: Array<ResolvedFile>];
288
- /**
289
- * Emitted when files are successfully added to the FileManager's internal cache.
290
- * This happens after files pass through path and name resolution.
291
- * Use this to track which files have been registered.
292
- */
293
- 'files:added': [files: Array<ResolvedFile>];
294
- /**
295
- * Emitted during file path resolution, before a file is cached.
296
- * Listeners can modify the file's path property to customize output location.
297
- * This is called for each file being added via `addFile()` or `upsertFile()`.
298
- */
299
- 'file:resolve:path': [file: File];
300
- /**
301
- * Emitted during file name resolution, before a file is cached.
302
- * Listeners can modify the file's name-related properties to customize naming.
303
- * This is called for each file being added via `addFile()` or `upsertFile()`.
304
- */
305
- 'file:resolve:name': [file: File];
306
- /**
307
- * Emitted just before files are written to disk.
308
- * Provides all files that will be written in this batch.
309
- * Use this to perform pre-write operations like creating directories.
310
- */
311
- 'files:writing:start': [files: Array<ResolvedFile>];
312
- /**
313
- * Emitted after all files have been successfully written to disk.
314
- * Provides all files that were written in this batch.
315
- * Use this for post-write operations like running formatters or reporting.
316
- */
317
- 'files:writing:end': [files: Array<ResolvedFile>];
318
- /**
319
- * Emitted when an individual file starts being processed.
320
- * This happens for each file in the queue, before parsing.
321
- * Use this for per-file setup or detailed logging.
322
- */
323
- 'file:processing:start': [file: ResolvedFile, index: number, total: number];
324
- /**
325
- * Emitted when an individual file completes processing.
326
- * This happens after the file has been parsed and handled.
327
- * Use this for per-file cleanup or progress tracking.
328
- */
329
- 'file:processing:end': [file: ResolvedFile, index: number, total: number];
330
- /**
331
- * Emitted after each file is processed, providing progress metrics.
332
- * This is the primary event for implementing progress bars or tracking.
333
- * Plugins like fsPlugin use this to write files to disk.
334
- *
335
- * @property processed - Number of files processed so far
336
- * @property total - Total number of files to process
337
- * @property percentage - Completion percentage (0-100)
338
- * @property source - Optional parsed source code of the file
339
- * @property file - The file that was just processed
340
- */
341
- 'file:processing:update': [{
342
- processed: number;
343
- total: number;
344
- percentage: number;
345
- source?: string;
346
- file: ResolvedFile;
347
- }];
348
- /**
349
- * Emitted once all files have been successfully processed.
350
- * This marks the completion of the processing phase.
351
- * Use this to perform batch operations on all processed files.
352
- */
353
- 'files:processing:end': [files: Array<ResolvedFile>];
354
- }
355
- /**
356
- * Shared context passed to all plugins, parsers, and Fabric internals.
357
- */
358
- interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEventEmitter<FabricEvents> {
359
- /** The active Fabric configuration. */
360
- config: FabricConfig<T>;
361
- /** The internal file manager handling file creation, merging, and writing. */
362
- fileManager: FileManager$1;
363
- /** List of files currently in memory. */
364
- files: ResolvedFile[];
365
- /** Add new files to the file manager. */
366
- addFile(...files: File[]): Promise<void>;
367
- /** Track installed plugins and parsers to prevent duplicates. */
368
- installedPlugins: Set<Plugin>;
369
- installedParsers: Map<Extname, Parser>;
370
- }
371
- /**
372
- * Base configuration object for Fabric.
373
- */
374
- type FabricConfig<T extends FabricOptions = FabricOptions> = T;
375
- /**
376
- * Utility type that checks whether all properties of `T` are optional.
377
- */
378
- type AllOptional<T> = {} extends T ? true : false;
379
- /**
380
- * Defines the signature of a plugin or parser's `install` function.
381
- */
382
- type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options?: TOptions) => void | Promise<void> : (context: FabricContext, options: TOptions) => void | Promise<void>;
383
- /**
384
- * Defines the signature of a plugin or parser's `inject` function.
385
- * Returns an object that extends the Fabric instance.
386
- */
387
- type Inject<TOptions = unknown, TExtension extends Record<string, any> = {}> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => Partial<TExtension> : AllOptional<TOptions> extends true ? (context: FabricContext, options?: TOptions) => Partial<TExtension> : (context: FabricContext, options: TOptions) => Partial<TExtension>;
388
- /**
389
- * The main Fabric runtime interface.
390
- * Provides access to the current context, registered plugins, files, and utility methods.
391
- */
392
- interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
393
- /** The shared context for this Fabric instance. */
394
- context: FabricContext<T>;
395
- /** The files managed by this Fabric instance. */
396
- files: ResolvedFile[];
397
- /**
398
- * Install a plugin or parser into Fabric.
399
- *
400
- * @param target - The plugin or parser to install.
401
- * @param options - Optional configuration or arguments for the target.
402
- * @returns A Fabric instance extended by the plugin (if applicable).
403
- */
404
- use<TPluginOptions = unknown, TMeta extends object = object, TExtension extends Record<string, any> = {}>(target: Plugin<TPluginOptions, TExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TExtension) | Promise<this & TExtension>;
405
- /**
406
- * Add one or more files to the Fabric file manager.
407
- */
408
- addFile(...files: File[]): Promise<void>;
409
- /**
410
- * Add one or more files to the Fabric file manager and merge the source, imports, exports
411
- */
412
- upsertFile(...files: File[]): Promise<void>;
413
- /**
414
- * Unmount the Fabric instance and remove all registered event listeners.
415
- * Plugins may extend this to perform additional cleanup (e.g. process signal listeners).
416
- */
417
- unmount(error?: Error | number | null): void;
418
- }
419
- //#endregion
420
- //#region ../fabric-core/src/plugins/types.d.ts
421
- type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
422
- name: string;
423
- type: 'plugin';
424
- install: Install<TOptions>;
425
- /**
426
- * Runtime app overrides or extensions.
427
- * Merged into the app instance after install.
428
- * This cannot be async
429
- */
430
- inject?: Inject<TOptions, TAppExtension>;
431
- };
432
- //#endregion
433
- //#region src/plugins/reactPlugin.d.ts
434
- type Options = {
435
- stdout?: NodeJS.WriteStream;
436
- stdin?: NodeJS.ReadStream;
437
- stderr?: NodeJS.WriteStream;
438
- treeNode?: TreeNode<types_d_exports.ComponentNode>;
439
- /**
440
- * Set this to true to always see the result of the render in the console(line per render)
441
- */
442
- debug?: boolean;
443
- };
444
- type ExtendOptions = {
445
- render(App: FabricReactElement): Promise<void>;
446
- renderToString(App: FabricReactElement): Promise<string>;
447
- waitUntilExit(): Promise<void>;
448
- unmount(error?: Error | number | null): void;
449
- };
450
- declare global {
451
- namespace Kubb {
452
- interface Fabric {
453
- render(App: FabricReactElement): Promise<void>;
454
- renderToString(App: FabricReactElement): Promise<string>;
455
- waitUntilExit(): Promise<void>;
456
- }
457
- }
458
- }
459
- declare const reactPlugin: Plugin<Options, ExtendOptions>;
460
- //#endregion
461
- export { reactPlugin as n, Options as t };
462
- //# sourceMappingURL=reactPlugin-DYARkyXy.d.ts.map
@@ -1,3 +0,0 @@
1
- const getData = <TData>(): number => {
2
- return 2
3
- }
@@ -1,3 +0,0 @@
1
- const myFunc = async () => {
2
- return true
3
- }
@@ -1,3 +0,0 @@
1
- async function myFunc() {
2
- return true
3
- }
@@ -1,3 +0,0 @@
1
- async function myFunc(): Promise<boolean> {
2
- return true
3
- }
@@ -1,3 +0,0 @@
1
- const myFunc = () => {
2
- return true
3
- }
@@ -1 +0,0 @@
1
- const myVar = "hello"
@@ -1 +0,0 @@
1
- export * from "@kubb/react-fabric";
@@ -1,3 +0,0 @@
1
- function myFunc() {
2
- return true
3
- }
@@ -1 +0,0 @@
1
- import fabric from "@kubb/react-fabric";
@@ -1 +0,0 @@
1
- type MyType = { a: string }
@@ -1,4 +0,0 @@
1
- /**
2
- * This is a variable
3
- */
4
- const myVar = "hello"
@@ -1 +0,0 @@
1
- const myVar = "hello" as const
@@ -1 +0,0 @@
1
- const myVar:string = "hello"
@@ -1,3 +0,0 @@
1
- export default const myFunc = () => {
2
- return true
3
- }
@@ -1,3 +0,0 @@
1
- export default function myFunc() {
2
- return true
3
- }
@@ -1,3 +0,0 @@
1
- export const myFunc = () => {
2
- return true
3
- }
@@ -1,3 +0,0 @@
1
- export const getData = async <TData>(): Promise<number> => {
2
- return 2
3
- }
@@ -1,3 +0,0 @@
1
- export async function getData<TData>(): Promise<number> {
2
- return 2
3
- }
@@ -1 +0,0 @@
1
- export const myVar = "hello"
@@ -1,3 +0,0 @@
1
- export function myFunc() {
2
- return true
3
- }