@kubb/ast 5.0.0-beta.99 → 5.0.1

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.
@@ -2460,20 +2460,37 @@ declare function transform(node: PropertyNode, options: TransformOptions): Prope
2460
2460
  declare function transform(node: ParameterNode, options: TransformOptions): ParameterNode;
2461
2461
  declare function transform(node: ResponseNode, options: TransformOptions): ResponseNode;
2462
2462
  declare function transform(node: Node, options: TransformOptions): Node;
2463
+ /**
2464
+ * Lazy depth-first collection pass. Yields every non-null value returned by
2465
+ * the visitor callbacks. Use `collectSync` for the eager array form.
2466
+ *
2467
+ * @example Collect every operationId
2468
+ * ```ts
2469
+ * const ids: string[] = []
2470
+ * for (const id of collect<string>(root, {
2471
+ * operation(node) {
2472
+ * return node.operationId
2473
+ * },
2474
+ * })) {
2475
+ * ids.push(id)
2476
+ * }
2477
+ * ```
2478
+ */
2479
+ declare function collect<T>(node: Node, options: CollectOptions<T>): Generator<T, void, undefined>;
2463
2480
  /**
2464
2481
  * Eager depth-first collection pass. Gathers every non-null value the visitor
2465
2482
  * callbacks return into an array.
2466
2483
  *
2467
2484
  * @example Collect every operationId
2468
2485
  * ```ts
2469
- * const ids = collect<string>(root, {
2486
+ * const ids = collectSync<string>(root, {
2470
2487
  * operation(node) {
2471
2488
  * return node.operationId
2472
2489
  * },
2473
2490
  * })
2474
2491
  * ```
2475
2492
  */
2476
- declare function collect<T>(node: Node, options: CollectOptions<T>): Array<T>;
2493
+ declare function collectSync<T>(node: Node, options: CollectOptions<T>): Array<T>;
2477
2494
  //#endregion
2478
2495
  //#region src/defineMacro.d.ts
2479
2496
  /**
@@ -2484,8 +2501,8 @@ type Enforce = 'pre' | 'post';
2484
2501
  /**
2485
2502
  * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a
2486
2503
  * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an
2487
- * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter
2488
- * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).
2504
+ * optional `match` predicate. Macros run on the shared AST, so the same macro works across every
2505
+ * adapter and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).
2489
2506
  */
2490
2507
  type Macro = Visitor & {
2491
2508
  /**
@@ -2498,10 +2515,10 @@ type Macro = Visitor & {
2498
2515
  */
2499
2516
  enforce?: Enforce;
2500
2517
  /**
2501
- * Gate checked against the current node before any callback runs. When it returns `false`
2502
- * the macro is skipped for that node.
2518
+ * Predicate checked against the current node before any callback runs. Returning `false`
2519
+ * skips the macro for that node.
2503
2520
  */
2504
- when?: (node: Node) => boolean;
2521
+ match?: (node: Node) => boolean;
2505
2522
  };
2506
2523
  /**
2507
2524
  * Types a macro for inference and a single construction site, mirroring `definePlugin`.
@@ -2743,5 +2760,5 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
2743
2760
  */
2744
2761
  declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
2745
2762
  //#endregion
2746
- export { sourceDef as $, NodeDef as $t, StatusCode as A, BreakNode as At, parameterDef as B, constDef as Bt, GenericOperationNode as C, PropertyNode as Ct, createOperation as D, InferSchemaNode as Dt, OperationNode as E, propertyDef as Et, requestBodyDef as F, JsxNode as Ft, UserFileNode as G, createJsx as Gt, FileNode as H, createBreak as Ht, ParameterLocation as I, TextNode as It, createImport as J, functionDef as Jt, createExport as K, createText as Kt, ParameterNode as L, TypeNode as Lt, responseDef as M, ConstNode as Mt, RequestBodyNode as N, FunctionNode as Nt, operationDef as O, ParserOptions as Ot, createRequestBody as P, JSDocNode as Pt, importDef as Q, DistributiveOmit as Qt, ParameterStyle as R, arrowFunctionDef as Rt, inputDef as S, schemaDef as St, HttpOperationNode as T, createProperty as Tt, ImportNode as U, createConst as Ut, ExportNode as V, createArrowFunction as Vt, SourceNode as W, createFunction as Wt, exportDef as X, textDef as Xt, createSource as Y, jsxDef as Yt, fileDef as Z, typeDef as Zt, createOutput as _, StringSchemaNode as _t, Enforce as a, DatetimeSchemaNode as at, InputNode as b, UrlSchemaNode as bt, composeMacros as c, NumberSchemaNode as ct, Visitor as d, RefSchemaNode as dt, defineNode as en, ContentNode as et, VisitorContext as f, ScalarSchemaNode as ft, OutputNode as g, SchemaType as gt, Node as h, SchemaNodeByType as ht, createPrinter as i, DateSchemaNode as it, createResponse as j, CodeNode as jt, ResponseNode as k, ArrowFunctionNode as kt, defineMacro as l, ObjectSchemaNode as lt, transform as m, SchemaNode as mt, PrinterFactoryOptions as n, NodeKind as nn, createContent as nt, Macro as o, EnumSchemaNode as ot, collect as p, ScalarSchemaType as pt, createFile as q, createType as qt, PrinterPartial as r, schemaTypes as rn, ArraySchemaNode as rt, applyMacros as s, IntersectionSchemaNode as st, Printer as t, BaseNode as tn, contentDef as tt, ParentOf as u, PrimitiveSchemaType as ut, outputDef as v, TimeSchemaNode as vt, HttpMethod as w, UserPropertyNode as wt, createInput as x, createSchema as xt, InputMeta as y, UnionSchemaNode as yt, createParameter as z, breakDef as zt };
2747
- //# sourceMappingURL=types-CqXMgUzC.d.ts.map
2763
+ export { importDef as $, DistributiveOmit as $t, ResponseNode as A, ArrowFunctionNode as At, createParameter as B, breakDef as Bt, inputDef as C, schemaDef as Ct, OperationNode as D, propertyDef as Dt, HttpOperationNode as E, createProperty as Et, createRequestBody as F, JSDocNode as Ft, SourceNode as G, createFunction as Gt, ExportNode as H, createArrowFunction as Ht, requestBodyDef as I, JsxNode as It, createFile as J, createType as Jt, UserFileNode as K, createJsx as Kt, ParameterLocation as L, TextNode as Lt, createResponse as M, CodeNode as Mt, responseDef as N, ConstNode as Nt, createOperation as O, InferSchemaNode as Ot, RequestBodyNode as P, FunctionNode as Pt, fileDef as Q, typeDef as Qt, ParameterNode as R, TypeNode as Rt, createInput as S, createSchema as St, HttpMethod as T, UserPropertyNode as Tt, FileNode as U, createBreak as Ut, parameterDef as V, constDef as Vt, ImportNode as W, createConst as Wt, createSource as X, jsxDef as Xt, createImport as Y, functionDef as Yt, exportDef as Z, textDef as Zt, OutputNode as _, SchemaType as _t, Enforce as a, DateSchemaNode as at, InputMeta as b, UnionSchemaNode as bt, composeMacros as c, IntersectionSchemaNode as ct, Visitor as d, PrimitiveSchemaType as dt, NodeDef as en, sourceDef as et, VisitorContext as f, RefSchemaNode as ft, Node as g, SchemaNodeByType as gt, transform as h, SchemaNode as ht, createPrinter as i, schemaTypes as in, ArraySchemaNode as it, StatusCode as j, BreakNode as jt, operationDef as k, ParserOptions as kt, defineMacro as l, NumberSchemaNode as lt, collectSync as m, ScalarSchemaType as mt, PrinterFactoryOptions as n, BaseNode as nn, contentDef as nt, Macro as o, DatetimeSchemaNode as ot, collect as p, ScalarSchemaNode as pt, createExport as q, createText as qt, PrinterPartial as r, NodeKind as rn, createContent as rt, applyMacros as s, EnumSchemaNode as st, Printer as t, defineNode as tn, ContentNode as tt, ParentOf as u, ObjectSchemaNode as ut, createOutput as v, StringSchemaNode as vt, GenericOperationNode as w, PropertyNode as wt, InputNode as x, UrlSchemaNode as xt, outputDef as y, TimeSchemaNode as yt, ParameterStyle as z, arrowFunctionDef as zt };
2764
+ //# sourceMappingURL=types-BPqinVNh.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- 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";
1
+ import { $t as DistributiveOmit, A as ResponseNode, At as ArrowFunctionNode, D as OperationNode, E as HttpOperationNode, Ft as JSDocNode, G as SourceNode, H as ExportNode, It as JsxNode, K as UserFileNode, L as ParameterLocation, Lt as TextNode, Mt as CodeNode, Nt as ConstNode, Ot as InferSchemaNode, P as RequestBodyNode, Pt as FunctionNode, R as ParameterNode, Rt as TypeNode, T as HttpMethod, U as FileNode, W as ImportNode, _ as OutputNode, _t as SchemaType, a as Enforce, at as DateSchemaNode, b as InputMeta, bt as UnionSchemaNode, ct as IntersectionSchemaNode, d as Visitor, dt as PrimitiveSchemaType, en as NodeDef, f as VisitorContext, ft as RefSchemaNode, g as Node, gt as SchemaNodeByType, ht as SchemaNode, it as ArraySchemaNode, j as StatusCode, jt as BreakNode, kt as ParserOptions, lt as NumberSchemaNode, mt as ScalarSchemaType, n as PrinterFactoryOptions, o as Macro, ot as DatetimeSchemaNode, pt as ScalarSchemaNode, r as PrinterPartial, rn as NodeKind, st as EnumSchemaNode, t as Printer, tt as ContentNode, u as ParentOf, ut as ObjectSchemaNode, vt as StringSchemaNode, w as GenericOperationNode, wt as PropertyNode, x as InputNode, xt as UrlSchemaNode, yt as TimeSchemaNode, z as ParameterStyle } from "./types-BPqinVNh.js";
2
2
  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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/ast",
3
- "version": "5.0.0-beta.99",
3
+ "version": "5.0.1",
4
4
  "description": "Spec-agnostic AST layer for Kubb. Defines the node tree, visitor pattern, factory functions, and type guards used across all code generation plugins.",
5
5
  "keywords": [
6
6
  "ast",
@@ -9,6 +9,7 @@
9
9
  "meta-framework",
10
10
  "typescript"
11
11
  ],
12
+ "homepage": "https://kubb.dev",
12
13
  "license": "MIT",
13
14
  "author": "stijnvanhulle",
14
15
  "repository": {
@@ -16,6 +17,16 @@
16
17
  "url": "git+https://github.com/kubb-labs/kubb.git",
17
18
  "directory": "packages/ast"
18
19
  },
20
+ "funding": [
21
+ {
22
+ "type": "github",
23
+ "url": "https://github.com/sponsors/stijnvanhulle"
24
+ },
25
+ {
26
+ "type": "opencollective",
27
+ "url": "https://opencollective.com/kubb"
28
+ }
29
+ ],
19
30
  "files": [
20
31
  "dist",
21
32
  "!/**/**.test.**",
@@ -43,7 +54,7 @@
43
54
  },
44
55
  "devDependencies": {
45
56
  "@types/node": "^22.20.1",
46
- "@internals/utils": "0.0.0"
57
+ "@internals/utils": "0.0.1"
47
58
  },
48
59
  "engines": {
49
60
  "node": ">=22"