node_modules: update (#150)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-09-29 16:54:46 +02:00
1 parent e7732aaa6f
commit d4178273f4
15 files changed
+566 -292

No files matched your search

+26 -25
View File
@@ -64,46 +64,47 @@ function plainValue(source, onError) {
}
if (badChar)
onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);
return foldLines(source);
return unfoldLines(source);
}
function singleQuotedValue(source, onError) {
if (source[source.length - 1] !== "'" || source.length === 1)
onError(source.length, 'MISSING_CHAR', "Missing closing 'quote");
return foldLines(source.slice(1, -1)).replace(/''/g, "'");
return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
}
function foldLines(source) {
/**
* The negative lookbehind here and in the `re` RegExp is to
* prevent causing a polynomial search time in certain cases.
*
* The try-catch is for Safari, which doesn't support this yet:
* https://caniuse.com/js-regexp-lookbehind
*/
let first, line;
try {
first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy');
line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy');
}
catch {
first = /(.*?)[ \t]*\r?\n/sy;
line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
}
let match = first.exec(source);
function unfoldLines(source) {
const line = /(.*?)\r?\n/sy;
let match = line.exec(source);
if (!match)
return source;
let res = match[1];
/**
* The negative lookbehinds in these RegExps are to
* prevent causing a polynomial search time in certain cases.
*
* The try-catch is for Safari < 16.4 and other old browsers:
* https://caniuse.com/js-regexp-lookbehind
*/
let trimEnd, trimBoth;
try {
trimEnd = new RegExp('(?<![ \t])[ \t]+$');
trimBoth = new RegExp('^[ \t]+|(?<![ \t])[ \t]+$', 'g');
}
catch {
trimEnd = /[ \t]+$/;
trimBoth = /^[ \t]+|[ \t]+$/g;
}
let res = match[1].replace(trimEnd, '');
let sep = ' ';
let pos = first.lastIndex;
line.lastIndex = pos;
let pos = line.lastIndex;
while ((match = line.exec(source))) {
if (match[1] === '') {
const lm = match[1].replace(trimBoth, '');
if (lm === '') {
if (sep === '\n')
res += sep;
else
sep = '\n';
}
else {
res += sep + match[1];
res += sep + lm;
sep = ' ';
}
pos = line.lastIndex;
+25 -23
View File
@@ -43,38 +43,40 @@ class Alias extends NodeBase {
if (node.anchor === this.source)
found = node;
}
if (found && ctx) {
const { anchors, doc, maxAliasCount } = ctx;
let data = anchors.get(found);
if (!data) {
// Resolve anchors for Node.prototype.toJS()
toJS(found, null, ctx);
data = anchors.get(found);
}
/* istanbul ignore if */
if (data?.res === undefined) {
const msg = 'This should not happen: Alias anchor was not resolved?';
throw new ReferenceError(msg);
}
if (maxAliasCount >= 0) {
data.count += 1;
if (data.aliasCount === 0)
data.aliasCount = getAliasCount(doc, found, anchors);
if (data.count * data.aliasCount > maxAliasCount) {
const msg = 'Excessive alias count indicates a resource exhaustion attack';
throw new ReferenceError(msg);
}
}
}
return found;
}
toJSON(_arg, ctx) {
if (!ctx)
return { source: this.source };
const { anchors, doc, maxAliasCount } = ctx;
const source = this.resolve(doc, ctx);
const source = this.resolve(ctx.doc, ctx);
if (!source) {
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
throw new ReferenceError(msg);
}
let data = anchors.get(source);
if (!data) {
// Resolve anchors for Node.prototype.toJS()
toJS(source, null, ctx);
data = anchors.get(source);
}
/* istanbul ignore if */
if (data?.res === undefined) {
const msg = 'This should not happen: Alias anchor was not resolved?';
throw new ReferenceError(msg);
}
if (maxAliasCount >= 0) {
data.count += 1;
if (data.aliasCount === 0)
data.aliasCount = getAliasCount(doc, source, anchors);
if (data.count * data.aliasCount > maxAliasCount) {
const msg = 'Excessive alias count indicates a resource exhaustion attack';
throw new ReferenceError(msg);
}
}
return data.res;
return ctx.anchors.get(source).res;
}
toString(ctx, _onComment, _onChompKeep) {
const src = `*${this.source}`;
+26 -25
View File
@@ -66,46 +66,47 @@ function plainValue(source, onError) {
}
if (badChar)
onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);
return foldLines(source);
return unfoldLines(source);
}
function singleQuotedValue(source, onError) {
if (source[source.length - 1] !== "'" || source.length === 1)
onError(source.length, 'MISSING_CHAR', "Missing closing 'quote");
return foldLines(source.slice(1, -1)).replace(/''/g, "'");
return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
}
function foldLines(source) {
/**
* The negative lookbehind here and in the `re` RegExp is to
* prevent causing a polynomial search time in certain cases.
*
* The try-catch is for Safari, which doesn't support this yet:
* https://caniuse.com/js-regexp-lookbehind
*/
let first, line;
try {
first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy');
line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy');
}
catch {
first = /(.*?)[ \t]*\r?\n/sy;
line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
}
let match = first.exec(source);
function unfoldLines(source) {
const line = /(.*?)\r?\n/sy;
let match = line.exec(source);
if (!match)
return source;
let res = match[1];
/**
* The negative lookbehinds in these RegExps are to
* prevent causing a polynomial search time in certain cases.
*
* The try-catch is for Safari < 16.4 and other old browsers:
* https://caniuse.com/js-regexp-lookbehind
*/
let trimEnd, trimBoth;
try {
trimEnd = new RegExp('(?<![ \t])[ \t]+$');
trimBoth = new RegExp('^[ \t]+|(?<![ \t])[ \t]+$', 'g');
}
catch {
trimEnd = /[ \t]+$/;
trimBoth = /^[ \t]+|[ \t]+$/g;
}
let res = match[1].replace(trimEnd, '');
let sep = ' ';
let pos = first.lastIndex;
line.lastIndex = pos;
let pos = line.lastIndex;
while ((match = line.exec(source))) {
if (match[1] === '') {
const lm = match[1].replace(trimBoth, '');
if (lm === '') {
if (sep === '\n')
res += sep;
else
sep = '\n';
}
else {
res += sep + match[1];
res += sep + lm;
sep = ' ';
}
pos = line.lastIndex;
+25 -23
View File
@@ -45,38 +45,40 @@ class Alias extends Node.NodeBase {
if (node.anchor === this.source)
found = node;
}
if (found && ctx) {
const { anchors, doc, maxAliasCount } = ctx;
let data = anchors.get(found);
if (!data) {
// Resolve anchors for Node.prototype.toJS()
toJS.toJS(found, null, ctx);
data = anchors.get(found);
}
/* istanbul ignore if */
if (data?.res === undefined) {
const msg = 'This should not happen: Alias anchor was not resolved?';
throw new ReferenceError(msg);
}
if (maxAliasCount >= 0) {
data.count += 1;
if (data.aliasCount === 0)
data.aliasCount = getAliasCount(doc, found, anchors);
if (data.count * data.aliasCount > maxAliasCount) {
const msg = 'Excessive alias count indicates a resource exhaustion attack';
throw new ReferenceError(msg);
}
}
}
return found;
}
toJSON(_arg, ctx) {
if (!ctx)
return { source: this.source };
const { anchors, doc, maxAliasCount } = ctx;
const source = this.resolve(doc, ctx);
const source = this.resolve(ctx.doc, ctx);
if (!source) {
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
throw new ReferenceError(msg);
}
let data = anchors.get(source);
if (!data) {
// Resolve anchors for Node.prototype.toJS()
toJS.toJS(source, null, ctx);
data = anchors.get(source);
}
/* istanbul ignore if */
if (data?.res === undefined) {
const msg = 'This should not happen: Alias anchor was not resolved?';
throw new ReferenceError(msg);
}
if (maxAliasCount >= 0) {
data.count += 1;
if (data.aliasCount === 0)
data.aliasCount = getAliasCount(doc, source, anchors);
if (data.count * data.aliasCount > maxAliasCount) {
const msg = 'Excessive alias count indicates a resource exhaustion attack';
throw new ReferenceError(msg);
}
}
return data.res;
return ctx.anchors.get(source).res;
}
toString(ctx, _onComment, _onChompKeep) {
const src = `*${this.source}`;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "yaml",
"version": "2.9.0",
"version": "2.9.1",
"license": "ISC",
"author": "Eemeli Aro <eemeli@gmail.com>",
"funding": "https://github.com/sponsors/eemeli",