@kubb/core 3.0.0-alpha.6 → 3.0.0-alpha.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.
Files changed (72) hide show
  1. package/dist/{FileManager-wyXRkgIk.d.cts → FileManager-B0GJlthB.d.cts} +30 -16
  2. package/dist/{FileManager-Ceski1W9.d.ts → FileManager-BFycBDqG.d.ts} +30 -16
  3. package/dist/chunk-27CPVXAT.js +945 -0
  4. package/dist/chunk-27CPVXAT.js.map +1 -0
  5. package/dist/{chunk-34BPAXR2.cjs → chunk-5E2I6KH4.cjs} +7 -7
  6. package/dist/{chunk-34BPAXR2.cjs.map → chunk-5E2I6KH4.cjs.map} +1 -1
  7. package/dist/chunk-5IGANEGE.cjs +1564 -0
  8. package/dist/chunk-5IGANEGE.cjs.map +1 -0
  9. package/dist/{chunk-67C6RBGQ.cjs → chunk-A6PCLWEY.cjs} +5 -5
  10. package/dist/{chunk-67C6RBGQ.cjs.map → chunk-A6PCLWEY.cjs.map} +1 -1
  11. package/dist/{chunk-5HN4LW3R.cjs → chunk-DID47EQD.cjs} +3 -3
  12. package/dist/{chunk-5HN4LW3R.cjs.map → chunk-DID47EQD.cjs.map} +1 -1
  13. package/dist/{chunk-25NKJ3DV.js → chunk-HBQM723K.js} +6 -6
  14. package/dist/{chunk-LOLEBOMW.cjs → chunk-IPZQXBA2.cjs} +16 -21
  15. package/dist/chunk-IPZQXBA2.cjs.map +1 -0
  16. package/dist/{chunk-76UEJFFE.js → chunk-SCR3LUXT.js} +9 -16
  17. package/dist/{chunk-76UEJFFE.js.map → chunk-SCR3LUXT.js.map} +1 -1
  18. package/dist/{chunk-XCPFG6DO.cjs → chunk-SEH6NUCX.cjs} +4 -28
  19. package/dist/chunk-SEH6NUCX.cjs.map +1 -0
  20. package/dist/index.cjs +380 -378
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +325 -319
  25. package/dist/index.js.map +1 -1
  26. package/dist/logger.cjs +4 -4
  27. package/dist/logger.js +2 -3
  28. package/dist/mocks.cjs +20 -15
  29. package/dist/mocks.cjs.map +1 -1
  30. package/dist/mocks.d.cts +6 -5
  31. package/dist/mocks.d.ts +6 -5
  32. package/dist/mocks.js +15 -11
  33. package/dist/mocks.js.map +1 -1
  34. package/dist/{prompt-6FWP747F.cjs → prompt-DVQN7JTN.cjs} +61 -61
  35. package/dist/{prompt-6FWP747F.cjs.map → prompt-DVQN7JTN.cjs.map} +1 -1
  36. package/dist/{prompt-HK3MWREM.js → prompt-WQQUN22Z.js} +5 -6
  37. package/dist/{prompt-HK3MWREM.js.map → prompt-WQQUN22Z.js.map} +1 -1
  38. package/dist/transformers.cjs +19 -19
  39. package/dist/transformers.js +0 -1
  40. package/dist/transformers.js.map +1 -1
  41. package/dist/utils.cjs +8 -4
  42. package/dist/utils.cjs.map +1 -1
  43. package/dist/utils.d.cts +25 -24
  44. package/dist/utils.d.ts +25 -24
  45. package/dist/utils.js +5 -2
  46. package/package.json +7 -7
  47. package/src/BarrelManager.ts +90 -40
  48. package/src/FileManager.ts +89 -109
  49. package/src/PluginManager.ts +2 -1
  50. package/src/__snapshots__/barrel.json +91 -0
  51. package/src/__snapshots__/grouped.json +114 -0
  52. package/src/__snapshots__/ordered.json +62 -0
  53. package/src/build.ts +60 -23
  54. package/src/plugin.ts +2 -2
  55. package/src/types.ts +22 -2
  56. package/src/utils/TreeNode.ts +43 -1
  57. package/src/utils/index.ts +1 -1
  58. package/src/utils/parser.ts +128 -67
  59. package/dist/chunk-AWAZR3D5.js +0 -360
  60. package/dist/chunk-AWAZR3D5.js.map +0 -1
  61. package/dist/chunk-DCZQYCCO.cjs +0 -1155
  62. package/dist/chunk-DCZQYCCO.cjs.map +0 -1
  63. package/dist/chunk-HMLY7DHA.js +0 -16
  64. package/dist/chunk-HMLY7DHA.js.map +0 -1
  65. package/dist/chunk-L3JJLZ5Q.cjs +0 -371
  66. package/dist/chunk-L3JJLZ5Q.cjs.map +0 -1
  67. package/dist/chunk-LOLEBOMW.cjs.map +0 -1
  68. package/dist/chunk-RIEGCND2.js +0 -525
  69. package/dist/chunk-RIEGCND2.js.map +0 -1
  70. package/dist/chunk-XCPFG6DO.cjs.map +0 -1
  71. package/schema.json +0 -86
  72. /package/dist/{chunk-25NKJ3DV.js.map → chunk-HBQM723K.js.map} +0 -0
@@ -4,14 +4,6 @@ import { ResolvedFile } from '@kubb/fs/types';
4
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
5
5
  import { E as EventEmitter, L as Logger } from './logger-BWFeedRk.cjs';
6
6
 
7
- type BarrelManagerOptions = {
8
- isTypeOnly?: boolean;
9
- /**
10
- * Add .ts or .js
11
- */
12
- extName?: string;
13
- };
14
-
15
7
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
16
8
  /**
17
9
  * Get the type of the first argument in a function.
@@ -195,6 +187,11 @@ type Config<TInput = Input> = {
195
187
  * @default true
196
188
  */
197
189
  write?: boolean;
190
+ /**
191
+ * Define what needs to exported, here you can also disable the export of barrel files
192
+ * @default `'barrelNamed'`
193
+ */
194
+ exportType?: 'barrel' | 'barrelNamed' | false;
198
195
  };
199
196
  /**
200
197
  * Array of Kubb plugins to use.
@@ -259,7 +256,7 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
259
256
  options: TOptions['resolvedOptions'];
260
257
  /**
261
258
  * 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.
262
- * Can be used to validate depended plugins.
259
+ * Can be used to validate dependent plugins.
263
260
  */
264
261
  pre?: Array<string>;
265
262
  /**
@@ -284,9 +281,24 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
284
281
  * @private
285
282
  */
286
283
  key: TOptions['key'];
284
+ output?: {
285
+ /**
286
+ * Output to save the clients.
287
+ */
288
+ path: string;
289
+ /**
290
+ * Add an extension to the generated imports and exports, default it will not use an extension
291
+ */
292
+ extName?: KubbFile.Extname;
293
+ /**
294
+ * Define what needs to exported, here you can also disable the export of barrel files
295
+ * @default `'barrelNamed'`
296
+ */
297
+ exportType?: 'barrel' | 'barrelNamed' | false;
298
+ };
287
299
  /**
288
300
  * 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.
289
- * Can be used to validate depended plugins.
301
+ * Can be used to validate dependent plugins.
290
302
  */
291
303
  pre?: Array<string>;
292
304
  /**
@@ -389,6 +401,8 @@ declare class TreeNode {
389
401
  get leaves(): Array<TreeNode>;
390
402
  get root(): TreeNode;
391
403
  forEach(callback: (treeNode: TreeNode) => void): this;
404
+ filter(callback: (treeNode: TreeNode) => boolean): Array<TreeNode>;
405
+ map<T>(callback: (treeNode: TreeNode) => T): Array<T>;
392
406
  static build(files: KubbFile.File[], root?: string): TreeNode | null;
393
407
  }
394
408
  type DirectoryTree = {
@@ -407,23 +421,22 @@ type AddIndexesProps = {
407
421
  * Root based on root and output.path specified in the config
408
422
  */
409
423
  root: string;
424
+ files: KubbFile.File[];
410
425
  /**
411
426
  * Output for plugin
412
427
  */
413
428
  output: {
414
429
  path: string;
430
+ extName?: KubbFile.Extname;
415
431
  exportAs?: string;
416
- extName?: string;
417
432
  exportType?: 'barrel' | 'barrelNamed' | false;
418
433
  };
419
434
  group?: {
420
435
  output: string;
421
436
  exportAs: string;
422
437
  };
423
- logger: Logger;
424
- files: KubbFile.File[];
425
- options?: BarrelManagerOptions;
426
- plugin: Plugin;
438
+ logger?: Logger;
439
+ meta?: FileMetaBase;
427
440
  };
428
441
  declare class FileManager {
429
442
  #private;
@@ -433,10 +446,11 @@ declare class FileManager {
433
446
  get groupedFiles(): DirectoryTree | null;
434
447
  get treeNode(): TreeNode | null;
435
448
  add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
449
+ clear(): void;
436
450
  getCacheById(id: string): KubbFile.File | undefined;
437
451
  getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | undefined;
438
452
  deleteByPath(path: KubbFile.Path): void;
439
- getIndexFiles({ files, plugin, root, output, logger, options }: AddIndexesProps): Promise<KubbFile.File[]>;
453
+ getBarrelFiles({ files, meta, root, output, logger }: AddIndexesProps): Promise<KubbFile.File[]>;
440
454
  write(...params: Parameters<typeof write>): ReturnType<typeof write>;
441
455
  read(...params: Parameters<typeof read>): ReturnType<typeof read>;
442
456
  static getMode(path: string | undefined | null): KubbFile.Mode;
@@ -4,14 +4,6 @@ import { ResolvedFile } from '@kubb/fs/types';
4
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
5
5
  import { E as EventEmitter, L as Logger } from './logger-BWFeedRk.js';
6
6
 
7
- type BarrelManagerOptions = {
8
- isTypeOnly?: boolean;
9
- /**
10
- * Add .ts or .js
11
- */
12
- extName?: string;
13
- };
14
-
15
7
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
16
8
  /**
17
9
  * Get the type of the first argument in a function.
@@ -195,6 +187,11 @@ type Config<TInput = Input> = {
195
187
  * @default true
196
188
  */
197
189
  write?: boolean;
190
+ /**
191
+ * Define what needs to exported, here you can also disable the export of barrel files
192
+ * @default `'barrelNamed'`
193
+ */
194
+ exportType?: 'barrel' | 'barrelNamed' | false;
198
195
  };
199
196
  /**
200
197
  * Array of Kubb plugins to use.
@@ -259,7 +256,7 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
259
256
  options: TOptions['resolvedOptions'];
260
257
  /**
261
258
  * 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.
262
- * Can be used to validate depended plugins.
259
+ * Can be used to validate dependent plugins.
263
260
  */
264
261
  pre?: Array<string>;
265
262
  /**
@@ -284,9 +281,24 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
284
281
  * @private
285
282
  */
286
283
  key: TOptions['key'];
284
+ output?: {
285
+ /**
286
+ * Output to save the clients.
287
+ */
288
+ path: string;
289
+ /**
290
+ * Add an extension to the generated imports and exports, default it will not use an extension
291
+ */
292
+ extName?: KubbFile.Extname;
293
+ /**
294
+ * Define what needs to exported, here you can also disable the export of barrel files
295
+ * @default `'barrelNamed'`
296
+ */
297
+ exportType?: 'barrel' | 'barrelNamed' | false;
298
+ };
287
299
  /**
288
300
  * 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.
289
- * Can be used to validate depended plugins.
301
+ * Can be used to validate dependent plugins.
290
302
  */
291
303
  pre?: Array<string>;
292
304
  /**
@@ -389,6 +401,8 @@ declare class TreeNode {
389
401
  get leaves(): Array<TreeNode>;
390
402
  get root(): TreeNode;
391
403
  forEach(callback: (treeNode: TreeNode) => void): this;
404
+ filter(callback: (treeNode: TreeNode) => boolean): Array<TreeNode>;
405
+ map<T>(callback: (treeNode: TreeNode) => T): Array<T>;
392
406
  static build(files: KubbFile.File[], root?: string): TreeNode | null;
393
407
  }
394
408
  type DirectoryTree = {
@@ -407,23 +421,22 @@ type AddIndexesProps = {
407
421
  * Root based on root and output.path specified in the config
408
422
  */
409
423
  root: string;
424
+ files: KubbFile.File[];
410
425
  /**
411
426
  * Output for plugin
412
427
  */
413
428
  output: {
414
429
  path: string;
430
+ extName?: KubbFile.Extname;
415
431
  exportAs?: string;
416
- extName?: string;
417
432
  exportType?: 'barrel' | 'barrelNamed' | false;
418
433
  };
419
434
  group?: {
420
435
  output: string;
421
436
  exportAs: string;
422
437
  };
423
- logger: Logger;
424
- files: KubbFile.File[];
425
- options?: BarrelManagerOptions;
426
- plugin: Plugin;
438
+ logger?: Logger;
439
+ meta?: FileMetaBase;
427
440
  };
428
441
  declare class FileManager {
429
442
  #private;
@@ -433,10 +446,11 @@ declare class FileManager {
433
446
  get groupedFiles(): DirectoryTree | null;
434
447
  get treeNode(): TreeNode | null;
435
448
  add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
449
+ clear(): void;
436
450
  getCacheById(id: string): KubbFile.File | undefined;
437
451
  getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | undefined;
438
452
  deleteByPath(path: KubbFile.Path): void;
439
- getIndexFiles({ files, plugin, root, output, logger, options }: AddIndexesProps): Promise<KubbFile.File[]>;
453
+ getBarrelFiles({ files, meta, root, output, logger }: AddIndexesProps): Promise<KubbFile.File[]>;
440
454
  write(...params: Parameters<typeof write>): ReturnType<typeof write>;
441
455
  read(...params: Parameters<typeof read>): ReturnType<typeof read>;
442
456
  static getMode(path: string | undefined | null): KubbFile.Mode;