node_modules: update (#127)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurla
2025-12-25 10:57:45 +01:00
committed by GitHub
parent f78fdf2ef7
commit e8303e5fa5
64 changed files with 585 additions and 291 deletions

View File

@@ -59,7 +59,7 @@ function composeCollection(CN, ctx, token, props, onError) {
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
if (!tag) {
const kt = ctx.schema.knownTags[tagName];
if (kt && kt.collection === expType) {
if (kt?.collection === expType) {
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
tag = kt;
}

View File

@@ -22,7 +22,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
});
if (!props.found) {
if (props.anchor || props.tag || value) {
if (value && value.type === 'block-seq')
if (value?.type === 'block-seq')
onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
else
onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');

View File

@@ -133,7 +133,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
}
}
else if (value) {
if ('source' in value && value.source && value.source[0] === ':')
if ('source' in value && value.source?.[0] === ':')
onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
else
onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
@@ -177,7 +177,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
const expectedEnd = isMap ? '}' : ']';
const [ce, ...ee] = fc.end;
let cePos = offset;
if (ce && ce.source === expectedEnd)
if (ce?.source === expectedEnd)
cePos = ce.offset + ce.source.length;
else {
const name = fcName[0].toUpperCase() + fcName.substring(1);

View File

@@ -46,7 +46,7 @@ const prettifyError = (src, lc) => (error) => {
if (/[^ ]/.test(lineStr)) {
let count = 1;
const end = error.linePos[1];
if (end && end.line === line && end.col > col) {
if (end?.line === line && end.col > col) {
count = Math.max(1, Math.min(end.col - col, 80 - ci));
}
const pointer = ' '.repeat(ci) + '^'.repeat(count);

View File

@@ -59,7 +59,7 @@ class Alias extends NodeBase {
data = anchors.get(source);
}
/* istanbul ignore if */
if (!data || data.res === undefined) {
if (data?.res === undefined) {
const msg = 'This should not happen: Alias anchor was not resolved?';
throw new ReferenceError(msg);
}

View File

@@ -226,7 +226,7 @@ class Parser {
}
*step() {
const top = this.peek(1);
if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) {
if (this.type === 'doc-end' && top?.type !== 'doc-end') {
while (this.stack.length > 0)
yield* this.pop();
this.stack.push({
@@ -758,7 +758,7 @@ class Parser {
do {
yield* this.pop();
top = this.peek(1);
} while (top && top.type === 'flow-collection');
} while (top?.type === 'flow-collection');
}
else if (fc.end.length === 0) {
switch (this.type) {

View File

@@ -4,7 +4,7 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
const num = typeof value === 'number' ? value : Number(value);
if (!isFinite(num))
return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';
let n = JSON.stringify(value);
let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);
if (!format &&
minFractionDigits &&
(!tag || tag === 'tag:yaml.org,2002:float') &&

View File

@@ -101,7 +101,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
ws += `\n${indentComment(cs, ctx.indent)}`;
}
if (valueStr === '' && !ctx.inFlow) {
if (ws === '\n')
if (ws === '\n' && valueComment)
ws = '\n\n';
}
else {

View File

@@ -159,7 +159,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
const { blockQuote, commentString, lineWidth } = ctx.options;
// 1. Block can't end in whitespace unless the last line is non-empty.
// 2. Strings consisting of only whitespace are best rendered explicitly.
if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
if (!blockQuote || /\n[\t ]+$/.test(value)) {
return quotedString(value, ctx);
}
const indent = ctx.indent ||