@kubb/core 0.52.0 → 0.53.0

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 (2) hide show
  1. package/dist/index.d.ts +10 -9
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -105,13 +105,14 @@ type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
105
105
  * Options set for a specific plugin(see kubb.config.ts)
106
106
  */
107
107
  options?: TOptions['options'];
108
- } & Partial<PluginLifecycle>;
109
- type PluginFactoryOptions<Options = unknown, Nested extends boolean = false, Api = any> = {
108
+ } & Partial<PluginLifecycle<TOptions>>;
109
+ type PluginFactoryOptions<Options = unknown, Nested extends boolean = false, Api = any, ResolveIdOptions = Record<string, any>> = {
110
110
  options: Options;
111
+ resolveIdOptions: ResolveIdOptions;
111
112
  nested: Nested;
112
113
  api: Api;
113
114
  };
114
- type PluginLifecycle = {
115
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
115
116
  /**
116
117
  * Valdiate all plugins to see if their depended plugins are installed and configured.
117
118
  * @type hookParallel
@@ -127,7 +128,7 @@ type PluginLifecycle = {
127
128
  * @type hookFirst
128
129
  * @example ('./Pet.ts', './src/gen/')
129
130
  */
130
- resolveId: (this: PluginContext, fileName: string, directory?: string, options?: Record<string, any>) => OptionalPath;
131
+ resolveId: (this: PluginContext, fileName: string, directory?: string, options?: TOptions['resolveIdOptions']) => OptionalPath;
131
132
  /**
132
133
  * Makes it possible to run async logic to override the path defined previously by `resolveId`.
133
134
  * @type hookFirst
@@ -150,7 +151,7 @@ type PluginLifecycle = {
150
151
  buildEnd: (this: PluginContext) => MaybePromise<void>;
151
152
  };
152
153
  type PluginLifecycleHooks = keyof PluginLifecycle;
153
- type ResolveIdParams = {
154
+ type ResolveIdParams<TOptions = Record<string, any>> = {
154
155
  fileName: string;
155
156
  directory?: string | undefined;
156
157
  /**
@@ -161,14 +162,14 @@ type ResolveIdParams = {
161
162
  /**
162
163
  * Options to be passed to 'resolveId' 3th parameter
163
164
  */
164
- options?: Record<string, any>;
165
+ options?: TOptions;
165
166
  };
166
- type PluginContext = {
167
+ type PluginContext<TOptions = Record<string, any>> = {
167
168
  config: KubbConfig;
168
169
  cache: Cache;
169
170
  fileManager: FileManager;
170
171
  addFile: (file: File) => Promise<File>;
171
- resolveId: (params: ResolveIdParams) => MaybePromise<OptionalPath>;
172
+ resolveId: (params: ResolveIdParams<TOptions>) => MaybePromise<OptionalPath>;
172
173
  load: (id: string) => MaybePromise<TransformResult | void>;
173
174
  };
174
175
  type TransformResult = string | null;
@@ -335,7 +336,7 @@ declare const name: "core";
335
336
  type Argument0<H extends keyof PluginLifecycle> = Parameters<PluginLifecycle[H]>[0];
336
337
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq';
337
338
 
338
- declare const hooks: [keyof PluginLifecycle];
339
+ declare const hooks: [keyof PluginLifecycle<PluginFactoryOptions<unknown, false, any, Record<string, any>>>];
339
340
  declare class PluginManager {
340
341
  plugins: KubbPlugin[];
341
342
  readonly fileManager: FileManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "Generator core",
5
5
  "repository": {
6
6
  "type": "git",