@kubb/core 3.0.0-alpha.1 → 3.0.0-alpha.10

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 (96) hide show
  1. package/dist/{FileManager-EVJig-LT.d.ts → FileManager-BbUCeEyv.d.cts} +108 -94
  2. package/dist/{FileManager-DSLZ6ps7.d.cts → FileManager-CpuFz6eH.d.ts} +108 -94
  3. package/dist/chunk-2EU7DMPM.js +97 -0
  4. package/dist/chunk-2EU7DMPM.js.map +1 -0
  5. package/dist/chunk-5E2I6KH4.cjs +1071 -0
  6. package/dist/chunk-5E2I6KH4.cjs.map +1 -0
  7. package/dist/{chunk-67C6RBGQ.cjs → chunk-A6PCLWEY.cjs} +5 -5
  8. package/dist/{chunk-67C6RBGQ.cjs.map → chunk-A6PCLWEY.cjs.map} +1 -1
  9. package/dist/chunk-DID47EQD.cjs +102 -0
  10. package/dist/chunk-DID47EQD.cjs.map +1 -0
  11. package/dist/chunk-HBQM723K.js +1063 -0
  12. package/dist/chunk-HBQM723K.js.map +1 -0
  13. package/dist/chunk-L6YLVCKM.js +929 -0
  14. package/dist/chunk-L6YLVCKM.js.map +1 -0
  15. package/dist/{chunk-LM2YQC3T.cjs → chunk-M7NLNCSM.cjs} +71 -38
  16. package/dist/chunk-M7NLNCSM.cjs.map +1 -0
  17. package/dist/{chunk-3OXCZ5DJ.js → chunk-MU3CBCQT.js} +59 -35
  18. package/dist/chunk-MU3CBCQT.js.map +1 -0
  19. package/dist/chunk-NB4JMN75.cjs +1548 -0
  20. package/dist/chunk-NB4JMN75.cjs.map +1 -0
  21. package/dist/{chunk-XCPFG6DO.cjs → chunk-SEH6NUCX.cjs} +4 -28
  22. package/dist/chunk-SEH6NUCX.cjs.map +1 -0
  23. package/dist/index.cjs +496 -552
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +6 -19
  26. package/dist/index.d.ts +6 -19
  27. package/dist/index.js +438 -492
  28. package/dist/index.js.map +1 -1
  29. package/dist/{logger-DChjnJMn.d.cts → logger-DvbHXjIO.d.cts} +29 -19
  30. package/dist/{logger-DChjnJMn.d.ts → logger-DvbHXjIO.d.ts} +29 -19
  31. package/dist/logger.cjs +4 -5
  32. package/dist/logger.cjs.map +1 -1
  33. package/dist/logger.d.cts +1 -2
  34. package/dist/logger.d.ts +1 -2
  35. package/dist/logger.js +2 -4
  36. package/dist/mocks.cjs +25 -19
  37. package/dist/mocks.cjs.map +1 -1
  38. package/dist/mocks.d.cts +6 -9
  39. package/dist/mocks.d.ts +6 -9
  40. package/dist/mocks.js +21 -16
  41. package/dist/mocks.js.map +1 -1
  42. package/dist/prompt-DVQN7JTN.cjs +760 -0
  43. package/dist/prompt-DVQN7JTN.cjs.map +1 -0
  44. package/dist/prompt-WQQUN22Z.js +754 -0
  45. package/dist/prompt-WQQUN22Z.js.map +1 -0
  46. package/dist/transformers.cjs +198 -42
  47. package/dist/transformers.cjs.map +1 -1
  48. package/dist/transformers.d.cts +1 -3
  49. package/dist/transformers.d.ts +1 -3
  50. package/dist/transformers.js +155 -14
  51. package/dist/transformers.js.map +1 -1
  52. package/dist/utils.cjs +12 -4
  53. package/dist/utils.cjs.map +1 -1
  54. package/dist/utils.d.cts +31 -3
  55. package/dist/utils.d.ts +31 -3
  56. package/dist/utils.js +11 -4
  57. package/package.json +10 -10
  58. package/src/BarrelManager.ts +93 -107
  59. package/src/{Generator.ts → BaseGenerator.ts} +1 -1
  60. package/src/FileManager.ts +198 -297
  61. package/src/PackageManager.ts +1 -1
  62. package/src/PluginManager.ts +152 -101
  63. package/src/__snapshots__/barrel.json +91 -0
  64. package/src/__snapshots__/grouped.json +114 -0
  65. package/src/__snapshots__/ordered.json +62 -0
  66. package/src/build.ts +86 -171
  67. package/src/errors.ts +0 -11
  68. package/src/index.ts +1 -2
  69. package/src/logger.ts +76 -34
  70. package/src/plugin.ts +3 -3
  71. package/src/transformers/index.ts +2 -3
  72. package/src/transformers/trim.ts +0 -4
  73. package/src/types.ts +35 -35
  74. package/src/utils/TreeNode.ts +132 -50
  75. package/src/utils/executeStrategies.ts +1 -1
  76. package/src/utils/index.ts +2 -1
  77. package/src/utils/parser.ts +157 -0
  78. package/dist/chunk-3OXCZ5DJ.js.map +0 -1
  79. package/dist/chunk-5JZNFPUP.js +0 -309
  80. package/dist/chunk-5JZNFPUP.js.map +0 -1
  81. package/dist/chunk-ADC5UNZ5.cjs +0 -1227
  82. package/dist/chunk-ADC5UNZ5.cjs.map +0 -1
  83. package/dist/chunk-HMLY7DHA.js +0 -16
  84. package/dist/chunk-HMLY7DHA.js.map +0 -1
  85. package/dist/chunk-JKZG2IJR.js +0 -283
  86. package/dist/chunk-JKZG2IJR.js.map +0 -1
  87. package/dist/chunk-LM2YQC3T.cjs.map +0 -1
  88. package/dist/chunk-PZT4CTBV.cjs +0 -299
  89. package/dist/chunk-PZT4CTBV.cjs.map +0 -1
  90. package/dist/chunk-SA2GZKXS.js +0 -596
  91. package/dist/chunk-SA2GZKXS.js.map +0 -1
  92. package/dist/chunk-XCPFG6DO.cjs.map +0 -1
  93. package/dist/chunk-YTSNYMHW.cjs +0 -320
  94. package/dist/chunk-YTSNYMHW.cjs.map +0 -1
  95. package/schema.json +0 -86
  96. package/src/utils/getParser.ts +0 -17
@@ -1,19 +1,8 @@
1
- import PQueue from 'p-queue';
2
1
  import { write, read } from '@kubb/fs';
3
2
  import * as KubbFile from '@kubb/fs/types';
4
- import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
3
+ import { ResolvedFile } from '@kubb/fs/types';
5
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
6
- import { DirectoryTreeOptions } from 'directory-tree';
7
- import { E as EventEmitter, L as Logger } from './logger-DChjnJMn.js';
8
-
9
- type BarrelManagerOptions = {
10
- treeNode?: DirectoryTreeOptions;
11
- isTypeOnly?: boolean;
12
- /**
13
- * Add .ts or .js
14
- */
15
- extName?: KubbFile.Extname;
16
- };
5
+ import { E as EventEmitter, L as Logger } from './logger-DvbHXjIO.cjs';
17
6
 
18
7
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
19
8
  /**
@@ -23,6 +12,7 @@ type RequiredPluginLifecycle = Required<PluginLifecycle>;
23
12
  type Argument0<H extends keyof PluginLifecycle> = Parameters<RequiredPluginLifecycle[H]>[0];
24
13
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq';
25
14
  type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
15
+ message: string;
26
16
  strategy: Strategy;
27
17
  hookName: H;
28
18
  plugin: Plugin;
@@ -34,15 +24,11 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
34
24
  result: Result;
35
25
  plugin: Plugin;
36
26
  };
37
- type Options$1 = {
27
+ type Options = {
38
28
  logger: Logger;
39
- /**
40
- * Task for the FileManager
41
- */
42
- task: (file: ResolvedFile) => Promise<ResolvedFile>;
43
29
  };
44
30
  type Events = {
45
- execute: [executer: Executer];
31
+ executing: [executer: Executer];
46
32
  executed: [executer: Executer];
47
33
  error: [error: Error];
48
34
  };
@@ -61,8 +47,8 @@ declare class PluginManager {
61
47
  readonly config: Config;
62
48
  readonly executed: Array<Executer>;
63
49
  readonly logger: Logger;
64
- readonly queue: PQueue;
65
- constructor(config: Config, options: Options$1);
50
+ readonly options: Options;
51
+ constructor(config: Config, options: Options);
66
52
  getFile<TOptions = object>({ name, mode, extName, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{
67
53
  pluginKey: Plugin['key'];
68
54
  }>;
@@ -75,60 +61,67 @@ declare class PluginManager {
75
61
  /**
76
62
  * Run a specific hookName for plugin x.
77
63
  */
78
- hookForPlugin<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
64
+ hookForPlugin<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, message, }: {
79
65
  pluginKey: Plugin['key'];
80
66
  hookName: H;
81
67
  parameters: PluginParameter<H>;
82
- }): Promise<Array<ReturnType<ParseResult<H>> | null>> | null;
68
+ message: string;
69
+ }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
83
70
  /**
84
71
  * Run a specific hookName for plugin x.
85
72
  */
86
- hookForPluginSync<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
73
+ hookForPluginSync<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, message, }: {
87
74
  pluginKey: Plugin['key'];
88
75
  hookName: H;
89
76
  parameters: PluginParameter<H>;
77
+ message: string;
90
78
  }): Array<ReturnType<ParseResult<H>>> | null;
91
79
  /**
92
80
  * First non-null result stops and will return it's value.
93
81
  */
94
- hookFirst<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
82
+ hookFirst<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, message, }: {
95
83
  hookName: H;
96
84
  parameters: PluginParameter<H>;
97
85
  skipped?: ReadonlySet<Plugin> | null;
86
+ message: string;
98
87
  }): Promise<SafeParseResult<H>>;
99
88
  /**
100
89
  * First non-null result stops and will return it's value.
101
90
  */
102
- hookFirstSync<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
91
+ hookFirstSync<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, message, }: {
103
92
  hookName: H;
104
93
  parameters: PluginParameter<H>;
105
94
  skipped?: ReadonlySet<Plugin> | null;
95
+ message: string;
106
96
  }): SafeParseResult<H>;
107
97
  /**
108
98
  * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
109
99
  */
110
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({ hookName, parameters, }: {
100
+ hookParallel<H extends PluginLifecycleHooks, TOuput = void>({ hookName, parameters, message, }: {
111
101
  hookName: H;
112
102
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
103
+ message: string;
113
104
  }): Promise<Awaited<TOuput>[]>;
114
105
  /**
115
106
  * Chain all plugins, `reduce` can be passed through to handle every returned value. The return value of the first plugin will be used as the first parameter for the plugin after that.
116
107
  */
117
- hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
108
+ hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, message, }: {
118
109
  hookName: H;
119
110
  parameters: PluginParameter<H>;
120
111
  reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: Plugin) => PossiblePromise<Argument0<H> | null>;
112
+ message: string;
121
113
  }): Promise<Argument0<H>>;
122
114
  /**
123
115
  * Chains plugins
124
116
  */
125
- hookSeq<H extends PluginLifecycleHooks>({ hookName, parameters }: {
117
+ hookSeq<H extends PluginLifecycleHooks>({ hookName, parameters, message, }: {
126
118
  hookName: H;
127
119
  parameters?: PluginParameter<H>;
120
+ message: string;
128
121
  }): Promise<void>;
129
122
  getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: Plugin['key']): Plugin[];
130
123
  static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>]>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
131
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
124
+ static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
132
125
  }
133
126
 
134
127
  interface Cache<TStore extends object = object> {
@@ -154,11 +147,9 @@ type UserConfig = Omit<Config, 'root' | 'plugins'> & {
154
147
  */
155
148
  root?: string;
156
149
  /**
157
- * Plugin type can be KubbJSONPlugin or Plugin
158
- * Example: ['@kubb/plugin-oas', { output: false }]
159
- * Or: pluginOas({ output: false })
150
+ * Plugin type should be a Kubb plugin
160
151
  */
161
- plugins?: Array<Omit<UnknownUserPlugin, 'api'>>;
152
+ plugins?: Array<Omit<UnknownUserPlugin, 'context'>>;
162
153
  };
163
154
  type InputPath = {
164
155
  /**
@@ -204,6 +195,11 @@ type Config<TInput = Input> = {
204
195
  * @default true
205
196
  */
206
197
  write?: boolean;
198
+ /**
199
+ * Define what needs to exported, here you can also disable the export of barrel files
200
+ * @default `'barrelNamed'`
201
+ */
202
+ exportType?: 'barrel' | 'barrelNamed' | false;
207
203
  };
208
204
  /**
209
205
  * Array of Kubb plugins to use.
@@ -236,9 +232,9 @@ TOptions extends object = object,
236
232
  */
237
233
  TResolvedOptions extends object = TOptions,
238
234
  /**
239
- * API that you want to expose to other plugins.
235
+ * Context that you want to expose to other plugins.
240
236
  */
241
- TAPI = any,
237
+ TContext = any,
242
238
  /**
243
239
  * When calling `resolvePath` you can specify better types.
244
240
  */
@@ -250,7 +246,7 @@ TResolvePathOptions extends object = object> = {
250
246
  key: PluginKey<TName | string>;
251
247
  options: TOptions;
252
248
  resolvedOptions: TResolvedOptions;
253
- api: TAPI;
249
+ context: TContext;
254
250
  resolvePathOptions: TResolvePathOptions;
255
251
  };
256
252
  type PluginKey<TName> = [name: TName, identifier?: string | number];
@@ -268,17 +264,17 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
268
264
  options: TOptions['resolvedOptions'];
269
265
  /**
270
266
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
271
- * Can be used to validate depended plugins.
267
+ * Can be used to validate dependent plugins.
272
268
  */
273
269
  pre?: Array<string>;
274
270
  /**
275
271
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
276
272
  */
277
273
  post?: Array<string>;
278
- } & (TOptions['api'] extends never ? {
279
- api?: never;
274
+ } & (TOptions['context'] extends never ? {
275
+ context?: never;
280
276
  } : {
281
- api: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['api'];
277
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
282
278
  });
283
279
  type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
284
280
  type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>;
@@ -293,9 +289,24 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
293
289
  * @private
294
290
  */
295
291
  key: TOptions['key'];
292
+ output?: {
293
+ /**
294
+ * Output to save the clients.
295
+ */
296
+ path: string;
297
+ /**
298
+ * Add an extension to the generated imports and exports, default it will not use an extension
299
+ */
300
+ extName?: KubbFile.Extname;
301
+ /**
302
+ * Define what needs to exported, here you can also disable the export of barrel files
303
+ * @default `'barrelNamed'`
304
+ */
305
+ exportType?: 'barrel' | 'barrelNamed' | false;
306
+ };
296
307
  /**
297
308
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
298
- * Can be used to validate depended plugins.
309
+ * Can be used to validate dependent plugins.
299
310
  */
300
311
  pre?: Array<string>;
301
312
  /**
@@ -306,10 +317,10 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
306
317
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
307
318
  */
308
319
  options: TOptions['resolvedOptions'];
309
- } & (TOptions['api'] extends never ? {
310
- api?: never;
320
+ } & (TOptions['context'] extends never ? {
321
+ context?: never;
311
322
  } : {
312
- api: TOptions['api'];
323
+ context: TOptions['context'];
313
324
  });
314
325
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
315
326
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
@@ -332,21 +343,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
332
343
  * @example ('pet') => 'Pet'
333
344
  */
334
345
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
335
- /**
336
- * Makes it possible to run async logic to override the path defined previously by `resolvePath`.
337
- * @type hookFirst
338
- */
339
- load?: (this: Omit<PluginContext<TOptions>, 'addFile'>, path: KubbFile.Path) => PossiblePromise<TransformResult | null>;
340
- /**
341
- * Transform the source-code.
342
- * @type hookReduceArg0
343
- */
344
- transform?: (this: Omit<PluginContext<TOptions>, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise<TransformResult>;
345
- /**
346
- * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).
347
- * @type hookParallel
348
- */
349
- writeFile?: (this: Omit<PluginContext<TOptions>, 'addFile'>, path: KubbFile.Path, source: string | undefined) => PossiblePromise<string | void>;
350
346
  /**
351
347
  * End of the plugin lifecycle.
352
348
  * @type hookParallel
@@ -380,7 +376,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
380
376
  cache: Cache<PluginCache>;
381
377
  fileManager: FileManager;
382
378
  pluginManager: PluginManager;
383
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.File>>;
379
+ addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
384
380
  resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
385
381
  resolveName: (params: ResolveNameParams) => string;
386
382
  logger: Logger;
@@ -393,63 +389,81 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
393
389
  */
394
390
  plugin: Plugin<TOptions>;
395
391
  };
396
- type TransformResult = string | null;
397
392
 
398
- type ResolvedFile<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = File<TMeta, TBaseName> & {
393
+ type BarrelData = {
394
+ file?: KubbFile.File;
399
395
  /**
400
- * @default crypto.randomUUID()
401
- */
402
- id: UUID;
403
- /**
404
- * Contains the first part of the baseName, generated based on baseName
405
- * @link https://nodejs.org/api/path.html#pathformatpathobject
396
+ * @deprecated use file instead
406
397
  */
398
+ type: KubbFile.Mode;
399
+ path: string;
407
400
  name: string;
408
401
  };
402
+ declare class TreeNode {
403
+ #private;
404
+ data: BarrelData;
405
+ parent?: TreeNode;
406
+ children: Array<TreeNode>;
407
+ constructor(data: BarrelData, parent?: TreeNode);
408
+ addChild(data: BarrelData): TreeNode;
409
+ get root(): TreeNode;
410
+ get leaves(): Array<TreeNode>;
411
+ forEach(callback: (treeNode: TreeNode) => void): this;
412
+ findDeep(predicate?: (value: TreeNode, index: number, obj: TreeNode[]) => boolean): TreeNode | undefined;
413
+ forEachDeep(callback: (treeNode: TreeNode) => void): void;
414
+ filterDeep(callback: (treeNode: TreeNode) => boolean): Array<TreeNode>;
415
+ mapDeep<T>(callback: (treeNode: TreeNode) => T): Array<T>;
416
+ static build(files: KubbFile.File[], root?: string): TreeNode | null;
417
+ }
418
+ type DirectoryTree = {
419
+ name: string;
420
+ path: string;
421
+ file?: KubbFile.File;
422
+ children: Array<DirectoryTree>;
423
+ };
424
+
409
425
  type FileMetaBase = {
410
426
  pluginKey?: Plugin['key'];
411
427
  };
412
- type FileWithMeta<TMeta extends FileMetaBase = FileMetaBase> = KubbFile.File<TMeta>;
413
- type AddResult<T extends Array<FileWithMeta>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
428
+ type AddResult<T extends Array<KubbFile.File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
414
429
  type AddIndexesProps = {
415
430
  /**
416
431
  * Root based on root and output.path specified in the config
417
432
  */
418
433
  root: string;
434
+ files: KubbFile.File[];
419
435
  /**
420
436
  * Output for plugin
421
437
  */
422
438
  output: {
423
439
  path: string;
424
- exportAs?: string;
425
440
  extName?: KubbFile.Extname;
441
+ exportAs?: string;
426
442
  exportType?: 'barrel' | 'barrelNamed' | false;
427
443
  };
428
- logger: Logger;
429
- options?: BarrelManagerOptions;
430
- meta?: FileWithMeta['meta'];
431
- };
432
- type Options = {
433
- queue?: PQueue;
434
- task?: (file: ResolvedFile) => Promise<ResolvedFile>;
444
+ group?: {
445
+ output: string;
446
+ exportAs: string;
447
+ };
448
+ logger?: Logger;
449
+ meta?: FileMetaBase;
435
450
  };
436
451
  declare class FileManager {
437
452
  #private;
438
- constructor({ task, queue }?: Options);
439
- get files(): Array<FileWithMeta>;
440
- get isExecuting(): boolean;
441
- add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
442
- addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
443
- getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
444
- get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
445
- remove(path: KubbFile.Path): void;
446
- write(...params: Parameters<typeof write>): Promise<string | undefined>;
447
- read(...params: Parameters<typeof read>): Promise<string>;
448
- static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
449
- static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
453
+ constructor();
454
+ get files(): Array<KubbFile.ResolvedFile>;
455
+ get orderedFiles(): Array<KubbFile.ResolvedFile>;
456
+ get groupedFiles(): DirectoryTree | null;
457
+ get treeNode(): TreeNode | null;
458
+ add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
459
+ clear(): void;
460
+ getCacheById(id: string): KubbFile.File | undefined;
461
+ getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | undefined;
462
+ deleteByPath(path: KubbFile.Path): void;
463
+ getBarrelFiles({ files, meta, root, output, logger }: AddIndexesProps): Promise<KubbFile.File[]>;
464
+ write(...params: Parameters<typeof write>): ReturnType<typeof write>;
465
+ read(...params: Parameters<typeof read>): ReturnType<typeof read>;
450
466
  static getMode(path: string | undefined | null): KubbFile.Mode;
451
- static get extensions(): Array<KubbFile.Extname>;
452
- static isJavascript(baseName: string): boolean;
453
467
  }
454
468
 
455
- export { type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type PluginContext as P, type ResolvePathParams as R, type TransformResult as T, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, type UserPlugin as g, type Plugin as h, type PluginWithLifeCycle as i, type PluginLifecycle as j, type PluginLifecycleHooks as k, type PluginParameter as l, type PluginCache as m, type ResolveNameParams as n };
469
+ export { type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, type UserPlugin as g, type Plugin as h, type PluginWithLifeCycle as i, type PluginLifecycle as j, type PluginLifecycleHooks as k, type PluginParameter as l, type PluginCache as m, type ResolveNameParams as n };