Commit bbfca1b

Anton Golub <antongolub@antongolub.com>
2025-06-04 10:51:41
chore: update yaml to v2.8.0 tag: 8.5.5
1 parent ac2f7c2
build/3rd-party-licenses
@@ -140,7 +140,7 @@ which@5.0.0
   git+https://github.com/npm/node-which.git
   ISC
 
-yaml@2.7.1
+yaml@2.8.0
   Eemeli Aro <eemeli@gmail.com>
   github:eemeli/yaml
   ISC
build/vendor-extra.cjs
@@ -13260,8 +13260,7 @@ function createNodeAnchors(doc, prefix) {
   return {
     onAnchor: (source) => {
       aliasObjects.push(source);
-      if (!prevAnchors)
-        prevAnchors = anchorNames(doc);
+      prevAnchors != null ? prevAnchors : prevAnchors = anchorNames(doc);
       const anchor = findNewAnchor(prefix, prevAnchors);
       prevAnchors.add(anchor);
       return anchor;
@@ -13401,23 +13400,35 @@ var Alias = class extends NodeBase {
    * Resolve the value of this alias within `doc`, finding the last
    * instance of the `source` anchor before this node.
    */
-  resolve(doc) {
+  resolve(doc, ctx) {
+    let nodes;
+    if (ctx == null ? void 0 : ctx.aliasResolveCache) {
+      nodes = ctx.aliasResolveCache;
+    } else {
+      nodes = [];
+      visit(doc, {
+        Node: (_key, node) => {
+          if (isAlias(node) || hasAnchor(node))
+            nodes.push(node);
+        }
+      });
+      if (ctx)
+        ctx.aliasResolveCache = nodes;
+    }
     let found = void 0;
-    visit(doc, {
-      Node: (_key, node) => {
-        if (node === this)
-          return visit.BREAK;
-        if (node.anchor === this.source)
-          found = node;
-      }
-    });
+    for (const node of nodes) {
+      if (node === this)
+        break;
+      if (node.anchor === this.source)
+        found = node;
+    }
     return found;
   }
   toJSON(_arg, ctx) {
     if (!ctx)
       return { source: this.source };
     const { anchors, doc, maxAliasCount } = ctx;
-    const source = this.resolve(doc);
+    const source = this.resolve(doc, ctx);
     if (!source) {
       const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
       throw new ReferenceError(msg);
@@ -13514,7 +13525,7 @@ function findTagObject(value, tagName, tags) {
   });
 }
 function createNode(value, tagName, ctx) {
-  var _a2, _b2, _c;
+  var _a2, _b2, _c, _d;
   if (isDocument(value))
     value = value.contents;
   if (isNode(value))
@@ -13532,8 +13543,7 @@ function createNode(value, tagName, ctx) {
   if (aliasDuplicateObjects && value && typeof value === "object") {
     ref = sourceObjects.get(value);
     if (ref) {
-      if (!ref.anchor)
-        ref.anchor = onAnchor(value);
+      (_c = ref.anchor) != null ? _c : ref.anchor = onAnchor(value);
       return new Alias(ref.anchor);
     } else {
       ref = { anchor: null, node: null };
@@ -13559,7 +13569,7 @@ function createNode(value, tagName, ctx) {
     onTagObj(tagObj);
     delete ctx.onTagObj;
   }
-  const node = (tagObj == null ? void 0 : tagObj.createNode) ? tagObj.createNode(ctx.schema, value, ctx) : typeof ((_c = tagObj == null ? void 0 : tagObj.nodeClass) == null ? void 0 : _c.from) === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar(value);
+  const node = (tagObj == null ? void 0 : tagObj.createNode) ? tagObj.createNode(ctx.schema, value, ctx) : typeof ((_d = tagObj == null ? void 0 : tagObj.nodeClass) == null ? void 0 : _d.from) === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar(value);
   if (tagName)
     node.tag = tagName;
   else if (!tagObj.default)
@@ -14054,7 +14064,7 @@ function plainString(item, ctx, onComment, onChompKeep) {
   if (implicitKey && value.includes("\n") || inFlow && /[[\]{},]/.test(value)) {
     return quotedString(value, ctx);
   }
-  if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
+  if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
     return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
   }
   if (!implicitKey && !inFlow && type !== Scalar.PLAIN && value.includes("\n")) {
@@ -14183,12 +14193,13 @@ function getTagObject(tags, item) {
     tagObj = tags.find((t4) => t4.nodeClass && obj instanceof t4.nodeClass);
   }
   if (!tagObj) {
-    const name = (_d = (_c = obj == null ? void 0 : obj.constructor) == null ? void 0 : _c.name) != null ? _d : typeof obj;
+    const name = (_d = (_c = obj == null ? void 0 : obj.constructor) == null ? void 0 : _c.name) != null ? _d : obj === null ? "null" : typeof obj;
     throw new Error(`Tag not resolved for ${name} value`);
   }
   return tagObj;
 }
 function stringifyProps(node, tagObj, { anchors, doc }) {
+  var _a2;
   if (!doc.directives)
     return "";
   const props = [];
@@ -14197,7 +14208,7 @@ function stringifyProps(node, tagObj, { anchors, doc }) {
     anchors.add(anchor);
     props.push(`&${anchor}`);
   }
-  const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
+  const tag = (_a2 = node.tag) != null ? _a2 : tagObj.default ? null : tagObj.tag;
   if (tag)
     props.push(doc.directives.tagString(tag));
   return props.join(" ");
@@ -14221,8 +14232,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
   }
   let tagObj = void 0;
   const node = isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o3) => tagObj = o3 });
-  if (!tagObj)
-    tagObj = getTagObject(ctx.doc.schema.tags, node);
+  tagObj != null ? tagObj : tagObj = getTagObject(ctx.doc.schema.tags, node);
   const props = stringifyProps(node, tagObj, ctx);
   if (props.length > 0)
     ctx.indentAtStart = ((_b2 = ctx.indentAtStart) != null ? _b2 : 0) + props.length + 1;
@@ -15139,8 +15149,7 @@ var binary = {
     } else {
       throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
     }
-    if (!type)
-      type = Scalar.BLOCK_LITERAL;
+    type != null ? type : type = Scalar.BLOCK_LITERAL;
     if (type !== Scalar.QUOTE_DOUBLE) {
       const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
       const n3 = Math.ceil(str.length / lineWidth);
@@ -16184,8 +16193,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
         if (token.source.endsWith(":"))
           onError(token.offset + token.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", true);
         anchor = token;
-        if (start === null)
-          start = token.offset;
+        start != null ? start : start = token.offset;
         atNewline = false;
         hasSpace = false;
         reqSpace = true;
@@ -16194,8 +16202,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
         if (tag)
           onError(token, "MULTIPLE_TAGS", "A node can have at most one tag");
         tag = token;
-        if (start === null)
-          start = token.offset;
+        start != null ? start : start = token.offset;
         atNewline = false;
         hasSpace = false;
         reqSpace = true;
@@ -17184,8 +17191,7 @@ function findScalarTagByTest({ atKey, directives, schema: schema4 }, value, toke
 // node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js
 function emptyScalarPosition(offset, before, pos) {
   if (before) {
-    if (pos === null)
-      pos = before.length;
+    pos != null ? pos : pos = before.length;
     for (let i = pos - 1; i >= 0; --i) {
       let st2 = before[i];
       switch (st2.type) {
.size-limit.json
@@ -24,7 +24,7 @@
   {
     "name": "js parts",
     "path": "build/*.{js,cjs}",
-    "limit": "816.50 kB",
+    "limit": "816.85 kB",
     "brotli": false,
     "gzip": false
   },
@@ -38,14 +38,14 @@
   {
     "name": "vendor",
     "path": "build/vendor-*",
-    "limit": "769.10 kB",
+    "limit": "769.45 kB",
     "brotli": false,
     "gzip": false
   },
   {
     "name": "all",
     "path": ["build/*", "man/*", "README.md", "LICENSE"],
-    "limit": "873.10 kB",
+    "limit": "873.45 kB",
     "brotli": false,
     "gzip": false
   }
package-lock.json
@@ -50,7 +50,7 @@
         "typescript": "5.8.3",
         "vitepress": "1.6.3",
         "which": "5.0.0",
-        "yaml": "2.7.1",
+        "yaml": "2.8.0",
         "zurk": "0.11.2"
       },
       "engines": {
@@ -7076,16 +7076,16 @@
       "license": "ISC"
     },
     "node_modules/yaml": {
-      "version": "2.7.1",
-      "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz",
-      "integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==",
+      "version": "2.8.0",
+      "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz",
+      "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==",
       "dev": true,
       "license": "ISC",
       "bin": {
         "yaml": "bin.mjs"
       },
       "engines": {
-        "node": ">= 14"
+        "node": ">= 14.6"
       }
     },
     "node_modules/yargs": {
package.json
@@ -135,7 +135,7 @@
     "typescript": "5.8.3",
     "vitepress": "1.6.3",
     "which": "5.0.0",
-    "yaml": "2.7.1",
+    "yaml": "2.8.0",
     "zurk": "0.11.2"
   },
   "overrides": {