@kubb/core
Advanced tools
Comparing version 0.52.0 to 0.53.0
@@ -108,9 +108,10 @@ import EventEmitter from 'eventemitter3'; | ||
options?: TOptions['options']; | ||
} & Partial<PluginLifecycle>; | ||
type PluginFactoryOptions<Options = unknown, Nested extends boolean = false, Api = any> = { | ||
} & Partial<PluginLifecycle<TOptions>>; | ||
type PluginFactoryOptions<Options = unknown, Nested extends boolean = false, Api = any, ResolveIdOptions = Record<string, any>> = { | ||
options: Options; | ||
resolveIdOptions: ResolveIdOptions; | ||
nested: Nested; | ||
api: Api; | ||
}; | ||
type PluginLifecycle = { | ||
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = { | ||
/** | ||
@@ -131,3 +132,3 @@ * Valdiate all plugins to see if their depended plugins are installed and configured. | ||
*/ | ||
resolveId: (this: PluginContext, fileName: string, directory?: string, options?: Record<string, any>) => OptionalPath; | ||
resolveId: (this: PluginContext, fileName: string, directory?: string, options?: TOptions['resolveIdOptions']) => OptionalPath; | ||
/** | ||
@@ -155,3 +156,3 @@ * Makes it possible to run async logic to override the path defined previously by `resolveId`. | ||
type PluginLifecycleHooks = keyof PluginLifecycle; | ||
type ResolveIdParams = { | ||
type ResolveIdParams<TOptions = Record<string, any>> = { | ||
fileName: string; | ||
@@ -167,5 +168,5 @@ directory?: string | undefined; | ||
*/ | ||
options?: Record<string, any>; | ||
options?: TOptions; | ||
}; | ||
type PluginContext = { | ||
type PluginContext<TOptions = Record<string, any>> = { | ||
config: KubbConfig; | ||
@@ -175,3 +176,3 @@ cache: Cache; | ||
addFile: (file: File) => Promise<File>; | ||
resolveId: (params: ResolveIdParams) => MaybePromise<OptionalPath>; | ||
resolveId: (params: ResolveIdParams<TOptions>) => MaybePromise<OptionalPath>; | ||
load: (id: string) => MaybePromise<TransformResult | void>; | ||
@@ -343,3 +344,3 @@ }; | ||
declare const hooks: [keyof PluginLifecycle]; | ||
declare const hooks: [keyof PluginLifecycle<PluginFactoryOptions<unknown, false, any, Record<string, any>>>]; | ||
declare class PluginManager { | ||
@@ -346,0 +347,0 @@ plugins: KubbPlugin[]; |
{ | ||
"name": "@kubb/core", | ||
"version": "0.52.0", | ||
"version": "0.53.0", | ||
"description": "Generator core", | ||
@@ -5,0 +5,0 @@ "repository": { |
3552696
31429