@kubb/core 5.14.4 → 5.14.5
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/{Hookable-CPbYCCpI.js → Hookable-BLHdV93L.js} +19 -7
- package/dist/Hookable-BLHdV93L.js.map +1 -0
- package/dist/{createAdapter-y4ey5daI.d.ts → createAdapter-BD4waEKc.d.ts} +17 -3
- package/dist/index.cjs +18 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/dist/Hookable-CPbYCCpI.js.map +0 -1
|
@@ -2530,8 +2530,10 @@ type ResolveNameOptions = {
|
|
|
2530
2530
|
name: string;
|
|
2531
2531
|
/**
|
|
2532
2532
|
* Compares emitted identifiers while returning raw names. Keep numeric suffixes distinct.
|
|
2533
|
+
* Return several names when one declaration emits more than one identifier, such as an enum's
|
|
2534
|
+
* value and its type alias: the raw name is only taken when all of them are free.
|
|
2533
2535
|
*/
|
|
2534
|
-
normalize?: (name: string) => string
|
|
2536
|
+
normalize?: (name: string) => string | ReadonlyArray<string>;
|
|
2535
2537
|
};
|
|
2536
2538
|
/**
|
|
2537
2539
|
* Partial resolver fields accepted by `Resolver.merge` and `setResolver`. Parameterize with a
|
|
@@ -2607,6 +2609,11 @@ declare class Resolver {
|
|
|
2607
2609
|
* resolver.resolveName({ key: ['operation', 'POST', '/containers', 'body'], name: 'CreateContainerBody' })
|
|
2608
2610
|
* // 'CreateContainerBody2'
|
|
2609
2611
|
* ```
|
|
2612
|
+
*
|
|
2613
|
+
* @example Resolve a name that has to be free as both an enum value and a type alias
|
|
2614
|
+
* ```ts
|
|
2615
|
+
* resolver.resolveName({ key: ['enum', 'Pet', 'status'], name: 'Status', normalize: (name) => [camelCase(name), `${name}Key`] })
|
|
2616
|
+
* ```
|
|
2610
2617
|
*/
|
|
2611
2618
|
resolveName({ key, name, normalize }: ResolveNameOptions): string;
|
|
2612
2619
|
file(options: ResolveFileOptions): FileNode;
|
|
@@ -3169,7 +3176,8 @@ declare function defineExtension<TFactory extends PluginType = PluginType>(defin
|
|
|
3169
3176
|
* input shape with paths resolved to absolute.
|
|
3170
3177
|
*
|
|
3171
3178
|
* - `{ type: 'path' }`: single file on disk.
|
|
3172
|
-
* - `{ type: 'data' }`: raw string or parsed object provided inline.
|
|
3179
|
+
* - `{ type: 'data' }`: raw string or parsed object provided inline. `root` is the folder that
|
|
3180
|
+
* relative external `$ref`s in it resolve from.
|
|
3173
3181
|
*/
|
|
3174
3182
|
type AdapterSource = {
|
|
3175
3183
|
type: 'path';
|
|
@@ -3177,6 +3185,7 @@ type AdapterSource = {
|
|
|
3177
3185
|
} | {
|
|
3178
3186
|
type: 'data';
|
|
3179
3187
|
data: string | unknown;
|
|
3188
|
+
root?: string;
|
|
3180
3189
|
};
|
|
3181
3190
|
/**
|
|
3182
3191
|
* Generic parameters used by `defineExtension` with `kind: 'adapter'` and the resulting `Adapter` type.
|
|
@@ -3229,6 +3238,11 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3229
3238
|
* Parsed source document after the first `parse()` call. `null` before parsing.
|
|
3230
3239
|
*/
|
|
3231
3240
|
document: TOptions['document'] | null;
|
|
3241
|
+
/**
|
|
3242
|
+
* The files and URLs the last `parse()` read, such as the ones external `$ref`s point at, including
|
|
3243
|
+
* any that could not be read. Inline data is not listed. A watcher rebuilds when one of them changes.
|
|
3244
|
+
*/
|
|
3245
|
+
sources?: Array<string>;
|
|
3232
3246
|
/**
|
|
3233
3247
|
* Parse the source into a universal `InputNode`.
|
|
3234
3248
|
*
|
|
@@ -3291,4 +3305,4 @@ type AdapterFactory<T extends AdapterFactoryOptions = AdapterFactoryOptions> = E
|
|
|
3291
3305
|
declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(definition: AdapterDefinition<T>): AdapterFactory<T>;
|
|
3292
3306
|
//#endregion
|
|
3293
3307
|
export { defineGenerator as $, Reporter as $t, PluginFactory as A, KubbHooks as At, ResolveImportsOptions as B, HookResult as Bt, NormalizedPlugin as C, KubbFilesProcessingUpdateContext as Ct, Override as D, KubbHookEndContext as Dt, OutputOptions as E, KubbGenerationSummaryContext as Et, definePlugin as F, KubbSuccessContext as Ft, ResolverFile as G, OutputManifest as Gt, ResolvePathOptions as H, runHook as Ht, BannerMeta as I, KubbWarnContext as It, ResolverPatch as J, RendererFactory as Jt, ResolverFileParams as K, createOutputManifest as Kt, ResolveBannerContext as L, PossibleConfig as Lt, PluginType as M, KubbLifecycleStartContext as Mt, ResolvePluginOptions as N, KubbMessageContext as Nt, Plugin as O, KubbHookLineContext as Ot, assertPluginOption as P, KubbPluginsEndContext as Pt, GeneratorContext as Q, GenerationResult as Qt, ResolveBannerFile as R, PostGenerateCommand as Rt, KubbPluginStartContext as S, KubbFilesProcessingStartContext as St, OutputMode as T, KubbGenerationStartContext as Tt, Resolver as U, KubbDriver as Ut, ResolveNameOptions as V, RunHookOptions as Vt, ResolverDefault as W, Hookable as Wt, ResolveOptionsContext as X, Storage as Xt, ResolverPathParams as Y, createRenderer as Yt, Generator as Z, createStorage as Zt, Filter as _, KubbBuildStartContext as _t, AdapterSource as a, logLevel as an, DiagnosticSeverity as at, KubbPluginEndContext as b, KubbFileProcessingUpdate as bt, ExtensionDependency as c, Parser as cn, ProblemCode as ct, ExtensionKind as d, defineParser as dn, BuildOutput as dt, ReporterContext as en, NodeCache as et, ExtensionMeta as f, CLIOptions as ft, Exclude$1 as g, KubbBuildEndContext as gt, resolveMeta as h, Input as ht, AdapterFactoryOptions as i, createReporter as in, DiagnosticLocation as it, PluginName as j, KubbInfoContext as jt, PluginDefinition as k, KubbHookStartContext as kt, ExtensionDependencyRecord as l, ParserDefinition as ln, ProblemDiagnostic as lt, defineExtension as m, FilesContext as mt, AdapterDefinition as n, ReporterPluginFiles as nn, DiagnosticDoc as nt, createAdapter as o, DiagnosticFormatOptions as on, Diagnostics as ot, checkCompatibility as p, Config as pt, ResolverFilePathParams as q, Renderer as qt, AdapterFactory as r, UserReporter as rn, DiagnosticKind as rt, ExtensionDependencies as s, SerializedDiagnostic as sn, PerformanceDiagnostic as st, Adapter as t, ReporterName as tn, Diagnostic as tt, ExtensionFactory as u, ParserFactory as un, UpdateDiagnostic as ut, Group as v, KubbDiagnosticContext as vt, Output as w, KubbGenerationEndContext as wt, KubbPluginSetupContext as x, KubbFilesProcessingEndContext as xt, Include as y, KubbErrorContext as yt, ResolveFileOptions as z, UserConfig as zt };
|
|
3294
|
-
//# sourceMappingURL=createAdapter-
|
|
3308
|
+
//# sourceMappingURL=createAdapter-BD4waEKc.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ let node_readline = require("node:readline");
|
|
|
42
42
|
let node_url = require("node:url");
|
|
43
43
|
let node_module = require("node:module");
|
|
44
44
|
//#region package.json
|
|
45
|
-
var version = "5.14.
|
|
45
|
+
var version = "5.14.5";
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region ../../internals/utils/src/casing.ts
|
|
48
48
|
/**
|
|
@@ -1694,7 +1694,8 @@ function isLegacyInput(input) {
|
|
|
1694
1694
|
/**
|
|
1695
1695
|
* Normalizes `config.input` into an `AdapterSource` the adapter can parse.
|
|
1696
1696
|
*
|
|
1697
|
-
* A parsed object and inline content become `{ type: 'data' }
|
|
1697
|
+
* A parsed object and inline content become `{ type: 'data' }` with `config.root` as the folder
|
|
1698
|
+
* their relative `$ref`s resolve from; a URL or git input is kept
|
|
1698
1699
|
* verbatim and a local path is resolved against `config.root`, all as `{ type: 'path' }`. The
|
|
1699
1700
|
* driver checks out a git input before the adapter parses it.
|
|
1700
1701
|
*/
|
|
@@ -1716,12 +1717,14 @@ function inputToAdapterSource(config) {
|
|
|
1716
1717
|
});
|
|
1717
1718
|
if (typeof input !== "string") return {
|
|
1718
1719
|
type: "data",
|
|
1719
|
-
data: input
|
|
1720
|
+
data: input,
|
|
1721
|
+
root: (0, node_path.resolve)(config.root)
|
|
1720
1722
|
};
|
|
1721
1723
|
const kind = getInputKind(input);
|
|
1722
1724
|
if (kind === "inline") return {
|
|
1723
1725
|
type: "data",
|
|
1724
|
-
data: input
|
|
1726
|
+
data: input,
|
|
1727
|
+
root: (0, node_path.resolve)(config.root)
|
|
1725
1728
|
};
|
|
1726
1729
|
if (kind === "url" || kind === "git") return {
|
|
1727
1730
|
type: "path",
|
|
@@ -1926,14 +1929,23 @@ var Resolver = class Resolver {
|
|
|
1926
1929
|
* resolver.resolveName({ key: ['operation', 'POST', '/containers', 'body'], name: 'CreateContainerBody' })
|
|
1927
1930
|
* // 'CreateContainerBody2'
|
|
1928
1931
|
* ```
|
|
1932
|
+
*
|
|
1933
|
+
* @example Resolve a name that has to be free as both an enum value and a type alias
|
|
1934
|
+
* ```ts
|
|
1935
|
+
* resolver.resolveName({ key: ['enum', 'Pet', 'status'], name: 'Status', normalize: (name) => [camelCase(name), `${name}Key`] })
|
|
1936
|
+
* ```
|
|
1929
1937
|
*/
|
|
1930
1938
|
resolveName({ key, name, normalize = (name) => name }) {
|
|
1931
1939
|
const cacheKey = JSON.stringify(key);
|
|
1932
1940
|
const previous = this.#resolvedNames.get(cacheKey);
|
|
1933
1941
|
if (previous !== void 0) return previous;
|
|
1942
|
+
const emitted = (value) => {
|
|
1943
|
+
const names = normalize(value);
|
|
1944
|
+
return typeof names === "string" ? [names] : names;
|
|
1945
|
+
};
|
|
1934
1946
|
let result = name;
|
|
1935
|
-
for (let suffix = 2; this.#usedNames.has(
|
|
1936
|
-
this
|
|
1947
|
+
for (let suffix = 2; emitted(result).some((emittedName) => this.#usedNames.has(emittedName)); suffix++) result = `${name}${suffix}`;
|
|
1948
|
+
this.reserveNames(emitted(result));
|
|
1937
1949
|
this.#resolvedNames.set(cacheKey, result);
|
|
1938
1950
|
return result;
|
|
1939
1951
|
}
|