yaml 2.8.4 → 2.9.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.
|
@@ -94,8 +94,10 @@ class Composer {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
if (afterDoc) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
for (let i = 0; i < this.errors.length; ++i)
|
|
98
|
+
doc.errors.push(this.errors[i]);
|
|
99
|
+
for (let i = 0; i < this.warnings.length; ++i)
|
|
100
|
+
doc.warnings.push(this.warnings[i]);
|
|
99
101
|
}
|
|
100
102
|
else {
|
|
101
103
|
doc.errors = this.errors;
|
|
@@ -310,7 +310,7 @@ class Lexer {
|
|
|
310
310
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
311
311
|
this.indentNext = this.indentValue + 1;
|
|
312
312
|
this.indentValue += n;
|
|
313
|
-
return
|
|
313
|
+
return 'block-start';
|
|
314
314
|
}
|
|
315
315
|
return 'doc';
|
|
316
316
|
}
|
|
@@ -631,32 +631,36 @@ class Lexer {
|
|
|
631
631
|
return 0;
|
|
632
632
|
}
|
|
633
633
|
*pushIndicators() {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
634
|
+
let n = 0;
|
|
635
|
+
loop: while (true) {
|
|
636
|
+
switch (this.charAt(0)) {
|
|
637
|
+
case '!':
|
|
638
|
+
n += yield* this.pushTag();
|
|
639
|
+
n += yield* this.pushSpaces(true);
|
|
640
|
+
continue loop;
|
|
641
|
+
case '&':
|
|
642
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
643
|
+
n += yield* this.pushSpaces(true);
|
|
644
|
+
continue loop;
|
|
645
|
+
case '-': // this is an error
|
|
646
|
+
case '?': // this is an error outside flow collections
|
|
647
|
+
case ':': {
|
|
648
|
+
const inFlow = this.flowLevel > 0;
|
|
649
|
+
const ch1 = this.charAt(1);
|
|
650
|
+
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
|
|
651
|
+
if (!inFlow)
|
|
652
|
+
this.indentNext = this.indentValue + 1;
|
|
653
|
+
else if (this.flowKey)
|
|
654
|
+
this.flowKey = false;
|
|
655
|
+
n += yield* this.pushCount(1);
|
|
656
|
+
n += yield* this.pushSpaces(true);
|
|
657
|
+
continue loop;
|
|
658
|
+
}
|
|
656
659
|
}
|
|
657
660
|
}
|
|
661
|
+
break loop;
|
|
658
662
|
}
|
|
659
|
-
return
|
|
663
|
+
return n;
|
|
660
664
|
}
|
|
661
665
|
*pushTag() {
|
|
662
666
|
if (this.charAt(1) === '<') {
|
|
@@ -67,6 +67,14 @@ function getFirstKeyStartProps(prev) {
|
|
|
67
67
|
}
|
|
68
68
|
return prev.splice(i, prev.length);
|
|
69
69
|
}
|
|
70
|
+
function arrayPushArray(target, source) {
|
|
71
|
+
// May exhaust call stack with large `source` array
|
|
72
|
+
if (source.length < 1e5)
|
|
73
|
+
Array.prototype.push.apply(target, source);
|
|
74
|
+
else
|
|
75
|
+
for (let i = 0; i < source.length; ++i)
|
|
76
|
+
target.push(source[i]);
|
|
77
|
+
}
|
|
70
78
|
function fixFlowSeqItems(fc) {
|
|
71
79
|
if (fc.start.type === 'flow-seq-start') {
|
|
72
80
|
for (const it of fc.items) {
|
|
@@ -79,12 +87,12 @@ function fixFlowSeqItems(fc) {
|
|
|
79
87
|
delete it.key;
|
|
80
88
|
if (isFlowToken(it.value)) {
|
|
81
89
|
if (it.value.end)
|
|
82
|
-
|
|
90
|
+
arrayPushArray(it.value.end, it.sep);
|
|
83
91
|
else
|
|
84
92
|
it.value.end = it.sep;
|
|
85
93
|
}
|
|
86
94
|
else
|
|
87
|
-
|
|
95
|
+
arrayPushArray(it.start, it.sep);
|
|
88
96
|
delete it.sep;
|
|
89
97
|
}
|
|
90
98
|
}
|
|
@@ -502,7 +510,7 @@ class Parser {
|
|
|
502
510
|
const prev = map.items[map.items.length - 2];
|
|
503
511
|
const end = prev?.value?.end;
|
|
504
512
|
if (Array.isArray(end)) {
|
|
505
|
-
|
|
513
|
+
arrayPushArray(end, it.start);
|
|
506
514
|
end.push(this.sourceToken);
|
|
507
515
|
map.items.pop();
|
|
508
516
|
return;
|
|
@@ -717,7 +725,7 @@ class Parser {
|
|
|
717
725
|
const prev = seq.items[seq.items.length - 2];
|
|
718
726
|
const end = prev?.value?.end;
|
|
719
727
|
if (Array.isArray(end)) {
|
|
720
|
-
|
|
728
|
+
arrayPushArray(end, it.start);
|
|
721
729
|
end.push(this.sourceToken);
|
|
722
730
|
seq.items.pop();
|
|
723
731
|
return;
|
package/dist/compose/composer.js
CHANGED
|
@@ -97,8 +97,10 @@ class Composer {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
if (afterDoc) {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
for (let i = 0; i < this.errors.length; ++i)
|
|
101
|
+
doc.errors.push(this.errors[i]);
|
|
102
|
+
for (let i = 0; i < this.warnings.length; ++i)
|
|
103
|
+
doc.warnings.push(this.warnings[i]);
|
|
102
104
|
}
|
|
103
105
|
else {
|
|
104
106
|
doc.errors = this.errors;
|
package/dist/parse/lexer.js
CHANGED
|
@@ -312,7 +312,7 @@ class Lexer {
|
|
|
312
312
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
313
313
|
this.indentNext = this.indentValue + 1;
|
|
314
314
|
this.indentValue += n;
|
|
315
|
-
return
|
|
315
|
+
return 'block-start';
|
|
316
316
|
}
|
|
317
317
|
return 'doc';
|
|
318
318
|
}
|
|
@@ -633,32 +633,36 @@ class Lexer {
|
|
|
633
633
|
return 0;
|
|
634
634
|
}
|
|
635
635
|
*pushIndicators() {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
636
|
+
let n = 0;
|
|
637
|
+
loop: while (true) {
|
|
638
|
+
switch (this.charAt(0)) {
|
|
639
|
+
case '!':
|
|
640
|
+
n += yield* this.pushTag();
|
|
641
|
+
n += yield* this.pushSpaces(true);
|
|
642
|
+
continue loop;
|
|
643
|
+
case '&':
|
|
644
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
645
|
+
n += yield* this.pushSpaces(true);
|
|
646
|
+
continue loop;
|
|
647
|
+
case '-': // this is an error
|
|
648
|
+
case '?': // this is an error outside flow collections
|
|
649
|
+
case ':': {
|
|
650
|
+
const inFlow = this.flowLevel > 0;
|
|
651
|
+
const ch1 = this.charAt(1);
|
|
652
|
+
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
|
|
653
|
+
if (!inFlow)
|
|
654
|
+
this.indentNext = this.indentValue + 1;
|
|
655
|
+
else if (this.flowKey)
|
|
656
|
+
this.flowKey = false;
|
|
657
|
+
n += yield* this.pushCount(1);
|
|
658
|
+
n += yield* this.pushSpaces(true);
|
|
659
|
+
continue loop;
|
|
660
|
+
}
|
|
658
661
|
}
|
|
659
662
|
}
|
|
663
|
+
break loop;
|
|
660
664
|
}
|
|
661
|
-
return
|
|
665
|
+
return n;
|
|
662
666
|
}
|
|
663
667
|
*pushTag() {
|
|
664
668
|
if (this.charAt(1) === '<') {
|
package/dist/parse/parser.js
CHANGED
|
@@ -70,6 +70,14 @@ function getFirstKeyStartProps(prev) {
|
|
|
70
70
|
}
|
|
71
71
|
return prev.splice(i, prev.length);
|
|
72
72
|
}
|
|
73
|
+
function arrayPushArray(target, source) {
|
|
74
|
+
// May exhaust call stack with large `source` array
|
|
75
|
+
if (source.length < 1e5)
|
|
76
|
+
Array.prototype.push.apply(target, source);
|
|
77
|
+
else
|
|
78
|
+
for (let i = 0; i < source.length; ++i)
|
|
79
|
+
target.push(source[i]);
|
|
80
|
+
}
|
|
73
81
|
function fixFlowSeqItems(fc) {
|
|
74
82
|
if (fc.start.type === 'flow-seq-start') {
|
|
75
83
|
for (const it of fc.items) {
|
|
@@ -82,12 +90,12 @@ function fixFlowSeqItems(fc) {
|
|
|
82
90
|
delete it.key;
|
|
83
91
|
if (isFlowToken(it.value)) {
|
|
84
92
|
if (it.value.end)
|
|
85
|
-
|
|
93
|
+
arrayPushArray(it.value.end, it.sep);
|
|
86
94
|
else
|
|
87
95
|
it.value.end = it.sep;
|
|
88
96
|
}
|
|
89
97
|
else
|
|
90
|
-
|
|
98
|
+
arrayPushArray(it.start, it.sep);
|
|
91
99
|
delete it.sep;
|
|
92
100
|
}
|
|
93
101
|
}
|
|
@@ -507,7 +515,7 @@ class Parser {
|
|
|
507
515
|
const prev = map.items[map.items.length - 2];
|
|
508
516
|
const end = prev?.value?.end;
|
|
509
517
|
if (Array.isArray(end)) {
|
|
510
|
-
|
|
518
|
+
arrayPushArray(end, it.start);
|
|
511
519
|
end.push(this.sourceToken);
|
|
512
520
|
map.items.pop();
|
|
513
521
|
return;
|
|
@@ -722,7 +730,7 @@ class Parser {
|
|
|
722
730
|
const prev = seq.items[seq.items.length - 2];
|
|
723
731
|
const end = prev?.value?.end;
|
|
724
732
|
if (Array.isArray(end)) {
|
|
725
|
-
|
|
733
|
+
arrayPushArray(end, it.start);
|
|
726
734
|
end.push(this.sourceToken);
|
|
727
735
|
seq.items.pop();
|
|
728
736
|
return;
|