@kubb/core 5.0.0-beta.73 → 5.0.0-beta.74

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.
@@ -1117,10 +1117,20 @@ TResolver extends Resolver = Resolver> = {
1117
1117
  */
1118
1118
  type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
1119
1119
  /**
1120
- * Register a generator dynamically. Generators fire during the AST walk (schema/operation/operations)
1121
- * just like generators declared statically on `createPlugin`.
1120
+ * Register one or more generators dynamically. Generators fire during the AST walk
1121
+ * (schema/operation/operations) just like generators declared statically on `createPlugin`.
1122
+ *
1123
+ * Pass generators as separate arguments or as arrays. Arrays are flattened, so spreading an
1124
+ * existing list is optional.
1125
+ *
1126
+ * @example
1127
+ * ```ts
1128
+ * ctx.addGenerator(myGenerator)
1129
+ * ctx.addGenerator(schemaGenerator, operationGenerator)
1130
+ * ctx.addGenerator(selectedGenerators)
1131
+ * ```
1122
1132
  */
1123
- addGenerator<TElement = unknown>(generator: Generator<TFactory, TElement>): void;
1133
+ addGenerator<TElement = unknown>(...generators: Array<Generator<TFactory, TElement> | Array<Generator<TFactory, TElement>>>): void;
1124
1134
  /**
1125
1135
  * Set or override the resolver for this plugin.
1126
1136
  * The resolver controls file naming and path resolution.
@@ -2889,4 +2899,4 @@ declare class Diagnostics {
2889
2899
  }
2890
2900
  //#endregion
2891
2901
  export { KubbPluginSetupContext as $, KubbHookStartContext as A, Adapter as At, ParsedFile as B, KubbFilesProcessingEndContext as C, GenerationResult as Ct, KubbGenerationStartContext as D, UserReporter as Dt, KubbGenerationEndContext as E, ReporterName as Et, KubbSuccessContext as F, Generator as G, createKubb as H, KubbWarnContext as I, KubbDriver as J, GeneratorContext as K, PossibleConfig as L, KubbInfoContext as M, AdapterSource as Mt, KubbLifecycleStartContext as N, createAdapter as Nt, KubbHookEndContext as O, createReporter as Ot, KubbPluginsEndContext as P, AsyncEventEmitter as Pt, KubbPluginEndContext as Q, UserConfig as R, KubbFileProcessingUpdate as S, createStorage as St, KubbFilesProcessingUpdateContext as T, ReporterContext as Tt, Parser as U, Kubb$1 as V, defineParser as W, Group as X, Exclude$1 as Y, Include as Z, InputPath as _, defineResolver as _t, DiagnosticLocation as a, Override as at, KubbDiagnosticContext as b, createRenderer as bt, PerformanceDiagnostic as c, definePlugin as ct, SerializedDiagnostic as d, ResolveBannerFile as dt, KubbPluginStartContext as et, UpdateDiagnostic as f, ResolveOptionsContext as ft, InputData as g, ResolverPathParams as gt, Config as h, ResolverFileParams as ht, DiagnosticKind as i, OutputOptions as it, KubbHooks as j, AdapterFactoryOptions as jt, KubbHookLineContext as k, logLevel as kt, ProblemCode as l, BannerMeta as lt, CLIOptions as m, ResolverContext as mt, DiagnosticByCode as n, Output as nt, DiagnosticSeverity as o, Plugin as ot, BuildOutput as p, Resolver as pt, defineGenerator as q, DiagnosticDoc as r, OutputMode as rt, Diagnostics as s, PluginFactoryOptions as st, Diagnostic as t, NormalizedPlugin as tt, ProblemDiagnostic as u, ResolveBannerContext as ut, KubbBuildEndContext as v, Renderer as vt, KubbFilesProcessingStartContext as w, Reporter as wt, KubbErrorContext as x, Storage as xt, KubbBuildStartContext as y, RendererFactory as yt, FileProcessorHooks as z };
2892
- //# sourceMappingURL=diagnostics-CJtO1uSM.d.ts.map
2902
+ //# sourceMappingURL=diagnostics-uXrHtPzQ.d.ts.map
package/dist/index.cjs CHANGED
@@ -406,7 +406,7 @@ function createAdapter(build) {
406
406
  /**
407
407
  * Docs major version, derived from the package version so the link tracks the published major.
408
408
  */
409
- const docsMajor = "5.0.0-beta.73".split(".")[0] ?? "5";
409
+ const docsMajor = "5.0.0-beta.74".split(".")[0] ?? "5";
410
410
  /**
411
411
  * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
412
412
  *
@@ -1506,8 +1506,8 @@ var KubbDriver = class {
1506
1506
  const pluginCtx = {
1507
1507
  ...globalCtx,
1508
1508
  options: plugin.options ?? {},
1509
- addGenerator: (gen) => {
1510
- this.registerGenerator(plugin.name, gen);
1509
+ addGenerator: (...generators) => {
1510
+ for (const generator of generators.flat()) this.registerGenerator(plugin.name, generator);
1511
1511
  },
1512
1512
  setResolver: (resolver) => {
1513
1513
  this.setPluginResolver(plugin.name, resolver);