3508 lines
123 KiB
JavaScript
3508 lines
123 KiB
JavaScript
import {
|
||
__commonJS,
|
||
__require
|
||
} from "./chunk-2TUXWMP5.js";
|
||
|
||
// browser-external:fs
|
||
var require_fs = __commonJS({
|
||
"browser-external:fs"(exports2, module2) {
|
||
module2.exports = Object.create(new Proxy({}, {
|
||
get(_, key) {
|
||
if (key !== "__esModule" && key !== "__proto__" && key !== "constructor" && key !== "splice") {
|
||
console.warn(`Module "fs" has been externalized for browser compatibility. Cannot access "fs.${key}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
|
||
}
|
||
}
|
||
}));
|
||
}
|
||
});
|
||
|
||
// node_modules/kind-of/index.js
|
||
var require_kind_of = __commonJS({
|
||
"node_modules/kind-of/index.js"(exports2, module2) {
|
||
var toString = Object.prototype.toString;
|
||
module2.exports = function kindOf(val) {
|
||
if (val === void 0) return "undefined";
|
||
if (val === null) return "null";
|
||
var type = typeof val;
|
||
if (type === "boolean") return "boolean";
|
||
if (type === "string") return "string";
|
||
if (type === "number") return "number";
|
||
if (type === "symbol") return "symbol";
|
||
if (type === "function") {
|
||
return isGeneratorFn(val) ? "generatorfunction" : "function";
|
||
}
|
||
if (isArray(val)) return "array";
|
||
if (isBuffer(val)) return "buffer";
|
||
if (isArguments(val)) return "arguments";
|
||
if (isDate(val)) return "date";
|
||
if (isError(val)) return "error";
|
||
if (isRegexp(val)) return "regexp";
|
||
switch (ctorName(val)) {
|
||
case "Symbol":
|
||
return "symbol";
|
||
case "Promise":
|
||
return "promise";
|
||
// Set, Map, WeakSet, WeakMap
|
||
case "WeakMap":
|
||
return "weakmap";
|
||
case "WeakSet":
|
||
return "weakset";
|
||
case "Map":
|
||
return "map";
|
||
case "Set":
|
||
return "set";
|
||
// 8-bit typed arrays
|
||
case "Int8Array":
|
||
return "int8array";
|
||
case "Uint8Array":
|
||
return "uint8array";
|
||
case "Uint8ClampedArray":
|
||
return "uint8clampedarray";
|
||
// 16-bit typed arrays
|
||
case "Int16Array":
|
||
return "int16array";
|
||
case "Uint16Array":
|
||
return "uint16array";
|
||
// 32-bit typed arrays
|
||
case "Int32Array":
|
||
return "int32array";
|
||
case "Uint32Array":
|
||
return "uint32array";
|
||
case "Float32Array":
|
||
return "float32array";
|
||
case "Float64Array":
|
||
return "float64array";
|
||
}
|
||
if (isGeneratorObj(val)) {
|
||
return "generator";
|
||
}
|
||
type = toString.call(val);
|
||
switch (type) {
|
||
case "[object Object]":
|
||
return "object";
|
||
// iterators
|
||
case "[object Map Iterator]":
|
||
return "mapiterator";
|
||
case "[object Set Iterator]":
|
||
return "setiterator";
|
||
case "[object String Iterator]":
|
||
return "stringiterator";
|
||
case "[object Array Iterator]":
|
||
return "arrayiterator";
|
||
}
|
||
return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
|
||
};
|
||
function ctorName(val) {
|
||
return typeof val.constructor === "function" ? val.constructor.name : null;
|
||
}
|
||
function isArray(val) {
|
||
if (Array.isArray) return Array.isArray(val);
|
||
return val instanceof Array;
|
||
}
|
||
function isError(val) {
|
||
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
||
}
|
||
function isDate(val) {
|
||
if (val instanceof Date) return true;
|
||
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
||
}
|
||
function isRegexp(val) {
|
||
if (val instanceof RegExp) return true;
|
||
return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
|
||
}
|
||
function isGeneratorFn(name, val) {
|
||
return ctorName(name) === "GeneratorFunction";
|
||
}
|
||
function isGeneratorObj(val) {
|
||
return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
|
||
}
|
||
function isArguments(val) {
|
||
try {
|
||
if (typeof val.length === "number" && typeof val.callee === "function") {
|
||
return true;
|
||
}
|
||
} catch (err) {
|
||
if (err.message.indexOf("callee") !== -1) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function isBuffer(val) {
|
||
if (val.constructor && typeof val.constructor.isBuffer === "function") {
|
||
return val.constructor.isBuffer(val);
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
});
|
||
|
||
// node_modules/is-extendable/index.js
|
||
var require_is_extendable = __commonJS({
|
||
"node_modules/is-extendable/index.js"(exports2, module2) {
|
||
"use strict";
|
||
module2.exports = function isExtendable(val) {
|
||
return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function");
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/extend-shallow/index.js
|
||
var require_extend_shallow = __commonJS({
|
||
"node_modules/extend-shallow/index.js"(exports2, module2) {
|
||
"use strict";
|
||
var isObject = require_is_extendable();
|
||
module2.exports = function extend(o) {
|
||
if (!isObject(o)) {
|
||
o = {};
|
||
}
|
||
var len = arguments.length;
|
||
for (var i = 1; i < len; i++) {
|
||
var obj = arguments[i];
|
||
if (isObject(obj)) {
|
||
assign(o, obj);
|
||
}
|
||
}
|
||
return o;
|
||
};
|
||
function assign(a, b) {
|
||
for (var key in b) {
|
||
if (hasOwn(b, key)) {
|
||
a[key] = b[key];
|
||
}
|
||
}
|
||
}
|
||
function hasOwn(obj, key) {
|
||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||
}
|
||
}
|
||
});
|
||
|
||
// node_modules/section-matter/index.js
|
||
var require_section_matter = __commonJS({
|
||
"node_modules/section-matter/index.js"(exports2, module2) {
|
||
"use strict";
|
||
var typeOf = require_kind_of();
|
||
var extend = require_extend_shallow();
|
||
module2.exports = function(input, options2) {
|
||
if (typeof options2 === "function") {
|
||
options2 = { parse: options2 };
|
||
}
|
||
var file = toObject(input);
|
||
var defaults = { section_delimiter: "---", parse: identity };
|
||
var opts = extend({}, defaults, options2);
|
||
var delim = opts.section_delimiter;
|
||
var lines = file.content.split(/\r?\n/);
|
||
var sections = null;
|
||
var section = createSection();
|
||
var content = [];
|
||
var stack = [];
|
||
function initSections(val) {
|
||
file.content = val;
|
||
sections = [];
|
||
content = [];
|
||
}
|
||
function closeSection(val) {
|
||
if (stack.length) {
|
||
section.key = getKey(stack[0], delim);
|
||
section.content = val;
|
||
opts.parse(section, sections);
|
||
sections.push(section);
|
||
section = createSection();
|
||
content = [];
|
||
stack = [];
|
||
}
|
||
}
|
||
for (var i = 0; i < lines.length; i++) {
|
||
var line = lines[i];
|
||
var len = stack.length;
|
||
var ln = line.trim();
|
||
if (isDelimiter(ln, delim)) {
|
||
if (ln.length === 3 && i !== 0) {
|
||
if (len === 0 || len === 2) {
|
||
content.push(line);
|
||
continue;
|
||
}
|
||
stack.push(ln);
|
||
section.data = content.join("\n");
|
||
content = [];
|
||
continue;
|
||
}
|
||
if (sections === null) {
|
||
initSections(content.join("\n"));
|
||
}
|
||
if (len === 2) {
|
||
closeSection(content.join("\n"));
|
||
}
|
||
stack.push(ln);
|
||
continue;
|
||
}
|
||
content.push(line);
|
||
}
|
||
if (sections === null) {
|
||
initSections(content.join("\n"));
|
||
} else {
|
||
closeSection(content.join("\n"));
|
||
}
|
||
file.sections = sections;
|
||
return file;
|
||
};
|
||
function isDelimiter(line, delim) {
|
||
if (line.slice(0, delim.length) !== delim) {
|
||
return false;
|
||
}
|
||
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
function toObject(input) {
|
||
if (typeOf(input) !== "object") {
|
||
input = { content: input };
|
||
}
|
||
if (typeof input.content !== "string" && !isBuffer(input.content)) {
|
||
throw new TypeError("expected a buffer or string");
|
||
}
|
||
input.content = input.content.toString();
|
||
input.sections = [];
|
||
return input;
|
||
}
|
||
function getKey(val, delim) {
|
||
return val ? val.slice(delim.length).trim() : "";
|
||
}
|
||
function createSection() {
|
||
return { key: "", data: "", content: "" };
|
||
}
|
||
function identity(val) {
|
||
return val;
|
||
}
|
||
function isBuffer(val) {
|
||
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
|
||
return val.constructor.isBuffer(val);
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js
|
||
var require_common = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) {
|
||
"use strict";
|
||
function isNothing(subject) {
|
||
return typeof subject === "undefined" || subject === null;
|
||
}
|
||
function isObject(subject) {
|
||
return typeof subject === "object" && subject !== null;
|
||
}
|
||
function toArray(sequence) {
|
||
if (Array.isArray(sequence)) return sequence;
|
||
else if (isNothing(sequence)) return [];
|
||
return [sequence];
|
||
}
|
||
function extend(target, source) {
|
||
var index, length, key, sourceKeys;
|
||
if (source) {
|
||
sourceKeys = Object.keys(source);
|
||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
||
key = sourceKeys[index];
|
||
target[key] = source[key];
|
||
}
|
||
}
|
||
return target;
|
||
}
|
||
function repeat(string, count) {
|
||
var result = "", cycle;
|
||
for (cycle = 0; cycle < count; cycle += 1) {
|
||
result += string;
|
||
}
|
||
return result;
|
||
}
|
||
function isNegativeZero(number) {
|
||
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
||
}
|
||
module2.exports.isNothing = isNothing;
|
||
module2.exports.isObject = isObject;
|
||
module2.exports.toArray = toArray;
|
||
module2.exports.repeat = repeat;
|
||
module2.exports.isNegativeZero = isNegativeZero;
|
||
module2.exports.extend = extend;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js
|
||
var require_exception = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) {
|
||
"use strict";
|
||
function YAMLException(reason, mark) {
|
||
Error.call(this);
|
||
this.name = "YAMLException";
|
||
this.reason = reason;
|
||
this.mark = mark;
|
||
this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
|
||
if (Error.captureStackTrace) {
|
||
Error.captureStackTrace(this, this.constructor);
|
||
} else {
|
||
this.stack = new Error().stack || "";
|
||
}
|
||
}
|
||
YAMLException.prototype = Object.create(Error.prototype);
|
||
YAMLException.prototype.constructor = YAMLException;
|
||
YAMLException.prototype.toString = function toString(compact) {
|
||
var result = this.name + ": ";
|
||
result += this.reason || "(unknown reason)";
|
||
if (!compact && this.mark) {
|
||
result += " " + this.mark.toString();
|
||
}
|
||
return result;
|
||
};
|
||
module2.exports = YAMLException;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js
|
||
var require_mark = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) {
|
||
"use strict";
|
||
var common = require_common();
|
||
function Mark(name, buffer, position, line, column) {
|
||
this.name = name;
|
||
this.buffer = buffer;
|
||
this.position = position;
|
||
this.line = line;
|
||
this.column = column;
|
||
}
|
||
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
||
var head, start, tail, end, snippet;
|
||
if (!this.buffer) return null;
|
||
indent = indent || 4;
|
||
maxLength = maxLength || 75;
|
||
head = "";
|
||
start = this.position;
|
||
while (start > 0 && "\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) {
|
||
start -= 1;
|
||
if (this.position - start > maxLength / 2 - 1) {
|
||
head = " ... ";
|
||
start += 5;
|
||
break;
|
||
}
|
||
}
|
||
tail = "";
|
||
end = this.position;
|
||
while (end < this.buffer.length && "\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
|
||
end += 1;
|
||
if (end - this.position > maxLength / 2 - 1) {
|
||
tail = " ... ";
|
||
end -= 5;
|
||
break;
|
||
}
|
||
}
|
||
snippet = this.buffer.slice(start, end);
|
||
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
|
||
};
|
||
Mark.prototype.toString = function toString(compact) {
|
||
var snippet, where = "";
|
||
if (this.name) {
|
||
where += 'in "' + this.name + '" ';
|
||
}
|
||
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
|
||
if (!compact) {
|
||
snippet = this.getSnippet();
|
||
if (snippet) {
|
||
where += ":\n" + snippet;
|
||
}
|
||
}
|
||
return where;
|
||
};
|
||
module2.exports = Mark;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js
|
||
var require_type = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) {
|
||
"use strict";
|
||
var YAMLException = require_exception();
|
||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
||
"kind",
|
||
"resolve",
|
||
"construct",
|
||
"instanceOf",
|
||
"predicate",
|
||
"represent",
|
||
"defaultStyle",
|
||
"styleAliases"
|
||
];
|
||
var YAML_NODE_KINDS = [
|
||
"scalar",
|
||
"sequence",
|
||
"mapping"
|
||
];
|
||
function compileStyleAliases(map) {
|
||
var result = {};
|
||
if (map !== null) {
|
||
Object.keys(map).forEach(function(style) {
|
||
map[style].forEach(function(alias) {
|
||
result[String(alias)] = style;
|
||
});
|
||
});
|
||
}
|
||
return result;
|
||
}
|
||
function Type(tag, options2) {
|
||
options2 = options2 || {};
|
||
Object.keys(options2).forEach(function(name) {
|
||
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
||
}
|
||
});
|
||
this.tag = tag;
|
||
this.kind = options2["kind"] || null;
|
||
this.resolve = options2["resolve"] || function() {
|
||
return true;
|
||
};
|
||
this.construct = options2["construct"] || function(data) {
|
||
return data;
|
||
};
|
||
this.instanceOf = options2["instanceOf"] || null;
|
||
this.predicate = options2["predicate"] || null;
|
||
this.represent = options2["represent"] || null;
|
||
this.defaultStyle = options2["defaultStyle"] || null;
|
||
this.styleAliases = compileStyleAliases(options2["styleAliases"] || null);
|
||
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
||
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
||
}
|
||
}
|
||
module2.exports = Type;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js
|
||
var require_schema = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) {
|
||
"use strict";
|
||
var common = require_common();
|
||
var YAMLException = require_exception();
|
||
var Type = require_type();
|
||
function compileList(schema, name, result) {
|
||
var exclude = [];
|
||
schema.include.forEach(function(includedSchema) {
|
||
result = compileList(includedSchema, name, result);
|
||
});
|
||
schema[name].forEach(function(currentType) {
|
||
result.forEach(function(previousType, previousIndex) {
|
||
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
||
exclude.push(previousIndex);
|
||
}
|
||
});
|
||
result.push(currentType);
|
||
});
|
||
return result.filter(function(type, index) {
|
||
return exclude.indexOf(index) === -1;
|
||
});
|
||
}
|
||
function compileMap() {
|
||
var result = {
|
||
scalar: {},
|
||
sequence: {},
|
||
mapping: {},
|
||
fallback: {}
|
||
}, index, length;
|
||
function collectType(type) {
|
||
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
||
}
|
||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
||
arguments[index].forEach(collectType);
|
||
}
|
||
return result;
|
||
}
|
||
function Schema(definition) {
|
||
this.include = definition.include || [];
|
||
this.implicit = definition.implicit || [];
|
||
this.explicit = definition.explicit || [];
|
||
this.implicit.forEach(function(type) {
|
||
if (type.loadKind && type.loadKind !== "scalar") {
|
||
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
||
}
|
||
});
|
||
this.compiledImplicit = compileList(this, "implicit", []);
|
||
this.compiledExplicit = compileList(this, "explicit", []);
|
||
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
||
}
|
||
Schema.DEFAULT = null;
|
||
Schema.create = function createSchema() {
|
||
var schemas, types;
|
||
switch (arguments.length) {
|
||
case 1:
|
||
schemas = Schema.DEFAULT;
|
||
types = arguments[0];
|
||
break;
|
||
case 2:
|
||
schemas = arguments[0];
|
||
types = arguments[1];
|
||
break;
|
||
default:
|
||
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
||
}
|
||
schemas = common.toArray(schemas);
|
||
types = common.toArray(types);
|
||
if (!schemas.every(function(schema) {
|
||
return schema instanceof Schema;
|
||
})) {
|
||
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
||
}
|
||
if (!types.every(function(type) {
|
||
return type instanceof Type;
|
||
})) {
|
||
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
||
}
|
||
return new Schema({
|
||
include: schemas,
|
||
explicit: types
|
||
});
|
||
};
|
||
module2.exports = Schema;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js
|
||
var require_str = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
module2.exports = new Type("tag:yaml.org,2002:str", {
|
||
kind: "scalar",
|
||
construct: function(data) {
|
||
return data !== null ? data : "";
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js
|
||
var require_seq = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
||
kind: "sequence",
|
||
construct: function(data) {
|
||
return data !== null ? data : [];
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js
|
||
var require_map = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
module2.exports = new Type("tag:yaml.org,2002:map", {
|
||
kind: "mapping",
|
||
construct: function(data) {
|
||
return data !== null ? data : {};
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
|
||
var require_failsafe = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) {
|
||
"use strict";
|
||
var Schema = require_schema();
|
||
module2.exports = new Schema({
|
||
explicit: [
|
||
require_str(),
|
||
require_seq(),
|
||
require_map()
|
||
]
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js
|
||
var require_null = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
function resolveYamlNull(data) {
|
||
if (data === null) return true;
|
||
var max = data.length;
|
||
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
||
}
|
||
function constructYamlNull() {
|
||
return null;
|
||
}
|
||
function isNull(object) {
|
||
return object === null;
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:null", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlNull,
|
||
construct: constructYamlNull,
|
||
predicate: isNull,
|
||
represent: {
|
||
canonical: function() {
|
||
return "~";
|
||
},
|
||
lowercase: function() {
|
||
return "null";
|
||
},
|
||
uppercase: function() {
|
||
return "NULL";
|
||
},
|
||
camelcase: function() {
|
||
return "Null";
|
||
}
|
||
},
|
||
defaultStyle: "lowercase"
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js
|
||
var require_bool = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
function resolveYamlBoolean(data) {
|
||
if (data === null) return false;
|
||
var max = data.length;
|
||
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
||
}
|
||
function constructYamlBoolean(data) {
|
||
return data === "true" || data === "True" || data === "TRUE";
|
||
}
|
||
function isBoolean(object) {
|
||
return Object.prototype.toString.call(object) === "[object Boolean]";
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:bool", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlBoolean,
|
||
construct: constructYamlBoolean,
|
||
predicate: isBoolean,
|
||
represent: {
|
||
lowercase: function(object) {
|
||
return object ? "true" : "false";
|
||
},
|
||
uppercase: function(object) {
|
||
return object ? "TRUE" : "FALSE";
|
||
},
|
||
camelcase: function(object) {
|
||
return object ? "True" : "False";
|
||
}
|
||
},
|
||
defaultStyle: "lowercase"
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js
|
||
var require_int = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) {
|
||
"use strict";
|
||
var common = require_common();
|
||
var Type = require_type();
|
||
function isHexCode(c) {
|
||
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
||
}
|
||
function isOctCode(c) {
|
||
return 48 <= c && c <= 55;
|
||
}
|
||
function isDecCode(c) {
|
||
return 48 <= c && c <= 57;
|
||
}
|
||
function resolveYamlInteger(data) {
|
||
if (data === null) return false;
|
||
var max = data.length, index = 0, hasDigits = false, ch;
|
||
if (!max) return false;
|
||
ch = data[index];
|
||
if (ch === "-" || ch === "+") {
|
||
ch = data[++index];
|
||
}
|
||
if (ch === "0") {
|
||
if (index + 1 === max) return true;
|
||
ch = data[++index];
|
||
if (ch === "b") {
|
||
index++;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (ch !== "0" && ch !== "1") return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== "_";
|
||
}
|
||
if (ch === "x") {
|
||
index++;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (!isHexCode(data.charCodeAt(index))) return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== "_";
|
||
}
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (!isOctCode(data.charCodeAt(index))) return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== "_";
|
||
}
|
||
if (ch === "_") return false;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (ch === ":") break;
|
||
if (!isDecCode(data.charCodeAt(index))) {
|
||
return false;
|
||
}
|
||
hasDigits = true;
|
||
}
|
||
if (!hasDigits || ch === "_") return false;
|
||
if (ch !== ":") return true;
|
||
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
||
}
|
||
function constructYamlInteger(data) {
|
||
var value = data, sign = 1, ch, base, digits = [];
|
||
if (value.indexOf("_") !== -1) {
|
||
value = value.replace(/_/g, "");
|
||
}
|
||
ch = value[0];
|
||
if (ch === "-" || ch === "+") {
|
||
if (ch === "-") sign = -1;
|
||
value = value.slice(1);
|
||
ch = value[0];
|
||
}
|
||
if (value === "0") return 0;
|
||
if (ch === "0") {
|
||
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
||
if (value[1] === "x") return sign * parseInt(value, 16);
|
||
return sign * parseInt(value, 8);
|
||
}
|
||
if (value.indexOf(":") !== -1) {
|
||
value.split(":").forEach(function(v) {
|
||
digits.unshift(parseInt(v, 10));
|
||
});
|
||
value = 0;
|
||
base = 1;
|
||
digits.forEach(function(d) {
|
||
value += d * base;
|
||
base *= 60;
|
||
});
|
||
return sign * value;
|
||
}
|
||
return sign * parseInt(value, 10);
|
||
}
|
||
function isInteger(object) {
|
||
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:int", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlInteger,
|
||
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);
|
||
}
|
||
},
|
||
defaultStyle: "decimal",
|
||
styleAliases: {
|
||
binary: [2, "bin"],
|
||
octal: [8, "oct"],
|
||
decimal: [10, "dec"],
|
||
hexadecimal: [16, "hex"]
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js
|
||
var require_float = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) {
|
||
"use strict";
|
||
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]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?: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;
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlFloat(data) {
|
||
var value, sign, base, digits;
|
||
value = data.replace(/_/g, "").toLowerCase();
|
||
sign = value[0] === "-" ? -1 : 1;
|
||
digits = [];
|
||
if ("+-".indexOf(value[0]) >= 0) {
|
||
value = value.slice(1);
|
||
}
|
||
if (value === ".inf") {
|
||
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
||
} else if (value === ".nan") {
|
||
return NaN;
|
||
} else if (value.indexOf(":") >= 0) {
|
||
value.split(":").forEach(function(v) {
|
||
digits.unshift(parseFloat(v, 10));
|
||
});
|
||
value = 0;
|
||
base = 1;
|
||
digits.forEach(function(d) {
|
||
value += d * base;
|
||
base *= 60;
|
||
});
|
||
return sign * value;
|
||
}
|
||
return sign * parseFloat(value, 10);
|
||
}
|
||
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
||
function representYamlFloat(object, style) {
|
||
var res;
|
||
if (isNaN(object)) {
|
||
switch (style) {
|
||
case "lowercase":
|
||
return ".nan";
|
||
case "uppercase":
|
||
return ".NAN";
|
||
case "camelcase":
|
||
return ".NaN";
|
||
}
|
||
} else if (Number.POSITIVE_INFINITY === object) {
|
||
switch (style) {
|
||
case "lowercase":
|
||
return ".inf";
|
||
case "uppercase":
|
||
return ".INF";
|
||
case "camelcase":
|
||
return ".Inf";
|
||
}
|
||
} else if (Number.NEGATIVE_INFINITY === object) {
|
||
switch (style) {
|
||
case "lowercase":
|
||
return "-.inf";
|
||
case "uppercase":
|
||
return "-.INF";
|
||
case "camelcase":
|
||
return "-.Inf";
|
||
}
|
||
} else if (common.isNegativeZero(object)) {
|
||
return "-0.0";
|
||
}
|
||
res = object.toString(10);
|
||
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
||
}
|
||
function isFloat(object) {
|
||
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:float", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlFloat,
|
||
construct: constructYamlFloat,
|
||
predicate: isFloat,
|
||
represent: representYamlFloat,
|
||
defaultStyle: "lowercase"
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js
|
||
var require_json = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) {
|
||
"use strict";
|
||
var Schema = require_schema();
|
||
module2.exports = new Schema({
|
||
include: [
|
||
require_failsafe()
|
||
],
|
||
implicit: [
|
||
require_null(),
|
||
require_bool(),
|
||
require_int(),
|
||
require_float()
|
||
]
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js
|
||
var require_core = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) {
|
||
"use strict";
|
||
var Schema = require_schema();
|
||
module2.exports = new Schema({
|
||
include: [
|
||
require_json()
|
||
]
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
|
||
var require_timestamp = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
var YAML_DATE_REGEXP = new RegExp(
|
||
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
||
);
|
||
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
||
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
||
);
|
||
function resolveYamlTimestamp(data) {
|
||
if (data === null) return false;
|
||
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
||
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
||
return false;
|
||
}
|
||
function constructYamlTimestamp(data) {
|
||
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
||
match = YAML_DATE_REGEXP.exec(data);
|
||
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
||
if (match === null) throw new Error("Date resolve error");
|
||
year = +match[1];
|
||
month = +match[2] - 1;
|
||
day = +match[3];
|
||
if (!match[4]) {
|
||
return new Date(Date.UTC(year, month, day));
|
||
}
|
||
hour = +match[4];
|
||
minute = +match[5];
|
||
second = +match[6];
|
||
if (match[7]) {
|
||
fraction = match[7].slice(0, 3);
|
||
while (fraction.length < 3) {
|
||
fraction += "0";
|
||
}
|
||
fraction = +fraction;
|
||
}
|
||
if (match[9]) {
|
||
tz_hour = +match[10];
|
||
tz_minute = +(match[11] || 0);
|
||
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
||
if (match[9] === "-") delta = -delta;
|
||
}
|
||
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
||
if (delta) date.setTime(date.getTime() - delta);
|
||
return date;
|
||
}
|
||
function representYamlTimestamp(object) {
|
||
return object.toISOString();
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:timestamp", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlTimestamp,
|
||
construct: constructYamlTimestamp,
|
||
instanceOf: Date,
|
||
represent: representYamlTimestamp
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js
|
||
var require_merge = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
function resolveYamlMerge(data) {
|
||
return data === "<<" || data === null;
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:merge", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlMerge
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
||
var require_binary = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) {
|
||
"use strict";
|
||
var NodeBuffer;
|
||
try {
|
||
_require = __require;
|
||
NodeBuffer = _require("buffer").Buffer;
|
||
} catch (__) {
|
||
}
|
||
var _require;
|
||
var Type = require_type();
|
||
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
||
function resolveYamlBinary(data) {
|
||
if (data === null) return false;
|
||
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
||
for (idx = 0; idx < max; idx++) {
|
||
code = map.indexOf(data.charAt(idx));
|
||
if (code > 64) continue;
|
||
if (code < 0) return false;
|
||
bitlen += 6;
|
||
}
|
||
return bitlen % 8 === 0;
|
||
}
|
||
function constructYamlBinary(data) {
|
||
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
|
||
for (idx = 0; idx < max; idx++) {
|
||
if (idx % 4 === 0 && idx) {
|
||
result.push(bits >> 16 & 255);
|
||
result.push(bits >> 8 & 255);
|
||
result.push(bits & 255);
|
||
}
|
||
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
||
}
|
||
tailbits = max % 4 * 6;
|
||
if (tailbits === 0) {
|
||
result.push(bits >> 16 & 255);
|
||
result.push(bits >> 8 & 255);
|
||
result.push(bits & 255);
|
||
} else if (tailbits === 18) {
|
||
result.push(bits >> 10 & 255);
|
||
result.push(bits >> 2 & 255);
|
||
} else if (tailbits === 12) {
|
||
result.push(bits >> 4 & 255);
|
||
}
|
||
if (NodeBuffer) {
|
||
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
||
}
|
||
return result;
|
||
}
|
||
function representYamlBinary(object) {
|
||
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
|
||
for (idx = 0; idx < max; idx++) {
|
||
if (idx % 3 === 0 && idx) {
|
||
result += map[bits >> 18 & 63];
|
||
result += map[bits >> 12 & 63];
|
||
result += map[bits >> 6 & 63];
|
||
result += map[bits & 63];
|
||
}
|
||
bits = (bits << 8) + object[idx];
|
||
}
|
||
tail = max % 3;
|
||
if (tail === 0) {
|
||
result += map[bits >> 18 & 63];
|
||
result += map[bits >> 12 & 63];
|
||
result += map[bits >> 6 & 63];
|
||
result += map[bits & 63];
|
||
} else if (tail === 2) {
|
||
result += map[bits >> 10 & 63];
|
||
result += map[bits >> 4 & 63];
|
||
result += map[bits << 2 & 63];
|
||
result += map[64];
|
||
} else if (tail === 1) {
|
||
result += map[bits >> 2 & 63];
|
||
result += map[bits << 4 & 63];
|
||
result += map[64];
|
||
result += map[64];
|
||
}
|
||
return result;
|
||
}
|
||
function isBinary(object) {
|
||
return NodeBuffer && NodeBuffer.isBuffer(object);
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:binary", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlBinary,
|
||
construct: constructYamlBinary,
|
||
predicate: isBinary,
|
||
represent: representYamlBinary
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js
|
||
var require_omap = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var _toString = Object.prototype.toString;
|
||
function resolveYamlOmap(data) {
|
||
if (data === null) return true;
|
||
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
pairHasKey = false;
|
||
if (_toString.call(pair) !== "[object Object]") return false;
|
||
for (pairKey in pair) {
|
||
if (_hasOwnProperty.call(pair, pairKey)) {
|
||
if (!pairHasKey) pairHasKey = true;
|
||
else return false;
|
||
}
|
||
}
|
||
if (!pairHasKey) return false;
|
||
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
||
else return false;
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlOmap(data) {
|
||
return data !== null ? data : [];
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:omap", {
|
||
kind: "sequence",
|
||
resolve: resolveYamlOmap,
|
||
construct: constructYamlOmap
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js
|
||
var require_pairs = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
var _toString = Object.prototype.toString;
|
||
function resolveYamlPairs(data) {
|
||
if (data === null) return true;
|
||
var index, length, pair, keys, result, object = data;
|
||
result = new Array(object.length);
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
if (_toString.call(pair) !== "[object Object]") return false;
|
||
keys = Object.keys(pair);
|
||
if (keys.length !== 1) return false;
|
||
result[index] = [keys[0], pair[keys[0]]];
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlPairs(data) {
|
||
if (data === null) return [];
|
||
var index, length, pair, keys, result, object = data;
|
||
result = new Array(object.length);
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
keys = Object.keys(pair);
|
||
result[index] = [keys[0], pair[keys[0]]];
|
||
}
|
||
return result;
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:pairs", {
|
||
kind: "sequence",
|
||
resolve: resolveYamlPairs,
|
||
construct: constructYamlPairs
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js
|
||
var require_set = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
function resolveYamlSet(data) {
|
||
if (data === null) return true;
|
||
var key, object = data;
|
||
for (key in object) {
|
||
if (_hasOwnProperty.call(object, key)) {
|
||
if (object[key] !== null) return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlSet(data) {
|
||
return data !== null ? data : {};
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:set", {
|
||
kind: "mapping",
|
||
resolve: resolveYamlSet,
|
||
construct: constructYamlSet
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
|
||
var require_default_safe = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) {
|
||
"use strict";
|
||
var Schema = require_schema();
|
||
module2.exports = new Schema({
|
||
include: [
|
||
require_core()
|
||
],
|
||
implicit: [
|
||
require_timestamp(),
|
||
require_merge()
|
||
],
|
||
explicit: [
|
||
require_binary(),
|
||
require_omap(),
|
||
require_pairs(),
|
||
require_set()
|
||
]
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
|
||
var require_undefined = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
function resolveJavascriptUndefined() {
|
||
return true;
|
||
}
|
||
function constructJavascriptUndefined() {
|
||
return void 0;
|
||
}
|
||
function representJavascriptUndefined() {
|
||
return "";
|
||
}
|
||
function isUndefined(object) {
|
||
return typeof object === "undefined";
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:js/undefined", {
|
||
kind: "scalar",
|
||
resolve: resolveJavascriptUndefined,
|
||
construct: constructJavascriptUndefined,
|
||
predicate: isUndefined,
|
||
represent: representJavascriptUndefined
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
|
||
var require_regexp = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) {
|
||
"use strict";
|
||
var Type = require_type();
|
||
function resolveJavascriptRegExp(data) {
|
||
if (data === null) return false;
|
||
if (data.length === 0) return false;
|
||
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
||
if (regexp[0] === "/") {
|
||
if (tail) modifiers = tail[1];
|
||
if (modifiers.length > 3) return false;
|
||
if (regexp[regexp.length - modifiers.length - 1] !== "/") return false;
|
||
}
|
||
return true;
|
||
}
|
||
function constructJavascriptRegExp(data) {
|
||
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
||
if (regexp[0] === "/") {
|
||
if (tail) modifiers = tail[1];
|
||
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
||
}
|
||
return new RegExp(regexp, modifiers);
|
||
}
|
||
function representJavascriptRegExp(object) {
|
||
var result = "/" + object.source + "/";
|
||
if (object.global) result += "g";
|
||
if (object.multiline) result += "m";
|
||
if (object.ignoreCase) result += "i";
|
||
return result;
|
||
}
|
||
function isRegExp(object) {
|
||
return Object.prototype.toString.call(object) === "[object RegExp]";
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:js/regexp", {
|
||
kind: "scalar",
|
||
resolve: resolveJavascriptRegExp,
|
||
construct: constructJavascriptRegExp,
|
||
predicate: isRegExp,
|
||
represent: representJavascriptRegExp
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js
|
||
var require_function = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) {
|
||
"use strict";
|
||
var esprima;
|
||
try {
|
||
_require = __require;
|
||
esprima = _require("esprima");
|
||
} catch (_) {
|
||
if (typeof window !== "undefined") esprima = window.esprima;
|
||
}
|
||
var _require;
|
||
var Type = require_type();
|
||
function resolveJavascriptFunction(data) {
|
||
if (data === null) return false;
|
||
try {
|
||
var source = "(" + data + ")", ast = esprima.parse(source, { range: true });
|
||
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") {
|
||
return false;
|
||
}
|
||
return true;
|
||
} catch (err) {
|
||
return false;
|
||
}
|
||
}
|
||
function constructJavascriptFunction(data) {
|
||
var source = "(" + data + ")", ast = esprima.parse(source, { range: true }), params = [], body;
|
||
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") {
|
||
throw new Error("Failed to resolve function");
|
||
}
|
||
ast.body[0].expression.params.forEach(function(param) {
|
||
params.push(param.name);
|
||
});
|
||
body = ast.body[0].expression.body.range;
|
||
if (ast.body[0].expression.body.type === "BlockStatement") {
|
||
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
||
}
|
||
return new Function(params, "return " + source.slice(body[0], body[1]));
|
||
}
|
||
function representJavascriptFunction(object) {
|
||
return object.toString();
|
||
}
|
||
function isFunction(object) {
|
||
return Object.prototype.toString.call(object) === "[object Function]";
|
||
}
|
||
module2.exports = new Type("tag:yaml.org,2002:js/function", {
|
||
kind: "scalar",
|
||
resolve: resolveJavascriptFunction,
|
||
construct: constructJavascriptFunction,
|
||
predicate: isFunction,
|
||
represent: representJavascriptFunction
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
|
||
var require_default_full = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) {
|
||
"use strict";
|
||
var Schema = require_schema();
|
||
module2.exports = Schema.DEFAULT = new Schema({
|
||
include: [
|
||
require_default_safe()
|
||
],
|
||
explicit: [
|
||
require_undefined(),
|
||
require_regexp(),
|
||
require_function()
|
||
]
|
||
});
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js
|
||
var require_loader = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) {
|
||
"use strict";
|
||
var common = require_common();
|
||
var YAMLException = require_exception();
|
||
var Mark = require_mark();
|
||
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
||
var DEFAULT_FULL_SCHEMA = require_default_full();
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var CONTEXT_FLOW_IN = 1;
|
||
var CONTEXT_FLOW_OUT = 2;
|
||
var CONTEXT_BLOCK_IN = 3;
|
||
var CONTEXT_BLOCK_OUT = 4;
|
||
var CHOMPING_CLIP = 1;
|
||
var CHOMPING_STRIP = 2;
|
||
var CHOMPING_KEEP = 3;
|
||
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
||
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
||
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
||
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 === 10 || c === 13;
|
||
}
|
||
function is_WHITE_SPACE(c) {
|
||
return c === 9 || c === 32;
|
||
}
|
||
function is_WS_OR_EOL(c) {
|
||
return c === 9 || c === 32 || c === 10 || c === 13;
|
||
}
|
||
function is_FLOW_INDICATOR(c) {
|
||
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
||
}
|
||
function fromHexCode(c) {
|
||
var lc;
|
||
if (48 <= c && c <= 57) {
|
||
return c - 48;
|
||
}
|
||
lc = c | 32;
|
||
if (97 <= lc && lc <= 102) {
|
||
return lc - 97 + 10;
|
||
}
|
||
return -1;
|
||
}
|
||
function escapedHexLen(c) {
|
||
if (c === 120) {
|
||
return 2;
|
||
}
|
||
if (c === 117) {
|
||
return 4;
|
||
}
|
||
if (c === 85) {
|
||
return 8;
|
||
}
|
||
return 0;
|
||
}
|
||
function fromDecimalCode(c) {
|
||
if (48 <= c && c <= 57) {
|
||
return c - 48;
|
||
}
|
||
return -1;
|
||
}
|
||
function simpleEscapeSequence(c) {
|
||
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "
" : c === 95 ? " " : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
||
}
|
||
function charFromCodepoint(c) {
|
||
if (c <= 65535) {
|
||
return String.fromCharCode(c);
|
||
}
|
||
return String.fromCharCode(
|
||
(c - 65536 >> 10) + 55296,
|
||
(c - 65536 & 1023) + 56320
|
||
);
|
||
}
|
||
var simpleEscapeCheck = new Array(256);
|
||
var simpleEscapeMap = new Array(256);
|
||
for (i = 0; i < 256; i++) {
|
||
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
||
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
||
}
|
||
var i;
|
||
function State(input, options2) {
|
||
this.input = input;
|
||
this.filename = options2["filename"] || null;
|
||
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
||
this.onWarning = options2["onWarning"] || null;
|
||
this.legacy = options2["legacy"] || false;
|
||
this.json = options2["json"] || false;
|
||
this.listener = options2["listener"] || null;
|
||
this.implicitTypes = this.schema.compiledImplicit;
|
||
this.typeMap = this.schema.compiledTypeMap;
|
||
this.length = input.length;
|
||
this.position = 0;
|
||
this.line = 0;
|
||
this.lineStart = 0;
|
||
this.lineIndent = 0;
|
||
this.documents = [];
|
||
}
|
||
function generateError(state, message) {
|
||
return new YAMLException(
|
||
message,
|
||
new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart)
|
||
);
|
||
}
|
||
function throwError(state, message) {
|
||
throw generateError(state, message);
|
||
}
|
||
function throwWarning(state, message) {
|
||
if (state.onWarning) {
|
||
state.onWarning.call(null, generateError(state, message));
|
||
}
|
||
}
|
||
var directiveHandlers = {
|
||
YAML: function handleYamlDirective(state, name, args) {
|
||
var match, major, minor;
|
||
if (state.version !== null) {
|
||
throwError(state, "duplication of %YAML directive");
|
||
}
|
||
if (args.length !== 1) {
|
||
throwError(state, "YAML directive accepts exactly one argument");
|
||
}
|
||
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
||
if (match === null) {
|
||
throwError(state, "ill-formed argument of the YAML directive");
|
||
}
|
||
major = parseInt(match[1], 10);
|
||
minor = parseInt(match[2], 10);
|
||
if (major !== 1) {
|
||
throwError(state, "unacceptable YAML version of the document");
|
||
}
|
||
state.version = args[0];
|
||
state.checkLineBreaks = minor < 2;
|
||
if (minor !== 1 && minor !== 2) {
|
||
throwWarning(state, "unsupported YAML version of the document");
|
||
}
|
||
},
|
||
TAG: function handleTagDirective(state, name, args) {
|
||
var handle, prefix;
|
||
if (args.length !== 2) {
|
||
throwError(state, "TAG directive accepts exactly two arguments");
|
||
}
|
||
handle = args[0];
|
||
prefix = args[1];
|
||
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
||
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
||
}
|
||
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
||
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
||
}
|
||
if (!PATTERN_TAG_URI.test(prefix)) {
|
||
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
||
}
|
||
state.tagMap[handle] = prefix;
|
||
}
|
||
};
|
||
function captureSegment(state, start, end, checkJson) {
|
||
var _position, _length, _character, _result;
|
||
if (start < end) {
|
||
_result = state.input.slice(start, end);
|
||
if (checkJson) {
|
||
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
||
_character = _result.charCodeAt(_position);
|
||
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
||
throwError(state, "expected valid JSON character");
|
||
}
|
||
}
|
||
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
||
throwError(state, "the stream contains non-printable characters");
|
||
}
|
||
state.result += _result;
|
||
}
|
||
}
|
||
function mergeMappings(state, destination, source, overridableKeys) {
|
||
var sourceKeys, key, index, quantity;
|
||
if (!common.isObject(source)) {
|
||
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
||
}
|
||
sourceKeys = Object.keys(source);
|
||
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
||
key = sourceKeys[index];
|
||
if (!_hasOwnProperty.call(destination, key)) {
|
||
destination[key] = source[key];
|
||
overridableKeys[key] = true;
|
||
}
|
||
}
|
||
}
|
||
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
||
var index, quantity;
|
||
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]";
|
||
}
|
||
}
|
||
}
|
||
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
||
keyNode = "[object Object]";
|
||
}
|
||
keyNode = String(keyNode);
|
||
if (_result === null) {
|
||
_result = {};
|
||
}
|
||
if (keyTag === "tag:yaml.org,2002:merge") {
|
||
if (Array.isArray(valueNode)) {
|
||
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
||
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
||
}
|
||
} else {
|
||
mergeMappings(state, _result, valueNode, overridableKeys);
|
||
}
|
||
} else {
|
||
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;
|
||
delete overridableKeys[keyNode];
|
||
}
|
||
return _result;
|
||
}
|
||
function readLineBreak(state) {
|
||
var ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 10) {
|
||
state.position++;
|
||
} else if (ch === 13) {
|
||
state.position++;
|
||
if (state.input.charCodeAt(state.position) === 10) {
|
||
state.position++;
|
||
}
|
||
} else {
|
||
throwError(state, "a line break is expected");
|
||
}
|
||
state.line += 1;
|
||
state.lineStart = state.position;
|
||
}
|
||
function skipSeparationSpace(state, allowComments, checkIndent) {
|
||
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
||
while (ch !== 0) {
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (allowComments && ch === 35) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
||
}
|
||
if (is_EOL(ch)) {
|
||
readLineBreak(state);
|
||
ch = state.input.charCodeAt(state.position);
|
||
lineBreaks++;
|
||
state.lineIndent = 0;
|
||
while (ch === 32) {
|
||
state.lineIndent++;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
||
throwWarning(state, "deficient indentation");
|
||
}
|
||
return lineBreaks;
|
||
}
|
||
function testDocumentSeparator(state) {
|
||
var _position = state.position, ch;
|
||
ch = state.input.charCodeAt(_position);
|
||
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
||
_position += 3;
|
||
ch = state.input.charCodeAt(_position);
|
||
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function writeFoldedLines(state, count) {
|
||
if (count === 1) {
|
||
state.result += " ";
|
||
} else if (count > 1) {
|
||
state.result += common.repeat("\n", count - 1);
|
||
}
|
||
}
|
||
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
||
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
||
return false;
|
||
}
|
||
if (ch === 63 || ch === 45) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
||
return false;
|
||
}
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
captureStart = captureEnd = state.position;
|
||
hasPendingContent = false;
|
||
while (ch !== 0) {
|
||
if (ch === 58) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
||
break;
|
||
}
|
||
} else if (ch === 35) {
|
||
preceding = state.input.charCodeAt(state.position - 1);
|
||
if (is_WS_OR_EOL(preceding)) {
|
||
break;
|
||
}
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
||
break;
|
||
} else if (is_EOL(ch)) {
|
||
_line = state.line;
|
||
_lineStart = state.lineStart;
|
||
_lineIndent = state.lineIndent;
|
||
skipSeparationSpace(state, false, -1);
|
||
if (state.lineIndent >= nodeIndent) {
|
||
hasPendingContent = true;
|
||
ch = state.input.charCodeAt(state.position);
|
||
continue;
|
||
} else {
|
||
state.position = captureEnd;
|
||
state.line = _line;
|
||
state.lineStart = _lineStart;
|
||
state.lineIndent = _lineIndent;
|
||
break;
|
||
}
|
||
}
|
||
if (hasPendingContent) {
|
||
captureSegment(state, captureStart, captureEnd, false);
|
||
writeFoldedLines(state, state.line - _line);
|
||
captureStart = captureEnd = state.position;
|
||
hasPendingContent = false;
|
||
}
|
||
if (!is_WHITE_SPACE(ch)) {
|
||
captureEnd = state.position + 1;
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
captureSegment(state, captureStart, captureEnd, false);
|
||
if (state.result) {
|
||
return true;
|
||
}
|
||
state.kind = _kind;
|
||
state.result = _result;
|
||
return false;
|
||
}
|
||
function readSingleQuotedScalar(state, nodeIndent) {
|
||
var ch, captureStart, captureEnd;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 39) {
|
||
return false;
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
state.position++;
|
||
captureStart = captureEnd = state.position;
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
if (ch === 39) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (ch === 39) {
|
||
captureStart = state.position;
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
} else {
|
||
return true;
|
||
}
|
||
} else if (is_EOL(ch)) {
|
||
captureSegment(state, captureStart, captureEnd, true);
|
||
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
||
captureStart = captureEnd = state.position;
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
throwError(state, "unexpected end of the document within a single quoted scalar");
|
||
} else {
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
}
|
||
}
|
||
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
||
}
|
||
function readDoubleQuotedScalar(state, nodeIndent) {
|
||
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 34) {
|
||
return false;
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
state.position++;
|
||
captureStart = captureEnd = state.position;
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
if (ch === 34) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
state.position++;
|
||
return true;
|
||
} else if (ch === 92) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (is_EOL(ch)) {
|
||
skipSeparationSpace(state, false, nodeIndent);
|
||
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
||
state.result += simpleEscapeMap[ch];
|
||
state.position++;
|
||
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
||
hexLength = tmp;
|
||
hexResult = 0;
|
||
for (; hexLength > 0; hexLength--) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if ((tmp = fromHexCode(ch)) >= 0) {
|
||
hexResult = (hexResult << 4) + tmp;
|
||
} else {
|
||
throwError(state, "expected hexadecimal character");
|
||
}
|
||
}
|
||
state.result += charFromCodepoint(hexResult);
|
||
state.position++;
|
||
} else {
|
||
throwError(state, "unknown escape sequence");
|
||
}
|
||
captureStart = captureEnd = state.position;
|
||
} else if (is_EOL(ch)) {
|
||
captureSegment(state, captureStart, captureEnd, true);
|
||
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
||
captureStart = captureEnd = state.position;
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
throwError(state, "unexpected end of the document within a double quoted scalar");
|
||
} else {
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
}
|
||
}
|
||
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
||
}
|
||
function readFlowCollection(state, nodeIndent) {
|
||
var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 91) {
|
||
terminator = 93;
|
||
isMapping = false;
|
||
_result = [];
|
||
} else if (ch === 123) {
|
||
terminator = 125;
|
||
isMapping = true;
|
||
_result = {};
|
||
} else {
|
||
return false;
|
||
}
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
while (ch !== 0) {
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === terminator) {
|
||
state.position++;
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = isMapping ? "mapping" : "sequence";
|
||
state.result = _result;
|
||
return true;
|
||
} else if (!readNext) {
|
||
throwError(state, "missed comma between flow collection entries");
|
||
}
|
||
keyTag = keyNode = valueNode = null;
|
||
isPair = isExplicitPair = false;
|
||
if (ch === 63) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (is_WS_OR_EOL(following)) {
|
||
isPair = isExplicitPair = true;
|
||
state.position++;
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
}
|
||
}
|
||
_line = state.line;
|
||
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
||
keyTag = state.tag;
|
||
keyNode = state.result;
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
||
isPair = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
||
valueNode = state.result;
|
||
}
|
||
if (isMapping) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
||
} else if (isPair) {
|
||
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
|
||
} else {
|
||
_result.push(keyNode);
|
||
}
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 44) {
|
||
readNext = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
readNext = false;
|
||
}
|
||
}
|
||
throwError(state, "unexpected end of the stream within a flow collection");
|
||
}
|
||
function readBlockScalar(state, nodeIndent) {
|
||
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 124) {
|
||
folding = false;
|
||
} else if (ch === 62) {
|
||
folding = true;
|
||
} else {
|
||
return false;
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
while (ch !== 0) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (ch === 43 || ch === 45) {
|
||
if (CHOMPING_CLIP === chomping) {
|
||
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
||
} else {
|
||
throwError(state, "repeat of a chomping mode identifier");
|
||
}
|
||
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
||
if (tmp === 0) {
|
||
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
||
} else if (!detectedIndent) {
|
||
textIndent = nodeIndent + tmp - 1;
|
||
detectedIndent = true;
|
||
} else {
|
||
throwError(state, "repeat of an indentation width identifier");
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
if (is_WHITE_SPACE(ch)) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (is_WHITE_SPACE(ch));
|
||
if (ch === 35) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (!is_EOL(ch) && ch !== 0);
|
||
}
|
||
}
|
||
while (ch !== 0) {
|
||
readLineBreak(state);
|
||
state.lineIndent = 0;
|
||
ch = state.input.charCodeAt(state.position);
|
||
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
||
state.lineIndent++;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (!detectedIndent && state.lineIndent > textIndent) {
|
||
textIndent = state.lineIndent;
|
||
}
|
||
if (is_EOL(ch)) {
|
||
emptyLines++;
|
||
continue;
|
||
}
|
||
if (state.lineIndent < textIndent) {
|
||
if (chomping === CHOMPING_KEEP) {
|
||
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
||
} else if (chomping === CHOMPING_CLIP) {
|
||
if (didReadContent) {
|
||
state.result += "\n";
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
if (folding) {
|
||
if (is_WHITE_SPACE(ch)) {
|
||
atMoreIndented = true;
|
||
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
||
} else if (atMoreIndented) {
|
||
atMoreIndented = false;
|
||
state.result += common.repeat("\n", emptyLines + 1);
|
||
} else if (emptyLines === 0) {
|
||
if (didReadContent) {
|
||
state.result += " ";
|
||
}
|
||
} else {
|
||
state.result += common.repeat("\n", emptyLines);
|
||
}
|
||
} else {
|
||
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
||
}
|
||
didReadContent = true;
|
||
detectedIndent = true;
|
||
emptyLines = 0;
|
||
captureStart = state.position;
|
||
while (!is_EOL(ch) && ch !== 0) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
captureSegment(state, captureStart, state.position, false);
|
||
}
|
||
return true;
|
||
}
|
||
function readBlockSequence(state, nodeIndent) {
|
||
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
ch = state.input.charCodeAt(state.position);
|
||
while (ch !== 0) {
|
||
if (ch !== 45) {
|
||
break;
|
||
}
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (!is_WS_OR_EOL(following)) {
|
||
break;
|
||
}
|
||
detected = true;
|
||
state.position++;
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
if (state.lineIndent <= nodeIndent) {
|
||
_result.push(null);
|
||
ch = state.input.charCodeAt(state.position);
|
||
continue;
|
||
}
|
||
}
|
||
_line = state.line;
|
||
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
||
_result.push(state.result);
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
||
throwError(state, "bad indentation of a sequence entry");
|
||
} else if (state.lineIndent < nodeIndent) {
|
||
break;
|
||
}
|
||
}
|
||
if (detected) {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = "sequence";
|
||
state.result = _result;
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function readBlockMapping(state, nodeIndent, flowIndent) {
|
||
var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
ch = state.input.charCodeAt(state.position);
|
||
while (ch !== 0) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
_line = state.line;
|
||
_pos = state.position;
|
||
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
||
if (ch === 63) {
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
detected = true;
|
||
atExplicitKey = true;
|
||
allowCompact = true;
|
||
} else if (atExplicitKey) {
|
||
atExplicitKey = false;
|
||
allowCompact = true;
|
||
} else {
|
||
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
||
}
|
||
state.position += 1;
|
||
ch = following;
|
||
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
||
if (state.line === _line) {
|
||
ch = state.input.charCodeAt(state.position);
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (ch === 58) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (!is_WS_OR_EOL(ch)) {
|
||
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
||
}
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
detected = true;
|
||
atExplicitKey = false;
|
||
allowCompact = false;
|
||
keyTag = state.tag;
|
||
keyNode = state.result;
|
||
} else if (detected) {
|
||
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
||
} else {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
return true;
|
||
}
|
||
} else if (detected) {
|
||
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
||
} else {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
return true;
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
if (state.line === _line || state.lineIndent > nodeIndent) {
|
||
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
||
if (atExplicitKey) {
|
||
keyNode = state.result;
|
||
} else {
|
||
valueNode = state.result;
|
||
}
|
||
}
|
||
if (!atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
}
|
||
if (state.lineIndent > nodeIndent && ch !== 0) {
|
||
throwError(state, "bad indentation of a mapping entry");
|
||
} else if (state.lineIndent < nodeIndent) {
|
||
break;
|
||
}
|
||
}
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
||
}
|
||
if (detected) {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = "mapping";
|
||
state.result = _result;
|
||
}
|
||
return detected;
|
||
}
|
||
function readTagProperty(state) {
|
||
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 33) return false;
|
||
if (state.tag !== null) {
|
||
throwError(state, "duplication of a tag property");
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (ch === 60) {
|
||
isVerbatim = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else if (ch === 33) {
|
||
isNamed = true;
|
||
tagHandle = "!!";
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
tagHandle = "!";
|
||
}
|
||
_position = state.position;
|
||
if (isVerbatim) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 0 && ch !== 62);
|
||
if (state.position < state.length) {
|
||
tagName = state.input.slice(_position, state.position);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
throwError(state, "unexpected end of the stream within a verbatim tag");
|
||
}
|
||
} else {
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
if (ch === 33) {
|
||
if (!isNamed) {
|
||
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
||
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
||
throwError(state, "named tag handle cannot contain such characters");
|
||
}
|
||
isNamed = true;
|
||
_position = state.position + 1;
|
||
} else {
|
||
throwError(state, "tag suffix cannot contain exclamation marks");
|
||
}
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
tagName = state.input.slice(_position, state.position);
|
||
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
||
throwError(state, "tag suffix cannot contain flow indicator characters");
|
||
}
|
||
}
|
||
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
||
throwError(state, "tag name cannot contain such characters: " + tagName);
|
||
}
|
||
if (isVerbatim) {
|
||
state.tag = tagName;
|
||
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
||
state.tag = state.tagMap[tagHandle] + tagName;
|
||
} else if (tagHandle === "!") {
|
||
state.tag = "!" + tagName;
|
||
} else if (tagHandle === "!!") {
|
||
state.tag = "tag:yaml.org,2002:" + tagName;
|
||
} else {
|
||
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
||
}
|
||
return true;
|
||
}
|
||
function readAnchorProperty(state) {
|
||
var _position, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 38) return false;
|
||
if (state.anchor !== null) {
|
||
throwError(state, "duplication of an anchor property");
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (state.position === _position) {
|
||
throwError(state, "name of an anchor node must contain at least one character");
|
||
}
|
||
state.anchor = state.input.slice(_position, state.position);
|
||
return true;
|
||
}
|
||
function readAlias(state) {
|
||
var _position, alias, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 42) return false;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (state.position === _position) {
|
||
throwError(state, "name of an alias node must contain at least one character");
|
||
}
|
||
alias = state.input.slice(_position, state.position);
|
||
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
||
throwError(state, 'unidentified alias "' + alias + '"');
|
||
}
|
||
state.result = state.anchorMap[alias];
|
||
skipSeparationSpace(state, true, -1);
|
||
return true;
|
||
}
|
||
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
||
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent;
|
||
if (state.listener !== null) {
|
||
state.listener("open", state);
|
||
}
|
||
state.tag = null;
|
||
state.anchor = null;
|
||
state.kind = null;
|
||
state.result = null;
|
||
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
||
if (allowToSeek) {
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
atNewLine = true;
|
||
if (state.lineIndent > parentIndent) {
|
||
indentStatus = 1;
|
||
} else if (state.lineIndent === parentIndent) {
|
||
indentStatus = 0;
|
||
} else if (state.lineIndent < parentIndent) {
|
||
indentStatus = -1;
|
||
}
|
||
}
|
||
}
|
||
if (indentStatus === 1) {
|
||
while (readTagProperty(state) || readAnchorProperty(state)) {
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
atNewLine = true;
|
||
allowBlockCollections = allowBlockStyles;
|
||
if (state.lineIndent > parentIndent) {
|
||
indentStatus = 1;
|
||
} else if (state.lineIndent === parentIndent) {
|
||
indentStatus = 0;
|
||
} else if (state.lineIndent < parentIndent) {
|
||
indentStatus = -1;
|
||
}
|
||
} else {
|
||
allowBlockCollections = false;
|
||
}
|
||
}
|
||
}
|
||
if (allowBlockCollections) {
|
||
allowBlockCollections = atNewLine || allowCompact;
|
||
}
|
||
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
||
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
||
flowIndent = parentIndent;
|
||
} else {
|
||
flowIndent = parentIndent + 1;
|
||
}
|
||
blockIndent = state.position - state.lineStart;
|
||
if (indentStatus === 1) {
|
||
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
||
hasContent = true;
|
||
} else {
|
||
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
||
hasContent = true;
|
||
} else if (readAlias(state)) {
|
||
hasContent = true;
|
||
if (state.tag !== null || state.anchor !== null) {
|
||
throwError(state, "alias node should not have any properties");
|
||
}
|
||
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
||
hasContent = true;
|
||
if (state.tag === null) {
|
||
state.tag = "?";
|
||
}
|
||
}
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
}
|
||
} else if (indentStatus === 0) {
|
||
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
||
}
|
||
}
|
||
if (state.tag !== null && state.tag !== "!") {
|
||
if (state.tag === "?") {
|
||
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) {
|
||
type = state.implicitTypes[typeIndex];
|
||
if (type.resolve(state.result)) {
|
||
state.result = type.construct(state.result);
|
||
state.tag = type.tag;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
} else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
||
type = state.typeMap[state.kind || "fallback"][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 + '"');
|
||
}
|
||
if (!type.resolve(state.result)) {
|
||
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
||
} else {
|
||
state.result = type.construct(state.result);
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
}
|
||
} else {
|
||
throwError(state, "unknown tag !<" + state.tag + ">");
|
||
}
|
||
}
|
||
if (state.listener !== null) {
|
||
state.listener("close", state);
|
||
}
|
||
return state.tag !== null || state.anchor !== null || hasContent;
|
||
}
|
||
function readDocument(state) {
|
||
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
||
state.version = null;
|
||
state.checkLineBreaks = state.legacy;
|
||
state.tagMap = {};
|
||
state.anchorMap = {};
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (state.lineIndent > 0 || ch !== 37) {
|
||
break;
|
||
}
|
||
hasDirectives = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
directiveName = state.input.slice(_position, state.position);
|
||
directiveArgs = [];
|
||
if (directiveName.length < 1) {
|
||
throwError(state, "directive name must not be less than one character in length");
|
||
}
|
||
while (ch !== 0) {
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (ch === 35) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 0 && !is_EOL(ch));
|
||
break;
|
||
}
|
||
if (is_EOL(ch)) break;
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
directiveArgs.push(state.input.slice(_position, state.position));
|
||
}
|
||
if (ch !== 0) readLineBreak(state);
|
||
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
||
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
||
} else {
|
||
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
||
}
|
||
}
|
||
skipSeparationSpace(state, true, -1);
|
||
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
||
state.position += 3;
|
||
skipSeparationSpace(state, true, -1);
|
||
} else if (hasDirectives) {
|
||
throwError(state, "directives end mark is expected");
|
||
}
|
||
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
||
skipSeparationSpace(state, true, -1);
|
||
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
||
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
||
}
|
||
state.documents.push(state.result);
|
||
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
if (state.input.charCodeAt(state.position) === 46) {
|
||
state.position += 3;
|
||
skipSeparationSpace(state, true, -1);
|
||
}
|
||
return;
|
||
}
|
||
if (state.position < state.length - 1) {
|
||
throwError(state, "end of the stream or a document separator is expected");
|
||
} else {
|
||
return;
|
||
}
|
||
}
|
||
function loadDocuments(input, options2) {
|
||
input = String(input);
|
||
options2 = options2 || {};
|
||
if (input.length !== 0) {
|
||
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
||
input += "\n";
|
||
}
|
||
if (input.charCodeAt(0) === 65279) {
|
||
input = input.slice(1);
|
||
}
|
||
}
|
||
var state = new State(input, options2);
|
||
var nullpos = input.indexOf("\0");
|
||
if (nullpos !== -1) {
|
||
state.position = nullpos;
|
||
throwError(state, "null byte is not allowed in input");
|
||
}
|
||
state.input += "\0";
|
||
while (state.input.charCodeAt(state.position) === 32) {
|
||
state.lineIndent += 1;
|
||
state.position += 1;
|
||
}
|
||
while (state.position < state.length - 1) {
|
||
readDocument(state);
|
||
}
|
||
return state.documents;
|
||
}
|
||
function loadAll(input, iterator, options2) {
|
||
if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
|
||
options2 = iterator;
|
||
iterator = null;
|
||
}
|
||
var documents = loadDocuments(input, options2);
|
||
if (typeof iterator !== "function") {
|
||
return documents;
|
||
}
|
||
for (var index = 0, length = documents.length; index < length; index += 1) {
|
||
iterator(documents[index]);
|
||
}
|
||
}
|
||
function load(input, options2) {
|
||
var documents = loadDocuments(input, options2);
|
||
if (documents.length === 0) {
|
||
return void 0;
|
||
} else if (documents.length === 1) {
|
||
return documents[0];
|
||
}
|
||
throw new YAMLException("expected a single document in the stream, but found more");
|
||
}
|
||
function safeLoadAll(input, iterator, options2) {
|
||
if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
|
||
options2 = iterator;
|
||
iterator = null;
|
||
}
|
||
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
||
}
|
||
function safeLoad(input, options2) {
|
||
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
||
}
|
||
module2.exports.loadAll = loadAll;
|
||
module2.exports.load = load;
|
||
module2.exports.safeLoadAll = safeLoadAll;
|
||
module2.exports.safeLoad = safeLoad;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js
|
||
var require_dumper = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) {
|
||
"use strict";
|
||
var common = require_common();
|
||
var YAMLException = require_exception();
|
||
var DEFAULT_FULL_SCHEMA = require_default_full();
|
||
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
||
var _toString = Object.prototype.toString;
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var CHAR_TAB = 9;
|
||
var CHAR_LINE_FEED = 10;
|
||
var CHAR_CARRIAGE_RETURN = 13;
|
||
var CHAR_SPACE = 32;
|
||
var CHAR_EXCLAMATION = 33;
|
||
var CHAR_DOUBLE_QUOTE = 34;
|
||
var CHAR_SHARP = 35;
|
||
var CHAR_PERCENT = 37;
|
||
var CHAR_AMPERSAND = 38;
|
||
var CHAR_SINGLE_QUOTE = 39;
|
||
var CHAR_ASTERISK = 42;
|
||
var CHAR_COMMA = 44;
|
||
var CHAR_MINUS = 45;
|
||
var CHAR_COLON = 58;
|
||
var CHAR_EQUALS = 61;
|
||
var CHAR_GREATER_THAN = 62;
|
||
var CHAR_QUESTION = 63;
|
||
var CHAR_COMMERCIAL_AT = 64;
|
||
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
||
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
||
var CHAR_GRAVE_ACCENT = 96;
|
||
var CHAR_LEFT_CURLY_BRACKET = 123;
|
||
var CHAR_VERTICAL_LINE = 124;
|
||
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
||
var ESCAPE_SEQUENCES = {};
|
||
ESCAPE_SEQUENCES[0] = "\\0";
|
||
ESCAPE_SEQUENCES[7] = "\\a";
|
||
ESCAPE_SEQUENCES[8] = "\\b";
|
||
ESCAPE_SEQUENCES[9] = "\\t";
|
||
ESCAPE_SEQUENCES[10] = "\\n";
|
||
ESCAPE_SEQUENCES[11] = "\\v";
|
||
ESCAPE_SEQUENCES[12] = "\\f";
|
||
ESCAPE_SEQUENCES[13] = "\\r";
|
||
ESCAPE_SEQUENCES[27] = "\\e";
|
||
ESCAPE_SEQUENCES[34] = '\\"';
|
||
ESCAPE_SEQUENCES[92] = "\\\\";
|
||
ESCAPE_SEQUENCES[133] = "\\N";
|
||
ESCAPE_SEQUENCES[160] = "\\_";
|
||
ESCAPE_SEQUENCES[8232] = "\\L";
|
||
ESCAPE_SEQUENCES[8233] = "\\P";
|
||
var DEPRECATED_BOOLEANS_SYNTAX = [
|
||
"y",
|
||
"Y",
|
||
"yes",
|
||
"Yes",
|
||
"YES",
|
||
"on",
|
||
"On",
|
||
"ON",
|
||
"n",
|
||
"N",
|
||
"no",
|
||
"No",
|
||
"NO",
|
||
"off",
|
||
"Off",
|
||
"OFF"
|
||
];
|
||
function compileStyleMap(schema, map) {
|
||
var result, keys, index, length, tag, style, type;
|
||
if (map === null) return {};
|
||
result = {};
|
||
keys = Object.keys(map);
|
||
for (index = 0, length = keys.length; index < length; index += 1) {
|
||
tag = keys[index];
|
||
style = String(map[tag]);
|
||
if (tag.slice(0, 2) === "!!") {
|
||
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
||
}
|
||
type = schema.compiledTypeMap["fallback"][tag];
|
||
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
||
style = type.styleAliases[style];
|
||
}
|
||
result[tag] = style;
|
||
}
|
||
return result;
|
||
}
|
||
function encodeHex(character) {
|
||
var string, handle, length;
|
||
string = character.toString(16).toUpperCase();
|
||
if (character <= 255) {
|
||
handle = "x";
|
||
length = 2;
|
||
} else if (character <= 65535) {
|
||
handle = "u";
|
||
length = 4;
|
||
} else if (character <= 4294967295) {
|
||
handle = "U";
|
||
length = 8;
|
||
} else {
|
||
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
||
}
|
||
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
||
}
|
||
function State(options2) {
|
||
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
||
this.indent = Math.max(1, options2["indent"] || 2);
|
||
this.noArrayIndent = options2["noArrayIndent"] || false;
|
||
this.skipInvalid = options2["skipInvalid"] || false;
|
||
this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"];
|
||
this.styleMap = compileStyleMap(this.schema, options2["styles"] || null);
|
||
this.sortKeys = options2["sortKeys"] || false;
|
||
this.lineWidth = options2["lineWidth"] || 80;
|
||
this.noRefs = options2["noRefs"] || false;
|
||
this.noCompatMode = options2["noCompatMode"] || false;
|
||
this.condenseFlow = options2["condenseFlow"] || false;
|
||
this.implicitTypes = this.schema.compiledImplicit;
|
||
this.explicitTypes = this.schema.compiledExplicit;
|
||
this.tag = null;
|
||
this.result = "";
|
||
this.duplicates = [];
|
||
this.usedDuplicates = null;
|
||
}
|
||
function indentString(string, spaces) {
|
||
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
||
while (position < length) {
|
||
next = string.indexOf("\n", position);
|
||
if (next === -1) {
|
||
line = string.slice(position);
|
||
position = length;
|
||
} else {
|
||
line = string.slice(position, next + 1);
|
||
position = next + 1;
|
||
}
|
||
if (line.length && line !== "\n") result += ind;
|
||
result += line;
|
||
}
|
||
return result;
|
||
}
|
||
function generateNextLine(state, level) {
|
||
return "\n" + common.repeat(" ", state.indent * level);
|
||
}
|
||
function testImplicitResolving(state, str2) {
|
||
var index, length, type;
|
||
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
||
type = state.implicitTypes[index];
|
||
if (type.resolve(str2)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function isWhitespace(c) {
|
||
return c === CHAR_SPACE || c === CHAR_TAB;
|
||
}
|
||
function isPrintable(c) {
|
||
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
|
||
}
|
||
function isNsChar(c) {
|
||
return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
||
}
|
||
function isPlainSafe(c, prev) {
|
||
return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
|
||
}
|
||
function isPlainSafeFirst(c) {
|
||
return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && 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 && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
||
}
|
||
function needIndentIndicator(string) {
|
||
var leadingSpaceRe = /^\n* /;
|
||
return leadingSpaceRe.test(string);
|
||
}
|
||
var STYLE_PLAIN = 1;
|
||
var STYLE_SINGLE = 2;
|
||
var STYLE_LITERAL = 3;
|
||
var STYLE_FOLDED = 4;
|
||
var STYLE_DOUBLE = 5;
|
||
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
||
var i;
|
||
var char, prev_char;
|
||
var hasLineBreak = false;
|
||
var hasFoldableLine = false;
|
||
var shouldTrackWidth = lineWidth !== -1;
|
||
var previousLineBreak = -1;
|
||
var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
|
||
if (singleLineOnly) {
|
||
for (i = 0; i < string.length; i++) {
|
||
char = string.charCodeAt(i);
|
||
if (!isPrintable(char)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
||
plain = plain && isPlainSafe(char, prev_char);
|
||
}
|
||
} else {
|
||
for (i = 0; i < string.length; i++) {
|
||
char = string.charCodeAt(i);
|
||
if (char === CHAR_LINE_FEED) {
|
||
hasLineBreak = true;
|
||
if (shouldTrackWidth) {
|
||
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
||
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
||
previousLineBreak = i;
|
||
}
|
||
} else if (!isPrintable(char)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
||
plain = plain && isPlainSafe(char, prev_char);
|
||
}
|
||
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
||
}
|
||
if (!hasLineBreak && !hasFoldableLine) {
|
||
return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
|
||
}
|
||
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
||
}
|
||
function writeScalar(state, string, level, iskey) {
|
||
state.dump = function() {
|
||
if (string.length === 0) {
|
||
return "''";
|
||
}
|
||
if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
|
||
return "'" + string + "'";
|
||
}
|
||
var indent = state.indent * Math.max(1, level);
|
||
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
||
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
||
function testAmbiguity(string2) {
|
||
return testImplicitResolving(state, string2);
|
||
}
|
||
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
||
case STYLE_PLAIN:
|
||
return string;
|
||
case STYLE_SINGLE:
|
||
return "'" + string.replace(/'/g, "''") + "'";
|
||
case STYLE_LITERAL:
|
||
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
||
case STYLE_FOLDED:
|
||
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
||
case STYLE_DOUBLE:
|
||
return '"' + escapeString(string, lineWidth) + '"';
|
||
default:
|
||
throw new YAMLException("impossible error: invalid scalar style");
|
||
}
|
||
}();
|
||
}
|
||
function blockHeader(string, indentPerLevel) {
|
||
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
||
var clip = string[string.length - 1] === "\n";
|
||
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
||
var chomp = keep ? "+" : clip ? "" : "-";
|
||
return indentIndicator + chomp + "\n";
|
||
}
|
||
function dropEndingNewline(string) {
|
||
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
||
}
|
||
function foldString(string, width) {
|
||
var lineRe = /(\n+)([^\n]*)/g;
|
||
var result = function() {
|
||
var nextLF = string.indexOf("\n");
|
||
nextLF = nextLF !== -1 ? nextLF : string.length;
|
||
lineRe.lastIndex = nextLF;
|
||
return foldLine(string.slice(0, nextLF), width);
|
||
}();
|
||
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
||
var moreIndented;
|
||
var match;
|
||
while (match = lineRe.exec(string)) {
|
||
var prefix = match[1], line = match[2];
|
||
moreIndented = line[0] === " ";
|
||
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
||
prevMoreIndented = moreIndented;
|
||
}
|
||
return result;
|
||
}
|
||
function foldLine(line, width) {
|
||
if (line === "" || line[0] === " ") return line;
|
||
var breakRe = / [^ ]/g;
|
||
var match;
|
||
var start = 0, end, curr = 0, next = 0;
|
||
var result = "";
|
||
while (match = breakRe.exec(line)) {
|
||
next = match.index;
|
||
if (next - start > width) {
|
||
end = curr > start ? curr : next;
|
||
result += "\n" + line.slice(start, end);
|
||
start = end + 1;
|
||
}
|
||
curr = next;
|
||
}
|
||
result += "\n";
|
||
if (line.length - start > width && curr > start) {
|
||
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
||
} else {
|
||
result += line.slice(start);
|
||
}
|
||
return result.slice(1);
|
||
}
|
||
function escapeString(string) {
|
||
var result = "";
|
||
var char, nextChar;
|
||
var escapeSeq;
|
||
for (var i = 0; i < string.length; i++) {
|
||
char = string.charCodeAt(i);
|
||
if (char >= 55296 && char <= 56319) {
|
||
nextChar = string.charCodeAt(i + 1);
|
||
if (nextChar >= 56320 && nextChar <= 57343) {
|
||
result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
||
i++;
|
||
continue;
|
||
}
|
||
}
|
||
escapeSeq = ESCAPE_SEQUENCES[char];
|
||
result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
|
||
}
|
||
return result;
|
||
}
|
||
function writeFlowSequence(state, level, object) {
|
||
var _result = "", _tag = state.tag, index, length;
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
if (writeNode(state, level, object[index], false, false)) {
|
||
if (index !== 0) _result += "," + (!state.condenseFlow ? " " : "");
|
||
_result += state.dump;
|
||
}
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = "[" + _result + "]";
|
||
}
|
||
function writeBlockSequence(state, level, object, compact) {
|
||
var _result = "", _tag = state.tag, index, length;
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
if (writeNode(state, level + 1, object[index], true, true)) {
|
||
if (!compact || index !== 0) {
|
||
_result += generateNextLine(state, level);
|
||
}
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
_result += "-";
|
||
} else {
|
||
_result += "- ";
|
||
}
|
||
_result += state.dump;
|
||
}
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = _result || "[]";
|
||
}
|
||
function writeFlowMapping(state, level, object) {
|
||
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
pairBuffer = "";
|
||
if (index !== 0) pairBuffer += ", ";
|
||
if (state.condenseFlow) pairBuffer += '"';
|
||
objectKey = objectKeyList[index];
|
||
objectValue = object[objectKey];
|
||
if (!writeNode(state, level, objectKey, false, false)) {
|
||
continue;
|
||
}
|
||
if (state.dump.length > 1024) pairBuffer += "? ";
|
||
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
||
if (!writeNode(state, level, objectValue, false, false)) {
|
||
continue;
|
||
}
|
||
pairBuffer += state.dump;
|
||
_result += pairBuffer;
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = "{" + _result + "}";
|
||
}
|
||
function writeBlockMapping(state, level, object, compact) {
|
||
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
||
if (state.sortKeys === true) {
|
||
objectKeyList.sort();
|
||
} else if (typeof state.sortKeys === "function") {
|
||
objectKeyList.sort(state.sortKeys);
|
||
} else if (state.sortKeys) {
|
||
throw new YAMLException("sortKeys must be a boolean or a function");
|
||
}
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
pairBuffer = "";
|
||
if (!compact || index !== 0) {
|
||
pairBuffer += generateNextLine(state, level);
|
||
}
|
||
objectKey = objectKeyList[index];
|
||
objectValue = object[objectKey];
|
||
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
||
continue;
|
||
}
|
||
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
||
if (explicitPair) {
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
pairBuffer += "?";
|
||
} else {
|
||
pairBuffer += "? ";
|
||
}
|
||
}
|
||
pairBuffer += state.dump;
|
||
if (explicitPair) {
|
||
pairBuffer += generateNextLine(state, level);
|
||
}
|
||
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
||
continue;
|
||
}
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
pairBuffer += ":";
|
||
} else {
|
||
pairBuffer += ": ";
|
||
}
|
||
pairBuffer += state.dump;
|
||
_result += pairBuffer;
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = _result || "{}";
|
||
}
|
||
function detectType(state, object, explicit) {
|
||
var _result, typeList, index, length, type, style;
|
||
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
||
for (index = 0, length = typeList.length; index < length; index += 1) {
|
||
type = typeList[index];
|
||
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
||
state.tag = explicit ? type.tag : "?";
|
||
if (type.represent) {
|
||
style = state.styleMap[type.tag] || type.defaultStyle;
|
||
if (_toString.call(type.represent) === "[object Function]") {
|
||
_result = type.represent(object, style);
|
||
} else if (_hasOwnProperty.call(type.represent, style)) {
|
||
_result = type.represent[style](object, style);
|
||
} else {
|
||
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
||
}
|
||
state.dump = _result;
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function writeNode(state, level, object, block, compact, iskey) {
|
||
state.tag = null;
|
||
state.dump = object;
|
||
if (!detectType(state, object, false)) {
|
||
detectType(state, object, true);
|
||
}
|
||
var type = _toString.call(state.dump);
|
||
if (block) {
|
||
block = state.flowLevel < 0 || state.flowLevel > level;
|
||
}
|
||
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
||
if (objectOrArray) {
|
||
duplicateIndex = state.duplicates.indexOf(object);
|
||
duplicate = duplicateIndex !== -1;
|
||
}
|
||
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
||
compact = false;
|
||
}
|
||
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
||
state.dump = "*ref_" + duplicateIndex;
|
||
} else {
|
||
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
||
state.usedDuplicates[duplicateIndex] = true;
|
||
}
|
||
if (type === "[object Object]") {
|
||
if (block && Object.keys(state.dump).length !== 0) {
|
||
writeBlockMapping(state, level, state.dump, compact);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + state.dump;
|
||
}
|
||
} else {
|
||
writeFlowMapping(state, level, state.dump);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
||
}
|
||
}
|
||
} 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);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + state.dump;
|
||
}
|
||
} else {
|
||
writeFlowSequence(state, arrayLevel, state.dump);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
||
}
|
||
}
|
||
} else if (type === "[object String]") {
|
||
if (state.tag !== "?") {
|
||
writeScalar(state, state.dump, level, iskey);
|
||
}
|
||
} else {
|
||
if (state.skipInvalid) return false;
|
||
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
||
}
|
||
if (state.tag !== null && state.tag !== "?") {
|
||
state.dump = "!<" + state.tag + "> " + state.dump;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
function getDuplicateReferences(object, state) {
|
||
var objects = [], duplicatesIndexes = [], index, length;
|
||
inspectNode(object, objects, duplicatesIndexes);
|
||
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
||
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
||
}
|
||
state.usedDuplicates = new Array(length);
|
||
}
|
||
function inspectNode(object, objects, duplicatesIndexes) {
|
||
var objectKeyList, index, length;
|
||
if (object !== null && typeof object === "object") {
|
||
index = objects.indexOf(object);
|
||
if (index !== -1) {
|
||
if (duplicatesIndexes.indexOf(index) === -1) {
|
||
duplicatesIndexes.push(index);
|
||
}
|
||
} else {
|
||
objects.push(object);
|
||
if (Array.isArray(object)) {
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
inspectNode(object[index], objects, duplicatesIndexes);
|
||
}
|
||
} else {
|
||
objectKeyList = Object.keys(object);
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
function dump(input, options2) {
|
||
options2 = options2 || {};
|
||
var state = new State(options2);
|
||
if (!state.noRefs) getDuplicateReferences(input, state);
|
||
if (writeNode(state, 0, input, true, true)) return state.dump + "\n";
|
||
return "";
|
||
}
|
||
function safeDump(input, options2) {
|
||
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
||
}
|
||
module2.exports.dump = dump;
|
||
module2.exports.safeDump = safeDump;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js
|
||
var require_js_yaml = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) {
|
||
"use strict";
|
||
var loader = require_loader();
|
||
var dumper = require_dumper();
|
||
function deprecated(name) {
|
||
return function() {
|
||
throw new Error("Function " + name + " is deprecated and cannot be used.");
|
||
};
|
||
}
|
||
module2.exports.Type = require_type();
|
||
module2.exports.Schema = require_schema();
|
||
module2.exports.FAILSAFE_SCHEMA = require_failsafe();
|
||
module2.exports.JSON_SCHEMA = require_json();
|
||
module2.exports.CORE_SCHEMA = require_core();
|
||
module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
|
||
module2.exports.DEFAULT_FULL_SCHEMA = require_default_full();
|
||
module2.exports.load = loader.load;
|
||
module2.exports.loadAll = loader.loadAll;
|
||
module2.exports.safeLoad = loader.safeLoad;
|
||
module2.exports.safeLoadAll = loader.safeLoadAll;
|
||
module2.exports.dump = dumper.dump;
|
||
module2.exports.safeDump = dumper.safeDump;
|
||
module2.exports.YAMLException = require_exception();
|
||
module2.exports.MINIMAL_SCHEMA = require_failsafe();
|
||
module2.exports.SAFE_SCHEMA = require_default_safe();
|
||
module2.exports.DEFAULT_SCHEMA = require_default_full();
|
||
module2.exports.scan = deprecated("scan");
|
||
module2.exports.parse = deprecated("parse");
|
||
module2.exports.compose = deprecated("compose");
|
||
module2.exports.addConstructor = deprecated("addConstructor");
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/node_modules/js-yaml/index.js
|
||
var require_js_yaml2 = __commonJS({
|
||
"node_modules/gray-matter/node_modules/js-yaml/index.js"(exports2, module2) {
|
||
"use strict";
|
||
var yaml2 = require_js_yaml();
|
||
module2.exports = yaml2;
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/engines.js
|
||
var require_engines = __commonJS({
|
||
"node_modules/gray-matter/lib/engines.js"(exports, module) {
|
||
"use strict";
|
||
var yaml = require_js_yaml2();
|
||
var engines = exports = module.exports;
|
||
engines.yaml = {
|
||
parse: yaml.safeLoad.bind(yaml),
|
||
stringify: yaml.safeDump.bind(yaml)
|
||
};
|
||
engines.json = {
|
||
parse: JSON.parse.bind(JSON),
|
||
stringify: function(obj, options2) {
|
||
const opts = Object.assign({ replacer: null, space: 2 }, options2);
|
||
return JSON.stringify(obj, opts.replacer, opts.space);
|
||
}
|
||
};
|
||
engines.javascript = {
|
||
parse: function parse(str, options, wrap) {
|
||
try {
|
||
if (wrap !== false) {
|
||
str = "(function() {\nreturn " + str.trim() + ";\n}());";
|
||
}
|
||
return eval(str) || {};
|
||
} catch (err) {
|
||
if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) {
|
||
return parse(str, options, false);
|
||
}
|
||
throw new SyntaxError(err);
|
||
}
|
||
},
|
||
stringify: function() {
|
||
throw new Error("stringifying JavaScript is not supported");
|
||
}
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/strip-bom-string/index.js
|
||
var require_strip_bom_string = __commonJS({
|
||
"node_modules/strip-bom-string/index.js"(exports2, module2) {
|
||
"use strict";
|
||
module2.exports = function(str2) {
|
||
if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") {
|
||
return str2.slice(1);
|
||
}
|
||
return str2;
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/utils.js
|
||
var require_utils = __commonJS({
|
||
"node_modules/gray-matter/lib/utils.js"(exports2) {
|
||
"use strict";
|
||
var stripBom = require_strip_bom_string();
|
||
var typeOf = require_kind_of();
|
||
exports2.define = function(obj, key, val) {
|
||
Reflect.defineProperty(obj, key, {
|
||
enumerable: false,
|
||
configurable: true,
|
||
writable: true,
|
||
value: val
|
||
});
|
||
};
|
||
exports2.isBuffer = function(val) {
|
||
return typeOf(val) === "buffer";
|
||
};
|
||
exports2.isObject = function(val) {
|
||
return typeOf(val) === "object";
|
||
};
|
||
exports2.toBuffer = function(input) {
|
||
return typeof input === "string" ? Buffer.from(input) : input;
|
||
};
|
||
exports2.toString = function(input) {
|
||
if (exports2.isBuffer(input)) return stripBom(String(input));
|
||
if (typeof input !== "string") {
|
||
throw new TypeError("expected input to be a string or buffer");
|
||
}
|
||
return stripBom(input);
|
||
};
|
||
exports2.arrayify = function(val) {
|
||
return val ? Array.isArray(val) ? val : [val] : [];
|
||
};
|
||
exports2.startsWith = function(str2, substr, len) {
|
||
if (typeof len !== "number") len = substr.length;
|
||
return str2.slice(0, len) === substr;
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/defaults.js
|
||
var require_defaults = __commonJS({
|
||
"node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
||
"use strict";
|
||
var engines2 = require_engines();
|
||
var utils = require_utils();
|
||
module2.exports = function(options2) {
|
||
const opts = Object.assign({}, options2);
|
||
opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || "---");
|
||
if (opts.delimiters.length === 1) {
|
||
opts.delimiters.push(opts.delimiters[0]);
|
||
}
|
||
opts.language = (opts.language || opts.lang || "yaml").toLowerCase();
|
||
opts.engines = Object.assign({}, engines2, opts.parsers, opts.engines);
|
||
return opts;
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/engine.js
|
||
var require_engine = __commonJS({
|
||
"node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
||
"use strict";
|
||
module2.exports = function(name, options2) {
|
||
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
||
if (typeof engine === "undefined") {
|
||
throw new Error('gray-matter engine "' + name + '" is not registered');
|
||
}
|
||
if (typeof engine === "function") {
|
||
engine = { parse: engine };
|
||
}
|
||
return engine;
|
||
};
|
||
function aliase(name) {
|
||
switch (name.toLowerCase()) {
|
||
case "js":
|
||
case "javascript":
|
||
return "javascript";
|
||
case "coffee":
|
||
case "coffeescript":
|
||
case "cson":
|
||
return "coffee";
|
||
case "yaml":
|
||
case "yml":
|
||
return "yaml";
|
||
default: {
|
||
return name;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/stringify.js
|
||
var require_stringify = __commonJS({
|
||
"node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
||
"use strict";
|
||
var typeOf = require_kind_of();
|
||
var getEngine = require_engine();
|
||
var defaults = require_defaults();
|
||
module2.exports = function(file, data, options2) {
|
||
if (data == null && options2 == null) {
|
||
switch (typeOf(file)) {
|
||
case "object":
|
||
data = file.data;
|
||
options2 = {};
|
||
break;
|
||
case "string":
|
||
return file;
|
||
default: {
|
||
throw new TypeError("expected file to be a string or object");
|
||
}
|
||
}
|
||
}
|
||
const str2 = file.content;
|
||
const opts = defaults(options2);
|
||
if (data == null) {
|
||
if (!opts.data) return file;
|
||
data = opts.data;
|
||
}
|
||
const language = file.language || opts.language;
|
||
const engine = getEngine(language, opts);
|
||
if (typeof engine.stringify !== "function") {
|
||
throw new TypeError('expected "' + language + '.stringify" to be a function');
|
||
}
|
||
data = Object.assign({}, file.data, data);
|
||
const open = opts.delimiters[0];
|
||
const close = opts.delimiters[1];
|
||
const matter = engine.stringify(data, options2).trim();
|
||
let buf = "";
|
||
if (matter !== "{}") {
|
||
buf = newline(open) + newline(matter) + newline(close);
|
||
}
|
||
if (typeof file.excerpt === "string" && file.excerpt !== "") {
|
||
if (str2.indexOf(file.excerpt.trim()) === -1) {
|
||
buf += newline(file.excerpt) + newline(close);
|
||
}
|
||
}
|
||
return buf + newline(str2);
|
||
};
|
||
function newline(str2) {
|
||
return str2.slice(-1) !== "\n" ? str2 + "\n" : str2;
|
||
}
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/excerpt.js
|
||
var require_excerpt = __commonJS({
|
||
"node_modules/gray-matter/lib/excerpt.js"(exports2, module2) {
|
||
"use strict";
|
||
var defaults = require_defaults();
|
||
module2.exports = function(file, options2) {
|
||
const opts = defaults(options2);
|
||
if (file.data == null) {
|
||
file.data = {};
|
||
}
|
||
if (typeof opts.excerpt === "function") {
|
||
return opts.excerpt(file, opts);
|
||
}
|
||
const sep = file.data.excerpt_separator || opts.excerpt_separator;
|
||
if (sep == null && (opts.excerpt === false || opts.excerpt == null)) {
|
||
return file;
|
||
}
|
||
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep || opts.delimiters[0];
|
||
const idx = file.content.indexOf(delimiter);
|
||
if (idx !== -1) {
|
||
file.excerpt = file.content.slice(0, idx);
|
||
}
|
||
return file;
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/to-file.js
|
||
var require_to_file = __commonJS({
|
||
"node_modules/gray-matter/lib/to-file.js"(exports2, module2) {
|
||
"use strict";
|
||
var typeOf = require_kind_of();
|
||
var stringify = require_stringify();
|
||
var utils = require_utils();
|
||
module2.exports = function(file) {
|
||
if (typeOf(file) !== "object") {
|
||
file = { content: file };
|
||
}
|
||
if (typeOf(file.data) !== "object") {
|
||
file.data = {};
|
||
}
|
||
if (file.contents && file.content == null) {
|
||
file.content = file.contents;
|
||
}
|
||
utils.define(file, "orig", utils.toBuffer(file.content));
|
||
utils.define(file, "language", file.language || "");
|
||
utils.define(file, "matter", file.matter || "");
|
||
utils.define(file, "stringify", function(data, options2) {
|
||
if (options2 && options2.language) {
|
||
file.language = options2.language;
|
||
}
|
||
return stringify(file, data, options2);
|
||
});
|
||
file.content = utils.toString(file.content);
|
||
file.isEmpty = false;
|
||
file.excerpt = "";
|
||
return file;
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/lib/parse.js
|
||
var require_parse = __commonJS({
|
||
"node_modules/gray-matter/lib/parse.js"(exports2, module2) {
|
||
"use strict";
|
||
var getEngine = require_engine();
|
||
var defaults = require_defaults();
|
||
module2.exports = function(language, str2, options2) {
|
||
const opts = defaults(options2);
|
||
const engine = getEngine(language, opts);
|
||
if (typeof engine.parse !== "function") {
|
||
throw new TypeError('expected "' + language + '.parse" to be a function');
|
||
}
|
||
return engine.parse(str2, opts);
|
||
};
|
||
}
|
||
});
|
||
|
||
// node_modules/gray-matter/index.js
|
||
var require_gray_matter = __commonJS({
|
||
"node_modules/gray-matter/index.js"(exports2, module2) {
|
||
var fs = require_fs();
|
||
var sections = require_section_matter();
|
||
var defaults = require_defaults();
|
||
var stringify = require_stringify();
|
||
var excerpt = require_excerpt();
|
||
var engines2 = require_engines();
|
||
var toFile = require_to_file();
|
||
var parse2 = require_parse();
|
||
var utils = require_utils();
|
||
function matter(input, options2) {
|
||
if (input === "") {
|
||
return { data: {}, content: input, excerpt: "", orig: input };
|
||
}
|
||
let file = toFile(input);
|
||
const cached = matter.cache[file.content];
|
||
if (!options2) {
|
||
if (cached) {
|
||
file = Object.assign({}, cached);
|
||
file.orig = cached.orig;
|
||
return file;
|
||
}
|
||
matter.cache[file.content] = file;
|
||
}
|
||
return parseMatter(file, options2);
|
||
}
|
||
function parseMatter(file, options2) {
|
||
const opts = defaults(options2);
|
||
const open = opts.delimiters[0];
|
||
const close = "\n" + opts.delimiters[1];
|
||
let str2 = file.content;
|
||
if (opts.language) {
|
||
file.language = opts.language;
|
||
}
|
||
const openLen = open.length;
|
||
if (!utils.startsWith(str2, open, openLen)) {
|
||
excerpt(file, opts);
|
||
return file;
|
||
}
|
||
if (str2.charAt(openLen) === open.slice(-1)) {
|
||
return file;
|
||
}
|
||
str2 = str2.slice(openLen);
|
||
const len = str2.length;
|
||
const language = matter.language(str2, opts);
|
||
if (language.name) {
|
||
file.language = language.name;
|
||
str2 = str2.slice(language.raw.length);
|
||
}
|
||
let closeIndex = str2.indexOf(close);
|
||
if (closeIndex === -1) {
|
||
closeIndex = len;
|
||
}
|
||
file.matter = str2.slice(0, closeIndex);
|
||
const block = file.matter.replace(/^\s*#[^\n]+/gm, "").trim();
|
||
if (block === "") {
|
||
file.isEmpty = true;
|
||
file.empty = file.content;
|
||
file.data = {};
|
||
} else {
|
||
file.data = parse2(file.language, file.matter, opts);
|
||
}
|
||
if (closeIndex === len) {
|
||
file.content = "";
|
||
} else {
|
||
file.content = str2.slice(closeIndex + close.length);
|
||
if (file.content[0] === "\r") {
|
||
file.content = file.content.slice(1);
|
||
}
|
||
if (file.content[0] === "\n") {
|
||
file.content = file.content.slice(1);
|
||
}
|
||
}
|
||
excerpt(file, opts);
|
||
if (opts.sections === true || typeof opts.section === "function") {
|
||
sections(file, opts.section);
|
||
}
|
||
return file;
|
||
}
|
||
matter.engines = engines2;
|
||
matter.stringify = function(file, data, options2) {
|
||
if (typeof file === "string") file = matter(file, options2);
|
||
return stringify(file, data, options2);
|
||
};
|
||
matter.read = function(filepath, options2) {
|
||
const str2 = fs.readFileSync(filepath, "utf8");
|
||
const file = matter(str2, options2);
|
||
file.path = filepath;
|
||
return file;
|
||
};
|
||
matter.test = function(str2, options2) {
|
||
return utils.startsWith(str2, defaults(options2).delimiters[0]);
|
||
};
|
||
matter.language = function(str2, options2) {
|
||
const opts = defaults(options2);
|
||
const open = opts.delimiters[0];
|
||
if (matter.test(str2)) {
|
||
str2 = str2.slice(open.length);
|
||
}
|
||
const language = str2.slice(0, str2.search(/\r?\n/));
|
||
return {
|
||
raw: language,
|
||
name: language ? language.trim() : ""
|
||
};
|
||
};
|
||
matter.cache = {};
|
||
matter.clearCache = function() {
|
||
matter.cache = {};
|
||
};
|
||
module2.exports = matter;
|
||
}
|
||
});
|
||
export default require_gray_matter();
|
||
/*! Bundled license information:
|
||
|
||
is-extendable/index.js:
|
||
(*!
|
||
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
||
*
|
||
* Copyright (c) 2015, Jon Schlinkert.
|
||
* Licensed under the MIT License.
|
||
*)
|
||
|
||
strip-bom-string/index.js:
|
||
(*!
|
||
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
||
*
|
||
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
||
* Released under the MIT License.
|
||
*)
|
||
*/
|
||
//# sourceMappingURL=gray-matter.js.map
|