@kubb/ast 5.9.0 → 5.9.2
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-uQRsJaXr.d.ts → types-DrSRvdtW.d.ts} +33 -202
- 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
|
/**
|
|
@@ -436,12 +359,8 @@ type PropertyNode = BaseNode & {
|
|
|
436
359
|
*/
|
|
437
360
|
type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>;
|
|
438
361
|
/**
|
|
439
|
-
*
|
|
362
|
+
* Creates a `PropertyNode`. `required` defaults to `false`, and the schema's
|
|
440
363
|
* `optional`/`nullish` flags are derived from it through {@link withRequired}.
|
|
441
|
-
*/
|
|
442
|
-
declare const propertyDef: NodeDef<PropertyNode, UserPropertyNode>;
|
|
443
|
-
/**
|
|
444
|
-
* Creates a `PropertyNode`.
|
|
445
364
|
*
|
|
446
365
|
* @example
|
|
447
366
|
* ```ts
|
|
@@ -453,7 +372,7 @@ declare const propertyDef: NodeDef<PropertyNode, UserPropertyNode>;
|
|
|
453
372
|
* // required=true, no optional/nullish
|
|
454
373
|
* ```
|
|
455
374
|
*/
|
|
456
|
-
declare
|
|
375
|
+
declare function createProperty(input: UserPropertyNode): PropertyNode;
|
|
457
376
|
//#endregion
|
|
458
377
|
//#region src/nodes/schema.d.ts
|
|
459
378
|
type PrimitiveSchemaType =
|
|
@@ -1066,12 +985,8 @@ type CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & {
|
|
|
1066
985
|
kind: 'Schema';
|
|
1067
986
|
};
|
|
1068
987
|
/**
|
|
1069
|
-
*
|
|
1070
|
-
* empty array, and `primitive` is inferred from `type` when not explicitly provided.
|
|
1071
|
-
*/
|
|
1072
|
-
declare const schemaDef: NodeDef<SchemaNode, CreateSchemaInput>;
|
|
1073
|
-
/**
|
|
1074
|
-
* 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.
|
|
1075
990
|
*
|
|
1076
991
|
* @example
|
|
1077
992
|
* ```ts
|
|
@@ -1139,12 +1054,8 @@ type ParameterNode = BaseNode & {
|
|
|
1139
1054
|
};
|
|
1140
1055
|
type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
|
|
1141
1056
|
/**
|
|
1142
|
-
*
|
|
1057
|
+
* Creates a `ParameterNode`. `required` defaults to `false`, and the schema's
|
|
1143
1058
|
* `optional`/`nullish` flags are derived from it through {@link withRequired}.
|
|
1144
|
-
*/
|
|
1145
|
-
declare const parameterDef: NodeDef<ParameterNode, UserParameterNode>;
|
|
1146
|
-
/**
|
|
1147
|
-
* Creates a `ParameterNode`.
|
|
1148
1059
|
*
|
|
1149
1060
|
* @example
|
|
1150
1061
|
* ```ts
|
|
@@ -1156,7 +1067,7 @@ declare const parameterDef: NodeDef<ParameterNode, UserParameterNode>;
|
|
|
1156
1067
|
* })
|
|
1157
1068
|
* ```
|
|
1158
1069
|
*/
|
|
1159
|
-
declare
|
|
1070
|
+
declare function createParameter(input: UserParameterNode): ParameterNode;
|
|
1160
1071
|
//#endregion
|
|
1161
1072
|
//#region src/nodes/content.d.ts
|
|
1162
1073
|
/**
|
|
@@ -1193,14 +1104,10 @@ type ContentNode = BaseNode & {
|
|
|
1193
1104
|
*/
|
|
1194
1105
|
keysToOmit?: Array<string> | null;
|
|
1195
1106
|
};
|
|
1196
|
-
/**
|
|
1197
|
-
* Definition for the {@link ContentNode}.
|
|
1198
|
-
*/
|
|
1199
|
-
declare const contentDef: NodeDef<ContentNode, Omit<ContentNode, "kind">>;
|
|
1200
1107
|
/**
|
|
1201
1108
|
* Creates a `ContentNode` for a single request-body or response content type.
|
|
1202
1109
|
*/
|
|
1203
|
-
declare
|
|
1110
|
+
declare function createContent(input: Omit<ContentNode, 'kind'>): ContentNode;
|
|
1204
1111
|
//#endregion
|
|
1205
1112
|
//#region src/nodes/requestBody.d.ts
|
|
1206
1113
|
/**
|
|
@@ -1239,26 +1146,17 @@ type RequestBodyNode = BaseNode & {
|
|
|
1239
1146
|
*/
|
|
1240
1147
|
content?: Array<ContentNode>;
|
|
1241
1148
|
};
|
|
1242
|
-
/**
|
|
1243
|
-
* Definition for the {@link RequestBodyNode}. Content entries are built upfront with
|
|
1244
|
-
* {@link createContent}, mirroring how `parameters` and `responses` take prebuilt nodes.
|
|
1245
|
-
*/
|
|
1246
|
-
declare const requestBodyDef: NodeDef<RequestBodyNode, Omit<RequestBodyNode, "kind">>;
|
|
1247
1149
|
/**
|
|
1248
1150
|
* Creates a `RequestBodyNode`.
|
|
1249
1151
|
*/
|
|
1250
|
-
declare
|
|
1152
|
+
declare function createRequestBody(input: Omit<RequestBodyNode, 'kind'>): RequestBodyNode;
|
|
1251
1153
|
//#endregion
|
|
1252
1154
|
//#region src/nodes/response.d.ts
|
|
1253
|
-
|
|
1254
|
-
* All supported HTTP status code literals as strings, as used in API specs
|
|
1255
|
-
* (for example, `"200"` and `"404"`).
|
|
1256
|
-
*/
|
|
1257
|
-
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;
|
|
1258
1156
|
/**
|
|
1259
1157
|
* Response status code literal used by operations.
|
|
1260
1158
|
*
|
|
1261
|
-
* Includes
|
|
1159
|
+
* Includes three-digit HTTP status code strings and `"default"` for catch-all responses.
|
|
1262
1160
|
*
|
|
1263
1161
|
* @example
|
|
1264
1162
|
* ```ts
|
|
@@ -1266,7 +1164,7 @@ type HttpStatusCode = '100' | '101' | '102' | '103' | '200' | '201' | '202' | '2
|
|
|
1266
1164
|
* const fallback: StatusCode = 'default'
|
|
1267
1165
|
* ```
|
|
1268
1166
|
*/
|
|
1269
|
-
type StatusCode =
|
|
1167
|
+
type StatusCode = `${1 | 2 | 3 | 4 | 5}${Digit}${Digit}` | 'default';
|
|
1270
1168
|
/**
|
|
1271
1169
|
* AST node representing one operation response variant.
|
|
1272
1170
|
*
|
|
@@ -1320,12 +1218,8 @@ type ResponseInput = Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNod
|
|
|
1320
1218
|
keysToOmit?: Array<string> | null;
|
|
1321
1219
|
};
|
|
1322
1220
|
/**
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
*/
|
|
1326
|
-
declare const responseDef: NodeDef<ResponseNode, ResponseInput>;
|
|
1327
|
-
/**
|
|
1328
|
-
* Creates a `ResponseNode`.
|
|
1221
|
+
* Creates a `ResponseNode`. A single legacy `schema` (with optional `mediaType`/`keysToOmit`)
|
|
1222
|
+
* is normalized into one `content` entry.
|
|
1329
1223
|
*
|
|
1330
1224
|
* @example
|
|
1331
1225
|
* ```ts
|
|
@@ -1335,13 +1229,14 @@ declare const responseDef: NodeDef<ResponseNode, ResponseInput>;
|
|
|
1335
1229
|
* })
|
|
1336
1230
|
* ```
|
|
1337
1231
|
*/
|
|
1338
|
-
declare
|
|
1232
|
+
declare function createResponse(props: ResponseInput): ResponseNode;
|
|
1339
1233
|
//#endregion
|
|
1340
1234
|
//#region src/nodes/operation.d.ts
|
|
1341
1235
|
/**
|
|
1342
|
-
* 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.
|
|
1343
1238
|
*/
|
|
1344
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
1239
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'QUERY';
|
|
1345
1240
|
/**
|
|
1346
1241
|
* Transport an operation belongs to.
|
|
1347
1242
|
*/
|
|
@@ -1437,21 +1332,10 @@ type GenericOperationNode = OperationNodeBase & {
|
|
|
1437
1332
|
* `isHttpOperationNode(node)` or `node.protocol === 'http'` before reading `method`/`path`.
|
|
1438
1333
|
*/
|
|
1439
1334
|
type OperationNode = HttpOperationNode | GenericOperationNode;
|
|
1440
|
-
type OperationInput = {
|
|
1441
|
-
operationId: string;
|
|
1442
|
-
method?: HttpOperationNode['method'];
|
|
1443
|
-
path?: HttpOperationNode['path'];
|
|
1444
|
-
requestBody?: Omit<RequestBodyNode, 'kind'>;
|
|
1445
|
-
[key: string]: unknown;
|
|
1446
|
-
};
|
|
1447
|
-
/**
|
|
1448
|
-
* Definition for the {@link OperationNode}. HTTP operations (those carrying both
|
|
1449
|
-
* `method` and `path`) are tagged with `protocol: 'http'`, and the request body is
|
|
1450
|
-
* normalized into a `RequestBodyNode`.
|
|
1451
|
-
*/
|
|
1452
|
-
declare const operationDef: NodeDef<OperationNode, OperationInput>;
|
|
1453
1335
|
/**
|
|
1454
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`.
|
|
1455
1339
|
*
|
|
1456
1340
|
* @example
|
|
1457
1341
|
* ```ts
|
|
@@ -1697,34 +1581,6 @@ type JsxNode = BaseNode & {
|
|
|
1697
1581
|
* structured children in {@link SourceNode.nodes}.
|
|
1698
1582
|
*/
|
|
1699
1583
|
type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
|
|
1700
|
-
/**
|
|
1701
|
-
* Definition for the {@link ConstNode}.
|
|
1702
|
-
*/
|
|
1703
|
-
declare const constDef: NodeDef<ConstNode, Omit<ConstNode, "kind">>;
|
|
1704
|
-
/**
|
|
1705
|
-
* Definition for the {@link TypeNode}.
|
|
1706
|
-
*/
|
|
1707
|
-
declare const typeDef: NodeDef<TypeNode, Omit<TypeNode, "kind">>;
|
|
1708
|
-
/**
|
|
1709
|
-
* Definition for the {@link FunctionNode}.
|
|
1710
|
-
*/
|
|
1711
|
-
declare const functionDef: NodeDef<FunctionNode, Omit<FunctionNode, "kind">>;
|
|
1712
|
-
/**
|
|
1713
|
-
* Definition for the {@link ArrowFunctionNode}.
|
|
1714
|
-
*/
|
|
1715
|
-
declare const arrowFunctionDef: NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">>;
|
|
1716
|
-
/**
|
|
1717
|
-
* Definition for the {@link TextNode}.
|
|
1718
|
-
*/
|
|
1719
|
-
declare const textDef: NodeDef<TextNode, string>;
|
|
1720
|
-
/**
|
|
1721
|
-
* Definition for the {@link BreakNode}.
|
|
1722
|
-
*/
|
|
1723
|
-
declare const breakDef: NodeDef<BreakNode, void>;
|
|
1724
|
-
/**
|
|
1725
|
-
* Definition for the {@link JsxNode}.
|
|
1726
|
-
*/
|
|
1727
|
-
declare const jsxDef: NodeDef<JsxNode, string>;
|
|
1728
1584
|
/**
|
|
1729
1585
|
* Creates a `ConstNode` representing a TypeScript `const` declaration.
|
|
1730
1586
|
*
|
|
@@ -1734,7 +1590,7 @@ declare const jsxDef: NodeDef<JsxNode, string>;
|
|
|
1734
1590
|
* // export const pets: Pet[] = ... as const
|
|
1735
1591
|
* ```
|
|
1736
1592
|
*/
|
|
1737
|
-
declare
|
|
1593
|
+
declare function createConst(input: Omit<ConstNode, 'kind'>): ConstNode;
|
|
1738
1594
|
/**
|
|
1739
1595
|
* Creates a `TypeNode` representing a TypeScript `type` alias declaration.
|
|
1740
1596
|
*
|
|
@@ -1744,7 +1600,7 @@ declare const createConst: (input: Omit<ConstNode, "kind">) => ConstNode;
|
|
|
1744
1600
|
* // export type Pet = ...
|
|
1745
1601
|
* ```
|
|
1746
1602
|
*/
|
|
1747
|
-
declare
|
|
1603
|
+
declare function createType(input: Omit<TypeNode, 'kind'>): TypeNode;
|
|
1748
1604
|
/**
|
|
1749
1605
|
* Creates a `FunctionNode` representing a TypeScript `function` declaration.
|
|
1750
1606
|
*
|
|
@@ -1754,7 +1610,7 @@ declare const createType: (input: Omit<TypeNode, "kind">) => TypeNode;
|
|
|
1754
1610
|
* // export async function fetchPet(): Promise<Pet> { ... }
|
|
1755
1611
|
* ```
|
|
1756
1612
|
*/
|
|
1757
|
-
declare
|
|
1613
|
+
declare function createFunction(input: Omit<FunctionNode, 'kind'>): FunctionNode;
|
|
1758
1614
|
/**
|
|
1759
1615
|
* Creates an `ArrowFunctionNode` representing a TypeScript arrow function.
|
|
1760
1616
|
*
|
|
@@ -1764,7 +1620,7 @@ declare const createFunction: (input: Omit<FunctionNode, "kind">) => FunctionNod
|
|
|
1764
1620
|
* // export const double = (n: number) => ...
|
|
1765
1621
|
* ```
|
|
1766
1622
|
*/
|
|
1767
|
-
declare
|
|
1623
|
+
declare function createArrowFunction(input: Omit<ArrowFunctionNode, 'kind'>): ArrowFunctionNode;
|
|
1768
1624
|
/**
|
|
1769
1625
|
* Creates a {@link TextNode} representing a raw string fragment in the source output.
|
|
1770
1626
|
*
|
|
@@ -1774,7 +1630,7 @@ declare const createArrowFunction: (input: Omit<ArrowFunctionNode, "kind">) => A
|
|
|
1774
1630
|
* // { kind: 'Text', value: 'return fetch(id)' }
|
|
1775
1631
|
* ```
|
|
1776
1632
|
*/
|
|
1777
|
-
declare
|
|
1633
|
+
declare function createText(value: string): TextNode;
|
|
1778
1634
|
/**
|
|
1779
1635
|
* Creates a {@link BreakNode} representing a line break in the source output.
|
|
1780
1636
|
*
|
|
@@ -1794,7 +1650,7 @@ declare function createBreak(): BreakNode;
|
|
|
1794
1650
|
* // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
|
|
1795
1651
|
* ```
|
|
1796
1652
|
*/
|
|
1797
|
-
declare
|
|
1653
|
+
declare function createJsx(value: string): JsxNode;
|
|
1798
1654
|
//#endregion
|
|
1799
1655
|
//#region src/nodes/file.d.ts
|
|
1800
1656
|
/**
|
|
@@ -2039,23 +1895,6 @@ type FileNode<TMeta extends object = object> = BaseNode & {
|
|
|
2039
1895
|
*/
|
|
2040
1896
|
copy?: string | null;
|
|
2041
1897
|
};
|
|
2042
|
-
/**
|
|
2043
|
-
* Definition for the {@link ImportNode}.
|
|
2044
|
-
*/
|
|
2045
|
-
declare const importDef: NodeDef<ImportNode, Omit<ImportNode, "kind">>;
|
|
2046
|
-
/**
|
|
2047
|
-
* Definition for the {@link ExportNode}.
|
|
2048
|
-
*/
|
|
2049
|
-
declare const exportDef: NodeDef<ExportNode, Omit<ExportNode, "kind">>;
|
|
2050
|
-
/**
|
|
2051
|
-
* Definition for the {@link SourceNode}.
|
|
2052
|
-
*/
|
|
2053
|
-
declare const sourceDef: NodeDef<SourceNode, Omit<SourceNode, "kind">>;
|
|
2054
|
-
/**
|
|
2055
|
-
* Definition for the {@link FileNode}. The fully resolved builder lives in
|
|
2056
|
-
* `createFile`, so this definition only supplies the guard.
|
|
2057
|
-
*/
|
|
2058
|
-
declare const fileDef: NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>;
|
|
2059
1898
|
/**
|
|
2060
1899
|
* Creates an `ImportNode` representing a language-agnostic import/dependency declaration.
|
|
2061
1900
|
*
|
|
@@ -2065,7 +1904,7 @@ declare const fileDef: NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>
|
|
|
2065
1904
|
* // import { useState } from 'react'
|
|
2066
1905
|
* ```
|
|
2067
1906
|
*/
|
|
2068
|
-
declare
|
|
1907
|
+
declare function createImport(input: Omit<ImportNode, 'kind'>): ImportNode;
|
|
2069
1908
|
/**
|
|
2070
1909
|
* Creates an `ExportNode` representing a language-agnostic export/public API declaration.
|
|
2071
1910
|
*
|
|
@@ -2075,7 +1914,7 @@ declare const createImport: (input: Omit<ImportNode, "kind">) => ImportNode;
|
|
|
2075
1914
|
* // export { Pet } from './Pet'
|
|
2076
1915
|
* ```
|
|
2077
1916
|
*/
|
|
2078
|
-
declare
|
|
1917
|
+
declare function createExport(input: Omit<ExportNode, 'kind'>): ExportNode;
|
|
2079
1918
|
/**
|
|
2080
1919
|
* Creates a `SourceNode` representing a fragment of source code within a file.
|
|
2081
1920
|
*
|
|
@@ -2084,7 +1923,7 @@ declare const createExport: (input: Omit<ExportNode, "kind">) => ExportNode;
|
|
|
2084
1923
|
* createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })
|
|
2085
1924
|
* ```
|
|
2086
1925
|
*/
|
|
2087
|
-
declare
|
|
1926
|
+
declare function createSource(input: Omit<SourceNode, 'kind'>): SourceNode;
|
|
2088
1927
|
/**
|
|
2089
1928
|
* Input descriptor for {@link createFile}, before `id`, `name`, and `extname` are computed
|
|
2090
1929
|
* and `imports`/`exports`/`sources` are deduplicated.
|
|
@@ -2222,12 +2061,8 @@ type InputNode = BaseNode & {
|
|
|
2222
2061
|
meta: InputMeta;
|
|
2223
2062
|
};
|
|
2224
2063
|
/**
|
|
2225
|
-
*
|
|
2226
|
-
|
|
2227
|
-
declare const inputDef: NodeDef<InputNode, Partial<Omit<InputNode, "kind">>>;
|
|
2228
|
-
/**
|
|
2229
|
-
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` per
|
|
2230
|
-
* {@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.
|
|
2231
2066
|
*
|
|
2232
2067
|
* @example
|
|
2233
2068
|
* ```ts
|
|
@@ -2261,10 +2096,6 @@ type OutputNode = BaseNode & {
|
|
|
2261
2096
|
*/
|
|
2262
2097
|
files: Array<FileNode>;
|
|
2263
2098
|
};
|
|
2264
|
-
/**
|
|
2265
|
-
* Definition for the {@link OutputNode}.
|
|
2266
|
-
*/
|
|
2267
|
-
declare const outputDef: NodeDef<OutputNode, Partial<Omit<OutputNode, "kind">>>;
|
|
2268
2099
|
/**
|
|
2269
2100
|
* Creates an `OutputNode` with a stable default for `files`.
|
|
2270
2101
|
*
|
|
@@ -2762,5 +2593,5 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
|
|
|
2762
2593
|
*/
|
|
2763
2594
|
declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
|
|
2764
2595
|
//#endregion
|
|
2765
|
-
export {
|
|
2766
|
-
//# 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