@kubb/ast 5.0.0-beta.62 → 5.0.0-beta.64
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-CNkUpxia.js → defineMacro-B76LsJwO.js} +4 -4
- package/dist/defineMacro-B76LsJwO.js.map +1 -0
- package/dist/{defineMacro-Vw-xQvq7.d.ts → defineMacro-B7qm3zTd.d.ts} +5 -6
- package/dist/{defineMacro-BryDiuQl.cjs → defineMacro-CEZHaCXE.cjs} +5 -5
- package/dist/defineMacro-CEZHaCXE.cjs.map +1 -0
- package/dist/factory-wJLzHeXT.d.ts +27 -0
- package/dist/factory.cjs +56 -56
- package/dist/factory.cjs.map +1 -1
- package/dist/factory.d.ts +3 -27
- package/dist/factory.js +6 -6
- package/dist/factory.js.map +1 -1
- package/dist/{index-CTaN_ee_.d.ts → index-BKD4drsX.d.ts} +47 -114
- package/dist/index.cjs +193 -270
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -21
- package/dist/index.js +154 -236
- package/dist/index.js.map +1 -1
- package/dist/macros.cjs +12 -12
- package/dist/macros.cjs.map +1 -1
- package/dist/macros.d.ts +3 -3
- package/dist/macros.js +5 -5
- package/dist/macros.js.map +1 -1
- package/dist/{operationParams-B44p6EQy.d.ts → operationParams-ByVfpYr7.d.ts} +10 -3
- package/dist/{visitor-DepQEKyp.js → refs-Dx6U5LoE.js} +116 -121
- package/dist/refs-Dx6U5LoE.js.map +1 -0
- package/dist/{visitor-B7Zlnp4c.cjs → refs-u5SDdyV7.cjs} +139 -144
- package/dist/refs-u5SDdyV7.cjs.map +1 -0
- package/dist/{response-BeG6hq2D.cjs → schema-BkvrrOAr.cjs} +171 -153
- package/dist/schema-BkvrrOAr.cjs.map +1 -0
- package/dist/{response-Rd1uisM1.js → schema-YNbOtTCM.js} +167 -155
- package/dist/schema-YNbOtTCM.js.map +1 -0
- package/dist/{types-DQTgVSwE.d.ts → types-BP9BZoq-.d.ts} +56 -80
- package/dist/types.d.ts +5 -5
- package/dist/{utils-DW9rnfsD.js → utils-BJi0y-xg.js} +57 -50
- package/dist/utils-BJi0y-xg.js.map +1 -0
- package/dist/{utils-BDI3kXlb.cjs → utils-CEepwqmb.cjs} +74 -67
- package/dist/utils-CEepwqmb.cjs.map +1 -0
- package/dist/utils.cjs +11 -11
- package/dist/utils.d.ts +45 -30
- package/dist/utils.js +3 -3
- package/package.json +1 -2
- package/dist/defineMacro-BryDiuQl.cjs.map +0 -1
- package/dist/defineMacro-CNkUpxia.js.map +0 -1
- package/dist/response-BeG6hq2D.cjs.map +0 -1
- package/dist/response-Rd1uisM1.js.map +0 -1
- package/dist/utils-BDI3kXlb.cjs.map +0 -1
- package/dist/utils-DW9rnfsD.js.map +0 -1
- package/dist/visitor-B7Zlnp4c.cjs.map +0 -1
- package/dist/visitor-DepQEKyp.js.map +0 -1
- package/src/constants.ts +0 -153
- package/src/dedupe.ts +0 -231
- package/src/defineMacro.ts +0 -139
- package/src/defineNode.ts +0 -105
- package/src/definePrinter.ts +0 -256
- package/src/dialect.ts +0 -76
- package/src/factory.ts +0 -44
- package/src/guards.ts +0 -28
- package/src/index.ts +0 -13
- package/src/infer.ts +0 -132
- package/src/macros/index.ts +0 -3
- package/src/macros/macroDiscriminatorEnum.ts +0 -50
- package/src/macros/macroEnumName.ts +0 -33
- package/src/macros/macroSimplifyUnion.ts +0 -60
- package/src/nodes/base.ts +0 -49
- package/src/nodes/code.ts +0 -352
- package/src/nodes/content.ts +0 -51
- package/src/nodes/file.ts +0 -379
- package/src/nodes/function.ts +0 -283
- package/src/nodes/index.ts +0 -93
- package/src/nodes/input.ts +0 -144
- package/src/nodes/operation.ts +0 -165
- package/src/nodes/output.ts +0 -49
- package/src/nodes/parameter.ts +0 -71
- package/src/nodes/property.ts +0 -67
- package/src/nodes/requestBody.ts +0 -54
- package/src/nodes/response.ts +0 -173
- package/src/nodes/schema.ts +0 -732
- package/src/registry.ts +0 -75
- package/src/signature.ts +0 -207
- package/src/types.ts +0 -9
- package/src/utils/codegen.ts +0 -104
- package/src/utils/extractStringsFromNodes.ts +0 -35
- package/src/utils/fileMerge.ts +0 -184
- package/src/utils/index.ts +0 -11
- package/src/utils/operationParams.ts +0 -353
- package/src/utils/refs.ts +0 -138
- package/src/utils/schemaGraph.ts +0 -169
- package/src/utils/schemaMerge.ts +0 -34
- package/src/utils/schemaTraversal.ts +0 -86
- package/src/utils/strings.ts +0 -139
- package/src/visitor.ts +0 -519
- /package/dist/{chunk-CNktS9qV.js → rolldown-runtime-CNktS9qV.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
+
import { u as transform } from "./refs-Dx6U5LoE.js";
|
|
3
|
+
import { nt as visitorKeys } from "./schema-YNbOtTCM.js";
|
|
4
4
|
//#region src/defineMacro.ts
|
|
5
5
|
/**
|
|
6
6
|
* Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain
|
|
@@ -96,4 +96,4 @@ function applyMacros(root, macros, options) {
|
|
|
96
96
|
//#endregion
|
|
97
97
|
export { composeMacros as n, defineMacro as r, applyMacros as t };
|
|
98
98
|
|
|
99
|
-
//# sourceMappingURL=defineMacro-
|
|
99
|
+
//# sourceMappingURL=defineMacro-B76LsJwO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineMacro-B76LsJwO.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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as __name } from "./
|
|
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-
|
|
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-BKD4drsX.js";
|
|
3
3
|
|
|
4
4
|
//#region src/constants.d.ts
|
|
5
5
|
/**
|
|
@@ -13,7 +13,6 @@ type VisitorDepth = 'shallow' | 'deep';
|
|
|
13
13
|
* Schema type discriminators used by all AST schema nodes.
|
|
14
14
|
*
|
|
15
15
|
* Each value is a stable discriminator across the AST (for example `schema.type === schemaTypes.object`).
|
|
16
|
-
* Call `isScalarPrimitive()` to check for the scalar types.
|
|
17
16
|
*/
|
|
18
17
|
declare const schemaTypes: {
|
|
19
18
|
/**
|
|
@@ -149,7 +148,7 @@ type ParentNodeMap = [[InputNode, undefined], [OutputNode, undefined], [Operatio
|
|
|
149
148
|
* @example
|
|
150
149
|
* ```ts
|
|
151
150
|
* type SchemaParent = ParentOf<SchemaNode>
|
|
152
|
-
* // InputNode |
|
|
151
|
+
* // InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode
|
|
153
152
|
* ```
|
|
154
153
|
*/
|
|
155
154
|
type ParentOf<T extends Node, TEntries extends ReadonlyArray<[Node, unknown]> = ParentNodeMap> = TEntries extends [infer TEntry extends [Node, unknown], ...infer TRest extends ReadonlyArray<[Node, unknown]>] ? T extends TEntry[0] ? TEntry[1] : ParentOf<T, TRest> : Node;
|
|
@@ -402,7 +401,7 @@ type Enforce = 'pre' | 'post';
|
|
|
402
401
|
*/
|
|
403
402
|
type Macro = Visitor & {
|
|
404
403
|
/**
|
|
405
|
-
* Macro identifier
|
|
404
|
+
* Macro identifier used to tell macros apart, for example `'simplify-union'`.
|
|
406
405
|
*/
|
|
407
406
|
name: string;
|
|
408
407
|
/**
|
|
@@ -464,4 +463,4 @@ declare function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyAr
|
|
|
464
463
|
}): TNode;
|
|
465
464
|
//#endregion
|
|
466
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 };
|
|
467
|
-
//# sourceMappingURL=defineMacro-
|
|
466
|
+
//# sourceMappingURL=defineMacro-B7qm3zTd.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require_schema = require("./schema-BkvrrOAr.cjs");
|
|
2
|
+
const require_refs = require("./refs-u5SDdyV7.cjs");
|
|
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
|
|
@@ -58,7 +58,7 @@ function chain({ macros, key, node, context }) {
|
|
|
58
58
|
function composeMacros(macros) {
|
|
59
59
|
const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce));
|
|
60
60
|
const visitor = {};
|
|
61
|
-
for (const key of
|
|
61
|
+
for (const key of require_schema.visitorKeys) {
|
|
62
62
|
if (!ordered.some((macro) => typeof macro[key] === "function")) continue;
|
|
63
63
|
const callback = (node, context) => chain({
|
|
64
64
|
macros: ordered,
|
|
@@ -87,7 +87,7 @@ function composeMacros(macros) {
|
|
|
87
87
|
*/
|
|
88
88
|
function applyMacros(root, macros, options) {
|
|
89
89
|
if (macros.length === 0) return root;
|
|
90
|
-
return
|
|
90
|
+
return require_refs.transform(root, {
|
|
91
91
|
...composeMacros(macros),
|
|
92
92
|
...options
|
|
93
93
|
});
|
|
@@ -112,4 +112,4 @@ Object.defineProperty(exports, "defineMacro", {
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
//# sourceMappingURL=defineMacro-
|
|
115
|
+
//# sourceMappingURL=defineMacro-CEZHaCXE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineMacro-CEZHaCXE.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,eAAAA,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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { n as __name, t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
+
import { F as createFunctionParameters, Gt as createBreak, I as createIndexedAccessType, J as UserFileNode, Jt as createJsx, Kt as createConst, L as createObjectBindingPattern, Ot as createProperty, P as createFunctionParameter, Q as createSource, R as createTypeLiteral, Wt as createArrowFunction, X as createFile, Xt as createType, Y as createExport, Yt as createText, Z as createImport, _ as createResponse, at as createContent, b as createRequestBody, p as createOperation, qt as createFunction, r as createOutput, s as createInput, t as Node, w as createParameter, wt as createSchema } from "./index-BKD4drsX.js";
|
|
3
|
+
|
|
4
|
+
//#region src/factory.d.ts
|
|
5
|
+
declare namespace factory_d_exports {
|
|
6
|
+
export { UserFileNode, createArrowFunction, createBreak, createConst, createContent, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createIndexedAccessType, createInput, createJsx, createObjectBindingPattern, createOperation, createOutput, createParameter, createProperty, createRequestBody, createResponse, createSchema, createSource, createText, createType, createTypeLiteral, update };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Identity-preserving node update: returns `node` unchanged when every field in
|
|
10
|
+
* `changes` already equals (by reference) the current value, otherwise a new node
|
|
11
|
+
* with the changes applied.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors the TypeScript compiler's `factory.updateX` contract. Pair it with the
|
|
14
|
+
* structural sharing in {@link transform} so a no-op rewrite does not allocate and
|
|
15
|
+
* downstream passes can detect "nothing changed" by identity. Comparison is shallow,
|
|
16
|
+
* so a structurally equal but newly allocated array or object counts as a change.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* update(node, { name: node.name }) // -> same `node` reference
|
|
21
|
+
* update(node, { name: 'renamed' }) // -> new node, `name` replaced
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function update<T extends Node>(node: T, changes: Partial<T>): T;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { update as n, factory_d_exports as t };
|
|
27
|
+
//# sourceMappingURL=factory-wJLzHeXT.d.ts.map
|
package/dist/factory.cjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_schema = require("./schema-BkvrrOAr.cjs");
|
|
3
3
|
//#region src/factory.ts
|
|
4
|
-
var factory_exports = /* @__PURE__ */
|
|
5
|
-
createArrowFunction: () =>
|
|
6
|
-
createBreak: () =>
|
|
7
|
-
createConst: () =>
|
|
8
|
-
createContent: () =>
|
|
9
|
-
createExport: () =>
|
|
10
|
-
createFile: () =>
|
|
11
|
-
createFunction: () =>
|
|
12
|
-
createFunctionParameter: () =>
|
|
13
|
-
createFunctionParameters: () =>
|
|
14
|
-
createImport: () =>
|
|
15
|
-
createIndexedAccessType: () =>
|
|
16
|
-
createInput: () =>
|
|
17
|
-
createJsx: () =>
|
|
18
|
-
createObjectBindingPattern: () =>
|
|
19
|
-
createOperation: () =>
|
|
20
|
-
createOutput: () =>
|
|
21
|
-
createParameter: () =>
|
|
22
|
-
createProperty: () =>
|
|
23
|
-
createRequestBody: () =>
|
|
24
|
-
createResponse: () =>
|
|
25
|
-
createSchema: () =>
|
|
26
|
-
createSource: () =>
|
|
27
|
-
createText: () =>
|
|
28
|
-
createType: () =>
|
|
29
|
-
createTypeLiteral: () =>
|
|
4
|
+
var factory_exports = /* @__PURE__ */ require_schema.__exportAll({
|
|
5
|
+
createArrowFunction: () => require_schema.createArrowFunction,
|
|
6
|
+
createBreak: () => require_schema.createBreak,
|
|
7
|
+
createConst: () => require_schema.createConst,
|
|
8
|
+
createContent: () => require_schema.createContent,
|
|
9
|
+
createExport: () => require_schema.createExport,
|
|
10
|
+
createFile: () => require_schema.createFile,
|
|
11
|
+
createFunction: () => require_schema.createFunction,
|
|
12
|
+
createFunctionParameter: () => require_schema.createFunctionParameter,
|
|
13
|
+
createFunctionParameters: () => require_schema.createFunctionParameters,
|
|
14
|
+
createImport: () => require_schema.createImport,
|
|
15
|
+
createIndexedAccessType: () => require_schema.createIndexedAccessType,
|
|
16
|
+
createInput: () => require_schema.createInput,
|
|
17
|
+
createJsx: () => require_schema.createJsx,
|
|
18
|
+
createObjectBindingPattern: () => require_schema.createObjectBindingPattern,
|
|
19
|
+
createOperation: () => require_schema.createOperation,
|
|
20
|
+
createOutput: () => require_schema.createOutput,
|
|
21
|
+
createParameter: () => require_schema.createParameter,
|
|
22
|
+
createProperty: () => require_schema.createProperty,
|
|
23
|
+
createRequestBody: () => require_schema.createRequestBody,
|
|
24
|
+
createResponse: () => require_schema.createResponse,
|
|
25
|
+
createSchema: () => require_schema.createSchema,
|
|
26
|
+
createSource: () => require_schema.createSource,
|
|
27
|
+
createText: () => require_schema.createText,
|
|
28
|
+
createType: () => require_schema.createType,
|
|
29
|
+
createTypeLiteral: () => require_schema.createTypeLiteral,
|
|
30
30
|
update: () => update
|
|
31
31
|
});
|
|
32
32
|
/**
|
|
@@ -34,10 +34,10 @@ var factory_exports = /* @__PURE__ */ require_response.__exportAll({
|
|
|
34
34
|
* `changes` already equals (by reference) the current value, otherwise a new node
|
|
35
35
|
* with the changes applied.
|
|
36
36
|
*
|
|
37
|
-
* Mirrors the TypeScript compiler's `factory.updateX` contract
|
|
38
|
-
* structural sharing in {@link transform} so a no-op rewrite
|
|
39
|
-
* downstream passes can detect "nothing changed" by identity. Comparison is
|
|
40
|
-
*
|
|
37
|
+
* Mirrors the TypeScript compiler's `factory.updateX` contract. Pair it with the
|
|
38
|
+
* structural sharing in {@link transform} so a no-op rewrite does not allocate and
|
|
39
|
+
* downstream passes can detect "nothing changed" by identity. Comparison is shallow,
|
|
40
|
+
* so a structurally equal but newly allocated array or object counts as a change.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```ts
|
|
@@ -53,31 +53,31 @@ function update(node, changes) {
|
|
|
53
53
|
return node;
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
|
-
exports.createArrowFunction =
|
|
57
|
-
exports.createBreak =
|
|
58
|
-
exports.createConst =
|
|
59
|
-
exports.createContent =
|
|
60
|
-
exports.createExport =
|
|
61
|
-
exports.createFile =
|
|
62
|
-
exports.createFunction =
|
|
63
|
-
exports.createFunctionParameter =
|
|
64
|
-
exports.createFunctionParameters =
|
|
65
|
-
exports.createImport =
|
|
66
|
-
exports.createIndexedAccessType =
|
|
67
|
-
exports.createInput =
|
|
68
|
-
exports.createJsx =
|
|
69
|
-
exports.createObjectBindingPattern =
|
|
70
|
-
exports.createOperation =
|
|
71
|
-
exports.createOutput =
|
|
72
|
-
exports.createParameter =
|
|
73
|
-
exports.createProperty =
|
|
74
|
-
exports.createRequestBody =
|
|
75
|
-
exports.createResponse =
|
|
76
|
-
exports.createSchema =
|
|
77
|
-
exports.createSource =
|
|
78
|
-
exports.createText =
|
|
79
|
-
exports.createType =
|
|
80
|
-
exports.createTypeLiteral =
|
|
56
|
+
exports.createArrowFunction = require_schema.createArrowFunction;
|
|
57
|
+
exports.createBreak = require_schema.createBreak;
|
|
58
|
+
exports.createConst = require_schema.createConst;
|
|
59
|
+
exports.createContent = require_schema.createContent;
|
|
60
|
+
exports.createExport = require_schema.createExport;
|
|
61
|
+
exports.createFile = require_schema.createFile;
|
|
62
|
+
exports.createFunction = require_schema.createFunction;
|
|
63
|
+
exports.createFunctionParameter = require_schema.createFunctionParameter;
|
|
64
|
+
exports.createFunctionParameters = require_schema.createFunctionParameters;
|
|
65
|
+
exports.createImport = require_schema.createImport;
|
|
66
|
+
exports.createIndexedAccessType = require_schema.createIndexedAccessType;
|
|
67
|
+
exports.createInput = require_schema.createInput;
|
|
68
|
+
exports.createJsx = require_schema.createJsx;
|
|
69
|
+
exports.createObjectBindingPattern = require_schema.createObjectBindingPattern;
|
|
70
|
+
exports.createOperation = require_schema.createOperation;
|
|
71
|
+
exports.createOutput = require_schema.createOutput;
|
|
72
|
+
exports.createParameter = require_schema.createParameter;
|
|
73
|
+
exports.createProperty = require_schema.createProperty;
|
|
74
|
+
exports.createRequestBody = require_schema.createRequestBody;
|
|
75
|
+
exports.createResponse = require_schema.createResponse;
|
|
76
|
+
exports.createSchema = require_schema.createSchema;
|
|
77
|
+
exports.createSource = require_schema.createSource;
|
|
78
|
+
exports.createText = require_schema.createText;
|
|
79
|
+
exports.createType = require_schema.createType;
|
|
80
|
+
exports.createTypeLiteral = require_schema.createTypeLiteral;
|
|
81
81
|
Object.defineProperty(exports, "factory_exports", {
|
|
82
82
|
enumerable: true,
|
|
83
83
|
get: function() {
|
package/dist/factory.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.cjs","names":[],"sources":["../src/factory.ts"],"sourcesContent":["import type { Node } from './nodes/index.ts'\n\n// Node constructors, grouped under the `factory` namespace the way the TypeScript compiler exposes\n// `ts.factory.createX`. Aggregating them here lets `export * as factory from './factory.ts'` in the\n// barrel surface every `createX` alongside the `createFile`/`update` helpers from a single module.\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './nodes/code.ts'\nexport { createContent } from './nodes/content.ts'\nexport { createExport, createFile, createImport, createSource } from './nodes/file.ts'\nexport type { UserFileNode } from './nodes/file.ts'\nexport { createFunctionParameter, createFunctionParameters, createIndexedAccessType, createObjectBindingPattern, createTypeLiteral } from './nodes/function.ts'\nexport { createInput } from './nodes/input.ts'\nexport { createOperation } from './nodes/operation.ts'\nexport { createOutput } from './nodes/output.ts'\nexport { createParameter } from './nodes/parameter.ts'\nexport { createProperty } from './nodes/property.ts'\nexport { createRequestBody } from './nodes/requestBody.ts'\nexport { createResponse } from './nodes/response.ts'\nexport { createSchema } from './nodes/schema.ts'\n\n/**\n * Identity-preserving node update: returns `node` unchanged when every field in\n * `changes` already equals (by reference) the current value, otherwise a new node\n * with the changes applied.\n *\n * Mirrors the TypeScript compiler's `factory.updateX` contract
|
|
1
|
+
{"version":3,"file":"factory.cjs","names":[],"sources":["../src/factory.ts"],"sourcesContent":["import type { Node } from './nodes/index.ts'\n\n// Node constructors, grouped under the `factory` namespace the way the TypeScript compiler exposes\n// `ts.factory.createX`. Aggregating them here lets `export * as factory from './factory.ts'` in the\n// barrel surface every `createX` alongside the `createFile`/`update` helpers from a single module.\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './nodes/code.ts'\nexport { createContent } from './nodes/content.ts'\nexport { createExport, createFile, createImport, createSource } from './nodes/file.ts'\nexport type { UserFileNode } from './nodes/file.ts'\nexport { createFunctionParameter, createFunctionParameters, createIndexedAccessType, createObjectBindingPattern, createTypeLiteral } from './nodes/function.ts'\nexport { createInput } from './nodes/input.ts'\nexport { createOperation } from './nodes/operation.ts'\nexport { createOutput } from './nodes/output.ts'\nexport { createParameter } from './nodes/parameter.ts'\nexport { createProperty } from './nodes/property.ts'\nexport { createRequestBody } from './nodes/requestBody.ts'\nexport { createResponse } from './nodes/response.ts'\nexport { createSchema } from './nodes/schema.ts'\n\n/**\n * Identity-preserving node update: returns `node` unchanged when every field in\n * `changes` already equals (by reference) the current value, otherwise a new node\n * with the changes applied.\n *\n * Mirrors the TypeScript compiler's `factory.updateX` contract. Pair it with the\n * structural sharing in {@link transform} so a no-op rewrite does not allocate and\n * downstream passes can detect \"nothing changed\" by identity. Comparison is shallow,\n * so a structurally equal but newly allocated array or object counts as a change.\n *\n * @example\n * ```ts\n * update(node, { name: node.name }) // -> same `node` reference\n * update(node, { name: 'renamed' }) // -> new node, `name` replaced\n * ```\n */\nexport function update<T extends Node>(node: T, changes: Partial<T>): T {\n for (const key in changes) {\n if (changes[key] !== node[key as keyof T]) {\n return { ...node, ...changes }\n }\n }\n\n return node\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,OAAuB,MAAS,SAAwB;CACtE,KAAK,MAAM,OAAO,SAChB,IAAI,QAAQ,SAAS,KAAK,MACxB,OAAO;EAAE,GAAG;EAAM,GAAG;CAAQ;CAIjC,OAAO;AACT"}
|
package/dist/factory.d.ts
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/factory.d.ts
|
|
5
|
-
declare namespace factory_d_exports {
|
|
6
|
-
export { UserFileNode, createArrowFunction, createBreak, createConst, createContent, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createIndexedAccessType, createInput, createJsx, createObjectBindingPattern, createOperation, createOutput, createParameter, createProperty, createRequestBody, createResponse, createSchema, createSource, createText, createType, createTypeLiteral, update };
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Identity-preserving node update: returns `node` unchanged when every field in
|
|
10
|
-
* `changes` already equals (by reference) the current value, otherwise a new node
|
|
11
|
-
* with the changes applied.
|
|
12
|
-
*
|
|
13
|
-
* Mirrors the TypeScript compiler's `factory.updateX` contract, pair it with the
|
|
14
|
-
* structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
|
|
15
|
-
* downstream passes can detect "nothing changed" by identity. Comparison is
|
|
16
|
-
* shallow: a structurally-equal but newly-allocated array/object counts as a change.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* update(node, { name: node.name }) // -> same `node` reference
|
|
21
|
-
* update(node, { name: 'renamed' }) // -> new node, `name` replaced
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare function update<T extends Node>(node: T, changes: Partial<T>): T;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { type UserFileNode, createArrowFunction, createBreak, createConst, createContent, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createIndexedAccessType, createInput, createJsx, createObjectBindingPattern, createOperation, createOutput, createParameter, createProperty, createRequestBody, createResponse, createSchema, createSource, createText, createType, createTypeLiteral, factory_d_exports as t, update };
|
|
27
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
1
|
+
import { F as createFunctionParameters, Gt as createBreak, I as createIndexedAccessType, J as UserFileNode, Jt as createJsx, Kt as createConst, L as createObjectBindingPattern, Ot as createProperty, P as createFunctionParameter, Q as createSource, R as createTypeLiteral, Wt as createArrowFunction, X as createFile, Xt as createType, Y as createExport, Yt as createText, Z as createImport, _ as createResponse, at as createContent, b as createRequestBody, p as createOperation, qt as createFunction, r as createOutput, s as createInput, w as createParameter, wt as createSchema } from "./index-BKD4drsX.js";
|
|
2
|
+
import { n as update } from "./factory-wJLzHeXT.js";
|
|
3
|
+
export { type UserFileNode, createArrowFunction, createBreak, createConst, createContent, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createIndexedAccessType, createInput, createJsx, createObjectBindingPattern, createOperation, createOutput, createParameter, createProperty, createRequestBody, createResponse, createSchema, createSource, createText, createType, createTypeLiteral, update };
|
package/dist/factory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./
|
|
2
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
+
import { A as createImport, B as createContent, G as createBreak, J as createJsx, K as createConst, O as createExport, S as createTypeLiteral, W as createArrowFunction, X as createType, Y as createText, a as createProperty, b as createIndexedAccessType, f as createOperation, g as createInput, j as createSource, k as createFile, m as createRequestBody, q as createFunction, r as createResponse, s as createParameter, t as createSchema, u as createOutput, v as createFunctionParameter, x as createObjectBindingPattern, y as createFunctionParameters } from "./schema-YNbOtTCM.js";
|
|
3
3
|
//#region src/factory.ts
|
|
4
4
|
var factory_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
createArrowFunction: () => createArrowFunction,
|
|
@@ -34,10 +34,10 @@ var factory_exports = /* @__PURE__ */ __exportAll({
|
|
|
34
34
|
* `changes` already equals (by reference) the current value, otherwise a new node
|
|
35
35
|
* with the changes applied.
|
|
36
36
|
*
|
|
37
|
-
* Mirrors the TypeScript compiler's `factory.updateX` contract
|
|
38
|
-
* structural sharing in {@link transform} so a no-op rewrite
|
|
39
|
-
* downstream passes can detect "nothing changed" by identity. Comparison is
|
|
40
|
-
*
|
|
37
|
+
* Mirrors the TypeScript compiler's `factory.updateX` contract. Pair it with the
|
|
38
|
+
* structural sharing in {@link transform} so a no-op rewrite does not allocate and
|
|
39
|
+
* downstream passes can detect "nothing changed" by identity. Comparison is shallow,
|
|
40
|
+
* so a structurally equal but newly allocated array or object counts as a change.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```ts
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","names":[],"sources":["../src/factory.ts"],"sourcesContent":["import type { Node } from './nodes/index.ts'\n\n// Node constructors, grouped under the `factory` namespace the way the TypeScript compiler exposes\n// `ts.factory.createX`. Aggregating them here lets `export * as factory from './factory.ts'` in the\n// barrel surface every `createX` alongside the `createFile`/`update` helpers from a single module.\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './nodes/code.ts'\nexport { createContent } from './nodes/content.ts'\nexport { createExport, createFile, createImport, createSource } from './nodes/file.ts'\nexport type { UserFileNode } from './nodes/file.ts'\nexport { createFunctionParameter, createFunctionParameters, createIndexedAccessType, createObjectBindingPattern, createTypeLiteral } from './nodes/function.ts'\nexport { createInput } from './nodes/input.ts'\nexport { createOperation } from './nodes/operation.ts'\nexport { createOutput } from './nodes/output.ts'\nexport { createParameter } from './nodes/parameter.ts'\nexport { createProperty } from './nodes/property.ts'\nexport { createRequestBody } from './nodes/requestBody.ts'\nexport { createResponse } from './nodes/response.ts'\nexport { createSchema } from './nodes/schema.ts'\n\n/**\n * Identity-preserving node update: returns `node` unchanged when every field in\n * `changes` already equals (by reference) the current value, otherwise a new node\n * with the changes applied.\n *\n * Mirrors the TypeScript compiler's `factory.updateX` contract
|
|
1
|
+
{"version":3,"file":"factory.js","names":[],"sources":["../src/factory.ts"],"sourcesContent":["import type { Node } from './nodes/index.ts'\n\n// Node constructors, grouped under the `factory` namespace the way the TypeScript compiler exposes\n// `ts.factory.createX`. Aggregating them here lets `export * as factory from './factory.ts'` in the\n// barrel surface every `createX` alongside the `createFile`/`update` helpers from a single module.\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './nodes/code.ts'\nexport { createContent } from './nodes/content.ts'\nexport { createExport, createFile, createImport, createSource } from './nodes/file.ts'\nexport type { UserFileNode } from './nodes/file.ts'\nexport { createFunctionParameter, createFunctionParameters, createIndexedAccessType, createObjectBindingPattern, createTypeLiteral } from './nodes/function.ts'\nexport { createInput } from './nodes/input.ts'\nexport { createOperation } from './nodes/operation.ts'\nexport { createOutput } from './nodes/output.ts'\nexport { createParameter } from './nodes/parameter.ts'\nexport { createProperty } from './nodes/property.ts'\nexport { createRequestBody } from './nodes/requestBody.ts'\nexport { createResponse } from './nodes/response.ts'\nexport { createSchema } from './nodes/schema.ts'\n\n/**\n * Identity-preserving node update: returns `node` unchanged when every field in\n * `changes` already equals (by reference) the current value, otherwise a new node\n * with the changes applied.\n *\n * Mirrors the TypeScript compiler's `factory.updateX` contract. Pair it with the\n * structural sharing in {@link transform} so a no-op rewrite does not allocate and\n * downstream passes can detect \"nothing changed\" by identity. Comparison is shallow,\n * so a structurally equal but newly allocated array or object counts as a change.\n *\n * @example\n * ```ts\n * update(node, { name: node.name }) // -> same `node` reference\n * update(node, { name: 'renamed' }) // -> new node, `name` replaced\n * ```\n */\nexport function update<T extends Node>(node: T, changes: Partial<T>): T {\n for (const key in changes) {\n if (changes[key] !== node[key as keyof T]) {\n return { ...node, ...changes }\n }\n }\n\n return node\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,OAAuB,MAAS,SAAwB;CACtE,KAAK,MAAM,OAAO,SAChB,IAAI,QAAQ,SAAS,KAAK,MACxB,OAAO;EAAE,GAAG;EAAM,GAAG;CAAQ;CAIjC,OAAO;AACT"}
|