windmill-cli 1.612.2 → 1.612.3
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/esm/deps/jsr.io/@std/fmt/{1.0.8 → 1.0.9}/colors.js +14 -14
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_create_walk_entry.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_is_same_path.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_is_subdir.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_to_path_string.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/copy.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/empty_dir.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_dir.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_file.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_link.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_symlink.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/eol.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/exists.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/expand_glob.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/mod.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/move.js +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/walk.js +5 -5
- package/esm/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.14/rotating_file_handler.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_dumper_state.js +46 -50
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_loader_state.js +250 -273
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/mod.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/stringify.js +1 -1
- package/esm/deps.js +3 -3
- package/esm/gen/services.gen.js +18 -16
- package/esm/src/commands/app/app.js +3 -0
- package/esm/src/commands/app/dev.js +7 -2
- package/esm/src/commands/sync/sync.js +30 -0
- package/esm/src/commands/workspace/workspace.js +19 -0
- package/esm/src/types.js +10 -1
- package/package.json +2 -2
- package/types/deps/jsr.io/@std/fmt/{1.0.8 → 1.0.9}/colors.d.ts +12 -12
- package/types/deps/jsr.io/@std/fmt/{1.0.8 → 1.0.9}/colors.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_create_walk_entry.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_get_file_info_type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_is_same_path.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_is_subdir.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_to_path_string.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/copy.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/empty_dir.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_dir.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_file.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_link.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_symlink.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/eol.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/exists.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/expand_glob.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/move.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/walk.d.ts +4 -4
- package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/walk.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_dumper_state.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_loader_state.d.ts +21 -18
- package/types/deps/jsr.io/@std/yaml/1.0.11/_loader_state.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/stringify.d.ts.map +1 -1
- package/types/deps.d.ts +3 -3
- package/types/gen/services.gen.d.ts +10 -9
- package/types/gen/services.gen.d.ts.map +1 -1
- package/types/gen/types.gen.d.ts +9 -4
- package/types/gen/types.gen.d.ts.map +1 -1
- package/types/src/commands/app/app.d.ts.map +1 -1
- package/types/src/commands/sync/sync.d.ts.map +1 -1
- package/types/src/commands/workspace/workspace.d.ts.map +1 -1
- package/types/src/types.d.ts.map +1 -1
- package/types/windmill-utils-internal/src/gen/types.gen.d.ts +9 -4
- package/types/windmill-utils-internal/src/gen/types.gen.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_get_file_info_type.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.js +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_create_walk_entry.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_get_file_info_type.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_is_same_path.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_is_subdir.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/_to_path_string.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/copy.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/empty_dir.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_dir.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_file.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_link.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/ensure_symlink.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/eol.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/exists.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/expand_glob.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/mod.d.ts +0 -0
- /package/types/deps/jsr.io/@std/fs/{1.0.21 → 1.0.22}/move.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_dumper_state.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/mod.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.d.ts +0 -0
- /package/types/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/stringify.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Ported from js-yaml v3.13.1:
|
|
2
2
|
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
|
|
3
3
|
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
|
|
4
|
-
// Copyright 2018-
|
|
4
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
5
5
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
6
6
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7
7
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -123,6 +123,20 @@ function markToString(buffer, position, line, column) {
|
|
|
123
123
|
where += `:\n${snippet}`;
|
|
124
124
|
return where;
|
|
125
125
|
}
|
|
126
|
+
function getIndentStatus(lineIndent, parentIndent) {
|
|
127
|
+
if (lineIndent > parentIndent)
|
|
128
|
+
return 1;
|
|
129
|
+
if (lineIndent < parentIndent)
|
|
130
|
+
return -1;
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
function writeFoldedLines(count) {
|
|
134
|
+
if (count === 1)
|
|
135
|
+
return " ";
|
|
136
|
+
if (count > 1)
|
|
137
|
+
return "\n".repeat(count - 1);
|
|
138
|
+
return "";
|
|
139
|
+
}
|
|
126
140
|
export class LoaderState {
|
|
127
141
|
constructor(input, { schema = DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false, }) {
|
|
128
142
|
_LoaderState_instances.add(this);
|
|
@@ -204,30 +218,6 @@ export class LoaderState {
|
|
|
204
218
|
writable: true,
|
|
205
219
|
value: new Map()
|
|
206
220
|
});
|
|
207
|
-
Object.defineProperty(this, "tag", {
|
|
208
|
-
enumerable: true,
|
|
209
|
-
configurable: true,
|
|
210
|
-
writable: true,
|
|
211
|
-
value: void 0
|
|
212
|
-
});
|
|
213
|
-
Object.defineProperty(this, "anchor", {
|
|
214
|
-
enumerable: true,
|
|
215
|
-
configurable: true,
|
|
216
|
-
writable: true,
|
|
217
|
-
value: void 0
|
|
218
|
-
});
|
|
219
|
-
Object.defineProperty(this, "kind", {
|
|
220
|
-
enumerable: true,
|
|
221
|
-
configurable: true,
|
|
222
|
-
writable: true,
|
|
223
|
-
value: void 0
|
|
224
|
-
});
|
|
225
|
-
Object.defineProperty(this, "result", {
|
|
226
|
-
enumerable: true,
|
|
227
|
-
configurable: true,
|
|
228
|
-
writable: true,
|
|
229
|
-
value: ""
|
|
230
|
-
});
|
|
231
221
|
this.input = input;
|
|
232
222
|
this.onWarning = onWarning;
|
|
233
223
|
this.allowDuplicateKeys = allowDuplicateKeys;
|
|
@@ -320,17 +310,14 @@ export class LoaderState {
|
|
|
320
310
|
else if (PATTERN_NON_PRINTABLE.test(result)) {
|
|
321
311
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Stream contains non-printable characters");
|
|
322
312
|
}
|
|
323
|
-
|
|
313
|
+
return result;
|
|
324
314
|
}
|
|
325
315
|
}
|
|
326
|
-
readBlockSequence(nodeIndent) {
|
|
316
|
+
readBlockSequence(tag, anchor, nodeIndent) {
|
|
327
317
|
let detected = false;
|
|
328
|
-
const tag = this.tag;
|
|
329
|
-
const anchor = this.anchor;
|
|
330
318
|
const result = [];
|
|
331
|
-
if (
|
|
332
|
-
this.anchorMap.set(
|
|
333
|
-
}
|
|
319
|
+
if (anchor !== null)
|
|
320
|
+
this.anchorMap.set(anchor, result);
|
|
334
321
|
let ch = this.peek();
|
|
335
322
|
while (ch !== 0) {
|
|
336
323
|
if (ch !== MINUS) {
|
|
@@ -350,13 +337,14 @@ export class LoaderState {
|
|
|
350
337
|
}
|
|
351
338
|
}
|
|
352
339
|
const line = this.line;
|
|
353
|
-
this.composeNode({
|
|
340
|
+
const newState = this.composeNode({
|
|
354
341
|
parentIndent: nodeIndent,
|
|
355
342
|
nodeContext: CONTEXT_BLOCK_IN,
|
|
356
343
|
allowToSeek: false,
|
|
357
344
|
allowCompact: true,
|
|
358
345
|
});
|
|
359
|
-
|
|
346
|
+
if (newState)
|
|
347
|
+
result.push(newState.result);
|
|
360
348
|
this.skipSeparationSpace(true, -1);
|
|
361
349
|
ch = this.peek();
|
|
362
350
|
if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
|
|
@@ -366,14 +354,8 @@ export class LoaderState {
|
|
|
366
354
|
break;
|
|
367
355
|
}
|
|
368
356
|
}
|
|
369
|
-
if (detected)
|
|
370
|
-
|
|
371
|
-
this.anchor = anchor;
|
|
372
|
-
this.kind = "sequence";
|
|
373
|
-
this.result = result;
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
376
|
-
return false;
|
|
357
|
+
if (detected)
|
|
358
|
+
return { tag, anchor, kind: "sequence", result };
|
|
377
359
|
}
|
|
378
360
|
mergeMappings(destination, source, overridableKeys) {
|
|
379
361
|
if (!isObject(source)) {
|
|
@@ -501,17 +483,7 @@ export class LoaderState {
|
|
|
501
483
|
}
|
|
502
484
|
return false;
|
|
503
485
|
}
|
|
504
|
-
|
|
505
|
-
if (count === 1) {
|
|
506
|
-
this.result += " ";
|
|
507
|
-
}
|
|
508
|
-
else if (count > 1) {
|
|
509
|
-
this.result += "\n".repeat(count - 1);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
readPlainScalar(nodeIndent, withinFlowCollection) {
|
|
513
|
-
const kind = this.kind;
|
|
514
|
-
const result = this.result;
|
|
486
|
+
readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
|
|
515
487
|
let ch = this.peek();
|
|
516
488
|
if (isWhiteSpaceOrEOL(ch) ||
|
|
517
489
|
isFlowIndicator(ch) ||
|
|
@@ -526,18 +498,17 @@ export class LoaderState {
|
|
|
526
498
|
ch === PERCENT ||
|
|
527
499
|
ch === COMMERCIAL_AT ||
|
|
528
500
|
ch === GRAVE_ACCENT) {
|
|
529
|
-
return
|
|
501
|
+
return;
|
|
530
502
|
}
|
|
531
503
|
let following;
|
|
532
504
|
if (ch === QUESTION || ch === MINUS) {
|
|
533
505
|
following = this.peek(1);
|
|
534
506
|
if (isWhiteSpaceOrEOL(following) ||
|
|
535
507
|
(withinFlowCollection && isFlowIndicator(following))) {
|
|
536
|
-
return
|
|
508
|
+
return;
|
|
537
509
|
}
|
|
538
510
|
}
|
|
539
|
-
|
|
540
|
-
this.result = "";
|
|
511
|
+
let result = "";
|
|
541
512
|
let captureEnd = this.position;
|
|
542
513
|
let captureStart = this.position;
|
|
543
514
|
let hasPendingContent = false;
|
|
@@ -579,8 +550,10 @@ export class LoaderState {
|
|
|
579
550
|
}
|
|
580
551
|
}
|
|
581
552
|
if (hasPendingContent) {
|
|
582
|
-
this.captureSegment(captureStart, captureEnd, false);
|
|
583
|
-
|
|
553
|
+
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
554
|
+
if (segment)
|
|
555
|
+
result += segment;
|
|
556
|
+
result += writeFoldedLines(this.line - line);
|
|
584
557
|
captureStart = captureEnd = this.position;
|
|
585
558
|
hasPendingContent = false;
|
|
586
559
|
}
|
|
@@ -589,28 +562,28 @@ export class LoaderState {
|
|
|
589
562
|
}
|
|
590
563
|
ch = this.next();
|
|
591
564
|
}
|
|
592
|
-
this.captureSegment(captureStart, captureEnd, false);
|
|
593
|
-
if (
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
565
|
+
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
566
|
+
if (segment)
|
|
567
|
+
result += segment;
|
|
568
|
+
if (anchor !== null)
|
|
569
|
+
this.anchorMap.set(anchor, result);
|
|
570
|
+
if (result)
|
|
571
|
+
return { tag, anchor, kind: "scalar", result };
|
|
599
572
|
}
|
|
600
|
-
readSingleQuotedScalar(nodeIndent) {
|
|
573
|
+
readSingleQuotedScalar(tag, anchor, nodeIndent) {
|
|
601
574
|
let ch = this.peek();
|
|
602
|
-
if (ch !== SINGLE_QUOTE)
|
|
603
|
-
return
|
|
604
|
-
|
|
605
|
-
this.kind = "scalar";
|
|
606
|
-
this.result = "";
|
|
575
|
+
if (ch !== SINGLE_QUOTE)
|
|
576
|
+
return;
|
|
577
|
+
let result = "";
|
|
607
578
|
this.position++;
|
|
608
579
|
let captureStart = this.position;
|
|
609
580
|
let captureEnd = this.position;
|
|
610
581
|
ch = this.peek();
|
|
611
582
|
while (ch !== 0) {
|
|
612
583
|
if (ch === SINGLE_QUOTE) {
|
|
613
|
-
this.captureSegment(captureStart, this.position, true);
|
|
584
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
585
|
+
if (segment)
|
|
586
|
+
result += segment;
|
|
614
587
|
ch = this.next();
|
|
615
588
|
if (ch === SINGLE_QUOTE) {
|
|
616
589
|
captureStart = this.position;
|
|
@@ -618,12 +591,16 @@ export class LoaderState {
|
|
|
618
591
|
captureEnd = this.position;
|
|
619
592
|
}
|
|
620
593
|
else {
|
|
621
|
-
|
|
594
|
+
if (anchor !== null)
|
|
595
|
+
this.anchorMap.set(anchor, result);
|
|
596
|
+
return { tag, anchor, kind: "scalar", result };
|
|
622
597
|
}
|
|
623
598
|
}
|
|
624
599
|
else if (isEOL(ch)) {
|
|
625
|
-
this.captureSegment(captureStart, captureEnd, true);
|
|
626
|
-
|
|
600
|
+
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
601
|
+
if (segment)
|
|
602
|
+
result += segment;
|
|
603
|
+
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
627
604
|
captureStart = captureEnd = this.position;
|
|
628
605
|
}
|
|
629
606
|
else if (this.position === this.lineStart &&
|
|
@@ -638,13 +615,11 @@ export class LoaderState {
|
|
|
638
615
|
}
|
|
639
616
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the stream within a single quoted scalar");
|
|
640
617
|
}
|
|
641
|
-
readDoubleQuotedScalar(nodeIndent) {
|
|
618
|
+
readDoubleQuotedScalar(tag, anchor, nodeIndent) {
|
|
642
619
|
let ch = this.peek();
|
|
643
|
-
if (ch !== DOUBLE_QUOTE)
|
|
644
|
-
return
|
|
645
|
-
|
|
646
|
-
this.kind = "scalar";
|
|
647
|
-
this.result = "";
|
|
620
|
+
if (ch !== DOUBLE_QUOTE)
|
|
621
|
+
return;
|
|
622
|
+
let result = "";
|
|
648
623
|
this.position++;
|
|
649
624
|
let captureEnd = this.position;
|
|
650
625
|
let captureStart = this.position;
|
|
@@ -652,18 +627,24 @@ export class LoaderState {
|
|
|
652
627
|
ch = this.peek();
|
|
653
628
|
while (ch !== 0) {
|
|
654
629
|
if (ch === DOUBLE_QUOTE) {
|
|
655
|
-
this.captureSegment(captureStart, this.position, true);
|
|
630
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
631
|
+
if (segment)
|
|
632
|
+
result += segment;
|
|
656
633
|
this.position++;
|
|
657
|
-
|
|
634
|
+
if (anchor !== null)
|
|
635
|
+
this.anchorMap.set(anchor, result);
|
|
636
|
+
return { tag, anchor, kind: "scalar", result };
|
|
658
637
|
}
|
|
659
638
|
if (ch === BACKSLASH) {
|
|
660
|
-
this.captureSegment(captureStart, this.position, true);
|
|
639
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
640
|
+
if (segment)
|
|
641
|
+
result += segment;
|
|
661
642
|
ch = this.next();
|
|
662
643
|
if (isEOL(ch)) {
|
|
663
644
|
this.skipSeparationSpace(false, nodeIndent);
|
|
664
645
|
}
|
|
665
646
|
else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
|
|
666
|
-
|
|
647
|
+
result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
|
|
667
648
|
this.position++;
|
|
668
649
|
}
|
|
669
650
|
else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
|
|
@@ -678,7 +659,7 @@ export class LoaderState {
|
|
|
678
659
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read double quoted scalar: expected hexadecimal character");
|
|
679
660
|
}
|
|
680
661
|
}
|
|
681
|
-
|
|
662
|
+
result += codepointToChar(hexResult);
|
|
682
663
|
this.position++;
|
|
683
664
|
}
|
|
684
665
|
else {
|
|
@@ -687,8 +668,10 @@ export class LoaderState {
|
|
|
687
668
|
captureStart = captureEnd = this.position;
|
|
688
669
|
}
|
|
689
670
|
else if (isEOL(ch)) {
|
|
690
|
-
this.captureSegment(captureStart, captureEnd, true);
|
|
691
|
-
|
|
671
|
+
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
672
|
+
if (segment)
|
|
673
|
+
result += segment;
|
|
674
|
+
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
692
675
|
captureStart = captureEnd = this.position;
|
|
693
676
|
}
|
|
694
677
|
else if (this.position === this.lineStart &&
|
|
@@ -703,7 +686,7 @@ export class LoaderState {
|
|
|
703
686
|
}
|
|
704
687
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the stream within a double quoted scalar");
|
|
705
688
|
}
|
|
706
|
-
readFlowCollection(nodeIndent) {
|
|
689
|
+
readFlowCollection(tag, anchor, nodeIndent) {
|
|
707
690
|
let ch = this.peek();
|
|
708
691
|
let terminator;
|
|
709
692
|
let isMapping = true;
|
|
@@ -717,14 +700,11 @@ export class LoaderState {
|
|
|
717
700
|
terminator = RIGHT_CURLY_BRACKET;
|
|
718
701
|
}
|
|
719
702
|
else {
|
|
720
|
-
return
|
|
721
|
-
}
|
|
722
|
-
if (this.anchor !== null && typeof this.anchor !== "undefined") {
|
|
723
|
-
this.anchorMap.set(this.anchor, result);
|
|
703
|
+
return;
|
|
724
704
|
}
|
|
705
|
+
if (anchor !== null)
|
|
706
|
+
this.anchorMap.set(anchor, result);
|
|
725
707
|
ch = this.next();
|
|
726
|
-
const tag = this.tag;
|
|
727
|
-
const anchor = this.anchor;
|
|
728
708
|
let readNext = true;
|
|
729
709
|
let valueNode = null;
|
|
730
710
|
let keyNode = null;
|
|
@@ -739,11 +719,8 @@ export class LoaderState {
|
|
|
739
719
|
ch = this.peek();
|
|
740
720
|
if (ch === terminator) {
|
|
741
721
|
this.position++;
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
this.kind = isMapping ? "mapping" : "sequence";
|
|
745
|
-
this.result = result;
|
|
746
|
-
return true;
|
|
722
|
+
const kind = isMapping ? "mapping" : "sequence";
|
|
723
|
+
return { tag, anchor, kind, result };
|
|
747
724
|
}
|
|
748
725
|
if (!readNext) {
|
|
749
726
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read flow collection: missing comma between flow collection entries");
|
|
@@ -759,27 +736,30 @@ export class LoaderState {
|
|
|
759
736
|
}
|
|
760
737
|
}
|
|
761
738
|
line = this.line;
|
|
762
|
-
this.composeNode({
|
|
739
|
+
const newState = this.composeNode({
|
|
763
740
|
parentIndent: nodeIndent,
|
|
764
741
|
nodeContext: CONTEXT_FLOW_IN,
|
|
765
742
|
allowToSeek: false,
|
|
766
743
|
allowCompact: true,
|
|
767
744
|
});
|
|
768
|
-
|
|
769
|
-
|
|
745
|
+
if (newState) {
|
|
746
|
+
keyTag = newState.tag || null;
|
|
747
|
+
keyNode = newState.result;
|
|
748
|
+
}
|
|
770
749
|
this.skipSeparationSpace(true, nodeIndent);
|
|
771
750
|
ch = this.peek();
|
|
772
751
|
if ((isExplicitPair || this.line === line) && ch === COLON) {
|
|
773
752
|
isPair = true;
|
|
774
753
|
ch = this.next();
|
|
775
754
|
this.skipSeparationSpace(true, nodeIndent);
|
|
776
|
-
this.composeNode({
|
|
755
|
+
const newState = this.composeNode({
|
|
777
756
|
parentIndent: nodeIndent,
|
|
778
757
|
nodeContext: CONTEXT_FLOW_IN,
|
|
779
758
|
allowToSeek: false,
|
|
780
759
|
allowCompact: true,
|
|
781
760
|
});
|
|
782
|
-
|
|
761
|
+
if (newState)
|
|
762
|
+
valueNode = newState.result;
|
|
783
763
|
}
|
|
784
764
|
if (isMapping) {
|
|
785
765
|
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode);
|
|
@@ -804,7 +784,7 @@ export class LoaderState {
|
|
|
804
784
|
}
|
|
805
785
|
// Handles block scaler styles: e.g. '|', '>', '|-' and '>-'.
|
|
806
786
|
// https://yaml.org/spec/1.2.2/#81-block-scalar-styles
|
|
807
|
-
readBlockScalar(nodeIndent) {
|
|
787
|
+
readBlockScalar(tag, anchor, nodeIndent) {
|
|
808
788
|
let chomping = CHOMPING_CLIP;
|
|
809
789
|
let didReadContent = false;
|
|
810
790
|
let detectedIndent = false;
|
|
@@ -820,10 +800,9 @@ export class LoaderState {
|
|
|
820
800
|
folding = true;
|
|
821
801
|
}
|
|
822
802
|
else {
|
|
823
|
-
return
|
|
803
|
+
return;
|
|
824
804
|
}
|
|
825
|
-
|
|
826
|
-
this.result = "";
|
|
805
|
+
let result = "";
|
|
827
806
|
let tmp = 0;
|
|
828
807
|
while (ch !== 0) {
|
|
829
808
|
ch = this.next();
|
|
@@ -876,12 +855,12 @@ export class LoaderState {
|
|
|
876
855
|
if (this.lineIndent < textIndent) {
|
|
877
856
|
// Perform the chomping.
|
|
878
857
|
if (chomping === CHOMPING_KEEP) {
|
|
879
|
-
|
|
858
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
880
859
|
}
|
|
881
860
|
else if (chomping === CHOMPING_CLIP) {
|
|
882
861
|
if (didReadContent) {
|
|
883
862
|
// i.e. only if the scalar is not empty.
|
|
884
|
-
|
|
863
|
+
result += "\n";
|
|
885
864
|
}
|
|
886
865
|
}
|
|
887
866
|
// Break this `while` cycle and go to the function's epilogue.
|
|
@@ -893,29 +872,29 @@ export class LoaderState {
|
|
|
893
872
|
if (isWhiteSpace(ch)) {
|
|
894
873
|
atMoreIndented = true;
|
|
895
874
|
// except for the first content line (cf. Example 8.1)
|
|
896
|
-
|
|
875
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
897
876
|
// End of more-indented block.
|
|
898
877
|
}
|
|
899
878
|
else if (atMoreIndented) {
|
|
900
879
|
atMoreIndented = false;
|
|
901
|
-
|
|
880
|
+
result += "\n".repeat(emptyLines + 1);
|
|
902
881
|
// Just one line break - perceive as the same line.
|
|
903
882
|
}
|
|
904
883
|
else if (emptyLines === 0) {
|
|
905
884
|
if (didReadContent) {
|
|
906
885
|
// i.e. only if we have already read some scalar content.
|
|
907
|
-
|
|
886
|
+
result += " ";
|
|
908
887
|
}
|
|
909
888
|
// Several line breaks - perceive as different lines.
|
|
910
889
|
}
|
|
911
890
|
else {
|
|
912
|
-
|
|
891
|
+
result += "\n".repeat(emptyLines);
|
|
913
892
|
}
|
|
914
893
|
// Literal style: just add exact number of line breaks between content lines.
|
|
915
894
|
}
|
|
916
895
|
else {
|
|
917
896
|
// Keep all line breaks except the header line break.
|
|
918
|
-
|
|
897
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
919
898
|
}
|
|
920
899
|
didReadContent = true;
|
|
921
900
|
detectedIndent = true;
|
|
@@ -924,13 +903,15 @@ export class LoaderState {
|
|
|
924
903
|
while (!isEOL(ch) && ch !== 0) {
|
|
925
904
|
ch = this.next();
|
|
926
905
|
}
|
|
927
|
-
this.captureSegment(captureStart, this.position, false);
|
|
906
|
+
const segment = this.captureSegment(captureStart, this.position, false);
|
|
907
|
+
if (segment)
|
|
908
|
+
result += segment;
|
|
928
909
|
}
|
|
929
|
-
|
|
910
|
+
if (anchor !== null)
|
|
911
|
+
this.anchorMap.set(anchor, result);
|
|
912
|
+
return { tag, anchor, kind: "scalar", result };
|
|
930
913
|
}
|
|
931
|
-
readBlockMapping(nodeIndent, flowIndent) {
|
|
932
|
-
const tag = this.tag;
|
|
933
|
-
const anchor = this.anchor;
|
|
914
|
+
readBlockMapping(tag, anchor, nodeIndent, flowIndent) {
|
|
934
915
|
const result = {};
|
|
935
916
|
const overridableKeys = new Set();
|
|
936
917
|
let allowCompact = false;
|
|
@@ -941,9 +922,8 @@ export class LoaderState {
|
|
|
941
922
|
let valueNode = null;
|
|
942
923
|
let atExplicitKey = false;
|
|
943
924
|
let detected = false;
|
|
944
|
-
if (
|
|
945
|
-
this.anchorMap.set(
|
|
946
|
-
}
|
|
925
|
+
if (anchor !== null)
|
|
926
|
+
this.anchorMap.set(anchor, result);
|
|
947
927
|
let ch = this.peek();
|
|
948
928
|
while (ch !== 0) {
|
|
949
929
|
const following = this.peek(1);
|
|
@@ -979,12 +959,15 @@ export class LoaderState {
|
|
|
979
959
|
// Implicit notation case. Flow-style node as the key first, then ":", and the value.
|
|
980
960
|
//
|
|
981
961
|
}
|
|
982
|
-
else
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
962
|
+
else {
|
|
963
|
+
const newState = this.composeNode({
|
|
964
|
+
parentIndent: flowIndent,
|
|
965
|
+
nodeContext: CONTEXT_FLOW_OUT,
|
|
966
|
+
allowToSeek: false,
|
|
967
|
+
allowCompact: true,
|
|
968
|
+
});
|
|
969
|
+
if (!newState)
|
|
970
|
+
break; // Reading is done. Go to the epilogue.
|
|
988
971
|
if (this.line === line) {
|
|
989
972
|
ch = this.peek();
|
|
990
973
|
this.skipWhitespaces();
|
|
@@ -1003,45 +986,41 @@ export class LoaderState {
|
|
|
1003
986
|
detected = true;
|
|
1004
987
|
atExplicitKey = false;
|
|
1005
988
|
allowCompact = false;
|
|
1006
|
-
keyTag =
|
|
1007
|
-
keyNode =
|
|
989
|
+
keyTag = newState.tag;
|
|
990
|
+
keyNode = newState.result;
|
|
1008
991
|
}
|
|
1009
992
|
else if (detected) {
|
|
1010
993
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read an implicit mapping pair: missing colon");
|
|
1011
994
|
}
|
|
1012
995
|
else {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
return true; // Keep the result of `composeNode`.
|
|
996
|
+
const { kind, result } = newState;
|
|
997
|
+
return { tag, anchor, kind, result }; // Keep the result of `composeNode`.
|
|
1016
998
|
}
|
|
1017
999
|
}
|
|
1018
1000
|
else if (detected) {
|
|
1019
1001
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read a block mapping entry: a multiline key may not be an implicit key");
|
|
1020
1002
|
}
|
|
1021
1003
|
else {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
return true; // Keep the result of `composeNode`.
|
|
1004
|
+
const { kind, result } = newState;
|
|
1005
|
+
return { tag, anchor, kind, result }; // Keep the result of `composeNode`.
|
|
1025
1006
|
}
|
|
1026
1007
|
}
|
|
1027
|
-
else {
|
|
1028
|
-
break; // Reading is done. Go to the epilogue.
|
|
1029
|
-
}
|
|
1030
1008
|
//
|
|
1031
1009
|
// Common reading code for both explicit and implicit notations.
|
|
1032
1010
|
//
|
|
1033
1011
|
if (this.line === line || this.lineIndent > nodeIndent) {
|
|
1034
|
-
|
|
1012
|
+
const newState = this.composeNode({
|
|
1035
1013
|
parentIndent: nodeIndent,
|
|
1036
1014
|
nodeContext: CONTEXT_BLOCK_OUT,
|
|
1037
1015
|
allowToSeek: true,
|
|
1038
1016
|
allowCompact,
|
|
1039
|
-
})
|
|
1017
|
+
});
|
|
1018
|
+
if (newState) {
|
|
1040
1019
|
if (atExplicitKey) {
|
|
1041
|
-
keyNode =
|
|
1020
|
+
keyNode = newState.result;
|
|
1042
1021
|
}
|
|
1043
1022
|
else {
|
|
1044
|
-
valueNode =
|
|
1023
|
+
valueNode = newState.result;
|
|
1045
1024
|
}
|
|
1046
1025
|
}
|
|
1047
1026
|
if (!atExplicitKey) {
|
|
@@ -1066,23 +1045,18 @@ export class LoaderState {
|
|
|
1066
1045
|
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
|
|
1067
1046
|
}
|
|
1068
1047
|
// Expose the resulting mapping.
|
|
1069
|
-
if (detected)
|
|
1070
|
-
|
|
1071
|
-
this.anchor = anchor;
|
|
1072
|
-
this.kind = "mapping";
|
|
1073
|
-
this.result = result;
|
|
1074
|
-
}
|
|
1075
|
-
return detected;
|
|
1048
|
+
if (detected)
|
|
1049
|
+
return { tag, anchor, kind: "mapping", result };
|
|
1076
1050
|
}
|
|
1077
|
-
readTagProperty() {
|
|
1051
|
+
readTagProperty(tag) {
|
|
1078
1052
|
let isVerbatim = false;
|
|
1079
1053
|
let isNamed = false;
|
|
1080
1054
|
let tagHandle = "";
|
|
1081
1055
|
let tagName;
|
|
1082
1056
|
let ch = this.peek();
|
|
1083
1057
|
if (ch !== EXCLAMATION)
|
|
1084
|
-
return
|
|
1085
|
-
if (
|
|
1058
|
+
return;
|
|
1059
|
+
if (tag !== null) {
|
|
1086
1060
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: duplication of a tag property");
|
|
1087
1061
|
}
|
|
1088
1062
|
ch = this.next();
|
|
@@ -1137,27 +1111,24 @@ export class LoaderState {
|
|
|
1137
1111
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: invalid characters in tag name "${tagName}"`);
|
|
1138
1112
|
}
|
|
1139
1113
|
if (isVerbatim) {
|
|
1140
|
-
|
|
1114
|
+
return tagName;
|
|
1141
1115
|
}
|
|
1142
1116
|
else if (this.tagMap.has(tagHandle)) {
|
|
1143
|
-
|
|
1117
|
+
return this.tagMap.get(tagHandle) + tagName;
|
|
1144
1118
|
}
|
|
1145
1119
|
else if (tagHandle === "!") {
|
|
1146
|
-
|
|
1120
|
+
return `!${tagName}`;
|
|
1147
1121
|
}
|
|
1148
1122
|
else if (tagHandle === "!!") {
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
else {
|
|
1152
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
1123
|
+
return `tag:yaml.org,2002:${tagName}`;
|
|
1153
1124
|
}
|
|
1154
|
-
|
|
1125
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
1155
1126
|
}
|
|
1156
|
-
readAnchorProperty() {
|
|
1127
|
+
readAnchorProperty(anchor) {
|
|
1157
1128
|
let ch = this.peek();
|
|
1158
1129
|
if (ch !== AMPERSAND)
|
|
1159
|
-
return
|
|
1160
|
-
if (
|
|
1130
|
+
return;
|
|
1131
|
+
if (anchor !== null) {
|
|
1161
1132
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read anchor property: duplicate anchor property");
|
|
1162
1133
|
}
|
|
1163
1134
|
ch = this.next();
|
|
@@ -1168,12 +1139,11 @@ export class LoaderState {
|
|
|
1168
1139
|
if (this.position === position) {
|
|
1169
1140
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read anchor property: name of an anchor node must contain at least one character");
|
|
1170
1141
|
}
|
|
1171
|
-
|
|
1172
|
-
return true;
|
|
1142
|
+
return this.input.slice(position, this.position);
|
|
1173
1143
|
}
|
|
1174
1144
|
readAlias() {
|
|
1175
1145
|
if (this.peek() !== ASTERISK)
|
|
1176
|
-
return
|
|
1146
|
+
return;
|
|
1177
1147
|
let ch = this.next();
|
|
1178
1148
|
const position = this.position;
|
|
1179
1149
|
while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
|
|
@@ -1186,19 +1156,56 @@ export class LoaderState {
|
|
|
1186
1156
|
if (!this.anchorMap.has(alias)) {
|
|
1187
1157
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read alias: unidentified alias "${alias}"`);
|
|
1188
1158
|
}
|
|
1189
|
-
this.result = this.anchorMap.get(alias);
|
|
1190
1159
|
this.skipSeparationSpace(true, -1);
|
|
1191
|
-
return
|
|
1160
|
+
return this.anchorMap.get(alias);
|
|
1161
|
+
}
|
|
1162
|
+
resolveTag(state) {
|
|
1163
|
+
switch (state.tag) {
|
|
1164
|
+
case null:
|
|
1165
|
+
case "!":
|
|
1166
|
+
return state;
|
|
1167
|
+
case "?": {
|
|
1168
|
+
for (const type of this.implicitTypes) {
|
|
1169
|
+
// Implicit resolving is not allowed for non-scalar types, and '?'
|
|
1170
|
+
// non-specific tag is only assigned to plain scalars. So, it isn't
|
|
1171
|
+
// needed to check for 'kind' conformity.
|
|
1172
|
+
if (!type.resolve(state.result))
|
|
1173
|
+
continue;
|
|
1174
|
+
// `state.result` updated in resolver if matched
|
|
1175
|
+
const result = type.construct(state.result);
|
|
1176
|
+
state.result = result;
|
|
1177
|
+
state.tag = type.tag;
|
|
1178
|
+
const { anchor } = state;
|
|
1179
|
+
if (anchor !== null)
|
|
1180
|
+
this.anchorMap.set(anchor, result);
|
|
1181
|
+
return state;
|
|
1182
|
+
}
|
|
1183
|
+
return state;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
const kind = state.kind ?? "fallback";
|
|
1187
|
+
const map = this.typeMap[kind];
|
|
1188
|
+
const type = map.get(state.tag);
|
|
1189
|
+
if (!type) {
|
|
1190
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve unknown tag !<${state.tag}>`);
|
|
1191
|
+
}
|
|
1192
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
1193
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Unacceptable node kind for !<${state.tag}> tag: it should be "${type.kind}", not "${state.kind}"`);
|
|
1194
|
+
}
|
|
1195
|
+
if (!type.resolve(state.result)) {
|
|
1196
|
+
// `state.result` updated in resolver if matched
|
|
1197
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve a node with !<${state.tag}> explicit tag`);
|
|
1198
|
+
}
|
|
1199
|
+
const result = type.construct(state.result);
|
|
1200
|
+
state.result = result;
|
|
1201
|
+
const { anchor } = state;
|
|
1202
|
+
if (anchor !== null)
|
|
1203
|
+
this.anchorMap.set(anchor, result);
|
|
1204
|
+
return state;
|
|
1192
1205
|
}
|
|
1193
1206
|
composeNode({ parentIndent, nodeContext, allowToSeek, allowCompact }) {
|
|
1194
1207
|
let indentStatus = 1; // 1: this>parent, 0: this=parent, -1: this<parent
|
|
1195
1208
|
let atNewLine = false;
|
|
1196
|
-
let hasContent = false;
|
|
1197
|
-
let type;
|
|
1198
|
-
this.tag = null;
|
|
1199
|
-
this.anchor = null;
|
|
1200
|
-
this.kind = null;
|
|
1201
|
-
this.result = null;
|
|
1202
1209
|
const allowBlockScalars = CONTEXT_BLOCK_OUT === nodeContext ||
|
|
1203
1210
|
CONTEXT_BLOCK_IN === nodeContext;
|
|
1204
1211
|
let allowBlockCollections = allowBlockScalars;
|
|
@@ -1206,31 +1213,27 @@ export class LoaderState {
|
|
|
1206
1213
|
if (allowToSeek) {
|
|
1207
1214
|
if (this.skipSeparationSpace(true, -1)) {
|
|
1208
1215
|
atNewLine = true;
|
|
1209
|
-
|
|
1210
|
-
indentStatus = 1;
|
|
1211
|
-
}
|
|
1212
|
-
else if (this.lineIndent === parentIndent) {
|
|
1213
|
-
indentStatus = 0;
|
|
1214
|
-
}
|
|
1215
|
-
else if (this.lineIndent < parentIndent) {
|
|
1216
|
-
indentStatus = -1;
|
|
1217
|
-
}
|
|
1216
|
+
indentStatus = getIndentStatus(this.lineIndent, parentIndent);
|
|
1218
1217
|
}
|
|
1219
1218
|
}
|
|
1219
|
+
let tag = null;
|
|
1220
|
+
let anchor = null;
|
|
1220
1221
|
if (indentStatus === 1) {
|
|
1221
|
-
while (
|
|
1222
|
+
while (true) {
|
|
1223
|
+
const newTag = this.readTagProperty(tag);
|
|
1224
|
+
if (newTag) {
|
|
1225
|
+
tag = newTag;
|
|
1226
|
+
}
|
|
1227
|
+
else {
|
|
1228
|
+
const newAnchor = this.readAnchorProperty(anchor);
|
|
1229
|
+
if (!newAnchor)
|
|
1230
|
+
break;
|
|
1231
|
+
anchor = newAnchor;
|
|
1232
|
+
}
|
|
1222
1233
|
if (this.skipSeparationSpace(true, -1)) {
|
|
1223
1234
|
atNewLine = true;
|
|
1224
1235
|
allowBlockCollections = allowBlockStyles;
|
|
1225
|
-
|
|
1226
|
-
indentStatus = 1;
|
|
1227
|
-
}
|
|
1228
|
-
else if (this.lineIndent === parentIndent) {
|
|
1229
|
-
indentStatus = 0;
|
|
1230
|
-
}
|
|
1231
|
-
else if (this.lineIndent < parentIndent) {
|
|
1232
|
-
indentStatus = -1;
|
|
1233
|
-
}
|
|
1236
|
+
indentStatus = getIndentStatus(this.lineIndent, parentIndent);
|
|
1234
1237
|
}
|
|
1235
1238
|
else {
|
|
1236
1239
|
allowBlockCollections = false;
|
|
@@ -1240,88 +1243,59 @@ export class LoaderState {
|
|
|
1240
1243
|
if (allowBlockCollections) {
|
|
1241
1244
|
allowBlockCollections = atNewLine || allowCompact;
|
|
1242
1245
|
}
|
|
1243
|
-
if (indentStatus === 1
|
|
1246
|
+
if (indentStatus === 1) {
|
|
1244
1247
|
const cond = CONTEXT_FLOW_IN === nodeContext ||
|
|
1245
1248
|
CONTEXT_FLOW_OUT === nodeContext;
|
|
1246
1249
|
const flowIndent = cond ? parentIndent : parentIndent + 1;
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
this.anchorMap.set(this.anchor, this.result);
|
|
1275
|
-
}
|
|
1250
|
+
if (allowBlockCollections) {
|
|
1251
|
+
const blockIndent = this.position - this.lineStart;
|
|
1252
|
+
const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
1253
|
+
if (blockSequenceState)
|
|
1254
|
+
return this.resolveTag(blockSequenceState);
|
|
1255
|
+
const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
|
|
1256
|
+
if (blockMappingState)
|
|
1257
|
+
return this.resolveTag(blockMappingState);
|
|
1258
|
+
}
|
|
1259
|
+
const flowCollectionState = this.readFlowCollection(tag, anchor, flowIndent);
|
|
1260
|
+
if (flowCollectionState)
|
|
1261
|
+
return this.resolveTag(flowCollectionState);
|
|
1262
|
+
if (allowBlockScalars) {
|
|
1263
|
+
const blockScalarState = this.readBlockScalar(tag, anchor, flowIndent);
|
|
1264
|
+
if (blockScalarState)
|
|
1265
|
+
return this.resolveTag(blockScalarState);
|
|
1266
|
+
}
|
|
1267
|
+
const singleQuoteState = this.readSingleQuotedScalar(tag, anchor, flowIndent);
|
|
1268
|
+
if (singleQuoteState)
|
|
1269
|
+
return this.resolveTag(singleQuoteState);
|
|
1270
|
+
const doubleQuoteState = this.readDoubleQuotedScalar(tag, anchor, flowIndent);
|
|
1271
|
+
if (doubleQuoteState)
|
|
1272
|
+
return this.resolveTag(doubleQuoteState);
|
|
1273
|
+
const alias = this.readAlias();
|
|
1274
|
+
if (alias) {
|
|
1275
|
+
if (tag !== null || anchor !== null) {
|
|
1276
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot compose node: alias node should not have any properties");
|
|
1276
1277
|
}
|
|
1278
|
+
return this.resolveTag({ tag, anchor, kind: null, result: alias });
|
|
1277
1279
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
this.readBlockSequence(blockIndent);
|
|
1280
|
+
const plainScalarState = this.readPlainScalar(tag, anchor, flowIndent, CONTEXT_FLOW_IN === nodeContext);
|
|
1281
|
+
if (plainScalarState) {
|
|
1282
|
+
plainScalarState.tag ??= "?";
|
|
1283
|
+
return this.resolveTag(plainScalarState);
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
1285
|
-
if (
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
this.result = type.construct(this.result);
|
|
1295
|
-
this.tag = type.tag;
|
|
1296
|
-
if (this.anchor !== null) {
|
|
1297
|
-
this.anchorMap.set(this.anchor, this.result);
|
|
1298
|
-
}
|
|
1299
|
-
break;
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
else if (this.typeMap[this.kind ?? "fallback"].has(this.tag)) {
|
|
1304
|
-
const map = this.typeMap[this.kind ?? "fallback"];
|
|
1305
|
-
type = map.get(this.tag);
|
|
1306
|
-
if (this.result !== null && type.kind !== this.kind) {
|
|
1307
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Unacceptable node kind for !<${this.tag}> tag: it should be "${type.kind}", not "${this.kind}"`);
|
|
1308
|
-
}
|
|
1309
|
-
if (!type.resolve(this.result)) {
|
|
1310
|
-
// `state.result` updated in resolver if matched
|
|
1311
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve a node with !<${this.tag}> explicit tag`);
|
|
1312
|
-
}
|
|
1313
|
-
else {
|
|
1314
|
-
this.result = type.construct(this.result);
|
|
1315
|
-
if (this.anchor !== null) {
|
|
1316
|
-
this.anchorMap.set(this.anchor, this.result);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
else {
|
|
1321
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve unknown tag !<${this.tag}>`);
|
|
1322
|
-
}
|
|
1286
|
+
else if (indentStatus === 0 &&
|
|
1287
|
+
CONTEXT_BLOCK_OUT === nodeContext &&
|
|
1288
|
+
allowBlockCollections) {
|
|
1289
|
+
// Special case: block sequences are allowed to have same indentation level as the parent.
|
|
1290
|
+
// http://www.yaml.org/spec/1.2/spec.html#id2799784
|
|
1291
|
+
const blockIndent = this.position - this.lineStart;
|
|
1292
|
+
const newState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
1293
|
+
if (newState)
|
|
1294
|
+
return this.resolveTag(newState);
|
|
1323
1295
|
}
|
|
1324
|
-
|
|
1296
|
+
const newState = this.resolveTag({ tag, anchor, kind: null, result: null });
|
|
1297
|
+
if (newState.tag !== null || newState.anchor !== null)
|
|
1298
|
+
return newState;
|
|
1325
1299
|
}
|
|
1326
1300
|
readDirectives() {
|
|
1327
1301
|
let hasDirectives = false;
|
|
@@ -1383,6 +1357,7 @@ export class LoaderState {
|
|
|
1383
1357
|
this.anchorMap = new Map();
|
|
1384
1358
|
const hasDirectives = this.readDirectives();
|
|
1385
1359
|
this.skipSeparationSpace(true, -1);
|
|
1360
|
+
let result = null;
|
|
1386
1361
|
if (this.lineIndent === 0 &&
|
|
1387
1362
|
this.peek() === MINUS &&
|
|
1388
1363
|
this.peek(1) === MINUS &&
|
|
@@ -1393,12 +1368,14 @@ export class LoaderState {
|
|
|
1393
1368
|
else if (hasDirectives) {
|
|
1394
1369
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: directives end mark is expected");
|
|
1395
1370
|
}
|
|
1396
|
-
this.composeNode({
|
|
1371
|
+
const newState = this.composeNode({
|
|
1397
1372
|
parentIndent: this.lineIndent - 1,
|
|
1398
1373
|
nodeContext: CONTEXT_BLOCK_OUT,
|
|
1399
1374
|
allowToSeek: false,
|
|
1400
1375
|
allowCompact: true,
|
|
1401
1376
|
});
|
|
1377
|
+
if (newState)
|
|
1378
|
+
result = newState.result;
|
|
1402
1379
|
this.skipSeparationSpace(true, -1);
|
|
1403
1380
|
if (this.checkLineBreaks &&
|
|
1404
1381
|
PATTERN_NON_ASCII_LINE_BREAKS.test(this.input.slice(documentStart, this.position))) {
|
|
@@ -1413,7 +1390,7 @@ export class LoaderState {
|
|
|
1413
1390
|
else if (this.position < this.length - 1) {
|
|
1414
1391
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: end of the stream or a document separator is expected");
|
|
1415
1392
|
}
|
|
1416
|
-
return
|
|
1393
|
+
return result;
|
|
1417
1394
|
}
|
|
1418
1395
|
*readDocuments() {
|
|
1419
1396
|
while (this.position < this.length - 1) {
|