@kubb/kit 5.19.2 → 5.20.0

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.cjs CHANGED
@@ -79,6 +79,19 @@ function toCamelOrPascal(text, pascal) {
79
79
  return memo$1(cache, key, () => convert(text, pascal));
80
80
  }
81
81
  /**
82
+ * Converts `text` to camelCase.
83
+ *
84
+ * @example Word boundaries
85
+ * `camelCase('hello-world') // 'helloWorld'`
86
+ *
87
+ * @example With a prefix
88
+ * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
89
+ */
90
+ function camelCase$1(text, { prefix = "", suffix = "" } = {}) {
91
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
92
+ }
93
+ __name(camelCase$1, "camelCase");
94
+ /**
82
95
  * Converts `text` to PascalCase.
83
96
  *
84
97
  * @example Word boundaries
@@ -273,6 +286,12 @@ function transformPathParam(raw) {
273
286
  return !startsWithSafeChar || i > 0 ? word.charAt(0).toUpperCase() + word.slice(1) : word.charAt(0).toLowerCase() + word.slice(1);
274
287
  }).join("");
275
288
  }
289
+ function uniqueParamName(base, used) {
290
+ let name = base;
291
+ for (let i = 2; used.has(name); i++) name = `${base}${i}`;
292
+ used.add(name);
293
+ return name;
294
+ }
276
295
  /**
277
296
  * Renders how a grouped `path` object's member is accessed: dot access for an identifier (reserved
278
297
  * words are valid property names), bracket access with the raw name otherwise.
@@ -301,13 +320,23 @@ var Url = class {
301
320
  * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'
302
321
  */
303
322
  static toPath(path) {
304
- const seen = /* @__PURE__ */ new Map();
305
- return path.replace(/\{([^}]+)\}/g, (_match, param) => {
306
- const base = transformPathParam(param);
307
- const count = (seen.get(base) ?? 0) + 1;
308
- seen.set(base, count);
309
- return count === 1 ? `:${base}` : `:${base}${count}`;
310
- });
323
+ const used = /* @__PURE__ */ new Set();
324
+ return path.replace(/\{([^}]+)\}/g, (_match, param) => `:${uniqueParamName(transformPathParam(param), used)}`);
325
+ }
326
+ /**
327
+ * Maps each `{placeholder}` name in a path to a unique camelCase identifier.
328
+ *
329
+ * @example
330
+ * Url.toParamNames('/groups/{group_id}/{group.id}') // Map { 'group_id' => 'groupId', 'group.id' => 'groupId2' }
331
+ */
332
+ static toParamNames(path) {
333
+ const used = /* @__PURE__ */ new Set();
334
+ const names = /* @__PURE__ */ new Map();
335
+ for (const [, param] of path.matchAll(/\{([^}]+)\}/g)) {
336
+ const name = uniqueParamName(camelCase$1(param) || transformPathParam(param), used);
337
+ if (!names.has(param)) names.set(param, name);
338
+ }
339
+ return names;
311
340
  }
312
341
  /**
313
342
  * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["memo","memo","pascalCase","astCreatePrinter","astDefineMacro","memo","ast","hash","camel","pascal","ast","ast","pascalCase","ast","ast"],"sources":["../../../internals/utils/src/promise.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/text.ts","../src/casing.ts","../src/text.ts","../src/authoring.ts","../src/macros/macroDedupeUnion.ts","../src/deprecated.ts","../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../src/utils/names.ts","../src/macros/macroEnumName.ts","../src/utils/mergeAdjacentSchemas.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n","import { memo } from './promise.ts'\n\ntype Options = {\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return (\n text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n // A status range such as `2xx` stays one word.\n .replace(/(\\d)(?!xx(?![a-z]))([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n )\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = memo.create<string, string>({ max: 100_000 })\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n return memo(cache, key, () => convert(text, pascal))\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n// A segment without lowercase letters, such as `COOL` or `2D`, stays one word, so a snake_case name is left unchanged.\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`. Unlike `pascalCase` it never splits words or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * `snakeCase('helloWorld') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Indents every non-empty line of `text` by `unit`, leaving blank lines empty.\n * @example\n * `indent({ text: 'a\\n\\nb' }) // ' a\\n\\n b'`\n */\nexport function indent({ text, unit = ' ' }: { text: string; unit?: string }): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${unit}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Strips the common leading whitespace and the surrounding blank lines, counting tabs and spaces alike, so indented template literals start at column zero.\n */\nexport function dedent(text: string): string {\n if (!text) return ''\n // Most text nodes are one line, so the common indent is its leading whitespace.\n if (!text.includes('\\n')) return text.trim() ? text.trimStart() : ''\n\n const lines = text.split('\\n')\n const indents = lines.map((line) => {\n const indent = line.length - line.trimStart().length\n return indent === line.length ? -1 : indent\n })\n const start = indents.findIndex((indent) => indent !== -1)\n if (start === -1) return ''\n const end = indents.findLastIndex((indent) => indent !== -1)\n // `-1` marks a blank line. `reduce`, not `Math.min(...indents)`, which overflows the stack on very long text.\n const min = indents.reduce((lowest, indent) => (indent !== -1 && indent < lowest ? indent : lowest), Infinity)\n\n return lines\n .slice(start, end + 1)\n .map((line, i) => (indents[start + i] === -1 ? '' : line.slice(min)))\n .join('\\n')\n}\n\n/**\n * Strips one matching pair of `\"`, `'` or `` ` `` from both ends of `text`. Returns `text` unchanged without a matching pair.\n * @example\n * `unquote('\"hello\"') // 'hello'`\n */\nexport function unquote(text: string): string {\n if (text.length < 2) return text\n const first = text[0]\n return (first === '\"' || first === \"'\" || first === '`') && text.at(-1) === first ? text.slice(1, -1) : text\n}\n","export { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nexport { capitalize, screamingSnakeCase as screamingSnake, snakeCase as snake } from '@internals/utils'\n","export { dedent, indent, unquote } from '@internals/utils'\n\n// A raw line break would end the literal.\nconst quoteEscapes = new Map([\n ['\\\\', '\\\\\\\\'],\n [\"'\", \"\\\\'\"],\n ['\\n', '\\\\n'],\n ['\\r', '\\\\r'],\n])\n\n/**\n * A single-quoted string literal with backslashes, quotes and line breaks escaped. JavaScript, TypeScript and Python read it the same way.\n */\nexport function quote(value: string | number | boolean | undefined | null): string {\n if (value === undefined || value === null) return \"''\"\n return `'${String(value).replace(/[\\\\'\\n\\r]/g, (char) => quoteEscapes.get(char)!)}'`\n}\n","import { createPrinter as astCreatePrinter, defineMacro as astDefineMacro } from '@kubb/ast'\n\nexport const createPrinter: typeof astCreatePrinter = astCreatePrinter\nexport const defineMacro: typeof astDefineMacro = astDefineMacro\n","import { hash } from 'node:crypto'\nimport { memo } from '@internals/utils'\nimport { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Drops members that repeat an earlier one, ignoring the source `pointer` so equal schemas from\n * different places in the spec still match.\n */\nfunction dedupeMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const seen = new Set<string>()\n const keys = memo.create<object, string>({ weak: true })\n\n function key(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'undefined'\n if (value instanceof Date) return key(value.toJSON())\n return memo(keys, value, () => {\n // A ref node's `ref` pointer already identifies its target, so hashing its resolved `schema` as\n // well only walks the same component graph again for every union that references it. The `kind`\n // check keeps plain data under `default` or `examples` hashed in full.\n const node = value as Partial<SchemaNode>\n const skipsSchema = node.kind === ast.node.kinds.schema && node.type === ast.schema.types.ref && typeof node.ref === 'string'\n // Hash each shared subtree once instead of expanding resolved refs into a giant string.\n const entries = Array.isArray(value)\n ? value.map(key)\n : Object.entries(value)\n .filter(([name, child]) => name !== 'pointer' && child !== undefined && !(skipsSchema && name === 'schema'))\n .map(([name, child]) => [name, key(child)])\n return hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n })\n }\n\n return members.filter((member) => {\n const memberKey = key(member)\n if (seen.has(memberKey)) return false\n seen.add(memberKey)\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one. Enum members next to a broader scalar, such as\n * `anyOf: [string, enum]`, are kept so the known values survive in the generated code.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroDedupeUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroDedupeUnion = defineMacro({\n name: 'dedupe-union',\n schema(node) {\n const unionNode = ast.schema.narrow(node, ast.schema.types.union)\n if (!unionNode?.members?.length) return undefined\n\n const deduped = dedupeMembers(unionNode.members)\n if (deduped.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: deduped }\n },\n})\n","import { ast } from '@kubb/ast'\nimport { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nimport { macroDedupeUnion } from './macros/macroDedupeUnion.ts'\n\n/** @deprecated Use `casing.camel`. Removed in Kubb v6. */\nexport const camelCase = camel\n\n/** @deprecated Use `casing.pascal`. Removed in Kubb v6. */\nexport const pascalCase = pascal\n\n/** @deprecated Use `ast.ref.getName`. Removed in Kubb v6. */\nexport const extractRefName = ast.ref.getName\n\n/** @deprecated Use `ast.ref.mergeSchema`. Removed in Kubb v6. */\nexport const syncSchemaRef = ast.ref.mergeSchema\n\n/** @deprecated Use `ast.schema.isString`. Removed in Kubb v6. */\nexport const isStringType = ast.schema.isString\n\n/** @deprecated Use `ast.graph.containsCircular`. Removed in Kubb v6. */\nexport const containsCircularRef = ast.graph.containsCircular\n\n/**\n * The name `macroDedupeUnion` had before 5.16. Kept so a plugin built against an older `@kubb/kit` keeps running.\n *\n * @deprecated Use `macroDedupeUnion`. Removed in the next major.\n */\nexport const macroSimplifyUnion = macroDedupeUnion\n","/**\n * Sanitizes a parameter name so it is safe to use as a `path-to-regexp` capture name, without\n * routing through {@link camelCase} (which keeps a leading `$` since it is a valid JS identifier\n * character). Runs of disallowed characters are treated as word boundaries; a boundary at the\n * very start of the name (e.g. the `$` in `$id`) still capitalizes the word that follows it.\n */\nfunction transformPathParam(raw: string): string {\n // `path-to-regexp` (used by MSW/Express) only accepts `[A-Za-z0-9_]` in a parameter name. It stops\n // reading at the first other character (a hyphen, a dot, a `$`, ...), which misparses the route or\n // throws \"Missing parameter name\".\n if (/^[A-Za-z0-9_]+$/.test(raw)) {\n return raw\n }\n\n const startsWithSafeChar = /^[A-Za-z_]/.test(raw)\n const words = raw.split(/[^A-Za-z0-9]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const capitalize = !startsWithSafeChar || i > 0\n return capitalize ? word.charAt(0).toUpperCase() + word.slice(1) : word.charAt(0).toLowerCase() + word.slice(1)\n })\n .join('')\n}\n\n/**\n * Renders how a grouped `path` object's member is accessed: dot access for an identifier (reserved\n * words are valid property names), bracket access with the raw name otherwise.\n */\nfunction groupedAccessor(name: string): string {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ? `.${name}` : `[${JSON.stringify(name)}]`\n}\n\n/**\n * Static helpers for OpenAPI/Swagger paths: template syntax conversion, parameter extraction, and URL composition.\n */\nexport class Url {\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * Distinct parameter names that normalize to the same identifier (e.g. `{group-id}` and\n * `{group.id}` both becoming `groupId`) are deduplicated with an incrementing suffix so\n * `path-to-regexp` never sees two identically named captures.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n *\n * @example\n * Url.toPath('/point/{point-id}') // '/point/:pointId'\n *\n * @example\n * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'\n */\n static toPath(path: string): string {\n const seen = new Map<string, number>()\n\n return path.replace(/\\{([^}]+)\\}/g, (_match, param: string) => {\n const base = transformPathParam(param)\n const count = (seen.get(base) ?? 0) + 1\n seen.set(base, count)\n\n return count === 1 ? `:${base}` : `:${base}${count}`\n })\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``.\n * Parameter names are kept exactly as they appear in the OpenAPI path; a name falls back to\n * bracket access (`` path['pet-id'] ``) only when it isn't a valid JS identifier.\n * `prefix` is prepended inside the literal. Shared by generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n *\n * @example\n * Url.toGroupedTemplateString('/user/{monetary-account-id}') // '`/user/${path[\"monetary-account-id\"]}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts.map((part, i) => (i % 2 === 0 ? part : `\\${path${groupedAccessor(part)}}`)).join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string | number | boolean>\n enumName?: string\n}\n\n/**\n * Picks the enum primitive from the type of the first value.\n */\nexport function enumPrimitive(values: Props['values']): 'string' | 'number' | 'boolean' {\n return typeof values[0] === 'number' ? 'number' : typeof values[0] === 'boolean' ? 'boolean' : 'string'\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with an enum of the given\n * values. The enum is a string, number or boolean enum, following the first value. Object schemas\n * that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.schema.narrow(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return ast.factory.createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return ast.factory.createProperty({\n ...prop,\n schema: ast.factory.createSchema({\n type: 'enum',\n primitive: enumPrimitive(values),\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { pascalCase } from '@internals/utils'\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport { enumPropName } from '../utils/names.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.schema.narrow(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Merges a run of adjacent anonymous object members into one. Named or non-object members break the\n * run and pass through unchanged. The merge follows member order, so callers control which members\n * combine by where they place them in the sequence.\n *\n * @example\n * ```ts\n * const merged = [...mergeAdjacentObjectsLazy([objectA, objectB])]\n * ```\n */\nexport function* mergeAdjacentObjectsLazy(members: Iterable<SchemaNode>): Generator<SchemaNode, void, undefined> {\n let acc: SchemaNode | undefined\n\n for (const member of members) {\n const objectMember = ast.schema.narrow(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.schema.narrow(acc, 'object')\n if (accObject && !accObject.name) {\n acc = ast.factory.createSchema({\n ...accObject,\n properties: [...(accObject.properties ?? []), ...(objectMember.properties ?? [])],\n })\n continue\n }\n }\n if (acc !== undefined) yield acc\n acc = member\n }\n\n if (acc !== undefined) yield acc\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgBA,OAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,MAAM,wBAAQ,IAAI,IAAkB;CACpC,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,OAAO,KAAW,UAAkB;EACxC,IAAI,MAAM,QAAQ,KAAK,MAAM,MAAM;EACnC,MAAM,IAAI,KAAK,KAAK;CACtB;CACA,IAAI,QAAQ,GAAG,OAAO;EAAE,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG;CAAI;CAGxF,MAAM,SAAS,QAAc;EAC3B,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACjC,OAAO;CACT;CACA,OAAO;EAAE,KAAK;EAAO,MAAM,QA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,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,eAAeC,UAAAA,IAAI,OAAO,OAAO,QAAQ,QAAQ;EACvD,IAAI,gBAAgB,CAAC,aAAa,QAAQ,QAAQ,KAAA,GAAW;GAC3D,MAAM,YAAYA,UAAAA,IAAI,OAAO,OAAO,KAAK,QAAQ;GACjD,IAAI,aAAa,CAAC,UAAU,MAAM;IAChC,MAAMA,UAAAA,IAAI,QAAQ,aAAa;KAC7B,GAAG;KACH,YAAY,CAAC,GAAI,UAAU,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;IAClF,CAAC;IACD;GACF;EACF;EACA,IAAI,QAAQ,KAAA,GAAW,MAAM;EAC7B,MAAM;CACR;CAEA,IAAI,QAAQ,KAAA,GAAW,MAAM;AAC/B"}
1
+ {"version":3,"file":"index.cjs","names":["memo","memo","camelCase","pascalCase","astCreatePrinter","astDefineMacro","memo","ast","hash","camel","pascal","ast","camelCase","ast","pascalCase","ast","ast"],"sources":["../../../internals/utils/src/promise.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/text.ts","../src/casing.ts","../src/text.ts","../src/authoring.ts","../src/macros/macroDedupeUnion.ts","../src/deprecated.ts","../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../src/utils/names.ts","../src/macros/macroEnumName.ts","../src/utils/mergeAdjacentSchemas.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n","import { memo } from './promise.ts'\n\ntype Options = {\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return (\n text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n // A status range such as `2xx` stays one word.\n .replace(/(\\d)(?!xx(?![a-z]))([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n )\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = memo.create<string, string>({ max: 100_000 })\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n return memo(cache, key, () => convert(text, pascal))\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n// A segment without lowercase letters, such as `COOL` or `2D`, stays one word, so a snake_case name is left unchanged.\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`. Unlike `pascalCase` it never splits words or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * `snakeCase('helloWorld') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Indents every non-empty line of `text` by `unit`, leaving blank lines empty.\n * @example\n * `indent({ text: 'a\\n\\nb' }) // ' a\\n\\n b'`\n */\nexport function indent({ text, unit = ' ' }: { text: string; unit?: string }): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${unit}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Strips the common leading whitespace and the surrounding blank lines, counting tabs and spaces alike, so indented template literals start at column zero.\n */\nexport function dedent(text: string): string {\n if (!text) return ''\n // Most text nodes are one line, so the common indent is its leading whitespace.\n if (!text.includes('\\n')) return text.trim() ? text.trimStart() : ''\n\n const lines = text.split('\\n')\n const indents = lines.map((line) => {\n const indent = line.length - line.trimStart().length\n return indent === line.length ? -1 : indent\n })\n const start = indents.findIndex((indent) => indent !== -1)\n if (start === -1) return ''\n const end = indents.findLastIndex((indent) => indent !== -1)\n // `-1` marks a blank line. `reduce`, not `Math.min(...indents)`, which overflows the stack on very long text.\n const min = indents.reduce((lowest, indent) => (indent !== -1 && indent < lowest ? indent : lowest), Infinity)\n\n return lines\n .slice(start, end + 1)\n .map((line, i) => (indents[start + i] === -1 ? '' : line.slice(min)))\n .join('\\n')\n}\n\n/**\n * Strips one matching pair of `\"`, `'` or `` ` `` from both ends of `text`. Returns `text` unchanged without a matching pair.\n * @example\n * `unquote('\"hello\"') // 'hello'`\n */\nexport function unquote(text: string): string {\n if (text.length < 2) return text\n const first = text[0]\n return (first === '\"' || first === \"'\" || first === '`') && text.at(-1) === first ? text.slice(1, -1) : text\n}\n","export { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nexport { capitalize, screamingSnakeCase as screamingSnake, snakeCase as snake } from '@internals/utils'\n","export { dedent, indent, unquote } from '@internals/utils'\n\n// A raw line break would end the literal.\nconst quoteEscapes = new Map([\n ['\\\\', '\\\\\\\\'],\n [\"'\", \"\\\\'\"],\n ['\\n', '\\\\n'],\n ['\\r', '\\\\r'],\n])\n\n/**\n * A single-quoted string literal with backslashes, quotes and line breaks escaped. JavaScript, TypeScript and Python read it the same way.\n */\nexport function quote(value: string | number | boolean | undefined | null): string {\n if (value === undefined || value === null) return \"''\"\n return `'${String(value).replace(/[\\\\'\\n\\r]/g, (char) => quoteEscapes.get(char)!)}'`\n}\n","import { createPrinter as astCreatePrinter, defineMacro as astDefineMacro } from '@kubb/ast'\n\nexport const createPrinter: typeof astCreatePrinter = astCreatePrinter\nexport const defineMacro: typeof astDefineMacro = astDefineMacro\n","import { hash } from 'node:crypto'\nimport { memo } from '@internals/utils'\nimport { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Drops members that repeat an earlier one, ignoring the source `pointer` so equal schemas from\n * different places in the spec still match.\n */\nfunction dedupeMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const seen = new Set<string>()\n const keys = memo.create<object, string>({ weak: true })\n\n function key(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'undefined'\n if (value instanceof Date) return key(value.toJSON())\n return memo(keys, value, () => {\n // A ref node's `ref` pointer already identifies its target, so hashing its resolved `schema` as\n // well only walks the same component graph again for every union that references it. The `kind`\n // check keeps plain data under `default` or `examples` hashed in full.\n const node = value as Partial<SchemaNode>\n const skipsSchema = node.kind === ast.node.kinds.schema && node.type === ast.schema.types.ref && typeof node.ref === 'string'\n // Hash each shared subtree once instead of expanding resolved refs into a giant string.\n const entries = Array.isArray(value)\n ? value.map(key)\n : Object.entries(value)\n .filter(([name, child]) => name !== 'pointer' && child !== undefined && !(skipsSchema && name === 'schema'))\n .map(([name, child]) => [name, key(child)])\n return hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n })\n }\n\n return members.filter((member) => {\n const memberKey = key(member)\n if (seen.has(memberKey)) return false\n seen.add(memberKey)\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one. Enum members next to a broader scalar, such as\n * `anyOf: [string, enum]`, are kept so the known values survive in the generated code.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroDedupeUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroDedupeUnion = defineMacro({\n name: 'dedupe-union',\n schema(node) {\n const unionNode = ast.schema.narrow(node, ast.schema.types.union)\n if (!unionNode?.members?.length) return undefined\n\n const deduped = dedupeMembers(unionNode.members)\n if (deduped.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: deduped }\n },\n})\n","import { ast } from '@kubb/ast'\nimport { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nimport { macroDedupeUnion } from './macros/macroDedupeUnion.ts'\n\n/** @deprecated Use `casing.camel`. Removed in Kubb v6. */\nexport const camelCase = camel\n\n/** @deprecated Use `casing.pascal`. Removed in Kubb v6. */\nexport const pascalCase = pascal\n\n/** @deprecated Use `ast.ref.getName`. Removed in Kubb v6. */\nexport const extractRefName = ast.ref.getName\n\n/** @deprecated Use `ast.ref.mergeSchema`. Removed in Kubb v6. */\nexport const syncSchemaRef = ast.ref.mergeSchema\n\n/** @deprecated Use `ast.schema.isString`. Removed in Kubb v6. */\nexport const isStringType = ast.schema.isString\n\n/** @deprecated Use `ast.graph.containsCircular`. Removed in Kubb v6. */\nexport const containsCircularRef = ast.graph.containsCircular\n\n/**\n * The name `macroDedupeUnion` had before 5.16. Kept so a plugin built against an older `@kubb/kit` keeps running.\n *\n * @deprecated Use `macroDedupeUnion`. Removed in the next major.\n */\nexport const macroSimplifyUnion = macroDedupeUnion\n","import { camelCase } from '@internals/utils'\n\n/**\n * Sanitizes a parameter name so it is safe to use as a `path-to-regexp` capture name, without\n * routing through {@link camelCase} (which keeps a leading `$` since it is a valid JS identifier\n * character). Runs of disallowed characters are treated as word boundaries; a boundary at the\n * very start of the name (e.g. the `$` in `$id`) still capitalizes the word that follows it.\n */\nfunction transformPathParam(raw: string): string {\n // `path-to-regexp` (used by MSW/Express) only accepts `[A-Za-z0-9_]` in a parameter name. It stops\n // reading at the first other character (a hyphen, a dot, a `$`, ...), which misparses the route or\n // throws \"Missing parameter name\".\n if (/^[A-Za-z0-9_]+$/.test(raw)) {\n return raw\n }\n\n const startsWithSafeChar = /^[A-Za-z_]/.test(raw)\n const words = raw.split(/[^A-Za-z0-9]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const capitalize = !startsWithSafeChar || i > 0\n return capitalize ? word.charAt(0).toUpperCase() + word.slice(1) : word.charAt(0).toLowerCase() + word.slice(1)\n })\n .join('')\n}\n\nfunction uniqueParamName(base: string, used: Set<string>): string {\n let name = base\n for (let i = 2; used.has(name); i++) name = `${base}${i}`\n used.add(name)\n\n return name\n}\n\n/**\n * Renders how a grouped `path` object's member is accessed: dot access for an identifier (reserved\n * words are valid property names), bracket access with the raw name otherwise.\n */\nfunction groupedAccessor(name: string): string {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ? `.${name}` : `[${JSON.stringify(name)}]`\n}\n\n/**\n * Static helpers for OpenAPI/Swagger paths: template syntax conversion, parameter extraction, and URL composition.\n */\nexport class Url {\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * Distinct parameter names that normalize to the same identifier (e.g. `{group-id}` and\n * `{group.id}` both becoming `groupId`) are deduplicated with an incrementing suffix so\n * `path-to-regexp` never sees two identically named captures.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n *\n * @example\n * Url.toPath('/point/{point-id}') // '/point/:pointId'\n *\n * @example\n * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'\n */\n static toPath(path: string): string {\n const used = new Set<string>()\n\n return path.replace(/\\{([^}]+)\\}/g, (_match, param: string) => `:${uniqueParamName(transformPathParam(param), used)}`)\n }\n\n /**\n * Maps each `{placeholder}` name in a path to a unique camelCase identifier.\n *\n * @example\n * Url.toParamNames('/groups/{group_id}/{group.id}') // Map { 'group_id' => 'groupId', 'group.id' => 'groupId2' }\n */\n static toParamNames(path: string): Map<string, string> {\n const used = new Set<string>()\n const names = new Map<string, string>()\n\n for (const [, param] of path.matchAll(/\\{([^}]+)\\}/g)) {\n const name = uniqueParamName(camelCase(param!) || transformPathParam(param!), used)\n if (!names.has(param!)) names.set(param!, name)\n }\n\n return names\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``.\n * Parameter names are kept exactly as they appear in the OpenAPI path; a name falls back to\n * bracket access (`` path['pet-id'] ``) only when it isn't a valid JS identifier.\n * `prefix` is prepended inside the literal. Shared by generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n *\n * @example\n * Url.toGroupedTemplateString('/user/{monetary-account-id}') // '`/user/${path[\"monetary-account-id\"]}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts.map((part, i) => (i % 2 === 0 ? part : `\\${path${groupedAccessor(part)}}`)).join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string | number | boolean>\n enumName?: string\n}\n\n/**\n * Picks the enum primitive from the type of the first value.\n */\nexport function enumPrimitive(values: Props['values']): 'string' | 'number' | 'boolean' {\n return typeof values[0] === 'number' ? 'number' : typeof values[0] === 'boolean' ? 'boolean' : 'string'\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with an enum of the given\n * values. The enum is a string, number or boolean enum, following the first value. Object schemas\n * that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.schema.narrow(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return ast.factory.createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return ast.factory.createProperty({\n ...prop,\n schema: ast.factory.createSchema({\n type: 'enum',\n primitive: enumPrimitive(values),\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { pascalCase } from '@internals/utils'\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport { enumPropName } from '../utils/names.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.schema.narrow(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Merges a run of adjacent anonymous object members into one. Named or non-object members break the\n * run and pass through unchanged. The merge follows member order, so callers control which members\n * combine by where they place them in the sequence.\n *\n * @example\n * ```ts\n * const merged = [...mergeAdjacentObjectsLazy([objectA, objectB])]\n * ```\n */\nexport function* mergeAdjacentObjectsLazy(members: Iterable<SchemaNode>): Generator<SchemaNode, void, undefined> {\n let acc: SchemaNode | undefined\n\n for (const member of members) {\n const objectMember = ast.schema.narrow(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.schema.narrow(acc, 'object')\n if (accObject && !accObject.name) {\n acc = ast.factory.createSchema({\n ...accObject,\n properties: [...(accObject.properties ?? []), ...(objectMember.properties ?? [])],\n })\n continue\n }\n }\n if (acc !== undefined) yield acc\n acc = member\n }\n\n if (acc !== undefined) yield acc\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgBA,OAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,MAAM,wBAAQ,IAAI,IAAkB;CACpC,IAAI,QAAQ,KAAA,GAAW,OAA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AAU,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;IAClF,CAAC;IACD;GACF;EACF;EACA,IAAI,QAAQ,KAAA,GAAW,MAAM;EAC7B,MAAM;CACR;CAEA,IAAI,QAAQ,KAAA,GAAW,MAAM;AAC/B"}
package/dist/index.d.cts CHANGED
@@ -97,6 +97,13 @@ export declare class Url {
97
97
  * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'
98
98
  */
99
99
  static toPath(path: string): string;
100
+ /**
101
+ * Maps each `{placeholder}` name in a path to a unique camelCase identifier.
102
+ *
103
+ * @example
104
+ * Url.toParamNames('/groups/{group_id}/{group.id}') // Map { 'group_id' => 'groupId', 'group.id' => 'groupId2' }
105
+ */
106
+ static toParamNames(path: string): Map<string, string>;
100
107
  /**
101
108
  * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a
102
109
  * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``.
package/dist/index.d.ts CHANGED
@@ -97,6 +97,13 @@ export declare class Url {
97
97
  * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'
98
98
  */
99
99
  static toPath(path: string): string;
100
+ /**
101
+ * Maps each `{placeholder}` name in a path to a unique camelCase identifier.
102
+ *
103
+ * @example
104
+ * Url.toParamNames('/groups/{group_id}/{group.id}') // Map { 'group_id' => 'groupId', 'group.id' => 'groupId2' }
105
+ */
106
+ static toParamNames(path: string): Map<string, string>;
100
107
  /**
101
108
  * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a
102
109
  * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ast, ast as ast$1, createPrinter as createPrinter$1, defineMacro as defineMacro$1 } from "@kubb/ast";
2
- import { Diagnostics, Hookable, Resolver, addGenerator, addMacro, assertPluginOption, camelCase as camel, camelCase as camelCase$1, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase as pascal, pascalCase as pascalCase$2, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
2
+ import { Diagnostics, Hookable, Resolver, addGenerator, addMacro, assertPluginOption, camelCase as camel, camelCase as camelCase$2, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase as pascal, pascalCase as pascalCase$2, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
3
3
  import { hash } from "node:crypto";
4
4
  // \0rolldown/runtime.js
5
5
  var __defProp = Object.defineProperty;
@@ -78,6 +78,19 @@ function toCamelOrPascal(text, pascal) {
78
78
  return memo$1(cache, key, () => convert(text, pascal));
79
79
  }
80
80
  /**
81
+ * Converts `text` to camelCase.
82
+ *
83
+ * @example Word boundaries
84
+ * `camelCase('hello-world') // 'helloWorld'`
85
+ *
86
+ * @example With a prefix
87
+ * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
88
+ */
89
+ function camelCase$1(text, { prefix = "", suffix = "" } = {}) {
90
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
91
+ }
92
+ __name(camelCase$1, "camelCase");
93
+ /**
81
94
  * Converts `text` to PascalCase.
82
95
  *
83
96
  * @example Word boundaries
@@ -241,7 +254,7 @@ const macroDedupeUnion = defineMacro({
241
254
  });
242
255
  // src/deprecated.ts
243
256
  /** @deprecated Use `casing.camel`. Removed in Kubb v6. */
244
- const camelCase = camelCase$1;
257
+ const camelCase = camelCase$2;
245
258
  /** @deprecated Use `casing.pascal`. Removed in Kubb v6. */
246
259
  const pascalCase = pascalCase$2;
247
260
  /** @deprecated Use `ast.ref.getName`. Removed in Kubb v6. */
@@ -272,6 +285,12 @@ function transformPathParam(raw) {
272
285
  return !startsWithSafeChar || i > 0 ? word.charAt(0).toUpperCase() + word.slice(1) : word.charAt(0).toLowerCase() + word.slice(1);
273
286
  }).join("");
274
287
  }
288
+ function uniqueParamName(base, used) {
289
+ let name = base;
290
+ for (let i = 2; used.has(name); i++) name = `${base}${i}`;
291
+ used.add(name);
292
+ return name;
293
+ }
275
294
  /**
276
295
  * Renders how a grouped `path` object's member is accessed: dot access for an identifier (reserved
277
296
  * words are valid property names), bracket access with the raw name otherwise.
@@ -300,13 +319,23 @@ var Url = class {
300
319
  * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'
301
320
  */
302
321
  static toPath(path) {
303
- const seen = /* @__PURE__ */ new Map();
304
- return path.replace(/\{([^}]+)\}/g, (_match, param) => {
305
- const base = transformPathParam(param);
306
- const count = (seen.get(base) ?? 0) + 1;
307
- seen.set(base, count);
308
- return count === 1 ? `:${base}` : `:${base}${count}`;
309
- });
322
+ const used = /* @__PURE__ */ new Set();
323
+ return path.replace(/\{([^}]+)\}/g, (_match, param) => `:${uniqueParamName(transformPathParam(param), used)}`);
324
+ }
325
+ /**
326
+ * Maps each `{placeholder}` name in a path to a unique camelCase identifier.
327
+ *
328
+ * @example
329
+ * Url.toParamNames('/groups/{group_id}/{group.id}') // Map { 'group_id' => 'groupId', 'group.id' => 'groupId2' }
330
+ */
331
+ static toParamNames(path) {
332
+ const used = /* @__PURE__ */ new Set();
333
+ const names = /* @__PURE__ */ new Map();
334
+ for (const [, param] of path.matchAll(/\{([^}]+)\}/g)) {
335
+ const name = uniqueParamName(camelCase$1(param) || transformPathParam(param), used);
336
+ if (!names.has(param)) names.set(param, name);
337
+ }
338
+ return names;
310
339
  }
311
340
  /**
312
341
  * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["memo","memo","pascalCase","astCreatePrinter","astDefineMacro","memo","ast","camel","pascal","ast","ast","pascalCase","ast","ast"],"sources":["../../../internals/utils/src/promise.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/text.ts","../src/casing.ts","../src/text.ts","../src/authoring.ts","../src/macros/macroDedupeUnion.ts","../src/deprecated.ts","../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../src/utils/names.ts","../src/macros/macroEnumName.ts","../src/utils/mergeAdjacentSchemas.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n","import { memo } from './promise.ts'\n\ntype Options = {\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return (\n text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n // A status range such as `2xx` stays one word.\n .replace(/(\\d)(?!xx(?![a-z]))([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n )\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = memo.create<string, string>({ max: 100_000 })\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n return memo(cache, key, () => convert(text, pascal))\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n// A segment without lowercase letters, such as `COOL` or `2D`, stays one word, so a snake_case name is left unchanged.\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`. Unlike `pascalCase` it never splits words or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * `snakeCase('helloWorld') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Indents every non-empty line of `text` by `unit`, leaving blank lines empty.\n * @example\n * `indent({ text: 'a\\n\\nb' }) // ' a\\n\\n b'`\n */\nexport function indent({ text, unit = ' ' }: { text: string; unit?: string }): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${unit}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Strips the common leading whitespace and the surrounding blank lines, counting tabs and spaces alike, so indented template literals start at column zero.\n */\nexport function dedent(text: string): string {\n if (!text) return ''\n // Most text nodes are one line, so the common indent is its leading whitespace.\n if (!text.includes('\\n')) return text.trim() ? text.trimStart() : ''\n\n const lines = text.split('\\n')\n const indents = lines.map((line) => {\n const indent = line.length - line.trimStart().length\n return indent === line.length ? -1 : indent\n })\n const start = indents.findIndex((indent) => indent !== -1)\n if (start === -1) return ''\n const end = indents.findLastIndex((indent) => indent !== -1)\n // `-1` marks a blank line. `reduce`, not `Math.min(...indents)`, which overflows the stack on very long text.\n const min = indents.reduce((lowest, indent) => (indent !== -1 && indent < lowest ? indent : lowest), Infinity)\n\n return lines\n .slice(start, end + 1)\n .map((line, i) => (indents[start + i] === -1 ? '' : line.slice(min)))\n .join('\\n')\n}\n\n/**\n * Strips one matching pair of `\"`, `'` or `` ` `` from both ends of `text`. Returns `text` unchanged without a matching pair.\n * @example\n * `unquote('\"hello\"') // 'hello'`\n */\nexport function unquote(text: string): string {\n if (text.length < 2) return text\n const first = text[0]\n return (first === '\"' || first === \"'\" || first === '`') && text.at(-1) === first ? text.slice(1, -1) : text\n}\n","export { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nexport { capitalize, screamingSnakeCase as screamingSnake, snakeCase as snake } from '@internals/utils'\n","export { dedent, indent, unquote } from '@internals/utils'\n\n// A raw line break would end the literal.\nconst quoteEscapes = new Map([\n ['\\\\', '\\\\\\\\'],\n [\"'\", \"\\\\'\"],\n ['\\n', '\\\\n'],\n ['\\r', '\\\\r'],\n])\n\n/**\n * A single-quoted string literal with backslashes, quotes and line breaks escaped. JavaScript, TypeScript and Python read it the same way.\n */\nexport function quote(value: string | number | boolean | undefined | null): string {\n if (value === undefined || value === null) return \"''\"\n return `'${String(value).replace(/[\\\\'\\n\\r]/g, (char) => quoteEscapes.get(char)!)}'`\n}\n","import { createPrinter as astCreatePrinter, defineMacro as astDefineMacro } from '@kubb/ast'\n\nexport const createPrinter: typeof astCreatePrinter = astCreatePrinter\nexport const defineMacro: typeof astDefineMacro = astDefineMacro\n","import { hash } from 'node:crypto'\nimport { memo } from '@internals/utils'\nimport { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Drops members that repeat an earlier one, ignoring the source `pointer` so equal schemas from\n * different places in the spec still match.\n */\nfunction dedupeMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const seen = new Set<string>()\n const keys = memo.create<object, string>({ weak: true })\n\n function key(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'undefined'\n if (value instanceof Date) return key(value.toJSON())\n return memo(keys, value, () => {\n // A ref node's `ref` pointer already identifies its target, so hashing its resolved `schema` as\n // well only walks the same component graph again for every union that references it. The `kind`\n // check keeps plain data under `default` or `examples` hashed in full.\n const node = value as Partial<SchemaNode>\n const skipsSchema = node.kind === ast.node.kinds.schema && node.type === ast.schema.types.ref && typeof node.ref === 'string'\n // Hash each shared subtree once instead of expanding resolved refs into a giant string.\n const entries = Array.isArray(value)\n ? value.map(key)\n : Object.entries(value)\n .filter(([name, child]) => name !== 'pointer' && child !== undefined && !(skipsSchema && name === 'schema'))\n .map(([name, child]) => [name, key(child)])\n return hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n })\n }\n\n return members.filter((member) => {\n const memberKey = key(member)\n if (seen.has(memberKey)) return false\n seen.add(memberKey)\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one. Enum members next to a broader scalar, such as\n * `anyOf: [string, enum]`, are kept so the known values survive in the generated code.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroDedupeUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroDedupeUnion = defineMacro({\n name: 'dedupe-union',\n schema(node) {\n const unionNode = ast.schema.narrow(node, ast.schema.types.union)\n if (!unionNode?.members?.length) return undefined\n\n const deduped = dedupeMembers(unionNode.members)\n if (deduped.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: deduped }\n },\n})\n","import { ast } from '@kubb/ast'\nimport { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nimport { macroDedupeUnion } from './macros/macroDedupeUnion.ts'\n\n/** @deprecated Use `casing.camel`. Removed in Kubb v6. */\nexport const camelCase = camel\n\n/** @deprecated Use `casing.pascal`. Removed in Kubb v6. */\nexport const pascalCase = pascal\n\n/** @deprecated Use `ast.ref.getName`. Removed in Kubb v6. */\nexport const extractRefName = ast.ref.getName\n\n/** @deprecated Use `ast.ref.mergeSchema`. Removed in Kubb v6. */\nexport const syncSchemaRef = ast.ref.mergeSchema\n\n/** @deprecated Use `ast.schema.isString`. Removed in Kubb v6. */\nexport const isStringType = ast.schema.isString\n\n/** @deprecated Use `ast.graph.containsCircular`. Removed in Kubb v6. */\nexport const containsCircularRef = ast.graph.containsCircular\n\n/**\n * The name `macroDedupeUnion` had before 5.16. Kept so a plugin built against an older `@kubb/kit` keeps running.\n *\n * @deprecated Use `macroDedupeUnion`. Removed in the next major.\n */\nexport const macroSimplifyUnion = macroDedupeUnion\n","/**\n * Sanitizes a parameter name so it is safe to use as a `path-to-regexp` capture name, without\n * routing through {@link camelCase} (which keeps a leading `$` since it is a valid JS identifier\n * character). Runs of disallowed characters are treated as word boundaries; a boundary at the\n * very start of the name (e.g. the `$` in `$id`) still capitalizes the word that follows it.\n */\nfunction transformPathParam(raw: string): string {\n // `path-to-regexp` (used by MSW/Express) only accepts `[A-Za-z0-9_]` in a parameter name. It stops\n // reading at the first other character (a hyphen, a dot, a `$`, ...), which misparses the route or\n // throws \"Missing parameter name\".\n if (/^[A-Za-z0-9_]+$/.test(raw)) {\n return raw\n }\n\n const startsWithSafeChar = /^[A-Za-z_]/.test(raw)\n const words = raw.split(/[^A-Za-z0-9]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const capitalize = !startsWithSafeChar || i > 0\n return capitalize ? word.charAt(0).toUpperCase() + word.slice(1) : word.charAt(0).toLowerCase() + word.slice(1)\n })\n .join('')\n}\n\n/**\n * Renders how a grouped `path` object's member is accessed: dot access for an identifier (reserved\n * words are valid property names), bracket access with the raw name otherwise.\n */\nfunction groupedAccessor(name: string): string {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ? `.${name}` : `[${JSON.stringify(name)}]`\n}\n\n/**\n * Static helpers for OpenAPI/Swagger paths: template syntax conversion, parameter extraction, and URL composition.\n */\nexport class Url {\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * Distinct parameter names that normalize to the same identifier (e.g. `{group-id}` and\n * `{group.id}` both becoming `groupId`) are deduplicated with an incrementing suffix so\n * `path-to-regexp` never sees two identically named captures.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n *\n * @example\n * Url.toPath('/point/{point-id}') // '/point/:pointId'\n *\n * @example\n * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'\n */\n static toPath(path: string): string {\n const seen = new Map<string, number>()\n\n return path.replace(/\\{([^}]+)\\}/g, (_match, param: string) => {\n const base = transformPathParam(param)\n const count = (seen.get(base) ?? 0) + 1\n seen.set(base, count)\n\n return count === 1 ? `:${base}` : `:${base}${count}`\n })\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``.\n * Parameter names are kept exactly as they appear in the OpenAPI path; a name falls back to\n * bracket access (`` path['pet-id'] ``) only when it isn't a valid JS identifier.\n * `prefix` is prepended inside the literal. Shared by generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n *\n * @example\n * Url.toGroupedTemplateString('/user/{monetary-account-id}') // '`/user/${path[\"monetary-account-id\"]}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts.map((part, i) => (i % 2 === 0 ? part : `\\${path${groupedAccessor(part)}}`)).join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string | number | boolean>\n enumName?: string\n}\n\n/**\n * Picks the enum primitive from the type of the first value.\n */\nexport function enumPrimitive(values: Props['values']): 'string' | 'number' | 'boolean' {\n return typeof values[0] === 'number' ? 'number' : typeof values[0] === 'boolean' ? 'boolean' : 'string'\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with an enum of the given\n * values. The enum is a string, number or boolean enum, following the first value. Object schemas\n * that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.schema.narrow(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return ast.factory.createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return ast.factory.createProperty({\n ...prop,\n schema: ast.factory.createSchema({\n type: 'enum',\n primitive: enumPrimitive(values),\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { pascalCase } from '@internals/utils'\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport { enumPropName } from '../utils/names.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.schema.narrow(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Merges a run of adjacent anonymous object members into one. Named or non-object members break the\n * run and pass through unchanged. The merge follows member order, so callers control which members\n * combine by where they place them in the sequence.\n *\n * @example\n * ```ts\n * const merged = [...mergeAdjacentObjectsLazy([objectA, objectB])]\n * ```\n */\nexport function* mergeAdjacentObjectsLazy(members: Iterable<SchemaNode>): Generator<SchemaNode, void, undefined> {\n let acc: SchemaNode | undefined\n\n for (const member of members) {\n const objectMember = ast.schema.narrow(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.schema.narrow(acc, 'object')\n if (accObject && !accObject.name) {\n acc = ast.factory.createSchema({\n ...accObject,\n properties: [...(accObject.properties ?? []), ...(objectMember.properties ?? [])],\n })\n continue\n }\n }\n if (acc !== undefined) yield acc\n acc = member\n }\n\n if (acc !== undefined) yield acc\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgBA,OAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IA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,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAOA,aAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;ACLA,SAAgB,cAAc,EAAE,YAAY,UAAU,cAAqB;CACzE,OAAO,YAAY;EACjB,MAAM;EACN,OAAO,MAAM;GACX,MAAM,WAAWC,MAAI,OAAO,OAAO,MAAM,MAAM;GAE/C,IAAI,UAAU,cAAc,WAAW,OAAO;IAAE,GAAG;IAAM,MAAM;GAAK;GACpE,IAAI,UAAU,OAAO;IAAE,GAAG;IAAM,MAAM,aAAa,YAAY,UAAU,UAAU;GAAE;EAGvF;CACF,CAAC;AACH;;;;;;;;;;;;ACnBA,UAAiB,yBAAyB,SAAuE;CAC/G,IAAI;CAEJ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,eAAeC,MAAI,OAAO,OAAO,QAAQ,QAAQ;EACvD,IAAI,gBAAgB,CAAC,aAAa,QAAQ,QAAQ,KAAA,GAAW;GAC3D,MAAM,YAAYA,MAAI,OAAO,OAAO,KAAK,QAAQ;GACjD,IAAI,aAAa,CAAC,UAAU,MAAM;IAChC,MAAMA,MAAI,QAAQ,aAAa;KAC7B,GAAG;KACH,YAAY,CAAC,GAAI,UAAU,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;IAClF,CAAC;IACD;GACF;EACF;EACA,IAAI,QAAQ,KAAA,GAAW,MAAM;EAC7B,MAAM;CACR;CAEA,IAAI,QAAQ,KAAA,GAAW,MAAM;AAC/B"}
1
+ {"version":3,"file":"index.js","names":["memo","memo","camelCase","pascalCase","astCreatePrinter","astDefineMacro","memo","ast","camel","pascal","ast","camelCase","ast","pascalCase","ast","ast"],"sources":["../../../internals/utils/src/promise.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/text.ts","../src/casing.ts","../src/text.ts","../src/authoring.ts","../src/macros/macroDedupeUnion.ts","../src/deprecated.ts","../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../src/utils/names.ts","../src/macros/macroEnumName.ts","../src/utils/mergeAdjacentSchemas.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n","import { memo } from './promise.ts'\n\ntype Options = {\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return (\n text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n // A status range such as `2xx` stays one word.\n .replace(/(\\d)(?!xx(?![a-z]))([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n )\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = memo.create<string, string>({ max: 100_000 })\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n return memo(cache, key, () => convert(text, pascal))\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n// A segment without lowercase letters, such as `COOL` or `2D`, stays one word, so a snake_case name is left unchanged.\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`. Unlike `pascalCase` it never splits words or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * `snakeCase('helloWorld') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * Indents every non-empty line of `text` by `unit`, leaving blank lines empty.\n * @example\n * `indent({ text: 'a\\n\\nb' }) // ' a\\n\\n b'`\n */\nexport function indent({ text, unit = ' ' }: { text: string; unit?: string }): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${unit}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Strips the common leading whitespace and the surrounding blank lines, counting tabs and spaces alike, so indented template literals start at column zero.\n */\nexport function dedent(text: string): string {\n if (!text) return ''\n // Most text nodes are one line, so the common indent is its leading whitespace.\n if (!text.includes('\\n')) return text.trim() ? text.trimStart() : ''\n\n const lines = text.split('\\n')\n const indents = lines.map((line) => {\n const indent = line.length - line.trimStart().length\n return indent === line.length ? -1 : indent\n })\n const start = indents.findIndex((indent) => indent !== -1)\n if (start === -1) return ''\n const end = indents.findLastIndex((indent) => indent !== -1)\n // `-1` marks a blank line. `reduce`, not `Math.min(...indents)`, which overflows the stack on very long text.\n const min = indents.reduce((lowest, indent) => (indent !== -1 && indent < lowest ? indent : lowest), Infinity)\n\n return lines\n .slice(start, end + 1)\n .map((line, i) => (indents[start + i] === -1 ? '' : line.slice(min)))\n .join('\\n')\n}\n\n/**\n * Strips one matching pair of `\"`, `'` or `` ` `` from both ends of `text`. Returns `text` unchanged without a matching pair.\n * @example\n * `unquote('\"hello\"') // 'hello'`\n */\nexport function unquote(text: string): string {\n if (text.length < 2) return text\n const first = text[0]\n return (first === '\"' || first === \"'\" || first === '`') && text.at(-1) === first ? text.slice(1, -1) : text\n}\n","export { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nexport { capitalize, screamingSnakeCase as screamingSnake, snakeCase as snake } from '@internals/utils'\n","export { dedent, indent, unquote } from '@internals/utils'\n\n// A raw line break would end the literal.\nconst quoteEscapes = new Map([\n ['\\\\', '\\\\\\\\'],\n [\"'\", \"\\\\'\"],\n ['\\n', '\\\\n'],\n ['\\r', '\\\\r'],\n])\n\n/**\n * A single-quoted string literal with backslashes, quotes and line breaks escaped. JavaScript, TypeScript and Python read it the same way.\n */\nexport function quote(value: string | number | boolean | undefined | null): string {\n if (value === undefined || value === null) return \"''\"\n return `'${String(value).replace(/[\\\\'\\n\\r]/g, (char) => quoteEscapes.get(char)!)}'`\n}\n","import { createPrinter as astCreatePrinter, defineMacro as astDefineMacro } from '@kubb/ast'\n\nexport const createPrinter: typeof astCreatePrinter = astCreatePrinter\nexport const defineMacro: typeof astDefineMacro = astDefineMacro\n","import { hash } from 'node:crypto'\nimport { memo } from '@internals/utils'\nimport { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Drops members that repeat an earlier one, ignoring the source `pointer` so equal schemas from\n * different places in the spec still match.\n */\nfunction dedupeMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const seen = new Set<string>()\n const keys = memo.create<object, string>({ weak: true })\n\n function key(value: unknown): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value) ?? 'undefined'\n if (value instanceof Date) return key(value.toJSON())\n return memo(keys, value, () => {\n // A ref node's `ref` pointer already identifies its target, so hashing its resolved `schema` as\n // well only walks the same component graph again for every union that references it. The `kind`\n // check keeps plain data under `default` or `examples` hashed in full.\n const node = value as Partial<SchemaNode>\n const skipsSchema = node.kind === ast.node.kinds.schema && node.type === ast.schema.types.ref && typeof node.ref === 'string'\n // Hash each shared subtree once instead of expanding resolved refs into a giant string.\n const entries = Array.isArray(value)\n ? value.map(key)\n : Object.entries(value)\n .filter(([name, child]) => name !== 'pointer' && child !== undefined && !(skipsSchema && name === 'schema'))\n .map(([name, child]) => [name, key(child)])\n return hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n })\n }\n\n return members.filter((member) => {\n const memberKey = key(member)\n if (seen.has(memberKey)) return false\n seen.add(memberKey)\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one. Enum members next to a broader scalar, such as\n * `anyOf: [string, enum]`, are kept so the known values survive in the generated code.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroDedupeUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroDedupeUnion = defineMacro({\n name: 'dedupe-union',\n schema(node) {\n const unionNode = ast.schema.narrow(node, ast.schema.types.union)\n if (!unionNode?.members?.length) return undefined\n\n const deduped = dedupeMembers(unionNode.members)\n if (deduped.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: deduped }\n },\n})\n","import { ast } from '@kubb/ast'\nimport { camelCase as camel, pascalCase as pascal } from '@kubb/core'\nimport { macroDedupeUnion } from './macros/macroDedupeUnion.ts'\n\n/** @deprecated Use `casing.camel`. Removed in Kubb v6. */\nexport const camelCase = camel\n\n/** @deprecated Use `casing.pascal`. Removed in Kubb v6. */\nexport const pascalCase = pascal\n\n/** @deprecated Use `ast.ref.getName`. Removed in Kubb v6. */\nexport const extractRefName = ast.ref.getName\n\n/** @deprecated Use `ast.ref.mergeSchema`. Removed in Kubb v6. */\nexport const syncSchemaRef = ast.ref.mergeSchema\n\n/** @deprecated Use `ast.schema.isString`. Removed in Kubb v6. */\nexport const isStringType = ast.schema.isString\n\n/** @deprecated Use `ast.graph.containsCircular`. Removed in Kubb v6. */\nexport const containsCircularRef = ast.graph.containsCircular\n\n/**\n * The name `macroDedupeUnion` had before 5.16. Kept so a plugin built against an older `@kubb/kit` keeps running.\n *\n * @deprecated Use `macroDedupeUnion`. Removed in the next major.\n */\nexport const macroSimplifyUnion = macroDedupeUnion\n","import { camelCase } from '@internals/utils'\n\n/**\n * Sanitizes a parameter name so it is safe to use as a `path-to-regexp` capture name, without\n * routing through {@link camelCase} (which keeps a leading `$` since it is a valid JS identifier\n * character). Runs of disallowed characters are treated as word boundaries; a boundary at the\n * very start of the name (e.g. the `$` in `$id`) still capitalizes the word that follows it.\n */\nfunction transformPathParam(raw: string): string {\n // `path-to-regexp` (used by MSW/Express) only accepts `[A-Za-z0-9_]` in a parameter name. It stops\n // reading at the first other character (a hyphen, a dot, a `$`, ...), which misparses the route or\n // throws \"Missing parameter name\".\n if (/^[A-Za-z0-9_]+$/.test(raw)) {\n return raw\n }\n\n const startsWithSafeChar = /^[A-Za-z_]/.test(raw)\n const words = raw.split(/[^A-Za-z0-9]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const capitalize = !startsWithSafeChar || i > 0\n return capitalize ? word.charAt(0).toUpperCase() + word.slice(1) : word.charAt(0).toLowerCase() + word.slice(1)\n })\n .join('')\n}\n\nfunction uniqueParamName(base: string, used: Set<string>): string {\n let name = base\n for (let i = 2; used.has(name); i++) name = `${base}${i}`\n used.add(name)\n\n return name\n}\n\n/**\n * Renders how a grouped `path` object's member is accessed: dot access for an identifier (reserved\n * words are valid property names), bracket access with the raw name otherwise.\n */\nfunction groupedAccessor(name: string): string {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ? `.${name}` : `[${JSON.stringify(name)}]`\n}\n\n/**\n * Static helpers for OpenAPI/Swagger paths: template syntax conversion, parameter extraction, and URL composition.\n */\nexport class Url {\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * Distinct parameter names that normalize to the same identifier (e.g. `{group-id}` and\n * `{group.id}` both becoming `groupId`) are deduplicated with an incrementing suffix so\n * `path-to-regexp` never sees two identically named captures.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n *\n * @example\n * Url.toPath('/point/{point-id}') // '/point/:pointId'\n *\n * @example\n * Url.toPath('/groups/{group-id}/{group.id}.json') // '/groups/:groupId/:groupId2.json'\n */\n static toPath(path: string): string {\n const used = new Set<string>()\n\n return path.replace(/\\{([^}]+)\\}/g, (_match, param: string) => `:${uniqueParamName(transformPathParam(param), used)}`)\n }\n\n /**\n * Maps each `{placeholder}` name in a path to a unique camelCase identifier.\n *\n * @example\n * Url.toParamNames('/groups/{group_id}/{group.id}') // Map { 'group_id' => 'groupId', 'group.id' => 'groupId2' }\n */\n static toParamNames(path: string): Map<string, string> {\n const used = new Set<string>()\n const names = new Map<string, string>()\n\n for (const [, param] of path.matchAll(/\\{([^}]+)\\}/g)) {\n const name = uniqueParamName(camelCase(param!) || transformPathParam(param!), used)\n if (!names.has(param!)) names.set(param!, name)\n }\n\n return names\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``.\n * Parameter names are kept exactly as they appear in the OpenAPI path; a name falls back to\n * bracket access (`` path['pet-id'] ``) only when it isn't a valid JS identifier.\n * `prefix` is prepended inside the literal. Shared by generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n *\n * @example\n * Url.toGroupedTemplateString('/user/{monetary-account-id}') // '`/user/${path[\"monetary-account-id\"]}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts.map((part, i) => (i % 2 === 0 ? part : `\\${path${groupedAccessor(part)}}`)).join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string | number | boolean>\n enumName?: string\n}\n\n/**\n * Picks the enum primitive from the type of the first value.\n */\nexport function enumPrimitive(values: Props['values']): 'string' | 'number' | 'boolean' {\n return typeof values[0] === 'number' ? 'number' : typeof values[0] === 'boolean' ? 'boolean' : 'string'\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with an enum of the given\n * values. The enum is a string, number or boolean enum, following the first value. Object schemas\n * that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.schema.narrow(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return ast.factory.createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return ast.factory.createProperty({\n ...prop,\n schema: ast.factory.createSchema({\n type: 'enum',\n primitive: enumPrimitive(values),\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { pascalCase } from '@internals/utils'\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n","import { ast } from '@kubb/ast'\nimport { defineMacro } from '../authoring.ts'\nimport { enumPropName } from '../utils/names.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.schema.narrow(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Merges a run of adjacent anonymous object members into one. Named or non-object members break the\n * run and pass through unchanged. The merge follows member order, so callers control which members\n * combine by where they place them in the sequence.\n *\n * @example\n * ```ts\n * const merged = [...mergeAdjacentObjectsLazy([objectA, objectB])]\n * ```\n */\nexport function* mergeAdjacentObjectsLazy(members: Iterable<SchemaNode>): Generator<SchemaNode, void, undefined> {\n let acc: SchemaNode | undefined\n\n for (const member of members) {\n const objectMember = ast.schema.narrow(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.schema.narrow(acc, 'object')\n if (accObject && !accObject.name) {\n acc = ast.factory.createSchema({\n ...accObject,\n properties: [...(accObject.proper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;;;;;;;ACnBA,UAAiB,yBAAyB,SAAuE;CAC/G,IAAI;CAEJ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,eAAeC,MAAI,OAAO,OAAO,QAAQ,QAAQ;EACvD,IAAI,gBAAgB,CAAC,aAAa,QAAQ,QAAQ,KAAA,GAAW;GAC3D,MAAM,YAAYA,MAAI,OAAO,OAAO,KAAK,QAAQ;GACjD,IAAI,aAAa,CAAC,UAAU,MAAM;IAChC,MAAMA,MAAI,QAAQ,aAAa;KAC7B,GAAG;KACH,YAAY,CAAC,GAAI,UAAU,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;IAClF,CAAC;IACD;GACF;EACF;EACA,IAAI,QAAQ,KAAA,GAAW,MAAM;EAC7B,MAAM;CACR;CAEA,IAAI,QAAQ,KAAA,GAAW,MAAM;AAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/kit",
3
- "version": "5.19.2",
3
+ "version": "5.20.0",
4
4
  "description": "Authoring toolkit for Kubb plugins, generators, adapters, resolvers, and renderers.",
5
5
  "keywords": [
6
6
  "codegen",
@@ -63,8 +63,8 @@
63
63
  "registry": "https://registry.npmjs.org/"
64
64
  },
65
65
  "dependencies": {
66
- "@kubb/ast": "^5.19.2",
67
- "@kubb/core": "^5.19.2"
66
+ "@kubb/ast": "^5.20.0",
67
+ "@kubb/core": "^5.20.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@internals/utils": "0.0.1"