node_modules: upgrade

This commit is contained in:
Dawid Dziurla
2024-01-17 10:08:10 +01:00
parent 9ff0bc8d99
commit 00765f79cf
320 changed files with 31840 additions and 1039 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
var Collection = require('../nodes/Collection.js');
var Node = require('../nodes/Node.js');
var identity = require('../nodes/identity.js');
var stringify = require('./stringify.js');
var stringifyComment = require('./stringifyComment.js');
@@ -18,15 +18,15 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
for (let i = 0; i < items.length; ++i) {
const item = items[i];
let comment = null;
if (Node.isNode(item)) {
if (identity.isNode(item)) {
if (!chompKeep && item.spaceBefore)
lines.push('');
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
if (item.comment)
comment = item.comment;
}
else if (Node.isPair(item)) {
const ik = Node.isNode(item.key) ? item.key : null;
else if (identity.isPair(item)) {
const ik = identity.isNode(item.key) ? item.key : null;
if (ik) {
if (!chompKeep && ik.spaceBefore)
lines.push('');
@@ -62,7 +62,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
return str;
}
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
const { indent, indentStep, options: { commentString } } = ctx;
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
itemIndent += indentStep;
const itemCtx = Object.assign({}, ctx, {
indent: itemIndent,
@@ -75,15 +75,15 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
for (let i = 0; i < items.length; ++i) {
const item = items[i];
let comment = null;
if (Node.isNode(item)) {
if (identity.isNode(item)) {
if (item.spaceBefore)
lines.push('');
addCommentBefore(ctx, lines, item.commentBefore, false);
if (item.comment)
comment = item.comment;
}
else if (Node.isPair(item)) {
const ik = Node.isNode(item.key) ? item.key : null;
else if (identity.isPair(item)) {
const ik = identity.isNode(item.key) ? item.key : null;
if (ik) {
if (ik.spaceBefore)
lines.push('');
@@ -91,14 +91,14 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
if (ik.comment)
reqNewline = true;
}
const iv = Node.isNode(item.value) ? item.value : null;
const iv = identity.isNode(item.value) ? item.value : null;
if (iv) {
if (iv.comment)
comment = iv.comment;
if (iv.commentBefore)
reqNewline = true;
}
else if (item.value == null && ik && ik.comment) {
else if (item.value == null && ik?.comment) {
comment = ik.comment;
}
}
@@ -131,11 +131,11 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
str += `\n${indent}${end}`;
}
else {
str = `${start} ${lines.join(' ')} ${end}`;
str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
}
}
if (comment) {
str += stringifyComment.lineComment(str, commentString(comment), indent);
str += stringifyComment.lineComment(str, indent, commentString(comment));
if (onComment)
onComment();
}