diff --git a/dist/index.js b/dist/index.js index 4f706b45..6ee35adb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -59557,7 +59557,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; } @@ -60443,7 +60443,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'); @@ -60660,7 +60660,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`); @@ -60704,7 +60704,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); @@ -62085,7 +62085,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); @@ -62253,7 +62253,7 @@ class Alias extends Node.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); } @@ -64595,7 +64595,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({ @@ -65127,7 +65127,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) { @@ -67313,7 +67313,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') && @@ -67444,7 +67444,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) { ws += `\n${stringifyComment.indentComment(cs, ctx.indent)}`; } if (valueStr === '' && !ctx.inFlow) { - if (ws === '\n') + if (ws === '\n' && valueComment) ws = '\n\n'; } else { diff --git a/package-lock.json b/package-lock.json index 25be1b12..316495b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@actions/core": "^1.10.1", "@aws-sdk/client-codedeploy": "^3.922.0", "@aws-sdk/client-ecs": "^3.908.0", - "yaml": "^2.8.1" + "yaml": "^2.8.2" }, "devDependencies": { "@eslint/js": "^9.38.0", @@ -1195,6 +1195,7 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -3430,6 +3431,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3710,6 +3712,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.19", "caniuse-lite": "^1.0.30001751", @@ -4072,6 +4075,7 @@ "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -6600,15 +6604,18 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", - "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", "license": "ISC", "bin": { "yaml": "bin.mjs" }, "engines": { "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" } }, "node_modules/yargs": { diff --git a/package.json b/package.json index ab9ba187..5e21df70 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@actions/core": "^1.10.1", "@aws-sdk/client-codedeploy": "^3.922.0", "@aws-sdk/client-ecs": "^3.908.0", - "yaml": "^2.8.1" + "yaml": "^2.8.2" }, "devDependencies": { "@eslint/js": "^9.38.0",