node_modules: upgrade

This commit is contained in:
Dawid Dziurla
2025-06-14 23:18:18 +02:00
parent 948e4a4fb8
commit de40b1f21f
268 changed files with 2150 additions and 3858 deletions

View File

@@ -1,5 +1,6 @@
'use strict';
var node_process = require('process');
var cst = require('./cst.js');
var lexer = require('./lexer.js');
@@ -166,7 +167,7 @@ class Parser {
*/
*next(source) {
this.source = source;
if (process.env.LOG_TOKENS)
if (node_process.env.LOG_TOKENS)
console.log('|', cst.prettyToken(source));
if (this.atScalar) {
this.atScalar = false;
@@ -308,7 +309,7 @@ class Parser {
}
else {
Object.assign(it, { key: token, sep: [] });
this.onKeyLine = !includesToken(it.start, 'explicit-key-ind');
this.onKeyLine = !it.explicitKey;
return;
}
break;
@@ -517,7 +518,10 @@ class Parser {
return;
}
if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
const atMapIndent = !this.onKeyLine && this.indent === map.indent;
const atNextItem = atMapIndent &&
(it.sep || it.explicitKey) &&
this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node
let start = [];
if (atNextItem && it.sep && !it.value) {
@@ -557,25 +561,26 @@ class Parser {
}
return;
case 'explicit-key-ind':
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
if (!it.sep && !it.explicitKey) {
it.start.push(this.sourceToken);
it.explicitKey = true;
}
else if (atNextItem || it.value) {
start.push(this.sourceToken);
map.items.push({ start });
map.items.push({ start, explicitKey: true });
}
else {
this.stack.push({
type: 'block-map',
offset: this.offset,
indent: this.indent,
items: [{ start: [this.sourceToken] }]
items: [{ start: [this.sourceToken], explicitKey: true }]
});
}
this.onKeyLine = true;
return;
case 'map-value-ind':
if (includesToken(it.start, 'explicit-key-ind')) {
if (it.explicitKey) {
if (!it.sep) {
if (includesToken(it.start, 'newline')) {
Object.assign(it, { key: null, sep: [this.sourceToken] });
@@ -608,7 +613,9 @@ class Parser {
const sep = it.sep;
sep.push(this.sourceToken);
// @ts-expect-error type guard is wrong here
delete it.key, delete it.sep;
delete it.key;
// @ts-expect-error type guard is wrong here
delete it.sep;
this.stack.push({
type: 'block-map',
offset: this.offset,
@@ -666,9 +673,20 @@ class Parser {
default: {
const bv = this.startBlockValue(map);
if (bv) {
if (atNextItem &&
bv.type !== 'block-seq' &&
includesToken(it.start, 'explicit-key-ind')) {
if (bv.type === 'block-seq') {
if (!it.explicitKey &&
it.sep &&
!includesToken(it.sep, 'newline')) {
yield* this.pop({
type: 'error',
offset: this.offset,
message: 'Unexpected block-seq-ind on same line with key',
source: this.source
});
return;
}
}
else if (atMapIndent) {
map.items.push({ start });
}
this.stack.push(bv);
@@ -889,7 +907,7 @@ class Parser {
type: 'block-map',
offset: this.offset,
indent: this.indent,
items: [{ start }]
items: [{ start, explicitKey: true }]
};
}
case 'map-value-ind': {