@wix/cli
Version:
CLI tool for building Wix sites and applications
1,541 lines (1,522 loc) • 337 kB
JavaScript
import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
useDevCenterClient
} from "./chunk-SBWS2IWP.js";
import {
wixCliAction,
wixCliAppFlowStepsAnswers
} from "./chunk-GO3JYNZE.js";
import {
createPackageManager,
getRepoType
} from "./chunk-K6SIDI2C.js";
import "./chunk-RWTQFIPN.js";
import "./chunk-W54PG6O5.js";
import {
require_lodash
} from "./chunk-J5YVHTPQ.js";
import {
useHttpClient
} from "./chunk-NPIBHDAX.js";
import {
BackOfficeHostingPlatforms,
ComponentType,
getExtensionPath,
useProjectModel
} from "./chunk-BUXKC4SM.js";
import {
globby
} from "./chunk-PIXNEJ52.js";
import "./chunk-HWVLWVTF.js";
import {
pRetry,
resolveUrl,
serializer,
toURLSearchParams
} from "./chunk-PLPLA7N3.js";
import {
useBiLogger,
useErrorReporter
} from "./chunk-EH3J5VW4.js";
import "./chunk-CCOOZLEQ.js";
import "./chunk-75K4NCRA.js";
import "./chunk-KJ37XZQA.js";
import {
AsyncCallbackStatus,
Box_default,
ConfirmInput,
InputState,
Key,
Learn,
Link,
Notification,
SelectGroupsInput,
SelectInput,
Spinner,
Text,
TextInput,
UnorderedList,
require_baseGetTag,
require_isObject,
require_root,
useAsync,
useAsyncCallback,
use_input_default
} from "./chunk-OAVLQEAG.js";
import {
require_react
} from "./chunk-5A5B2WR4.js";
import "./chunk-SQ3KPTIH.js";
import "./chunk-Z4MHKCET.js";
import "./chunk-C4SUTB4O.js";
import "./chunk-TKDDSH55.js";
import "./chunk-62BYZXT7.js";
import {
getTestOverrides
} from "./chunk-WYHHEOWO.js";
import {
outputDir,
outputFile,
pathExists,
readJson,
readPackageJson,
toJsonString,
writePackageJson
} from "./chunk-P4ZPHTFX.js";
import {
z
} from "./chunk-ZXYGJZOO.js";
import {
CliError,
CliErrorCode,
require_lib
} from "./chunk-D5VYILRO.js";
import {
__commonJS,
__dirname,
__require,
__toESM,
init_esm_shims
} from "./chunk-4EFJZ3GQ.js";
// ../../node_modules/ejs/lib/utils.js
var require_utils = __commonJS({
"../../node_modules/ejs/lib/utils.js"(exports) {
"use strict";
init_esm_shims();
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var hasOwn = function(obj, key) {
return hasOwnProperty.apply(obj, [key]);
};
exports.escapeRegExpChars = function(string) {
if (!string) {
return "";
}
return String(string).replace(regExpChars, "\\$&");
};
var _ENCODE_HTML_RULES = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
var _MATCH_HTML = /[&<>'"]/g;
function encode_char(c) {
return _ENCODE_HTML_RULES[c] || c;
}
var escapeFuncStr = `var _ENCODE_HTML_RULES = {
"&": "&"
, "<": "<"
, ">": ">"
, '"': """
, "'": "'"
}
, _MATCH_HTML = /[&<>'"]/g;
function encode_char(c) {
return _ENCODE_HTML_RULES[c] || c;
};
`;
exports.escapeXML = function(markup) {
return markup == void 0 ? "" : String(markup).replace(_MATCH_HTML, encode_char);
};
function escapeXMLToString() {
return Function.prototype.toString.call(this) + ";\n" + escapeFuncStr;
}
try {
if (typeof Object.defineProperty === "function") {
Object.defineProperty(exports.escapeXML, "toString", { value: escapeXMLToString });
} else {
exports.escapeXML.toString = escapeXMLToString;
}
} catch (err) {
console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)");
}
exports.shallowCopy = function(to, from) {
from = from || {};
if (to !== null && to !== void 0) {
for (var p in from) {
if (!hasOwn(from, p)) {
continue;
}
if (p === "__proto__" || p === "constructor") {
continue;
}
to[p] = from[p];
}
}
return to;
};
exports.shallowCopyFromList = function(to, from, list) {
list = list || [];
from = from || {};
if (to !== null && to !== void 0) {
for (var i = 0; i < list.length; i++) {
var p = list[i];
if (typeof from[p] != "undefined") {
if (!hasOwn(from, p)) {
continue;
}
if (p === "__proto__" || p === "constructor") {
continue;
}
to[p] = from[p];
}
}
}
return to;
};
exports.cache = {
_data: {},
set: function(key, val) {
this._data[key] = val;
},
get: function(key) {
return this._data[key];
},
remove: function(key) {
delete this._data[key];
},
reset: function() {
this._data = {};
}
};
exports.hyphenToCamel = function(str) {
return str.replace(/-[a-z]/g, function(match12) {
return match12[1].toUpperCase();
});
};
exports.createNullProtoObjWherePossible = function() {
if (typeof Object.create == "function") {
return function() {
return /* @__PURE__ */ Object.create(null);
};
}
if (!({ __proto__: null } instanceof Object)) {
return function() {
return { __proto__: null };
};
}
return function() {
return {};
};
}();
exports.hasOwnOnlyObject = function(obj) {
var o = exports.createNullProtoObjWherePossible();
for (var p in obj) {
if (hasOwn(obj, p)) {
o[p] = obj[p];
}
}
return o;
};
}
});
// ../../node_modules/ejs/package.json
var require_package = __commonJS({
"../../node_modules/ejs/package.json"(exports, module) {
module.exports = {
name: "ejs",
description: "Embedded JavaScript templates",
keywords: [
"template",
"engine",
"ejs"
],
version: "3.1.10",
author: "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
license: "Apache-2.0",
bin: {
ejs: "./bin/cli.js"
},
main: "./lib/ejs.js",
jsdelivr: "ejs.min.js",
unpkg: "ejs.min.js",
repository: {
type: "git",
url: "git://github.com/mde/ejs.git"
},
bugs: "https://github.com/mde/ejs/issues",
homepage: "https://github.com/mde/ejs",
dependencies: {
jake: "^10.8.5"
},
devDependencies: {
browserify: "^16.5.1",
eslint: "^6.8.0",
"git-directory-deploy": "^1.5.1",
jsdoc: "^4.0.2",
"lru-cache": "^4.0.1",
mocha: "^10.2.0",
"uglify-js": "^3.3.16"
},
engines: {
node: ">=0.10.0"
},
scripts: {
test: "npx jake test"
}
};
}
});
// ../../node_modules/ejs/lib/ejs.js
var require_ejs = __commonJS({
"../../node_modules/ejs/lib/ejs.js"(exports) {
"use strict";
init_esm_shims();
var fs = __require("fs");
var path7 = __require("path");
var utils = require_utils();
var scopeOptionWarned = false;
var _VERSION_STRING = require_package().version;
var _DEFAULT_OPEN_DELIMITER = "<";
var _DEFAULT_CLOSE_DELIMITER = ">";
var _DEFAULT_DELIMITER = "%";
var _DEFAULT_LOCALS_NAME = "locals";
var _NAME = "ejs";
var _REGEX_STRING = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";
var _OPTS_PASSABLE_WITH_DATA = [
"delimiter",
"scope",
"context",
"debug",
"compileDebug",
"client",
"_with",
"rmWhitespace",
"strict",
"filename",
"async"
];
var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat("cache");
var _BOM = /^\uFEFF/;
var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
exports.cache = utils.cache;
exports.fileLoader = fs.readFileSync;
exports.localsName = _DEFAULT_LOCALS_NAME;
exports.promiseImpl = new Function("return this;")().Promise;
exports.resolveInclude = function(name, filename, isDir) {
var dirname3 = path7.dirname;
var extname2 = path7.extname;
var resolve3 = path7.resolve;
var includePath = resolve3(isDir ? filename : dirname3(filename), name);
var ext = extname2(name);
if (!ext) {
includePath += ".ejs";
}
return includePath;
};
function resolvePaths(name, paths) {
var filePath;
if (paths.some(function(v) {
filePath = exports.resolveInclude(name, v, true);
return fs.existsSync(filePath);
})) {
return filePath;
}
}
function getIncludePath(path8, options) {
var includePath;
var filePath;
var views = options.views;
var match12 = /^[A-Za-z]+:\\|^\//.exec(path8);
if (match12 && match12.length) {
path8 = path8.replace(/^\/*/, "");
if (Array.isArray(options.root)) {
includePath = resolvePaths(path8, options.root);
} else {
includePath = exports.resolveInclude(path8, options.root || "/", true);
}
} else {
if (options.filename) {
filePath = exports.resolveInclude(path8, options.filename);
if (fs.existsSync(filePath)) {
includePath = filePath;
}
}
if (!includePath && Array.isArray(views)) {
includePath = resolvePaths(path8, views);
}
if (!includePath && typeof options.includer !== "function") {
throw new Error('Could not find the include file "' + options.escapeFunction(path8) + '"');
}
}
return includePath;
}
function handleCache(options, template) {
var func;
var filename = options.filename;
var hasTemplate = arguments.length > 1;
if (options.cache) {
if (!filename) {
throw new Error("cache option requires a filename");
}
func = exports.cache.get(filename);
if (func) {
return func;
}
if (!hasTemplate) {
template = fileLoader(filename).toString().replace(_BOM, "");
}
} else if (!hasTemplate) {
if (!filename) {
throw new Error("Internal EJS error: no file name or template provided");
}
template = fileLoader(filename).toString().replace(_BOM, "");
}
func = exports.compile(template, options);
if (options.cache) {
exports.cache.set(filename, func);
}
return func;
}
function tryHandleCache(options, data, cb) {
var result;
if (!cb) {
if (typeof exports.promiseImpl == "function") {
return new exports.promiseImpl(function(resolve3, reject) {
try {
result = handleCache(options)(data);
resolve3(result);
} catch (err) {
reject(err);
}
});
} else {
throw new Error("Please provide a callback function");
}
} else {
try {
result = handleCache(options)(data);
} catch (err) {
return cb(err);
}
cb(null, result);
}
}
function fileLoader(filePath) {
return exports.fileLoader(filePath);
}
function includeFile(path8, options) {
var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
opts.filename = getIncludePath(path8, opts);
if (typeof options.includer === "function") {
var includerResult = options.includer(path8, opts.filename);
if (includerResult) {
if (includerResult.filename) {
opts.filename = includerResult.filename;
}
if (includerResult.template) {
return handleCache(opts, includerResult.template);
}
}
}
return handleCache(opts);
}
function rethrow(err, str, flnm, lineno, esc) {
var lines = str.split("\n");
var start = Math.max(lineno - 3, 0);
var end = Math.min(lines.length, lineno + 3);
var filename = esc(flnm);
var context = lines.slice(start, end).map(function(line, i) {
var curr = i + start + 1;
return (curr == lineno ? " >> " : " ") + curr + "| " + line;
}).join("\n");
err.path = filename;
err.message = (filename || "ejs") + ":" + lineno + "\n" + context + "\n\n" + err.message;
throw err;
}
function stripSemi(str) {
return str.replace(/;(\s*$)/, "$1");
}
exports.compile = function compile(template, opts) {
var templ;
if (opts && opts.scope) {
if (!scopeOptionWarned) {
console.warn("`scope` option is deprecated and will be removed in EJS 3");
scopeOptionWarned = true;
}
if (!opts.context) {
opts.context = opts.scope;
}
delete opts.scope;
}
templ = new Template(template, opts);
return templ.compile();
};
exports.render = function(template, d, o) {
var data = d || utils.createNullProtoObjWherePossible();
var opts = o || utils.createNullProtoObjWherePossible();
if (arguments.length == 2) {
utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA);
}
return handleCache(opts, template)(data);
};
exports.renderFile = function() {
var args = Array.prototype.slice.call(arguments);
var filename = args.shift();
var cb;
var opts = { filename };
var data;
var viewOpts;
if (typeof arguments[arguments.length - 1] == "function") {
cb = args.pop();
}
if (args.length) {
data = args.shift();
if (args.length) {
utils.shallowCopy(opts, args.pop());
} else {
if (data.settings) {
if (data.settings.views) {
opts.views = data.settings.views;
}
if (data.settings["view cache"]) {
opts.cache = true;
}
viewOpts = data.settings["view options"];
if (viewOpts) {
utils.shallowCopy(opts, viewOpts);
}
}
utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS);
}
opts.filename = filename;
} else {
data = utils.createNullProtoObjWherePossible();
}
return tryHandleCache(opts, data, cb);
};
exports.Template = Template;
exports.clearCache = function() {
exports.cache.reset();
};
function Template(text, optsParam) {
var opts = utils.hasOwnOnlyObject(optsParam);
var options = utils.createNullProtoObjWherePossible();
this.templateText = text;
this.mode = null;
this.truncate = false;
this.currentLine = 1;
this.source = "";
options.client = opts.client || false;
options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML;
options.compileDebug = opts.compileDebug !== false;
options.debug = !!opts.debug;
options.filename = opts.filename;
options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER;
options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER;
options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER;
options.strict = opts.strict || false;
options.context = opts.context;
options.cache = opts.cache || false;
options.rmWhitespace = opts.rmWhitespace;
options.root = opts.root;
options.includer = opts.includer;
options.outputFunctionName = opts.outputFunctionName;
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
options.views = opts.views;
options.async = opts.async;
options.destructuredLocals = opts.destructuredLocals;
options.legacyInclude = typeof opts.legacyInclude != "undefined" ? !!opts.legacyInclude : true;
if (options.strict) {
options._with = false;
} else {
options._with = typeof opts._with != "undefined" ? opts._with : true;
}
this.opts = options;
this.regex = this.createRegex();
}
Template.modes = {
EVAL: "eval",
ESCAPED: "escaped",
RAW: "raw",
COMMENT: "comment",
LITERAL: "literal"
};
Template.prototype = {
createRegex: function() {
var str = _REGEX_STRING;
var delim = utils.escapeRegExpChars(this.opts.delimiter);
var open = utils.escapeRegExpChars(this.opts.openDelimiter);
var close = utils.escapeRegExpChars(this.opts.closeDelimiter);
str = str.replace(/%/g, delim).replace(/</g, open).replace(/>/g, close);
return new RegExp(str);
},
compile: function() {
var src;
var fn;
var opts = this.opts;
var prepended = "";
var appended = "";
var escapeFn = opts.escapeFunction;
var ctor;
var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : "undefined";
if (!this.source) {
this.generateSource();
prepended += ' var __output = "";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
if (opts.outputFunctionName) {
if (!_JS_IDENTIFIER.test(opts.outputFunctionName)) {
throw new Error("outputFunctionName is not a valid JS identifier.");
}
prepended += " var " + opts.outputFunctionName + " = __append;\n";
}
if (opts.localsName && !_JS_IDENTIFIER.test(opts.localsName)) {
throw new Error("localsName is not a valid JS identifier.");
}
if (opts.destructuredLocals && opts.destructuredLocals.length) {
var destructuring = " var __locals = (" + opts.localsName + " || {}),\n";
for (var i = 0; i < opts.destructuredLocals.length; i++) {
var name = opts.destructuredLocals[i];
if (!_JS_IDENTIFIER.test(name)) {
throw new Error("destructuredLocals[" + i + "] is not a valid JS identifier.");
}
if (i > 0) {
destructuring += ",\n ";
}
destructuring += name + " = __locals." + name;
}
prepended += destructuring + ";\n";
}
if (opts._with !== false) {
prepended += " with (" + opts.localsName + " || {}) {\n";
appended += " }\n";
}
appended += " return __output;\n";
this.source = prepended + this.source + appended;
}
if (opts.compileDebug) {
src = "var __line = 1\n , __lines = " + JSON.stringify(this.templateText) + "\n , __filename = " + sanitizedFilename + ";\ntry {\n" + this.source + "} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n";
} else {
src = this.source;
}
if (opts.client) {
src = "escapeFn = escapeFn || " + escapeFn.toString() + ";\n" + src;
if (opts.compileDebug) {
src = "rethrow = rethrow || " + rethrow.toString() + ";\n" + src;
}
}
if (opts.strict) {
src = '"use strict";\n' + src;
}
if (opts.debug) {
console.log(src);
}
if (opts.compileDebug && opts.filename) {
src = src + "\n//# sourceURL=" + sanitizedFilename + "\n";
}
try {
if (opts.async) {
try {
ctor = new Function("return (async function(){}).constructor;")();
} catch (e) {
if (e instanceof SyntaxError) {
throw new Error("This environment does not support async/await");
} else {
throw e;
}
}
} else {
ctor = Function;
}
fn = new ctor(opts.localsName + ", escapeFn, include, rethrow", src);
} catch (e) {
if (e instanceof SyntaxError) {
if (opts.filename) {
e.message += " in " + opts.filename;
}
e.message += " while compiling ejs\n\n";
e.message += "If the above error is not helpful, you may want to try EJS-Lint:\n";
e.message += "https://github.com/RyanZim/EJS-Lint";
if (!opts.async) {
e.message += "\n";
e.message += "Or, if you meant to create an async function, pass `async: true` as an option.";
}
}
throw e;
}
var returnedFn = opts.client ? fn : function anonymous(data) {
var include = function(path8, includeData) {
var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
if (includeData) {
d = utils.shallowCopy(d, includeData);
}
return includeFile(path8, opts)(d);
};
return fn.apply(
opts.context,
[data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]
);
};
if (opts.filename && typeof Object.defineProperty === "function") {
var filename = opts.filename;
var basename = path7.basename(filename, path7.extname(filename));
try {
Object.defineProperty(returnedFn, "name", {
value: basename,
writable: false,
enumerable: false,
configurable: true
});
} catch (e) {
}
}
return returnedFn;
},
generateSource: function() {
var opts = this.opts;
if (opts.rmWhitespace) {
this.templateText = this.templateText.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
}
this.templateText = this.templateText.replace(/[ \t]*<%_/gm, "<%_").replace(/_%>[ \t]*/gm, "_%>");
var self = this;
var matches = this.parseTemplateText();
var d = this.opts.delimiter;
var o = this.opts.openDelimiter;
var c = this.opts.closeDelimiter;
if (matches && matches.length) {
matches.forEach(function(line, index) {
var closing;
if (line.indexOf(o + d) === 0 && line.indexOf(o + d + d) !== 0) {
closing = matches[index + 2];
if (!(closing == d + c || closing == "-" + d + c || closing == "_" + d + c)) {
throw new Error('Could not find matching close tag for "' + line + '".');
}
}
self.scanLine(line);
});
}
},
parseTemplateText: function() {
var str = this.templateText;
var pat = this.regex;
var result = pat.exec(str);
var arr = [];
var firstPos;
while (result) {
firstPos = result.index;
if (firstPos !== 0) {
arr.push(str.substring(0, firstPos));
str = str.slice(firstPos);
}
arr.push(result[0]);
str = str.slice(result[0].length);
result = pat.exec(str);
}
if (str) {
arr.push(str);
}
return arr;
},
_addOutput: function(line) {
if (this.truncate) {
line = line.replace(/^(?:\r\n|\r|\n)/, "");
this.truncate = false;
}
if (!line) {
return line;
}
line = line.replace(/\\/g, "\\\\");
line = line.replace(/\n/g, "\\n");
line = line.replace(/\r/g, "\\r");
line = line.replace(/"/g, '\\"');
this.source += ' ; __append("' + line + '")\n';
},
scanLine: function(line) {
var self = this;
var d = this.opts.delimiter;
var o = this.opts.openDelimiter;
var c = this.opts.closeDelimiter;
var newLineCount = 0;
newLineCount = line.split("\n").length - 1;
switch (line) {
case o + d:
case o + d + "_":
this.mode = Template.modes.EVAL;
break;
case o + d + "=":
this.mode = Template.modes.ESCAPED;
break;
case o + d + "-":
this.mode = Template.modes.RAW;
break;
case o + d + "#":
this.mode = Template.modes.COMMENT;
break;
case o + d + d:
this.mode = Template.modes.LITERAL;
this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")\n';
break;
case d + d + c:
this.mode = Template.modes.LITERAL;
this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")\n';
break;
case d + c:
case "-" + d + c:
case "_" + d + c:
if (this.mode == Template.modes.LITERAL) {
this._addOutput(line);
}
this.mode = null;
this.truncate = line.indexOf("-") === 0 || line.indexOf("_") === 0;
break;
default:
if (this.mode) {
switch (this.mode) {
case Template.modes.EVAL:
case Template.modes.ESCAPED:
case Template.modes.RAW:
if (line.lastIndexOf("//") > line.lastIndexOf("\n")) {
line += "\n";
}
}
switch (this.mode) {
// Just executing code
case Template.modes.EVAL:
this.source += " ; " + line + "\n";
break;
// Exec, esc, and output
case Template.modes.ESCAPED:
this.source += " ; __append(escapeFn(" + stripSemi(line) + "))\n";
break;
// Exec and output
case Template.modes.RAW:
this.source += " ; __append(" + stripSemi(line) + ")\n";
break;
case Template.modes.COMMENT:
break;
// Literal <%% mode, append as raw output
case Template.modes.LITERAL:
this._addOutput(line);
break;
}
} else {
this._addOutput(line);
}
}
if (self.opts.compileDebug && newLineCount) {
this.currentLine += newLineCount;
this.source += " ; __line = " + this.currentLine + "\n";
}
}
};
exports.escapeXML = utils.escapeXML;
exports.__express = exports.renderFile;
exports.VERSION = _VERSION_STRING;
exports.name = _NAME;
if (typeof window != "undefined") {
window.ejs = exports;
}
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/common.js
var require_common = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/common.js"(exports, module) {
"use strict";
init_esm_shims();
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;
}
module.exports.isNothing = isNothing;
module.exports.isObject = isObject;
module.exports.toArray = toArray;
module.exports.repeat = repeat;
module.exports.isNegativeZero = isNegativeZero;
module.exports.extend = extend;
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/exception.js
var require_exception = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/exception.js"(exports, module) {
"use strict";
init_esm_shims();
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;
};
module.exports = YAMLException;
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/mark.js
var require_mark = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/mark.js"(exports, module) {
"use strict";
init_esm_shims();
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\x85\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\x85\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;
};
module.exports = Mark;
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type.js
var require_type = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type.js"(exports, module) {
"use strict";
init_esm_shims();
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 Type2(tag, options) {
options = options || {};
Object.keys(options).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 = options["kind"] || null;
this.resolve = options["resolve"] || function() {
return true;
};
this.construct = options["construct"] || function(data) {
return data;
};
this.instanceOf = options["instanceOf"] || null;
this.predicate = options["predicate"] || null;
this.represent = options["represent"] || null;
this.defaultStyle = options["defaultStyle"] || null;
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
module.exports = Type2;
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema.js
var require_schema = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema.js"(exports, module) {
"use strict";
init_esm_shims();
var common = require_common();
var YAMLException = require_exception();
var Type2 = 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 Type2;
})) {
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
});
};
module.exports = Schema;
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/str.js
var require_str = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports, module) {
"use strict";
init_esm_shims();
var Type2 = require_type();
module.exports = new Type2("tag:yaml.org,2002:str", {
kind: "scalar",
construct: function(data) {
return data !== null ? data : "";
}
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js
var require_seq = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports, module) {
"use strict";
init_esm_shims();
var Type2 = require_type();
module.exports = new Type2("tag:yaml.org,2002:seq", {
kind: "sequence",
construct: function(data) {
return data !== null ? data : [];
}
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/map.js
var require_map = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports, module) {
"use strict";
init_esm_shims();
var Type2 = require_type();
module.exports = new Type2("tag:yaml.org,2002:map", {
kind: "mapping",
construct: function(data) {
return data !== null ? data : {};
}
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
var require_failsafe = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports, module) {
"use strict";
init_esm_shims();
var Schema = require_schema();
module.exports = new Schema({
explicit: [
require_str(),
require_seq(),
require_map()
]
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/null.js
var require_null = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports, module) {
"use strict";
init_esm_shims();
var Type2 = 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;
}
module.exports = new Type2("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/front-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js
var require_bool = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports, module) {
"use strict";
init_esm_shims();
var Type2 = 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]";
}
module.exports = new Type2("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/front-matter/node_modules/js-yaml/lib/js-yaml/type/int.js
var require_int = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports, module) {
"use strict";
init_esm_shims();
var common = require_common();
var Type2 = 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));
}
module.exports = new Type2("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/front-matter/node_modules/js-yaml/lib/js-yaml/type/float.js
var require_float = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports, module) {
"use strict";
init_esm_shims();
var common = require_common();
var Type2 = 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));
}
module.exports = new Type2("tag:yaml.org,2002:float", {
kind: "scalar",
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: "lowercase"
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js
var require_json = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports, module) {
"use strict";
init_esm_shims();
var Schema = require_schema();
module.exports = new Schema({
include: [
require_failsafe()
],
implicit: [
require_null(),
require_bool(),
require_int(),
require_float()
]
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js
var require_core = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports, module) {
"use strict";
init_esm_shims();
var Schema = require_schema();
module.exports = new Schema({
include: [
require_json()
]
});
}
});
// ../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
var require_timestamp = __commonJS({
"../../node_modules/front-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports, module) {
"use strict";
init_esm_shims();
var Type2 = 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)