@kubb/core 2.0.0-beta.10 → 2.0.0-beta.12

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/Queue-2-6pMcCx.d.cts +32 -0
  2. package/dist/Queue-2-6pMcCx.d.ts +32 -0
  3. package/dist/fs.cjs +2383 -0
  4. package/dist/fs.cjs.map +1 -0
  5. package/dist/fs.d.cts +5 -0
  6. package/dist/fs.d.ts +5 -0
  7. package/dist/fs.js +2380 -0
  8. package/dist/fs.js.map +1 -0
  9. package/dist/index.cjs +3336 -191
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +18 -69
  12. package/dist/index.d.ts +18 -69
  13. package/dist/index.js +3655 -226
  14. package/dist/index.js.map +1 -1
  15. package/dist/logger.cjs +148 -0
  16. package/dist/logger.cjs.map +1 -0
  17. package/dist/logger.d.cts +31 -0
  18. package/dist/logger.d.ts +31 -0
  19. package/dist/logger.js +140 -0
  20. package/dist/logger.js.map +1 -0
  21. package/dist/transformers.cjs +79 -9
  22. package/dist/transformers.cjs.map +1 -1
  23. package/dist/transformers.js +82 -8
  24. package/dist/transformers.js.map +1 -1
  25. package/dist/utils.cjs +86 -766
  26. package/dist/utils.cjs.map +1 -1
  27. package/dist/utils.d.cts +3 -595
  28. package/dist/utils.d.ts +3 -595
  29. package/dist/utils.js +87 -727
  30. package/dist/utils.js.map +1 -1
  31. package/dist/write-46ytbnu9.d.cts +7 -0
  32. package/dist/write-46ytbnu9.d.ts +7 -0
  33. package/package.json +21 -11
  34. package/src/FileManager.ts +34 -62
  35. package/src/PluginManager.ts +20 -15
  36. package/src/build.ts +11 -12
  37. package/src/fs/index.ts +3 -0
  38. package/src/index.ts +4 -4
  39. package/src/{utils/logger.ts → logger.ts} +38 -3
  40. package/src/plugin.ts +1 -1
  41. package/src/transformers/casing.ts +3 -3
  42. package/src/types.ts +1 -1
  43. package/src/utils/index.ts +10 -18
  44. package/src/utils/randomColour.ts +0 -39
  45. package/src/utils/throttle.ts +0 -30
  46. /package/src/{utils → fs}/clean.ts +0 -0
  47. /package/src/{utils → fs}/read.ts +0 -0
  48. /package/src/{utils → fs}/write.ts +0 -0
package/dist/utils.d.ts CHANGED
@@ -1,592 +1,5 @@
1
- import { PossiblePromise, GreaterThan } from '@kubb/types';
2
- import { DirectoryTreeOptions } from 'directory-tree';
3
- import { Ora } from 'ora';
4
- export { default as pc } from 'picocolors';
5
-
6
- declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
7
- declare function read(path: string): Promise<string>;
8
- declare function readSync(path: string): string;
9
-
10
- declare function write(data: string, path: string): Promise<string | undefined>;
11
-
12
- type TreeNodeOptions = DirectoryTreeOptions;
13
- type BarrelData = {
14
- type: KubbFile.Mode;
15
- path: KubbFile.Path;
16
- name: string;
17
- };
18
- declare class TreeNode<T = BarrelData> {
19
- data: T;
20
- parent?: TreeNode<T>;
21
- children: Array<TreeNode<T>>;
22
- constructor(data: T, parent?: TreeNode<T>);
23
- addChild(data: T): TreeNode<T>;
24
- find(data?: T): TreeNode<T> | null;
25
- get leaves(): TreeNode<T>[];
26
- get root(): TreeNode<T>;
27
- forEach(callback: (treeNode: TreeNode<T>) => void): this;
28
- static build(path: string, options?: TreeNodeOptions): TreeNode | null;
29
- }
30
-
31
- declare class EventEmitter<TEvents extends Record<string, any>> {
32
- #private;
33
- constructor();
34
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
35
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
36
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
37
- removeAll(): void;
38
- }
39
-
40
- type QueueJob<T = unknown> = {
41
- (...args: unknown[]): Promise<T | void>;
42
- };
43
- type RunOptions = {
44
- controller?: AbortController;
45
- name?: string;
46
- description?: string;
47
- };
48
- type Events$1 = {
49
- jobDone: [result: unknown];
50
- jobFailed: [error: Error];
51
- };
52
- declare class Queue {
53
- #private;
54
- readonly eventEmitter: EventEmitter<Events$1>;
55
- constructor(maxParallel: number, debug?: boolean);
56
- run<T>(job: QueueJob<T>, options?: RunOptions): Promise<T>;
57
- runSync<T>(job: QueueJob<T>, options?: RunOptions): void;
58
- get hasJobs(): boolean;
59
- get count(): number;
60
- }
61
-
62
- declare const LogLevel: {
63
- readonly silent: "silent";
64
- readonly info: "info";
65
- readonly debug: "debug";
66
- };
67
- type LogLevel = keyof typeof LogLevel;
68
- type Logger = {
69
- /**
70
- * Optional config name to show in CLI output
71
- */
72
- name?: string;
73
- logLevel: LogLevel;
74
- log: (message: string | null) => void;
75
- error: (message: string | null) => void;
76
- info: (message: string | null) => void;
77
- warn: (message: string | null) => void;
78
- spinner?: Ora;
79
- logs: string[];
80
- };
81
- type Props = {
82
- name?: string;
83
- logLevel: LogLevel;
84
- spinner?: Ora;
85
- };
86
- declare function createLogger({ logLevel, name, spinner }: Props): Logger;
87
-
88
- type RequiredPluginLifecycle = Required<PluginLifecycle>;
89
- /**
90
- * Get the type of the first argument in a function.
91
- * @example Arg0<(a: string, b: number) => void> -> string
92
- */
93
- type Argument0<H extends keyof PluginLifecycle> = Parameters<RequiredPluginLifecycle[H]>[0];
94
- type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq';
95
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
96
- strategy: Strategy;
97
- hookName: H;
98
- plugin: KubbPlugin;
99
- parameters?: unknown[] | undefined;
100
- output?: unknown;
101
- };
102
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
103
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
104
- result: Result;
105
- plugin: KubbPlugin;
106
- };
107
- type Options$1 = {
108
- logger: Logger;
109
- /**
110
- * Task for the FileManager
111
- */
112
- task: QueueJob<KubbFile.ResolvedFile>;
113
- /**
114
- * Timeout between writes in the FileManager
115
- */
116
- writeTimeout?: number;
117
- };
118
- type Events = {
119
- execute: [executer: Executer];
120
- executed: [executer: Executer];
121
- error: [error: Error];
122
- };
123
- declare class PluginManager {
124
- #private;
125
- readonly plugins: KubbPluginWithLifeCycle[];
126
- readonly fileManager: FileManager;
127
- readonly eventEmitter: EventEmitter<Events>;
128
- readonly queue: Queue;
129
- readonly config: KubbConfig;
130
- readonly executed: Executer[];
131
- readonly logger: Logger;
132
- constructor(config: KubbConfig, options: Options$1);
133
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
134
- resolveName: (params: ResolveNameParams) => string;
135
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
136
- /**
137
- * Run only hook for a specific plugin name
138
- */
139
- hookForPlugin<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
140
- pluginKey: KubbPlugin['key'];
141
- hookName: H;
142
- parameters: PluginParameter<H>;
143
- }): Promise<Array<ReturnType<ParseResult<H>> | null>> | null;
144
- hookForPluginSync<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
145
- pluginKey: KubbPlugin['key'];
146
- hookName: H;
147
- parameters: PluginParameter<H>;
148
- }): Array<ReturnType<ParseResult<H>>> | null;
149
- /**
150
- * Chains, first non-null result stops and returns
151
- */
152
- hookFirst<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
153
- hookName: H;
154
- parameters: PluginParameter<H>;
155
- skipped?: ReadonlySet<KubbPlugin> | null;
156
- }): Promise<SafeParseResult<H>>;
157
- /**
158
- * Chains, first non-null result stops and returns
159
- */
160
- hookFirstSync<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
161
- hookName: H;
162
- parameters: PluginParameter<H>;
163
- skipped?: ReadonlySet<KubbPlugin> | null;
164
- }): SafeParseResult<H>;
165
- /**
166
- * Parallel, runs all plugins
167
- */
168
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({ hookName, parameters, }: {
169
- hookName: H;
170
- parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
171
- }): Promise<Awaited<TOuput>[]>;
172
- /**
173
- * Chains, reduces returned value, handling the reduced value as the first hook argument
174
- */
175
- hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
176
- hookName: H;
177
- parameters: PluginParameter<H>;
178
- reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>;
179
- }): Promise<Argument0<H>>;
180
- /**
181
- * Chains plugins
182
- */
183
- hookSeq<H extends PluginLifecycleHooks>({ hookName, parameters }: {
184
- hookName: H;
185
- parameters?: PluginParameter<H>;
186
- }): Promise<void>;
187
- getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: KubbPlugin['key']): KubbPlugin[];
188
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: KubbPlugin<T1>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>, T3: KubbPlugin<T3>]>(plugins: Array<KubbPlugin>, dependedPluginNames: string | string[]): TOutput;
189
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
190
- }
191
-
192
- type BarrelManagerOptions = {
193
- treeNode?: DirectoryTreeOptions;
194
- isTypeOnly?: boolean;
195
- /**
196
- * Add .ts or .js
197
- */
198
- extName?: KubbFile.Extname;
199
- };
200
-
201
- type BasePath<T extends string = string> = `${T}/`;
202
- declare namespace KubbFile {
203
- type Import = {
204
- /**
205
- * Import name to be used
206
- * @example ["useState"]
207
- * @example "React"
208
- */
209
- name: string | Array<string | {
210
- propertyName: string;
211
- name?: string;
212
- }>;
213
- /**
214
- * Path for the import
215
- * @xample '@kubb/core'
216
- */
217
- path: string;
218
- /**
219
- * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
220
- */
221
- isTypeOnly?: boolean;
222
- /**
223
- * Add `* as` prefix to the import, this will result in: `import * as path from './path'`.
224
- */
225
- isNameSpace?: boolean;
226
- /**
227
- * When root is set it will get the path with relative getRelativePath(root, path).
228
- */
229
- root?: string;
230
- };
231
- type Export = {
232
- /**
233
- * Export name to be used.
234
- * @example ["useState"]
235
- * @example "React"
236
- */
237
- name?: string | Array<string>;
238
- /**
239
- * Path for the import.
240
- * @xample '@kubb/core'
241
- */
242
- path: string;
243
- /**
244
- * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
245
- */
246
- isTypeOnly?: boolean;
247
- /**
248
- * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
249
- */
250
- asAlias?: boolean;
251
- };
252
- const dataTagSymbol: unique symbol;
253
- type DataTag<Type, Value> = Type & {
254
- [dataTagSymbol]: Value;
255
- };
256
- type UUID = string;
257
- type Source = string;
258
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
259
- type Mode = 'file' | 'directory';
260
- /**
261
- * Name to be used to dynamicly create the baseName(based on input.path)
262
- * Based on UNIX basename
263
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
264
- */
265
- type BaseName = `${string}${Extname}`;
266
- /**
267
- * Path will be full qualified path to a specified file
268
- */
269
- type Path = string;
270
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
271
- type OptionalPath = Path | undefined | null;
272
- type FileMetaBase = {
273
- pluginKey?: KubbPlugin['key'];
274
- };
275
- type File<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = {
276
- /**
277
- * Unique identifier to reuse later
278
- * @default crypto.randomUUID()
279
- */
280
- id?: string;
281
- /**
282
- * Name to be used to create the path
283
- * Based on UNIX basename, `${name}.extName`
284
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
285
- */
286
- baseName: TBaseName;
287
- /**
288
- * Path will be full qualified path to a specified file
289
- */
290
- path: AdvancedPath<TBaseName> | Path;
291
- source: Source;
292
- imports?: Import[];
293
- exports?: Export[];
294
- /**
295
- * This will call fileManager.add instead of fileManager.addOrAppend, adding the source when the files already exists
296
- * This will also ignore the combinefiles utils
297
- * @default `false`
298
- */
299
- override?: boolean;
300
- /**
301
- * Use extra meta, this is getting used to generate the barrel/index files.
302
- */
303
- meta?: TMeta;
304
- /**
305
- * This will override `process.env[key]` inside the `source`, see `getFileSource`.
306
- */
307
- env?: NodeJS.ProcessEnv;
308
- };
309
- type ResolvedFile<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = KubbFile.File<TMeta, TBaseName> & {
310
- /**
311
- * @default crypto.randomUUID()
312
- */
313
- id: UUID;
314
- /**
315
- * Contains the first part of the baseName, generated based on baseName
316
- * @link https://nodejs.org/api/path.html#pathformatpathobject
317
- */
318
- name: string;
319
- };
320
- }
321
- type AddResult<T extends Array<KubbFile.File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<KubbFile.ResolvedFile[]> : Promise<KubbFile.ResolvedFile>>>;
322
- type AddIndexesProps = {
323
- /**
324
- * Root based on root and output.path specified in the config
325
- */
326
- root: string;
327
- /**
328
- * Output for plugin
329
- */
330
- output: {
331
- path: string;
332
- exportAs?: string;
333
- extName?: KubbFile.Extname;
334
- exportType?: 'barrel' | false;
335
- };
336
- options?: BarrelManagerOptions;
337
- meta?: KubbFile.File['meta'];
338
- };
339
- type Options = {
340
- queue?: Queue;
341
- task?: QueueJob<KubbFile.ResolvedFile>;
342
- /**
343
- * Timeout between writes
344
- */
345
- timeout?: number;
346
- };
347
- declare class FileManager {
348
- #private;
349
- constructor(options?: Options);
350
- get files(): Array<KubbFile.File>;
351
- get isExecuting(): boolean;
352
- add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
353
- addIndexes({ root, output, meta, options }: AddIndexesProps): Promise<Array<KubbFile.File> | undefined>;
354
- getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
355
- get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
356
- remove(path: KubbFile.Path): void;
357
- write(...params: Parameters<typeof write>): Promise<string | undefined>;
358
- read(...params: Parameters<typeof read>): Promise<string>;
359
- static getSource<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(file: KubbFile.File<TMeta>): string;
360
- static combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(files: Array<KubbFile.File<TMeta> | null>): Array<KubbFile.File<TMeta>>;
361
- static getMode(path: string | undefined | null): KubbFile.Mode;
362
- static get extensions(): Array<KubbFile.Extname>;
363
- static isExtensionAllowed(baseName: string): boolean;
364
- }
365
-
366
- type InputPath = {
367
- /**
368
- * Path to be used as the input. This can be an absolute path or a path relative to the `root`.
369
- */
370
- path: string;
371
- };
372
- type InputData = {
373
- /**
374
- * `string` or `object` containing the data.
375
- */
376
- data: string | unknown;
377
- };
378
- type Input = InputPath | InputData;
379
- /**
380
- * @private
381
- */
382
- type KubbConfig<TInput = Input> = {
383
- /**
384
- * Optional config name to show in CLI output
385
- */
386
- name?: string;
387
- /**
388
- * Project root directory. Can be an absolute path, or a path relative from
389
- * the location of the config file itself.
390
- * @default process.cwd()
391
- */
392
- root: string;
393
- input: TInput;
394
- output: {
395
- /**
396
- * Path to be used to export all generated files.
397
- * This can be an absolute path, or a path relative based of the defined `root` option.
398
- */
399
- path: string;
400
- /**
401
- * Clean output directory before each build.
402
- */
403
- clean?: boolean;
404
- /**
405
- * Write files to the fileSystem
406
- * This is being used for the playground.
407
- * @default true
408
- */
409
- write?: boolean;
410
- };
411
- /**
412
- * Array of Kubb plugins to use.
413
- * The plugin/package can forsee some options that you need to pass through.
414
- * Sometimes a plugin is depended on another plugin, if that's the case you will get an error back from the plugin you installed.
415
- */
416
- plugins?: Array<KubbPlugin>;
417
- /**
418
- * Hooks that will be called when a specific action is triggered in Kubb.
419
- */
420
- hooks?: {
421
- /**
422
- * Hook that will be triggered at the end of all executions.
423
- * Useful for running Prettier or ESLint to format/lint your code.
424
- */
425
- done?: string | Array<string>;
426
- };
427
- };
428
- type PluginFactoryOptions<
429
- /**
430
- * Name to be used for the plugin, this will also be used for they key.
431
- */
432
- TName extends string = string,
433
- /**
434
- * Options of the plugin.
435
- */
436
- TOptions extends object = object,
437
- /**
438
- * Options of the plugin that can be used later on, see `options` inside your plugin config.
439
- */
440
- TResolvedOptions extends object = TOptions,
441
- /**
442
- * API that you want to expose to other plugins.
443
- */
444
- TAPI = any,
445
- /**
446
- * When calling `resolvePath` you can specify better types.
447
- */
448
- TResolvePathOptions extends object = object,
449
- /**
450
- * When using @kubb/react(based on React) you can specify here which types should be used when calling render.
451
- * Always extend from `AppMeta` of the core.
452
- */
453
- TAppMeta = unknown> = {
454
- name: TName;
455
- /**
456
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
457
- */
458
- key: [name: TName | string, identifier?: string | number];
459
- options: TOptions;
460
- resolvedOptions: TResolvedOptions;
461
- api: TAPI;
462
- resolvePathOptions: TResolvePathOptions;
463
- appMeta: {
464
- pluginManager: PluginManager;
465
- plugin: KubbPlugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
466
- } & TAppMeta;
467
- };
468
- type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
469
- /**
470
- * Unique name used for the plugin
471
- * @example @kubb/typescript
472
- */
473
- name: TOptions['name'];
474
- /**
475
- * Internal key used when a developer uses more than one of the same plugin
476
- * @private
477
- */
478
- key: TOptions['key'];
479
- /**
480
- * 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.
481
- * Can be used to validate depended plugins.
482
- */
483
- pre?: Array<string>;
484
- /**
485
- * 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.
486
- */
487
- post?: Array<string>;
488
- /**
489
- * Options set for a specific plugin(see kubb.config.js), passthrough of options.
490
- */
491
- options: TOptions['resolvedOptions'];
492
- } & (TOptions['api'] extends never ? {
493
- api?: never;
494
- } : {
495
- api: TOptions['api'];
496
- });
497
- type KubbPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = KubbPlugin<TOptions> & PluginLifecycle<TOptions>;
498
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
499
- /**
500
- * Start of the lifecycle of a plugin.
501
- * @type hookParallel
502
- */
503
- buildStart?: (this: PluginContext<TOptions>, kubbConfig: KubbConfig) => PossiblePromise<void>;
504
- /**
505
- * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
506
- * Options can als be included.
507
- * @type hookFirst
508
- * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
509
- */
510
- resolvePath?: (this: PluginContext<TOptions>, baseName: string, directory?: string, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
511
- /**
512
- * Resolve to a name based on a string.
513
- * Useful when converting to PascalCase or camelCase.
514
- * @type hookFirst
515
- * @example ('pet') => 'Pet'
516
- */
517
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
518
- /**
519
- * Makes it possible to run async logic to override the path defined previously by `resolvePath`.
520
- * @type hookFirst
521
- */
522
- load?: (this: Omit<PluginContext<TOptions>, 'addFile'>, path: KubbFile.Path) => PossiblePromise<TransformResult | null>;
523
- /**
524
- * Transform the source-code.
525
- * @type hookReduceArg0
526
- */
527
- transform?: (this: Omit<PluginContext<TOptions>, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise<TransformResult>;
528
- /**
529
- * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).
530
- * @type hookParallel
531
- */
532
- writeFile?: (this: Omit<PluginContext<TOptions>, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise<string | void>;
533
- /**
534
- * End of the plugin lifecycle.
535
- * @type hookParallel
536
- */
537
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
538
- };
539
- type PluginLifecycleHooks = keyof PluginLifecycle;
540
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
541
- type PluginCache = Record<string, [number, unknown]>;
542
- type ResolvePathParams<TOptions = object> = {
543
- pluginKey?: KubbPlugin['key'];
544
- baseName: string;
545
- directory?: string | undefined;
546
- /**
547
- * Options to be passed to 'resolvePath' 3th parameter
548
- */
549
- options?: TOptions;
550
- };
551
- type ResolveNameParams = {
552
- name: string;
553
- pluginKey?: KubbPlugin['key'];
554
- /**
555
- * `file` will be used to customize the name of the created file(use of camelCase)
556
- * `function` can be used used to customize the exported functions(use of camelCase)
557
- * `type` is a special type for TypeScript(use of PascalCase)
558
- */
559
- type?: 'file' | 'function' | 'type';
560
- };
561
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
562
- config: KubbConfig;
563
- cache: Cache<PluginCache>;
564
- fileManager: FileManager;
565
- pluginManager: PluginManager;
566
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.File>>;
567
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
568
- resolveName: (params: ResolveNameParams) => string;
569
- logger: Logger;
570
- /**
571
- * All plugins
572
- */
573
- plugins: KubbPlugin[];
574
- /**
575
- * Current plugin
576
- */
577
- plugin: KubbPlugin<TOptions>;
578
- };
579
- type TransformResult = string | null;
580
-
581
- interface Cache<TStore extends object = object> {
582
- delete(id: keyof TStore): boolean;
583
- get(id: keyof TStore): TStore[keyof TStore] | null;
584
- has(id: keyof TStore): boolean;
585
- set(id: keyof TStore, value: unknown): void;
586
- }
587
- declare function createPluginCache<TStore extends PluginCache>(Store?: TStore): Cache<TStore>;
588
-
589
- declare function clean(path: string): Promise<void>;
1
+ import { PossiblePromise } from '@kubb/types';
2
+ export { Q as Queue, a as QueueJob } from './Queue-2-6pMcCx.js';
590
3
 
591
4
  type FunctionParamsASTWithoutType = {
592
5
  name?: string;
@@ -629,13 +42,8 @@ declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown
629
42
  reason: T;
630
43
  };
631
44
 
632
- declare function randomColour(text?: string, colours?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
633
- declare function randomPicoColour(text?: string, colors?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
634
-
635
45
  declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
636
46
 
637
- declare const throttle: <R, A extends any[]>(fn: (...args: A) => R, delay: number) => [(...args: A) => R | undefined, () => void];
638
-
639
47
  declare function timeout(ms: number): Promise<unknown>;
640
48
 
641
49
  declare function getUniqueName(originalName: string, data: Record<string, number>): string;
@@ -684,4 +92,4 @@ declare class URLPath {
684
92
  toURLPath(): string;
685
93
  }
686
94
 
687
- export { type Cache, FunctionParams, type FunctionParamsAST, LogLevel, type Logger, Queue, type QueueJob, TreeNode, type TreeNodeOptions, type URLObject, URLPath, clean, createLogger, createPluginCache, getRelativePath, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, randomColour, randomPicoColour, read, readSync, renderTemplate, setUniqueName, throttle, timeout, write };
95
+ export { FunctionParams, type FunctionParamsAST, type URLObject, URLPath, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout };