@kubb/core 1.13.0-canary.20231018T171206 → 1.14.0-canary.20231018T192916

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.
package/dist/index.d.cts CHANGED
@@ -105,16 +105,12 @@ type RunOptions = {
105
105
  description?: string;
106
106
  };
107
107
  declare class Queue {
108
- private queue;
109
- private workerCount;
110
- private maxParallel;
111
- private debug;
108
+ #private;
112
109
  constructor(maxParallel: number, debug?: boolean);
113
110
  run<T>(job: QueueJob<T>, options?: RunOptions): Promise<T>;
114
111
  runSync<T>(job: QueueJob<T>, options?: RunOptions): void;
115
112
  get hasJobs(): boolean;
116
113
  get count(): number;
117
- private work;
118
114
  }
119
115
 
120
116
  declare function escape(text?: string): string;
@@ -285,9 +281,7 @@ declare class FunctionParams {
285
281
  }
286
282
 
287
283
  declare class FileManager {
288
- private cache;
289
- private task?;
290
- private queue?;
284
+ #private;
291
285
  constructor(options?: {
292
286
  queue?: Queue;
293
287
  task?: QueueJob<KubbFile.ResolvedFile>;
@@ -297,7 +291,6 @@ declare class FileManager {
297
291
  get isExecuting(): boolean;
298
292
  add(file: KubbFile.File): Promise<KubbFile.ResolvedFile>;
299
293
  addOrAppend(file: KubbFile.File): Promise<KubbFile.ResolvedFile>;
300
- private append;
301
294
  getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
302
295
  get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
303
296
  remove(path: KubbFile.Path): void;
@@ -317,8 +310,8 @@ declare function combineImports(imports: Array<KubbFile.Import>, exports: Array<
317
310
  declare function createFileSource(file: KubbFile.File): string;
318
311
 
319
312
  declare class EventEmitter<TEvents extends Record<string, any>> {
313
+ #private;
320
314
  constructor();
321
- private emitter;
322
315
  emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
323
316
  on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
324
317
  off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
@@ -365,13 +358,13 @@ type Events = {
365
358
  error: [pluginError: PluginError];
366
359
  };
367
360
  declare class PluginManager {
361
+ #private;
368
362
  plugins: KubbPlugin[];
369
363
  readonly fileManager: FileManager;
370
364
  readonly eventEmitter: EventEmitter<Events>;
371
365
  readonly queue: Queue;
372
366
  readonly executed: Executer[];
373
367
  readonly logger: Logger;
374
- private readonly core;
375
368
  constructor(config: KubbConfig, options: Options$1);
376
369
  resolvePath: (params: ResolvePathParams) => KubbFile.OptionalPath;
377
370
  resolveName: (params: ResolveNameParams) => string;
@@ -432,25 +425,7 @@ declare class PluginManager {
432
425
  hookName: H;
433
426
  parameters?: Parameters<PluginLifecycle[H]>;
434
427
  }): Promise<void>;
435
- private getSortedPlugins;
436
428
  getPlugin(hookName: keyof PluginLifecycle, pluginName: string): KubbPlugin;
437
- private addExecutedToCallStack;
438
- /**
439
- * Run an async plugin hook and return the result.
440
- * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
441
- * @param args Arguments passed to the plugin hook.
442
- * @param plugin The actual pluginObject to run.
443
- */
444
- private execute;
445
- /**
446
- * Run a sync plugin hook and return the result.
447
- * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
448
- * @param args Arguments passed to the plugin hook.
449
- * @param plugin The acutal plugin
450
- * @param replaceContext When passed, the plugin context can be overridden.
451
- */
452
- private executeSync;
453
- private catcher;
454
429
  }
455
430
 
456
431
  declare class ValidationPluginError extends Error {
@@ -473,7 +448,7 @@ type PackageJSON = {
473
448
  devDependencies?: Record<string, string>;
474
449
  };
475
450
  declare class PackageManager {
476
- private cwd;
451
+ #private;
477
452
  constructor(workspace?: string);
478
453
  getPackageJSON(): Promise<PackageJSON | undefined>;
479
454
  getPackageJSONSync(): PackageJSON | undefined;
@@ -774,10 +749,12 @@ declare const pluginName: CorePluginOptions['name'];
774
749
  * Abstract class that contains the building blocks for plugins to create their own Generator
775
750
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
776
751
  */
777
- declare abstract class Generator<TOptions extends object = object> {
778
- private _options;
779
- constructor(options?: TOptions);
752
+ declare abstract class Generator<TOptions = unknown, TContext = unknown> {
753
+ #private;
754
+ constructor(options?: TOptions, context?: TContext);
780
755
  get options(): TOptions;
756
+ get context(): TContext;
757
+ set options(options: TOptions);
781
758
  abstract build(...params: unknown[]): unknown;
782
759
  }
783
760
 
package/dist/index.d.ts CHANGED
@@ -105,16 +105,12 @@ type RunOptions = {
105
105
  description?: string;
106
106
  };
107
107
  declare class Queue {
108
- private queue;
109
- private workerCount;
110
- private maxParallel;
111
- private debug;
108
+ #private;
112
109
  constructor(maxParallel: number, debug?: boolean);
113
110
  run<T>(job: QueueJob<T>, options?: RunOptions): Promise<T>;
114
111
  runSync<T>(job: QueueJob<T>, options?: RunOptions): void;
115
112
  get hasJobs(): boolean;
116
113
  get count(): number;
117
- private work;
118
114
  }
119
115
 
120
116
  declare function escape(text?: string): string;
@@ -285,9 +281,7 @@ declare class FunctionParams {
285
281
  }
286
282
 
287
283
  declare class FileManager {
288
- private cache;
289
- private task?;
290
- private queue?;
284
+ #private;
291
285
  constructor(options?: {
292
286
  queue?: Queue;
293
287
  task?: QueueJob<KubbFile.ResolvedFile>;
@@ -297,7 +291,6 @@ declare class FileManager {
297
291
  get isExecuting(): boolean;
298
292
  add(file: KubbFile.File): Promise<KubbFile.ResolvedFile>;
299
293
  addOrAppend(file: KubbFile.File): Promise<KubbFile.ResolvedFile>;
300
- private append;
301
294
  getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
302
295
  get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
303
296
  remove(path: KubbFile.Path): void;
@@ -317,8 +310,8 @@ declare function combineImports(imports: Array<KubbFile.Import>, exports: Array<
317
310
  declare function createFileSource(file: KubbFile.File): string;
318
311
 
319
312
  declare class EventEmitter<TEvents extends Record<string, any>> {
313
+ #private;
320
314
  constructor();
321
- private emitter;
322
315
  emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
323
316
  on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
324
317
  off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
@@ -365,13 +358,13 @@ type Events = {
365
358
  error: [pluginError: PluginError];
366
359
  };
367
360
  declare class PluginManager {
361
+ #private;
368
362
  plugins: KubbPlugin[];
369
363
  readonly fileManager: FileManager;
370
364
  readonly eventEmitter: EventEmitter<Events>;
371
365
  readonly queue: Queue;
372
366
  readonly executed: Executer[];
373
367
  readonly logger: Logger;
374
- private readonly core;
375
368
  constructor(config: KubbConfig, options: Options$1);
376
369
  resolvePath: (params: ResolvePathParams) => KubbFile.OptionalPath;
377
370
  resolveName: (params: ResolveNameParams) => string;
@@ -432,25 +425,7 @@ declare class PluginManager {
432
425
  hookName: H;
433
426
  parameters?: Parameters<PluginLifecycle[H]>;
434
427
  }): Promise<void>;
435
- private getSortedPlugins;
436
428
  getPlugin(hookName: keyof PluginLifecycle, pluginName: string): KubbPlugin;
437
- private addExecutedToCallStack;
438
- /**
439
- * Run an async plugin hook and return the result.
440
- * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
441
- * @param args Arguments passed to the plugin hook.
442
- * @param plugin The actual pluginObject to run.
443
- */
444
- private execute;
445
- /**
446
- * Run a sync plugin hook and return the result.
447
- * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
448
- * @param args Arguments passed to the plugin hook.
449
- * @param plugin The acutal plugin
450
- * @param replaceContext When passed, the plugin context can be overridden.
451
- */
452
- private executeSync;
453
- private catcher;
454
429
  }
455
430
 
456
431
  declare class ValidationPluginError extends Error {
@@ -473,7 +448,7 @@ type PackageJSON = {
473
448
  devDependencies?: Record<string, string>;
474
449
  };
475
450
  declare class PackageManager {
476
- private cwd;
451
+ #private;
477
452
  constructor(workspace?: string);
478
453
  getPackageJSON(): Promise<PackageJSON | undefined>;
479
454
  getPackageJSONSync(): PackageJSON | undefined;
@@ -774,10 +749,12 @@ declare const pluginName: CorePluginOptions['name'];
774
749
  * Abstract class that contains the building blocks for plugins to create their own Generator
775
750
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
776
751
  */
777
- declare abstract class Generator<TOptions extends object = object> {
778
- private _options;
779
- constructor(options?: TOptions);
752
+ declare abstract class Generator<TOptions = unknown, TContext = unknown> {
753
+ #private;
754
+ constructor(options?: TOptions, context?: TContext);
780
755
  get options(): TOptions;
756
+ get context(): TContext;
757
+ set options(options: TOptions);
781
758
  abstract build(...params: unknown[]): unknown;
782
759
  }
783
760