@swagger-api/apidom-ast 1.0.0-alpha.8 → 1.0.0-beta.0
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/CHANGELOG.md +12 -0
- package/dist/apidom-ast.browser.js +797 -406
- package/dist/apidom-ast.browser.min.js +1 -1
- package/package.json +16 -16
- package/{cjs → src}/Error.cjs +7 -0
- package/{es → src}/Error.mjs +6 -0
- package/{cjs → src}/Literal.cjs +7 -0
- package/{es → src}/Literal.mjs +6 -0
- package/{cjs → src}/Node.cjs +7 -0
- package/{es → src}/Node.mjs +7 -0
- package/{cjs → src}/ParseResult.cjs +3 -0
- package/{es → src}/ParseResult.mjs +3 -0
- package/{cjs → src}/Position.cjs +14 -0
- package/{es → src}/Position.mjs +15 -0
- package/{es → src}/index.mjs +1 -2
- package/{cjs → src}/json/nodes/JsonArray.cjs +3 -0
- package/{es → src}/json/nodes/JsonArray.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonDocument.cjs +3 -0
- package/{es → src}/json/nodes/JsonDocument.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonEscapeSequence.cjs +3 -0
- package/{es → src}/json/nodes/JsonEscapeSequence.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonFalse.cjs +3 -0
- package/{es → src}/json/nodes/JsonFalse.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonKey.cjs +3 -0
- package/{es → src}/json/nodes/JsonKey.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonNode.cjs +3 -0
- package/{es → src}/json/nodes/JsonNode.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonNull.cjs +3 -0
- package/{es → src}/json/nodes/JsonNull.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonNumber.cjs +3 -0
- package/{es → src}/json/nodes/JsonNumber.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonObject.cjs +3 -0
- package/{es → src}/json/nodes/JsonObject.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonProperty.cjs +7 -0
- package/{es → src}/json/nodes/JsonProperty.mjs +6 -0
- package/{cjs → src}/json/nodes/JsonString.cjs +3 -0
- package/{es → src}/json/nodes/JsonString.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonStringContent.cjs +3 -0
- package/{es → src}/json/nodes/JsonStringContent.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonTrue.cjs +3 -0
- package/{es → src}/json/nodes/JsonTrue.mjs +3 -0
- package/{cjs → src}/json/nodes/JsonValue.cjs +7 -0
- package/{es → src}/json/nodes/JsonValue.mjs +6 -0
- package/{cjs → src}/json/nodes/predicates.cjs +47 -0
- package/{es → src}/json/nodes/predicates.mjs +47 -0
- package/{cjs → src}/predicates.cjs +19 -0
- package/{es → src}/predicates.mjs +19 -0
- package/{cjs → src}/traversal/visitor.cjs +43 -16
- package/{es → src}/traversal/visitor.mjs +43 -16
- package/{cjs → src}/yaml/anchors-aliases/ReferenceManager.cjs +3 -0
- package/{es → src}/yaml/anchors-aliases/ReferenceManager.mjs +3 -0
- package/{cjs → src}/yaml/errors/YamlError.cjs +3 -0
- package/{es → src}/yaml/errors/YamlError.mjs +4 -0
- package/{cjs → src}/yaml/errors/YamlReferenceError.cjs +3 -0
- package/{es → src}/yaml/errors/YamlReferenceError.mjs +3 -0
- package/{cjs → src}/yaml/errors/YamlSchemaError.cjs +3 -0
- package/{es → src}/yaml/errors/YamlSchemaError.mjs +3 -0
- package/{cjs → src}/yaml/errors/YamlTagError.cjs +7 -0
- package/{es → src}/yaml/errors/YamlTagError.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlAlias.cjs +7 -0
- package/{es → src}/yaml/nodes/YamlAlias.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlAnchor.cjs +7 -0
- package/{es → src}/yaml/nodes/YamlAnchor.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlCollection.cjs +3 -0
- package/{es → src}/yaml/nodes/YamlCollection.mjs +3 -0
- package/{cjs → src}/yaml/nodes/YamlComment.cjs +7 -0
- package/{es → src}/yaml/nodes/YamlComment.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlDirective.cjs +11 -0
- package/{es → src}/yaml/nodes/YamlDirective.mjs +9 -0
- package/{cjs → src}/yaml/nodes/YamlDocument.cjs +3 -0
- package/{es → src}/yaml/nodes/YamlDocument.mjs +3 -0
- package/{cjs → src}/yaml/nodes/YamlKeyValuePair.cjs +7 -0
- package/{es → src}/yaml/nodes/YamlKeyValuePair.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlMapping.cjs +3 -0
- package/{es → src}/yaml/nodes/YamlMapping.mjs +3 -0
- package/{cjs → src}/yaml/nodes/YamlNode.cjs +7 -0
- package/{es → src}/yaml/nodes/YamlNode.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlScalar.cjs +7 -0
- package/{es → src}/yaml/nodes/YamlScalar.mjs +6 -0
- package/{cjs → src}/yaml/nodes/YamlSequence.cjs +3 -0
- package/{es → src}/yaml/nodes/YamlSequence.mjs +3 -0
- package/{cjs → src}/yaml/nodes/YamlStream.cjs +3 -0
- package/{es → src}/yaml/nodes/YamlStream.mjs +3 -0
- package/{cjs → src}/yaml/nodes/YamlStyle.cjs +6 -0
- package/{es → src}/yaml/nodes/YamlStyle.mjs +7 -0
- package/{cjs → src}/yaml/nodes/YamlTag.cjs +9 -0
- package/{es → src}/yaml/nodes/YamlTag.mjs +11 -0
- package/{cjs → src}/yaml/nodes/predicates.cjs +43 -0
- package/{es → src}/yaml/nodes/predicates.mjs +43 -0
- package/{cjs → src}/yaml/schemas/failsafe/index.cjs +3 -0
- package/{es → src}/yaml/schemas/failsafe/index.mjs +3 -0
- package/{cjs → src}/yaml/schemas/json/index.cjs +3 -0
- package/{es → src}/yaml/schemas/json/index.mjs +3 -0
- package/types/apidom-ast.d.ts +826 -0
- package/types/dist.d.ts +0 -486
- /package/{cjs → src}/index.cjs +0 -0
- /package/{cjs → src}/yaml/schemas/ScalarTag.cjs +0 -0
- /package/{es → src}/yaml/schemas/ScalarTag.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/Tag.cjs +0 -0
- /package/{es → src}/yaml/schemas/Tag.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/canonical-format.cjs +0 -0
- /package/{es → src}/yaml/schemas/canonical-format.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/failsafe/GenericMapping.cjs +0 -0
- /package/{es → src}/yaml/schemas/failsafe/GenericMapping.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/failsafe/GenericSequence.cjs +0 -0
- /package/{es → src}/yaml/schemas/failsafe/GenericSequence.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/failsafe/GenericString.cjs +0 -0
- /package/{es → src}/yaml/schemas/failsafe/GenericString.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/json/Boolean.cjs +0 -0
- /package/{es → src}/yaml/schemas/json/Boolean.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/json/FloatingPoint.cjs +0 -0
- /package/{es → src}/yaml/schemas/json/FloatingPoint.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/json/Integer.cjs +0 -0
- /package/{es → src}/yaml/schemas/json/Integer.mjs +0 -0
- /package/{cjs → src}/yaml/schemas/json/Null.cjs +0 -0
- /package/{es → src}/yaml/schemas/json/Null.mjs +0 -0
@@ -0,0 +1,826 @@
|
|
1
|
+
import type { ApiDOMErrorOptions } from '@swagger-api/apidom-error';
|
2
|
+
import { ApiDOMStructuredError } from '@swagger-api/apidom-error';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @public
|
6
|
+
*/
|
7
|
+
export declare const BREAK: {};
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @public
|
11
|
+
*/
|
12
|
+
export declare const cloneNode: (node: any) => any;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @public
|
16
|
+
*/
|
17
|
+
declare class Error_2 extends Node_2 {
|
18
|
+
static readonly type: string;
|
19
|
+
readonly value: unknown;
|
20
|
+
readonly isUnexpected: boolean;
|
21
|
+
constructor({ value, isUnexpected, ...rest }?: ErrorOptions_2);
|
22
|
+
}
|
23
|
+
export { Error_2 as Error }
|
24
|
+
|
25
|
+
/**
|
26
|
+
* @public
|
27
|
+
*/
|
28
|
+
declare interface ErrorOptions_2 extends NodeOptions {
|
29
|
+
readonly value?: unknown;
|
30
|
+
readonly isUnexpected?: boolean;
|
31
|
+
}
|
32
|
+
export { ErrorOptions_2 as ErrorOptions }
|
33
|
+
|
34
|
+
/**
|
35
|
+
* @public
|
36
|
+
*/
|
37
|
+
export declare const getNodeType: (node: any) => string | undefined;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @public
|
41
|
+
*/
|
42
|
+
export declare const getVisitFn: (visitor: any, type: string | undefined, isLeaving: boolean) => ((...args: any[]) => any) | null;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @public
|
46
|
+
*/
|
47
|
+
export declare const isJsonArray: (node: unknown) => node is JsonArray;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* @public
|
51
|
+
*/
|
52
|
+
export declare const isJsonDocument: (node: unknown) => node is JsonDocument;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* @public
|
56
|
+
*/
|
57
|
+
export declare const isJsonEscapeSequence: (node: unknown) => node is JsonEscapeSequence;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* @public
|
61
|
+
*/
|
62
|
+
export declare const isJsonFalse: (node: unknown) => node is JsonFalse;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @public
|
66
|
+
*/
|
67
|
+
export declare const isJsonKey: (node: unknown) => node is JsonKey;
|
68
|
+
|
69
|
+
/**
|
70
|
+
* @public
|
71
|
+
*/
|
72
|
+
export declare const isJsonNull: (node: unknown) => node is JsonNull;
|
73
|
+
|
74
|
+
/**
|
75
|
+
* @public
|
76
|
+
*/
|
77
|
+
export declare const isJsonNumber: (node: unknown) => node is JsonNumber;
|
78
|
+
|
79
|
+
/**
|
80
|
+
* @public
|
81
|
+
*/
|
82
|
+
export declare const isJsonObject: (node: unknown) => node is JsonObject;
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @public
|
86
|
+
*/
|
87
|
+
export declare const isJsonProperty: (node: unknown) => node is JsonProperty;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* @public
|
91
|
+
*/
|
92
|
+
export declare const isJsonString: (node: unknown) => node is JsonString;
|
93
|
+
|
94
|
+
/**
|
95
|
+
* @public
|
96
|
+
*/
|
97
|
+
export declare const isJsonStringContent: (node: unknown) => node is JsonStringContent;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* @public
|
101
|
+
*/
|
102
|
+
export declare const isJsonTrue: (node: unknown) => node is JsonTrue;
|
103
|
+
|
104
|
+
/**
|
105
|
+
* @public
|
106
|
+
*/
|
107
|
+
export declare const isLiteral: (node: unknown) => node is Literal;
|
108
|
+
|
109
|
+
/**
|
110
|
+
* @public
|
111
|
+
*/
|
112
|
+
export declare const isNode: (node: any) => boolean;
|
113
|
+
|
114
|
+
/**
|
115
|
+
* @public
|
116
|
+
*/
|
117
|
+
export declare const isParseResult: (node: unknown) => node is ParseResult;
|
118
|
+
|
119
|
+
/**
|
120
|
+
* @public
|
121
|
+
*/
|
122
|
+
export declare const isPoint: (node: unknown) => node is Point;
|
123
|
+
|
124
|
+
/**
|
125
|
+
* @public
|
126
|
+
*/
|
127
|
+
export declare const isPosition: (node: unknown) => node is Position;
|
128
|
+
|
129
|
+
/**
|
130
|
+
* @public
|
131
|
+
*/
|
132
|
+
export declare const isYamlAlias: (node: unknown) => node is YamlAlias;
|
133
|
+
|
134
|
+
/**
|
135
|
+
* @public
|
136
|
+
*/
|
137
|
+
export declare const isYamlAnchor: (node: unknown) => node is YamlAnchor;
|
138
|
+
|
139
|
+
/**
|
140
|
+
* @public
|
141
|
+
*/
|
142
|
+
export declare const isYamlComment: (node: unknown) => node is YamlComment;
|
143
|
+
|
144
|
+
/**
|
145
|
+
* @public
|
146
|
+
*/
|
147
|
+
export declare const isYamlDirective: (node: unknown) => node is YamlDirective;
|
148
|
+
|
149
|
+
/**
|
150
|
+
* @public
|
151
|
+
*/
|
152
|
+
export declare const isYamlDocument: (node: unknown) => node is YamlDocument;
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @public
|
156
|
+
*/
|
157
|
+
export declare const isYamlKeyValuePair: (node: unknown) => node is YamlKeyValuePair;
|
158
|
+
|
159
|
+
/**
|
160
|
+
* @public
|
161
|
+
*/
|
162
|
+
export declare const isYamlMapping: (node: unknown) => node is YamlMapping;
|
163
|
+
|
164
|
+
/**
|
165
|
+
* @public
|
166
|
+
*/
|
167
|
+
export declare const isYamlScalar: (node: unknown) => node is YamlScalar;
|
168
|
+
|
169
|
+
/**
|
170
|
+
* @public
|
171
|
+
*/
|
172
|
+
export declare const isYamlSequence: (node: unknown) => node is YamlSequence;
|
173
|
+
|
174
|
+
/**
|
175
|
+
* @public
|
176
|
+
*/
|
177
|
+
export declare const isYamlStream: (node: unknown) => node is YamlStream;
|
178
|
+
|
179
|
+
/**
|
180
|
+
* @public
|
181
|
+
*/
|
182
|
+
export declare const isYamlTag: (node: unknown) => node is YamlTag;
|
183
|
+
|
184
|
+
/**
|
185
|
+
* @public
|
186
|
+
*/
|
187
|
+
export declare class JsonArray extends JsonNode {
|
188
|
+
static readonly type = "array";
|
189
|
+
get items(): unknown[];
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* @public
|
194
|
+
*/
|
195
|
+
export declare class JsonDocument extends JsonNode {
|
196
|
+
static readonly type = "document";
|
197
|
+
get child(): unknown;
|
198
|
+
}
|
199
|
+
|
200
|
+
/**
|
201
|
+
* @public
|
202
|
+
*/
|
203
|
+
export declare class JsonEscapeSequence extends JsonValue {
|
204
|
+
static readonly type = "escapeSequence";
|
205
|
+
}
|
206
|
+
|
207
|
+
/**
|
208
|
+
* @public
|
209
|
+
*/
|
210
|
+
export declare class JsonFalse extends JsonValue {
|
211
|
+
static readonly type = "false";
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* @public
|
216
|
+
*/
|
217
|
+
export declare class JsonKey extends JsonString {
|
218
|
+
static readonly type = "key";
|
219
|
+
}
|
220
|
+
|
221
|
+
/**
|
222
|
+
* @public
|
223
|
+
*/
|
224
|
+
export declare class JsonNode extends Node_2 {
|
225
|
+
}
|
226
|
+
|
227
|
+
/**
|
228
|
+
* @public
|
229
|
+
*/
|
230
|
+
export declare class JsonNull extends JsonValue {
|
231
|
+
static readonly type = "null";
|
232
|
+
}
|
233
|
+
|
234
|
+
/**
|
235
|
+
* @public
|
236
|
+
*/
|
237
|
+
export declare class JsonNumber extends JsonValue {
|
238
|
+
static readonly type = "number";
|
239
|
+
}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* @public
|
243
|
+
*/
|
244
|
+
export declare class JsonObject extends JsonNode {
|
245
|
+
static readonly type = "object";
|
246
|
+
get properties(): Array<JsonProperty>;
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* @public
|
251
|
+
*/
|
252
|
+
export declare class JsonProperty extends JsonNode {
|
253
|
+
static readonly type = "property";
|
254
|
+
get key(): JsonKey | undefined;
|
255
|
+
get value(): JsonPropertyValue | undefined;
|
256
|
+
}
|
257
|
+
|
258
|
+
/**
|
259
|
+
* @public
|
260
|
+
*/
|
261
|
+
export declare type JsonPropertyValue = JsonFalse | JsonTrue | JsonNull | JsonNumber | JsonString | JsonArray | JsonObject;
|
262
|
+
|
263
|
+
/**
|
264
|
+
* @public
|
265
|
+
*/
|
266
|
+
export declare class JsonString extends JsonNode {
|
267
|
+
static readonly type: string;
|
268
|
+
get value(): string;
|
269
|
+
}
|
270
|
+
|
271
|
+
/**
|
272
|
+
* @public
|
273
|
+
*/
|
274
|
+
export declare class JsonStringContent extends JsonValue {
|
275
|
+
static readonly type = "stringContent";
|
276
|
+
}
|
277
|
+
|
278
|
+
/**
|
279
|
+
* @public
|
280
|
+
*/
|
281
|
+
export declare class JsonTrue extends JsonValue {
|
282
|
+
static readonly type = "true";
|
283
|
+
}
|
284
|
+
|
285
|
+
/**
|
286
|
+
* @public
|
287
|
+
*/
|
288
|
+
export declare class JsonValue extends JsonNode {
|
289
|
+
static readonly type: string;
|
290
|
+
readonly value: string;
|
291
|
+
constructor({ value, ...rest }: JsonValueOptions);
|
292
|
+
}
|
293
|
+
|
294
|
+
/**
|
295
|
+
* @public
|
296
|
+
*/
|
297
|
+
export declare interface JsonValueOptions extends NodeOptions {
|
298
|
+
value: string;
|
299
|
+
}
|
300
|
+
|
301
|
+
/**
|
302
|
+
* @public
|
303
|
+
*/
|
304
|
+
export declare class Literal extends Node_2 {
|
305
|
+
static readonly type: string;
|
306
|
+
readonly value: unknown;
|
307
|
+
constructor({ value, ...rest }?: LiteralOptions);
|
308
|
+
}
|
309
|
+
|
310
|
+
/**
|
311
|
+
* @public
|
312
|
+
*/
|
313
|
+
export declare interface LiteralOptions extends NodeOptions {
|
314
|
+
readonly value?: unknown;
|
315
|
+
}
|
316
|
+
|
317
|
+
/**
|
318
|
+
* @public
|
319
|
+
*/
|
320
|
+
export declare interface MergeAllAsync {
|
321
|
+
(visitors: any[], options?: {
|
322
|
+
visitFnGetter?: typeof getVisitFn;
|
323
|
+
nodeTypeGetter?: typeof getNodeType;
|
324
|
+
breakSymbol?: typeof BREAK;
|
325
|
+
deleteNodeSymbol?: any;
|
326
|
+
skipVisitingNodeSymbol?: boolean;
|
327
|
+
exposeEdits?: boolean;
|
328
|
+
}): {
|
329
|
+
enter: (node: any, ...rest: any[]) => Promise<any>;
|
330
|
+
leave: (node: any, ...rest: any[]) => Promise<any>;
|
331
|
+
};
|
332
|
+
}
|
333
|
+
|
334
|
+
/**
|
335
|
+
* Creates a new visitor instance which delegates to many visitors to run in
|
336
|
+
* parallel. Each visitor will be visited for each node before moving on.
|
337
|
+
*
|
338
|
+
* If a prior visitor edits a node, no following visitors will see that node.
|
339
|
+
* `exposeEdits=true` can be used to expose the edited node from the previous visitors.
|
340
|
+
* @public
|
341
|
+
*/
|
342
|
+
export declare interface MergeAllSync {
|
343
|
+
(visitors: any[], options?: {
|
344
|
+
visitFnGetter?: typeof getVisitFn;
|
345
|
+
nodeTypeGetter?: typeof getNodeType;
|
346
|
+
breakSymbol?: typeof BREAK;
|
347
|
+
deleteNodeSymbol?: any;
|
348
|
+
skipVisitingNodeSymbol?: boolean;
|
349
|
+
exposeEdits?: boolean;
|
350
|
+
}): {
|
351
|
+
enter: (node: any, ...rest: any[]) => any;
|
352
|
+
leave: (node: any, ...rest: any[]) => any;
|
353
|
+
};
|
354
|
+
[key: symbol]: MergeAllAsync;
|
355
|
+
}
|
356
|
+
|
357
|
+
/**
|
358
|
+
* @public
|
359
|
+
*/
|
360
|
+
export declare const mergeAllVisitors: MergeAllSync;
|
361
|
+
|
362
|
+
/**
|
363
|
+
* @public
|
364
|
+
*/
|
365
|
+
declare class Node_2 {
|
366
|
+
static readonly type: string;
|
367
|
+
readonly type: string;
|
368
|
+
readonly isMissing: boolean;
|
369
|
+
children: unknown[];
|
370
|
+
position?: Position;
|
371
|
+
constructor({ children, position, isMissing }?: NodeOptions);
|
372
|
+
clone(): Node_2;
|
373
|
+
}
|
374
|
+
export { Node_2 as Node }
|
375
|
+
|
376
|
+
/**
|
377
|
+
* @public
|
378
|
+
*/
|
379
|
+
export declare interface NodeOptions {
|
380
|
+
readonly children?: unknown[];
|
381
|
+
readonly position?: Position;
|
382
|
+
readonly isMissing?: boolean;
|
383
|
+
}
|
384
|
+
|
385
|
+
/**
|
386
|
+
* @public
|
387
|
+
*/
|
388
|
+
export declare class ParseResult extends Node_2 {
|
389
|
+
static readonly type: string;
|
390
|
+
get rootNode(): unknown;
|
391
|
+
}
|
392
|
+
|
393
|
+
/**
|
394
|
+
* @public
|
395
|
+
*/
|
396
|
+
export declare class Point {
|
397
|
+
static readonly type: string;
|
398
|
+
readonly type: string;
|
399
|
+
readonly row: number;
|
400
|
+
readonly column: number;
|
401
|
+
readonly char: number;
|
402
|
+
constructor({ row, column, char }: PointOptions);
|
403
|
+
}
|
404
|
+
|
405
|
+
/**
|
406
|
+
* @public
|
407
|
+
*/
|
408
|
+
export declare interface PointOptions {
|
409
|
+
readonly row: number;
|
410
|
+
readonly column: number;
|
411
|
+
readonly char: number;
|
412
|
+
}
|
413
|
+
|
414
|
+
/**
|
415
|
+
* @public
|
416
|
+
*/
|
417
|
+
export declare class Position {
|
418
|
+
static readonly type: string;
|
419
|
+
readonly type: string;
|
420
|
+
readonly start: Point;
|
421
|
+
readonly end: Point;
|
422
|
+
constructor({ start, end }: PositionOptions_2);
|
423
|
+
}
|
424
|
+
|
425
|
+
/**
|
426
|
+
* @public
|
427
|
+
*/
|
428
|
+
declare interface PositionOptions_2 {
|
429
|
+
readonly start: Point;
|
430
|
+
readonly end: Point;
|
431
|
+
}
|
432
|
+
export { PositionOptions_2 as PositionOptions }
|
433
|
+
|
434
|
+
/**
|
435
|
+
* visit() will walk through an AST using a preorder depth first traversal, calling
|
436
|
+
* the visitor's enter function at each node in the traversal, and calling the
|
437
|
+
* leave function after visiting that node and all of its child nodes.
|
438
|
+
*
|
439
|
+
* By returning different values from the enter and leave functions, the
|
440
|
+
* behavior of the visitor can be altered, including skipping over a sub-tree of
|
441
|
+
* the AST (by returning false), editing the AST by returning a value or null
|
442
|
+
* to remove the value, or to stop the whole traversal by returning BREAK.
|
443
|
+
*
|
444
|
+
* When using visit() to edit an AST, the original AST will not be modified, and
|
445
|
+
* a new version of the AST with the changes applied will be returned from the
|
446
|
+
* visit function.
|
447
|
+
*
|
448
|
+
* @example
|
449
|
+
* ```
|
450
|
+
* const editedAST = visit(ast, {
|
451
|
+
* enter(node, key, parent, path, ancestors) {
|
452
|
+
* // return
|
453
|
+
* // undefined: no action
|
454
|
+
* // false: skip visiting this node
|
455
|
+
* // BREAK: stop visiting altogether
|
456
|
+
* // null: delete this node
|
457
|
+
* // any value: replace this node with the returned value
|
458
|
+
* },
|
459
|
+
* leave(node, key, parent, path, ancestors) {
|
460
|
+
* // return
|
461
|
+
* // undefined: no action
|
462
|
+
* // false: no action
|
463
|
+
* // BREAK: stop visiting altogether
|
464
|
+
* // null: delete this node
|
465
|
+
* // any value: replace this node with the returned value
|
466
|
+
* }
|
467
|
+
* });
|
468
|
+
*```
|
469
|
+
* Alternatively to providing enter() and leave() functions, a visitor can
|
470
|
+
* instead provide functions named the same as the kinds of AST nodes, or
|
471
|
+
* enter/leave visitors at a named key, leading to four permutations of
|
472
|
+
* visitor API:
|
473
|
+
*
|
474
|
+
* 1) Named visitors triggered when entering a node a specific kind.
|
475
|
+
* ```
|
476
|
+
* visit(ast, {
|
477
|
+
* Kind(node) {
|
478
|
+
* // enter the "Kind" node
|
479
|
+
* }
|
480
|
+
* })
|
481
|
+
* ```
|
482
|
+
* 2) Named visitors that trigger upon entering and leaving a node of
|
483
|
+
* a specific kind.
|
484
|
+
* ```
|
485
|
+
* visit(ast, {
|
486
|
+
* Kind: {
|
487
|
+
* enter(node) {
|
488
|
+
* // enter the "Kind" node
|
489
|
+
* }
|
490
|
+
* leave(node) {
|
491
|
+
* // leave the "Kind" node
|
492
|
+
* }
|
493
|
+
* }
|
494
|
+
* })
|
495
|
+
* ```
|
496
|
+
* 3) Generic visitors that trigger upon entering and leaving any node.
|
497
|
+
* ```
|
498
|
+
* visit(ast, {
|
499
|
+
* enter(node) {
|
500
|
+
* // enter any node
|
501
|
+
* },
|
502
|
+
* leave(node) {
|
503
|
+
* // leave any node
|
504
|
+
* }
|
505
|
+
* })
|
506
|
+
* ```
|
507
|
+
* 4) Parallel visitors for entering and leaving nodes of a specific kind.
|
508
|
+
* ```
|
509
|
+
* visit(ast, {
|
510
|
+
* enter: {
|
511
|
+
* Kind(node) {
|
512
|
+
* // enter the "Kind" node
|
513
|
+
* }
|
514
|
+
* },
|
515
|
+
* leave: {
|
516
|
+
* Kind(node) {
|
517
|
+
* // leave the "Kind" node
|
518
|
+
* }
|
519
|
+
* }
|
520
|
+
* })
|
521
|
+
* ```
|
522
|
+
* sig `visit :: (Node, Visitor, Options)`
|
523
|
+
*
|
524
|
+
* sig `Options = { keyMap: Object, state: Object }`
|
525
|
+
*
|
526
|
+
* @public
|
527
|
+
*/
|
528
|
+
export declare const visit: (root: any, visitor: any, { keyMap, state, breakSymbol, deleteNodeSymbol, skipVisitingNodeSymbol, visitFnGetter, nodeTypeGetter, nodePredicate, nodeCloneFn, detectCycles, }?: {
|
529
|
+
keyMap?: null | undefined;
|
530
|
+
state?: {} | undefined;
|
531
|
+
breakSymbol?: {} | undefined;
|
532
|
+
deleteNodeSymbol?: null | undefined;
|
533
|
+
skipVisitingNodeSymbol?: boolean | undefined;
|
534
|
+
visitFnGetter?: ((visitor: any, type: string | undefined, isLeaving: boolean) => ((...args: any[]) => any) | null) | undefined;
|
535
|
+
nodeTypeGetter?: ((node: any) => string | undefined) | undefined;
|
536
|
+
nodePredicate?: ((node: any) => boolean) | undefined;
|
537
|
+
nodeCloneFn?: ((node: any) => any) | undefined;
|
538
|
+
detectCycles?: boolean | undefined;
|
539
|
+
}) => any;
|
540
|
+
|
541
|
+
/**
|
542
|
+
* @public
|
543
|
+
*/
|
544
|
+
export declare class YamlAlias extends Node_2 {
|
545
|
+
static readonly type = "alias";
|
546
|
+
readonly content: string;
|
547
|
+
constructor({ content, ...rest }: YamlAliasOptions);
|
548
|
+
}
|
549
|
+
|
550
|
+
/**
|
551
|
+
* @public
|
552
|
+
*/
|
553
|
+
export declare interface YamlAliasOptions extends NodeOptions {
|
554
|
+
readonly content: string;
|
555
|
+
}
|
556
|
+
|
557
|
+
/**
|
558
|
+
* @public
|
559
|
+
*/
|
560
|
+
export declare class YamlAnchor extends Node_2 {
|
561
|
+
static readonly type = "anchor";
|
562
|
+
readonly name: string;
|
563
|
+
constructor({ name, ...rest }: YamlAnchorOptions);
|
564
|
+
}
|
565
|
+
|
566
|
+
/**
|
567
|
+
* @public
|
568
|
+
*/
|
569
|
+
export declare interface YamlAnchorOptions extends NodeOptions {
|
570
|
+
readonly name: string;
|
571
|
+
}
|
572
|
+
|
573
|
+
/**
|
574
|
+
* @public
|
575
|
+
*/
|
576
|
+
export declare class YamlCollection extends YamlNode {
|
577
|
+
}
|
578
|
+
|
579
|
+
/**
|
580
|
+
* @public
|
581
|
+
*/
|
582
|
+
export declare class YamlComment extends Node_2 {
|
583
|
+
static readonly type = "comment";
|
584
|
+
readonly content: string;
|
585
|
+
constructor({ content, ...rest }: YamlCommentOptions);
|
586
|
+
}
|
587
|
+
|
588
|
+
/**
|
589
|
+
* @public
|
590
|
+
*/
|
591
|
+
export declare interface YamlCommentOptions extends NodeOptions {
|
592
|
+
readonly content: string;
|
593
|
+
}
|
594
|
+
|
595
|
+
/**
|
596
|
+
* @public
|
597
|
+
*/
|
598
|
+
export declare class YamlDirective extends Node_2 {
|
599
|
+
static readonly type = "directive";
|
600
|
+
readonly name?: string;
|
601
|
+
readonly parameters: YamlDirectiveParameters;
|
602
|
+
constructor({ name, parameters, ...rest }: YamlDirectiveOptions);
|
603
|
+
}
|
604
|
+
|
605
|
+
/**
|
606
|
+
* @public
|
607
|
+
*/
|
608
|
+
export declare interface YamlDirectiveOptions extends NodeOptions {
|
609
|
+
readonly name?: string;
|
610
|
+
readonly parameters: YamlDirectiveParameters;
|
611
|
+
}
|
612
|
+
|
613
|
+
/**
|
614
|
+
* @public
|
615
|
+
*/
|
616
|
+
export declare interface YamlDirectiveParameters {
|
617
|
+
readonly version?: string;
|
618
|
+
readonly handle?: string;
|
619
|
+
readonly prefix?: string;
|
620
|
+
}
|
621
|
+
|
622
|
+
/**
|
623
|
+
* @public
|
624
|
+
*/
|
625
|
+
export declare class YamlDocument extends Node_2 {
|
626
|
+
static readonly type = "document";
|
627
|
+
}
|
628
|
+
|
629
|
+
/**
|
630
|
+
* @public
|
631
|
+
*/
|
632
|
+
export declare class YamlError extends ApiDOMStructuredError {
|
633
|
+
}
|
634
|
+
|
635
|
+
/**
|
636
|
+
* @public
|
637
|
+
*/
|
638
|
+
export declare class YamlFailsafeSchema {
|
639
|
+
tags: any[];
|
640
|
+
tagDirectives: YamlDirective[];
|
641
|
+
constructor();
|
642
|
+
toSpecificTagName(node: any): string;
|
643
|
+
registerTagDirective(tagDirective: YamlDirective): void;
|
644
|
+
registerTag(tag: any, beginning?: boolean): this;
|
645
|
+
overrideTag(tag: any): this;
|
646
|
+
resolve(node: any): any;
|
647
|
+
}
|
648
|
+
|
649
|
+
/**
|
650
|
+
* @public
|
651
|
+
*/
|
652
|
+
export declare class YamlJsonSchema extends YamlFailsafeSchema {
|
653
|
+
constructor();
|
654
|
+
toSpecificTagName(node: any): any;
|
655
|
+
}
|
656
|
+
|
657
|
+
/**
|
658
|
+
* @public
|
659
|
+
*/
|
660
|
+
export declare class YamlKeyValuePair extends Node_2 {
|
661
|
+
static readonly type = "keyValuePair";
|
662
|
+
readonly styleGroup: YamlStyleGroup;
|
663
|
+
constructor({ styleGroup, ...rest }: YamlKeyValuePairOptions);
|
664
|
+
}
|
665
|
+
|
666
|
+
/**
|
667
|
+
* @public
|
668
|
+
*/
|
669
|
+
export declare interface YamlKeyValuePairOptions extends NodeOptions {
|
670
|
+
readonly styleGroup: YamlStyleGroup;
|
671
|
+
}
|
672
|
+
|
673
|
+
/**
|
674
|
+
* @public
|
675
|
+
*/
|
676
|
+
export declare class YamlMapping extends YamlCollection {
|
677
|
+
static readonly type = "mapping";
|
678
|
+
}
|
679
|
+
|
680
|
+
/**
|
681
|
+
* @public
|
682
|
+
*/
|
683
|
+
export declare class YamlNode extends Node_2 {
|
684
|
+
readonly anchor?: YamlAnchor;
|
685
|
+
readonly tag?: YamlTag;
|
686
|
+
readonly style: YamlStyle;
|
687
|
+
readonly styleGroup: YamlStyleGroup;
|
688
|
+
constructor({ anchor, tag, style, styleGroup, ...rest }: YamlNodeOptions);
|
689
|
+
}
|
690
|
+
|
691
|
+
/**
|
692
|
+
* @public
|
693
|
+
*/
|
694
|
+
export declare enum YamlNodeKind {
|
695
|
+
Scalar = "Scalar",
|
696
|
+
Sequence = "Sequence",
|
697
|
+
Mapping = "Mapping"
|
698
|
+
}
|
699
|
+
|
700
|
+
/**
|
701
|
+
* @public
|
702
|
+
*/
|
703
|
+
export declare interface YamlNodeOptions extends NodeOptions {
|
704
|
+
readonly anchor?: YamlAnchor;
|
705
|
+
readonly tag?: YamlTag;
|
706
|
+
readonly style: YamlStyle;
|
707
|
+
readonly styleGroup: YamlStyleGroup;
|
708
|
+
}
|
709
|
+
|
710
|
+
/**
|
711
|
+
* @public
|
712
|
+
*/
|
713
|
+
export declare class YamlReferenceError extends YamlError {
|
714
|
+
}
|
715
|
+
|
716
|
+
/**
|
717
|
+
* @public
|
718
|
+
*/
|
719
|
+
export declare class YamlReferenceManager {
|
720
|
+
addAnchor(node: YamlNode): void;
|
721
|
+
resolveAlias(alias: YamlAlias): YamlScalar;
|
722
|
+
}
|
723
|
+
|
724
|
+
/**
|
725
|
+
* @public
|
726
|
+
*/
|
727
|
+
export declare class YamlScalar extends YamlNode {
|
728
|
+
static readonly type = "scalar";
|
729
|
+
readonly content: string;
|
730
|
+
constructor({ content, ...rest }: YamlScalarOptions);
|
731
|
+
}
|
732
|
+
|
733
|
+
/**
|
734
|
+
* @public
|
735
|
+
*/
|
736
|
+
export declare interface YamlScalarOptions extends YamlNodeOptions {
|
737
|
+
readonly content: string;
|
738
|
+
}
|
739
|
+
|
740
|
+
/**
|
741
|
+
* @public
|
742
|
+
*/
|
743
|
+
export declare class YamlSchemaError extends YamlError {
|
744
|
+
}
|
745
|
+
|
746
|
+
/**
|
747
|
+
* @public
|
748
|
+
*/
|
749
|
+
export declare class YamlSequence extends YamlCollection {
|
750
|
+
static readonly type = "sequence";
|
751
|
+
}
|
752
|
+
|
753
|
+
/**
|
754
|
+
* @public
|
755
|
+
*/
|
756
|
+
export declare class YamlStream extends Node_2 {
|
757
|
+
static readonly type = "stream";
|
758
|
+
}
|
759
|
+
|
760
|
+
/**
|
761
|
+
* @public
|
762
|
+
*/
|
763
|
+
export declare enum YamlStyle {
|
764
|
+
Plain = "Plain",
|
765
|
+
SingleQuoted = "SingleQuoted",
|
766
|
+
DoubleQuoted = "DoubleQuoted",
|
767
|
+
Literal = "Literal",
|
768
|
+
Folded = "Folded",
|
769
|
+
Explicit = "Explicit",
|
770
|
+
SinglePair = "SinglePair",
|
771
|
+
NextLine = "NextLine",
|
772
|
+
InLine = "InLine"
|
773
|
+
}
|
774
|
+
|
775
|
+
/**
|
776
|
+
* @public
|
777
|
+
*/
|
778
|
+
export declare enum YamlStyleGroup {
|
779
|
+
Flow = "Flow",
|
780
|
+
Block = "Block"
|
781
|
+
}
|
782
|
+
|
783
|
+
/**
|
784
|
+
* @public
|
785
|
+
*/
|
786
|
+
export declare class YamlTag extends Node_2 {
|
787
|
+
static readonly type = "tag";
|
788
|
+
readonly explicitName: string;
|
789
|
+
readonly kind: YamlNodeKind;
|
790
|
+
constructor({ explicitName, kind, ...rest }: YamlTagOptions);
|
791
|
+
}
|
792
|
+
|
793
|
+
/**
|
794
|
+
* @public
|
795
|
+
*/
|
796
|
+
export declare class YamlTagError extends YamlSchemaError {
|
797
|
+
readonly specificTagName: string;
|
798
|
+
readonly explicitTagName: string;
|
799
|
+
readonly tagKind: string;
|
800
|
+
readonly tagPosition?: Position;
|
801
|
+
readonly nodeCanonicalContent?: string;
|
802
|
+
readonly node?: unknown;
|
803
|
+
constructor(message?: string, structuredOptions?: YamlTagErrorOptions);
|
804
|
+
}
|
805
|
+
|
806
|
+
/**
|
807
|
+
* @public
|
808
|
+
*/
|
809
|
+
export declare interface YamlTagErrorOptions<T extends Node_2 = Node_2> extends ApiDOMErrorOptions {
|
810
|
+
readonly specificTagName: string;
|
811
|
+
readonly explicitTagName: string;
|
812
|
+
readonly tagKind: string;
|
813
|
+
readonly tagPosition?: Position;
|
814
|
+
readonly nodeCanonicalContent?: string;
|
815
|
+
readonly node?: T;
|
816
|
+
}
|
817
|
+
|
818
|
+
/**
|
819
|
+
* @public
|
820
|
+
*/
|
821
|
+
export declare interface YamlTagOptions extends NodeOptions {
|
822
|
+
readonly explicitName: string;
|
823
|
+
readonly kind: YamlNodeKind;
|
824
|
+
}
|
825
|
+
|
826
|
+
export { }
|