diff --git a/dist/query.js b/dist/query.js index b36f2317..cc4030d7 100644 --- a/dist/query.js +++ b/dist/query.js @@ -74402,7 +74402,7 @@ var require_Alias = __commonJS({ toJS.toJS(source, null, ctx); data = anchors2.get(source); } - if (!data || data.res === void 0) { + if (data?.res === void 0) { const msg = "This should not happen: Alias anchor was not resolved?"; throw new ReferenceError(msg); } @@ -75352,7 +75352,7 @@ ${indent}:`; ${stringifyComment.indentComment(cs, ctx.indent)}`; } if (valueStr === "" && !ctx.inFlow) { - if (ws === "\n") + if (ws === "\n" && valueComment) ws = "\n\n"; } else { ws += ` @@ -76097,7 +76097,7 @@ var require_stringifyNumber = __commonJS({ 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") && /^\d/.test(n)) { let i = n.indexOf("."); if (i < 0) { @@ -77465,7 +77465,7 @@ var require_errors4 = __commonJS({ if (/[^ ]/.test(lineStr)) { let count = 1; const end = error2.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); @@ -77828,7 +77828,7 @@ var require_resolve_block_seq = __commonJS({ }); 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"); @@ -78025,7 +78025,7 @@ var require_resolve_flow_collection = __commonJS({ onError(valueProps.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key"); } } 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`); @@ -78062,7 +78062,7 @@ var require_resolve_flow_collection = __commonJS({ 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); @@ -78129,7 +78129,7 @@ var require_compose_collection = __commonJS({ 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; } else { @@ -80227,7 +80227,7 @@ var require_parser = __commonJS({ } *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({ @@ -80705,7 +80705,7 @@ var require_parser = __commonJS({ 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) { case "comma": diff --git a/package-lock.json b/package-lock.json index 5fecc46d..296907bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "jszip": "3.10.1", "semver": "^7.7.2", "uuid": "^13.0.0", - "yaml": "^2.8.1" + "yaml": "^2.8.2" }, "devDependencies": { "@babel/core": "^7.28.5", @@ -11437,15 +11437,18 @@ } }, "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 89c1a0c9..1abfea4f 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "jszip": "3.10.1", "semver": "^7.7.2", "uuid": "^13.0.0", - "yaml": "^2.8.1" + "yaml": "^2.8.2" }, "devDependencies": { "@babel/core": "^7.28.5",