@kubb/core 3.0.0-alpha.2 → 3.0.0-alpha.4

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 (48) hide show
  1. package/dist/{FileManager-Bw-FNS3q.d.cts → FileManager--scIq4y4.d.cts} +26 -18
  2. package/dist/{FileManager-BW--rO8q.d.ts → FileManager-CaejIVBd.d.ts} +26 -18
  3. package/dist/chunk-25NKJ3DV.js +1063 -0
  4. package/dist/chunk-25NKJ3DV.js.map +1 -0
  5. package/dist/chunk-34BPAXR2.cjs +1071 -0
  6. package/dist/chunk-34BPAXR2.cjs.map +1 -0
  7. package/dist/{chunk-3OXCZ5DJ.js → chunk-EFQPHF4E.js} +29 -21
  8. package/dist/chunk-EFQPHF4E.js.map +1 -0
  9. package/dist/{chunk-LM2YQC3T.cjs → chunk-QRIDQ4RG.cjs} +38 -23
  10. package/dist/chunk-QRIDQ4RG.cjs.map +1 -0
  11. package/dist/{chunk-SA2GZKXS.js → chunk-UUBPTMRW.js} +49 -37
  12. package/dist/chunk-UUBPTMRW.js.map +1 -0
  13. package/dist/{chunk-ADC5UNZ5.cjs → chunk-V5THHXXQ.cjs} +259 -250
  14. package/dist/chunk-V5THHXXQ.cjs.map +1 -0
  15. package/dist/index.cjs +44 -108
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +4 -15
  18. package/dist/index.d.ts +4 -15
  19. package/dist/index.js +27 -91
  20. package/dist/index.js.map +1 -1
  21. package/dist/{logger-DChjnJMn.d.cts → logger-dzAcLeAA.d.cts} +12 -19
  22. package/dist/{logger-DChjnJMn.d.ts → logger-dzAcLeAA.d.ts} +12 -19
  23. package/dist/logger.cjs +3 -4
  24. package/dist/logger.cjs.map +1 -1
  25. package/dist/logger.d.cts +1 -2
  26. package/dist/logger.d.ts +1 -2
  27. package/dist/logger.js +2 -3
  28. package/dist/mocks.cjs +3 -3
  29. package/dist/mocks.cjs.map +1 -1
  30. package/dist/mocks.d.cts +2 -4
  31. package/dist/mocks.d.ts +2 -4
  32. package/dist/mocks.js +2 -2
  33. package/dist/mocks.js.map +1 -1
  34. package/dist/prompt-6FWP747F.cjs +760 -0
  35. package/dist/prompt-6FWP747F.cjs.map +1 -0
  36. package/dist/prompt-HK3MWREM.js +755 -0
  37. package/dist/prompt-HK3MWREM.js.map +1 -0
  38. package/package.json +7 -8
  39. package/src/FileManager.ts +62 -42
  40. package/src/PluginManager.ts +4 -20
  41. package/src/build.ts +24 -91
  42. package/src/errors.ts +0 -11
  43. package/src/index.ts +0 -1
  44. package/src/logger.ts +42 -33
  45. package/dist/chunk-3OXCZ5DJ.js.map +0 -1
  46. package/dist/chunk-ADC5UNZ5.cjs.map +0 -1
  47. package/dist/chunk-LM2YQC3T.cjs.map +0 -1
  48. package/dist/chunk-SA2GZKXS.js.map +0 -1
@@ -1,10 +1,9 @@
1
- import PQueue from 'p-queue';
2
1
  import { write, read } from '@kubb/fs';
3
2
  import * as KubbFile from '@kubb/fs/types';
4
3
  import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
5
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
6
5
  import { DirectoryTreeOptions } from 'directory-tree';
7
- import { E as EventEmitter, L as Logger } from './logger-DChjnJMn.cjs';
6
+ import { E as EventEmitter, L as Logger } from './logger-dzAcLeAA.cjs';
8
7
 
9
8
  type BarrelManagerOptions = {
10
9
  treeNode?: DirectoryTreeOptions;
@@ -34,12 +33,8 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
34
33
  result: Result;
35
34
  plugin: Plugin;
36
35
  };
37
- type Options$1 = {
36
+ type Options = {
38
37
  logger: Logger;
39
- /**
40
- * Task for the FileManager
41
- */
42
- task: (file: ResolvedFile) => Promise<ResolvedFile>;
43
38
  };
44
39
  type Events = {
45
40
  execute: [executer: Executer];
@@ -61,8 +56,7 @@ declare class PluginManager {
61
56
  readonly config: Config;
62
57
  readonly executed: Array<Executer>;
63
58
  readonly logger: Logger;
64
- readonly queue: PQueue;
65
- constructor(config: Config, options: Options$1);
59
+ constructor(config: Config, options: Options);
66
60
  getFile<TOptions = object>({ name, mode, extName, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{
67
61
  pluginKey: Plugin['key'];
68
62
  }>;
@@ -411,27 +405,41 @@ type AddIndexesProps = {
411
405
  options?: BarrelManagerOptions;
412
406
  meta?: FileWithMeta['meta'];
413
407
  };
414
- type Options = {
415
- queue?: PQueue;
416
- task?: (file: ResolvedFile) => Promise<ResolvedFile>;
417
- };
418
408
  declare class FileManager {
419
409
  #private;
420
- constructor({ task, queue }?: Options);
410
+ constructor();
421
411
  get files(): Array<FileWithMeta>;
422
- get isExecuting(): boolean;
423
412
  add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
424
- addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
413
+ getIndexFiles({ root, output, meta, logger, options }: AddIndexesProps): Promise<ResolvedFile[]>;
425
414
  getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
426
415
  get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
427
416
  remove(path: KubbFile.Path): void;
428
- write(...params: Parameters<typeof write>): Promise<string | undefined>;
429
- read(...params: Parameters<typeof read>): Promise<string>;
417
+ write(...params: Parameters<typeof write>): ReturnType<typeof write>;
418
+ read(...params: Parameters<typeof read>): ReturnType<typeof read>;
419
+ processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles>;
430
420
  static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
431
421
  static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
432
422
  static getMode(path: string | undefined | null): KubbFile.Mode;
433
423
  static get extensions(): Array<KubbFile.Extname>;
434
424
  static isJavascript(baseName: string): boolean;
435
425
  }
426
+ type WriteFilesProps = {
427
+ files: KubbFile.File[];
428
+ logger: Logger;
429
+ dryRun?: boolean;
430
+ };
431
+ declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<{
432
+ source: string;
433
+ id?: string;
434
+ baseName: `${string}.${string}`;
435
+ path: KubbFile.AdvancedPath<TBaseName> | KubbFile.Path;
436
+ imports?: KubbFile.Import[];
437
+ exports?: KubbFile.Export[];
438
+ override?: boolean;
439
+ meta?: object | undefined;
440
+ exportable?: boolean;
441
+ env?: NodeJS.ProcessEnv;
442
+ language?: string;
443
+ }[]>;
436
444
 
437
445
  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 };
@@ -1,10 +1,9 @@
1
- import PQueue from 'p-queue';
2
1
  import { write, read } from '@kubb/fs';
3
2
  import * as KubbFile from '@kubb/fs/types';
4
3
  import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
5
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
6
5
  import { DirectoryTreeOptions } from 'directory-tree';
7
- import { E as EventEmitter, L as Logger } from './logger-DChjnJMn.js';
6
+ import { E as EventEmitter, L as Logger } from './logger-dzAcLeAA.js';
8
7
 
9
8
  type BarrelManagerOptions = {
10
9
  treeNode?: DirectoryTreeOptions;
@@ -34,12 +33,8 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
34
33
  result: Result;
35
34
  plugin: Plugin;
36
35
  };
37
- type Options$1 = {
36
+ type Options = {
38
37
  logger: Logger;
39
- /**
40
- * Task for the FileManager
41
- */
42
- task: (file: ResolvedFile) => Promise<ResolvedFile>;
43
38
  };
44
39
  type Events = {
45
40
  execute: [executer: Executer];
@@ -61,8 +56,7 @@ declare class PluginManager {
61
56
  readonly config: Config;
62
57
  readonly executed: Array<Executer>;
63
58
  readonly logger: Logger;
64
- readonly queue: PQueue;
65
- constructor(config: Config, options: Options$1);
59
+ constructor(config: Config, options: Options);
66
60
  getFile<TOptions = object>({ name, mode, extName, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{
67
61
  pluginKey: Plugin['key'];
68
62
  }>;
@@ -411,27 +405,41 @@ type AddIndexesProps = {
411
405
  options?: BarrelManagerOptions;
412
406
  meta?: FileWithMeta['meta'];
413
407
  };
414
- type Options = {
415
- queue?: PQueue;
416
- task?: (file: ResolvedFile) => Promise<ResolvedFile>;
417
- };
418
408
  declare class FileManager {
419
409
  #private;
420
- constructor({ task, queue }?: Options);
410
+ constructor();
421
411
  get files(): Array<FileWithMeta>;
422
- get isExecuting(): boolean;
423
412
  add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
424
- addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
413
+ getIndexFiles({ root, output, meta, logger, options }: AddIndexesProps): Promise<ResolvedFile[]>;
425
414
  getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
426
415
  get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
427
416
  remove(path: KubbFile.Path): void;
428
- write(...params: Parameters<typeof write>): Promise<string | undefined>;
429
- read(...params: Parameters<typeof read>): Promise<string>;
417
+ write(...params: Parameters<typeof write>): ReturnType<typeof write>;
418
+ read(...params: Parameters<typeof read>): ReturnType<typeof read>;
419
+ processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles>;
430
420
  static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
431
421
  static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
432
422
  static getMode(path: string | undefined | null): KubbFile.Mode;
433
423
  static get extensions(): Array<KubbFile.Extname>;
434
424
  static isJavascript(baseName: string): boolean;
435
425
  }
426
+ type WriteFilesProps = {
427
+ files: KubbFile.File[];
428
+ logger: Logger;
429
+ dryRun?: boolean;
430
+ };
431
+ declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<{
432
+ source: string;
433
+ id?: string;
434
+ baseName: `${string}.${string}`;
435
+ path: KubbFile.AdvancedPath<TBaseName> | KubbFile.Path;
436
+ imports?: KubbFile.Import[];
437
+ exports?: KubbFile.Export[];
438
+ override?: boolean;
439
+ meta?: object | undefined;
440
+ exportable?: boolean;
441
+ env?: NodeJS.ProcessEnv;
442
+ language?: string;
443
+ }[]>;
436
444
 
437
445
  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 };