@kubb/ast
Advanced tools
Sorry, the diff of this file is too big to display
+42
-7
@@ -1413,4 +1413,5 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
| /** | ||
| * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls | ||
| * back to `name` then nested `schema.name`. | ||
| * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when | ||
| * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`, | ||
| * then `name`, then the nested `schema.name`. | ||
| * | ||
@@ -1421,5 +1422,9 @@ * Returns `null` for non-ref nodes or when no name resolves. | ||
| * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'` | ||
| * | ||
| * @example Collision-renamed target | ||
| * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'` | ||
| */ | ||
| function resolveRefName(node) { | ||
| if (!node || node.type !== "ref") return null; | ||
| if (node.targetName) return node.targetName; | ||
| if (node.ref) return extractRefName(node.ref); | ||
@@ -1532,6 +1537,2 @@ return node.name ?? node.schema?.name ?? null; | ||
| } | ||
| /** | ||
| * Memoized two-level cache keyed first on the operations array, then on the schemas array. | ||
| */ | ||
| const collectUsedSchemaNamesMemo = memoize(/* @__PURE__ */ new WeakMap(), (ops) => memoize(/* @__PURE__ */ new WeakMap(), (schemas) => computeUsedSchemaNames(ops, schemas))); | ||
| function computeUsedSchemaNames(operations, schemas) { | ||
@@ -1576,3 +1577,3 @@ const schemaMap = /* @__PURE__ */ new Map(); | ||
| function collectUsedSchemaNames(operations, schemas) { | ||
| return collectUsedSchemaNamesMemo(operations)(schemas); | ||
| return computeUsedSchemaNames(operations, schemas); | ||
| } | ||
@@ -1741,2 +1742,32 @@ const EMPTY_CIRCULAR_SET = /* @__PURE__ */ new Set(); | ||
| //#endregion | ||
| //#region src/macros/macroRenameSchema.ts | ||
| /** | ||
| * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref | ||
| * pointing at it (`targetName`) change together, so imports and printed references stay in | ||
| * sync. Renaming only one side by hand produces imports for files that are never generated. | ||
| * | ||
| * @example | ||
| * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })` | ||
| */ | ||
| function macroRenameSchema({ from, to }) { | ||
| return defineMacro({ | ||
| name: "rename-schema", | ||
| schema(node) { | ||
| const refNode = narrowSchema(node, "ref"); | ||
| if (!refNode) return node.name === from ? { | ||
| ...node, | ||
| name: to | ||
| } : void 0; | ||
| const renamesDeclaration = refNode.name === from; | ||
| const renamesTarget = resolveRefName(refNode) === from; | ||
| if (!renamesDeclaration && !renamesTarget) return void 0; | ||
| return { | ||
| ...refNode, | ||
| ...renamesDeclaration ? { name: to } : {}, | ||
| ...renamesTarget ? { targetName: to } : {} | ||
| }; | ||
| } | ||
| }); | ||
| } | ||
| //#endregion | ||
| //#region src/macros/macroSimplifyUnion.ts | ||
@@ -1877,2 +1908,3 @@ /** | ||
| macroEnumName: () => macroEnumName, | ||
| macroRenameSchema: () => macroRenameSchema, | ||
| macroSimplifyUnion: () => macroSimplifyUnion, | ||
@@ -1891,2 +1923,3 @@ mapSchemaItems: () => mapSchemaItems, | ||
| requestBodyDef: () => requestBodyDef, | ||
| resolveRefName: () => resolveRefName, | ||
| responseDef: () => responseDef, | ||
@@ -1944,2 +1977,3 @@ schemaDef: () => schemaDef, | ||
| exports.macroEnumName = macroEnumName; | ||
| exports.macroRenameSchema = macroRenameSchema; | ||
| exports.macroSimplifyUnion = macroSimplifyUnion; | ||
@@ -1958,2 +1992,3 @@ exports.mapSchemaItems = mapSchemaItems; | ||
| exports.requestBodyDef = requestBodyDef; | ||
| exports.resolveRefName = resolveRefName; | ||
| exports.responseDef = responseDef; | ||
@@ -1960,0 +1995,0 @@ exports.schemaDef = schemaDef; |
+37
-20
| import { n as __name, t as __exportAll } from "./rolldown-runtime-CNktS9qV.js"; | ||
| import { $ as sourceDef, $t as NodeDef, A as StatusCode, At as BreakNode, B as parameterDef, Bt as constDef, C as GenericOperationNode, Ct as PropertyNode, D as createOperation, Dt as InferSchemaNode, E as OperationNode, Et as propertyDef, F as requestBodyDef, Ft as JsxNode, G as UserFileNode, Gt as createJsx, H as FileNode, Ht as createBreak, I as ParameterLocation, It as TextNode, J as createImport, Jt as functionDef, K as createExport, Kt as createText, L as ParameterNode, Lt as TypeNode, M as responseDef, Mt as ConstNode, N as RequestBodyNode, Nt as FunctionNode, O as operationDef, Ot as ParserOptions, P as createRequestBody, Pt as JSDocNode, Q as importDef, Qt as DistributiveOmit, R as ParameterStyle, Rt as arrowFunctionDef, S as inputDef, St as schemaDef, T as HttpOperationNode, Tt as createProperty, U as ImportNode, Ut as createConst, V as ExportNode, Vt as createArrowFunction, W as SourceNode, Wt as createFunction, X as exportDef, Xt as textDef, Y as createSource, Yt as jsxDef, Z as fileDef, Zt as typeDef, _ as createOutput, _t as StringSchemaNode, a as Enforce, at as DatetimeSchemaNode, b as InputNode, bt as UrlSchemaNode, c as composeMacros, ct as NumberSchemaNode, d as Visitor, dt as RefSchemaNode, en as defineNode, et as ContentNode, f as VisitorContext, ft as ScalarSchemaNode, g as OutputNode, gt as SchemaType, h as Node, ht as SchemaNodeByType, i as createPrinter, it as DateSchemaNode, j as createResponse, jt as CodeNode, k as ResponseNode, kt as ArrowFunctionNode, l as defineMacro, lt as ObjectSchemaNode, m as transform, mt as SchemaNode, n as PrinterFactoryOptions, nn as NodeKind, nt as createContent, o as Macro, ot as EnumSchemaNode, p as collect, pt as ScalarSchemaType, q as createFile, qt as createType, r as PrinterPartial, rn as schemaTypes, rt as ArraySchemaNode, s as applyMacros, st as IntersectionSchemaNode, t as Printer, tn as BaseNode, tt as contentDef, u as ParentOf, ut as PrimitiveSchemaType, v as outputDef, vt as TimeSchemaNode, w as HttpMethod, wt as UserPropertyNode, x as createInput, xt as createSchema, y as InputMeta, yt as UnionSchemaNode, z as createParameter, zt as breakDef } from "./types-CsAwiskn.js"; | ||
| import { $ as sourceDef, $t as NodeDef, A as StatusCode, At as BreakNode, B as parameterDef, Bt as constDef, C as GenericOperationNode, Ct as PropertyNode, D as createOperation, Dt as InferSchemaNode, E as OperationNode, Et as propertyDef, F as requestBodyDef, Ft as JsxNode, G as UserFileNode, Gt as createJsx, H as FileNode, Ht as createBreak, I as ParameterLocation, It as TextNode, J as createImport, Jt as functionDef, K as createExport, Kt as createText, L as ParameterNode, Lt as TypeNode, M as responseDef, Mt as ConstNode, N as RequestBodyNode, Nt as FunctionNode, O as operationDef, Ot as ParserOptions, P as createRequestBody, Pt as JSDocNode, Q as importDef, Qt as DistributiveOmit, R as ParameterStyle, Rt as arrowFunctionDef, S as inputDef, St as schemaDef, T as HttpOperationNode, Tt as createProperty, U as ImportNode, Ut as createConst, V as ExportNode, Vt as createArrowFunction, W as SourceNode, Wt as createFunction, X as exportDef, Xt as textDef, Y as createSource, Yt as jsxDef, Z as fileDef, Zt as typeDef, _ as createOutput, _t as StringSchemaNode, a as Enforce, at as DatetimeSchemaNode, b as InputNode, bt as UrlSchemaNode, c as composeMacros, ct as NumberSchemaNode, d as Visitor, dt as RefSchemaNode, en as defineNode, et as ContentNode, f as VisitorContext, ft as ScalarSchemaNode, g as OutputNode, gt as SchemaType, h as Node, ht as SchemaNodeByType, i as createPrinter, it as DateSchemaNode, j as createResponse, jt as CodeNode, k as ResponseNode, kt as ArrowFunctionNode, l as defineMacro, lt as ObjectSchemaNode, m as transform, mt as SchemaNode, n as PrinterFactoryOptions, nn as NodeKind, nt as createContent, o as Macro, ot as EnumSchemaNode, p as collect, pt as ScalarSchemaType, q as createFile, qt as createType, r as PrinterPartial, rn as schemaTypes, rt as ArraySchemaNode, s as applyMacros, st as IntersectionSchemaNode, t as Printer, tn as BaseNode, tt as contentDef, u as ParentOf, ut as PrimitiveSchemaType, v as outputDef, vt as TimeSchemaNode, w as HttpMethod, wt as UserPropertyNode, x as createInput, xt as createSchema, y as InputMeta, yt as UnionSchemaNode, z as createParameter, zt as breakDef } from "./types-CqXMgUzC.js"; | ||
| //#region src/guards.d.ts | ||
@@ -87,2 +86,16 @@ /** | ||
| /** | ||
| * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when | ||
| * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`, | ||
| * then `name`, then the nested `schema.name`. | ||
| * | ||
| * Returns `null` for non-ref nodes or when no name resolves. | ||
| * | ||
| * @example | ||
| * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'` | ||
| * | ||
| * @example Collision-renamed target | ||
| * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'` | ||
| */ | ||
| declare function resolveRefName(node: SchemaNode | null | undefined): string | null; | ||
| /** | ||
| * Builds a PascalCase child schema name by joining a parent name and property name. | ||
@@ -169,6 +182,3 @@ * Returns `null` when there is no parent to nest under. | ||
| */ | ||
| declare function containsCircularRef(node: SchemaNode | undefined, { | ||
| circularSchemas, | ||
| excludeName | ||
| }: { | ||
| declare function containsCircularRef(node: SchemaNode | undefined, { circularSchemas, excludeName }: { | ||
| circularSchemas: ReadonlySet<string>; | ||
@@ -238,3 +248,3 @@ excludeName?: string; | ||
| //#region src/macros/macroDiscriminatorEnum.d.ts | ||
| type Props$1 = { | ||
| type Props$2 = { | ||
| propertyName: string; | ||
@@ -254,10 +264,6 @@ values: Array<string>; | ||
| */ | ||
| declare function macroDiscriminatorEnum({ | ||
| propertyName, | ||
| values, | ||
| enumName | ||
| }: Props$1): Macro; | ||
| declare function macroDiscriminatorEnum({ propertyName, values, enumName }: Props$2): Macro; | ||
| //#endregion | ||
| //#region src/macros/macroEnumName.d.ts | ||
| type Props = { | ||
| type Props$1 = { | ||
| parentName: string | null | undefined; | ||
@@ -277,8 +283,19 @@ propName: string; | ||
| */ | ||
| declare function macroEnumName({ | ||
| parentName, | ||
| propName, | ||
| enumSuffix | ||
| }: Props): Macro; | ||
| declare function macroEnumName({ parentName, propName, enumSuffix }: Props$1): Macro; | ||
| //#endregion | ||
| //#region src/macros/macroRenameSchema.d.ts | ||
| type Props = { | ||
| from: string; | ||
| to: string; | ||
| }; | ||
| /** | ||
| * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref | ||
| * pointing at it (`targetName`) change together, so imports and printed references stay in | ||
| * sync. Renaming only one side by hand produces imports for files that are never generated. | ||
| * | ||
| * @example | ||
| * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })` | ||
| */ | ||
| declare function macroRenameSchema({ from, to }: Props): Macro; | ||
| //#endregion | ||
| //#region src/macros/macroSimplifyUnion.d.ts | ||
@@ -390,6 +407,6 @@ /** | ||
| declare namespace exports_d_exports { | ||
| export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, applyMacros, arrowFunctionDef, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef }; | ||
| export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, applyMacros, arrowFunctionDef, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroRenameSchema, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, resolveRefName, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef }; | ||
| } | ||
| //#endregion | ||
| export { type ArraySchemaNode, type ArrowFunctionNode, type BreakNode, type CodeNode, type ConstNode, type ContentNode, type DateSchemaNode, type DatetimeSchemaNode, type DistributiveOmit, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InferSchemaNode, type InputMeta, type InputNode, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeDef, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type OutputNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PrinterPartial, type PropertyNode, type RefSchemaNode, type RequestBodyNode, type ResponseNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type UserFileNode, type Visitor, type VisitorContext, applyMacros, arrowFunctionDef, exports_d_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef }; | ||
| export { type ArraySchemaNode, type ArrowFunctionNode, type BreakNode, type CodeNode, type ConstNode, type ContentNode, type DateSchemaNode, type DatetimeSchemaNode, type DistributiveOmit, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InferSchemaNode, type InputMeta, type InputNode, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeDef, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type OutputNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PrinterPartial, type PropertyNode, type RefSchemaNode, type RequestBodyNode, type ResponseNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type UserFileNode, type Visitor, type VisitorContext, applyMacros, arrowFunctionDef, exports_d_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroRenameSchema, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, resolveRefName, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef }; | ||
| //# sourceMappingURL=index.d.ts.map |
+41
-8
@@ -1381,4 +1381,5 @@ import { t as __exportAll } from "./rolldown-runtime-CNktS9qV.js"; | ||
| /** | ||
| * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls | ||
| * back to `name` then nested `schema.name`. | ||
| * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when | ||
| * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`, | ||
| * then `name`, then the nested `schema.name`. | ||
| * | ||
@@ -1389,5 +1390,9 @@ * Returns `null` for non-ref nodes or when no name resolves. | ||
| * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'` | ||
| * | ||
| * @example Collision-renamed target | ||
| * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'` | ||
| */ | ||
| function resolveRefName(node) { | ||
| if (!node || node.type !== "ref") return null; | ||
| if (node.targetName) return node.targetName; | ||
| if (node.ref) return extractRefName(node.ref); | ||
@@ -1500,6 +1505,2 @@ return node.name ?? node.schema?.name ?? null; | ||
| } | ||
| /** | ||
| * Memoized two-level cache keyed first on the operations array, then on the schemas array. | ||
| */ | ||
| const collectUsedSchemaNamesMemo = memoize(/* @__PURE__ */ new WeakMap(), (ops) => memoize(/* @__PURE__ */ new WeakMap(), (schemas) => computeUsedSchemaNames(ops, schemas))); | ||
| function computeUsedSchemaNames(operations, schemas) { | ||
@@ -1544,3 +1545,3 @@ const schemaMap = /* @__PURE__ */ new Map(); | ||
| function collectUsedSchemaNames(operations, schemas) { | ||
| return collectUsedSchemaNamesMemo(operations)(schemas); | ||
| return computeUsedSchemaNames(operations, schemas); | ||
| } | ||
@@ -1709,2 +1710,32 @@ const EMPTY_CIRCULAR_SET = /* @__PURE__ */ new Set(); | ||
| //#endregion | ||
| //#region src/macros/macroRenameSchema.ts | ||
| /** | ||
| * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref | ||
| * pointing at it (`targetName`) change together, so imports and printed references stay in | ||
| * sync. Renaming only one side by hand produces imports for files that are never generated. | ||
| * | ||
| * @example | ||
| * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })` | ||
| */ | ||
| function macroRenameSchema({ from, to }) { | ||
| return defineMacro({ | ||
| name: "rename-schema", | ||
| schema(node) { | ||
| const refNode = narrowSchema(node, "ref"); | ||
| if (!refNode) return node.name === from ? { | ||
| ...node, | ||
| name: to | ||
| } : void 0; | ||
| const renamesDeclaration = refNode.name === from; | ||
| const renamesTarget = resolveRefName(refNode) === from; | ||
| if (!renamesDeclaration && !renamesTarget) return void 0; | ||
| return { | ||
| ...refNode, | ||
| ...renamesDeclaration ? { name: to } : {}, | ||
| ...renamesTarget ? { targetName: to } : {} | ||
| }; | ||
| } | ||
| }); | ||
| } | ||
| //#endregion | ||
| //#region src/macros/macroSimplifyUnion.ts | ||
@@ -1845,2 +1876,3 @@ /** | ||
| macroEnumName: () => macroEnumName, | ||
| macroRenameSchema: () => macroRenameSchema, | ||
| macroSimplifyUnion: () => macroSimplifyUnion, | ||
@@ -1859,2 +1891,3 @@ mapSchemaItems: () => mapSchemaItems, | ||
| requestBodyDef: () => requestBodyDef, | ||
| resolveRefName: () => resolveRefName, | ||
| responseDef: () => responseDef, | ||
@@ -1870,4 +1903,4 @@ schemaDef: () => schemaDef, | ||
| //#endregion | ||
| export { applyMacros, arrowFunctionDef, exports_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef }; | ||
| export { applyMacros, arrowFunctionDef, exports_exports as ast, breakDef, childName, collect, collectUsedSchemaNames, combineExports, combineImports, combineSources, composeMacros, constDef, containsCircularRef, contentDef, createPrinter, defineMacro, defineNode, enumPropName, exportDef, extractRefName, extractStringsFromNodes, factory_exports as factory, fileDef, findCircularSchemas, functionDef, importDef, inputDef, isHttpOperationNode, isStringType, jsxDef, macroDiscriminatorEnum, macroEnumName, macroRenameSchema, macroSimplifyUnion, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, resolveRefName, responseDef, schemaDef, schemaTypes, sourceDef, syncSchemaRef, textDef, transform, typeDef }; | ||
| //# sourceMappingURL=index.js.map |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { $t as NodeDef, A as StatusCode, At as BreakNode, C as GenericOperationNode, Ct as PropertyNode, Dt as InferSchemaNode, E as OperationNode, Ft as JsxNode, G as UserFileNode, H as FileNode, I as ParameterLocation, It as TextNode, L as ParameterNode, Lt as TypeNode, Mt as ConstNode, N as RequestBodyNode, Nt as FunctionNode, Ot as ParserOptions, Pt as JSDocNode, Qt as DistributiveOmit, R as ParameterStyle, T as HttpOperationNode, U as ImportNode, V as ExportNode, W as SourceNode, _t as StringSchemaNode, a as Enforce, at as DatetimeSchemaNode, b as InputNode, bt as UrlSchemaNode, ct as NumberSchemaNode, d as Visitor, dt as RefSchemaNode, et as ContentNode, f as VisitorContext, ft as ScalarSchemaNode, g as OutputNode, gt as SchemaType, h as Node, ht as SchemaNodeByType, it as DateSchemaNode, jt as CodeNode, k as ResponseNode, kt as ArrowFunctionNode, lt as ObjectSchemaNode, mt as SchemaNode, n as PrinterFactoryOptions, nn as NodeKind, o as Macro, ot as EnumSchemaNode, pt as ScalarSchemaType, r as PrinterPartial, rt as ArraySchemaNode, st as IntersectionSchemaNode, t as Printer, u as ParentOf, ut as PrimitiveSchemaType, vt as TimeSchemaNode, w as HttpMethod, y as InputMeta, yt as UnionSchemaNode } from "./types-CsAwiskn.js"; | ||
| import { $t as NodeDef, A as StatusCode, At as BreakNode, C as GenericOperationNode, Ct as PropertyNode, Dt as InferSchemaNode, E as OperationNode, Ft as JsxNode, G as UserFileNode, H as FileNode, I as ParameterLocation, It as TextNode, L as ParameterNode, Lt as TypeNode, Mt as ConstNode, N as RequestBodyNode, Nt as FunctionNode, Ot as ParserOptions, Pt as JSDocNode, Qt as DistributiveOmit, R as ParameterStyle, T as HttpOperationNode, U as ImportNode, V as ExportNode, W as SourceNode, _t as StringSchemaNode, a as Enforce, at as DatetimeSchemaNode, b as InputNode, bt as UrlSchemaNode, ct as NumberSchemaNode, d as Visitor, dt as RefSchemaNode, et as ContentNode, f as VisitorContext, ft as ScalarSchemaNode, g as OutputNode, gt as SchemaType, h as Node, ht as SchemaNodeByType, it as DateSchemaNode, jt as CodeNode, k as ResponseNode, kt as ArrowFunctionNode, lt as ObjectSchemaNode, mt as SchemaNode, n as PrinterFactoryOptions, nn as NodeKind, o as Macro, ot as EnumSchemaNode, pt as ScalarSchemaType, r as PrinterPartial, rt as ArraySchemaNode, st as IntersectionSchemaNode, t as Printer, u as ParentOf, ut as PrimitiveSchemaType, vt as TimeSchemaNode, w as HttpMethod, y as InputMeta, yt as UnionSchemaNode } from "./types-CqXMgUzC.js"; | ||
| export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext }; |
+2
-2
| { | ||
| "name": "@kubb/ast", | ||
| "version": "5.0.0-beta.94", | ||
| "version": "5.0.0-beta.95", | ||
| "description": "Spec-agnostic AST layer for Kubb. Defines the node tree, visitor pattern, factory functions, and type guards used across all code generation plugins.", | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "@types/node": "^22.20.0", | ||
| "@types/node": "^22.20.1", | ||
| "@internals/utils": "0.0.0" | ||
@@ -48,0 +48,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
554651
0.78%7099
1.36%