install-nix-action/node_modules/expect/build-es5/index.js

35614 lines
1.0 MiB
JavaScript
Raw Permalink Normal View History

2019-11-20 03:50:30 +11:00
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["expect"] = factory();
else
root["expect"] = factory();
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./packages/expect/src/index.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/@babel/code-frame/lib/index.js":
/*!*****************************************************!*\
!*** ./node_modules/@babel/code-frame/lib/index.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.codeFrameColumns = codeFrameColumns;
exports.default = _default;
function _highlight() {
var data = _interopRequireWildcard(__webpack_require__(/*! @babel/highlight */ "./node_modules/@babel/highlight/lib/index.js"));
_highlight = function _highlight() {
return data;
};
return data;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var deprecationWarningShown = false;
function getDefs(chalk) {
return {
gutter: chalk.grey,
marker: chalk.red.bold,
message: chalk.red.bold
};
}
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts) {
var startLoc = Object.assign({
column: 0,
line: -1
}, loc.start);
var endLoc = Object.assign({}, startLoc, loc.end);
var _ref = opts || {},
_ref$linesAbove = _ref.linesAbove,
linesAbove = _ref$linesAbove === void 0 ? 2 : _ref$linesAbove,
_ref$linesBelow = _ref.linesBelow,
linesBelow = _ref$linesBelow === void 0 ? 3 : _ref$linesBelow;
var startLine = startLoc.line;
var startColumn = startLoc.column;
var endLine = endLoc.line;
var endColumn = endLoc.column;
var start = Math.max(startLine - (linesAbove + 1), 0);
var end = Math.min(source.length, endLine + linesBelow);
if (startLine === -1) {
start = 0;
}
if (endLine === -1) {
end = source.length;
}
var lineDiff = endLine - startLine;
var markerLines = {};
if (lineDiff) {
for (var i = 0; i <= lineDiff; i++) {
var lineNumber = i + startLine;
if (!startColumn) {
markerLines[lineNumber] = true;
} else if (i === 0) {
var sourceLength = source[lineNumber - 1].length;
markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
} else if (i === lineDiff) {
markerLines[lineNumber] = [0, endColumn];
} else {
var _sourceLength = source[lineNumber - i].length;
markerLines[lineNumber] = [0, _sourceLength];
}
}
} else {
if (startColumn === endColumn) {
if (startColumn) {
markerLines[startLine] = [startColumn, 0];
} else {
markerLines[startLine] = true;
}
} else {
markerLines[startLine] = [startColumn, endColumn - startColumn];
}
}
return {
start: start,
end: end,
markerLines: markerLines
};
}
function codeFrameColumns(rawLines, loc) {
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
var chalk = (0, _highlight().getChalk)(opts);
var defs = getDefs(chalk);
var maybeHighlight = function maybeHighlight(chalkFn, string) {
return highlighted ? chalkFn(string) : string;
};
if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts);
var lines = rawLines.split(NEWLINE);
var _getMarkerLines = getMarkerLines(loc, lines, opts),
start = _getMarkerLines.start,
end = _getMarkerLines.end,
markerLines = _getMarkerLines.markerLines;
var hasColumns = loc.start && typeof loc.start.column === "number";
var numberMaxWidth = String(end).length;
var frame = lines.slice(start, end).map(function (line, index) {
var number = start + 1 + index;
var paddedNumber = " ".concat(number).slice(-numberMaxWidth);
var gutter = " ".concat(paddedNumber, " | ");
var hasMarker = markerLines[number];
var lastMarkerLine = !markerLines[number + 1];
if (hasMarker) {
var markerLine = "";
if (Array.isArray(hasMarker)) {
var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
var numberOfMarkers = hasMarker[1] || 1;
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
if (lastMarkerLine && opts.message) {
markerLine += " " + maybeHighlight(defs.message, opts.message);
}
}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
} else {
return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
}
}).join("\n");
if (opts.message && !hasColumns) {
frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
}
if (highlighted) {
return chalk.reset(frame);
} else {
return frame;
}
}
function _default(rawLines, lineNumber, colNumber) {
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
if (!deprecationWarningShown) {
deprecationWarningShown = true;
var message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
if (process.emitWarning) {
process.emitWarning(message, "DeprecationWarning");
} else {
var deprecationError = new Error(message);
deprecationError.name = "DeprecationWarning";
console.warn(new Error(message));
}
}
colNumber = Math.max(colNumber, 0);
var location = {
start: {
column: colNumber,
line: lineNumber
}
};
return codeFrameColumns(rawLines, location, opts);
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/@babel/highlight/lib/index.js":
/*!****************************************************!*\
!*** ./node_modules/@babel/highlight/lib/index.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shouldHighlight = shouldHighlight;
exports.getChalk = getChalk;
exports.default = highlight;
function _jsTokens() {
var data = _interopRequireWildcard(__webpack_require__(/*! js-tokens */ "./node_modules/js-tokens/index.js"));
_jsTokens = function _jsTokens() {
return data;
};
return data;
}
function _esutils() {
var data = _interopRequireDefault(__webpack_require__(/*! esutils */ "./node_modules/esutils/lib/utils.js"));
_esutils = function _esutils() {
return data;
};
return data;
}
function _chalk() {
var data = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
_chalk = function _chalk() {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
function getDefs(chalk) {
return {
keyword: chalk.cyan,
capitalized: chalk.yellow,
jsx_tag: chalk.yellow,
punctuator: chalk.yellow,
number: chalk.magenta,
string: chalk.green,
regex: chalk.magenta,
comment: chalk.grey,
invalid: chalk.white.bgRed.bold
};
}
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
var JSX_TAG = /^[a-z][\w-]*$/i;
var BRACKET = /^[()[\]{}]$/;
function getTokenType(match) {
var _match$slice = match.slice(-2),
_match$slice2 = _slicedToArray(_match$slice, 2),
offset = _match$slice2[0],
text = _match$slice2[1];
var token = (0, _jsTokens().matchToToken)(match);
if (token.type === "name") {
if (_esutils().default.keyword.isReservedWordES6(token.value)) {
return "keyword";
}
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
return "jsx_tag";
}
if (token.value[0] !== token.value[0].toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
return "punctuator";
}
return token.type;
}
function highlightTokens(defs, text) {
return text.replace(_jsTokens().default, function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var type = getTokenType(args);
var colorize = defs[type];
if (colorize) {
return args[0].split(NEWLINE).map(function (str) {
return colorize(str);
}).join("\n");
} else {
return args[0];
}
});
}
function shouldHighlight(options) {
return _chalk().default.supportsColor || options.forceColor;
}
function getChalk(options) {
var chalk = _chalk().default;
if (options.forceColor) {
chalk = new (_chalk().default.constructor)({
enabled: true,
level: 1
});
}
return chalk;
}
function highlight(code) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (shouldHighlight(options)) {
var chalk = getChalk(options);
var defs = getDefs(chalk);
return highlightTokens(defs, code);
} else {
return code;
}
}
/***/ }),
/***/ "./node_modules/ansi-regex/index.js":
/*!******************************************!*\
!*** ./node_modules/ansi-regex/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function (options) {
options = Object.assign({
onlyFirst: false
}, options);
var pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
};
/***/ }),
/***/ "./node_modules/ansi-styles/index.js":
/*!*******************************************!*\
!*** ./node_modules/ansi-styles/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(module) {
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var colorConvert = __webpack_require__(/*! color-convert */ "./node_modules/color-convert/index.js");
var wrapAnsi16 = function wrapAnsi16(fn, offset) {
return function () {
var code = fn.apply(colorConvert, arguments);
return "\x1B[".concat(code + offset, "m");
};
};
var wrapAnsi256 = function wrapAnsi256(fn, offset) {
return function () {
var code = fn.apply(colorConvert, arguments);
return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
};
};
var wrapAnsi16m = function wrapAnsi16m(fn, offset) {
return function () {
var rgb = fn.apply(colorConvert, arguments);
return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
};
};
function assembleStyles() {
var codes = new Map();
var styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
// Bright color
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
}; // Fix humans
styles.color.grey = styles.color.gray;
var _arr = Object.keys(styles);
for (var _i = 0; _i < _arr.length; _i++) {
var groupName = _arr[_i];
var group = styles[groupName];
var _arr3 = Object.keys(group);
for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
var styleName = _arr3[_i3];
var style = group[styleName];
styles[styleName] = {
open: "\x1B[".concat(style[0], "m"),
close: "\x1B[".concat(style[1], "m")
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
}
var ansi2ansi = function ansi2ansi(n) {
return n;
};
var rgb2rgb = function rgb2rgb(r, g, b) {
return [r, g, b];
};
styles.color.close = "\x1B[39m";
styles.bgColor.close = "\x1B[49m";
styles.color.ansi = {
ansi: wrapAnsi16(ansi2ansi, 0)
};
styles.color.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 0)
};
styles.color.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 0)
};
styles.bgColor.ansi = {
ansi: wrapAnsi16(ansi2ansi, 10)
};
styles.bgColor.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 10)
};
styles.bgColor.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 10)
};
var _arr2 = Object.keys(colorConvert);
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var key = _arr2[_i2];
if (_typeof(colorConvert[key]) !== 'object') {
continue;
}
var suite = colorConvert[key];
if (key === 'ansi16') {
key = 'ansi';
}
if ('ansi16' in suite) {
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
}
if ('ansi256' in suite) {
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
}
if ('rgb' in suite) {
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
}
}
return styles;
} // Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
/***/ }),
/***/ "./node_modules/arr-diff/index.js":
/*!****************************************!*\
!*** ./node_modules/arr-diff/index.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* arr-diff <https://github.com/jonschlinkert/arr-diff>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
module.exports = function diff(arr
/*, arrays*/
) {
var len = arguments.length;
var idx = 0;
while (++idx < len) {
arr = diffArray(arr, arguments[idx]);
}
return arr;
};
function diffArray(one, two) {
if (!Array.isArray(two)) {
return one.slice();
}
var tlen = two.length;
var olen = one.length;
var idx = -1;
var arr = [];
while (++idx < olen) {
var ele = one[idx];
var hasEle = false;
for (var i = 0; i < tlen; i++) {
var val = two[i];
if (ele === val) {
hasEle = true;
break;
}
}
if (hasEle === false) {
arr.push(ele);
}
}
return arr;
}
/***/ }),
/***/ "./node_modules/arr-flatten/index.js":
/*!*******************************************!*\
!*** ./node_modules/arr-flatten/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
module.exports = function (arr) {
return flat(arr, []);
};
function flat(arr, res) {
var i = 0,
cur;
var len = arr.length;
for (; i < len; i++) {
cur = arr[i];
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
}
return res;
}
/***/ }),
/***/ "./node_modules/arr-union/index.js":
/*!*****************************************!*\
!*** ./node_modules/arr-union/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function union(init) {
if (!Array.isArray(init)) {
throw new TypeError('arr-union expects the first argument to be an array.');
}
var len = arguments.length;
var i = 0;
while (++i < len) {
var arg = arguments[i];
if (!arg) continue;
if (!Array.isArray(arg)) {
arg = [arg];
}
for (var j = 0; j < arg.length; j++) {
var ele = arg[j];
if (init.indexOf(ele) >= 0) {
continue;
}
init.push(ele);
}
}
return init;
};
/***/ }),
/***/ "./node_modules/array-unique/index.js":
/*!********************************************!*\
!*** ./node_modules/array-unique/index.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* array-unique <https://github.com/jonschlinkert/array-unique>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function unique(arr) {
if (!Array.isArray(arr)) {
throw new TypeError('array-unique expects an array.');
}
var len = arr.length;
var i = -1;
while (i++ < len) {
var j = i + 1;
for (; j < arr.length; ++j) {
if (arr[i] === arr[j]) {
arr.splice(j--, 1);
}
}
}
return arr;
};
module.exports.immutable = function uniqueImmutable(arr) {
if (!Array.isArray(arr)) {
throw new TypeError('array-unique expects an array.');
}
var arrLen = arr.length;
var newArr = new Array(arrLen);
for (var i = 0; i < arrLen; i++) {
newArr[i] = arr[i];
}
return module.exports(newArr);
};
/***/ }),
/***/ "./node_modules/assign-symbols/index.js":
/*!**********************************************!*\
!*** ./node_modules/assign-symbols/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* assign-symbols <https://github.com/jonschlinkert/assign-symbols>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function (receiver, objects) {
if (receiver === null || typeof receiver === 'undefined') {
throw new TypeError('expected first argument to be an object.');
}
if (typeof objects === 'undefined' || typeof Symbol === 'undefined') {
return receiver;
}
if (typeof Object.getOwnPropertySymbols !== 'function') {
return receiver;
}
var isEnumerable = Object.prototype.propertyIsEnumerable;
var target = Object(receiver);
var len = arguments.length,
i = 0;
while (++i < len) {
var provider = Object(arguments[i]);
var names = Object.getOwnPropertySymbols(provider);
for (var j = 0; j < names.length; j++) {
var key = names[j];
if (isEnumerable.call(provider, key)) {
target[key] = provider[key];
}
}
}
return target;
};
/***/ }),
/***/ "./node_modules/base/index.js":
/*!************************************!*\
!*** ./node_modules/base/index.js ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/base/node_modules/define-property/index.js");
var CacheBase = __webpack_require__(/*! cache-base */ "./node_modules/cache-base/index.js");
var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/base/node_modules/component-emitter/index.js");
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var merge = __webpack_require__(/*! mixin-deep */ "./node_modules/mixin-deep/index.js");
var pascal = __webpack_require__(/*! pascalcase */ "./node_modules/pascalcase/index.js");
var cu = __webpack_require__(/*! class-utils */ "./node_modules/class-utils/index.js");
/**
* Optionally define a custom `cache` namespace to use.
*/
function namespace(name) {
var Cache = name ? CacheBase.namespace(name) : CacheBase;
var fns = [];
/**
* Create an instance of `Base` with the given `config` and `options`.
*
* ```js
* // initialize with `config` and `options`
* var app = new Base({isApp: true}, {abc: true});
* app.set('foo', 'bar');
*
* // values defined with the given `config` object will be on the root of the instance
* console.log(app.baz); //=> undefined
* console.log(app.foo); //=> 'bar'
* // or use `.get`
* console.log(app.get('isApp')); //=> true
* console.log(app.get('foo')); //=> 'bar'
*
* // values defined with the given `options` object will be on `app.options
* console.log(app.options.abc); //=> true
* ```
*
* @param {Object} `config` If supplied, this object is passed to [cache-base][] to merge onto the the instance upon instantiation.
* @param {Object} `options` If supplied, this object is used to initialize the `base.options` object.
* @api public
*/
function Base(config, options) {
if (!(this instanceof Base)) {
return new Base(config, options);
}
Cache.call(this, config);
this.is('base');
this.initBase(config, options);
}
/**
* Inherit cache-base
*/
util.inherits(Base, Cache);
/**
* Add static emitter methods
*/
Emitter(Base);
/**
* Initialize `Base` defaults with the given `config` object
*/
Base.prototype.initBase = function (config, options) {
this.options = merge({}, this.options, options);
this.cache = this.cache || {};
this.define('registered', {});
if (name) this[name] = {}; // make `app._callbacks` non-enumerable
this.define('_callbacks', this._callbacks);
if (isObject(config)) {
this.visit('set', config);
}
Base.run(this, 'use', fns);
};
/**
* Set the given `name` on `app._name` and `app.is*` properties. Used for doing
* lookups in plugins.
*
* ```js
* app.is('foo');
* console.log(app._name);
* //=> 'foo'
* console.log(app.isFoo);
* //=> true
* app.is('bar');
* console.log(app.isFoo);
* //=> true
* console.log(app.isBar);
* //=> true
* console.log(app._name);
* //=> 'bar'
* ```
* @name .is
* @param {String} `name`
* @return {Boolean}
* @api public
*/
Base.prototype.is = function (name) {
if (typeof name !== 'string') {
throw new TypeError('expected name to be a string');
}
this.define('is' + pascal(name), true);
this.define('_name', name);
this.define('_appname', name);
return this;
};
/**
* Returns true if a plugin has already been registered on an instance.
*
* Plugin implementors are encouraged to use this first thing in a plugin
* to prevent the plugin from being called more than once on the same
* instance.
*
* ```js
* var base = new Base();
* base.use(function(app) {
* if (app.isRegistered('myPlugin')) return;
* // do stuff to `app`
* });
*
* // to also record the plugin as being registered
* base.use(function(app) {
* if (app.isRegistered('myPlugin', true)) return;
* // do stuff to `app`
* });
* ```
* @name .isRegistered
* @emits `plugin` Emits the name of the plugin being registered. Useful for unit tests, to ensure plugins are only registered once.
* @param {String} `name` The plugin name.
* @param {Boolean} `register` If the plugin if not already registered, to record it as being registered pass `true` as the second argument.
* @return {Boolean} Returns true if a plugin is already registered.
* @api public
*/
Base.prototype.isRegistered = function (name, register) {
if (this.registered.hasOwnProperty(name)) {
return true;
}
if (register !== false) {
this.registered[name] = true;
this.emit('plugin', name);
}
return false;
};
/**
* Define a plugin function to be called immediately upon init. Plugins are chainable
* and expose the following arguments to the plugin function:
*
* - `app`: the current instance of `Base`
* - `base`: the [first ancestor instance](#base) of `Base`
*
* ```js
* var app = new Base()
* .use(foo)
* .use(bar)
* .use(baz)
* ```
* @name .use
* @param {Function} `fn` plugin function to call
* @return {Object} Returns the item instance for chaining.
* @api public
*/
Base.prototype.use = function (fn) {
fn.call(this, this);
return this;
};
/**
* The `.define` method is used for adding non-enumerable property on the instance.
* Dot-notation is **not supported** with `define`.
*
* ```js
* // arbitrary `render` function using lodash `template`
* app.define('render', function(str, locals) {
* return _.template(str)(locals);
* });
* ```
* @name .define
* @param {String} `key` The name of the property to define.
* @param {any} `value`
* @return {Object} Returns the instance for chaining.
* @api public
*/
Base.prototype.define = function (key, val) {
if (isObject(key)) {
return this.visit('define', key);
}
define(this, key, val);
return this;
};
/**
* Mix property `key` onto the Base prototype. If base is inherited using
* `Base.extend` this method will be overridden by a new `mixin` method that will
* only add properties to the prototype of the inheriting application.
*
* ```js
* app.mixin('foo', function() {
* // do stuff
* });
* ```
* @name .mixin
* @param {String} `key`
* @param {Object|Array} `val`
* @return {Object} Returns the `base` instance for chaining.
* @api public
*/
Base.prototype.mixin = function (key, val) {
Base.prototype[key] = val;
return this;
};
/**
* Non-enumberable mixin array, used by the static [Base.mixin]() method.
*/
Base.prototype.mixins = Base.prototype.mixins || [];
/**
* Getter/setter used when creating nested instances of `Base`, for storing a reference
* to the first ancestor instance. This works by setting an instance of `Base` on the `parent`
* property of a "child" instance. The `base` property defaults to the current instance if
* no `parent` property is defined.
*
* ```js
* // create an instance of `Base`, this is our first ("base") instance
* var first = new Base();
* first.foo = 'bar'; // arbitrary property, to make it easier to see what's happening later
*
* // create another instance
* var second = new Base();
* // create a reference to the first instance (`first`)
* second.parent = first;
*
* // create another instance
* var third = new Base();
* // create a reference to the previous instance (`second`)
* // repeat this pattern every time a "child" instance is created
* third.parent = second;
*
* // we can always access the first instance using the `base` property
* console.log(first.base.foo);
* //=> 'bar'
* console.log(second.base.foo);
* //=> 'bar'
* console.log(third.base.foo);
* //=> 'bar'
* // and now you know how to get to third base ;)
* ```
* @name .base
* @api public
*/
Object.defineProperty(Base.prototype, 'base', {
configurable: true,
get: function get() {
return this.parent ? this.parent.base : this;
}
});
/**
* Static method for adding global plugin functions that will
* be added to an instance when created.
*
* ```js
* Base.use(function(app) {
* app.foo = 'bar';
* });
* var app = new Base();
* console.log(app.foo);
* //=> 'bar'
* ```
* @name #use
* @param {Function} `fn` Plugin function to use on each instance.
* @return {Object} Returns the `Base` constructor for chaining
* @api public
*/
define(Base, 'use', function (fn) {
fns.push(fn);
return Base;
});
/**
* Run an array of functions by passing each function
* to a method on the given object specified by the given property.
*
* @param {Object} `obj` Object containing method to use.
* @param {String} `prop` Name of the method on the object to use.
* @param {Array} `arr` Array of functions to pass to the method.
*/
define(Base, 'run', function (obj, prop, arr) {
var len = arr.length,
i = 0;
while (len--) {
obj[prop](arr[i++]);
}
return Base;
});
/**
* Static method for inheriting the prototype and static methods of the `Base` class.
* This method greatly simplifies the process of creating inheritance-based applications.
* See [static-extend][] for more details.
*
* ```js
* var extend = cu.extend(Parent);
* Parent.extend(Child);
*
* // optional methods
* Parent.extend(Child, {
* foo: function() {},
* bar: function() {}
* });
* ```
* @name #extend
* @param {Function} `Ctor` constructor to extend
* @param {Object} `methods` Optional prototype properties to mix in.
* @return {Object} Returns the `Base` constructor for chaining
* @api public
*/
define(Base, 'extend', cu.extend(Base, function (Ctor, Parent) {
Ctor.prototype.mixins = Ctor.prototype.mixins || [];
define(Ctor, 'mixin', function (fn) {
var mixin = fn(Ctor.prototype, Ctor);
if (typeof mixin === 'function') {
Ctor.prototype.mixins.push(mixin);
}
return Ctor;
});
define(Ctor, 'mixins', function (Child) {
Base.run(Child, 'mixin', Ctor.prototype.mixins);
return Ctor;
});
Ctor.prototype.mixin = function (key, value) {
Ctor.prototype[key] = value;
return this;
};
return Base;
}));
/**
* Used for adding methods to the `Base` prototype, and/or to the prototype of child instances.
* When a mixin function returns a function, the returned function is pushed onto the `.mixins`
* array, making it available to be used on inheriting classes whenever `Base.mixins()` is
* called (e.g. `Base.mixins(Child)`).
*
* ```js
* Base.mixin(function(proto) {
* proto.foo = function(msg) {
* return 'foo ' + msg;
* };
* });
* ```
* @name #mixin
* @param {Function} `fn` Function to call
* @return {Object} Returns the `Base` constructor for chaining
* @api public
*/
define(Base, 'mixin', function (fn) {
var mixin = fn(Base.prototype, Base);
if (typeof mixin === 'function') {
Base.prototype.mixins.push(mixin);
}
return Base;
});
/**
* Static method for running global mixin functions against a child constructor.
* Mixins must be registered before calling this method.
*
* ```js
* Base.extend(Child);
* Base.mixins(Child);
* ```
* @name #mixins
* @param {Function} `Child` Constructor function of a child class
* @return {Object} Returns the `Base` constructor for chaining
* @api public
*/
define(Base, 'mixins', function (Child) {
Base.run(Child, 'mixin', Base.prototype.mixins);
return Base;
});
/**
* Similar to `util.inherit`, but copies all static properties, prototype properties, and
* getters/setters from `Provider` to `Receiver`. See [class-utils][]{#inherit} for more details.
*
* ```js
* Base.inherit(Foo, Bar);
* ```
* @name #inherit
* @param {Function} `Receiver` Receiving (child) constructor
* @param {Function} `Provider` Providing (parent) constructor
* @return {Object} Returns the `Base` constructor for chaining
* @api public
*/
define(Base, 'inherit', cu.inherit);
define(Base, 'bubble', cu.bubble);
return Base;
}
/**
* Expose `Base` with default settings
*/
module.exports = namespace();
/**
* Allow users to define a namespace
*/
module.exports.namespace = namespace;
/***/ }),
/***/ "./node_modules/base/node_modules/component-emitter/index.js":
/*!*******************************************************************!*\
!*** ./node_modules/base/node_modules/component-emitter/index.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Expose `Emitter`.
*/
if (true) {
module.exports = Emitter;
}
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
}
;
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function (event, fn) {
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
this._callbacks = this._callbacks || {}; // all
if (0 == arguments.length) {
this._callbacks = {};
return this;
} // specific event
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this; // remove all handlers
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
} // remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
} // Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function (event) {
this._callbacks = this._callbacks || {};
var args = new Array(arguments.length - 1),
callbacks = this._callbacks['$' + event];
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function (event) {
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function (event) {
return !!this.listeners(event).length;
};
/***/ }),
/***/ "./node_modules/base/node_modules/define-property/index.js":
/*!*****************************************************************!*\
!*** ./node_modules/base/node_modules/define-property/index.js ***!
\*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
module.exports = function defineProperty(obj, prop, val) {
if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
throw new TypeError('expected an object or function.');
}
if (typeof prop !== 'string') {
throw new TypeError('expected `prop` to be a string.');
}
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
return Object.defineProperty(obj, prop, val);
}
return Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
};
/***/ }),
/***/ "./node_modules/braces/index.js":
/*!**************************************!*\
!*** ./node_modules/braces/index.js ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Module dependencies
*/
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
var unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
/**
* Local dependencies
*/
var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/braces/lib/compilers.js");
var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/braces/lib/parsers.js");
var Braces = __webpack_require__(/*! ./lib/braces */ "./node_modules/braces/lib/braces.js");
var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/braces/lib/utils.js");
var MAX_LENGTH = 1024 * 64;
var cache = {};
/**
* Convert the given `braces` pattern into a regex-compatible string. By default, only one string is generated for every input string. Set `options.expand` to true to return an array of patterns (similar to Bash or minimatch. Before using `options.expand`, it's recommended that you read the [performance notes](#performance)).
*
* ```js
* var braces = require('braces');
* console.log(braces('{a,b,c}'));
* //=> ['(a|b|c)']
*
* console.log(braces('{a,b,c}', {expand: true}));
* //=> ['a', 'b', 'c']
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {String}
* @api public
*/
function braces(pattern, options) {
var key = utils.createKey(String(pattern), options);
var arr = [];
var disabled = options && options.cache === false;
if (!disabled && cache.hasOwnProperty(key)) {
return cache[key];
}
if (Array.isArray(pattern)) {
for (var i = 0; i < pattern.length; i++) {
arr.push.apply(arr, braces.create(pattern[i], options));
}
} else {
arr = braces.create(pattern, options);
}
if (options && options.nodupes === true) {
arr = unique(arr);
}
if (!disabled) {
cache[key] = arr;
}
return arr;
}
/**
* Expands a brace pattern into an array. This method is called by the main [braces](#braces) function when `options.expand` is true. Before using this method it's recommended that you read the [performance notes](#performance)) and advantages of using [.optimize](#optimize) instead.
*
* ```js
* var braces = require('braces');
* console.log(braces.expand('a/{b,c}/d'));
* //=> ['a/b/d', 'a/c/d'];
* ```
* @param {String} `pattern` Brace pattern
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.expand = function (pattern, options) {
return braces.create(pattern, extend({}, options, {
expand: true
}));
};
/**
* Expands a brace pattern into a regex-compatible, optimized string. This method is called by the main [braces](#braces) function by default.
*
* ```js
* var braces = require('braces');
* console.log(braces.expand('a/{b,c}/d'));
* //=> ['a/(b|c)/d']
* ```
* @param {String} `pattern` Brace pattern
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.optimize = function (pattern, options) {
return braces.create(pattern, options);
};
/**
* Processes a brace pattern and returns either an expanded array (if `options.expand` is true), a highly optimized regex-compatible string. This method is called by the main [braces](#braces) function.
*
* ```js
* var braces = require('braces');
* console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
* //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
* ```
* @param {String} `pattern` Brace pattern
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.create = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
var maxLength = options && options.maxLength || MAX_LENGTH;
if (pattern.length >= maxLength) {
throw new Error('expected pattern to be less than ' + maxLength + ' characters');
}
function create() {
if (pattern === '' || pattern.length < 3) {
return [pattern];
}
if (utils.isEmptySets(pattern)) {
return [];
}
if (utils.isQuotedString(pattern)) {
return [pattern.slice(1, -1)];
}
var proto = new Braces(options);
var result = !options || options.expand !== true ? proto.optimize(pattern, options) : proto.expand(pattern, options); // get the generated pattern(s)
var arr = result.output; // filter out empty strings if specified
if (options && options.noempty === true) {
arr = arr.filter(Boolean);
} // filter out duplicates if specified
if (options && options.nodupes === true) {
arr = unique(arr);
}
Object.defineProperty(arr, 'result', {
enumerable: false,
value: result
});
return arr;
}
return memoize('create', pattern, options, create);
};
/**
* Create a regular expression from the given string `pattern`.
*
* ```js
* var braces = require('braces');
*
* console.log(braces.makeRe('id-{200..300}'));
* //=> /^(?:id-(20[0-9]|2[1-9][0-9]|300))$/
* ```
* @param {String} `pattern` The pattern to convert to regex.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
braces.makeRe = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
var maxLength = options && options.maxLength || MAX_LENGTH;
if (pattern.length >= maxLength) {
throw new Error('expected pattern to be less than ' + maxLength + ' characters');
}
function makeRe() {
var arr = braces(pattern, options);
var opts = extend({
strictErrors: false
}, options);
return toRegex(arr, opts);
}
return memoize('makeRe', pattern, options, makeRe);
};
/**
* Parse the given `str` with the given `options`.
*
* ```js
* var braces = require('braces');
* var ast = braces.parse('a/{b,c}/d');
* console.log(ast);
* // { type: 'root',
* // errors: [],
* // input: 'a/{b,c}/d',
* // nodes:
* // [ { type: 'bos', val: '' },
* // { type: 'text', val: 'a/' },
* // { type: 'brace',
* // nodes:
* // [ { type: 'brace.open', val: '{' },
* // { type: 'text', val: 'b,c' },
* // { type: 'brace.close', val: '}' } ] },
* // { type: 'text', val: '/d' },
* // { type: 'eos', val: '' } ] }
* ```
* @param {String} `pattern` Brace pattern to parse
* @param {Object} `options`
* @return {Object} Returns an AST
* @api public
*/
braces.parse = function (pattern, options) {
var proto = new Braces(options);
return proto.parse(pattern, options);
};
/**
* Compile the given `ast` or string with the given `options`.
*
* ```js
* var braces = require('braces');
* var ast = braces.parse('a/{b,c}/d');
* console.log(braces.compile(ast));
* // { options: { source: 'string' },
* // state: {},
* // compilers:
* // { eos: [Function],
* // noop: [Function],
* // bos: [Function],
* // brace: [Function],
* // 'brace.open': [Function],
* // text: [Function],
* // 'brace.close': [Function] },
* // output: [ 'a/(b|c)/d' ],
* // ast:
* // { ... },
* // parsingErrors: [] }
* ```
* @param {Object|String} `ast` AST from [.parse](#parse). If a string is passed it will be parsed first.
* @param {Object} `options`
* @return {Object} Returns an object that has an `output` property with the compiled string.
* @api public
*/
braces.compile = function (ast, options) {
var proto = new Braces(options);
return proto.compile(ast, options);
};
/**
* Clear the regex cache.
*
* ```js
* braces.clearCache();
* ```
* @api public
*/
braces.clearCache = function () {
cache = braces.cache = {};
};
/**
* Memoize a generated regex or function. A unique key is generated
* from the method name, pattern, and user-defined options. Set
* options.memoize to false to disable.
*/
function memoize(type, pattern, options, fn) {
var key = utils.createKey(type + ':' + pattern, options);
var disabled = options && options.cache === false;
if (disabled) {
braces.clearCache();
return fn(pattern, options);
}
if (cache.hasOwnProperty(key)) {
return cache[key];
}
var res = fn(pattern, options);
cache[key] = res;
return res;
}
/**
* Expose `Braces` constructor and methods
* @type {Function}
*/
braces.Braces = Braces;
braces.compilers = compilers;
braces.parsers = parsers;
braces.cache = cache;
/**
* Expose `braces`
* @type {Function}
*/
module.exports = braces;
/***/ }),
/***/ "./node_modules/braces/lib/braces.js":
/*!*******************************************!*\
!*** ./node_modules/braces/lib/braces.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
var compilers = __webpack_require__(/*! ./compilers */ "./node_modules/braces/lib/compilers.js");
var parsers = __webpack_require__(/*! ./parsers */ "./node_modules/braces/lib/parsers.js");
var utils = __webpack_require__(/*! ./utils */ "./node_modules/braces/lib/utils.js");
/**
* Customize Snapdragon parser and renderer
*/
function Braces(options) {
this.options = extend({}, options);
}
/**
* Initialize braces
*/
Braces.prototype.init = function (options) {
if (this.isInitialized) return;
this.isInitialized = true;
var opts = utils.createOptions({}, this.options, options);
this.snapdragon = this.options.snapdragon || new Snapdragon(opts);
this.compiler = this.snapdragon.compiler;
this.parser = this.snapdragon.parser;
compilers(this.snapdragon, opts);
parsers(this.snapdragon, opts);
/**
* Call Snapdragon `.parse` method. When AST is returned, we check to
* see if any unclosed braces are left on the stack and, if so, we iterate
* over the stack and correct the AST so that compilers are called in the correct
* order and unbalance braces are properly escaped.
*/
utils.define(this.snapdragon, 'parse', function (pattern, options) {
var parsed = Snapdragon.prototype.parse.apply(this, arguments);
this.parser.ast.input = pattern;
var stack = this.parser.stack;
while (stack.length) {
addParent({
type: 'brace.close',
val: ''
}, stack.pop());
}
function addParent(node, parent) {
utils.define(node, 'parent', parent);
parent.nodes.push(node);
} // add non-enumerable parser reference
utils.define(parsed, 'parser', this.parser);
return parsed;
});
};
/**
* Decorate `.parse` method
*/
Braces.prototype.parse = function (ast, options) {
if (ast && _typeof(ast) === 'object' && ast.nodes) return ast;
this.init(options);
return this.snapdragon.parse(ast, options);
};
/**
* Decorate `.compile` method
*/
Braces.prototype.compile = function (ast, options) {
if (typeof ast === 'string') {
ast = this.parse(ast, options);
} else {
this.init(options);
}
return this.snapdragon.compile(ast, options);
};
/**
* Expand
*/
Braces.prototype.expand = function (pattern) {
var ast = this.parse(pattern, {
expand: true
});
return this.compile(ast, {
expand: true
});
};
/**
* Optimize
*/
Braces.prototype.optimize = function (pattern) {
var ast = this.parse(pattern, {
optimize: true
});
return this.compile(ast, {
optimize: true
});
};
/**
* Expose `Braces`
*/
module.exports = Braces;
/***/ }),
/***/ "./node_modules/braces/lib/compilers.js":
/*!**********************************************!*\
!*** ./node_modules/braces/lib/compilers.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(/*! ./utils */ "./node_modules/braces/lib/utils.js");
module.exports = function (braces, options) {
braces.compiler
/**
* bos
*/
.set('bos', function () {
if (this.output) return;
this.ast.queue = isEscaped(this.ast) ? [this.ast.val] : [];
this.ast.count = 1;
})
/**
* Square brackets
*/
.set('bracket', function (node) {
var close = node.close;
var open = !node.escaped ? '[' : '\\[';
var negated = node.negated;
var inner = node.inner;
inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\');
if (inner === ']-') {
inner = '\\]\\-';
}
if (negated && inner.indexOf('.') === -1) {
inner += '.';
}
if (negated && inner.indexOf('/') === -1) {
inner += '/';
}
var val = open + negated + inner + close;
var queue = node.parent.queue;
var last = utils.arrayify(queue.pop());
queue.push(utils.join(last, val));
queue.push.apply(queue, []);
})
/**
* Brace
*/
.set('brace', function (node) {
node.queue = isEscaped(node) ? [node.val] : [];
node.count = 1;
return this.mapVisit(node.nodes);
})
/**
* Open
*/
.set('brace.open', function (node) {
node.parent.open = node.val;
})
/**
* Inner
*/
.set('text', function (node) {
var queue = node.parent.queue;
var escaped = node.escaped;
var segs = [node.val];
if (node.optimize === false) {
options = utils.extend({}, options, {
optimize: false
});
}
if (node.multiplier > 1) {
node.parent.count *= node.multiplier;
}
if (options.quantifiers === true && utils.isQuantifier(node.val)) {
escaped = true;
} else if (node.val.length > 1) {
if (isType(node.parent, 'brace') && !isEscaped(node)) {
var expanded = utils.expand(node.val, options);
segs = expanded.segs;
if (expanded.isOptimized) {
node.parent.isOptimized = true;
} // if nothing was expanded, we probably have a literal brace
if (!segs.length) {
var val = expanded.val || node.val;
if (options.unescape !== false) {
// unescape unexpanded brace sequence/set separators
val = val.replace(/\\([,.])/g, '$1'); // strip quotes
val = val.replace(/["'`]/g, '');
}
segs = [val];
escaped = true;
}
}
} else if (node.val === ',') {
if (options.expand) {
node.parent.queue.push(['']);
segs = [''];
} else {
segs = ['|'];
}
} else {
escaped = true;
}
if (escaped && isType(node.parent, 'brace')) {
if (node.parent.nodes.length <= 4 && node.parent.count === 1) {
node.parent.escaped = true;
} else if (node.parent.length <= 3) {
node.parent.escaped = true;
}
}
if (!hasQueue(node.parent)) {
node.parent.queue = segs;
return;
}
var last = utils.arrayify(queue.pop());
if (node.parent.count > 1 && options.expand) {
last = multiply(last, node.parent.count);
node.parent.count = 1;
}
queue.push(utils.join(utils.flatten(last), segs.shift()));
queue.push.apply(queue, segs);
})
/**
* Close
*/
.set('brace.close', function (node) {
var queue = node.parent.queue;
var prev = node.parent.parent;
var last = prev.queue.pop();
var open = node.parent.open;
var close = node.val;
if (open && close && isOptimized(node, options)) {
open = '(';
close = ')';
} // if a close brace exists, and the previous segment is one character
// don't wrap the result in braces or parens
var ele = utils.last(queue);
if (node.parent.count > 1 && options.expand) {
ele = multiply(queue.pop(), node.parent.count);
node.parent.count = 1;
queue.push(ele);
}
if (close && typeof ele === 'string' && ele.length === 1) {
open = '';
close = '';
}
if ((isLiteralBrace(node, options) || noInner(node)) && !node.parent.hasEmpty) {
queue.push(utils.join(open, queue.pop() || ''));
queue = utils.flatten(utils.join(queue, close));
}
if (typeof last === 'undefined') {
prev.queue = [queue];
} else {
prev.queue.push(utils.flatten(utils.join(last, queue)));
}
})
/**
* eos
*/
.set('eos', function (node) {
if (this.input) return;
if (options.optimize !== false) {
this.output = utils.last(utils.flatten(this.ast.queue));
} else if (Array.isArray(utils.last(this.ast.queue))) {
this.output = utils.flatten(this.ast.queue.pop());
} else {
this.output = utils.flatten(this.ast.queue);
}
if (node.parent.count > 1 && options.expand) {
this.output = multiply(this.output, node.parent.count);
}
this.output = utils.arrayify(this.output);
this.ast.queue = [];
});
};
/**
* Multiply the segments in the current brace level
*/
function multiply(queue, n, options) {
return utils.flatten(utils.repeat(utils.arrayify(queue), n));
}
/**
* Return true if `node` is escaped
*/
function isEscaped(node) {
return node.escaped === true;
}
/**
* Returns true if regex parens should be used for sets. If the parent `type`
* is not `brace`, then we're on a root node, which means we should never
* expand segments and open/close braces should be `{}` (since this indicates
* a brace is missing from the set)
*/
function isOptimized(node, options) {
if (node.parent.isOptimized) return true;
return isType(node.parent, 'brace') && !isEscaped(node.parent) && options.expand !== true;
}
/**
* Returns true if the value in `node` should be wrapped in a literal brace.
* @return {Boolean}
*/
function isLiteralBrace(node, options) {
return isEscaped(node.parent) || options.optimize !== false;
}
/**
* Returns true if the given `node` does not have an inner value.
* @return {Boolean}
*/
function noInner(node, type) {
if (node.parent.queue.length === 1) {
return true;
}
var nodes = node.parent.nodes;
return nodes.length === 3 && isType(nodes[0], 'brace.open') && !isType(nodes[1], 'text') && isType(nodes[2], 'brace.close');
}
/**
* Returns true if the given `node` is the given `type`
* @return {Boolean}
*/
function isType(node, type) {
return typeof node !== 'undefined' && node.type === type;
}
/**
* Returns true if the given `node` has a non-empty queue.
* @return {Boolean}
*/
function hasQueue(node) {
return Array.isArray(node.queue) && node.queue.length;
}
/***/ }),
/***/ "./node_modules/braces/lib/parsers.js":
/*!********************************************!*\
!*** ./node_modules/braces/lib/parsers.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Node = __webpack_require__(/*! snapdragon-node */ "./node_modules/snapdragon-node/index.js");
var utils = __webpack_require__(/*! ./utils */ "./node_modules/braces/lib/utils.js");
/**
* Braces parsers
*/
module.exports = function (braces, options) {
braces.parser.set('bos', function () {
if (!this.parsed) {
this.ast = this.nodes[0] = new Node(this.ast);
}
})
/**
* Character parsers
*/
.set('escape', function () {
var pos = this.position();
var m = this.match(/^(?:\\(.)|\$\{)/);
if (!m) return;
var prev = this.prev();
var last = utils.last(prev.nodes);
var node = pos(new Node({
type: 'text',
multiplier: 1,
val: m[0]
}));
if (node.val === '\\\\') {
return node;
}
if (node.val === '${') {
var str = this.input;
var idx = -1;
var ch;
while (ch = str[++idx]) {
this.consume(1);
node.val += ch;
if (ch === '\\') {
node.val += str[++idx];
continue;
}
if (ch === '}') {
break;
}
}
}
if (this.options.unescape !== false) {
node.val = node.val.replace(/\\([{}])/g, '$1');
}
if (last.val === '"' && this.input.charAt(0) === '"') {
last.val = node.val;
this.consume(1);
return;
}
return concatNodes.call(this, pos, node, prev, options);
})
/**
* Brackets: "[...]" (basic, this is overridden by
* other parsers in more advanced implementations)
*/
.set('bracket', function () {
var isInside = this.isInside('brace');
var pos = this.position();
var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]-)(\]|[^*+?]+)|\[)/);
if (!m) return;
var prev = this.prev();
var val = m[0];
var negated = m[1] ? '^' : '';
var inner = m[2] || '';
var close = m[3] || '';
if (isInside && prev.type === 'brace') {
prev.text = prev.text || '';
prev.text += val;
}
var esc = this.input.slice(0, 2);
if (inner === '' && esc === '\\]') {
inner += esc;
this.consume(2);
var str = this.input;
var idx = -1;
var ch;
while (ch = str[++idx]) {
this.consume(1);
if (ch === ']') {
close = ch;
break;
}
inner += ch;
}
}
return pos(new Node({
type: 'bracket',
val: val,
escaped: close !== ']',
negated: negated,
inner: inner,
close: close
}));
})
/**
* Empty braces (we capture these early to
* speed up processing in the compiler)
*/
.set('multiplier', function () {
var isInside = this.isInside('brace');
var pos = this.position();
var m = this.match(/^\{((?:,|\{,+\})+)\}/);
if (!m) return;
this.multiplier = true;
var prev = this.prev();
var val = m[0];
if (isInside && prev.type === 'brace') {
prev.text = prev.text || '';
prev.text += val;
}
var node = pos(new Node({
type: 'text',
multiplier: 1,
match: m,
val: val
}));
return concatNodes.call(this, pos, node, prev, options);
})
/**
* Open
*/
.set('brace.open', function () {
var pos = this.position();
var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/);
if (!m) return;
var prev = this.prev();
var last = utils.last(prev.nodes); // if the last parsed character was an extglob character
// we need to _not optimize_ the brace pattern because
// it might be mistaken for an extglob by a downstream parser
if (last && last.val && isExtglobChar(last.val.slice(-1))) {
last.optimize = false;
}
var open = pos(new Node({
type: 'brace.open',
val: m[0]
}));
var node = pos(new Node({
type: 'brace',
nodes: []
}));
node.push(open);
prev.push(node);
this.push('brace', node);
})
/**
* Close
*/
.set('brace.close', function () {
var pos = this.position();
var m = this.match(/^\}/);
if (!m || !m[0]) return;
var brace = this.pop('brace');
var node = pos(new Node({
type: 'brace.close',
val: m[0]
}));
if (!this.isType(brace, 'brace')) {
if (this.options.strict) {
throw new Error('missing opening "{"');
}
node.type = 'text';
node.multiplier = 0;
node.escaped = true;
return node;
}
var prev = this.prev();
var last = utils.last(prev.nodes);
if (last.text) {
var lastNode = utils.last(last.nodes);
if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) {
var open = last.nodes[0];
var text = last.nodes[1];
if (open.type === 'brace.open' && text && text.type === 'text') {
text.optimize = false;
}
}
}
if (brace.nodes.length > 2) {
var first = brace.nodes[1];
if (first.type === 'text' && first.val === ',') {
brace.nodes.splice(1, 1);
brace.nodes.push(first);
}
}
brace.push(node);
})
/**
* Capture boundary characters
*/
.set('boundary', function () {
var pos = this.position();
var m = this.match(/^[$^](?!\{)/);
if (!m) return;
return pos(new Node({
type: 'text',
val: m[0]
}));
})
/**
* One or zero, non-comma characters wrapped in braces
*/
.set('nobrace', function () {
var isInside = this.isInside('brace');
var pos = this.position();
var m = this.match(/^\{[^,]?\}/);
if (!m) return;
var prev = this.prev();
var val = m[0];
if (isInside && prev.type === 'brace') {
prev.text = prev.text || '';
prev.text += val;
}
return pos(new Node({
type: 'text',
multiplier: 0,
val: val
}));
})
/**
* Text
*/
.set('text', function () {
var isInside = this.isInside('brace');
var pos = this.position();
var m = this.match(/^((?!\\)[^${}[\]])+/);
if (!m) return;
var prev = this.prev();
var val = m[0];
if (isInside && prev.type === 'brace') {
prev.text = prev.text || '';
prev.text += val;
}
var node = pos(new Node({
type: 'text',
multiplier: 1,
val: val
}));
return concatNodes.call(this, pos, node, prev, options);
});
};
/**
* Returns true if the character is an extglob character.
*/
function isExtglobChar(ch) {
return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+';
}
/**
* Combine text nodes, and calculate empty sets (`{,,}`)
* @param {Function} `pos` Function to calculate node position
* @param {Object} `node` AST node
* @return {Object}
*/
function concatNodes(pos, node, parent, options) {
node.orig = node.val;
var prev = this.prev();
var last = utils.last(prev.nodes);
var isEscaped = false;
if (node.val.length > 1) {
var a = node.val.charAt(0);
var b = node.val.slice(-1);
isEscaped = a === '"' && b === '"' || a === "'" && b === "'" || a === '`' && b === '`';
}
if (isEscaped && options.unescape !== false) {
node.val = node.val.slice(1, node.val.length - 1);
node.escaped = true;
}
if (node.match) {
var match = node.match[1];
if (!match || match.indexOf('}') === -1) {
match = node.match[0];
} // replace each set with a single ","
var val = match.replace(/\{/g, ',').replace(/\}/g, '');
node.multiplier *= val.length;
node.val = '';
}
var simpleText = last.type === 'text' && last.multiplier === 1 && node.multiplier === 1 && node.val;
if (simpleText) {
last.val += node.val;
return;
}
prev.push(node);
}
/***/ }),
/***/ "./node_modules/braces/lib/utils.js":
/*!******************************************!*\
!*** ./node_modules/braces/lib/utils.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var splitString = __webpack_require__(/*! split-string */ "./node_modules/split-string/index.js");
var utils = module.exports;
/**
* Module dependencies
*/
utils.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
utils.flatten = __webpack_require__(/*! arr-flatten */ "./node_modules/arr-flatten/index.js");
utils.isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
utils.fillRange = __webpack_require__(/*! fill-range */ "./node_modules/fill-range/index.js");
utils.repeat = __webpack_require__(/*! repeat-element */ "./node_modules/repeat-element/index.js");
utils.unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
utils.define = function (obj, key, val) {
Object.defineProperty(obj, key, {
writable: true,
configurable: true,
enumerable: false,
value: val
});
};
/**
* Returns true if the given string contains only empty brace sets.
*/
utils.isEmptySets = function (str) {
return /^(?:\{,\})+$/.test(str);
};
/**
* Returns true if the given string contains only empty brace sets.
*/
utils.isQuotedString = function (str) {
var open = str.charAt(0);
if (open === '\'' || open === '"' || open === '`') {
return str.slice(-1) === open;
}
return false;
};
/**
* Create the key to use for memoization. The unique key is generated
* by iterating over the options and concatenating key-value pairs
* to the pattern string.
*/
utils.createKey = function (pattern, options) {
var id = pattern;
if (typeof options === 'undefined') {
return id;
}
var keys = Object.keys(options);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
id += ';' + key + '=' + String(options[key]);
}
return id;
};
/**
* Normalize options
*/
utils.createOptions = function (options) {
var opts = utils.extend.apply(null, arguments);
if (typeof opts.expand === 'boolean') {
opts.optimize = !opts.expand;
}
if (typeof opts.optimize === 'boolean') {
opts.expand = !opts.optimize;
}
if (opts.optimize === true) {
opts.makeRe = true;
}
return opts;
};
/**
* Join patterns in `a` to patterns in `b`
*/
utils.join = function (a, b, options) {
options = options || {};
a = utils.arrayify(a);
b = utils.arrayify(b);
if (!a.length) return b;
if (!b.length) return a;
var len = a.length;
var idx = -1;
var arr = [];
while (++idx < len) {
var val = a[idx];
if (Array.isArray(val)) {
for (var i = 0; i < val.length; i++) {
val[i] = utils.join(val[i], b, options);
}
arr.push(val);
continue;
}
for (var j = 0; j < b.length; j++) {
var bval = b[j];
if (Array.isArray(bval)) {
arr.push(utils.join(val, bval, options));
} else {
arr.push(val + bval);
}
}
}
return arr;
};
/**
* Split the given string on `,` if not escaped.
*/
utils.split = function (str, options) {
var opts = utils.extend({
sep: ','
}, options);
if (typeof opts.keepQuotes !== 'boolean') {
opts.keepQuotes = true;
}
if (opts.unescape === false) {
opts.keepEscaping = true;
}
return splitString(str, opts, utils.escapeBrackets(opts));
};
/**
* Expand ranges or sets in the given `pattern`.
*
* @param {String} `str`
* @param {Object} `options`
* @return {Object}
*/
utils.expand = function (str, options) {
var opts = utils.extend({
rangeLimit: 10000
}, options);
var segs = utils.split(str, opts);
var tok = {
segs: segs
};
if (utils.isQuotedString(str)) {
return tok;
}
if (opts.rangeLimit === true) {
opts.rangeLimit = 10000;
}
if (segs.length > 1) {
if (opts.optimize === false) {
tok.val = segs[0];
return tok;
}
tok.segs = utils.stringifyArray(tok.segs);
} else if (segs.length === 1) {
var arr = str.split('..');
if (arr.length === 1) {
tok.val = tok.segs[tok.segs.length - 1] || tok.val || str;
tok.segs = [];
return tok;
}
if (arr.length === 2 && arr[0] === arr[1]) {
tok.escaped = true;
tok.val = arr[0];
tok.segs = [];
return tok;
}
if (arr.length > 1) {
if (opts.optimize !== false) {
opts.optimize = true;
delete opts.expand;
}
if (opts.optimize !== true) {
var min = Math.min(arr[0], arr[1]);
var max = Math.max(arr[0], arr[1]);
var step = arr[2] || 1;
if (opts.rangeLimit !== false && (max - min) / step >= opts.rangeLimit) {
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
}
}
arr.push(opts);
tok.segs = utils.fillRange.apply(null, arr);
if (!tok.segs.length) {
tok.escaped = true;
tok.val = str;
return tok;
}
if (opts.optimize === true) {
tok.segs = utils.stringifyArray(tok.segs);
}
if (tok.segs === '') {
tok.val = str;
} else {
tok.val = tok.segs[0];
}
return tok;
}
} else {
tok.val = str;
}
return tok;
};
/**
* Ensure commas inside brackets and parens are not split.
* @param {Object} `tok` Token from the `split-string` module
* @return {undefined}
*/
utils.escapeBrackets = function (options) {
return function (tok) {
if (tok.escaped && tok.val === 'b') {
tok.val = '\\b';
return;
}
if (tok.val !== '(' && tok.val !== '[') return;
var opts = utils.extend({}, options);
var brackets = [];
var parens = [];
var stack = [];
var val = tok.val;
var str = tok.str;
var i = tok.idx - 1;
while (++i < str.length) {
var ch = str[i];
if (ch === '\\') {
val += (opts.keepEscaping === false ? '' : ch) + str[++i];
continue;
}
if (ch === '(') {
parens.push(ch);
stack.push(ch);
}
if (ch === '[') {
brackets.push(ch);
stack.push(ch);
}
if (ch === ')') {
parens.pop();
stack.pop();
if (!stack.length) {
val += ch;
break;
}
}
if (ch === ']') {
brackets.pop();
stack.pop();
if (!stack.length) {
val += ch;
break;
}
}
val += ch;
}
tok.split = false;
tok.val = val.slice(1);
tok.idx = i;
};
};
/**
* Returns true if the given string looks like a regex quantifier
* @return {Boolean}
*/
utils.isQuantifier = function (str) {
return /^(?:[0-9]?,[0-9]|[0-9],)$/.test(str);
};
/**
* Cast `val` to an array.
* @param {*} `val`
*/
utils.stringifyArray = function (arr) {
return [utils.arrayify(arr).join('|')];
};
/**
* Cast `val` to an array.
* @param {*} `val`
*/
utils.arrayify = function (arr) {
if (typeof arr === 'undefined') {
return [];
}
if (typeof arr === 'string') {
return [arr];
}
return arr;
};
/**
* Returns true if the given `str` is a non-empty string
* @return {Boolean}
*/
utils.isString = function (str) {
return str != null && typeof str === 'string';
};
/**
* Get the last element from `array`
* @param {Array} `array`
* @return {*}
*/
utils.last = function (arr, n) {
return arr[arr.length - (n || 1)];
};
utils.escapeRegex = function (str) {
return str.replace(/\\?([!^*?()[\]{}+?/])/g, '\\$1');
};
/***/ }),
/***/ "./node_modules/cache-base/index.js":
/*!******************************************!*\
!*** ./node_modules/cache-base/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/cache-base/node_modules/component-emitter/index.js");
var visit = __webpack_require__(/*! collection-visit */ "./node_modules/collection-visit/index.js");
var toPath = __webpack_require__(/*! to-object-path */ "./node_modules/to-object-path/index.js");
var union = __webpack_require__(/*! union-value */ "./node_modules/union-value/index.js");
var del = __webpack_require__(/*! unset-value */ "./node_modules/unset-value/index.js");
var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
var has = __webpack_require__(/*! has-value */ "./node_modules/has-value/index.js");
var set = __webpack_require__(/*! set-value */ "./node_modules/set-value/index.js");
/**
* Create a `Cache` constructor that when instantiated will
* store values on the given `prop`.
*
* ```js
* var Cache = require('cache-base').namespace('data');
* var cache = new Cache();
*
* cache.set('foo', 'bar');
* //=> {data: {foo: 'bar'}}
* ```
* @param {String} `prop` The property name to use for storing values.
* @return {Function} Returns a custom `Cache` constructor
* @api public
*/
function namespace(prop) {
/**
* Create a new `Cache`. Internally the `Cache` constructor is created using
* the `namespace` function, with `cache` defined as the storage object.
*
* ```js
* var app = new Cache();
* ```
* @param {Object} `cache` Optionally pass an object to initialize with.
* @constructor
* @api public
*/
function Cache(cache) {
if (prop) {
this[prop] = {};
}
if (cache) {
this.set(cache);
}
}
/**
* Inherit Emitter
*/
Emitter(Cache.prototype);
/**
* Assign `value` to `key`. Also emits `set` with
* the key and value.
*
* ```js
* app.on('set', function(key, val) {
* // do something when `set` is emitted
* });
*
* app.set(key, value);
*
* // also takes an object or array
* app.set({name: 'Halle'});
* app.set([{foo: 'bar'}, {baz: 'quux'}]);
* console.log(app);
* //=> {name: 'Halle', foo: 'bar', baz: 'quux'}
* ```
*
* @name .set
* @emits `set` with `key` and `value` as arguments.
* @param {String} `key`
* @param {any} `value`
* @return {Object} Returns the instance for chaining.
* @api public
*/
Cache.prototype.set = function (key, val) {
if (Array.isArray(key) && arguments.length === 2) {
key = toPath(key);
}
if (isObject(key) || Array.isArray(key)) {
this.visit('set', key);
} else {
set(prop ? this[prop] : this, key, val);
this.emit('set', key, val);
}
return this;
};
/**
* Union `array` to `key`. Also emits `set` with
* the key and value.
*
* ```js
* app.union('a.b', ['foo']);
* app.union('a.b', ['bar']);
* console.log(app.get('a'));
* //=> {b: ['foo', 'bar']}
* ```
* @name .union
* @param {String} `key`
* @param {any} `value`
* @return {Object} Returns the instance for chaining.
* @api public
*/
Cache.prototype.union = function (key, val) {
if (Array.isArray(key) && arguments.length === 2) {
key = toPath(key);
}
var ctx = prop ? this[prop] : this;
union(ctx, key, arrayify(val));
this.emit('union', val);
return this;
};
/**
* Return the value of `key`. Dot notation may be used
* to get [nested property values][get-value].
*
* ```js
* app.set('a.b.c', 'd');
* app.get('a.b');
* //=> {c: 'd'}
*
* app.get(['a', 'b']);
* //=> {c: 'd'}
* ```
*
* @name .get
* @emits `get` with `key` and `value` as arguments.
* @param {String} `key` The name of the property to get. Dot-notation may be used.
* @return {any} Returns the value of `key`
* @api public
*/
Cache.prototype.get = function (key) {
key = toPath(arguments);
var ctx = prop ? this[prop] : this;
var val = get(ctx, key);
this.emit('get', key, val);
return val;
};
/**
* Return true if app has a stored value for `key`,
* false only if value is `undefined`.
*
* ```js
* app.set('foo', 'bar');
* app.has('foo');
* //=> true
* ```
*
* @name .has
* @emits `has` with `key` and true or false as arguments.
* @param {String} `key`
* @return {Boolean}
* @api public
*/
Cache.prototype.has = function (key) {
key = toPath(arguments);
var ctx = prop ? this[prop] : this;
var val = get(ctx, key);
var has = typeof val !== 'undefined';
this.emit('has', key, has);
return has;
};
/**
* Delete one or more properties from the instance.
*
* ```js
* app.del(); // delete all
* // or
* app.del('foo');
* // or
* app.del(['foo', 'bar']);
* ```
* @name .del
* @emits `del` with the `key` as the only argument.
* @param {String|Array} `key` Property name or array of property names.
* @return {Object} Returns the instance for chaining.
* @api public
*/
Cache.prototype.del = function (key) {
if (Array.isArray(key)) {
this.visit('del', key);
} else {
del(prop ? this[prop] : this, key);
this.emit('del', key);
}
return this;
};
/**
* Reset the entire cache to an empty object.
*
* ```js
* app.clear();
* ```
* @api public
*/
Cache.prototype.clear = function () {
if (prop) {
this[prop] = {};
}
};
/**
* Visit `method` over the properties in the given object, or map
* visit over the object-elements in an array.
*
* @name .visit
* @param {String} `method` The name of the `base` method to call.
* @param {Object|Array} `val` The object or array to iterate over.
* @return {Object} Returns the instance for chaining.
* @api public
*/
Cache.prototype.visit = function (method, val) {
visit(this, method, val);
return this;
};
return Cache;
}
/**
* Cast val to an array
*/
function arrayify(val) {
return val ? Array.isArray(val) ? val : [val] : [];
}
/**
* Expose `Cache`
*/
module.exports = namespace();
/**
* Expose `Cache.namespace`
*/
module.exports.namespace = namespace;
/***/ }),
/***/ "./node_modules/cache-base/node_modules/component-emitter/index.js":
/*!*************************************************************************!*\
!*** ./node_modules/cache-base/node_modules/component-emitter/index.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Expose `Emitter`.
*/
if (true) {
module.exports = Emitter;
}
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
}
;
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function (event, fn) {
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
this._callbacks = this._callbacks || {}; // all
if (0 == arguments.length) {
this._callbacks = {};
return this;
} // specific event
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this; // remove all handlers
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
} // remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
} // Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function (event) {
this._callbacks = this._callbacks || {};
var args = new Array(arguments.length - 1),
callbacks = this._callbacks['$' + event];
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function (event) {
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function (event) {
return !!this.listeners(event).length;
};
/***/ }),
/***/ "./node_modules/class-utils/index.js":
/*!*******************************************!*\
!*** ./node_modules/class-utils/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var union = __webpack_require__(/*! arr-union */ "./node_modules/arr-union/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
var staticExtend = __webpack_require__(/*! static-extend */ "./node_modules/static-extend/index.js");
var isObj = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
/**
* Expose class utils
*/
var cu = module.exports;
/**
* Expose class utils: `cu`
*/
cu.isObject = function isObject(val) {
return isObj(val) || typeof val === 'function';
};
/**
* Returns true if an array has any of the given elements, or an
* object has any of the give keys.
*
* ```js
* cu.has(['a', 'b', 'c'], 'c');
* //=> true
*
* cu.has(['a', 'b', 'c'], ['c', 'z']);
* //=> true
*
* cu.has({a: 'b', c: 'd'}, ['c', 'z']);
* //=> true
* ```
* @param {Object} `obj`
* @param {String|Array} `val`
* @return {Boolean}
* @api public
*/
cu.has = function has(obj, val) {
val = cu.arrayify(val);
var len = val.length;
if (cu.isObject(obj)) {
for (var key in obj) {
if (val.indexOf(key) > -1) {
return true;
}
}
var keys = cu.nativeKeys(obj);
return cu.has(keys, val);
}
if (Array.isArray(obj)) {
var arr = obj;
while (len--) {
if (arr.indexOf(val[len]) > -1) {
return true;
}
}
return false;
}
throw new TypeError('expected an array or object.');
};
/**
* Returns true if an array or object has all of the given values.
*
* ```js
* cu.hasAll(['a', 'b', 'c'], 'c');
* //=> true
*
* cu.hasAll(['a', 'b', 'c'], ['c', 'z']);
* //=> false
*
* cu.hasAll({a: 'b', c: 'd'}, ['c', 'z']);
* //=> false
* ```
* @param {Object|Array} `val`
* @param {String|Array} `values`
* @return {Boolean}
* @api public
*/
cu.hasAll = function hasAll(val, values) {
values = cu.arrayify(values);
var len = values.length;
while (len--) {
if (!cu.has(val, values[len])) {
return false;
}
}
return true;
};
/**
* Cast the given value to an array.
*
* ```js
* cu.arrayify('foo');
* //=> ['foo']
*
* cu.arrayify(['foo']);
* //=> ['foo']
* ```
*
* @param {String|Array} `val`
* @return {Array}
* @api public
*/
cu.arrayify = function arrayify(val) {
return val ? Array.isArray(val) ? val : [val] : [];
};
/**
* Noop
*/
cu.noop = function noop() {
return;
};
/**
* Returns the first argument passed to the function.
*/
cu.identity = function identity(val) {
return val;
};
/**
* Returns true if a value has a `contructor`
*
* ```js
* cu.hasConstructor({});
* //=> true
*
* cu.hasConstructor(Object.create(null));
* //=> false
* ```
* @param {Object} `value`
* @return {Boolean}
* @api public
*/
cu.hasConstructor = function hasConstructor(val) {
return cu.isObject(val) && typeof val.constructor !== 'undefined';
};
/**
* Get the native `ownPropertyNames` from the constructor of the
* given `object`. An empty array is returned if the object does
* not have a constructor.
*
* ```js
* cu.nativeKeys({a: 'b', b: 'c', c: 'd'})
* //=> ['a', 'b', 'c']
*
* cu.nativeKeys(function(){})
* //=> ['length', 'caller']
* ```
*
* @param {Object} `obj` Object that has a `constructor`.
* @return {Array} Array of keys.
* @api public
*/
cu.nativeKeys = function nativeKeys(val) {
if (!cu.hasConstructor(val)) return [];
var keys = Object.getOwnPropertyNames(val);
if ('caller' in val) keys.push('caller');
return keys;
};
/**
* Returns property descriptor `key` if it's an "own" property
* of the given object.
*
* ```js
* function App() {}
* Object.defineProperty(App.prototype, 'count', {
* get: function() {
* return Object.keys(this).length;
* }
* });
* cu.getDescriptor(App.prototype, 'count');
* // returns:
* // {
* // get: [Function],
* // set: undefined,
* // enumerable: false,
* // configurable: false
* // }
* ```
*
* @param {Object} `obj`
* @param {String} `key`
* @return {Object} Returns descriptor `key`
* @api public
*/
cu.getDescriptor = function getDescriptor(obj, key) {
if (!cu.isObject(obj)) {
throw new TypeError('expected an object.');
}
if (typeof key !== 'string') {
throw new TypeError('expected key to be a string.');
}
return Object.getOwnPropertyDescriptor(obj, key);
};
/**
* Copy a descriptor from one object to another.
*
* ```js
* function App() {}
* Object.defineProperty(App.prototype, 'count', {
* get: function() {
* return Object.keys(this).length;
* }
* });
* var obj = {};
* cu.copyDescriptor(obj, App.prototype, 'count');
* ```
* @param {Object} `receiver`
* @param {Object} `provider`
* @param {String} `name`
* @return {Object}
* @api public
*/
cu.copyDescriptor = function copyDescriptor(receiver, provider, name) {
if (!cu.isObject(receiver)) {
throw new TypeError('expected receiving object to be an object.');
}
if (!cu.isObject(provider)) {
throw new TypeError('expected providing object to be an object.');
}
if (typeof name !== 'string') {
throw new TypeError('expected name to be a string.');
}
var val = cu.getDescriptor(provider, name);
if (val) Object.defineProperty(receiver, name, val);
};
/**
* Copy static properties, prototype properties, and descriptors
* from one object to another.
*
* @param {Object} `receiver`
* @param {Object} `provider`
* @param {String|Array} `omit` One or more properties to omit
* @return {Object}
* @api public
*/
cu.copy = function copy(receiver, provider, omit) {
if (!cu.isObject(receiver)) {
throw new TypeError('expected receiving object to be an object.');
}
if (!cu.isObject(provider)) {
throw new TypeError('expected providing object to be an object.');
}
var props = Object.getOwnPropertyNames(provider);
var keys = Object.keys(provider);
var len = props.length,
key;
omit = cu.arrayify(omit);
while (len--) {
key = props[len];
if (cu.has(keys, key)) {
define(receiver, key, provider[key]);
} else if (!(key in receiver) && !cu.has(omit, key)) {
cu.copyDescriptor(receiver, provider, key);
}
}
};
/**
* Inherit the static properties, prototype properties, and descriptors
* from of an object.
*
* @param {Object} `receiver`
* @param {Object} `provider`
* @param {String|Array} `omit` One or more properties to omit
* @return {Object}
* @api public
*/
cu.inherit = function inherit(receiver, provider, omit) {
if (!cu.isObject(receiver)) {
throw new TypeError('expected receiving object to be an object.');
}
if (!cu.isObject(provider)) {
throw new TypeError('expected providing object to be an object.');
}
var keys = [];
for (var key in provider) {
keys.push(key);
receiver[key] = provider[key];
}
keys = keys.concat(cu.arrayify(omit));
var a = provider.prototype || provider;
var b = receiver.prototype || receiver;
cu.copy(b, a, keys);
};
/**
* Returns a function for extending the static properties,
* prototype properties, and descriptors from the `Parent`
* constructor onto `Child` constructors.
*
* ```js
* var extend = cu.extend(Parent);
* Parent.extend(Child);
*
* // optional methods
* Parent.extend(Child, {
* foo: function() {},
* bar: function() {}
* });
* ```
* @param {Function} `Parent` Parent ctor
* @param {Function} `extend` Optional extend function to handle custom extensions. Useful when updating methods that require a specific prototype.
* @param {Function} `Child` Child ctor
* @param {Object} `proto` Optionally pass additional prototype properties to inherit.
* @return {Object}
* @api public
*/
cu.extend = function () {
// keep it lazy, instead of assigning to `cu.extend`
return staticExtend.apply(null, arguments);
};
/**
* Bubble up events emitted from static methods on the Parent ctor.
*
* @param {Object} `Parent`
* @param {Array} `events` Event names to bubble up
* @api public
*/
cu.bubble = function (Parent, events) {
events = events || [];
Parent.bubble = function (Child, arr) {
if (Array.isArray(arr)) {
events = union([], events, arr);
}
var len = events.length;
var idx = -1;
while (++idx < len) {
var name = events[idx];
Parent.on(name, Child.emit.bind(Child, name));
}
cu.bubble(Child, events);
};
};
/***/ }),
/***/ "./node_modules/collection-visit/index.js":
/*!************************************************!*\
!*** ./node_modules/collection-visit/index.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* collection-visit <https://github.com/jonschlinkert/collection-visit>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var visit = __webpack_require__(/*! object-visit */ "./node_modules/object-visit/index.js");
var mapVisit = __webpack_require__(/*! map-visit */ "./node_modules/map-visit/index.js");
module.exports = function (collection, method, val) {
var result;
if (typeof val === 'string' && method in collection) {
var args = [].slice.call(arguments, 2);
result = collection[method].apply(collection, args);
} else if (Array.isArray(val)) {
result = mapVisit.apply(null, arguments);
} else {
result = visit.apply(null, arguments);
}
if (typeof result !== 'undefined') {
return result;
}
return collection;
};
/***/ }),
/***/ "./node_modules/color-convert/conversions.js":
/*!***************************************************!*\
!*** ./node_modules/color-convert/conversions.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* MIT license */
var cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js"); // NOTE: conversions should only return primitive values (i.e. arrays, or
// values that give correct `typeof` results).
// do not use box values types (i.e. Number(), String(), etc.)
var reverseKeywords = {};
for (var key in cssKeywords) {
if (cssKeywords.hasOwnProperty(key)) {
reverseKeywords[cssKeywords[key]] = key;
}
}
var convert = module.exports = {
rgb: {
channels: 3,
labels: 'rgb'
},
hsl: {
channels: 3,
labels: 'hsl'
},
hsv: {
channels: 3,
labels: 'hsv'
},
hwb: {
channels: 3,
labels: 'hwb'
},
cmyk: {
channels: 4,
labels: 'cmyk'
},
xyz: {
channels: 3,
labels: 'xyz'
},
lab: {
channels: 3,
labels: 'lab'
},
lch: {
channels: 3,
labels: 'lch'
},
hex: {
channels: 1,
labels: ['hex']
},
keyword: {
channels: 1,
labels: ['keyword']
},
ansi16: {
channels: 1,
labels: ['ansi16']
},
ansi256: {
channels: 1,
labels: ['ansi256']
},
hcg: {
channels: 3,
labels: ['h', 'c', 'g']
},
apple: {
channels: 3,
labels: ['r16', 'g16', 'b16']
},
gray: {
channels: 1,
labels: ['gray']
}
}; // hide .channels and .labels properties
for (var model in convert) {
if (convert.hasOwnProperty(model)) {
if (!('channels' in convert[model])) {
throw new Error('missing channels property: ' + model);
}
if (!('labels' in convert[model])) {
throw new Error('missing channel labels property: ' + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error('channel and label counts mismatch: ' + model);
}
var channels = convert[model].channels;
var labels = convert[model].labels;
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], 'channels', {
value: channels
});
Object.defineProperty(convert[model], 'labels', {
value: labels
});
}
}
convert.rgb.hsl = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var delta = max - min;
var h;
var s;
var l;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
return [h, s * 100, l * 100];
};
convert.rgb.hsv = function (rgb) {
var rdif;
var gdif;
var bdif;
var h;
var s;
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var v = Math.max(r, g, b);
var diff = v - Math.min(r, g, b);
var diffc = function diffc(c) {
return (v - c) / 6 / diff + 1 / 2;
};
if (diff === 0) {
h = s = 0;
} else {
s = diff / v;
rdif = diffc(r);
gdif = diffc(g);
bdif = diffc(b);
if (r === v) {
h = bdif - gdif;
} else if (g === v) {
h = 1 / 3 + rdif - bdif;
} else if (b === v) {
h = 2 / 3 + gdif - rdif;
}
if (h < 0) {
h += 1;
} else if (h > 1) {
h -= 1;
}
}
return [h * 360, s * 100, v * 100];
};
convert.rgb.hwb = function (rgb) {
var r = rgb[0];
var g = rgb[1];
var b = rgb[2];
var h = convert.rgb.hsl(rgb)[0];
var w = 1 / 255 * Math.min(r, Math.min(g, b));
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
return [h, w * 100, b * 100];
};
convert.rgb.cmyk = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var c;
var m;
var y;
var k;
k = Math.min(1 - r, 1 - g, 1 - b);
c = (1 - r - k) / (1 - k) || 0;
m = (1 - g - k) / (1 - k) || 0;
y = (1 - b - k) / (1 - k) || 0;
return [c * 100, m * 100, y * 100, k * 100];
};
/**
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
* */
function comparativeDistance(x, y) {
return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
}
convert.rgb.keyword = function (rgb) {
var reversed = reverseKeywords[rgb];
if (reversed) {
return reversed;
}
var currentClosestDistance = Infinity;
var currentClosestKeyword;
for (var keyword in cssKeywords) {
if (cssKeywords.hasOwnProperty(keyword)) {
var value = cssKeywords[keyword]; // Compute comparative distance
var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
}
return currentClosestKeyword;
};
convert.keyword.rgb = function (keyword) {
return cssKeywords[keyword];
};
convert.rgb.xyz = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255; // assume sRGB
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
return [x * 100, y * 100, z * 100];
};
convert.rgb.lab = function (rgb) {
var xyz = convert.rgb.xyz(rgb);
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
l = 116 * y - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.hsl.rgb = function (hsl) {
var h = hsl[0] / 360;
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var t1;
var t2;
var t3;
var rgb;
var val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
t1 = 2 * l - t2;
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) {
t3++;
}
if (t3 > 1) {
t3--;
}
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
return rgb;
};
convert.hsl.hsv = function (hsl) {
var h = hsl[0];
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var smin = s;
var lmin = Math.max(l, 0.01);
var sv;
var v;
l *= 2;
s *= l <= 1 ? l : 2 - l;
smin *= lmin <= 1 ? lmin : 2 - lmin;
v = (l + s) / 2;
sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
return [h, sv * 100, v * 100];
};
convert.hsv.rgb = function (hsv) {
var h = hsv[0] / 60;
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var hi = Math.floor(h) % 6;
var f = h - Math.floor(h);
var p = 255 * v * (1 - s);
var q = 255 * v * (1 - s * f);
var t = 255 * v * (1 - s * (1 - f));
v *= 255;
switch (hi) {
case 0:
return [v, t, p];
case 1:
return [q, v, p];
case 2:
return [p, v, t];
case 3:
return [p, q, v];
case 4:
return [t, p, v];
case 5:
return [v, p, q];
}
};
convert.hsv.hsl = function (hsv) {
var h = hsv[0];
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var vmin = Math.max(v, 0.01);
var lmin;
var sl;
var l;
l = (2 - s) * v;
lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= lmin <= 1 ? lmin : 2 - lmin;
sl = sl || 0;
l /= 2;
return [h, sl * 100, l * 100];
}; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
convert.hwb.rgb = function (hwb) {
var h = hwb[0] / 360;
var wh = hwb[1] / 100;
var bl = hwb[2] / 100;
var ratio = wh + bl;
var i;
var v;
var f;
var n; // wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
i = Math.floor(6 * h);
v = 1 - bl;
f = 6 * h - i;
if ((i & 0x01) !== 0) {
f = 1 - f;
}
n = wh + f * (v - wh); // linear interpolation
var r;
var g;
var b;
switch (i) {
default:
case 6:
case 0:
r = v;
g = n;
b = wh;
break;
case 1:
r = n;
g = v;
b = wh;
break;
case 2:
r = wh;
g = v;
b = n;
break;
case 3:
r = wh;
g = n;
b = v;
break;
case 4:
r = n;
g = wh;
b = v;
break;
case 5:
r = v;
g = wh;
b = n;
break;
}
return [r * 255, g * 255, b * 255];
};
convert.cmyk.rgb = function (cmyk) {
var c = cmyk[0] / 100;
var m = cmyk[1] / 100;
var y = cmyk[2] / 100;
var k = cmyk[3] / 100;
var r;
var g;
var b;
r = 1 - Math.min(1, c * (1 - k) + k);
g = 1 - Math.min(1, m * (1 - k) + k);
b = 1 - Math.min(1, y * (1 - k) + k);
return [r * 255, g * 255, b * 255];
};
convert.xyz.rgb = function (xyz) {
var x = xyz[0] / 100;
var y = xyz[1] / 100;
var z = xyz[2] / 100;
var r;
var g;
var b;
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
r = Math.min(Math.max(0, r), 1);
g = Math.min(Math.max(0, g), 1);
b = Math.min(Math.max(0, b), 1);
return [r * 255, g * 255, b * 255];
};
convert.xyz.lab = function (xyz) {
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
l = 116 * y - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.lab.xyz = function (lab) {
var l = lab[0];
var a = lab[1];
var b = lab[2];
var x;
var y;
var z;
y = (l + 16) / 116;
x = a / 500 + y;
z = y - b / 200;
var y2 = Math.pow(y, 3);
var x2 = Math.pow(x, 3);
var z2 = Math.pow(z, 3);
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
x *= 95.047;
y *= 100;
z *= 108.883;
return [x, y, z];
};
convert.lab.lch = function (lab) {
var l = lab[0];
var a = lab[1];
var b = lab[2];
var hr;
var h;
var c;
hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
c = Math.sqrt(a * a + b * b);
return [l, c, h];
};
convert.lch.lab = function (lch) {
var l = lch[0];
var c = lch[1];
var h = lch[2];
var a;
var b;
var hr;
hr = h / 360 * 2 * Math.PI;
a = c * Math.cos(hr);
b = c * Math.sin(hr);
return [l, a, b];
};
convert.rgb.ansi16 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2];
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
value = Math.round(value / 50);
if (value === 0) {
return 30;
}
var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
if (value === 2) {
ansi += 60;
}
return ansi;
};
convert.hsv.ansi16 = function (args) {
// optimization here; we already know the value and don't need to get
// it converted for us.
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2]; // we use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r === g && g === b) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round((r - 8) / 247 * 24) + 232;
}
var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
return ansi;
};
convert.ansi16.rgb = function (args) {
var color = args % 10; // handle greyscale
if (color === 0 || color === 7) {
if (args > 50) {
color += 3.5;
}
color = color / 10.5 * 255;
return [color, color, color];
}
var mult = (~~(args > 50) + 1) * 0.5;
var r = (color & 1) * mult * 255;
var g = (color >> 1 & 1) * mult * 255;
var b = (color >> 2 & 1) * mult * 255;
return [r, g, b];
};
convert.ansi256.rgb = function (args) {
// handle greyscale
if (args >= 232) {
var c = (args - 232) * 10 + 8;
return [c, c, c];
}
args -= 16;
var rem;
var r = Math.floor(args / 36) / 5 * 255;
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
var b = rem % 6 / 5 * 255;
return [r, g, b];
};
convert.rgb.hex = function (args) {
var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.hex.rgb = function (args) {
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
var colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split('').map(function (char) {
return char + char;
}).join('');
}
var integer = parseInt(colorString, 16);
var r = integer >> 16 & 0xFF;
var g = integer >> 8 & 0xFF;
var b = integer & 0xFF;
return [r, g, b];
};
convert.rgb.hcg = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var max = Math.max(Math.max(r, g), b);
var min = Math.min(Math.min(r, g), b);
var chroma = max - min;
var grayscale;
var hue;
if (chroma < 1) {
grayscale = min / (1 - chroma);
} else {
grayscale = 0;
}
if (chroma <= 0) {
hue = 0;
} else if (max === r) {
hue = (g - b) / chroma % 6;
} else if (max === g) {
hue = 2 + (b - r) / chroma;
} else {
hue = 4 + (r - g) / chroma + 4;
}
hue /= 6;
hue %= 1;
return [hue * 360, chroma * 100, grayscale * 100];
};
convert.hsl.hcg = function (hsl) {
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var c = 1;
var f = 0;
if (l < 0.5) {
c = 2.0 * s * l;
} else {
c = 2.0 * s * (1.0 - l);
}
if (c < 1.0) {
f = (l - 0.5 * c) / (1.0 - c);
}
return [hsl[0], c * 100, f * 100];
};
convert.hsv.hcg = function (hsv) {
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var c = s * v;
var f = 0;
if (c < 1.0) {
f = (v - c) / (1 - c);
}
return [hsv[0], c * 100, f * 100];
};
convert.hcg.rgb = function (hcg) {
var h = hcg[0] / 360;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
if (c === 0.0) {
return [g * 255, g * 255, g * 255];
}
var pure = [0, 0, 0];
var hi = h % 1 * 6;
var v = hi % 1;
var w = 1 - v;
var mg = 0;
switch (Math.floor(hi)) {
case 0:
pure[0] = 1;
pure[1] = v;
pure[2] = 0;
break;
case 1:
pure[0] = w;
pure[1] = 1;
pure[2] = 0;
break;
case 2:
pure[0] = 0;
pure[1] = 1;
pure[2] = v;
break;
case 3:
pure[0] = 0;
pure[1] = w;
pure[2] = 1;
break;
case 4:
pure[0] = v;
pure[1] = 0;
pure[2] = 1;
break;
default:
pure[0] = 1;
pure[1] = 0;
pure[2] = w;
}
mg = (1.0 - c) * g;
return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
};
convert.hcg.hsv = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
var f = 0;
if (v > 0.0) {
f = c / v;
}
return [hcg[0], f * 100, v * 100];
};
convert.hcg.hsl = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var l = g * (1.0 - c) + 0.5 * c;
var s = 0;
if (l > 0.0 && l < 0.5) {
s = c / (2 * l);
} else if (l >= 0.5 && l < 1.0) {
s = c / (2 * (1 - l));
}
return [hcg[0], s * 100, l * 100];
};
convert.hcg.hwb = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
return [hcg[0], (v - c) * 100, (1 - v) * 100];
};
convert.hwb.hcg = function (hwb) {
var w = hwb[1] / 100;
var b = hwb[2] / 100;
var v = 1 - b;
var c = v - w;
var g = 0;
if (c < 1) {
g = (v - c) / (1 - c);
}
return [hwb[0], c * 100, g * 100];
};
convert.apple.rgb = function (apple) {
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
};
convert.rgb.apple = function (rgb) {
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
};
convert.gray.rgb = function (args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = convert.gray.hsv = function (args) {
return [0, 0, args[0]];
};
convert.gray.hwb = function (gray) {
return [0, 100, gray[0]];
};
convert.gray.cmyk = function (gray) {
return [0, 0, 0, gray[0]];
};
convert.gray.lab = function (gray) {
return [gray[0], 0, 0];
};
convert.gray.hex = function (gray) {
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
var integer = (val << 16) + (val << 8) + val;
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.rgb.gray = function (rgb) {
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
return [val / 255 * 100];
};
/***/ }),
/***/ "./node_modules/color-convert/index.js":
/*!*********************************************!*\
!*** ./node_modules/color-convert/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
var route = __webpack_require__(/*! ./route */ "./node_modules/color-convert/route.js");
var convert = {};
var models = Object.keys(conversions);
function wrapRaw(fn) {
var wrappedFn = function wrappedFn(args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn(args);
}; // preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
var wrappedFn = function wrappedFn(args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn(args); // we're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (_typeof(result) === 'object') {
for (var len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
}; // preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach(function (fromModel) {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], 'channels', {
value: conversions[fromModel].channels
});
Object.defineProperty(convert[fromModel], 'labels', {
value: conversions[fromModel].labels
});
var routes = route(fromModel);
var routeModels = Object.keys(routes);
routeModels.forEach(function (toModel) {
var fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
module.exports = convert;
/***/ }),
/***/ "./node_modules/color-convert/route.js":
/*!*********************************************!*\
!*** ./node_modules/color-convert/route.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
/*
this function routes a model to all other models.
all functions that are routed have a property `.conversion` attached
to the returned synthetic function. This property is an array
of strings, each with the steps in between the 'from' and 'to'
color models (inclusive).
conversions that are not possible simply are not included.
*/
function buildGraph() {
var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
var models = Object.keys(conversions);
for (var len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
} // https://en.wikipedia.org/wiki/Breadth-first_search
function deriveBFS(fromModel) {
var graph = buildGraph();
var queue = [fromModel]; // unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
var current = queue.pop();
var adjacents = Object.keys(conversions[current]);
for (var len = adjacents.length, i = 0; i < len; i++) {
var adjacent = adjacents[i];
var node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
function link(from, to) {
return function (args) {
return to(from(args));
};
}
function wrapConversion(toModel, graph) {
var path = [graph[toModel].parent, toModel];
var fn = conversions[graph[toModel].parent][toModel];
var cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link(conversions[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
module.exports = function (fromModel) {
var graph = deriveBFS(fromModel);
var conversion = {};
var models = Object.keys(graph);
for (var len = models.length, i = 0; i < len; i++) {
var toModel = models[i];
var node = graph[toModel];
if (node.parent === null) {
// no possible conversion, or this node is the source model.
continue;
}
conversion[toModel] = wrapConversion(toModel, graph);
}
return conversion;
};
/***/ }),
/***/ "./node_modules/color-name/index.js":
/*!******************************************!*\
!*** ./node_modules/color-name/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
"aquamarine": [127, 255, 212],
"azure": [240, 255, 255],
"beige": [245, 245, 220],
"bisque": [255, 228, 196],
"black": [0, 0, 0],
"blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255],
"blueviolet": [138, 43, 226],
"brown": [165, 42, 42],
"burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30],
"coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220],
"crimson": [220, 20, 60],
"cyan": [0, 255, 255],
"darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204],
"darkred": [139, 0, 0],
"darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255],
"gold": [255, 215, 0],
"goldenrod": [218, 165, 32],
"gray": [128, 128, 128],
"green": [0, 128, 0],
"greenyellow": [173, 255, 47],
"grey": [128, 128, 128],
"honeydew": [240, 255, 240],
"hotpink": [255, 105, 180],
"indianred": [205, 92, 92],
"indigo": [75, 0, 130],
"ivory": [255, 255, 240],
"khaki": [240, 230, 140],
"lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224],
"lime": [0, 255, 0],
"limegreen": [50, 205, 50],
"linen": [250, 240, 230],
"magenta": [255, 0, 255],
"maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173],
"navy": [0, 0, 128],
"oldlace": [253, 245, 230],
"olive": [128, 128, 0],
"olivedrab": [107, 142, 35],
"orange": [255, 165, 0],
"orangered": [255, 69, 0],
"orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185],
"peru": [205, 133, 63],
"pink": [255, 192, 203],
"plum": [221, 160, 221],
"powderblue": [176, 224, 230],
"purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153],
"red": [255, 0, 0],
"rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114],
"sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87],
"seashell": [255, 245, 238],
"sienna": [160, 82, 45],
"silver": [192, 192, 192],
"skyblue": [135, 206, 235],
"slateblue": [106, 90, 205],
"slategray": [112, 128, 144],
"slategrey": [112, 128, 144],
"snow": [255, 250, 250],
"springgreen": [0, 255, 127],
"steelblue": [70, 130, 180],
"tan": [210, 180, 140],
"teal": [0, 128, 128],
"thistle": [216, 191, 216],
"tomato": [255, 99, 71],
"turquoise": [64, 224, 208],
"violet": [238, 130, 238],
"wheat": [245, 222, 179],
"white": [255, 255, 255],
"whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50]
};
/***/ }),
/***/ "./node_modules/copy-descriptor/index.js":
/*!***********************************************!*\
!*** ./node_modules/copy-descriptor/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* copy-descriptor <https://github.com/jonschlinkert/copy-descriptor>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
/**
* Copy a descriptor from one object to another.
*
* ```js
* function App() {
* this.cache = {};
* }
* App.prototype.set = function(key, val) {
* this.cache[key] = val;
* return this;
* };
* Object.defineProperty(App.prototype, 'count', {
* get: function() {
* return Object.keys(this.cache).length;
* }
* });
*
* copy(App.prototype, 'count', 'len');
*
* // create an instance
* var app = new App();
*
* app.set('a', true);
* app.set('b', true);
* app.set('c', true);
*
* console.log(app.count);
* //=> 3
* console.log(app.len);
* //=> 3
* ```
* @name copy
* @param {Object} `receiver` The target object
* @param {Object} `provider` The provider object
* @param {String} `from` The key to copy on provider.
* @param {String} `to` Optionally specify a new key name to use.
* @return {Object}
* @api public
*/
module.exports = function copyDescriptor(receiver, provider, from, to) {
if (!isObject(provider) && typeof provider !== 'function') {
to = from;
from = provider;
provider = receiver;
}
if (!isObject(receiver) && typeof receiver !== 'function') {
throw new TypeError('expected the first argument to be an object');
}
if (!isObject(provider) && typeof provider !== 'function') {
throw new TypeError('expected provider to be an object');
}
if (typeof to !== 'string') {
to = from;
}
if (typeof from !== 'string') {
throw new TypeError('expected key to be a string');
}
if (!(from in provider)) {
throw new Error('property "' + from + '" does not exist');
}
var val = Object.getOwnPropertyDescriptor(provider, from);
if (val) Object.defineProperty(receiver, to, val);
};
function isObject(val) {
return {}.toString.call(val) === '[object Object]';
}
/***/ }),
/***/ "./node_modules/define-property/index.js":
/*!***********************************************!*\
!*** ./node_modules/define-property/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/define-property/node_modules/is-descriptor/index.js");
module.exports = function defineProperty(obj, prop, val) {
if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
throw new TypeError('expected an object or function.');
}
if (typeof prop !== 'string') {
throw new TypeError('expected `prop` to be a string.');
}
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
return Object.defineProperty(obj, prop, val);
}
return Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
};
/***/ }),
/***/ "./node_modules/define-property/node_modules/is-accessor-descriptor/index.js":
/*!***********************************************************************************!*\
!*** ./node_modules/define-property/node_modules/is-accessor-descriptor/index.js ***!
\***********************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/define-property/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js"); // accessor descriptor properties
var accessor = {
get: 'function',
set: 'function',
configurable: 'boolean',
enumerable: 'boolean'
};
function isAccessorDescriptor(obj, prop) {
if (typeof prop === 'string') {
var val = Object.getOwnPropertyDescriptor(obj, prop);
return typeof val !== 'undefined';
}
if (typeOf(obj) !== 'object') {
return false;
}
if (has(obj, 'value') || has(obj, 'writable')) {
return false;
}
if (!has(obj, 'get') || typeof obj.get !== 'function') {
return false;
} // tldr: it's valid to have "set" be undefined
// "set" might be undefined if `Object.getOwnPropertyDescriptor`
// was used to get the value, and only `get` was defined by the user
if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
return false;
}
for (var key in obj) {
if (!accessor.hasOwnProperty(key)) {
continue;
}
if (typeOf(obj[key]) === accessor[key]) {
continue;
}
if (typeof obj[key] !== 'undefined') {
return false;
}
}
return true;
}
function has(obj, key) {
return {}.hasOwnProperty.call(obj, key);
}
/**
* Expose `isAccessorDescriptor`
*/
module.exports = isAccessorDescriptor;
/***/ }),
/***/ "./node_modules/define-property/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js":
/*!********************************************************************************************************!*\
!*** ./node_modules/define-property/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js ***!
\********************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
var toString = Object.prototype.toString;
/**
* Get the native `typeof` a value.
*
* @param {*} `val`
* @return {*} Native javascript type
*/
module.exports = function kindOf(val) {
// primitivies
if (typeof val === 'undefined') {
return 'undefined';
}
if (val === null) {
return 'null';
}
if (val === true || val === false || val instanceof Boolean) {
return 'boolean';
}
if (typeof val === 'string' || val instanceof String) {
return 'string';
}
if (typeof val === 'number' || val instanceof Number) {
return 'number';
} // functions
if (typeof val === 'function' || val instanceof Function) {
return 'function';
} // array
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
return 'array';
} // check for instances of RegExp and Date before calling `toString`
if (val instanceof RegExp) {
return 'regexp';
}
if (val instanceof Date) {
return 'date';
} // other objects
var type = toString.call(val);
if (type === '[object RegExp]') {
return 'regexp';
}
if (type === '[object Date]') {
return 'date';
}
if (type === '[object Arguments]') {
return 'arguments';
}
if (type === '[object Error]') {
return 'error';
} // buffer
if (isBuffer(val)) {
return 'buffer';
} // es6: Map, WeakMap, Set, WeakSet
if (type === '[object Set]') {
return 'set';
}
if (type === '[object WeakSet]') {
return 'weakset';
}
if (type === '[object Map]') {
return 'map';
}
if (type === '[object WeakMap]') {
return 'weakmap';
}
if (type === '[object Symbol]') {
return 'symbol';
} // typed arrays
if (type === '[object Int8Array]') {
return 'int8array';
}
if (type === '[object Uint8Array]') {
return 'uint8array';
}
if (type === '[object Uint8ClampedArray]') {
return 'uint8clampedarray';
}
if (type === '[object Int16Array]') {
return 'int16array';
}
if (type === '[object Uint16Array]') {
return 'uint16array';
}
if (type === '[object Int32Array]') {
return 'int32array';
}
if (type === '[object Uint32Array]') {
return 'uint32array';
}
if (type === '[object Float32Array]') {
return 'float32array';
}
if (type === '[object Float64Array]') {
return 'float64array';
} // must be a plain object
return 'object';
};
/***/ }),
/***/ "./node_modules/define-property/node_modules/is-data-descriptor/index.js":
/*!*******************************************************************************!*\
!*** ./node_modules/define-property/node_modules/is-data-descriptor/index.js ***!
\*******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/define-property/node_modules/is-data-descriptor/node_modules/kind-of/index.js"); // data descriptor properties
var data = {
configurable: 'boolean',
enumerable: 'boolean',
writable: 'boolean'
};
function isDataDescriptor(obj, prop) {
if (typeOf(obj) !== 'object') {
return false;
}
if (typeof prop === 'string') {
var val = Object.getOwnPropertyDescriptor(obj, prop);
return typeof val !== 'undefined';
}
if (!('value' in obj) && !('writable' in obj)) {
return false;
}
for (var key in obj) {
if (key === 'value') continue;
if (!data.hasOwnProperty(key)) {
continue;
}
if (typeOf(obj[key]) === data[key]) {
continue;
}
if (typeof obj[key] !== 'undefined') {
return false;
}
}
return true;
}
/**
* Expose `isDataDescriptor`
*/
module.exports = isDataDescriptor;
/***/ }),
/***/ "./node_modules/define-property/node_modules/is-data-descriptor/node_modules/kind-of/index.js":
/*!****************************************************************************************************!*\
!*** ./node_modules/define-property/node_modules/is-data-descriptor/node_modules/kind-of/index.js ***!
\****************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
var toString = Object.prototype.toString;
/**
* Get the native `typeof` a value.
*
* @param {*} `val`
* @return {*} Native javascript type
*/
module.exports = function kindOf(val) {
// primitivies
if (typeof val === 'undefined') {
return 'undefined';
}
if (val === null) {
return 'null';
}
if (val === true || val === false || val instanceof Boolean) {
return 'boolean';
}
if (typeof val === 'string' || val instanceof String) {
return 'string';
}
if (typeof val === 'number' || val instanceof Number) {
return 'number';
} // functions
if (typeof val === 'function' || val instanceof Function) {
return 'function';
} // array
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
return 'array';
} // check for instances of RegExp and Date before calling `toString`
if (val instanceof RegExp) {
return 'regexp';
}
if (val instanceof Date) {
return 'date';
} // other objects
var type = toString.call(val);
if (type === '[object RegExp]') {
return 'regexp';
}
if (type === '[object Date]') {
return 'date';
}
if (type === '[object Arguments]') {
return 'arguments';
}
if (type === '[object Error]') {
return 'error';
} // buffer
if (isBuffer(val)) {
return 'buffer';
} // es6: Map, WeakMap, Set, WeakSet
if (type === '[object Set]') {
return 'set';
}
if (type === '[object WeakSet]') {
return 'weakset';
}
if (type === '[object Map]') {
return 'map';
}
if (type === '[object WeakMap]') {
return 'weakmap';
}
if (type === '[object Symbol]') {
return 'symbol';
} // typed arrays
if (type === '[object Int8Array]') {
return 'int8array';
}
if (type === '[object Uint8Array]') {
return 'uint8array';
}
if (type === '[object Uint8ClampedArray]') {
return 'uint8clampedarray';
}
if (type === '[object Int16Array]') {
return 'int16array';
}
if (type === '[object Uint16Array]') {
return 'uint16array';
}
if (type === '[object Int32Array]') {
return 'int32array';
}
if (type === '[object Uint32Array]') {
return 'uint32array';
}
if (type === '[object Float32Array]') {
return 'float32array';
}
if (type === '[object Float64Array]') {
return 'float64array';
} // must be a plain object
return 'object';
};
/***/ }),
/***/ "./node_modules/define-property/node_modules/is-descriptor/index.js":
/*!**************************************************************************!*\
!*** ./node_modules/define-property/node_modules/is-descriptor/index.js ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-descriptor <https://github.com/jonschlinkert/is-descriptor>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/define-property/node_modules/kind-of/index.js");
var isAccessor = __webpack_require__(/*! is-accessor-descriptor */ "./node_modules/define-property/node_modules/is-accessor-descriptor/index.js");
var isData = __webpack_require__(/*! is-data-descriptor */ "./node_modules/define-property/node_modules/is-data-descriptor/index.js");
module.exports = function isDescriptor(obj, key) {
if (typeOf(obj) !== 'object') {
return false;
}
if ('get' in obj) {
return isAccessor(obj, key);
}
return isData(obj, key);
};
/***/ }),
/***/ "./node_modules/define-property/node_modules/kind-of/index.js":
/*!********************************************************************!*\
!*** ./node_modules/define-property/node_modules/kind-of/index.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toString = Object.prototype.toString;
/**
* Get the native `typeof` a value.
*
* @param {*} `val`
* @return {*} Native javascript type
*/
module.exports = function kindOf(val) {
var type = _typeof(val); // primitivies
if (type === 'undefined') {
return 'undefined';
}
if (val === null) {
return 'null';
}
if (val === true || val === false || val instanceof Boolean) {
return 'boolean';
}
if (type === 'string' || val instanceof String) {
return 'string';
}
if (type === 'number' || val instanceof Number) {
return 'number';
} // functions
if (type === 'function' || val instanceof Function) {
if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') {
return 'generatorfunction';
}
return 'function';
} // array
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
return 'array';
} // check for instances of RegExp and Date before calling `toString`
if (val instanceof RegExp) {
return 'regexp';
}
if (val instanceof Date) {
return 'date';
} // other objects
type = toString.call(val);
if (type === '[object RegExp]') {
return 'regexp';
}
if (type === '[object Date]') {
return 'date';
}
if (type === '[object Arguments]') {
return 'arguments';
}
if (type === '[object Error]') {
return 'error';
}
if (type === '[object Promise]') {
return 'promise';
} // buffer
if (isBuffer(val)) {
return 'buffer';
} // es6: Map, WeakMap, Set, WeakSet
if (type === '[object Set]') {
return 'set';
}
if (type === '[object WeakSet]') {
return 'weakset';
}
if (type === '[object Map]') {
return 'map';
}
if (type === '[object WeakMap]') {
return 'weakmap';
}
if (type === '[object Symbol]') {
return 'symbol';
}
if (type === '[object Map Iterator]') {
return 'mapiterator';
}
if (type === '[object Set Iterator]') {
return 'setiterator';
}
if (type === '[object String Iterator]') {
return 'stringiterator';
}
if (type === '[object Array Iterator]') {
return 'arrayiterator';
} // typed arrays
if (type === '[object Int8Array]') {
return 'int8array';
}
if (type === '[object Uint8Array]') {
return 'uint8array';
}
if (type === '[object Uint8ClampedArray]') {
return 'uint8clampedarray';
}
if (type === '[object Int16Array]') {
return 'int16array';
}
if (type === '[object Uint16Array]') {
return 'uint16array';
}
if (type === '[object Int32Array]') {
return 'int32array';
}
if (type === '[object Uint32Array]') {
return 'uint32array';
}
if (type === '[object Float32Array]') {
return 'float32array';
}
if (type === '[object Float64Array]') {
return 'float64array';
} // must be a plain object
return 'object';
};
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
return val.constructor && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
}
/***/ }),
/***/ "./node_modules/esutils/lib/ast.js":
/*!*****************************************!*\
!*** ./node_modules/esutils/lib/ast.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
function isExpression(node) {
if (node == null) {
return false;
}
switch (node.type) {
case 'ArrayExpression':
case 'AssignmentExpression':
case 'BinaryExpression':
case 'CallExpression':
case 'ConditionalExpression':
case 'FunctionExpression':
case 'Identifier':
case 'Literal':
case 'LogicalExpression':
case 'MemberExpression':
case 'NewExpression':
case 'ObjectExpression':
case 'SequenceExpression':
case 'ThisExpression':
case 'UnaryExpression':
case 'UpdateExpression':
return true;
}
return false;
}
function isIterationStatement(node) {
if (node == null) {
return false;
}
switch (node.type) {
case 'DoWhileStatement':
case 'ForInStatement':
case 'ForStatement':
case 'WhileStatement':
return true;
}
return false;
}
function isStatement(node) {
if (node == null) {
return false;
}
switch (node.type) {
case 'BlockStatement':
case 'BreakStatement':
case 'ContinueStatement':
case 'DebuggerStatement':
case 'DoWhileStatement':
case 'EmptyStatement':
case 'ExpressionStatement':
case 'ForInStatement':
case 'ForStatement':
case 'IfStatement':
case 'LabeledStatement':
case 'ReturnStatement':
case 'SwitchStatement':
case 'ThrowStatement':
case 'TryStatement':
case 'VariableDeclaration':
case 'WhileStatement':
case 'WithStatement':
return true;
}
return false;
}
function isSourceElement(node) {
return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
}
function trailingStatement(node) {
switch (node.type) {
case 'IfStatement':
if (node.alternate != null) {
return node.alternate;
}
return node.consequent;
case 'LabeledStatement':
case 'ForStatement':
case 'ForInStatement':
case 'WhileStatement':
case 'WithStatement':
return node.body;
}
return null;
}
function isProblematicIfStatement(node) {
var current;
if (node.type !== 'IfStatement') {
return false;
}
if (node.alternate == null) {
return false;
}
current = node.consequent;
do {
if (current.type === 'IfStatement') {
if (current.alternate == null) {
return true;
}
}
current = trailingStatement(current);
} while (current);
return false;
}
module.exports = {
isExpression: isExpression,
isStatement: isStatement,
isIterationStatement: isIterationStatement,
isSourceElement: isSourceElement,
isProblematicIfStatement: isProblematicIfStatement,
trailingStatement: trailingStatement
};
})();
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ }),
/***/ "./node_modules/esutils/lib/code.js":
/*!******************************************!*\
!*** ./node_modules/esutils/lib/code.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
ES5Regex = {
// ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart:
NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44
// ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart:
NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3
};
ES6Regex = {
// ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3
// ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9
};
function isDecimalDigit(ch) {
return 0x30 <= ch && ch <= 0x39; // 0..9
}
function isHexDigit(ch) {
return 0x30 <= ch && ch <= 0x39 || // 0..9
0x61 <= ch && ch <= 0x66 || // a..f
0x41 <= ch && ch <= 0x46; // A..F
}
function isOctalDigit(ch) {
return ch >= 0x30 && ch <= 0x37; // 0..7
} // 7.2 White Space
NON_ASCII_WHITESPACES = [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
function isWhiteSpace(ch) {
return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
} // 7.3 Line Terminators
function isLineTerminator(ch) {
return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
} // 7.6 Identifier Names and Identifiers
function fromCodePoint(cp) {
if (cp <= 0xFFFF) {
return String.fromCharCode(cp);
}
var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
return cu1 + cu2;
}
IDENTIFIER_START = new Array(0x80);
for (ch = 0; ch < 0x80; ++ch) {
IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
ch >= 0x41 && ch <= 0x5A || // A..Z
ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
}
IDENTIFIER_PART = new Array(0x80);
for (ch = 0; ch < 0x80; ++ch) {
IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
ch >= 0x41 && ch <= 0x5A || // A..Z
ch >= 0x30 && ch <= 0x39 || // 0..9
ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
}
function isIdentifierStartES5(ch) {
return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
}
function isIdentifierPartES5(ch) {
return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
}
function isIdentifierStartES6(ch) {
return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
}
function isIdentifierPartES6(ch) {
return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
}
module.exports = {
isDecimalDigit: isDecimalDigit,
isHexDigit: isHexDigit,
isOctalDigit: isOctalDigit,
isWhiteSpace: isWhiteSpace,
isLineTerminator: isLineTerminator,
isIdentifierStartES5: isIdentifierStartES5,
isIdentifierPartES5: isIdentifierPartES5,
isIdentifierStartES6: isIdentifierStartES6,
isIdentifierPartES6: isIdentifierPartES6
};
})();
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ }),
/***/ "./node_modules/esutils/lib/keyword.js":
/*!*********************************************!*\
!*** ./node_modules/esutils/lib/keyword.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
var code = __webpack_require__(/*! ./code */ "./node_modules/esutils/lib/code.js");
function isStrictModeReservedWordES6(id) {
switch (id) {
case 'implements':
case 'interface':
case 'package':
case 'private':
case 'protected':
case 'public':
case 'static':
case 'let':
return true;
default:
return false;
}
}
function isKeywordES5(id, strict) {
// yield should not be treated as keyword under non-strict mode.
if (!strict && id === 'yield') {
return false;
}
return isKeywordES6(id, strict);
}
function isKeywordES6(id, strict) {
if (strict && isStrictModeReservedWordES6(id)) {
return true;
}
switch (id.length) {
case 2:
return id === 'if' || id === 'in' || id === 'do';
case 3:
return id === 'var' || id === 'for' || id === 'new' || id === 'try';
case 4:
return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
case 5:
return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
case 6:
return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
case 7:
return id === 'default' || id === 'finally' || id === 'extends';
case 8:
return id === 'function' || id === 'continue' || id === 'debugger';
case 10:
return id === 'instanceof';
default:
return false;
}
}
function isReservedWordES5(id, strict) {
return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
}
function isReservedWordES6(id, strict) {
return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
}
function isRestrictedWord(id) {
return id === 'eval' || id === 'arguments';
}
function isIdentifierNameES5(id) {
var i, iz, ch;
if (id.length === 0) {
return false;
}
ch = id.charCodeAt(0);
if (!code.isIdentifierStartES5(ch)) {
return false;
}
for (i = 1, iz = id.length; i < iz; ++i) {
ch = id.charCodeAt(i);
if (!code.isIdentifierPartES5(ch)) {
return false;
}
}
return true;
}
function decodeUtf16(lead, trail) {
return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
}
function isIdentifierNameES6(id) {
var i, iz, ch, lowCh, check;
if (id.length === 0) {
return false;
}
check = code.isIdentifierStartES6;
for (i = 0, iz = id.length; i < iz; ++i) {
ch = id.charCodeAt(i);
if (0xD800 <= ch && ch <= 0xDBFF) {
++i;
if (i >= iz) {
return false;
}
lowCh = id.charCodeAt(i);
if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
return false;
}
ch = decodeUtf16(ch, lowCh);
}
if (!check(ch)) {
return false;
}
check = code.isIdentifierPartES6;
}
return true;
}
function isIdentifierES5(id, strict) {
return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
}
function isIdentifierES6(id, strict) {
return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
}
module.exports = {
isKeywordES5: isKeywordES5,
isKeywordES6: isKeywordES6,
isReservedWordES5: isReservedWordES5,
isReservedWordES6: isReservedWordES6,
isRestrictedWord: isRestrictedWord,
isIdentifierNameES5: isIdentifierNameES5,
isIdentifierNameES6: isIdentifierNameES6,
isIdentifierES5: isIdentifierES5,
isIdentifierES6: isIdentifierES6
};
})();
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ }),
/***/ "./node_modules/esutils/lib/utils.js":
/*!*******************************************!*\
!*** ./node_modules/esutils/lib/utils.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
exports.ast = __webpack_require__(/*! ./ast */ "./node_modules/esutils/lib/ast.js");
exports.code = __webpack_require__(/*! ./code */ "./node_modules/esutils/lib/code.js");
exports.keyword = __webpack_require__(/*! ./keyword */ "./node_modules/esutils/lib/keyword.js");
})();
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ }),
/***/ "./node_modules/expand-brackets/index.js":
/*!***********************************************!*\
!*** ./node_modules/expand-brackets/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(__filename) {
/**
* Local dependencies
*/
var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/expand-brackets/lib/compilers.js");
var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/expand-brackets/lib/parsers.js");
/**
* Module dependencies
*/
var debug = __webpack_require__(/*! debug */ "./node_modules/expand-brackets/node_modules/debug/src/browser.js")('expand-brackets');
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
/**
* Parses the given POSIX character class `pattern` and returns a
* string that can be used for creating regular expressions for matching.
*
* @param {String} `pattern`
* @param {Object} `options`
* @return {Object}
* @api public
*/
function brackets(pattern, options) {
debug('initializing from <%s>', __filename);
var res = brackets.create(pattern, options);
return res.output;
}
/**
* Takes an array of strings and a POSIX character class pattern, and returns a new
* array with only the strings that matched the pattern.
*
* ```js
* var brackets = require('expand-brackets');
* console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]'));
* //=> ['a']
*
* console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+'));
* //=> ['a', 'ab']
* ```
* @param {Array} `arr` Array of strings to match
* @param {String} `pattern` POSIX character class pattern(s)
* @param {Object} `options`
* @return {Array}
* @api public
*/
brackets.match = function (arr, pattern, options) {
arr = [].concat(arr);
var opts = extend({}, options);
var isMatch = brackets.matcher(pattern, opts);
var len = arr.length;
var idx = -1;
var res = [];
while (++idx < len) {
var ele = arr[idx];
if (isMatch(ele)) {
res.push(ele);
}
}
if (res.length === 0) {
if (opts.failglob === true) {
throw new Error('no matches found for "' + pattern + '"');
}
if (opts.nonull === true || opts.nullglob === true) {
return [pattern.split('\\').join('')];
}
}
return res;
};
/**
* Returns true if the specified `string` matches the given
* brackets `pattern`.
*
* ```js
* var brackets = require('expand-brackets');
*
* console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]'));
* //=> true
* console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]'));
* //=> false
* ```
* @param {String} `string` String to match
* @param {String} `pattern` Poxis pattern
* @param {String} `options`
* @return {Boolean}
* @api public
*/
brackets.isMatch = function (str, pattern, options) {
return brackets.matcher(pattern, options)(str);
};
/**
* Takes a POSIX character class pattern and returns a matcher function. The returned
* function takes the string to match as its only argument.
*
* ```js
* var brackets = require('expand-brackets');
* var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]');
*
* console.log(isMatch('a.a'));
* //=> false
* console.log(isMatch('a.A'));
* //=> true
* ```
* @param {String} `pattern` Poxis pattern
* @param {String} `options`
* @return {Boolean}
* @api public
*/
brackets.matcher = function (pattern, options) {
var re = brackets.makeRe(pattern, options);
return function (str) {
return re.test(str);
};
};
/**
* Create a regular expression from the given `pattern`.
*
* ```js
* var brackets = require('expand-brackets');
* var re = brackets.makeRe('[[:alpha:]]');
* console.log(re);
* //=> /^(?:[a-zA-Z])$/
* ```
* @param {String} `pattern` The pattern to convert to regex.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
brackets.makeRe = function (pattern, options) {
var res = brackets.create(pattern, options);
var opts = extend({
strictErrors: false
}, options);
return toRegex(res.output, opts);
};
/**
* Parses the given POSIX character class `pattern` and returns an object
* with the compiled `output` and optional source `map`.
*
* ```js
* var brackets = require('expand-brackets');
* console.log(brackets('[[:alpha:]]'));
* // { options: { source: 'string' },
* // input: '[[:alpha:]]',
* // state: {},
* // compilers:
* // { eos: [Function],
* // noop: [Function],
* // bos: [Function],
* // not: [Function],
* // escape: [Function],
* // text: [Function],
* // posix: [Function],
* // bracket: [Function],
* // 'bracket.open': [Function],
* // 'bracket.inner': [Function],
* // 'bracket.literal': [Function],
* // 'bracket.close': [Function] },
* // output: '[a-zA-Z]',
* // ast:
* // { type: 'root',
* // errors: [],
* // nodes: [ [Object], [Object], [Object] ] },
* // parsingErrors: [] }
* ```
* @param {String} `pattern`
* @param {Object} `options`
* @return {Object}
* @api public
*/
brackets.create = function (pattern, options) {
var snapdragon = options && options.snapdragon || new Snapdragon(options);
compilers(snapdragon);
parsers(snapdragon);
var ast = snapdragon.parse(pattern, options);
ast.input = pattern;
var res = snapdragon.compile(ast, options);
res.input = pattern;
return res;
};
/**
* Expose `brackets` constructor, parsers and compilers
*/
brackets.compilers = compilers;
brackets.parsers = parsers;
/**
* Expose `brackets`
* @type {Function}
*/
module.exports = brackets;
/* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
/***/ }),
/***/ "./node_modules/expand-brackets/lib/compilers.js":
/*!*******************************************************!*\
!*** ./node_modules/expand-brackets/lib/compilers.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var posix = __webpack_require__(/*! posix-character-classes */ "./node_modules/posix-character-classes/index.js");
module.exports = function (brackets) {
brackets.compiler
/**
* Escaped characters
*/
.set('escape', function (node) {
return this.emit('\\' + node.val.replace(/^\\/, ''), node);
})
/**
* Text
*/
.set('text', function (node) {
return this.emit(node.val.replace(/([{}])/g, '\\$1'), node);
})
/**
* POSIX character classes
*/
.set('posix', function (node) {
if (node.val === '[::]') {
return this.emit('\\[::\\]', node);
}
var val = posix[node.inner];
if (typeof val === 'undefined') {
val = '[' + node.inner + ']';
}
return this.emit(val, node);
})
/**
* Non-posix brackets
*/
.set('bracket', function (node) {
return this.mapVisit(node.nodes);
}).set('bracket.open', function (node) {
return this.emit(node.val, node);
}).set('bracket.inner', function (node) {
var inner = node.val;
if (inner === '[' || inner === ']') {
return this.emit('\\' + node.val, node);
}
if (inner === '^]') {
return this.emit('^\\]', node);
}
if (inner === '^') {
return this.emit('^', node);
}
if (/-/.test(inner) && !/(\d-\d|\w-\w)/.test(inner)) {
inner = inner.split('-').join('\\-');
}
var isNegated = inner.charAt(0) === '^'; // add slashes to negated brackets, per spec
if (isNegated && inner.indexOf('/') === -1) {
inner += '/';
}
if (isNegated && inner.indexOf('.') === -1) {
inner += '.';
} // don't unescape `0` (octal literal)
inner = inner.replace(/\\([1-9])/g, '$1');
return this.emit(inner, node);
}).set('bracket.close', function (node) {
var val = node.val.replace(/^\\/, '');
if (node.parent.escaped === true) {
return this.emit('\\' + val, node);
}
return this.emit(val, node);
});
};
/***/ }),
/***/ "./node_modules/expand-brackets/lib/parsers.js":
/*!*****************************************************!*\
!*** ./node_modules/expand-brackets/lib/parsers.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(/*! ./utils */ "./node_modules/expand-brackets/lib/utils.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
/**
* Text regex
*/
var TEXT_REGEX = '(\\[(?=.*\\])|\\])+';
var not = utils.createRegex(TEXT_REGEX);
/**
* Brackets parsers
*/
function parsers(brackets) {
brackets.state = brackets.state || {};
brackets.parser.sets.bracket = brackets.parser.sets.bracket || [];
brackets.parser.capture('escape', function () {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(/^\\(.)/);
if (!m) return;
return pos({
type: 'escape',
val: m[0]
});
})
/**
* Text parser
*/
.capture('text', function () {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(not);
if (!m || !m[0]) return;
return pos({
type: 'text',
val: m[0]
});
})
/**
* POSIX character classes: "[[:alpha:][:digits:]]"
*/
.capture('posix', function () {
var pos = this.position();
var m = this.match(/^\[:(.*?):\](?=.*\])/);
if (!m) return;
var inside = this.isInside('bracket');
if (inside) {
brackets.posix++;
}
return pos({
type: 'posix',
insideBracket: inside,
inner: m[1],
val: m[0]
});
})
/**
* Bracket (noop)
*/
.capture('bracket', function () {})
/**
* Open: '['
*/
.capture('bracket.open', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\[(?=.*\])/);
if (!m) return;
var prev = this.prev();
var last = utils.last(prev.nodes);
if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) {
last.val = last.val.slice(0, last.val.length - 1);
return pos({
type: 'escape',
val: m[0]
});
}
var open = pos({
type: 'bracket.open',
val: m[0]
});
if (last.type === 'bracket.open' || this.isInside('bracket')) {
open.val = '\\' + open.val;
open.type = 'bracket.inner';
open.escaped = true;
return open;
}
var node = pos({
type: 'bracket',
nodes: [open]
});
define(node, 'parent', prev);
define(open, 'parent', node);
this.push('bracket', node);
prev.nodes.push(node);
})
/**
* Bracket text
*/
.capture('bracket.inner', function () {
if (!this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(not);
if (!m || !m[0]) return;
var next = this.input.charAt(0);
var val = m[0];
var node = pos({
type: 'bracket.inner',
val: val
});
if (val === '\\\\') {
return node;
}
var first = val.charAt(0);
var last = val.slice(-1);
if (first === '!') {
val = '^' + val.slice(1);
}
if (last === '\\' || val === '^' && next === ']') {
val += this.input[0];
this.consume(1);
}
node.val = val;
return node;
})
/**
* Close: ']'
*/
.capture('bracket.close', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\]/);
if (!m) return;
var prev = this.prev();
var last = utils.last(prev.nodes);
if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) {
last.val = last.val.slice(0, last.val.length - 1);
return pos({
type: 'escape',
val: m[0]
});
}
var node = pos({
type: 'bracket.close',
rest: this.input,
val: m[0]
});
if (last.type === 'bracket.open') {
node.type = 'bracket.inner';
node.escaped = true;
return node;
}
var bracket = this.pop('bracket');
if (!this.isType(bracket, 'bracket')) {
if (this.options.strict) {
throw new Error('missing opening "["');
}
node.type = 'bracket.inner';
node.escaped = true;
return node;
}
bracket.nodes.push(node);
define(node, 'parent', bracket);
});
}
/**
* Brackets parsers
*/
module.exports = parsers;
/**
* Expose text regex
*/
module.exports.TEXT_REGEX = TEXT_REGEX;
/***/ }),
/***/ "./node_modules/expand-brackets/lib/utils.js":
/*!***************************************************!*\
!*** ./node_modules/expand-brackets/lib/utils.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
var regexNot = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
var cached;
/**
* Get the last element from `array`
* @param {Array} `array`
* @return {*}
*/
exports.last = function (arr) {
return arr[arr.length - 1];
};
/**
* Create and cache regex to use for text nodes
*/
exports.createRegex = function (pattern, include) {
if (cached) return cached;
var opts = {
contains: true,
strictClose: false
};
var not = regexNot.create(pattern, opts);
var re;
if (typeof include === 'string') {
re = toRegex('^(?:' + include + '|' + not + ')', opts);
} else {
re = toRegex(not, opts);
}
return cached = re;
};
/***/ }),
/***/ "./node_modules/expand-brackets/node_modules/debug/src/browser.js":
/*!************************************************************************!*\
!*** ./node_modules/expand-brackets/node_modules/debug/src/browser.js ***!
\************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/expand-brackets/node_modules/debug/src/debug.js");
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();
/**
* Colors.
*/
exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson'];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
return true;
} // is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (err) {
return '[UnexpectedJSONParseError]: ' + err.message;
}
};
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);
if (!useColors) return;
var c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit'); // the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
var index = 0;
var lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, function (match) {
if ('%%' === match) return;
index++;
if ('%c' === match) {
// we only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log() {
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (null == namespaces) {
exports.storage.removeItem('debug');
} else {
exports.storage.debug = namespaces;
}
} catch (e) {}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
var r;
try {
r = exports.storage.debug;
} catch (e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
return window.localStorage;
} catch (e) {}
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/expand-brackets/node_modules/debug/src/debug.js":
/*!**********************************************************************!*\
!*** ./node_modules/expand-brackets/node_modules/debug/src/debug.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = __webpack_require__(/*! ms */ "./node_modules/expand-brackets/node_modules/ms/index.js");
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
exports.formatters = {};
/**
* Previous log timestamp.
*/
var prevTime;
/**
* Select a color.
* @param {String} namespace
* @return {Number}
* @api private
*/
function selectColor(namespace) {
var hash = 0,
i;
for (i in namespace) {
hash = (hash << 5) - hash + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return exports.colors[Math.abs(hash) % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
function debug() {
// disabled?
if (!debug.enabled) return;
var self = debug; // set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr; // turn the `arguments` into a proper Array
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %O
args.unshift('%O');
} // apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
}); // apply env-specific formatting (colors, etc.)
exports.formatArgs.call(self, args);
var logFn = debug.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.enabled = exports.enabled(namespace);
debug.useColors = exports.useColors();
debug.color = selectColor(namespace); // env-specific initialization logic for debug instances
if ('function' === typeof exports.init) {
exports.init(debug);
}
return debug;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
exports.names = [];
exports.skips = [];
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (var i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
/***/ }),
/***/ "./node_modules/expand-brackets/node_modules/ms/index.js":
/*!***************************************************************!*\
!*** ./node_modules/expand-brackets/node_modules/ms/index.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val is not a non-empty string or a number
* @return {String|Number}
* @api public
*/
module.exports = function (val, options) {
options = options || {};
var type = _typeof(val);
if (type === 'string' && val.length > 0) {
return parse(val);
} else if (type === 'number' && isNaN(val) === false) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
};
/**
* Parse the given `str` and return milliseconds.
*
* @param {String} str
* @return {Number}
* @api private
*/
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'yrs':
case 'yr':
case 'y':
return n * y;
case 'days':
case 'day':
case 'd':
return n * d;
case 'hours':
case 'hour':
case 'hrs':
case 'hr':
case 'h':
return n * h;
case 'minutes':
case 'minute':
case 'mins':
case 'min':
case 'm':
return n * m;
case 'seconds':
case 'second':
case 'secs':
case 'sec':
case 's':
return n * s;
case 'milliseconds':
case 'millisecond':
case 'msecs':
case 'msec':
case 'ms':
return n;
default:
return undefined;
}
}
/**
* Short format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtShort(ms) {
if (ms >= d) {
return Math.round(ms / d) + 'd';
}
if (ms >= h) {
return Math.round(ms / h) + 'h';
}
if (ms >= m) {
return Math.round(ms / m) + 'm';
}
if (ms >= s) {
return Math.round(ms / s) + 's';
}
return ms + 'ms';
}
/**
* Long format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtLong(ms) {
return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms';
}
/**
* Pluralization helper.
*/
function plural(ms, n, name) {
if (ms < n) {
return;
}
if (ms < n * 1.5) {
return Math.floor(ms / n) + ' ' + name;
}
return Math.ceil(ms / n) + ' ' + name + 's';
}
/***/ }),
/***/ "./node_modules/extend-shallow/index.js":
/*!**********************************************!*\
!*** ./node_modules/extend-shallow/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isObject = __webpack_require__(/*! is-extendable */ "./node_modules/is-extendable/index.js");
module.exports = function extend(o
/*, objects*/
) {
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];
}
}
}
/**
* Returns true if the given `key` is an own property of `obj`.
*/
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
/***/ }),
/***/ "./node_modules/extglob/index.js":
/*!***************************************!*\
!*** ./node_modules/extglob/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Module dependencies
*/
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
var unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
/**
* Local dependencies
*/
var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/extglob/lib/compilers.js");
var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/extglob/lib/parsers.js");
var Extglob = __webpack_require__(/*! ./lib/extglob */ "./node_modules/extglob/lib/extglob.js");
var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/extglob/lib/utils.js");
var MAX_LENGTH = 1024 * 64;
/**
* Convert the given `extglob` pattern into a regex-compatible string. Returns
* an object with the compiled result and the parsed AST.
*
* ```js
* var extglob = require('extglob');
* console.log(extglob('*.!(*a)'));
* //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
* ```
* @param {String} `pattern`
* @param {Object} `options`
* @return {String}
* @api public
*/
function extglob(pattern, options) {
return extglob.create(pattern, options).output;
}
/**
* Takes an array of strings and an extglob pattern and returns a new
* array that contains only the strings that match the pattern.
*
* ```js
* var extglob = require('extglob');
* console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)'));
* //=> ['a.b', 'a.c']
* ```
* @param {Array} `list` Array of strings to match
* @param {String} `pattern` Extglob pattern
* @param {Object} `options`
* @return {Array} Returns an array of matches
* @api public
*/
extglob.match = function (list, pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
list = utils.arrayify(list);
var isMatch = extglob.matcher(pattern, options);
var len = list.length;
var idx = -1;
var matches = [];
while (++idx < len) {
var ele = list[idx];
if (isMatch(ele)) {
matches.push(ele);
}
} // if no options were passed, uniquify results and return
if (typeof options === 'undefined') {
return unique(matches);
}
if (matches.length === 0) {
if (options.failglob === true) {
throw new Error('no matches found for "' + pattern + '"');
}
if (options.nonull === true || options.nullglob === true) {
return [pattern.split('\\').join('')];
}
}
return options.nodupes !== false ? unique(matches) : matches;
};
/**
* Returns true if the specified `string` matches the given
* extglob `pattern`.
*
* ```js
* var extglob = require('extglob');
*
* console.log(extglob.isMatch('a.a', '*.!(*a)'));
* //=> false
* console.log(extglob.isMatch('a.b', '*.!(*a)'));
* //=> true
* ```
* @param {String} `string` String to match
* @param {String} `pattern` Extglob pattern
* @param {String} `options`
* @return {Boolean}
* @api public
*/
extglob.isMatch = function (str, pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
if (typeof str !== 'string') {
throw new TypeError('expected a string');
}
if (pattern === str) {
return true;
}
if (pattern === '' || pattern === ' ' || pattern === '.') {
return pattern === str;
}
var isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher);
return isMatch(str);
};
/**
* Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but
* the pattern can match any part of the string.
*
* ```js
* var extglob = require('extglob');
* console.log(extglob.contains('aa/bb/cc', '*b'));
* //=> true
* console.log(extglob.contains('aa/bb/cc', '*d'));
* //=> false
* ```
* @param {String} `str` The string to match.
* @param {String} `pattern` Glob pattern to use for matching.
* @param {Object} `options`
* @return {Boolean} Returns true if the patter matches any part of `str`.
* @api public
*/
extglob.contains = function (str, pattern, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string');
}
if (pattern === '' || pattern === ' ' || pattern === '.') {
return pattern === str;
}
var opts = extend({}, options, {
contains: true
});
opts.strictClose = false;
opts.strictOpen = false;
return extglob.isMatch(str, pattern, opts);
};
/**
* Takes an extglob pattern and returns a matcher function. The returned
* function takes the string to match as its only argument.
*
* ```js
* var extglob = require('extglob');
* var isMatch = extglob.matcher('*.!(*a)');
*
* console.log(isMatch('a.a'));
* //=> false
* console.log(isMatch('a.b'));
* //=> true
* ```
* @param {String} `pattern` Extglob pattern
* @param {String} `options`
* @return {Boolean}
* @api public
*/
extglob.matcher = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
function matcher() {
var re = extglob.makeRe(pattern, options);
return function (str) {
return re.test(str);
};
}
return utils.memoize('matcher', pattern, options, matcher);
};
/**
* Convert the given `extglob` pattern into a regex-compatible string. Returns
* an object with the compiled result and the parsed AST.
*
* ```js
* var extglob = require('extglob');
* console.log(extglob.create('*.!(*a)').output);
* //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {String}
* @api public
*/
extglob.create = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
function create() {
var ext = new Extglob(options);
var ast = ext.parse(pattern, options);
return ext.compile(ast, options);
}
return utils.memoize('create', pattern, options, create);
};
/**
* Returns an array of matches captured by `pattern` in `string`, or `null`
* if the pattern did not match.
*
* ```js
* var extglob = require('extglob');
* extglob.capture(pattern, string[, options]);
*
* console.log(extglob.capture('test/*.js', 'test/foo.js'));
* //=> ['foo']
* console.log(extglob.capture('test/*.js', 'foo/bar.css'));
* //=> null
* ```
* @param {String} `pattern` Glob pattern to use for matching.
* @param {String} `string` String to match
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
* @api public
*/
extglob.capture = function (pattern, str, options) {
var re = extglob.makeRe(pattern, extend({
capture: true
}, options));
function match() {
return function (string) {
var match = re.exec(string);
if (!match) {
return null;
}
return match.slice(1);
};
}
var capture = utils.memoize('capture', pattern, options, match);
return capture(str);
};
/**
* Create a regular expression from the given `pattern` and `options`.
*
* ```js
* var extglob = require('extglob');
* var re = extglob.makeRe('*.!(*a)');
* console.log(re);
* //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/
* ```
* @param {String} `pattern` The pattern to convert to regex.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
extglob.makeRe = function (pattern, options) {
if (pattern instanceof RegExp) {
return pattern;
}
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
if (pattern.length > MAX_LENGTH) {
throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
}
function makeRe() {
var opts = extend({
strictErrors: false
}, options);
if (opts.strictErrors === true) opts.strict = true;
var res = extglob.create(pattern, opts);
return toRegex(res.output, opts);
}
var regex = utils.memoize('makeRe', pattern, options, makeRe);
if (regex.source.length > MAX_LENGTH) {
throw new SyntaxError('potentially malicious regex detected');
}
return regex;
};
/**
* Cache
*/
extglob.cache = utils.cache;
extglob.clearCache = function () {
extglob.cache.__data__ = {};
};
/**
* Expose `Extglob` constructor, parsers and compilers
*/
extglob.Extglob = Extglob;
extglob.compilers = compilers;
extglob.parsers = parsers;
/**
* Expose `extglob`
* @type {Function}
*/
module.exports = extglob;
/***/ }),
/***/ "./node_modules/extglob/lib/compilers.js":
/*!***********************************************!*\
!*** ./node_modules/extglob/lib/compilers.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var brackets = __webpack_require__(/*! expand-brackets */ "./node_modules/expand-brackets/index.js");
/**
* Extglob compilers
*/
module.exports = function (extglob) {
function star() {
if (typeof extglob.options.star === 'function') {
return extglob.options.star.apply(this, arguments);
}
if (typeof extglob.options.star === 'string') {
return extglob.options.star;
}
return '.*?';
}
/**
* Use `expand-brackets` compilers
*/
extglob.use(brackets.compilers);
extglob.compiler
/**
* Escaped: "\\*"
*/
.set('escape', function (node) {
return this.emit(node.val, node);
})
/**
* Dot: "."
*/
.set('dot', function (node) {
return this.emit('\\' + node.val, node);
})
/**
* Question mark: "?"
*/
.set('qmark', function (node) {
var val = '[^\\\\/.]';
var prev = this.prev();
if (node.parsed.slice(-1) === '(') {
var ch = node.rest.charAt(0);
if (ch !== '!' && ch !== '=' && ch !== ':') {
return this.emit(val, node);
}
return this.emit(node.val, node);
}
if (prev.type === 'text' && prev.val) {
return this.emit(val, node);
}
if (node.val.length > 1) {
val += '{' + node.val.length + '}';
}
return this.emit(val, node);
})
/**
* Plus: "+"
*/
.set('plus', function (node) {
var prev = node.parsed.slice(-1);
if (prev === ']' || prev === ')') {
return this.emit(node.val, node);
}
var ch = this.output.slice(-1);
if (!this.output || /[?*+]/.test(ch) && node.parent.type !== 'bracket') {
return this.emit('\\+', node);
}
if (/\w/.test(ch) && !node.inside) {
return this.emit('+\\+?', node);
}
return this.emit('+', node);
})
/**
* Star: "*"
*/
.set('star', function (node) {
var prev = this.prev();
var prefix = prev.type !== 'text' && prev.type !== 'escape' ? '(?!\\.)' : '';
return this.emit(prefix + star.call(this, node), node);
})
/**
* Parens
*/
.set('paren', function (node) {
return this.mapVisit(node.nodes);
}).set('paren.open', function (node) {
var capture = this.options.capture ? '(' : '';
switch (node.parent.prefix) {
case '!':
case '^':
return this.emit(capture + '(?:(?!(?:', node);
case '*':
case '+':
case '?':
case '@':
return this.emit(capture + '(?:', node);
default:
{
var val = node.val;
if (this.options.bash === true) {
val = '\\' + val;
} else if (!this.options.capture && val === '(' && node.parent.rest[0] !== '?') {
val += '?:';
}
return this.emit(val, node);
}
}
}).set('paren.close', function (node) {
var capture = this.options.capture ? ')' : '';
switch (node.prefix) {
case '!':
case '^':
var prefix = /^(\)|$)/.test(node.rest) ? '$' : '';
var str = star.call(this, node); // if the extglob has a slash explicitly defined, we know the user wants
// to match slashes, so we need to ensure the "star" regex allows for it
if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) {
str = '.*?';
}
return this.emit(prefix + ('))' + str + ')') + capture, node);
case '*':
case '+':
case '?':
return this.emit(')' + node.prefix + capture, node);
case '@':
return this.emit(')' + capture, node);
default:
{
var val = (this.options.bash === true ? '\\' : '') + ')';
return this.emit(val, node);
}
}
})
/**
* Text
*/
.set('text', function (node) {
var val = node.val.replace(/[\[\]]/g, '\\$&');
return this.emit(val, node);
});
};
/***/ }),
/***/ "./node_modules/extglob/lib/extglob.js":
/*!*********************************************!*\
!*** ./node_modules/extglob/lib/extglob.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Module dependencies
*/
var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/extglob/node_modules/define-property/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
/**
* Local dependencies
*/
var compilers = __webpack_require__(/*! ./compilers */ "./node_modules/extglob/lib/compilers.js");
var parsers = __webpack_require__(/*! ./parsers */ "./node_modules/extglob/lib/parsers.js");
/**
* Customize Snapdragon parser and renderer
*/
function Extglob(options) {
this.options = extend({
source: 'extglob'
}, options);
this.snapdragon = this.options.snapdragon || new Snapdragon(this.options);
this.snapdragon.patterns = this.snapdragon.patterns || {};
this.compiler = this.snapdragon.compiler;
this.parser = this.snapdragon.parser;
compilers(this.snapdragon);
parsers(this.snapdragon);
/**
* Override Snapdragon `.parse` method
*/
define(this.snapdragon, 'parse', function (str, options) {
var parsed = Snapdragon.prototype.parse.apply(this, arguments);
parsed.input = str; // escape unmatched brace/bracket/parens
var last = this.parser.stack.pop();
if (last && this.options.strict !== true) {
var node = last.nodes[0];
node.val = '\\' + node.val;
var sibling = node.parent.nodes[1];
if (sibling.type === 'star') {
sibling.loose = true;
}
} // add non-enumerable parser reference
define(parsed, 'parser', this.parser);
return parsed;
});
/**
* Decorate `.parse` method
*/
define(this, 'parse', function (ast, options) {
return this.snapdragon.parse.apply(this.snapdragon, arguments);
});
/**
* Decorate `.compile` method
*/
define(this, 'compile', function (ast, options) {
return this.snapdragon.compile.apply(this.snapdragon, arguments);
});
}
/**
* Expose `Extglob`
*/
module.exports = Extglob;
/***/ }),
/***/ "./node_modules/extglob/lib/parsers.js":
/*!*********************************************!*\
!*** ./node_modules/extglob/lib/parsers.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var brackets = __webpack_require__(/*! expand-brackets */ "./node_modules/expand-brackets/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/extglob/node_modules/define-property/index.js");
var utils = __webpack_require__(/*! ./utils */ "./node_modules/extglob/lib/utils.js");
/**
* Characters to use in text regex (we want to "not" match
* characters that are matched by other parsers)
*/
var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+';
var not = utils.createRegex(TEXT_REGEX);
/**
* Extglob parsers
*/
function parsers(extglob) {
extglob.state = extglob.state || {};
/**
* Use `expand-brackets` parsers
*/
extglob.use(brackets.parsers);
extglob.parser.sets.paren = extglob.parser.sets.paren || [];
extglob.parser
/**
* Extglob open: "*("
*/
.capture('paren.open', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^([!@*?+])?\(/);
if (!m) return;
var prev = this.prev();
var prefix = m[1];
var val = m[0];
var open = pos({
type: 'paren.open',
parsed: parsed,
val: val
});
var node = pos({
type: 'paren',
prefix: prefix,
nodes: [open]
}); // if nested negation extglobs, just cancel them out to simplify
if (prefix === '!' && prev.type === 'paren' && prev.prefix === '!') {
prev.prefix = '@';
node.prefix = '@';
}
define(node, 'rest', this.input);
define(node, 'parsed', parsed);
define(node, 'parent', prev);
define(open, 'parent', node);
this.push('paren', node);
prev.nodes.push(node);
})
/**
* Extglob close: ")"
*/
.capture('paren.close', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\)/);
if (!m) return;
var parent = this.pop('paren');
var node = pos({
type: 'paren.close',
rest: this.input,
parsed: parsed,
val: m[0]
});
if (!this.isType(parent, 'paren')) {
if (this.options.strict) {
throw new Error('missing opening paren: "("');
}
node.escaped = true;
return node;
}
node.prefix = parent.prefix;
parent.nodes.push(node);
define(node, 'parent', parent);
})
/**
* Escape: "\\."
*/
.capture('escape', function () {
var pos = this.position();
var m = this.match(/^\\(.)/);
if (!m) return;
return pos({
type: 'escape',
val: m[0],
ch: m[1]
});
})
/**
* Question marks: "?"
*/
.capture('qmark', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\?+(?!\()/);
if (!m) return;
extglob.state.metachar = true;
return pos({
type: 'qmark',
rest: this.input,
parsed: parsed,
val: m[0]
});
})
/**
* Character parsers
*/
.capture('star', /^\*(?!\()/).capture('plus', /^\+(?!\()/).capture('dot', /^\./).capture('text', not);
}
;
/**
* Expose text regex string
*/
module.exports.TEXT_REGEX = TEXT_REGEX;
/**
* Extglob parsers
*/
module.exports = parsers;
/***/ }),
/***/ "./node_modules/extglob/lib/utils.js":
/*!*******************************************!*\
!*** ./node_modules/extglob/lib/utils.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var regex = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
var Cache = __webpack_require__(/*! fragment-cache */ "./node_modules/fragment-cache/index.js");
/**
* Utils
*/
var utils = module.exports;
var cache = utils.cache = new Cache();
/**
* Cast `val` to an array
* @return {Array}
*/
utils.arrayify = function (val) {
if (!Array.isArray(val)) {
return [val];
}
return val;
};
/**
* Memoize a generated regex or function
*/
utils.memoize = function (type, pattern, options, fn) {
var key = utils.createKey(type + pattern, options);
if (cache.has(type, key)) {
return cache.get(type, key);
}
var val = fn(pattern, options);
if (options && options.cache === false) {
return val;
}
cache.set(type, key, val);
return val;
};
/**
* Create the key to use for memoization. The key is generated
* by iterating over the options and concatenating key-value pairs
* to the pattern string.
*/
utils.createKey = function (pattern, options) {
var key = pattern;
if (typeof options === 'undefined') {
return key;
}
for (var prop in options) {
key += ';' + prop + '=' + String(options[prop]);
}
return key;
};
/**
* Create the regex to use for matching text
*/
utils.createRegex = function (str) {
var opts = {
contains: true,
strictClose: false
};
return regex(str, opts);
};
/***/ }),
/***/ "./node_modules/extglob/node_modules/define-property/index.js":
/*!********************************************************************!*\
!*** ./node_modules/extglob/node_modules/define-property/index.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
module.exports = function defineProperty(obj, prop, val) {
if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
throw new TypeError('expected an object or function.');
}
if (typeof prop !== 'string') {
throw new TypeError('expected `prop` to be a string.');
}
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
return Object.defineProperty(obj, prop, val);
}
return Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
};
/***/ }),
/***/ "./node_modules/fill-range/index.js":
/*!******************************************!*\
!*** ./node_modules/fill-range/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var isNumber = __webpack_require__(/*! is-number */ "./node_modules/is-number/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
var repeat = __webpack_require__(/*! repeat-string */ "./node_modules/repeat-string/index.js");
var toRegex = __webpack_require__(/*! to-regex-range */ "./node_modules/to-regex-range/index.js");
/**
* Return a range of numbers or letters.
*
* @param {String} `start` Start of the range
* @param {String} `stop` End of the range
* @param {String} `step` Increment or decrement to use.
* @param {Function} `fn` Custom function to modify each element in the range.
* @return {Array}
*/
function fillRange(start, stop, step, options) {
if (typeof start === 'undefined') {
return [];
}
if (typeof stop === 'undefined' || start === stop) {
// special case, for handling negative zero
var isString = typeof start === 'string';
if (isNumber(start) && !toNumber(start)) {
return [isString ? '0' : 0];
}
return [start];
}
if (typeof step !== 'number' && typeof step !== 'string') {
options = step;
step = undefined;
}
if (typeof options === 'function') {
options = {
transform: options
};
}
var opts = extend({
step: step
}, options);
if (opts.step && !isValidNumber(opts.step)) {
if (opts.strictRanges === true) {
throw new TypeError('expected options.step to be a number');
}
return [];
}
opts.isNumber = isValidNumber(start) && isValidNumber(stop);
if (!opts.isNumber && !isValid(start, stop)) {
if (opts.strictRanges === true) {
throw new RangeError('invalid range arguments: ' + util.inspect([start, stop]));
}
return [];
}
opts.isPadded = isPadded(start) || isPadded(stop);
opts.toString = opts.stringify || typeof opts.step === 'string' || typeof start === 'string' || typeof stop === 'string' || !opts.isNumber;
if (opts.isPadded) {
opts.maxLength = Math.max(String(start).length, String(stop).length);
} // support legacy minimatch/fill-range options
if (typeof opts.optimize === 'boolean') opts.toRegex = opts.optimize;
if (typeof opts.makeRe === 'boolean') opts.toRegex = opts.makeRe;
return expand(start, stop, opts);
}
function expand(start, stop, options) {
var a = options.isNumber ? toNumber(start) : start.charCodeAt(0);
var b = options.isNumber ? toNumber(stop) : stop.charCodeAt(0);
var step = Math.abs(toNumber(options.step)) || 1;
if (options.toRegex && step === 1) {
return toRange(a, b, start, stop, options);
}
var zero = {
greater: [],
lesser: []
};
var asc = a < b;
var arr = new Array(Math.round((asc ? b - a : a - b) / step));
var idx = 0;
while (asc ? a <= b : a >= b) {
var val = options.isNumber ? a : String.fromCharCode(a);
if (options.toRegex && (val >= 0 || !options.isNumber)) {
zero.greater.push(val);
} else {
zero.lesser.push(Math.abs(val));
}
if (options.isPadded) {
val = zeros(val, options);
}
if (options.toString) {
val = String(val);
}
if (typeof options.transform === 'function') {
arr[idx++] = options.transform(val, a, b, step, idx, arr, options);
} else {
arr[idx++] = val;
}
if (asc) {
a += step;
} else {
a -= step;
}
}
if (options.toRegex === true) {
return toSequence(arr, zero, options);
}
return arr;
}
function toRange(a, b, start, stop, options) {
if (options.isPadded) {
return toRegex(start, stop, options);
}
if (options.isNumber) {
return toRegex(Math.min(a, b), Math.max(a, b), options);
}
var start = String.fromCharCode(Math.min(a, b));
var stop = String.fromCharCode(Math.max(a, b));
return '[' + start + '-' + stop + ']';
}
function toSequence(arr, zeros, options) {
var greater = '',
lesser = '';
if (zeros.greater.length) {
greater = zeros.greater.join('|');
}
if (zeros.lesser.length) {
lesser = '-(' + zeros.lesser.join('|') + ')';
}
var res = greater && lesser ? greater + '|' + lesser : greater || lesser;
if (options.capture) {
return '(' + res + ')';
}
return res;
}
function zeros(val, options) {
if (options.isPadded) {
var str = String(val);
var len = str.length;
var dash = '';
if (str.charAt(0) === '-') {
dash = '-';
str = str.slice(1);
}
var diff = options.maxLength - len;
var pad = repeat('0', diff);
val = dash + pad + str;
}
if (options.stringify) {
return String(val);
}
return val;
}
function toNumber(val) {
return Number(val) || 0;
}
function isPadded(str) {
return /^-?0\d/.test(str);
}
function isValid(min, max) {
return (isValidNumber(min) || isValidLetter(min)) && (isValidNumber(max) || isValidLetter(max));
}
function isValidLetter(ch) {
return typeof ch === 'string' && ch.length === 1 && /^\w+$/.test(ch);
}
function isValidNumber(n) {
return isNumber(n) && !/\./.test(n);
}
/**
* Expose `fillRange`
* @type {Function}
*/
module.exports = fillRange;
/***/ }),
/***/ "./node_modules/for-in/index.js":
/*!**************************************!*\
!*** ./node_modules/for-in/index.js ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* for-in <https://github.com/jonschlinkert/for-in>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
module.exports = function forIn(obj, fn, thisArg) {
for (var key in obj) {
if (fn.call(thisArg, obj[key], key, obj) === false) {
break;
}
}
};
/***/ }),
/***/ "./node_modules/fragment-cache/index.js":
/*!**********************************************!*\
!*** ./node_modules/fragment-cache/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* fragment-cache <https://github.com/jonschlinkert/fragment-cache>
*
* Copyright (c) 2016-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var MapCache = __webpack_require__(/*! map-cache */ "./node_modules/map-cache/index.js");
/**
* Create a new `FragmentCache` with an optional object to use for `caches`.
*
* ```js
* var fragment = new FragmentCache();
* ```
* @name FragmentCache
* @param {String} `cacheName`
* @return {Object} Returns the [map-cache][] instance.
* @api public
*/
function FragmentCache(caches) {
this.caches = caches || {};
}
/**
* Prototype
*/
FragmentCache.prototype = {
/**
* Get cache `name` from the `fragment.caches` object. Creates a new
* `MapCache` if it doesn't already exist.
*
* ```js
* var cache = fragment.cache('files');
* console.log(fragment.caches.hasOwnProperty('files'));
* //=> true
* ```
* @name .cache
* @param {String} `cacheName`
* @return {Object} Returns the [map-cache][] instance.
* @api public
*/
cache: function cache(cacheName) {
return this.caches[cacheName] || (this.caches[cacheName] = new MapCache());
},
/**
* Set a value for property `key` on cache `name`
*
* ```js
* fragment.set('files', 'somefile.js', new File({path: 'somefile.js'}));
* ```
* @name .set
* @param {String} `name`
* @param {String} `key` Property name to set
* @param {any} `val` The value of `key`
* @return {Object} The cache instance for chaining
* @api public
*/
set: function set(cacheName, key, val) {
var cache = this.cache(cacheName);
cache.set(key, val);
return cache;
},
/**
* Returns true if a non-undefined value is set for `key` on fragment cache `name`.
*
* ```js
* var cache = fragment.cache('files');
* cache.set('somefile.js');
*
* console.log(cache.has('somefile.js'));
* //=> true
*
* console.log(cache.has('some-other-file.js'));
* //=> false
* ```
* @name .has
* @param {String} `name` Cache name
* @param {String} `key` Optionally specify a property to check for on cache `name`
* @return {Boolean}
* @api public
*/
has: function has(cacheName, key) {
return typeof this.get(cacheName, key) !== 'undefined';
},
/**
* Get `name`, or if specified, the value of `key`. Invokes the [cache]() method,
* so that cache `name` will be created it doesn't already exist. If `key` is not passed,
* the entire cache (`name`) is returned.
*
* ```js
* var Vinyl = require('vinyl');
* var cache = fragment.cache('files');
* cache.set('somefile.js', new Vinyl({path: 'somefile.js'}));
* console.log(cache.get('somefile.js'));
* //=> <File "somefile.js">
* ```
* @name .get
* @param {String} `name`
* @return {Object} Returns cache `name`, or the value of `key` if specified
* @api public
*/
get: function get(name, key) {
var cache = this.cache(name);
if (typeof key === 'string') {
return cache.get(key);
}
return cache;
}
};
/**
* Expose `FragmentCache`
*/
exports = module.exports = FragmentCache;
/***/ }),
/***/ "./node_modules/get-value/index.js":
/*!*****************************************!*\
!*** ./node_modules/get-value/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*!
* get-value <https://github.com/jonschlinkert/get-value>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function (obj, prop, a, b, c) {
if (!isObject(obj) || !prop) {
return obj;
}
prop = toString(prop); // allowing for multiple properties to be passed as
// a string or array, but much faster (3-4x) than doing
// `[].slice.call(arguments)`
if (a) prop += '.' + toString(a);
if (b) prop += '.' + toString(b);
if (c) prop += '.' + toString(c);
if (prop in obj) {
return obj[prop];
}
var segs = prop.split('.');
var len = segs.length;
var i = -1;
while (obj && ++i < len) {
var key = segs[i];
while (key[key.length - 1] === '\\') {
key = key.slice(0, -1) + '.' + segs[++i];
}
obj = obj[key];
}
return obj;
};
function isObject(val) {
return val !== null && (_typeof(val) === 'object' || typeof val === 'function');
}
function toString(val) {
if (!val) return '';
if (Array.isArray(val)) {
return val.join('.');
}
return val;
}
/***/ }),
/***/ "./node_modules/has-value/index.js":
/*!*****************************************!*\
!*** ./node_modules/has-value/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* has-value <https://github.com/jonschlinkert/has-value>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Licensed under the MIT License.
*/
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var hasValues = __webpack_require__(/*! has-values */ "./node_modules/has-values/index.js");
var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
module.exports = function (val, prop) {
return hasValues(isObject(val) && prop ? get(val, prop) : val);
};
/***/ }),
/***/ "./node_modules/has-values/index.js":
/*!******************************************!*\
!*** ./node_modules/has-values/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* has-values <https://github.com/jonschlinkert/has-values>
*
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/has-values/node_modules/kind-of/index.js");
var isNumber = __webpack_require__(/*! is-number */ "./node_modules/is-number/index.js");
module.exports = function hasValue(val) {
// is-number checks for NaN and other edge cases
if (isNumber(val)) {
return true;
}
switch (typeOf(val)) {
case 'null':
case 'boolean':
case 'function':
return true;
case 'string':
case 'arguments':
return val.length !== 0;
case 'error':
return val.message !== '';
case 'array':
var len = val.length;
if (len === 0) {
return false;
}
for (var i = 0; i < len; i++) {
if (hasValue(val[i])) {
return true;
}
}
return false;
case 'file':
case 'map':
case 'set':
return val.size !== 0;
case 'object':
var keys = Object.keys(val);
if (keys.length === 0) {
return false;
}
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (hasValue(val[key])) {
return true;
}
}
return false;
default:
{
return false;
}
}
};
/***/ }),
/***/ "./node_modules/has-values/node_modules/kind-of/index.js":
/*!***************************************************************!*\
!*** ./node_modules/has-values/node_modules/kind-of/index.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
var toString = Object.prototype.toString;
/**
* Get the native `typeof` a value.
*
* @param {*} `val`
* @return {*} Native javascript type
*/
module.exports = function kindOf(val) {
// primitivies
if (typeof val === 'undefined') {
return 'undefined';
}
if (val === null) {
return 'null';
}
if (val === true || val === false || val instanceof Boolean) {
return 'boolean';
}
if (typeof val === 'string' || val instanceof String) {
return 'string';
}
if (typeof val === 'number' || val instanceof Number) {
return 'number';
} // functions
if (typeof val === 'function' || val instanceof Function) {
return 'function';
} // array
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
return 'array';
} // check for instances of RegExp and Date before calling `toString`
if (val instanceof RegExp) {
return 'regexp';
}
if (val instanceof Date) {
return 'date';
} // other objects
var type = toString.call(val);
if (type === '[object RegExp]') {
return 'regexp';
}
if (type === '[object Date]') {
return 'date';
}
if (type === '[object Arguments]') {
return 'arguments';
}
if (type === '[object Error]') {
return 'error';
}
if (type === '[object Promise]') {
return 'promise';
} // buffer
if (isBuffer(val)) {
return 'buffer';
} // es6: Map, WeakMap, Set, WeakSet
if (type === '[object Set]') {
return 'set';
}
if (type === '[object WeakSet]') {
return 'weakset';
}
if (type === '[object Map]') {
return 'map';
}
if (type === '[object WeakMap]') {
return 'weakmap';
}
if (type === '[object Symbol]') {
return 'symbol';
} // typed arrays
if (type === '[object Int8Array]') {
return 'int8array';
}
if (type === '[object Uint8Array]') {
return 'uint8array';
}
if (type === '[object Uint8ClampedArray]') {
return 'uint8clampedarray';
}
if (type === '[object Int16Array]') {
return 'int16array';
}
if (type === '[object Uint16Array]') {
return 'uint16array';
}
if (type === '[object Int32Array]') {
return 'int32array';
}
if (type === '[object Uint32Array]') {
return 'uint32array';
}
if (type === '[object Float32Array]') {
return 'float32array';
}
if (type === '[object Float64Array]') {
return 'float64array';
} // must be a plain object
return 'object';
};
/***/ }),
/***/ "./node_modules/is-accessor-descriptor/index.js":
/*!******************************************************!*\
!*** ./node_modules/is-accessor-descriptor/index.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/is-accessor-descriptor/node_modules/kind-of/index.js"); // accessor descriptor properties
var accessor = {
get: 'function',
set: 'function',
configurable: 'boolean',
enumerable: 'boolean'
};
function isAccessorDescriptor(obj, prop) {
if (typeof prop === 'string') {
var val = Object.getOwnPropertyDescriptor(obj, prop);
return typeof val !== 'undefined';
}
if (typeOf(obj) !== 'object') {
return false;
}
if (has(obj, 'value') || has(obj, 'writable')) {
return false;
}
if (!has(obj, 'get') || typeof obj.get !== 'function') {
return false;
} // tldr: it's valid to have "set" be undefined
// "set" might be undefined if `Object.getOwnPropertyDescriptor`
// was used to get the value, and only `get` was defined by the user
if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
return false;
}
for (var key in obj) {
if (!accessor.hasOwnProperty(key)) {
continue;
}
if (typeOf(obj[key]) === accessor[key]) {
continue;
}
if (typeof obj[key] !== 'undefined') {
return false;
}
}
return true;
}
function has(obj, key) {
return {}.hasOwnProperty.call(obj, key);
}
/**
* Expose `isAccessorDescriptor`
*/
module.exports = isAccessorDescriptor;
/***/ }),
/***/ "./node_modules/is-accessor-descriptor/node_modules/kind-of/index.js":
/*!***************************************************************************!*\
!*** ./node_modules/is-accessor-descriptor/node_modules/kind-of/index.js ***!
\***************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toString = Object.prototype.toString;
module.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';
} // Non-plain objects
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';
} // other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
return val.constructor ? 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;
}
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === 'function') {
return val.constructor.isBuffer(val);
}
return false;
}
/***/ }),
/***/ "./node_modules/is-buffer/index.js":
/*!*****************************************!*\
!*** ./node_modules/is-buffer/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
// The _isBuffer check is for Safari 5-7 support, because it's missing
// Object.prototype.constructor. Remove this eventually
module.exports = function (obj) {
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
};
function isBuffer(obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
} // For Node v0.10 support. Remove this eventually.
function isSlowBuffer(obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0));
}
/***/ }),
/***/ "./node_modules/is-data-descriptor/index.js":
/*!**************************************************!*\
!*** ./node_modules/is-data-descriptor/index.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/is-data-descriptor/node_modules/kind-of/index.js");
module.exports = function isDataDescriptor(obj, prop) {
// data descriptor properties
var data = {
configurable: 'boolean',
enumerable: 'boolean',
writable: 'boolean'
};
if (typeOf(obj) !== 'object') {
return false;
}
if (typeof prop === 'string') {
var val = Object.getOwnPropertyDescriptor(obj, prop);
return typeof val !== 'undefined';
}
if (!('value' in obj) && !('writable' in obj)) {
return false;
}
for (var key in obj) {
if (key === 'value') continue;
if (!data.hasOwnProperty(key)) {
continue;
}
if (typeOf(obj[key]) === data[key]) {
continue;
}
if (typeof obj[key] !== 'undefined') {
return false;
}
}
return true;
};
/***/ }),
/***/ "./node_modules/is-data-descriptor/node_modules/kind-of/index.js":
/*!***********************************************************************!*\
!*** ./node_modules/is-data-descriptor/node_modules/kind-of/index.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toString = Object.prototype.toString;
module.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';
} // Non-plain objects
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';
} // other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
return val.constructor ? 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;
}
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === 'function') {
return val.constructor.isBuffer(val);
}
return false;
}
/***/ }),
/***/ "./node_modules/is-descriptor/index.js":
/*!*********************************************!*\
!*** ./node_modules/is-descriptor/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-descriptor <https://github.com/jonschlinkert/is-descriptor>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/is-descriptor/node_modules/kind-of/index.js");
var isAccessor = __webpack_require__(/*! is-accessor-descriptor */ "./node_modules/is-accessor-descriptor/index.js");
var isData = __webpack_require__(/*! is-data-descriptor */ "./node_modules/is-data-descriptor/index.js");
module.exports = function isDescriptor(obj, key) {
if (typeOf(obj) !== 'object') {
return false;
}
if ('get' in obj) {
return isAccessor(obj, key);
}
return isData(obj, key);
};
/***/ }),
/***/ "./node_modules/is-descriptor/node_modules/kind-of/index.js":
/*!******************************************************************!*\
!*** ./node_modules/is-descriptor/node_modules/kind-of/index.js ***!
\******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toString = Object.prototype.toString;
module.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';
} // Non-plain objects
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';
} // other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
return val.constructor ? 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;
}
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === 'function') {
return val.constructor.isBuffer(val);
}
return false;
}
/***/ }),
/***/ "./node_modules/is-extendable/index.js":
/*!*********************************************!*\
!*** ./node_modules/is-extendable/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
module.exports = function isExtendable(val) {
return typeof val !== 'undefined' && val !== null && (_typeof(val) === 'object' || typeof val === 'function');
};
/***/ }),
/***/ "./node_modules/is-number/index.js":
/*!*****************************************!*\
!*** ./node_modules/is-number/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
module.exports = function isNumber(num) {
var type = typeOf(num);
if (type === 'string') {
if (!num.trim()) return false;
} else if (type !== 'number') {
return false;
}
return num - num + 1 >= 0;
};
/***/ }),
/***/ "./node_modules/is-plain-object/index.js":
/*!***********************************************!*\
!*** ./node_modules/is-plain-object/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
function isObjectObject(o) {
return isObject(o) === true && Object.prototype.toString.call(o) === '[object Object]';
}
module.exports = function isPlainObject(o) {
var ctor, prot;
if (isObjectObject(o) === false) return false; // If has modified constructor
ctor = o.constructor;
if (typeof ctor !== 'function') return false; // If has modified prototype
prot = ctor.prototype;
if (isObjectObject(prot) === false) return false; // If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
} // Most likely a plain Object
return true;
};
/***/ }),
/***/ "./node_modules/is-windows/index.js":
/*!******************************************!*\
!*** ./node_modules/is-windows/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*!
* is-windows <https://github.com/jonschlinkert/is-windows>
*
* Copyright © 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*/
(function (factory) {
if (exports && ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined') {
module.exports = factory();
} else if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
})(function () {
'use strict';
return function isWindows() {
return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE));
};
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/isarray/index.js":
/*!***************************************!*\
!*** ./node_modules/isarray/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
/***/ }),
/***/ "./node_modules/isobject/index.js":
/*!****************************************!*\
!*** ./node_modules/isobject/index.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
module.exports = function isObject(val) {
return val != null && _typeof(val) === 'object' && Array.isArray(val) === false;
};
/***/ }),
/***/ "./node_modules/js-tokens/index.js":
/*!*****************************************!*\
!*** ./node_modules/js-tokens/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
// License: MIT. (See LICENSE.)
Object.defineProperty(exports, "__esModule", {
value: true
}); // This regex comes from regex.coffee, and is inserted here by generate-index.js
// (run `npm run build`).
exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
exports.matchToToken = function (match) {
var token = {
type: "invalid",
value: match[0],
closed: undefined
};
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
return token;
};
/***/ }),
/***/ "./node_modules/kind-of/index.js":
/*!***************************************!*\
!*** ./node_modules/kind-of/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
var toString = Object.prototype.toString;
/**
* Get the native `typeof` a value.
*
* @param {*} `val`
* @return {*} Native javascript type
*/
module.exports = function kindOf(val) {
// primitivies
if (typeof val === 'undefined') {
return 'undefined';
}
if (val === null) {
return 'null';
}
if (val === true || val === false || val instanceof Boolean) {
return 'boolean';
}
if (typeof val === 'string' || val instanceof String) {
return 'string';
}
if (typeof val === 'number' || val instanceof Number) {
return 'number';
} // functions
if (typeof val === 'function' || val instanceof Function) {
return 'function';
} // array
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
return 'array';
} // check for instances of RegExp and Date before calling `toString`
if (val instanceof RegExp) {
return 'regexp';
}
if (val instanceof Date) {
return 'date';
} // other objects
var type = toString.call(val);
if (type === '[object RegExp]') {
return 'regexp';
}
if (type === '[object Date]') {
return 'date';
}
if (type === '[object Arguments]') {
return 'arguments';
}
if (type === '[object Error]') {
return 'error';
} // buffer
if (isBuffer(val)) {
return 'buffer';
} // es6: Map, WeakMap, Set, WeakSet
if (type === '[object Set]') {
return 'set';
}
if (type === '[object WeakSet]') {
return 'weakset';
}
if (type === '[object Map]') {
return 'map';
}
if (type === '[object WeakMap]') {
return 'weakmap';
}
if (type === '[object Symbol]') {
return 'symbol';
} // typed arrays
if (type === '[object Int8Array]') {
return 'int8array';
}
if (type === '[object Uint8Array]') {
return 'uint8array';
}
if (type === '[object Uint8ClampedArray]') {
return 'uint8clampedarray';
}
if (type === '[object Int16Array]') {
return 'int16array';
}
if (type === '[object Uint16Array]') {
return 'uint16array';
}
if (type === '[object Int32Array]') {
return 'int32array';
}
if (type === '[object Uint32Array]') {
return 'uint32array';
}
if (type === '[object Float32Array]') {
return 'float32array';
}
if (type === '[object Float64Array]') {
return 'float64array';
} // must be a plain object
return 'object';
};
/***/ }),
/***/ "./node_modules/map-cache/index.js":
/*!*****************************************!*\
!*** ./node_modules/map-cache/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* map-cache <https://github.com/jonschlinkert/map-cache>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var hasOwn = Object.prototype.hasOwnProperty;
/**
* Expose `MapCache`
*/
module.exports = MapCache;
/**
* Creates a cache object to store key/value pairs.
*
* ```js
* var cache = new MapCache();
* ```
*
* @api public
*/
function MapCache(data) {
this.__data__ = data || {};
}
/**
* Adds `value` to `key` on the cache.
*
* ```js
* cache.set('foo', 'bar');
* ```
*
* @param {String} `key` The key of the value to cache.
* @param {*} `value` The value to cache.
* @returns {Object} Returns the `Cache` object for chaining.
* @api public
*/
MapCache.prototype.set = function mapSet(key, value) {
if (key !== '__proto__') {
this.__data__[key] = value;
}
return this;
};
/**
* Gets the cached value for `key`.
*
* ```js
* cache.get('foo');
* //=> 'bar'
* ```
*
* @param {String} `key` The key of the value to get.
* @returns {*} Returns the cached value.
* @api public
*/
MapCache.prototype.get = function mapGet(key) {
return key === '__proto__' ? undefined : this.__data__[key];
};
/**
* Checks if a cached value for `key` exists.
*
* ```js
* cache.has('foo');
* //=> true
* ```
*
* @param {String} `key` The key of the entry to check.
* @returns {Boolean} Returns `true` if an entry for `key` exists, else `false`.
* @api public
*/
MapCache.prototype.has = function mapHas(key) {
return key !== '__proto__' && hasOwn.call(this.__data__, key);
};
/**
* Removes `key` and its value from the cache.
*
* ```js
* cache.del('foo');
* ```
* @title .del
* @param {String} `key` The key of the value to remove.
* @returns {Boolean} Returns `true` if the entry was removed successfully, else `false`.
* @api public
*/
MapCache.prototype.del = function mapDelete(key) {
return this.has(key) && delete this.__data__[key];
};
/***/ }),
/***/ "./node_modules/map-visit/index.js":
/*!*****************************************!*\
!*** ./node_modules/map-visit/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var visit = __webpack_require__(/*! object-visit */ "./node_modules/object-visit/index.js");
/**
* Map `visit` over an array of objects.
*
* @param {Object} `collection` The context in which to invoke `method`
* @param {String} `method` Name of the method to call on `collection`
* @param {Object} `arr` Array of objects.
*/
module.exports = function mapVisit(collection, method, val) {
if (isObject(val)) {
return visit.apply(null, arguments);
}
if (!Array.isArray(val)) {
throw new TypeError('expected an array: ' + util.inspect(val));
}
var args = [].slice.call(arguments, 3);
for (var i = 0; i < val.length; i++) {
var ele = val[i];
if (isObject(ele)) {
visit.apply(null, [collection, method, ele].concat(args));
} else {
collection[method].apply(collection, [ele].concat(args));
}
}
};
function isObject(val) {
return val && (typeof val === 'function' || !Array.isArray(val) && _typeof(val) === 'object');
}
/***/ }),
/***/ "./node_modules/micromatch/index.js":
/*!******************************************!*\
!*** ./node_modules/micromatch/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Module dependencies
*/
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var braces = __webpack_require__(/*! braces */ "./node_modules/braces/index.js");
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/micromatch/node_modules/extend-shallow/index.js");
/**
* Local dependencies
*/
var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/micromatch/lib/compilers.js");
var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/micromatch/lib/parsers.js");
var cache = __webpack_require__(/*! ./lib/cache */ "./node_modules/micromatch/lib/cache.js");
var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/micromatch/lib/utils.js");
var MAX_LENGTH = 1024 * 64;
/**
* The main function takes a list of strings and one or more
* glob patterns to use for matching.
*
* ```js
* var mm = require('micromatch');
* mm(list, patterns[, options]);
*
* console.log(mm(['a.js', 'a.txt'], ['*.js']));
* //=> [ 'a.js' ]
* ```
* @param {Array} `list` A list of strings to match
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Array} Returns an array of matches
* @summary false
* @api public
*/
function micromatch(list, patterns, options) {
patterns = utils.arrayify(patterns);
list = utils.arrayify(list);
var len = patterns.length;
if (list.length === 0 || len === 0) {
return [];
}
if (len === 1) {
return micromatch.match(list, patterns[0], options);
}
var omit = [];
var keep = [];
var idx = -1;
while (++idx < len) {
var pattern = patterns[idx];
if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33
/* ! */
) {
omit.push.apply(omit, micromatch.match(list, pattern.slice(1), options));
} else {
keep.push.apply(keep, micromatch.match(list, pattern, options));
}
}
var matches = utils.diff(keep, omit);
if (!options || options.nodupes !== false) {
return utils.unique(matches);
}
return matches;
}
/**
* Similar to the main function, but `pattern` must be a string.
*
* ```js
* var mm = require('micromatch');
* mm.match(list, pattern[, options]);
*
* console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
* //=> ['a.a', 'a.aa']
* ```
* @param {Array} `list` Array of strings to match
* @param {String} `pattern` Glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Array} Returns an array of matches
* @api public
*/
micromatch.match = function (list, pattern, options) {
if (Array.isArray(pattern)) {
throw new TypeError('expected pattern to be a string');
}
var unixify = utils.unixify(options);
var isMatch = memoize('match', pattern, options, micromatch.matcher);
var matches = [];
list = utils.arrayify(list);
var len = list.length;
var idx = -1;
while (++idx < len) {
var ele = list[idx];
if (ele === pattern || isMatch(ele)) {
matches.push(utils.value(ele, unixify, options));
}
} // if no options were passed, uniquify results and return
if (typeof options === 'undefined') {
return utils.unique(matches);
}
if (matches.length === 0) {
if (options.failglob === true) {
throw new Error('no matches found for "' + pattern + '"');
}
if (options.nonull === true || options.nullglob === true) {
return [options.unescape ? utils.unescape(pattern) : pattern];
}
} // if `opts.ignore` was defined, diff ignored list
if (options.ignore) {
matches = micromatch.not(matches, options.ignore, options);
}
return options.nodupes !== false ? utils.unique(matches) : matches;
};
/**
* Returns true if the specified `string` matches the given glob `pattern`.
*
* ```js
* var mm = require('micromatch');
* mm.isMatch(string, pattern[, options]);
*
* console.log(mm.isMatch('a.a', '*.a'));
* //=> true
* console.log(mm.isMatch('a.b', '*.a'));
* //=> false
* ```
* @param {String} `string` String to match
* @param {String} `pattern` Glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if the string matches the glob pattern.
* @api public
*/
micromatch.isMatch = function (str, pattern, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (isEmptyString(str) || isEmptyString(pattern)) {
return false;
}
var equals = utils.equalsPattern(options);
if (equals(str)) {
return true;
}
var isMatch = memoize('isMatch', pattern, options, micromatch.matcher);
return isMatch(str);
};
/**
* Returns true if some of the strings in the given `list` match any of the
* given glob `patterns`.
*
* ```js
* var mm = require('micromatch');
* mm.some(list, patterns[, options]);
*
* console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
* // true
* console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
* // false
* ```
* @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
micromatch.some = function (list, patterns, options) {
if (typeof list === 'string') {
list = [list];
}
for (var i = 0; i < list.length; i++) {
if (micromatch(list[i], patterns, options).length === 1) {
return true;
}
}
return false;
};
/**
* Returns true if every string in the given `list` matches
* any of the given glob `patterns`.
*
* ```js
* var mm = require('micromatch');
* mm.every(list, patterns[, options]);
*
* console.log(mm.every('foo.js', ['foo.js']));
* // true
* console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
* // true
* console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
* // false
* console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
* // false
* ```
* @param {String|Array} `list` The string or array of strings to test.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
micromatch.every = function (list, patterns, options) {
if (typeof list === 'string') {
list = [list];
}
for (var i = 0; i < list.length; i++) {
if (micromatch(list[i], patterns, options).length !== 1) {
return false;
}
}
return true;
};
/**
* Returns true if **any** of the given glob `patterns`
* match the specified `string`.
*
* ```js
* var mm = require('micromatch');
* mm.any(string, patterns[, options]);
*
* console.log(mm.any('a.a', ['b.*', '*.a']));
* //=> true
* console.log(mm.any('a.a', 'b.*'));
* //=> false
* ```
* @param {String|Array} `str` The string to test.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
micromatch.any = function (str, patterns, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (isEmptyString(str) || isEmptyString(patterns)) {
return false;
}
if (typeof patterns === 'string') {
patterns = [patterns];
}
for (var i = 0; i < patterns.length; i++) {
if (micromatch.isMatch(str, patterns[i], options)) {
return true;
}
}
return false;
};
/**
* Returns true if **all** of the given `patterns` match
* the specified string.
*
* ```js
* var mm = require('micromatch');
* mm.all(string, patterns[, options]);
*
* console.log(mm.all('foo.js', ['foo.js']));
* // true
*
* console.log(mm.all('foo.js', ['*.js', '!foo.js']));
* // false
*
* console.log(mm.all('foo.js', ['*.js', 'foo.js']));
* // true
*
* console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
* // true
* ```
* @param {String|Array} `str` The string to test.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
micromatch.all = function (str, patterns, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (typeof patterns === 'string') {
patterns = [patterns];
}
for (var i = 0; i < patterns.length; i++) {
if (!micromatch.isMatch(str, patterns[i], options)) {
return false;
}
}
return true;
};
/**
* Returns a list of strings that _**do not match any**_ of the given `patterns`.
*
* ```js
* var mm = require('micromatch');
* mm.not(list, patterns[, options]);
*
* console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
* //=> ['b.b', 'c.c']
* ```
* @param {Array} `list` Array of strings to match.
* @param {String|Array} `patterns` One or more glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Array} Returns an array of strings that **do not match** the given patterns.
* @api public
*/
micromatch.not = function (list, patterns, options) {
var opts = extend({}, options);
var ignore = opts.ignore;
delete opts.ignore;
var unixify = utils.unixify(opts);
list = utils.arrayify(list).map(unixify);
var matches = utils.diff(list, micromatch(list, patterns, opts));
if (ignore) {
matches = utils.diff(matches, micromatch(list, ignore));
}
return opts.nodupes !== false ? utils.unique(matches) : matches;
};
/**
* Returns true if the given `string` contains the given pattern. Similar
* to [.isMatch](#isMatch) but the pattern can match any part of the string.
*
* ```js
* var mm = require('micromatch');
* mm.contains(string, pattern[, options]);
*
* console.log(mm.contains('aa/bb/cc', '*b'));
* //=> true
* console.log(mm.contains('aa/bb/cc', '*d'));
* //=> false
* ```
* @param {String} `str` The string to match.
* @param {String|Array} `patterns` Glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if the patter matches any part of `str`.
* @api public
*/
micromatch.contains = function (str, patterns, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (typeof patterns === 'string') {
if (isEmptyString(str) || isEmptyString(patterns)) {
return false;
}
var equals = utils.equalsPattern(patterns, options);
if (equals(str)) {
return true;
}
var contains = utils.containsPattern(patterns, options);
if (contains(str)) {
return true;
}
}
var opts = extend({}, options, {
contains: true
});
return micromatch.any(str, patterns, opts);
};
/**
* Returns true if the given pattern and options should enable
* the `matchBase` option.
* @return {Boolean}
* @api private
*/
micromatch.matchBase = function (pattern, options) {
if (pattern && pattern.indexOf('/') !== -1 || !options) return false;
return options.basename === true || options.matchBase === true;
};
/**
* Filter the keys of the given object with the given `glob` pattern
* and `options`. Does not attempt to match nested keys. If you need this feature,
* use [glob-object][] instead.
*
* ```js
* var mm = require('micromatch');
* mm.matchKeys(object, patterns[, options]);
*
* var obj = { aa: 'a', ab: 'b', ac: 'c' };
* console.log(mm.matchKeys(obj, '*b'));
* //=> { ab: 'b' }
* ```
* @param {Object} `object` The object with keys to filter.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Object} Returns an object with only keys that match the given patterns.
* @api public
*/
micromatch.matchKeys = function (obj, patterns, options) {
if (!utils.isObject(obj)) {
throw new TypeError('expected the first argument to be an object');
}
var keys = micromatch(Object.keys(obj), patterns, options);
return utils.pick(obj, keys);
};
/**
* Returns a memoized matcher function from the given glob `pattern` and `options`.
* The returned function takes a string to match as its only argument and returns
* true if the string is a match.
*
* ```js
* var mm = require('micromatch');
* mm.matcher(pattern[, options]);
*
* var isMatch = mm.matcher('*.!(*a)');
* console.log(isMatch('a.a'));
* //=> false
* console.log(isMatch('a.b'));
* //=> true
* ```
* @param {String} `pattern` Glob pattern
* @param {Object} `options` See available [options](#options) for changing how matches are performed.
* @return {Function} Returns a matcher function.
* @api public
*/
micromatch.matcher = function matcher(pattern, options) {
if (Array.isArray(pattern)) {
return compose(pattern, options, matcher);
} // if pattern is a regex
if (pattern instanceof RegExp) {
return test(pattern);
} // if pattern is invalid
if (!utils.isString(pattern)) {
throw new TypeError('expected pattern to be an array, string or regex');
} // if pattern is a non-glob string
if (!utils.hasSpecialChars(pattern)) {
if (options && options.nocase === true) {
pattern = pattern.toLowerCase();
}
return utils.matchPath(pattern, options);
} // if pattern is a glob string
var re = micromatch.makeRe(pattern, options); // if `options.matchBase` or `options.basename` is defined
if (micromatch.matchBase(pattern, options)) {
return utils.matchBasename(re, options);
}
function test(regex) {
var equals = utils.equalsPattern(options);
var unixify = utils.unixify(options);
return function (str) {
if (equals(str)) {
return true;
}
if (regex.test(unixify(str))) {
return true;
}
return false;
};
}
var fn = test(re);
Object.defineProperty(fn, 'result', {
configurable: true,
enumerable: false,
value: re.result
});
return fn;
};
/**
* Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
*
* ```js
* var mm = require('micromatch');
* mm.capture(pattern, string[, options]);
*
* console.log(mm.capture('test/*.js', 'test/foo.js'));
* //=> ['foo']
* console.log(mm.capture('test/*.js', 'foo/bar.css'));
* //=> null
* ```
* @param {String} `pattern` Glob pattern to use for matching.
* @param {String} `string` String to match
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
* @api public
*/
micromatch.capture = function (pattern, str, options) {
var re = micromatch.makeRe(pattern, extend({
capture: true
}, options));
var unixify = utils.unixify(options);
function match() {
return function (string) {
var match = re.exec(unixify(string));
if (!match) {
return null;
}
return match.slice(1);
};
}
var capture = memoize('capture', pattern, options, match);
return capture(str);
};
/**
* Create a regular expression from the given glob `pattern`.
*
* ```js
* var mm = require('micromatch');
* mm.makeRe(pattern[, options]);
*
* console.log(mm.makeRe('*.js'));
* //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
* ```
* @param {String} `pattern` A glob pattern to convert to regex.
* @param {Object} `options` See available [options](#options) for changing how matches are performed.
* @return {RegExp} Returns a regex created from the given pattern.
* @api public
*/
micromatch.makeRe = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
if (pattern.length > MAX_LENGTH) {
throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
}
function makeRe() {
var result = micromatch.create(pattern, options);
var ast_array = [];
var output = result.map(function (obj) {
obj.ast.state = obj.state;
ast_array.push(obj.ast);
return obj.output;
});
var regex = toRegex(output.join('|'), options);
Object.defineProperty(regex, 'result', {
configurable: true,
enumerable: false,
value: ast_array
});
return regex;
}
return memoize('makeRe', pattern, options, makeRe);
};
/**
* Expand the given brace `pattern`.
*
* ```js
* var mm = require('micromatch');
* console.log(mm.braces('foo/{a,b}/bar'));
* //=> ['foo/(a|b)/bar']
*
* console.log(mm.braces('foo/{a,b}/bar', {expand: true}));
* //=> ['foo/(a|b)/bar']
* ```
* @param {String} `pattern` String with brace pattern to expand.
* @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
* @return {Array}
* @api public
*/
micromatch.braces = function (pattern, options) {
if (typeof pattern !== 'string' && !Array.isArray(pattern)) {
throw new TypeError('expected pattern to be an array or string');
}
function expand() {
if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
return utils.arrayify(pattern);
}
return braces(pattern, options);
}
return memoize('braces', pattern, options, expand);
};
/**
* Proxy to the [micromatch.braces](#method), for parity with
* minimatch.
*/
micromatch.braceExpand = function (pattern, options) {
var opts = extend({}, options, {
expand: true
});
return micromatch.braces(pattern, opts);
};
/**
* Parses the given glob `pattern` and returns an array of abstract syntax
* trees (ASTs), with the compiled `output` and optional source `map` on
* each AST.
*
* ```js
* var mm = require('micromatch');
* mm.create(pattern[, options]);
*
* console.log(mm.create('abc/*.js'));
* // [{ options: { source: 'string', sourcemap: true },
* // state: {},
* // compilers:
* // { ... },
* // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js',
* // ast:
* // { type: 'root',
* // errors: [],
* // nodes:
* // [ ... ],
* // dot: false,
* // input: 'abc/*.js' },
* // parsingErrors: [],
* // map:
* // { version: 3,
* // sources: [ 'string' ],
* // names: [],
* // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE',
* // sourcesContent: [ 'abc/*.js' ] },
* // position: { line: 1, column: 28 },
* // content: {},
* // files: {},
* // idx: 6 }]
* ```
* @param {String} `pattern` Glob pattern to parse and compile.
* @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed.
* @return {Object} Returns an object with the parsed AST, compiled string and optional source map.
* @api public
*/
micromatch.create = function (pattern, options) {
return memoize('create', pattern, options, function () {
function create(str, opts) {
return micromatch.compile(micromatch.parse(str, opts), opts);
}
pattern = micromatch.braces(pattern, options);
var len = pattern.length;
var idx = -1;
var res = [];
while (++idx < len) {
res.push(create(pattern[idx], options));
}
return res;
});
};
/**
* Parse the given `str` with the given `options`.
*
* ```js
* var mm = require('micromatch');
* mm.parse(pattern[, options]);
*
* var ast = mm.parse('a/{b,c}/d');
* console.log(ast);
* // { type: 'root',
* // errors: [],
* // input: 'a/{b,c}/d',
* // nodes:
* // [ { type: 'bos', val: '' },
* // { type: 'text', val: 'a/' },
* // { type: 'brace',
* // nodes:
* // [ { type: 'brace.open', val: '{' },
* // { type: 'text', val: 'b,c' },
* // { type: 'brace.close', val: '}' } ] },
* // { type: 'text', val: '/d' },
* // { type: 'eos', val: '' } ] }
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {Object} Returns an AST
* @api public
*/
micromatch.parse = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
function parse() {
var snapdragon = utils.instantiate(null, options);
parsers(snapdragon, options);
var ast = snapdragon.parse(pattern, options);
utils.define(ast, 'snapdragon', snapdragon);
ast.input = pattern;
return ast;
}
return memoize('parse', pattern, options, parse);
};
/**
* Compile the given `ast` or string with the given `options`.
*
* ```js
* var mm = require('micromatch');
* mm.compile(ast[, options]);
*
* var ast = mm.parse('a/{b,c}/d');
* console.log(mm.compile(ast));
* // { options: { source: 'string' },
* // state: {},
* // compilers:
* // { eos: [Function],
* // noop: [Function],
* // bos: [Function],
* // brace: [Function],
* // 'brace.open': [Function],
* // text: [Function],
* // 'brace.close': [Function] },
* // output: [ 'a/(b|c)/d' ],
* // ast:
* // { ... },
* // parsingErrors: [] }
* ```
* @param {Object|String} `ast`
* @param {Object} `options`
* @return {Object} Returns an object that has an `output` property with the compiled string.
* @api public
*/
micromatch.compile = function (ast, options) {
if (typeof ast === 'string') {
ast = micromatch.parse(ast, options);
}
return memoize('compile', ast.input, options, function () {
var snapdragon = utils.instantiate(ast, options);
compilers(snapdragon, options);
return snapdragon.compile(ast, options);
});
};
/**
* Clear the regex cache.
*
* ```js
* mm.clearCache();
* ```
* @api public
*/
micromatch.clearCache = function () {
micromatch.cache.caches = {};
};
/**
* Returns true if the given value is effectively an empty string
*/
function isEmptyString(val) {
return String(val) === '' || String(val) === './';
}
/**
* Compose a matcher function with the given patterns.
* This allows matcher functions to be compiled once and
* called multiple times.
*/
function compose(patterns, options, matcher) {
var matchers;
return memoize('compose', String(patterns), options, function () {
return function (file) {
// delay composition until it's invoked the first time,
// after that it won't be called again
if (!matchers) {
matchers = [];
for (var i = 0; i < patterns.length; i++) {
matchers.push(matcher(patterns[i], options));
}
}
var len = matchers.length;
while (len--) {
if (matchers[len](file) === true) {
return true;
}
}
return false;
};
});
}
/**
* Memoize a generated regex or function. A unique key is generated
* from the `type` (usually method name), the `pattern`, and
* user-defined options.
*/
function memoize(type, pattern, options, fn) {
var key = utils.createKey(type + '=' + pattern, options);
if (options && options.cache === false) {
return fn(pattern, options);
}
if (cache.has(type, key)) {
return cache.get(type, key);
}
var val = fn(pattern, options);
cache.set(type, key, val);
return val;
}
/**
* Expose compiler, parser and cache on `micromatch`
*/
micromatch.compilers = compilers;
micromatch.parsers = parsers;
micromatch.caches = cache.caches;
/**
* Expose `micromatch`
* @type {Function}
*/
module.exports = micromatch;
/***/ }),
/***/ "./node_modules/micromatch/lib/cache.js":
/*!**********************************************!*\
!*** ./node_modules/micromatch/lib/cache.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = new (__webpack_require__(/*! fragment-cache */ "./node_modules/fragment-cache/index.js"))();
/***/ }),
/***/ "./node_modules/micromatch/lib/compilers.js":
/*!**************************************************!*\
!*** ./node_modules/micromatch/lib/compilers.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var nanomatch = __webpack_require__(/*! nanomatch */ "./node_modules/nanomatch/index.js");
var extglob = __webpack_require__(/*! extglob */ "./node_modules/extglob/index.js");
module.exports = function (snapdragon) {
var compilers = snapdragon.compiler.compilers;
var opts = snapdragon.options; // register nanomatch compilers
snapdragon.use(nanomatch.compilers); // get references to some specific nanomatch compilers before they
// are overridden by the extglob and/or custom compilers
var escape = compilers.escape;
var qmark = compilers.qmark;
var slash = compilers.slash;
var star = compilers.star;
var text = compilers.text;
var plus = compilers.plus;
var dot = compilers.dot; // register extglob compilers or escape exglobs if disabled
if (opts.extglob === false || opts.noext === true) {
snapdragon.compiler.use(escapeExtglobs);
} else {
snapdragon.use(extglob.compilers);
}
snapdragon.use(function () {
this.options.star = this.options.star || function ()
/*node*/
{
return '[^\\\\/]*?';
};
}); // custom micromatch compilers
snapdragon.compiler // reset referenced compiler
.set('dot', dot).set('escape', escape).set('plus', plus).set('slash', slash).set('qmark', qmark).set('star', star).set('text', text);
};
function escapeExtglobs(compiler) {
compiler.set('paren', function (node) {
var val = '';
visit(node, function (tok) {
if (tok.val) val += (/^\W/.test(tok.val) ? '\\' : '') + tok.val;
});
return this.emit(val, node);
});
/**
* Visit `node` with the given `fn`
*/
function visit(node, fn) {
return node.nodes ? mapVisit(node.nodes, fn) : fn(node);
}
/**
* Map visit over array of `nodes`.
*/
function mapVisit(nodes, fn) {
var len = nodes.length;
var idx = -1;
while (++idx < len) {
visit(nodes[idx], fn);
}
}
}
/***/ }),
/***/ "./node_modules/micromatch/lib/parsers.js":
/*!************************************************!*\
!*** ./node_modules/micromatch/lib/parsers.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var extglob = __webpack_require__(/*! extglob */ "./node_modules/extglob/index.js");
var nanomatch = __webpack_require__(/*! nanomatch */ "./node_modules/nanomatch/index.js");
var regexNot = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
var not;
/**
* Characters to use in negation regex (we want to "not" match
* characters that are matched by other parsers)
*/
var TEXT = '([!@*?+]?\\(|\\)|\\[:?(?=.*?:?\\])|:?\\]|[*+?!^$.\\\\/])+';
var createNotRegex = function createNotRegex(opts) {
return not || (not = textRegex(TEXT));
};
/**
* Parsers
*/
module.exports = function (snapdragon) {
var parsers = snapdragon.parser.parsers; // register nanomatch parsers
snapdragon.use(nanomatch.parsers); // get references to some specific nanomatch parsers before they
// are overridden by the extglob and/or parsers
var escape = parsers.escape;
var slash = parsers.slash;
var qmark = parsers.qmark;
var plus = parsers.plus;
var star = parsers.star;
var dot = parsers.dot; // register extglob parsers
snapdragon.use(extglob.parsers); // custom micromatch parsers
snapdragon.parser.use(function () {
// override "notRegex" created in nanomatch parser
this.notRegex = /^\!+(?!\()/;
}) // reset the referenced parsers
.capture('escape', escape).capture('slash', slash).capture('qmark', qmark).capture('star', star).capture('plus', plus).capture('dot', dot)
/**
* Override `text` parser
*/
.capture('text', function () {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(createNotRegex(this.options));
if (!m || !m[0]) return; // escape regex boundary characters and simple brackets
var val = m[0].replace(/([[\]^$])/g, '\\$1');
return pos({
type: 'text',
val: val
});
});
};
/**
* Create text regex
*/
function textRegex(pattern) {
var notStr = regexNot.create(pattern, {
contains: true,
strictClose: false
});
var prefix = '(?:[\\^]|\\\\|';
return toRegex(prefix + notStr + ')', {
strictClose: false
});
}
/***/ }),
/***/ "./node_modules/micromatch/lib/utils.js":
/*!**********************************************!*\
!*** ./node_modules/micromatch/lib/utils.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
var utils = module.exports;
var path = __webpack_require__(/*! path */ "./node_modules/path-browserify/index.js");
/**
* Module dependencies
*/
var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
utils.define = __webpack_require__(/*! define-property */ "./node_modules/micromatch/node_modules/define-property/index.js");
utils.diff = __webpack_require__(/*! arr-diff */ "./node_modules/arr-diff/index.js");
utils.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/micromatch/node_modules/extend-shallow/index.js");
utils.pick = __webpack_require__(/*! object.pick */ "./node_modules/object.pick/index.js");
utils.typeOf = __webpack_require__(/*! kind-of */ "./node_modules/micromatch/node_modules/kind-of/index.js");
utils.unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
/**
* Returns true if the platform is windows, or `path.sep` is `\\`.
* This is defined as a function to allow `path.sep` to be set in unit tests,
* or by the user, if there is a reason to do so.
* @return {Boolean}
*/
utils.isWindows = function () {
return path.sep === '\\' || process.platform === 'win32';
};
/**
* Get the `Snapdragon` instance to use
*/
utils.instantiate = function (ast, options) {
var snapdragon; // if an instance was created by `.parse`, use that instance
if (utils.typeOf(ast) === 'object' && ast.snapdragon) {
snapdragon = ast.snapdragon; // if the user supplies an instance on options, use that instance
} else if (utils.typeOf(options) === 'object' && options.snapdragon) {
snapdragon = options.snapdragon; // create a new instance
} else {
snapdragon = new Snapdragon(options);
}
utils.define(snapdragon, 'parse', function (str, options) {
var parsed = Snapdragon.prototype.parse.apply(this, arguments);
parsed.input = str; // escape unmatched brace/bracket/parens
var last = this.parser.stack.pop();
if (last && this.options.strictErrors !== true) {
var open = last.nodes[0];
var inner = last.nodes[1];
if (last.type === 'bracket') {
if (inner.val.charAt(0) === '[') {
inner.val = '\\' + inner.val;
}
} else {
open.val = '\\' + open.val;
var sibling = open.parent.nodes[1];
if (sibling.type === 'star') {
sibling.loose = true;
}
}
} // add non-enumerable parser reference
utils.define(parsed, 'parser', this.parser);
return parsed;
});
return snapdragon;
};
/**
* Create the key to use for memoization. The key is generated
* by iterating over the options and concatenating key-value pairs
* to the pattern string.
*/
utils.createKey = function (pattern, options) {
if (utils.typeOf(options) !== 'object') {
return pattern;
}
var val = pattern;
var keys = Object.keys(options);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
val += ';' + key + '=' + String(options[key]);
}
return val;
};
/**
* Cast `val` to an array
* @return {Array}
*/
utils.arrayify = function (val) {
if (typeof val === 'string') return [val];
return val ? Array.isArray(val) ? val : [val] : [];
};
/**
* Return true if `val` is a non-empty string
*/
utils.isString = function (val) {
return typeof val === 'string';
};
/**
* Return true if `val` is a non-empty string
*/
utils.isObject = function (val) {
return utils.typeOf(val) === 'object';
};
/**
* Returns true if the given `str` has special characters
*/
utils.hasSpecialChars = function (str) {
return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
};
/**
* Escape regex characters in the given string
*/
utils.escapeRegex = function (str) {
return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&');
};
/**
* Normalize slashes in the given filepath.
*
* @param {String} `filepath`
* @return {String}
*/
utils.toPosixPath = function (str) {
return str.replace(/\\+/g, '/');
};
/**
* Strip backslashes before special characters in a string.
*
* @param {String} `str`
* @return {String}
*/
utils.unescape = function (str) {
return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, ''));
};
/**
* Strip the prefix from a filepath
* @param {String} `fp`
* @return {String}
*/
utils.stripPrefix = function (str) {
if (str.charAt(0) !== '.') {
return str;
}
var ch = str.charAt(1);
if (utils.isSlash(ch)) {
return str.slice(2);
}
return str;
};
/**
* Returns true if the given str is an escaped or
* unescaped path character
*/
utils.isSlash = function (str) {
return str === '/' || str === '\\/' || str === '\\' || str === '\\\\';
};
/**
* Returns a function that returns true if the given
* pattern matches or contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.matchPath = function (pattern, options) {
return options && options.contains ? utils.containsPattern(pattern, options) : utils.equalsPattern(pattern, options);
};
/**
* Returns true if the given (original) filepath or unixified path are equal
* to the given pattern.
*/
utils._equals = function (filepath, unixPath, pattern) {
return pattern === filepath || pattern === unixPath;
};
/**
* Returns true if the given (original) filepath or unixified path contain
* the given pattern.
*/
utils._contains = function (filepath, unixPath, pattern) {
return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1;
};
/**
* Returns a function that returns true if the given
* pattern is the same as a given `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.equalsPattern = function (pattern, options) {
var unixify = utils.unixify(options);
options = options || {};
return function fn(filepath) {
var equal = utils._equals(filepath, unixify(filepath), pattern);
if (equal === true || options.nocase !== true) {
return equal;
}
var lower = filepath.toLowerCase();
return utils._equals(lower, unixify(lower), pattern);
};
};
/**
* Returns a function that returns true if the given
* pattern contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.containsPattern = function (pattern, options) {
var unixify = utils.unixify(options);
options = options || {};
return function (filepath) {
var contains = utils._contains(filepath, unixify(filepath), pattern);
if (contains === true || options.nocase !== true) {
return contains;
}
var lower = filepath.toLowerCase();
return utils._contains(lower, unixify(lower), pattern);
};
};
/**
* Returns a function that returns true if the given
* regex matches the `filename` of a file path.
*
* @param {RegExp} `re` Matching regex
* @return {Function}
*/
utils.matchBasename = function (re) {
return function (filepath) {
return re.test(path.basename(filepath));
};
};
/**
* Determines the filepath to return based on the provided options.
* @return {any}
*/
utils.value = function (str, unixify, options) {
if (options && options.unixify === false) {
return str;
}
return unixify(str);
};
/**
* Returns a function that normalizes slashes in a string to forward
* slashes, strips `./` from beginning of paths, and optionally unescapes
* special characters.
* @return {Function}
*/
utils.unixify = function (options) {
options = options || {};
return function (filepath) {
if (utils.isWindows() || options.unixify === true) {
filepath = utils.toPosixPath(filepath);
}
if (options.stripPrefix !== false) {
filepath = utils.stripPrefix(filepath);
}
if (options.unescape === true) {
filepath = utils.unescape(filepath);
}
return filepath;
};
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/micromatch/node_modules/define-property/index.js":
/*!***********************************************************************!*\
!*** ./node_modules/micromatch/node_modules/define-property/index.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*/
var isobject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
var define = typeof Reflect !== 'undefined' && Reflect.defineProperty ? Reflect.defineProperty : Object.defineProperty;
module.exports = function defineProperty(obj, key, val) {
if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
throw new TypeError('expected an object, function, or array');
}
if (typeof key !== 'string') {
throw new TypeError('expected "key" to be a string');
}
if (isDescriptor(val)) {
define(obj, key, val);
return obj;
}
define(obj, key, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
return obj;
};
/***/ }),
/***/ "./node_modules/micromatch/node_modules/extend-shallow/index.js":
/*!**********************************************************************!*\
!*** ./node_modules/micromatch/node_modules/extend-shallow/index.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/micromatch/node_modules/is-extendable/index.js");
var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
module.exports = Object.assign || function (obj
/*, objects*/
) {
if (obj === null || typeof obj === 'undefined') {
throw new TypeError('Cannot convert undefined or null to object');
}
if (!isObject(obj)) {
obj = {};
}
for (var i = 1; i < arguments.length; i++) {
var val = arguments[i];
if (isString(val)) {
val = toObject(val);
}
if (isObject(val)) {
assign(obj, val);
assignSymbols(obj, val);
}
}
return obj;
};
function assign(a, b) {
for (var key in b) {
if (hasOwn(b, key)) {
a[key] = b[key];
}
}
}
function isString(val) {
return val && typeof val === 'string';
}
function toObject(str) {
var obj = {};
for (var i in str) {
obj[i] = str[i];
}
return obj;
}
function isObject(val) {
return val && _typeof(val) === 'object' || isExtendable(val);
}
/**
* Returns true if the given `key` is an own property of `obj`.
*/
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isEnum(obj, key) {
return Object.prototype.propertyIsEnumerable.call(obj, key);
}
/***/ }),
/***/ "./node_modules/micromatch/node_modules/is-extendable/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/micromatch/node_modules/is-extendable/index.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
};
/***/ }),
/***/ "./node_modules/micromatch/node_modules/kind-of/index.js":
/*!***************************************************************!*\
!*** ./node_modules/micromatch/node_modules/kind-of/index.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toString = Object.prototype.toString;
module.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';
} // Non-plain objects
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';
} // other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
return val.constructor ? 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;
}
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === 'function') {
return val.constructor.isBuffer(val);
}
return false;
}
/***/ }),
/***/ "./node_modules/mixin-deep/index.js":
/*!******************************************!*\
!*** ./node_modules/mixin-deep/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/mixin-deep/node_modules/is-extendable/index.js");
var forIn = __webpack_require__(/*! for-in */ "./node_modules/for-in/index.js");
function mixinDeep(target, objects) {
var len = arguments.length,
i = 0;
while (++i < len) {
var obj = arguments[i];
if (isObject(obj)) {
forIn(obj, copy, target);
}
}
return target;
}
/**
* Copy properties from the source object to the
* target object.
*
* @param {*} `val`
* @param {String} `key`
*/
function copy(val, key) {
if (!isValidKey(key)) {
return;
}
var obj = this[key];
if (isObject(val) && isObject(obj)) {
mixinDeep(obj, val);
} else {
this[key] = val;
}
}
/**
* Returns true if `val` is an object or function.
*
* @param {any} val
* @return {Boolean}
*/
function isObject(val) {
return isExtendable(val) && !Array.isArray(val);
}
/**
* Returns true if `key` is a valid key to use when extending objects.
*
* @param {String} `key`
* @return {Boolean}
*/
function isValidKey(key) {
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
}
;
/**
* Expose `mixinDeep`
*/
module.exports = mixinDeep;
/***/ }),
/***/ "./node_modules/mixin-deep/node_modules/is-extendable/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/mixin-deep/node_modules/is-extendable/index.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
};
/***/ }),
/***/ "./node_modules/nanomatch/index.js":
/*!*****************************************!*\
!*** ./node_modules/nanomatch/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Module dependencies
*/
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/nanomatch/node_modules/extend-shallow/index.js");
/**
* Local dependencies
*/
var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/nanomatch/lib/compilers.js");
var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/nanomatch/lib/parsers.js");
var cache = __webpack_require__(/*! ./lib/cache */ "./node_modules/nanomatch/lib/cache.js");
var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/nanomatch/lib/utils.js");
var MAX_LENGTH = 1024 * 64;
/**
* The main function takes a list of strings and one or more
* glob patterns to use for matching.
*
* ```js
* var nm = require('nanomatch');
* nm(list, patterns[, options]);
*
* console.log(nm(['a.js', 'a.txt'], ['*.js']));
* //=> [ 'a.js' ]
* ```
* @param {Array} `list` A list of strings to match
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Array} Returns an array of matches
* @summary false
* @api public
*/
function nanomatch(list, patterns, options) {
patterns = utils.arrayify(patterns);
list = utils.arrayify(list);
var len = patterns.length;
if (list.length === 0 || len === 0) {
return [];
}
if (len === 1) {
return nanomatch.match(list, patterns[0], options);
}
var negated = false;
var omit = [];
var keep = [];
var idx = -1;
while (++idx < len) {
var pattern = patterns[idx];
if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33
/* ! */
) {
omit.push.apply(omit, nanomatch.match(list, pattern.slice(1), options));
negated = true;
} else {
keep.push.apply(keep, nanomatch.match(list, pattern, options));
}
} // minimatch.match parity
if (negated && keep.length === 0) {
if (options && options.unixify === false) {
keep = list.slice();
} else {
var unixify = utils.unixify(options);
for (var i = 0; i < list.length; i++) {
keep.push(unixify(list[i]));
}
}
}
var matches = utils.diff(keep, omit);
if (!options || options.nodupes !== false) {
return utils.unique(matches);
}
return matches;
}
/**
* Similar to the main function, but `pattern` must be a string.
*
* ```js
* var nm = require('nanomatch');
* nm.match(list, pattern[, options]);
*
* console.log(nm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
* //=> ['a.a', 'a.aa']
* ```
* @param {Array} `list` Array of strings to match
* @param {String} `pattern` Glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Array} Returns an array of matches
* @api public
*/
nanomatch.match = function (list, pattern, options) {
if (Array.isArray(pattern)) {
throw new TypeError('expected pattern to be a string');
}
var unixify = utils.unixify(options);
var isMatch = memoize('match', pattern, options, nanomatch.matcher);
var matches = [];
list = utils.arrayify(list);
var len = list.length;
var idx = -1;
while (++idx < len) {
var ele = list[idx];
if (ele === pattern || isMatch(ele)) {
matches.push(utils.value(ele, unixify, options));
}
} // if no options were passed, uniquify results and return
if (typeof options === 'undefined') {
return utils.unique(matches);
}
if (matches.length === 0) {
if (options.failglob === true) {
throw new Error('no matches found for "' + pattern + '"');
}
if (options.nonull === true || options.nullglob === true) {
return [options.unescape ? utils.unescape(pattern) : pattern];
}
} // if `opts.ignore` was defined, diff ignored list
if (options.ignore) {
matches = nanomatch.not(matches, options.ignore, options);
}
return options.nodupes !== false ? utils.unique(matches) : matches;
};
/**
* Returns true if the specified `string` matches the given glob `pattern`.
*
* ```js
* var nm = require('nanomatch');
* nm.isMatch(string, pattern[, options]);
*
* console.log(nm.isMatch('a.a', '*.a'));
* //=> true
* console.log(nm.isMatch('a.b', '*.a'));
* //=> false
* ```
* @param {String} `string` String to match
* @param {String} `pattern` Glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if the string matches the glob pattern.
* @api public
*/
nanomatch.isMatch = function (str, pattern, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (utils.isEmptyString(str) || utils.isEmptyString(pattern)) {
return false;
}
var equals = utils.equalsPattern(options);
if (equals(str)) {
return true;
}
var isMatch = memoize('isMatch', pattern, options, nanomatch.matcher);
return isMatch(str);
};
/**
* Returns true if some of the elements in the given `list` match any of the
* given glob `patterns`.
*
* ```js
* var nm = require('nanomatch');
* nm.some(list, patterns[, options]);
*
* console.log(nm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
* // true
* console.log(nm.some(['foo.js'], ['*.js', '!foo.js']));
* // false
* ```
* @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
nanomatch.some = function (list, patterns, options) {
if (typeof list === 'string') {
list = [list];
}
for (var i = 0; i < list.length; i++) {
if (nanomatch(list[i], patterns, options).length === 1) {
return true;
}
}
return false;
};
/**
* Returns true if every element in the given `list` matches
* at least one of the given glob `patterns`.
*
* ```js
* var nm = require('nanomatch');
* nm.every(list, patterns[, options]);
*
* console.log(nm.every('foo.js', ['foo.js']));
* // true
* console.log(nm.every(['foo.js', 'bar.js'], ['*.js']));
* // true
* console.log(nm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
* // false
* console.log(nm.every(['foo.js'], ['*.js', '!foo.js']));
* // false
* ```
* @param {String|Array} `list` The string or array of strings to test.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
nanomatch.every = function (list, patterns, options) {
if (typeof list === 'string') {
list = [list];
}
for (var i = 0; i < list.length; i++) {
if (nanomatch(list[i], patterns, options).length !== 1) {
return false;
}
}
return true;
};
/**
* Returns true if **any** of the given glob `patterns`
* match the specified `string`.
*
* ```js
* var nm = require('nanomatch');
* nm.any(string, patterns[, options]);
*
* console.log(nm.any('a.a', ['b.*', '*.a']));
* //=> true
* console.log(nm.any('a.a', 'b.*'));
* //=> false
* ```
* @param {String|Array} `str` The string to test.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
nanomatch.any = function (str, patterns, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) {
return false;
}
if (typeof patterns === 'string') {
patterns = [patterns];
}
for (var i = 0; i < patterns.length; i++) {
if (nanomatch.isMatch(str, patterns[i], options)) {
return true;
}
}
return false;
};
/**
* Returns true if **all** of the given `patterns`
* match the specified string.
*
* ```js
* var nm = require('nanomatch');
* nm.all(string, patterns[, options]);
*
* console.log(nm.all('foo.js', ['foo.js']));
* // true
*
* console.log(nm.all('foo.js', ['*.js', '!foo.js']));
* // false
*
* console.log(nm.all('foo.js', ['*.js', 'foo.js']));
* // true
*
* console.log(nm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
* // true
* ```
* @param {String|Array} `str` The string to test.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
nanomatch.all = function (str, patterns, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (typeof patterns === 'string') {
patterns = [patterns];
}
for (var i = 0; i < patterns.length; i++) {
if (!nanomatch.isMatch(str, patterns[i], options)) {
return false;
}
}
return true;
};
/**
* Returns a list of strings that _**do not match any**_ of the given `patterns`.
*
* ```js
* var nm = require('nanomatch');
* nm.not(list, patterns[, options]);
*
* console.log(nm.not(['a.a', 'b.b', 'c.c'], '*.a'));
* //=> ['b.b', 'c.c']
* ```
* @param {Array} `list` Array of strings to match.
* @param {String|Array} `patterns` One or more glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Array} Returns an array of strings that **do not match** the given patterns.
* @api public
*/
nanomatch.not = function (list, patterns, options) {
var opts = extend({}, options);
var ignore = opts.ignore;
delete opts.ignore;
list = utils.arrayify(list);
var matches = utils.diff(list, nanomatch(list, patterns, opts));
if (ignore) {
matches = utils.diff(matches, nanomatch(list, ignore));
}
return opts.nodupes !== false ? utils.unique(matches) : matches;
};
/**
* Returns true if the given `string` contains the given pattern. Similar
* to [.isMatch](#isMatch) but the pattern can match any part of the string.
*
* ```js
* var nm = require('nanomatch');
* nm.contains(string, pattern[, options]);
*
* console.log(nm.contains('aa/bb/cc', '*b'));
* //=> true
* console.log(nm.contains('aa/bb/cc', '*d'));
* //=> false
* ```
* @param {String} `str` The string to match.
* @param {String|Array} `patterns` Glob pattern to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns true if the patter matches any part of `str`.
* @api public
*/
nanomatch.contains = function (str, patterns, options) {
if (typeof str !== 'string') {
throw new TypeError('expected a string: "' + util.inspect(str) + '"');
}
if (typeof patterns === 'string') {
if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) {
return false;
}
var equals = utils.equalsPattern(patterns, options);
if (equals(str)) {
return true;
}
var contains = utils.containsPattern(patterns, options);
if (contains(str)) {
return true;
}
}
var opts = extend({}, options, {
contains: true
});
return nanomatch.any(str, patterns, opts);
};
/**
* Returns true if the given pattern and options should enable
* the `matchBase` option.
* @return {Boolean}
* @api private
*/
nanomatch.matchBase = function (pattern, options) {
if (pattern && pattern.indexOf('/') !== -1 || !options) return false;
return options.basename === true || options.matchBase === true;
};
/**
* Filter the keys of the given object with the given `glob` pattern
* and `options`. Does not attempt to match nested keys. If you need this feature,
* use [glob-object][] instead.
*
* ```js
* var nm = require('nanomatch');
* nm.matchKeys(object, patterns[, options]);
*
* var obj = { aa: 'a', ab: 'b', ac: 'c' };
* console.log(nm.matchKeys(obj, '*b'));
* //=> { ab: 'b' }
* ```
* @param {Object} `object` The object with keys to filter.
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Object} Returns an object with only keys that match the given patterns.
* @api public
*/
nanomatch.matchKeys = function (obj, patterns, options) {
if (!utils.isObject(obj)) {
throw new TypeError('expected the first argument to be an object');
}
var keys = nanomatch(Object.keys(obj), patterns, options);
return utils.pick(obj, keys);
};
/**
* Returns a memoized matcher function from the given glob `pattern` and `options`.
* The returned function takes a string to match as its only argument and returns
* true if the string is a match.
*
* ```js
* var nm = require('nanomatch');
* nm.matcher(pattern[, options]);
*
* var isMatch = nm.matcher('*.!(*a)');
* console.log(isMatch('a.a'));
* //=> false
* console.log(isMatch('a.b'));
* //=> true
* ```
* @param {String} `pattern` Glob pattern
* @param {Object} `options` See available [options](#options) for changing how matches are performed.
* @return {Function} Returns a matcher function.
* @api public
*/
nanomatch.matcher = function matcher(pattern, options) {
if (utils.isEmptyString(pattern)) {
return function () {
return false;
};
}
if (Array.isArray(pattern)) {
return compose(pattern, options, matcher);
} // if pattern is a regex
if (pattern instanceof RegExp) {
return test(pattern);
} // if pattern is invalid
if (!utils.isString(pattern)) {
throw new TypeError('expected pattern to be an array, string or regex');
} // if pattern is a non-glob string
if (!utils.hasSpecialChars(pattern)) {
if (options && options.nocase === true) {
pattern = pattern.toLowerCase();
}
return utils.matchPath(pattern, options);
} // if pattern is a glob string
var re = nanomatch.makeRe(pattern, options); // if `options.matchBase` or `options.basename` is defined
if (nanomatch.matchBase(pattern, options)) {
return utils.matchBasename(re, options);
}
function test(regex) {
var equals = utils.equalsPattern(options);
var unixify = utils.unixify(options);
return function (str) {
if (equals(str)) {
return true;
}
if (regex.test(unixify(str))) {
return true;
}
return false;
};
} // create matcher function
var matcherFn = test(re); // set result object from compiler on matcher function,
// as a non-enumerable property. useful for debugging
utils.define(matcherFn, 'result', re.result);
return matcherFn;
};
/**
* Returns an array of matches captured by `pattern` in `string, or
* `null` if the pattern did not match.
*
* ```js
* var nm = require('nanomatch');
* nm.capture(pattern, string[, options]);
*
* console.log(nm.capture('test/*.js', 'test/foo.js'));
* //=> ['foo']
* console.log(nm.capture('test/*.js', 'foo/bar.css'));
* //=> null
* ```
* @param {String} `pattern` Glob pattern to use for matching.
* @param {String} `string` String to match
* @param {Object} `options` See available [options](#options) for changing how matches are performed
* @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
* @api public
*/
nanomatch.capture = function (pattern, str, options) {
var re = nanomatch.makeRe(pattern, extend({
capture: true
}, options));
var unixify = utils.unixify(options);
function match() {
return function (string) {
var match = re.exec(unixify(string));
if (!match) {
return null;
}
return match.slice(1);
};
}
var capture = memoize('capture', pattern, options, match);
return capture(str);
};
/**
* Create a regular expression from the given glob `pattern`.
*
* ```js
* var nm = require('nanomatch');
* nm.makeRe(pattern[, options]);
*
* console.log(nm.makeRe('*.js'));
* //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
* ```
* @param {String} `pattern` A glob pattern to convert to regex.
* @param {Object} `options` See available [options](#options) for changing how matches are performed.
* @return {RegExp} Returns a regex created from the given pattern.
* @api public
*/
nanomatch.makeRe = function (pattern, options) {
if (pattern instanceof RegExp) {
return pattern;
}
if (typeof pattern !== 'string') {
throw new TypeError('expected pattern to be a string');
}
if (pattern.length > MAX_LENGTH) {
throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
}
function makeRe() {
var opts = utils.extend({
wrap: false
}, options);
var result = nanomatch.create(pattern, opts);
var regex = toRegex(result.output, opts);
utils.define(regex, 'result', result);
return regex;
}
return memoize('makeRe', pattern, options, makeRe);
};
/**
* Parses the given glob `pattern` and returns an object with the compiled `output`
* and optional source `map`.
*
* ```js
* var nm = require('nanomatch');
* nm.create(pattern[, options]);
*
* console.log(nm.create('abc/*.js'));
* // { options: { source: 'string', sourcemap: true },
* // state: {},
* // compilers:
* // { ... },
* // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js',
* // ast:
* // { type: 'root',
* // errors: [],
* // nodes:
* // [ ... ],
* // dot: false,
* // input: 'abc/*.js' },
* // parsingErrors: [],
* // map:
* // { version: 3,
* // sources: [ 'string' ],
* // names: [],
* // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE',
* // sourcesContent: [ 'abc/*.js' ] },
* // position: { line: 1, column: 28 },
* // content: {},
* // files: {},
* // idx: 6 }
* ```
* @param {String} `pattern` Glob pattern to parse and compile.
* @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed.
* @return {Object} Returns an object with the parsed AST, compiled string and optional source map.
* @api public
*/
nanomatch.create = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
function create() {
return nanomatch.compile(nanomatch.parse(pattern, options), options);
}
return memoize('create', pattern, options, create);
};
/**
* Parse the given `str` with the given `options`.
*
* ```js
* var nm = require('nanomatch');
* nm.parse(pattern[, options]);
*
* var ast = nm.parse('a/{b,c}/d');
* console.log(ast);
* // { type: 'root',
* // errors: [],
* // input: 'a/{b,c}/d',
* // nodes:
* // [ { type: 'bos', val: '' },
* // { type: 'text', val: 'a/' },
* // { type: 'brace',
* // nodes:
* // [ { type: 'brace.open', val: '{' },
* // { type: 'text', val: 'b,c' },
* // { type: 'brace.close', val: '}' } ] },
* // { type: 'text', val: '/d' },
* // { type: 'eos', val: '' } ] }
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {Object} Returns an AST
* @api public
*/
nanomatch.parse = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
function parse() {
var snapdragon = utils.instantiate(null, options);
parsers(snapdragon, options);
var ast = snapdragon.parse(pattern, options);
utils.define(ast, 'snapdragon', snapdragon);
ast.input = pattern;
return ast;
}
return memoize('parse', pattern, options, parse);
};
/**
* Compile the given `ast` or string with the given `options`.
*
* ```js
* var nm = require('nanomatch');
* nm.compile(ast[, options]);
*
* var ast = nm.parse('a/{b,c}/d');
* console.log(nm.compile(ast));
* // { options: { source: 'string' },
* // state: {},
* // compilers:
* // { eos: [Function],
* // noop: [Function],
* // bos: [Function],
* // brace: [Function],
* // 'brace.open': [Function],
* // text: [Function],
* // 'brace.close': [Function] },
* // output: [ 'a/(b|c)/d' ],
* // ast:
* // { ... },
* // parsingErrors: [] }
* ```
* @param {Object|String} `ast`
* @param {Object} `options`
* @return {Object} Returns an object that has an `output` property with the compiled string.
* @api public
*/
nanomatch.compile = function (ast, options) {
if (typeof ast === 'string') {
ast = nanomatch.parse(ast, options);
}
function compile() {
var snapdragon = utils.instantiate(ast, options);
compilers(snapdragon, options);
return snapdragon.compile(ast, options);
}
return memoize('compile', ast.input, options, compile);
};
/**
* Clear the regex cache.
*
* ```js
* nm.clearCache();
* ```
* @api public
*/
nanomatch.clearCache = function () {
nanomatch.cache.__data__ = {};
};
/**
* Compose a matcher function with the given patterns.
* This allows matcher functions to be compiled once and
* called multiple times.
*/
function compose(patterns, options, matcher) {
var matchers;
return memoize('compose', String(patterns), options, function () {
return function (file) {
// delay composition until it's invoked the first time,
// after that it won't be called again
if (!matchers) {
matchers = [];
for (var i = 0; i < patterns.length; i++) {
matchers.push(matcher(patterns[i], options));
}
}
var len = matchers.length;
while (len--) {
if (matchers[len](file) === true) {
return true;
}
}
return false;
};
});
}
/**
* Memoize a generated regex or function. A unique key is generated
* from the `type` (usually method name), the `pattern`, and
* user-defined options.
*/
function memoize(type, pattern, options, fn) {
var key = utils.createKey(type + '=' + pattern, options);
if (options && options.cache === false) {
return fn(pattern, options);
}
if (cache.has(type, key)) {
return cache.get(type, key);
}
var val = fn(pattern, options);
cache.set(type, key, val);
return val;
}
/**
* Expose compiler, parser and cache on `nanomatch`
*/
nanomatch.compilers = compilers;
nanomatch.parsers = parsers;
nanomatch.cache = cache;
/**
* Expose `nanomatch`
* @type {Function}
*/
module.exports = nanomatch;
/***/ }),
/***/ "./node_modules/nanomatch/lib/cache.js":
/*!*********************************************!*\
!*** ./node_modules/nanomatch/lib/cache.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = new (__webpack_require__(/*! fragment-cache */ "./node_modules/fragment-cache/index.js"))();
/***/ }),
/***/ "./node_modules/nanomatch/lib/compilers.js":
/*!*************************************************!*\
!*** ./node_modules/nanomatch/lib/compilers.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Nanomatch compilers
*/
module.exports = function (nanomatch, options) {
function slash() {
if (options && typeof options.slash === 'string') {
return options.slash;
}
if (options && typeof options.slash === 'function') {
return options.slash.call(nanomatch);
}
return '\\\\/';
}
function star() {
if (options && typeof options.star === 'string') {
return options.star;
}
if (options && typeof options.star === 'function') {
return options.star.call(nanomatch);
}
return '[^' + slash() + ']*?';
}
var ast = nanomatch.ast = nanomatch.parser.ast;
ast.state = nanomatch.parser.state;
nanomatch.compiler.state = ast.state;
nanomatch.compiler
/**
* Negation / escaping
*/
.set('not', function (node) {
var prev = this.prev();
if (this.options.nonegate === true || prev.type !== 'bos') {
return this.emit('\\' + node.val, node);
}
return this.emit(node.val, node);
}).set('escape', function (node) {
if (this.options.unescape && /^[-\w_.]/.test(node.val)) {
return this.emit(node.val, node);
}
return this.emit('\\' + node.val, node);
}).set('quoted', function (node) {
return this.emit(node.val, node);
})
/**
* Regex
*/
.set('dollar', function (node) {
if (node.parent.type === 'bracket') {
return this.emit(node.val, node);
}
return this.emit('\\' + node.val, node);
})
/**
* Dot: "."
*/
.set('dot', function (node) {
if (node.dotfiles === true) this.dotfiles = true;
return this.emit('\\' + node.val, node);
})
/**
* Slashes: "/" and "\"
*/
.set('backslash', function (node) {
return this.emit(node.val, node);
}).set('slash', function (node, nodes, i) {
var val = '[' + slash() + ']';
var parent = node.parent;
var prev = this.prev(); // set "node.hasSlash" to true on all ancestor parens nodes
while (parent.type === 'paren' && !parent.hasSlash) {
parent.hasSlash = true;
parent = parent.parent;
}
if (prev.addQmark) {
val += '?';
} // word boundary
if (node.rest.slice(0, 2) === '\\b') {
return this.emit(val, node);
} // globstars
if (node.parsed === '**' || node.parsed === './**') {
this.output = '(?:' + this.output;
return this.emit(val + ')?', node);
} // negation
if (node.parsed === '!**' && this.options.nonegate !== true) {
return this.emit(val + '?\\b', node);
}
return this.emit(val, node);
})
/**
* Square brackets
*/
.set('bracket', function (node) {
var close = node.close;
var open = !node.escaped ? '[' : '\\[';
var negated = node.negated;
var inner = node.inner;
var val = node.val;
if (node.escaped === true) {
inner = inner.replace(/\\?(\W)/g, '\\$1');
negated = '';
}
if (inner === ']-') {
inner = '\\]\\-';
}
if (negated && inner.indexOf('.') === -1) {
inner += '.';
}
if (negated && inner.indexOf('/') === -1) {
inner += '/';
}
val = open + negated + inner + close;
return this.emit(val, node);
})
/**
* Square: "[.]" (only matches a single character in brackets)
*/
.set('square', function (node) {
var val = (/^\W/.test(node.val) ? '\\' : '') + node.val;
return this.emit(val, node);
})
/**
* Question mark: "?"
*/
.set('qmark', function (node) {
var prev = this.prev(); // don't use "slash" variable so that we always avoid
// matching backslashes and slashes with a qmark
var val = '[^.\\\\/]';
if (this.options.dot || prev.type !== 'bos' && prev.type !== 'slash') {
val = '[^\\\\/]';
}
if (node.parsed.slice(-1) === '(') {
var ch = node.rest.charAt(0);
if (ch === '!' || ch === '=' || ch === ':') {
return this.emit(node.val, node);
}
}
if (node.val.length > 1) {
val += '{' + node.val.length + '}';
}
return this.emit(val, node);
})
/**
* Plus
*/
.set('plus', function (node) {
var prev = node.parsed.slice(-1);
if (prev === ']' || prev === ')') {
return this.emit(node.val, node);
}
if (!this.output || /[?*+]/.test(ch) && node.parent.type !== 'bracket') {
return this.emit('\\+', node);
}
var ch = this.output.slice(-1);
if (/\w/.test(ch) && !node.inside) {
return this.emit('+\\+?', node);
}
return this.emit('+', node);
})
/**
* globstar: '**'
*/
.set('globstar', function (node, nodes, i) {
if (!this.output) {
this.state.leadingGlobstar = true;
}
var prev = this.prev();
var before = this.prev(2);
var next = this.next();
var after = this.next(2);
var type = prev.type;
var val = node.val;
if (prev.type === 'slash' && next.type === 'slash') {
if (before.type === 'text') {
this.output += '?';
if (after.type !== 'text') {
this.output += '\\b';
}
}
}
var parsed = node.parsed;
if (parsed.charAt(0) === '!') {
parsed = parsed.slice(1);
}
var isInside = node.isInside.paren || node.isInside.brace;
if (parsed && type !== 'slash' && type !== 'bos' && !isInside) {
val = star();
} else {
val = this.options.dot !== true ? '(?:(?!(?:[' + slash() + ']|^)\\.).)*?' : '(?:(?!(?:[' + slash() + ']|^)(?:\\.{1,2})($|[' + slash() + ']))(?!\\.{2}).)*?';
}
if ((type === 'slash' || type === 'bos') && this.options.dot !== true) {
val = '(?!\\.)' + val;
}
if (prev.type === 'slash' && next.type === 'slash' && before.type !== 'text') {
if (after.type === 'text' || after.type === 'star') {
node.addQmark = true;
}
}
if (this.options.capture) {
val = '(' + val + ')';
}
return this.emit(val, node);
})
/**
* Star: "*"
*/
.set('star', function (node, nodes, i) {
var prior = nodes[i - 2] || {};
var prev = this.prev();
var next = this.next();
var type = prev.type;
function isStart(n) {
return n.type === 'bos' || n.type === 'slash';
}
if (this.output === '' && this.options.contains !== true) {
this.output = '(?![' + slash() + '])';
}
if (type === 'bracket' && this.options.bash === false) {
var str = next && next.type === 'bracket' ? star() : '*?';
if (!prev.nodes || prev.nodes[1].type !== 'posix') {
return this.emit(str, node);
}
}
var prefix = !this.dotfiles && type !== 'text' && type !== 'escape' ? this.options.dot ? '(?!(?:^|[' + slash() + '])\\.{1,2}(?:$|[' + slash() + ']))' : '(?!\\.)' : '';
if (isStart(prev) || isStart(prior) && type === 'not') {
if (prefix !== '(?!\\.)') {
prefix += '(?!(\\.{2}|\\.[' + slash() + ']))(?=.)';
} else {
prefix += '(?=.)';
}
} else if (prefix === '(?!\\.)') {
prefix = '';
}
if (prev.type === 'not' && prior.type === 'bos' && this.options.dot === true) {
this.output = '(?!\\.)' + this.output;
}
var output = prefix + star();
if (this.options.capture) {
output = '(' + output + ')';
}
return this.emit(output, node);
})
/**
* Text
*/
.set('text', function (node) {
return this.emit(node.val, node);
})
/**
* End-of-string
*/
.set('eos', function (node) {
var prev = this.prev();
var val = node.val;
this.output = '(?:\\.[' + slash() + '](?=.))?' + this.output;
if (this.state.metachar && prev.type !== 'qmark' && prev.type !== 'slash') {
val += this.options.contains ? '[' + slash() + ']?' : '(?:[' + slash() + ']|$)';
}
return this.emit(val, node);
});
/**
* Allow custom compilers to be passed on options
*/
if (options && typeof options.compilers === 'function') {
options.compilers(nanomatch.compiler);
}
};
/***/ }),
/***/ "./node_modules/nanomatch/lib/parsers.js":
/*!***********************************************!*\
!*** ./node_modules/nanomatch/lib/parsers.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var regexNot = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
/**
* Characters to use in negation regex (we want to "not" match
* characters that are matched by other parsers)
*/
var cached;
var NOT_REGEX = '[\\[!*+?$^"\'.\\\\/]+';
var not = createTextRegex(NOT_REGEX);
/**
* Nanomatch parsers
*/
module.exports = function (nanomatch, options) {
var parser = nanomatch.parser;
var opts = parser.options;
parser.state = {
slashes: 0,
paths: []
};
parser.ast.state = parser.state;
parser
/**
* Beginning-of-string
*/
.capture('prefix', function () {
if (this.parsed) return;
var m = this.match(/^\.[\\/]/);
if (!m) return;
this.state.strictOpen = !!this.options.strictOpen;
this.state.addPrefix = true;
})
/**
* Escape: "\\."
*/
.capture('escape', function () {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(/^(?:\\(.)|([$^]))/);
if (!m) return;
return pos({
type: 'escape',
val: m[2] || m[1]
});
})
/**
* Quoted strings
*/
.capture('quoted', function () {
var pos = this.position();
var m = this.match(/^["']/);
if (!m) return;
var quote = m[0];
if (this.input.indexOf(quote) === -1) {
return pos({
type: 'escape',
val: quote
});
}
var tok = advanceTo(this.input, quote);
this.consume(tok.len);
return pos({
type: 'quoted',
val: tok.esc
});
})
/**
* Negations: "!"
*/
.capture('not', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(this.notRegex || /^!+/);
if (!m) return;
var val = m[0];
var isNegated = val.length % 2 === 1;
if (parsed === '' && !isNegated) {
val = '';
} // if nothing has been parsed, we know `!` is at the start,
// so we need to wrap the result in a negation regex
if (parsed === '' && isNegated && this.options.nonegate !== true) {
this.bos.val = '(?!^(?:';
this.append = ')$).*';
val = '';
}
return pos({
type: 'not',
val: val
});
})
/**
* Dot: "."
*/
.capture('dot', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\.+/);
if (!m) return;
var val = m[0];
this.state.dot = val === '.' && (parsed === '' || parsed.slice(-1) === '/');
return pos({
type: 'dot',
dotfiles: this.state.dot,
val: val
});
})
/**
* Plus: "+"
*/
.capture('plus', /^\+(?!\()/)
/**
* Question mark: "?"
*/
.capture('qmark', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\?+(?!\()/);
if (!m) return;
this.state.metachar = true;
this.state.qmark = true;
return pos({
type: 'qmark',
parsed: parsed,
val: m[0]
});
})
/**
* Globstar: "**"
*/
.capture('globstar', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(/^\*{2}(?![*(])(?=[,)/]|$)/);
if (!m) return;
var type = opts.noglobstar !== true ? 'globstar' : 'star';
var node = pos({
type: type,
parsed: parsed
});
this.state.metachar = true;
while (this.input.slice(0, 4) === '/**/') {
this.input = this.input.slice(3);
}
node.isInside = {
brace: this.isInside('brace'),
paren: this.isInside('paren')
};
if (type === 'globstar') {
this.state.globstar = true;
node.val = '**';
} else {
this.state.star = true;
node.val = '*';
}
return node;
})
/**
* Star: "*"
*/
.capture('star', function () {
var pos = this.position();
var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(/]|$)|\*(?=\*\())/;
var m = this.match(starRe);
if (!m) return;
this.state.metachar = true;
this.state.star = true;
return pos({
type: 'star',
val: m[0]
});
})
/**
* Slash: "/"
*/
.capture('slash', function () {
var pos = this.position();
var m = this.match(/^\//);
if (!m) return;
this.state.slashes++;
return pos({
type: 'slash',
val: m[0]
});
})
/**
* Backslash: "\\"
*/
.capture('backslash', function () {
var pos = this.position();
var m = this.match(/^\\(?![*+?(){}[\]'"])/);
if (!m) return;
var val = m[0];
if (this.isInside('bracket')) {
val = '\\';
} else if (val.length > 1) {
val = '\\\\';
}
return pos({
type: 'backslash',
val: val
});
})
/**
* Square: "[.]"
*/
.capture('square', function () {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(/^\[([^!^\\])\]/);
if (!m) return;
return pos({
type: 'square',
val: m[1]
});
})
/**
* Brackets: "[...]" (basic, this can be overridden by other parsers)
*/
.capture('bracket', function () {
var pos = this.position();
var m = this.match(/^(?:\[([!^]?)([^\]]+|\]-)(\]|[^*+?]+)|\[)/);
if (!m) return;
var val = m[0];
var negated = m[1] ? '^' : '';
var inner = (m[2] || '').replace(/\\\\+/, '\\\\');
var close = m[3] || '';
if (m[2] && inner.length < m[2].length) {
val = val.replace(/\\\\+/, '\\\\');
}
var esc = this.input.slice(0, 2);
if (inner === '' && esc === '\\]') {
inner += esc;
this.consume(2);
var str = this.input;
var idx = -1;
var ch;
while (ch = str[++idx]) {
this.consume(1);
if (ch === ']') {
close = ch;
break;
}
inner += ch;
}
}
return pos({
type: 'bracket',
val: val,
escaped: close !== ']',
negated: negated,
inner: inner,
close: close
});
})
/**
* Text
*/
.capture('text', function () {
if (this.isInside('bracket')) return;
var pos = this.position();
var m = this.match(not);
if (!m || !m[0]) return;
return pos({
type: 'text',
val: m[0]
});
});
/**
* Allow custom parsers to be passed on options
*/
if (options && typeof options.parsers === 'function') {
options.parsers(nanomatch.parser);
}
};
/**
* Advance to the next non-escaped character
*/
function advanceTo(input, endChar) {
var ch = input.charAt(0);
var tok = {
len: 1,
val: '',
esc: ''
};
var idx = 0;
function advance() {
if (ch !== '\\') {
tok.esc += '\\' + ch;
tok.val += ch;
}
ch = input.charAt(++idx);
tok.len++;
if (ch === '\\') {
advance();
advance();
}
}
while (ch && ch !== endChar) {
advance();
}
return tok;
}
/**
* Create text regex
*/
function createTextRegex(pattern) {
if (cached) return cached;
var opts = {
contains: true,
strictClose: false
};
var not = regexNot.create(pattern, opts);
var re = toRegex('^(?:[*]\\((?=.)|' + not + ')', opts);
return cached = re;
}
/**
* Expose negation string
*/
module.exports.not = NOT_REGEX;
/***/ }),
/***/ "./node_modules/nanomatch/lib/utils.js":
/*!*********************************************!*\
!*** ./node_modules/nanomatch/lib/utils.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = module.exports;
var path = __webpack_require__(/*! path */ "./node_modules/path-browserify/index.js");
/**
* Module dependencies
*/
var isWindows = __webpack_require__(/*! is-windows */ "./node_modules/is-windows/index.js")();
var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
utils.define = __webpack_require__(/*! define-property */ "./node_modules/nanomatch/node_modules/define-property/index.js");
utils.diff = __webpack_require__(/*! arr-diff */ "./node_modules/arr-diff/index.js");
utils.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/nanomatch/node_modules/extend-shallow/index.js");
utils.pick = __webpack_require__(/*! object.pick */ "./node_modules/object.pick/index.js");
utils.typeOf = __webpack_require__(/*! kind-of */ "./node_modules/nanomatch/node_modules/kind-of/index.js");
utils.unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
/**
* Returns true if the given value is effectively an empty string
*/
utils.isEmptyString = function (val) {
return String(val) === '' || String(val) === './';
};
/**
* Returns true if the platform is windows, or `path.sep` is `\\`.
* This is defined as a function to allow `path.sep` to be set in unit tests,
* or by the user, if there is a reason to do so.
* @return {Boolean}
*/
utils.isWindows = function () {
return path.sep === '\\' || isWindows === true;
};
/**
* Return the last element from an array
*/
utils.last = function (arr, n) {
return arr[arr.length - (n || 1)];
};
/**
* Get the `Snapdragon` instance to use
*/
utils.instantiate = function (ast, options) {
var snapdragon; // if an instance was created by `.parse`, use that instance
if (utils.typeOf(ast) === 'object' && ast.snapdragon) {
snapdragon = ast.snapdragon; // if the user supplies an instance on options, use that instance
} else if (utils.typeOf(options) === 'object' && options.snapdragon) {
snapdragon = options.snapdragon; // create a new instance
} else {
snapdragon = new Snapdragon(options);
}
utils.define(snapdragon, 'parse', function (str, options) {
var parsed = Snapdragon.prototype.parse.call(this, str, options);
parsed.input = str; // escape unmatched brace/bracket/parens
var last = this.parser.stack.pop();
if (last && this.options.strictErrors !== true) {
var open = last.nodes[0];
var inner = last.nodes[1];
if (last.type === 'bracket') {
if (inner.val.charAt(0) === '[') {
inner.val = '\\' + inner.val;
}
} else {
open.val = '\\' + open.val;
var sibling = open.parent.nodes[1];
if (sibling.type === 'star') {
sibling.loose = true;
}
}
} // add non-enumerable parser reference
utils.define(parsed, 'parser', this.parser);
return parsed;
});
return snapdragon;
};
/**
* Create the key to use for memoization. The key is generated
* by iterating over the options and concatenating key-value pairs
* to the pattern string.
*/
utils.createKey = function (pattern, options) {
if (typeof options === 'undefined') {
return pattern;
}
var key = pattern;
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
key += ';' + prop + '=' + String(options[prop]);
}
}
return key;
};
/**
* Cast `val` to an array
* @return {Array}
*/
utils.arrayify = function (val) {
if (typeof val === 'string') return [val];
return val ? Array.isArray(val) ? val : [val] : [];
};
/**
* Return true if `val` is a non-empty string
*/
utils.isString = function (val) {
return typeof val === 'string';
};
/**
* Return true if `val` is a non-empty string
*/
utils.isRegex = function (val) {
return utils.typeOf(val) === 'regexp';
};
/**
* Return true if `val` is a non-empty string
*/
utils.isObject = function (val) {
return utils.typeOf(val) === 'object';
};
/**
* Escape regex characters in the given string
*/
utils.escapeRegex = function (str) {
return str.replace(/[-[\]{}()^$|*+?.\\/\s]/g, '\\$&');
};
/**
* Combines duplicate characters in the provided `input` string.
* @param {String} `input`
* @returns {String}
*/
utils.combineDupes = function (input, patterns) {
patterns = utils.arrayify(patterns).join('|').split('|');
patterns = patterns.map(function (s) {
return s.replace(/\\?([+*\\/])/g, '\\$1');
});
var substr = patterns.join('|');
var regex = new RegExp('(' + substr + ')(?=\\1)', 'g');
return input.replace(regex, '');
};
/**
* Returns true if the given `str` has special characters
*/
utils.hasSpecialChars = function (str) {
return /(?:(?:(^|\/)[!.])|[*?+()|[\]{}]|[+@]\()/.test(str);
};
/**
* Normalize slashes in the given filepath.
*
* @param {String} `filepath`
* @return {String}
*/
utils.toPosixPath = function (str) {
return str.replace(/\\+/g, '/');
};
/**
* Strip backslashes before special characters in a string.
*
* @param {String} `str`
* @return {String}
*/
utils.unescape = function (str) {
return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, ''));
};
/**
* Strip the drive letter from a windows filepath
* @param {String} `fp`
* @return {String}
*/
utils.stripDrive = function (fp) {
return utils.isWindows() ? fp.replace(/^[a-z]:[\\/]+?/i, '/') : fp;
};
/**
* Strip the prefix from a filepath
* @param {String} `fp`
* @return {String}
*/
utils.stripPrefix = function (str) {
if (str.charAt(0) === '.' && (str.charAt(1) === '/' || str.charAt(1) === '\\')) {
return str.slice(2);
}
return str;
};
/**
* Returns true if `str` is a common character that doesn't need
* to be processed to be used for matching.
* @param {String} `str`
* @return {Boolean}
*/
utils.isSimpleChar = function (str) {
return str.trim() === '' || str === '.';
};
/**
* Returns true if the given str is an escaped or
* unescaped path character
*/
utils.isSlash = function (str) {
return str === '/' || str === '\\/' || str === '\\' || str === '\\\\';
};
/**
* Returns a function that returns true if the given
* pattern matches or contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.matchPath = function (pattern, options) {
return options && options.contains ? utils.containsPattern(pattern, options) : utils.equalsPattern(pattern, options);
};
/**
* Returns true if the given (original) filepath or unixified path are equal
* to the given pattern.
*/
utils._equals = function (filepath, unixPath, pattern) {
return pattern === filepath || pattern === unixPath;
};
/**
* Returns true if the given (original) filepath or unixified path contain
* the given pattern.
*/
utils._contains = function (filepath, unixPath, pattern) {
return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1;
};
/**
* Returns a function that returns true if the given
* pattern is the same as a given `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.equalsPattern = function (pattern, options) {
var unixify = utils.unixify(options);
options = options || {};
return function fn(filepath) {
var equal = utils._equals(filepath, unixify(filepath), pattern);
if (equal === true || options.nocase !== true) {
return equal;
}
var lower = filepath.toLowerCase();
return utils._equals(lower, unixify(lower), pattern);
};
};
/**
* Returns a function that returns true if the given
* pattern contains a `filepath`
*
* @param {String} `pattern`
* @return {Function}
*/
utils.containsPattern = function (pattern, options) {
var unixify = utils.unixify(options);
options = options || {};
return function (filepath) {
var contains = utils._contains(filepath, unixify(filepath), pattern);
if (contains === true || options.nocase !== true) {
return contains;
}
var lower = filepath.toLowerCase();
return utils._contains(lower, unixify(lower), pattern);
};
};
/**
* Returns a function that returns true if the given
* regex matches the `filename` of a file path.
*
* @param {RegExp} `re` Matching regex
* @return {Function}
*/
utils.matchBasename = function (re) {
return function (filepath) {
return re.test(filepath) || re.test(path.basename(filepath));
};
};
/**
* Returns the given value unchanced.
* @return {any}
*/
utils.identity = function (val) {
return val;
};
/**
* Determines the filepath to return based on the provided options.
* @return {any}
*/
utils.value = function (str, unixify, options) {
if (options && options.unixify === false) {
return str;
}
if (options && typeof options.unixify === 'function') {
return options.unixify(str);
}
return unixify(str);
};
/**
* Returns a function that normalizes slashes in a string to forward
* slashes, strips `./` from beginning of paths, and optionally unescapes
* special characters.
* @return {Function}
*/
utils.unixify = function (options) {
var opts = options || {};
return function (filepath) {
if (opts.stripPrefix !== false) {
filepath = utils.stripPrefix(filepath);
}
if (opts.unescape === true) {
filepath = utils.unescape(filepath);
}
if (opts.unixify === true || utils.isWindows()) {
filepath = utils.toPosixPath(filepath);
}
return filepath;
};
};
/***/ }),
/***/ "./node_modules/nanomatch/node_modules/define-property/index.js":
/*!**********************************************************************!*\
!*** ./node_modules/nanomatch/node_modules/define-property/index.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*/
var isobject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
var define = typeof Reflect !== 'undefined' && Reflect.defineProperty ? Reflect.defineProperty : Object.defineProperty;
module.exports = function defineProperty(obj, key, val) {
if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
throw new TypeError('expected an object, function, or array');
}
if (typeof key !== 'string') {
throw new TypeError('expected "key" to be a string');
}
if (isDescriptor(val)) {
define(obj, key, val);
return obj;
}
define(obj, key, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
return obj;
};
/***/ }),
/***/ "./node_modules/nanomatch/node_modules/extend-shallow/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/nanomatch/node_modules/extend-shallow/index.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/nanomatch/node_modules/is-extendable/index.js");
var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
module.exports = Object.assign || function (obj
/*, objects*/
) {
if (obj === null || typeof obj === 'undefined') {
throw new TypeError('Cannot convert undefined or null to object');
}
if (!isObject(obj)) {
obj = {};
}
for (var i = 1; i < arguments.length; i++) {
var val = arguments[i];
if (isString(val)) {
val = toObject(val);
}
if (isObject(val)) {
assign(obj, val);
assignSymbols(obj, val);
}
}
return obj;
};
function assign(a, b) {
for (var key in b) {
if (hasOwn(b, key)) {
a[key] = b[key];
}
}
}
function isString(val) {
return val && typeof val === 'string';
}
function toObject(str) {
var obj = {};
for (var i in str) {
obj[i] = str[i];
}
return obj;
}
function isObject(val) {
return val && _typeof(val) === 'object' || isExtendable(val);
}
/**
* Returns true if the given `key` is an own property of `obj`.
*/
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isEnum(obj, key) {
return Object.prototype.propertyIsEnumerable.call(obj, key);
}
/***/ }),
/***/ "./node_modules/nanomatch/node_modules/is-extendable/index.js":
/*!********************************************************************!*\
!*** ./node_modules/nanomatch/node_modules/is-extendable/index.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
};
/***/ }),
/***/ "./node_modules/nanomatch/node_modules/kind-of/index.js":
/*!**************************************************************!*\
!*** ./node_modules/nanomatch/node_modules/kind-of/index.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toString = Object.prototype.toString;
module.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';
} // Non-plain objects
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';
} // other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
return val.constructor ? 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;
}
/**
* If you need to support Safari 5-7 (8-10 yr-old browser),
* take a look at https://github.com/feross/is-buffer
*/
function isBuffer(val) {
if (val.constructor && typeof val.constructor.isBuffer === 'function') {
return val.constructor.isBuffer(val);
}
return false;
}
/***/ }),
/***/ "./node_modules/node-libs-browser/mock/empty.js":
/*!******************************************************!*\
!*** ./node_modules/node-libs-browser/mock/empty.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/***/ }),
/***/ "./node_modules/object-copy/index.js":
/*!*******************************************!*\
!*** ./node_modules/object-copy/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
var copyDescriptor = __webpack_require__(/*! copy-descriptor */ "./node_modules/copy-descriptor/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
/**
* Copy static properties, prototype properties, and descriptors from one object to another.
*
* ```js
* function App() {}
* var proto = App.prototype;
* App.prototype.set = function() {};
* App.prototype.get = function() {};
*
* var obj = {};
* copy(obj, proto);
* ```
* @param {Object} `receiver`
* @param {Object} `provider`
* @param {String|Array} `omit` One or more properties to omit
* @return {Object}
* @api public
*/
function copy(receiver, provider, omit) {
if (!isObject(receiver)) {
throw new TypeError('expected receiving object to be an object.');
}
if (!isObject(provider)) {
throw new TypeError('expected providing object to be an object.');
}
var props = nativeKeys(provider);
var keys = Object.keys(provider);
var len = props.length;
omit = arrayify(omit);
while (len--) {
var key = props[len];
if (has(keys, key)) {
define(receiver, key, provider[key]);
} else if (!(key in receiver) && !has(omit, key)) {
copyDescriptor(receiver, provider, key);
}
}
}
;
/**
* Return true if the given value is an object or function
*/
function isObject(val) {
return typeOf(val) === 'object' || typeof val === 'function';
}
/**
* Returns true if an array has any of the given elements, or an
* object has any of the give keys.
*
* ```js
* has(['a', 'b', 'c'], 'c');
* //=> true
*
* has(['a', 'b', 'c'], ['c', 'z']);
* //=> true
*
* has({a: 'b', c: 'd'}, ['c', 'z']);
* //=> true
* ```
* @param {Object} `obj`
* @param {String|Array} `val`
* @return {Boolean}
*/
function has(obj, val) {
val = arrayify(val);
var len = val.length;
if (isObject(obj)) {
for (var key in obj) {
if (val.indexOf(key) > -1) {
return true;
}
}
var keys = nativeKeys(obj);
return has(keys, val);
}
if (Array.isArray(obj)) {
var arr = obj;
while (len--) {
if (arr.indexOf(val[len]) > -1) {
return true;
}
}
return false;
}
throw new TypeError('expected an array or object.');
}
/**
* Cast the given value to an array.
*
* ```js
* arrayify('foo');
* //=> ['foo']
*
* arrayify(['foo']);
* //=> ['foo']
* ```
*
* @param {String|Array} `val`
* @return {Array}
*/
function arrayify(val) {
return val ? Array.isArray(val) ? val : [val] : [];
}
/**
* Returns true if a value has a `contructor`
*
* ```js
* hasConstructor({});
* //=> true
*
* hasConstructor(Object.create(null));
* //=> false
* ```
* @param {Object} `value`
* @return {Boolean}
*/
function hasConstructor(val) {
return isObject(val) && typeof val.constructor !== 'undefined';
}
/**
* Get the native `ownPropertyNames` from the constructor of the
* given `object`. An empty array is returned if the object does
* not have a constructor.
*
* ```js
* nativeKeys({a: 'b', b: 'c', c: 'd'})
* //=> ['a', 'b', 'c']
*
* nativeKeys(function(){})
* //=> ['length', 'caller']
* ```
*
* @param {Object} `obj` Object that has a `constructor`.
* @return {Array} Array of keys.
*/
function nativeKeys(val) {
if (!hasConstructor(val)) return [];
return Object.getOwnPropertyNames(val);
}
/**
* Expose `copy`
*/
module.exports = copy;
/**
* Expose `copy.has` for tests
*/
module.exports.has = has;
/***/ }),
/***/ "./node_modules/object-visit/index.js":
/*!********************************************!*\
!*** ./node_modules/object-visit/index.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* object-visit <https://github.com/jonschlinkert/object-visit>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
module.exports = function visit(thisArg, method, target, val) {
if (!isObject(thisArg) && typeof thisArg !== 'function') {
throw new Error('object-visit expects `thisArg` to be an object.');
}
if (typeof method !== 'string') {
throw new Error('object-visit expects `method` name to be a string');
}
if (typeof thisArg[method] !== 'function') {
return thisArg;
}
var args = [].slice.call(arguments, 3);
target = target || {};
for (var key in target) {
var arr = [key, target[key]].concat(args);
thisArg[method].apply(thisArg, arr);
}
return thisArg;
};
/***/ }),
/***/ "./node_modules/object.pick/index.js":
/*!*******************************************!*\
!*** ./node_modules/object.pick/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* object.pick <https://github.com/jonschlinkert/object.pick>
*
* Copyright (c) 2014-2015 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
module.exports = function pick(obj, keys) {
if (!isObject(obj) && typeof obj !== 'function') {
return {};
}
var res = {};
if (typeof keys === 'string') {
if (keys in obj) {
res[keys] = obj[keys];
}
return res;
}
var len = keys.length;
var idx = -1;
while (++idx < len) {
var key = keys[idx];
if (key in obj) {
res[key] = obj[key];
}
}
return res;
};
/***/ }),
/***/ "./node_modules/pascalcase/index.js":
/*!******************************************!*\
!*** ./node_modules/pascalcase/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* pascalcase <https://github.com/jonschlinkert/pascalcase>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
function pascalcase(str) {
if (typeof str !== 'string') {
throw new TypeError('expected a string.');
}
str = str.replace(/([A-Z])/g, ' $1');
if (str.length === 1) {
return str.toUpperCase();
}
str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
str = str.charAt(0).toUpperCase() + str.slice(1);
return str.replace(/[\W_]+(\w|$)/g, function (_, ch) {
return ch.toUpperCase();
});
}
module.exports = pascalcase;
/***/ }),
/***/ "./node_modules/path-browserify/index.js":
/*!***********************************************!*\
!*** ./node_modules/path-browserify/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
// backported and transplited with Babel, with backwards-compat fixes
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
} // if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
} // path.resolve([from ...], to)
// posix version
exports.resolve = function () {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = i >= 0 ? arguments[i] : process.cwd(); // Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
} // At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
return !!p;
}), !resolvedAbsolute).join('/');
return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
}; // path.normalize(path)
// posix version
exports.normalize = function (path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/'; // Normalize the path
path = normalizeArray(filter(path.split('/'), function (p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
}; // posix version
exports.isAbsolute = function (path) {
return path.charAt(0) === '/';
}; // posix version
exports.join = function () {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function (p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
}; // path.relative(from, to)
// posix version
exports.relative = function (from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function (path) {
if (typeof path !== 'string') path = path + '';
if (path.length === 0) return '.';
var code = path.charCodeAt(0);
var hasRoot = code === 47
/*/*/
;
var end = -1;
var matchedSlash = true;
for (var i = path.length - 1; i >= 1; --i) {
code = path.charCodeAt(i);
if (code === 47
/*/*/
) {
if (!matchedSlash) {
end = i;
break;
}
} else {
// We saw the first non-path separator
matchedSlash = false;
}
}
if (end === -1) return hasRoot ? '/' : '.';
if (hasRoot && end === 1) {
// return '//';
// Backwards-compat fix:
return '/';
}
return path.slice(0, end);
};
function basename(path) {
if (typeof path !== 'string') path = path + '';
var start = 0;
var end = -1;
var matchedSlash = true;
var i;
for (i = path.length - 1; i >= 0; --i) {
if (path.charCodeAt(i) === 47
/*/*/
) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
} else if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// path component
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) return '';
return path.slice(start, end);
} // Uses a mixed approach for backwards-compatibility, as ext behavior changed
// in new Node.js versions, so only basename() above is backported here
exports.basename = function (path, ext) {
var f = basename(path);
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function (path) {
if (typeof path !== 'string') path = path + '';
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true; // Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
for (var i = path.length - 1; i >= 0; --i) {
var code = path.charCodeAt(i);
if (code === 47
/*/*/
) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === 46
/*.*/
) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
} else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
preDotState = -1;
}
}
if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
return '';
}
return path.slice(startDot, end);
};
function filter(xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
} // String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
return str.substr(start, len);
} : function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/posix-character-classes/index.js":
/*!*******************************************************!*\
!*** ./node_modules/posix-character-classes/index.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* POSIX character classes
*/
module.exports = {
alnum: 'a-zA-Z0-9',
alpha: 'a-zA-Z',
ascii: '\\x00-\\x7F',
blank: ' \\t',
cntrl: '\\x00-\\x1F\\x7F',
digit: '0-9',
graph: '\\x21-\\x7E',
lower: 'a-z',
print: '\\x20-\\x7E ',
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
space: ' \\t\\r\\n\\v\\f',
upper: 'A-Z',
word: 'A-Za-z0-9_',
xdigit: 'A-Fa-f0-9'
};
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// shim for using process in browser
var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout() {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
})();
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
} // if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
} // if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while (len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
}; // v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) {
return [];
};
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () {
return '/';
};
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function () {
return 0;
};
/***/ }),
/***/ "./node_modules/react-is/cjs/react-is.development.js":
/*!***********************************************************!*\
!*** ./node_modules/react-is/cjs/react-is.development.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.8.6
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
if (true) {
(function () {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
}); // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
function isValidElementType(type) {
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
}
/**
* Forked from fbjs/warning:
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
*
* Only change is we use console.warn instead of console.error,
* and do nothing when 'console' is not supported.
* This really simplifies the code.
* ---
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var lowPriorityWarning = function lowPriorityWarning() {};
{
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.warn(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
lowPriorityWarning = function lowPriorityWarning(condition, format) {
if (format === undefined) {
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
var lowPriorityWarning$1 = lowPriorityWarning;
function typeOf(object) {
if (_typeof(object) === 'object' && object !== null) {
var $$typeof = object.$$typeof;
switch ($$typeof) {
case REACT_ELEMENT_TYPE:
var type = object.type;
switch (type) {
case REACT_ASYNC_MODE_TYPE:
case REACT_CONCURRENT_MODE_TYPE:
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
return type;
default:
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_PROVIDER_TYPE:
return $$typeofType;
default:
return $$typeof;
}
}
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:
case REACT_PORTAL_TYPE:
return $$typeof;
}
}
return undefined;
} // AsyncMode is deprecated along with isAsyncMode
var AsyncMode = REACT_ASYNC_MODE_TYPE;
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true;
lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
}
}
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
}
function isConcurrentMode(object) {
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
}
function isContextConsumer(object) {
return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement(object) {
return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
exports.typeOf = typeOf;
exports.AsyncMode = AsyncMode;
exports.ConcurrentMode = ConcurrentMode;
exports.ContextConsumer = ContextConsumer;
exports.ContextProvider = ContextProvider;
exports.Element = Element;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment;
exports.Lazy = Lazy;
exports.Memo = Memo;
exports.Portal = Portal;
exports.Profiler = Profiler;
exports.StrictMode = StrictMode;
exports.Suspense = Suspense;
exports.isValidElementType = isValidElementType;
exports.isAsyncMode = isAsyncMode;
exports.isConcurrentMode = isConcurrentMode;
exports.isContextConsumer = isContextConsumer;
exports.isContextProvider = isContextProvider;
exports.isElement = isElement;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isLazy = isLazy;
exports.isMemo = isMemo;
exports.isPortal = isPortal;
exports.isProfiler = isProfiler;
exports.isStrictMode = isStrictMode;
exports.isSuspense = isSuspense;
})();
}
/***/ }),
/***/ "./node_modules/react-is/index.js":
/*!****************************************!*\
!*** ./node_modules/react-is/index.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (false) {} else {
module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/react-is/cjs/react-is.development.js");
}
/***/ }),
/***/ "./node_modules/regex-not/index.js":
/*!*****************************************!*\
!*** ./node_modules/regex-not/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/regex-not/node_modules/extend-shallow/index.js");
var safe = __webpack_require__(/*! safe-regex */ "./node_modules/safe-regex/index.js");
/**
* The main export is a function that takes a `pattern` string and an `options` object.
*
* ```js
& var not = require('regex-not');
& console.log(not('foo'));
& //=> /^(?:(?!^(?:foo)$).)*$/
* ```
*
* @param {String} `pattern`
* @param {Object} `options`
* @return {RegExp} Converts the given `pattern` to a regex using the specified `options`.
* @api public
*/
function toRegex(pattern, options) {
return new RegExp(toRegex.create(pattern, options));
}
/**
* Create a regex-compatible string from the given `pattern` and `options`.
*
* ```js
& var not = require('regex-not');
& console.log(not.create('foo'));
& //=> '^(?:(?!^(?:foo)$).)*$'
* ```
* @param {String} `pattern`
* @param {Object} `options`
* @return {String}
* @api public
*/
toRegex.create = function (pattern, options) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
var opts = extend({}, options);
if (opts.contains === true) {
opts.strictNegate = false;
}
var open = opts.strictOpen !== false ? '^' : '';
var close = opts.strictClose !== false ? '$' : '';
var endChar = opts.endChar ? opts.endChar : '+';
var str = pattern;
if (opts.strictNegate === false) {
str = '(?:(?!(?:' + pattern + ')).)' + endChar;
} else {
str = '(?:(?!^(?:' + pattern + ')$).)' + endChar;
}
var res = open + str + close;
if (opts.safe === true && safe(res) === false) {
throw new Error('potentially unsafe regular expression: ' + res);
}
return res;
};
/**
* Expose `toRegex`
*/
module.exports = toRegex;
/***/ }),
/***/ "./node_modules/regex-not/node_modules/extend-shallow/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/regex-not/node_modules/extend-shallow/index.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/regex-not/node_modules/is-extendable/index.js");
var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
module.exports = Object.assign || function (obj
/*, objects*/
) {
if (obj === null || typeof obj === 'undefined') {
throw new TypeError('Cannot convert undefined or null to object');
}
if (!isObject(obj)) {
obj = {};
}
for (var i = 1; i < arguments.length; i++) {
var val = arguments[i];
if (isString(val)) {
val = toObject(val);
}
if (isObject(val)) {
assign(obj, val);
assignSymbols(obj, val);
}
}
return obj;
};
function assign(a, b) {
for (var key in b) {
if (hasOwn(b, key)) {
a[key] = b[key];
}
}
}
function isString(val) {
return val && typeof val === 'string';
}
function toObject(str) {
var obj = {};
for (var i in str) {
obj[i] = str[i];
}
return obj;
}
function isObject(val) {
return val && _typeof(val) === 'object' || isExtendable(val);
}
/**
* Returns true if the given `key` is an own property of `obj`.
*/
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isEnum(obj, key) {
return Object.prototype.propertyIsEnumerable.call(obj, key);
}
/***/ }),
/***/ "./node_modules/regex-not/node_modules/is-extendable/index.js":
/*!********************************************************************!*\
!*** ./node_modules/regex-not/node_modules/is-extendable/index.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
};
/***/ }),
/***/ "./node_modules/repeat-element/index.js":
/*!**********************************************!*\
!*** ./node_modules/repeat-element/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* repeat-element <https://github.com/jonschlinkert/repeat-element>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Licensed under the MIT license.
*/
module.exports = function repeat(ele, num) {
var arr = new Array(num);
for (var i = 0; i < num; i++) {
arr[i] = ele;
}
return arr;
};
/***/ }),
/***/ "./node_modules/repeat-string/index.js":
/*!*********************************************!*\
!*** ./node_modules/repeat-string/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
/**
* Results cache
*/
var res = '';
var cache;
/**
* Expose `repeat`
*/
module.exports = repeat;
/**
* Repeat the given `string` the specified `number`
* of times.
*
* **Example:**
*
* ```js
* var repeat = require('repeat-string');
* repeat('A', 5);
* //=> AAAAA
* ```
*
* @param {String} `string` The string to repeat
* @param {Number} `number` The number of times to repeat the string
* @return {String} Repeated string
* @api public
*/
function repeat(str, num) {
if (typeof str !== 'string') {
throw new TypeError('expected a string');
} // cover common, quick use cases
if (num === 1) return str;
if (num === 2) return str + str;
var max = str.length * num;
if (cache !== str || typeof cache === 'undefined') {
cache = str;
res = '';
} else if (res.length >= max) {
return res.substr(0, max);
}
while (max > res.length && num > 1) {
if (num & 1) {
res += str;
}
num >>= 1;
str += str;
}
res += str;
res = res.substr(0, max);
return res;
}
/***/ }),
/***/ "./node_modules/resolve-url/resolve-url.js":
/*!*************************************************!*\
!*** ./node_modules/resolve-url/resolve-url.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Copyright 2014 Simon Lydell
// X11 (“MIT”) Licensed. (See LICENSE.)
void function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
__WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(void 0, function () {
function resolveUrl()
/* ...urls */
{
var numUrls = arguments.length;
if (numUrls === 0) {
throw new Error("resolveUrl requires at least one argument; got none.");
}
var base = document.createElement("base");
base.href = arguments[0];
if (numUrls === 1) {
return base.href;
}
var head = document.getElementsByTagName("head")[0];
head.insertBefore(base, head.firstChild);
var a = document.createElement("a");
var resolved;
for (var index = 1; index < numUrls; index++) {
a.href = arguments[index];
resolved = a.href;
base.href = resolved;
}
head.removeChild(base);
return resolved;
}
return resolveUrl;
});
/***/ }),
/***/ "./node_modules/ret/lib/index.js":
/*!***************************************!*\
!*** ./node_modules/ret/lib/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__(/*! ./util */ "./node_modules/ret/lib/util.js");
var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
var sets = __webpack_require__(/*! ./sets */ "./node_modules/ret/lib/sets.js");
var positions = __webpack_require__(/*! ./positions */ "./node_modules/ret/lib/positions.js");
module.exports = function (regexpStr) {
var i = 0,
l,
c,
start = {
type: types.ROOT,
stack: []
},
// Keep track of last clause/group and stack.
lastGroup = start,
last = start.stack,
groupStack = [];
var repeatErr = function repeatErr(i) {
util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1));
}; // Decode a few escaped characters.
var str = util.strToChars(regexpStr);
l = str.length; // Iterate through each character in string.
while (i < l) {
c = str[i++];
switch (c) {
// Handle escaped characters, inclues a few sets.
case '\\':
c = str[i++];
switch (c) {
case 'b':
last.push(positions.wordBoundary());
break;
case 'B':
last.push(positions.nonWordBoundary());
break;
case 'w':
last.push(sets.words());
break;
case 'W':
last.push(sets.notWords());
break;
case 'd':
last.push(sets.ints());
break;
case 'D':
last.push(sets.notInts());
break;
case 's':
last.push(sets.whitespace());
break;
case 'S':
last.push(sets.notWhitespace());
break;
default:
// Check if c is integer.
// In which case it's a reference.
if (/\d/.test(c)) {
last.push({
type: types.REFERENCE,
value: parseInt(c, 10)
}); // Escaped character.
} else {
last.push({
type: types.CHAR,
value: c.charCodeAt(0)
});
}
}
break;
// Positionals.
case '^':
last.push(positions.begin());
break;
case '$':
last.push(positions.end());
break;
// Handle custom sets.
case '[':
// Check if this class is 'anti' i.e. [^abc].
var not;
if (str[i] === '^') {
not = true;
i++;
} else {
not = false;
} // Get all the characters in class.
var classTokens = util.tokenizeClass(str.slice(i), regexpStr); // Increase index by length of class.
i += classTokens[1];
last.push({
type: types.SET,
set: classTokens[0],
not: not
});
break;
// Class of any character except \n.
case '.':
last.push(sets.anyChar());
break;
// Push group onto stack.
case '(':
// Create group.
var group = {
type: types.GROUP,
stack: [],
remember: true
};
c = str[i]; // If if this is a special kind of group.
if (c === '?') {
c = str[i + 1];
i += 2; // Match if followed by.
if (c === '=') {
group.followedBy = true; // Match if not followed by.
} else if (c === '!') {
group.notFollowedBy = true;
} else if (c !== ':') {
util.error(regexpStr, 'Invalid group, character \'' + c + '\' after \'?\' at column ' + (i - 1));
}
group.remember = false;
} // Insert subgroup into current group stack.
last.push(group); // Remember the current group for when the group closes.
groupStack.push(lastGroup); // Make this new group the current group.
lastGroup = group;
last = group.stack;
break;
// Pop group out of stack.
case ')':
if (groupStack.length === 0) {
util.error(regexpStr, 'Unmatched ) at column ' + (i - 1));
}
lastGroup = groupStack.pop(); // Check if this group has a PIPE.
// To get back the correct last stack.
last = lastGroup.options ? lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;
break;
// Use pipe character to give more choices.
case '|':
// Create array where options are if this is the first PIPE
// in this clause.
if (!lastGroup.options) {
lastGroup.options = [lastGroup.stack];
delete lastGroup.stack;
} // Create a new stack and add to options for rest of clause.
var stack = [];
lastGroup.options.push(stack);
last = stack;
break;
// Repetition.
// For every repetition, remove last element from last stack
// then insert back a RANGE object.
// This design is chosen because there could be more than
// one repetition symbols in a regex i.e. `a?+{2,3}`.
case '{':
var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)),
min,
max;
if (rs !== null) {
if (last.length === 0) {
repeatErr(i);
}
min = parseInt(rs[1], 10);
max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;
i += rs[0].length;
last.push({
type: types.REPETITION,
min: min,
max: max,
value: last.pop()
});
} else {
last.push({
type: types.CHAR,
value: 123
});
}
break;
case '?':
if (last.length === 0) {
repeatErr(i);
}
last.push({
type: types.REPETITION,
min: 0,
max: 1,
value: last.pop()
});
break;
case '+':
if (last.length === 0) {
repeatErr(i);
}
last.push({
type: types.REPETITION,
min: 1,
max: Infinity,
value: last.pop()
});
break;
case '*':
if (last.length === 0) {
repeatErr(i);
}
last.push({
type: types.REPETITION,
min: 0,
max: Infinity,
value: last.pop()
});
break;
// Default is a character that is not `\[](){}?+*^$`.
default:
last.push({
type: types.CHAR,
value: c.charCodeAt(0)
});
}
} // Check if any groups have not been closed.
if (groupStack.length !== 0) {
util.error(regexpStr, 'Unterminated group');
}
return start;
};
module.exports.types = types;
/***/ }),
/***/ "./node_modules/ret/lib/positions.js":
/*!*******************************************!*\
!*** ./node_modules/ret/lib/positions.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
exports.wordBoundary = function () {
return {
type: types.POSITION,
value: 'b'
};
};
exports.nonWordBoundary = function () {
return {
type: types.POSITION,
value: 'B'
};
};
exports.begin = function () {
return {
type: types.POSITION,
value: '^'
};
};
exports.end = function () {
return {
type: types.POSITION,
value: '$'
};
};
/***/ }),
/***/ "./node_modules/ret/lib/sets.js":
/*!**************************************!*\
!*** ./node_modules/ret/lib/sets.js ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
var INTS = function INTS() {
return [{
type: types.RANGE,
from: 48,
to: 57
}];
};
var WORDS = function WORDS() {
return [{
type: types.CHAR,
value: 95
}, {
type: types.RANGE,
from: 97,
to: 122
}, {
type: types.RANGE,
from: 65,
to: 90
}].concat(INTS());
};
var WHITESPACE = function WHITESPACE() {
return [{
type: types.CHAR,
value: 9
}, {
type: types.CHAR,
value: 10
}, {
type: types.CHAR,
value: 11
}, {
type: types.CHAR,
value: 12
}, {
type: types.CHAR,
value: 13
}, {
type: types.CHAR,
value: 32
}, {
type: types.CHAR,
value: 160
}, {
type: types.CHAR,
value: 5760
}, {
type: types.CHAR,
value: 6158
}, {
type: types.CHAR,
value: 8192
}, {
type: types.CHAR,
value: 8193
}, {
type: types.CHAR,
value: 8194
}, {
type: types.CHAR,
value: 8195
}, {
type: types.CHAR,
value: 8196
}, {
type: types.CHAR,
value: 8197
}, {
type: types.CHAR,
value: 8198
}, {
type: types.CHAR,
value: 8199
}, {
type: types.CHAR,
value: 8200
}, {
type: types.CHAR,
value: 8201
}, {
type: types.CHAR,
value: 8202
}, {
type: types.CHAR,
value: 8232
}, {
type: types.CHAR,
value: 8233
}, {
type: types.CHAR,
value: 8239
}, {
type: types.CHAR,
value: 8287
}, {
type: types.CHAR,
value: 12288
}, {
type: types.CHAR,
value: 65279
}];
};
var NOTANYCHAR = function NOTANYCHAR() {
return [{
type: types.CHAR,
value: 10
}, {
type: types.CHAR,
value: 13
}, {
type: types.CHAR,
value: 8232
}, {
type: types.CHAR,
value: 8233
}];
}; // Predefined class objects.
exports.words = function () {
return {
type: types.SET,
set: WORDS(),
not: false
};
};
exports.notWords = function () {
return {
type: types.SET,
set: WORDS(),
not: true
};
};
exports.ints = function () {
return {
type: types.SET,
set: INTS(),
not: false
};
};
exports.notInts = function () {
return {
type: types.SET,
set: INTS(),
not: true
};
};
exports.whitespace = function () {
return {
type: types.SET,
set: WHITESPACE(),
not: false
};
};
exports.notWhitespace = function () {
return {
type: types.SET,
set: WHITESPACE(),
not: true
};
};
exports.anyChar = function () {
return {
type: types.SET,
set: NOTANYCHAR(),
not: true
};
};
/***/ }),
/***/ "./node_modules/ret/lib/types.js":
/*!***************************************!*\
!*** ./node_modules/ret/lib/types.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
ROOT: 0,
GROUP: 1,
POSITION: 2,
SET: 3,
RANGE: 4,
REPETITION: 5,
REFERENCE: 6,
CHAR: 7
};
/***/ }),
/***/ "./node_modules/ret/lib/util.js":
/*!**************************************!*\
!*** ./node_modules/ret/lib/util.js ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
var sets = __webpack_require__(/*! ./sets */ "./node_modules/ret/lib/sets.js"); // All of these are private and only used by randexp.
// It's assumed that they will always be called with the correct input.
var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?';
var SLSH = {
'0': 0,
't': 9,
'n': 10,
'v': 11,
'f': 12,
'r': 13
};
/**
* Finds character representations in str and convert all to
* their respective characters
*
* @param {String} str
* @return {String}
*/
exports.strToChars = function (str) {
/* jshint maxlen: false */
var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g;
str = str.replace(chars_regex, function (s, b, lbs, a16, b16, c8, dctrl, eslsh) {
if (lbs) {
return s;
}
var code = b ? 8 : a16 ? parseInt(a16, 16) : b16 ? parseInt(b16, 16) : c8 ? parseInt(c8, 8) : dctrl ? CTRL.indexOf(dctrl) : SLSH[eslsh];
var c = String.fromCharCode(code); // Escape special regex characters.
if (/[\[\]{}\^$.|?*+()]/.test(c)) {
c = '\\' + c;
}
return c;
});
return str;
};
/**
* turns class into tokens
* reads str until it encounters a ] not preceeded by a \
*
* @param {String} str
* @param {String} regexpStr
* @return {Array.<Array.<Object>, Number>}
*/
exports.tokenizeClass = function (str, regexpStr) {
/* jshint maxlen: false */
var tokens = [];
var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g;
var rs, c;
while ((rs = regexp.exec(str)) != null) {
if (rs[1]) {
tokens.push(sets.words());
} else if (rs[2]) {
tokens.push(sets.ints());
} else if (rs[3]) {
tokens.push(sets.whitespace());
} else if (rs[4]) {
tokens.push(sets.notWords());
} else if (rs[5]) {
tokens.push(sets.notInts());
} else if (rs[6]) {
tokens.push(sets.notWhitespace());
} else if (rs[7]) {
tokens.push({
type: types.RANGE,
from: (rs[8] || rs[9]).charCodeAt(0),
to: rs[10].charCodeAt(0)
});
} else if (c = rs[12]) {
tokens.push({
type: types.CHAR,
value: c.charCodeAt(0)
});
} else {
return [tokens, regexp.lastIndex];
}
}
exports.error(regexpStr, 'Unterminated character class');
};
/**
* Shortcut to throw errors.
*
* @param {String} regexp
* @param {String} msg
*/
exports.error = function (regexp, msg) {
throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);
};
/***/ }),
/***/ "./node_modules/safe-regex/index.js":
/*!******************************************!*\
!*** ./node_modules/safe-regex/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var parse = __webpack_require__(/*! ret */ "./node_modules/ret/lib/index.js");
var types = parse.types;
module.exports = function (re, opts) {
if (!opts) opts = {};
var replimit = opts.limit === undefined ? 25 : opts.limit;
if (isRegExp(re)) re = re.source;else if (typeof re !== 'string') re = String(re);
try {
re = parse(re);
} catch (err) {
return false;
}
var reps = 0;
return function walk(node, starHeight) {
if (node.type === types.REPETITION) {
starHeight++;
reps++;
if (starHeight > 1) return false;
if (reps > replimit) return false;
}
if (node.options) {
for (var i = 0, len = node.options.length; i < len; i++) {
var ok = walk({
stack: node.options[i]
}, starHeight);
if (!ok) return false;
}
}
var stack = node.stack || node.value && node.value.stack;
if (!stack) return true;
for (var i = 0; i < stack.length; i++) {
var ok = walk(stack[i], starHeight);
if (!ok) return false;
}
return true;
}(re, 0);
};
function isRegExp(x) {
return {}.toString.call(x) === '[object RegExp]';
}
/***/ }),
/***/ "./node_modules/set-value/index.js":
/*!*****************************************!*\
!*** ./node_modules/set-value/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* set-value <https://github.com/jonschlinkert/set-value>
*
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var split = __webpack_require__(/*! split-string */ "./node_modules/split-string/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
var isObject = __webpack_require__(/*! is-extendable */ "./node_modules/is-extendable/index.js");
module.exports = function (obj, prop, val) {
if (!isObject(obj)) {
return obj;
}
if (Array.isArray(prop)) {
prop = [].concat.apply([], prop).join('.');
}
if (typeof prop !== 'string') {
return obj;
}
var keys = split(prop, {
sep: '.',
brackets: true
}).filter(isValidKey);
var len = keys.length;
var idx = -1;
var current = obj;
while (++idx < len) {
var key = keys[idx];
if (idx !== len - 1) {
if (!isObject(current[key])) {
current[key] = {};
}
current = current[key];
continue;
}
if (isPlainObject(current[key]) && isPlainObject(val)) {
current[key] = extend({}, current[key], val);
} else {
current[key] = val;
}
}
return obj;
};
function isValidKey(key) {
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
}
/***/ }),
/***/ "./node_modules/setimmediate/setImmediate.js":
/*!***************************************************!*\
!*** ./node_modules/setimmediate/setImmediate.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global, process) {
(function (global, undefined) {
"use strict";
if (global.setImmediate) {
return;
}
var nextHandle = 1; // Spec says greater than zero
var tasksByHandle = {};
var currentlyRunningATask = false;
var doc = global.document;
var registerImmediate;
function setImmediate(callback) {
// Callback can either be a function or a string
if (typeof callback !== "function") {
callback = new Function("" + callback);
} // Copy function arguments
var args = new Array(arguments.length - 1);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i + 1];
} // Store and register the task
var task = {
callback: callback,
args: args
};
tasksByHandle[nextHandle] = task;
registerImmediate(nextHandle);
return nextHandle++;
}
function clearImmediate(handle) {
delete tasksByHandle[handle];
}
function run(task) {
var callback = task.callback;
var args = task.args;
switch (args.length) {
case 0:
callback();
break;
case 1:
callback(args[0]);
break;
case 2:
callback(args[0], args[1]);
break;
case 3:
callback(args[0], args[1], args[2]);
break;
default:
callback.apply(undefined, args);
break;
}
}
function runIfPresent(handle) {
// From the spec: "Wait until any invocations of this algorithm started before this one have completed."
// So if we're currently running a task, we'll need to delay this invocation.
if (currentlyRunningATask) {
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
// "too much recursion" error.
setTimeout(runIfPresent, 0, handle);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunningATask = true;
try {
run(task);
} finally {
clearImmediate(handle);
currentlyRunningATask = false;
}
}
}
}
function installNextTickImplementation() {
registerImmediate = function registerImmediate(handle) {
process.nextTick(function () {
runIfPresent(handle);
});
};
}
function canUsePostMessage() {
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
// where `global.postMessage` means something completely different and can't be used for this purpose.
if (global.postMessage && !global.importScripts) {
var postMessageIsAsynchronous = true;
var oldOnMessage = global.onmessage;
global.onmessage = function () {
postMessageIsAsynchronous = false;
};
global.postMessage("", "*");
global.onmessage = oldOnMessage;
return postMessageIsAsynchronous;
}
}
function installPostMessageImplementation() {
// Installs an event handler on `global` for the `message` event: see
// * https://developer.mozilla.org/en/DOM/window.postMessage
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
var messagePrefix = "setImmediate$" + Math.random() + "$";
var onGlobalMessage = function onGlobalMessage(event) {
if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
runIfPresent(+event.data.slice(messagePrefix.length));
}
};
if (global.addEventListener) {
global.addEventListener("message", onGlobalMessage, false);
} else {
global.attachEvent("onmessage", onGlobalMessage);
}
registerImmediate = function registerImmediate(handle) {
global.postMessage(messagePrefix + handle, "*");
};
}
function installMessageChannelImplementation() {
var channel = new MessageChannel();
channel.port1.onmessage = function (event) {
var handle = event.data;
runIfPresent(handle);
};
registerImmediate = function registerImmediate(handle) {
channel.port2.postMessage(handle);
};
}
function installReadyStateChangeImplementation() {
var html = doc.documentElement;
registerImmediate = function registerImmediate(handle) {
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
var script = doc.createElement("script");
script.onreadystatechange = function () {
runIfPresent(handle);
script.onreadystatechange = null;
html.removeChild(script);
script = null;
};
html.appendChild(script);
};
}
function installSetTimeoutImplementation() {
registerImmediate = function registerImmediate(handle) {
setTimeout(runIfPresent, 0, handle);
};
} // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments.
if ({}.toString.call(global.process) === "[object process]") {
// For Node.js before 0.9
installNextTickImplementation();
} else if (canUsePostMessage()) {
// For non-IE10 modern browsers
installPostMessageImplementation();
} else if (global.MessageChannel) {
// For web workers, where supported
installMessageChannelImplementation();
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
// For IE 68
installReadyStateChangeImplementation();
} else {
// For older browsers
installSetTimeoutImplementation();
}
attachTo.setImmediate = setImmediate;
attachTo.clearImmediate = clearImmediate;
})(typeof self === "undefined" ? typeof global === "undefined" ? void 0 : global : self);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/slash/index.js":
/*!*************************************!*\
!*** ./node_modules/slash/index.js ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function (input) {
var isExtendedLengthPath = /^\\\\\?\\/.test(input);
var hasNonAscii = /[^\u0000-\u0080]+/.test(input); // eslint-disable-line no-control-regex
if (isExtendedLengthPath || hasNonAscii) {
return input;
}
return input.replace(/\\/g, '/');
};
/***/ }),
/***/ "./node_modules/snapdragon-node/index.js":
/*!***********************************************!*\
!*** ./node_modules/snapdragon-node/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/snapdragon-node/node_modules/define-property/index.js");
var utils = __webpack_require__(/*! snapdragon-util */ "./node_modules/snapdragon-util/index.js");
var ownNames;
/**
* Create a new AST `Node` with the given `val` and `type`.
*
* ```js
* var node = new Node('*', 'Star');
* var node = new Node({type: 'star', val: '*'});
* ```
* @name Node
* @param {String|Object} `val` Pass a matched substring, or an object to merge onto the node.
* @param {String} `type` The node type to use when `val` is a string.
* @return {Object} node instance
* @api public
*/
function Node(val, type, parent) {
if (typeof type !== 'string') {
parent = type;
type = null;
}
define(this, 'parent', parent);
define(this, 'isNode', true);
define(this, 'expect', null);
if (typeof type !== 'string' && isObject(val)) {
lazyKeys();
var keys = Object.keys(val);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (ownNames.indexOf(key) === -1) {
this[key] = val[key];
}
}
} else {
this.type = type;
this.val = val;
}
}
/**
* Returns true if the given value is a node.
*
* ```js
* var Node = require('snapdragon-node');
* var node = new Node({type: 'foo'});
* console.log(Node.isNode(node)); //=> true
* console.log(Node.isNode({})); //=> false
* ```
* @param {Object} `node`
* @returns {Boolean}
* @api public
*/
Node.isNode = function (node) {
return utils.isNode(node);
};
/**
* Define a non-enumberable property on the node instance.
* Useful for adding properties that shouldn't be extended
* or visible during debugging.
*
* ```js
* var node = new Node();
* node.define('foo', 'something non-enumerable');
* ```
* @param {String} `name`
* @param {any} `val`
* @return {Object} returns the node instance
* @api public
*/
Node.prototype.define = function (name, val) {
define(this, name, val);
return this;
};
/**
* Returns true if `node.val` is an empty string, or `node.nodes` does
* not contain any non-empty text nodes.
*
* ```js
* var node = new Node({type: 'text'});
* node.isEmpty(); //=> true
* node.val = 'foo';
* node.isEmpty(); //=> false
* ```
* @param {Function} `fn` (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes.
* @return {Boolean}
* @api public
*/
Node.prototype.isEmpty = function (fn) {
return utils.isEmpty(this, fn);
};
/**
* Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and
* set `foo` as `bar.parent`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* foo.push(bar);
* ```
* @param {Object} `node`
* @return {Number} Returns the length of `node.nodes`
* @api public
*/
Node.prototype.push = function (node) {
assert(Node.isNode(node), 'expected node to be an instance of Node');
define(node, 'parent', this);
this.nodes = this.nodes || [];
return this.nodes.push(node);
};
/**
* Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and
* set `foo` as `bar.parent`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* foo.unshift(bar);
* ```
* @param {Object} `node`
* @return {Number} Returns the length of `node.nodes`
* @api public
*/
Node.prototype.unshift = function (node) {
assert(Node.isNode(node), 'expected node to be an instance of Node');
define(node, 'parent', this);
this.nodes = this.nodes || [];
return this.nodes.unshift(node);
};
/**
* Pop a node from `node.nodes`.
*
* ```js
* var node = new Node({type: 'foo'});
* node.push(new Node({type: 'a'}));
* node.push(new Node({type: 'b'}));
* node.push(new Node({type: 'c'}));
* node.push(new Node({type: 'd'}));
* console.log(node.nodes.length);
* //=> 4
* node.pop();
* console.log(node.nodes.length);
* //=> 3
* ```
* @return {Number} Returns the popped `node`
* @api public
*/
Node.prototype.pop = function () {
return this.nodes && this.nodes.pop();
};
/**
* Shift a node from `node.nodes`.
*
* ```js
* var node = new Node({type: 'foo'});
* node.push(new Node({type: 'a'}));
* node.push(new Node({type: 'b'}));
* node.push(new Node({type: 'c'}));
* node.push(new Node({type: 'd'}));
* console.log(node.nodes.length);
* //=> 4
* node.shift();
* console.log(node.nodes.length);
* //=> 3
* ```
* @return {Object} Returns the shifted `node`
* @api public
*/
Node.prototype.shift = function () {
return this.nodes && this.nodes.shift();
};
/**
* Remove `node` from `node.nodes`.
*
* ```js
* node.remove(childNode);
* ```
* @param {Object} `node`
* @return {Object} Returns the removed node.
* @api public
*/
Node.prototype.remove = function (node) {
assert(Node.isNode(node), 'expected node to be an instance of Node');
this.nodes = this.nodes || [];
var idx = node.index;
if (idx !== -1) {
node.index = -1;
return this.nodes.splice(idx, 1);
}
return null;
};
/**
* Get the first child node from `node.nodes` that matches the given `type`.
* If `type` is a number, the child node at that index is returned.
*
* ```js
* var child = node.find(1); //<= index of the node to get
* var child = node.find('foo'); //<= node.type of a child node
* var child = node.find(/^(foo|bar)$/); //<= regex to match node.type
* var child = node.find(['foo', 'bar']); //<= array of node.type(s)
* ```
* @param {String} `type`
* @return {Object} Returns a child node or undefined.
* @api public
*/
Node.prototype.find = function (type) {
return utils.findNode(this.nodes, type);
};
/**
* Return true if the node is the given `type`.
*
* ```js
* var node = new Node({type: 'bar'});
* cosole.log(node.isType('foo')); // false
* cosole.log(node.isType(/^(foo|bar)$/)); // true
* cosole.log(node.isType(['foo', 'bar'])); // true
* ```
* @param {String} `type`
* @return {Boolean}
* @api public
*/
Node.prototype.isType = function (type) {
return utils.isType(this, type);
};
/**
* Return true if the `node.nodes` has the given `type`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* foo.push(bar);
*
* cosole.log(foo.hasType('qux')); // false
* cosole.log(foo.hasType(/^(qux|bar)$/)); // true
* cosole.log(foo.hasType(['qux', 'bar'])); // true
* ```
* @param {String} `type`
* @return {Boolean}
* @api public
*/
Node.prototype.hasType = function (type) {
return utils.hasType(this, type);
};
/**
* Get the siblings array, or `null` if it doesn't exist.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* foo.push(bar);
* foo.push(baz);
*
* console.log(bar.siblings.length) // 2
* console.log(baz.siblings.length) // 2
* ```
* @return {Array}
* @api public
*/
Object.defineProperty(Node.prototype, 'siblings', {
set: function set() {
throw new Error('node.siblings is a getter and cannot be defined');
},
get: function get() {
return this.parent ? this.parent.nodes : null;
}
});
/**
* Get the node's current index from `node.parent.nodes`.
* This should always be correct, even when the parent adds nodes.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* var qux = new Node({type: 'qux'});
* foo.push(bar);
* foo.push(baz);
* foo.unshift(qux);
*
* console.log(bar.index) // 1
* console.log(baz.index) // 2
* console.log(qux.index) // 0
* ```
* @return {Number}
* @api public
*/
Object.defineProperty(Node.prototype, 'index', {
set: function set(index) {
define(this, 'idx', index);
},
get: function get() {
if (!Array.isArray(this.siblings)) {
return -1;
}
var tok = this.idx !== -1 ? this.siblings[this.idx] : null;
if (tok !== this) {
this.idx = this.siblings.indexOf(this);
}
return this.idx;
}
});
/**
* Get the previous node from the siblings array or `null`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* foo.push(bar);
* foo.push(baz);
*
* console.log(baz.prev.type) // 'bar'
* ```
* @return {Object}
* @api public
*/
Object.defineProperty(Node.prototype, 'prev', {
set: function set() {
throw new Error('node.prev is a getter and cannot be defined');
},
get: function get() {
if (Array.isArray(this.siblings)) {
return this.siblings[this.index - 1] || this.parent.prev;
}
return null;
}
});
/**
* Get the siblings array, or `null` if it doesn't exist.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* foo.push(bar);
* foo.push(baz);
*
* console.log(bar.siblings.length) // 2
* console.log(baz.siblings.length) // 2
* ```
* @return {Object}
* @api public
*/
Object.defineProperty(Node.prototype, 'next', {
set: function set() {
throw new Error('node.next is a getter and cannot be defined');
},
get: function get() {
if (Array.isArray(this.siblings)) {
return this.siblings[this.index + 1] || this.parent.next;
}
return null;
}
});
/**
* Get the first node from `node.nodes`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* var qux = new Node({type: 'qux'});
* foo.push(bar);
* foo.push(baz);
* foo.push(qux);
*
* console.log(foo.first.type) // 'bar'
* ```
* @return {Object} The first node, or undefiend
* @api public
*/
Object.defineProperty(Node.prototype, 'first', {
get: function get() {
return this.nodes ? this.nodes[0] : null;
}
});
/**
* Get the last node from `node.nodes`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* var qux = new Node({type: 'qux'});
* foo.push(bar);
* foo.push(baz);
* foo.push(qux);
*
* console.log(foo.last.type) // 'qux'
* ```
* @return {Object} The last node, or undefiend
* @api public
*/
Object.defineProperty(Node.prototype, 'last', {
get: function get() {
return this.nodes ? utils.last(this.nodes) : null;
}
});
/**
* Get the last node from `node.nodes`.
*
* ```js
* var foo = new Node({type: 'foo'});
* var bar = new Node({type: 'bar'});
* var baz = new Node({type: 'baz'});
* var qux = new Node({type: 'qux'});
* foo.push(bar);
* foo.push(baz);
* foo.push(qux);
*
* console.log(foo.last.type) // 'qux'
* ```
* @return {Object} The last node, or undefiend
* @api public
*/
Object.defineProperty(Node.prototype, 'scope', {
get: function get() {
if (this.isScope !== true) {
return this.parent ? this.parent.scope : this;
}
return this;
}
});
/**
* Get own property names from Node prototype, but only the
* first time `Node` is instantiated
*/
function lazyKeys() {
if (!ownNames) {
ownNames = Object.getOwnPropertyNames(Node.prototype);
}
}
/**
* Simplified assertion. Throws an error is `val` is falsey.
*/
function assert(val, message) {
if (!val) throw new Error(message);
}
/**
* Expose `Node`
*/
exports = module.exports = Node;
/***/ }),
/***/ "./node_modules/snapdragon-node/node_modules/define-property/index.js":
/*!****************************************************************************!*\
!*** ./node_modules/snapdragon-node/node_modules/define-property/index.js ***!
\****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
module.exports = function defineProperty(obj, prop, val) {
if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
throw new TypeError('expected an object or function.');
}
if (typeof prop !== 'string') {
throw new TypeError('expected `prop` to be a string.');
}
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
return Object.defineProperty(obj, prop, val);
}
return Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
};
/***/ }),
/***/ "./node_modules/snapdragon-util/index.js":
/*!***********************************************!*\
!*** ./node_modules/snapdragon-util/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
var utils = module.exports;
/**
* Returns true if the given value is a node.
*
* ```js
* var Node = require('snapdragon-node');
* var node = new Node({type: 'foo'});
* console.log(utils.isNode(node)); //=> true
* console.log(utils.isNode({})); //=> false
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @returns {Boolean}
* @api public
*/
utils.isNode = function (node) {
return typeOf(node) === 'object' && node.isNode === true;
};
/**
* Emit an empty string for the given `node`.
*
* ```js
* // do nothing for beginning-of-string
* snapdragon.compiler.set('bos', utils.noop);
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @returns {undefined}
* @api public
*/
utils.noop = function (node) {
append(this, '', node);
};
/**
* Appdend `node.val` to `compiler.output`, exactly as it was created
* by the parser.
*
* ```js
* snapdragon.compiler.set('text', utils.identity);
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @returns {undefined}
* @api public
*/
utils.identity = function (node) {
append(this, node.val, node);
};
/**
* Previously named `.emit`, this method appends the given `val`
* to `compiler.output` for the given node. Useful when you know
* what value should be appended advance, regardless of the actual
* value of `node.val`.
*
* ```js
* snapdragon.compiler
* .set('i', function(node) {
* this.mapVisit(node);
* })
* .set('i.open', utils.append('<i>'))
* .set('i.close', utils.append('</i>'))
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @returns {Function} Returns a compiler middleware function.
* @api public
*/
utils.append = function (val) {
return function (node) {
append(this, val, node);
};
};
/**
* Used in compiler middleware, this onverts an AST node into
* an empty `text` node and deletes `node.nodes` if it exists.
* The advantage of this method is that, as opposed to completely
* removing the node, indices will not need to be re-calculated
* in sibling nodes, and nothing is appended to the output.
*
* ```js
* utils.toNoop(node);
* // convert `node.nodes` to the given value instead of deleting it
* utils.toNoop(node, []);
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array.
* @api public
*/
utils.toNoop = function (node, nodes) {
if (nodes) {
node.nodes = nodes;
} else {
delete node.nodes;
node.type = 'text';
node.val = '';
}
};
/**
* Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon
* automatically calls registered compilers, this allows you to pass a visitor
* function.
*
* ```js
* snapdragon.compiler.set('i', function(node) {
* utils.visit(node, function(childNode) {
* // do stuff with "childNode"
* return childNode;
* });
* });
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Function} `fn`
* @return {Object} returns the node after recursively visiting all child nodes.
* @api public
*/
utils.visit = function (node, fn) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isFunction(fn), 'expected a visitor function');
fn(node);
return node.nodes ? utils.mapVisit(node, fn) : node;
};
/**
* Map [visit](#visit) the given `fn` over `node.nodes`. This is called by
* [visit](#visit), use this method if you do not want `fn` to be called on
* the first node.
*
* ```js
* snapdragon.compiler.set('i', function(node) {
* utils.mapVisit(node, function(childNode) {
* // do stuff with "childNode"
* return childNode;
* });
* });
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Object} `options`
* @param {Function} `fn`
* @return {Object} returns the node
* @api public
*/
utils.mapVisit = function (node, fn) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isArray(node.nodes), 'expected node.nodes to be an array');
assert(isFunction(fn), 'expected a visitor function');
for (var i = 0; i < node.nodes.length; i++) {
utils.visit(node.nodes[i], fn);
}
return node;
};
/**
* Unshift an `*.open` node onto `node.nodes`.
*
* ```js
* var Node = require('snapdragon-node');
* snapdragon.parser.set('brace', function(node) {
* var match = this.match(/^{/);
* if (match) {
* var parent = new Node({type: 'brace'});
* utils.addOpen(parent, Node);
* console.log(parent.nodes[0]):
* // { type: 'brace.open', val: '' };
*
* // push the parent "brace" node onto the stack
* this.push(parent);
*
* // return the parent node, so it's also added to the AST
* return brace;
* }
* });
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
* @param {Function} `filter` Optionaly specify a filter function to exclude the node.
* @return {Object} Returns the created opening node.
* @api public
*/
utils.addOpen = function (node, Node, val, filter) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isFunction(Node), 'expected Node to be a constructor function');
if (typeof val === 'function') {
filter = val;
val = '';
}
if (typeof filter === 'function' && !filter(node)) return;
var open = new Node({
type: node.type + '.open',
val: val
});
var unshift = node.unshift || node.unshiftNode;
if (typeof unshift === 'function') {
unshift.call(node, open);
} else {
utils.unshiftNode(node, open);
}
return open;
};
/**
* Push a `*.close` node onto `node.nodes`.
*
* ```js
* var Node = require('snapdragon-node');
* snapdragon.parser.set('brace', function(node) {
* var match = this.match(/^}/);
* if (match) {
* var parent = this.parent();
* if (parent.type !== 'brace') {
* throw new Error('missing opening: ' + '}');
* }
*
* utils.addClose(parent, Node);
* console.log(parent.nodes[parent.nodes.length - 1]):
* // { type: 'brace.close', val: '' };
*
* // no need to return a node, since the parent
* // was already added to the AST
* return;
* }
* });
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
* @param {Function} `filter` Optionaly specify a filter function to exclude the node.
* @return {Object} Returns the created closing node.
* @api public
*/
utils.addClose = function (node, Node, val, filter) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isFunction(Node), 'expected Node to be a constructor function');
if (typeof val === 'function') {
filter = val;
val = '';
}
if (typeof filter === 'function' && !filter(node)) return;
var close = new Node({
type: node.type + '.close',
val: val
});
var push = node.push || node.pushNode;
if (typeof push === 'function') {
push.call(node, close);
} else {
utils.pushNode(node, close);
}
return close;
};
/**
* Wraps the given `node` with `*.open` and `*.close` nodes.
*
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
* @param {Function} `filter` Optionaly specify a filter function to exclude the node.
* @return {Object} Returns the node
* @api public
*/
utils.wrapNodes = function (node, Node, filter) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isFunction(Node), 'expected Node to be a constructor function');
utils.addOpen(node, Node, filter);
utils.addClose(node, Node, filter);
return node;
};
/**
* Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent.
*
* ```js
* var parent = new Node({type: 'foo'});
* var node = new Node({type: 'bar'});
* utils.pushNode(parent, node);
* console.log(parent.nodes[0].type) // 'bar'
* console.log(node.parent.type) // 'foo'
* ```
* @param {Object} `parent`
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Object} Returns the child node
* @api public
*/
utils.pushNode = function (parent, node) {
assert(utils.isNode(parent), 'expected parent node to be an instance of Node');
assert(utils.isNode(node), 'expected node to be an instance of Node');
node.define('parent', parent);
parent.nodes = parent.nodes || [];
parent.nodes.push(node);
return node;
};
/**
* Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent.
*
* ```js
* var parent = new Node({type: 'foo'});
* var node = new Node({type: 'bar'});
* utils.unshiftNode(parent, node);
* console.log(parent.nodes[0].type) // 'bar'
* console.log(node.parent.type) // 'foo'
* ```
* @param {Object} `parent`
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {undefined}
* @api public
*/
utils.unshiftNode = function (parent, node) {
assert(utils.isNode(parent), 'expected parent node to be an instance of Node');
assert(utils.isNode(node), 'expected node to be an instance of Node');
node.define('parent', parent);
parent.nodes = parent.nodes || [];
parent.nodes.unshift(node);
};
/**
* Pop the last `node` off of `parent.nodes`. The advantage of
* using this method is that it checks for `node.nodes` and works
* with any version of `snapdragon-node`.
*
* ```js
* var parent = new Node({type: 'foo'});
* utils.pushNode(parent, new Node({type: 'foo'}));
* utils.pushNode(parent, new Node({type: 'bar'}));
* utils.pushNode(parent, new Node({type: 'baz'}));
* console.log(parent.nodes.length); //=> 3
* utils.popNode(parent);
* console.log(parent.nodes.length); //=> 2
* ```
* @param {Object} `parent`
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Number|Undefined} Returns the length of `node.nodes` or undefined.
* @api public
*/
utils.popNode = function (node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
if (typeof node.pop === 'function') {
return node.pop();
}
return node.nodes && node.nodes.pop();
};
/**
* Shift the first `node` off of `parent.nodes`. The advantage of
* using this method is that it checks for `node.nodes` and works
* with any version of `snapdragon-node`.
*
* ```js
* var parent = new Node({type: 'foo'});
* utils.pushNode(parent, new Node({type: 'foo'}));
* utils.pushNode(parent, new Node({type: 'bar'}));
* utils.pushNode(parent, new Node({type: 'baz'}));
* console.log(parent.nodes.length); //=> 3
* utils.shiftNode(parent);
* console.log(parent.nodes.length); //=> 2
* ```
* @param {Object} `parent`
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Number|Undefined} Returns the length of `node.nodes` or undefined.
* @api public
*/
utils.shiftNode = function (node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
if (typeof node.shift === 'function') {
return node.shift();
}
return node.nodes && node.nodes.shift();
};
/**
* Remove the specified `node` from `parent.nodes`.
*
* ```js
* var parent = new Node({type: 'abc'});
* var foo = new Node({type: 'foo'});
* utils.pushNode(parent, foo);
* utils.pushNode(parent, new Node({type: 'bar'}));
* utils.pushNode(parent, new Node({type: 'baz'}));
* console.log(parent.nodes.length); //=> 3
* utils.removeNode(parent, foo);
* console.log(parent.nodes.length); //=> 2
* ```
* @param {Object} `parent`
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Object|undefined} Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`.
* @api public
*/
utils.removeNode = function (parent, node) {
assert(utils.isNode(parent), 'expected parent.node to be an instance of Node');
assert(utils.isNode(node), 'expected node to be an instance of Node');
if (!parent.nodes) {
return null;
}
if (typeof parent.remove === 'function') {
return parent.remove(node);
}
var idx = parent.nodes.indexOf(node);
if (idx !== -1) {
return parent.nodes.splice(idx, 1);
}
};
/**
* Returns true if `node.type` matches the given `type`. Throws a
* `TypeError` if `node` is not an instance of `Node`.
*
* ```js
* var Node = require('snapdragon-node');
* var node = new Node({type: 'foo'});
* console.log(utils.isType(node, 'foo')); // false
* console.log(utils.isType(node, 'bar')); // true
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {String} `type`
* @return {Boolean}
* @api public
*/
utils.isType = function (node, type) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
switch (typeOf(type)) {
case 'array':
var types = type.slice();
for (var i = 0; i < types.length; i++) {
if (utils.isType(node, types[i])) {
return true;
}
}
return false;
case 'string':
return node.type === type;
case 'regexp':
return type.test(node.type);
default:
{
throw new TypeError('expected "type" to be an array, string or regexp');
}
}
};
/**
* Returns true if the given `node` has the given `type` in `node.nodes`.
* Throws a `TypeError` if `node` is not an instance of `Node`.
*
* ```js
* var Node = require('snapdragon-node');
* var node = new Node({
* type: 'foo',
* nodes: [
* new Node({type: 'bar'}),
* new Node({type: 'baz'})
* ]
* });
* console.log(utils.hasType(node, 'xyz')); // false
* console.log(utils.hasType(node, 'baz')); // true
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {String} `type`
* @return {Boolean}
* @api public
*/
utils.hasType = function (node, type) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
if (!Array.isArray(node.nodes)) return false;
for (var i = 0; i < node.nodes.length; i++) {
if (utils.isType(node.nodes[i], type)) {
return true;
}
}
return false;
};
/**
* Returns the first node from `node.nodes` of the given `type`
*
* ```js
* var node = new Node({
* type: 'foo',
* nodes: [
* new Node({type: 'text', val: 'abc'}),
* new Node({type: 'text', val: 'xyz'})
* ]
* });
*
* var textNode = utils.firstOfType(node.nodes, 'text');
* console.log(textNode.val);
* //=> 'abc'
* ```
* @param {Array} `nodes`
* @param {String} `type`
* @return {Object|undefined} Returns the first matching node or undefined.
* @api public
*/
utils.firstOfType = function (nodes, type) {
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
if (utils.isType(node, type)) {
return node;
}
}
};
/**
* Returns the node at the specified index, or the first node of the
* given `type` from `node.nodes`.
*
* ```js
* var node = new Node({
* type: 'foo',
* nodes: [
* new Node({type: 'text', val: 'abc'}),
* new Node({type: 'text', val: 'xyz'})
* ]
* });
*
* var nodeOne = utils.findNode(node.nodes, 'text');
* console.log(nodeOne.val);
* //=> 'abc'
*
* var nodeTwo = utils.findNode(node.nodes, 1);
* console.log(nodeTwo.val);
* //=> 'xyz'
* ```
*
* @param {Array} `nodes`
* @param {String|Number} `type` Node type or index.
* @return {Object} Returns a node or undefined.
* @api public
*/
utils.findNode = function (nodes, type) {
if (!Array.isArray(nodes)) {
return null;
}
if (typeof type === 'number') {
return nodes[type];
}
return utils.firstOfType(nodes, type);
};
/**
* Returns true if the given node is an "*.open" node.
*
* ```js
* var Node = require('snapdragon-node');
* var brace = new Node({type: 'brace'});
* var open = new Node({type: 'brace.open'});
* var close = new Node({type: 'brace.close'});
*
* console.log(utils.isOpen(brace)); // false
* console.log(utils.isOpen(open)); // true
* console.log(utils.isOpen(close)); // false
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Boolean}
* @api public
*/
utils.isOpen = function (node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
return node.type.slice(-5) === '.open';
};
/**
* Returns true if the given node is a "*.close" node.
*
* ```js
* var Node = require('snapdragon-node');
* var brace = new Node({type: 'brace'});
* var open = new Node({type: 'brace.open'});
* var close = new Node({type: 'brace.close'});
*
* console.log(utils.isClose(brace)); // false
* console.log(utils.isClose(open)); // false
* console.log(utils.isClose(close)); // true
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Boolean}
* @api public
*/
utils.isClose = function (node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
return node.type.slice(-6) === '.close';
};
/**
* Returns true if `node.nodes` **has** an `.open` node
*
* ```js
* var Node = require('snapdragon-node');
* var brace = new Node({
* type: 'brace',
* nodes: []
* });
*
* var open = new Node({type: 'brace.open'});
* console.log(utils.hasOpen(brace)); // false
*
* brace.pushNode(open);
* console.log(utils.hasOpen(brace)); // true
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Boolean}
* @api public
*/
utils.hasOpen = function (node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
var first = node.first || node.nodes ? node.nodes[0] : null;
if (utils.isNode(first)) {
return first.type === node.type + '.open';
}
return false;
};
/**
* Returns true if `node.nodes` **has** a `.close` node
*
* ```js
* var Node = require('snapdragon-node');
* var brace = new Node({
* type: 'brace',
* nodes: []
* });
*
* var close = new Node({type: 'brace.close'});
* console.log(utils.hasClose(brace)); // false
*
* brace.pushNode(close);
* console.log(utils.hasClose(brace)); // true
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Boolean}
* @api public
*/
utils.hasClose = function (node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
var last = node.last || node.nodes ? node.nodes[node.nodes.length - 1] : null;
if (utils.isNode(last)) {
return last.type === node.type + '.close';
}
return false;
};
/**
* Returns true if `node.nodes` has both `.open` and `.close` nodes
*
* ```js
* var Node = require('snapdragon-node');
* var brace = new Node({
* type: 'brace',
* nodes: []
* });
*
* var open = new Node({type: 'brace.open'});
* var close = new Node({type: 'brace.close'});
* console.log(utils.hasOpen(brace)); // false
* console.log(utils.hasClose(brace)); // false
*
* brace.pushNode(open);
* brace.pushNode(close);
* console.log(utils.hasOpen(brace)); // true
* console.log(utils.hasClose(brace)); // true
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Boolean}
* @api public
*/
utils.hasOpenAndClose = function (node) {
return utils.hasOpen(node) && utils.hasClose(node);
};
/**
* Push the given `node` onto the `state.inside` array for the
* given type. This array is used as a specialized "stack" for
* only the given `node.type`.
*
* ```js
* var state = { inside: {}};
* var node = new Node({type: 'brace'});
* utils.addType(state, node);
* console.log(state.inside);
* //=> { brace: [{type: 'brace'}] }
* ```
* @param {Object} `state` The `compiler.state` object or custom state object.
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Array} Returns the `state.inside` stack for the given type.
* @api public
*/
utils.addType = function (state, node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isObject(state), 'expected state to be an object');
var type = node.parent ? node.parent.type : node.type.replace(/\.open$/, '');
if (!state.hasOwnProperty('inside')) {
state.inside = {};
}
if (!state.inside.hasOwnProperty(type)) {
state.inside[type] = [];
}
var arr = state.inside[type];
arr.push(node);
return arr;
};
/**
* Remove the given `node` from the `state.inside` array for the
* given type. This array is used as a specialized "stack" for
* only the given `node.type`.
*
* ```js
* var state = { inside: {}};
* var node = new Node({type: 'brace'});
* utils.addType(state, node);
* console.log(state.inside);
* //=> { brace: [{type: 'brace'}] }
* utils.removeType(state, node);
* //=> { brace: [] }
* ```
* @param {Object} `state` The `compiler.state` object or custom state object.
* @param {Object} `node` Instance of [snapdragon-node][]
* @return {Array} Returns the `state.inside` stack for the given type.
* @api public
*/
utils.removeType = function (state, node) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isObject(state), 'expected state to be an object');
var type = node.parent ? node.parent.type : node.type.replace(/\.close$/, '');
if (state.inside.hasOwnProperty(type)) {
return state.inside[type].pop();
}
};
/**
* Returns true if `node.val` is an empty string, or `node.nodes` does
* not contain any non-empty text nodes.
*
* ```js
* var node = new Node({type: 'text'});
* utils.isEmpty(node); //=> true
* node.val = 'foo';
* utils.isEmpty(node); //=> false
* ```
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {Function} `fn`
* @return {Boolean}
* @api public
*/
utils.isEmpty = function (node, fn) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
if (!Array.isArray(node.nodes)) {
if (node.type !== 'text') {
return true;
}
if (typeof fn === 'function') {
return fn(node, node.parent);
}
return !utils.trim(node.val);
}
for (var i = 0; i < node.nodes.length; i++) {
var child = node.nodes[i];
if (utils.isOpen(child) || utils.isClose(child)) {
continue;
}
if (!utils.isEmpty(child, fn)) {
return false;
}
}
return true;
};
/**
* Returns true if the `state.inside` stack for the given type exists
* and has one or more nodes on it.
*
* ```js
* var state = { inside: {}};
* var node = new Node({type: 'brace'});
* console.log(utils.isInsideType(state, 'brace')); //=> false
* utils.addType(state, node);
* console.log(utils.isInsideType(state, 'brace')); //=> true
* utils.removeType(state, node);
* console.log(utils.isInsideType(state, 'brace')); //=> false
* ```
* @param {Object} `state`
* @param {String} `type`
* @return {Boolean}
* @api public
*/
utils.isInsideType = function (state, type) {
assert(isObject(state), 'expected state to be an object');
assert(isString(type), 'expected type to be a string');
if (!state.hasOwnProperty('inside')) {
return false;
}
if (!state.inside.hasOwnProperty(type)) {
return false;
}
return state.inside[type].length > 0;
};
/**
* Returns true if `node` is either a child or grand-child of the given `type`,
* or `state.inside[type]` is a non-empty array.
*
* ```js
* var state = { inside: {}};
* var node = new Node({type: 'brace'});
* var open = new Node({type: 'brace.open'});
* console.log(utils.isInside(state, open, 'brace')); //=> false
* utils.pushNode(node, open);
* console.log(utils.isInside(state, open, 'brace')); //=> true
* ```
* @param {Object} `state` Either the `compiler.state` object, if it exists, or a user-supplied state object.
* @param {Object} `node` Instance of [snapdragon-node][]
* @param {String} `type` The `node.type` to check for.
* @return {Boolean}
* @api public
*/
utils.isInside = function (state, node, type) {
assert(utils.isNode(node), 'expected node to be an instance of Node');
assert(isObject(state), 'expected state to be an object');
if (Array.isArray(type)) {
for (var i = 0; i < type.length; i++) {
if (utils.isInside(state, node, type[i])) {
return true;
}
}
return false;
}
var parent = node.parent;
if (typeof type === 'string') {
return parent && parent.type === type || utils.isInsideType(state, type);
}
if (typeOf(type) === 'regexp') {
if (parent && parent.type && type.test(parent.type)) {
return true;
}
var keys = Object.keys(state.inside);
var len = keys.length;
var idx = -1;
while (++idx < len) {
var key = keys[idx];
var val = state.inside[key];
if (Array.isArray(val) && val.length !== 0 && type.test(key)) {
return true;
}
}
}
return false;
};
/**
* Get the last `n` element from the given `array`. Used for getting
* a node from `node.nodes.`
*
* @param {Array} `array`
* @param {Number} `n`
* @return {undefined}
* @api public
*/
utils.last = function (arr, n) {
return arr[arr.length - (n || 1)];
};
/**
* Cast the given `val` to an array.
*
* ```js
* console.log(utils.arrayify(''));
* //=> []
* console.log(utils.arrayify('foo'));
* //=> ['foo']
* console.log(utils.arrayify(['foo']));
* //=> ['foo']
* ```
* @param {any} `val`
* @return {Array}
* @api public
*/
utils.arrayify = function (val) {
if (typeof val === 'string' && val !== '') {
return [val];
}
if (!Array.isArray(val)) {
return [];
}
return val;
};
/**
* Convert the given `val` to a string by joining with `,`. Useful
* for creating a cheerio/CSS/DOM-style selector from a list of strings.
*
* @param {any} `val`
* @return {Array}
* @api public
*/
utils.stringify = function (val) {
return utils.arrayify(val).join(',');
};
/**
* Ensure that the given value is a string and call `.trim()` on it,
* or return an empty string.
*
* @param {String} `str`
* @return {String}
* @api public
*/
utils.trim = function (str) {
return typeof str === 'string' ? str.trim() : '';
};
/**
* Return true if val is an object
*/
function isObject(val) {
return typeOf(val) === 'object';
}
/**
* Return true if val is a string
*/
function isString(val) {
return typeof val === 'string';
}
/**
* Return true if val is a function
*/
function isFunction(val) {
return typeof val === 'function';
}
/**
* Return true if val is an array
*/
function isArray(val) {
return Array.isArray(val);
}
/**
* Shim to ensure the `.append` methods work with any version of snapdragon
*/
function append(compiler, val, node) {
if (typeof compiler.append !== 'function') {
return compiler.emit(val, node);
}
return compiler.append(val, node);
}
/**
* Simplified assertion. Throws an error is `val` is falsey.
*/
function assert(val, message) {
if (!val) throw new Error(message);
}
/***/ }),
/***/ "./node_modules/snapdragon/index.js":
/*!******************************************!*\
!*** ./node_modules/snapdragon/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Base = __webpack_require__(/*! base */ "./node_modules/base/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
var Compiler = __webpack_require__(/*! ./lib/compiler */ "./node_modules/snapdragon/lib/compiler.js");
var Parser = __webpack_require__(/*! ./lib/parser */ "./node_modules/snapdragon/lib/parser.js");
var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/snapdragon/lib/utils.js");
var regexCache = {};
var cache = {};
/**
* Create a new instance of `Snapdragon` with the given `options`.
*
* ```js
* var snapdragon = new Snapdragon();
* ```
*
* @param {Object} `options`
* @api public
*/
function Snapdragon(options) {
Base.call(this, null, options);
this.options = utils.extend({
source: 'string'
}, this.options);
this.compiler = new Compiler(this.options);
this.parser = new Parser(this.options);
Object.defineProperty(this, 'compilers', {
get: function get() {
return this.compiler.compilers;
}
});
Object.defineProperty(this, 'parsers', {
get: function get() {
return this.parser.parsers;
}
});
Object.defineProperty(this, 'regex', {
get: function get() {
return this.parser.regex;
}
});
}
/**
* Inherit Base
*/
Base.extend(Snapdragon);
/**
* Add a parser to `snapdragon.parsers` for capturing the given `type` using
* the specified regex or parser function. A function is useful if you need
* to customize how the token is created and/or have access to the parser
* instance to check options, etc.
*
* ```js
* snapdragon
* .capture('slash', /^\//)
* .capture('dot', function() {
* var pos = this.position();
* var m = this.match(/^\./);
* if (!m) return;
* return pos({
* type: 'dot',
* val: m[0]
* });
* });
* ```
* @param {String} `type`
* @param {RegExp|Function} `regex`
* @return {Object} Returns the parser instance for chaining
* @api public
*/
Snapdragon.prototype.capture = function () {
return this.parser.capture.apply(this.parser, arguments);
};
/**
* Register a plugin `fn`.
*
* ```js
* var snapdragon = new Snapdgragon([options]);
* snapdragon.use(function() {
* console.log(this); //<= snapdragon instance
* console.log(this.parser); //<= parser instance
* console.log(this.compiler); //<= compiler instance
* });
* ```
* @param {Object} `fn`
* @api public
*/
Snapdragon.prototype.use = function (fn) {
fn.call(this, this);
return this;
};
/**
* Parse the given `str`.
*
* ```js
* var snapdragon = new Snapdgragon([options]);
* // register parsers
* snapdragon.parser.use(function() {});
*
* // parse
* var ast = snapdragon.parse('foo/bar');
* console.log(ast);
* ```
* @param {String} `str`
* @param {Object} `options` Set `options.sourcemap` to true to enable source maps.
* @return {Object} Returns an AST.
* @api public
*/
Snapdragon.prototype.parse = function (str, options) {
this.options = utils.extend({}, this.options, options);
var parsed = this.parser.parse(str, this.options); // add non-enumerable parser reference
define(parsed, 'parser', this.parser);
return parsed;
};
/**
* Compile the given `AST`.
*
* ```js
* var snapdragon = new Snapdgragon([options]);
* // register plugins
* snapdragon.use(function() {});
* // register parser plugins
* snapdragon.parser.use(function() {});
* // register compiler plugins
* snapdragon.compiler.use(function() {});
*
* // parse
* var ast = snapdragon.parse('foo/bar');
*
* // compile
* var res = snapdragon.compile(ast);
* console.log(res.output);
* ```
* @param {Object} `ast`
* @param {Object} `options`
* @return {Object} Returns an object with an `output` property with the rendered string.
* @api public
*/
Snapdragon.prototype.compile = function (ast, options) {
this.options = utils.extend({}, this.options, options);
var compiled = this.compiler.compile(ast, this.options); // add non-enumerable compiler reference
define(compiled, 'compiler', this.compiler);
return compiled;
};
/**
* Expose `Snapdragon`
*/
module.exports = Snapdragon;
/**
* Expose `Parser` and `Compiler`
*/
module.exports.Compiler = Compiler;
module.exports.Parser = Parser;
/***/ }),
/***/ "./node_modules/snapdragon/lib/compiler.js":
/*!*************************************************!*\
!*** ./node_modules/snapdragon/lib/compiler.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(__filename) {
var use = __webpack_require__(/*! use */ "./node_modules/use/index.js");
var _define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
var debug = __webpack_require__(/*! debug */ "./node_modules/snapdragon/node_modules/debug/src/browser.js")('snapdragon:compiler');
var utils = __webpack_require__(/*! ./utils */ "./node_modules/snapdragon/lib/utils.js");
/**
* Create a new `Compiler` with the given `options`.
* @param {Object} `options`
*/
function Compiler(options, state) {
debug('initializing', __filename);
this.options = utils.extend({
source: 'string'
}, options);
this.state = state || {};
this.compilers = {};
this.output = '';
this.set('eos', function (node) {
return this.emit(node.val, node);
});
this.set('noop', function (node) {
return this.emit(node.val, node);
});
this.set('bos', function (node) {
return this.emit(node.val, node);
});
use(this);
}
/**
* Prototype methods
*/
Compiler.prototype = {
/**
* Throw an error message with details including the cursor position.
* @param {String} `msg` Message to use in the Error.
*/
error: function error(msg, node) {
var pos = node.position || {
start: {
column: 0
}
};
var message = this.options.source + ' column:' + pos.start.column + ': ' + msg;
var err = new Error(message);
err.reason = msg;
err.column = pos.start.column;
err.source = this.pattern;
if (this.options.silent) {
this.errors.push(err);
} else {
throw err;
}
},
/**
* Define a non-enumberable property on the `Compiler` instance.
*
* ```js
* compiler.define('foo', 'bar');
* ```
* @name .define
* @param {String} `key` propery name
* @param {any} `val` property value
* @return {Object} Returns the Compiler instance for chaining.
* @api public
*/
define: function define(key, val) {
_define(this, key, val);
return this;
},
/**
* Emit `node.val`
*/
emit: function emit(str, node) {
this.output += str;
return str;
},
/**
* Add a compiler `fn` with the given `name`
*/
set: function set(name, fn) {
this.compilers[name] = fn;
return this;
},
/**
* Get compiler `name`.
*/
get: function get(name) {
return this.compilers[name];
},
/**
* Get the previous AST node.
*/
prev: function prev(n) {
return this.ast.nodes[this.idx - (n || 1)] || {
type: 'bos',
val: ''
};
},
/**
* Get the next AST node.
*/
next: function next(n) {
return this.ast.nodes[this.idx + (n || 1)] || {
type: 'eos',
val: ''
};
},
/**
* Visit `node`.
*/
visit: function visit(node, nodes, i) {
var fn = this.compilers[node.type];
this.idx = i;
if (typeof fn !== 'function') {
throw this.error('compiler "' + node.type + '" is not registered', node);
}
return fn.call(this, node, nodes, i);
},
/**
* Map visit over array of `nodes`.
*/
mapVisit: function mapVisit(nodes) {
if (!Array.isArray(nodes)) {
throw new TypeError('expected an array');
}
var len = nodes.length;
var idx = -1;
while (++idx < len) {
this.visit(nodes[idx], nodes, idx);
}
return this;
},
/**
* Compile `ast`.
*/
compile: function compile(ast, options) {
var opts = utils.extend({}, this.options, options);
this.ast = ast;
this.parsingErrors = this.ast.errors;
this.output = ''; // source map support
if (opts.sourcemap) {
var sourcemaps = __webpack_require__(/*! ./source-maps */ "./node_modules/snapdragon/lib/source-maps.js");
sourcemaps(this);
this.mapVisit(this.ast.nodes);
this.applySourceMaps();
this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON();
return this;
}
this.mapVisit(this.ast.nodes);
return this;
}
};
/**
* Expose `Compiler`
*/
module.exports = Compiler;
/* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
/***/ }),
/***/ "./node_modules/snapdragon/lib/parser.js":
/*!***********************************************!*\
!*** ./node_modules/snapdragon/lib/parser.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(__filename) {
var use = __webpack_require__(/*! use */ "./node_modules/use/index.js");
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
var Cache = __webpack_require__(/*! map-cache */ "./node_modules/map-cache/index.js");
var _define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
var debug = __webpack_require__(/*! debug */ "./node_modules/snapdragon/node_modules/debug/src/browser.js")('snapdragon:parser');
var Position = __webpack_require__(/*! ./position */ "./node_modules/snapdragon/lib/position.js");
var utils = __webpack_require__(/*! ./utils */ "./node_modules/snapdragon/lib/utils.js");
/**
* Create a new `Parser` with the given `input` and `options`.
* @param {String} `input`
* @param {Object} `options`
* @api public
*/
function Parser(options) {
debug('initializing', __filename);
this.options = utils.extend({
source: 'string'
}, options);
this.init(this.options);
use(this);
}
/**
* Prototype methods
*/
Parser.prototype = {
constructor: Parser,
init: function init(options) {
this.orig = '';
this.input = '';
this.parsed = '';
this.column = 1;
this.line = 1;
this.regex = new Cache();
this.errors = this.errors || [];
this.parsers = this.parsers || {};
this.types = this.types || [];
this.sets = this.sets || {};
this.fns = this.fns || [];
this.currentType = 'root';
var pos = this.position();
this.bos = pos({
type: 'bos',
val: ''
});
this.ast = {
type: 'root',
errors: this.errors,
nodes: [this.bos]
};
_define(this.bos, 'parent', this.ast);
this.nodes = [this.ast];
this.count = 0;
this.setCount = 0;
this.stack = [];
},
/**
* Throw a formatted error with the cursor column and `msg`.
* @param {String} `msg` Message to use in the Error.
*/
error: function error(msg, node) {
var pos = node.position || {
start: {
column: 0,
line: 0
}
};
var line = pos.start.line;
var column = pos.start.column;
var source = this.options.source;
var message = source + ' <line:' + line + ' column:' + column + '>: ' + msg;
var err = new Error(message);
err.source = source;
err.reason = msg;
err.pos = pos;
if (this.options.silent) {
this.errors.push(err);
} else {
throw err;
}
},
/**
* Define a non-enumberable property on the `Parser` instance.
*
* ```js
* parser.define('foo', 'bar');
* ```
* @name .define
* @param {String} `key` propery name
* @param {any} `val` property value
* @return {Object} Returns the Parser instance for chaining.
* @api public
*/
define: function define(key, val) {
_define(this, key, val);
return this;
},
/**
* Mark position and patch `node.position`.
*/
position: function position() {
var start = {
line: this.line,
column: this.column
};
var self = this;
return function (node) {
_define(node, 'position', new Position(start, self));
return node;
};
},
/**
* Set parser `name` with the given `fn`
* @param {String} `name`
* @param {Function} `fn`
* @api public
*/
set: function set(type, fn) {
if (this.types.indexOf(type) === -1) {
this.types.push(type);
}
this.parsers[type] = fn.bind(this);
return this;
},
/**
* Get parser `name`
* @param {String} `name`
* @api public
*/
get: function get(name) {
return this.parsers[name];
},
/**
* Push a `token` onto the `type` stack.
*
* @param {String} `type`
* @return {Object} `token`
* @api public
*/
push: function push(type, token) {
this.sets[type] = this.sets[type] || [];
this.count++;
this.stack.push(token);
return this.sets[type].push(token);
},
/**
* Pop a token off of the `type` stack
* @param {String} `type`
* @returns {Object} Returns a token
* @api public
*/
pop: function pop(type) {
this.sets[type] = this.sets[type] || [];
this.count--;
this.stack.pop();
return this.sets[type].pop();
},
/**
* Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`.
*
* @param {String} `type`
* @return {Boolean}
* @api public
*/
isInside: function isInside(type) {
this.sets[type] = this.sets[type] || [];
return this.sets[type].length > 0;
},
/**
* Return true if `node` is the given `type`.
*
* ```js
* parser.isType(node, 'brace');
* ```
* @param {Object} `node`
* @param {String} `type`
* @return {Boolean}
* @api public
*/
isType: function isType(node, type) {
return node && node.type === type;
},
/**
* Get the previous AST node
* @return {Object}
*/
prev: function prev(n) {
return this.stack.length > 0 ? utils.last(this.stack, n) : utils.last(this.nodes, n);
},
/**
* Update line and column based on `str`.
*/
consume: function consume(len) {
this.input = this.input.substr(len);
},
/**
* Update column based on `str`.
*/
updatePosition: function updatePosition(str, len) {
var lines = str.match(/\n/g);
if (lines) this.line += lines.length;
var i = str.lastIndexOf('\n');
this.column = ~i ? len - i : this.column + len;
this.parsed += str;
this.consume(len);
},
/**
* Match `regex`, return captures, and update the cursor position by `match[0]` length.
* @param {RegExp} `regex`
* @return {Object}
*/
match: function match(regex) {
var m = regex.exec(this.input);
if (m) {
this.updatePosition(m[0], m[0].length);
return m;
}
},
/**
* Capture `type` with the given regex.
* @param {String} `type`
* @param {RegExp} `regex`
* @return {Function}
*/
capture: function capture(type, regex) {
if (typeof regex === 'function') {
return this.set.apply(this, arguments);
}
this.regex.set(type, regex);
this.set(type, function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(regex);
if (!m || !m[0]) return;
var prev = this.prev();
var node = pos({
type: type,
val: m[0],
parsed: parsed,
rest: this.input
});
if (m[1]) {
node.inner = m[1];
}
_define(node, 'inside', this.stack.length > 0);
_define(node, 'parent', prev);
prev.nodes.push(node);
}.bind(this));
return this;
},
/**
* Create a parser with open and close for parens,
* brackets or braces
*/
capturePair: function capturePair(type, openRegex, closeRegex, fn) {
this.sets[type] = this.sets[type] || [];
/**
* Open
*/
this.set(type + '.open', function () {
var parsed = this.parsed;
var pos = this.position();
var m = this.match(openRegex);
if (!m || !m[0]) return;
var val = m[0];
this.setCount++;
this.specialChars = true;
var open = pos({
type: type + '.open',
val: val,
rest: this.input
});
if (typeof m[1] !== 'undefined') {
open.inner = m[1];
}
var prev = this.prev();
var node = pos({
type: type,
nodes: [open]
});
_define(node, 'rest', this.input);
_define(node, 'parsed', parsed);
_define(node, 'prefix', m[1]);
_define(node, 'parent', prev);
_define(open, 'parent', node);
if (typeof fn === 'function') {
fn.call(this, open, node);
}
this.push(type, node);
prev.nodes.push(node);
});
/**
* Close
*/
this.set(type + '.close', function () {
var pos = this.position();
var m = this.match(closeRegex);
if (!m || !m[0]) return;
var parent = this.pop(type);
var node = pos({
type: type + '.close',
rest: this.input,
suffix: m[1],
val: m[0]
});
if (!this.isType(parent, type)) {
if (this.options.strict) {
throw new Error('missing opening "' + type + '"');
}
this.setCount--;
node.escaped = true;
return node;
}
if (node.suffix === '\\') {
parent.escaped = true;
node.escaped = true;
}
parent.nodes.push(node);
_define(node, 'parent', parent);
});
return this;
},
/**
* Capture end-of-string
*/
eos: function eos() {
var pos = this.position();
if (this.input) return;
var prev = this.prev();
while (prev.type !== 'root' && !prev.visited) {
if (this.options.strict === true) {
throw new SyntaxError('invalid syntax:' + util.inspect(prev, null, 2));
}
if (!hasDelims(prev)) {
prev.parent.escaped = true;
prev.escaped = true;
}
visit(prev, function (node) {
if (!hasDelims(node.parent)) {
node.parent.escaped = true;
node.escaped = true;
}
});
prev = prev.parent;
}
var tok = pos({
type: 'eos',
val: this.append || ''
});
_define(tok, 'parent', this.ast);
return tok;
},
/**
* Run parsers to advance the cursor position
*/
next: function next() {
var parsed = this.parsed;
var len = this.types.length;
var idx = -1;
var tok;
while (++idx < len) {
if (tok = this.parsers[this.types[idx]].call(this)) {
_define(tok, 'rest', this.input);
_define(tok, 'parsed', parsed);
this.last = tok;
return tok;
}
}
},
/**
* Parse the given string.
* @return {Array}
*/
parse: function parse(input) {
if (typeof input !== 'string') {
throw new TypeError('expected a string');
}
this.init(this.options);
this.orig = input;
this.input = input;
var self = this;
function parse() {
// check input before calling `.next()`
input = self.input; // get the next AST ndoe
var node = self.next();
if (node) {
var prev = self.prev();
if (prev) {
_define(node, 'parent', prev);
if (prev.nodes) {
prev.nodes.push(node);
}
}
if (self.sets.hasOwnProperty(prev.type)) {
self.currentType = prev.type;
}
} // if we got here but input is not changed, throw an error
if (self.input && input === self.input) {
throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
}
}
while (this.input) {
parse();
}
if (this.stack.length && this.options.strict) {
var node = this.stack.pop();
throw this.error('missing opening ' + node.type + ': "' + this.orig + '"');
}
var eos = this.eos();
var tok = this.prev();
if (tok.type !== 'eos') {
this.ast.nodes.push(eos);
}
return this.ast;
}
};
/**
* Visit `node` with the given `fn`
*/
function visit(node, fn) {
if (!node.visited) {
_define(node, 'visited', true);
return node.nodes ? mapVisit(node.nodes, fn) : fn(node);
}
return node;
}
/**
* Map visit over array of `nodes`.
*/
function mapVisit(nodes, fn) {
var len = nodes.length;
var idx = -1;
while (++idx < len) {
visit(nodes[idx], fn);
}
}
function hasOpen(node) {
return node.nodes && node.nodes[0].type === node.type + '.open';
}
function hasClose(node) {
return node.nodes && utils.last(node.nodes).type === node.type + '.close';
}
function hasDelims(node) {
return hasOpen(node) && hasClose(node);
}
/**
* Expose `Parser`
*/
module.exports = Parser;
/* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
/***/ }),
/***/ "./node_modules/snapdragon/lib/position.js":
/*!*************************************************!*\
!*** ./node_modules/snapdragon/lib/position.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
/**
* Store position for a node
*/
module.exports = function Position(start, parser) {
this.start = start;
this.end = {
line: parser.line,
column: parser.column
};
define(this, 'content', parser.orig);
define(this, 'source', parser.options.source);
};
/***/ }),
/***/ "./node_modules/snapdragon/lib/source-maps.js":
/*!****************************************************!*\
!*** ./node_modules/snapdragon/lib/source-maps.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fs = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js");
var path = __webpack_require__(/*! path */ "./node_modules/path-browserify/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
var utils = __webpack_require__(/*! ./utils */ "./node_modules/snapdragon/lib/utils.js");
/**
* Expose `mixin()`.
* This code is based on `source-maps-support.js` in reworkcss/css
* https://github.com/reworkcss/css/blob/master/lib/stringify/source-map-support.js
* Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
*/
module.exports = mixin;
/**
* Mixin source map support into `compiler`.
*
* @param {Object} `compiler`
* @api public
*/
function mixin(compiler) {
define(compiler, '_comment', compiler.comment);
compiler.map = new utils.SourceMap.SourceMapGenerator();
compiler.position = {
line: 1,
column: 1
};
compiler.content = {};
compiler.files = {};
for (var key in exports) {
define(compiler, key, exports[key]);
}
}
/**
* Update position.
*
* @param {String} str
*/
exports.updatePosition = function (str) {
var lines = str.match(/\n/g);
if (lines) this.position.line += lines.length;
var i = str.lastIndexOf('\n');
this.position.column = ~i ? str.length - i : this.position.column + str.length;
};
/**
* Emit `str` with `position`.
*
* @param {String} str
* @param {Object} [pos]
* @return {String}
*/
exports.emit = function (str, node) {
var position = node.position || {};
var source = position.source;
if (source) {
if (position.filepath) {
source = utils.unixify(position.filepath);
}
this.map.addMapping({
source: source,
generated: {
line: this.position.line,
column: Math.max(this.position.column - 1, 0)
},
original: {
line: position.start.line,
column: position.start.column - 1
}
});
if (position.content) {
this.addContent(source, position);
}
if (position.filepath) {
this.addFile(source, position);
}
this.updatePosition(str);
this.output += str;
}
return str;
};
/**
* Adds a file to the source map output if it has not already been added
* @param {String} `file`
* @param {Object} `pos`
*/
exports.addFile = function (file, position) {
if (typeof position.content !== 'string') return;
if (Object.prototype.hasOwnProperty.call(this.files, file)) return;
this.files[file] = position.content;
};
/**
* Adds a content source to the source map output if it has not already been added
* @param {String} `source`
* @param {Object} `position`
*/
exports.addContent = function (source, position) {
if (typeof position.content !== 'string') return;
if (Object.prototype.hasOwnProperty.call(this.content, source)) return;
this.map.setSourceContent(source, position.content);
};
/**
* Applies any original source maps to the output and embeds the source file
* contents in the source map.
*/
exports.applySourceMaps = function () {
Object.keys(this.files).forEach(function (file) {
var content = this.files[file];
this.map.setSourceContent(file, content);
if (this.options.inputSourcemaps === true) {
var originalMap = utils.sourceMapResolve.resolveSync(content, file, fs.readFileSync);
if (originalMap) {
var map = new utils.SourceMap.SourceMapConsumer(originalMap.map);
var relativeTo = originalMap.sourcesRelativeTo;
this.map.applySourceMap(map, file, utils.unixify(path.dirname(relativeTo)));
}
}
}, this);
};
/**
* Process comments, drops sourceMap comments.
* @param {Object} node
*/
exports.comment = function (node) {
if (/^# sourceMappingURL=/.test(node.comment)) {
return this.emit('', node.position);
}
return this._comment(node);
};
/***/ }),
/***/ "./node_modules/snapdragon/lib/utils.js":
/*!**********************************************!*\
!*** ./node_modules/snapdragon/lib/utils.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Module dependencies
*/
exports.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
exports.SourceMap = __webpack_require__(/*! source-map */ "./node_modules/snapdragon/node_modules/source-map/source-map.js");
exports.sourceMapResolve = __webpack_require__(/*! source-map-resolve */ "./node_modules/source-map-resolve/source-map-resolve.js");
/**
* Convert backslash in the given string to forward slashes
*/
exports.unixify = function (fp) {
return fp.split(/\\+/).join('/');
};
/**
* Return true if `val` is a non-empty string
*
* @param {String} `str`
* @return {Boolean}
*/
exports.isString = function (str) {
return str && typeof str === 'string';
};
/**
* Cast `val` to an array
* @return {Array}
*/
exports.arrayify = function (val) {
if (typeof val === 'string') return [val];
return val ? Array.isArray(val) ? val : [val] : [];
};
/**
* Get the last `n` element from the given `array`
* @param {Array} `array`
* @return {*}
*/
exports.last = function (arr, n) {
return arr[arr.length - (n || 1)];
};
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/debug/src/browser.js":
/*!*******************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/debug/src/browser.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/snapdragon/node_modules/debug/src/debug.js");
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();
/**
* Colors.
*/
exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson'];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
return true;
} // is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (err) {
return '[UnexpectedJSONParseError]: ' + err.message;
}
};
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);
if (!useColors) return;
var c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit'); // the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
var index = 0;
var lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, function (match) {
if ('%%' === match) return;
index++;
if ('%c' === match) {
// we only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log() {
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (null == namespaces) {
exports.storage.removeItem('debug');
} else {
exports.storage.debug = namespaces;
}
} catch (e) {}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
var r;
try {
r = exports.storage.debug;
} catch (e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
return window.localStorage;
} catch (e) {}
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/debug/src/debug.js":
/*!*****************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/debug/src/debug.js ***!
\*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = __webpack_require__(/*! ms */ "./node_modules/snapdragon/node_modules/ms/index.js");
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
exports.formatters = {};
/**
* Previous log timestamp.
*/
var prevTime;
/**
* Select a color.
* @param {String} namespace
* @return {Number}
* @api private
*/
function selectColor(namespace) {
var hash = 0,
i;
for (i in namespace) {
hash = (hash << 5) - hash + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return exports.colors[Math.abs(hash) % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
function debug() {
// disabled?
if (!debug.enabled) return;
var self = debug; // set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr; // turn the `arguments` into a proper Array
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %O
args.unshift('%O');
} // apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
}); // apply env-specific formatting (colors, etc.)
exports.formatArgs.call(self, args);
var logFn = debug.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.enabled = exports.enabled(namespace);
debug.useColors = exports.useColors();
debug.color = selectColor(namespace); // env-specific initialization logic for debug instances
if ('function' === typeof exports.init) {
exports.init(debug);
}
return debug;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
exports.names = [];
exports.skips = [];
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (var i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/ms/index.js":
/*!**********************************************************!*\
!*** ./node_modules/snapdragon/node_modules/ms/index.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val is not a non-empty string or a number
* @return {String|Number}
* @api public
*/
module.exports = function (val, options) {
options = options || {};
var type = _typeof(val);
if (type === 'string' && val.length > 0) {
return parse(val);
} else if (type === 'number' && isNaN(val) === false) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
};
/**
* Parse the given `str` and return milliseconds.
*
* @param {String} str
* @return {Number}
* @api private
*/
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'yrs':
case 'yr':
case 'y':
return n * y;
case 'days':
case 'day':
case 'd':
return n * d;
case 'hours':
case 'hour':
case 'hrs':
case 'hr':
case 'h':
return n * h;
case 'minutes':
case 'minute':
case 'mins':
case 'min':
case 'm':
return n * m;
case 'seconds':
case 'second':
case 'secs':
case 'sec':
case 's':
return n * s;
case 'milliseconds':
case 'millisecond':
case 'msecs':
case 'msec':
case 'ms':
return n;
default:
return undefined;
}
}
/**
* Short format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtShort(ms) {
if (ms >= d) {
return Math.round(ms / d) + 'd';
}
if (ms >= h) {
return Math.round(ms / h) + 'h';
}
if (ms >= m) {
return Math.round(ms / m) + 'm';
}
if (ms >= s) {
return Math.round(ms / s) + 's';
}
return ms + 'ms';
}
/**
* Long format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtLong(ms) {
return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms';
}
/**
* Pluralization helper.
*/
function plural(ms, n, name) {
if (ms < n) {
return;
}
if (ms < n * 1.5) {
return Math.floor(ms / n) + ' ' + name;
}
return Math.ceil(ms / n) + ' ' + name + 's';
}
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/array-set.js":
/*!**************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/array-set.js ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
var has = Object.prototype.hasOwnProperty;
var hasNativeMap = typeof Map !== "undefined";
/**
* A data structure which is a combination of an array and a set. Adding a new
* member is O(1), testing for membership is O(1), and finding the index of an
* element is O(1). Removing elements from the set is not supported. Only
* strings are supported for membership.
*/
function ArraySet() {
this._array = [];
this._set = hasNativeMap ? new Map() : Object.create(null);
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
};
/**
* Return how many unique items are in this ArraySet. If duplicates have been
* added, than those do not count towards the size.
*
* @returns Number
*/
ArraySet.prototype.size = function ArraySet_size() {
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
};
/**
* Add the given string to this set.
*
* @param String aStr
*/
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
if (hasNativeMap) {
this._set.set(aStr, idx);
} else {
this._set[sStr] = idx;
}
}
};
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
ArraySet.prototype.has = function ArraySet_has(aStr) {
if (hasNativeMap) {
return this._set.has(aStr);
} else {
var sStr = util.toSetString(aStr);
return has.call(this._set, sStr);
}
};
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (hasNativeMap) {
var idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
} else {
var sStr = util.toSetString(aStr);
if (has.call(this._set, sStr)) {
return this._set[sStr];
}
}
throw new Error('"' + aStr + '" is not in the set.');
};
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
};
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports.ArraySet = ArraySet;
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js":
/*!***************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js ***!
\***************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var base64 = __webpack_require__(/*! ./base64 */ "./node_modules/snapdragon/node_modules/source-map/lib/base64.js"); // A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5; // binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative ? -shifted : shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string via the out parameter.
*/
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (aIndex >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charCodeAt(aIndex++));
if (digit === -1) {
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
}
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
};
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/base64.js":
/*!***********************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/base64.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function (number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
/**
* Decode a single base 64 character code digit to an integer. Returns -1 on
* failure.
*/
exports.decode = function (charCode) {
var bigA = 65; // 'A'
var bigZ = 90; // 'Z'
var littleA = 97; // 'a'
var littleZ = 122; // 'z'
var zero = 48; // '0'
var nine = 57; // '9'
var plus = 43; // '+'
var slash = 47; // '/'
var littleOffset = 26;
var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
if (bigA <= charCode && charCode <= bigZ) {
return charCode - bigA;
} // 26 - 51: abcdefghijklmnopqrstuvwxyz
if (littleA <= charCode && charCode <= littleZ) {
return charCode - littleA + littleOffset;
} // 52 - 61: 0123456789
if (zero <= charCode && charCode <= nine) {
return charCode - zero + numberOffset;
} // 62: +
if (charCode == plus) {
return 62;
} // 63: /
if (charCode == slash) {
return 63;
} // Invalid base64 digit.
return -1;
};
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/binary-search.js":
/*!******************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/binary-search.js ***!
\******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.GREATEST_LOWER_BOUND = 1;
exports.LEAST_UPPER_BOUND = 2;
/**
* Recursive implementation of binary search.
*
* @param aLow Indices here and lower do not contain the needle.
* @param aHigh Indices here and higher do not contain the needle.
* @param aNeedle The element being searched for.
* @param aHaystack The non-empty array being searched.
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
*/
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the index of
// the next-closest element.
//
// 3. We did not find the exact element, and there is no next-closest
// element than the one we are searching for, so we return -1.
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
// Found the element we are looking for.
return mid;
} else if (cmp > 0) {
// Our needle is greater than aHaystack[mid].
if (aHigh - mid > 1) {
// The element is in the upper half.
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
} // The exact needle element was not found in this haystack. Determine if
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
} else {
return mid;
}
} else {
// Our needle is less than aHaystack[mid].
if (mid - aLow > 1) {
// The element is in the lower half.
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
} // we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return mid;
} else {
return aLow < 0 ? -1 : aLow;
}
}
}
/**
* This is an implementation of binary search which will always try and return
* the index of the closest element if there is no exact hit. This is because
* mappings between original and generated line/col pairs are single points,
* and there is an implicit region between each of them, so a miss just means
* that you aren't on the very start of a region.
*
* @param aNeedle The element you are looking for.
* @param aHaystack The array that is being searched.
* @param aCompare A function which takes the needle and an element in the
* array and returns -1, 0, or 1 depending on whether the needle is less
* than, equal to, or greater than the element, respectively.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
*/
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
if (aHaystack.length === 0) {
return -1;
}
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
if (index < 0) {
return -1;
} // We have found either the exact element, or the next-closest element than
// the one we are searching for. However, there may be more than one such
// element. Make sure we always return the smallest of these.
while (index - 1 >= 0) {
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
break;
}
--index;
}
return index;
};
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js":
/*!*****************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js ***!
\*****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2014 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
/**
* Determine whether mappingB is after mappingA with respect to generated
* position.
*/
function generatedPositionAfter(mappingA, mappingB) {
// Optimized for most common case
var lineA = mappingA.generatedLine;
var lineB = mappingB.generatedLine;
var columnA = mappingA.generatedColumn;
var columnB = mappingB.generatedColumn;
return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
}
/**
* A data structure to provide a sorted view of accumulated mappings in a
* performance conscious manner. It trades a neglibable overhead in general
* case for a large speedup in case of mappings being added in order.
*/
function MappingList() {
this._array = [];
this._sorted = true; // Serves as infimum
this._last = {
generatedLine: -1,
generatedColumn: 0
};
}
/**
* Iterate through internal items. This method takes the same arguments that
* `Array.prototype.forEach` takes.
*
* NOTE: The order of the mappings is NOT guaranteed.
*/
MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
this._array.forEach(aCallback, aThisArg);
};
/**
* Add the given source mapping.
*
* @param Object aMapping
*/
MappingList.prototype.add = function MappingList_add(aMapping) {
if (generatedPositionAfter(this._last, aMapping)) {
this._last = aMapping;
this._array.push(aMapping);
} else {
this._sorted = false;
this._array.push(aMapping);
}
};
/**
* Returns the flat, sorted array of mappings. The mappings are sorted by
* generated position.
*
* WARNING: This method returns internal data without copying, for
* performance. The return value must NOT be mutated, and should be treated as
* an immutable borrow. If you want to take ownership, you must make your own
* copy.
*/
MappingList.prototype.toArray = function MappingList_toArray() {
if (!this._sorted) {
this._array.sort(util.compareByGeneratedPositionsInflated);
this._sorted = true;
}
return this._array;
};
exports.MappingList = MappingList;
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js":
/*!***************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js ***!
\***************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
// It turns out that some (most?) JavaScript engines don't self-host
// `Array.prototype.sort`. This makes sense because C++ will likely remain
// faster than JS when doing raw CPU-intensive sorting. However, when using a
// custom comparator function, calling back and forth between the VM's C++ and
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
// worse generated code for the comparator function than would be optimal. In
// fact, when sorting with a comparator, these costs outweigh the benefits of
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
// a ~3500ms mean speed-up in `bench/bench.html`.
/**
* Swap the elements indexed by `x` and `y` in the array `ary`.
*
* @param {Array} ary
* The array.
* @param {Number} x
* The index of the first item.
* @param {Number} y
* The index of the second item.
*/
function swap(ary, x, y) {
var temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
/**
* Returns a random integer within the range `low .. high` inclusive.
*
* @param {Number} low
* The lower bound on the range.
* @param {Number} high
* The upper bound on the range.
*/
function randomIntInRange(low, high) {
return Math.round(low + Math.random() * (high - low));
}
/**
* The Quick Sort algorithm.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
* @param {Number} p
* Start index of the array
* @param {Number} r
* End index of the array
*/
function doQuickSort(ary, comparator, p, r) {
// If our lower bound is less than our upper bound, we (1) partition the
// array into two pieces and (2) recurse on each half. If it is not, this is
// the empty array and our base case.
if (p < r) {
// (1) Partitioning.
//
// The partitioning chooses a pivot between `p` and `r` and moves all
// elements that are less than or equal to the pivot to the before it, and
// all the elements that are greater than it after it. The effect is that
// once partition is done, the pivot is in the exact place it will be when
// the array is put in sorted order, and it will not need to be moved
// again. This runs in O(n) time.
// Always choose a random pivot so that an input array which is reverse
// sorted does not cause O(n^2) running time.
var pivotIndex = randomIntInRange(p, r);
var i = p - 1;
swap(ary, pivotIndex, r);
var pivot = ary[r]; // Immediately after `j` is incremented in this loop, the following hold
// true:
//
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
//
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
for (var j = p; j < r; j++) {
if (comparator(ary[j], pivot) <= 0) {
i += 1;
swap(ary, i, j);
}
}
swap(ary, i + 1, j);
var q = i + 1; // (2) Recurse on each half.
doQuickSort(ary, comparator, p, q - 1);
doQuickSort(ary, comparator, q + 1, r);
}
}
/**
* Sort the given array in-place with the given comparator function.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
*/
exports.quickSort = function (ary, comparator) {
doQuickSort(ary, comparator, 0, ary.length - 1);
};
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js":
/*!************************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js ***!
\************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
var binarySearch = __webpack_require__(/*! ./binary-search */ "./node_modules/snapdragon/node_modules/source-map/lib/binary-search.js");
var ArraySet = __webpack_require__(/*! ./array-set */ "./node_modules/snapdragon/node_modules/source-map/lib/array-set.js").ArraySet;
var base64VLQ = __webpack_require__(/*! ./base64-vlq */ "./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js");
var quickSort = __webpack_require__(/*! ./quick-sort */ "./node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js").quickSort;
function SourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap) : new BasicSourceMapConsumer(sourceMap);
}
SourceMapConsumer.fromSourceMap = function (aSourceMap) {
return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
};
/**
* The version of the source mapping spec that we are consuming.
*/
SourceMapConsumer.prototype._version = 3; // `__generatedMappings` and `__originalMappings` are arrays that hold the
// parsed mapping coordinates from the source map's "mappings" attribute. They
// are lazily instantiated, accessed via the `_generatedMappings` and
// `_originalMappings` getters respectively, and we only parse the mappings
// and create these arrays once queried for a source location. We jump through
// these hoops because there can be many thousands of mappings, and parsing
// them is expensive, so we only want to do it if we must.
//
// Each object in the arrays is of the form:
//
// {
// generatedLine: The line number in the generated code,
// generatedColumn: The column number in the generated code,
// source: The path to the original source file that generated this
// chunk of code,
// originalLine: The line number in the original source that
// corresponds to this chunk of generated code,
// originalColumn: The column number in the original source that
// corresponds to this chunk of generated code,
// name: The name of the original symbol which generated this chunk of
// code.
// }
//
// All properties except for `generatedLine` and `generatedColumn` can be
// `null`.
//
// `_generatedMappings` is ordered by the generated positions.
//
// `_originalMappings` is ordered by the original positions.
SourceMapConsumer.prototype.__generatedMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
get: function get() {
if (!this.__generatedMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__generatedMappings;
}
});
SourceMapConsumer.prototype.__originalMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
get: function get() {
if (!this.__originalMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__originalMappings;
}
});
SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
var c = aStr.charAt(index);
return c === ";" || c === ",";
};
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
throw new Error("Subclasses must implement _parseMappings");
};
SourceMapConsumer.GENERATED_ORDER = 1;
SourceMapConsumer.ORIGINAL_ORDER = 2;
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param Function aCallback
* The function that is called with each mapping.
* @param Object aContext
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param aOrder
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
switch (order) {
case SourceMapConsumer.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
var sourceRoot = this.sourceRoot;
mappings.map(function (mapping) {
var source = mapping.source === null ? null : this._sources.at(mapping.source);
if (source != null && sourceRoot != null) {
source = util.join(sourceRoot, source);
}
return {
source: source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name === null ? null : this._names.at(mapping.name)
};
}, this).forEach(aCallback, context);
};
/**
* Returns all generated line and column information for the original source,
* line, and column provided. If no column is provided, returns all mappings
* corresponding to a either the line we are searching for or the next
* closest line that has any mappings. Otherwise, returns all mappings
* corresponding to the given line and either the column we are searching for
* or the next closest column that has any offsets.
*
* The only argument is an object with the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: Optional. the column number in the original source.
*
* and an array of objects is returned, each with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
var line = util.getArg(aArgs, 'line'); // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
// returns the index of the closest mapping less than the needle. By
// setting needle.originalColumn to 0, we thus find the last mapping for
// the given line, provided such a mapping exists.
var needle = {
source: util.getArg(aArgs, 'source'),
originalLine: line,
originalColumn: util.getArg(aArgs, 'column', 0)
};
if (this.sourceRoot != null) {
needle.source = util.relative(this.sourceRoot, needle.source);
}
if (!this._sources.has(needle.source)) {
return [];
}
needle.source = this._sources.indexOf(needle.source);
var mappings = [];
var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
if (index >= 0) {
var mapping = this._originalMappings[index];
if (aArgs.column === undefined) {
var originalLine = mapping.originalLine; // Iterate until either we run out of mappings, or we run into
// a mapping for a different line than the one we found. Since
// mappings are sorted, this is guaranteed to find all mappings for
// the line we found.
while (mapping && mapping.originalLine === originalLine) {
mappings.push({
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
});
mapping = this._originalMappings[++index];
}
} else {
var originalColumn = mapping.originalColumn; // Iterate until either we run out of mappings, or we run into
// a mapping for a different line than the one we were searching for.
// Since mappings are sorted, this is guaranteed to find all mappings for
// the line we are searching for.
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
mappings.push({
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
});
mapping = this._originalMappings[++index];
}
}
}
return mappings;
};
exports.SourceMapConsumer = SourceMapConsumer;
/**
* A BasicSourceMapConsumer instance represents a parsed source map which we can
* query for information about the original file positions by giving it a file
* position in the generated source.
*
* The only parameter is the raw source map (either as a JSON string, or
* already parsed to an object). According to the spec, source maps have the
* following attributes:
*
* - version: Which version of the source map spec this map is following.
* - sources: An array of URLs to the original source files.
* - names: An array of identifiers which can be referrenced by individual mappings.
* - sourceRoot: Optional. The URL root from which all sources are relative.
* - sourcesContent: Optional. An array of contents of the original source files.
* - mappings: A string of base64 VLQs which contain the actual mappings.
* - file: Optional. The generated file this source map is associated with.
*
* Here is an example source map, taken from the source map spec[0]:
*
* {
* version : 3,
* file: "out.js",
* sourceRoot : "",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AA,AB;;ABCDE;"
* }
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
*/
function BasicSourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
var version = util.getArg(sourceMap, 'version');
var sources = util.getArg(sourceMap, 'sources'); // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
// requires the array) to play nice here.
var names = util.getArg(sourceMap, 'names', []);
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
var mappings = util.getArg(sourceMap, 'mappings');
var file = util.getArg(sourceMap, 'file', null); // Once again, Sass deviates from the spec and supplies the version as a
// string rather than a number, so we use loose equality checking here.
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
sources = sources.map(String) // Some source maps produce relative source paths like "./foo.js" instead of
// "foo.js". Normalize these first so that future comparisons will succeed.
// See bugzil.la/1090768.
.map(util.normalize) // Always ensure that absolute sources are internally stored relative to
// the source root, if the source root is absolute. Not doing this would
// be particularly problematic when the source root is a prefix of the
// source (valid, but why??). See github issue #199 and bugzil.la/1188982.
.map(function (source) {
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
}); // Pass `true` below to allow duplicate names and sources. While source maps
// are intended to be compressed and deduplicated, the TypeScript compiler
// sometimes generates source maps with duplicates in them. See Github issue
// #72 and bugzil.la/889492.
this._names = ArraySet.fromArray(names.map(String), true);
this._sources = ArraySet.fromArray(sources, true);
this.sourceRoot = sourceRoot;
this.sourcesContent = sourcesContent;
this._mappings = mappings;
this.file = file;
}
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
/**
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
*
* @param SourceMapGenerator aSourceMap
* The source map that will be consumed.
* @returns BasicSourceMapConsumer
*/
BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap) {
var smc = Object.create(BasicSourceMapConsumer.prototype);
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
smc.sourceRoot = aSourceMap._sourceRoot;
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
smc.file = aSourceMap._file; // Because we are modifying the entries (by converting string sources and
// names to indices into the sources and names ArraySets), we have to make
// a copy of the entry or else bad things happen. Shared mutable state
// strikes again! See github issue #191.
var generatedMappings = aSourceMap._mappings.toArray().slice();
var destGeneratedMappings = smc.__generatedMappings = [];
var destOriginalMappings = smc.__originalMappings = [];
for (var i = 0, length = generatedMappings.length; i < length; i++) {
var srcMapping = generatedMappings[i];
var destMapping = new Mapping();
destMapping.generatedLine = srcMapping.generatedLine;
destMapping.generatedColumn = srcMapping.generatedColumn;
if (srcMapping.source) {
destMapping.source = sources.indexOf(srcMapping.source);
destMapping.originalLine = srcMapping.originalLine;
destMapping.originalColumn = srcMapping.originalColumn;
if (srcMapping.name) {
destMapping.name = names.indexOf(srcMapping.name);
}
destOriginalMappings.push(destMapping);
}
destGeneratedMappings.push(destMapping);
}
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
return smc;
};
/**
* The version of the source mapping spec that we are consuming.
*/
BasicSourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
get: function get() {
return this._sources.toArray().map(function (s) {
return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
}, this);
}
});
/**
* Provide the JIT with a nice shape / hidden class.
*/
function Mapping() {
this.generatedLine = 0;
this.generatedColumn = 0;
this.source = null;
this.originalLine = null;
this.originalColumn = null;
this.name = null;
}
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
var length = aStr.length;
var index = 0;
var cachedSegments = {};
var temp = {};
var originalMappings = [];
var generatedMappings = [];
var mapping, str, segment, end, value;
while (index < length) {
if (aStr.charAt(index) === ';') {
generatedLine++;
index++;
previousGeneratedColumn = 0;
} else if (aStr.charAt(index) === ',') {
index++;
} else {
mapping = new Mapping();
mapping.generatedLine = generatedLine; // Because each offset is encoded relative to the previous one,
// many segments often have the same encoding. We can exploit this
// fact by caching the parsed variable length fields of each segment,
// allowing us to avoid a second parse if we encounter the same
// segment again.
for (end = index; end < length; end++) {
if (this._charIsMappingSeparator(aStr, end)) {
break;
}
}
str = aStr.slice(index, end);
segment = cachedSegments[str];
if (segment) {
index += str.length;
} else {
segment = [];
while (index < end) {
base64VLQ.decode(aStr, index, temp);
value = temp.value;
index = temp.rest;
segment.push(value);
}
if (segment.length === 2) {
throw new Error('Found a source, but no line and column');
}
if (segment.length === 3) {
throw new Error('Found a source and line, but no column');
}
cachedSegments[str] = segment;
} // Generated column.
mapping.generatedColumn = previousGeneratedColumn + segment[0];
previousGeneratedColumn = mapping.generatedColumn;
if (segment.length > 1) {
// Original source.
mapping.source = previousSource + segment[1];
previousSource += segment[1]; // Original line.
mapping.originalLine = previousOriginalLine + segment[2];
previousOriginalLine = mapping.originalLine; // Lines are stored 0-based
mapping.originalLine += 1; // Original column.
mapping.originalColumn = previousOriginalColumn + segment[3];
previousOriginalColumn = mapping.originalColumn;
if (segment.length > 4) {
// Original name.
mapping.name = previousName + segment[4];
previousName += segment[4];
}
}
generatedMappings.push(mapping);
if (typeof mapping.originalLine === 'number') {
originalMappings.push(mapping);
}
}
}
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
this.__generatedMappings = generatedMappings;
quickSort(originalMappings, util.compareByOriginalPositions);
this.__originalMappings = originalMappings;
};
/**
* Find the mapping that best matches the hypothetical "needle" mapping that
* we are searching for in the given "haystack" of mappings.
*/
BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
// To return the position we are searching for, we must first find the
// mapping for the given position and then return the opposite position it
// points to. Because the mappings are sorted, we can use binary search to
// find the best mapping.
if (aNeedle[aLineName] <= 0) {
throw new TypeError('Line must be greater than or equal to 1, got ' + aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError('Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
};
/**
* Compute the last column for each generated mapping. The last column is
* inclusive.
*/
BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
for (var index = 0; index < this._generatedMappings.length; ++index) {
var mapping = this._generatedMappings[index]; // Mappings do not contain a field for the last generated columnt. We
// can come up with an optimistic estimate, however, by assuming that
// mappings are contiguous (i.e. given two consecutive mappings, the
// first mapping ends where the second one starts).
if (index + 1 < this._generatedMappings.length) {
var nextMapping = this._generatedMappings[index + 1];
if (mapping.generatedLine === nextMapping.generatedLine) {
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
continue;
}
} // The last mapping for each line spans the entire line.
mapping.lastGeneratedColumn = Infinity;
}
};
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
var index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
if (index >= 0) {
var mapping = this._generatedMappings[index];
if (mapping.generatedLine === needle.generatedLine) {
var source = util.getArg(mapping, 'source', null);
if (source !== null) {
source = this._sources.at(source);
if (this.sourceRoot != null) {
source = util.join(this.sourceRoot, source);
}
}
var name = util.getArg(mapping, 'name', null);
if (name !== null) {
name = this._names.at(name);
}
return {
source: source,
line: util.getArg(mapping, 'originalLine', null),
column: util.getArg(mapping, 'originalColumn', null),
name: name
};
}
}
return {
source: null,
line: null,
column: null,
name: null
};
};
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
if (!this.sourcesContent) {
return false;
}
return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) {
return sc == null;
});
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
if (!this.sourcesContent) {
return null;
}
if (this.sourceRoot != null) {
aSource = util.relative(this.sourceRoot, aSource);
}
if (this._sources.has(aSource)) {
return this.sourcesContent[this._sources.indexOf(aSource)];
}
var url;
if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
// many users. We can help them out when they expect file:// URIs to
// behave like it would if they were running a local HTTP server. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
}
if ((!url.path || url.path == "/") && this._sources.has("/" + aSource)) {
return this.sourcesContent[this._sources.indexOf("/" + aSource)];
}
} // This function is used recursively from
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
// don't want to throw if we can't find the source - we just want to
// return null, so we provide a flag to exit gracefully.
if (nullOnMissing) {
return null;
} else {
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
var source = util.getArg(aArgs, 'source');
if (this.sourceRoot != null) {
source = util.relative(this.sourceRoot, source);
}
if (!this._sources.has(source)) {
return {
line: null,
column: null,
lastColumn: null
};
}
source = this._sources.indexOf(source);
var needle = {
source: source,
originalLine: util.getArg(aArgs, 'line'),
originalColumn: util.getArg(aArgs, 'column')
};
var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
if (index >= 0) {
var mapping = this._originalMappings[index];
if (mapping.source === needle.source) {
return {
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
};
}
}
return {
line: null,
column: null,
lastColumn: null
};
};
exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
/**
* An IndexedSourceMapConsumer instance represents a parsed source map which
* we can query for information. It differs from BasicSourceMapConsumer in
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
* input.
*
* The only parameter is a raw source map (either as a JSON string, or already
* parsed to an object). According to the spec for indexed source maps, they
* have the following attributes:
*
* - version: Which version of the source map spec this map is following.
* - file: Optional. The generated file this source map is associated with.
* - sections: A list of section definitions.
*
* Each value under the "sections" field has two fields:
* - offset: The offset into the original specified at which this section
* begins to apply, defined as an object with a "line" and "column"
* field.
* - map: A source map definition. This source map could also be indexed,
* but doesn't have to be.
*
* Instead of the "map" field, it's also possible to have a "url" field
* specifying a URL to retrieve a source map from, but that's currently
* unsupported.
*
* Here's an example source map, taken from the source map spec[0], but
* modified to omit a section which uses the "url" field.
*
* {
* version : 3,
* file: "app.js",
* sections: [{
* offset: {line:100, column:10},
* map: {
* version : 3,
* file: "section.js",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AAAA,E;;ABCDE;"
* }
* }],
* }
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
*/
function IndexedSourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
var version = util.getArg(sourceMap, 'version');
var sections = util.getArg(sourceMap, 'sections');
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
this._sources = new ArraySet();
this._names = new ArraySet();
var lastOffset = {
line: -1,
column: 0
};
this._sections = sections.map(function (s) {
if (s.url) {
// The url field will require support for asynchronicity.
// See https://github.com/mozilla/source-map/issues/16
throw new Error('Support for url field in sections not implemented.');
}
var offset = util.getArg(s, 'offset');
var offsetLine = util.getArg(offset, 'line');
var offsetColumn = util.getArg(offset, 'column');
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
throw new Error('Section offsets must be ordered and non-overlapping.');
}
lastOffset = offset;
return {
generatedOffset: {
// The offset fields are 0-based, but we use 1-based indices when
// encoding/decoding from VLQ.
generatedLine: offsetLine + 1,
generatedColumn: offsetColumn + 1
},
consumer: new SourceMapConsumer(util.getArg(s, 'map'))
};
});
}
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
/**
* The version of the source mapping spec that we are consuming.
*/
IndexedSourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
get: function get() {
var sources = [];
for (var i = 0; i < this._sections.length; i++) {
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
sources.push(this._sections[i].consumer.sources[j]);
}
}
return sources;
}
});
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
}; // Find the section containing the generated position we're trying to map
// to an original position.
var sectionIndex = binarySearch.search(needle, this._sections, function (needle, section) {
var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
if (cmp) {
return cmp;
}
return needle.generatedColumn - section.generatedOffset.generatedColumn;
});
var section = this._sections[sectionIndex];
if (!section) {
return {
source: null,
line: null,
column: null,
name: null
};
}
return section.consumer.originalPositionFor({
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
bias: aArgs.bias
});
};
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
return this._sections.every(function (s) {
return s.consumer.hasContentsOfAllSources();
});
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var content = section.consumer.sourceContentFor(aSource, true);
if (content) {
return content;
}
}
if (nullOnMissing) {
return null;
} else {
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i]; // Only consider this section if the requested source is in the list of
// sources of the consumer.
if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
continue;
}
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
if (generatedPosition) {
var ret = {
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
};
return ret;
}
}
return {
line: null,
column: null
};
};
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
this.__generatedMappings = [];
this.__originalMappings = [];
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var sectionMappings = section.consumer._generatedMappings;
for (var j = 0; j < sectionMappings.length; j++) {
var mapping = sectionMappings[j];
var source = section.consumer._sources.at(mapping.source);
if (section.consumer.sourceRoot !== null) {
source = util.join(section.consumer.sourceRoot, source);
}
this._sources.add(source);
source = this._sources.indexOf(source);
var name = section.consumer._names.at(mapping.name);
this._names.add(name);
name = this._names.indexOf(name); // The mappings coming from the consumer for the section have
// generated positions relative to the start of the section, so we
// need to offset them to be relative to the start of the concatenated
// generated file.
var adjustedMapping = {
source: source,
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: name
};
this.__generatedMappings.push(adjustedMapping);
if (typeof adjustedMapping.originalLine === 'number') {
this.__originalMappings.push(adjustedMapping);
}
}
}
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
quickSort(this.__originalMappings, util.compareByOriginalPositions);
};
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js":
/*!*************************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js ***!
\*************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var base64VLQ = __webpack_require__(/*! ./base64-vlq */ "./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js");
var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
var ArraySet = __webpack_require__(/*! ./array-set */ "./node_modules/snapdragon/node_modules/source-map/lib/array-set.js").ArraySet;
var MappingList = __webpack_require__(/*! ./mapping-list */ "./node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js").MappingList;
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. You may pass an object with the following
* properties:
*
* - file: The filename of the generated source.
* - sourceRoot: A root for all relative URLs in this source map.
*/
function SourceMapGenerator(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, 'file', null);
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
});
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
});
};
/**
* Set the source content for a source file.
*/
SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param aSourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
}
sourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot; // Make "sourceFile" relative if an absolute Url is passed.
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
} // Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet(); // Find mappings for the "sourceFile"
this._mappings.unsortedForEach(function (mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source);
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames; // Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aSourceMapPath != null) {
sourceFile = util.join(aSourceMapPath, sourceFile);
}
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
};
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
throw new Error('original.line and original.column are not numbers -- you probably meant to omit ' + 'the original mapping entirely and only map the generated position. If so, pass ' + 'null for the original mapping instead of an object with empty or null values.');
}
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
// Case 1.
return;
} else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
// Cases 2 and 3.
return;
} else {
throw new Error('Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
};
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var next;
var mapping;
var nameIdx;
var sourceIdx;
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = '';
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ';';
previousGeneratedLine++;
}
} else {
if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ',';
}
}
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
};
SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function (source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util.relative(aSourceRoot, source);
}
var key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
}, this);
};
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
exports.SourceMapGenerator = SourceMapGenerator;
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/source-node.js":
/*!****************************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/source-node.js ***!
\****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var SourceMapGenerator = __webpack_require__(/*! ./source-map-generator */ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator;
var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js"); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
// operating systems these days (capturing the result).
var REGEX_NEWLINE = /(\r?\n)/; // Newline character code for charCodeAt() comparisons
var NEWLINE_CODE = 10; // Private symbol for identifying `SourceNode`s when multiple versions of
// the source-map library are loaded. This MUST NOT CHANGE across
// versions!
var isSourceNode = "$$$isSourceNode$$$";
/**
* SourceNodes provide a way to abstract over interpolating/concatenating
* snippets of generated JavaScript source code while maintaining the line and
* column information associated with the original source code.
*
* @param aLine The original line number.
* @param aColumn The original column number.
* @param aSource The original source's filename.
* @param aChunks Optional. An array of strings which are snippets of
* generated JS, or other SourceNodes.
* @param aName The original identifier.
*/
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine == null ? null : aLine;
this.column = aColumn == null ? null : aColumn;
this.source = aSource == null ? null : aSource;
this.name = aName == null ? null : aName;
this[isSourceNode] = true;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
* @param aRelativePath Optional. The path that relative sources in the
* SourceMapConsumer should be relative to.
*/
SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
var node = new SourceNode(); // All even indices of this array are one line of the generated code,
// while all odd indices are the newlines between two adjacent lines
// (since `REGEX_NEWLINE` captures its match).
// Processed fragments are accessed by calling `shiftNextLine`.
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
var remainingLinesIndex = 0;
var shiftNextLine = function shiftNextLine() {
var lineContents = getNextLine(); // The last line of a file might not have a newline.
var newLine = getNextLine() || "";
return lineContents + newLine;
function getNextLine() {
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined;
}
}; // We need to remember the position of "remainingLines"
var lastGeneratedLine = 1,
lastGeneratedColumn = 0; // The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
var lastMapping = null;
aSourceMapConsumer.eachMapping(function (mapping) {
if (lastMapping !== null) {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine < mapping.generatedLine) {
// Associate first line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
lastGeneratedLine++;
lastGeneratedColumn = 0; // The remaining code is added without mapping
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
var nextLine = remainingLines[remainingLinesIndex];
var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code); // No more remaining code, continue
lastMapping = mapping;
return;
}
} // We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine < mapping.generatedLine) {
node.add(shiftNextLine());
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[remainingLinesIndex];
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
lastMapping = mapping;
}, this); // We have processed all mappings.
if (remainingLinesIndex < remainingLines.length) {
if (lastMapping) {
// Associate the remaining code in the current line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
} // and add the remaining lines without any mapping
node.add(remainingLines.splice(remainingLinesIndex).join(""));
} // Copy sourcesContent into SourceNode
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === undefined) {
node.add(code);
} else {
var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
}
}
};
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function (chunk) {
this.add(chunk);
}, this);
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
} else {
throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
}
return this;
};
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length - 1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
this.children.unshift(aChunk);
} else {
throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
}
return this;
};
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
var chunk;
for (var i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk[isSourceNode]) {
chunk.walk(aFn);
} else {
if (chunk !== '') {
aFn(chunk, {
source: this.source,
line: this.line,
column: this.column,
name: this.name
});
}
}
}
};
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len - 1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild[isSourceNode]) {
lastChild.replaceRight(aPattern, aReplacement);
} else if (typeof lastChild === 'string') {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
} else {
this.children.push(''.replace(aPattern, aReplacement));
}
return this;
};
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
};
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
for (var i = 0, len = this.children.length; i < len; i++) {
if (this.children[i][isSourceNode]) {
this.children[i].walkSourceContents(aFn);
}
}
var sources = Object.keys(this.sourceContents);
for (var i = 0, len = sources.length; i < len; i++) {
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
};
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function (chunk) {
str += chunk;
});
return str;
};
/**
* Returns the string representation of this source node along with a source
* map.
*/
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
var lastOriginalSource = null;
var lastOriginalLine = null;
var lastOriginalColumn = null;
var lastOriginalName = null;
this.walk(function (chunk, original) {
generated.code += chunk;
if (original.source !== null && original.line !== null && original.column !== null) {
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
for (var idx = 0, length = chunk.length; idx < length; idx++) {
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
generated.line++;
generated.column = 0; // Mappings end at eol
if (idx + 1 === length) {
lastOriginalSource = null;
sourceMappingActive = false;
} else if (sourceMappingActive) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
} else {
generated.column++;
}
}
});
this.walkSourceContents(function (sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return {
code: generated.code,
map: map
};
};
exports.SourceNode = SourceNode;
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/lib/util.js":
/*!*********************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/lib/util.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[2],
host: match[3],
port: match[4],
path: match[5]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = '';
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ':';
}
url += '//';
if (aParsedUrl.auth) {
url += aParsedUrl.auth + '@';
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port;
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
/**
* Normalizes a path, or the path portion of a URL:
*
* - Replaces consecutive slashes with one slash.
* - Removes unnecessary '.' parts.
* - Removes unnecessary '<dir>/..' parts.
*
* Based on code in the Node.js 'path' core module.
*
* @param aPath The path or url to normalize.
*/
function normalize(aPath) {
var path = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path = url.path;
}
var isAbsolute = exports.isAbsolute(path);
var parts = path.split(/\/+/);
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === '.') {
parts.splice(i, 1);
} else if (part === '..') {
up++;
} else if (up > 0) {
if (part === '') {
// The first part is blank if the path is absolute. Trying to go
// above the root is a no-op. Therefore we can remove all '..' parts
// directly after the root.
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path = parts.join('/');
if (path === '') {
path = isAbsolute ? '/' : '.';
}
if (url) {
url.path = path;
return urlGenerate(url);
}
return path;
}
exports.normalize = normalize;
/**
* Joins two paths/URLs.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be joined with the root.
*
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
* first.
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
* is updated with the result and aRoot is returned. Otherwise the result
* is returned.
* - If aPath is absolute, the result is aPath.
* - Otherwise the two paths are joined with a slash.
* - Joining for example 'http://' and 'www.example.com' is also supported.
*/
function join(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || '/';
} // `join(foo, '//www.example.org')`
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
} // `join('http://', 'www.example.com')`
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports.join = join;
exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
};
/**
* Make a path relative to a URL or another path.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be made relative to aRoot.
*/
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, ''); // It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from the root one by one, until either we find
// a prefix that fits, or we run out of components to remove.
var level = 0;
while (aPath.indexOf(aRoot + '/') !== 0) {
var index = aRoot.lastIndexOf("/");
if (index < 0) {
return aPath;
} // If the only part of the root that is left is the scheme (i.e. http://,
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
// have exhausted all components, so the path is not relative to the root.
aRoot = aRoot.slice(0, index);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
} // Make sure we add a "../" for each component we removed from the root.
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports.relative = relative;
var supportsNullProto = function () {
var obj = Object.create(null);
return !('__proto__' in obj);
}();
function identity(s) {
return s;
}
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
if (isProtoString(aStr)) {
return '$' + aStr;
}
return aStr;
}
exports.toSetString = supportsNullProto ? identity : toSetString;
function fromSetString(aStr) {
if (isProtoString(aStr)) {
return aStr.slice(1);
}
return aStr;
}
exports.fromSetString = supportsNullProto ? identity : fromSetString;
function isProtoString(s) {
if (!s) {
return false;
}
var length = s.length;
if (length < 9
/* "__proto__".length */
) {
return false;
}
if (s.charCodeAt(length - 1) !== 95
/* '_' */
|| s.charCodeAt(length - 2) !== 95
/* '_' */
|| s.charCodeAt(length - 3) !== 111
/* 'o' */
|| s.charCodeAt(length - 4) !== 116
/* 't' */
|| s.charCodeAt(length - 5) !== 111
/* 'o' */
|| s.charCodeAt(length - 6) !== 114
/* 'r' */
|| s.charCodeAt(length - 7) !== 112
/* 'p' */
|| s.charCodeAt(length - 8) !== 95
/* '_' */
|| s.charCodeAt(length - 9) !== 95
/* '_' */
) {
return false;
}
for (var i = length - 10; i >= 0; i--) {
if (s.charCodeAt(i) !== 36
/* '$' */
) {
return false;
}
}
return true;
}
/**
* Comparator between two mappings where the original positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same original source/line/column, but different generated
* line and column the same. Useful when searching for a mapping with a
* stubbed out mapping.
*/
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = mappingA.source - mappingB.source;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return mappingA.name - mappingB.name;
}
exports.compareByOriginalPositions = compareByOriginalPositions;
/**
* Comparator between two mappings with deflated source and name indices where
* the generated positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same generated line and column, but different
* source/name/original line and column the same. Useful when searching for a
* mapping with a stubbed out mapping.
*/
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = mappingA.source - mappingB.source;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return mappingA.name - mappingB.name;
}
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
/**
* Comparator between two mappings with inflated source and name strings where
* the generated positions are compared.
*/
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
/***/ }),
/***/ "./node_modules/snapdragon/node_modules/source-map/source-map.js":
/*!***********************************************************************!*\
!*** ./node_modules/snapdragon/node_modules/source-map/source-map.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = __webpack_require__(/*! ./lib/source-map-generator */ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator;
exports.SourceMapConsumer = __webpack_require__(/*! ./lib/source-map-consumer */ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer;
exports.SourceNode = __webpack_require__(/*! ./lib/source-node */ "./node_modules/snapdragon/node_modules/source-map/lib/source-node.js").SourceNode;
/***/ }),
/***/ "./node_modules/source-map-resolve/source-map-resolve.js":
/*!***************************************************************!*\
!*** ./node_modules/source-map-resolve/source-map-resolve.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(setImmediate) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Copyright 2014, 2015, 2016, 2017 Simon Lydell
// X11 (“MIT”) Licensed. (See LICENSE.)
// Note: source-map-resolve.js is generated from source-map-resolve-node.js and
// source-map-resolve-template.js. Only edit the two latter files, _not_
// source-map-resolve.js!
void function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! source-map-url */ "./node_modules/source-map-url/source-map-url.js"), __webpack_require__(/*! resolve-url */ "./node_modules/resolve-url/resolve-url.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var resolveUrl, sourceMappingURL; }
}(void 0, function (sourceMappingURL, resolveUrl) {
function callbackAsync(callback, error, result) {
setImmediate(function () {
callback(error, result);
});
}
function parseMapToJSON(string, data) {
try {
return JSON.parse(string.replace(/^\)\]\}'/, ""));
} catch (error) {
error.sourceMapData = data;
throw error;
}
}
function readSync(read, url, data) {
var readUrl = url;
try {
return String(read(readUrl));
} catch (error) {
error.sourceMapData = data;
throw error;
}
}
function resolveSourceMap(code, codeUrl, read, callback) {
var mapData;
try {
mapData = resolveSourceMapHelper(code, codeUrl);
} catch (error) {
return callbackAsync(callback, error);
}
if (!mapData || mapData.map) {
return callbackAsync(callback, null, mapData);
}
var readUrl = mapData.url;
read(readUrl, function (error, result) {
if (error) {
error.sourceMapData = mapData;
return callback(error);
}
mapData.map = String(result);
try {
mapData.map = parseMapToJSON(mapData.map, mapData);
} catch (error) {
return callback(error);
}
callback(null, mapData);
});
}
function resolveSourceMapSync(code, codeUrl, read) {
var mapData = resolveSourceMapHelper(code, codeUrl);
if (!mapData || mapData.map) {
return mapData;
}
mapData.map = readSync(read, mapData.url, mapData);
mapData.map = parseMapToJSON(mapData.map, mapData);
return mapData;
}
var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/;
var jsonMimeTypeRegex = /^(?:application|text)\/json$/;
function resolveSourceMapHelper(code, codeUrl) {
var url = sourceMappingURL.getFrom(code);
if (!url) {
return null;
}
var dataUri = url.match(dataUriRegex);
if (dataUri) {
var mimeType = dataUri[1];
var lastParameter = dataUri[2] || "";
var encoded = dataUri[3] || "";
var data = {
sourceMappingURL: url,
url: null,
sourcesRelativeTo: codeUrl,
map: encoded
};
if (!jsonMimeTypeRegex.test(mimeType)) {
var error = new Error("Unuseful data uri mime type: " + (mimeType || "text/plain"));
error.sourceMapData = data;
throw error;
}
data.map = parseMapToJSON(lastParameter === ";base64" ? atob(encoded) : decodeURIComponent(encoded), data);
return data;
}
var mapUrl = resolveUrl(codeUrl, url);
return {
sourceMappingURL: url,
url: mapUrl,
sourcesRelativeTo: mapUrl,
map: null
};
}
function resolveSources(map, mapUrl, read, options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
}
var pending = map.sources ? map.sources.length : 0;
var result = {
sourcesResolved: [],
sourcesContent: []
};
if (pending === 0) {
callbackAsync(callback, null, result);
return;
}
var done = function done() {
pending--;
if (pending === 0) {
callback(null, result);
}
};
resolveSourcesHelper(map, mapUrl, options, function (fullUrl, sourceContent, index) {
result.sourcesResolved[index] = fullUrl;
if (typeof sourceContent === "string") {
result.sourcesContent[index] = sourceContent;
callbackAsync(done, null);
} else {
var readUrl = fullUrl;
read(readUrl, function (error, source) {
result.sourcesContent[index] = error ? error : String(source);
done();
});
}
});
}
function resolveSourcesSync(map, mapUrl, read, options) {
var result = {
sourcesResolved: [],
sourcesContent: []
};
if (!map.sources || map.sources.length === 0) {
return result;
}
resolveSourcesHelper(map, mapUrl, options, function (fullUrl, sourceContent, index) {
result.sourcesResolved[index] = fullUrl;
if (read !== null) {
if (typeof sourceContent === "string") {
result.sourcesContent[index] = sourceContent;
} else {
var readUrl = fullUrl;
try {
result.sourcesContent[index] = String(read(readUrl));
} catch (error) {
result.sourcesContent[index] = error;
}
}
}
});
return result;
}
var endingSlash = /\/?$/;
function resolveSourcesHelper(map, mapUrl, options, fn) {
options = options || {};
var fullUrl;
var sourceContent;
var sourceRoot;
for (var index = 0, len = map.sources.length; index < len; index++) {
sourceRoot = null;
if (typeof options.sourceRoot === "string") {
sourceRoot = options.sourceRoot;
} else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) {
sourceRoot = map.sourceRoot;
} // If the sourceRoot is the empty string, it is equivalent to not setting
// the property at all.
if (sourceRoot === null || sourceRoot === '') {
fullUrl = resolveUrl(mapUrl, map.sources[index]);
} else {
// Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes
// `/scripts/subdir/<source>`, not `/scripts/<source>`. Pointing to a file as source root
// does not make sense.
fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index]);
}
sourceContent = (map.sourcesContent || [])[index];
fn(fullUrl, sourceContent, index);
}
}
function resolve(code, codeUrl, read, options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
}
if (code === null) {
var mapUrl = codeUrl;
var data = {
sourceMappingURL: null,
url: mapUrl,
sourcesRelativeTo: mapUrl,
map: null
};
var readUrl = mapUrl;
read(readUrl, function (error, result) {
if (error) {
error.sourceMapData = data;
return callback(error);
}
data.map = String(result);
try {
data.map = parseMapToJSON(data.map, data);
} catch (error) {
return callback(error);
}
_resolveSources(data);
});
} else {
resolveSourceMap(code, codeUrl, read, function (error, mapData) {
if (error) {
return callback(error);
}
if (!mapData) {
return callback(null, null);
}
_resolveSources(mapData);
});
}
function _resolveSources(mapData) {
resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function (error, result) {
if (error) {
return callback(error);
}
mapData.sourcesResolved = result.sourcesResolved;
mapData.sourcesContent = result.sourcesContent;
callback(null, mapData);
});
}
}
function resolveSync(code, codeUrl, read, options) {
var mapData;
if (code === null) {
var mapUrl = codeUrl;
mapData = {
sourceMappingURL: null,
url: mapUrl,
sourcesRelativeTo: mapUrl,
map: null
};
mapData.map = readSync(read, mapUrl, mapData);
mapData.map = parseMapToJSON(mapData.map, mapData);
} else {
mapData = resolveSourceMapSync(code, codeUrl, read);
if (!mapData) {
return null;
}
}
var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options);
mapData.sourcesResolved = result.sourcesResolved;
mapData.sourcesContent = result.sourcesContent;
return mapData;
}
return {
resolveSourceMap: resolveSourceMap,
resolveSourceMapSync: resolveSourceMapSync,
resolveSources: resolveSources,
resolveSourcesSync: resolveSourcesSync,
resolve: resolve,
resolveSync: resolveSync,
parseMapToJSON: parseMapToJSON
};
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate))
/***/ }),
/***/ "./node_modules/source-map-url/source-map-url.js":
/*!*******************************************************!*\
!*** ./node_modules/source-map-url/source-map-url.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Copyright 2014 Simon Lydell
// X11 (“MIT”) Licensed. (See LICENSE.)
void function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
__WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(void 0, function () {
var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
var regex = RegExp("(?:" + "/\\*" + "(?:\\s*\r?\n(?://)?)?" + "(?:" + innerRegex.source + ")" + "\\s*" + "\\*/" + "|" + "//(?:" + innerRegex.source + ")" + ")" + "\\s*");
return {
regex: regex,
_innerRegex: innerRegex,
getFrom: function getFrom(code) {
var match = code.match(regex);
return match ? match[1] || match[2] || "" : null;
},
existsIn: function existsIn(code) {
return regex.test(code);
},
removeFrom: function removeFrom(code) {
return code.replace(regex, "");
},
insertBefore: function insertBefore(code, string) {
var match = code.match(regex);
if (match) {
return code.slice(0, match.index) + string + code.slice(match.index);
} else {
return code + string;
}
}
};
});
/***/ }),
/***/ "./node_modules/split-string/index.js":
/*!********************************************!*\
!*** ./node_modules/split-string/index.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* split-string <https://github.com/jonschlinkert/split-string>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/split-string/node_modules/extend-shallow/index.js");
module.exports = function (str, options, fn) {
if (typeof str !== 'string') {
throw new TypeError('expected a string');
}
if (typeof options === 'function') {
fn = options;
options = null;
} // allow separator to be defined as a string
if (typeof options === 'string') {
options = {
sep: options
};
}
var opts = extend({
sep: '.'
}, options);
var quotes = opts.quotes || ['"', "'", '`'];
var brackets;
if (opts.brackets === true) {
brackets = {
'<': '>',
'(': ')',
'[': ']',
'{': '}'
};
} else if (opts.brackets) {
brackets = opts.brackets;
}
var tokens = [];
var stack = [];
var arr = [''];
var sep = opts.sep;
var len = str.length;
var idx = -1;
var closeIdx;
function expected() {
if (brackets && stack.length) {
return brackets[stack[stack.length - 1]];
}
}
while (++idx < len) {
var ch = str[idx];
var next = str[idx + 1];
var tok = {
val: ch,
idx: idx,
arr: arr,
str: str
};
tokens.push(tok);
if (ch === '\\') {
tok.val = keepEscaping(opts, str, idx) === true ? ch + next : next;
tok.escaped = true;
if (typeof fn === 'function') {
fn(tok);
}
arr[arr.length - 1] += tok.val;
idx++;
continue;
}
if (brackets && brackets[ch]) {
stack.push(ch);
var e = expected();
var i = idx + 1;
if (str.indexOf(e, i + 1) !== -1) {
while (stack.length && i < len) {
var s = str[++i];
if (s === '\\') {
s++;
continue;
}
if (quotes.indexOf(s) !== -1) {
i = getClosingQuote(str, s, i + 1);
continue;
}
e = expected();
if (stack.length && str.indexOf(e, i + 1) === -1) {
break;
}
if (brackets[s]) {
stack.push(s);
continue;
}
if (e === s) {
stack.pop();
}
}
}
closeIdx = i;
if (closeIdx === -1) {
arr[arr.length - 1] += ch;
continue;
}
ch = str.slice(idx, closeIdx + 1);
tok.val = ch;
tok.idx = idx = closeIdx;
}
if (quotes.indexOf(ch) !== -1) {
closeIdx = getClosingQuote(str, ch, idx + 1);
if (closeIdx === -1) {
arr[arr.length - 1] += ch;
continue;
}
if (keepQuotes(ch, opts) === true) {
ch = str.slice(idx, closeIdx + 1);
} else {
ch = str.slice(idx + 1, closeIdx);
}
tok.val = ch;
tok.idx = idx = closeIdx;
}
if (typeof fn === 'function') {
fn(tok, tokens);
ch = tok.val;
idx = tok.idx;
}
if (tok.val === sep && tok.split !== false) {
arr.push('');
continue;
}
arr[arr.length - 1] += tok.val;
}
return arr;
};
function getClosingQuote(str, ch, i, brackets) {
var idx = str.indexOf(ch, i);
if (str.charAt(idx - 1) === '\\') {
return getClosingQuote(str, ch, idx + 1);
}
return idx;
}
function keepQuotes(ch, opts) {
if (opts.keepDoubleQuotes === true && ch === '"') return true;
if (opts.keepSingleQuotes === true && ch === "'") return true;
return opts.keepQuotes;
}
function keepEscaping(opts, str, idx) {
if (typeof opts.keepEscaping === 'function') {
return opts.keepEscaping(str, idx);
}
return opts.keepEscaping === true || str[idx + 1] === '\\';
}
/***/ }),
/***/ "./node_modules/split-string/node_modules/extend-shallow/index.js":
/*!************************************************************************!*\
!*** ./node_modules/split-string/node_modules/extend-shallow/index.js ***!
\************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/split-string/node_modules/is-extendable/index.js");
var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
module.exports = Object.assign || function (obj
/*, objects*/
) {
if (obj === null || typeof obj === 'undefined') {
throw new TypeError('Cannot convert undefined or null to object');
}
if (!isObject(obj)) {
obj = {};
}
for (var i = 1; i < arguments.length; i++) {
var val = arguments[i];
if (isString(val)) {
val = toObject(val);
}
if (isObject(val)) {
assign(obj, val);
assignSymbols(obj, val);
}
}
return obj;
};
function assign(a, b) {
for (var key in b) {
if (hasOwn(b, key)) {
a[key] = b[key];
}
}
}
function isString(val) {
return val && typeof val === 'string';
}
function toObject(str) {
var obj = {};
for (var i in str) {
obj[i] = str[i];
}
return obj;
}
function isObject(val) {
return val && _typeof(val) === 'object' || isExtendable(val);
}
/**
* Returns true if the given `key` is an own property of `obj`.
*/
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isEnum(obj, key) {
return Object.prototype.propertyIsEnumerable.call(obj, key);
}
/***/ }),
/***/ "./node_modules/split-string/node_modules/is-extendable/index.js":
/*!***********************************************************************!*\
!*** ./node_modules/split-string/node_modules/is-extendable/index.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
};
/***/ }),
/***/ "./node_modules/stack-utils/index.js":
/*!*******************************************!*\
!*** ./node_modules/stack-utils/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
module.exports = StackUtils;
function StackUtils(opts) {
if (!(this instanceof StackUtils)) {
throw new Error('StackUtils constructor must be called with new');
}
opts = opts || {};
this._cwd = (opts.cwd || process.cwd()).replace(/\\/g, '/');
this._internals = opts.internals || [];
this._wrapCallSite = opts.wrapCallSite || false;
}
module.exports.nodeInternals = nodeInternals;
function nodeInternals() {
if (!module.exports.natives) {
module.exports.natives = Object.keys(process.binding('natives'));
module.exports.natives.push('bootstrap_node', 'node', 'internal/bootstrap/node');
}
return module.exports.natives.map(function (n) {
return new RegExp('\\(' + n + '\\.js:\\d+:\\d+\\)$');
}).concat([/\s*at (bootstrap_)?node\.js:\d+:\d+?$/, /\(internal\/[^:]+:\d+:\d+\)$/, /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/]);
}
StackUtils.prototype.clean = function (stack) {
if (!Array.isArray(stack)) {
stack = stack.split('\n');
}
if (!/^\s*at /.test(stack[0]) && /^\s*at /.test(stack[1])) {
stack = stack.slice(1);
}
var outdent = false;
var lastNonAtLine = null;
var result = [];
stack.forEach(function (st) {
st = st.replace(/\\/g, '/');
var isInternal = this._internals.some(function (internal) {
return internal.test(st);
});
if (isInternal) {
return null;
}
var isAtLine = /^\s*at /.test(st);
if (outdent) {
st = st.replace(/\s+$/, '').replace(/^(\s+)at /, '$1');
} else {
st = st.trim();
if (isAtLine) {
st = st.substring(3);
}
}
st = st.replace(this._cwd + '/', '');
if (st) {
if (isAtLine) {
if (lastNonAtLine) {
result.push(lastNonAtLine);
lastNonAtLine = null;
}
result.push(st);
} else {
outdent = true;
lastNonAtLine = st;
}
}
}, this);
stack = result.join('\n').trim();
if (stack) {
return stack + '\n';
}
return '';
};
StackUtils.prototype.captureString = function (limit, fn) {
if (typeof limit === 'function') {
fn = limit;
limit = Infinity;
}
if (!fn) {
fn = this.captureString;
}
var limitBefore = Error.stackTraceLimit;
if (limit) {
Error.stackTraceLimit = limit;
}
var obj = {};
Error.captureStackTrace(obj, fn);
var stack = obj.stack;
Error.stackTraceLimit = limitBefore;
return this.clean(stack);
};
StackUtils.prototype.capture = function (limit, fn) {
if (typeof limit === 'function') {
fn = limit;
limit = Infinity;
}
if (!fn) {
fn = this.capture;
}
var prepBefore = Error.prepareStackTrace;
var limitBefore = Error.stackTraceLimit;
var wrapCallSite = this._wrapCallSite;
Error.prepareStackTrace = function (obj, site) {
if (wrapCallSite) {
return site.map(wrapCallSite);
}
return site;
};
if (limit) {
Error.stackTraceLimit = limit;
}
var obj = {};
Error.captureStackTrace(obj, fn);
var stack = obj.stack;
Error.prepareStackTrace = prepBefore;
Error.stackTraceLimit = limitBefore;
return stack;
};
StackUtils.prototype.at = function at(fn) {
if (!fn) {
fn = at;
}
var site = this.capture(1, fn)[0];
if (!site) {
return {};
}
var res = {
line: site.getLineNumber(),
column: site.getColumnNumber()
};
this._setFile(res, site.getFileName());
if (site.isConstructor()) {
res.constructor = true;
}
if (site.isEval()) {
res.evalOrigin = site.getEvalOrigin();
} // Node v10 stopped with the isNative() on callsites, apparently
/* istanbul ignore next */
if (site.isNative()) {
res.native = true;
}
var typename = null;
try {
typename = site.getTypeName();
} catch (er) {}
if (typename && typename !== 'Object' && typename !== '[object Object]') {
res.type = typename;
}
var fname = site.getFunctionName();
if (fname) {
res.function = fname;
}
var meth = site.getMethodName();
if (meth && fname !== meth) {
res.method = meth;
}
return res;
};
StackUtils.prototype._setFile = function (result, filename) {
if (filename) {
filename = filename.replace(/\\/g, '/');
if (filename.indexOf(this._cwd + '/') === 0) {
filename = filename.substr(this._cwd.length + 1);
}
result.file = filename;
}
};
var re = new RegExp('^' + // Sometimes we strip out the ' at' because it's noisy
'(?:\\s*at )?' + // $1 = ctor if 'new'
'(?:(new) )?' + // $2 = function name (can be literally anything)
// May contain method at the end as [as xyz]
'(?:(.*?) \\()?' + // (eval at <anonymous> (file.js:1:1),
// $3 = eval origin
// $4:$5:$6 are eval file/line/col, but not normally reported
'(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' + // file:line:col
// $7:$8:$9
// $10 = 'native' if native
'(?:(.+?):(\\d+):(\\d+)|(native))' + // maybe close the paren, then end
// if $11 is ), then we only allow balanced parens in the filename
// any imbalance is placed on the fname. This is a heuristic, and
// bound to be incorrect in some edge cases. The bet is that
// having weird characters in method names is more common than
// having weird characters in filenames, which seems reasonable.
'(\\)?)$');
var methodRe = /^(.*?) \[as (.*?)\]$/;
StackUtils.prototype.parseLine = function parseLine(line) {
var match = line && line.match(re);
if (!match) {
return null;
}
var ctor = match[1] === 'new';
var fname = match[2];
var evalOrigin = match[3];
var evalFile = match[4];
var evalLine = Number(match[5]);
var evalCol = Number(match[6]);
var file = match[7];
var lnum = match[8];
var col = match[9];
var native = match[10] === 'native';
var closeParen = match[11] === ')';
var res = {};
if (lnum) {
res.line = Number(lnum);
}
if (col) {
res.column = Number(col);
}
if (closeParen && file) {
// make sure parens are balanced
// if we have a file like "asdf) [as foo] (xyz.js", then odds are
// that the fname should be += " (asdf) [as foo]" and the file
// should be just "xyz.js"
// walk backwards from the end to find the last unbalanced (
var closes = 0;
for (var i = file.length - 1; i > 0; i--) {
if (file.charAt(i) === ')') {
closes++;
} else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
closes--;
if (closes === -1 && file.charAt(i - 1) === ' ') {
var before = file.substr(0, i - 1);
var after = file.substr(i + 1);
file = after;
fname += ' (' + before;
break;
}
}
}
}
if (fname) {
var methodMatch = fname.match(methodRe);
if (methodMatch) {
fname = methodMatch[1];
var meth = methodMatch[2];
}
}
this._setFile(res, file);
if (ctor) {
res.constructor = true;
}
if (evalOrigin) {
res.evalOrigin = evalOrigin;
res.evalLine = evalLine;
res.evalColumn = evalCol;
res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
}
if (native) {
res.native = true;
}
if (fname) {
res.function = fname;
}
if (meth && fname !== meth) {
res.method = meth;
}
return res;
};
var bound = new StackUtils();
Object.keys(StackUtils.prototype).forEach(function (key) {
StackUtils[key] = bound[key].bind(bound);
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/static-extend/index.js":
/*!*********************************************!*\
!*** ./node_modules/static-extend/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* static-extend <https://github.com/jonschlinkert/static-extend>
*
* Copyright (c) 2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var copy = __webpack_require__(/*! object-copy */ "./node_modules/object-copy/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
/**
* Returns a function for extending the static properties,
* prototype properties, and descriptors from the `Parent`
* constructor onto `Child` constructors.
*
* ```js
* var extend = require('static-extend');
* Parent.extend = extend(Parent);
*
* // optionally pass a custom merge function as the second arg
* Parent.extend = extend(Parent, function(Child) {
* Child.prototype.mixin = function(key, val) {
* Child.prototype[key] = val;
* };
* });
*
* // extend "child" constructors
* Parent.extend(Child);
*
* // optionally define prototype methods as the second arg
* Parent.extend(Child, {
* foo: function() {},
* bar: function() {}
* });
* ```
* @param {Function} `Parent` Parent ctor
* @param {Function} `extendFn` Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype.
* @param {Function} `Child` Child ctor
* @param {Object} `proto` Optionally pass additional prototype properties to inherit.
* @return {Object}
* @api public
*/
function extend(Parent, extendFn) {
if (typeof Parent !== 'function') {
throw new TypeError('expected Parent to be a function.');
}
return function (Ctor, proto) {
if (typeof Ctor !== 'function') {
throw new TypeError('expected Ctor to be a function.');
}
util.inherits(Ctor, Parent);
copy(Ctor, Parent); // proto can be null or a plain object
if (_typeof(proto) === 'object') {
var obj = Object.create(proto);
for (var k in obj) {
Ctor.prototype[k] = obj[k];
}
} // keep a reference to the parent prototype
define(Ctor.prototype, '_parent_', {
configurable: true,
set: function set() {},
get: function get() {
return Parent.prototype;
}
});
if (typeof extendFn === 'function') {
extendFn(Ctor, Parent);
}
Ctor.extend = extend(Ctor, extendFn);
};
}
;
/**
* Expose `extend`
*/
module.exports = extend;
/***/ }),
/***/ "./node_modules/timers-browserify/main.js":
/*!************************************************!*\
!*** ./node_modules/timers-browserify/main.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var scope = typeof global !== "undefined" && global || typeof self !== "undefined" && self || window;
var apply = Function.prototype.apply; // DOM APIs, for completeness
exports.setTimeout = function () {
return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
};
exports.setInterval = function () {
return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
};
exports.clearTimeout = exports.clearInterval = function (timeout) {
if (timeout) {
timeout.close();
}
};
function Timeout(id, clearFn) {
this._id = id;
this._clearFn = clearFn;
}
Timeout.prototype.unref = Timeout.prototype.ref = function () {};
Timeout.prototype.close = function () {
this._clearFn.call(scope, this._id);
}; // Does not start the time, just sets up the members needed.
exports.enroll = function (item, msecs) {
clearTimeout(item._idleTimeoutId);
item._idleTimeout = msecs;
};
exports.unenroll = function (item) {
clearTimeout(item._idleTimeoutId);
item._idleTimeout = -1;
};
exports._unrefActive = exports.active = function (item) {
clearTimeout(item._idleTimeoutId);
var msecs = item._idleTimeout;
if (msecs >= 0) {
item._idleTimeoutId = setTimeout(function onTimeout() {
if (item._onTimeout) item._onTimeout();
}, msecs);
}
}; // setimmediate attaches itself to the global object
__webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js"); // On some exotic environments, it's not clear which object `setimmediate` was
// able to install onto. Search each possibility in the same order as the
// `setimmediate` library.
exports.setImmediate = typeof self !== "undefined" && self.setImmediate || typeof global !== "undefined" && global.setImmediate || void 0 && (void 0).setImmediate;
exports.clearImmediate = typeof self !== "undefined" && self.clearImmediate || typeof global !== "undefined" && global.clearImmediate || void 0 && (void 0).clearImmediate;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/to-object-path/index.js":
/*!**********************************************!*\
!*** ./node_modules/to-object-path/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* to-object-path <https://github.com/jonschlinkert/to-object-path>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
module.exports = function toPath(args) {
if (typeOf(args) !== 'arguments') {
args = arguments;
}
return filter(args).join('.');
};
function filter(arr) {
var len = arr.length;
var idx = -1;
var res = [];
while (++idx < len) {
var ele = arr[idx];
if (typeOf(ele) === 'arguments' || Array.isArray(ele)) {
res.push.apply(res, filter(ele));
} else if (typeof ele === 'string') {
res.push(ele);
}
}
return res;
}
/***/ }),
/***/ "./node_modules/to-regex-range/index.js":
/*!**********************************************!*\
!*** ./node_modules/to-regex-range/index.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* to-regex-range <https://github.com/jonschlinkert/to-regex-range>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var repeat = __webpack_require__(/*! repeat-string */ "./node_modules/repeat-string/index.js");
var isNumber = __webpack_require__(/*! is-number */ "./node_modules/is-number/index.js");
var cache = {};
function toRegexRange(min, max, options) {
if (isNumber(min) === false) {
throw new RangeError('toRegexRange: first argument is invalid.');
}
if (typeof max === 'undefined' || min === max) {
return String(min);
}
if (isNumber(max) === false) {
throw new RangeError('toRegexRange: second argument is invalid.');
}
options = options || {};
var relax = String(options.relaxZeros);
var shorthand = String(options.shorthand);
var capture = String(options.capture);
var key = min + ':' + max + '=' + relax + shorthand + capture;
if (cache.hasOwnProperty(key)) {
return cache[key].result;
}
var a = Math.min(min, max);
var b = Math.max(min, max);
if (Math.abs(a - b) === 1) {
var result = min + '|' + max;
if (options.capture) {
return '(' + result + ')';
}
return result;
}
var isPadded = padding(min) || padding(max);
var positives = [];
var negatives = [];
var tok = {
min: min,
max: max,
a: a,
b: b
};
if (isPadded) {
tok.isPadded = isPadded;
tok.maxLen = String(tok.max).length;
}
if (a < 0) {
var newMin = b < 0 ? Math.abs(b) : 1;
var newMax = Math.abs(a);
negatives = splitToPatterns(newMin, newMax, tok, options);
a = tok.a = 0;
}
if (b >= 0) {
positives = splitToPatterns(a, b, tok, options);
}
tok.negatives = negatives;
tok.positives = positives;
tok.result = siftPatterns(negatives, positives, options);
if (options.capture && positives.length + negatives.length > 1) {
tok.result = '(' + tok.result + ')';
}
cache[key] = tok;
return tok.result;
}
function siftPatterns(neg, pos, options) {
var onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
var onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
var intersected = filterPatterns(neg, pos, '-?', true, options) || [];
var subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
return subpatterns.join('|');
}
function splitToRanges(min, max) {
min = Number(min);
max = Number(max);
var nines = 1;
var stops = [max];
var stop = +countNines(min, nines);
while (min <= stop && stop <= max) {
stops = push(stops, stop);
nines += 1;
stop = +countNines(min, nines);
}
var zeros = 1;
stop = countZeros(max + 1, zeros) - 1;
while (min < stop && stop <= max) {
stops = push(stops, stop);
zeros += 1;
stop = countZeros(max + 1, zeros) - 1;
}
stops.sort(compare);
return stops;
}
/**
* Convert a range to a regex pattern
* @param {Number} `start`
* @param {Number} `stop`
* @return {String}
*/
function rangeToPattern(start, stop, options) {
if (start === stop) {
return {
pattern: String(start),
digits: []
};
}
var zipped = zip(String(start), String(stop));
var len = zipped.length,
i = -1;
var pattern = '';
var digits = 0;
while (++i < len) {
var numbers = zipped[i];
var startDigit = numbers[0];
var stopDigit = numbers[1];
if (startDigit === stopDigit) {
pattern += startDigit;
} else if (startDigit !== '0' || stopDigit !== '9') {
pattern += toCharacterClass(startDigit, stopDigit);
} else {
digits += 1;
}
}
if (digits) {
pattern += options.shorthand ? '\\d' : '[0-9]';
}
return {
pattern: pattern,
digits: [digits]
};
}
function splitToPatterns(min, max, tok, options) {
var ranges = splitToRanges(min, max);
var len = ranges.length;
var idx = -1;
var tokens = [];
var start = min;
var prev;
while (++idx < len) {
var range = ranges[idx];
var obj = rangeToPattern(start, range, options);
var zeros = '';
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
if (prev.digits.length > 1) {
prev.digits.pop();
}
prev.digits.push(obj.digits[0]);
prev.string = prev.pattern + toQuantifier(prev.digits);
start = range + 1;
continue;
}
if (tok.isPadded) {
zeros = padZeros(range, tok);
}
obj.string = zeros + obj.pattern + toQuantifier(obj.digits);
tokens.push(obj);
start = range + 1;
prev = obj;
}
return tokens;
}
function filterPatterns(arr, comparison, prefix, intersection, options) {
var res = [];
for (var i = 0; i < arr.length; i++) {
var tok = arr[i];
var ele = tok.string;
if (options.relaxZeros !== false) {
if (prefix === '-' && ele.charAt(0) === '0') {
if (ele.charAt(1) === '{') {
ele = '0*' + ele.replace(/^0\{\d+\}/, '');
} else {
ele = '0*' + ele.slice(1);
}
}
}
if (!intersection && !contains(comparison, 'string', ele)) {
res.push(prefix + ele);
}
if (intersection && contains(comparison, 'string', ele)) {
res.push(prefix + ele);
}
}
return res;
}
/**
* Zip strings (`for in` can be used on string characters)
*/
function zip(a, b) {
var arr = [];
for (var ch in a) {
arr.push([a[ch], b[ch]]);
}
return arr;
}
function compare(a, b) {
return a > b ? 1 : b > a ? -1 : 0;
}
function push(arr, ele) {
if (arr.indexOf(ele) === -1) arr.push(ele);
return arr;
}
function contains(arr, key, val) {
for (var i = 0; i < arr.length; i++) {
if (arr[i][key] === val) {
return true;
}
}
return false;
}
function countNines(min, len) {
return String(min).slice(0, -len) + repeat('9', len);
}
function countZeros(integer, zeros) {
return integer - integer % Math.pow(10, zeros);
}
function toQuantifier(digits) {
var start = digits[0];
var stop = digits[1] ? ',' + digits[1] : '';
if (!stop && (!start || start === 1)) {
return '';
}
return '{' + start + stop + '}';
}
function toCharacterClass(a, b) {
return '[' + a + (b - a === 1 ? '' : '-') + b + ']';
}
function padding(str) {
return /^-?(0+)\d/.exec(str);
}
function padZeros(val, tok) {
if (tok.isPadded) {
var diff = Math.abs(tok.maxLen - String(val).length);
switch (diff) {
case 0:
return '';
case 1:
return '0';
default:
{
return '0{' + diff + '}';
}
}
}
return val;
}
/**
* Expose `toRegexRange`
*/
module.exports = toRegexRange;
/***/ }),
/***/ "./node_modules/to-regex/index.js":
/*!****************************************!*\
!*** ./node_modules/to-regex/index.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var safe = __webpack_require__(/*! safe-regex */ "./node_modules/safe-regex/index.js");
var define = __webpack_require__(/*! define-property */ "./node_modules/to-regex/node_modules/define-property/index.js");
var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/to-regex/node_modules/extend-shallow/index.js");
var not = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
var MAX_LENGTH = 1024 * 64;
/**
* Session cache
*/
var cache = {};
/**
* Create a regular expression from the given `pattern` string.
*
* @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
module.exports = function (patterns, options) {
if (!Array.isArray(patterns)) {
return makeRe(patterns, options);
}
return makeRe(patterns.join('|'), options);
};
/**
* Create a regular expression from the given `pattern` string.
*
* @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
function makeRe(pattern, options) {
if (pattern instanceof RegExp) {
return pattern;
}
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
if (pattern.length > MAX_LENGTH) {
throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
}
var key = pattern; // do this before shallow cloning options, it's a lot faster
if (!options || options && options.cache !== false) {
key = createKey(pattern, options);
if (cache.hasOwnProperty(key)) {
return cache[key];
}
}
var opts = extend({}, options);
if (opts.contains === true) {
if (opts.negate === true) {
opts.strictNegate = false;
} else {
opts.strict = false;
}
}
if (opts.strict === false) {
opts.strictOpen = false;
opts.strictClose = false;
}
var open = opts.strictOpen !== false ? '^' : '';
var close = opts.strictClose !== false ? '$' : '';
var flags = opts.flags || '';
var regex;
if (opts.nocase === true && !/i/.test(flags)) {
flags += 'i';
}
try {
if (opts.negate || typeof opts.strictNegate === 'boolean') {
pattern = not.create(pattern, opts);
}
var str = open + '(?:' + pattern + ')' + close;
regex = new RegExp(str, flags);
if (opts.safe === true && safe(regex) === false) {
throw new Error('potentially unsafe regular expression: ' + regex.source);
}
} catch (err) {
if (opts.strictErrors === true || opts.safe === true) {
err.key = key;
err.pattern = pattern;
err.originalOptions = options;
err.createdOptions = opts;
throw err;
}
try {
regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$');
} catch (err) {
regex = /.^/; //<= match nothing
}
}
if (opts.cache !== false) {
memoize(regex, key, pattern, opts);
}
return regex;
}
/**
* Memoize generated regex. This can result in dramatic speed improvements
* and simplify debugging by adding options and pattern to the regex. It can be
* disabled by passing setting `options.cache` to false.
*/
function memoize(regex, key, pattern, options) {
define(regex, 'cached', true);
define(regex, 'pattern', pattern);
define(regex, 'options', options);
define(regex, 'key', key);
cache[key] = regex;
}
/**
* Create the key to use for memoization. The key is generated
* by iterating over the options and concatenating key-value pairs
* to the pattern string.
*/
function createKey(pattern, options) {
if (!options) return pattern;
var key = pattern;
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
key += ';' + prop + '=' + String(options[prop]);
}
}
return key;
}
/**
* Expose `makeRe`
*/
module.exports.makeRe = makeRe;
/***/ }),
/***/ "./node_modules/to-regex/node_modules/define-property/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/to-regex/node_modules/define-property/index.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* define-property <https://github.com/jonschlinkert/define-property>
*
* Copyright (c) 2015-2018, Jon Schlinkert.
* Released under the MIT License.
*/
var isobject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
var define = typeof Reflect !== 'undefined' && Reflect.defineProperty ? Reflect.defineProperty : Object.defineProperty;
module.exports = function defineProperty(obj, key, val) {
if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
throw new TypeError('expected an object, function, or array');
}
if (typeof key !== 'string') {
throw new TypeError('expected "key" to be a string');
}
if (isDescriptor(val)) {
define(obj, key, val);
return obj;
}
define(obj, key, {
configurable: true,
enumerable: false,
writable: true,
value: val
});
return obj;
};
/***/ }),
/***/ "./node_modules/to-regex/node_modules/extend-shallow/index.js":
/*!********************************************************************!*\
!*** ./node_modules/to-regex/node_modules/extend-shallow/index.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/to-regex/node_modules/is-extendable/index.js");
var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
module.exports = Object.assign || function (obj
/*, objects*/
) {
if (obj === null || typeof obj === 'undefined') {
throw new TypeError('Cannot convert undefined or null to object');
}
if (!isObject(obj)) {
obj = {};
}
for (var i = 1; i < arguments.length; i++) {
var val = arguments[i];
if (isString(val)) {
val = toObject(val);
}
if (isObject(val)) {
assign(obj, val);
assignSymbols(obj, val);
}
}
return obj;
};
function assign(a, b) {
for (var key in b) {
if (hasOwn(b, key)) {
a[key] = b[key];
}
}
}
function isString(val) {
return val && typeof val === 'string';
}
function toObject(str) {
var obj = {};
for (var i in str) {
obj[i] = str[i];
}
return obj;
}
function isObject(val) {
return val && _typeof(val) === 'object' || isExtendable(val);
}
/**
* Returns true if the given `key` is an own property of `obj`.
*/
function hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isEnum(obj, key) {
return Object.prototype.propertyIsEnumerable.call(obj, key);
}
/***/ }),
/***/ "./node_modules/to-regex/node_modules/is-extendable/index.js":
/*!*******************************************************************!*\
!*** ./node_modules/to-regex/node_modules/is-extendable/index.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* is-extendable <https://github.com/jonschlinkert/is-extendable>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
module.exports = function isExtendable(val) {
return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
};
/***/ }),
/***/ "./node_modules/union-value/index.js":
/*!*******************************************!*\
!*** ./node_modules/union-value/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isObject = __webpack_require__(/*! is-extendable */ "./node_modules/is-extendable/index.js");
var union = __webpack_require__(/*! arr-union */ "./node_modules/arr-union/index.js");
var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
var set = __webpack_require__(/*! set-value */ "./node_modules/set-value/index.js");
module.exports = function unionValue(obj, prop, value) {
if (!isObject(obj)) {
throw new TypeError('union-value expects the first argument to be an object.');
}
if (typeof prop !== 'string') {
throw new TypeError('union-value expects `prop` to be a string.');
}
var arr = arrayify(get(obj, prop));
set(obj, prop, union(arr, arrayify(value)));
return obj;
};
function arrayify(val) {
if (val === null || typeof val === 'undefined') {
return [];
}
if (Array.isArray(val)) {
return val;
}
return [val];
}
/***/ }),
/***/ "./node_modules/unset-value/index.js":
/*!*******************************************!*\
!*** ./node_modules/unset-value/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* unset-value <https://github.com/jonschlinkert/unset-value>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
var has = __webpack_require__(/*! has-value */ "./node_modules/unset-value/node_modules/has-value/index.js");
module.exports = function unset(obj, prop) {
if (!isObject(obj)) {
throw new TypeError('expected an object.');
}
if (obj.hasOwnProperty(prop)) {
delete obj[prop];
return true;
}
if (has(obj, prop)) {
var segs = prop.split('.');
var last = segs.pop();
while (segs.length && segs[segs.length - 1].slice(-1) === '\\') {
last = segs.pop().slice(0, -1) + '.' + last;
}
while (segs.length) {
obj = obj[prop = segs.shift()];
}
return delete obj[last];
}
return true;
};
/***/ }),
/***/ "./node_modules/unset-value/node_modules/has-value/index.js":
/*!******************************************************************!*\
!*** ./node_modules/unset-value/node_modules/has-value/index.js ***!
\******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* has-value <https://github.com/jonschlinkert/has-value>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
var isObject = __webpack_require__(/*! isobject */ "./node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js");
var hasValues = __webpack_require__(/*! has-values */ "./node_modules/unset-value/node_modules/has-values/index.js");
var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
module.exports = function (obj, prop, noZero) {
if (isObject(obj)) {
return hasValues(get(obj, prop), noZero);
}
return hasValues(obj, prop);
};
/***/ }),
/***/ "./node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js":
/*!****************************************************************************************!*\
!*** ./node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js ***!
\****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js");
module.exports = function isObject(val) {
return val != null && _typeof(val) === 'object' && isArray(val) === false;
};
/***/ }),
/***/ "./node_modules/unset-value/node_modules/has-values/index.js":
/*!*******************************************************************!*\
!*** ./node_modules/unset-value/node_modules/has-values/index.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* has-values <https://github.com/jonschlinkert/has-values>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function hasValue(o, noZero) {
if (o === null || o === undefined) {
return false;
}
if (typeof o === 'boolean') {
return true;
}
if (typeof o === 'number') {
if (o === 0 && noZero === true) {
return false;
}
return true;
}
if (o.length !== undefined) {
return o.length !== 0;
}
for (var key in o) {
if (o.hasOwnProperty(key)) {
return true;
}
}
return false;
};
/***/ }),
/***/ "./node_modules/use/index.js":
/*!***********************************!*\
!*** ./node_modules/use/index.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* use <https://github.com/jonschlinkert/use>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
module.exports = function base(app, options) {
if (!isObject(app) && typeof app !== 'function') {
throw new TypeError('expected an object or function');
}
var opts = isObject(options) ? options : {};
var prop = typeof opts.prop === 'string' ? opts.prop : 'fns';
if (!Array.isArray(app[prop])) {
define(app, prop, []);
}
/**
* Define a plugin function to be passed to use. The only
* parameter exposed to the plugin is `app`, the object or function.
* passed to `use(app)`. `app` is also exposed as `this` in plugins.
*
* Additionally, **if a plugin returns a function, the function will
* be pushed onto the `fns` array**, allowing the plugin to be
* called at a later point by the `run` method.
*
* ```js
* var use = require('use');
*
* // define a plugin
* function foo(app) {
* // do stuff
* }
*
* var app = function(){};
* use(app);
*
* // register plugins
* app.use(foo);
* app.use(bar);
* app.use(baz);
* ```
* @name .use
* @param {Function} `fn` plugin function to call
* @api public
*/
define(app, 'use', use);
/**
* Run all plugins on `fns`. Any plugin that returns a function
* when called by `use` is pushed onto the `fns` array.
*
* ```js
* var config = {};
* app.run(config);
* ```
* @name .run
* @param {Object} `value` Object to be modified by plugins.
* @return {Object} Returns the object passed to `run`
* @api public
*/
define(app, 'run', function (val) {
if (!isObject(val)) return;
if (!val.use || !val.run) {
define(val, prop, val[prop] || []);
define(val, 'use', use);
}
if (!val[prop] || val[prop].indexOf(base) === -1) {
val.use(base);
}
var self = this || app;
var fns = self[prop];
var len = fns.length;
var idx = -1;
while (++idx < len) {
val.use(fns[idx]);
}
return val;
});
/**
* Call plugin `fn`. If a function is returned push it into the
* `fns` array to be called by the `run` method.
*/
function use(type, fn, options) {
var offset = 1;
if (typeof type === 'string' || Array.isArray(type)) {
fn = wrap(type, fn);
offset++;
} else {
options = fn;
fn = type;
}
if (typeof fn !== 'function') {
throw new TypeError('expected a function');
}
var self = this || app;
var fns = self[prop];
var args = [].slice.call(arguments, offset);
args.unshift(self);
if (typeof opts.hook === 'function') {
opts.hook.apply(self, args);
}
var val = fn.apply(self, args);
if (typeof val === 'function' && fns.indexOf(val) === -1) {
fns.push(val);
}
return self;
}
/**
* Wrap a named plugin function so that it's only called on objects of the
* given `type`
*
* @param {String} `type`
* @param {Function} `fn` Plugin function
* @return {Function}
*/
function wrap(type, fn) {
return function plugin() {
return this.type === type ? fn.apply(this, arguments) : plugin;
};
}
return app;
};
function isObject(val) {
return val && _typeof(val) === 'object' && !Array.isArray(val);
}
function define(obj, key, val) {
Object.defineProperty(obj, key, {
configurable: true,
writable: true,
value: val
});
}
/***/ }),
/***/ "./node_modules/util/node_modules/inherits/inherits_browser.js":
/*!*********************************************************************!*\
!*** ./node_modules/util/node_modules/inherits/inherits_browser.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
var TempCtor = function TempCtor() {};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
};
}
/***/ }),
/***/ "./node_modules/util/support/isBufferBrowser.js":
/*!******************************************************!*\
!*** ./node_modules/util/support/isBufferBrowser.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
module.exports = function isBuffer(arg) {
return arg && _typeof(arg) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';
};
/***/ }),
/***/ "./node_modules/util/util.js":
/*!***********************************!*\
!*** ./node_modules/util/util.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
var keys = Object.keys(obj);
var descriptors = {};
for (var i = 0; i < keys.length; i++) {
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
}
return descriptors;
};
var formatRegExp = /%[sdj%]/g;
exports.format = function (f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function (x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s':
return String(args[i++]);
case '%d':
return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
}; // Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function (fn, msg) {
if (typeof process !== 'undefined' && process.noDeprecation === true) {
return fn;
} // Allow for deprecating things in the process of starting up.
if (typeof process === 'undefined') {
return function () {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function (set) {
if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function () {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function () {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
}; // legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
} // set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
'bold': [1, 22],
'italic': [3, 23],
'underline': [4, 24],
'inverse': [7, 27],
'white': [37, 39],
'grey': [90, 39],
'black': [30, 39],
'blue': [34, 39],
'cyan': [36, 39],
'green': [32, 39],
'magenta': [35, 39],
'red': [31, 39],
'yellow': [33, 39]
}; // Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return "\x1B[" + inspect.colors[style][0] + 'm' + str + "\x1B[" + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function (val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
} // Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
} // Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
} // IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
} // Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '',
array = false,
braces = ['{', '}']; // Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
} // Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
} // Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
} // Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
} // Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function (key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value)) return ctx.stylize('' + value, 'number');
if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here.
if (isNull(value)) return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
} else {
output.push('');
}
}
keys.forEach(function (key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || {
value: value[key]
};
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function (line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function (line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function (prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
} // NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return _typeof(arg) === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return _typeof(arg) === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof(arg) === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ "./node_modules/util/support/isBufferBrowser.js");
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
} // log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function () {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = __webpack_require__(/*! inherits */ "./node_modules/util/node_modules/inherits/inherits_browser.js");
exports._extend = function (origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
exports.promisify = function promisify(original) {
if (typeof original !== 'function') throw new TypeError('The "original" argument must be of type Function');
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
var fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== 'function') {
throw new TypeError('The "util.promisify.custom" argument must be of type Function');
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
enumerable: false,
writable: false,
configurable: true
});
return fn;
}
function fn() {
var promiseResolve, promiseReject;
var promise = new Promise(function (resolve, reject) {
promiseResolve = resolve;
promiseReject = reject;
});
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
args.push(function (err, value) {
if (err) {
promiseReject(err);
} else {
promiseResolve(value);
}
});
try {
original.apply(this, args);
} catch (err) {
promiseReject(err);
}
return promise;
}
Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
enumerable: false,
writable: false,
configurable: true
});
return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
};
exports.promisify.custom = kCustomPromisifiedSymbol;
function callbackifyOnRejected(reason, cb) {
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
// Because `null` is a special error value in callbacks which means "no error
// occurred", we error-wrap so the callback consumer can distinguish between
// "the promise rejected with null" or "the promise fulfilled with undefined".
if (!reason) {
var newReason = new Error('Promise was rejected with a falsy value');
newReason.reason = reason;
reason = newReason;
}
return cb(reason);
}
function callbackify(original) {
if (typeof original !== 'function') {
throw new TypeError('The "original" argument must be of type Function');
} // We DO NOT return the promise as it gives the user a false sense that
// the promise is actually somehow related to the callback's execution
// and that the callback throwing will reject the promise.
function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== 'function') {
throw new TypeError('The last argument must be of type Function');
}
var self = this;
var cb = function cb() {
return maybeCb.apply(self, arguments);
}; // In true node style we process the callback on `nextTick` with all the
// implications (stack, `uncaughtException`, `async_hooks`)
original.apply(this, args).then(function (ret) {
process.nextTick(cb, null, ret);
}, function (rej) {
process.nextTick(callbackifyOnRejected, rej, cb);
});
}
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
return callbackified;
}
exports.callbackify = callbackify;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var g; // This works in non-strict mode
g = function () {
return this;
}();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
} // g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/***/ "./node_modules/webpack/buildin/module.js":
/*!***********************************!*\
!*** (webpack)/buildin/module.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function (module) {
if (!module.webpackPolyfill) {
module.deprecate = function () {};
module.paths = []; // module.parent = undefined by default
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function get() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function get() {
return module.i;
}
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/***/ "./packages/diff-sequences/build/index.js":
/*!************************************************!*\
!*** ./packages/diff-sequences/build/index.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// This diff-sequences package implements the linear space variation in
// An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers
// Relationship in notation between Myers paper and this package:
// A is a
// N is aLength, aEnd - aStart, and so on
// x is aIndex, aFirst, aLast, and so on
// B is b
// M is bLength, bEnd - bStart, and so on
// y is bIndex, bFirst, bLast, and so on
// Δ = N - M is negative of baDeltaLength = bLength - aLength
// D is d
// k is kF
// k + Δ is kF = kR - baDeltaLength
// V is aIndexesF or aIndexesR (see comment below about Indexes type)
// index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength)
// starting point in forward direction (0, 0) is (-1, -1)
// starting point in reverse direction (N + 1, M + 1) is (aLength, bLength)
// The “edit graph” for sequences a and b corresponds to items:
// in a on the horizontal axis
// in b on the vertical axis
//
// Given a-coordinate of a point in a diagonal, you can compute b-coordinate.
//
// Forward diagonals kF:
// zero diagonal intersects top left corner
// positive diagonals intersect top edge
// negative diagonals insersect left edge
//
// Reverse diagonals kR:
// zero diagonal intersects bottom right corner
// positive diagonals intersect right edge
// negative diagonals intersect bottom edge
// The graph contains a directed acyclic graph of edges:
// horizontal: delete an item from a
// vertical: insert an item from b
// diagonal: common item in a and b
//
// The algorithm solves dual problems in the graph analogy:
// Find longest common subsequence: path with maximum number of diagonal edges
// Find shortest edit script: path with minimum number of non-diagonal edges
// Input callback function compares items at indexes in the sequences.
// Output callback function receives the number of adjacent items
// and starting indexes of each common subsequence.
// Either original functions or wrapped to swap indexes if graph is transposed.
// Indexes in sequence a of last point of forward or reverse paths in graph.
// Myers algorithm indexes by diagonal k which for negative is bad deopt in V8.
// This package indexes by iF and iR which are greater than or equal to zero.
// and also updates the index arrays in place to cut memory in half.
// kF = 2 * iF - d
// kR = d - 2 * iR
// Division of index intervals in sequences a and b at the middle change.
// Invariant: intervals do not have common items at the start or end.
var pkg = 'diff-sequences'; // for error messages
var NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8
// Return the number of common items that follow in forward direction.
// The length of what Myers paper calls a “snake” in a forward path.
var countCommonItemsF = function countCommonItemsF(aIndex, aEnd, bIndex, bEnd, isCommon) {
var nCommon = 0;
while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
aIndex += 1;
bIndex += 1;
nCommon += 1;
}
return nCommon;
}; // Return the number of common items that precede in reverse direction.
// The length of what Myers paper calls a “snake” in a reverse path.
var countCommonItemsR = function countCommonItemsR(aStart, aIndex, bStart, bIndex, isCommon) {
var nCommon = 0;
while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
aIndex -= 1;
bIndex -= 1;
nCommon += 1;
}
return nCommon;
}; // A simple function to extend forward paths from (d - 1) to d changes
// when forward and reverse paths cannot yet overlap.
var extendPathsF = function extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) {
// Unroll the first iteration.
var iF = 0;
var kF = -d; // kF = 2 * iF - d
var aFirst = aIndexesF[iF]; // in first iteration always insert
var aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration
aIndexesF[iF] += countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon); // Optimization: skip diagonals in which paths cannot ever overlap.
var nF = d < iMaxF ? d : iMaxF; // The diagonals kF are odd when d is odd and even when d is even.
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
// To get first point of path segment, move one change in forward direction
// from last point of previous path segment in an adjacent diagonal.
// In last possible iteration when iF === d and kF === d always delete.
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
aFirst = aIndexesF[iF]; // vertical to insert from b
} else {
aFirst = aIndexPrev1 + 1; // horizontal to delete from a
if (aEnd <= aFirst) {
// Optimization: delete moved past right of graph.
return iF - 1;
}
} // To get last point of path segment, move along diagonal of common items.
aIndexPrev1 = aIndexesF[iF];
aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
}
return iMaxF;
}; // A simple function to extend reverse paths from (d - 1) to d changes
// when reverse and forward paths cannot yet overlap.
var extendPathsR = function extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) {
// Unroll the first iteration.
var iR = 0;
var kR = d; // kR = d - 2 * iR
var aFirst = aIndexesR[iR]; // in first iteration always insert
var aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration
aIndexesR[iR] -= countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon); // Optimization: skip diagonals in which paths cannot ever overlap.
var nR = d < iMaxR ? d : iMaxR; // The diagonals kR are odd when d is odd and even when d is even.
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
// To get first point of path segment, move one change in reverse direction
// from last point of previous path segment in an adjacent diagonal.
// In last possible iteration when iR === d and kR === -d always delete.
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
aFirst = aIndexesR[iR]; // vertical to insert from b
} else {
aFirst = aIndexPrev1 - 1; // horizontal to delete from a
if (aFirst < aStart) {
// Optimization: delete moved past left of graph.
return iR - 1;
}
} // To get last point of path segment, move along diagonal of common items.
aIndexPrev1 = aIndexesR[iR];
aIndexesR[iR] = aFirst - countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
}
return iMaxR;
}; // A complete function to extend forward paths from (d - 1) to d changes.
// Return true if a path overlaps reverse path of (d - 1) changes in its diagonal.
var extendOverlappablePathsF = function extendOverlappablePathsF(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) {
var bF = bStart - aStart; // bIndex = bF + aIndex - kF
var aLength = aEnd - aStart;
var bLength = bEnd - bStart;
var baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength
// Range of diagonals in which forward and reverse paths might overlap.
var kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR
var kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1)
var aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration
// Optimization: skip diagonals in which paths cannot ever overlap.
var nF = d < iMaxF ? d : iMaxF; // The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even.
for (var iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
// To get first point of path segment, move one change in forward direction
// from last point of previous path segment in an adjacent diagonal.
// In first iteration when iF === 0 and kF === -d always insert.
// In last possible iteration when iF === d and kF === d always delete.
var insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
var aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
var aFirst = insert ? aLastPrev // vertical to insert from b
: aLastPrev + 1; // horizontal to delete from a
// To get last point of path segment, move along diagonal of common items.
var bFirst = bF + aFirst - kF;
var nCommonF = countCommonItemsF(aFirst + 1, aEnd, bFirst + 1, bEnd, isCommon);
var aLast = aFirst + nCommonF;
aIndexPrev1 = aIndexesF[iF];
aIndexesF[iF] = aLast;
if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
// Solve for iR of reverse path with (d - 1) changes in diagonal kF:
// kR = kF + baDeltaLength
// kR = (d - 1) - 2 * iR
var iR = (d - 1 - (kF + baDeltaLength)) / 2; // If this forward path overlaps the reverse path in this diagonal,
// then this is the middle change of the index intervals.
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
// Unlike the Myers algorithm which finds only the middle “snake”
// this package can find two common subsequences per division.
// Last point of previous path segment is on an adjacent diagonal.
var bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1); // Because of invariant that intervals preceding the middle change
// cannot have common items at the end,
// move in reverse direction along a diagonal of common items.
var nCommonR = countCommonItemsR(aStart, aLastPrev, bStart, bLastPrev, isCommon);
var aIndexPrevFirst = aLastPrev - nCommonR;
var bIndexPrevFirst = bLastPrev - nCommonR;
var aEndPreceding = aIndexPrevFirst + 1;
var bEndPreceding = bIndexPrevFirst + 1;
division.nChangePreceding = d - 1;
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
// Optimization: number of preceding changes in forward direction
// is equal to number of items in preceding interval,
// therefore it cannot contain any common items.
division.aEndPreceding = aStart;
division.bEndPreceding = bStart;
} else {
division.aEndPreceding = aEndPreceding;
division.bEndPreceding = bEndPreceding;
}
division.nCommonPreceding = nCommonR;
if (nCommonR !== 0) {
division.aCommonPreceding = aEndPreceding;
division.bCommonPreceding = bEndPreceding;
}
division.nCommonFollowing = nCommonF;
if (nCommonF !== 0) {
division.aCommonFollowing = aFirst + 1;
division.bCommonFollowing = bFirst + 1;
}
var aStartFollowing = aLast + 1;
var bStartFollowing = bFirst + nCommonF + 1;
division.nChangeFollowing = d - 1;
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
// Optimization: number of changes in reverse direction
// is equal to number of items in following interval,
// therefore it cannot contain any common items.
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
division.aStartFollowing = aStartFollowing;
division.bStartFollowing = bStartFollowing;
}
return true;
}
}
}
return false;
}; // A complete function to extend reverse paths from (d - 1) to d changes.
// Return true if a path overlaps forward path of d changes in its diagonal.
var extendOverlappablePathsR = function extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) {
var bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
var aLength = aEnd - aStart;
var bLength = bEnd - bStart;
var baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength
// Range of diagonals in which forward and reverse paths might overlap.
var kMinOverlapR = baDeltaLength - d; // -d <= kF
var kMaxOverlapR = baDeltaLength + d; // kF <= d
var aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration
// Optimization: skip diagonals in which paths cannot ever overlap.
var nR = d < iMaxR ? d : iMaxR; // The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even.
for (var iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
// To get first point of path segment, move one change in reverse direction
// from last point of previous path segment in an adjacent diagonal.
// In first iteration when iR === 0 and kR === d always insert.
// In last possible iteration when iR === d and kR === -d always delete.
var insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
var aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
var aFirst = insert ? aLastPrev // vertical to insert from b
: aLastPrev - 1; // horizontal to delete from a
// To get last point of path segment, move along diagonal of common items.
var bFirst = bR + aFirst - kR;
var nCommonR = countCommonItemsR(aStart, aFirst - 1, bStart, bFirst - 1, isCommon);
var aLast = aFirst - nCommonR;
aIndexPrev1 = aIndexesR[iR];
aIndexesR[iR] = aLast;
if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
// Solve for iF of forward path with d changes in diagonal kR:
// kF = kR - baDeltaLength
// kF = 2 * iF - d
var iF = (d + (kR - baDeltaLength)) / 2; // If this reverse path overlaps the forward path in this diagonal,
// then this is a middle change of the index intervals.
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
var bLast = bFirst - nCommonR;
division.nChangePreceding = d;
if (d === aLast + bLast - aStart - bStart) {
// Optimization: number of changes in reverse direction
// is equal to number of items in preceding interval,
// therefore it cannot contain any common items.
division.aEndPreceding = aStart;
division.bEndPreceding = bStart;
} else {
division.aEndPreceding = aLast;
division.bEndPreceding = bLast;
}
division.nCommonPreceding = nCommonR;
if (nCommonR !== 0) {
// The last point of reverse path segment is start of common subsequence.
division.aCommonPreceding = aLast;
division.bCommonPreceding = bLast;
}
division.nChangeFollowing = d - 1;
if (d === 1) {
// There is no previous path segment.
division.nCommonFollowing = 0;
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
// Unlike the Myers algorithm which finds only the middle “snake”
// this package can find two common subsequences per division.
// Last point of previous path segment is on an adjacent diagonal.
var bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1); // Because of invariant that intervals following the middle change
// cannot have common items at the start,
// move in forward direction along a diagonal of common items.
var nCommonF = countCommonItemsF(aLastPrev, aEnd, bLastPrev, bEnd, isCommon);
division.nCommonFollowing = nCommonF;
if (nCommonF !== 0) {
// The last point of reverse path segment is start of common subsequence.
division.aCommonFollowing = aLastPrev;
division.bCommonFollowing = bLastPrev;
}
var aStartFollowing = aLastPrev + nCommonF; // aFirstPrev
var bStartFollowing = bLastPrev + nCommonF; // bFirstPrev
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
// Optimization: number of changes in forward direction
// is equal to number of items in following interval,
// therefore it cannot contain any common items.
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
division.aStartFollowing = aStartFollowing;
division.bStartFollowing = bStartFollowing;
}
}
return true;
}
}
}
return false;
}; // Given index intervals and input function to compare items at indexes,
// divide at the middle change.
//
// DO NOT CALL if start === end, because interval cannot contain common items
// and because this function will throw the “no overlap” error.
var divide = function divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division // output
) {
var bF = bStart - aStart; // bIndex = bF + aIndex - kF
var bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
var aLength = aEnd - aStart;
var bLength = bEnd - bStart; // Because graph has square or portrait orientation,
// length difference is minimum number of items to insert from b.
// Corresponding forward and reverse diagonals in graph
// depend on length difference of the sequences:
// kF = kR - baDeltaLength
// kR = kF + baDeltaLength
var baDeltaLength = bLength - aLength; // Optimization: max diagonal in graph intersects corner of shorter side.
var iMaxF = aLength;
var iMaxR = aLength; // Initialize no changes yet in forward or reverse direction:
aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start
aIndexesR[0] = aEnd; // at open end of interval
if (baDeltaLength % 2 === 0) {
// The number of changes in paths is 2 * d if length difference is even.
var dMin = (nChange || baDeltaLength) / 2;
var dMax = (aLength + bLength) / 2;
for (var d = 1; d <= dMax; d += 1) {
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
if (d < dMin) {
iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
} else if ( // If a reverse path overlaps a forward path in the same diagonal,
// return a division of the index intervals at the middle change.
extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
return;
}
}
} else {
// The number of changes in paths is 2 * d - 1 if length difference is odd.
var _dMin = ((nChange || baDeltaLength) + 1) / 2;
var _dMax = (aLength + bLength + 1) / 2; // Unroll first half iteration so loop extends the relevant pairs of paths.
// Because of invariant that intervals have no common items at start or end,
// and limitation not to call divide with empty intervals,
// therefore it cannot be called if a forward path with one change
// would overlap a reverse path with no changes, even if dMin === 1.
var _d = 1;
iMaxF = extendPathsF(_d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
for (_d += 1; _d <= _dMax; _d += 1) {
iMaxR = extendPathsR(_d - 1, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
if (_d < _dMin) {
iMaxF = extendPathsF(_d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
} else if ( // If a forward path overlaps a reverse path in the same diagonal,
// return a division of the index intervals at the middle change.
extendOverlappablePathsF(_d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
return;
}
}
}
/* istanbul ignore next */
throw new Error("".concat(pkg, ": no overlap aStart=").concat(aStart, " aEnd=").concat(aEnd, " bStart=").concat(bStart, " bEnd=").concat(bEnd));
}; // Given index intervals and input function to compare items at indexes,
// return by output function the number of adjacent items and starting indexes
// of each common subsequence. Divide and conquer with only linear space.
//
// The index intervals are half open [start, end) like array slice method.
// DO NOT CALL if start === end, because interval cannot contain common items
// and because divide function will throw the “no overlap” error.
var findSubsequences = function findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division // temporary memory, not input nor output
) {
if (bEnd - bStart < aEnd - aStart) {
// Transpose graph so it has portrait instead of landscape orientation.
// Always compare shorter to longer sequence for consistency and optimization.
transposed = !transposed;
if (transposed && callbacks.length === 1) {
// Lazily wrap callback functions to swap args if graph is transposed.
var _callbacks$ = callbacks[0],
_foundSubsequence2 = _callbacks$.foundSubsequence,
_isCommon2 = _callbacks$.isCommon;
callbacks[1] = {
foundSubsequence: function (_foundSubsequence) {
function foundSubsequence(_x, _x2, _x3) {
return _foundSubsequence.apply(this, arguments);
}
foundSubsequence.toString = function () {
return _foundSubsequence.toString();
};
return foundSubsequence;
}(function (nCommon, bCommon, aCommon) {
_foundSubsequence2(nCommon, aCommon, bCommon);
}),
isCommon: function (_isCommon) {
function isCommon(_x4, _x5) {
return _isCommon.apply(this, arguments);
}
isCommon.toString = function () {
return _isCommon.toString();
};
return isCommon;
}(function (bIndex, aIndex) {
return _isCommon2(aIndex, bIndex);
})
};
}
var tStart = aStart;
var tEnd = aEnd;
aStart = bStart;
aEnd = bEnd;
bStart = tStart;
bEnd = tEnd;
}
var _callbacks = callbacks[transposed ? 1 : 0],
foundSubsequence = _callbacks.foundSubsequence,
isCommon = _callbacks.isCommon; // Divide the index intervals at the middle change.
divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division);
var nChangePreceding = division.nChangePreceding,
aEndPreceding = division.aEndPreceding,
bEndPreceding = division.bEndPreceding,
nCommonPreceding = division.nCommonPreceding,
aCommonPreceding = division.aCommonPreceding,
bCommonPreceding = division.bCommonPreceding,
nCommonFollowing = division.nCommonFollowing,
aCommonFollowing = division.aCommonFollowing,
bCommonFollowing = division.bCommonFollowing,
nChangeFollowing = division.nChangeFollowing,
aStartFollowing = division.aStartFollowing,
bStartFollowing = division.bStartFollowing; // Unless either index interval is empty, they might contain common items.
if (aStart < aEndPreceding && bStart < bEndPreceding) {
// Recursely find and return common subsequences preceding the division.
findSubsequences(nChangePreceding, aStart, aEndPreceding, bStart, bEndPreceding, transposed, callbacks, aIndexesF, aIndexesR, division);
} // Return common subsequences that are adjacent to the middle change.
if (nCommonPreceding !== 0) {
foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
}
if (nCommonFollowing !== 0) {
foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
} // Unless either index interval is empty, they might contain common items.
if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
// Recursely find and return common subsequences following the division.
findSubsequences(nChangeFollowing, aStartFollowing, aEnd, bStartFollowing, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
}
};
var validateLength = function validateLength(name, arg) {
var type = _typeof(arg);
if (type !== 'number') {
throw new TypeError("".concat(pkg, ": ").concat(name, " typeof ").concat(type, " is not a number"));
}
if (!Number.isSafeInteger(arg)) {
throw new RangeError("".concat(pkg, ": ").concat(name, " value ").concat(arg, " is not a safe integer"));
}
if (arg < 0) {
throw new RangeError("".concat(pkg, ": ").concat(name, " value ").concat(arg, " is a negative integer"));
}
};
var validateCallback = function validateCallback(name, arg) {
var type = _typeof(arg);
if (type !== 'function') {
throw new TypeError("".concat(pkg, ": ").concat(name, " typeof ").concat(type, " is not a function"));
}
}; // Compare items in two sequences to find a longest common subsequence.
// Given lengths of sequences and input function to compare items at indexes,
// return by output function the number of adjacent items and starting indexes
// of each common subsequence.
var _default = function _default(aLength, bLength, isCommon, foundSubsequence) {
validateLength('aLength', aLength);
validateLength('bLength', bLength);
validateCallback('isCommon', isCommon);
validateCallback('foundSubsequence', foundSubsequence); // Count common items from the start in the forward direction.
var nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
if (nCommonF !== 0) {
foundSubsequence(nCommonF, 0, 0);
} // Unless both sequences consist of common items only,
// find common items in the half-trimmed index intervals.
if (aLength !== nCommonF || bLength !== nCommonF) {
// Invariant: intervals do not have common items at the start.
// The start of an index interval is closed like array slice method.
var aStart = nCommonF;
var bStart = nCommonF; // Count common items from the end in the reverse direction.
var nCommonR = countCommonItemsR(aStart, aLength - 1, bStart, bLength - 1, isCommon); // Invariant: intervals do not have common items at the end.
// The end of an index interval is open like array slice method.
var aEnd = aLength - nCommonR;
var bEnd = bLength - nCommonR; // Unless one sequence consists of common items only,
// therefore the other trimmed index interval consists of changes only,
// find common items in the trimmed index intervals.
var nCommonFR = nCommonF + nCommonR;
if (aLength !== nCommonFR && bLength !== nCommonFR) {
var nChange = 0; // number of change items is not yet known
var transposed = false; // call the original unwrapped functions
var callbacks = [{
foundSubsequence: foundSubsequence,
isCommon: isCommon
}]; // Indexes in sequence a of last points in furthest reaching paths
// from outside the start at top left in the forward direction:
var aIndexesF = [NOT_YET_SET]; // from the end at bottom right in the reverse direction:
var aIndexesR = [NOT_YET_SET]; // Initialize one object as output of all calls to divide function.
var division = {
aCommonFollowing: NOT_YET_SET,
aCommonPreceding: NOT_YET_SET,
aEndPreceding: NOT_YET_SET,
aStartFollowing: NOT_YET_SET,
bCommonFollowing: NOT_YET_SET,
bCommonPreceding: NOT_YET_SET,
bEndPreceding: NOT_YET_SET,
bStartFollowing: NOT_YET_SET,
nChangeFollowing: NOT_YET_SET,
nChangePreceding: NOT_YET_SET,
nCommonFollowing: NOT_YET_SET,
nCommonPreceding: NOT_YET_SET
}; // Find and return common subsequences in the trimmed index intervals.
findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
}
if (nCommonR !== 0) {
foundSubsequence(nCommonR, aEnd, bEnd);
}
}
};
exports.default = _default;
/***/ }),
/***/ "./packages/expect/build/fakeChalk.js":
/*!********************************************!*\
!*** ./packages/expect/build/fakeChalk.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _ansiStyles = _interopRequireDefault(__webpack_require__(/*! ansi-styles */ "./node_modules/ansi-styles/index.js"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var returnInput = function returnInput(str) {
return str;
};
var allColorsAsFunc = Object.keys(_ansiStyles.default).map(function (style) {
return _defineProperty({}, style, returnInput);
}).reduce(function (acc, cur) {
return Object.assign(acc, cur);
});
Object.keys(allColorsAsFunc).map(function (color) {
return allColorsAsFunc[color];
}).forEach(function (style) {
Object.assign(style, allColorsAsFunc);
Object.assign(returnInput, style);
});
module.exports = allColorsAsFunc;
/***/ }),
/***/ "./packages/expect/src/asymmetricMatchers.ts":
/*!***************************************************!*\
!*** ./packages/expect/src/asymmetricMatchers.ts ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.stringNotMatching = exports.stringMatching = exports.stringNotContaining = exports.stringContaining = exports.objectNotContaining = exports.objectContaining = exports.arrayNotContaining = exports.arrayContaining = exports.anything = exports.any = exports.AsymmetricMatcher = void 0;
var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AsymmetricMatcher = function AsymmetricMatcher(sample) {
_classCallCheck(this, AsymmetricMatcher);
this.$$typeof = Symbol.for('jest.asymmetricMatcher');
this.sample = sample;
};
exports.AsymmetricMatcher = AsymmetricMatcher;
var Any =
/*#__PURE__*/
function (_AsymmetricMatcher) {
_inherits(Any, _AsymmetricMatcher);
function Any(sample) {
_classCallCheck(this, Any);
if (typeof sample === 'undefined') {
throw new TypeError('any() expects to be passed a constructor function. ' + 'Please pass one or use anything() to match any object.');
}
return _possibleConstructorReturn(this, _getPrototypeOf(Any).call(this, sample));
}
_createClass(Any, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
if (this.sample == String) {
return typeof other == 'string' || other instanceof String;
}
if (this.sample == Number) {
return typeof other == 'number' || other instanceof Number;
}
if (this.sample == Function) {
return typeof other == 'function' || other instanceof Function;
}
if (this.sample == Object) {
return _typeof(other) == 'object';
}
if (this.sample == Boolean) {
return typeof other == 'boolean';
}
return other instanceof this.sample;
}
}, {
key: "toString",
value: function toString() {
return 'Any';
}
}, {
key: "getExpectedType",
value: function getExpectedType() {
if (this.sample == String) {
return 'string';
}
if (this.sample == Number) {
return 'number';
}
if (this.sample == Function) {
return 'function';
}
if (this.sample == Object) {
return 'object';
}
if (this.sample == Boolean) {
return 'boolean';
}
return (0, _jasmineUtils.fnNameFor)(this.sample);
}
}, {
key: "toAsymmetricMatcher",
value: function toAsymmetricMatcher() {
return 'Any<' + (0, _jasmineUtils.fnNameFor)(this.sample) + '>';
}
}]);
return Any;
}(AsymmetricMatcher);
var Anything =
/*#__PURE__*/
function (_AsymmetricMatcher2) {
_inherits(Anything, _AsymmetricMatcher2);
function Anything() {
_classCallCheck(this, Anything);
return _possibleConstructorReturn(this, _getPrototypeOf(Anything).apply(this, arguments));
}
_createClass(Anything, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
return !(0, _jasmineUtils.isUndefined)(other) && other !== null;
}
}, {
key: "toString",
value: function toString() {
return 'Anything';
} // No getExpectedType method, because it matches either null or undefined.
}, {
key: "toAsymmetricMatcher",
value: function toAsymmetricMatcher() {
return 'Anything';
}
}]);
return Anything;
}(AsymmetricMatcher);
var ArrayContaining =
/*#__PURE__*/
function (_AsymmetricMatcher3) {
_inherits(ArrayContaining, _AsymmetricMatcher3);
function ArrayContaining(sample) {
var _this;
var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
_classCallCheck(this, ArrayContaining);
_this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayContaining).call(this, sample));
_this.inverse = inverse;
return _this;
}
_createClass(ArrayContaining, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
if (!Array.isArray(this.sample)) {
throw new Error("You must provide an array to ".concat(this.toString(), ", not '") + _typeof(this.sample) + "'.");
}
var result = this.sample.length === 0 || Array.isArray(other) && this.sample.every(function (item) {
return other.some(function (another) {
return (0, _jasmineUtils.equals)(item, another);
});
});
return this.inverse ? !result : result;
}
}, {
key: "toString",
value: function toString() {
return "Array".concat(this.inverse ? 'Not' : '', "Containing");
}
}, {
key: "getExpectedType",
value: function getExpectedType() {
return 'array';
}
}]);
return ArrayContaining;
}(AsymmetricMatcher);
var ObjectContaining =
/*#__PURE__*/
function (_AsymmetricMatcher4) {
_inherits(ObjectContaining, _AsymmetricMatcher4);
function ObjectContaining(sample) {
var _this2;
var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
_classCallCheck(this, ObjectContaining);
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(ObjectContaining).call(this, sample));
_this2.inverse = inverse;
return _this2;
}
_createClass(ObjectContaining, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
if (_typeof(this.sample) !== 'object') {
throw new Error("You must provide an object to ".concat(this.toString(), ", not '") + _typeof(this.sample) + "'.");
}
if (this.inverse) {
for (var property in this.sample) {
if ((0, _jasmineUtils.hasProperty)(other, property) && (0, _jasmineUtils.equals)(this.sample[property], other[property]) && !(0, _utils.emptyObject)(this.sample[property]) && !(0, _utils.emptyObject)(other[property])) {
return false;
}
}
return true;
} else {
for (var _property in this.sample) {
if (!(0, _jasmineUtils.hasProperty)(other, _property) || !(0, _jasmineUtils.equals)(this.sample[_property], other[_property])) {
return false;
}
}
return true;
}
}
}, {
key: "toString",
value: function toString() {
return "Object".concat(this.inverse ? 'Not' : '', "Containing");
}
}, {
key: "getExpectedType",
value: function getExpectedType() {
return 'object';
}
}]);
return ObjectContaining;
}(AsymmetricMatcher);
var StringContaining =
/*#__PURE__*/
function (_AsymmetricMatcher5) {
_inherits(StringContaining, _AsymmetricMatcher5);
function StringContaining(sample) {
var _this3;
var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
_classCallCheck(this, StringContaining);
if (!(0, _jasmineUtils.isA)('String', sample)) {
throw new Error('Expected is not a string');
}
_this3 = _possibleConstructorReturn(this, _getPrototypeOf(StringContaining).call(this, sample));
_this3.inverse = inverse;
return _this3;
}
_createClass(StringContaining, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
var result = (0, _jasmineUtils.isA)('String', other) && other.includes(this.sample);
return this.inverse ? !result : result;
}
}, {
key: "toString",
value: function toString() {
return "String".concat(this.inverse ? 'Not' : '', "Containing");
}
}, {
key: "getExpectedType",
value: function getExpectedType() {
return 'string';
}
}]);
return StringContaining;
}(AsymmetricMatcher);
var StringMatching =
/*#__PURE__*/
function (_AsymmetricMatcher6) {
_inherits(StringMatching, _AsymmetricMatcher6);
function StringMatching(sample) {
var _this4;
var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
_classCallCheck(this, StringMatching);
if (!(0, _jasmineUtils.isA)('String', sample) && !(0, _jasmineUtils.isA)('RegExp', sample)) {
throw new Error('Expected is not a String or a RegExp');
}
_this4 = _possibleConstructorReturn(this, _getPrototypeOf(StringMatching).call(this, new RegExp(sample)));
_this4.inverse = inverse;
return _this4;
}
_createClass(StringMatching, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
var result = (0, _jasmineUtils.isA)('String', other) && this.sample.test(other);
return this.inverse ? !result : result;
}
}, {
key: "toString",
value: function toString() {
return "String".concat(this.inverse ? 'Not' : '', "Matching");
}
}, {
key: "getExpectedType",
value: function getExpectedType() {
return 'string';
}
}]);
return StringMatching;
}(AsymmetricMatcher);
var any = function any(expectedObject) {
return new Any(expectedObject);
};
exports.any = any;
var anything = function anything() {
return new Anything();
};
exports.anything = anything;
var arrayContaining = function arrayContaining(sample) {
return new ArrayContaining(sample);
};
exports.arrayContaining = arrayContaining;
var arrayNotContaining = function arrayNotContaining(sample) {
return new ArrayContaining(sample, true);
};
exports.arrayNotContaining = arrayNotContaining;
var objectContaining = function objectContaining(sample) {
return new ObjectContaining(sample);
};
exports.objectContaining = objectContaining;
var objectNotContaining = function objectNotContaining(sample) {
return new ObjectContaining(sample, true);
};
exports.objectNotContaining = objectNotContaining;
var stringContaining = function stringContaining(expected) {
return new StringContaining(expected);
};
exports.stringContaining = stringContaining;
var stringNotContaining = function stringNotContaining(expected) {
return new StringContaining(expected, true);
};
exports.stringNotContaining = stringNotContaining;
var stringMatching = function stringMatching(expected) {
return new StringMatching(expected);
};
exports.stringMatching = stringMatching;
var stringNotMatching = function stringNotMatching(expected) {
return new StringMatching(expected, true);
};
exports.stringNotMatching = stringNotMatching;
/***/ }),
/***/ "./packages/expect/src/extractExpectedAssertionsErrors.ts":
/*!****************************************************************!*\
!*** ./packages/expect/src/extractExpectedAssertionsErrors.ts ***!
\****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
var _jestMatchersObject = __webpack_require__(/*! ./jestMatchersObject */ "./packages/expect/src/jestMatchersObject.ts");
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var resetAssertionsLocalState = function resetAssertionsLocalState() {
(0, _jestMatchersObject.setState)({
assertionCalls: 0,
expectedAssertionsNumber: null,
isExpectingAssertions: false
});
}; // Create and format all errors related to the mismatched number of `expect`
// calls and reset the matcher's state.
var extractExpectedAssertionsErrors = function extractExpectedAssertionsErrors() {
var result = [];
var _getState = (0, _jestMatchersObject.getState)(),
assertionCalls = _getState.assertionCalls,
expectedAssertionsNumber = _getState.expectedAssertionsNumber,
expectedAssertionsNumberError = _getState.expectedAssertionsNumberError,
isExpectingAssertions = _getState.isExpectingAssertions,
isExpectingAssertionsError = _getState.isExpectingAssertionsError;
resetAssertionsLocalState();
if (typeof expectedAssertionsNumber === 'number' && assertionCalls !== expectedAssertionsNumber) {
var numOfAssertionsExpected = (0, _jestMatcherUtils.EXPECTED_COLOR)((0, _jestMatcherUtils.pluralize)('assertion', expectedAssertionsNumber));
expectedAssertionsNumberError.message = (0, _jestMatcherUtils.matcherHint)('.assertions', '', String(expectedAssertionsNumber), {
isDirectExpectCall: true
}) + '\n\n' + "Expected ".concat(numOfAssertionsExpected, " to be called but received ") + (0, _jestMatcherUtils.RECEIVED_COLOR)((0, _jestMatcherUtils.pluralize)('assertion call', assertionCalls || 0)) + '.';
result.push({
actual: assertionCalls,
error: expectedAssertionsNumberError,
expected: expectedAssertionsNumber
});
}
if (isExpectingAssertions && assertionCalls === 0) {
var expected = (0, _jestMatcherUtils.EXPECTED_COLOR)('at least one assertion');
var received = (0, _jestMatcherUtils.RECEIVED_COLOR)('received none');
isExpectingAssertionsError.message = (0, _jestMatcherUtils.matcherHint)('.hasAssertions', '', '', {
isDirectExpectCall: true
}) + '\n\n' + "Expected ".concat(expected, " to be called but ").concat(received, ".");
result.push({
actual: 'none',
error: isExpectingAssertionsError,
expected: 'at least one'
});
}
return result;
};
var _default = extractExpectedAssertionsErrors;
exports.default = _default;
/***/ }),
/***/ "./packages/expect/src/index.ts":
/*!**************************************!*\
!*** ./packages/expect/src/index.ts ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var matcherUtils = _interopRequireWildcard(__webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js"));
var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
var _matchers = _interopRequireDefault(__webpack_require__(/*! ./matchers */ "./packages/expect/src/matchers.ts"));
var _spyMatchers = _interopRequireDefault(__webpack_require__(/*! ./spyMatchers */ "./packages/expect/src/spyMatchers.ts"));
var _toThrowMatchers = _interopRequireWildcard(__webpack_require__(/*! ./toThrowMatchers */ "./packages/expect/src/toThrowMatchers.ts"));
var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
var _asymmetricMatchers = __webpack_require__(/*! ./asymmetricMatchers */ "./packages/expect/src/asymmetricMatchers.ts");
var _jestMatchersObject = __webpack_require__(/*! ./jestMatchersObject */ "./packages/expect/src/jestMatchersObject.ts");
var _extractExpectedAssertionsErrors = _interopRequireDefault(__webpack_require__(/*! ./extractExpectedAssertionsErrors */ "./packages/expect/src/extractExpectedAssertionsErrors.ts"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var JestAssertionError =
/*#__PURE__*/
function (_Error) {
_inherits(JestAssertionError, _Error);
function JestAssertionError() {
_classCallCheck(this, JestAssertionError);
return _possibleConstructorReturn(this, _getPrototypeOf(JestAssertionError).apply(this, arguments));
}
return JestAssertionError;
}(_wrapNativeSuper(Error));
var isPromise = function isPromise(obj) {
return !!obj && (_typeof(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
};
var createToThrowErrorMatchingSnapshotMatcher = function createToThrowErrorMatchingSnapshotMatcher(matcher) {
return function (received, testNameOrInlineSnapshot) {
return matcher.apply(this, [received, testNameOrInlineSnapshot, true]);
};
};
var getPromiseMatcher = function getPromiseMatcher(name, matcher) {
if (name === 'toThrow' || name === 'toThrowError') {
return (0, _toThrowMatchers.createMatcher)(name, true);
} else if (name === 'toThrowErrorMatchingSnapshot' || name === 'toThrowErrorMatchingInlineSnapshot') {
return createToThrowErrorMatchingSnapshotMatcher(matcher);
}
return null;
};
var expect = function expect(actual) {
if ((arguments.length <= 1 ? 0 : arguments.length - 1) !== 0) {
throw new Error('Expect takes at most one argument.');
}
var allMatchers = (0, _jestMatchersObject.getMatchers)();
var expectation = {
not: {},
rejects: {
not: {}
},
resolves: {
not: {}
}
};
var err = new JestAssertionError();
Object.keys(allMatchers).forEach(function (name) {
var matcher = allMatchers[name];
var promiseMatcher = getPromiseMatcher(name, matcher) || matcher;
expectation[name] = makeThrowingMatcher(matcher, false, '', actual);
expectation.not[name] = makeThrowingMatcher(matcher, true, '', actual);
expectation.resolves[name] = makeResolveMatcher(name, promiseMatcher, false, actual, err);
expectation.resolves.not[name] = makeResolveMatcher(name, promiseMatcher, true, actual, err);
expectation.rejects[name] = makeRejectMatcher(name, promiseMatcher, false, actual, err);
expectation.rejects.not[name] = makeRejectMatcher(name, promiseMatcher, true, actual, err);
});
return expectation;
};
var getMessage = function getMessage(message) {
return message && message() || matcherUtils.RECEIVED_COLOR('No message was specified for this matcher.');
};
var makeResolveMatcher = function makeResolveMatcher(matcherName, matcher, isNot, actual, outerErr) {
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var options = {
isNot: isNot,
promise: 'resolves'
};
if (!isPromise(actual)) {
throw new JestAssertionError(matcherUtils.matcherErrorMessage(matcherUtils.matcherHint(matcherName, undefined, '', options), "".concat(matcherUtils.RECEIVED_COLOR('received'), " value must be a promise"), matcherUtils.printWithType('Received', actual, matcherUtils.printReceived)));
}
var innerErr = new JestAssertionError();
return actual.then(function (result) {
return makeThrowingMatcher(matcher, isNot, 'resolves', result, innerErr).apply(null, args);
}, function (reason) {
outerErr.message = matcherUtils.matcherHint(matcherName, undefined, '', options) + '\n\n' + "Received promise rejected instead of resolved\n" + "Rejected to value: ".concat(matcherUtils.printReceived(reason));
return Promise.reject(outerErr);
});
};
};
var makeRejectMatcher = function makeRejectMatcher(matcherName, matcher, isNot, actual, outerErr) {
return function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var options = {
isNot: isNot,
promise: 'rejects'
};
if (!isPromise(actual)) {
throw new JestAssertionError(matcherUtils.matcherErrorMessage(matcherUtils.matcherHint(matcherName, undefined, '', options), "".concat(matcherUtils.RECEIVED_COLOR('received'), " value must be a promise"), matcherUtils.printWithType('Received', actual, matcherUtils.printReceived)));
}
var innerErr = new JestAssertionError();
return actual.then(function (result) {
outerErr.message = matcherUtils.matcherHint(matcherName, undefined, '', options) + '\n\n' + "Received promise resolved instead of rejected\n" + "Resolved to value: ".concat(matcherUtils.printReceived(result));
return Promise.reject(outerErr);
}, function (reason) {
return makeThrowingMatcher(matcher, isNot, 'rejects', reason, innerErr).apply(null, args);
});
};
};
var makeThrowingMatcher = function makeThrowingMatcher(matcher, isNot, promise, actual, err) {
return function throwingMatcher() {
var throws = true;
var utils = _objectSpread({}, matcherUtils, {
iterableEquality: _utils.iterableEquality,
subsetEquality: _utils.subsetEquality
});
var matcherContext = _objectSpread({
// When throws is disabled, the matcher will not throw errors during test
// execution but instead add them to the global matcher state. If a
// matcher throws, test execution is normally stopped immediately. The
// snapshot matcher uses it because we want to log all snapshot
// failures in a test.
dontThrow: function dontThrow() {
return throws = false;
}
}, (0, _jestMatchersObject.getState)(), {
equals: _jasmineUtils.equals,
error: err,
isNot: isNot,
promise: promise,
utils: utils
});
var processResult = function processResult(result, asyncError) {
_validateResult(result);
(0, _jestMatchersObject.getState)().assertionCalls++;
if (result.pass && isNot || !result.pass && !isNot) {
// XOR
var message = getMessage(result.message);
var error;
if (err) {
error = err;
error.message = message;
} else if (asyncError) {
error = asyncError;
error.message = message;
} else {
error = new JestAssertionError(message); // Try to remove this function from the stack trace frame.
// Guard for some environments (browsers) that do not support this feature.
if (Error.captureStackTrace) {
Error.captureStackTrace(error, throwingMatcher);
}
} // Passing the result of the matcher with the error so that a custom
// reporter could access the actual and expected objects of the result
// for example in order to display a custom visual diff
error.matcherResult = result;
if (throws) {
throw error;
} else {
(0, _jestMatchersObject.getState)().suppressedErrors.push(error);
}
}
};
var handlError = function handlError(error) {
if (matcher[_jestMatchersObject.INTERNAL_MATCHER_FLAG] === true && !(error instanceof JestAssertionError) && error.name !== 'PrettyFormatPluginError' && // Guard for some environments (browsers) that do not support this feature.
Error.captureStackTrace) {
// Try to remove this and deeper functions from the stack trace frame.
Error.captureStackTrace(error, throwingMatcher);
}
throw error;
};
var potentialResult;
try {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
potentialResult = matcher.call.apply(matcher, [matcherContext, actual].concat(args));
if (isPromise(potentialResult)) {
var asyncResult = potentialResult;
var asyncError = new JestAssertionError();
if (Error.captureStackTrace) {
Error.captureStackTrace(asyncError, throwingMatcher);
}
return asyncResult.then(function (aResult) {
return processResult(aResult, asyncError);
}).catch(function (error) {
return handlError(error);
});
} else {
var syncResult = potentialResult;
return processResult(syncResult);
}
} catch (error) {
return handlError(error);
}
};
};
expect.extend = function (matchers) {
return (0, _jestMatchersObject.setMatchers)(matchers, false, expect);
};
expect.anything = _asymmetricMatchers.anything;
expect.any = _asymmetricMatchers.any;
expect.not = {
arrayContaining: _asymmetricMatchers.arrayNotContaining,
objectContaining: _asymmetricMatchers.objectNotContaining,
stringContaining: _asymmetricMatchers.stringNotContaining,
stringMatching: _asymmetricMatchers.stringNotMatching
};
expect.objectContaining = _asymmetricMatchers.objectContaining;
expect.arrayContaining = _asymmetricMatchers.arrayContaining;
expect.stringContaining = _asymmetricMatchers.stringContaining;
expect.stringMatching = _asymmetricMatchers.stringMatching;
var _validateResult = function _validateResult(result) {
if (_typeof(result) !== 'object' || typeof result.pass !== 'boolean' || result.message && typeof result.message !== 'string' && typeof result.message !== 'function') {
throw new Error('Unexpected return from a matcher function.\n' + 'Matcher functions should ' + 'return an object in the following format:\n' + ' {message?: string | function, pass: boolean}\n' + "'".concat(matcherUtils.stringify(result), "' was returned"));
}
};
function assertions(expected) {
var error = new Error();
if (Error.captureStackTrace) {
Error.captureStackTrace(error, assertions);
}
(0, _jestMatchersObject.getState)().expectedAssertionsNumber = expected;
(0, _jestMatchersObject.getState)().expectedAssertionsNumberError = error;
}
function hasAssertions() {
var error = new Error();
if (Error.captureStackTrace) {
Error.captureStackTrace(error, hasAssertions);
}
matcherUtils.ensureNoExpected(arguments.length <= 0 ? undefined : arguments[0], '.hasAssertions');
(0, _jestMatchersObject.getState)().isExpectingAssertions = true;
(0, _jestMatchersObject.getState)().isExpectingAssertionsError = error;
} // add default jest matchers
(0, _jestMatchersObject.setMatchers)(_matchers.default, true, expect);
(0, _jestMatchersObject.setMatchers)(_spyMatchers.default, true, expect);
(0, _jestMatchersObject.setMatchers)(_toThrowMatchers.default, true, expect);
expect.addSnapshotSerializer = function () {
return void 0;
};
expect.assertions = assertions;
expect.hasAssertions = hasAssertions;
expect.getState = _jestMatchersObject.getState;
expect.setState = _jestMatchersObject.setState;
expect.extractExpectedAssertionsErrors = _extractExpectedAssertionsErrors.default;
var expectExport = expect; // eslint-disable-next-line no-redeclare
module.exports = expectExport;
/***/ }),
/***/ "./packages/expect/src/jasmineUtils.ts":
/*!*********************************************!*\
!*** ./packages/expect/src/jasmineUtils.ts ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.equals = equals;
exports.isA = isA;
exports.fnNameFor = fnNameFor;
exports.isUndefined = isUndefined;
exports.hasProperty = hasProperty;
exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*
Copyright (c) 2008-2016 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable */
// Extracted out of jasmine 2.5.2
function equals(a, b, customTesters, strictCheck) {
customTesters = customTesters || [];
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
}
var functionToString = Function.prototype.toString;
function isAsymmetric(obj) {
return !!obj && isA('Function', obj.asymmetricMatch);
}
function asymmetricMatch(a, b) {
var asymmetricA = isAsymmetric(a),
asymmetricB = isAsymmetric(b);
if (asymmetricA && asymmetricB) {
return undefined;
}
if (asymmetricA) {
return a.asymmetricMatch(b);
}
if (asymmetricB) {
return b.asymmetricMatch(a);
}
} // Equality function lovingly adapted from isEqual in
// [Underscore](http://underscorejs.org)
function eq(a, b, aStack, bStack, customTesters, hasKey) {
var result = true;
var asymmetricResult = asymmetricMatch(a, b);
if (asymmetricResult !== undefined) {
return asymmetricResult;
}
for (var i = 0; i < customTesters.length; i++) {
var customTesterResult = customTesters[i](a, b);
if (customTesterResult !== undefined) {
return customTesterResult;
}
}
if (a instanceof Error && b instanceof Error) {
return a.message == b.message;
}
if (Object.is(a, b)) {
return true;
} // A strict comparison is necessary because `null == undefined`.
if (a === null || b === null) {
return a === b;
}
var className = Object.prototype.toString.call(a);
if (className != Object.prototype.toString.call(b)) {
return false;
}
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
return Object.is(Number(a), Number(b));
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase;
}
if (_typeof(a) != 'object' || _typeof(b) != 'object') {
return false;
} // Use DOM3 method isEqualNode (IE>=9)
if (isDomNode(a) && isDomNode(b)) {
return a.isEqualNode(b);
} // Used to detect circular references.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
// circular references at same depth are equal
// circular reference is not equal to non-circular one
if (aStack[length] === a) {
return bStack[length] === b;
} else if (bStack[length] === b) {
return false;
}
} // Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0; // Recursively compare objects and arrays.
// Compare array lengths to determine if a deep comparison is necessary.
if (className == '[object Array]') {
size = a.length;
if (size !== b.length) {
return false;
}
while (size--) {
result = eq(a[size], b[size], aStack, bStack, customTesters, hasKey);
if (!result) {
return false;
}
}
} // Deep compare objects.
var aKeys = keys(a, className == '[object Array]', hasKey),
key;
size = aKeys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
if (keys(b, className == '[object Array]', hasKey).length !== size) {
return false;
}
while (size--) {
key = aKeys[size]; // Deep compare each member
result = hasKey(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey);
if (!result) {
return false;
}
} // Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
}
function keys(obj, isArray, hasKey) {
var allKeys = function (o) {
var keys = [];
for (var key in o) {
if (hasKey(o, key)) {
keys.push(key);
}
}
return keys.concat(Object.getOwnPropertySymbols(o).filter(function (symbol) {
return Object.getOwnPropertyDescriptor(o, symbol).enumerable;
}));
}(obj);
if (!isArray) {
return allKeys;
}
var extraKeys = [];
if (allKeys.length === 0) {
return allKeys;
}
for (var x = 0; x < allKeys.length; x++) {
if (_typeof(allKeys[x]) === 'symbol' || !allKeys[x].match(/^[0-9]+$/)) {
extraKeys.push(allKeys[x]);
}
}
return extraKeys;
}
function hasDefinedKey(obj, key) {
return hasKey(obj, key) && obj[key] !== undefined;
}
function hasKey(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isA(typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
}
function isDomNode(obj) {
return obj !== null && _typeof(obj) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string' && typeof obj.isEqualNode === 'function';
}
function fnNameFor(func) {
if (func.name) {
return func.name;
}
var matches = functionToString.call(func).match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/);
return matches ? matches[1] : '<anonymous>';
}
function isUndefined(obj) {
return obj === void 0;
}
function getPrototype(obj) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(obj);
}
if (obj.constructor.prototype == obj) {
return null;
}
return obj.constructor.prototype;
}
function hasProperty(obj, property) {
if (!obj) {
return false;
}
if (Object.prototype.hasOwnProperty.call(obj, property)) {
return true;
}
return hasProperty(getPrototype(obj), property);
} // SENTINEL constants are from https://github.com/facebook/immutable-js
var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
function isImmutableUnorderedKeyed(maybeKeyed) {
return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
}
function isImmutableUnorderedSet(maybeSet) {
return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
}
/***/ }),
/***/ "./packages/expect/src/jestMatchersObject.ts":
/*!***************************************************!*\
!*** ./packages/expect/src/jestMatchersObject.ts ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setMatchers = exports.getMatchers = exports.setState = exports.getState = exports.INTERNAL_MATCHER_FLAG = void 0;
var _asymmetricMatchers = __webpack_require__(/*! ./asymmetricMatchers */ "./packages/expect/src/asymmetricMatchers.ts");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
// Global matchers object holds the list of available matchers and
// the state, that can hold matcher specific values that change over time.
var JEST_MATCHERS_OBJECT = Symbol.for('$$jest-matchers-object'); // Notes a built-in/internal Jest matcher.
// Jest may override the stack trace of Errors thrown by internal matchers.
var INTERNAL_MATCHER_FLAG = Symbol.for('$$jest-internal-matcher');
exports.INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG;
if (!global.hasOwnProperty(JEST_MATCHERS_OBJECT)) {
Object.defineProperty(global, JEST_MATCHERS_OBJECT, {
value: {
matchers: Object.create(null),
state: {
assertionCalls: 0,
expectedAssertionsNumber: null,
isExpectingAssertions: false,
suppressedErrors: [] // errors that are not thrown immediately.
}
}
});
}
var getState = function getState() {
return global[JEST_MATCHERS_OBJECT].state;
};
exports.getState = getState;
var setState = function setState(state) {
Object.assign(global[JEST_MATCHERS_OBJECT].state, state);
};
exports.setState = setState;
var getMatchers = function getMatchers() {
return global[JEST_MATCHERS_OBJECT].matchers;
};
exports.getMatchers = getMatchers;
var setMatchers = function setMatchers(matchers, isInternal, expect) {
Object.keys(matchers).forEach(function (key) {
var matcher = matchers[key];
Object.defineProperty(matcher, INTERNAL_MATCHER_FLAG, {
value: isInternal
});
if (!isInternal) {
// expect is defined
var CustomMatcher =
/*#__PURE__*/
function (_AsymmetricMatcher) {
_inherits(CustomMatcher, _AsymmetricMatcher);
function CustomMatcher() {
var _this;
var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
_classCallCheck(this, CustomMatcher);
for (var _len = arguments.length, sample = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
sample[_key - 1] = arguments[_key];
}
_this = _possibleConstructorReturn(this, _getPrototypeOf(CustomMatcher).call(this, sample));
_this.inverse = inverse;
return _this;
}
_createClass(CustomMatcher, [{
key: "asymmetricMatch",
value: function asymmetricMatch(other) {
var _ref = matcher.apply(void 0, [other].concat(_toConsumableArray(this.sample))),
pass = _ref.pass;
return this.inverse ? !pass : pass;
}
}, {
key: "toString",
value: function toString() {
return "".concat(this.inverse ? 'not.' : '').concat(key);
}
}, {
key: "getExpectedType",
value: function getExpectedType() {
return 'any';
}
}, {
key: "toAsymmetricMatcher",
value: function toAsymmetricMatcher() {
return "".concat(this.toString(), "<").concat(this.sample.join(', '), ">");
}
}]);
return CustomMatcher;
}(_asymmetricMatchers.AsymmetricMatcher);
expect[key] = function () {
for (var _len2 = arguments.length, sample = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
sample[_key2] = arguments[_key2];
}
return _construct(CustomMatcher, [false].concat(sample));
};
if (!expect.not) {
expect.not = {};
}
expect.not[key] = function () {
for (var _len3 = arguments.length, sample = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
sample[_key3] = arguments[_key3];
}
return _construct(CustomMatcher, [true].concat(sample));
};
}
});
Object.assign(global[JEST_MATCHERS_OBJECT].matchers, matchers);
};
exports.setMatchers = setMatchers;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./packages/expect/src/matchers.ts":
/*!*****************************************!*\
!*** ./packages/expect/src/matchers.ts ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _jestGetType = _interopRequireWildcard(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
var _print = __webpack_require__(/*! ./print */ "./packages/expect/src/print.ts");
var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Omit colon and one or more spaces, so can call getLabelPrinter.
var EXPECTED_LABEL = 'Expected';
var RECEIVED_LABEL = 'Received';
var EXPECTED_VALUE_LABEL = 'Expected value';
var RECEIVED_VALUE_LABEL = 'Received value'; // The optional property of matcher context is true if undefined.
var isExpand = function isExpand(expand) {
return expand !== false;
};
var toStrictEqualTesters = [_utils.iterableEquality, _utils.typeEquality, _utils.sparseArrayEquality];
var matchers = {
toBe: function toBe(received, expected) {
var _this = this;
var matcherName = 'toBe';
var options = {
comment: 'Object.is equality',
isNot: this.isNot,
promise: this.promise
};
var pass = Object.is(received, expected);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected));
} : function () {
var expectedType = (0, _jestGetType.default)(expected);
var deepEqualityName = null;
if (expectedType !== 'map' && expectedType !== 'set') {
// If deep equality passes when referential identity fails,
// but exclude map and set until review of their equality logic.
if ((0, _jasmineUtils.equals)(received, expected, toStrictEqualTesters, true)) {
deepEqualityName = 'toStrictEqual';
} else if ((0, _jasmineUtils.equals)(received, expected, [_utils.iterableEquality])) {
deepEqualityName = 'toEqual';
}
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (deepEqualityName !== null ? (0, _jestMatcherUtils.DIM_COLOR)("If it should pass with deep equality, replace \"".concat(matcherName, "\" with \"").concat(deepEqualityName, "\"")) + '\n\n' : '') + (0, _jestMatcherUtils.printDiffOrStringify)(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this.expand));
}; // Passing the actual and expected objects so that a custom reporter
// could access them, for example in order to display a custom visual diff,
// or create a different error message
return {
actual: received,
expected: expected,
message: message,
name: matcherName,
pass: pass
};
},
toBeCloseTo: function toBeCloseTo(received, expected) {
var precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
var matcherName = 'toBeCloseTo';
var secondArgument = arguments.length === 3 ? 'precision' : undefined;
var options = {
isNot: this.isNot,
promise: this.promise,
secondArgument: secondArgument,
secondArgumentColor: function secondArgumentColor(arg) {
return arg;
}
};
(0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
var pass = false;
var expectedDiff = 0;
var receivedDiff = 0;
if (received === Infinity && expected === Infinity) {
pass = true; // Infinity - Infinity is NaN
} else if (received === -Infinity && expected === -Infinity) {
pass = true; // -Infinity - -Infinity is NaN
} else {
expectedDiff = Math.pow(10, -precision) / 2;
receivedDiff = Math.abs(expected - received);
pass = receivedDiff < expectedDiff;
}
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (receivedDiff === 0 ? '' : "Received: ".concat((0, _jestMatcherUtils.printReceived)(received), "\n") + '\n' + "Expected precision: ".concat((0, _jestMatcherUtils.stringify)(precision), "\n") + "Expected difference: not < ".concat((0, _jestMatcherUtils.printExpected)(expectedDiff), "\n") + "Received difference: ".concat((0, _jestMatcherUtils.printReceived)(receivedDiff)));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received), "\n") + '\n' + "Expected precision: ".concat((0, _jestMatcherUtils.stringify)(precision), "\n") + "Expected difference: < ".concat((0, _jestMatcherUtils.printExpected)(expectedDiff), "\n") + "Received difference: ".concat((0, _jestMatcherUtils.printReceived)(receivedDiff));
};
return {
message: message,
pass: pass
};
},
toBeDefined: function toBeDefined(received, expected) {
var matcherName = 'toBeDefined';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
var pass = received !== void 0;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeFalsy: function toBeFalsy(received, expected) {
var matcherName = 'toBeFalsy';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
var pass = !received;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeGreaterThan: function toBeGreaterThan(received, expected) {
var matcherName = 'toBeGreaterThan';
var isNot = this.isNot;
var options = {
isNot: isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
var pass = received > expected;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " > ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeGreaterThanOrEqual: function toBeGreaterThanOrEqual(received, expected) {
var matcherName = 'toBeGreaterThanOrEqual';
var isNot = this.isNot;
var options = {
isNot: isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
var pass = received >= expected;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " >= ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeInstanceOf: function toBeInstanceOf(received, expected) {
var matcherName = 'toBeInstanceOf';
var options = {
isNot: this.isNot,
promise: this.promise
};
if (typeof expected !== 'function') {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a function"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
}
var pass = received instanceof expected;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorNameNot)('Expected constructor', expected) + (typeof received.constructor === 'function' && received.constructor !== expected ? (0, _print.printReceivedConstructorNameNot)('Received constructor', received.constructor, expected) : '');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorName)('Expected constructor', expected) + ((0, _jestGetType.isPrimitive)(received) || Object.getPrototypeOf(received) === null ? "\nReceived value has no prototype\nReceived value: ".concat((0, _jestMatcherUtils.printReceived)(received)) : typeof received.constructor !== 'function' ? "\nReceived value: ".concat((0, _jestMatcherUtils.printReceived)(received)) : (0, _print.printReceivedConstructorName)('Received constructor', received.constructor));
};
return {
message: message,
pass: pass
};
},
toBeLessThan: function toBeLessThan(received, expected) {
var matcherName = 'toBeLessThan';
var isNot = this.isNot;
var options = {
isNot: isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
var pass = received < expected;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " < ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeLessThanOrEqual: function toBeLessThanOrEqual(received, expected) {
var matcherName = 'toBeLessThanOrEqual';
var isNot = this.isNot;
var options = {
isNot: isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
var pass = received <= expected;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " <= ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeNaN: function toBeNaN(received, expected) {
var matcherName = 'toBeNaN';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
var pass = Number.isNaN(received);
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeNull: function toBeNull(received, expected) {
var matcherName = 'toBeNull';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
var pass = received === null;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeTruthy: function toBeTruthy(received, expected) {
var matcherName = 'toBeTruthy';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
var pass = !!received;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toBeUndefined: function toBeUndefined(received, expected) {
var matcherName = 'toBeUndefined';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
var pass = received === void 0;
var message = function message() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toContain: function toContain(received, expected) {
var matcherName = 'toContain';
var isNot = this.isNot;
var options = {
comment: 'indexOf',
isNot: isNot,
promise: this.promise
};
if (received == null) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must not be null nor undefined"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
if (typeof received === 'string') {
var _index = received.indexOf(String(expected));
var _pass = _index !== -1;
var _message = function _message() {
var labelExpected = "Expected ".concat(typeof expected === 'string' ? 'substring' : 'value');
var labelReceived = 'Received string';
var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat(isNot ? ' ' : '').concat(isNot ? (0, _print.printReceivedStringContainExpectedSubstring)(received, _index, String(expected).length) : (0, _jestMatcherUtils.printReceived)(received));
};
return {
message: _message,
pass: _pass
};
}
var indexable = Array.from(received);
var index = indexable.indexOf(expected);
var pass = index !== -1;
var message = function message() {
var labelExpected = 'Expected value';
var labelReceived = "Received ".concat((0, _jestGetType.default)(received));
var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat(isNot ? ' ' : '').concat(isNot && Array.isArray(received) ? (0, _print.printReceivedArrayContainExpectedItem)(received, index) : (0, _jestMatcherUtils.printReceived)(received)) + (!isNot && indexable.findIndex(function (item) {
return (0, _jasmineUtils.equals)(item, expected, [_utils.iterableEquality]);
}) !== -1 ? "\n\n".concat(_jestMatcherUtils.SUGGEST_TO_CONTAIN_EQUAL) : '');
};
return {
message: message,
pass: pass
};
},
toContainEqual: function toContainEqual(received, expected) {
var matcherName = 'toContainEqual';
var isNot = this.isNot;
var options = {
comment: 'deep equality',
isNot: isNot,
promise: this.promise
};
if (received == null) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must not be null nor undefined"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
var index = Array.from(received).findIndex(function (item) {
return (0, _jasmineUtils.equals)(item, expected, [_utils.iterableEquality]);
});
var pass = index !== -1;
var message = function message() {
var labelExpected = 'Expected value';
var labelReceived = "Received ".concat((0, _jestGetType.default)(received));
var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat(isNot ? ' ' : '').concat(isNot && Array.isArray(received) ? (0, _print.printReceivedArrayContainExpectedItem)(received, index) : (0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toEqual: function toEqual(received, expected) {
var _this2 = this;
var matcherName = 'toEqual';
var options = {
comment: 'deep equality',
isNot: this.isNot,
promise: this.promise
};
var pass = (0, _jasmineUtils.equals)(received, expected, [_utils.iterableEquality]);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + ((0, _jestMatcherUtils.stringify)(expected) !== (0, _jestMatcherUtils.stringify)(received) ? "Received: ".concat((0, _jestMatcherUtils.printReceived)(received)) : '');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this2.expand));
}; // Passing the actual and expected objects so that a custom reporter
// could access them, for example in order to display a custom visual diff,
// or create a different error message
return {
actual: received,
expected: expected,
message: message,
name: matcherName,
pass: pass
};
},
toHaveLength: function toHaveLength(received, expected) {
var matcherName = 'toHaveLength';
var isNot = this.isNot;
var options = {
isNot: isNot,
promise: this.promise
};
if (typeof received !== 'string' && (!received || typeof received.length !== 'number')) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must have a length property whose value must be a number"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
(0, _jestMatcherUtils.ensureExpectedIsNonNegativeInteger)(expected, matcherName, options);
var pass = received.length === expected;
var message = function message() {
var labelExpected = 'Expected length';
var labelReceivedLength = 'Received length';
var labelReceivedValue = "Received ".concat((0, _jestGetType.default)(received));
var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceivedLength, labelReceivedValue);
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (isNot ? '' : "".concat(printLabel(labelReceivedLength)).concat((0, _jestMatcherUtils.printReceived)(received.length), "\n")) + "".concat(printLabel(labelReceivedValue)).concat(isNot ? ' ' : '').concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toHaveProperty: function toHaveProperty(received, expectedPath, expectedValue) {
var _this3 = this;
var matcherName = 'toHaveProperty';
var expectedArgument = 'path';
var hasValue = arguments.length === 3;
var options = {
isNot: this.isNot,
promise: this.promise,
secondArgument: hasValue ? 'value' : ''
};
if (received === null || received === undefined) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must not be null nor undefined"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
var expectedPathType = (0, _jestGetType.default)(expectedPath);
if (expectedPathType !== 'string' && expectedPathType !== 'array') {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " path must be a string or array"), (0, _jestMatcherUtils.printWithType)('Expected', expectedPath, _jestMatcherUtils.printExpected)));
}
var expectedPathLength = typeof expectedPath === 'string' ? expectedPath.split('.').length : expectedPath.length;
if (expectedPathType === 'array' && expectedPathLength === 0) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " path must not be an empty array"), (0, _jestMatcherUtils.printWithType)('Expected', expectedPath, _jestMatcherUtils.printExpected)));
}
var result = (0, _utils.getPath)(received, expectedPath);
var lastTraversedObject = result.lastTraversedObject,
hasEndProp = result.hasEndProp;
var receivedPath = result.traversedPath;
var hasCompletePath = receivedPath.length === expectedPathLength;
var receivedValue = hasCompletePath ? result.value : lastTraversedObject;
var pass = hasValue ? (0, _jasmineUtils.equals)(result.value, expectedValue, [_utils.iterableEquality]) : Boolean(hasEndProp); // theoretically undefined if empty path
// Remove type cast if we rewrite getPath as iterative algorithm.
// Delete this unique report if future breaking change
// removes the edge case that expected value undefined
// also matches absence of a property with the key path.
if (pass && !hasCompletePath) {
var _message2 = function _message2() {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options) + '\n\n' + "Expected path: ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n") + "Received path: ".concat((0, _jestMatcherUtils.printReceived)(expectedPathType === 'array' || receivedPath.length === 0 ? receivedPath : receivedPath.join('.')), "\n\n") + "Expected value: not ".concat((0, _jestMatcherUtils.printExpected)(expectedValue), "\n") + "Received value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue), "\n\n") + (0, _jestMatcherUtils.DIM_COLOR)('Because a positive assertion passes for expected value undefined if the property does not exist, this negative assertion fails unless the property does exist and has a defined value');
};
return {
message: _message2,
pass: pass
};
}
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options) + '\n\n' + (hasValue ? "Expected path: ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n\n") + "Expected value: not ".concat((0, _jestMatcherUtils.printExpected)(expectedValue)) + ((0, _jestMatcherUtils.stringify)(expectedValue) !== (0, _jestMatcherUtils.stringify)(receivedValue) ? "\nReceived value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue)) : '') : "Expected path: not ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n\n") + "Received value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue)));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options) + '\n\n' + "Expected path: ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n") + (hasCompletePath ? '\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expectedValue, receivedValue, EXPECTED_VALUE_LABEL, RECEIVED_VALUE_LABEL, isExpand(_this3.expand)) : "Received path: ".concat((0, _jestMatcherUtils.printReceived)(expectedPathType === 'array' || receivedPath.length === 0 ? receivedPath : receivedPath.join('.')), "\n\n") + (hasValue ? "Expected value: ".concat((0, _jestMatcherUtils.printExpected)(expectedValue), "\n") : '') + "Received value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue)));
};
return {
message: message,
pass: pass
};
},
toMatch: function toMatch(received, expected) {
var matcherName = 'toMatch';
var options = {
isNot: this.isNot,
promise: this.promise
};
if (typeof received !== 'string') {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a string"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
if (!(typeof expected === 'string') && !(expected && typeof expected.test === 'function')) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a string or regular expression"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
}
var pass = typeof expected === 'string' ? received.includes(expected) : expected.test(received);
var message = pass ? function () {
return typeof expected === 'string' ? (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected substring: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received string: ".concat((0, _print.printReceivedStringContainExpectedSubstring)(received, received.indexOf(expected), expected.length)) : (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected pattern: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received string: ".concat((0, _print.printReceivedStringContainExpectedResult)(received, typeof expected.exec === 'function' ? expected.exec(received) : null));
} : function () {
var labelExpected = "Expected ".concat(typeof expected === 'string' ? 'substring' : 'pattern');
var labelReceived = 'Received string';
var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat((0, _jestMatcherUtils.printReceived)(received));
};
return {
message: message,
pass: pass
};
},
toMatchObject: function toMatchObject(received, expected) {
var _this4 = this;
var matcherName = 'toMatchObject';
var options = {
isNot: this.isNot,
promise: this.promise
};
if (_typeof(received) !== 'object' || received === null) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a non-null object"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
if (_typeof(expected) !== 'object' || expected === null) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a non-null object"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
}
var pass = (0, _jasmineUtils.equals)(received, expected, [_utils.iterableEquality, _utils.subsetEquality]);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected)) + ((0, _jestMatcherUtils.stringify)(expected) !== (0, _jestMatcherUtils.stringify)(received) ? "\nReceived: ".concat((0, _jestMatcherUtils.printReceived)(received)) : '');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expected, (0, _utils.getObjectSubset)(received, expected), EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this4.expand));
};
return {
message: message,
pass: pass
};
},
toStrictEqual: function toStrictEqual(received, expected) {
var _this5 = this;
var matcherName = 'toStrictEqual';
var options = {
comment: 'deep equality',
isNot: this.isNot,
promise: this.promise
};
var pass = (0, _jasmineUtils.equals)(received, expected, toStrictEqualTesters, true);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + ((0, _jestMatcherUtils.stringify)(expected) !== (0, _jestMatcherUtils.stringify)(received) ? "Received: ".concat((0, _jestMatcherUtils.printReceived)(received)) : '');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this5.expand));
}; // Passing the actual and expected objects so that a custom reporter
// could access them, for example in order to display a custom visual diff,
// or create a different error message
return {
actual: received,
expected: expected,
message: message,
name: matcherName,
pass: pass
};
}
};
var _default = matchers;
exports.default = _default;
/***/ }),
/***/ "./packages/expect/src/print.ts":
/*!**************************************!*\
!*** ./packages/expect/src/print.ts ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// Format substring but do not enclose in double quote marks.
// The replacement is compatible with pretty-format package.
var printSubstring = function printSubstring(val) {
return val.replace(/"|\\/g, '\\$&');
};
var printReceivedStringContainExpectedSubstring = function printReceivedStringContainExpectedSubstring(received, start, length) {
return (0, _jestMatcherUtils.RECEIVED_COLOR)('"' + printSubstring(received.slice(0, start)) + (0, _jestMatcherUtils.INVERTED_COLOR)(printSubstring(received.slice(start, start + length))) + printSubstring(received.slice(start + length)) + '"');
};
exports.printReceivedStringContainExpectedSubstring = printReceivedStringContainExpectedSubstring;
var printReceivedStringContainExpectedResult = function printReceivedStringContainExpectedResult(received, result) {
return result === null ? (0, _jestMatcherUtils.printReceived)(received) : printReceivedStringContainExpectedSubstring(received, result.index, result[0].length);
}; // The serialized array is compatible with pretty-format package min option.
// However, items have default stringify depth (instead of depth - 1)
// so expected item looks consistent by itself and enclosed in the array.
exports.printReceivedStringContainExpectedResult = printReceivedStringContainExpectedResult;
var printReceivedArrayContainExpectedItem = function printReceivedArrayContainExpectedItem(received, index) {
return (0, _jestMatcherUtils.RECEIVED_COLOR)('[' + received.map(function (item, i) {
var stringified = (0, _jestMatcherUtils.stringify)(item);
return i === index ? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified) : stringified;
}).join(', ') + ']');
};
exports.printReceivedArrayContainExpectedItem = printReceivedArrayContainExpectedItem;
var printExpectedConstructorName = function printExpectedConstructorName(label, expected) {
return printConstructorName(label, expected, false, true) + '\n';
};
exports.printExpectedConstructorName = printExpectedConstructorName;
var printExpectedConstructorNameNot = function printExpectedConstructorNameNot(label, expected) {
return printConstructorName(label, expected, true, true) + '\n';
};
exports.printExpectedConstructorNameNot = printExpectedConstructorNameNot;
var printReceivedConstructorName = function printReceivedConstructorName(label, received) {
return printConstructorName(label, received, false, false) + '\n';
}; // Do not call function if received is equal to expected.
exports.printReceivedConstructorName = printReceivedConstructorName;
var printReceivedConstructorNameNot = function printReceivedConstructorNameNot(label, received, expected) {
return typeof expected.name === 'string' && expected.name.length !== 0 && typeof received.name === 'string' && received.name.length !== 0 ? printConstructorName(label, received, true, false) + " ".concat(Object.getPrototypeOf(received) === expected ? 'extends' : 'extends … extends', " ").concat((0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)) + '\n' : printConstructorName(label, received, false, false) + '\n';
};
exports.printReceivedConstructorNameNot = printReceivedConstructorNameNot;
var printConstructorName = function printConstructorName(label, constructor, isNot, isExpected) {
return typeof constructor.name !== 'string' ? "".concat(label, " name is not a string") : constructor.name.length === 0 ? "".concat(label, " name is an empty string") : "".concat(label, ": ").concat(!isNot ? '' : isExpected ? 'not ' : ' ').concat(isExpected ? (0, _jestMatcherUtils.EXPECTED_COLOR)(constructor.name) : (0, _jestMatcherUtils.RECEIVED_COLOR)(constructor.name));
};
/***/ }),
/***/ "./packages/expect/src/spyMatchers.ts":
/*!********************************************!*\
!*** ./packages/expect/src/spyMatchers.ts ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _jestGetType = _interopRequireWildcard(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
// The optional property of matcher context is true if undefined.
var isExpand = function isExpand(expand) {
return expand !== false;
};
var PRINT_LIMIT = 3;
var NO_ARGUMENTS = 'called with 0 arguments';
var printExpectedArgs = function printExpectedArgs(expected) {
return expected.length === 0 ? NO_ARGUMENTS : expected.map(function (arg) {
return (0, _jestMatcherUtils.printExpected)(arg);
}).join(', ');
};
var printReceivedArgs = function printReceivedArgs(received, expected) {
return received.length === 0 ? NO_ARGUMENTS : received.map(function (arg, i) {
return Array.isArray(expected) && i < expected.length && isEqualValue(expected[i], arg) ? printCommon(arg) : (0, _jestMatcherUtils.printReceived)(arg);
}).join(', ');
};
var printCommon = function printCommon(val) {
return (0, _jestMatcherUtils.DIM_COLOR)((0, _jestMatcherUtils.stringify)(val));
};
var isEqualValue = function isEqualValue(expected, received) {
return (0, _jasmineUtils.equals)(expected, received, [_utils.iterableEquality]);
};
var isEqualCall = function isEqualCall(expected, received) {
return isEqualValue(expected, received);
};
var isEqualReturn = function isEqualReturn(expected, result) {
return result.type === 'return' && isEqualValue(expected, result.value);
};
var countReturns = function countReturns(results) {
return results.reduce(function (n, result) {
return result.type === 'return' ? n + 1 : n;
}, 0);
};
var printNumberOfReturns = function printNumberOfReturns(countReturns, countCalls) {
return "\nNumber of returns: ".concat((0, _jestMatcherUtils.printReceived)(countReturns)) + (countCalls !== countReturns ? "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(countCalls)) : '');
};
// Given a label, return a function which given a string,
// right-aligns it preceding the colon in the label.
var getRightAlignedPrinter = function getRightAlignedPrinter(label) {
// Assume that the label contains a colon.
var index = label.indexOf(':');
var suffix = label.slice(index);
return function (string, isExpectedCall) {
return (isExpectedCall ? '->' + ' '.repeat(Math.max(0, index - 2 - string.length)) : ' '.repeat(Math.max(index - string.length))) + string + suffix;
};
};
var printReceivedCallsNegative = function printReceivedCallsNegative(expected, indexedCalls, isOnlyCall, iExpectedCall) {
if (indexedCalls.length === 0) {
return '';
}
var label = 'Received: ';
if (isOnlyCall) {
return label + printReceivedArgs(indexedCalls[0], expected) + '\n';
}
var printAligned = getRightAlignedPrinter(label);
return 'Received\n' + indexedCalls.reduce(function (printed, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
i = _ref2[0],
args = _ref2[1];
return printed + printAligned(String(i + 1), i === iExpectedCall) + printReceivedArgs(args, expected) + '\n';
}, '');
};
var printExpectedReceivedCallsPositive = function printExpectedReceivedCallsPositive(expected, indexedCalls, expand, isOnlyCall, iExpectedCall) {
var expectedLine = "Expected: ".concat(printExpectedArgs(expected), "\n");
if (indexedCalls.length === 0) {
return expectedLine;
}
var label = 'Received: ';
if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) {
var received = indexedCalls[0][1];
if (isLineDiffableCall(expected, received)) {
// Display diff without indentation.
var lines = [(0, _jestMatcherUtils.EXPECTED_COLOR)('- Expected'), (0, _jestMatcherUtils.RECEIVED_COLOR)('+ Received'), ''];
var length = Math.max(expected.length, received.length);
for (var i = 0; i < length; i += 1) {
if (i < expected.length && i < received.length) {
if (isEqualValue(expected[i], received[i])) {
lines.push(" ".concat(printCommon(received[i]), ","));
continue;
}
if (isLineDiffableArg(expected[i], received[i])) {
var difference = (0, _jestMatcherUtils.diff)(expected[i], received[i], {
expand: expand
});
if (typeof difference === 'string' && difference.includes('- Expected') && difference.includes('+ Received')) {
// Omit annotation in case multiple args have diff.
lines.push(difference.split('\n').slice(3).join('\n') + ',');
continue;
}
}
}
if (i < expected.length) {
lines.push((0, _jestMatcherUtils.EXPECTED_COLOR)('- ' + (0, _jestMatcherUtils.stringify)(expected[i])) + ',');
}
if (i < received.length) {
lines.push((0, _jestMatcherUtils.RECEIVED_COLOR)('+ ' + (0, _jestMatcherUtils.stringify)(received[i])) + ',');
}
}
return lines.join('\n') + '\n';
}
return expectedLine + label + printReceivedArgs(received, expected) + '\n';
}
var printAligned = getRightAlignedPrinter(label);
return expectedLine + 'Received\n' + indexedCalls.reduce(function (printed, _ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
i = _ref4[0],
received = _ref4[1];
var aligned = printAligned(String(i + 1), i === iExpectedCall);
return printed + ((i === iExpectedCall || iExpectedCall === undefined) && isLineDiffableCall(expected, received) ? aligned.replace(': ', '\n') + printDiffCall(expected, received, expand) : aligned + printReceivedArgs(received, expected)) + '\n';
}, '');
};
var indentation = 'Received'.replace(/\w/g, ' ');
var printDiffCall = function printDiffCall(expected, received, expand) {
return received.map(function (arg, i) {
if (i < expected.length) {
if (isEqualValue(expected[i], arg)) {
return indentation + ' ' + printCommon(arg) + ',';
}
if (isLineDiffableArg(expected[i], arg)) {
var difference = (0, _jestMatcherUtils.diff)(expected[i], arg, {
expand: expand
});
if (typeof difference === 'string' && difference.includes('- Expected') && difference.includes('+ Received')) {
// Display diff with indentation.
return difference.split('\n').slice(3).map(function (line) {
return indentation + line;
}).join('\n') + ',';
}
}
} // Display + only if received arg has no corresponding expected arg.
return indentation + (i < expected.length ? ' ' + (0, _jestMatcherUtils.printReceived)(arg) : (0, _jestMatcherUtils.RECEIVED_COLOR)('+ ' + (0, _jestMatcherUtils.stringify)(arg))) + ',';
}).join('\n');
};
var isLineDiffableCall = function isLineDiffableCall(expected, received) {
return expected.some(function (arg, i) {
return i < received.length && isLineDiffableArg(arg, received[i]);
});
}; // Almost redundant with function in jest-matcher-utils,
// except no line diff for any strings.
var isLineDiffableArg = function isLineDiffableArg(expected, received) {
var expectedType = (0, _jestGetType.default)(expected);
var receivedType = (0, _jestGetType.default)(received);
if (expectedType !== receivedType) {
return false;
}
if ((0, _jestGetType.isPrimitive)(expected)) {
return false;
}
if (expectedType === 'date' || expectedType === 'function' || expectedType === 'regexp') {
return false;
}
if (expected instanceof Error && received instanceof Error) {
return false;
}
if (expectedType === 'object' && typeof expected.asymmetricMatch === 'function') {
return false;
}
if (receivedType === 'object' && typeof received.asymmetricMatch === 'function') {
return false;
}
return true;
};
var printResult = function printResult(result, expected) {
return result.type === 'throw' ? 'function call threw an error' : result.type === 'incomplete' ? 'function call has not returned yet' : isEqualValue(expected, result.value) ? printCommon(result.value) : (0, _jestMatcherUtils.printReceived)(result.value);
};
// Return either empty string or one line per indexed result,
// so additional empty line can separate from `Number of returns` which follows.
var printReceivedResults = function printReceivedResults(label, expected, indexedResults, isOnlyCall, iExpectedCall) {
if (indexedResults.length === 0) {
return '';
}
if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) {
return label + printResult(indexedResults[0][1], expected) + '\n';
}
var printAligned = getRightAlignedPrinter(label);
return label.replace(':', '').trim() + '\n' + indexedResults.reduce(function (printed, _ref5) {
var _ref6 = _slicedToArray(_ref5, 2),
i = _ref6[0],
result = _ref6[1];
return printed + printAligned(String(i + 1), i === iExpectedCall) + printResult(result, expected) + '\n';
}, '');
};
var createToBeCalledMatcher = function createToBeCalledMatcher(matcherName) {
return function (received, expected) {
var expectedArgument = '';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
ensureMockOrSpy(received, matcherName, expectedArgument, options);
var receivedIsSpy = isSpy(received);
var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
var calls = receivedIsSpy ? received.calls.all().map(function (x) {
return x.args;
}) : received.mock.calls;
var pass = count > 0;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of calls: ".concat((0, _jestMatcherUtils.printExpected)(0), "\n") + "Received number of calls: ".concat((0, _jestMatcherUtils.printReceived)(count), "\n\n") + calls.reduce(function (lines, args, i) {
if (lines.length < PRINT_LIMIT) {
lines.push("".concat(i + 1, ": ").concat(printReceivedArgs(args)));
}
return lines;
}, []).join('\n');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of calls: >= ".concat((0, _jestMatcherUtils.printExpected)(1), "\n") + "Received number of calls: ".concat((0, _jestMatcherUtils.printReceived)(count));
};
return {
message: message,
pass: pass
};
};
};
var createToReturnMatcher = function createToReturnMatcher(matcherName) {
return function (received, expected) {
var expectedArgument = '';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
ensureMock(received, matcherName, expectedArgument, options);
var receivedName = received.getMockName(); // Count return values that correspond only to calls that returned
var count = received.mock.results.reduce(function (n, result) {
return result.type === 'return' ? n + 1 : n;
}, 0);
var pass = count > 0;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of returns: ".concat((0, _jestMatcherUtils.printExpected)(0), "\n") + "Received number of returns: ".concat((0, _jestMatcherUtils.printReceived)(count), "\n\n") + received.mock.results.reduce(function (lines, result, i) {
if (result.type === 'return' && lines.length < PRINT_LIMIT) {
lines.push("".concat(i + 1, ": ").concat((0, _jestMatcherUtils.printReceived)(result.value)));
}
return lines;
}, []).join('\n') + (received.mock.calls.length !== count ? "\n\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of returns: >= ".concat((0, _jestMatcherUtils.printExpected)(1), "\n") + "Received number of returns: ".concat((0, _jestMatcherUtils.printReceived)(count)) + (received.mock.calls.length !== count ? "\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
};
return {
message: message,
pass: pass
};
};
};
var createToBeCalledTimesMatcher = function createToBeCalledTimesMatcher(matcherName) {
return function (received, expected) {
var expectedArgument = 'expected';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureExpectedIsNumber)(expected, matcherName, options);
ensureMockOrSpy(received, matcherName, expectedArgument, options);
var receivedIsSpy = isSpy(received);
var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
var pass = count === expected;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + "\n\n" + "Expected number of calls: not ".concat((0, _jestMatcherUtils.printExpected)(expected));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of calls: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received number of calls: ".concat((0, _jestMatcherUtils.printReceived)(count));
};
return {
message: message,
pass: pass
};
};
};
var createToReturnTimesMatcher = function createToReturnTimesMatcher(matcherName) {
return function (received, expected) {
var expectedArgument = 'expected';
var options = {
isNot: this.isNot,
promise: this.promise
};
(0, _jestMatcherUtils.ensureExpectedIsNumber)(expected, matcherName, options);
ensureMock(received, matcherName, expectedArgument, options);
var receivedName = received.getMockName(); // Count return values that correspond only to calls that returned
var count = received.mock.results.reduce(function (n, result) {
return result.type === 'return' ? n + 1 : n;
}, 0);
var pass = count === expected;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + "\n\n" + "Expected number of returns: not ".concat((0, _jestMatcherUtils.printExpected)(expected)) + (received.mock.calls.length !== count ? "\n\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of returns: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received number of returns: ".concat((0, _jestMatcherUtils.printReceived)(count)) + (received.mock.calls.length !== count ? "\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
};
return {
message: message,
pass: pass
};
};
};
var createToBeCalledWithMatcher = function createToBeCalledWithMatcher(matcherName) {
return function (received) {
var _this = this;
for (var _len = arguments.length, expected = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
expected[_key - 1] = arguments[_key];
}
var expectedArgument = '...expected';
var options = {
isNot: this.isNot,
promise: this.promise
};
ensureMockOrSpy(received, matcherName, expectedArgument, options);
var receivedIsSpy = isSpy(received);
var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
var calls = receivedIsSpy ? received.calls.all().map(function (x) {
return x.args;
}) : received.mock.calls;
var pass = calls.some(function (call) {
return isEqualCall(expected, call);
});
var message = pass ? function () {
// Some examples of calls that are equal to expected value.
var indexedCalls = [];
var i = 0;
while (i < calls.length && indexedCalls.length < PRINT_LIMIT) {
if (isEqualCall(expected, calls[i])) {
indexedCalls.push([i, calls[i]]);
}
i += 1;
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat(printExpectedArgs(expected), "\n") + (calls.length === 1 && (0, _jestMatcherUtils.stringify)(calls[0]) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedCallsNegative(expected, indexedCalls, calls.length === 1)) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
} : function () {
// Some examples of calls that are not equal to expected value.
var indexedCalls = [];
var i = 0;
while (i < calls.length && indexedCalls.length < PRINT_LIMIT) {
indexedCalls.push([i, calls[i]]);
i += 1;
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(_this.expand), calls.length === 1) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
};
return {
message: message,
pass: pass
};
};
};
var createToReturnWithMatcher = function createToReturnWithMatcher(matcherName) {
return function (received, expected) {
var expectedArgument = 'expected';
var options = {
isNot: this.isNot,
promise: this.promise
};
ensureMock(received, matcherName, expectedArgument, options);
var receivedName = received.getMockName();
var _received$mock = received.mock,
calls = _received$mock.calls,
results = _received$mock.results;
var pass = results.some(function (result) {
return isEqualReturn(expected, result);
});
var message = pass ? function () {
// Some examples of results that are equal to expected value.
var indexedResults = [];
var i = 0;
while (i < results.length && indexedResults.length < PRINT_LIMIT) {
if (isEqualReturn(expected, results[i])) {
indexedResults.push([i, results[i]]);
}
i += 1;
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (results.length === 1 && results[0].type === 'return' && (0, _jestMatcherUtils.stringify)(results[0].value) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedResults('Received: ', expected, indexedResults, results.length === 1)) + printNumberOfReturns(countReturns(results), calls.length);
} : function () {
// Some examples of results that are not equal to expected value.
var indexedResults = [];
var i = 0;
while (i < results.length && indexedResults.length < PRINT_LIMIT) {
indexedResults.push([i, results[i]]);
i += 1;
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + printReceivedResults('Received: ', expected, indexedResults, results.length === 1) + printNumberOfReturns(countReturns(results), calls.length);
};
return {
message: message,
pass: pass
};
};
};
var createLastCalledWithMatcher = function createLastCalledWithMatcher(matcherName) {
return function (received) {
var _this2 = this;
for (var _len2 = arguments.length, expected = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
expected[_key2 - 1] = arguments[_key2];
}
var expectedArgument = '...expected';
var options = {
isNot: this.isNot,
promise: this.promise
};
ensureMockOrSpy(received, matcherName, expectedArgument, options);
var receivedIsSpy = isSpy(received);
var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
var calls = receivedIsSpy ? received.calls.all().map(function (x) {
return x.args;
}) : received.mock.calls;
var iLast = calls.length - 1;
var pass = iLast >= 0 && isEqualCall(expected, calls[iLast]);
var message = pass ? function () {
var indexedCalls = [];
if (iLast > 0) {
// Display preceding call as context.
indexedCalls.push([iLast - 1, calls[iLast - 1]]);
}
indexedCalls.push([iLast, calls[iLast]]);
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat(printExpectedArgs(expected), "\n") + (calls.length === 1 && (0, _jestMatcherUtils.stringify)(calls[0]) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedCallsNegative(expected, indexedCalls, calls.length === 1, iLast)) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
} : function () {
var indexedCalls = [];
if (iLast >= 0) {
if (iLast > 0) {
var i = iLast - 1; // Is there a preceding call that is equal to expected args?
while (i >= 0 && !isEqualCall(expected, calls[i])) {
i -= 1;
}
if (i < 0) {
i = iLast - 1; // otherwise, preceding call
}
indexedCalls.push([i, calls[i]]);
}
indexedCalls.push([iLast, calls[iLast]]);
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(_this2.expand), calls.length === 1, iLast) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
};
return {
message: message,
pass: pass
};
};
};
var createLastReturnedMatcher = function createLastReturnedMatcher(matcherName) {
return function (received, expected) {
var expectedArgument = 'expected';
var options = {
isNot: this.isNot,
promise: this.promise
};
ensureMock(received, matcherName, expectedArgument, options);
var receivedName = received.getMockName();
var _received$mock2 = received.mock,
calls = _received$mock2.calls,
results = _received$mock2.results;
var iLast = results.length - 1;
var pass = iLast >= 0 && isEqualReturn(expected, results[iLast]);
var message = pass ? function () {
var indexedResults = [];
if (iLast > 0) {
// Display preceding result as context.
indexedResults.push([iLast - 1, results[iLast - 1]]);
}
indexedResults.push([iLast, results[iLast]]);
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (results.length === 1 && results[0].type === 'return' && (0, _jestMatcherUtils.stringify)(results[0].value) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iLast)) + printNumberOfReturns(countReturns(results), calls.length);
} : function () {
var indexedResults = [];
if (iLast >= 0) {
if (iLast > 0) {
var i = iLast - 1; // Is there a preceding result that is equal to expected value?
while (i >= 0 && !isEqualReturn(expected, results[i])) {
i -= 1;
}
if (i < 0) {
i = iLast - 1; // otherwise, preceding result
}
indexedResults.push([i, results[i]]);
}
indexedResults.push([iLast, results[iLast]]);
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iLast) + printNumberOfReturns(countReturns(results), calls.length);
};
return {
message: message,
pass: pass
};
};
};
var createNthCalledWithMatcher = function createNthCalledWithMatcher(matcherName) {
return function (received, nth) {
var _this3 = this;
for (var _len3 = arguments.length, expected = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
expected[_key3 - 2] = arguments[_key3];
}
var expectedArgument = 'n';
var options = {
expectedColor: function expectedColor(arg) {
return arg;
},
isNot: this.isNot,
promise: this.promise,
secondArgument: '...expected'
};
ensureMockOrSpy(received, matcherName, expectedArgument, options);
if (!Number.isSafeInteger(nth) || nth < 1) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat(expectedArgument, " must be a positive integer"), (0, _jestMatcherUtils.printWithType)(expectedArgument, nth, _jestMatcherUtils.stringify)));
}
var receivedIsSpy = isSpy(received);
var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
var calls = receivedIsSpy ? received.calls.all().map(function (x) {
return x.args;
}) : received.mock.calls;
var length = calls.length;
var iNth = nth - 1;
var pass = iNth < length && isEqualCall(expected, calls[iNth]);
var message = pass ? function () {
// Display preceding and following calls,
var indexedCalls = [];
if (iNth - 1 >= 0) {
indexedCalls.push([iNth - 1, calls[iNth - 1]]);
}
indexedCalls.push([iNth, calls[iNth]]);
if (iNth + 1 < length) {
indexedCalls.push([iNth + 1, calls[iNth + 1]]);
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + "Expected: not ".concat(printExpectedArgs(expected), "\n") + (calls.length === 1 && (0, _jestMatcherUtils.stringify)(calls[0]) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedCallsNegative(expected, indexedCalls, calls.length === 1, iNth)) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
} : function () {
// Display preceding and following calls:
// * nearest call that is equal to expected args
// * otherwise, adjacent call
var indexedCalls = [];
if (iNth < length) {
if (iNth - 1 >= 0) {
var i = iNth - 1; // Is there a preceding call that is equal to expected args?
while (i >= 0 && !isEqualCall(expected, calls[i])) {
i -= 1;
}
if (i < 0) {
i = iNth - 1; // otherwise, adjacent call
}
indexedCalls.push([i, calls[i]]);
}
indexedCalls.push([iNth, calls[iNth]]);
if (iNth + 1 < length) {
var _i2 = iNth + 1; // Is there a following call that is equal to expected args?
while (_i2 < length && !isEqualCall(expected, calls[_i2])) {
_i2 += 1;
}
if (_i2 >= length) {
_i2 = iNth + 1; // otherwise, adjacent call
}
indexedCalls.push([_i2, calls[_i2]]);
}
} else if (length > 0) {
// The number of received calls is fewer than the expected number.
var _i3 = length - 1; // Is there a call that is equal to expected args?
while (_i3 >= 0 && !isEqualCall(expected, calls[_i3])) {
_i3 -= 1;
}
if (_i3 < 0) {
_i3 = length - 1; // otherwise, last call
}
indexedCalls.push([_i3, calls[_i3]]);
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(_this3.expand), calls.length === 1, iNth) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
};
return {
message: message,
pass: pass
};
};
};
var createNthReturnedWithMatcher = function createNthReturnedWithMatcher(matcherName) {
return function (received, nth, expected) {
var expectedArgument = 'n';
var options = {
expectedColor: function expectedColor(arg) {
return arg;
},
isNot: this.isNot,
promise: this.promise,
secondArgument: 'expected'
};
ensureMock(received, matcherName, expectedArgument, options);
if (!Number.isSafeInteger(nth) || nth < 1) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat(expectedArgument, " must be a positive integer"), (0, _jestMatcherUtils.printWithType)(expectedArgument, nth, _jestMatcherUtils.stringify)));
}
var receivedName = received.getMockName();
var _received$mock3 = received.mock,
calls = _received$mock3.calls,
results = _received$mock3.results;
var length = results.length;
var iNth = nth - 1;
var pass = iNth < length && isEqualReturn(expected, results[iNth]);
var message = pass ? function () {
// Display preceding and following results,
var indexedResults = [];
if (iNth - 1 >= 0) {
indexedResults.push([iNth - 1, results[iNth - 1]]);
}
indexedResults.push([iNth, results[iNth]]);
if (iNth + 1 < length) {
indexedResults.push([iNth + 1, results[iNth + 1]]);
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (results.length === 1 && results[0].type === 'return' && (0, _jestMatcherUtils.stringify)(results[0].value) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iNth)) + printNumberOfReturns(countReturns(results), calls.length);
} : function () {
// Display preceding and following results:
// * nearest result that is equal to expected value
// * otherwise, adjacent result
var indexedResults = [];
if (iNth < length) {
if (iNth - 1 >= 0) {
var i = iNth - 1; // Is there a preceding result that is equal to expected value?
while (i >= 0 && !isEqualReturn(expected, results[i])) {
i -= 1;
}
if (i < 0) {
i = iNth - 1; // otherwise, adjacent result
}
indexedResults.push([i, results[i]]);
}
indexedResults.push([iNth, results[iNth]]);
if (iNth + 1 < length) {
var _i4 = iNth + 1; // Is there a following result that is equal to expected value?
while (_i4 < length && !isEqualReturn(expected, results[_i4])) {
_i4 += 1;
}
if (_i4 >= length) {
_i4 = iNth + 1; // otherwise, adjacent result
}
indexedResults.push([_i4, results[_i4]]);
}
} else if (length > 0) {
// The number of received calls is fewer than the expected number.
var _i5 = length - 1; // Is there a result that is equal to expected value?
while (_i5 >= 0 && !isEqualReturn(expected, results[_i5])) {
_i5 -= 1;
}
if (_i5 < 0) {
_i5 = length - 1; // otherwise, last result
}
indexedResults.push([_i5, results[_i5]]);
}
return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iNth) + printNumberOfReturns(countReturns(results), calls.length);
};
return {
message: message,
pass: pass
};
};
};
var spyMatchers = {
lastCalledWith: createLastCalledWithMatcher('lastCalledWith'),
lastReturnedWith: createLastReturnedMatcher('lastReturnedWith'),
nthCalledWith: createNthCalledWithMatcher('nthCalledWith'),
nthReturnedWith: createNthReturnedWithMatcher('nthReturnedWith'),
toBeCalled: createToBeCalledMatcher('toBeCalled'),
toBeCalledTimes: createToBeCalledTimesMatcher('toBeCalledTimes'),
toBeCalledWith: createToBeCalledWithMatcher('toBeCalledWith'),
toHaveBeenCalled: createToBeCalledMatcher('toHaveBeenCalled'),
toHaveBeenCalledTimes: createToBeCalledTimesMatcher('toHaveBeenCalledTimes'),
toHaveBeenCalledWith: createToBeCalledWithMatcher('toHaveBeenCalledWith'),
toHaveBeenLastCalledWith: createLastCalledWithMatcher('toHaveBeenLastCalledWith'),
toHaveBeenNthCalledWith: createNthCalledWithMatcher('toHaveBeenNthCalledWith'),
toHaveLastReturnedWith: createLastReturnedMatcher('toHaveLastReturnedWith'),
toHaveNthReturnedWith: createNthReturnedWithMatcher('toHaveNthReturnedWith'),
toHaveReturned: createToReturnMatcher('toHaveReturned'),
toHaveReturnedTimes: createToReturnTimesMatcher('toHaveReturnedTimes'),
toHaveReturnedWith: createToReturnWithMatcher('toHaveReturnedWith'),
toReturn: createToReturnMatcher('toReturn'),
toReturnTimes: createToReturnTimesMatcher('toReturnTimes'),
toReturnWith: createToReturnWithMatcher('toReturnWith')
};
var isMock = function isMock(received) {
return received != null && received._isMockFunction === true;
};
var isSpy = function isSpy(received) {
return received != null && received.calls != null && typeof received.calls.all === 'function' && typeof received.calls.count === 'function';
};
var ensureMockOrSpy = function ensureMockOrSpy(received, matcherName, expectedArgument, options) {
if (!isMock(received) && !isSpy(received)) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a mock or spy function"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
};
var ensureMock = function ensureMock(received, matcherName, expectedArgument, options) {
if (!isMock(received)) {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a mock function"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
};
var _default = spyMatchers;
exports.default = _default;
/***/ }),
/***/ "./packages/expect/src/toThrowMatchers.ts":
/*!************************************************!*\
!*** ./packages/expect/src/toThrowMatchers.ts ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.createMatcher = void 0;
var _jestMessageUtil = __webpack_require__(/*! jest-message-util */ "./packages/jest-message-util/build/index.js");
var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
var _print = __webpack_require__(/*! ./print */ "./packages/expect/src/print.ts");
var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var DID_NOT_THROW = 'Received function did not throw';
var getThrown = function getThrown(e) {
var hasMessage = e !== null && e !== undefined && typeof e.message === 'string';
if (hasMessage && typeof e.name === 'string' && typeof e.stack === 'string') {
return {
hasMessage: hasMessage,
isError: true,
message: e.message,
value: e
};
}
return {
hasMessage: hasMessage,
isError: false,
message: hasMessage ? e.message : String(e),
value: e
};
};
var createMatcher = function createMatcher(matcherName, fromPromise) {
return function (received, expected) {
var options = {
isNot: this.isNot,
promise: this.promise
};
var thrown = null;
if (fromPromise && (0, _utils.isError)(received)) {
thrown = getThrown(received);
} else {
if (typeof received !== 'function') {
if (!fromPromise) {
var placeholder = expected === undefined ? '' : 'expected';
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, placeholder, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a function"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
}
} else {
try {
received();
} catch (e) {
thrown = getThrown(e);
}
}
}
if (expected === undefined) {
return toThrow(matcherName, options, thrown);
} else if (typeof expected === 'function') {
return toThrowExpectedClass(matcherName, options, thrown, expected);
} else if (typeof expected === 'string') {
return toThrowExpectedString(matcherName, options, thrown, expected);
} else if (expected !== null && typeof expected.test === 'function') {
return toThrowExpectedRegExp(matcherName, options, thrown, expected);
} else if (expected !== null && typeof expected.asymmetricMatch === 'function') {
return toThrowExpectedAsymmetric(matcherName, options, thrown, expected);
} else if (expected !== null && _typeof(expected) === 'object') {
return toThrowExpectedObject(matcherName, options, thrown, expected);
} else {
throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a string or regular expression or class or error"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
}
};
};
exports.createMatcher = createMatcher;
var matchers = {
toThrow: createMatcher('toThrow'),
toThrowError: createMatcher('toThrowError')
};
var toThrowExpectedRegExp = function toThrowExpectedRegExp(matcherName, options, thrown, expected) {
var pass = thrown !== null && expected.test(thrown.message);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected pattern: not ', expected) + (thrown !== null && thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message', expected) + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected pattern: ', expected) + (thrown === null ? '\n' + DID_NOT_THROW : thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
};
return {
message: message,
pass: pass
};
};
var toThrowExpectedAsymmetric = function toThrowExpectedAsymmetric(matcherName, options, thrown, expected) {
var pass = thrown !== null && expected.asymmetricMatch(thrown.value);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected asymmetric matcher: not ', expected) + '\n' + (thrown !== null && thrown.hasMessage ? formatReceived('Received name: ', thrown, 'name') + formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value'));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected asymmetric matcher: ', expected) + '\n' + (thrown === null ? DID_NOT_THROW : thrown.hasMessage ? formatReceived('Received name: ', thrown, 'name') + formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value'));
};
return {
message: message,
pass: pass
};
};
var toThrowExpectedObject = function toThrowExpectedObject(matcherName, options, thrown, expected) {
var pass = thrown !== null && thrown.message === expected.message;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected message: not ', expected.message) + (thrown !== null && thrown.hasMessage ? formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (thrown === null ? formatExpected('Expected message: ', expected.message) + '\n' + DID_NOT_THROW : thrown.hasMessage ? (0, _jestMatcherUtils.printDiffOrStringify)(expected.message, thrown.message, 'Expected message', 'Received message', true) + '\n' + formatStack(thrown) : formatExpected('Expected message: ', expected.message) + formatReceived('Received value: ', thrown, 'value'));
};
return {
message: message,
pass: pass
};
};
var toThrowExpectedClass = function toThrowExpectedClass(matcherName, options, thrown, expected) {
var pass = thrown !== null && thrown.value instanceof expected;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorNameNot)('Expected constructor', expected) + (thrown !== null && thrown.value != null && typeof thrown.value.constructor === 'function' && thrown.value.constructor !== expected ? (0, _print.printReceivedConstructorNameNot)('Received constructor', thrown.value.constructor, expected) : '') + '\n' + (thrown !== null && thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorName)('Expected constructor', expected) + (thrown === null ? '\n' + DID_NOT_THROW : (thrown.value != null && typeof thrown.value.constructor === 'function' ? (0, _print.printReceivedConstructorName)('Received constructor', thrown.value.constructor) : '') + '\n' + (thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value')));
};
return {
message: message,
pass: pass
};
};
var toThrowExpectedString = function toThrowExpectedString(matcherName, options, thrown, expected) {
var pass = thrown !== null && thrown.message.includes(expected);
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected substring: not ', expected) + (thrown !== null && thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message', expected) + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected substring: ', expected) + (thrown === null ? '\n' + DID_NOT_THROW : thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
};
return {
message: message,
pass: pass
};
};
var toThrow = function toThrow(matcherName, options, thrown) {
var pass = thrown !== null;
var message = pass ? function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + (thrown !== null && thrown.hasMessage ? formatReceived('Error name: ', thrown, 'name') + formatReceived('Error message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value'));
} : function () {
return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + DID_NOT_THROW;
};
return {
message: message,
pass: pass
};
};
var formatExpected = function formatExpected(label, expected) {
return label + (0, _jestMatcherUtils.printExpected)(expected) + '\n';
};
var formatReceived = function formatReceived(label, thrown, key, expected) {
if (thrown === null) {
return '';
}
if (key === 'message') {
var _message = thrown.message;
if (typeof expected === 'string') {
var index = _message.indexOf(expected);
if (index !== -1) {
return label + (0, _print.printReceivedStringContainExpectedSubstring)(_message, index, expected.length) + '\n';
}
} else if (expected instanceof RegExp) {
return label + (0, _print.printReceivedStringContainExpectedResult)(_message, typeof expected.exec === 'function' ? expected.exec(_message) : null) + '\n';
}
return label + (0, _jestMatcherUtils.printReceived)(_message) + '\n';
}
if (key === 'name') {
return thrown.isError ? label + (0, _jestMatcherUtils.printReceived)(thrown.value.name) + '\n' : '';
}
if (key === 'value') {
return thrown.isError ? '' : label + (0, _jestMatcherUtils.printReceived)(thrown.value) + '\n';
}
return '';
};
var formatStack = function formatStack(thrown) {
return thrown === null || !thrown.isError ? '' : (0, _jestMessageUtil.formatStackTrace)((0, _jestMessageUtil.separateMessageFromStack)(thrown.value.stack).stack, {
rootDir: process.cwd(),
testMatch: []
}, {
noStackTrace: false
});
};
var _default = matchers;
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./packages/expect/src/utils.ts":
/*!**************************************!*\
!*** ./packages/expect/src/utils.ts ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.emptyObject = emptyObject;
exports.isOneline = exports.isError = exports.partition = exports.sparseArrayEquality = exports.typeEquality = exports.subsetEquality = exports.iterableEquality = exports.getObjectSubset = exports.getPath = exports.hasOwnProperty = void 0;
var _jestGetType = __webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js");
var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Return whether object instance inherits getter from its class.
var hasGetterFromConstructor = function hasGetterFromConstructor(object, key) {
var constructor = object.constructor;
if (constructor === Object) {
// A literal object has Object as constructor.
// Therefore, it cannot inherit application-specific getters.
// Furthermore, Object has __proto__ getter which is not relevant.
// Array, Boolean, Number, String constructors dont have any getters.
return false;
}
if (typeof constructor !== 'function') {
// Object.create(null) constructs object with no constructor nor prototype.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects
return false;
}
var descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, key);
return descriptor !== undefined && typeof descriptor.get === 'function';
};
var hasOwnProperty = function hasOwnProperty(object, key) {
return Object.prototype.hasOwnProperty.call(object, key) || hasGetterFromConstructor(object, key);
};
exports.hasOwnProperty = hasOwnProperty;
var getPath = function getPath(object, propertyPath) {
if (!Array.isArray(propertyPath)) {
propertyPath = propertyPath.split('.');
}
if (propertyPath.length) {
var lastProp = propertyPath.length === 1;
var prop = propertyPath[0];
var newObject = object[prop];
if (!lastProp && (newObject === null || newObject === undefined)) {
// This is not the last prop in the chain. If we keep recursing it will
// hit a `can't access property X of undefined | null`. At this point we
// know that the chain has broken and we can return right away.
return {
hasEndProp: false,
lastTraversedObject: object,
traversedPath: []
};
}
var result = getPath(newObject, propertyPath.slice(1));
if (result.lastTraversedObject === null) {
result.lastTraversedObject = object;
}
result.traversedPath.unshift(prop);
if (lastProp) {
// Does object have the property with an undefined value?
// Although primitive values support bracket notation (above)
// they would throw TypeError for in operator (below).
result.hasEndProp = newObject !== undefined || !(0, _jestGetType.isPrimitive)(object) && prop in object;
if (!result.hasEndProp) {
result.traversedPath.shift();
}
}
return result;
}
return {
lastTraversedObject: null,
traversedPath: [],
value: object
};
}; // Strip properties from object that are not present in the subset. Useful for
// printing the diff for toMatchObject() without adding unrelated noise.
exports.getPath = getPath;
var getObjectSubset = function getObjectSubset(object, subset) {
var seenReferences = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakMap();
if (Array.isArray(object)) {
if (Array.isArray(subset) && subset.length === object.length) {
return subset.map(function (sub, i) {
return getObjectSubset(object[i], sub);
});
}
} else if (object instanceof Date) {
return object;
} else if (isObject(object) && isObject(subset)) {
var trimmed = {};
seenReferences.set(object, trimmed);
Object.keys(object).filter(function (key) {
return hasOwnProperty(subset, key);
}).forEach(function (key) {
trimmed[key] = seenReferences.has(object[key]) ? seenReferences.get(object[key]) : getObjectSubset(object[key], subset[key], seenReferences);
});
if (Object.keys(trimmed).length > 0) {
return trimmed;
}
}
return object;
};
exports.getObjectSubset = getObjectSubset;
var IteratorSymbol = Symbol.iterator;
var hasIterator = function hasIterator(object) {
return !!(object != null && object[IteratorSymbol]);
};
var iterableEquality = function iterableEquality(a, b) {
var aStack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
var bStack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
if (_typeof(a) !== 'object' || _typeof(b) !== 'object' || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
return undefined;
}
if (a.constructor !== b.constructor) {
return false;
}
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
// circular references at same depth are equal
// circular reference is not equal to non-circular one
if (aStack[length] === a) {
return bStack[length] === b;
}
}
aStack.push(a);
bStack.push(b);
var iterableEqualityWithStack = function iterableEqualityWithStack(a, b) {
return iterableEquality(a, b, _toConsumableArray(aStack), _toConsumableArray(bStack));
};
if (a.size !== undefined) {
if (a.size !== b.size) {
return false;
} else if ((0, _jasmineUtils.isA)('Set', a) || (0, _jasmineUtils.isImmutableUnorderedSet)(a)) {
var allFound = true;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = a[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var aValue = _step.value;
if (!b.has(aValue)) {
var has = false;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = b[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var bValue = _step2.value;
var isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [iterableEqualityWithStack]);
if (isEqual === true) {
has = true;
}
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
if (has === false) {
allFound = false;
break;
}
}
} // Remove the first value from the stack of traversed values.
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
aStack.pop();
bStack.pop();
return allFound;
} else if ((0, _jasmineUtils.isA)('Map', a) || (0, _jasmineUtils.isImmutableUnorderedKeyed)(a)) {
var _allFound = true;
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = a[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var aEntry = _step3.value;
if (!b.has(aEntry[0]) || !(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [iterableEqualityWithStack])) {
var _has = false;
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = b[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var bEntry = _step4.value;
var matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], [iterableEqualityWithStack]);
var matchedValue = false;
if (matchedKey === true) {
matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], [iterableEqualityWithStack]);
}
if (matchedValue === true) {
_has = true;
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
if (_has === false) {
_allFound = false;
break;
}
}
} // Remove the first value from the stack of traversed values.
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
aStack.pop();
bStack.pop();
return _allFound;
}
}
var bIterator = b[IteratorSymbol]();
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (var _iterator5 = a[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var _aValue = _step5.value;
var nextB = bIterator.next();
if (nextB.done || !(0, _jasmineUtils.equals)(_aValue, nextB.value, [iterableEqualityWithStack])) {
return false;
}
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
_iterator5.return();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
if (!bIterator.next().done) {
return false;
} // Remove the first value from the stack of traversed values.
aStack.pop();
bStack.pop();
return true;
};
exports.iterableEquality = iterableEquality;
var isObject = function isObject(a) {
return a !== null && _typeof(a) === 'object';
};
var isObjectWithKeys = function isObjectWithKeys(a) {
return isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
};
var subsetEquality = function subsetEquality(object, subset) {
// subsetEquality needs to keep track of the references
// it has already visited to avoid infinite loops in case
// there are circular references in the subset passed to it.
var subsetEqualityWithContext = function subsetEqualityWithContext() {
var seenReferences = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new WeakMap();
return function (object, subset) {
if (!isObjectWithKeys(subset)) {
return undefined;
}
return Object.keys(subset).every(function (key) {
if (isObjectWithKeys(subset[key])) {
if (seenReferences.get(subset[key])) {
return (0, _jasmineUtils.equals)(object[key], subset[key], [iterableEquality]);
}
seenReferences.set(subset[key], true);
}
return object != null && hasOwnProperty(object, key) && (0, _jasmineUtils.equals)(object[key], subset[key], [iterableEquality, subsetEqualityWithContext(seenReferences)]);
});
};
};
return subsetEqualityWithContext()(object, subset);
};
exports.subsetEquality = subsetEquality;
var typeEquality = function typeEquality(a, b) {
if (a == null || b == null || a.constructor === b.constructor) {
return undefined;
}
return false;
};
exports.typeEquality = typeEquality;
var sparseArrayEquality = function sparseArrayEquality(a, b) {
if (!Array.isArray(a) || !Array.isArray(b)) {
return undefined;
} // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"]
var aKeys = Object.keys(a);
var bKeys = Object.keys(b);
return (0, _jasmineUtils.equals)(a, b, [iterableEquality, typeEquality], true) && (0, _jasmineUtils.equals)(aKeys, bKeys);
};
exports.sparseArrayEquality = sparseArrayEquality;
var partition = function partition(items, predicate) {
var result = [[], []];
items.forEach(function (item) {
return result[predicate(item) ? 0 : 1].push(item);
});
return result;
}; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
exports.partition = partition;
var isError = function isError(value) {
switch (Object.prototype.toString.call(value)) {
case '[object Error]':
return true;
case '[object Exception]':
return true;
case '[object DOMException]':
return true;
default:
return value instanceof Error;
}
};
exports.isError = isError;
function emptyObject(obj) {
return obj && _typeof(obj) === 'object' ? !Object.keys(obj).length : false;
}
var MULTILINE_REGEXP = /[\r\n]/;
var isOneline = function isOneline(expected, received) {
return typeof expected === 'string' && typeof received === 'string' && (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
};
exports.isOneline = isOneline;
/***/ }),
/***/ "./packages/jest-diff/build/cleanupSemantic.js":
/*!*****************************************************!*\
!*** ./packages/jest-diff/build/cleanupSemantic.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.cleanupSemantic = exports.DIFF_INSERT = exports.DIFF_DELETE = exports.DIFF_EQUAL = exports.Diff = void 0;
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* Diff Match and Patch
* Copyright 2018 The diff-match-patch Authors.
* https://github.com/google/diff-match-patch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Computes the difference between two texts to create a patch.
* Applies the patch onto another text, allowing for errors.
* @author fraser@google.com (Neil Fraser)
*/
/**
* CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file:
*
* 1. Delete anything not needed to use diff_cleanupSemantic method
* 2. Convert from prototype properties to var declarations
* 3. Convert Diff to class from constructor and prototype
* 4. Add type annotations for arguments and return values
* 5. Add exports
*/
/**
* The data structure representing a diff is an array of tuples:
* [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
* which means: delete 'Hello', add 'Goodbye' and keep ' world.'
*/
var DIFF_DELETE = -1;
exports.DIFF_DELETE = DIFF_DELETE;
var DIFF_INSERT = 1;
exports.DIFF_INSERT = DIFF_INSERT;
var DIFF_EQUAL = 0;
/**
* Class representing one diff tuple.
* Attempts to look like a two-element array (which is what this used to be).
* @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
* @param {string} text Text to be deleted, inserted, or retained.
* @constructor
*/
exports.DIFF_EQUAL = DIFF_EQUAL;
var Diff = function Diff(op, text) {
_classCallCheck(this, Diff);
_defineProperty(this, 0, void 0);
_defineProperty(this, 1, void 0);
this[0] = op;
this[1] = text;
};
/**
* Determine the common prefix of two strings.
* @param {string} text1 First string.
* @param {string} text2 Second string.
* @return {number} The number of characters common to the start of each
* string.
*/
exports.Diff = Diff;
var diff_commonPrefix = function diff_commonPrefix(text1, text2) {
// Quick check for common null cases.
if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
return 0;
} // Binary search.
// Performance analysis: https://neil.fraser.name/news/2007/10/09/
var pointermin = 0;
var pointermax = Math.min(text1.length, text2.length);
var pointermid = pointermax;
var pointerstart = 0;
while (pointermin < pointermid) {
if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
pointermin = pointermid;
pointerstart = pointermin;
} else {
pointermax = pointermid;
}
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
}
return pointermid;
};
/**
* Determine the common suffix of two strings.
* @param {string} text1 First string.
* @param {string} text2 Second string.
* @return {number} The number of characters common to the end of each string.
*/
var diff_commonSuffix = function diff_commonSuffix(text1, text2) {
// Quick check for common null cases.
if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
return 0;
} // Binary search.
// Performance analysis: https://neil.fraser.name/news/2007/10/09/
var pointermin = 0;
var pointermax = Math.min(text1.length, text2.length);
var pointermid = pointermax;
var pointerend = 0;
while (pointermin < pointermid) {
if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
pointermin = pointermid;
pointerend = pointermin;
} else {
pointermax = pointermid;
}
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
}
return pointermid;
};
/**
* Determine if the suffix of one string is the prefix of another.
* @param {string} text1 First string.
* @param {string} text2 Second string.
* @return {number} The number of characters common to the end of the first
* string and the start of the second string.
* @private
*/
var diff_commonOverlap_ = function diff_commonOverlap_(text1, text2) {
// Cache the text lengths to prevent multiple calls.
var text1_length = text1.length;
var text2_length = text2.length; // Eliminate the null case.
if (text1_length == 0 || text2_length == 0) {
return 0;
} // Truncate the longer string.
if (text1_length > text2_length) {
text1 = text1.substring(text1_length - text2_length);
} else if (text1_length < text2_length) {
text2 = text2.substring(0, text1_length);
}
var text_length = Math.min(text1_length, text2_length); // Quick check for the worst case.
if (text1 == text2) {
return text_length;
} // Start by looking for a single character match
// and increase length until no match is found.
// Performance analysis: https://neil.fraser.name/news/2010/11/04/
var best = 0;
var length = 1;
while (true) {
var pattern = text1.substring(text_length - length);
var found = text2.indexOf(pattern);
if (found == -1) {
return best;
}
length += found;
if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) {
best = length;
length++;
}
}
};
/**
* Reduce the number of edits by eliminating semantically trivial equalities.
* @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
*/
var diff_cleanupSemantic = function diff_cleanupSemantic(diffs) {
var changes = false;
var equalities = []; // Stack of indices where equalities are found.
var equalitiesLength = 0; // Keeping our own length var is faster in JS.
/** @type {?string} */
var lastEquality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1]
var pointer = 0; // Index of current position.
// Number of characters that changed prior to the equality.
var length_insertions1 = 0;
var length_deletions1 = 0; // Number of characters that changed after the equality.
var length_insertions2 = 0;
var length_deletions2 = 0;
while (pointer < diffs.length) {
if (diffs[pointer][0] == DIFF_EQUAL) {
// Equality found.
equalities[equalitiesLength++] = pointer;
length_insertions1 = length_insertions2;
length_deletions1 = length_deletions2;
length_insertions2 = 0;
length_deletions2 = 0;
lastEquality = diffs[pointer][1];
} else {
// An insertion or deletion.
if (diffs[pointer][0] == DIFF_INSERT) {
length_insertions2 += diffs[pointer][1].length;
} else {
length_deletions2 += diffs[pointer][1].length;
} // Eliminate an equality that is smaller or equal to the edits on both
// sides of it.
if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(length_insertions2, length_deletions2)) {
// Duplicate record.
diffs.splice(equalities[equalitiesLength - 1], 0, new Diff(DIFF_DELETE, lastEquality)); // Change second copy to insert.
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; // Throw away the equality we just deleted.
equalitiesLength--; // Throw away the previous equality (it needs to be reevaluated).
equalitiesLength--;
pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
length_insertions1 = 0; // Reset the counters.
length_deletions1 = 0;
length_insertions2 = 0;
length_deletions2 = 0;
lastEquality = null;
changes = true;
}
}
pointer++;
} // Normalize the diff.
if (changes) {
diff_cleanupMerge(diffs);
}
diff_cleanupSemanticLossless(diffs); // Find any overlaps between deletions and insertions.
// e.g: <del>abcxxx</del><ins>xxxdef</ins>
// -> <del>abc</del>xxx<ins>def</ins>
// e.g: <del>xxxabc</del><ins>defxxx</ins>
// -> <ins>def</ins>xxx<del>abc</del>
// Only extract an overlap if it is as big as the edit ahead or behind it.
pointer = 1;
while (pointer < diffs.length) {
if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) {
var deletion = diffs[pointer - 1][1];
var insertion = diffs[pointer][1];
var overlap_length1 = diff_commonOverlap_(deletion, insertion);
var overlap_length2 = diff_commonOverlap_(insertion, deletion);
if (overlap_length1 >= overlap_length2) {
if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
// Overlap found. Insert an equality and trim the surrounding edits.
diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1)));
diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
diffs[pointer + 1][1] = insertion.substring(overlap_length1);
pointer++;
}
} else {
if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
// Reverse overlap found.
// Insert an equality and swap and trim the surrounding edits.
diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2)));
diffs[pointer - 1][0] = DIFF_INSERT;
diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
diffs[pointer + 1][0] = DIFF_DELETE;
diffs[pointer + 1][1] = deletion.substring(overlap_length2);
pointer++;
}
}
pointer++;
}
pointer++;
}
};
/**
* Look for single edits surrounded on both sides by equalities
* which can be shifted sideways to align the edit to a word boundary.
* e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
* @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
*/
exports.cleanupSemantic = diff_cleanupSemantic;
var diff_cleanupSemanticLossless = function diff_cleanupSemanticLossless(diffs) {
/**
* Given two strings, compute a score representing whether the internal
* boundary falls on logical boundaries.
* Scores range from 6 (best) to 0 (worst).
* Closure, but does not reference any external variables.
* @param {string} one First string.
* @param {string} two Second string.
* @return {number} The score.
* @private
*/
function diff_cleanupSemanticScore_(one, two) {
if (!one || !two) {
// Edges are the best.
return 6;
} // Each port of this function behaves slightly differently due to
// subtle differences in each language's definition of things like
// 'whitespace'. Since this function's purpose is largely cosmetic,
// the choice has been made to use each language's native features
// rather than force total conformity.
var char1 = one.charAt(one.length - 1);
var char2 = two.charAt(0);
var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
var lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
var lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
if (blankLine1 || blankLine2) {
// Five points for blank lines.
return 5;
} else if (lineBreak1 || lineBreak2) {
// Four points for line breaks.
return 4;
} else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
// Three points for end of sentences.
return 3;
} else if (whitespace1 || whitespace2) {
// Two points for whitespace.
return 2;
} else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
// One point for non-alphanumeric.
return 1;
}
return 0;
}
var pointer = 1; // Intentionally ignore the first and last element (don't need checking).
while (pointer < diffs.length - 1) {
if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
// This is a single edit surrounded by equalities.
var equality1 = diffs[pointer - 1][1];
var edit = diffs[pointer][1];
var equality2 = diffs[pointer + 1][1]; // First, shift the edit as far left as possible.
var commonOffset = diff_commonSuffix(equality1, edit);
if (commonOffset) {
var commonString = edit.substring(edit.length - commonOffset);
equality1 = equality1.substring(0, equality1.length - commonOffset);
edit = commonString + edit.substring(0, edit.length - commonOffset);
equality2 = commonString + equality2;
} // Second, step character by character right, looking for the best fit.
var bestEquality1 = equality1;
var bestEdit = edit;
var bestEquality2 = equality2;
var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
while (edit.charAt(0) === equality2.charAt(0)) {
equality1 += edit.charAt(0);
edit = edit.substring(1) + equality2.charAt(0);
equality2 = equality2.substring(1);
var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); // The >= encourages trailing rather than leading whitespace on edits.
if (score >= bestScore) {
bestScore = score;
bestEquality1 = equality1;
bestEdit = edit;
bestEquality2 = equality2;
}
}
if (diffs[pointer - 1][1] != bestEquality1) {
// We have an improvement, save it back to the diff.
if (bestEquality1) {
diffs[pointer - 1][1] = bestEquality1;
} else {
diffs.splice(pointer - 1, 1);
pointer--;
}
diffs[pointer][1] = bestEdit;
if (bestEquality2) {
diffs[pointer + 1][1] = bestEquality2;
} else {
diffs.splice(pointer + 1, 1);
pointer--;
}
}
}
pointer++;
}
}; // Define some regex patterns for matching boundaries.
var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
var whitespaceRegex_ = /\s/;
var linebreakRegex_ = /[\r\n]/;
var blanklineEndRegex_ = /\n\r?\n$/;
var blanklineStartRegex_ = /^\r?\n\r?\n/;
/**
* Reorder and merge like edit sections. Merge equalities.
* Any edit section can move as long as it doesn't cross an equality.
* @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
*/
var diff_cleanupMerge = function diff_cleanupMerge(diffs) {
// Add a dummy entry at the end.
diffs.push(new Diff(DIFF_EQUAL, ''));
var pointer = 0;
var count_delete = 0;
var count_insert = 0;
var text_delete = '';
var text_insert = '';
var commonlength;
while (pointer < diffs.length) {
switch (diffs[pointer][0]) {
case DIFF_INSERT:
count_insert++;
text_insert += diffs[pointer][1];
pointer++;
break;
case DIFF_DELETE:
count_delete++;
text_delete += diffs[pointer][1];
pointer++;
break;
case DIFF_EQUAL:
// Upon reaching an equality, check for prior redundancies.
if (count_delete + count_insert > 1) {
if (count_delete !== 0 && count_insert !== 0) {
// Factor out any common prefixies.
commonlength = diff_commonPrefix(text_insert, text_delete);
if (commonlength !== 0) {
if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL) {
diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
} else {
diffs.splice(0, 0, new Diff(DIFF_EQUAL, text_insert.substring(0, commonlength)));
pointer++;
}
text_insert = text_insert.substring(commonlength);
text_delete = text_delete.substring(commonlength);
} // Factor out any common suffixies.
commonlength = diff_commonSuffix(text_insert, text_delete);
if (commonlength !== 0) {
diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
text_insert = text_insert.substring(0, text_insert.length - commonlength);
text_delete = text_delete.substring(0, text_delete.length - commonlength);
}
} // Delete the offending records and add the merged ones.
pointer -= count_delete + count_insert;
diffs.splice(pointer, count_delete + count_insert);
if (text_delete.length) {
diffs.splice(pointer, 0, new Diff(DIFF_DELETE, text_delete));
pointer++;
}
if (text_insert.length) {
diffs.splice(pointer, 0, new Diff(DIFF_INSERT, text_insert));
pointer++;
}
pointer++;
} else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
// Merge this equality with the previous one.
diffs[pointer - 1][1] += diffs[pointer][1];
diffs.splice(pointer, 1);
} else {
pointer++;
}
count_insert = 0;
count_delete = 0;
text_delete = '';
text_insert = '';
break;
}
}
if (diffs[diffs.length - 1][1] === '') {
diffs.pop(); // Remove the dummy entry at the end.
} // Second pass: look for single edits surrounded on both sides by equalities
// which can be shifted sideways to eliminate an equality.
// e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
var changes = false;
pointer = 1; // Intentionally ignore the first and last element (don't need checking).
while (pointer < diffs.length - 1) {
if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
// This is a single edit surrounded by equalities.
if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
// Shift the edit over the previous equality.
diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
diffs.splice(pointer - 1, 1);
changes = true;
} else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
// Shift the edit over the next equality.
diffs[pointer - 1][1] += diffs[pointer + 1][1];
diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
diffs.splice(pointer + 1, 1);
changes = true;
}
}
pointer++;
} // If shifts were made, the diff needs reordering and another shift sweep.
if (changes) {
diff_cleanupMerge(diffs);
}
};
/***/ }),
/***/ "./packages/jest-diff/build/constants.js":
/*!***********************************************!*\
!*** ./packages/jest-diff/build/constants.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.SIMILAR_MESSAGE = exports.NO_DIFF_MESSAGE = void 0;
var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var NO_DIFF_MESSAGE = _chalk.default.dim('Compared values have no visual difference.');
exports.NO_DIFF_MESSAGE = NO_DIFF_MESSAGE;
var SIMILAR_MESSAGE = _chalk.default.dim('Compared values serialize to the same structure.\n' + 'Printing internal object structure without calling `toJSON` instead.');
exports.SIMILAR_MESSAGE = SIMILAR_MESSAGE;
/***/ }),
/***/ "./packages/jest-diff/build/diffLines.js":
/*!***********************************************!*\
!*** ./packages/jest-diff/build/diffLines.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
var _diffSequences = _interopRequireDefault(__webpack_require__(/*! diff-sequences */ "./packages/diff-sequences/build/index.js"));
var _constants = __webpack_require__(/*! ./constants */ "./packages/jest-diff/build/constants.js");
var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var DIFF_CONTEXT_DEFAULT = 5;
var fgDelete = _chalk.default.green;
var fgInsert = _chalk.default.red;
var fgCommon = _chalk.default.dim; // common lines (even indentation same)
var fgIndent = _chalk.default.cyan; // common lines (only indentation different)
var bgCommon = _chalk.default.bgYellow; // edge spaces in common line (even indentation same)
var bgInverse = _chalk.default.inverse; // edge spaces in any other lines
// ONLY trailing if expected value is snapshot or multiline string.
var highlightTrailingSpaces = function highlightTrailingSpaces(line, bgColor) {
return line.replace(/\s+$/, bgColor('$&'));
}; // BOTH leading AND trailing if expected value is data structure.
var highlightLeadingTrailingSpaces = function highlightLeadingTrailingSpaces(line, bgColor // If line consists of ALL spaces: highlight all of them.
) {
return highlightTrailingSpaces(line, bgColor).replace( // If line has an ODD length of leading spaces: highlight only the LAST.
/^(\s\s)*(\s)(?=[^\s])/, '$1' + bgColor('$2'));
};
var getHighlightSpaces = function getHighlightSpaces(bothEdges) {
return bothEdges ? highlightLeadingTrailingSpaces : highlightTrailingSpaces;
}; // Given index interval in expected lines, put formatted delete lines.
var formatDelete = function formatDelete(aStart, aEnd, aLinesUn, aLinesIn, put) {
var highlightSpaces = getHighlightSpaces(aLinesUn !== aLinesIn);
for (var aIndex = aStart; aIndex !== aEnd; aIndex += 1) {
var aLineUn = aLinesUn[aIndex];
var aLineIn = aLinesIn[aIndex];
var indentation = aLineIn.slice(0, aLineIn.length - aLineUn.length);
put(fgDelete('- ' + indentation + highlightSpaces(aLineUn, bgInverse)));
}
}; // Given index interval in received lines, put formatted insert lines.
var formatInsert = function formatInsert(bStart, bEnd, bLinesUn, bLinesIn, put) {
var highlightSpaces = getHighlightSpaces(bLinesUn !== bLinesIn);
for (var bIndex = bStart; bIndex !== bEnd; bIndex += 1) {
var bLineUn = bLinesUn[bIndex];
var bLineIn = bLinesIn[bIndex];
var indentation = bLineIn.slice(0, bLineIn.length - bLineUn.length);
put(fgInsert('+ ' + indentation + highlightSpaces(bLineUn, bgInverse)));
}
}; // Given the number of items and starting indexes of a common subsequence,
// put formatted common lines.
var formatCommon = function formatCommon(nCommon, aCommon, bCommon, aLinesIn, bLinesUn, bLinesIn, put) {
var highlightSpaces = getHighlightSpaces(bLinesUn !== bLinesIn);
for (; nCommon !== 0; nCommon -= 1, aCommon += 1, bCommon += 1) {
var bLineUn = bLinesUn[bCommon];
var bLineIn = bLinesIn[bCommon];
var bLineInLength = bLineIn.length; // For common lines, received indentation seems more intuitive.
var indentation = bLineIn.slice(0, bLineInLength - bLineUn.length); // Color shows whether expected and received line has same indentation.
var hasSameIndentation = aLinesIn[aCommon].length === bLineInLength;
var fg = hasSameIndentation ? fgCommon : fgIndent;
var bg = hasSameIndentation ? bgCommon : bgInverse;
put(fg(' ' + indentation + highlightSpaces(bLineUn, bg)));
}
}; // jest --expand
// Return formatted diff as joined string of all lines.
var diffExpand = function diffExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn) {
var isCommon = function isCommon(aIndex, bIndex) {
return aLinesUn[aIndex] === bLinesUn[bIndex];
};
var array = [];
var put = function put(line) {
array.push(line);
};
var aStart = 0;
var bStart = 0;
var foundSubsequence = function foundSubsequence(nCommon, aCommon, bCommon) {
formatDelete(aStart, aCommon, aLinesUn, aLinesIn, put);
formatInsert(bStart, bCommon, bLinesUn, bLinesIn, put);
formatCommon(nCommon, aCommon, bCommon, aLinesIn, bLinesUn, bLinesIn, put);
aStart = aCommon + nCommon;
bStart = bCommon + nCommon;
};
var aLength = aLinesUn.length;
var bLength = bLinesUn.length;
(0, _diffSequences.default)(aLength, bLength, isCommon, foundSubsequence); // After the last common subsequence, format remaining change lines.
formatDelete(aStart, aLength, aLinesUn, aLinesIn, put);
formatInsert(bStart, bLength, bLinesUn, bLinesIn, put);
return array.join('\n');
};
var getContextLines = function getContextLines(options) {
return options && typeof options.contextLines === 'number' && options.contextLines >= 0 ? options.contextLines : DIFF_CONTEXT_DEFAULT;
}; // jest --no-expand
// Return joined string of formatted diff for all change lines,
// but if some common lines are omitted because there are more than the context,
// then a “patch mark” precedes each set of adjacent changed and common lines.
var diffNoExpand = function diffNoExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn, nContextLines) {
var isCommon = function isCommon(aIndex, bIndex) {
return aLinesUn[aIndex] === bLinesUn[bIndex];
};
var iPatchMark = 0; // index of placeholder line for patch mark
var array = [''];
var put = function put(line) {
array.push(line);
};
var isAtEnd = false;
var aLength = aLinesUn.length;
var bLength = bLinesUn.length;
var nContextLines2 = nContextLines + nContextLines; // Initialize the first patch for changes at the start,
// especially for edge case in which there is no common subsequence.
var aStart = 0;
var aEnd = 0;
var bStart = 0;
var bEnd = 0; // Given the number of items and starting indexes of each common subsequence,
// format any preceding change lines, and then common context lines.
var foundSubsequence = function foundSubsequence(nCommon, aStartCommon, bStartCommon) {
var aEndCommon = aStartCommon + nCommon;
var bEndCommon = bStartCommon + nCommon;
isAtEnd = aEndCommon === aLength && bEndCommon === bLength; // If common subsequence is at start, re-initialize the first patch.
if (aStartCommon === 0 && bStartCommon === 0) {
var nLines = nContextLines < nCommon ? nContextLines : nCommon;
aStart = aEndCommon - nLines;
bStart = bEndCommon - nLines;
formatCommon(nLines, aStart, bStart, aLinesIn, bLinesUn, bLinesIn, put);
aEnd = aEndCommon;
bEnd = bEndCommon;
return;
} // Format preceding change lines.
formatDelete(aEnd, aStartCommon, aLinesUn, aLinesIn, put);
formatInsert(bEnd, bStartCommon, bLinesUn, bLinesIn, put);
aEnd = aStartCommon;
bEnd = bStartCommon; // If common subsequence is at end, then context follows preceding changes;
// else context follows preceding changes AND precedes following changes.
var maxContextLines = isAtEnd ? nContextLines : nContextLines2;
if (nCommon <= maxContextLines) {
// The patch includes all lines in the common subsequence.
formatCommon(nCommon, aEnd, bEnd, aLinesIn, bLinesUn, bLinesIn, put);
aEnd += nCommon;
bEnd += nCommon;
return;
} // The patch ends because context is less than number of common lines.
formatCommon(nContextLines, aEnd, bEnd, aLinesIn, bLinesUn, bLinesIn, put);
aEnd += nContextLines;
bEnd += nContextLines;
array[iPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd); // If common subsequence is not at end, another patch follows it.
if (!isAtEnd) {
iPatchMark = array.length; // index of placeholder line
array[iPatchMark] = '';
var _nLines = nContextLines < nCommon ? nContextLines : nCommon;
aStart = aEndCommon - _nLines;
bStart = bEndCommon - _nLines;
formatCommon(_nLines, aStart, bStart, aLinesIn, bLinesUn, bLinesIn, put);
aEnd = aEndCommon;
bEnd = bEndCommon;
}
};
(0, _diffSequences.default)(aLength, bLength, isCommon, foundSubsequence); // If no common subsequence or last was not at end, format remaining change lines.
if (!isAtEnd) {
formatDelete(aEnd, aLength, aLinesUn, aLinesIn, put);
formatInsert(bEnd, bLength, bLinesUn, bLinesIn, put);
aEnd = aLength;
bEnd = bLength;
}
if (aStart === 0 && aEnd === aLength && bStart === 0 && bEnd === bLength) {
array.splice(0, 1); // delete placeholder line for patch mark
} else {
array[iPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd);
}
return array.join('\n');
};
var _default = function _default(a, b, options, original) {
if (a === b) {
return _constants.NO_DIFF_MESSAGE;
}
var aLinesUn = a.split('\n');
var bLinesUn = b.split('\n'); // Indentation is unknown if expected value is snapshot or multiline string.
var aLinesIn = aLinesUn;
var bLinesIn = bLinesUn;
if (original) {
// Indentation is known if expected value is data structure:
// Compare lines without indentation and format lines with indentation.
aLinesIn = original.a.split('\n');
bLinesIn = original.b.split('\n');
if (aLinesUn.length !== aLinesIn.length || bLinesUn.length !== bLinesIn.length) {
// Fall back if unindented and indented lines are inconsistent.
aLinesUn = aLinesIn;
bLinesUn = bLinesIn;
}
}
return (0, _printDiffs.printAnnotation)(options) + (options && options.expand === false ? diffNoExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn, getContextLines(options)) : diffExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn));
};
exports.default = _default;
/***/ }),
/***/ "./packages/jest-diff/build/diffStrings.js":
/*!*************************************************!*\
!*** ./packages/jest-diff/build/diffStrings.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
var _diffSequences = _interopRequireDefault(__webpack_require__(/*! diff-sequences */ "./packages/diff-sequences/build/index.js"));
var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var diffStrings = function diffStrings(a, b) {
var isCommon = function isCommon(aIndex, bIndex) {
return a[aIndex] === b[bIndex];
};
var aIndex = 0;
var bIndex = 0;
var diffs = [];
var foundSubsequence = function foundSubsequence(nCommon, aCommon, bCommon) {
if (aIndex !== aCommon) {
diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, a.slice(aIndex, aCommon)));
}
if (bIndex !== bCommon) {
diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, b.slice(bIndex, bCommon)));
}
aIndex = aCommon + nCommon; // number of characters compared in a
bIndex = bCommon + nCommon; // number of characters compared in b
diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_EQUAL, b.slice(bCommon, bIndex)));
};
(0, _diffSequences.default)(a.length, b.length, isCommon, foundSubsequence); // After the last common subsequence, push remaining change items.
if (aIndex !== a.length) {
diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, a.slice(aIndex)));
}
if (bIndex !== b.length) {
diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, b.slice(bIndex)));
}
return diffs;
};
var _default = diffStrings;
exports.default = _default;
/***/ }),
/***/ "./packages/jest-diff/build/getAlignedDiffs.js":
/*!*****************************************************!*\
!*** ./packages/jest-diff/build/getAlignedDiffs.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
} // Encapsulate change lines until either a common newline or the end.
var ChangeBuffer =
/*#__PURE__*/
function () {
// incomplete line
// complete lines
function ChangeBuffer(op) {
_classCallCheck(this, ChangeBuffer);
_defineProperty(this, 'op', void 0);
_defineProperty(this, 'line', void 0);
_defineProperty(this, 'lines', void 0);
this.op = op;
this.line = [];
this.lines = [];
}
_createClass(ChangeBuffer, [{
key: "pushSubstring",
value: function pushSubstring(substring) {
this.pushDiff(new _cleanupSemantic.Diff(this.op, substring));
}
}, {
key: "pushLine",
value: function pushLine() {
// Assume call only if line has at least one diff,
// therefore an empty line must have a diff which has an empty string.
this.lines.push(new _cleanupSemantic.Diff(this.op, (0, _printDiffs.getHighlightedString)(this.op, this.line)));
this.line.length = 0;
}
}, {
key: "isLineEmpty",
value: function isLineEmpty() {
return this.line.length === 0;
} // Minor input to buffer.
}, {
key: "pushDiff",
value: function pushDiff(diff) {
this.line.push(diff);
} // Main input to buffer.
}, {
key: "align",
value: function align(diff) {
var _this = this;
var string = diff[1];
if (_printDiffs.MULTILINE_REGEXP.test(string)) {
var substrings = string.split('\n');
var iLast = substrings.length - 1;
substrings.forEach(function (substring, i) {
if (i < iLast) {
// The first substring completes the current change line.
// A middle substring is a change line.
_this.pushSubstring(substring);
_this.pushLine();
} else if (substring.length !== 0) {
// The last substring starts a change line, if it is not empty.
// Important: This non-empty condition also automatically omits
// the newline appended to the end of expected and received strings.
_this.pushSubstring(substring);
}
});
} else {
// Append non-multiline string to current change line.
this.pushDiff(diff);
}
} // Output from buffer.
}, {
key: "moveLinesTo",
value: function moveLinesTo(lines) {
if (!this.isLineEmpty()) {
this.pushLine();
}
lines.push.apply(lines, _toConsumableArray(this.lines));
this.lines.length = 0;
}
}]);
return ChangeBuffer;
}(); // Encapsulate common and change lines.
var CommonBuffer =
/*#__PURE__*/
function () {
function CommonBuffer(deleteBuffer, insertBuffer) {
_classCallCheck(this, CommonBuffer);
_defineProperty(this, 'deleteBuffer', void 0);
_defineProperty(this, 'insertBuffer', void 0);
_defineProperty(this, 'lines', void 0);
this.deleteBuffer = deleteBuffer;
this.insertBuffer = insertBuffer;
this.lines = [];
}
_createClass(CommonBuffer, [{
key: "pushDiffCommonLine",
value: function pushDiffCommonLine(diff) {
this.lines.push(diff);
}
}, {
key: "pushDiffChangeLines",
value: function pushDiffChangeLines(diff) {
var isDiffEmpty = diff[1].length === 0; // An empty diff string is redundant, unless a change line is empty.
if (!isDiffEmpty || this.deleteBuffer.isLineEmpty()) {
this.deleteBuffer.pushDiff(diff);
}
if (!isDiffEmpty || this.insertBuffer.isLineEmpty()) {
this.insertBuffer.pushDiff(diff);
}
}
}, {
key: "flushChangeLines",
value: function flushChangeLines() {
this.deleteBuffer.moveLinesTo(this.lines);
this.insertBuffer.moveLinesTo(this.lines);
} // Input to buffer.
}, {
key: "align",
value: function align(diff) {
var _this2 = this;
var op = diff[0];
var string = diff[1];
if (_printDiffs.MULTILINE_REGEXP.test(string)) {
var substrings = string.split('\n');
var iLast = substrings.length - 1;
substrings.forEach(function (substring, i) {
if (i === 0) {
var subdiff = new _cleanupSemantic.Diff(op, substring);
if (_this2.deleteBuffer.isLineEmpty() && _this2.insertBuffer.isLineEmpty()) {
// If both current change lines are empty,
// then the first substring is a common line.
_this2.flushChangeLines();
_this2.pushDiffCommonLine(subdiff);
} else {
// If either current change line is non-empty,
// then the first substring completes the change lines.
_this2.pushDiffChangeLines(subdiff);
_this2.flushChangeLines();
}
} else if (i < iLast) {
// A middle substring is a common line.
_this2.pushDiffCommonLine(new _cleanupSemantic.Diff(op, substring));
} else if (substring.length !== 0) {
// The last substring starts a change line, if it is not empty.
// Important: This non-empty condition also automatically omits
// the newline appended to the end of expected and received strings.
_this2.pushDiffChangeLines(new _cleanupSemantic.Diff(op, substring));
}
});
} else {
// Append non-multiline string to current change lines.
// Important: It cannot be at the end following empty change lines,
// because newline appended to the end of expected and received strings.
this.pushDiffChangeLines(diff);
}
} // Output from buffer.
}, {
key: "getLines",
value: function getLines() {
this.flushChangeLines();
return this.lines;
}
}]);
return CommonBuffer;
}(); // Given diffs from expected and received strings,
// return new array of diffs split or joined into lines.
//
// To correctly align a change line at the end, the algorithm:
// * assumes that a newline was appended to the strings
// * omits the last newline from the output array
//
// Assume the function is not called:
// * if either expected or received is empty string
// * if neither expected nor received is multiline string
var getAlignedDiffs = function getAlignedDiffs(diffs) {
var deleteBuffer = new ChangeBuffer(_cleanupSemantic.DIFF_DELETE);
var insertBuffer = new ChangeBuffer(_cleanupSemantic.DIFF_INSERT);
var commonBuffer = new CommonBuffer(deleteBuffer, insertBuffer);
diffs.forEach(function (diff) {
switch (diff[0]) {
case _cleanupSemantic.DIFF_DELETE:
deleteBuffer.align(diff);
break;
case _cleanupSemantic.DIFF_INSERT:
insertBuffer.align(diff);
break;
default:
commonBuffer.align(diff);
}
});
return commonBuffer.getLines();
};
var _default = getAlignedDiffs;
exports.default = _default;
/***/ }),
/***/ "./packages/jest-diff/build/index.js":
/*!*******************************************!*\
!*** ./packages/jest-diff/build/index.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var _prettyFormat = _interopRequireDefault(__webpack_require__(/*! pretty-format */ "./packages/pretty-format/build/index.js"));
var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
var _jestGetType = _interopRequireDefault(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
var _diffLines = _interopRequireDefault(__webpack_require__(/*! ./diffLines */ "./packages/jest-diff/build/diffLines.js"));
var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
var _constants = __webpack_require__(/*! ./constants */ "./packages/jest-diff/build/constants.js");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var _prettyFormat$plugins = _prettyFormat.default.plugins,
AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
DOMCollection = _prettyFormat$plugins.DOMCollection,
DOMElement = _prettyFormat$plugins.DOMElement,
Immutable = _prettyFormat$plugins.Immutable,
ReactElement = _prettyFormat$plugins.ReactElement,
ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
var FORMAT_OPTIONS = {
plugins: PLUGINS
};
var FORMAT_OPTIONS_0 = _objectSpread({}, FORMAT_OPTIONS, {
indent: 0
});
var FALLBACK_FORMAT_OPTIONS = {
callToJSON: false,
maxDepth: 10,
plugins: PLUGINS
};
var FALLBACK_FORMAT_OPTIONS_0 = _objectSpread({}, FALLBACK_FORMAT_OPTIONS, {
indent: 0
}); // Generate a string that will highlight the difference between two values
// with green and red. (similar to how github does code diffing)
function diff(a, b, options) {
if (Object.is(a, b)) {
return _constants.NO_DIFF_MESSAGE;
}
var aType = (0, _jestGetType.default)(a);
var expectedType = aType;
var omitDifference = false;
if (aType === 'object' && typeof a.asymmetricMatch === 'function') {
if (a.$$typeof !== _Symbol.for('jest.asymmetricMatcher')) {
// Do not know expected type of user-defined asymmetric matcher.
return null;
}
if (typeof a.getExpectedType !== 'function') {
// For example, expect.anything() matches either null or undefined
return null;
}
expectedType = a.getExpectedType(); // Primitive types boolean and number omit difference below.
// For example, omit difference for expect.stringMatching(regexp)
omitDifference = expectedType === 'string';
}
if (expectedType !== (0, _jestGetType.default)(b)) {
return ' Comparing two different types of values.' + " Expected ".concat(_chalk.default.green(expectedType), " but ") + "received ".concat(_chalk.default.red((0, _jestGetType.default)(b)), ".");
}
if (omitDifference) {
return null;
}
switch (aType) {
case 'string':
return (0, _diffLines.default)(a, b, options);
case 'boolean':
case 'number':
return comparePrimitive(a, b, options);
case 'map':
return compareObjects(sortMap(a), sortMap(b), options);
case 'set':
return compareObjects(sortSet(a), sortSet(b), options);
default:
return compareObjects(a, b, options);
}
}
function comparePrimitive(a, b, options) {
return (0, _diffLines.default)((0, _prettyFormat.default)(a, FORMAT_OPTIONS), (0, _prettyFormat.default)(b, FORMAT_OPTIONS), options);
}
function sortMap(map) {
return new Map(Array.from(map.entries()).sort());
}
function sortSet(set) {
return new Set(Array.from(set.values()).sort());
}
function compareObjects(a, b, options) {
var diffMessage;
var hasThrown = false;
try {
diffMessage = (0, _diffLines.default)((0, _prettyFormat.default)(a, FORMAT_OPTIONS_0), (0, _prettyFormat.default)(b, FORMAT_OPTIONS_0), options, {
a: (0, _prettyFormat.default)(a, FORMAT_OPTIONS),
b: (0, _prettyFormat.default)(b, FORMAT_OPTIONS)
});
} catch (e) {
hasThrown = true;
} // If the comparison yields no results, compare again but this time
// without calling `toJSON`. It's also possible that toJSON might throw.
if (!diffMessage || diffMessage === _constants.NO_DIFF_MESSAGE) {
diffMessage = (0, _diffLines.default)((0, _prettyFormat.default)(a, FALLBACK_FORMAT_OPTIONS_0), (0, _prettyFormat.default)(b, FALLBACK_FORMAT_OPTIONS_0), options, {
a: (0, _prettyFormat.default)(a, FALLBACK_FORMAT_OPTIONS),
b: (0, _prettyFormat.default)(b, FALLBACK_FORMAT_OPTIONS)
});
if (diffMessage !== _constants.NO_DIFF_MESSAGE && !hasThrown) {
diffMessage = _constants.SIMILAR_MESSAGE + '\n\n' + diffMessage;
}
}
return diffMessage;
} // eslint-disable-next-line no-redeclare
diff.getStringDiff = _printDiffs.getStringDiff;
module.exports = diff;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./packages/jest-diff/build/joinAlignedDiffs.js":
/*!******************************************************!*\
!*** ./packages/jest-diff/build/joinAlignedDiffs.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.joinAlignedDiffsExpand = exports.joinAlignedDiffsNoExpand = void 0;
var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var DIFF_CONTEXT_DEFAULT = 5; // same as diffLines
// jest --no-expand
//
// Given array of aligned strings with inverse highlight formatting,
// return joined lines with diff formatting (and patch marks, if needed).
var joinAlignedDiffsNoExpand = function joinAlignedDiffsNoExpand(diffs) {
var nContextLines = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIFF_CONTEXT_DEFAULT;
var iLength = diffs.length;
var nContextLines2 = nContextLines + nContextLines; // First pass: count output lines and see if it has patches.
var jLength = iLength;
var hasExcessAtStartOrEnd = false;
var nExcessesBetweenChanges = 0;
var i = 0;
while (i !== iLength) {
var iStart = i;
while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) {
i += 1;
}
if (iStart !== i) {
if (iStart === 0) {
// at start
if (i > nContextLines) {
jLength -= i - nContextLines; // subtract excess common lines
hasExcessAtStartOrEnd = true;
}
} else if (i === iLength) {
// at end
var n = i - iStart;
if (n > nContextLines) {
jLength -= n - nContextLines; // subtract excess common lines
hasExcessAtStartOrEnd = true;
}
} else {
// between changes
var _n = i - iStart;
if (_n > nContextLines2) {
jLength -= _n - nContextLines2; // subtract excess common lines
nExcessesBetweenChanges += 1;
}
}
}
while (i !== iLength && diffs[i][0] !== _cleanupSemantic.DIFF_EQUAL) {
i += 1;
}
}
var hasPatch = nExcessesBetweenChanges !== 0 || hasExcessAtStartOrEnd;
if (nExcessesBetweenChanges !== 0) {
jLength += nExcessesBetweenChanges + 1; // add patch lines
} else if (hasExcessAtStartOrEnd) {
jLength += 1; // add patch line
}
var jLast = jLength - 1;
var lines = [];
var jPatchMark = 0; // index of placeholder line for current patch mark
if (hasPatch) {
lines.push(''); // placeholder line for first patch mark
} // Indexes of expected or received lines in current patch:
var aStart = 0;
var bStart = 0;
var aEnd = 0;
var bEnd = 0;
var pushCommonLine = function pushCommonLine(line) {
var j = lines.length;
lines.push((0, _printDiffs.printCommonLine)(line, j === 0 || j === jLast));
aEnd += 1;
bEnd += 1;
};
var pushDeleteLine = function pushDeleteLine(line) {
lines.push((0, _printDiffs.printDeleteLine)(line));
aEnd += 1;
};
var pushInsertLine = function pushInsertLine(line) {
lines.push((0, _printDiffs.printInsertLine)(line));
bEnd += 1;
}; // Second pass: push lines with diff formatting (and patch marks, if needed).
i = 0;
while (i !== iLength) {
var _iStart = i;
while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) {
i += 1;
}
if (_iStart !== i) {
if (_iStart === 0) {
// at beginning
if (i > nContextLines) {
_iStart = i - nContextLines;
aStart = _iStart;
bStart = _iStart;
aEnd = aStart;
bEnd = bStart;
}
for (var iCommon = _iStart; iCommon !== i; iCommon += 1) {
pushCommonLine(diffs[iCommon][1]);
}
} else if (i === iLength) {
// at end
var iEnd = i - _iStart > nContextLines ? _iStart + nContextLines : i;
for (var _iCommon = _iStart; _iCommon !== iEnd; _iCommon += 1) {
pushCommonLine(diffs[_iCommon][1]);
}
} else {
// between changes
var nCommon = i - _iStart;
if (nCommon > nContextLines2) {
var _iEnd = _iStart + nContextLines;
for (var _iCommon2 = _iStart; _iCommon2 !== _iEnd; _iCommon2 += 1) {
pushCommonLine(diffs[_iCommon2][1]);
}
lines[jPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd);
jPatchMark = lines.length;
lines.push(''); // placeholder line for next patch mark
var nOmit = nCommon - nContextLines2;
aStart = aEnd + nOmit;
bStart = bEnd + nOmit;
aEnd = aStart;
bEnd = bStart;
for (var _iCommon3 = i - nContextLines; _iCommon3 !== i; _iCommon3 += 1) {
pushCommonLine(diffs[_iCommon3][1]);
}
} else {
for (var _iCommon4 = _iStart; _iCommon4 !== i; _iCommon4 += 1) {
pushCommonLine(diffs[_iCommon4][1]);
}
}
}
}
while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_DELETE) {
pushDeleteLine(diffs[i][1]);
i += 1;
}
while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_INSERT) {
pushInsertLine(diffs[i][1]);
i += 1;
}
}
if (hasPatch) {
lines[jPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd);
}
return lines.join('\n');
}; // jest --expand
//
// Given array of aligned strings with inverse highlight formatting,
// return joined lines with diff formatting.
exports.joinAlignedDiffsNoExpand = joinAlignedDiffsNoExpand;
var joinAlignedDiffsExpand = function joinAlignedDiffsExpand(diffs) {
return diffs.map(function (diff, i, diffs) {
var line = diff[1];
switch (diff[0]) {
case _cleanupSemantic.DIFF_DELETE:
return (0, _printDiffs.printDeleteLine)(line);
case _cleanupSemantic.DIFF_INSERT:
return (0, _printDiffs.printInsertLine)(line);
default:
return (0, _printDiffs.printCommonLine)(line, i === 0 || i === diffs.length - 1);
}
}).join('\n');
};
exports.joinAlignedDiffsExpand = joinAlignedDiffsExpand;
/***/ }),
/***/ "./packages/jest-diff/build/printDiffs.js":
/*!************************************************!*\
!*** ./packages/jest-diff/build/printDiffs.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.getStringDiff = exports.printMultilineStringDiffs = exports.createPatchMark = exports.printAnnotation = exports.hasCommonDiff = exports.computeStringDiffs = exports.printCommonLine = exports.printInsertLine = exports.printDeleteLine = exports.MULTILINE_REGEXP = exports.getReceivedString = exports.getExpectedString = exports.getHighlightedString = exports.RECEIVED_COLOR = exports.INVERTED_COLOR = exports.EXPECTED_COLOR = exports.DIM_COLOR = void 0;
var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
var _diffStrings = _interopRequireDefault(__webpack_require__(/*! ./diffStrings */ "./packages/jest-diff/build/diffStrings.js"));
var _getAlignedDiffs = _interopRequireDefault(__webpack_require__(/*! ./getAlignedDiffs */ "./packages/jest-diff/build/getAlignedDiffs.js"));
var _joinAlignedDiffs = __webpack_require__(/*! ./joinAlignedDiffs */ "./packages/jest-diff/build/joinAlignedDiffs.js");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var DIM_COLOR = _chalk.default.dim;
exports.DIM_COLOR = DIM_COLOR;
var EXPECTED_COLOR = _chalk.default.green;
exports.EXPECTED_COLOR = EXPECTED_COLOR;
var INVERTED_COLOR = _chalk.default.inverse;
exports.INVERTED_COLOR = INVERTED_COLOR;
var RECEIVED_COLOR = _chalk.default.red;
exports.RECEIVED_COLOR = RECEIVED_COLOR;
var PATCH_COLOR = _chalk.default.yellow; // Given change op and array of diffs, return concatenated string:
// * include common strings
// * include change strings which have argument op (inverse highlight)
// * exclude change strings which have opposite op
var getHighlightedString = function getHighlightedString(op, diffs) {
return diffs.reduce(function (reduced, diff) {
return reduced + (diff[0] === _cleanupSemantic.DIFF_EQUAL ? diff[1] : diff[0] === op ? INVERTED_COLOR(diff[1]) : '');
}, '');
};
exports.getHighlightedString = getHighlightedString;
var getExpectedString = function getExpectedString(diffs) {
return getHighlightedString(_cleanupSemantic.DIFF_DELETE, diffs);
};
exports.getExpectedString = getExpectedString;
var getReceivedString = function getReceivedString(diffs) {
return getHighlightedString(_cleanupSemantic.DIFF_INSERT, diffs);
};
exports.getReceivedString = getReceivedString;
var MULTILINE_REGEXP = /\n/;
exports.MULTILINE_REGEXP = MULTILINE_REGEXP;
var NEWLINE_SYMBOL = "\u21B5"; // downwards arrow with corner leftwards
var SPACE_SYMBOL = "\xB7"; // middle dot
// Instead of inverse highlight which now implies a change,
// replace common spaces with middle dot at the end of the line.
var replaceSpacesAtEnd = function replaceSpacesAtEnd(line) {
return line.replace(/\s+$/, function (spaces) {
return SPACE_SYMBOL.repeat(spaces.length);
});
};
var printDeleteLine = function printDeleteLine(line) {
return EXPECTED_COLOR(line.length !== 0 ? '- ' + replaceSpacesAtEnd(line) : '-');
};
exports.printDeleteLine = printDeleteLine;
var printInsertLine = function printInsertLine(line) {
return RECEIVED_COLOR(line.length !== 0 ? '+ ' + replaceSpacesAtEnd(line) : '+');
}; // Prevent visually ambiguous empty line as the first or the last.
exports.printInsertLine = printInsertLine;
var printCommonLine = function printCommonLine(line) {
var isFirstOrLast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return line.length !== 0 ? DIM_COLOR(' ' + replaceSpacesAtEnd(line)) : isFirstOrLast ? DIM_COLOR(' ' + NEWLINE_SYMBOL) : '';
};
exports.printCommonLine = printCommonLine;
var computeStringDiffs = function computeStringDiffs(expected, received) {
var isMultiline = MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received); // getAlignedDiffs assumes that a newline was appended to the strings.
if (isMultiline) {
expected += '\n';
received += '\n';
}
var diffs = (0, _diffStrings.default)(expected, received);
(0, _cleanupSemantic.cleanupSemantic)(diffs); // impure function
return {
diffs: diffs,
isMultiline: isMultiline
};
};
exports.computeStringDiffs = computeStringDiffs;
var hasCommonDiff = function hasCommonDiff(diffs, isMultiline) {
if (isMultiline) {
// Important: Ignore common newline that was appended to multiline strings!
var iLast = diffs.length - 1;
return diffs.some(function (diff, i) {
return diff[0] === _cleanupSemantic.DIFF_EQUAL && (i !== iLast || diff[1] !== '\n');
});
}
return diffs.some(function (diff) {
return diff[0] === _cleanupSemantic.DIFF_EQUAL;
});
};
exports.hasCommonDiff = hasCommonDiff;
var printAnnotation = function printAnnotation(options) {
return EXPECTED_COLOR('- ' + (options && options.aAnnotation || 'Expected')) + '\n' + RECEIVED_COLOR('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n';
}; // In GNU diff format, indexes are one-based instead of zero-based.
exports.printAnnotation = printAnnotation;
var createPatchMark = function createPatchMark(aStart, aEnd, bStart, bEnd) {
return PATCH_COLOR("@@ -".concat(aStart + 1, ",").concat(aEnd - aStart, " +").concat(bStart + 1, ",").concat(bEnd - bStart, " @@"));
}; // Return formatted diff lines without labels.
exports.createPatchMark = createPatchMark;
var printMultilineStringDiffs = function printMultilineStringDiffs(diffs, expand) {
var lines = (0, _getAlignedDiffs.default)(diffs);
return expand ? (0, _joinAlignedDiffs.joinAlignedDiffsExpand)(lines) : (0, _joinAlignedDiffs.joinAlignedDiffsNoExpand)(lines);
};
exports.printMultilineStringDiffs = printMultilineStringDiffs;
var MAX_DIFF_STRING_LENGTH = 20000; // Print specific substring diff for strings only:
// * if strings are not equal
// * if neither string is empty
// * if neither string is too long
// * if there is a common string after semantic cleanup
var getStringDiff = function getStringDiff(expected, received, options) {
if (expected === received || expected.length === 0 || received.length === 0 || expected.length > MAX_DIFF_STRING_LENGTH || received.length > MAX_DIFF_STRING_LENGTH) {
return null;
}
var _computeStringDiffs = computeStringDiffs(expected, received),
diffs = _computeStringDiffs.diffs,
isMultiline = _computeStringDiffs.isMultiline;
if (!hasCommonDiff(diffs, isMultiline)) {
return null;
}
return isMultiline ? {
annotatedDiff: printAnnotation(options) + printMultilineStringDiffs(diffs, options === undefined || options.expand !== false),
isMultiline: isMultiline
} : {
a: getExpectedString(diffs),
b: getReceivedString(diffs),
isMultiline: isMultiline
};
};
exports.getStringDiff = getStringDiff;
/***/ }),
/***/ "./packages/jest-get-type/build/index.js":
/*!***********************************************!*\
!*** ./packages/jest-get-type/build/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// get the type of a value with handling the edge cases like `typeof []`
// and `typeof null`
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function getType(value) {
if (value === undefined) {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Array.isArray(value)) {
return 'array';
} else if (typeof value === 'boolean') {
return 'boolean';
} else if (typeof value === 'function') {
return 'function';
} else if (typeof value === 'number') {
return 'number';
} else if (typeof value === 'string') {
return 'string';
} else if (_typeof(value) === 'object') {
if (value != null) {
if (value.constructor === RegExp) {
return 'regexp';
} else if (value.constructor === Map) {
return 'map';
} else if (value.constructor === Set) {
return 'set';
} else if (value.constructor === Date) {
return 'date';
}
}
return 'object';
} else if (_typeof(value) === 'symbol') {
return 'symbol';
}
throw new Error("value of unknown type: ".concat(value));
}
getType.isPrimitive = function (value) {
return Object(value) !== value;
};
module.exports = getType;
/***/ }),
/***/ "./packages/jest-matcher-utils/build/index.js":
/*!****************************************************!*\
!*** ./packages/jest-matcher-utils/build/index.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'DiffOptions', {
enumerable: true,
get: function get() {
return _jestDiff.DiffOptions;
}
});
exports.matcherHint = exports.matcherErrorMessage = exports.getLabelPrinter = exports.pluralize = exports.diff = exports.printDiffOrStringify = exports.ensureExpectedIsNonNegativeInteger = exports.ensureNumbers = exports.ensureExpectedIsNumber = exports.ensureActualIsNumber = exports.ensureNoExpected = exports.printWithType = exports.printExpected = exports.printReceived = exports.highlightTrailingWhitespace = exports.stringify = exports.SUGGEST_TO_CONTAIN_EQUAL = exports.DIM_COLOR = exports.BOLD_WEIGHT = exports.INVERTED_COLOR = exports.RECEIVED_COLOR = exports.EXPECTED_COLOR = void 0;
var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
var _jestDiff = _interopRequireWildcard(__webpack_require__(/*! jest-diff */ "./packages/jest-diff/build/index.js"));
var _jestGetType = _interopRequireWildcard(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
var _prettyFormat = _interopRequireDefault(__webpack_require__(/*! pretty-format */ "./packages/pretty-format/build/index.js"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var _prettyFormat$plugins = _prettyFormat.default.plugins,
AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
DOMCollection = _prettyFormat$plugins.DOMCollection,
DOMElement = _prettyFormat$plugins.DOMElement,
Immutable = _prettyFormat$plugins.Immutable,
ReactElement = _prettyFormat$plugins.ReactElement,
ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
var EXPECTED_COLOR = _chalk.default.green;
exports.EXPECTED_COLOR = EXPECTED_COLOR;
var RECEIVED_COLOR = _chalk.default.red;
exports.RECEIVED_COLOR = RECEIVED_COLOR;
var INVERTED_COLOR = _chalk.default.inverse;
exports.INVERTED_COLOR = INVERTED_COLOR;
var BOLD_WEIGHT = _chalk.default.bold;
exports.BOLD_WEIGHT = BOLD_WEIGHT;
var DIM_COLOR = _chalk.default.dim;
exports.DIM_COLOR = DIM_COLOR;
var MULTILINE_REGEXP = /\n/;
var SPACE_SYMBOL = "\xB7"; // middle dot
var NUMBERS = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen'];
var SUGGEST_TO_CONTAIN_EQUAL = _chalk.default.dim('Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.');
exports.SUGGEST_TO_CONTAIN_EQUAL = SUGGEST_TO_CONTAIN_EQUAL;
var stringify = function stringify(object) {
var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
var MAX_LENGTH = 10000;
var result;
try {
result = (0, _prettyFormat.default)(object, {
maxDepth: maxDepth,
min: true,
plugins: PLUGINS
});
} catch (e) {
result = (0, _prettyFormat.default)(object, {
callToJSON: false,
maxDepth: maxDepth,
min: true,
plugins: PLUGINS
});
}
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
};
exports.stringify = stringify;
var highlightTrailingWhitespace = function highlightTrailingWhitespace(text) {
return text.replace(/\s+$/gm, _chalk.default.inverse('$&'));
}; // Instead of inverse highlight which now implies a change,
// replace common spaces with middle dot at the end of any line.
exports.highlightTrailingWhitespace = highlightTrailingWhitespace;
var replaceTrailingSpaces = function replaceTrailingSpaces(text) {
return text.replace(/\s+$/gm, function (spaces) {
return SPACE_SYMBOL.repeat(spaces.length);
});
};
var printReceived = function printReceived(object) {
return RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
};
exports.printReceived = printReceived;
var printExpected = function printExpected(value) {
return EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
};
exports.printExpected = printExpected;
var printWithType = function printWithType(name, value, print // printExpected or printReceived
) {
var type = (0, _jestGetType.default)(value);
var hasType = type !== 'null' && type !== 'undefined' ? "".concat(name, " has type: ").concat(type, "\n") : '';
var hasValue = "".concat(name, " has value: ").concat(print(value));
return hasType + hasValue;
};
exports.printWithType = printWithType;
var ensureNoExpected = function ensureNoExpected(expected, matcherName, options) {
if (typeof expected !== 'undefined') {
// Prepend maybe not only for backward compatibility.
var matcherString = (options ? '' : '[.not]') + matcherName;
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, '', options), // Because expected is omitted in hint above,
'this matcher must not have an expected argument', printWithType('Expected', expected, printExpected)));
}
};
exports.ensureNoExpected = ensureNoExpected;
var ensureActualIsNumber = function ensureActualIsNumber(actual, matcherName, options) {
if (typeof actual !== 'number') {
// Prepend maybe not only for backward compatibility.
var matcherString = (options ? '' : '[.not]') + matcherName;
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), "".concat(RECEIVED_COLOR('received'), " value must be a number"), printWithType('Received', actual, printReceived)));
}
};
exports.ensureActualIsNumber = ensureActualIsNumber;
var ensureExpectedIsNumber = function ensureExpectedIsNumber(expected, matcherName, options) {
if (typeof expected !== 'number') {
// Prepend maybe not only for backward compatibility.
var matcherString = (options ? '' : '[.not]') + matcherName;
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), "".concat(EXPECTED_COLOR('expected'), " value must be a number"), printWithType('Expected', expected, printExpected)));
}
};
exports.ensureExpectedIsNumber = ensureExpectedIsNumber;
var ensureNumbers = function ensureNumbers(actual, expected, matcherName, options) {
ensureActualIsNumber(actual, matcherName, options);
ensureExpectedIsNumber(expected, matcherName, options);
};
exports.ensureNumbers = ensureNumbers;
var ensureExpectedIsNonNegativeInteger = function ensureExpectedIsNonNegativeInteger(expected, matcherName, options) {
if (typeof expected !== 'number' || !Number.isSafeInteger(expected) || expected < 0) {
// Prepend maybe not only for backward compatibility.
var matcherString = (options ? '' : '[.not]') + matcherName;
throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), "".concat(EXPECTED_COLOR('expected'), " value must be a non-negative integer"), printWithType('Expected', expected, printExpected)));
}
};
exports.ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger;
var isLineDiffable = function isLineDiffable(expected, received) {
var expectedType = (0, _jestGetType.default)(expected);
var receivedType = (0, _jestGetType.default)(received);
if (expectedType !== receivedType) {
return false;
}
if ((0, _jestGetType.isPrimitive)(expected)) {
// Print generic line diff for strings only:
// * if neither string is empty
return typeof expected === 'string' && typeof received === 'string' && expected.length !== 0 && received.length !== 0 && (MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received));
}
if (expectedType === 'date' || expectedType === 'function' || expectedType === 'regexp') {
return false;
}
if (expected instanceof Error && received instanceof Error) {
return false;
}
if (expectedType === 'object' && typeof expected.asymmetricMatch === 'function') {
return false;
}
if (receivedType === 'object' && typeof received.asymmetricMatch === 'function') {
return false;
}
return true;
};
var printDiffOrStringify = function printDiffOrStringify(expected, received, expectedLabel, receivedLabel, expand) {
if (typeof expected === 'string' && typeof received === 'string') {
var result = (0, _jestDiff.getStringDiff)(expected, received, {
aAnnotation: expectedLabel,
bAnnotation: receivedLabel,
expand: expand
});
if (result !== null) {
if (result.isMultiline) {
return result.annotatedDiff;
}
var _printLabel = getLabelPrinter(expectedLabel, receivedLabel);
var _expectedLine = _printLabel(expectedLabel) + printExpected(result.a);
var _receivedLine = _printLabel(receivedLabel) + printReceived(result.b);
return _expectedLine + '\n' + _receivedLine;
}
}
if (isLineDiffable(expected, received)) {
var difference = (0, _jestDiff.default)(expected, received, {
aAnnotation: expectedLabel,
bAnnotation: receivedLabel,
expand: expand
});
if (typeof difference === 'string' && difference.includes('- ' + expectedLabel) && difference.includes('+ ' + receivedLabel)) {
return difference;
}
}
var printLabel = getLabelPrinter(expectedLabel, receivedLabel);
var expectedLine = printLabel(expectedLabel) + printExpected(expected);
var receivedLine = printLabel(receivedLabel) + (stringify(expected) === stringify(received) ? 'serializes to the same string' : printReceived(received));
return expectedLine + '\n' + receivedLine;
}; // Sometimes, e.g. when comparing two numbers, the output from jest-diff
// does not contain more information than the `Expected:` / `Received:` already gives.
// In those cases, we do not print a diff to make the output shorter and not redundant.
exports.printDiffOrStringify = printDiffOrStringify;
var shouldPrintDiff = function shouldPrintDiff(actual, expected) {
if (typeof actual === 'number' && typeof expected === 'number') {
return false;
}
if (typeof actual === 'boolean' && typeof expected === 'boolean') {
return false;
}
return true;
};
var diff = function diff(a, b, options) {
return shouldPrintDiff(a, b) ? (0, _jestDiff.default)(a, b, options) : null;
};
exports.diff = diff;
var pluralize = function pluralize(word, count) {
return (NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
}; // To display lines of labeled values as two columns with monospace alignment:
// given the strings which will describe the values,
// return function which given each string, returns the label:
// string, colon, space, and enough padding spaces to align the value.
exports.pluralize = pluralize;
var getLabelPrinter = function getLabelPrinter() {
for (var _len = arguments.length, strings = new Array(_len), _key = 0; _key < _len; _key++) {
strings[_key] = arguments[_key];
}
var maxLength = strings.reduce(function (max, string) {
return string.length > max ? string.length : max;
}, 0);
return function (string) {
return "".concat(string, ": ").concat(' '.repeat(maxLength - string.length));
};
};
exports.getLabelPrinter = getLabelPrinter;
var matcherErrorMessage = function matcherErrorMessage(hint, generic, specific // incorrect value returned from call to printWithType
) {
return "".concat(hint, "\n\n").concat(_chalk.default.bold('Matcher error'), ": ").concat(generic, "\n\n").concat(specific);
}; // Display assertion for the report when a test fails.
// New format: rejects/resolves, not, and matcher name have black color
// Old format: matcher name has dim color
exports.matcherErrorMessage = matcherErrorMessage;
var matcherHint = function matcherHint(matcherName) {
var received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';
var expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var _options$comment = options.comment,
comment = _options$comment === void 0 ? '' : _options$comment,
_options$expectedColo = options.expectedColor,
expectedColor = _options$expectedColo === void 0 ? EXPECTED_COLOR : _options$expectedColo,
_options$isDirectExpe = options.isDirectExpectCall,
isDirectExpectCall = _options$isDirectExpe === void 0 ? false : _options$isDirectExpe,
_options$isNot = options.isNot,
isNot = _options$isNot === void 0 ? false : _options$isNot,
_options$promise = options.promise,
promise = _options$promise === void 0 ? '' : _options$promise,
_options$receivedColo = options.receivedColor,
receivedColor = _options$receivedColo === void 0 ? RECEIVED_COLOR : _options$receivedColo,
_options$secondArgume = options.secondArgument,
secondArgument = _options$secondArgume === void 0 ? '' : _options$secondArgume,
_options$secondArgume2 = options.secondArgumentColor,
secondArgumentColor = _options$secondArgume2 === void 0 ? EXPECTED_COLOR : _options$secondArgume2;
var hint = '';
var dimString = 'expect'; // concatenate adjacent dim substrings
if (!isDirectExpectCall && received !== '') {
hint += DIM_COLOR(dimString + '(') + receivedColor(received);
dimString = ')';
}
if (promise !== '') {
hint += DIM_COLOR(dimString + '.') + promise;
dimString = '';
}
if (isNot) {
hint += DIM_COLOR(dimString + '.') + 'not';
dimString = '';
}
if (matcherName.includes('.')) {
// Old format: for backward compatibility,
// especially without promise or isNot options
dimString += matcherName;
} else {
// New format: omit period from matcherName arg
hint += DIM_COLOR(dimString + '.') + matcherName;
dimString = '';
}
if (expected === '') {
dimString += '()';
} else {
hint += DIM_COLOR(dimString + '(') + expectedColor(expected);
if (secondArgument) {
hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument);
}
dimString = ')';
}
if (comment !== '') {
dimString += ' // ' + comment;
}
if (dimString !== '') {
hint += DIM_COLOR(dimString);
}
return hint;
};
exports.matcherHint = matcherHint;
/***/ }),
/***/ "./packages/jest-message-util/build/index.js":
/*!***************************************************!*\
!*** ./packages/jest-message-util/build/index.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'Frame', {
enumerable: true,
get: function get() {
return _types.Frame;
}
});
exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.getTopFrame = exports.getStackTraceLines = exports.formatExecError = void 0;
var _fs = _interopRequireDefault(__webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js"));
var _path = _interopRequireDefault(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js"));
var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
var _micromatch = _interopRequireDefault(__webpack_require__(/*! micromatch */ "./node_modules/micromatch/index.js"));
var _slash = _interopRequireDefault(__webpack_require__(/*! slash */ "./node_modules/slash/index.js"));
var _codeFrame = __webpack_require__(/*! @babel/code-frame */ "./node_modules/@babel/code-frame/lib/index.js");
var _stackUtils = _interopRequireDefault(__webpack_require__(/*! stack-utils */ "./node_modules/stack-utils/index.js"));
var _types = __webpack_require__(/*! ./types */ "./packages/jest-message-util/build/types.js");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
var jestReadFile = global[_Symbol.for('jest-native-read-file')] || _fs.default.readFileSync;
var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; // stack utils tries to create pretty stack by making paths relative.
var stackUtils = new _stackUtils.default({
cwd: 'something which does not exist'
});
var nodeInternals = [];
try {
nodeInternals = _stackUtils.default.nodeInternals();
} catch (e) {// `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
// node internals in the browser though, so no issue.
}
var PATH_NODE_MODULES = "".concat(_path.default.sep, "node_modules").concat(_path.default.sep);
var PATH_JEST_PACKAGES = "".concat(_path.default.sep, "jest").concat(_path.default.sep, "packages").concat(_path.default.sep); // filter for noisy stack trace lines
var JASMINE_IGNORE = /^\s+at(?:(?:.jasmine\-)|\s+jasmine\.buildExpectationResult)/;
var JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;
var ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
var ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
var ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/;
var NATIVE_NEXT_IGNORE = /^\s+at next \(native\).*$/;
var TITLE_INDENT = ' ';
var MESSAGE_INDENT = ' ';
var STACK_INDENT = ' ';
var ANCESTRY_SEPARATOR = " \u203A ";
var TITLE_BULLET = _chalk.default.bold("\u25CF ");
var STACK_TRACE_COLOR = _chalk.default.dim;
var STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
var EXEC_ERROR_MESSAGE = 'Test suite failed to run';
var NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm;
var indentAllLines = function indentAllLines(lines, indent) {
return lines.replace(NOT_EMPTY_LINE_REGEXP, indent);
};
var trim = function trim(string) {
return (string || '').trim();
}; // Some errors contain not only line numbers in stack traces
// e.g. SyntaxErrors can contain snippets of code, and we don't
// want to trim those, because they may have pointers to the column/character
// which will get misaligned.
var trimPaths = function trimPaths(string) {
return string.match(STACK_PATH_REGEXP) ? trim(string) : string;
};
var getRenderedCallsite = function getRenderedCallsite(fileContent, line, column) {
var renderedCallsite = (0, _codeFrame.codeFrameColumns)(fileContent, {
start: {
column: column,
line: line
}
}, {
highlightCode: true
});
renderedCallsite = indentAllLines(renderedCallsite, MESSAGE_INDENT);
renderedCallsite = "\n".concat(renderedCallsite, "\n");
return renderedCallsite;
};
var blankStringRegexp = /^\s*$/; // ExecError is an error thrown outside of the test suite (not inside an `it` or
// `before/after each` hooks). If it's thrown, none of the tests in the file
// are executed.
var formatExecError = function formatExecError(error, config, options, testPath, reuseMessage) {
if (!error || typeof error === 'number') {
error = new Error("Expected an Error, but \"".concat(String(error), "\" was thrown"));
error.stack = '';
}
var message, stack;
if (typeof error === 'string' || !error) {
error || (error = 'EMPTY ERROR');
message = '';
stack = error;
} else {
message = error.message;
stack = error.stack;
}
var separated = separateMessageFromStack(stack || '');
stack = separated.stack;
if (separated.message.includes(trim(message))) {
// Often stack trace already contains the duplicate of the message
message = separated.message;
}
message = indentAllLines(message, MESSAGE_INDENT);
stack = stack && !options.noStackTrace ? '\n' + formatStackTrace(stack, config, options, testPath) : '';
if (blankStringRegexp.test(message) && blankStringRegexp.test(stack)) {
// this can happen if an empty object is thrown.
message = MESSAGE_INDENT + 'Error: No message was provided';
}
var messageToUse;
if (reuseMessage) {
messageToUse = " ".concat(message.trim());
} else {
messageToUse = "".concat(EXEC_ERROR_MESSAGE, "\n\n").concat(message);
}
return TITLE_INDENT + TITLE_BULLET + messageToUse + stack + '\n';
};
exports.formatExecError = formatExecError;
var removeInternalStackEntries = function removeInternalStackEntries(lines, options) {
var pathCounter = 0;
return lines.filter(function (line) {
if (ANONYMOUS_FN_IGNORE.test(line)) {
return false;
}
if (ANONYMOUS_PROMISE_IGNORE.test(line)) {
return false;
}
if (ANONYMOUS_GENERATOR_IGNORE.test(line)) {
return false;
}
if (NATIVE_NEXT_IGNORE.test(line)) {
return false;
}
if (nodeInternals.some(function (internal) {
return internal.test(line);
})) {
return false;
}
if (!STACK_PATH_REGEXP.test(line)) {
return true;
}
if (JASMINE_IGNORE.test(line)) {
return false;
}
if (++pathCounter === 1) {
return true; // always keep the first line even if it's from Jest
}
if (options.noStackTrace) {
return false;
}
if (JEST_INTERNALS_IGNORE.test(line)) {
return false;
}
return true;
});
};
var formatPaths = function formatPaths(config, relativeTestPath, line) {
// Extract the file path from the trace line.
var match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
if (!match) {
return line;
}
var filePath = (0, _slash.default)(_path.default.relative(config.rootDir, match[2])); // highlight paths from the current test file
if (config.testMatch && config.testMatch.length && _micromatch.default.some(filePath, config.testMatch) || filePath === relativeTestPath) {
filePath = _chalk.default.reset.cyan(filePath);
}
return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
};
var getStackTraceLines = function getStackTraceLines(stack) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
noStackTrace: false
};
return removeInternalStackEntries(stack.split(/\n/), options);
};
exports.getStackTraceLines = getStackTraceLines;
var getTopFrame = function getTopFrame(lines) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = lines[_Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var line = _step.value;
if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_JEST_PACKAGES)) {
continue;
}
var parsedFrame = stackUtils.parseLine(line.trim());
if (parsedFrame && parsedFrame.file) {
return parsedFrame;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return null;
};
exports.getTopFrame = getTopFrame;
var formatStackTrace = function formatStackTrace(stack, config, options, testPath) {
var lines = getStackTraceLines(stack, options);
var topFrame = getTopFrame(lines);
var renderedCallsite = '';
var relativeTestPath = testPath ? (0, _slash.default)(_path.default.relative(config.rootDir, testPath)) : null;
if (topFrame) {
var column = topFrame.column,
filename = topFrame.file,
line = topFrame.line;
if (line && filename && _path.default.isAbsolute(filename)) {
var fileContent;
try {
// TODO: check & read HasteFS instead of reading the filesystem:
// see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
fileContent = jestReadFile(filename, 'utf8');
renderedCallsite = getRenderedCallsite(fileContent, line, column);
} catch (e) {// the file does not exist or is inaccessible, we ignore
}
}
}
var stacktrace = lines.filter(Boolean).map(function (line) {
return STACK_INDENT + formatPaths(config, relativeTestPath, trimPaths(line));
}).join('\n');
return "".concat(renderedCallsite, "\n").concat(stacktrace);
};
exports.formatStackTrace = formatStackTrace;
var formatResultsErrors = function formatResultsErrors(testResults, config, options, testPath) {
var failedResults = testResults.reduce(function (errors, result) {
result.failureMessages.forEach(function (content) {
return errors.push({
content: content,
result: result
});
});
return errors;
}, []);
if (!failedResults.length) {
return null;
}
return failedResults.map(function (_ref) {
var result = _ref.result,
content = _ref.content;
var _separateMessageFromS = separateMessageFromStack(content),
message = _separateMessageFromS.message,
stack = _separateMessageFromS.stack;
stack = options.noStackTrace ? '' : STACK_TRACE_COLOR(formatStackTrace(stack, config, options, testPath)) + '\n';
message = indentAllLines(message, MESSAGE_INDENT);
var title = _chalk.default.bold.red(TITLE_INDENT + TITLE_BULLET + result.ancestorTitles.join(ANCESTRY_SEPARATOR) + (result.ancestorTitles.length ? ANCESTRY_SEPARATOR : '') + result.title) + '\n';
return title + '\n' + message + '\n' + stack;
}).join('\n');
};
exports.formatResultsErrors = formatResultsErrors;
var errorRegexp = /^Error:?\s*$/;
var removeBlankErrorLine = function removeBlankErrorLine(str) {
return str.split('\n') // Lines saying just `Error:` are useless
.filter(function (line) {
return !errorRegexp.test(line);
}).join('\n').trimRight();
}; // jasmine and worker farm sometimes don't give us access to the actual
// Error object, so we have to regexp out the message from the stack string
// to format it.
var separateMessageFromStack = function separateMessageFromStack(content) {
if (!content) {
return {
message: '',
stack: ''
};
} // All lines up to what looks like a stack -- or if nothing looks like a stack
// (maybe it's a code frame instead), just the first non-empty line.
// If the error is a plain "Error:" instead of a SyntaxError or TypeError we
// remove the prefix from the message because it is generally not useful.
var messageMatch = content.match(/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\s\S]*)$/);
if (!messageMatch) {
// For typescript
throw new Error('If you hit this error, the regex above is buggy.');
}
var message = removeBlankErrorLine(messageMatch[1]);
var stack = removeBlankErrorLine(messageMatch[2]);
return {
message: message,
stack: stack
};
};
exports.separateMessageFromStack = separateMessageFromStack;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./packages/jest-message-util/build/types.js":
/*!***************************************************!*\
!*** ./packages/jest-message-util/build/types.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/***/ }),
/***/ "./packages/pretty-format/build/collections.js":
/*!*****************************************************!*\
!*** ./packages/pretty-format/build/collections.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.printIteratorEntries = printIteratorEntries;
exports.printIteratorValues = printIteratorValues;
exports.printListItems = printListItems;
exports.printObjectProperties = printObjectProperties;
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var getKeysOfEnumerableProperties = function getKeysOfEnumerableProperties(object) {
var keys = Object.keys(object).sort();
if (Object.getOwnPropertySymbols) {
Object.getOwnPropertySymbols(object).forEach(function (symbol) {
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
keys.push(symbol);
}
});
}
return keys;
};
/**
* Return entries (for example, of a map)
* with spacing, indentation, and comma
* without surrounding punctuation (for example, braces)
*/
function printIteratorEntries( // Flow 0.51.0: property `@@iterator` of $Iterator not found in Object
// To allow simplistic getRecordIterator in immutable.js
iterator, config, indentation, depth, refs, printer) {
var separator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ': ';
var result = '';
var current = iterator.next();
if (!current.done) {
result += config.spacingOuter;
var indentationNext = indentation + config.indent;
while (!current.done) {
var name = printer(current.value[0], config, indentationNext, depth, refs);
var value = printer(current.value[1], config, indentationNext, depth, refs);
result += indentationNext + name + separator + value;
current = iterator.next();
if (!current.done) {
result += ',' + config.spacingInner;
} else if (!config.min) {
result += ',';
}
}
result += config.spacingOuter + indentation;
}
return result;
}
/**
* Return values (for example, of a set)
* with spacing, indentation, and comma
* without surrounding punctuation (braces or brackets)
*/
function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
var result = '';
var current = iterator.next();
if (!current.done) {
result += config.spacingOuter;
var indentationNext = indentation + config.indent;
while (!current.done) {
result += indentationNext + printer(current.value, config, indentationNext, depth, refs);
current = iterator.next();
if (!current.done) {
result += ',' + config.spacingInner;
} else if (!config.min) {
result += ',';
}
}
result += config.spacingOuter + indentation;
}
return result;
}
/**
* Return items (for example, of an array)
* with spacing, indentation, and comma
* without surrounding punctuation (for example, brackets)
**/
function printListItems(list, config, indentation, depth, refs, printer) {
var result = '';
if (list.length) {
result += config.spacingOuter;
var indentationNext = indentation + config.indent;
for (var i = 0; i < list.length; i++) {
result += indentationNext + printer(list[i], config, indentationNext, depth, refs);
if (i < list.length - 1) {
result += ',' + config.spacingInner;
} else if (!config.min) {
result += ',';
}
}
result += config.spacingOuter + indentation;
}
return result;
}
/**
* Return properties of an object
* with spacing, indentation, and comma
* without surrounding punctuation (for example, braces)
*/
function printObjectProperties(val, config, indentation, depth, refs, printer) {
var result = '';
var keys = getKeysOfEnumerableProperties(val);
if (keys.length) {
result += config.spacingOuter;
var indentationNext = indentation + config.indent;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var name = printer(key, config, indentationNext, depth, refs);
var value = printer(val[key], config, indentationNext, depth, refs);
result += indentationNext + name + ': ' + value;
if (i < keys.length - 1) {
result += ',' + config.spacingInner;
} else if (!config.min) {
result += ',';
}
}
result += config.spacingOuter + indentation;
}
return result;
}
/***/ }),
/***/ "./packages/pretty-format/build/index.js":
/*!***********************************************!*\
!*** ./packages/pretty-format/build/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _ansiStyles = _interopRequireDefault(__webpack_require__(/*! ansi-styles */ "./node_modules/ansi-styles/index.js"));
var _collections = __webpack_require__(/*! ./collections */ "./packages/pretty-format/build/collections.js");
var _AsymmetricMatcher = _interopRequireDefault(__webpack_require__(/*! ./plugins/AsymmetricMatcher */ "./packages/pretty-format/build/plugins/AsymmetricMatcher.js"));
var _ConvertAnsi = _interopRequireDefault(__webpack_require__(/*! ./plugins/ConvertAnsi */ "./packages/pretty-format/build/plugins/ConvertAnsi.js"));
var _DOMCollection = _interopRequireDefault(__webpack_require__(/*! ./plugins/DOMCollection */ "./packages/pretty-format/build/plugins/DOMCollection.js"));
var _DOMElement = _interopRequireDefault(__webpack_require__(/*! ./plugins/DOMElement */ "./packages/pretty-format/build/plugins/DOMElement.js"));
var _Immutable = _interopRequireDefault(__webpack_require__(/*! ./plugins/Immutable */ "./packages/pretty-format/build/plugins/Immutable.js"));
var _ReactElement = _interopRequireDefault(__webpack_require__(/*! ./plugins/ReactElement */ "./packages/pretty-format/build/plugins/ReactElement.js"));
var _ReactTestComponent = _interopRequireDefault(__webpack_require__(/*! ./plugins/ReactTestComponent */ "./packages/pretty-format/build/plugins/ReactTestComponent.js"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
var toString = Object.prototype.toString;
var toISOString = Date.prototype.toISOString;
var errorToString = Error.prototype.toString;
var regExpToString = RegExp.prototype.toString;
var symbolToString = _Symbol.prototype.toString;
/**
* Explicitly comparing typeof constructor to function avoids undefined as name
* when mock identity-obj-proxy returns the key as the value for any key.
*/
var getConstructorName = function getConstructorName(val) {
return typeof val.constructor === 'function' && val.constructor.name || 'Object';
};
/* global window */
/** Is val is equal to global window object? Works even if it does not exist :) */
var isWindow = function isWindow(val) {
return typeof window !== 'undefined' && val === window;
};
var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
var NEWLINE_REGEXP = /\n/gi;
var PrettyFormatPluginError =
/*#__PURE__*/
function (_Error) {
_inherits(PrettyFormatPluginError, _Error);
function PrettyFormatPluginError(message, stack) {
var _this;
_classCallCheck(this, PrettyFormatPluginError);
_this = _possibleConstructorReturn(this, _getPrototypeOf(PrettyFormatPluginError).call(this, message));
_this.stack = stack;
_this.name = _this.constructor.name;
return _this;
}
return PrettyFormatPluginError;
}(_wrapNativeSuper(Error));
function isToStringedArrayType(toStringed) {
return toStringed === '[object Array]' || toStringed === '[object ArrayBuffer]' || toStringed === '[object DataView]' || toStringed === '[object Float32Array]' || toStringed === '[object Float64Array]' || toStringed === '[object Int8Array]' || toStringed === '[object Int16Array]' || toStringed === '[object Int32Array]' || toStringed === '[object Uint8Array]' || toStringed === '[object Uint8ClampedArray]' || toStringed === '[object Uint16Array]' || toStringed === '[object Uint32Array]';
}
function printNumber(val) {
return Object.is(val, -0) ? '-0' : String(val);
}
function printBigInt(val) {
return String("".concat(val, "n"));
}
function printFunction(val, printFunctionName) {
if (!printFunctionName) {
return '[Function]';
}
return '[Function ' + (val.name || 'anonymous') + ']';
}
function printSymbol(val) {
return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
}
function printError(val) {
return '[' + errorToString.call(val) + ']';
}
/**
* The first port of call for printing an object, handles most of the
* data-types in JS.
*/
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
if (val === true || val === false) {
return '' + val;
}
if (val === undefined) {
return 'undefined';
}
if (val === null) {
return 'null';
}
var typeOf = _typeof(val);
if (typeOf === 'number') {
return printNumber(val);
}
if (typeOf === 'bigint') {
return printBigInt(val);
}
if (typeOf === 'string') {
if (escapeString) {
return '"' + val.replace(/"|\\/g, '\\$&') + '"';
}
return '"' + val + '"';
}
if (typeOf === 'function') {
return printFunction(val, printFunctionName);
}
if (typeOf === 'symbol') {
return printSymbol(val);
}
var toStringed = toString.call(val);
if (toStringed === '[object WeakMap]') {
return 'WeakMap {}';
}
if (toStringed === '[object WeakSet]') {
return 'WeakSet {}';
}
if (toStringed === '[object Function]' || toStringed === '[object GeneratorFunction]') {
return printFunction(val, printFunctionName);
}
if (toStringed === '[object Symbol]') {
return printSymbol(val);
}
if (toStringed === '[object Date]') {
return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
}
if (toStringed === '[object Error]') {
return printError(val);
}
if (toStringed === '[object RegExp]') {
if (escapeRegex) {
// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
}
return regExpToString.call(val);
}
if (val instanceof Error) {
return printError(val);
}
return null;
}
/**
* Handles more complex objects ( such as objects with circular references.
* maps and sets etc )
*/
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
if (refs.indexOf(val) !== -1) {
return '[Circular]';
}
refs = refs.slice();
refs.push(val);
var hitMaxDepth = ++depth > config.maxDepth;
var min = config.min;
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === 'function' && !hasCalledToJSON) {
return printer(val.toJSON(), config, indentation, depth, refs, true);
}
var toStringed = toString.call(val);
if (toStringed === '[object Arguments]') {
return hitMaxDepth ? '[Arguments]' : (min ? '' : 'Arguments ') + '[' + (0, _collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
}
if (isToStringedArrayType(toStringed)) {
return hitMaxDepth ? '[' + val.constructor.name + ']' : (min ? '' : val.constructor.name + ' ') + '[' + (0, _collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
}
if (toStringed === '[object Map]') {
return hitMaxDepth ? '[Map]' : 'Map {' + (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, ' => ') + '}';
}
if (toStringed === '[object Set]') {
return hitMaxDepth ? '[Set]' : 'Set {' + (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + '}';
} // Avoid failure to serialize global window object in jsdom test environment.
// For example, not even relevant if window is prop of React element.
return hitMaxDepth || isWindow(val) ? '[' + getConstructorName(val) + ']' : (min ? '' : getConstructorName(val) + ' ') + '{' + (0, _collections.printObjectProperties)(val, config, indentation, depth, refs, printer) + '}';
}
function isNewPlugin(plugin) {
return plugin.serialize != null;
}
function printPlugin(plugin, val, config, indentation, depth, refs) {
var printed;
try {
printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, function (valChild) {
return printer(valChild, config, indentation, depth, refs);
}, function (str) {
var indentationNext = indentation + config.indent;
return indentationNext + str.replace(NEWLINE_REGEXP, '\n' + indentationNext);
}, {
edgeSpacing: config.spacingOuter,
min: config.min,
spacing: config.spacingInner
}, config.colors);
} catch (error) {
throw new PrettyFormatPluginError(error.message, error.stack);
}
if (typeof printed !== 'string') {
throw new Error("pretty-format: Plugin must return type \"string\" but instead returned \"".concat(_typeof(printed), "\"."));
}
return printed;
}
function findPlugin(plugins, val) {
for (var p = 0; p < plugins.length; p++) {
try {
if (plugins[p].test(val)) {
return plugins[p];
}
} catch (error) {
throw new PrettyFormatPluginError(error.message, error.stack);
}
}
return null;
}
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
var plugin = findPlugin(config.plugins, val);
if (plugin !== null) {
return printPlugin(plugin, val, config, indentation, depth, refs);
}
var basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
if (basicResult !== null) {
return basicResult;
}
return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
}
var DEFAULT_THEME = {
comment: 'gray',
content: 'reset',
prop: 'yellow',
tag: 'cyan',
value: 'green'
};
var DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
var DEFAULT_OPTIONS = {
callToJSON: true,
escapeRegex: false,
escapeString: true,
highlight: false,
indent: 2,
maxDepth: Infinity,
min: false,
plugins: [],
printFunctionName: true,
theme: DEFAULT_THEME
};
function validateOptions(options) {
Object.keys(options).forEach(function (key) {
if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
throw new Error("pretty-format: Unknown option \"".concat(key, "\"."));
}
});
if (options.min && options.indent !== undefined && options.indent !== 0) {
throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
}
if (options.theme !== undefined) {
if (options.theme === null) {
throw new Error("pretty-format: Option \"theme\" must not be null.");
}
if (_typeof(options.theme) !== 'object') {
throw new Error("pretty-format: Option \"theme\" must be of type \"object\" but instead received \"".concat(_typeof(options.theme), "\"."));
}
}
}
var getColorsHighlight = function getColorsHighlight(options) {
return DEFAULT_THEME_KEYS.reduce(function (colors, key) {
var value = options.theme && options.theme[key] !== undefined ? options.theme[key] : DEFAULT_THEME[key];
var color = value && _ansiStyles.default[value];
if (color && typeof color.close === 'string' && typeof color.open === 'string') {
colors[key] = color;
} else {
throw new Error("pretty-format: Option \"theme\" has a key \"".concat(key, "\" whose value \"").concat(value, "\" is undefined in ansi-styles."));
}
return colors;
}, Object.create(null));
};
var getColorsEmpty = function getColorsEmpty() {
return DEFAULT_THEME_KEYS.reduce(function (colors, key) {
colors[key] = {
close: '',
open: ''
};
return colors;
}, Object.create(null));
};
var getPrintFunctionName = function getPrintFunctionName(options) {
return options && options.printFunctionName !== undefined ? options.printFunctionName : DEFAULT_OPTIONS.printFunctionName;
};
var getEscapeRegex = function getEscapeRegex(options) {
return options && options.escapeRegex !== undefined ? options.escapeRegex : DEFAULT_OPTIONS.escapeRegex;
};
var getEscapeString = function getEscapeString(options) {
return options && options.escapeString !== undefined ? options.escapeString : DEFAULT_OPTIONS.escapeString;
};
var getConfig = function getConfig(options) {
return {
callToJSON: options && options.callToJSON !== undefined ? options.callToJSON : DEFAULT_OPTIONS.callToJSON,
colors: options && options.highlight ? getColorsHighlight(options) : getColorsEmpty(),
escapeRegex: getEscapeRegex(options),
escapeString: getEscapeString(options),
indent: options && options.min ? '' : createIndent(options && options.indent !== undefined ? options.indent : DEFAULT_OPTIONS.indent),
maxDepth: options && options.maxDepth !== undefined ? options.maxDepth : DEFAULT_OPTIONS.maxDepth,
min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
plugins: options && options.plugins !== undefined ? options.plugins : DEFAULT_OPTIONS.plugins,
printFunctionName: getPrintFunctionName(options),
spacingInner: options && options.min ? ' ' : '\n',
spacingOuter: options && options.min ? '' : '\n'
};
};
function createIndent(indent) {
return new Array(indent + 1).join(' ');
}
/**
* Returns a presentation string of your `val` object
* @param val any potential JavaScript object
* @param options Custom settings
*/
function prettyFormat(val, options) {
if (options) {
validateOptions(options);
if (options.plugins) {
var plugin = findPlugin(options.plugins, val);
if (plugin !== null) {
return printPlugin(plugin, val, getConfig(options), '', 0, []);
}
}
}
var basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
if (basicResult !== null) {
return basicResult;
}
return printComplexValue(val, getConfig(options), '', 0, []);
}
prettyFormat.plugins = {
AsymmetricMatcher: _AsymmetricMatcher.default,
ConvertAnsi: _ConvertAnsi.default,
DOMCollection: _DOMCollection.default,
DOMElement: _DOMElement.default,
Immutable: _Immutable.default,
ReactElement: _ReactElement.default,
ReactTestComponent: _ReactTestComponent.default
};
/* eslint-disable-next-line no-redeclare */
module.exports = prettyFormat;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./packages/pretty-format/build/plugins/AsymmetricMatcher.js":
/*!*******************************************************************!*\
!*** ./packages/pretty-format/build/plugins/AsymmetricMatcher.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.test = exports.serialize = void 0;
var _collections = __webpack_require__(/*! ../collections */ "./packages/pretty-format/build/collections.js");
var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
var asymmetricMatcher = _Symbol.for('jest.asymmetricMatcher');
var SPACE = ' ';
var serialize = function serialize(val, config, indentation, depth, refs, printer) {
var stringedValue = val.toString();
if (stringedValue === 'ArrayContaining' || stringedValue === 'ArrayNotContaining') {
if (++depth > config.maxDepth) {
return '[' + stringedValue + ']';
}
return stringedValue + SPACE + '[' + (0, _collections.printListItems)(val.sample, config, indentation, depth, refs, printer) + ']';
}
if (stringedValue === 'ObjectContaining' || stringedValue === 'ObjectNotContaining') {
if (++depth > config.maxDepth) {
return '[' + stringedValue + ']';
}
return stringedValue + SPACE + '{' + (0, _collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer) + '}';
}
if (stringedValue === 'StringMatching' || stringedValue === 'StringNotMatching') {
return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
}
if (stringedValue === 'StringContaining' || stringedValue === 'StringNotContaining') {
return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
}
return val.toAsymmetricMatcher();
};
exports.serialize = serialize;
var test = function test(val) {
return val && val.$$typeof === asymmetricMatcher;
};
exports.test = test;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./packages/pretty-format/build/plugins/ConvertAnsi.js":
/*!*************************************************************!*\
!*** ./packages/pretty-format/build/plugins/ConvertAnsi.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.serialize = exports.test = void 0;
var _ansiRegex = _interopRequireDefault(__webpack_require__(/*! ansi-regex */ "./node_modules/ansi-regex/index.js"));
var _ansiStyles = _interopRequireDefault(__webpack_require__(/*! ansi-styles */ "./node_modules/ansi-styles/index.js"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var toHumanReadableAnsi = function toHumanReadableAnsi(text) {
return text.replace((0, _ansiRegex.default)(), function (match) {
switch (match) {
case _ansiStyles.default.red.close:
case _ansiStyles.default.green.close:
case _ansiStyles.default.cyan.close:
case _ansiStyles.default.gray.close:
case _ansiStyles.default.white.close:
case _ansiStyles.default.yellow.close:
case _ansiStyles.default.bgRed.close:
case _ansiStyles.default.bgGreen.close:
case _ansiStyles.default.bgYellow.close:
case _ansiStyles.default.inverse.close:
case _ansiStyles.default.dim.close:
case _ansiStyles.default.bold.close:
case _ansiStyles.default.reset.open:
case _ansiStyles.default.reset.close:
return '</>';
case _ansiStyles.default.red.open:
return '<red>';
case _ansiStyles.default.green.open:
return '<green>';
case _ansiStyles.default.cyan.open:
return '<cyan>';
case _ansiStyles.default.gray.open:
return '<gray>';
case _ansiStyles.default.white.open:
return '<white>';
case _ansiStyles.default.yellow.open:
return '<yellow>';
case _ansiStyles.default.bgRed.open:
return '<bgRed>';
case _ansiStyles.default.bgGreen.open:
return '<bgGreen>';
case _ansiStyles.default.bgYellow.open:
return '<bgYellow>';
case _ansiStyles.default.inverse.open:
return '<inverse>';
case _ansiStyles.default.dim.open:
return '<dim>';
case _ansiStyles.default.bold.open:
return '<bold>';
default:
return '';
}
});
};
var test = function test(val) {
return typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
};
exports.test = test;
var serialize = function serialize(val, config, indentation, depth, refs, printer) {
return printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
};
exports.serialize = serialize;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/***/ }),
/***/ "./packages/pretty-format/build/plugins/DOMCollection.js":
/*!***************************************************************!*\
!*** ./packages/pretty-format/build/plugins/DOMCollection.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.serialize = exports.test = void 0;
var _collections = __webpack_require__(/*! ../collections */ "./packages/pretty-format/build/collections.js");
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var SPACE = ' ';
var OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
var ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
var testName = function testName(name) {
return OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
};
var test = function test(val) {
return val && val.constructor && val.constructor.name && testName(val.constructor.name);
}; // Convert array of attribute objects to props object.
exports.test = test;
var propsReducer = function propsReducer(props, attribute) {
props[attribute.name] = attribute.value;
return props;
};
var serialize = function serialize(collection, config, indentation, depth, refs, printer) {
var name = collection.constructor.name;
if (++depth > config.maxDepth) {
return '[' + name + ']';
}
return (config.min ? '' : name + SPACE) + (OBJECT_NAMES.indexOf(name) !== -1 ? '{' + (0, _collections.printObjectProperties)(name === 'NamedNodeMap' ? Array.prototype.reduce.call(collection, propsReducer, {}) : _objectSpread({}, collection), config, indentation, depth, refs, printer) + '}' : '[' + (0, _collections.printListItems)(Array.from(collection), config, indentation, depth, refs, printer) + ']');
};
exports.serialize = serialize;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/***/ }),
/***/ "./packages/pretty-format/build/plugins/DOMElement.js":
/*!************************************************************!*\
!*** ./packages/pretty-format/build/plugins/DOMElement.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.serialize = exports.test = void 0;
var _markup = __webpack_require__(/*! ./lib/markup */ "./packages/pretty-format/build/plugins/lib/markup.js");
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ELEMENT_NODE = 1;
var TEXT_NODE = 3;
var COMMENT_NODE = 8;
var FRAGMENT_NODE = 11;
var ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
var testNode = function testNode(nodeType, name) {
return nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name) || nodeType === TEXT_NODE && name === 'Text' || nodeType === COMMENT_NODE && name === 'Comment' || nodeType === FRAGMENT_NODE && name === 'DocumentFragment';
};
var test = function test(val) {
return val && val.constructor && val.constructor.name && testNode(val.nodeType, val.constructor.name);
};
exports.test = test;
function nodeIsText(node) {
return node.nodeType === TEXT_NODE;
}
function nodeIsComment(node) {
return node.nodeType === COMMENT_NODE;
}
function nodeIsFragment(node) {
return node.nodeType === FRAGMENT_NODE;
}
var serialize = function serialize(node, config, indentation, depth, refs, printer) {
if (nodeIsText(node)) {
return (0, _markup.printText)(node.data, config);
}
if (nodeIsComment(node)) {
return (0, _markup.printComment)(node.data, config);
}
var type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
if (++depth > config.maxDepth) {
return (0, _markup.printElementAsLeaf)(type, config);
}
return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes).map(function (attr) {
return attr.name;
}).sort(), nodeIsFragment(node) ? [] : Array.from(node.attributes).reduce(function (props, attribute) {
props[attribute.name] = attribute.value;
return props;
}, {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
};
exports.serialize = serialize;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/***/ }),
/***/ "./packages/pretty-format/build/plugins/Immutable.js":
/*!***********************************************************!*\
!*** ./packages/pretty-format/build/plugins/Immutable.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.test = exports.serialize = void 0;
var _collections = __webpack_require__(/*! ../collections */ "./packages/pretty-format/build/collections.js");
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// SENTINEL constants are from https://github.com/facebook/immutable-js
var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
var IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
var getImmutableName = function getImmutableName(name) {
return 'Immutable.' + name;
};
var printAsLeaf = function printAsLeaf(name) {
return '[' + name + ']';
};
var SPACE = ' ';
var LAZY = '…'; // Seq is lazy if it calls a method like filter
var printImmutableEntries = function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '{' + (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) + '}';
}; // Record has an entries method because it is a collection in immutable v3.
// Return an iterator for Immutable Record from version v3 or v4.
var getRecordEntries = function getRecordEntries(val) {
var i = 0;
return {
next: function next() {
if (i < val._keys.length) {
var key = val._keys[i++];
return {
done: false,
value: [key, val.get(key)]
};
}
return {
done: true
};
}
};
};
var printImmutableRecord = function printImmutableRecord(val, config, indentation, depth, refs, printer) {
// _name property is defined only for an Immutable Record instance
// which was constructed with a second optional descriptive name arg
var name = getImmutableName(val._name || 'Record');
return ++depth > config.maxDepth ? printAsLeaf(name) : name + SPACE + '{' + (0, _collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer) + '}';
};
var printImmutableSeq = function printImmutableSeq(val, config, indentation, depth, refs, printer) {
var name = getImmutableName('Seq');
if (++depth > config.maxDepth) {
return printAsLeaf(name);
}
if (val[IS_KEYED_SENTINEL]) {
return name + SPACE + '{' + ( // from Immutable collection of entries or from ECMAScript object
val._iter || val._object ? (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY) + '}';
}
return name + SPACE + '[' + (val._iter || // from Immutable collection of values
val._array || // from ECMAScript array
val._collection || // from ECMAScript collection in immutable v4
val._iterable // from ECMAScript collection in immutable v3
? (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY) + ']';
};
var printImmutableValues = function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '[' + (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + ']';
};
var serialize = function serialize(val, config, indentation, depth, refs, printer) {
if (val[IS_MAP_SENTINEL]) {
return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map');
}
if (val[IS_LIST_SENTINEL]) {
return printImmutableValues(val, config, indentation, depth, refs, printer, 'List');
}
if (val[IS_SET_SENTINEL]) {
return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set');
}
if (val[IS_STACK_SENTINEL]) {
return printImmutableValues(val, config, indentation, depth, refs, printer, 'Stack');
}
if (val[IS_SEQ_SENTINEL]) {
return printImmutableSeq(val, config, indentation, depth, refs, printer);
} // For compatibility with immutable v3 and v4, let record be the default.
return printImmutableRecord(val, config, indentation, depth, refs, printer);
}; // Explicitly comparing sentinel properties to true avoids false positive
// when mock identity-obj-proxy returns the key as the value for any key.
exports.serialize = serialize;
var test = function test(val) {
return val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
};
exports.test = test;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/***/ }),
/***/ "./packages/pretty-format/build/plugins/ReactElement.js":
/*!**************************************************************!*\
!*** ./packages/pretty-format/build/plugins/ReactElement.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.test = exports.serialize = void 0;
var ReactIs = _interopRequireWildcard(__webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"));
var _markup = __webpack_require__(/*! ./lib/markup */ "./packages/pretty-format/build/plugins/lib/markup.js");
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Given element.props.children, or subtree during recursive traversal,
// return flattened array of children.
var getChildren = function getChildren(arg) {
var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
if (Array.isArray(arg)) {
arg.forEach(function (item) {
getChildren(item, children);
});
} else if (arg != null && arg !== false) {
children.push(arg);
}
return children;
};
var getType = function getType(element) {
var type = element.type;
if (typeof type === 'string') {
return type;
}
if (typeof type === 'function') {
return type.displayName || type.name || 'Unknown';
}
if (ReactIs.isFragment(element)) {
return 'React.Fragment';
}
if (ReactIs.isSuspense(element)) {
return 'React.Suspense';
}
if (_typeof(type) === 'object' && type !== null) {
if (ReactIs.isContextProvider(element)) {
return 'Context.Provider';
}
if (ReactIs.isContextConsumer(element)) {
return 'Context.Consumer';
}
if (ReactIs.isForwardRef(element)) {
var functionName = type.render.displayName || type.render.name || '';
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
}
if (ReactIs.isMemo(type)) {
var _functionName = type.displayName || type.type.displayName || type.type.name || '';
return _functionName !== '' ? 'Memo(' + _functionName + ')' : 'Memo';
}
}
return 'UNDEFINED';
};
var getPropKeys = function getPropKeys(element) {
var props = element.props;
return Object.keys(props).filter(function (key) {
return key !== 'children' && props[key] !== undefined;
}).sort();
};
var serialize = function serialize(element, config, indentation, depth, refs, printer) {
return ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(getType(element), config) : (0, _markup.printElement)(getType(element), (0, _markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
};
exports.serialize = serialize;
var test = function test(val) {
return val && ReactIs.isElement(val);
};
exports.test = test;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/***/ }),
/***/ "./packages/pretty-format/build/plugins/ReactTestComponent.js":
/*!********************************************************************!*\
!*** ./packages/pretty-format/build/plugins/ReactTestComponent.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = exports.test = exports.serialize = void 0;
var _markup = __webpack_require__(/*! ./lib/markup */ "./packages/pretty-format/build/plugins/lib/markup.js");
var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
var testSymbol = _Symbol.for('react.test.json');
var getPropKeys = function getPropKeys(object) {
var props = object.props;
return props ? Object.keys(props).filter(function (key) {
return props[key] !== undefined;
}).sort() : [];
};
var serialize = function serialize(object, config, indentation, depth, refs, printer) {
return ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(object.type, config) : (0, _markup.printElement)(object.type, object.props ? (0, _markup.printProps)(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : '', object.children ? (0, _markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : '', config, indentation);
};
exports.serialize = serialize;
var test = function test(val) {
return val && val.$$typeof === testSymbol;
};
exports.test = test;
var plugin = {
serialize: serialize,
test: test
};
var _default = plugin;
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./packages/pretty-format/build/plugins/lib/escapeHTML.js":
/*!****************************************************************!*\
!*** ./packages/pretty-format/build/plugins/lib/escapeHTML.js ***!
\****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = escapeHTML;
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function escapeHTML(str) {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
/***/ }),
/***/ "./packages/pretty-format/build/plugins/lib/markup.js":
/*!************************************************************!*\
!*** ./packages/pretty-format/build/plugins/lib/markup.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = void 0;
var _escapeHTML = _interopRequireDefault(__webpack_require__(/*! ./escapeHTML */ "./packages/pretty-format/build/plugins/lib/escapeHTML.js"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Return empty string if keys is empty.
var printProps = function printProps(keys, props, config, indentation, depth, refs, printer) {
var indentationNext = indentation + config.indent;
var colors = config.colors;
return keys.map(function (key) {
var value = props[key];
var printed = printer(value, config, indentationNext, depth, refs);
if (typeof value !== 'string') {
if (printed.indexOf('\n') !== -1) {
printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
}
printed = '{' + printed + '}';
}
return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;
}).join('');
}; // Return empty string if children is empty.
exports.printProps = printProps;
var printChildren = function printChildren(children, config, indentation, depth, refs, printer) {
return children.map(function (child) {
return config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs));
}).join('');
};
exports.printChildren = printChildren;
var printText = function printText(text, config) {
var contentColor = config.colors.content;
return contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close;
};
exports.printText = printText;
var printComment = function printComment(comment, config) {
var commentColor = config.colors.comment;
return commentColor.open + '<!--' + (0, _escapeHTML.default)(comment) + '-->' + commentColor.close;
}; // Separate the functions to format props, children, and element,
// so a plugin could override a particular function, if needed.
// Too bad, so sad: the traditional (but unnecessary) space
// in a self-closing tagColor requires a second test of printedProps.
exports.printComment = printComment;
var printElement = function printElement(type, printedProps, printedChildren, config, indentation) {
var tagColor = config.colors.tag;
return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;
};
exports.printElement = printElement;
var printElementAsLeaf = function printElementAsLeaf(type, config) {
var tagColor = config.colors.tag;
return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;
};
exports.printElementAsLeaf = printElementAsLeaf;
/***/ })
/******/ });
});
//# sourceMappingURL=index.js.map