@kubb/ast 5.8.4 → 5.9.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.
- package/README.md +6 -7
- package/dist/index.cjs +1088 -1260
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -78
- package/dist/index.js +1088 -1238
- package/dist/index.js.map +1 -1
- package/dist/{types-C8GhOW_5.d.ts → types-DrSRvdtW.d.ts} +35 -203
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -144,85 +144,8 @@ type BaseNode = {
|
|
|
144
144
|
*/
|
|
145
145
|
kind: NodeKind;
|
|
146
146
|
};
|
|
147
|
-
|
|
148
|
-
//#region src/defineNode.d.ts
|
|
149
|
-
/**
|
|
150
|
-
* Visitor callback names, one per traversable node kind, in traversal order.
|
|
151
|
-
* Kept in sync with the keys of `Visitor` in `visitor.ts`.
|
|
152
|
-
*/
|
|
153
|
-
declare const visitorKeys: readonly ["input", "output", "operation", "schema", "property", "parameter", "response"];
|
|
154
|
-
/**
|
|
155
|
-
* One of the {@link visitorKeys} callback names.
|
|
156
|
-
*/
|
|
157
|
-
type VisitorKey = (typeof visitorKeys)[number];
|
|
158
|
-
/**
|
|
159
|
-
* Distributive `Omit` that preserves each member of a union.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```ts
|
|
163
|
-
* type A = { kind: 'a'; keep: string; drop: number }
|
|
164
|
-
* type B = { kind: 'b'; keep: boolean; drop: number }
|
|
165
|
-
* type Result = DistributiveOmit<A | B, 'drop'>
|
|
166
|
-
* // -> { kind: 'a'; keep: string } | { kind: 'b'; keep: boolean }
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
147
|
+
/** `Omit` applied to each member of a union, so the union survives. */
|
|
169
148
|
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
170
|
-
/**
|
|
171
|
-
* The single definition derived from one {@link defineNode} call: the node's
|
|
172
|
-
* `create` builder, its `is` guard, and the traversal metadata the registry
|
|
173
|
-
* collects into the visitor tables.
|
|
174
|
-
*/
|
|
175
|
-
type NodeDef<TNode extends BaseNode = BaseNode, TInput = never> = {
|
|
176
|
-
/**
|
|
177
|
-
* Node discriminator this definition owns.
|
|
178
|
-
*/
|
|
179
|
-
kind: NodeKind;
|
|
180
|
-
/**
|
|
181
|
-
* Builds a node from its input, applying `defaults` and the optional `build` hook.
|
|
182
|
-
*/
|
|
183
|
-
create: (input: TInput) => TNode;
|
|
184
|
-
/**
|
|
185
|
-
* Type guard matching this node kind.
|
|
186
|
-
*/
|
|
187
|
-
is: (node: unknown) => node is TNode;
|
|
188
|
-
/**
|
|
189
|
-
* Child node fields in traversal order. Feeds `VISITOR_KEYS`.
|
|
190
|
-
*/
|
|
191
|
-
children?: ReadonlyArray<string>;
|
|
192
|
-
/**
|
|
193
|
-
* Visitor callback name. Feeds `VISITOR_KEY_BY_KIND`.
|
|
194
|
-
*/
|
|
195
|
-
visitorKey?: VisitorKey;
|
|
196
|
-
};
|
|
197
|
-
type DefineNodeConfig<TNode extends BaseNode, TInput, TBuilt extends object> = {
|
|
198
|
-
kind: TNode['kind'];
|
|
199
|
-
defaults?: Partial<TNode>;
|
|
200
|
-
build?: (input: TInput) => TBuilt;
|
|
201
|
-
children?: ReadonlyArray<string>;
|
|
202
|
-
visitorKey?: VisitorKey;
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Defines a node once and derives its `create` builder, `is` guard, and traversal
|
|
206
|
-
* metadata. `create` merges `defaults`, the `build` hook (or the raw input), and the
|
|
207
|
-
* `kind`, so node construction lives in one place without scattered `as` casts.
|
|
208
|
-
*
|
|
209
|
-
* @example Simple node
|
|
210
|
-
* ```ts
|
|
211
|
-
* const importDef = defineNode<ImportNode>({ kind: 'Import' })
|
|
212
|
-
* const createImport = importDef.create
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* @example Node with a build hook
|
|
216
|
-
* ```ts
|
|
217
|
-
* const propertyDef = defineNode<PropertyNode, UserPropertyNode>({
|
|
218
|
-
* kind: 'Property',
|
|
219
|
-
* build: (props) => ({ ...props, required: props.required ?? false }),
|
|
220
|
-
* children: ['schema'],
|
|
221
|
-
* visitorKey: 'property',
|
|
222
|
-
* })
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
declare function defineNode<TNode extends BaseNode, TInput = Omit<TNode, 'kind'>, TBuilt extends object = Omit<TNode, 'kind'>>(config: DefineNodeConfig<TNode, TInput, TBuilt>): NodeDef<TNode, TInput>;
|
|
226
149
|
//#endregion
|
|
227
150
|
//#region src/infer.d.ts
|
|
228
151
|
/**
|
|
@@ -268,7 +191,8 @@ type ParserOptions = {
|
|
|
268
191
|
*/
|
|
269
192
|
dateType: DateTimeTypeValue | DateTypeOptions;
|
|
270
193
|
/**
|
|
271
|
-
* How `
|
|
194
|
+
* How a schema with `format: 'int64'` or `format: 'uint64'` maps to TypeScript. Other
|
|
195
|
+
* integers always map to `number`.
|
|
272
196
|
* - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
|
|
273
197
|
* - `'number'` fits most JSON APIs. Loses precision above `Number.MAX_SAFE_INTEGER`.
|
|
274
198
|
*
|
|
@@ -435,12 +359,8 @@ type PropertyNode = BaseNode & {
|
|
|
435
359
|
*/
|
|
436
360
|
type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>;
|
|
437
361
|
/**
|
|
438
|
-
*
|
|
362
|
+
* Creates a `PropertyNode`. `required` defaults to `false`, and the schema's
|
|
439
363
|
* `optional`/`nullish` flags are derived from it through {@link withRequired}.
|
|
440
|
-
*/
|
|
441
|
-
declare const propertyDef: NodeDef<PropertyNode, UserPropertyNode>;
|
|
442
|
-
/**
|
|
443
|
-
* Creates a `PropertyNode`.
|
|
444
364
|
*
|
|
445
365
|
* @example
|
|
446
366
|
* ```ts
|
|
@@ -452,7 +372,7 @@ declare const propertyDef: NodeDef<PropertyNode, UserPropertyNode>;
|
|
|
452
372
|
* // required=true, no optional/nullish
|
|
453
373
|
* ```
|
|
454
374
|
*/
|
|
455
|
-
declare
|
|
375
|
+
declare function createProperty(input: UserPropertyNode): PropertyNode;
|
|
456
376
|
//#endregion
|
|
457
377
|
//#region src/nodes/schema.d.ts
|
|
458
378
|
type PrimitiveSchemaType =
|
|
@@ -1065,12 +985,8 @@ type CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & {
|
|
|
1065
985
|
kind: 'Schema';
|
|
1066
986
|
};
|
|
1067
987
|
/**
|
|
1068
|
-
*
|
|
1069
|
-
* empty array, and `primitive` is inferred from `type` when not explicitly provided.
|
|
1070
|
-
*/
|
|
1071
|
-
declare const schemaDef: NodeDef<SchemaNode, CreateSchemaInput>;
|
|
1072
|
-
/**
|
|
1073
|
-
* Creates a `SchemaNode`, narrowed to the variant of `props.type`.
|
|
988
|
+
* Creates a `SchemaNode`, narrowed to the variant of `props.type`. Object schemas default
|
|
989
|
+
* `properties` to an empty array, and `primitive` is inferred from `type` when not explicitly provided.
|
|
1074
990
|
*
|
|
1075
991
|
* @example
|
|
1076
992
|
* ```ts
|
|
@@ -1138,12 +1054,8 @@ type ParameterNode = BaseNode & {
|
|
|
1138
1054
|
};
|
|
1139
1055
|
type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
|
|
1140
1056
|
/**
|
|
1141
|
-
*
|
|
1057
|
+
* Creates a `ParameterNode`. `required` defaults to `false`, and the schema's
|
|
1142
1058
|
* `optional`/`nullish` flags are derived from it through {@link withRequired}.
|
|
1143
|
-
*/
|
|
1144
|
-
declare const parameterDef: NodeDef<ParameterNode, UserParameterNode>;
|
|
1145
|
-
/**
|
|
1146
|
-
* Creates a `ParameterNode`.
|
|
1147
1059
|
*
|
|
1148
1060
|
* @example
|
|
1149
1061
|
* ```ts
|
|
@@ -1155,7 +1067,7 @@ declare const parameterDef: NodeDef<ParameterNode, UserParameterNode>;
|
|
|
1155
1067
|
* })
|
|
1156
1068
|
* ```
|
|
1157
1069
|
*/
|
|
1158
|
-
declare
|
|
1070
|
+
declare function createParameter(input: UserParameterNode): ParameterNode;
|
|
1159
1071
|
//#endregion
|
|
1160
1072
|
//#region src/nodes/content.d.ts
|
|
1161
1073
|
/**
|
|
@@ -1192,14 +1104,10 @@ type ContentNode = BaseNode & {
|
|
|
1192
1104
|
*/
|
|
1193
1105
|
keysToOmit?: Array<string> | null;
|
|
1194
1106
|
};
|
|
1195
|
-
/**
|
|
1196
|
-
* Definition for the {@link ContentNode}.
|
|
1197
|
-
*/
|
|
1198
|
-
declare const contentDef: NodeDef<ContentNode, Omit<ContentNode, "kind">>;
|
|
1199
1107
|
/**
|
|
1200
1108
|
* Creates a `ContentNode` for a single request-body or response content type.
|
|
1201
1109
|
*/
|
|
1202
|
-
declare
|
|
1110
|
+
declare function createContent(input: Omit<ContentNode, 'kind'>): ContentNode;
|
|
1203
1111
|
//#endregion
|
|
1204
1112
|
//#region src/nodes/requestBody.d.ts
|
|
1205
1113
|
/**
|
|
@@ -1238,26 +1146,17 @@ type RequestBodyNode = BaseNode & {
|
|
|
1238
1146
|
*/
|
|
1239
1147
|
content?: Array<ContentNode>;
|
|
1240
1148
|
};
|
|
1241
|
-
/**
|
|
1242
|
-
* Definition for the {@link RequestBodyNode}. Content entries are built upfront with
|
|
1243
|
-
* {@link createContent}, mirroring how `parameters` and `responses` take prebuilt nodes.
|
|
1244
|
-
*/
|
|
1245
|
-
declare const requestBodyDef: NodeDef<RequestBodyNode, Omit<RequestBodyNode, "kind">>;
|
|
1246
1149
|
/**
|
|
1247
1150
|
* Creates a `RequestBodyNode`.
|
|
1248
1151
|
*/
|
|
1249
|
-
declare
|
|
1152
|
+
declare function createRequestBody(input: Omit<RequestBodyNode, 'kind'>): RequestBodyNode;
|
|
1250
1153
|
//#endregion
|
|
1251
1154
|
//#region src/nodes/response.d.ts
|
|
1252
|
-
|
|
1253
|
-
* All supported HTTP status code literals as strings, as used in API specs
|
|
1254
|
-
* (for example, `"200"` and `"404"`).
|
|
1255
|
-
*/
|
|
1256
|
-
type HttpStatusCode = '100' | '101' | '102' | '103' | '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' | '300' | '301' | '302' | '303' | '304' | '305' | '307' | '308' | '400' | '401' | '402' | '403' | '404' | '405' | '406' | '407' | '408' | '409' | '410' | '411' | '412' | '413' | '414' | '415' | '416' | '417' | '418' | '421' | '422' | '423' | '424' | '425' | '426' | '428' | '429' | '431' | '451' | '500' | '501' | '502' | '503' | '504' | '505' | '506' | '507' | '508' | '510' | '511';
|
|
1155
|
+
type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
1257
1156
|
/**
|
|
1258
1157
|
* Response status code literal used by operations.
|
|
1259
1158
|
*
|
|
1260
|
-
* Includes
|
|
1159
|
+
* Includes three-digit HTTP status code strings and `"default"` for catch-all responses.
|
|
1261
1160
|
*
|
|
1262
1161
|
* @example
|
|
1263
1162
|
* ```ts
|
|
@@ -1265,7 +1164,7 @@ type HttpStatusCode = '100' | '101' | '102' | '103' | '200' | '201' | '202' | '2
|
|
|
1265
1164
|
* const fallback: StatusCode = 'default'
|
|
1266
1165
|
* ```
|
|
1267
1166
|
*/
|
|
1268
|
-
type StatusCode =
|
|
1167
|
+
type StatusCode = `${1 | 2 | 3 | 4 | 5}${Digit}${Digit}` | 'default';
|
|
1269
1168
|
/**
|
|
1270
1169
|
* AST node representing one operation response variant.
|
|
1271
1170
|
*
|
|
@@ -1319,12 +1218,8 @@ type ResponseInput = Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNod
|
|
|
1319
1218
|
keysToOmit?: Array<string> | null;
|
|
1320
1219
|
};
|
|
1321
1220
|
/**
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
*/
|
|
1325
|
-
declare const responseDef: NodeDef<ResponseNode, ResponseInput>;
|
|
1326
|
-
/**
|
|
1327
|
-
* Creates a `ResponseNode`.
|
|
1221
|
+
* Creates a `ResponseNode`. A single legacy `schema` (with optional `mediaType`/`keysToOmit`)
|
|
1222
|
+
* is normalized into one `content` entry.
|
|
1328
1223
|
*
|
|
1329
1224
|
* @example
|
|
1330
1225
|
* ```ts
|
|
@@ -1334,13 +1229,14 @@ declare const responseDef: NodeDef<ResponseNode, ResponseInput>;
|
|
|
1334
1229
|
* })
|
|
1335
1230
|
* ```
|
|
1336
1231
|
*/
|
|
1337
|
-
declare
|
|
1232
|
+
declare function createResponse(props: ResponseInput): ResponseNode;
|
|
1338
1233
|
//#endregion
|
|
1339
1234
|
//#region src/nodes/operation.d.ts
|
|
1340
1235
|
/**
|
|
1341
|
-
* HTTP method an operation responds to.
|
|
1236
|
+
* HTTP method an operation responds to. `QUERY` is the safe, idempotent method with a request body
|
|
1237
|
+
* from RFC 10008, declared with the `query` field of an OpenAPI 3.2 path item.
|
|
1342
1238
|
*/
|
|
1343
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
1239
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'QUERY';
|
|
1344
1240
|
/**
|
|
1345
1241
|
* Transport an operation belongs to.
|
|
1346
1242
|
*/
|
|
@@ -1436,21 +1332,10 @@ type GenericOperationNode = OperationNodeBase & {
|
|
|
1436
1332
|
* `isHttpOperationNode(node)` or `node.protocol === 'http'` before reading `method`/`path`.
|
|
1437
1333
|
*/
|
|
1438
1334
|
type OperationNode = HttpOperationNode | GenericOperationNode;
|
|
1439
|
-
type OperationInput = {
|
|
1440
|
-
operationId: string;
|
|
1441
|
-
method?: HttpOperationNode['method'];
|
|
1442
|
-
path?: HttpOperationNode['path'];
|
|
1443
|
-
requestBody?: Omit<RequestBodyNode, 'kind'>;
|
|
1444
|
-
[key: string]: unknown;
|
|
1445
|
-
};
|
|
1446
|
-
/**
|
|
1447
|
-
* Definition for the {@link OperationNode}. HTTP operations (those carrying both
|
|
1448
|
-
* `method` and `path`) are tagged with `protocol: 'http'`, and the request body is
|
|
1449
|
-
* normalized into a `RequestBodyNode`.
|
|
1450
|
-
*/
|
|
1451
|
-
declare const operationDef: NodeDef<OperationNode, OperationInput>;
|
|
1452
1335
|
/**
|
|
1453
1336
|
* Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.
|
|
1337
|
+
* HTTP operations (those carrying both `method` and `path`) are tagged with `protocol: 'http'`,
|
|
1338
|
+
* and the request body is normalized into a `RequestBodyNode`.
|
|
1454
1339
|
*
|
|
1455
1340
|
* @example
|
|
1456
1341
|
* ```ts
|
|
@@ -1696,34 +1581,6 @@ type JsxNode = BaseNode & {
|
|
|
1696
1581
|
* structured children in {@link SourceNode.nodes}.
|
|
1697
1582
|
*/
|
|
1698
1583
|
type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
|
|
1699
|
-
/**
|
|
1700
|
-
* Definition for the {@link ConstNode}.
|
|
1701
|
-
*/
|
|
1702
|
-
declare const constDef: NodeDef<ConstNode, Omit<ConstNode, "kind">>;
|
|
1703
|
-
/**
|
|
1704
|
-
* Definition for the {@link TypeNode}.
|
|
1705
|
-
*/
|
|
1706
|
-
declare const typeDef: NodeDef<TypeNode, Omit<TypeNode, "kind">>;
|
|
1707
|
-
/**
|
|
1708
|
-
* Definition for the {@link FunctionNode}.
|
|
1709
|
-
*/
|
|
1710
|
-
declare const functionDef: NodeDef<FunctionNode, Omit<FunctionNode, "kind">>;
|
|
1711
|
-
/**
|
|
1712
|
-
* Definition for the {@link ArrowFunctionNode}.
|
|
1713
|
-
*/
|
|
1714
|
-
declare const arrowFunctionDef: NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">>;
|
|
1715
|
-
/**
|
|
1716
|
-
* Definition for the {@link TextNode}.
|
|
1717
|
-
*/
|
|
1718
|
-
declare const textDef: NodeDef<TextNode, string>;
|
|
1719
|
-
/**
|
|
1720
|
-
* Definition for the {@link BreakNode}.
|
|
1721
|
-
*/
|
|
1722
|
-
declare const breakDef: NodeDef<BreakNode, void>;
|
|
1723
|
-
/**
|
|
1724
|
-
* Definition for the {@link JsxNode}.
|
|
1725
|
-
*/
|
|
1726
|
-
declare const jsxDef: NodeDef<JsxNode, string>;
|
|
1727
1584
|
/**
|
|
1728
1585
|
* Creates a `ConstNode` representing a TypeScript `const` declaration.
|
|
1729
1586
|
*
|
|
@@ -1733,7 +1590,7 @@ declare const jsxDef: NodeDef<JsxNode, string>;
|
|
|
1733
1590
|
* // export const pets: Pet[] = ... as const
|
|
1734
1591
|
* ```
|
|
1735
1592
|
*/
|
|
1736
|
-
declare
|
|
1593
|
+
declare function createConst(input: Omit<ConstNode, 'kind'>): ConstNode;
|
|
1737
1594
|
/**
|
|
1738
1595
|
* Creates a `TypeNode` representing a TypeScript `type` alias declaration.
|
|
1739
1596
|
*
|
|
@@ -1743,7 +1600,7 @@ declare const createConst: (input: Omit<ConstNode, "kind">) => ConstNode;
|
|
|
1743
1600
|
* // export type Pet = ...
|
|
1744
1601
|
* ```
|
|
1745
1602
|
*/
|
|
1746
|
-
declare
|
|
1603
|
+
declare function createType(input: Omit<TypeNode, 'kind'>): TypeNode;
|
|
1747
1604
|
/**
|
|
1748
1605
|
* Creates a `FunctionNode` representing a TypeScript `function` declaration.
|
|
1749
1606
|
*
|
|
@@ -1753,7 +1610,7 @@ declare const createType: (input: Omit<TypeNode, "kind">) => TypeNode;
|
|
|
1753
1610
|
* // export async function fetchPet(): Promise<Pet> { ... }
|
|
1754
1611
|
* ```
|
|
1755
1612
|
*/
|
|
1756
|
-
declare
|
|
1613
|
+
declare function createFunction(input: Omit<FunctionNode, 'kind'>): FunctionNode;
|
|
1757
1614
|
/**
|
|
1758
1615
|
* Creates an `ArrowFunctionNode` representing a TypeScript arrow function.
|
|
1759
1616
|
*
|
|
@@ -1763,7 +1620,7 @@ declare const createFunction: (input: Omit<FunctionNode, "kind">) => FunctionNod
|
|
|
1763
1620
|
* // export const double = (n: number) => ...
|
|
1764
1621
|
* ```
|
|
1765
1622
|
*/
|
|
1766
|
-
declare
|
|
1623
|
+
declare function createArrowFunction(input: Omit<ArrowFunctionNode, 'kind'>): ArrowFunctionNode;
|
|
1767
1624
|
/**
|
|
1768
1625
|
* Creates a {@link TextNode} representing a raw string fragment in the source output.
|
|
1769
1626
|
*
|
|
@@ -1773,7 +1630,7 @@ declare const createArrowFunction: (input: Omit<ArrowFunctionNode, "kind">) => A
|
|
|
1773
1630
|
* // { kind: 'Text', value: 'return fetch(id)' }
|
|
1774
1631
|
* ```
|
|
1775
1632
|
*/
|
|
1776
|
-
declare
|
|
1633
|
+
declare function createText(value: string): TextNode;
|
|
1777
1634
|
/**
|
|
1778
1635
|
* Creates a {@link BreakNode} representing a line break in the source output.
|
|
1779
1636
|
*
|
|
@@ -1793,7 +1650,7 @@ declare function createBreak(): BreakNode;
|
|
|
1793
1650
|
* // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
|
|
1794
1651
|
* ```
|
|
1795
1652
|
*/
|
|
1796
|
-
declare
|
|
1653
|
+
declare function createJsx(value: string): JsxNode;
|
|
1797
1654
|
//#endregion
|
|
1798
1655
|
//#region src/nodes/file.d.ts
|
|
1799
1656
|
/**
|
|
@@ -2038,23 +1895,6 @@ type FileNode<TMeta extends object = object> = BaseNode & {
|
|
|
2038
1895
|
*/
|
|
2039
1896
|
copy?: string | null;
|
|
2040
1897
|
};
|
|
2041
|
-
/**
|
|
2042
|
-
* Definition for the {@link ImportNode}.
|
|
2043
|
-
*/
|
|
2044
|
-
declare const importDef: NodeDef<ImportNode, Omit<ImportNode, "kind">>;
|
|
2045
|
-
/**
|
|
2046
|
-
* Definition for the {@link ExportNode}.
|
|
2047
|
-
*/
|
|
2048
|
-
declare const exportDef: NodeDef<ExportNode, Omit<ExportNode, "kind">>;
|
|
2049
|
-
/**
|
|
2050
|
-
* Definition for the {@link SourceNode}.
|
|
2051
|
-
*/
|
|
2052
|
-
declare const sourceDef: NodeDef<SourceNode, Omit<SourceNode, "kind">>;
|
|
2053
|
-
/**
|
|
2054
|
-
* Definition for the {@link FileNode}. The fully resolved builder lives in
|
|
2055
|
-
* `createFile`, so this definition only supplies the guard.
|
|
2056
|
-
*/
|
|
2057
|
-
declare const fileDef: NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>;
|
|
2058
1898
|
/**
|
|
2059
1899
|
* Creates an `ImportNode` representing a language-agnostic import/dependency declaration.
|
|
2060
1900
|
*
|
|
@@ -2064,7 +1904,7 @@ declare const fileDef: NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>
|
|
|
2064
1904
|
* // import { useState } from 'react'
|
|
2065
1905
|
* ```
|
|
2066
1906
|
*/
|
|
2067
|
-
declare
|
|
1907
|
+
declare function createImport(input: Omit<ImportNode, 'kind'>): ImportNode;
|
|
2068
1908
|
/**
|
|
2069
1909
|
* Creates an `ExportNode` representing a language-agnostic export/public API declaration.
|
|
2070
1910
|
*
|
|
@@ -2074,7 +1914,7 @@ declare const createImport: (input: Omit<ImportNode, "kind">) => ImportNode;
|
|
|
2074
1914
|
* // export { Pet } from './Pet'
|
|
2075
1915
|
* ```
|
|
2076
1916
|
*/
|
|
2077
|
-
declare
|
|
1917
|
+
declare function createExport(input: Omit<ExportNode, 'kind'>): ExportNode;
|
|
2078
1918
|
/**
|
|
2079
1919
|
* Creates a `SourceNode` representing a fragment of source code within a file.
|
|
2080
1920
|
*
|
|
@@ -2083,7 +1923,7 @@ declare const createExport: (input: Omit<ExportNode, "kind">) => ExportNode;
|
|
|
2083
1923
|
* createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })
|
|
2084
1924
|
* ```
|
|
2085
1925
|
*/
|
|
2086
|
-
declare
|
|
1926
|
+
declare function createSource(input: Omit<SourceNode, 'kind'>): SourceNode;
|
|
2087
1927
|
/**
|
|
2088
1928
|
* Input descriptor for {@link createFile}, before `id`, `name`, and `extname` are computed
|
|
2089
1929
|
* and `imports`/`exports`/`sources` are deduplicated.
|
|
@@ -2221,12 +2061,8 @@ type InputNode = BaseNode & {
|
|
|
2221
2061
|
meta: InputMeta;
|
|
2222
2062
|
};
|
|
2223
2063
|
/**
|
|
2224
|
-
*
|
|
2225
|
-
|
|
2226
|
-
declare const inputDef: NodeDef<InputNode, Partial<Omit<InputNode, "kind">>>;
|
|
2227
|
-
/**
|
|
2228
|
-
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` per
|
|
2229
|
-
* {@link inputDef}.
|
|
2064
|
+
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to empty
|
|
2065
|
+
* name lists. Every call allocates fresh defaults so no two inputs share them.
|
|
2230
2066
|
*
|
|
2231
2067
|
* @example
|
|
2232
2068
|
* ```ts
|
|
@@ -2260,10 +2096,6 @@ type OutputNode = BaseNode & {
|
|
|
2260
2096
|
*/
|
|
2261
2097
|
files: Array<FileNode>;
|
|
2262
2098
|
};
|
|
2263
|
-
/**
|
|
2264
|
-
* Definition for the {@link OutputNode}.
|
|
2265
|
-
*/
|
|
2266
|
-
declare const outputDef: NodeDef<OutputNode, Partial<Omit<OutputNode, "kind">>>;
|
|
2267
2099
|
/**
|
|
2268
2100
|
* Creates an `OutputNode` with a stable default for `files`.
|
|
2269
2101
|
*
|
|
@@ -2761,5 +2593,5 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
|
|
|
2761
2593
|
*/
|
|
2762
2594
|
declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
|
|
2763
2595
|
//#endregion
|
|
2764
|
-
export {
|
|
2765
|
-
//# sourceMappingURL=types-
|
|
2596
|
+
export { StatusCode as $, createSource as A, DateOnlyTypeValue as At, createArrowFunction as B, FileNode as C, StringSchemaNode as Ct, createExport as D, createSchema as Dt, UserFileNode as E, UrlSchemaNode as Et, FunctionNode as F, DistributiveOmit as Ft, createText as G, createConst as H, JSDocNode as I, NodeKind as It, HttpMethod as J, createType as K, JsxNode as L, schemaTypes as Lt, BreakNode as M, DateTypeOptions as Mt, CodeNode as N, InferSchemaNode as Nt, createFile as O, PropertyNode as Ot, ConstNode as P, ParserOptions as Pt, ResponseNode as Q, TextNode as R, ExportNode as S, SchemaType as St, SourceNode as T, UnionSchemaNode as Tt, createFunction as U, createBreak as V, createJsx as W, OperationNode as X, HttpOperationNode as Y, createOperation as Z, OutputNode as _, RefSchemaNode as _t, Enforce as a, ParameterLocation as at, InputNode as b, SchemaNode as bt, composeMacros as c, createParameter as ct, Visitor as d, DatetimeSchemaNode as dt, createResponse as et, VisitorContext as f, EnumSchemaNode as ft, Node as g, PrimitiveSchemaType as gt, transform as h, ObjectSchemaNode as ht, createPrinter as i, createContent as it, ArrowFunctionNode as j, DateTimeTypeValue as jt, createImport as k, createProperty as kt, defineMacro as l, ArraySchemaNode as lt, collectSync as m, NumberSchemaNode as mt, PrinterFactoryOptions as n, createRequestBody as nt, Macro as o, ParameterNode as ot, collect as p, IntersectionSchemaNode as pt, GenericOperationNode as q, PrinterPartial as r, ContentNode as rt, applyMacros as s, ParameterStyle as st, Printer as t, RequestBodyNode as tt, ParentOf as u, DateSchemaNode as ut, createOutput as v, ScalarSchemaNode as vt, ImportNode as w, TimeSchemaNode as wt, createInput as x, SchemaNodeByType as xt, InputMeta as y, ScalarSchemaType as yt, TypeNode as z };
|
|
2597
|
+
//# sourceMappingURL=types-DrSRvdtW.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node,
|
|
1
|
+
import { $ as StatusCode, At as DateOnlyTypeValue, C as FileNode, Ct as StringSchemaNode, E as UserFileNode, Et as UrlSchemaNode, F as FunctionNode, Ft as DistributiveOmit, I as JSDocNode, It as NodeKind, J as HttpMethod, L as JsxNode, M as BreakNode, Mt as DateTypeOptions, N as CodeNode, Nt as InferSchemaNode, Ot as PropertyNode, P as ConstNode, Pt as ParserOptions, Q as ResponseNode, R as TextNode, S as ExportNode, St as SchemaType, T as SourceNode, Tt as UnionSchemaNode, X as OperationNode, Y as HttpOperationNode, _ as OutputNode, _t as RefSchemaNode, a as Enforce, at as ParameterLocation, b as InputNode, bt as SchemaNode, d as Visitor, dt as DatetimeSchemaNode, f as VisitorContext, ft as EnumSchemaNode, g as Node, gt as PrimitiveSchemaType, ht as ObjectSchemaNode, j as ArrowFunctionNode, jt as DateTimeTypeValue, lt as ArraySchemaNode, mt as NumberSchemaNode, n as PrinterFactoryOptions, o as Macro, ot as ParameterNode, pt as IntersectionSchemaNode, q as GenericOperationNode, r as PrinterPartial, rt as ContentNode, st as ParameterStyle, t as Printer, tt as RequestBodyNode, u as ParentOf, ut as DateSchemaNode, vt as ScalarSchemaNode, w as ImportNode, wt as TimeSchemaNode, xt as SchemaNodeByType, y as InputMeta, yt as ScalarSchemaType, z as TypeNode } from "./types-DrSRvdtW.js";
|
|
2
|
+
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, 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