mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-12-09 22:30:41 -07:00
node_modules: upgrade
This commit is contained in:
83
node_modules/yaml/dist/stringify/stringifyPair.js
generated
vendored
83
node_modules/yaml/dist/stringify/stringifyPair.js
generated
vendored
@@ -1,18 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var Node = require('../nodes/Node.js');
|
||||
var identity = require('../nodes/identity.js');
|
||||
var Scalar = require('../nodes/Scalar.js');
|
||||
var stringify = require('./stringify.js');
|
||||
var stringifyComment = require('./stringifyComment.js');
|
||||
|
||||
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
||||
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
||||
let keyComment = (Node.isNode(key) && key.comment) || null;
|
||||
let keyComment = (identity.isNode(key) && key.comment) || null;
|
||||
if (simpleKeys) {
|
||||
if (keyComment) {
|
||||
throw new Error('With simple keys, key nodes cannot have comments');
|
||||
}
|
||||
if (Node.isCollection(key)) {
|
||||
if (identity.isCollection(key)) {
|
||||
const msg = 'With simple keys, collection cannot be used as a key value';
|
||||
throw new Error(msg);
|
||||
}
|
||||
@@ -20,8 +20,8 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
||||
let explicitKey = !simpleKeys &&
|
||||
(!key ||
|
||||
(keyComment && value == null && !ctx.inFlow) ||
|
||||
Node.isCollection(key) ||
|
||||
(Node.isScalar(key)
|
||||
identity.isCollection(key) ||
|
||||
(identity.isScalar(key)
|
||||
? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL
|
||||
: typeof key === 'object'));
|
||||
ctx = Object.assign({}, ctx, {
|
||||
@@ -65,51 +65,76 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
||||
if (keyComment)
|
||||
str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
|
||||
}
|
||||
let vcb = '';
|
||||
let valueComment = null;
|
||||
if (Node.isNode(value)) {
|
||||
if (value.spaceBefore)
|
||||
vcb = '\n';
|
||||
if (value.commentBefore) {
|
||||
const cs = commentString(value.commentBefore);
|
||||
vcb += `\n${stringifyComment.indentComment(cs, ctx.indent)}`;
|
||||
}
|
||||
let vsb, vcb, valueComment;
|
||||
if (identity.isNode(value)) {
|
||||
vsb = !!value.spaceBefore;
|
||||
vcb = value.commentBefore;
|
||||
valueComment = value.comment;
|
||||
}
|
||||
else if (value && typeof value === 'object') {
|
||||
value = doc.createNode(value);
|
||||
else {
|
||||
vsb = false;
|
||||
vcb = null;
|
||||
valueComment = null;
|
||||
if (value && typeof value === 'object')
|
||||
value = doc.createNode(value);
|
||||
}
|
||||
ctx.implicitKey = false;
|
||||
if (!explicitKey && !keyComment && Node.isScalar(value))
|
||||
if (!explicitKey && !keyComment && identity.isScalar(value))
|
||||
ctx.indentAtStart = str.length + 1;
|
||||
chompKeep = false;
|
||||
if (!indentSeq &&
|
||||
indentStep.length >= 2 &&
|
||||
!ctx.inFlow &&
|
||||
!explicitKey &&
|
||||
Node.isSeq(value) &&
|
||||
identity.isSeq(value) &&
|
||||
!value.flow &&
|
||||
!value.tag &&
|
||||
!value.anchor) {
|
||||
// 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;
|
||||
const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
|
||||
let ws = ' ';
|
||||
if (vcb || keyComment) {
|
||||
if (valueStr === '' && !ctx.inFlow)
|
||||
ws = vcb === '\n' ? '\n\n' : vcb;
|
||||
else
|
||||
ws = `${vcb}\n${ctx.indent}`;
|
||||
if (keyComment || vsb || vcb) {
|
||||
ws = vsb ? '\n' : '';
|
||||
if (vcb) {
|
||||
const cs = commentString(vcb);
|
||||
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)) {
|
||||
const flow = valueStr[0] === '[' || valueStr[0] === '{';
|
||||
if (!flow || valueStr.includes('\n'))
|
||||
ws = `\n${ctx.indent}`;
|
||||
else if (!explicitKey && identity.isCollection(value)) {
|
||||
const vs0 = valueStr[0];
|
||||
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}`;
|
||||
}
|
||||
}
|
||||
else if (valueStr === '' || valueStr[0] === '\n')
|
||||
else if (valueStr === '' || valueStr[0] === '\n') {
|
||||
ws = '';
|
||||
}
|
||||
str += ws + valueStr;
|
||||
if (ctx.inFlow) {
|
||||
if (valueCommentDone && onComment)
|
||||
|
||||
Reference in New Issue
Block a user