@@ -43771,19 +43771,19 @@ function foldNewline(source, offset) {
4377143771 return { fold, offset };
4377243772}
4377343773const escapeCodes = {
43774- '0': '\0',
43775- a: '\x07',
43776- b: '\b',
43777- e: '\x1b',
43778- f: '\f',
43779- n: '\n',
43780- r: '\r',
43781- t: '\t',
43782- v: '\v',
43783- N: '\u0085',
43784- _: '\u00a0',
43785- L: '\u2028',
43786- P: '\u2029',
43774+ '0': '\0', // null character
43775+ a: '\x07', // bell character
43776+ b: '\b', // backspace
43777+ e: '\x1b', // escape character
43778+ f: '\f', // form feed
43779+ n: '\n', // line feed
43780+ r: '\r', // carriage return
43781+ t: '\t', // horizontal tab
43782+ v: '\v', // vertical tab
43783+ N: '\u0085', // Unicode next line
43784+ _: '\u00a0', // Unicode non-breaking space
43785+ L: '\u2028', // Unicode line separator
43786+ P: '\u2029', // Unicode paragraph separator
4378743787 ' ': ' ',
4378843788 '"': '"',
4378943789 '/': '/',
@@ -44800,12 +44800,19 @@ class Directives {
4480044800 onError('Verbatim tags must end with a >');
4480144801 return verbatim;
4480244802 }
44803- const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/);
44803+ const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s );
4480444804 if (!suffix)
4480544805 onError(`The ${source} tag has no suffix`);
4480644806 const prefix = this.tags[handle];
44807- if (prefix)
44808- return prefix + decodeURIComponent(suffix);
44807+ if (prefix) {
44808+ try {
44809+ return prefix + decodeURIComponent(suffix);
44810+ }
44811+ catch (error) {
44812+ onError(String(error));
44813+ return null;
44814+ }
44815+ }
4480944816 if (handle === '!')
4481044817 return source; // local tag
4481144818 onError(`Could not resolve tag: ${source}`);
@@ -44995,6 +45002,8 @@ function debug(logLevel, ...messages) {
4499545002}
4499645003function warn(logLevel, warning) {
4499745004 if (logLevel === 'debug' || logLevel === 'warn') {
45005+ // https://github.com/typescript-eslint/typescript-eslint/issues/7478
45006+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
4499845007 if (typeof process !== 'undefined' && process.emitWarning)
4499945008 process.emitWarning(warning);
4500045009 else
@@ -45776,7 +45785,7 @@ function stringifyKey(key, jsKey, ctx) {
4577645785 return '';
4577745786 if (typeof jsKey !== 'object')
4577845787 return String(jsKey);
45779- if (identity.isNode(key) && ctx && ctx .doc) {
45788+ if (identity.isNode(key) && ctx? .doc) {
4578045789 const strCtx = stringify.createStringifyContext(ctx.doc, {});
4578145790 strCtx.anchors = new Set();
4578245791 for (const node of ctx.anchors.keys())
@@ -47716,7 +47725,10 @@ class Parser {
4771647725 return;
4771747726 }
4771847727 if (this.indent >= map.indent) {
47719- const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
47728+ const atNextItem = !this.onKeyLine &&
47729+ this.indent === map.indent &&
47730+ it.sep &&
47731+ this.type !== 'seq-item-ind';
4772047732 // For empty nodes, assign newline-separated not indented empty tokens to following node
4772147733 let start = [];
4772247734 if (atNextItem && it.sep && !it.value) {
@@ -48761,7 +48773,7 @@ var Scalar = __nccwpck_require__(9338);
4876148773var stringifyString = __nccwpck_require__(46226);
4876248774
4876348775const binary = {
48764- identify: value => value instanceof Uint8Array,
48776+ identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array
4876548777 default: false,
4876648778 tag: 'tag:yaml.org,2002:binary',
4876748779 /**
@@ -49155,8 +49167,9 @@ function createPairs(schema, iterable, ctx) {
4915549167 key = keys[0];
4915649168 value = it[key];
4915749169 }
49158- else
49159- throw new TypeError(`Expected { key: value } tuple: ${it}`);
49170+ else {
49171+ throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
49172+ }
4916049173 }
4916149174 else {
4916249175 key = it;
@@ -49480,7 +49493,7 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth =
4948049493 let escStart = -1;
4948149494 let escEnd = -1;
4948249495 if (mode === FOLD_BLOCK) {
49483- i = consumeMoreIndentedLines(text, i);
49496+ i = consumeMoreIndentedLines(text, i, indent.length );
4948449497 if (i !== -1)
4948549498 end = i + endStep;
4948649499 }
@@ -49504,8 +49517,8 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth =
4950449517 }
4950549518 if (ch === '\n') {
4950649519 if (mode === FOLD_BLOCK)
49507- i = consumeMoreIndentedLines(text, i);
49508- end = i + endStep;
49520+ i = consumeMoreIndentedLines(text, i, indent.length );
49521+ end = i + indent.length + endStep;
4950949522 split = undefined;
4951049523 }
4951149524 else {
@@ -49573,15 +49586,24 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth =
4957349586 * Presumes `i + 1` is at the start of a line
4957449587 * @returns index of last newline in more-indented block
4957549588 */
49576- function consumeMoreIndentedLines(text, i) {
49577- let ch = text[i + 1];
49589+ function consumeMoreIndentedLines(text, i, indent) {
49590+ let end = i;
49591+ let start = i + 1;
49592+ let ch = text[start];
4957849593 while (ch === ' ' || ch === '\t') {
49579- do {
49580- ch = text[(i += 1)];
49581- } while (ch && ch !== '\n');
49582- ch = text[i + 1];
49594+ if (i < start + indent) {
49595+ ch = text[++i];
49596+ }
49597+ else {
49598+ do {
49599+ ch = text[++i];
49600+ } while (ch && ch !== '\n');
49601+ end = i;
49602+ start = i + 1;
49603+ ch = text[start];
49604+ }
4958349605 }
49584- return i ;
49606+ return end ;
4958549607}
4958649608
4958749609exports.FOLD_BLOCK = FOLD_BLOCK;
@@ -49733,7 +49755,6 @@ exports.stringify = stringify;
4973349755"use strict";
4973449756
4973549757
49736- var Collection = __nccwpck_require__(3466);
4973749758var identity = __nccwpck_require__(15589);
4973849759var stringify = __nccwpck_require__(18409);
4973949760var stringifyComment = __nccwpck_require__(85182);
@@ -49794,7 +49815,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
4979449815 onChompKeep();
4979549816 return str;
4979649817}
49797- function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
49818+ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
4979849819 const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
4979949820 itemIndent += indentStep;
4980049821 const itemCtx = Object.assign({}, ctx, {
@@ -49831,7 +49852,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
4983149852 if (iv.commentBefore)
4983249853 reqNewline = true;
4983349854 }
49834- else if (item.value == null && ik && ik .comment) {
49855+ else if (item.value == null && ik? .comment) {
4983549856 comment = ik.comment;
4983649857 }
4983749858 }
@@ -49847,32 +49868,25 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
4984749868 lines.push(str);
4984849869 linesAtValue = lines.length;
4984949870 }
49850- let str;
4985149871 const { start, end } = flowChars;
4985249872 if (lines.length === 0) {
49853- str = start + end;
49873+ return start + end;
4985449874 }
4985549875 else {
4985649876 if (!reqNewline) {
4985749877 const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
49858- reqNewline = len > Collection.Collection.maxFlowStringSingleLineLength ;
49878+ reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth ;
4985949879 }
4986049880 if (reqNewline) {
49861- str = start;
49881+ let str = start;
4986249882 for (const line of lines)
4986349883 str += line ? `\n${indentStep}${indent}${line}` : '\n';
49864- str += ` \n${indent}${end}`;
49884+ return `${str} \n${indent}${end}`;
4986549885 }
4986649886 else {
49867- str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
49887+ return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
4986849888 }
4986949889 }
49870- if (comment) {
49871- str += stringifyComment.lineComment(str, indent, commentString(comment));
49872- if (onComment)
49873- onComment();
49874- }
49875- return str;
4987649890}
4987749891function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
4987849892 if (comment && chompKeep)
@@ -50457,7 +50471,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
5045750471function plainString(item, ctx, onComment, onChompKeep) {
5045850472 const { type, value } = item;
5045950473 const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
50460- if ((implicitKey && /[\n[\]{},]/.test(value )) ||
50474+ if ((implicitKey && value.includes('\n' )) ||
5046150475 (inFlow && /[[\]{},]/.test(value))) {
5046250476 return quotedString(value, ctx);
5046350477 }
0 commit comments