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:
38
node_modules/yaml/browser/dist/stringify/stringifyString.js
generated
vendored
38
node_modules/yaml/browser/dist/stringify/stringifyString.js
generated
vendored
@@ -1,8 +1,8 @@
|
||||
import { Scalar } from '../nodes/Scalar.js';
|
||||
import { foldFlowLines, FOLD_QUOTED, FOLD_FLOW, FOLD_BLOCK } from './foldFlowLines.js';
|
||||
|
||||
const getFoldOptions = (ctx) => ({
|
||||
indentAtStart: ctx.indentAtStart,
|
||||
const getFoldOptions = (ctx, isBlock) => ({
|
||||
indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
|
||||
lineWidth: ctx.options.lineWidth,
|
||||
minContentWidth: ctx.options.minContentWidth
|
||||
});
|
||||
@@ -115,7 +115,7 @@ function doubleQuotedString(value, ctx) {
|
||||
str = start ? str + json.slice(start) : json;
|
||||
return implicitKey
|
||||
? str
|
||||
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
|
||||
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx, false));
|
||||
}
|
||||
function singleQuotedString(value, ctx) {
|
||||
if (ctx.options.singleQuote === false ||
|
||||
@@ -127,7 +127,7 @@ function singleQuotedString(value, ctx) {
|
||||
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
|
||||
return ctx.implicitKey
|
||||
? res
|
||||
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
|
||||
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx, false));
|
||||
}
|
||||
function quotedString(value, ctx) {
|
||||
const { singleQuote } = ctx.options;
|
||||
@@ -146,6 +146,15 @@ function quotedString(value, ctx) {
|
||||
}
|
||||
return qs(value, ctx);
|
||||
}
|
||||
// The negative lookbehind avoids a polynomial search,
|
||||
// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind
|
||||
let blockEndNewlines;
|
||||
try {
|
||||
blockEndNewlines = new RegExp('(^|(?<!\n))\n+(?!\n|$)', 'g');
|
||||
}
|
||||
catch {
|
||||
blockEndNewlines = /\n+(?!\n|$)/g;
|
||||
}
|
||||
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
||||
const { blockQuote, commentString, lineWidth } = ctx.options;
|
||||
// 1. Block can't end in whitespace unless the last line is non-empty.
|
||||
@@ -189,7 +198,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
||||
value = value.slice(0, -end.length);
|
||||
if (end[end.length - 1] === '\n')
|
||||
end = end.slice(0, -1);
|
||||
end = end.replace(/\n+(?!\n|$)/g, `$&${indent}`);
|
||||
end = end.replace(blockEndNewlines, `$&${indent}`);
|
||||
}
|
||||
// determine indent indicator from whitespace at value start
|
||||
let startWithSpace = false;
|
||||
@@ -225,13 +234,13 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
||||
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
||||
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
||||
.replace(/\n+/g, `$&${indent}`);
|
||||
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx));
|
||||
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
|
||||
return `${header}\n${indent}${body}`;
|
||||
}
|
||||
function plainString(item, ctx, onComment, onChompKeep) {
|
||||
const { type, value } = item;
|
||||
const { actualString, implicitKey, indent, inFlow } = ctx;
|
||||
if ((implicitKey && /[\n[\]{},]/.test(value)) ||
|
||||
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
||||
if ((implicitKey && value.includes('\n')) ||
|
||||
(inFlow && /[[\]{},]/.test(value))) {
|
||||
return quotedString(value, ctx);
|
||||
}
|
||||
@@ -254,9 +263,14 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
||||
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
||||
return blockString(item, ctx, onComment, onChompKeep);
|
||||
}
|
||||
if (indent === '' && containsDocumentMarker(value)) {
|
||||
ctx.forceBlockIndent = true;
|
||||
return blockString(item, ctx, onComment, onChompKeep);
|
||||
if (containsDocumentMarker(value)) {
|
||||
if (indent === '') {
|
||||
ctx.forceBlockIndent = true;
|
||||
return blockString(item, ctx, onComment, onChompKeep);
|
||||
}
|
||||
else if (implicitKey && indent === indentStep) {
|
||||
return quotedString(value, ctx);
|
||||
}
|
||||
}
|
||||
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
||||
// Verify that output will be parsed as a string, as e.g. plain numbers and
|
||||
@@ -270,7 +284,7 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
||||
}
|
||||
return implicitKey
|
||||
? str
|
||||
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
|
||||
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx, false));
|
||||
}
|
||||
function stringifyString(item, ctx, onComment, onChompKeep) {
|
||||
const { implicitKey, inFlow } = ctx;
|
||||
|
||||
Reference in New Issue
Block a user