@kubb/core 0.37.17 → 0.37.19

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
@@ -177,7 +177,7 @@ declare const clean: (path: string) => Promise<unknown>;
177
177
  declare const getRelativePath: (root?: string | null, file?: string | null) => string;
178
178
  type PathMode = 'file' | 'directory';
179
179
  declare const getPathMode: (path: string | undefined | null) => PathMode | undefined;
180
- declare const read: (path: string) => Promise<Buffer>;
180
+ declare const read: (path: string) => Promise<string>;
181
181
 
182
182
  /**
183
183
  * @deprecated Use userFile instead
@@ -247,7 +247,7 @@ declare class FileManager {
247
247
  get(id: UUID): File | undefined;
248
248
  remove(id: UUID): void;
249
249
  write(...params: Parameters<typeof write>): Promise<void>;
250
- read(...params: Parameters<typeof read>): Promise<Buffer>;
250
+ read(...params: Parameters<typeof read>): Promise<string>;
251
251
  }
252
252
 
253
253
  declare class TreeNode<T = unknown> {
@@ -268,7 +268,7 @@ declare class TreeNode<T = unknown> {
268
268
  }
269
269
 
270
270
  type BuildOutput = {
271
- fileManager: FileManager;
271
+ files: FileManager['files'];
272
272
  };
273
273
  type Spinner = {
274
274
  start: (text?: string) => Spinner;
@@ -309,6 +309,7 @@ type Options = {
309
309
  load: PluginContext['load'];
310
310
  };
311
311
  type CorePluginOptions = PluginFactoryOptions<Options, false, PluginContext>;
312
+ declare const name: "core";
312
313
 
313
314
  /**
314
315
  * Get the type of the first argument in a function.
@@ -375,4 +376,4 @@ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput>
375
376
  abstract build(schema: TInput, name: string, description?: string): TOutput;
376
377
  }
377
378
 
378
- 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, read, validatePlugins, write };
379
+ 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 };
@@ -15587,6 +15587,7 @@ var kubb = (function (exports) {
15587
15587
 
15588
15588
  // src/build.ts
15589
15589
  init_define_process();
15590
+ var import_path4 = __toESM(require_path_browserify());
15590
15591
 
15591
15592
  // src/managers/pluginManager/PluginManager.ts
15592
15593
  init_define_process();
@@ -15681,7 +15682,7 @@ var kubb = (function (exports) {
15681
15682
  };
15682
15683
  var read = async (path) => {
15683
15684
  try {
15684
- return import_fs2.promises.readFile(path);
15685
+ return import_fs2.promises.readFile(path, { encoding: "utf8" });
15685
15686
  } catch (err) {
15686
15687
  console.error(err);
15687
15688
  throw err;
@@ -16232,7 +16233,7 @@ ${file.source}`
16232
16233
  fileManager.events.onSuccess(async () => {
16233
16234
  await pluginManager.hookParallel("buildEnd");
16234
16235
  setTimeout(() => {
16235
- done({ fileManager });
16236
+ done({ files: fileManager.files });
16236
16237
  }, 1e3);
16237
16238
  });
16238
16239
  fileManager.events.onAdd(async (id, file) => {
@@ -16252,6 +16253,11 @@ ${file.source}`
16252
16253
  }
16253
16254
  });
16254
16255
  await pluginManager.hookParallel("buildStart", [config]);
16256
+ pluginManager.fileManager.add({
16257
+ path: typeof config.input === "string" ? "input" : import_path4.default.resolve(config.root, config.input.path),
16258
+ fileName: typeof config.input === "string" ? "input" : config.input.path,
16259
+ source: typeof config.input === "string" ? config.input : await read(import_path4.default.resolve(config.root, config.input.path))
16260
+ });
16255
16261
  }
16256
16262
  function build(options) {
16257
16263
  return new Promise((resolve, reject) => {
@@ -16325,6 +16331,7 @@ ${file.source}`
16325
16331
  exports.getRelativePath = getRelativePath;
16326
16332
  exports.hooks = hooks;
16327
16333
  exports.isPromise = isPromise;
16334
+ exports.name = name;
16328
16335
  exports.read = read;
16329
16336
  exports.validatePlugins = validatePlugins;
16330
16337
  exports.write = write;