@kubb/core 0.40.0 → 0.41.1

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.ts CHANGED
@@ -96,6 +96,10 @@ type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
96
96
  * Defined an api that can be used by other plugins
97
97
  */
98
98
  api?: TOptions['api'];
99
+ /**
100
+ * Options set for a specific plugin(see kubb.config.ts)
101
+ */
102
+ options?: TOptions['options'];
99
103
  } & Partial<PluginLifecycle>;
100
104
  type PluginFactoryOptions<Options = unknown, Nested extends boolean = false, Api = any> = {
101
105
  options: Options;
@@ -158,9 +162,7 @@ type PluginContext = {
158
162
  config: KubbConfig;
159
163
  cache: Cache;
160
164
  fileManager: FileManager;
161
- addFile: (emitedFile: EmittedFile | File, options?: {
162
- root?: true;
163
- }) => Promise<File>;
165
+ addFile: (file: File) => Promise<File>;
164
166
  resolveId: (params: ResolveIdParams) => MaybePromise<OptionalPath>;
165
167
  load: (id: string) => MaybePromise<TransformResult | void>;
166
168
  };
@@ -184,29 +186,6 @@ type PathMode = 'file' | 'directory';
184
186
  declare const getPathMode: (path: string | undefined | null) => PathMode | undefined;
185
187
  declare const read: (path: string) => Promise<string>;
186
188
 
187
- /**
188
- * @deprecated Use userFile instead
189
- */
190
- type EmittedFile = {
191
- /**
192
- * equal to importee when getting passed through resolveId
193
- */
194
- id: string;
195
- /**
196
- * The importer is the fully resolved id of the importing module.
197
- */
198
- importer?: string;
199
- /**
200
- * Name to be used to dynamicly create the fileName(based on input.path)
201
- */
202
- name?: string;
203
- /**
204
- * FileName will be the end result so no input.path will not be added
205
- */
206
- fileName?: string;
207
- source?: string;
208
- options?: Record<string, any>;
209
- };
210
189
  type Import = {
211
190
  name: string | string[];
212
191
  path: string;
@@ -251,9 +230,19 @@ declare class FileManager {
251
230
  private getCache;
252
231
  private getCacheByPath;
253
232
  private getCountByStatus;
233
+ private getSource;
254
234
  get files(): File[];
255
235
  add(file: File): Promise<File>;
256
- build(file: File): string;
236
+ build(file: File): {
237
+ source: string;
238
+ fileName: string;
239
+ path: string;
240
+ imports?: {
241
+ name: string | string[];
242
+ path: string;
243
+ type?: boolean | undefined;
244
+ }[] | undefined;
245
+ };
257
246
  addOrAppend(file: File): Promise<File>;
258
247
  setStatus(id: UUID, status: Status): void;
259
248
  get(id: UUID): File | undefined;
@@ -388,4 +377,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
388
377
  abstract build(schema: TInput, name: string, description?: string): TOutput;
389
378
  }
390
379
 
391
- export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, EmittedFile, File, FileManager, FileName, Generator, KubbBuild, KubbConfig, KubbJSONPlugin, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, clean, createPlugin, createPluginCache, build as default, defineConfig, getPathMode, getRelativePath, hooks, isPromise, name, read, validatePlugins, write };
380
+ export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, File, FileManager, FileName, Generator, KubbBuild, KubbConfig, KubbJSONPlugin, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, clean, createPlugin, createPluginCache, build as default, defineConfig, getPathMode, getRelativePath, hooks, isPromise, name, read, validatePlugins, write };