Galerie und tage
This commit is contained in:
290
node_modules/js-yaml/dist/js-yaml.js
generated
vendored
290
node_modules/js-yaml/dist/js-yaml.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
/*! js-yaml 3.14.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
/* js-yaml 3.6.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
var CHAR_TAB = 0x09; /* Tab */
|
||||
var CHAR_LINE_FEED = 0x0A; /* LF */
|
||||
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
|
||||
var CHAR_SPACE = 0x20; /* Space */
|
||||
var CHAR_EXCLAMATION = 0x21; /* ! */
|
||||
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
|
||||
@@ -127,7 +126,6 @@ var CHAR_ASTERISK = 0x2A; /* * */
|
||||
var CHAR_COMMA = 0x2C; /* , */
|
||||
var CHAR_MINUS = 0x2D; /* - */
|
||||
var CHAR_COLON = 0x3A; /* : */
|
||||
var CHAR_EQUALS = 0x3D; /* = */
|
||||
var CHAR_GREATER_THAN = 0x3E; /* > */
|
||||
var CHAR_QUESTION = 0x3F; /* ? */
|
||||
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
|
||||
@@ -176,7 +174,8 @@ function compileStyleMap(schema, map) {
|
||||
if (tag.slice(0, 2) === '!!') {
|
||||
tag = 'tag:yaml.org,2002:' + tag.slice(2);
|
||||
}
|
||||
type = schema.compiledTypeMap['fallback'][tag];
|
||||
|
||||
type = schema.compiledTypeMap[tag];
|
||||
|
||||
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
||||
style = type.styleAliases[style];
|
||||
@@ -210,17 +209,15 @@ function encodeHex(character) {
|
||||
}
|
||||
|
||||
function State(options) {
|
||||
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
|
||||
this.indent = Math.max(1, (options['indent'] || 2));
|
||||
this.noArrayIndent = options['noArrayIndent'] || false;
|
||||
this.skipInvalid = options['skipInvalid'] || false;
|
||||
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
||||
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
||||
this.sortKeys = options['sortKeys'] || false;
|
||||
this.lineWidth = options['lineWidth'] || 80;
|
||||
this.noRefs = options['noRefs'] || false;
|
||||
this.noCompatMode = options['noCompatMode'] || false;
|
||||
this.condenseFlow = options['condenseFlow'] || false;
|
||||
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
|
||||
this.indent = Math.max(1, (options['indent'] || 2));
|
||||
this.skipInvalid = options['skipInvalid'] || false;
|
||||
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
||||
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
||||
this.sortKeys = options['sortKeys'] || false;
|
||||
this.lineWidth = options['lineWidth'] || 80;
|
||||
this.noRefs = options['noRefs'] || false;
|
||||
this.noCompatMode = options['noCompatMode'] || false;
|
||||
|
||||
this.implicitTypes = this.schema.compiledImplicit;
|
||||
this.explicitTypes = this.schema.compiledExplicit;
|
||||
@@ -293,23 +290,8 @@ function isPrintable(c) {
|
||||
|| (0x10000 <= c && c <= 0x10FFFF);
|
||||
}
|
||||
|
||||
// [34] ns-char ::= nb-char - s-white
|
||||
// [27] nb-char ::= c-printable - b-char - c-byte-order-mark
|
||||
// [26] b-char ::= b-line-feed | b-carriage-return
|
||||
// [24] b-line-feed ::= #xA /* LF */
|
||||
// [25] b-carriage-return ::= #xD /* CR */
|
||||
// [3] c-byte-order-mark ::= #xFEFF
|
||||
function isNsChar(c) {
|
||||
return isPrintable(c) && !isWhitespace(c)
|
||||
// byte-order-mark
|
||||
&& c !== 0xFEFF
|
||||
// b-char
|
||||
&& c !== CHAR_CARRIAGE_RETURN
|
||||
&& c !== CHAR_LINE_FEED;
|
||||
}
|
||||
|
||||
// Simplified test for values allowed after the first character in plain style.
|
||||
function isPlainSafe(c, prev) {
|
||||
function isPlainSafe(c) {
|
||||
// Uses a subset of nb-char - c-flow-indicator - ":" - "#"
|
||||
// where nb-char ::= c-printable - b-char - c-byte-order-mark.
|
||||
return isPrintable(c) && c !== 0xFEFF
|
||||
@@ -320,9 +302,8 @@ function isPlainSafe(c, prev) {
|
||||
&& c !== CHAR_LEFT_CURLY_BRACKET
|
||||
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
||||
// - ":" - "#"
|
||||
// /* An ns-char preceding */ "#"
|
||||
&& c !== CHAR_COLON
|
||||
&& ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
|
||||
&& c !== CHAR_SHARP;
|
||||
}
|
||||
|
||||
// Simplified test for values allowed as the first character in plain style.
|
||||
@@ -341,13 +322,12 @@ function isPlainSafeFirst(c) {
|
||||
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
||||
&& c !== CHAR_LEFT_CURLY_BRACKET
|
||||
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
||||
// | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
|
||||
// | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
|
||||
&& c !== CHAR_SHARP
|
||||
&& c !== CHAR_AMPERSAND
|
||||
&& c !== CHAR_ASTERISK
|
||||
&& c !== CHAR_EXCLAMATION
|
||||
&& c !== CHAR_VERTICAL_LINE
|
||||
&& c !== CHAR_EQUALS
|
||||
&& c !== CHAR_GREATER_THAN
|
||||
&& c !== CHAR_SINGLE_QUOTE
|
||||
&& c !== CHAR_DOUBLE_QUOTE
|
||||
@@ -357,12 +337,6 @@ function isPlainSafeFirst(c) {
|
||||
&& c !== CHAR_GRAVE_ACCENT;
|
||||
}
|
||||
|
||||
// Determines whether block indentation indicator is required.
|
||||
function needIndentIndicator(string) {
|
||||
var leadingSpaceRe = /^\n* /;
|
||||
return leadingSpaceRe.test(string);
|
||||
}
|
||||
|
||||
var STYLE_PLAIN = 1,
|
||||
STYLE_SINGLE = 2,
|
||||
STYLE_LITERAL = 3,
|
||||
@@ -378,7 +352,7 @@ var STYLE_PLAIN = 1,
|
||||
// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
|
||||
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
||||
var i;
|
||||
var char, prev_char;
|
||||
var char;
|
||||
var hasLineBreak = false;
|
||||
var hasFoldableLine = false; // only checked if shouldTrackWidth
|
||||
var shouldTrackWidth = lineWidth !== -1;
|
||||
@@ -394,8 +368,7 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
||||
if (!isPrintable(char)) {
|
||||
return STYLE_DOUBLE;
|
||||
}
|
||||
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
||||
plain = plain && isPlainSafe(char, prev_char);
|
||||
plain = plain && isPlainSafe(char);
|
||||
}
|
||||
} else {
|
||||
// Case: block styles permitted.
|
||||
@@ -414,8 +387,7 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
||||
} else if (!isPrintable(char)) {
|
||||
return STYLE_DOUBLE;
|
||||
}
|
||||
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
||||
plain = plain && isPlainSafe(char, prev_char);
|
||||
plain = plain && isPlainSafe(char);
|
||||
}
|
||||
// in case the end is missing a \n
|
||||
hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
|
||||
@@ -432,7 +404,7 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
||||
? STYLE_PLAIN : STYLE_SINGLE;
|
||||
}
|
||||
// Edge case: block indentation indicator can only have one digit.
|
||||
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
||||
if (string[0] === ' ' && indentPerLevel > 9) {
|
||||
return STYLE_DOUBLE;
|
||||
}
|
||||
// At this point we know block styles are valid.
|
||||
@@ -496,7 +468,7 @@ function writeScalar(state, string, level, iskey) {
|
||||
|
||||
// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
|
||||
function blockHeader(string, indentPerLevel) {
|
||||
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
|
||||
var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : '';
|
||||
|
||||
// note the special case: the string '\n' counts as a "trailing" empty line.
|
||||
var clip = string[string.length - 1] === '\n';
|
||||
@@ -592,21 +564,11 @@ function foldLine(line, width) {
|
||||
// Escapes a double-quoted string.
|
||||
function escapeString(string) {
|
||||
var result = '';
|
||||
var char, nextChar;
|
||||
var char;
|
||||
var escapeSeq;
|
||||
|
||||
for (var i = 0; i < string.length; i++) {
|
||||
char = string.charCodeAt(i);
|
||||
// Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
|
||||
if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
|
||||
nextChar = string.charCodeAt(i + 1);
|
||||
if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
|
||||
// Combine the surrogate pair and store it escaped.
|
||||
result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
|
||||
// Advance index one extra since we already used that char here.
|
||||
i++; continue;
|
||||
}
|
||||
}
|
||||
escapeSeq = ESCAPE_SEQUENCES[char];
|
||||
result += !escapeSeq && isPrintable(char)
|
||||
? string[i]
|
||||
@@ -625,7 +587,7 @@ function writeFlowSequence(state, level, object) {
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
// Write only valid elements.
|
||||
if (writeNode(state, level, object[index], false, false)) {
|
||||
if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
|
||||
if (index !== 0) _result += ', ';
|
||||
_result += state.dump;
|
||||
}
|
||||
}
|
||||
@@ -646,14 +608,7 @@ function writeBlockSequence(state, level, object, compact) {
|
||||
if (!compact || index !== 0) {
|
||||
_result += generateNextLine(state, level);
|
||||
}
|
||||
|
||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||||
_result += '-';
|
||||
} else {
|
||||
_result += '- ';
|
||||
}
|
||||
|
||||
_result += state.dump;
|
||||
_result += '- ' + state.dump;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,11 +627,9 @@ function writeFlowMapping(state, level, object) {
|
||||
pairBuffer;
|
||||
|
||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||||
|
||||
pairBuffer = '';
|
||||
if (index !== 0) pairBuffer += ', ';
|
||||
|
||||
if (state.condenseFlow) pairBuffer += '"';
|
||||
if (index !== 0) pairBuffer += ', ';
|
||||
|
||||
objectKey = objectKeyList[index];
|
||||
objectValue = object[objectKey];
|
||||
@@ -687,7 +640,7 @@ function writeFlowMapping(state, level, object) {
|
||||
|
||||
if (state.dump.length > 1024) pairBuffer += '? ';
|
||||
|
||||
pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
|
||||
pairBuffer += state.dump + ': ';
|
||||
|
||||
if (!writeNode(state, level, objectValue, false, false)) {
|
||||
continue; // Skip this pair because of invalid value.
|
||||
@@ -861,14 +814,13 @@ function writeNode(state, level, object, block, compact, iskey) {
|
||||
}
|
||||
}
|
||||
} else if (type === '[object Array]') {
|
||||
var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
|
||||
if (block && (state.dump.length !== 0)) {
|
||||
writeBlockSequence(state, arrayLevel, state.dump, compact);
|
||||
writeBlockSequence(state, level, state.dump, compact);
|
||||
if (duplicate) {
|
||||
state.dump = '&ref_' + duplicateIndex + state.dump;
|
||||
}
|
||||
} else {
|
||||
writeFlowSequence(state, arrayLevel, state.dump);
|
||||
writeFlowSequence(state, level, state.dump);
|
||||
if (duplicate) {
|
||||
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
||||
}
|
||||
@@ -961,11 +913,6 @@ function YAMLException(reason, mark) {
|
||||
// Super constructor
|
||||
Error.call(this);
|
||||
|
||||
this.name = 'YAMLException';
|
||||
this.reason = reason;
|
||||
this.mark = mark;
|
||||
this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
|
||||
|
||||
// Include stack trace in error object
|
||||
if (Error.captureStackTrace) {
|
||||
// Chrome and NodeJS
|
||||
@@ -974,6 +921,11 @@ function YAMLException(reason, mark) {
|
||||
// FF, IE 10+ and Safari 6+. Fallback for others
|
||||
this.stack = (new Error()).stack || '';
|
||||
}
|
||||
|
||||
this.name = 'YAMLException';
|
||||
this.reason = reason;
|
||||
this.mark = mark;
|
||||
this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
|
||||
}
|
||||
|
||||
|
||||
@@ -1030,8 +982,6 @@ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
||||
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
||||
|
||||
|
||||
function _class(obj) { return Object.prototype.toString.call(obj); }
|
||||
|
||||
function is_EOL(c) {
|
||||
return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
|
||||
}
|
||||
@@ -1088,7 +1038,6 @@ function fromDecimalCode(c) {
|
||||
}
|
||||
|
||||
function simpleEscapeSequence(c) {
|
||||
/* eslint-disable indent */
|
||||
return (c === 0x30/* 0 */) ? '\x00' :
|
||||
(c === 0x61/* a */) ? '\x07' :
|
||||
(c === 0x62/* b */) ? '\x08' :
|
||||
@@ -1115,10 +1064,8 @@ function charFromCodepoint(c) {
|
||||
}
|
||||
// Encode UTF-16 surrogate pair
|
||||
// https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
|
||||
return String.fromCharCode(
|
||||
((c - 0x010000) >> 10) + 0xD800,
|
||||
((c - 0x010000) & 0x03FF) + 0xDC00
|
||||
);
|
||||
return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
|
||||
((c - 0x010000) & 0x03FF) + 0xDC00);
|
||||
}
|
||||
|
||||
var simpleEscapeCheck = new Array(256); // integer, for fast access
|
||||
@@ -1250,7 +1197,9 @@ function captureSegment(state, start, end, checkJson) {
|
||||
_result = state.input.slice(start, end);
|
||||
|
||||
if (checkJson) {
|
||||
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
||||
for (_position = 0, _length = _result.length;
|
||||
_position < _length;
|
||||
_position += 1) {
|
||||
_character = _result.charCodeAt(_position);
|
||||
if (!(_character === 0x09 ||
|
||||
(0x20 <= _character && _character <= 0x10FFFF))) {
|
||||
@@ -1284,34 +1233,9 @@ function mergeMappings(state, destination, source, overridableKeys) {
|
||||
}
|
||||
}
|
||||
|
||||
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
||||
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) {
|
||||
var index, quantity;
|
||||
|
||||
// The output is a plain object here, so keys can only be strings.
|
||||
// We need to convert keyNode to a string, but doing so can hang the process
|
||||
// (deeply nested arrays that explode exponentially using aliases).
|
||||
if (Array.isArray(keyNode)) {
|
||||
keyNode = Array.prototype.slice.call(keyNode);
|
||||
|
||||
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
||||
if (Array.isArray(keyNode[index])) {
|
||||
throwError(state, 'nested arrays are not supported inside keys');
|
||||
}
|
||||
|
||||
if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
|
||||
keyNode[index] = '[object Object]';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid code execution in load() via toString property
|
||||
// (still use its own toString for arrays, timestamps,
|
||||
// and whatever user schema extensions happen to have @@toStringTag)
|
||||
if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
|
||||
keyNode = '[object Object]';
|
||||
}
|
||||
|
||||
|
||||
keyNode = String(keyNode);
|
||||
|
||||
if (_result === null) {
|
||||
@@ -1330,8 +1254,6 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
||||
if (!state.json &&
|
||||
!_hasOwnProperty.call(overridableKeys, keyNode) &&
|
||||
_hasOwnProperty.call(_result, keyNode)) {
|
||||
state.line = startLine || state.line;
|
||||
state.position = startPos || state.position;
|
||||
throwError(state, 'duplicated mapping key');
|
||||
}
|
||||
_result[keyNode] = valueNode;
|
||||
@@ -1562,9 +1484,8 @@ function readSingleQuotedScalar(state, nodeIndent) {
|
||||
ch = state.input.charCodeAt(++state.position);
|
||||
|
||||
if (ch === 0x27/* ' */) {
|
||||
captureStart = state.position;
|
||||
captureStart = captureEnd = state.position;
|
||||
state.position++;
|
||||
captureEnd = state.position;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -1979,7 +1900,6 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
||||
var following,
|
||||
allowCompact,
|
||||
_line,
|
||||
_pos,
|
||||
_tag = state.tag,
|
||||
_anchor = state.anchor,
|
||||
_result = {},
|
||||
@@ -2000,7 +1920,6 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
||||
while (ch !== 0) {
|
||||
following = state.input.charCodeAt(state.position + 1);
|
||||
_line = state.line; // Save the current line.
|
||||
_pos = state.position;
|
||||
|
||||
//
|
||||
// Explicit notation case. There are two separate blocks:
|
||||
@@ -2024,7 +1943,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
||||
allowCompact = true;
|
||||
|
||||
} else {
|
||||
throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
|
||||
throwError(state, 'incomplete explicit mapping pair; a key node is missed');
|
||||
}
|
||||
|
||||
state.position += 1;
|
||||
@@ -2095,7 +2014,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
||||
}
|
||||
|
||||
if (!atExplicitKey) {
|
||||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
|
||||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
||||
keyTag = keyNode = valueNode = null;
|
||||
}
|
||||
|
||||
@@ -2272,7 +2191,7 @@ function readAlias(state) {
|
||||
|
||||
alias = state.input.slice(_position, state.position);
|
||||
|
||||
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
||||
if (!state.anchorMap.hasOwnProperty(alias)) {
|
||||
throwError(state, 'unidentified alias "' + alias + '"');
|
||||
}
|
||||
|
||||
@@ -2393,19 +2312,15 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
||||
|
||||
if (state.tag !== null && state.tag !== '!') {
|
||||
if (state.tag === '?') {
|
||||
// Implicit resolving is not allowed for non-scalar types, and '?'
|
||||
// non-specific tag is only automatically assigned to plain scalars.
|
||||
//
|
||||
// We only need to check kind conformity in case user explicitly assigns '?'
|
||||
// tag, for example like this: "!<?> [0]"
|
||||
//
|
||||
if (state.result !== null && state.kind !== 'scalar') {
|
||||
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
||||
}
|
||||
|
||||
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
||||
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
|
||||
typeIndex < typeQuantity;
|
||||
typeIndex += 1) {
|
||||
type = state.implicitTypes[typeIndex];
|
||||
|
||||
// Implicit resolving is not allowed for non-scalar types, and '?'
|
||||
// non-specific tag is only assigned to plain scalars. So, it isn't
|
||||
// needed to check for 'kind' conformity.
|
||||
|
||||
if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
|
||||
state.result = type.construct(state.result);
|
||||
state.tag = type.tag;
|
||||
@@ -2415,8 +2330,8 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
|
||||
type = state.typeMap[state.kind || 'fallback'][state.tag];
|
||||
} else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
|
||||
type = state.typeMap[state.tag];
|
||||
|
||||
if (state.result !== null && type.kind !== state.kind) {
|
||||
throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
||||
@@ -2569,13 +2484,6 @@ function loadDocuments(input, options) {
|
||||
|
||||
var state = new State(input, options);
|
||||
|
||||
var nullpos = input.indexOf('\0');
|
||||
|
||||
if (nullpos !== -1) {
|
||||
state.position = nullpos;
|
||||
throwError(state, 'null byte is not allowed in input');
|
||||
}
|
||||
|
||||
// Use 0 as string terminator. That significantly simplifies bounds check.
|
||||
state.input += '\0';
|
||||
|
||||
@@ -2593,18 +2501,9 @@ function loadDocuments(input, options) {
|
||||
|
||||
|
||||
function loadAll(input, iterator, options) {
|
||||
if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
|
||||
options = iterator;
|
||||
iterator = null;
|
||||
}
|
||||
var documents = loadDocuments(input, options), index, length;
|
||||
|
||||
var documents = loadDocuments(input, options);
|
||||
|
||||
if (typeof iterator !== 'function') {
|
||||
return documents;
|
||||
}
|
||||
|
||||
for (var index = 0, length = documents.length; index < length; index += 1) {
|
||||
for (index = 0, length = documents.length; index < length; index += 1) {
|
||||
iterator(documents[index]);
|
||||
}
|
||||
}
|
||||
@@ -2623,13 +2522,8 @@ function load(input, options) {
|
||||
}
|
||||
|
||||
|
||||
function safeLoadAll(input, iterator, options) {
|
||||
if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
|
||||
options = iterator;
|
||||
iterator = null;
|
||||
}
|
||||
|
||||
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
||||
function safeLoadAll(input, output, options) {
|
||||
loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
||||
}
|
||||
|
||||
|
||||
@@ -2740,7 +2634,7 @@ function compileList(schema, name, result) {
|
||||
|
||||
schema[name].forEach(function (currentType) {
|
||||
result.forEach(function (previousType, previousIndex) {
|
||||
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
||||
if (previousType.tag === currentType.tag) {
|
||||
exclude.push(previousIndex);
|
||||
}
|
||||
});
|
||||
@@ -2755,20 +2649,16 @@ function compileList(schema, name, result) {
|
||||
|
||||
|
||||
function compileMap(/* lists... */) {
|
||||
var result = {
|
||||
scalar: {},
|
||||
sequence: {},
|
||||
mapping: {},
|
||||
fallback: {}
|
||||
}, index, length;
|
||||
var result = {}, index, length;
|
||||
|
||||
function collectType(type) {
|
||||
result[type.kind][type.tag] = result['fallback'][type.tag] = type;
|
||||
result[type.tag] = type;
|
||||
}
|
||||
|
||||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
||||
arguments[index].forEach(collectType);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3095,10 +2985,7 @@ function constructYamlBinary(data) {
|
||||
}
|
||||
|
||||
// Wrap into Buffer for NodeJS and leave Array for browser
|
||||
if (NodeBuffer) {
|
||||
// Support node 6.+ Buffer API when available
|
||||
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
||||
}
|
||||
if (NodeBuffer) return new NodeBuffer(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -3201,27 +3088,16 @@ var common = require('../common');
|
||||
var Type = require('../type');
|
||||
|
||||
var YAML_FLOAT_PATTERN = new RegExp(
|
||||
// 2.5e4, 2.5 and integers
|
||||
'^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
|
||||
// .2e4, .2
|
||||
// special case, seems not from spec
|
||||
'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
|
||||
// 20:59
|
||||
'^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
|
||||
'|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
|
||||
'|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
|
||||
// .inf
|
||||
'|[-+]?\\.(?:inf|Inf|INF)' +
|
||||
// .nan
|
||||
'|\\.(?:nan|NaN|NAN))$');
|
||||
|
||||
function resolveYamlFloat(data) {
|
||||
if (data === null) return false;
|
||||
|
||||
if (!YAML_FLOAT_PATTERN.test(data) ||
|
||||
// Quick hack to not allow integers end with `_`
|
||||
// Probably should update regexp & check speed
|
||||
data[data.length - 1] === '_') {
|
||||
return false;
|
||||
}
|
||||
if (!YAML_FLOAT_PATTERN.test(data)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3366,7 +3242,7 @@ function resolveYamlInteger(data) {
|
||||
if (ch !== '0' && ch !== '1') return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
return hasDigits;
|
||||
}
|
||||
|
||||
|
||||
@@ -3380,7 +3256,7 @@ function resolveYamlInteger(data) {
|
||||
if (!isHexCode(data.charCodeAt(index))) return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
return hasDigits;
|
||||
}
|
||||
|
||||
// base 8
|
||||
@@ -3390,14 +3266,11 @@ function resolveYamlInteger(data) {
|
||||
if (!isOctCode(data.charCodeAt(index))) return false;
|
||||
hasDigits = true;
|
||||
}
|
||||
return hasDigits && ch !== '_';
|
||||
return hasDigits;
|
||||
}
|
||||
|
||||
// base 10 (except 0) or base 60
|
||||
|
||||
// value should not start with `_`;
|
||||
if (ch === '_') return false;
|
||||
|
||||
for (; index < max; index++) {
|
||||
ch = data[index];
|
||||
if (ch === '_') continue;
|
||||
@@ -3408,8 +3281,7 @@ function resolveYamlInteger(data) {
|
||||
hasDigits = true;
|
||||
}
|
||||
|
||||
// Should have digits and should not end with `_`
|
||||
if (!hasDigits || ch === '_') return false;
|
||||
if (!hasDigits) return false;
|
||||
|
||||
// if !base60 - done;
|
||||
if (ch !== ':') return true;
|
||||
@@ -3472,11 +3344,10 @@ module.exports = new Type('tag:yaml.org,2002:int', {
|
||||
construct: constructYamlInteger,
|
||||
predicate: isInteger,
|
||||
represent: {
|
||||
binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
|
||||
octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
|
||||
decimal: function (obj) { return obj.toString(10); },
|
||||
/* eslint-disable max-len */
|
||||
hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
|
||||
binary: function (object) { return '0b' + object.toString(2); },
|
||||
octal: function (object) { return '0' + object.toString(8); },
|
||||
decimal: function (object) { return object.toString(10); },
|
||||
hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
|
||||
},
|
||||
defaultStyle: 'decimal',
|
||||
styleAliases: {
|
||||
@@ -3504,8 +3375,7 @@ try {
|
||||
var _require = require;
|
||||
esprima = _require('esprima');
|
||||
} catch (_) {
|
||||
/* eslint-disable no-redeclare */
|
||||
/* global window */
|
||||
/*global window */
|
||||
if (typeof window !== 'undefined') esprima = window.esprima;
|
||||
}
|
||||
|
||||
@@ -3521,8 +3391,7 @@ function resolveJavascriptFunction(data) {
|
||||
if (ast.type !== 'Program' ||
|
||||
ast.body.length !== 1 ||
|
||||
ast.body[0].type !== 'ExpressionStatement' ||
|
||||
(ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
|
||||
ast.body[0].expression.type !== 'FunctionExpression')) {
|
||||
ast.body[0].expression.type !== 'FunctionExpression') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3543,8 +3412,7 @@ function constructJavascriptFunction(data) {
|
||||
if (ast.type !== 'Program' ||
|
||||
ast.body.length !== 1 ||
|
||||
ast.body[0].type !== 'ExpressionStatement' ||
|
||||
(ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
|
||||
ast.body[0].expression.type !== 'FunctionExpression')) {
|
||||
ast.body[0].expression.type !== 'FunctionExpression') {
|
||||
throw new Error('Failed to resolve function');
|
||||
}
|
||||
|
||||
@@ -3556,14 +3424,8 @@ function constructJavascriptFunction(data) {
|
||||
|
||||
// Esprima's ranges include the first '{' and the last '}' characters on
|
||||
// function expressions. So cut them out.
|
||||
if (ast.body[0].expression.body.type === 'BlockStatement') {
|
||||
/*eslint-disable no-new-func*/
|
||||
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
||||
}
|
||||
// ES6 arrow functions can omit the BlockStatement. In that case, just return
|
||||
// the body.
|
||||
/*eslint-disable no-new-func*/
|
||||
return new Function(params, 'return ' + source.slice(body[0], body[1]));
|
||||
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
||||
}
|
||||
|
||||
function representJavascriptFunction(object /*, style*/) {
|
||||
@@ -3986,4 +3848,4 @@ var yaml = require('./lib/js-yaml.js');
|
||||
module.exports = yaml;
|
||||
|
||||
},{"./lib/js-yaml.js":1}]},{},[])("/")
|
||||
});
|
||||
});
|
||||
4
node_modules/js-yaml/dist/js-yaml.min.js
generated
vendored
4
node_modules/js-yaml/dist/js-yaml.min.js
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user