diff --git a/dist/index.js b/dist/index.js index 2469c26f..6cd64e4e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11933,19 +11933,19 @@ function foldNewline(source, offset) { return { fold, offset }; } const escapeCodes = { - '0': '\0', - a: '\x07', - b: '\b', - e: '\x1b', - f: '\f', - n: '\n', - r: '\r', - t: '\t', - v: '\v', - N: '\u0085', - _: '\u00a0', - L: '\u2028', - P: '\u2029', + '0': '\0', // null character + a: '\x07', // bell character + b: '\b', // backspace + e: '\x1b', // escape character + f: '\f', // form feed + n: '\n', // line feed + r: '\r', // carriage return + t: '\t', // horizontal tab + v: '\v', // vertical tab + N: '\u0085', // Unicode next line + _: '\u00a0', // Unicode non-breaking space + L: '\u2028', // Unicode line separator + P: '\u2029', // Unicode paragraph separator ' ': ' ', '"': '"', '/': '/', @@ -12962,12 +12962,19 @@ class Directives { onError('Verbatim tags must end with a >'); return verbatim; } - const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/); + const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s); if (!suffix) onError(`The ${source} tag has no suffix`); const prefix = this.tags[handle]; - if (prefix) - return prefix + decodeURIComponent(suffix); + if (prefix) { + try { + return prefix + decodeURIComponent(suffix); + } + catch (error) { + onError(String(error)); + return null; + } + } if (handle === '!') return source; // local tag onError(`Could not resolve tag: ${source}`); @@ -16925,7 +16932,7 @@ var Scalar = __nccwpck_require__(9338); var stringifyString = __nccwpck_require__(6226); const binary = { - identify: value => value instanceof Uint8Array, + identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array default: false, tag: 'tag:yaml.org,2002:binary', /** @@ -17898,7 +17905,6 @@ exports.stringify = stringify; "use strict"; -var Collection = __nccwpck_require__(3466); var identity = __nccwpck_require__(5589); var stringify = __nccwpck_require__(8409); var stringifyComment = __nccwpck_require__(5182); @@ -18020,7 +18026,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden else { if (!reqNewline) { const len = lines.reduce((sum, line) => sum + line.length + 2, 2); - reqNewline = len > Collection.Collection.maxFlowStringSingleLineLength; + reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth; } if (reqNewline) { str = start;