node_modules: upgrade

This commit is contained in:
Dawid Dziurla
2024-01-17 10:08:10 +01:00
parent 9ff0bc8d99
commit 00765f79cf
320 changed files with 31840 additions and 1039 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
var Alias = require('../nodes/Alias.js');
var Node = require('../nodes/Node.js');
var identity = require('../nodes/identity.js');
var Scalar = require('../nodes/Scalar.js');
const defaultTagPrefix = 'tag:yaml.org,2002:';
@@ -16,12 +16,12 @@ function findTagObject(value, tagName, tags) {
return tags.find(t => t.identify?.(value) && !t.format);
}
function createNode(value, tagName, ctx) {
if (Node.isDocument(value))
if (identity.isDocument(value))
value = value.contents;
if (Node.isNode(value))
if (identity.isNode(value))
return value;
if (Node.isPair(value)) {
const map = ctx.schema[Node.MAP].createNode?.(ctx.schema, null, ctx);
if (identity.isPair(value)) {
const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);
map.items.push(value);
return map;
}
@@ -65,10 +65,10 @@ function createNode(value, tagName, ctx) {
}
tagObj =
value instanceof Map
? schema[Node.MAP]
? schema[identity.MAP]
: Symbol.iterator in Object(value)
? schema[Node.SEQ]
: schema[Node.MAP];
? schema[identity.SEQ]
: schema[identity.MAP];
}
if (onTagObj) {
onTagObj(tagObj);
@@ -76,9 +76,13 @@ function createNode(value, tagName, ctx) {
}
const node = tagObj?.createNode
? tagObj.createNode(ctx.schema, value, ctx)
: new Scalar.Scalar(value);
: typeof tagObj?.nodeClass?.from === 'function'
? tagObj.nodeClass.from(ctx.schema, value, ctx)
: new Scalar.Scalar(value);
if (tagName)
node.tag = tagName;
else if (!tagObj.default)
node.tag = tagObj.tag;
if (ref)
ref.node = node;
return node;