@kubb/core 5.0.0-beta.61 → 5.0.0-beta.62

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.
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { FileNode, HttpMethod, ImportNode, InputMeta, InputNode, Macro, Node, OperationNode, SchemaNode, UserFileNode } from "@kubb/ast";
2
+ import { Enforce, FileNode, HttpMethod, ImportNode, InputMeta, InputNode, Macro, Node, OperationNode, SchemaNode, UserFileNode } from "@kubb/ast";
3
3
 
4
4
  //#region ../../internals/utils/src/asyncEventEmitter.d.ts
5
5
  /**
@@ -1190,7 +1190,7 @@ type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
1190
1190
  *
1191
1191
  * Dependency constraints always take precedence over `enforce`.
1192
1192
  */
1193
- enforce?: 'pre' | 'post';
1193
+ enforce?: Enforce;
1194
1194
  /**
1195
1195
  * The options passed by the user when calling the plugin factory.
1196
1196
  */
@@ -2901,4 +2901,4 @@ declare class Diagnostics {
2901
2901
  }
2902
2902
  //#endregion
2903
2903
  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$1 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 };
2904
- //# sourceMappingURL=diagnostics-DiaUv_iK.d.ts.map
2904
+ //# sourceMappingURL=diagnostics-D0G07LHG.d.ts.map
package/dist/index.cjs CHANGED
@@ -611,7 +611,7 @@ function createAdapter(build) {
611
611
  /**
612
612
  * Docs major version, derived from the package version so the link tracks the published major.
613
613
  */
614
- const docsMajor = "5.0.0-beta.61".split(".")[0] ?? "5";
614
+ const docsMajor = "5.0.0-beta.62".split(".")[0] ?? "5";
615
615
  /**
616
616
  * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
617
617
  *
@@ -1788,39 +1788,21 @@ var KubbDriver = class {
1788
1788
  * Call this method inside `addGenerator()` (in `kubb:plugin:setup`) to wire up a generator.
1789
1789
  */
1790
1790
  registerGenerator(pluginName, generator) {
1791
- if (generator.schema) {
1792
- const schemaHandler = async (node, ctx) => {
1791
+ const register = (event, method) => {
1792
+ if (!method) return;
1793
+ const handler = async (node, ctx) => {
1793
1794
  if (ctx.plugin.name !== pluginName) return;
1794
- const result = await generator.schema(node, ctx);
1795
+ const result = await method(node, ctx);
1795
1796
  await this.dispatch({
1796
1797
  result,
1797
1798
  renderer: generator.renderer
1798
1799
  });
1799
1800
  };
1800
- this.#trackListener("kubb:generate:schema", schemaHandler);
1801
- }
1802
- if (generator.operation) {
1803
- const operationHandler = async (node, ctx) => {
1804
- if (ctx.plugin.name !== pluginName) return;
1805
- const result = await generator.operation(node, ctx);
1806
- await this.dispatch({
1807
- result,
1808
- renderer: generator.renderer
1809
- });
1810
- };
1811
- this.#trackListener("kubb:generate:operation", operationHandler);
1812
- }
1813
- if (generator.operations) {
1814
- const operationsHandler = async (nodes, ctx) => {
1815
- if (ctx.plugin.name !== pluginName) return;
1816
- const result = await generator.operations(nodes, ctx);
1817
- await this.dispatch({
1818
- result,
1819
- renderer: generator.renderer
1820
- });
1821
- };
1822
- this.#trackListener("kubb:generate:operations", operationsHandler);
1823
- }
1801
+ this.#trackListener(event, handler);
1802
+ };
1803
+ register("kubb:generate:schema", generator.schema);
1804
+ register("kubb:generate:operation", generator.operation);
1805
+ register("kubb:generate:operations", generator.operations);
1824
1806
  this.#eventGeneratorPlugins.add(pluginName);
1825
1807
  }
1826
1808
  /**