@kubb/core 5.14.2 → 5.14.4

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.cts CHANGED
@@ -2288,9 +2288,9 @@ type Generator<TOptions extends PluginType = PluginType, TElement = unknown> = {
2288
2288
  */
2289
2289
  export declare function defineGenerator<TOptions extends PluginType = PluginType, TElement = unknown>(generator: Generator<TOptions, TElement>): Generator<TOptions, TElement>;
2290
2290
  //#endregion
2291
- //#region src/Resolver.d.ts
2291
+ //#region src/resolveOptions.d.ts
2292
2292
  /**
2293
- * Context for resolving filtered options for a given operation or schema node.
2293
+ * Filters and overrides applied to an operation or schema's options.
2294
2294
  *
2295
2295
  * @internal
2296
2296
  */
@@ -2300,6 +2300,8 @@ type ResolveOptionsContext<TOptions> = {
2300
2300
  include?: Array<Filter>;
2301
2301
  override?: Array<Override<TOptions>>;
2302
2302
  };
2303
+ //#endregion
2304
+ //#region src/Resolver.d.ts
2303
2305
  /**
2304
2306
  * The built-in resolution machinery exposed on every resolver as `resolver.default`.
2305
2307
  * Plugins delegate to it via `this.default.*` and set their own conventions through
@@ -2522,6 +2524,17 @@ type ResolverBuildOptions = {
2522
2524
  name?: (name: string) => string;
2523
2525
  file?: ResolverFile;
2524
2526
  };
2527
+ /**
2528
+ * Reuse the declaration's key when resolving its references.
2529
+ */
2530
+ type ResolveNameOptions = {
2531
+ key: string | ReadonlyArray<string | undefined>;
2532
+ name: string;
2533
+ /**
2534
+ * Compares emitted identifiers while returning raw names. Keep numeric suffixes distinct.
2535
+ */
2536
+ normalize?: (name: string) => string;
2537
+ };
2525
2538
  /**
2526
2539
  * Partial resolver fields accepted by `Resolver.merge` and `setResolver`. Parameterize with a
2527
2540
  * concrete resolver type (e.g. `ResolverPatch<ResolverTs>`) to type-check overrides and bind
@@ -2574,6 +2587,30 @@ export declare class Resolver {
2574
2587
  /** Exposes the raw build options so `Resolver.merge` can read them across `@kubb/core` copies. */
2575
2588
  get [resolverOptions](): ResolverBuildOptions;
2576
2589
  name(name: string): string;
2590
+ /**
2591
+ * Reserves emitted identifiers before allocating other declarations. The driver reserves component
2592
+ * names. Reserve extra identifiers, such as enum type aliases, before calling `resolveName`.
2593
+ *
2594
+ * @example Reserve an enum's type and value names
2595
+ * ```ts
2596
+ * resolver.reserveNames(['petStatusEnum', 'PetStatusEnumKey'])
2597
+ * ```
2598
+ */
2599
+ reserveNames(names: Iterable<string>): void;
2600
+ /**
2601
+ * Returns the same name for repeated declaration keys. Adds numeric suffixes starting at `2`
2602
+ * when the preferred name is taken. Array segment order and boundaries matter. String and array
2603
+ * keys are distinct. Pass an already-cased name or use `normalize` to compare emitted identifiers
2604
+ * while returning raw names. `Resolver.merge` creates a resolver with no reservations.
2605
+ *
2606
+ * @example Resolve a request body that collides with a component
2607
+ * ```ts
2608
+ * resolver.reserveNames(['CreateContainerBody'])
2609
+ * resolver.resolveName({ key: ['operation', 'POST', '/containers', 'body'], name: 'CreateContainerBody' })
2610
+ * // 'CreateContainerBody2'
2611
+ * ```
2612
+ */
2613
+ resolveName({ key, name, normalize }: ResolveNameOptions): string;
2577
2614
  file(options: ResolveFileOptions): FileNode;
2578
2615
  /**
2579
2616
  * Builds one `ImportNode` per unique schema referenced in the tree, in first-occurrence
@@ -3901,5 +3938,5 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
3901
3938
  resolveFrom?: Array<string>;
3902
3939
  }): Promise<Array<InstalledPackage>>;
3903
3940
  //#endregion
3904
- export type { Adapter, AdapterDefinition, AdapterFactory, AdapterFactoryOptions, AdapterSource, BannerMeta, CreateKubbOptions, Diagnostic, DiagnosticDoc, DiagnosticFormatOptions, DiagnosticKind, DiagnosticLocation, DiagnosticSeverity, Exclude$1 as Exclude, ExtensionDependencies, ExtensionDependency, ExtensionDependencyRecord, ExtensionFactory, ExtensionKind, ExtensionManifest, ExtensionManifestOption, ExtensionMeta, Filter, GenerateOptions, GenerateResult, GenerationResult, Generator, GeneratorContext, Group, HookResult, Include, InputKind, InstalledPackage, JSONValue, Kubb$1 as Kubb, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, NodeCache, NormalizedPlugin, Output, OutputManifest, OutputMode, OutputOptions, Override, Parser, ParserDefinition, ParserFactory, PerformanceDiagnostic, Plugin, PluginDefinition, PluginFactory, PluginName, PluginType, ProblemCode, ProblemDiagnostic, RegistryArtifact, RegistryDetail, RegistryEntry, RegistryGuide, RegistryIndex, Renderer, RendererFactory, Reporter, ReporterContext, ReporterName, ReporterPluginFiles, ResolveBannerContext, ResolveBannerFile, ResolveFileOptions, ResolveImportsOptions, ResolveOptionsContext, ResolvePathOptions, ResolvePluginOptions, ResolverDefault, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, ResolverPathParams, RunHookOptions, RunOutputPassesOptions, SerializedDiagnostic, Storage, SummaryRenderer, UpdateDiagnostic, UserReporter };
3941
+ export type { Adapter, AdapterDefinition, AdapterFactory, AdapterFactoryOptions, AdapterSource, BannerMeta, CreateKubbOptions, Diagnostic, DiagnosticDoc, DiagnosticFormatOptions, DiagnosticKind, DiagnosticLocation, DiagnosticSeverity, Exclude$1 as Exclude, ExtensionDependencies, ExtensionDependency, ExtensionDependencyRecord, ExtensionFactory, ExtensionKind, ExtensionManifest, ExtensionManifestOption, ExtensionMeta, Filter, GenerateOptions, GenerateResult, GenerationResult, Generator, GeneratorContext, Group, HookResult, Include, InputKind, InstalledPackage, JSONValue, Kubb$1 as Kubb, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, NodeCache, NormalizedPlugin, Output, OutputManifest, OutputMode, OutputOptions, Override, Parser, ParserDefinition, ParserFactory, PerformanceDiagnostic, Plugin, PluginDefinition, PluginFactory, PluginName, PluginType, ProblemCode, ProblemDiagnostic, RegistryArtifact, RegistryDetail, RegistryEntry, RegistryGuide, RegistryIndex, Renderer, RendererFactory, Reporter, ReporterContext, ReporterName, ReporterPluginFiles, ResolveBannerContext, ResolveBannerFile, ResolveFileOptions, ResolveImportsOptions, ResolveNameOptions, ResolveOptionsContext, ResolvePathOptions, ResolvePluginOptions, ResolverDefault, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, ResolverPathParams, RunHookOptions, RunOutputPassesOptions, SerializedDiagnostic, Storage, SummaryRenderer, UpdateDiagnostic, UserReporter };
3905
3942
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as NodeCache, $t as ReporterContext, A as PluginFactory, At as KubbInfoContext, B as ResolveImportsOptions, Bt as RunHookOptions, C as NormalizedPlugin, Ct as KubbGenerationEndContext, D as Override, Dt as KubbHookLineContext, E as OutputOptions, Et as KubbHookEndContext, F as definePlugin, Ft as KubbWarnContext, G as ResolverFile, Gt as createOutputManifest, H as ResolvePathOptions, Ht as KubbDriver, I as BannerMeta, It as PossibleConfig, J as ResolverPatch, Jt as createRenderer, K as ResolverFileParams, Kt as Renderer, L as ResolveBannerContext, Lt as PostGenerateCommand, M as PluginType, Mt as KubbMessageContext, N as ResolvePluginOptions, Nt as KubbPluginsEndContext, O as Plugin, Ot as KubbHookStartContext, P as assertPluginOption, Pt as KubbSuccessContext, Q as defineGenerator, Qt as Reporter, R as ResolveBannerFile, Rt as UserConfig, S as KubbPluginStartContext, St as KubbFilesProcessingUpdateContext, T as OutputMode, Tt as KubbGenerationSummaryContext, U as Resolver, Ut as Hookable, V as ResolveOptionsContext, Vt as runHook, W as ResolverDefault, Wt as OutputManifest, X as Generator, Xt as createStorage, Y as ResolverPathParams, Yt as Storage, Z as GeneratorContext, Zt as GenerationResult, _ as Filter, _t as KubbDiagnosticContext, a as AdapterSource, an as DiagnosticFormatOptions, at as Diagnostics, b as KubbPluginEndContext, bt as KubbFilesProcessingEndContext, c as ExtensionDependency, cn as ParserDefinition, ct as ProblemDiagnostic, d as ExtensionKind, dt as CLIOptions, en as ReporterName, et as Diagnostic, f as ExtensionMeta, ft as Config, g as Exclude, gt as KubbBuildStartContext, h as resolveMeta, ht as KubbBuildEndContext, i as AdapterFactoryOptions, in as logLevel, it as DiagnosticSeverity, j as PluginName, jt as KubbLifecycleStartContext, k as PluginDefinition, kt as KubbHooks, l as ExtensionDependencyRecord, ln as ParserFactory, lt as UpdateDiagnostic, m as defineExtension, mt as Input, n as AdapterDefinition, nn as UserReporter, nt as DiagnosticKind, o as createAdapter, on as SerializedDiagnostic, ot as PerformanceDiagnostic, p as checkCompatibility, pt as FilesContext, q as ResolverFilePathParams, qt as RendererFactory, r as AdapterFactory, rn as createReporter, rt as DiagnosticLocation, s as ExtensionDependencies, sn as Parser, st as ProblemCode, t as Adapter, tn as ReporterPluginFiles, tt as DiagnosticDoc, u as ExtensionFactory, un as defineParser, ut as BuildOutput, v as Group, vt as KubbErrorContext, w as Output, wt as KubbGenerationStartContext, x as KubbPluginSetupContext, xt as KubbFilesProcessingStartContext, y as Include, yt as KubbFileProcessingUpdate, z as ResolveFileOptions, zt as HookResult } from "./createAdapter-DwnjwKN0.js";
1
+ import { $ as defineGenerator, $t as Reporter, A as PluginFactory, At as KubbHooks, B as ResolveImportsOptions, Bt as HookResult, C as NormalizedPlugin, Ct as KubbFilesProcessingUpdateContext, D as Override, Dt as KubbHookEndContext, E as OutputOptions, Et as KubbGenerationSummaryContext, F as definePlugin, Ft as KubbSuccessContext, G as ResolverFile, Gt as OutputManifest, H as ResolvePathOptions, Ht as runHook, I as BannerMeta, It as KubbWarnContext, J as ResolverPatch, Jt as RendererFactory, K as ResolverFileParams, Kt as createOutputManifest, L as ResolveBannerContext, Lt as PossibleConfig, M as PluginType, Mt as KubbLifecycleStartContext, N as ResolvePluginOptions, Nt as KubbMessageContext, O as Plugin, Ot as KubbHookLineContext, P as assertPluginOption, Pt as KubbPluginsEndContext, Q as GeneratorContext, Qt as GenerationResult, R as ResolveBannerFile, Rt as PostGenerateCommand, S as KubbPluginStartContext, St as KubbFilesProcessingStartContext, T as OutputMode, Tt as KubbGenerationStartContext, U as Resolver, Ut as KubbDriver, V as ResolveNameOptions, Vt as RunHookOptions, W as ResolverDefault, Wt as Hookable, X as ResolveOptionsContext, Xt as Storage, Y as ResolverPathParams, Yt as createRenderer, Z as Generator, Zt as createStorage, _ as Filter, _t as KubbBuildStartContext, a as AdapterSource, an as logLevel, at as DiagnosticSeverity, b as KubbPluginEndContext, bt as KubbFileProcessingUpdate, c as ExtensionDependency, cn as Parser, ct as ProblemCode, d as ExtensionKind, dn as defineParser, dt as BuildOutput, en as ReporterContext, et as NodeCache, f as ExtensionMeta, ft as CLIOptions, g as Exclude, gt as KubbBuildEndContext, h as resolveMeta, ht as Input, i as AdapterFactoryOptions, in as createReporter, it as DiagnosticLocation, j as PluginName, jt as KubbInfoContext, k as PluginDefinition, kt as KubbHookStartContext, l as ExtensionDependencyRecord, ln as ParserDefinition, lt as ProblemDiagnostic, m as defineExtension, mt as FilesContext, n as AdapterDefinition, nn as ReporterPluginFiles, nt as DiagnosticDoc, o as createAdapter, on as DiagnosticFormatOptions, ot as Diagnostics, p as checkCompatibility, pt as Config, q as ResolverFilePathParams, qt as Renderer, r as AdapterFactory, rn as UserReporter, rt as DiagnosticKind, s as ExtensionDependencies, sn as SerializedDiagnostic, st as PerformanceDiagnostic, t as Adapter, tn as ReporterName, tt as Diagnostic, u as ExtensionFactory, un as ParserFactory, ut as UpdateDiagnostic, v as Group, vt as KubbDiagnosticContext, w as Output, wt as KubbGenerationEndContext, x as KubbPluginSetupContext, xt as KubbFilesProcessingEndContext, y as Include, yt as KubbErrorContext, z as ResolveFileOptions, zt as UserConfig } from "./createAdapter-y4ey5daI.js";
2
2
  import { FileNode, Macro, UserFileNode } from "@kubb/ast";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import net from "node:net";
@@ -648,5 +648,5 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
648
648
  resolveFrom?: Array<string>;
649
649
  }): Promise<Array<InstalledPackage>>;
650
650
  //#endregion
651
- export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticFormatOptions, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, FilesContext, type Filter, type GenerateOptions, type GenerateResult, type GenerationResult, type Generator, type GeneratorContext, type Group, type HookResult, Hookable, type Include, Input, type InputKind, type InstalledPackage, type JSONValue, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbGenerationSummaryContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, KubbMessageContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NodeCache, type NormalizedPlugin, type Output, type OutputManifest, type OutputMode, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type PerformanceDiagnostic, type Plugin, type PluginDefinition, type PluginFactory, type PluginName, type PluginType, PossibleConfig, PostGenerateCommand, type ProblemCode, type ProblemDiagnostic, type RegistryArtifact, type RegistryDetail, type RegistryEntry, type RegistryGuide, type RegistryIndex, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ReporterPluginFiles, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveImportsOptions, type ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type RunHookOptions, type RunOutputPassesOptions, type SerializedDiagnostic, type Storage, type SummaryRenderer, type UpdateDiagnostic, UserConfig, type UserReporter, assertPluginOption, checkCompatibility, createAdapter, createOutputManifest, createRenderer, createReporter, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, logLevel, resolveMeta, runHook };
651
+ export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticFormatOptions, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, FilesContext, type Filter, type GenerateOptions, type GenerateResult, type GenerationResult, type Generator, type GeneratorContext, type Group, type HookResult, Hookable, type Include, Input, type InputKind, type InstalledPackage, type JSONValue, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbGenerationSummaryContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, KubbMessageContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NodeCache, type NormalizedPlugin, type Output, type OutputManifest, type OutputMode, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type PerformanceDiagnostic, type Plugin, type PluginDefinition, type PluginFactory, type PluginName, type PluginType, PossibleConfig, PostGenerateCommand, type ProblemCode, type ProblemDiagnostic, type RegistryArtifact, type RegistryDetail, type RegistryEntry, type RegistryGuide, type RegistryIndex, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ReporterPluginFiles, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type RunHookOptions, type RunOutputPassesOptions, type SerializedDiagnostic, type Storage, type SummaryRenderer, type UpdateDiagnostic, UserConfig, type UserReporter, assertPluginOption, checkCompatibility, createAdapter, createOutputManifest, createRenderer, createReporter, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, logLevel, resolveMeta, runHook };
652
652
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as formatMs, B as writeRaw, C as useConfig, D as defineExtension, E as checkCompatibility, F as isPathInside, I as listFiles, L as read, M as inParallel, N as exists, O as resolveMeta, P as existsSync$1, R as rm$1, S as tryUseKubb, T as useOptions, V as toError, _ as kubbContext, b as setOptions, c as Resolver, d as isPublicAddress, f as assertPluginOption, g as injectFile, h as addMacro, j as getElapsedMs, k as Diagnostics, l as getInputKind, m as addGenerator, n as KubbDriver, o as _usingCtx, p as definePlugin, s as createResolver, t as Hookable, u as checkoutGitInput, v as requirePlugin, w as useKubb, x as setResolver, y as setMacros, z as write } from "./Hookable-DjPMSKYr.js";
1
+ import { A as formatMs, B as writeRaw, C as useConfig, D as defineExtension, E as checkCompatibility, F as isPathInside, I as listFiles, L as read, M as inParallel, N as exists, O as resolveMeta, P as existsSync$1, R as rm$1, S as tryUseKubb, T as useOptions, V as toError, _ as kubbContext, b as setOptions, c as Resolver, d as isPublicAddress, f as assertPluginOption, g as injectFile, h as addMacro, j as getElapsedMs, k as Diagnostics, l as getInputKind, m as addGenerator, n as KubbDriver, o as _usingCtx, p as definePlugin, s as createResolver, t as Hookable, u as checkoutGitInput, v as requirePlugin, w as useKubb, x as setResolver, y as setMacros, z as write } from "./Hookable-CPbYCCpI.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { isValid } from "verkit";
4
4
  import process$1 from "node:process";
package/dist/mocks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as NormalizedPlugin, Ht as KubbDriver, M as PluginType, X as Generator, ft as Config, i as AdapterFactoryOptions, sn as Parser, t as Adapter, x as KubbPluginSetupContext } from "./createAdapter-DwnjwKN0.js";
1
+ import { C as NormalizedPlugin, M as PluginType, Ut as KubbDriver, Z as Generator, cn as Parser, i as AdapterFactoryOptions, pt as Config, t as Adapter, x as KubbPluginSetupContext } from "./createAdapter-y4ey5daI.js";
2
2
  import { FileNode, InputMeta, Macro, OperationNode, SchemaNode } from "@kubb/ast";
3
3
  //#region src/mocks.d.ts
4
4
  /**
package/dist/mocks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { H as camelCase, a as FileManager, i as createNodeCache, r as pluginNotFoundError, t as Hookable } from "./Hookable-DjPMSKYr.js";
1
+ import { H as camelCase, a as FileManager, i as createNodeCache, r as pluginNotFoundError, t as Hookable } from "./Hookable-CPbYCCpI.js";
2
2
  import path, { resolve } from "node:path";
3
3
  import { applyMacros, ast } from "@kubb/ast";
4
4
  import { expect, vi } from "vitest";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "5.14.2",
3
+ "version": "5.14.4",
4
4
  "description": "Core engine for Kubb. Provides the plugin driver, file manager and build orchestration used by every Kubb plugin.",
5
5
  "keywords": [
6
6
  "code-generator",
@@ -77,7 +77,7 @@
77
77
  "registry": "https://registry.npmjs.org/"
78
78
  },
79
79
  "dependencies": {
80
- "@kubb/ast": "5.14.2",
80
+ "@kubb/ast": "5.14.4",
81
81
  "tinyexec": "^1.3.1",
82
82
  "verkit": "^0.5.0"
83
83
  },