Skip to content

Commit 4b74703

Browse files
author
GitHub Actions
committed
chore: Update dist
1 parent 93abf07 commit 4b74703

File tree

1 file changed

+39
-49
lines changed

1 file changed

+39
-49
lines changed

dist/index.js

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -104945,14 +104945,6 @@ module.exports = require("net");
104945104945

104946104946
/***/ }),
104947104947

104948-
/***/ 4573:
104949-
/***/ ((module) => {
104950-
104951-
"use strict";
104952-
module.exports = require("node:buffer");
104953-
104954-
/***/ }),
104955-
104956104948
/***/ 77598:
104957104949
/***/ ((module) => {
104958104950

@@ -104969,14 +104961,6 @@ module.exports = require("node:events");
104969104961

104970104962
/***/ }),
104971104963

104972-
/***/ 1708:
104973-
/***/ ((module) => {
104974-
104975-
"use strict";
104976-
module.exports = require("node:process");
104977-
104978-
/***/ }),
104979-
104980104964
/***/ 57075:
104981104965
/***/ ((module) => {
104982104966

@@ -107104,7 +107088,7 @@ exports.composeScalar = composeScalar;
107104107088
"use strict";
107105107089

107106107090

107107-
var node_process = __nccwpck_require__(1708);
107091+
var node_process = __nccwpck_require__(932);
107108107092
var directives = __nccwpck_require__(61342);
107109107093
var Document = __nccwpck_require__(3021);
107110107094
var errors = __nccwpck_require__(91464);
@@ -108297,8 +108281,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
108297108281
if (token.source.endsWith(':'))
108298108282
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
108299108283
anchor = token;
108300-
if (start === null)
108301-
start = token.offset;
108284+
start ?? (start = token.offset);
108302108285
atNewline = false;
108303108286
hasSpace = false;
108304108287
reqSpace = true;
@@ -108307,8 +108290,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
108307108290
if (tag)
108308108291
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
108309108292
tag = token;
108310-
if (start === null)
108311-
start = token.offset;
108293+
start ?? (start = token.offset);
108312108294
atNewline = false;
108313108295
hasSpace = false;
108314108296
reqSpace = true;
@@ -108427,8 +108409,7 @@ exports.containsNewline = containsNewline;
108427108409

108428108410
function emptyScalarPosition(offset, before, pos) {
108429108411
if (before) {
108430-
if (pos === null)
108431-
pos = before.length;
108412+
pos ?? (pos = before.length);
108432108413
for (let i = pos - 1; i >= 0; --i) {
108433108414
let st = before[i];
108434108415
switch (st.type) {
@@ -108896,8 +108877,7 @@ function createNodeAnchors(doc, prefix) {
108896108877
return {
108897108878
onAnchor: (source) => {
108898108879
aliasObjects.push(source);
108899-
if (!prevAnchors)
108900-
prevAnchors = anchorNames(doc);
108880+
prevAnchors ?? (prevAnchors = anchorNames(doc));
108901108881
const anchor = findNewAnchor(prefix, prevAnchors);
108902108882
prevAnchors.add(anchor);
108903108883
return anchor;
@@ -109045,8 +109025,7 @@ function createNode(value, tagName, ctx) {
109045109025
if (aliasDuplicateObjects && value && typeof value === 'object') {
109046109026
ref = sourceObjects.get(value);
109047109027
if (ref) {
109048-
if (!ref.anchor)
109049-
ref.anchor = onAnchor(value);
109028+
ref.anchor ?? (ref.anchor = onAnchor(value));
109050109029
return new Alias.Alias(ref.anchor);
109051109030
}
109052109031
else {
@@ -109418,7 +109397,7 @@ exports.visitAsync = visit.visitAsync;
109418109397
"use strict";
109419109398

109420109399

109421-
var node_process = __nccwpck_require__(1708);
109400+
var node_process = __nccwpck_require__(932);
109422109401

109423109402
function debug(logLevel, ...messages) {
109424109403
if (logLevel === 'debug')
@@ -109465,23 +109444,36 @@ class Alias extends Node.NodeBase {
109465109444
* Resolve the value of this alias within `doc`, finding the last
109466109445
* instance of the `source` anchor before this node.
109467109446
*/
109468-
resolve(doc) {
109447+
resolve(doc, ctx) {
109448+
let nodes;
109449+
if (ctx?.aliasResolveCache) {
109450+
nodes = ctx.aliasResolveCache;
109451+
}
109452+
else {
109453+
nodes = [];
109454+
visit.visit(doc, {
109455+
Node: (_key, node) => {
109456+
if (identity.isAlias(node) || identity.hasAnchor(node))
109457+
nodes.push(node);
109458+
}
109459+
});
109460+
if (ctx)
109461+
ctx.aliasResolveCache = nodes;
109462+
}
109469109463
let found = undefined;
109470-
visit.visit(doc, {
109471-
Node: (_key, node) => {
109472-
if (node === this)
109473-
return visit.visit.BREAK;
109474-
if (node.anchor === this.source)
109475-
found = node;
109476-
}
109477-
});
109464+
for (const node of nodes) {
109465+
if (node === this)
109466+
break;
109467+
if (node.anchor === this.source)
109468+
found = node;
109469+
}
109478109470
return found;
109479109471
}
109480109472
toJSON(_arg, ctx) {
109481109473
if (!ctx)
109482109474
return { source: this.source };
109483109475
const { anchors, doc, maxAliasCount } = ctx;
109484-
const source = this.resolve(doc);
109476+
const source = this.resolve(doc, ctx);
109485109477
if (!source) {
109486109478
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
109487109479
throw new ReferenceError(msg);
@@ -110162,6 +110154,7 @@ function addPairToJSMap(ctx, map, { key, value }) {
110162110154
function stringifyKey(key, jsKey, ctx) {
110163110155
if (jsKey === null)
110164110156
return '';
110157+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
110165110158
if (typeof jsKey !== 'object')
110166110159
return String(jsKey);
110167110160
if (identity.isNode(key) && ctx?.doc) {
@@ -111603,7 +111596,7 @@ exports.LineCounter = LineCounter;
111603111596
"use strict";
111604111597

111605111598

111606-
var node_process = __nccwpck_require__(1708);
111599+
var node_process = __nccwpck_require__(932);
111607111600
var cst = __nccwpck_require__(3461);
111608111601
var lexer = __nccwpck_require__(40361);
111609111602

@@ -113194,7 +113187,7 @@ exports.getTags = getTags;
113194113187
"use strict";
113195113188

113196113189

113197-
var node_buffer = __nccwpck_require__(4573);
113190+
var node_buffer = __nccwpck_require__(20181);
113198113191
var Scalar = __nccwpck_require__(63301);
113199113192
var stringifyString = __nccwpck_require__(83069);
113200113193

@@ -113247,8 +113240,7 @@ const binary = {
113247113240
else {
113248113241
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
113249113242
}
113250-
if (!type)
113251-
type = Scalar.Scalar.BLOCK_LITERAL;
113243+
type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
113252113244
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
113253113245
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
113254113246
const n = Math.ceil(str.length / lineWidth);
@@ -114198,7 +114190,7 @@ function getTagObject(tags, item) {
114198114190
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
114199114191
}
114200114192
if (!tagObj) {
114201-
const name = obj?.constructor?.name ?? typeof obj;
114193+
const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
114202114194
throw new Error(`Tag not resolved for ${name} value`);
114203114195
}
114204114196
return tagObj;
@@ -114213,7 +114205,7 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
114213114205
anchors$1.add(anchor);
114214114206
props.push(`&${anchor}`);
114215114207
}
114216-
const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
114208+
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
114217114209
if (tag)
114218114210
props.push(doc.directives.tagString(tag));
114219114211
return props.join(' ');
@@ -114239,8 +114231,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
114239114231
const node = identity.isNode(item)
114240114232
? item
114241114233
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
114242-
if (!tagObj)
114243-
tagObj = getTagObject(ctx.doc.schema.tags, node);
114234+
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
114244114235
const props = stringifyProps(node, tagObj, ctx);
114245114236
if (props.length > 0)
114246114237
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -114997,10 +114988,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
114997114988
(inFlow && /[[\]{},]/.test(value))) {
114998114989
return quotedString(value, ctx);
114999114990
}
115000-
if (!value ||
115001-
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
114991+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
115002114992
// not allowed:
115003-
// - empty string, '-' or '?'
114993+
// - '-' or '?'
115004114994
// - start with an indicator character (except [?:-]) or /[?-] /
115005114995
// - '\n ', ': ' or ' \n' anywhere
115006114996
// - '#' not preceded by a non-space char

0 commit comments

Comments
 (0)