summaryrefslogtreecommitdiff
path: root/MistyCore/node_modules/yaml/dist/options.d.ts
blob: 06e1b6db566854ceb4cedab8b5c8b70c3c29219e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
import type { Reviver } from './doc/applyReviver.js';
import type { Directives } from './doc/directives.js';
import type { LogLevelId } from './log.js';
import type { ParsedNode } from './nodes/Node.js';
import type { Pair } from './nodes/Pair.js';
import type { Scalar } from './nodes/Scalar.js';
import type { LineCounter } from './parse/line-counter.js';
import type { Schema } from './schema/Schema.js';
import type { Tags } from './schema/tags.js';
import type { CollectionTag, ScalarTag } from './schema/types.js';
export declare type ParseOptions = {
    /**
     * Whether integers should be parsed into BigInt rather than number values.
     *
     * Default: `false`
     *
     * https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/BigInt
     */
    intAsBigInt?: boolean;
    /**
     * Include a `srcToken` value on each parsed `Node`, containing the CST token
     * that was composed into this node.
     *
     * Default: `false`
     */
    keepSourceTokens?: boolean;
    /**
     * If set, newlines will be tracked, to allow for `lineCounter.linePos(offset)`
     * to provide the `{ line, col }` positions within the input.
     */
    lineCounter?: LineCounter;
    /**
     * Include line/col position & node type directly in parse errors.
     *
     * Default: `true`
     */
    prettyErrors?: boolean;
    /**
     * Detect and report errors that are required by the YAML 1.2 spec,
     * but are caused by unambiguous content.
     *
     * Default: `true`
     */
    strict?: boolean;
    /**
     * YAML requires map keys to be unique. By default, this is checked by
     * comparing scalar values with `===`; deep equality is not checked for
     * aliases or collections. If merge keys are enabled by the schema,
     * multiple `<<` keys are allowed.
     *
     * Set `false` to disable, or provide your own comparator function to
     * customise. The comparator will be passed two `ParsedNode` values, and
     * is expected to return a `boolean` indicating their equality.
     *
     * Default: `true`
     */
    uniqueKeys?: boolean | ((a: ParsedNode, b: ParsedNode) => boolean);
};
export declare type DocumentOptions = {
    /**
     * @internal
     * Used internally by Composer. If set and includes an explicit version,
     * that overrides the `version` option.
     */
    _directives?: Directives;
    /**
     * Control the logging level during parsing
     *
     * Default: `'warn'`
     */
    logLevel?: LogLevelId;
    /**
     * The YAML version used by documents without a `%YAML` directive.
     *
     * Default: `"1.2"`
     */
    version?: '1.1' | '1.2' | 'next';
};
export declare type SchemaOptions = {
    /**
     * When parsing, warn about compatibility issues with the given schema.
     * When stringifying, use scalar styles that are parsed correctly
     * by the `compat` schema as well as the actual schema.
     *
     * Default: `null`
     */
    compat?: string | Tags | null;
    /**
     * Array of additional tags to include in the schema, or a function that may
     * modify the schema's base tag array.
     */
    customTags?: Tags | ((tags: Tags) => Tags) | null;
    /**
     * Enable support for `<<` merge keys.
     *
     * Default: `false` for YAML 1.2, `true` for earlier versions
     */
    merge?: boolean;
    /**
     * When using the `'core'` schema, support parsing values with these
     * explicit YAML 1.1 tags:
     *
     * `!!binary`, `!!omap`, `!!pairs`, `!!set`, `!!timestamp`.
     *
     * Default `true`
     */
    resolveKnownTags?: boolean;
    /**
     * The base schema to use.
     *
     * The core library has built-in support for the following:
     * - `'failsafe'`: A minimal schema that parses all scalars as strings
     * - `'core'`: The YAML 1.2 core schema
     * - `'json'`: The YAML 1.2 JSON schema, with minimal rules for JSON compatibility
     * - `'yaml-1.1'`: The YAML 1.1 schema
     *
     * If using another (custom) schema, the `customTags` array needs to
     * fully define the schema's tags.
     *
     * Default: `'core'` for YAML 1.2, `'yaml-1.1'` for earlier versions
     */
    schema?: string | Schema;
    /**
     * When adding to or stringifying a map, sort the entries.
     * If `true`, sort by comparing key values with `<`.
     * Does not affect item order when parsing.
     *
     * Default: `false`
     */
    sortMapEntries?: boolean | ((a: Pair, b: Pair) => number);
    /**
     * Override default values for `toString()` options.
     */
    toStringDefaults?: ToStringOptions;
};
export declare type CreateNodeOptions = {
    /**
     * During node construction, use anchors and aliases to keep strictly equal
     * non-null objects as equivalent in YAML.
     *
     * Default: `true`
     */
    aliasDuplicateObjects?: boolean;
    /**
     * Default prefix for anchors.
     *
     * Default: `'a'`, resulting in anchors `a1`, `a2`, etc.
     */
    anchorPrefix?: string;
    /** Force the top-level collection node to use flow style. */
    flow?: boolean;
    /**
     * Keep `undefined` object values when creating mappings, rather than
     * discarding them.
     *
     * Default: `false`
     */
    keepUndefined?: boolean | null;
    onTagObj?: (tagObj: ScalarTag | CollectionTag) => void;
    /**
     * Specify the top-level collection type, e.g. `"!!omap"`. Note that this
     * requires the corresponding tag to be available in this document's schema.
     */
    tag?: string;
};
export declare type ToJSOptions = {
    /**
     * Use Map rather than Object to represent mappings.
     *
     * Default: `false`
     */
    mapAsMap?: boolean;
    /**
     * Prevent exponential entity expansion attacks by limiting data aliasing count;
     * set to `-1` to disable checks; `0` disallows all alias nodes.
     *
     * Default: `100`
     */
    maxAliasCount?: number;
    /**
     * If defined, called with the resolved `value` and reference `count` for
     * each anchor in the document.
     */
    onAnchor?: (value: unknown, count: number) => void;
    /**
     * Optional function that may filter or modify the output JS value
     *
     * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter
     */
    reviver?: Reviver;
};
export declare type ToStringOptions = {
    /**
     * Use block quote styles for scalar values where applicable.
     * Set to `false` to disable block quotes completely.
     *
     * Default: `true`
     */
    blockQuote?: boolean | 'folded' | 'literal';
    /**
     * Enforce `'block'` or `'flow'` style on maps and sequences.
     * Empty collections will always be stringified as `{}` or `[]`.
     *
     * Default: `'any'`, allowing each node to set its style separately
     * with its `flow: boolean` (default `false`) property.
     */
    collectionStyle?: 'any' | 'block' | 'flow';
    /**
     * Comment stringifier.
     * Output should be valid for the current schema.
     *
     * By default, empty comment lines are left empty,
     * lines consisting of a single space are replaced by `#`,
     * and all other lines are prefixed with a `#`.
     */
    commentString?: (comment: string) => string;
    /**
     * The default type of string literal used to stringify implicit key values.
     * Output may use other types if required to fully represent the value.
     *
     * If `null`, the value of `defaultStringType` is used.
     *
     * Default: `null`
     */
    defaultKeyType?: Scalar.Type | null;
    /**
     * The default type of string literal used to stringify values in general.
     * Output may use other types if required to fully represent the value.
     *
     * Default: `'PLAIN'`
     */
    defaultStringType?: Scalar.Type;
    /**
     * Include directives in the output.
     *
     * - If `true`, at least the document-start marker `---` is always included.
     *   This does not force the `%YAML` directive to be included. To do that,
     *   set `doc.directives.yaml.explicit = true`.
     * - If `false`, no directives or marker is ever included. If using the `%TAG`
     *   directive, you are expected to include it manually in the stream before
     *   its use.
     * - If `null`, directives and marker may be included if required.
     *
     * Default: `null`
     */
    directives?: boolean | null;
    /**
     * Restrict double-quoted strings to use JSON-compatible syntax.
     *
     * Default: `false`
     */
    doubleQuotedAsJSON?: boolean;
    /**
     * Minimum length for double-quoted strings to use multiple lines to
     * represent the value. Ignored if `doubleQuotedAsJSON` is set.
     *
     * Default: `40`
     */
    doubleQuotedMinMultiLineLength?: number;
    /**
     * String representation for `false`.
     * With the core schema, use `'false'`, `'False'`, or `'FALSE'`.
     *
     * Default: `'false'`
     */
    falseStr?: string;
    /**
     * The number of spaces to use when indenting code.
     *
     * Default: `2`
     */
    indent?: number;
    /**
     * Whether block sequences should be indented.
     *
     * Default: `true`
     */
    indentSeq?: boolean;
    /**
     * Maximum line width (set to `0` to disable folding).
     *
     * This is a soft limit, as only double-quoted semantics allow for inserting
     * a line break in the middle of a word, as well as being influenced by the
     * `minContentWidth` option.
     *
     * Default: `80`
     */
    lineWidth?: number;
    /**
     * Minimum line width for highly-indented content (set to `0` to disable).
     *
     * Default: `20`
     */
    minContentWidth?: number;
    /**
     * String representation for `null`.
     * With the core schema, use `'null'`, `'Null'`, `'NULL'`, `'~'`, or an empty
     * string `''`.
     *
     * Default: `'null'`
     */
    nullStr?: string;
    /**
     * Require keys to be scalars and to use implicit rather than explicit notation.
     *
     * Default: `false`
     */
    simpleKeys?: boolean;
    /**
     * Use 'single quote' rather than "double quote" where applicable.
     * Set to `false` to disable single quotes completely.
     *
     * Default: `null`
     */
    singleQuote?: boolean | null;
    /**
     * String representation for `true`.
     * With the core schema, use `'true'`, `'True'`, or `'TRUE'`.
     *
     * Default: `'true'`
     */
    trueStr?: string;
    /**
     * The anchor used by an alias must be defined before the alias node. As it's
     * possible for the document to be modified manually, the order may be
     * verified during stringification.
     *
     * Default: `'true'`
     */
    verifyAliasOrder?: boolean;
};