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 anchors = require('../doc/anchors.js');
var Node = require('../nodes/Node.js');
var identity = require('../nodes/identity.js');
var stringifyComment = require('./stringifyComment.js');
var stringifyString = require('./stringifyString.js');
@@ -15,6 +15,7 @@ function createStringifyContext(doc, options) {
doubleQuotedAsJSON: false,
doubleQuotedMinMultiLineLength: 40,
falseStr: 'false',
flowCollectionPadding: true,
indentSeq: true,
lineWidth: 80,
minContentWidth: 20,
@@ -38,6 +39,7 @@ function createStringifyContext(doc, options) {
return {
anchors: new Set(),
doc,
flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',
indent: '',
indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',
inFlow,
@@ -52,7 +54,7 @@ function getTagObject(tags, item) {
}
let tagObj = undefined;
let obj;
if (Node.isScalar(item)) {
if (identity.isScalar(item)) {
obj = item.value;
const match = tags.filter(t => t.identify?.(obj));
tagObj =
@@ -73,7 +75,7 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
if (!doc.directives)
return '';
const props = [];
const anchor = (Node.isScalar(node) || Node.isCollection(node)) && node.anchor;
const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;
if (anchor && anchors.anchorIsValid(anchor)) {
anchors$1.add(anchor);
props.push(`&${anchor}`);
@@ -84,9 +86,9 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
return props.join(' ');
}
function stringify(item, ctx, onComment, onChompKeep) {
if (Node.isPair(item))
if (identity.isPair(item))
return item.toString(ctx, onComment, onChompKeep);
if (Node.isAlias(item)) {
if (identity.isAlias(item)) {
if (ctx.doc.directives)
return item.toString(ctx);
if (ctx.resolvedAliases?.has(item)) {
@@ -101,7 +103,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
}
}
let tagObj = undefined;
const node = Node.isNode(item)
const node = identity.isNode(item)
? item
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
if (!tagObj)
@@ -111,12 +113,12 @@ function stringify(item, ctx, onComment, onChompKeep) {
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
const str = typeof tagObj.stringify === 'function'
? tagObj.stringify(node, ctx, onComment, onChompKeep)
: Node.isScalar(node)
: identity.isScalar(node)
? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)
: node.toString(ctx, onComment, onChompKeep);
if (!props)
return str;
return Node.isScalar(node) || str[0] === '{' || str[0] === '['
return identity.isScalar(node) || str[0] === '{' || str[0] === '['
? `${props} ${str}`
: `${props}\n${ctx.indent}${str}`;
}