@kubb/ast 5.0.0-beta.93 → 5.0.0-beta.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +47 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +38 -21
- package/dist/index.js +46 -12
- package/dist/index.js.map +1 -1
- package/dist/{types-Dno_xT4x.d.ts → types-CqXMgUzC.d.ts} +32 -24
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
|
|
3
2
|
//#region src/constants.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Traversal depth for AST visitor utilities.
|
|
6
5
|
*
|
|
7
|
-
* - `'shallow'`
|
|
8
|
-
*
|
|
6
|
+
* - `'shallow'` recurses through every node except nested `Schema` subtrees, which it treats as
|
|
7
|
+
* leaves: a schema node itself is visited, but its children are not.
|
|
8
|
+
* - `'deep'` recursively visits all descendant nodes, including schema subtrees.
|
|
9
9
|
*/
|
|
10
10
|
type VisitorDepth = 'shallow' | 'deep';
|
|
11
11
|
/**
|
|
@@ -322,7 +322,7 @@ type TypeNode = BaseNode & {
|
|
|
322
322
|
*
|
|
323
323
|
* @example
|
|
324
324
|
* ```ts
|
|
325
|
-
*
|
|
325
|
+
* createFunction({ name: 'getPet', export: true, async: true, returnType: 'Pet' })
|
|
326
326
|
* // export async function getPet(): Promise<Pet> { ... }
|
|
327
327
|
* ```
|
|
328
328
|
*/
|
|
@@ -383,7 +383,7 @@ type FunctionNode = BaseNode & {
|
|
|
383
383
|
*
|
|
384
384
|
* @example
|
|
385
385
|
* ```ts
|
|
386
|
-
*
|
|
386
|
+
* createArrowFunction({ name: 'getPet', export: true, singleLine: true })
|
|
387
387
|
* // export const getPet = () => ...
|
|
388
388
|
* ```
|
|
389
389
|
*/
|
|
@@ -760,55 +760,55 @@ type PrimitiveSchemaType =
|
|
|
760
760
|
/**
|
|
761
761
|
* Text value.
|
|
762
762
|
*/
|
|
763
|
-
'string'
|
|
763
|
+
'string' |
|
|
764
764
|
/**
|
|
765
765
|
* Floating-point number.
|
|
766
766
|
*/
|
|
767
|
-
|
|
767
|
+
'number' |
|
|
768
768
|
/**
|
|
769
769
|
* Integer number.
|
|
770
770
|
*/
|
|
771
|
-
|
|
771
|
+
'integer' |
|
|
772
772
|
/**
|
|
773
773
|
* Big integer number.
|
|
774
774
|
*/
|
|
775
|
-
|
|
775
|
+
'bigint' |
|
|
776
776
|
/**
|
|
777
777
|
* Boolean value.
|
|
778
778
|
*/
|
|
779
|
-
|
|
779
|
+
'boolean' |
|
|
780
780
|
/**
|
|
781
781
|
* Null value.
|
|
782
782
|
*/
|
|
783
|
-
|
|
783
|
+
'null' |
|
|
784
784
|
/**
|
|
785
785
|
* Any value.
|
|
786
786
|
*/
|
|
787
|
-
|
|
787
|
+
'any' |
|
|
788
788
|
/**
|
|
789
789
|
* Unknown value.
|
|
790
790
|
*/
|
|
791
|
-
|
|
791
|
+
'unknown' |
|
|
792
792
|
/**
|
|
793
793
|
* No value (`void`).
|
|
794
794
|
*/
|
|
795
|
-
|
|
795
|
+
'void' |
|
|
796
796
|
/**
|
|
797
797
|
* Never value.
|
|
798
798
|
*/
|
|
799
|
-
|
|
799
|
+
'never' |
|
|
800
800
|
/**
|
|
801
801
|
* Object value.
|
|
802
802
|
*/
|
|
803
|
-
|
|
803
|
+
'object' |
|
|
804
804
|
/**
|
|
805
805
|
* Array value.
|
|
806
806
|
*/
|
|
807
|
-
|
|
807
|
+
'array' |
|
|
808
808
|
/**
|
|
809
809
|
* Date value.
|
|
810
810
|
*/
|
|
811
|
-
|
|
811
|
+
'date';
|
|
812
812
|
/**
|
|
813
813
|
* Composite schema types.
|
|
814
814
|
*/
|
|
@@ -824,7 +824,7 @@ type SchemaType = PrimitiveSchemaType | ComplexSchemaType | SpecialSchemaType;
|
|
|
824
824
|
/**
|
|
825
825
|
* Scalar schema types without extra object/array/ref structure.
|
|
826
826
|
*/
|
|
827
|
-
type ScalarSchemaType = Exclude<SchemaType, 'object' | 'array' | 'tuple' | 'union' | 'intersection' | 'enum' | 'ref' | 'datetime' | 'date' | 'time' | 'string' | 'number' | 'integer' | 'bigint' | 'url' | 'uuid' | 'email'>;
|
|
827
|
+
type ScalarSchemaType = Exclude<SchemaType, 'object' | 'array' | 'tuple' | 'union' | 'intersection' | 'enum' | 'ref' | 'datetime' | 'date' | 'time' | 'string' | 'number' | 'integer' | 'bigint' | 'url' | 'uuid' | 'email' | 'ipv4' | 'ipv6'>;
|
|
828
828
|
/**
|
|
829
829
|
* Fields shared by all schema nodes.
|
|
830
830
|
*/
|
|
@@ -1106,6 +1106,13 @@ type RefSchemaNode = SchemaNodeBase & {
|
|
|
1106
1106
|
* Used to resolve names later.
|
|
1107
1107
|
*/
|
|
1108
1108
|
ref?: string;
|
|
1109
|
+
/**
|
|
1110
|
+
* Emitted name of the referenced schema when it differs from the pointer's last segment,
|
|
1111
|
+
* for example after a collision rename (`Order` becomes `OrderSchema`) or a macro rename.
|
|
1112
|
+
* Resolve display and import names through `resolveRefName`, which prefers this field and
|
|
1113
|
+
* falls back to the pointer segment, then `name`.
|
|
1114
|
+
*/
|
|
1115
|
+
targetName?: string;
|
|
1109
1116
|
/**
|
|
1110
1117
|
* Pattern copied from a sibling `pattern` field.
|
|
1111
1118
|
*/
|
|
@@ -2268,7 +2275,7 @@ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): Ou
|
|
|
2268
2275
|
* }
|
|
2269
2276
|
* ```
|
|
2270
2277
|
*/
|
|
2271
|
-
type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode;
|
|
2278
|
+
type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
|
|
2272
2279
|
//#endregion
|
|
2273
2280
|
//#region src/visitor.d.ts
|
|
2274
2281
|
/**
|
|
@@ -2554,6 +2561,7 @@ declare function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyAr
|
|
|
2554
2561
|
* const context: PrinterHandlerContext<string, {}> = {
|
|
2555
2562
|
* options: {},
|
|
2556
2563
|
* transform: () => 'value',
|
|
2564
|
+
* base: () => 'value',
|
|
2557
2565
|
* }
|
|
2558
2566
|
* ```
|
|
2559
2567
|
*/
|
|
@@ -2608,7 +2616,7 @@ type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = Sch
|
|
|
2608
2616
|
* })
|
|
2609
2617
|
* ```
|
|
2610
2618
|
*/
|
|
2611
|
-
type PrinterPartial<TOutput, TOptions extends object> = Partial<{ [K in SchemaType]: PrinterHandler<TOutput, TOptions, K
|
|
2619
|
+
type PrinterPartial<TOutput, TOptions extends object> = Partial<{ [K in SchemaType]: PrinterHandler<TOutput, TOptions, K>; }>;
|
|
2612
2620
|
/**
|
|
2613
2621
|
* Generic shape used by `definePrinter`.
|
|
2614
2622
|
*
|
|
@@ -2678,13 +2686,13 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
|
|
|
2678
2686
|
* Options to store on the printer.
|
|
2679
2687
|
*/
|
|
2680
2688
|
options: T['options'];
|
|
2681
|
-
nodes: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K
|
|
2689
|
+
nodes: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K>; }>;
|
|
2682
2690
|
/**
|
|
2683
2691
|
* User-supplied handler overrides. An override wins over the matching `nodes` handler,
|
|
2684
2692
|
* and can call `this.base(node)` to reuse the handler it replaced. Pass overrides here
|
|
2685
2693
|
* instead of spreading them into `nodes`, otherwise `this.base` cannot find the original.
|
|
2686
2694
|
*/
|
|
2687
|
-
overrides?: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K
|
|
2695
|
+
overrides?: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K>; }>;
|
|
2688
2696
|
/**
|
|
2689
2697
|
* Optional root-level print override. When provided, becomes the public `printer.print`.
|
|
2690
2698
|
* Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),
|
|
@@ -2736,4 +2744,4 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
|
|
|
2736
2744
|
declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
|
|
2737
2745
|
//#endregion
|
|
2738
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 };
|
|
2739
|
-
//# sourceMappingURL=types-
|
|
2747
|
+
//# sourceMappingURL=types-CqXMgUzC.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-
|
|
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";
|
|
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.
|
|
3
|
+
"version": "5.0.0-beta.95",
|
|
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",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org/"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^22.20.
|
|
45
|
+
"@types/node": "^22.20.1",
|
|
46
46
|
"@internals/utils": "0.0.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|