@kubb/kit 5.14.5 → 5.15.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
@@ -1,9 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#endregion
2
+ // \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", {
5
+ value,
6
+ configurable: true
7
+ });
3
8
  let _kubb_ast = require("@kubb/ast");
4
9
  let node_crypto = require("node:crypto");
5
10
  let _kubb_core = require("@kubb/core");
6
- //#region src/Url.ts
11
+ // src/Url.ts
7
12
  /**
8
13
  * Sanitizes a parameter name so it is safe to use as a `path-to-regexp` capture name, without
9
14
  * routing through {@link camelCase} (which keeps a leading `$` since it is a valid JS identifier
@@ -71,8 +76,7 @@ var Url = class {
71
76
  return `\`${prefix ?? ""}${result}\``;
72
77
  }
73
78
  };
74
- //#endregion
75
- //#region src/macros/macroDiscriminatorEnum.ts
79
+ // src/macros/macroDiscriminatorEnum.ts
76
80
  /**
77
81
  * Picks the enum primitive from the type of the first value.
78
82
  */
@@ -117,8 +121,7 @@ function macroDiscriminatorEnum({ propertyName, values, enumName }) {
117
121
  }
118
122
  });
119
123
  }
120
- //#endregion
121
- //#region ../../internals/utils/src/casing.ts
124
+ // ../../internals/utils/src/casing.ts
122
125
  /**
123
126
  * Shared implementation for camelCase and PascalCase conversion.
124
127
  * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
@@ -133,7 +136,7 @@ function convert(text, pascal) {
133
136
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
134
137
  }
135
138
  const cache = /* @__PURE__ */ new Map();
136
- const cacheLimit = 1e4;
139
+ const cacheLimit = 1e5;
137
140
  function toCamelOrPascal(text, pascal) {
138
141
  const key = `${pascal ? "P" : "c"}${text}`;
139
142
  const cached = cache.get(key);
@@ -152,11 +155,11 @@ function toCamelOrPascal(text, pascal) {
152
155
  * @example With a suffix
153
156
  * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`
154
157
  */
155
- function pascalCase(text, { prefix = "", suffix = "" } = {}) {
158
+ function pascalCase$1(text, { prefix = "", suffix = "" } = {}) {
156
159
  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
157
160
  }
158
- //#endregion
159
- //#region src/utils/refs.ts
161
+ __name(pascalCase$1, "pascalCase");
162
+ // src/utils/refs.ts
160
163
  const plainStringTypes = /* @__PURE__ */ new Set([
161
164
  "string",
162
165
  "uuid",
@@ -177,7 +180,7 @@ const extractRefName = _kubb_ast.ast.refName;
177
180
  * `childName(undefined, 'params') // null`
178
181
  */
179
182
  function childName(parentName, propName) {
180
- return parentName ? pascalCase([parentName, propName].join(" ")) : null;
183
+ return parentName ? pascalCase$1([parentName, propName].join(" ")) : null;
181
184
  }
182
185
  /**
183
186
  * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any
@@ -187,7 +190,7 @@ function childName(parentName, propName) {
187
190
  * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`
188
191
  */
189
192
  function enumPropName(parentName, propName, enumSuffix) {
190
- return pascalCase([
193
+ return pascalCase$1([
191
194
  parentName,
192
195
  propName,
193
196
  enumSuffix
@@ -220,8 +223,7 @@ function isStringType(node) {
220
223
  if (temporal) return temporal.representation !== "date";
221
224
  return false;
222
225
  }
223
- //#endregion
224
- //#region src/macros/macroEnumName.ts
226
+ // src/macros/macroEnumName.ts
225
227
  /**
226
228
  * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums
227
229
  * are left anonymous. Non-enum nodes are returned unchanged.
@@ -248,8 +250,7 @@ function macroEnumName({ parentName, propName, enumSuffix }) {
248
250
  }
249
251
  });
250
252
  }
251
- //#endregion
252
- //#region src/macros/macroRenameSchema.ts
253
+ // src/macros/macroRenameSchema.ts
253
254
  /**
254
255
  * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref
255
256
  * pointing at it (`targetName`) change together, so imports and printed references stay in
@@ -278,8 +279,7 @@ function macroRenameSchema({ from, to }) {
278
279
  }
279
280
  });
280
281
  }
281
- //#endregion
282
- //#region src/macros/macroSimplifyUnion.ts
282
+ // src/macros/macroSimplifyUnion.ts
283
283
  const SCALAR_PRIMITIVE_TYPES = /* @__PURE__ */ new Set([
284
284
  _kubb_ast.ast.schemaTypes.string,
285
285
  _kubb_ast.ast.schemaTypes.number,
@@ -299,7 +299,9 @@ function dedupeMembers(members) {
299
299
  if (value instanceof Date) return key(value.toJSON());
300
300
  const cached = keys.get(value);
301
301
  if (cached) return cached;
302
- const entries = Array.isArray(value) ? value.map(key) : Object.entries(value).filter(([name, child]) => name !== "pointer" && child !== void 0).map(([name, child]) => [name, key(child)]);
302
+ const node = value;
303
+ const skipsSchema = node.kind === _kubb_ast.ast.nodeKinds.schema && node.type === _kubb_ast.ast.schemaTypes.ref && typeof node.ref === "string";
304
+ const entries = Array.isArray(value) ? value.map(key) : Object.entries(value).filter(([name, child]) => name !== "pointer" && child !== void 0 && !(skipsSchema && name === "schema")).map(([name, child]) => [name, key(child)]);
303
305
  const result = (0, node_crypto.hash)("sha256", JSON.stringify([Array.isArray(value), entries]));
304
306
  keys.set(value, result);
305
307
  return result;
@@ -350,8 +352,7 @@ const macroSimplifyUnion = _kubb_ast.ast.defineMacro({
350
352
  };
351
353
  }
352
354
  });
353
- //#endregion
354
- //#region src/utils/mergeAdjacentSchemas.ts
355
+ // src/utils/mergeAdjacentSchemas.ts
355
356
  /**
356
357
  * Merges a run of adjacent anonymous object members into one. Named or non-object members break the
357
358
  * run and pass through unchanged. The merge follows member order, so callers control which members
@@ -381,8 +382,7 @@ function* mergeAdjacentObjectsLazy(members) {
381
382
  }
382
383
  if (acc !== void 0) yield acc;
383
384
  }
384
- //#endregion
385
- //#region src/utils/schemaGraph.ts
385
+ // src/utils/schemaGraph.ts
386
386
  /**
387
387
  * Returns `true` when a schema, or anything nested inside it, references a circular schema.
388
388
  *
@@ -396,7 +396,6 @@ function containsCircularRef(node, { circularSchemas, excludeName }) {
396
396
  for (const name of _kubb_ast.ast.collectSchemaRefs(node)) if (name !== excludeName && circularSchemas.has(name)) return true;
397
397
  return false;
398
398
  }
399
- //#endregion
400
399
  Object.defineProperty(exports, "Diagnostics", {
401
400
  enumerable: true,
402
401
  get: function() {
@@ -440,6 +439,12 @@ Object.defineProperty(exports, "ast", {
440
439
  return _kubb_ast.ast;
441
440
  }
442
441
  });
442
+ Object.defineProperty(exports, "camelCase", {
443
+ enumerable: true,
444
+ get: function() {
445
+ return _kubb_core.camelCase;
446
+ }
447
+ });
443
448
  exports.childName = childName;
444
449
  exports.containsCircularRef = containsCircularRef;
445
450
  Object.defineProperty(exports, "createAdapter", {
@@ -528,6 +533,12 @@ Object.defineProperty(exports, "manifestProblems", {
528
533
  return _kubb_core.manifestProblems;
529
534
  }
530
535
  });
536
+ Object.defineProperty(exports, "memo", {
537
+ enumerable: true,
538
+ get: function() {
539
+ return _kubb_core.memo;
540
+ }
541
+ });
531
542
  Object.defineProperty(exports, "memoryStorage", {
532
543
  enumerable: true,
533
544
  get: function() {
@@ -535,6 +546,12 @@ Object.defineProperty(exports, "memoryStorage", {
535
546
  }
536
547
  });
537
548
  exports.mergeAdjacentObjectsLazy = mergeAdjacentObjectsLazy;
549
+ Object.defineProperty(exports, "pascalCase", {
550
+ enumerable: true,
551
+ get: function() {
552
+ return _kubb_core.pascalCase;
553
+ }
554
+ });
538
555
  Object.defineProperty(exports, "requirePlugin", {
539
556
  enumerable: true,
540
557
  get: function() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ast","ast","ast","ast","ast","hash","ast","ast"],"sources":["../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../../../internals/utils/src/casing.ts","../src/utils/refs.ts","../src/macros/macroEnumName.ts","../src/macros/macroRenameSchema.ts","../src/macros/macroSimplifyUnion.ts","../src/utils/mergeAdjacentSchemas.ts","../src/utils/schemaGraph.ts"],"sourcesContent":["/**\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 * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\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'\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 ast.defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.narrowSchema(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","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\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 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 .replace(/(\\d)([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// Plugins resolve the same names over and over (about 47,000 calls for a 1,000 schema spec), so\n// results are kept. Clearing at the limit bounds the memory a long-running process spends on it.\nconst cache = new Map<string, string>()\nconst cacheLimit = 10_000\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n\n const result = convert(text, pascal)\n if (cache.size >= cacheLimit) cache.clear()\n cache.set(key, result)\n return result\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","import { ast } from '@kubb/ast'\nimport type { SchemaNode, SchemaType } from '@kubb/ast'\nimport { pascalCase } from '@internals/utils'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/** Returns the last path segment of a reference string, for example `'Pet'` for `#/components/schemas/Pet`. */\nexport const extractRefName = ast.refName\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\n/**\n * Applies `ast.mergeRefWithSchema()` to a resolved ref and rebuilds the result through\n * `ast.factory.createSchema()`. Non-ref nodes and unresolved refs are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = ast.factory.createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = ast.narrowSchema(node, 'ref')\n\n if (!ref?.schema) return node\n\n return ast.factory.createSchema(ast.mergeRefWithSchema(ref))\n}\n\n/**\n * Returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = ast.narrowSchema(node, 'date') ?? ast.narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n","import { ast } from '@kubb/ast'\nimport { enumPropName } from '../utils/refs.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 ast.defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.narrowSchema(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'\n\ntype Props = {\n from: string\n to: string\n}\n\n/**\n * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref\n * pointing at it (`targetName`) change together, so imports and printed references stay in\n * sync. Renaming only one side by hand produces imports for files that are never generated.\n *\n * @example\n * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })`\n */\nexport function macroRenameSchema({ from, to }: Props) {\n return ast.defineMacro({\n name: 'rename-schema',\n schema(node) {\n const refNode = ast.narrowSchema(node, 'ref')\n\n if (!refNode) {\n return node.name === from ? { ...node, name: to } : undefined\n }\n\n const renamesDeclaration = refNode.name === from\n const renamesTarget = ast.resolveRefName(refNode) === from\n if (!renamesDeclaration && !renamesTarget) return undefined\n\n return {\n ...refNode,\n ...(renamesDeclaration ? { name: to } : {}),\n ...(renamesTarget ? { targetName: to } : {}),\n }\n },\n })\n}\n","import { hash } from 'node:crypto'\nimport { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\nconst SCALAR_PRIMITIVE_TYPES = new Set<string>([\n ast.schemaTypes.string,\n ast.schemaTypes.number,\n ast.schemaTypes.integer,\n ast.schemaTypes.bigint,\n ast.schemaTypes.boolean,\n])\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 = new WeakMap<object, string>()\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 const cached = keys.get(value)\n if (cached) return cached\n\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)\n .map(([name, child]) => [name, key(child)])\n const result = hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n keys.set(value, result)\n return result\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 * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set<string>(members.filter((member) => SCALAR_PRIMITIVE_TYPES.has(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = ast.narrowSchema(member, ast.schemaTypes.enum)\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if (\n (primitive === ast.schemaTypes.integer || primitive === ast.schemaTypes.number) &&\n (scalarPrimitives.has(ast.schemaTypes.integer) || scalarPrimitives.has(ast.schemaTypes.number))\n )\n return false\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one, and members a broader scalar primitive already\n * covers, such as a multi-value string enum sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = ast.defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = ast.narrowSchema(node, ast.schemaTypes.union)\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(dedupeMembers(unionNode.members))\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\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.narrowSchema(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.narrowSchema(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","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Returns `true` when a schema, or anything nested inside it, references a circular schema.\n *\n * Pass `excludeName` to skip refs to a specific schema, which helps when self-references are handled\n * on their own. Pair it with `ast.findCircularSchemas()` to decide where lazy wrappers go.\n *\n * @note Reads the memoized `ast.collectSchemaRefs()` set, so a schema is scanned once across plugins.\n */\nexport function containsCircularRef(\n node: SchemaNode | undefined,\n { circularSchemas, excludeName }: { circularSchemas: ReadonlySet<string>; excludeName?: string },\n): boolean {\n if (!node || circularSchemas.size === 0) return false\n\n for (const name of ast.collectSchemaRefs(node)) {\n if (name !== excludeName && circularSchemas.has(name)) return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAS,mBAAmB,KAAqB;CAI/C,IAAI,kBAAkB,KAAK,GAAG,GAC5B,OAAO;CAGT,MAAM,qBAAqB,aAAa,KAAK,GAAG;CAGhD,OAFc,IAAI,MAAM,eAAe,CAAC,CAAC,OAAO,OAErC,CAAC,CACT,KAAK,MAAM,MAAM;EAEhB,OADmB,CAAC,sBAAsB,IAAI,IAC1B,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;CAChH,CAAC,CAAC,CACD,KAAK,EAAE;AACZ;;;;;AAMA,SAAS,gBAAgB,MAAsB;CAC7C,OAAO,6BAA6B,KAAK,IAAI,IAAI,IAAI,SAAS,IAAI,KAAK,UAAU,IAAI,EAAE;AACzF;;;;AAKA,IAAa,MAAb,MAAiB;;;;;;;;;;;;;;;;;CAiBf,OAAO,OAAO,MAAsB;EAClC,MAAM,uBAAO,IAAI,IAAoB;EAErC,OAAO,KAAK,QAAQ,iBAAiB,QAAQ,UAAkB;GAC7D,MAAM,OAAO,mBAAmB,KAAK;GACrC,MAAM,SAAS,KAAK,IAAI,IAAI,K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Q;EACtD,IAAI,gBAAgB,CAAC,aAAa,QAAQ,QAAQ,KAAA,GAAW;GAC3D,MAAM,YAAYA,UAAAA,IAAI,aAAa,KAAK,QAAQ;GAChD,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;;;;;;;;;;;ACtBA,SAAgB,oBACd,MACA,EAAE,iBAAiB,eACV;CACT,IAAI,CAAC,QAAQ,gBAAgB,SAAS,GAAG,OAAO;CAEhD,KAAK,MAAM,QAAQC,UAAAA,IAAI,kBAAkB,IAAI,GAC3C,IAAI,SAAS,eAAe,gBAAgB,IAAI,IAAI,GAAG,OAAO;CAGhE,OAAO;AACT"}
1
+ {"version":3,"file":"index.cjs","names":["ast","pascalCase","ast","pascalCase","ast","ast","ast","hash","ast","ast"],"sources":["../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../../../internals/utils/src/casing.ts","../src/utils/refs.ts","../src/macros/macroEnumName.ts","../src/macros/macroRenameSchema.ts","../src/macros/macroSimplifyUnion.ts","../src/utils/mergeAdjacentSchemas.ts","../src/utils/schemaGraph.ts"],"sourcesContent":["/**\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 * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\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'\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 ast.defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.narrowSchema(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","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\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 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 .replace(/(\\d)([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// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = new Map<string, string>()\nconst cacheLimit = 100_000\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n\n const result = convert(text, pascal)\n if (cache.size >= cacheLimit) cache.clear()\n cache.set(key, result)\n return result\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","import { ast } from '@kubb/ast'\nimport type { SchemaNode, SchemaType } from '@kubb/ast'\nimport { pascalCase } from '@internals/utils'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/** Returns the last path segment of a reference string, for example `'Pet'` for `#/components/schemas/Pet`. */\nexport const extractRefName = ast.refName\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\n/**\n * Applies `ast.mergeRefWithSchema()` to a resolved ref and rebuilds the result through\n * `ast.factory.createSchema()`. Non-ref nodes and unresolved refs are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = ast.factory.createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = ast.narrowSchema(node, 'ref')\n\n if (!ref?.schema) return node\n\n return ast.factory.createSchema(ast.mergeRefWithSchema(ref))\n}\n\n/**\n * Returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = ast.narrowSchema(node, 'date') ?? ast.narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n","import { ast } from '@kubb/ast'\nimport { enumPropName } from '../utils/refs.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 ast.defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.narrowSchema(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'\n\ntype Props = {\n from: string\n to: string\n}\n\n/**\n * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref\n * pointing at it (`targetName`) change together, so imports and printed references stay in\n * sync. Renaming only one side by hand produces imports for files that are never generated.\n *\n * @example\n * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })`\n */\nexport function macroRenameSchema({ from, to }: Props) {\n return ast.defineMacro({\n name: 'rename-schema',\n schema(node) {\n const refNode = ast.narrowSchema(node, 'ref')\n\n if (!refNode) {\n return node.name === from ? { ...node, name: to } : undefined\n }\n\n const renamesDeclaration = refNode.name === from\n const renamesTarget = ast.resolveRefName(refNode) === from\n if (!renamesDeclaration && !renamesTarget) return undefined\n\n return {\n ...refNode,\n ...(renamesDeclaration ? { name: to } : {}),\n ...(renamesTarget ? { targetName: to } : {}),\n }\n },\n })\n}\n","import { hash } from 'node:crypto'\nimport { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\nconst SCALAR_PRIMITIVE_TYPES = new Set<string>([\n ast.schemaTypes.string,\n ast.schemaTypes.number,\n ast.schemaTypes.integer,\n ast.schemaTypes.bigint,\n ast.schemaTypes.boolean,\n])\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 = new WeakMap<object, string>()\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 const cached = keys.get(value)\n if (cached) return cached\n\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.nodeKinds.schema && node.type === ast.schemaTypes.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 const result = hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n keys.set(value, result)\n return result\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 * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set<string>(members.filter((member) => SCALAR_PRIMITIVE_TYPES.has(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = ast.narrowSchema(member, ast.schemaTypes.enum)\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if (\n (primitive === ast.schemaTypes.integer || primitive === ast.schemaTypes.number) &&\n (scalarPrimitives.has(ast.schemaTypes.integer) || scalarPrimitives.has(ast.schemaTypes.number))\n )\n return false\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one, and members a broader scalar primitive already\n * covers, such as a multi-value string enum sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = ast.defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = ast.narrowSchema(node, ast.schemaTypes.union)\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(dedupeMembers(unionNode.members))\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\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.narrowSchema(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.narrowSchema(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","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Returns `true` when a schema, or anything nested inside it, references a circular schema.\n *\n * Pass `excludeName` to skip refs to a specific schema, which helps when self-references are handled\n * on their own. Pair it with `ast.findCircularSchemas()` to decide where lazy wrappers go.\n *\n * @note Reads the memoized `ast.collectSchemaRefs()` set, so a schema is scanned once across plugins.\n */\nexport function containsCircularRef(\n node: SchemaNode | undefined,\n { circularSchemas, excludeName }: { circularSchemas: ReadonlySet<string>; excludeName?: string },\n): boolean {\n if (!node || circularSchemas.size === 0) return false\n\n for (const name of ast.collectSchemaRefs(node)) {\n if (name !== excludeName && circularSchemas.has(name)) return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,SAAS,mBAAmB,KAAqB;CAI/C,IAAI,kBAAkB,KAAK,GAAG,GAC5B,OAAO;CAGT,MAAM,qBAAqB,aAAa,KAAK,GAAG;CAGhD,OAFc,IAAI,MAAM,eAAe,CAAC,CAAC,OAAO,OAErC,CAAC,CACT,KAAK,MAAM,MAAM;EAEhB,OADmB,CAAC,sBAAsB,IAAI,IAC1B,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;CAChH,CAAC,CAAC,CACD,KAAK,EAAE;AACZ;;;;;AAMA,SAAS,gBAAgB,MAAsB;CAC7C,OAAO,6BAA6B,KAAK,IAAI,IAAI,IAAI,SAAS,IAAI,KAAK,UAAU,IAAI,EAAE;AACzF;;;;AAKA,IAAa,MAAb,MAAiB;;;;;;;;;;;;;;;;;CAiBf,OAAO,OAAO,MAAsB;EAClC,MAAM,uBAAO,IAAI,IAAoB;EAErC,OAAO,KAAK,QAAQ,iBAAiB,QAAQ,UAAkB;GAC7D,MAAM,OAAO,mBAAmB,KAAK;GACrC,MAAM,SAAS,KAAK,IAAI,IAAI,KAAK,KAAK;GACtC,KAAK,IAAI,MAAM,KAAK;GAEpB,OAAO,UAAU,IAAI,IAAI,SAAS,IAAI,OAAO;EAC/C,CAAC;CACH;;;;;;;;;;;;;;CAeA,OAAO,wBAAw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AAQ,QAAQ;EACtD,IAAI,gBAAgB,CAAC,aAAa,QAAQ,QAAQ,KAAA,GAAW;GAC3D,MAAM,YAAYA,UAAAA,IAAI,aAAa,KAAK,QAAQ;GAChD,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;;;;;;;;;;ACtBA,SAAgB,oBACd,MACA,EAAE,iBAAiB,eACV;CACT,IAAI,CAAC,QAAQ,gBAAgB,SAAS,GAAG,OAAO;CAEhD,KAAK,MAAM,QAAQC,UAAAA,IAAI,kBAAkB,IAAI,GAC3C,IAAI,SAAS,eAAe,gBAAgB,IAAI,IAAI,GAAG,OAAO;CAGhE,OAAO;AACT"}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { SchemaNode, ast, ast as ast$1 } from "@kubb/ast";
2
- import { Adapter, AdapterDefinition, AdapterFactory, AdapterFactoryOptions, AdapterSource, BannerMeta, Config, Diagnostic, Diagnostics, Exclude, ExtensionDependencies, ExtensionDependency, ExtensionDependencyRecord, ExtensionFactory, ExtensionKind, ExtensionManifest, ExtensionManifestOption, ExtensionMeta, Generator as Generator$1, GeneratorContext, Group, Hookable, Include, KubbHooks, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, NodeCache, NormalizedPlugin, Output, OutputOptions, Override, Parser, ParserDefinition, ParserFactory, Plugin, PluginDefinition, PluginFactory, PluginType, Renderer, RendererFactory, ResolveFileOptions, ResolveImportsOptions, ResolveNameOptions, ResolvePathOptions, Resolver, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, Storage, addGenerator, addMacro, assertPluginOption, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memoryStorage, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
3
- //#region src/Url.d.ts
2
+ import { Adapter, AdapterDefinition, AdapterFactory, AdapterFactoryOptions, AdapterSource, BannerMeta, Config, Diagnostic, Diagnostics, Exclude, ExtensionDependencies, ExtensionDependency, ExtensionDependencyRecord, ExtensionFactory, ExtensionKind, ExtensionManifest, ExtensionManifestOption, ExtensionMeta, Generator as Generator$1, GeneratorContext, Group, Hookable, Include, KubbHooks, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, Memo, NodeCache, NormalizedPlugin, Output, OutputOptions, Override, Parser, ParserDefinition, ParserFactory, Plugin, PluginDefinition, PluginFactory, PluginType, Renderer, RendererFactory, ResolveFileOptions, ResolveImportsOptions, ResolveNameOptions, ResolvePathOptions, Resolver, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, Storage, addGenerator, addMacro, assertPluginOption, camelCase, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
4
3
  /**
5
4
  * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
6
5
  */
@@ -39,8 +38,6 @@ export declare class Url {
39
38
  prefix?: string | null;
40
39
  }): string;
41
40
  }
42
- //#endregion
43
- //#region src/macros/macroDiscriminatorEnum.d.ts
44
41
  type Props$2 = {
45
42
  propertyName: string;
46
43
  values: Array<string | number | boolean>;
@@ -62,8 +59,6 @@ export declare function enumPrimitive(values: Props$2['values']): 'string' | 'nu
62
59
  * ```
63
60
  */
64
61
  export declare function macroDiscriminatorEnum({ propertyName, values, enumName }: Props$2): ast$1.Macro;
65
- //#endregion
66
- //#region src/macros/macroEnumName.d.ts
67
62
  type Props$1 = {
68
63
  parentName: string | null | undefined;
69
64
  propName: string;
@@ -80,8 +75,6 @@ type Props$1 = {
80
75
  * ```
81
76
  */
82
77
  export declare function macroEnumName({ parentName, propName, enumSuffix }: Props$1): ast$1.Macro;
83
- //#endregion
84
- //#region src/macros/macroRenameSchema.d.ts
85
78
  type Props = {
86
79
  from: string;
87
80
  to: string;
@@ -95,8 +88,6 @@ type Props = {
95
88
  * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })`
96
89
  */
97
90
  export declare function macroRenameSchema({ from, to }: Props): ast$1.Macro;
98
- //#endregion
99
- //#region src/macros/macroSimplifyUnion.d.ts
100
91
  /**
101
92
  * Removes union members that repeat an earlier one, and members a broader scalar primitive already
102
93
  * covers, such as a multi-value string enum sitting next to a plain `string`. Single-value enums are kept.
@@ -107,8 +98,6 @@ export declare function macroRenameSchema({ from, to }: Props): ast$1.Macro;
107
98
  * ```
108
99
  */
109
100
  export declare const macroSimplifyUnion: ast$1.Macro;
110
- //#endregion
111
- //#region src/utils/mergeAdjacentSchemas.d.ts
112
101
  /**
113
102
  * Merges a run of adjacent anonymous object members into one. Named or non-object members break the
114
103
  * run and pass through unchanged. The merge follows member order, so callers control which members
@@ -120,8 +109,6 @@ export declare const macroSimplifyUnion: ast$1.Macro;
120
109
  * ```
121
110
  */
122
111
  export declare function mergeAdjacentObjectsLazy(members: Iterable<SchemaNode>): Generator<SchemaNode, void, undefined>;
123
- //#endregion
124
- //#region src/utils/refs.d.ts
125
112
  /** Returns the last path segment of a reference string, for example `'Pet'` for `#/components/schemas/Pet`. */
126
113
  export declare const extractRefName: typeof ast$1.refName;
127
114
  /**
@@ -161,8 +148,6 @@ export declare function syncSchemaRef(node: SchemaNode): SchemaNode;
161
148
  * types, returns `true` only when `representation` is `'string'` rather than `'date'`.
162
149
  */
163
150
  export declare function isStringType(node: SchemaNode): boolean;
164
- //#endregion
165
- //#region src/utils/schemaGraph.d.ts
166
151
  /**
167
152
  * Returns `true` when a schema, or anything nested inside it, references a circular schema.
168
153
  *
@@ -175,6 +160,5 @@ export declare function containsCircularRef(node: SchemaNode | undefined, { circ
175
160
  circularSchemas: ReadonlySet<string>;
176
161
  excludeName?: string;
177
162
  }): boolean;
178
- //#endregion
179
- export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type Config, type Diagnostic, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type Generator$1 as Generator, type GeneratorContext, type Group, Hookable, type Include, type KubbHooks, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type NodeCache, type NormalizedPlugin, type Output, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type Plugin, type PluginDefinition, type PluginFactory, type PluginType, type Renderer, type RendererFactory, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolvePathOptions, Resolver, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type Storage, addGenerator, addMacro, assertPluginOption, ast, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memoryStorage, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
163
+ export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type Config, type Diagnostic, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type Generator$1 as Generator, type GeneratorContext, type Group, Hookable, type Include, type KubbHooks, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type Memo, type NodeCache, type NormalizedPlugin, type Output, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type Plugin, type PluginDefinition, type PluginFactory, type PluginType, type Renderer, type RendererFactory, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolvePathOptions, Resolver, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type Storage, addGenerator, addMacro, assertPluginOption, ast, camelCase, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
180
164
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { SchemaNode, ast, ast as ast$1 } from "@kubb/ast";
2
- import { Adapter, AdapterDefinition, AdapterFactory, AdapterFactoryOptions, AdapterSource, BannerMeta, Config, Diagnostic, Diagnostics, Exclude, ExtensionDependencies, ExtensionDependency, ExtensionDependencyRecord, ExtensionFactory, ExtensionKind, ExtensionManifest, ExtensionManifestOption, ExtensionMeta, Generator as Generator$1, GeneratorContext, Group, Hookable, Include, KubbHooks, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, NodeCache, NormalizedPlugin, Output, OutputOptions, Override, Parser, ParserDefinition, ParserFactory, Plugin, PluginDefinition, PluginFactory, PluginType, Renderer, RendererFactory, ResolveFileOptions, ResolveImportsOptions, ResolveNameOptions, ResolvePathOptions, Resolver, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, Storage, addGenerator, addMacro, assertPluginOption, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memoryStorage, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
3
- //#region src/Url.d.ts
2
+ import { Adapter, AdapterDefinition, AdapterFactory, AdapterFactoryOptions, AdapterSource, BannerMeta, Config, Diagnostic, Diagnostics, Exclude, ExtensionDependencies, ExtensionDependency, ExtensionDependencyRecord, ExtensionFactory, ExtensionKind, ExtensionManifest, ExtensionManifestOption, ExtensionMeta, Generator as Generator$1, GeneratorContext, Group, Hookable, Include, KubbHooks, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, Memo, NodeCache, NormalizedPlugin, Output, OutputOptions, Override, Parser, ParserDefinition, ParserFactory, Plugin, PluginDefinition, PluginFactory, PluginType, Renderer, RendererFactory, ResolveFileOptions, ResolveImportsOptions, ResolveNameOptions, ResolvePathOptions, Resolver, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, Storage, addGenerator, addMacro, assertPluginOption, camelCase, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
4
3
  /**
5
4
  * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
6
5
  */
@@ -39,8 +38,6 @@ export declare class Url {
39
38
  prefix?: string | null;
40
39
  }): string;
41
40
  }
42
- //#endregion
43
- //#region src/macros/macroDiscriminatorEnum.d.ts
44
41
  type Props$2 = {
45
42
  propertyName: string;
46
43
  values: Array<string | number | boolean>;
@@ -62,8 +59,6 @@ export declare function enumPrimitive(values: Props$2['values']): 'string' | 'nu
62
59
  * ```
63
60
  */
64
61
  export declare function macroDiscriminatorEnum({ propertyName, values, enumName }: Props$2): ast$1.Macro;
65
- //#endregion
66
- //#region src/macros/macroEnumName.d.ts
67
62
  type Props$1 = {
68
63
  parentName: string | null | undefined;
69
64
  propName: string;
@@ -80,8 +75,6 @@ type Props$1 = {
80
75
  * ```
81
76
  */
82
77
  export declare function macroEnumName({ parentName, propName, enumSuffix }: Props$1): ast$1.Macro;
83
- //#endregion
84
- //#region src/macros/macroRenameSchema.d.ts
85
78
  type Props = {
86
79
  from: string;
87
80
  to: string;
@@ -95,8 +88,6 @@ type Props = {
95
88
  * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })`
96
89
  */
97
90
  export declare function macroRenameSchema({ from, to }: Props): ast$1.Macro;
98
- //#endregion
99
- //#region src/macros/macroSimplifyUnion.d.ts
100
91
  /**
101
92
  * Removes union members that repeat an earlier one, and members a broader scalar primitive already
102
93
  * covers, such as a multi-value string enum sitting next to a plain `string`. Single-value enums are kept.
@@ -107,8 +98,6 @@ export declare function macroRenameSchema({ from, to }: Props): ast$1.Macro;
107
98
  * ```
108
99
  */
109
100
  export declare const macroSimplifyUnion: ast$1.Macro;
110
- //#endregion
111
- //#region src/utils/mergeAdjacentSchemas.d.ts
112
101
  /**
113
102
  * Merges a run of adjacent anonymous object members into one. Named or non-object members break the
114
103
  * run and pass through unchanged. The merge follows member order, so callers control which members
@@ -120,8 +109,6 @@ export declare const macroSimplifyUnion: ast$1.Macro;
120
109
  * ```
121
110
  */
122
111
  export declare function mergeAdjacentObjectsLazy(members: Iterable<SchemaNode>): Generator<SchemaNode, void, undefined>;
123
- //#endregion
124
- //#region src/utils/refs.d.ts
125
112
  /** Returns the last path segment of a reference string, for example `'Pet'` for `#/components/schemas/Pet`. */
126
113
  export declare const extractRefName: typeof ast$1.refName;
127
114
  /**
@@ -161,8 +148,6 @@ export declare function syncSchemaRef(node: SchemaNode): SchemaNode;
161
148
  * types, returns `true` only when `representation` is `'string'` rather than `'date'`.
162
149
  */
163
150
  export declare function isStringType(node: SchemaNode): boolean;
164
- //#endregion
165
- //#region src/utils/schemaGraph.d.ts
166
151
  /**
167
152
  * Returns `true` when a schema, or anything nested inside it, references a circular schema.
168
153
  *
@@ -175,6 +160,5 @@ export declare function containsCircularRef(node: SchemaNode | undefined, { circ
175
160
  circularSchemas: ReadonlySet<string>;
176
161
  excludeName?: string;
177
162
  }): boolean;
178
- //#endregion
179
- export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type Config, type Diagnostic, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type Generator$1 as Generator, type GeneratorContext, type Group, Hookable, type Include, type KubbHooks, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type NodeCache, type NormalizedPlugin, type Output, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type Plugin, type PluginDefinition, type PluginFactory, type PluginType, type Renderer, type RendererFactory, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolvePathOptions, Resolver, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type Storage, addGenerator, addMacro, assertPluginOption, ast, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memoryStorage, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
163
+ export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type Config, type Diagnostic, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type Generator$1 as Generator, type GeneratorContext, type Group, Hookable, type Include, type KubbHooks, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type Memo, type NodeCache, type NormalizedPlugin, type Output, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type Plugin, type PluginDefinition, type PluginFactory, type PluginType, type Renderer, type RendererFactory, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolvePathOptions, Resolver, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type Storage, addGenerator, addMacro, assertPluginOption, ast, camelCase, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
180
164
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  import { ast, ast as ast$1 } from "@kubb/ast";
2
2
  import { hash } from "node:crypto";
3
- import { Diagnostics, Hookable, Resolver, addGenerator, addMacro, assertPluginOption, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memoryStorage, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
4
- //#endregion
5
- //#region src/Url.ts
3
+ import { Diagnostics, Hookable, Resolver, addGenerator, addMacro, assertPluginOption, camelCase, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fsStorage, injectFile, isExtensionManifest, kubbContext, manifestProblems, memo, memoryStorage, pascalCase, requirePlugin, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions } from "@kubb/core";
4
+ // \0rolldown/runtime.js
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", {
7
+ value,
8
+ configurable: true
9
+ });
10
+ // src/Url.ts
6
11
  /**
7
12
  * Sanitizes a parameter name so it is safe to use as a `path-to-regexp` capture name, without
8
13
  * routing through {@link camelCase} (which keeps a leading `$` since it is a valid JS identifier
@@ -70,8 +75,7 @@ var Url = class {
70
75
  return `\`${prefix ?? ""}${result}\``;
71
76
  }
72
77
  };
73
- //#endregion
74
- //#region src/macros/macroDiscriminatorEnum.ts
78
+ // src/macros/macroDiscriminatorEnum.ts
75
79
  /**
76
80
  * Picks the enum primitive from the type of the first value.
77
81
  */
@@ -116,8 +120,7 @@ function macroDiscriminatorEnum({ propertyName, values, enumName }) {
116
120
  }
117
121
  });
118
122
  }
119
- //#endregion
120
- //#region ../../internals/utils/src/casing.ts
123
+ // ../../internals/utils/src/casing.ts
121
124
  /**
122
125
  * Shared implementation for camelCase and PascalCase conversion.
123
126
  * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
@@ -132,7 +135,7 @@ function convert(text, pascal) {
132
135
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
133
136
  }
134
137
  const cache = /* @__PURE__ */ new Map();
135
- const cacheLimit = 1e4;
138
+ const cacheLimit = 1e5;
136
139
  function toCamelOrPascal(text, pascal) {
137
140
  const key = `${pascal ? "P" : "c"}${text}`;
138
141
  const cached = cache.get(key);
@@ -151,11 +154,11 @@ function toCamelOrPascal(text, pascal) {
151
154
  * @example With a suffix
152
155
  * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`
153
156
  */
154
- function pascalCase(text, { prefix = "", suffix = "" } = {}) {
157
+ function pascalCase$1(text, { prefix = "", suffix = "" } = {}) {
155
158
  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
156
159
  }
157
- //#endregion
158
- //#region src/utils/refs.ts
160
+ __name(pascalCase$1, "pascalCase");
161
+ // src/utils/refs.ts
159
162
  const plainStringTypes = /* @__PURE__ */ new Set([
160
163
  "string",
161
164
  "uuid",
@@ -176,7 +179,7 @@ const extractRefName = ast$1.refName;
176
179
  * `childName(undefined, 'params') // null`
177
180
  */
178
181
  function childName(parentName, propName) {
179
- return parentName ? pascalCase([parentName, propName].join(" ")) : null;
182
+ return parentName ? pascalCase$1([parentName, propName].join(" ")) : null;
180
183
  }
181
184
  /**
182
185
  * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any
@@ -186,7 +189,7 @@ function childName(parentName, propName) {
186
189
  * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`
187
190
  */
188
191
  function enumPropName(parentName, propName, enumSuffix) {
189
- return pascalCase([
192
+ return pascalCase$1([
190
193
  parentName,
191
194
  propName,
192
195
  enumSuffix
@@ -219,8 +222,7 @@ function isStringType(node) {
219
222
  if (temporal) return temporal.representation !== "date";
220
223
  return false;
221
224
  }
222
- //#endregion
223
- //#region src/macros/macroEnumName.ts
225
+ // src/macros/macroEnumName.ts
224
226
  /**
225
227
  * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums
226
228
  * are left anonymous. Non-enum nodes are returned unchanged.
@@ -247,8 +249,7 @@ function macroEnumName({ parentName, propName, enumSuffix }) {
247
249
  }
248
250
  });
249
251
  }
250
- //#endregion
251
- //#region src/macros/macroRenameSchema.ts
252
+ // src/macros/macroRenameSchema.ts
252
253
  /**
253
254
  * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref
254
255
  * pointing at it (`targetName`) change together, so imports and printed references stay in
@@ -277,8 +278,7 @@ function macroRenameSchema({ from, to }) {
277
278
  }
278
279
  });
279
280
  }
280
- //#endregion
281
- //#region src/macros/macroSimplifyUnion.ts
281
+ // src/macros/macroSimplifyUnion.ts
282
282
  const SCALAR_PRIMITIVE_TYPES = /* @__PURE__ */ new Set([
283
283
  ast$1.schemaTypes.string,
284
284
  ast$1.schemaTypes.number,
@@ -298,7 +298,9 @@ function dedupeMembers(members) {
298
298
  if (value instanceof Date) return key(value.toJSON());
299
299
  const cached = keys.get(value);
300
300
  if (cached) return cached;
301
- const entries = Array.isArray(value) ? value.map(key) : Object.entries(value).filter(([name, child]) => name !== "pointer" && child !== void 0).map(([name, child]) => [name, key(child)]);
301
+ const node = value;
302
+ const skipsSchema = node.kind === ast$1.nodeKinds.schema && node.type === ast$1.schemaTypes.ref && typeof node.ref === "string";
303
+ const entries = Array.isArray(value) ? value.map(key) : Object.entries(value).filter(([name, child]) => name !== "pointer" && child !== void 0 && !(skipsSchema && name === "schema")).map(([name, child]) => [name, key(child)]);
302
304
  const result = hash("sha256", JSON.stringify([Array.isArray(value), entries]));
303
305
  keys.set(value, result);
304
306
  return result;
@@ -349,8 +351,7 @@ const macroSimplifyUnion = ast$1.defineMacro({
349
351
  };
350
352
  }
351
353
  });
352
- //#endregion
353
- //#region src/utils/mergeAdjacentSchemas.ts
354
+ // src/utils/mergeAdjacentSchemas.ts
354
355
  /**
355
356
  * Merges a run of adjacent anonymous object members into one. Named or non-object members break the
356
357
  * run and pass through unchanged. The merge follows member order, so callers control which members
@@ -380,8 +381,7 @@ function* mergeAdjacentObjectsLazy(members) {
380
381
  }
381
382
  if (acc !== void 0) yield acc;
382
383
  }
383
- //#endregion
384
- //#region src/utils/schemaGraph.ts
384
+ // src/utils/schemaGraph.ts
385
385
  /**
386
386
  * Returns `true` when a schema, or anything nested inside it, references a circular schema.
387
387
  *
@@ -395,7 +395,6 @@ function containsCircularRef(node, { circularSchemas, excludeName }) {
395
395
  for (const name of ast$1.collectSchemaRefs(node)) if (name !== excludeName && circularSchemas.has(name)) return true;
396
396
  return false;
397
397
  }
398
- //#endregion
399
- export { Diagnostics, Hookable, Resolver, Url, addGenerator, addMacro, assertPluginOption, ast, childName, containsCircularRef, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, enumPrimitive, enumPropName, extractRefName, fsStorage, injectFile, isExtensionManifest, isStringType, kubbContext, macroDiscriminatorEnum, macroEnumName, macroRenameSchema, macroSimplifyUnion, manifestProblems, memoryStorage, mergeAdjacentObjectsLazy, requirePlugin, setMacros, setOptions, setResolver, syncSchemaRef, tryUseKubb, useConfig, useKubb, useOptions };
398
+ export { Diagnostics, Hookable, Resolver, Url, addGenerator, addMacro, assertPluginOption, ast, camelCase, childName, containsCircularRef, createAdapter, createRenderer, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, enumPrimitive, enumPropName, extractRefName, fsStorage, injectFile, isExtensionManifest, isStringType, kubbContext, macroDiscriminatorEnum, macroEnumName, macroRenameSchema, macroSimplifyUnion, manifestProblems, memo, memoryStorage, mergeAdjacentObjectsLazy, pascalCase, requirePlugin, setMacros, setOptions, setResolver, syncSchemaRef, tryUseKubb, useConfig, useKubb, useOptions };
400
399
 
401
400
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ast","ast","ast","ast","ast","ast","ast"],"sources":["../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../../../internals/utils/src/casing.ts","../src/utils/refs.ts","../src/macros/macroEnumName.ts","../src/macros/macroRenameSchema.ts","../src/macros/macroSimplifyUnion.ts","../src/utils/mergeAdjacentSchemas.ts","../src/utils/schemaGraph.ts"],"sourcesContent":["/**\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 * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\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'\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 ast.defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.narrowSchema(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","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\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 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 .replace(/(\\d)([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// Plugins resolve the same names over and over (about 47,000 calls for a 1,000 schema spec), so\n// results are kept. Clearing at the limit bounds the memory a long-running process spends on it.\nconst cache = new Map<string, string>()\nconst cacheLimit = 10_000\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n\n const result = convert(text, pascal)\n if (cache.size >= cacheLimit) cache.clear()\n cache.set(key, result)\n return result\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","import { ast } from '@kubb/ast'\nimport type { SchemaNode, SchemaType } from '@kubb/ast'\nimport { pascalCase } from '@internals/utils'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/** Returns the last path segment of a reference string, for example `'Pet'` for `#/components/schemas/Pet`. */\nexport const extractRefName = ast.refName\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\n/**\n * Applies `ast.mergeRefWithSchema()` to a resolved ref and rebuilds the result through\n * `ast.factory.createSchema()`. Non-ref nodes and unresolved refs are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = ast.factory.createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = ast.narrowSchema(node, 'ref')\n\n if (!ref?.schema) return node\n\n return ast.factory.createSchema(ast.mergeRefWithSchema(ref))\n}\n\n/**\n * Returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = ast.narrowSchema(node, 'date') ?? ast.narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n","import { ast } from '@kubb/ast'\nimport { enumPropName } from '../utils/refs.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 ast.defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.narrowSchema(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'\n\ntype Props = {\n from: string\n to: string\n}\n\n/**\n * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref\n * pointing at it (`targetName`) change together, so imports and printed references stay in\n * sync. Renaming only one side by hand produces imports for files that are never generated.\n *\n * @example\n * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })`\n */\nexport function macroRenameSchema({ from, to }: Props) {\n return ast.defineMacro({\n name: 'rename-schema',\n schema(node) {\n const refNode = ast.narrowSchema(node, 'ref')\n\n if (!refNode) {\n return node.name === from ? { ...node, name: to } : undefined\n }\n\n const renamesDeclaration = refNode.name === from\n const renamesTarget = ast.resolveRefName(refNode) === from\n if (!renamesDeclaration && !renamesTarget) return undefined\n\n return {\n ...refNode,\n ...(renamesDeclaration ? { name: to } : {}),\n ...(renamesTarget ? { targetName: to } : {}),\n }\n },\n })\n}\n","import { hash } from 'node:crypto'\nimport { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\nconst SCALAR_PRIMITIVE_TYPES = new Set<string>([\n ast.schemaTypes.string,\n ast.schemaTypes.number,\n ast.schemaTypes.integer,\n ast.schemaTypes.bigint,\n ast.schemaTypes.boolean,\n])\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 = new WeakMap<object, string>()\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 const cached = keys.get(value)\n if (cached) return cached\n\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)\n .map(([name, child]) => [name, key(child)])\n const result = hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n keys.set(value, result)\n return result\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 * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set<string>(members.filter((member) => SCALAR_PRIMITIVE_TYPES.has(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = ast.narrowSchema(member, ast.schemaTypes.enum)\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if (\n (primitive === ast.schemaTypes.integer || primitive === ast.schemaTypes.number) &&\n (scalarPrimitives.has(ast.schemaTypes.integer) || scalarPrimitives.has(ast.schemaTypes.number))\n )\n return false\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one, and members a broader scalar primitive already\n * covers, such as a multi-value string enum sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = ast.defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = ast.narrowSchema(node, ast.schemaTypes.union)\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(dedupeMembers(unionNode.members))\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\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.narrowSchema(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.narrowSchema(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","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Returns `true` when a schema, or anything nested inside it, references a circular schema.\n *\n * Pass `excludeName` to skip refs to a specific schema, which helps when self-references are handled\n * on their own. Pair it with `ast.findCircularSchemas()` to decide where lazy wrappers go.\n *\n * @note Reads the memoized `ast.collectSchemaRefs()` set, so a schema is scanned once across plugins.\n */\nexport function containsCircularRef(\n node: SchemaNode | undefined,\n { circularSchemas, excludeName }: { circularSchemas: ReadonlySet<string>; excludeName?: string },\n): boolean {\n if (!node || circularSchemas.size === 0) return false\n\n for (const name of ast.collectSchemaRefs(node)) {\n if (name !== excludeName && circularSchemas.has(name)) return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAS,mBAAmB,KAAqB;CAI/C,IAAI,kBAAkB,KAAK,GAAG,GAC5B,OAAO;CAGT,MAAM,qBAAqB,aAAa,KAAK,GAAG;CAGhD,OAFc,IAAI,MAAM,eAAe,CAAC,CAAC,OAAO,OAErC,CAAC,CACT,KAAK,MAAM,MAAM;EAEhB,OADmB,CAAC,sBAAsB,IAAI,IAC1B,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,IAAI,KAAK,OA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;EAE3D,OAAO;GAAE,GAAG;GAAW,SAAS;EAAW;CAC7C;AACF,CAAC;;;;;;;;;;;;;ACjFD,UAAiB,yBAAyB,SAAuE;CAC/G,IAAI;CAEJ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,eAAeC,MAAI,aAAa,QAAQ,QAAQ;EACtD,IAAI,gBAAgB,CAAC,aAAa,QAAQ,QAAQ,KAAA,GAAW;GAC3D,MAAM,YAAYA,MAAI,aAAa,KAAK,QAAQ;GAChD,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;;;;;;;;;;;ACtBA,SAAgB,oBACd,MACA,EAAE,iBAAiB,eACV;CACT,IAAI,CAAC,QAAQ,gBAAgB,SAAS,GAAG,OAAO;CAEhD,KAAK,MAAM,QAAQC,MAAI,kBAAkB,IAAI,GAC3C,IAAI,SAAS,eAAe,gBAAgB,IAAI,IAAI,GAAG,OAAO;CAGhE,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":["ast","pascalCase","ast","pascalCase","ast","ast","ast","ast","ast"],"sources":["../src/Url.ts","../src/macros/macroDiscriminatorEnum.ts","../../../internals/utils/src/casing.ts","../src/utils/refs.ts","../src/macros/macroEnumName.ts","../src/macros/macroRenameSchema.ts","../src/macros/macroSimplifyUnion.ts","../src/utils/mergeAdjacentSchemas.ts","../src/utils/schemaGraph.ts"],"sourcesContent":["/**\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 * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\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'\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 ast.defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = ast.narrowSchema(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","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\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 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 .replace(/(\\d)([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// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = new Map<string, string>()\nconst cacheLimit = 100_000\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n\n const result = convert(text, pascal)\n if (cache.size >= cacheLimit) cache.clear()\n cache.set(key, result)\n return result\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","import { ast } from '@kubb/ast'\nimport type { SchemaNode, SchemaType } from '@kubb/ast'\nimport { pascalCase } from '@internals/utils'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/** Returns the last path segment of a reference string, for example `'Pet'` for `#/components/schemas/Pet`. */\nexport const extractRefName = ast.refName\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\n/**\n * Applies `ast.mergeRefWithSchema()` to a resolved ref and rebuilds the result through\n * `ast.factory.createSchema()`. Non-ref nodes and unresolved refs are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = ast.factory.createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = ast.narrowSchema(node, 'ref')\n\n if (!ref?.schema) return node\n\n return ast.factory.createSchema(ast.mergeRefWithSchema(ref))\n}\n\n/**\n * Returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = ast.narrowSchema(node, 'date') ?? ast.narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n","import { ast } from '@kubb/ast'\nimport { enumPropName } from '../utils/refs.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 ast.defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = ast.narrowSchema(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'\n\ntype Props = {\n from: string\n to: string\n}\n\n/**\n * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref\n * pointing at it (`targetName`) change together, so imports and printed references stay in\n * sync. Renaming only one side by hand produces imports for files that are never generated.\n *\n * @example\n * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })`\n */\nexport function macroRenameSchema({ from, to }: Props) {\n return ast.defineMacro({\n name: 'rename-schema',\n schema(node) {\n const refNode = ast.narrowSchema(node, 'ref')\n\n if (!refNode) {\n return node.name === from ? { ...node, name: to } : undefined\n }\n\n const renamesDeclaration = refNode.name === from\n const renamesTarget = ast.resolveRefName(refNode) === from\n if (!renamesDeclaration && !renamesTarget) return undefined\n\n return {\n ...refNode,\n ...(renamesDeclaration ? { name: to } : {}),\n ...(renamesTarget ? { targetName: to } : {}),\n }\n },\n })\n}\n","import { hash } from 'node:crypto'\nimport { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\nconst SCALAR_PRIMITIVE_TYPES = new Set<string>([\n ast.schemaTypes.string,\n ast.schemaTypes.number,\n ast.schemaTypes.integer,\n ast.schemaTypes.bigint,\n ast.schemaTypes.boolean,\n])\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 = new WeakMap<object, string>()\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 const cached = keys.get(value)\n if (cached) return cached\n\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.nodeKinds.schema && node.type === ast.schemaTypes.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 const result = hash('sha256', JSON.stringify([Array.isArray(value), entries]))\n keys.set(value, result)\n return result\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 * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set<string>(members.filter((member) => SCALAR_PRIMITIVE_TYPES.has(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = ast.narrowSchema(member, ast.schemaTypes.enum)\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if (\n (primitive === ast.schemaTypes.integer || primitive === ast.schemaTypes.number) &&\n (scalarPrimitives.has(ast.schemaTypes.integer) || scalarPrimitives.has(ast.schemaTypes.number))\n )\n return false\n\n return true\n })\n}\n\n/**\n * Removes union members that repeat an earlier one, and members a broader scalar primitive already\n * covers, such as a multi-value string enum sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = ast.defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = ast.narrowSchema(node, ast.schemaTypes.union)\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(dedupeMembers(unionNode.members))\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\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.narrowSchema(member, 'object')\n if (objectMember && !objectMember.name && acc !== undefined) {\n const accObject = ast.narrowSchema(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","import { ast } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast'\n\n/**\n * Returns `true` when a schema, or anything nested inside it, references a circular schema.\n *\n * Pass `excludeName` to skip refs to a specific schema, which helps when self-references are handled\n * on their own. Pair it with `ast.findCircularSchemas()` to decide where lazy wrappers go.\n *\n * @note Reads the memoized `ast.collectSchemaRefs()` set, so a schema is scanned once across plugins.\n */\nexport function containsCircularRef(\n node: SchemaNode | undefined,\n { circularSchemas, excludeName }: { circularSchemas: ReadonlySet<string>; excludeName?: string },\n): boolean {\n if (!node || circularSchemas.size === 0) return false\n\n for (const name of ast.collectSchemaRefs(node)) {\n if (name !== excludeName && circularSchemas.has(name)) return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAMA,SAAS,mBAAmB,KAAqB;CAI/C,IAAI,kBAAkB,KAAK,GAAG,GAC5B,OAAO;CAGT,MAAM,qBAAqB,aAAa,KAAK,GAAG;CAGhD,OAFc,IAAI,MAAM,eAAe,CAAC,CAAC,OAAO,OAErC,CAAC,CACT,KAAK,MAAM,MAAM;EAEhB,OADmB,CAAC,sBAAsB,IAAI,IAC1B,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;CAChH,CAAC,CAAC,CACD,KAAK,EAAE;AACZ;;;;;AAMA,SAAS,gBAAgB,MAAsB;CAC7C,OAAO,6BAA6B,KAAK,IAAI,IAAI,IAAI,SAAS,IAAI,KAAK,UAAU,IAAI,EAAE;AACzF;;;;AAKA,IAAa,MAAb,MAAiB;;;;;;;;;;;;;;;;;CAiBf,OAAO,OAAO,MAAsB;EAClC,MAAM,uBAAO,IAAI,IAAoB;EAErC,OAAO,KAAK,QAAQ,iBAAiB,QAAQ,UAAkB;GAC7D,MAAM,OAAO,mBAAmB,KAAK;GACrC,MAAM,S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MAAI,aAAa,KAAK,QAAQ;GAChD,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;;;;;;;;;;ACtBA,SAAgB,oBACd,MACA,EAAE,iBAAiB,eACV;CACT,IAAI,CAAC,QAAQ,gBAAgB,SAAS,GAAG,OAAO;CAEhD,KAAK,MAAM,QAAQC,MAAI,kBAAkB,IAAI,GAC3C,IAAI,SAAS,eAAe,gBAAgB,IAAI,IAAI,GAAG,OAAO;CAGhE,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/kit",
3
- "version": "5.14.5",
3
+ "version": "5.15.0",
4
4
  "description": "Authoring toolkit for Kubb plugins, generators, adapters, resolvers, and renderers.",
5
5
  "keywords": [
6
6
  "codegen",
@@ -74,8 +74,8 @@
74
74
  "registry": "https://registry.npmjs.org/"
75
75
  },
76
76
  "dependencies": {
77
- "@kubb/ast": "5.14.5",
78
- "@kubb/core": "5.14.5"
77
+ "@kubb/ast": "5.15.0",
78
+ "@kubb/core": "5.15.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@internals/utils": "0.0.1"