Merge pull request #368 from actions/dependabot/npm_and_yarn/yaml-2.2.1

Bump yaml from 2.1.3 to 2.2.1
This commit is contained in:
Federico Builes
2023-01-02 05:36:29 -05:00
committed by GitHub
4 changed files with 73 additions and 41 deletions
Generated Vendored
+60 -28
View File
@@ -31465,13 +31465,13 @@ function findPair(items, key) {
return undefined; return undefined;
} }
class YAMLMap extends Collection.Collection { class YAMLMap extends Collection.Collection {
static get tagName() {
return 'tag:yaml.org,2002:map';
}
constructor(schema) { constructor(schema) {
super(Node.MAP, schema); super(Node.MAP, schema);
this.items = []; this.items = [];
} }
static get tagName() {
return 'tag:yaml.org,2002:map';
}
/** /**
* Adds a value to the collection. * Adds a value to the collection.
* *
@@ -31579,13 +31579,13 @@ var Scalar = __nccwpck_require__(9338);
var toJS = __nccwpck_require__(2463); var toJS = __nccwpck_require__(2463);
class YAMLSeq extends Collection.Collection { class YAMLSeq extends Collection.Collection {
static get tagName() {
return 'tag:yaml.org,2002:seq';
}
constructor(schema) { constructor(schema) {
super(Node.SEQ, schema); super(Node.SEQ, schema);
this.items = []; this.items = [];
} }
static get tagName() {
return 'tag:yaml.org,2002:seq';
}
add(value) { add(value) {
this.items.push(value); this.items.push(value);
} }
@@ -35577,6 +35577,7 @@ function createStringifyContext(doc, options) {
doubleQuotedAsJSON: false, doubleQuotedAsJSON: false,
doubleQuotedMinMultiLineLength: 40, doubleQuotedMinMultiLineLength: 40,
falseStr: 'false', falseStr: 'false',
flowCollectionPadding: true,
indentSeq: true, indentSeq: true,
lineWidth: 80, lineWidth: 80,
minContentWidth: 20, minContentWidth: 20,
@@ -35600,6 +35601,7 @@ function createStringifyContext(doc, options) {
return { return {
anchors: new Set(), anchors: new Set(),
doc, doc,
flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',
indent: '', indent: '',
indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ', indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',
inFlow, inFlow,
@@ -35757,7 +35759,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
return str; return str;
} }
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) { function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
const { indent, indentStep, options: { commentString } } = ctx; const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
itemIndent += indentStep; itemIndent += indentStep;
const itemCtx = Object.assign({}, ctx, { const itemCtx = Object.assign({}, ctx, {
indent: itemIndent, indent: itemIndent,
@@ -35826,7 +35828,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
str += `\n${indent}${end}`; str += `\n${indent}${end}`;
} }
else { else {
str = `${start} ${lines.join(' ')} ${end}`; str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
} }
} }
if (comment) { if (comment) {
@@ -36082,18 +36084,17 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
if (keyComment) if (keyComment)
str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment)); str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
} }
let vcb = ''; let vsb, vcb, valueComment;
let valueComment = null;
if (Node.isNode(value)) { if (Node.isNode(value)) {
if (value.spaceBefore) vsb = !!value.spaceBefore;
vcb = '\n'; vcb = value.commentBefore;
if (value.commentBefore) {
const cs = commentString(value.commentBefore);
vcb += `\n${stringifyComment.indentComment(cs, ctx.indent)}`;
}
valueComment = value.comment; valueComment = value.comment;
} }
else if (value && typeof value === 'object') { else {
vsb = false;
vcb = null;
valueComment = null;
if (value && typeof value === 'object')
value = doc.createNode(value); value = doc.createNode(value);
} }
ctx.implicitKey = false; ctx.implicitKey = false;
@@ -36109,24 +36110,50 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
!value.tag && !value.tag &&
!value.anchor) { !value.anchor) {
// If indentSeq === false, consider '- ' as part of indentation where possible // If indentSeq === false, consider '- ' as part of indentation where possible
ctx.indent = ctx.indent.substr(2); ctx.indent = ctx.indent.substring(2);
} }
let valueCommentDone = false; let valueCommentDone = false;
const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true)); const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
let ws = ' '; let ws = ' ';
if (vcb || keyComment) { if (keyComment || vsb || vcb) {
if (valueStr === '' && !ctx.inFlow) ws = vsb ? '\n' : '';
ws = vcb === '\n' ? '\n\n' : vcb; if (vcb) {
else const cs = commentString(vcb);
ws = `${vcb}\n${ctx.indent}`; ws += `\n${stringifyComment.indentComment(cs, ctx.indent)}`;
}
if (valueStr === '' && !ctx.inFlow) {
if (ws === '\n')
ws = '\n\n';
}
else {
ws += `\n${ctx.indent}`;
}
} }
else if (!explicitKey && Node.isCollection(value)) { else if (!explicitKey && Node.isCollection(value)) {
const flow = valueStr[0] === '[' || valueStr[0] === '{'; const vs0 = valueStr[0];
if (!flow || valueStr.includes('\n')) const nl0 = valueStr.indexOf('\n');
const hasNewline = nl0 !== -1;
const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;
if (hasNewline || !flow) {
let hasPropsLine = false;
if (hasNewline && (vs0 === '&' || vs0 === '!')) {
let sp0 = valueStr.indexOf(' ');
if (vs0 === '&' &&
sp0 !== -1 &&
sp0 < nl0 &&
valueStr[sp0 + 1] === '!') {
sp0 = valueStr.indexOf(' ', sp0 + 1);
}
if (sp0 === -1 || nl0 < sp0)
hasPropsLine = true;
}
if (!hasPropsLine)
ws = `\n${ctx.indent}`; ws = `\n${ctx.indent}`;
} }
else if (valueStr === '' || valueStr[0] === '\n') }
else if (valueStr === '' || valueStr[0] === '\n') {
ws = ''; ws = '';
}
str += ws + valueStr; str += ws + valueStr;
if (ctx.inFlow) { if (ctx.inFlow) {
if (valueCommentDone && onComment) if (valueCommentDone && onComment)
@@ -36384,7 +36411,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
} }
function plainString(item, ctx, onComment, onChompKeep) { function plainString(item, ctx, onComment, onChompKeep) {
const { type, value } = item; const { type, value } = item;
const { actualString, implicitKey, indent, inFlow } = ctx; const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
if ((implicitKey && /[\n[\]{},]/.test(value)) || if ((implicitKey && /[\n[\]{},]/.test(value)) ||
(inFlow && /[[\]{},]/.test(value))) { (inFlow && /[[\]{},]/.test(value))) {
return quotedString(value, ctx); return quotedString(value, ctx);
@@ -36408,10 +36435,15 @@ function plainString(item, ctx, onComment, onChompKeep) {
// Where allowed & type not set explicitly, prefer block style for multiline strings // Where allowed & type not set explicitly, prefer block style for multiline strings
return blockString(item, ctx, onComment, onChompKeep); return blockString(item, ctx, onComment, onChompKeep);
} }
if (indent === '' && containsDocumentMarker(value)) { if (containsDocumentMarker(value)) {
if (indent === '') {
ctx.forceBlockIndent = true; ctx.forceBlockIndent = true;
return blockString(item, ctx, onComment, onChompKeep); return blockString(item, ctx, onComment, onChompKeep);
} }
else if (implicitKey && indent === indentStep) {
return quotedString(value, ctx);
}
}
const str = value.replace(/\n+/g, `$&\n${indent}`); const str = value.replace(/\n+/g, `$&\n${indent}`);
// Verify that output will be parsed as a string, as e.g. plain numbers and // Verify that output will be parsed as a string, as e.g. plain numbers and
// 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'),
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -7
View File
@@ -19,7 +19,7 @@
"octokit": "^2.0.10", "octokit": "^2.0.10",
"spdx-expression-parse": "^3.0.1", "spdx-expression-parse": "^3.0.1",
"spdx-satisfies": "^5.0.1", "spdx-satisfies": "^5.0.1",
"yaml": "^2.1.3", "yaml": "^2.2.1",
"zod": "^3.20.2" "zod": "^3.20.2"
}, },
"devDependencies": { "devDependencies": {
@@ -8212,9 +8212,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}, },
"node_modules/yaml": { "node_modules/yaml": {
"version": "2.1.3", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.3.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz",
"integrity": "sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==", "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==",
"engines": { "engines": {
"node": ">= 14" "node": ">= 14"
} }
@@ -14314,9 +14314,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}, },
"yaml": { "yaml": {
"version": "2.1.3", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.3.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz",
"integrity": "sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==" "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw=="
}, },
"yargs": { "yargs": {
"version": "16.2.0", "version": "16.2.0",
+1 -1
View File
@@ -35,7 +35,7 @@
"octokit": "^2.0.10", "octokit": "^2.0.10",
"spdx-expression-parse": "^3.0.1", "spdx-expression-parse": "^3.0.1",
"spdx-satisfies": "^5.0.1", "spdx-satisfies": "^5.0.1",
"yaml": "^2.1.3", "yaml": "^2.2.1",
"zod": "^3.20.2" "zod": "^3.20.2"
}, },
"devDependencies": { "devDependencies": {