summaryrefslogtreecommitdiff
path: root/node_modules/yaml/browser/dist
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/yaml/browser/dist')
-rw-r--r--node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js26
-rw-r--r--node_modules/yaml/browser/dist/parse/parser.js5
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js2
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js2
-rw-r--r--node_modules/yaml/browser/dist/stringify/foldFlowLines.js29
-rw-r--r--node_modules/yaml/browser/dist/stringify/stringifyCollection.js20
6 files changed, 44 insertions, 40 deletions
diff --git a/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js b/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js
index 501cf396..ebb9fd42 100644
--- a/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js
+++ b/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js
@@ -189,19 +189,19 @@ function foldNewline(source, offset) {
return { fold, offset };
}
const escapeCodes = {
- '0': '\0',
- a: '\x07',
- b: '\b',
- e: '\x1b',
- f: '\f',
- n: '\n',
- r: '\r',
- t: '\t',
- v: '\v',
- N: '\u0085',
- _: '\u00a0',
- L: '\u2028',
- P: '\u2029',
+ '0': '\0', // null character
+ a: '\x07', // bell character
+ b: '\b', // backspace
+ e: '\x1b', // escape character
+ f: '\f', // form feed
+ n: '\n', // line feed
+ r: '\r', // carriage return
+ t: '\t', // horizontal tab
+ v: '\v', // vertical tab
+ N: '\u0085', // Unicode next line
+ _: '\u00a0', // Unicode non-breaking space
+ L: '\u2028', // Unicode line separator
+ P: '\u2029', // Unicode paragraph separator
' ': ' ',
'"': '"',
'/': '/',
diff --git a/node_modules/yaml/browser/dist/parse/parser.js b/node_modules/yaml/browser/dist/parse/parser.js
index d75e1ee4..65da03d6 100644
--- a/node_modules/yaml/browser/dist/parse/parser.js
+++ b/node_modules/yaml/browser/dist/parse/parser.js
@@ -513,7 +513,10 @@ class Parser {
return;
}
if (this.indent >= map.indent) {
- const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
+ const atNextItem = !this.onKeyLine &&
+ this.indent === map.indent &&
+ it.sep &&
+ this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node
let start = [];
if (atNextItem && it.sep && !it.value) {
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
index a7008193..8021a527 100644
--- a/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
@@ -2,7 +2,7 @@ import { Scalar } from '../../nodes/Scalar.js';
import { stringifyString } from '../../stringify/stringifyString.js';
const binary = {
- identify: value => value instanceof Uint8Array,
+ identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array
default: false,
tag: 'tag:yaml.org,2002:binary',
/**
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
index 1ced7919..999b59d4 100644
--- a/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
@@ -18,7 +18,7 @@ const falseTag = {
identify: value => value === false,
default: true,
tag: 'tag:yaml.org,2002:bool',
- test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
+ test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
resolve: () => new Scalar(false),
stringify: boolStringify
};
diff --git a/node_modules/yaml/browser/dist/stringify/foldFlowLines.js b/node_modules/yaml/browser/dist/stringify/foldFlowLines.js
index 01fe7876..2a554266 100644
--- a/node_modules/yaml/browser/dist/stringify/foldFlowLines.js
+++ b/node_modules/yaml/browser/dist/stringify/foldFlowLines.js
@@ -28,7 +28,7 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth =
let escStart = -1;
let escEnd = -1;
if (mode === FOLD_BLOCK) {
- i = consumeMoreIndentedLines(text, i);
+ i = consumeMoreIndentedLines(text, i, indent.length);
if (i !== -1)
end = i + endStep;
}
@@ -52,8 +52,8 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth =
}
if (ch === '\n') {
if (mode === FOLD_BLOCK)
- i = consumeMoreIndentedLines(text, i);
- end = i + endStep;
+ i = consumeMoreIndentedLines(text, i, indent.length);
+ end = i + indent.length + endStep;
split = undefined;
}
else {
@@ -121,15 +121,24 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth =
* Presumes `i + 1` is at the start of a line
* @returns index of last newline in more-indented block
*/
-function consumeMoreIndentedLines(text, i) {
- let ch = text[i + 1];
+function consumeMoreIndentedLines(text, i, indent) {
+ let end = i;
+ let start = i + 1;
+ let ch = text[start];
while (ch === ' ' || ch === '\t') {
- do {
- ch = text[(i += 1)];
- } while (ch && ch !== '\n');
- ch = text[i + 1];
+ if (i < start + indent) {
+ ch = text[++i];
+ }
+ else {
+ do {
+ ch = text[++i];
+ } while (ch && ch !== '\n');
+ end = i;
+ start = i + 1;
+ ch = text[start];
+ }
}
- return i;
+ return end;
}
export { FOLD_BLOCK, FOLD_FLOW, FOLD_QUOTED, foldFlowLines };
diff --git a/node_modules/yaml/browser/dist/stringify/stringifyCollection.js b/node_modules/yaml/browser/dist/stringify/stringifyCollection.js
index 4817a9d5..9019400f 100644
--- a/node_modules/yaml/browser/dist/stringify/stringifyCollection.js
+++ b/node_modules/yaml/browser/dist/stringify/stringifyCollection.js
@@ -1,4 +1,3 @@
-import { Collection } from '../nodes/Collection.js';
import { isNode, isPair } from '../nodes/identity.js';
import { stringify } from './stringify.js';
import { lineComment, indentComment } from './stringifyComment.js';
@@ -59,7 +58,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
onChompKeep();
return str;
}
-function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
+function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
itemIndent += indentStep;
const itemCtx = Object.assign({}, ctx, {
@@ -112,32 +111,25 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
lines.push(str);
linesAtValue = lines.length;
}
- let str;
const { start, end } = flowChars;
if (lines.length === 0) {
- str = start + end;
+ return start + end;
}
else {
if (!reqNewline) {
const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
- reqNewline = len > Collection.maxFlowStringSingleLineLength;
+ reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
}
if (reqNewline) {
- str = start;
+ let str = start;
for (const line of lines)
str += line ? `\n${indentStep}${indent}${line}` : '\n';
- str += `\n${indent}${end}`;
+ return `${str}\n${indent}${end}`;
}
else {
- str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
+ return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
}
}
- if (comment) {
- str += lineComment(str, indent, commentString(comment));
- if (onComment)
- onComment();
- }
- return str;
}
function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
if (comment && chompKeep)