Manually bump dist/

This commit is contained in:
Barry Gordon
2022-09-22 11:23:04 +01:00
parent bdbe81d735
commit 00ab600844

202
dist/index.js generated vendored
View File

@@ -10563,7 +10563,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
: new Scalar.Scalar(res); : new Scalar.Scalar(res);
node.range = coll.range; node.range = coll.range;
node.tag = tagName; node.tag = tagName;
if (tag === null || tag === void 0 ? void 0 : tag.format) if (tag?.format)
node.format = tag.format; node.format = tag.format;
return node; return node;
} }
@@ -10585,7 +10585,7 @@ var resolveEnd = __nccwpck_require__(1250);
var resolveProps = __nccwpck_require__(6985); var resolveProps = __nccwpck_require__(6985);
function composeDoc(options, directives, { offset, start, value, end }, onError) { function composeDoc(options, directives, { offset, start, value, end }, onError) {
const opts = Object.assign({ directives }, options); const opts = Object.assign({ _directives: directives }, options);
const doc = new Document.Document(undefined, opts); const doc = new Document.Document(undefined, opts);
const ctx = { const ctx = {
atRoot: true, atRoot: true,
@@ -10595,7 +10595,7 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
}; };
const props = resolveProps.resolveProps(start, { const props = resolveProps.resolveProps(start, {
indicator: 'doc-start', indicator: 'doc-start',
next: value !== null && value !== void 0 ? value : end === null || end === void 0 ? void 0 : end[0], next: value ?? end?.[0],
offset, offset,
onError, onError,
startOnNewline: true startOnNewline: true
@@ -10749,12 +10749,12 @@ function composeScalar(ctx, token, tagToken, onError) {
: ctx.schema[Node.SCALAR]; : ctx.schema[Node.SCALAR];
let scalar; let scalar;
try { try {
const res = tag.resolve(value, msg => onError(tagToken !== null && tagToken !== void 0 ? tagToken : token, 'TAG_RESOLVE_FAILED', msg), ctx.options); const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
scalar = Node.isScalar(res) ? res : new Scalar.Scalar(res); scalar = Node.isScalar(res) ? res : new Scalar.Scalar(res);
} }
catch (error) { catch (error) {
const msg = error instanceof Error ? error.message : String(error); const msg = error instanceof Error ? error.message : String(error);
onError(tagToken !== null && tagToken !== void 0 ? tagToken : token, 'TAG_RESOLVE_FAILED', msg); onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);
scalar = new Scalar.Scalar(value); scalar = new Scalar.Scalar(value);
} }
scalar.range = range; scalar.range = range;
@@ -10770,7 +10770,6 @@ function composeScalar(ctx, token, tagToken, onError) {
return scalar; return scalar;
} }
function findScalarTagByName(schema, value, tagName, tagToken, onError) { function findScalarTagByName(schema, value, tagName, tagToken, onError) {
var _a;
if (tagName === '!') if (tagName === '!')
return schema[Node.SCALAR]; // non-specific tag return schema[Node.SCALAR]; // non-specific tag
const matchWithTest = []; const matchWithTest = [];
@@ -10783,7 +10782,7 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
} }
} }
for (const tag of matchWithTest) for (const tag of matchWithTest)
if ((_a = tag.test) === null || _a === void 0 ? void 0 : _a.test(value)) if (tag.test?.test(value))
return tag; return tag;
const kt = schema.knownTags[tagName]; const kt = schema.knownTags[tagName];
if (kt && !kt.collection) { if (kt && !kt.collection) {
@@ -10796,10 +10795,10 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
return schema[Node.SCALAR]; return schema[Node.SCALAR];
} }
function findScalarTagByTest({ directives, schema }, value, token, onError) { function findScalarTagByTest({ directives, schema }, value, token, onError) {
var _a; const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[Node.SCALAR];
const tag = schema.tags.find(tag => { var _a; return tag.default && ((_a = tag.test) === null || _a === void 0 ? void 0 : _a.test(value)); }) || schema[Node.SCALAR];
if (schema.compat) { if (schema.compat) {
const compat = (_a = schema.compat.find(tag => { var _a; return tag.default && ((_a = tag.test) === null || _a === void 0 ? void 0 : _a.test(value)); })) !== null && _a !== void 0 ? _a : schema[Node.SCALAR]; const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
schema[Node.SCALAR];
if (tag.tag !== compat.tag) { if (tag.tag !== compat.tag) {
const ts = directives.tagString(tag.tag); const ts = directives.tagString(tag.tag);
const cs = directives.tagString(compat.tag); const cs = directives.tagString(compat.tag);
@@ -10837,7 +10836,6 @@ function getErrorPos(src) {
return [offset, offset + (typeof source === 'string' ? source.length : 1)]; return [offset, offset + (typeof source === 'string' ? source.length : 1)];
} }
function parsePrelude(prelude) { function parsePrelude(prelude) {
var _a;
let comment = ''; let comment = '';
let atComment = false; let atComment = false;
let afterEmptyLine = false; let afterEmptyLine = false;
@@ -10852,7 +10850,7 @@ function parsePrelude(prelude) {
afterEmptyLine = false; afterEmptyLine = false;
break; break;
case '%': case '%':
if (((_a = prelude[i + 1]) === null || _a === void 0 ? void 0 : _a[0]) !== '#') if (prelude[i + 1]?.[0] !== '#')
i += 1; i += 1;
atComment = false; atComment = false;
break; break;
@@ -11029,7 +11027,7 @@ class Composer {
this.doc = null; this.doc = null;
} }
else if (forceDoc) { else if (forceDoc) {
const opts = Object.assign({ directives: this.directives }, this.options); const opts = Object.assign({ _directives: this.directives }, this.options);
const doc = new Document.Document(undefined, opts); const doc = new Document.Document(undefined, opts);
if (this.atDirectives) if (this.atDirectives)
this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line'); this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');
@@ -11060,7 +11058,6 @@ var utilMapIncludes = __nccwpck_require__(6899);
const startColMsg = 'All mapping items must start at the same column'; const startColMsg = 'All mapping items must start at the same column';
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) { function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
var _a;
const map = new YAMLMap.YAMLMap(ctx.schema); const map = new YAMLMap.YAMLMap(ctx.schema);
if (ctx.atRoot) if (ctx.atRoot)
ctx.atRoot = false; ctx.atRoot = false;
@@ -11070,7 +11067,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
// key properties // key properties
const keyProps = resolveProps.resolveProps(start, { const keyProps = resolveProps.resolveProps(start, {
indicator: 'explicit-key-ind', indicator: 'explicit-key-ind',
next: key !== null && key !== void 0 ? key : sep === null || sep === void 0 ? void 0 : sep[0], next: key ?? sep?.[0],
offset, offset,
onError, onError,
startOnNewline: true startOnNewline: true
@@ -11094,10 +11091,10 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
continue; continue;
} }
if (keyProps.hasNewlineAfterProp || utilContainsNewline.containsNewline(key)) { if (keyProps.hasNewlineAfterProp || utilContainsNewline.containsNewline(key)) {
onError(key !== null && key !== void 0 ? key : start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line'); onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
} }
} }
else if (((_a = keyProps.found) === null || _a === void 0 ? void 0 : _a.indent) !== bm.indent) { else if (keyProps.found?.indent !== bm.indent) {
onError(offset, 'BAD_INDENT', startColMsg); onError(offset, 'BAD_INDENT', startColMsg);
} }
// key value // key value
@@ -11110,7 +11107,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode)) if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique'); onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
// value properties // value properties
const valueProps = resolveProps.resolveProps(sep !== null && sep !== void 0 ? sep : [], { const valueProps = resolveProps.resolveProps(sep ?? [], {
indicator: 'map-value-ind', indicator: 'map-value-ind',
next: value, next: value,
offset: keyNode.range[2], offset: keyNode.range[2],
@@ -11120,7 +11117,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
offset = valueProps.end; offset = valueProps.end;
if (valueProps.found) { if (valueProps.found) {
if (implicitKey) { if (implicitKey) {
if ((value === null || value === void 0 ? void 0 : value.type) === 'block-map' && !valueProps.hasNewline) if (value?.type === 'block-map' && !valueProps.hasNewline)
onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings'); onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');
if (ctx.options.strict && if (ctx.options.strict &&
keyProps.start < valueProps.found.offset - 1024) keyProps.start < valueProps.found.offset - 1024)
@@ -11353,7 +11350,7 @@ function splitLines(source) {
const split = source.split(/\n( *)/); const split = source.split(/\n( *)/);
const first = split[0]; const first = split[0];
const m = first.match(/^( *)/); const m = first.match(/^( *)/);
const line0 = (m === null || m === void 0 ? void 0 : m[1]) const line0 = m?.[1]
? [m[1], first.slice(m[1].length)] ? [m[1], first.slice(m[1].length)]
: ['', first]; : ['', first];
const lines = [line0]; const lines = [line0];
@@ -11487,7 +11484,6 @@ var utilMapIncludes = __nccwpck_require__(6899);
const blockMsg = 'Block collections are not allowed within flow collections'; const blockMsg = 'Block collections are not allowed within flow collections';
const isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq'); const isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError) { function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError) {
var _a;
const isMap = fc.start.source === '{'; const isMap = fc.start.source === '{';
const fcName = isMap ? 'flow map' : 'flow sequence'; const fcName = isMap ? 'flow map' : 'flow sequence';
const coll = isMap const coll = isMap
@@ -11504,7 +11500,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
const props = resolveProps.resolveProps(start, { const props = resolveProps.resolveProps(start, {
flow: fcName, flow: fcName,
indicator: 'explicit-key-ind', indicator: 'explicit-key-ind',
next: key !== null && key !== void 0 ? key : sep === null || sep === void 0 ? void 0 : sep[0], next: key ?? sep?.[0],
offset, offset,
onError, onError,
startOnNewline: false startOnNewline: false
@@ -11552,7 +11548,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
if (prevItemComment) { if (prevItemComment) {
let prev = coll.items[coll.items.length - 1]; let prev = coll.items[coll.items.length - 1];
if (Node.isPair(prev)) if (Node.isPair(prev))
prev = (_a = prev.value) !== null && _a !== void 0 ? _a : prev.key; prev = prev.value ?? prev.key;
if (prev.comment) if (prev.comment)
prev.comment += '\n' + prevItemComment; prev.comment += '\n' + prevItemComment;
else else
@@ -11582,7 +11578,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
if (isBlock(key)) if (isBlock(key))
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg); onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
// value properties // value properties
const valueProps = resolveProps.resolveProps(sep !== null && sep !== void 0 ? sep : [], { const valueProps = resolveProps.resolveProps(sep ?? [], {
flow: fcName, flow: fcName,
indicator: 'map-value-ind', indicator: 'map-value-ind',
next: value, next: value,
@@ -11760,7 +11756,6 @@ function singleQuotedValue(source, onError) {
return foldLines(source.slice(1, -1)).replace(/''/g, "'"); return foldLines(source.slice(1, -1)).replace(/''/g, "'");
} }
function foldLines(source) { function foldLines(source) {
var _a;
/** /**
* The negative lookbehind here and in the `re` RegExp is to * The negative lookbehind here and in the `re` RegExp is to
* prevent causing a polynomial search time in certain cases. * prevent causing a polynomial search time in certain cases.
@@ -11800,7 +11795,7 @@ function foldLines(source) {
const last = /[ \t]*(.*)/sy; const last = /[ \t]*(.*)/sy;
last.lastIndex = pos; last.lastIndex = pos;
match = last.exec(source); match = last.exec(source);
return res + sep + ((_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : ''); return res + sep + (match?.[1] ?? '');
} }
function doubleQuotedValue(source, onError) { function doubleQuotedValue(source, onError) {
let res = ''; let res = '';
@@ -12009,7 +12004,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
if (anchor || tag) if (anchor || tag)
onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`); onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);
if (found) if (found)
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow !== null && flow !== void 0 ? flow : 'collection'}`); onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
found = token; found = token;
atNewline = false; atNewline = false;
hasSpace = false; hasSpace = false;
@@ -12049,7 +12044,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
anchor, anchor,
tag, tag,
end, end,
start: start !== null && start !== void 0 ? start : end start: start ?? end
}; };
} }
@@ -12124,7 +12119,7 @@ function emptyScalarPosition(offset, before, pos) {
// Technically, an empty scalar is immediately after the last non-empty // Technically, an empty scalar is immediately after the last non-empty
// node, but it's more useful to place it after any whitespace. // node, but it's more useful to place it after any whitespace.
st = before[++i]; st = before[++i];
while ((st === null || st === void 0 ? void 0 : st.type) === 'space') { while (st?.type === 'space') {
offset += st.source.length; offset += st.source.length;
st = before[++i]; st = before[++i];
} }
@@ -12148,7 +12143,7 @@ exports.emptyScalarPosition = emptyScalarPosition;
var utilContainsNewline = __nccwpck_require__(976); var utilContainsNewline = __nccwpck_require__(976);
function flowIndentCheck(indent, fc, onError) { function flowIndentCheck(indent, fc, onError) {
if ((fc === null || fc === void 0 ? void 0 : fc.type) === 'flow-collection') { if (fc?.type === 'flow-collection') {
const end = fc.end[0]; const end = fc.end[0];
if (end.indent === indent && if (end.indent === indent &&
(end.source === ']' || end.source === '}') && (end.source === ']' || end.source === '}') &&
@@ -12240,8 +12235,8 @@ class Document {
}, options); }, options);
this.options = opt; this.options = opt;
let { version } = opt; let { version } = opt;
if (options === null || options === void 0 ? void 0 : options.directives) { if (options?._directives) {
this.directives = options.directives.atDocument(); this.directives = options._directives.atDocument();
if (this.directives.yaml.explicit) if (this.directives.yaml.explicit)
version = this.directives.yaml.version; version = this.directives.yaml.version;
} }
@@ -12323,13 +12318,13 @@ class Document {
options = replacer; options = replacer;
replacer = undefined; replacer = undefined;
} }
const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options !== null && options !== void 0 ? options : {}; const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this,
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
anchorPrefix || 'a'); anchorPrefix || 'a');
const ctx = { const ctx = {
aliasDuplicateObjects: aliasDuplicateObjects !== null && aliasDuplicateObjects !== void 0 ? aliasDuplicateObjects : true, aliasDuplicateObjects: aliasDuplicateObjects ?? true,
keepUndefined: keepUndefined !== null && keepUndefined !== void 0 ? keepUndefined : false, keepUndefined: keepUndefined ?? false,
onAnchor, onAnchor,
onTagObj, onTagObj,
replacer: _replacer, replacer: _replacer,
@@ -12493,7 +12488,7 @@ class Document {
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100, maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100,
stringify: stringify.stringify stringify: stringify.stringify
}; };
const res = toJS.toJS(this.contents, jsonArg !== null && jsonArg !== void 0 ? jsonArg : '', ctx); const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);
if (typeof onAnchor === 'function') if (typeof onAnchor === 'function')
for (const { count, res } of ctx.anchors.values()) for (const { count, res } of ctx.anchors.values())
onAnchor(res, count); onAnchor(res, count);
@@ -12694,24 +12689,22 @@ var Scalar = __nccwpck_require__(9338);
const defaultTagPrefix = 'tag:yaml.org,2002:'; const defaultTagPrefix = 'tag:yaml.org,2002:';
function findTagObject(value, tagName, tags) { function findTagObject(value, tagName, tags) {
var _a;
if (tagName) { if (tagName) {
const match = tags.filter(t => t.tag === tagName); const match = tags.filter(t => t.tag === tagName);
const tagObj = (_a = match.find(t => !t.format)) !== null && _a !== void 0 ? _a : match[0]; const tagObj = match.find(t => !t.format) ?? match[0];
if (!tagObj) if (!tagObj)
throw new Error(`Tag ${tagName} not found`); throw new Error(`Tag ${tagName} not found`);
return tagObj; return tagObj;
} }
return tags.find(t => { var _a; return ((_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, value)) && !t.format; }); return tags.find(t => t.identify?.(value) && !t.format);
} }
function createNode(value, tagName, ctx) { function createNode(value, tagName, ctx) {
var _a, _b;
if (Node.isDocument(value)) if (Node.isDocument(value))
value = value.contents; value = value.contents;
if (Node.isNode(value)) if (Node.isNode(value))
return value; return value;
if (Node.isPair(value)) { if (Node.isPair(value)) {
const map = (_b = (_a = ctx.schema[Node.MAP]).createNode) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.schema, null, ctx); const map = ctx.schema[Node.MAP].createNode?.(ctx.schema, null, ctx);
map.items.push(value); map.items.push(value);
return map; return map;
} }
@@ -12739,7 +12732,7 @@ function createNode(value, tagName, ctx) {
sourceObjects.set(value, ref); sourceObjects.set(value, ref);
} }
} }
if (tagName === null || tagName === void 0 ? void 0 : tagName.startsWith('!!')) if (tagName?.startsWith('!!'))
tagName = defaultTagPrefix + tagName.slice(2); tagName = defaultTagPrefix + tagName.slice(2);
let tagObj = findTagObject(value, tagName, schema.tags); let tagObj = findTagObject(value, tagName, schema.tags);
if (!tagObj) { if (!tagObj) {
@@ -12764,7 +12757,7 @@ function createNode(value, tagName, ctx) {
onTagObj(tagObj); onTagObj(tagObj);
delete ctx.onTagObj; delete ctx.onTagObj;
} }
const node = (tagObj === null || tagObj === void 0 ? void 0 : tagObj.createNode) const node = tagObj?.createNode
? tagObj.createNode(ctx.schema, value, ctx) ? tagObj.createNode(ctx.schema, value, ctx)
: new Scalar.Scalar(value); : new Scalar.Scalar(value);
if (tagName) if (tagName)
@@ -13247,7 +13240,8 @@ function collectionFromPath(schema, path, value) {
sourceObjects: new Map() sourceObjects: new Map()
}); });
} }
// null, undefined, or an empty non-string iterable (e.g. []) // Type guard is intentionally a little wrong so as to be more useful,
// as it does not cover untypable empty non-string iterables (e.g. []).
const isEmptyPath = (path) => path == null || const isEmptyPath = (path) => path == null ||
(typeof path === 'object' && !!path[Symbol.iterator]().next().done); (typeof path === 'object' && !!path[Symbol.iterator]().next().done);
class Collection extends Node.NodeBase { class Collection extends Node.NodeBase {
@@ -13478,11 +13472,11 @@ class Pair {
return new Pair(key, value); return new Pair(key, value);
} }
toJSON(_, ctx) { toJSON(_, ctx) {
const pair = (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {}; const pair = ctx?.mapAsMap ? new Map() : {};
return addPairToJSMap.addPairToJSMap(ctx, pair, this); return addPairToJSMap.addPairToJSMap(ctx, pair, this);
} }
toString(ctx, onComment, onChompKeep) { toString(ctx, onComment, onChompKeep) {
return (ctx === null || ctx === void 0 ? void 0 : ctx.doc) return ctx?.doc
? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep) ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)
: JSON.stringify(this); : JSON.stringify(this);
} }
@@ -13510,7 +13504,7 @@ class Scalar extends Node.NodeBase {
this.value = value; this.value = value;
} }
toJSON(arg, ctx) { toJSON(arg, ctx) {
return (ctx === null || ctx === void 0 ? void 0 : ctx.keep) ? this.value : toJS.toJS(this.value, arg, ctx); return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);
} }
toString() { toString() {
return String(this.value); return String(this.value);
@@ -13568,18 +13562,17 @@ class YAMLMap extends Collection.Collection {
* collection will throw. Otherwise, overwrites the previous value. * collection will throw. Otherwise, overwrites the previous value.
*/ */
add(pair, overwrite) { add(pair, overwrite) {
var _a;
let _pair; let _pair;
if (Node.isPair(pair)) if (Node.isPair(pair))
_pair = pair; _pair = pair;
else if (!pair || typeof pair !== 'object' || !('key' in pair)) { else if (!pair || typeof pair !== 'object' || !('key' in pair)) {
// In TypeScript, this never happens. // In TypeScript, this never happens.
_pair = new Pair.Pair(pair, pair.value); _pair = new Pair.Pair(pair, pair?.value);
} }
else else
_pair = new Pair.Pair(pair.key, pair.value); _pair = new Pair.Pair(pair.key, pair.value);
const prev = findPair(this.items, _pair.key); const prev = findPair(this.items, _pair.key);
const sortEntries = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.sortMapEntries; const sortEntries = this.schema?.sortMapEntries;
if (prev) { if (prev) {
if (!overwrite) if (!overwrite)
throw new Error(`Key ${_pair.key} already set`); throw new Error(`Key ${_pair.key} already set`);
@@ -13609,8 +13602,8 @@ class YAMLMap extends Collection.Collection {
} }
get(key, keepScalar) { get(key, keepScalar) {
const it = findPair(this.items, key); const it = findPair(this.items, key);
const node = it === null || it === void 0 ? void 0 : it.value; const node = it?.value;
return !keepScalar && Node.isScalar(node) ? node.value : node; return (!keepScalar && Node.isScalar(node) ? node.value : node) ?? undefined;
} }
has(key) { has(key) {
return !!findPair(this.items, key); return !!findPair(this.items, key);
@@ -13624,8 +13617,8 @@ class YAMLMap extends Collection.Collection {
* @returns Instance of Type, Map, or Object * @returns Instance of Type, Map, or Object
*/ */
toJSON(_, ctx, Type) { toJSON(_, ctx, Type) {
const map = Type ? new Type() : (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {}; const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};
if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate) if (ctx?.onCreate)
ctx.onCreate(map); ctx.onCreate(map);
for (const item of this.items) for (const item of this.items)
addPairToJSMap.addPairToJSMap(ctx, map, item); addPairToJSMap.addPairToJSMap(ctx, map, item);
@@ -13694,14 +13687,6 @@ class YAMLSeq extends Collection.Collection {
const del = this.items.splice(idx, 1); const del = this.items.splice(idx, 1);
return del.length > 0; return del.length > 0;
} }
/**
* Returns item at `key`, or `undefined` if not found. By default unwraps
* scalar values from their surrounding node; to disable set `keepScalar` to
* `true` (collections are always returned intact).
*
* `key` must contain a representation of an integer for this to succeed.
* It may be wrapped in a `Scalar`.
*/
get(key, keepScalar) { get(key, keepScalar) {
const idx = asItemIndex(key); const idx = asItemIndex(key);
if (typeof idx !== 'number') if (typeof idx !== 'number')
@@ -13738,7 +13723,7 @@ class YAMLSeq extends Collection.Collection {
} }
toJSON(_, ctx) { toJSON(_, ctx) {
const seq = []; const seq = [];
if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate) if (ctx?.onCreate)
ctx.onCreate(seq); ctx.onCreate(seq);
let i = 0; let i = 0;
for (const item of this.items) for (const item of this.items)
@@ -13785,7 +13770,7 @@ var toJS = __nccwpck_require__(2463);
const MERGE_KEY = '<<'; const MERGE_KEY = '<<';
function addPairToJSMap(ctx, map, { key, value }) { function addPairToJSMap(ctx, map, { key, value }) {
if ((ctx === null || ctx === void 0 ? void 0 : ctx.doc.schema.merge) && isMergeKey(key)) { if (ctx?.doc.schema.merge && isMergeKey(key)) {
value = Node.isAlias(value) ? value.resolve(ctx.doc) : value; value = Node.isAlias(value) ? value.resolve(ctx.doc) : value;
if (Node.isSeq(value)) if (Node.isSeq(value))
for (const it of value.items) for (const it of value.items)
@@ -13922,7 +13907,7 @@ function toJS(value, arg, ctx) {
ctx.onCreate(res); ctx.onCreate(res);
return res; return res;
} }
if (typeof value === 'bigint' && !(ctx === null || ctx === void 0 ? void 0 : ctx.keep)) if (typeof value === 'bigint' && !ctx?.keep)
return Number(value); return Number(value);
return value; return value;
} }
@@ -13978,7 +13963,6 @@ function resolveAsScalar(token, strict = true, onError) {
* @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`. * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.
*/ */
function createScalarToken(value, context) { function createScalarToken(value, context) {
var _a;
const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context; const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;
const source = stringifyString.stringifyString({ type, value }, { const source = stringifyString.stringifyString({ type, value }, {
implicitKey, implicitKey,
@@ -13986,7 +13970,7 @@ function createScalarToken(value, context) {
inFlow, inFlow,
options: { blockQuote: true, lineWidth: -1 } options: { blockQuote: true, lineWidth: -1 }
}); });
const end = (_a = context.end) !== null && _a !== void 0 ? _a : [ const end = context.end ?? [
{ type: 'newline', offset: -1, indent, source: '\n' } { type: 'newline', offset: -1, indent, source: '\n' }
]; ];
switch (source[0]) { switch (source[0]) {
@@ -14285,7 +14269,7 @@ visit.REMOVE = REMOVE;
visit.itemAtPath = (cst, path) => { visit.itemAtPath = (cst, path) => {
let item = cst; let item = cst;
for (const [field, index] of path) { for (const [field, index] of path) {
const tok = item === null || item === void 0 ? void 0 : item[field]; const tok = item?.[field];
if (tok && 'items' in tok) { if (tok && 'items' in tok) {
item = tok.items[index]; item = tok.items[index];
} }
@@ -14302,7 +14286,7 @@ visit.itemAtPath = (cst, path) => {
visit.parentCollection = (cst, path) => { visit.parentCollection = (cst, path) => {
const parent = visit.itemAtPath(cst, path.slice(0, -1)); const parent = visit.itemAtPath(cst, path.slice(0, -1));
const field = path[path.length - 1][0]; const field = path[path.length - 1][0];
const coll = parent === null || parent === void 0 ? void 0 : parent[field]; const coll = parent?.[field];
if (coll && 'items' in coll) if (coll && 'items' in coll)
return coll; return coll;
throw new Error('Parent collection not found'); throw new Error('Parent collection not found');
@@ -14613,13 +14597,12 @@ class Lexer {
* @returns A generator of lexical tokens * @returns A generator of lexical tokens
*/ */
*lex(source, incomplete = false) { *lex(source, incomplete = false) {
var _a;
if (source) { if (source) {
this.buffer = this.buffer ? this.buffer + source : source; this.buffer = this.buffer ? this.buffer + source : source;
this.lineEndPos = null; this.lineEndPos = null;
} }
this.atEnd = !incomplete; this.atEnd = !incomplete;
let next = (_a = this.next) !== null && _a !== void 0 ? _a : 'stream'; let next = this.next ?? 'stream';
while (next && (incomplete || this.hasChars(1))) while (next && (incomplete || this.hasChars(1)))
next = yield* this.parseNext(next); next = yield* this.parseNext(next);
} }
@@ -15247,7 +15230,7 @@ function findNonEmptyIndex(list) {
return -1; return -1;
} }
function isFlowToken(token) { function isFlowToken(token) {
switch (token === null || token === void 0 ? void 0 : token.type) { switch (token?.type) {
case 'alias': case 'alias':
case 'scalar': case 'scalar':
case 'single-quoted-scalar': case 'single-quoted-scalar':
@@ -15259,13 +15242,12 @@ function isFlowToken(token) {
} }
} }
function getPrevProps(parent) { function getPrevProps(parent) {
var _a;
switch (parent.type) { switch (parent.type) {
case 'document': case 'document':
return parent.start; return parent.start;
case 'block-map': { case 'block-map': {
const it = parent.items[parent.items.length - 1]; const it = parent.items[parent.items.length - 1];
return (_a = it.sep) !== null && _a !== void 0 ? _a : it.start; return it.sep ?? it.start;
} }
case 'block-seq': case 'block-seq':
return parent.items[parent.items.length - 1].start; return parent.items[parent.items.length - 1].start;
@@ -15276,7 +15258,6 @@ function getPrevProps(parent) {
} }
/** Note: May modify input array */ /** Note: May modify input array */
function getFirstKeyStartProps(prev) { function getFirstKeyStartProps(prev) {
var _a;
if (prev.length === 0) if (prev.length === 0)
return []; return [];
let i = prev.length; let i = prev.length;
@@ -15290,7 +15271,7 @@ function getFirstKeyStartProps(prev) {
break loop; break loop;
} }
} }
while (((_a = prev[++i]) === null || _a === void 0 ? void 0 : _a.type) === 'space') { while (prev[++i]?.type === 'space') {
/* loop */ /* loop */
} }
return prev.splice(i, prev.length); return prev.splice(i, prev.length);
@@ -15494,7 +15475,7 @@ class Parser {
return this.stack[this.stack.length - n]; return this.stack[this.stack.length - n];
} }
*pop(error) { *pop(error) {
const token = error !== null && error !== void 0 ? error : this.stack.pop(); const token = error ?? this.stack.pop();
/* istanbul ignore if should not happen */ /* istanbul ignore if should not happen */
if (!token) { if (!token) {
const message = 'Tried to pop an empty stack'; const message = 'Tried to pop an empty stack';
@@ -15699,7 +15680,6 @@ class Parser {
} }
} }
*blockMap(map) { *blockMap(map) {
var _a;
const it = map.items[map.items.length - 1]; const it = map.items[map.items.length - 1];
// it.sep is true-ish if pair already has key or : separator // it.sep is true-ish if pair already has key or : separator
switch (this.type) { switch (this.type) {
@@ -15708,8 +15688,8 @@ class Parser {
if (it.value) { if (it.value) {
const end = 'end' in it.value ? it.value.end : undefined; const end = 'end' in it.value ? it.value.end : undefined;
const last = Array.isArray(end) ? end[end.length - 1] : undefined; const last = Array.isArray(end) ? end[end.length - 1] : undefined;
if ((last === null || last === void 0 ? void 0 : last.type) === 'comment') if (last?.type === 'comment')
end === null || end === void 0 ? void 0 : end.push(this.sourceToken); end?.push(this.sourceToken);
else else
map.items.push({ start: [this.sourceToken] }); map.items.push({ start: [this.sourceToken] });
} }
@@ -15731,7 +15711,7 @@ class Parser {
else { else {
if (this.atIndentedComment(it.start, map.indent)) { if (this.atIndentedComment(it.start, map.indent)) {
const prev = map.items[map.items.length - 2]; const prev = map.items[map.items.length - 2];
const end = (_a = prev === null || prev === void 0 ? void 0 : prev.value) === null || _a === void 0 ? void 0 : _a.end; const end = prev?.value?.end;
if (Array.isArray(end)) { if (Array.isArray(end)) {
Array.prototype.push.apply(end, it.start); Array.prototype.push.apply(end, it.start);
end.push(this.sourceToken); end.push(this.sourceToken);
@@ -15908,15 +15888,14 @@ class Parser {
yield* this.step(); yield* this.step();
} }
*blockSequence(seq) { *blockSequence(seq) {
var _a;
const it = seq.items[seq.items.length - 1]; const it = seq.items[seq.items.length - 1];
switch (this.type) { switch (this.type) {
case 'newline': case 'newline':
if (it.value) { if (it.value) {
const end = 'end' in it.value ? it.value.end : undefined; const end = 'end' in it.value ? it.value.end : undefined;
const last = Array.isArray(end) ? end[end.length - 1] : undefined; const last = Array.isArray(end) ? end[end.length - 1] : undefined;
if ((last === null || last === void 0 ? void 0 : last.type) === 'comment') if (last?.type === 'comment')
end === null || end === void 0 ? void 0 : end.push(this.sourceToken); end?.push(this.sourceToken);
else else
seq.items.push({ start: [this.sourceToken] }); seq.items.push({ start: [this.sourceToken] });
} }
@@ -15930,7 +15909,7 @@ class Parser {
else { else {
if (this.atIndentedComment(it.start, seq.indent)) { if (this.atIndentedComment(it.start, seq.indent)) {
const prev = seq.items[seq.items.length - 2]; const prev = seq.items[seq.items.length - 2];
const end = (_a = prev === null || prev === void 0 ? void 0 : prev.value) === null || _a === void 0 ? void 0 : _a.end; const end = prev?.value?.end;
if (Array.isArray(end)) { if (Array.isArray(end)) {
Array.prototype.push.apply(end, it.start); Array.prototype.push.apply(end, it.start);
end.push(this.sourceToken); end.push(this.sourceToken);
@@ -16213,7 +16192,7 @@ function parseOptions(options) {
*/ */
function parseAllDocuments(source, options = {}) { function parseAllDocuments(source, options = {}) {
const { lineCounter, prettyErrors } = parseOptions(options); const { lineCounter, prettyErrors } = parseOptions(options);
const parser$1 = new parser.Parser(lineCounter === null || lineCounter === void 0 ? void 0 : lineCounter.addNewLine); const parser$1 = new parser.Parser(lineCounter?.addNewLine);
const composer$1 = new composer.Composer(options); const composer$1 = new composer.Composer(options);
const docs = Array.from(composer$1.compose(parser$1.parse(source))); const docs = Array.from(composer$1.compose(parser$1.parse(source)));
if (prettyErrors && lineCounter) if (prettyErrors && lineCounter)
@@ -16228,7 +16207,7 @@ function parseAllDocuments(source, options = {}) {
/** Parse an input string into a single YAML.Document */ /** Parse an input string into a single YAML.Document */
function parseDocument(source, options = {}) { function parseDocument(source, options = {}) {
const { lineCounter, prettyErrors } = parseOptions(options); const { lineCounter, prettyErrors } = parseOptions(options);
const parser$1 = new parser.Parser(lineCounter === null || lineCounter === void 0 ? void 0 : lineCounter.addNewLine); const parser$1 = new parser.Parser(lineCounter?.addNewLine);
const composer$1 = new composer.Composer(options); const composer$1 = new composer.Composer(options);
// `doc` is always set by compose.end(true) at the very latest // `doc` is always set by compose.end(true) at the very latest
let doc = null; let doc = null;
@@ -16267,7 +16246,6 @@ function parse(src, reviver, options) {
return doc.toJS(Object.assign({ reviver: _reviver }, options)); return doc.toJS(Object.assign({ reviver: _reviver }, options));
} }
function stringify(value, replacer, options) { function stringify(value, replacer, options) {
var _a;
let _replacer = null; let _replacer = null;
if (typeof replacer === 'function' || Array.isArray(replacer)) { if (typeof replacer === 'function' || Array.isArray(replacer)) {
_replacer = replacer; _replacer = replacer;
@@ -16282,7 +16260,7 @@ function stringify(value, replacer, options) {
options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent }; options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
} }
if (value === undefined) { if (value === undefined) {
const { keepUndefined } = (_a = options !== null && options !== void 0 ? options : replacer) !== null && _a !== void 0 ? _a : {}; const { keepUndefined } = options ?? replacer ?? {};
if (!keepUndefined) if (!keepUndefined)
return undefined; return undefined;
} }
@@ -16321,7 +16299,7 @@ class Schema {
this.name = (typeof schema === 'string' && schema) || 'core'; this.name = (typeof schema === 'string' && schema) || 'core';
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {}; this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
this.tags = tags.getTags(customTags, this.name); this.tags = tags.getTags(customTags, this.name);
this.toStringOptions = toStringDefaults !== null && toStringDefaults !== void 0 ? toStringDefaults : null; this.toStringOptions = toStringDefaults ?? null;
Object.defineProperty(this, Node.MAP, { value: map.map }); Object.defineProperty(this, Node.MAP, { value: map.map });
Object.defineProperty(this, Node.SCALAR, { value: string.string }); Object.defineProperty(this, Node.SCALAR, { value: string.string });
Object.defineProperty(this, Node.SEQ, { value: seq.seq }); Object.defineProperty(this, Node.SEQ, { value: seq.seq });
@@ -17107,7 +17085,7 @@ class YAMLOMap extends YAMLSeq.YAMLSeq {
if (!ctx) if (!ctx)
return super.toJSON(_); return super.toJSON(_);
const map = new Map(); const map = new Map();
if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate) if (ctx?.onCreate)
ctx.onCreate(map); ctx.onCreate(map);
for (const pair of this.items) { for (const pair of this.items) {
let key, value; let key, value;
@@ -17173,7 +17151,6 @@ var Scalar = __nccwpck_require__(9338);
var YAMLSeq = __nccwpck_require__(5161); var YAMLSeq = __nccwpck_require__(5161);
function resolvePairs(seq, onError) { function resolvePairs(seq, onError) {
var _a;
if (Node.isSeq(seq)) { if (Node.isSeq(seq)) {
for (let i = 0; i < seq.items.length; ++i) { for (let i = 0; i < seq.items.length; ++i) {
let item = seq.items[i]; let item = seq.items[i];
@@ -17188,7 +17165,7 @@ function resolvePairs(seq, onError) {
? `${item.commentBefore}\n${pair.key.commentBefore}` ? `${item.commentBefore}\n${pair.key.commentBefore}`
: item.commentBefore; : item.commentBefore;
if (item.comment) { if (item.comment) {
const cn = (_a = pair.value) !== null && _a !== void 0 ? _a : pair.key; const cn = pair.value ?? pair.key;
cn.comment = cn.comment cn.comment = cn.comment
? `${item.comment}\n${cn.comment}` ? `${item.comment}\n${cn.comment}`
: item.comment; : item.comment;
@@ -17328,6 +17305,10 @@ class YAMLSet extends YAMLMap.YAMLMap {
if (!prev) if (!prev)
this.items.push(pair); this.items.push(pair);
} }
/**
* If `keepPair` is `true`, returns the Pair matching `key`.
* Otherwise, returns the value of that Pair's key.
*/
get(key, keepPair) { get(key, keepPair) {
const pair = YAMLMap.findPair(this.items, key); const pair = YAMLMap.findPair(this.items, key);
return !keepPair && Node.isPair(pair) return !keepPair && Node.isPair(pair)
@@ -17708,26 +17689,25 @@ function createStringifyContext(doc, options) {
}; };
} }
function getTagObject(tags, item) { function getTagObject(tags, item) {
var _a, _b, _c, _d;
if (item.tag) { if (item.tag) {
const match = tags.filter(t => t.tag === item.tag); const match = tags.filter(t => t.tag === item.tag);
if (match.length > 0) if (match.length > 0)
return (_a = match.find(t => t.format === item.format)) !== null && _a !== void 0 ? _a : match[0]; return match.find(t => t.format === item.format) ?? match[0];
} }
let tagObj = undefined; let tagObj = undefined;
let obj; let obj;
if (Node.isScalar(item)) { if (Node.isScalar(item)) {
obj = item.value; obj = item.value;
const match = tags.filter(t => { var _a; return (_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, obj); }); const match = tags.filter(t => t.identify?.(obj));
tagObj = tagObj =
(_b = match.find(t => t.format === item.format)) !== null && _b !== void 0 ? _b : match.find(t => !t.format); match.find(t => t.format === item.format) ?? match.find(t => !t.format);
} }
else { else {
obj = item; obj = item;
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass); tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
} }
if (!tagObj) { if (!tagObj) {
const name = (_d = (_c = obj === null || obj === void 0 ? void 0 : obj.constructor) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : typeof obj; const name = obj?.constructor?.name ?? typeof obj;
throw new Error(`Tag not resolved for ${name} value`); throw new Error(`Tag not resolved for ${name} value`);
} }
return tagObj; return tagObj;
@@ -17748,13 +17728,12 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
return props.join(' '); return props.join(' ');
} }
function stringify(item, ctx, onComment, onChompKeep) { function stringify(item, ctx, onComment, onChompKeep) {
var _a, _b;
if (Node.isPair(item)) if (Node.isPair(item))
return item.toString(ctx, onComment, onChompKeep); return item.toString(ctx, onComment, onChompKeep);
if (Node.isAlias(item)) { if (Node.isAlias(item)) {
if (ctx.doc.directives) if (ctx.doc.directives)
return item.toString(ctx); return item.toString(ctx);
if ((_a = ctx.resolvedAliases) === null || _a === void 0 ? void 0 : _a.has(item)) { if (ctx.resolvedAliases?.has(item)) {
throw new TypeError(`Cannot stringify circular structure without alias nodes`); throw new TypeError(`Cannot stringify circular structure without alias nodes`);
} }
else { else {
@@ -17773,7 +17752,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
tagObj = getTagObject(ctx.doc.schema.tags, node); tagObj = getTagObject(ctx.doc.schema.tags, node);
const props = stringifyProps(node, tagObj, ctx); const props = stringifyProps(node, tagObj, ctx);
if (props.length > 0) if (props.length > 0)
ctx.indentAtStart = ((_b = ctx.indentAtStart) !== null && _b !== void 0 ? _b : 0) + props.length + 1; ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
const str = typeof tagObj.stringify === 'function' const str = typeof tagObj.stringify === 'function'
? tagObj.stringify(node, ctx, onComment, onChompKeep) ? tagObj.stringify(node, ctx, onComment, onChompKeep)
: Node.isScalar(node) : Node.isScalar(node)
@@ -17804,8 +17783,7 @@ var stringify = __nccwpck_require__(8409);
var stringifyComment = __nccwpck_require__(5182); var stringifyComment = __nccwpck_require__(5182);
function stringifyCollection(collection, ctx, options) { function stringifyCollection(collection, ctx, options) {
var _a; const flow = ctx.inFlow ?? collection.flow;
const flow = (_a = ctx.inFlow) !== null && _a !== void 0 ? _a : collection.flow;
const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection; const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
return stringify(collection, ctx, options); return stringify(collection, ctx, options);
} }
@@ -17997,7 +17975,6 @@ var stringify = __nccwpck_require__(8409);
var stringifyComment = __nccwpck_require__(5182); var stringifyComment = __nccwpck_require__(5182);
function stringifyDocument(doc, options) { function stringifyDocument(doc, options) {
var _a;
const lines = []; const lines = [];
let hasDirectives = options.directives === true; let hasDirectives = options.directives === true;
if (options.directives !== false && doc.directives) { if (options.directives !== false && doc.directives) {
@@ -18049,7 +18026,7 @@ function stringifyDocument(doc, options) {
else { else {
lines.push(stringify.stringify(doc.contents, ctx)); lines.push(stringify.stringify(doc.contents, ctx));
} }
if ((_a = doc.directives) === null || _a === void 0 ? void 0 : _a.docEnd) { if (doc.directives?.docEnd) {
if (doc.comment) { if (doc.comment) {
const cs = commentString(doc.comment); const cs = commentString(doc.comment);
if (cs.includes('\n')) { if (cs.includes('\n')) {
@@ -18522,9 +18499,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
// booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'), // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
// and others in v1.1. // and others in v1.1.
if (actualString) { if (actualString) {
const test = (tag) => { var _a; return tag.default && tag.tag !== 'tag:yaml.org,2002:str' && ((_a = tag.test) === null || _a === void 0 ? void 0 : _a.test(str)); }; const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);
const { compat, tags } = ctx.doc.schema; const { compat, tags } = ctx.doc.schema;
if (tags.some(test) || (compat === null || compat === void 0 ? void 0 : compat.some(test))) if (tags.some(test) || compat?.some(test))
return quotedString(value, ctx); return quotedString(value, ctx);
} }
return implicitKey return implicitKey
@@ -18779,19 +18756,18 @@ function initVisitor(visitor) {
return visitor; return visitor;
} }
function callVisitor(key, node, visitor, path) { function callVisitor(key, node, visitor, path) {
var _a, _b, _c, _d, _e;
if (typeof visitor === 'function') if (typeof visitor === 'function')
return visitor(key, node, path); return visitor(key, node, path);
if (Node.isMap(node)) if (Node.isMap(node))
return (_a = visitor.Map) === null || _a === void 0 ? void 0 : _a.call(visitor, key, node, path); return visitor.Map?.(key, node, path);
if (Node.isSeq(node)) if (Node.isSeq(node))
return (_b = visitor.Seq) === null || _b === void 0 ? void 0 : _b.call(visitor, key, node, path); return visitor.Seq?.(key, node, path);
if (Node.isPair(node)) if (Node.isPair(node))
return (_c = visitor.Pair) === null || _c === void 0 ? void 0 : _c.call(visitor, key, node, path); return visitor.Pair?.(key, node, path);
if (Node.isScalar(node)) if (Node.isScalar(node))
return (_d = visitor.Scalar) === null || _d === void 0 ? void 0 : _d.call(visitor, key, node, path); return visitor.Scalar?.(key, node, path);
if (Node.isAlias(node)) if (Node.isAlias(node))
return (_e = visitor.Alias) === null || _e === void 0 ? void 0 : _e.call(visitor, key, node, path); return visitor.Alias?.(key, node, path);
return undefined; return undefined;
} }
function replaceNode(key, path, node) { function replaceNode(key, path, node) {