Skip to content

Commit 5b4b65f

Browse files
author
GitHub Actions
committed
chore: Update dist
1 parent 49bf8ea commit 5b4b65f

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
@@ -110627,14 +110627,6 @@ module.exports = require("net");
110627110627

110628110628
/***/ }),
110629110629

110630-
/***/ 4573:
110631-
/***/ ((module) => {
110632-
110633-
"use strict";
110634-
module.exports = require("node:buffer");
110635-
110636-
/***/ }),
110637-
110638110630
/***/ 77598:
110639110631
/***/ ((module) => {
110640110632

@@ -110651,14 +110643,6 @@ module.exports = require("node:events");
110651110643

110652110644
/***/ }),
110653110645

110654-
/***/ 1708:
110655-
/***/ ((module) => {
110656-
110657-
"use strict";
110658-
module.exports = require("node:process");
110659-
110660-
/***/ }),
110661-
110662110646
/***/ 57075:
110663110647
/***/ ((module) => {
110664110648

@@ -112786,7 +112770,7 @@ exports.composeScalar = composeScalar;
112786112770
"use strict";
112787112771

112788112772

112789-
var node_process = __nccwpck_require__(1708);
112773+
var node_process = __nccwpck_require__(932);
112790112774
var directives = __nccwpck_require__(61342);
112791112775
var Document = __nccwpck_require__(3021);
112792112776
var errors = __nccwpck_require__(91464);
@@ -113979,8 +113963,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
113979113963
if (token.source.endsWith(':'))
113980113964
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
113981113965
anchor = token;
113982-
if (start === null)
113983-
start = token.offset;
113966+
start ?? (start = token.offset);
113984113967
atNewline = false;
113985113968
hasSpace = false;
113986113969
reqSpace = true;
@@ -113989,8 +113972,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
113989113972
if (tag)
113990113973
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
113991113974
tag = token;
113992-
if (start === null)
113993-
start = token.offset;
113975+
start ?? (start = token.offset);
113994113976
atNewline = false;
113995113977
hasSpace = false;
113996113978
reqSpace = true;
@@ -114109,8 +114091,7 @@ exports.containsNewline = containsNewline;
114109114091

114110114092
function emptyScalarPosition(offset, before, pos) {
114111114093
if (before) {
114112-
if (pos === null)
114113-
pos = before.length;
114094+
pos ?? (pos = before.length);
114114114095
for (let i = pos - 1; i >= 0; --i) {
114115114096
let st = before[i];
114116114097
switch (st.type) {
@@ -114578,8 +114559,7 @@ function createNodeAnchors(doc, prefix) {
114578114559
return {
114579114560
onAnchor: (source) => {
114580114561
aliasObjects.push(source);
114581-
if (!prevAnchors)
114582-
prevAnchors = anchorNames(doc);
114562+
prevAnchors ?? (prevAnchors = anchorNames(doc));
114583114563
const anchor = findNewAnchor(prefix, prevAnchors);
114584114564
prevAnchors.add(anchor);
114585114565
return anchor;
@@ -114727,8 +114707,7 @@ function createNode(value, tagName, ctx) {
114727114707
if (aliasDuplicateObjects && value && typeof value === 'object') {
114728114708
ref = sourceObjects.get(value);
114729114709
if (ref) {
114730-
if (!ref.anchor)
114731-
ref.anchor = onAnchor(value);
114710+
ref.anchor ?? (ref.anchor = onAnchor(value));
114732114711
return new Alias.Alias(ref.anchor);
114733114712
}
114734114713
else {
@@ -115100,7 +115079,7 @@ exports.visitAsync = visit.visitAsync;
115100115079
"use strict";
115101115080

115102115081

115103-
var node_process = __nccwpck_require__(1708);
115082+
var node_process = __nccwpck_require__(932);
115104115083

115105115084
function debug(logLevel, ...messages) {
115106115085
if (logLevel === 'debug')
@@ -115147,23 +115126,36 @@ class Alias extends Node.NodeBase {
115147115126
* Resolve the value of this alias within `doc`, finding the last
115148115127
* instance of the `source` anchor before this node.
115149115128
*/
115150-
resolve(doc) {
115129+
resolve(doc, ctx) {
115130+
let nodes;
115131+
if (ctx?.aliasResolveCache) {
115132+
nodes = ctx.aliasResolveCache;
115133+
}
115134+
else {
115135+
nodes = [];
115136+
visit.visit(doc, {
115137+
Node: (_key, node) => {
115138+
if (identity.isAlias(node) || identity.hasAnchor(node))
115139+
nodes.push(node);
115140+
}
115141+
});
115142+
if (ctx)
115143+
ctx.aliasResolveCache = nodes;
115144+
}
115151115145
let found = undefined;
115152-
visit.visit(doc, {
115153-
Node: (_key, node) => {
115154-
if (node === this)
115155-
return visit.visit.BREAK;
115156-
if (node.anchor === this.source)
115157-
found = node;
115158-
}
115159-
});
115146+
for (const node of nodes) {
115147+
if (node === this)
115148+
break;
115149+
if (node.anchor === this.source)
115150+
found = node;
115151+
}
115160115152
return found;
115161115153
}
115162115154
toJSON(_arg, ctx) {
115163115155
if (!ctx)
115164115156
return { source: this.source };
115165115157
const { anchors, doc, maxAliasCount } = ctx;
115166-
const source = this.resolve(doc);
115158+
const source = this.resolve(doc, ctx);
115167115159
if (!source) {
115168115160
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
115169115161
throw new ReferenceError(msg);
@@ -115844,6 +115836,7 @@ function addPairToJSMap(ctx, map, { key, value }) {
115844115836
function stringifyKey(key, jsKey, ctx) {
115845115837
if (jsKey === null)
115846115838
return '';
115839+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
115847115840
if (typeof jsKey !== 'object')
115848115841
return String(jsKey);
115849115842
if (identity.isNode(key) && ctx?.doc) {
@@ -117285,7 +117278,7 @@ exports.LineCounter = LineCounter;
117285117278
"use strict";
117286117279

117287117280

117288-
var node_process = __nccwpck_require__(1708);
117281+
var node_process = __nccwpck_require__(932);
117289117282
var cst = __nccwpck_require__(3461);
117290117283
var lexer = __nccwpck_require__(40361);
117291117284

@@ -118876,7 +118869,7 @@ exports.getTags = getTags;
118876118869
"use strict";
118877118870

118878118871

118879-
var node_buffer = __nccwpck_require__(4573);
118872+
var node_buffer = __nccwpck_require__(20181);
118880118873
var Scalar = __nccwpck_require__(63301);
118881118874
var stringifyString = __nccwpck_require__(83069);
118882118875

@@ -118929,8 +118922,7 @@ const binary = {
118929118922
else {
118930118923
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
118931118924
}
118932-
if (!type)
118933-
type = Scalar.Scalar.BLOCK_LITERAL;
118925+
type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
118934118926
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
118935118927
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
118936118928
const n = Math.ceil(str.length / lineWidth);
@@ -119880,7 +119872,7 @@ function getTagObject(tags, item) {
119880119872
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
119881119873
}
119882119874
if (!tagObj) {
119883-
const name = obj?.constructor?.name ?? typeof obj;
119875+
const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
119884119876
throw new Error(`Tag not resolved for ${name} value`);
119885119877
}
119886119878
return tagObj;
@@ -119895,7 +119887,7 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
119895119887
anchors$1.add(anchor);
119896119888
props.push(`&${anchor}`);
119897119889
}
119898-
const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
119890+
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
119899119891
if (tag)
119900119892
props.push(doc.directives.tagString(tag));
119901119893
return props.join(' ');
@@ -119921,8 +119913,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
119921119913
const node = identity.isNode(item)
119922119914
? item
119923119915
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
119924-
if (!tagObj)
119925-
tagObj = getTagObject(ctx.doc.schema.tags, node);
119916+
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
119926119917
const props = stringifyProps(node, tagObj, ctx);
119927119918
if (props.length > 0)
119928119919
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -120679,10 +120670,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
120679120670
(inFlow && /[[\]{},]/.test(value))) {
120680120671
return quotedString(value, ctx);
120681120672
}
120682-
if (!value ||
120683-
/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
120673+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
120684120674
// not allowed:
120685-
// - empty string, '-' or '?'
120675+
// - '-' or '?'
120686120676
// - start with an indicator character (except [?:-]) or /[?-] /
120687120677
// - '\n ', ': ' or ' \n' anywhere
120688120678
// - '#' not preceded by a non-space char

0 commit comments

Comments
 (0)