@kubb/ast 5.0.0-beta.67 → 5.0.0-beta.68
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/{defineMacro-BQpu6Ags.d.ts → defineMacro-D9ekmTW5.d.ts} +2 -2
- package/dist/{defineMacro-BxfaP1iL.cjs → defineMacro-DoMJxLWT.cjs} +2 -2
- package/dist/{defineMacro-BxfaP1iL.cjs.map → defineMacro-DoMJxLWT.cjs.map} +1 -1
- package/dist/{defineMacro-D2vgAdoH.js → defineMacro-_xJf504Y.js} +2 -2
- package/dist/{defineMacro-D2vgAdoH.js.map → defineMacro-_xJf504Y.js.map} +1 -1
- package/dist/{index-CeJAFegf.d.ts → index-q_ldM1YP.d.ts} +20 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -3
- package/dist/macros.cjs +2 -2
- package/dist/macros.d.ts +1 -1
- package/dist/macros.js +2 -2
- package/dist/{operationParams-DCY3q4C7.d.ts → operationParams-Dme8H-sR.d.ts} +2 -2
- package/dist/{refs-CXp6uOHL.js → refs-CQNBUfBU.js} +10 -1
- package/dist/refs-CQNBUfBU.js.map +1 -0
- package/dist/{refs-DDIY_Tpn.cjs → refs-DLBwxlrG.cjs} +10 -1
- package/dist/refs-DLBwxlrG.cjs.map +1 -0
- package/dist/{types-CkgvnJBm.d.ts → types-BOsOrEZf.d.ts} +2 -2
- package/dist/types.d.ts +4 -4
- package/dist/{utils-DYhjlv0E.cjs → utils-BjyHu4VI.cjs} +2 -2
- package/dist/{utils-DYhjlv0E.cjs.map → utils-BjyHu4VI.cjs.map} +1 -1
- package/dist/{utils-C2kwfetT.js → utils-BlvDdD8y.js} +2 -2
- package/dist/{utils-C2kwfetT.js.map → utils-BlvDdD8y.js.map} +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -2
- package/package.json +2 -1
- package/dist/refs-CXp6uOHL.js.map +0 -1
- package/dist/refs-DDIY_Tpn.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { C as ParameterNode, Et as PropertyNode, _t as SchemaNode, f as OperationNode, h as ResponseNode, n as OutputNode, o as InputNode, rt as ContentNode, t as Node, y as RequestBodyNode } from "./index-
|
|
2
|
+
import { C as ParameterNode, Et as PropertyNode, _t as SchemaNode, f as OperationNode, h as ResponseNode, n as OutputNode, o as InputNode, rt as ContentNode, t as Node, y as RequestBodyNode } from "./index-q_ldM1YP.js";
|
|
3
3
|
|
|
4
4
|
//#region src/constants.d.ts
|
|
5
5
|
/**
|
|
@@ -463,4 +463,4 @@ declare function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyAr
|
|
|
463
463
|
}): TNode;
|
|
464
464
|
//#endregion
|
|
465
465
|
export { defineMacro as a, VisitorContext as c, walk as d, schemaTypes as f, composeMacros as i, collect as l, Macro as n, ParentOf as o, applyMacros as r, Visitor as s, Enforce as t, transform as u };
|
|
466
|
-
//# sourceMappingURL=defineMacro-
|
|
466
|
+
//# sourceMappingURL=defineMacro-D9ekmTW5.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_refs = require("./refs-
|
|
1
|
+
const require_refs = require("./refs-DLBwxlrG.cjs");
|
|
2
2
|
//#region src/defineMacro.ts
|
|
3
3
|
/**
|
|
4
4
|
* Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain
|
|
@@ -111,4 +111,4 @@ Object.defineProperty(exports, "defineMacro", {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
//# sourceMappingURL=defineMacro-
|
|
114
|
+
//# sourceMappingURL=defineMacro-DoMJxLWT.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineMacro-
|
|
1
|
+
{"version":3,"file":"defineMacro-DoMJxLWT.cjs","names":["visitorKeys","transform"],"sources":["../src/defineMacro.ts"],"sourcesContent":["import type { VisitorDepth } from './constants.ts'\nimport type { VisitorKey } from './defineNode.ts'\nimport { visitorKeys } from './defineNode.ts'\nimport type { Node } from './nodes/index.ts'\nimport type { Visitor, VisitorContext } from './visitor.ts'\nimport { transform } from './visitor.ts'\n\n/**\n * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,\n * and `undefined` keeps declaration order.\n */\nexport type Enforce = 'pre' | 'post'\n\n/**\n * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain\n * list keeps its authored order.\n */\nfunction enforceWeight(enforce?: Enforce): number {\n if (enforce === 'pre') return 0\n if (enforce === 'post') return 2\n return 1\n}\n\n/**\n * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a\n * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an\n * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter\n * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).\n */\nexport type Macro = Visitor & {\n /**\n * Macro identifier used to tell macros apart, for example `'simplify-union'`.\n */\n name: string\n /**\n * Ordering hint. `pre` macros run before unmarked macros, `post` macros run after.\n * Ordering within a bucket follows list order.\n */\n enforce?: Enforce\n /**\n * Gate checked against the current node before any callback runs. When it returns `false`\n * the macro is skipped for that node.\n */\n when?: (node: Node) => boolean\n}\n\n/**\n * Types a macro for inference and a single construction site, mirroring `definePlugin`.\n * Adds no runtime behavior.\n *\n * @example\n * ```ts\n * const macroUntagged = defineMacro({\n * name: 'untagged',\n * operation(node) {\n * return node.tags?.length ? undefined : { ...node, tags: ['untagged'] }\n * },\n * })\n * ```\n */\nexport function defineMacro(macro: Macro): Macro {\n return macro\n}\n\ntype MacroCallback = (node: Node, context: VisitorContext) => Node | null | undefined\n\ntype ChainProps = {\n macros: ReadonlyArray<Macro>\n key: VisitorKey\n node: Node\n context: VisitorContext\n}\n\n/**\n * Runs every macro's callback for one node kind in order, chaining the result so each macro sees\n * the previous macro's output. Returns `undefined` when nothing changed, so `transform` keeps the\n * original reference (structural sharing).\n */\nfunction chain({ macros, key, node, context }: ChainProps): Node | undefined {\n let current = node\n\n for (const macro of macros) {\n const callback = macro[key] as MacroCallback | undefined\n if (!callback) continue\n if (macro.when && !macro.when(current)) continue\n\n const next = callback(current, context)\n if (next != null) current = next\n }\n\n return current === node ? undefined : current\n}\n\n/**\n * Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin\n * transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied\n * sequentially per node so later macros see earlier output. This differs from a plain visitor, which\n * has no names, ordering, or composition.\n *\n * @example\n * ```ts\n * const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])\n * const next = transform(root, visitor)\n * ```\n */\nexport function composeMacros(macros: ReadonlyArray<Macro>): Visitor {\n const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce))\n\n const visitor: Visitor = {}\n for (const key of visitorKeys) {\n if (!ordered.some((macro) => typeof macro[key] === 'function')) continue\n\n const callback = (node: Node, context: VisitorContext) => chain({ macros: ordered, key, node, context })\n ;(visitor as Record<VisitorKey, MacroCallback>)[key] = callback\n }\n\n return visitor\n}\n\n/**\n * Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s\n * structural sharing, so an empty or no-op macro list returns the same reference. Pass\n * `depth: 'shallow'` to rewrite the root node only.\n *\n * @example\n * ```ts\n * const next = applyMacros(root, [macroIntegerToString])\n * ```\n *\n * @example Apply to the root node only\n * ```ts\n * const named = applyMacros(node, [macroEnumName({ parentName, propName, enumSuffix })], { depth: 'shallow' })\n * ```\n */\nexport function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyArray<Macro>, options?: { depth?: VisitorDepth }): TNode {\n if (macros.length === 0) return root\n\n return transform(root, { ...composeMacros(macros), ...options }) as TNode\n}\n"],"mappings":";;;;;;AAiBA,SAAS,cAAc,SAA2B;CAChD,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,QAAQ,OAAO;CAC/B,OAAO;AACT;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAqB;CAC/C,OAAO;AACT;;;;;;AAgBA,SAAS,MAAM,EAAE,QAAQ,KAAK,MAAM,WAAyC;CAC3E,IAAI,UAAU;CAEd,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,UAAU;EACf,IAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,GAAG;EAExC,MAAM,OAAO,SAAS,SAAS,OAAO;EACtC,IAAI,QAAQ,MAAM,UAAU;CAC9B;CAEA,OAAO,YAAY,OAAO,KAAA,IAAY;AACxC;;;;;;;;;;;;;AAcA,SAAgB,cAAc,QAAuC;CACnE,MAAM,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,cAAc,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,CAAC;CAE9F,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAOA,aAAAA,aAAa;EAC7B,IAAI,CAAC,QAAQ,MAAM,UAAU,OAAO,MAAM,SAAS,UAAU,GAAG;EAEhE,MAAM,YAAY,MAAY,YAA4B,MAAM;GAAE,QAAQ;GAAS;GAAK;GAAM;EAAQ,CAAC;EACtG,QAA+C,OAAO;CACzD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAgC,MAAa,QAA8B,SAA2C;CACpI,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAOC,aAAAA,UAAU,MAAM;EAAE,GAAG,cAAc,MAAM;EAAG,GAAG;CAAQ,CAAC;AACjE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { pt as visitorKeys, u as transform } from "./refs-
|
|
2
|
+
import { pt as visitorKeys, u as transform } from "./refs-CQNBUfBU.js";
|
|
3
3
|
//#region src/defineMacro.ts
|
|
4
4
|
/**
|
|
5
5
|
* Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain
|
|
@@ -95,4 +95,4 @@ function applyMacros(root, macros, options) {
|
|
|
95
95
|
//#endregion
|
|
96
96
|
export { composeMacros as n, defineMacro as r, applyMacros as t };
|
|
97
97
|
|
|
98
|
-
//# sourceMappingURL=defineMacro-
|
|
98
|
+
//# sourceMappingURL=defineMacro-_xJf504Y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineMacro-
|
|
1
|
+
{"version":3,"file":"defineMacro-_xJf504Y.js","names":[],"sources":["../src/defineMacro.ts"],"sourcesContent":["import type { VisitorDepth } from './constants.ts'\nimport type { VisitorKey } from './defineNode.ts'\nimport { visitorKeys } from './defineNode.ts'\nimport type { Node } from './nodes/index.ts'\nimport type { Visitor, VisitorContext } from './visitor.ts'\nimport { transform } from './visitor.ts'\n\n/**\n * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,\n * and `undefined` keeps declaration order.\n */\nexport type Enforce = 'pre' | 'post'\n\n/**\n * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain\n * list keeps its authored order.\n */\nfunction enforceWeight(enforce?: Enforce): number {\n if (enforce === 'pre') return 0\n if (enforce === 'post') return 2\n return 1\n}\n\n/**\n * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a\n * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an\n * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter\n * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).\n */\nexport type Macro = Visitor & {\n /**\n * Macro identifier used to tell macros apart, for example `'simplify-union'`.\n */\n name: string\n /**\n * Ordering hint. `pre` macros run before unmarked macros, `post` macros run after.\n * Ordering within a bucket follows list order.\n */\n enforce?: Enforce\n /**\n * Gate checked against the current node before any callback runs. When it returns `false`\n * the macro is skipped for that node.\n */\n when?: (node: Node) => boolean\n}\n\n/**\n * Types a macro for inference and a single construction site, mirroring `definePlugin`.\n * Adds no runtime behavior.\n *\n * @example\n * ```ts\n * const macroUntagged = defineMacro({\n * name: 'untagged',\n * operation(node) {\n * return node.tags?.length ? undefined : { ...node, tags: ['untagged'] }\n * },\n * })\n * ```\n */\nexport function defineMacro(macro: Macro): Macro {\n return macro\n}\n\ntype MacroCallback = (node: Node, context: VisitorContext) => Node | null | undefined\n\ntype ChainProps = {\n macros: ReadonlyArray<Macro>\n key: VisitorKey\n node: Node\n context: VisitorContext\n}\n\n/**\n * Runs every macro's callback for one node kind in order, chaining the result so each macro sees\n * the previous macro's output. Returns `undefined` when nothing changed, so `transform` keeps the\n * original reference (structural sharing).\n */\nfunction chain({ macros, key, node, context }: ChainProps): Node | undefined {\n let current = node\n\n for (const macro of macros) {\n const callback = macro[key] as MacroCallback | undefined\n if (!callback) continue\n if (macro.when && !macro.when(current)) continue\n\n const next = callback(current, context)\n if (next != null) current = next\n }\n\n return current === node ? undefined : current\n}\n\n/**\n * Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin\n * transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied\n * sequentially per node so later macros see earlier output. This differs from a plain visitor, which\n * has no names, ordering, or composition.\n *\n * @example\n * ```ts\n * const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])\n * const next = transform(root, visitor)\n * ```\n */\nexport function composeMacros(macros: ReadonlyArray<Macro>): Visitor {\n const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce))\n\n const visitor: Visitor = {}\n for (const key of visitorKeys) {\n if (!ordered.some((macro) => typeof macro[key] === 'function')) continue\n\n const callback = (node: Node, context: VisitorContext) => chain({ macros: ordered, key, node, context })\n ;(visitor as Record<VisitorKey, MacroCallback>)[key] = callback\n }\n\n return visitor\n}\n\n/**\n * Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s\n * structural sharing, so an empty or no-op macro list returns the same reference. Pass\n * `depth: 'shallow'` to rewrite the root node only.\n *\n * @example\n * ```ts\n * const next = applyMacros(root, [macroIntegerToString])\n * ```\n *\n * @example Apply to the root node only\n * ```ts\n * const named = applyMacros(node, [macroEnumName({ parentName, propName, enumSuffix })], { depth: 'shallow' })\n * ```\n */\nexport function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyArray<Macro>, options?: { depth?: VisitorDepth }): TNode {\n if (macros.length === 0) return root\n\n return transform(root, { ...composeMacros(macros), ...options }) as TNode\n}\n"],"mappings":";;;;;;;AAiBA,SAAS,cAAc,SAA2B;CAChD,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,QAAQ,OAAO;CAC/B,OAAO;AACT;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAqB;CAC/C,OAAO;AACT;;;;;;AAgBA,SAAS,MAAM,EAAE,QAAQ,KAAK,MAAM,WAAyC;CAC3E,IAAI,UAAU;CAEd,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,UAAU;EACf,IAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,GAAG;EAExC,MAAM,OAAO,SAAS,SAAS,OAAO;EACtC,IAAI,QAAQ,MAAM,UAAU;CAC9B;CAEA,OAAO,YAAY,OAAO,KAAA,IAAY;AACxC;;;;;;;;;;;;;AAcA,SAAgB,cAAc,QAAuC;CACnE,MAAM,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,cAAc,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,CAAC;CAE9F,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,aAAa;EAC7B,IAAI,CAAC,QAAQ,MAAM,UAAU,OAAO,MAAM,SAAS,UAAU,GAAG;EAEhE,MAAM,YAAY,MAAY,YAA4B,MAAM;GAAE,QAAQ;GAAS;GAAK;GAAM;EAAQ,CAAC;EACtG,QAA+C,OAAO;CACzD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAgC,MAAa,QAA8B,SAA2C;CACpI,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAO,UAAU,MAAM;EAAE,GAAG,cAAc,MAAM;EAAG,GAAG;CAAQ,CAAC;AACjE"}
|
|
@@ -1540,6 +1540,16 @@ type FileNode<TMeta extends object = object> = BaseNode & {
|
|
|
1540
1540
|
* Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
|
|
1541
1541
|
*/
|
|
1542
1542
|
footer?: string | null;
|
|
1543
|
+
/**
|
|
1544
|
+
* Absolute on-disk path to copy verbatim into the output, bypassing the parser.
|
|
1545
|
+
*
|
|
1546
|
+
* Use to emit a real source file shipped inside a package (a template) into the generated
|
|
1547
|
+
* folder without reformatting or import reordering. Only `banner` and `footer` are applied
|
|
1548
|
+
* around the copied content. When set, `copy` provides the file content and any `sources`
|
|
1549
|
+
* nodes are ignored for output; `sources` may still carry `name`/`isExportable`/`isIndexable`
|
|
1550
|
+
* so barrel generation treats the file the same as a rendered one.
|
|
1551
|
+
*/
|
|
1552
|
+
copy?: string | null;
|
|
1543
1553
|
};
|
|
1544
1554
|
/**
|
|
1545
1555
|
* Definition for the {@link ImportNode}.
|
|
@@ -1620,6 +1630,15 @@ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind'
|
|
|
1620
1630
|
* // file.name = 'petStore'
|
|
1621
1631
|
* // file.extname = '.ts'
|
|
1622
1632
|
* ```
|
|
1633
|
+
*
|
|
1634
|
+
* @example Copy a real file into the output verbatim
|
|
1635
|
+
* ```ts
|
|
1636
|
+
* const file = createFile({
|
|
1637
|
+
* baseName: 'client.ts',
|
|
1638
|
+
* path: 'src/gen/client.ts',
|
|
1639
|
+
* copy: '/abs/path/to/templates/client.ts',
|
|
1640
|
+
* })
|
|
1641
|
+
* ```
|
|
1623
1642
|
*/
|
|
1624
1643
|
declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
|
|
1625
1644
|
//#endregion
|
|
@@ -2400,4 +2419,4 @@ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): Ou
|
|
|
2400
2419
|
type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode;
|
|
2401
2420
|
//#endregion
|
|
2402
2421
|
export { exportDef as $, textDef as $t, IndexedAccessTypeNode as A, InferSchemaNode as At, functionParametersDef as B, TypeNode as Bt, ParameterNode as C, UrlSchemaNode as Ct, FunctionParamNode as D, UserPropertyNode as Dt, FunctionParamKind as E, PropertyNode as Et, createFunctionParameters as F, ConstNode as Ft, FileNode as G, createBreak as Gt, objectBindingPatternDef as H, breakDef as Ht, createIndexedAccessType as I, FunctionNode as It, UserFileNode as J, createJsx as Jt, ImportNode as K, createConst as Kt, createObjectBindingPattern as L, JSDocNode as Lt, TypeExpression as M, ArrowFunctionNode as Mt, TypeLiteralNode as N, BreakNode as Nt, FunctionParameterNode as O, createProperty as Ot, createFunctionParameter as P, CodeNode as Pt, createSource as Q, jsxDef as Qt, createTypeLiteral as R, JsxNode as Rt, ParameterLocation as S, UnionSchemaNode as St, parameterDef as T, schemaDef as Tt, typeLiteralDef as U, constDef as Ut, indexedAccessTypeDef as V, arrowFunctionDef as Vt, ExportNode as W, createArrowFunction as Wt, createFile as X, createType as Xt, createExport as Y, createText as Yt, createImport as Z, functionDef as Zt, createResponse as _, SchemaNode as _t, InputMeta as a, NodeKind as an, createContent as at, createRequestBody as b, StringSchemaNode as bt, inputDef as c, DatetimeSchemaNode as ct, HttpOperationNode as d, NumberSchemaNode as dt, typeDef as en, fileDef as et, OperationNode as f, ObjectSchemaNode as ft, StatusCode as g, ScalarSchemaType as gt, ResponseNode as h, ScalarSchemaNode as ht, outputDef as i, BaseNode as in, contentDef as it, ObjectBindingPatternNode as j, ParserOptions as jt, FunctionParametersNode as k, propertyDef as kt, GenericOperationNode as l, EnumSchemaNode as lt, operationDef as m, RefSchemaNode as mt, OutputNode as n, NodeDef as nn, sourceDef as nt, InputNode as o, ArraySchemaNode as ot, createOperation as p, PrimitiveSchemaType as pt, SourceNode as q, createFunction as qt, createOutput as r, defineNode as rn, ContentNode as rt, createInput as s, DateSchemaNode as st, Node as t, DistributiveOmit as tn, importDef as tt, HttpMethod as u, IntersectionSchemaNode as ut, responseDef as v, SchemaNodeByType as vt, createParameter as w, createSchema as wt, requestBodyDef as x, TimeSchemaNode as xt, RequestBodyNode as y, SchemaType as yt, functionParameterDef as z, TextNode as zt };
|
|
2403
|
-
//# sourceMappingURL=index-
|
|
2422
|
+
//# sourceMappingURL=index-q_ldM1YP.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_refs = require("./refs-
|
|
3
|
-
require("./utils-
|
|
4
|
-
const require_defineMacro = require("./defineMacro-
|
|
2
|
+
const require_refs = require("./refs-DLBwxlrG.cjs");
|
|
3
|
+
require("./utils-BjyHu4VI.cjs");
|
|
4
|
+
const require_defineMacro = require("./defineMacro-DoMJxLWT.cjs");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
6
|
//#region src/defineDialect.ts
|
|
7
7
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __name, t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { a as defineMacro, c as VisitorContext, d as walk, f as schemaTypes, i as composeMacros, l as collect, n as Macro, o as ParentOf, r as applyMacros, s as Visitor, t as Enforce, u as transform } from "./defineMacro-
|
|
3
|
-
import { $ as exportDef, $t as textDef, A as IndexedAccessTypeNode, At as InferSchemaNode, B as functionParametersDef, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, Dt as UserPropertyNode, E as FunctionParamKind, Et as PropertyNode, F as createFunctionParameters, Ft as ConstNode, G as FileNode, Gt as createBreak, H as objectBindingPatternDef, Ht as breakDef, I as createIndexedAccessType, It as FunctionNode, J as UserFileNode, Jt as createJsx, K as ImportNode, Kt as createConst, L as createObjectBindingPattern, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Ot as createProperty, P as createFunctionParameter, Pt as CodeNode, Q as createSource, Qt as jsxDef, R as createTypeLiteral, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, T as parameterDef, Tt as schemaDef, U as typeLiteralDef, Ut as constDef, V as indexedAccessTypeDef, Vt as arrowFunctionDef, W as ExportNode, Wt as createArrowFunction, X as createFile, Xt as createType, Y as createExport, Yt as createText, Z as createImport, Zt as functionDef, _ as createResponse, _t as SchemaNode, a as InputMeta, an as NodeKind, at as createContent, b as createRequestBody, bt as StringSchemaNode, c as inputDef, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, en as typeDef, et as fileDef, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, i as outputDef, in as BaseNode, it as contentDef, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, kt as propertyDef, l as GenericOperationNode, lt as EnumSchemaNode, m as operationDef, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, nt as sourceDef, o as InputNode, ot as ArraySchemaNode, p as createOperation, pt as PrimitiveSchemaType, q as SourceNode, qt as createFunction, r as createOutput, rn as defineNode, rt as ContentNode, s as createInput, st as DateSchemaNode, t as Node, tn as DistributiveOmit, tt as importDef, u as HttpMethod, ut as IntersectionSchemaNode, v as responseDef, vt as SchemaNodeByType, w as createParameter, wt as createSchema, x as requestBodyDef, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, z as functionParameterDef, zt as TextNode } from "./index-
|
|
4
|
-
import { a as Dedupe, c as defineDialect, i as createPrinter, n as PrinterFactoryOptions, o as Dialect, r as PrinterPartial, s as SchemaDialect, t as Printer } from "./types-
|
|
5
|
-
import { n as OperationParamsResolver } from "./operationParams-
|
|
2
|
+
import { a as defineMacro, c as VisitorContext, d as walk, f as schemaTypes, i as composeMacros, l as collect, n as Macro, o as ParentOf, r as applyMacros, s as Visitor, t as Enforce, u as transform } from "./defineMacro-D9ekmTW5.js";
|
|
3
|
+
import { $ as exportDef, $t as textDef, A as IndexedAccessTypeNode, At as InferSchemaNode, B as functionParametersDef, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, Dt as UserPropertyNode, E as FunctionParamKind, Et as PropertyNode, F as createFunctionParameters, Ft as ConstNode, G as FileNode, Gt as createBreak, H as objectBindingPatternDef, Ht as breakDef, I as createIndexedAccessType, It as FunctionNode, J as UserFileNode, Jt as createJsx, K as ImportNode, Kt as createConst, L as createObjectBindingPattern, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Ot as createProperty, P as createFunctionParameter, Pt as CodeNode, Q as createSource, Qt as jsxDef, R as createTypeLiteral, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, T as parameterDef, Tt as schemaDef, U as typeLiteralDef, Ut as constDef, V as indexedAccessTypeDef, Vt as arrowFunctionDef, W as ExportNode, Wt as createArrowFunction, X as createFile, Xt as createType, Y as createExport, Yt as createText, Z as createImport, Zt as functionDef, _ as createResponse, _t as SchemaNode, a as InputMeta, an as NodeKind, at as createContent, b as createRequestBody, bt as StringSchemaNode, c as inputDef, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, en as typeDef, et as fileDef, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, i as outputDef, in as BaseNode, it as contentDef, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, kt as propertyDef, l as GenericOperationNode, lt as EnumSchemaNode, m as operationDef, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, nt as sourceDef, o as InputNode, ot as ArraySchemaNode, p as createOperation, pt as PrimitiveSchemaType, q as SourceNode, qt as createFunction, r as createOutput, rn as defineNode, rt as ContentNode, s as createInput, st as DateSchemaNode, t as Node, tn as DistributiveOmit, tt as importDef, u as HttpMethod, ut as IntersectionSchemaNode, v as responseDef, vt as SchemaNodeByType, w as createParameter, wt as createSchema, x as requestBodyDef, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, z as functionParameterDef, zt as TextNode } from "./index-q_ldM1YP.js";
|
|
4
|
+
import { a as Dedupe, c as defineDialect, i as createPrinter, n as PrinterFactoryOptions, o as Dialect, r as PrinterPartial, s as SchemaDialect, t as Printer } from "./types-BOsOrEZf.js";
|
|
5
|
+
import { n as OperationParamsResolver } from "./operationParams-Dme8H-sR.js";
|
|
6
6
|
|
|
7
7
|
//#region src/guards.d.ts
|
|
8
8
|
/**
|
|
@@ -75,7 +75,7 @@ declare function update<T extends Node>(node: T, changes: Partial<T>): T;
|
|
|
75
75
|
* Every node definition. Adding a node means adding its `defineNode` to one
|
|
76
76
|
* `nodes/*.ts` file and listing it here. The visitor tables in `visitor.ts` derive from it.
|
|
77
77
|
*/
|
|
78
|
-
declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<SchemaNode, (Omit<ObjectSchemaNode, "properties" | "kind" | "primitive"> & {
|
|
78
|
+
declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<ConstNode, Omit<ConstNode, "kind">> | NodeDef<TypeNode, Omit<TypeNode, "kind">> | NodeDef<FunctionNode, Omit<FunctionNode, "kind">> | NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">> | NodeDef<TextNode, string> | NodeDef<BreakNode, void> | NodeDef<JsxNode, string> | NodeDef<SchemaNode, (Omit<ObjectSchemaNode, "properties" | "kind" | "primitive"> & {
|
|
79
79
|
properties?: Array<PropertyNode>;
|
|
80
80
|
primitive?: "object";
|
|
81
81
|
}) | DistributiveOmit<ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | (BaseNode & {
|
|
@@ -131,7 +131,7 @@ declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<Schem
|
|
|
131
131
|
format?: string;
|
|
132
132
|
} & {
|
|
133
133
|
type: "ipv6";
|
|
134
|
-
}) | ScalarSchemaNode, "kind">> | NodeDef<
|
|
134
|
+
}) | ScalarSchemaNode, "kind">> | NodeDef<InputNode<false>, Partial<Omit<InputNode<false>, "kind">>> | NodeDef<OutputNode, Partial<Omit<OutputNode, "kind">>> | NodeDef<RequestBodyNode, Omit<RequestBodyNode, "kind">> | NodeDef<OperationNode, {
|
|
135
135
|
[key: string]: unknown;
|
|
136
136
|
operationId: string;
|
|
137
137
|
method?: HttpOperationNode["method"];
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { $ as breakDef, A as createFunctionParameter, B as createExport, C as outputDef, D as requestBodyDef, E as createRequestBody, F as functionParameterDef, G as fileDef, H as createImport, I as functionParametersDef, K as importDef, L as indexedAccessTypeDef, M as createIndexedAccessType, N as createObjectBindingPattern, O as createInput, P as createTypeLiteral, Q as arrowFunctionDef, R as objectBindingPatternDef, S as createOutput, T as operationDef, U as createSource, V as createFile, W as exportDef, X as contentDef, Z as createContent, _ as createProperty, _t as schemaTypes, at as createJsx, b as parameterDef, c as collect, ct as functionDef, d as walk, dt as typeDef, et as constDef, f as nodeDefs, ft as defineNode, g as responseDef, h as createResponse, ht as narrowSchema, it as createFunction, j as createFunctionParameters, k as inputDef, lt as jsxDef, m as schemaDef, mt as isHttpOperationNode, nt as createBreak, ot as createText, p as createSchema, q as sourceDef, r as extractRefName, rt as createConst, st as createType, tt as createArrowFunction, u as transform, ut as textDef, v as propertyDef, w as createOperation, x as optionality, y as createParameter, z as typeLiteralDef } from "./refs-
|
|
3
|
-
import "./utils-
|
|
4
|
-
import { n as composeMacros, r as defineMacro, t as applyMacros } from "./defineMacro-
|
|
2
|
+
import { $ as breakDef, A as createFunctionParameter, B as createExport, C as outputDef, D as requestBodyDef, E as createRequestBody, F as functionParameterDef, G as fileDef, H as createImport, I as functionParametersDef, K as importDef, L as indexedAccessTypeDef, M as createIndexedAccessType, N as createObjectBindingPattern, O as createInput, P as createTypeLiteral, Q as arrowFunctionDef, R as objectBindingPatternDef, S as createOutput, T as operationDef, U as createSource, V as createFile, W as exportDef, X as contentDef, Z as createContent, _ as createProperty, _t as schemaTypes, at as createJsx, b as parameterDef, c as collect, ct as functionDef, d as walk, dt as typeDef, et as constDef, f as nodeDefs, ft as defineNode, g as responseDef, h as createResponse, ht as narrowSchema, it as createFunction, j as createFunctionParameters, k as inputDef, lt as jsxDef, m as schemaDef, mt as isHttpOperationNode, nt as createBreak, ot as createText, p as createSchema, q as sourceDef, r as extractRefName, rt as createConst, st as createType, tt as createArrowFunction, u as transform, ut as textDef, v as propertyDef, w as createOperation, x as optionality, y as createParameter, z as typeLiteralDef } from "./refs-CQNBUfBU.js";
|
|
3
|
+
import "./utils-BlvDdD8y.js";
|
|
4
|
+
import { n as composeMacros, r as defineMacro, t as applyMacros } from "./defineMacro-_xJf504Y.js";
|
|
5
5
|
import { hash } from "node:crypto";
|
|
6
6
|
//#region src/defineDialect.ts
|
|
7
7
|
/**
|
package/dist/macros.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_refs = require("./refs-
|
|
3
|
-
const require_defineMacro = require("./defineMacro-
|
|
2
|
+
const require_refs = require("./refs-DLBwxlrG.cjs");
|
|
3
|
+
const require_defineMacro = require("./defineMacro-DoMJxLWT.cjs");
|
|
4
4
|
//#region src/macros/macroDiscriminatorEnum.ts
|
|
5
5
|
/**
|
|
6
6
|
* Builds a macro that replaces a discriminator property's schema with a string enum of the given
|
package/dist/macros.d.ts
CHANGED
package/dist/macros.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { _ as createProperty, ht as narrowSchema, n as enumPropName, p as createSchema } from "./refs-
|
|
3
|
-
import { r as defineMacro } from "./defineMacro-
|
|
2
|
+
import { _ as createProperty, ht as narrowSchema, n as enumPropName, p as createSchema } from "./refs-CQNBUfBU.js";
|
|
3
|
+
import { r as defineMacro } from "./defineMacro-_xJf504Y.js";
|
|
4
4
|
//#region src/macros/macroDiscriminatorEnum.ts
|
|
5
5
|
/**
|
|
6
6
|
* Builds a macro that replaces a discriminator property's schema with a string enum of the given
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { C as ParameterNode, M as TypeExpression, N as TypeLiteralNode, O as FunctionParameterNode, f as OperationNode, k as FunctionParametersNode } from "./index-
|
|
2
|
+
import { C as ParameterNode, M as TypeExpression, N as TypeLiteralNode, O as FunctionParameterNode, f as OperationNode, k as FunctionParametersNode } from "./index-q_ldM1YP.js";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/operationParams.d.ts
|
|
5
5
|
/**
|
|
@@ -208,4 +208,4 @@ declare function buildTypeLiteral({
|
|
|
208
208
|
}): TypeLiteralNode;
|
|
209
209
|
//#endregion
|
|
210
210
|
export { buildTypeLiteral as a, resolveParamType as c, buildGroupParam as i, OperationParamsResolver as n, caseParams as o, ParamGroupType as r, createOperationParams as s, BuildGroupArgs as t };
|
|
211
|
-
//# sourceMappingURL=operationParams-
|
|
211
|
+
//# sourceMappingURL=operationParams-Dme8H-sR.d.ts.map
|
|
@@ -635,6 +635,15 @@ const createSource = sourceDef.create;
|
|
|
635
635
|
* // file.name = 'petStore'
|
|
636
636
|
* // file.extname = '.ts'
|
|
637
637
|
* ```
|
|
638
|
+
*
|
|
639
|
+
* @example Copy a real file into the output verbatim
|
|
640
|
+
* ```ts
|
|
641
|
+
* const file = createFile({
|
|
642
|
+
* baseName: 'client.ts',
|
|
643
|
+
* path: 'src/gen/client.ts',
|
|
644
|
+
* copy: '/abs/path/to/templates/client.ts',
|
|
645
|
+
* })
|
|
646
|
+
* ```
|
|
638
647
|
*/
|
|
639
648
|
function createFile(input) {
|
|
640
649
|
const extname = path.extname(input.baseName) || (input.baseName.startsWith(".") ? input.baseName : "");
|
|
@@ -1407,4 +1416,4 @@ function resolveGroupType({ node, params, group, resolver }) {
|
|
|
1407
1416
|
//#endregion
|
|
1408
1417
|
export { breakDef as $, createFunctionParameter as A, createExport as B, outputDef as C, requestBodyDef as D, createRequestBody as E, functionParameterDef as F, fileDef as G, createImport as H, functionParametersDef as I, extractStringsFromNodes as J, importDef as K, indexedAccessTypeDef as L, createIndexedAccessType as M, createObjectBindingPattern as N, createInput as O, createTypeLiteral as P, arrowFunctionDef as Q, objectBindingPatternDef as R, createOutput as S, operationDef as T, createSource as U, createFile as V, exportDef as W, contentDef as X, camelCase as Y, createContent as Z, createProperty as _, schemaTypes as _t, resolveGroupType as a, createJsx as at, parameterDef as b, collect as c, functionDef as ct, walk as d, typeDef as dt, constDef as et, nodeDefs as f, defineNode as ft, responseDef as g, INDENT as gt, createResponse as h, narrowSchema as ht, isStringType as i, createFunction as it, createFunctionParameters as j, inputDef as k, collectLazy as l, jsxDef as lt, schemaDef as m, isHttpOperationNode as mt, enumPropName as n, createBreak as nt, resolveRefName as o, createText as ot, createSchema as p, visitorKeys as pt, sourceDef as q, extractRefName as r, createConst as rt, syncSchemaRef as s, createType as st, childName as t, createArrowFunction as tt, transform as u, textDef as ut, propertyDef as v, createOperation as w, optionality as x, createParameter as y, typeLiteralDef as z };
|
|
1409
1418
|
|
|
1410
|
-
//# sourceMappingURL=refs-
|
|
1419
|
+
//# sourceMappingURL=refs-CQNBUfBU.js.map
|