@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.
@@ -19,7 +19,7 @@ var __name = (target, value) => __defProp(target, "name", {
19
19
  });
20
20
  //#endregion
21
21
  //#region package.json
22
- var version = "5.14.4";
22
+ var version = "5.14.5";
23
23
  //#endregion
24
24
  //#region ../../internals/utils/src/casing.ts
25
25
  /**
@@ -1515,7 +1515,8 @@ function isLegacyInput(input) {
1515
1515
  /**
1516
1516
  * Normalizes `config.input` into an `AdapterSource` the adapter can parse.
1517
1517
  *
1518
- * A parsed object and inline content become `{ type: 'data' }`; a URL or git input is kept
1518
+ * A parsed object and inline content become `{ type: 'data' }` with `config.root` as the folder
1519
+ * their relative `$ref`s resolve from; a URL or git input is kept
1519
1520
  * verbatim and a local path is resolved against `config.root`, all as `{ type: 'path' }`. The
1520
1521
  * driver checks out a git input before the adapter parses it.
1521
1522
  */
@@ -1537,12 +1538,14 @@ function inputToAdapterSource(config) {
1537
1538
  });
1538
1539
  if (typeof input !== "string") return {
1539
1540
  type: "data",
1540
- data: input
1541
+ data: input,
1542
+ root: resolve(config.root)
1541
1543
  };
1542
1544
  const kind = getInputKind(input);
1543
1545
  if (kind === "inline") return {
1544
1546
  type: "data",
1545
- data: input
1547
+ data: input,
1548
+ root: resolve(config.root)
1546
1549
  };
1547
1550
  if (kind === "url" || kind === "git") return {
1548
1551
  type: "path",
@@ -1747,14 +1750,23 @@ var Resolver = class Resolver {
1747
1750
  * resolver.resolveName({ key: ['operation', 'POST', '/containers', 'body'], name: 'CreateContainerBody' })
1748
1751
  * // 'CreateContainerBody2'
1749
1752
  * ```
1753
+ *
1754
+ * @example Resolve a name that has to be free as both an enum value and a type alias
1755
+ * ```ts
1756
+ * resolver.resolveName({ key: ['enum', 'Pet', 'status'], name: 'Status', normalize: (name) => [camelCase(name), `${name}Key`] })
1757
+ * ```
1750
1758
  */
1751
1759
  resolveName({ key, name, normalize = (name) => name }) {
1752
1760
  const cacheKey = JSON.stringify(key);
1753
1761
  const previous = this.#resolvedNames.get(cacheKey);
1754
1762
  if (previous !== void 0) return previous;
1763
+ const emitted = (value) => {
1764
+ const names = normalize(value);
1765
+ return typeof names === "string" ? [names] : names;
1766
+ };
1755
1767
  let result = name;
1756
- for (let suffix = 2; this.#usedNames.has(normalize(result)); suffix++) result = `${name}${suffix}`;
1757
- this.#usedNames.add(normalize(result));
1768
+ for (let suffix = 2; emitted(result).some((emittedName) => this.#usedNames.has(emittedName)); suffix++) result = `${name}${suffix}`;
1769
+ this.reserveNames(emitted(result));
1758
1770
  this.#resolvedNames.set(cacheKey, result);
1759
1771
  return result;
1760
1772
  }
@@ -3238,4 +3250,4 @@ var Hookable = class {
3238
3250
  //#endregion
3239
3251
  export { formatMs as A, writeRaw as B, useConfig as C, defineExtension as D, checkCompatibility as E, isPathInside as F, camelCase as H, listFiles as I, read as L, inParallel as M, exists as N, resolveMeta as O, existsSync$1 as P, rm$1 as R, tryUseKubb as S, useOptions as T, __name as U, toError as V, kubbContext as _, FileManager as a, setOptions as b, Resolver as c, isPublicAddress as d, assertPluginOption as f, injectFile as g, addMacro as h, createNodeCache as i, getElapsedMs as j, Diagnostics as k, getInputKind as l, addGenerator as m, KubbDriver as n, _usingCtx as o, definePlugin as p, pluginNotFoundError as r, createResolver as s, Hookable as t, checkoutGitInput as u, requirePlugin as v, useKubb as w, setResolver as x, setMacros as y, write as z };
3240
3252
 
3241
- //# sourceMappingURL=Hookable-CPbYCCpI.js.map
3253
+ //# sourceMappingURL=Hookable-BLHdV93L.js.map