node_modules: update (#146)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurla
2026-08-07 08:08:41 +02:00
committed by GitHub
co-authored by dawidd6
parent 6b3dfab4e0
commit 3d5a3a75cc
44 changed files with 660 additions and 284 deletions
+28 -24
View File
@@ -310,7 +310,7 @@ class Lexer {
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
this.indentNext = this.indentValue + 1;
this.indentValue += n;
return yield* this.parseBlockStart();
return 'block-start';
}
return 'doc';
}
@@ -631,32 +631,36 @@ class Lexer {
return 0;
}
*pushIndicators() {
switch (this.charAt(0)) {
case '!':
return ((yield* this.pushTag()) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
case '&':
return ((yield* this.pushUntil(isNotAnchorChar)) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
case '-': // this is an error
case '?': // this is an error outside flow collections
case ':': {
const inFlow = this.flowLevel > 0;
const ch1 = this.charAt(1);
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
if (!inFlow)
this.indentNext = this.indentValue + 1;
else if (this.flowKey)
this.flowKey = false;
return ((yield* this.pushCount(1)) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
let n = 0;
loop: while (true) {
switch (this.charAt(0)) {
case '!':
n += yield* this.pushTag();
n += yield* this.pushSpaces(true);
continue loop;
case '&':
n += yield* this.pushUntil(isNotAnchorChar);
n += yield* this.pushSpaces(true);
continue loop;
case '-': // this is an error
case '?': // this is an error outside flow collections
case ':': {
const inFlow = this.flowLevel > 0;
const ch1 = this.charAt(1);
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
if (!inFlow)
this.indentNext = this.indentValue + 1;
else if (this.flowKey)
this.flowKey = false;
n += yield* this.pushCount(1);
n += yield* this.pushSpaces(true);
continue loop;
}
}
}
break loop;
}
return 0;
return n;
}
*pushTag() {
if (this.charAt(1) === '<') {
+12 -4
View File
@@ -67,6 +67,14 @@ function getFirstKeyStartProps(prev) {
}
return prev.splice(i, prev.length);
}
function arrayPushArray(target, source) {
// May exhaust call stack with large `source` array
if (source.length < 1e5)
Array.prototype.push.apply(target, source);
else
for (let i = 0; i < source.length; ++i)
target.push(source[i]);
}
function fixFlowSeqItems(fc) {
if (fc.start.type === 'flow-seq-start') {
for (const it of fc.items) {
@@ -79,12 +87,12 @@ function fixFlowSeqItems(fc) {
delete it.key;
if (isFlowToken(it.value)) {
if (it.value.end)
Array.prototype.push.apply(it.value.end, it.sep);
arrayPushArray(it.value.end, it.sep);
else
it.value.end = it.sep;
}
else
Array.prototype.push.apply(it.start, it.sep);
arrayPushArray(it.start, it.sep);
delete it.sep;
}
}
@@ -502,7 +510,7 @@ class Parser {
const prev = map.items[map.items.length - 2];
const end = prev?.value?.end;
if (Array.isArray(end)) {
Array.prototype.push.apply(end, it.start);
arrayPushArray(end, it.start);
end.push(this.sourceToken);
map.items.pop();
return;
@@ -717,7 +725,7 @@ class Parser {
const prev = seq.items[seq.items.length - 2];
const end = prev?.value?.end;
if (Array.isArray(end)) {
Array.prototype.push.apply(end, it.start);
arrayPushArray(end, it.start);
end.push(this.sourceToken);
seq.items.pop();
return;