From 2d7e7b678591ee3321638e5c5621ca689628daa4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 10:42:32 +0000 Subject: [PATCH] build(deps): bump yaml from 2.8.2 to 2.8.3 (#1365) Co-authored-by: Fernandez Ludovic --- dist/post_run/index.js | 32 +++++++++++++++++++++++++------- dist/run/index.js | 32 +++++++++++++++++++++++++------- package-lock.json | 8 ++++---- package.json | 2 +- 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index dfa07ba..12cf96e 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -97736,19 +97736,26 @@ function composeNode(ctx, token, props, onError) { case 'block-map': case 'block-seq': case 'flow-collection': - node = composeCollection.composeCollection(CN, ctx, token, props, onError); - if (anchor) - node.anchor = anchor.source.substring(1); + try { + node = composeCollection.composeCollection(CN, ctx, token, props, onError); + if (anchor) + node.anchor = anchor.source.substring(1); + } + catch (error) { + // Almost certainly here due to a stack overflow + const message = error instanceof Error ? error.message : String(error); + onError(token, 'RESOURCE_EXHAUSTION', message); + } break; default: { const message = token.type === 'error' ? token.message : `Unsupported token (type: ${token.type})`; onError(token, 'UNEXPECTED_TOKEN', message); - node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError); isSrcToken = false; } } + node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError)); if (anchor && node.anchor === '') onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string'); if (atKey && @@ -104969,6 +104976,7 @@ function createStringifyContext(doc, options) { nullStr: 'null', simpleKeys: false, singleQuote: null, + trailingComma: false, trueStr: 'true', verifyAliasOrder: true }, doc.schema.toStringOptions, options); @@ -105190,12 +105198,22 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) { if (comment) reqNewline = true; let str = stringify.stringify(item, itemCtx, () => (comment = null)); - if (i < items.length - 1) + reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n')); + if (i < items.length - 1) { str += ','; + } + else if (ctx.options.trailingComma) { + if (ctx.options.lineWidth > 0) { + reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + + (str.length + 2) > + ctx.options.lineWidth); + } + if (reqNewline) { + str += ','; + } + } if (comment) str += stringifyComment.lineComment(str, itemIndent, commentString(comment)); - if (!reqNewline && (lines.length > linesAtValue || str.includes('\n'))) - reqNewline = true; lines.push(str); linesAtValue = lines.length; } diff --git a/dist/run/index.js b/dist/run/index.js index c7e3c00..b0f7888 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -97736,19 +97736,26 @@ function composeNode(ctx, token, props, onError) { case 'block-map': case 'block-seq': case 'flow-collection': - node = composeCollection.composeCollection(CN, ctx, token, props, onError); - if (anchor) - node.anchor = anchor.source.substring(1); + try { + node = composeCollection.composeCollection(CN, ctx, token, props, onError); + if (anchor) + node.anchor = anchor.source.substring(1); + } + catch (error) { + // Almost certainly here due to a stack overflow + const message = error instanceof Error ? error.message : String(error); + onError(token, 'RESOURCE_EXHAUSTION', message); + } break; default: { const message = token.type === 'error' ? token.message : `Unsupported token (type: ${token.type})`; onError(token, 'UNEXPECTED_TOKEN', message); - node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError); isSrcToken = false; } } + node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError)); if (anchor && node.anchor === '') onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string'); if (atKey && @@ -104969,6 +104976,7 @@ function createStringifyContext(doc, options) { nullStr: 'null', simpleKeys: false, singleQuote: null, + trailingComma: false, trueStr: 'true', verifyAliasOrder: true }, doc.schema.toStringOptions, options); @@ -105190,12 +105198,22 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) { if (comment) reqNewline = true; let str = stringify.stringify(item, itemCtx, () => (comment = null)); - if (i < items.length - 1) + reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n')); + if (i < items.length - 1) { str += ','; + } + else if (ctx.options.trailingComma) { + if (ctx.options.lineWidth > 0) { + reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + + (str.length + 2) > + ctx.options.lineWidth); + } + if (reqNewline) { + str += ','; + } + } if (comment) str += stringifyComment.lineComment(str, itemIndent, commentString(comment)); - if (!reqNewline && (lines.length > linesAtValue || str.includes('\n'))) - reqNewline = true; lines.push(str); linesAtValue = lines.length; } diff --git a/package-lock.json b/package-lock.json index 5d8c993..ea7e892 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "@types/which": "^3.0.4", "tmp": "^0.2.5", "which": "^6.0.0", - "yaml": "^2.8.2" + "yaml": "^2.8.3" }, "devDependencies": { "@eslint/compat": "^2.0.2", @@ -4338,9 +4338,9 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz", + "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", "license": "ISC", "bin": { "yaml": "bin.mjs" diff --git a/package.json b/package.json index 997849a..145cdba 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@types/which": "^3.0.4", "tmp": "^0.2.5", "which": "^6.0.0", - "yaml": "^2.8.2" + "yaml": "^2.8.3" }, "devDependencies": { "@eslint/compat": "^2.0.2",