diff --git a/packages/next/compiled/webpack/bundle4.js b/packages/next/compiled/webpack/bundle4.js index 28b50e13ab3e1..fd6df4bbe440b 100644 --- a/packages/next/compiled/webpack/bundle4.js +++ b/packages/next/compiled/webpack/bundle4.js @@ -20706,3421 +20706,3475 @@ module.exports = function defineProperty(obj, prop, val) { /***/ }), -/***/ 22706: +/***/ 63375: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/** - * Module dependencies - */ - -var toRegex = __webpack_require__(51279); -var unique = __webpack_require__(19009); -var extend = __webpack_require__(28727); - -/** - * Local dependencies - */ - -var compilers = __webpack_require__(46109); -var parsers = __webpack_require__(49665); -var Braces = __webpack_require__(68297); -var utils = __webpack_require__(68130); -var MAX_LENGTH = 1024 * 64; -var cache = {}; +var isObject = __webpack_require__(96667); +var Emitter = __webpack_require__(79458); +var visit = __webpack_require__(16704); +var toPath = __webpack_require__(71708); +var union = __webpack_require__(7716); +var del = __webpack_require__(5834); +var get = __webpack_require__(89304); +var has = __webpack_require__(41825); +var set = __webpack_require__(34857); /** - * 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)). + * Create a `Cache` constructor that when instantiated will + * store values on the given `prop`. * * ```js - * var braces = require('braces'); - * console.log(braces('{a,b,c}')); - * //=> ['(a|b|c)'] + * var Cache = require('cache-base').namespace('data'); + * var cache = new Cache(); * - * console.log(braces('{a,b,c}', {expand: true})); - * //=> ['a', 'b', 'c'] + * cache.set('foo', 'bar'); + * //=> {data: {foo: 'bar'}} * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {String} + * @param {String} `prop` The property name to use for storing values. + * @return {Function} Returns a custom `Cache` constructor * @api public */ -function braces(pattern, options) { - var key = utils.createKey(String(pattern), options); - var arr = []; +function namespace(prop) { - var disabled = options && options.cache === false; - if (!disabled && cache.hasOwnProperty(key)) { - return cache[key]; - } + /** + * 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 + */ - if (Array.isArray(pattern)) { - for (var i = 0; i < pattern.length; i++) { - arr.push.apply(arr, braces.create(pattern[i], options)); + function Cache(cache) { + if (prop) { + this[prop] = {}; + } + if (cache) { + this.set(cache); } - } 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'); - } + /** + * Inherit Emitter + */ - var maxLength = (options && options.maxLength) || MAX_LENGTH; - if (pattern.length >= maxLength) { - throw new Error('expected pattern to be less than ' + maxLength + ' characters'); - } + Emitter(Cache.prototype); - function create() { - if (pattern === '' || pattern.length < 3) { - return [pattern]; - } + /** + * 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 + */ - if (utils.isEmptySets(pattern)) { - return []; + Cache.prototype.set = function(key, val) { + if (Array.isArray(key) && arguments.length === 2) { + key = toPath(key); } - - if (utils.isQuotedString(pattern)) { - return [pattern.slice(1, -1)]; + 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; + }; - 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; + /** + * 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 + */ - // filter out empty strings if specified - if (options && options.noempty === true) { - arr = arr.filter(Boolean); + 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; + }; - // filter out duplicates if specified - if (options && options.nodupes === true) { - arr = unique(arr); - } + /** + * 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 + */ - Object.defineProperty(arr, 'result', { - enumerable: false, - value: result - }); + Cache.prototype.get = function(key) { + key = toPath(arguments); - return arr; - } + var ctx = prop ? this[prop] : this; + var val = get(ctx, key); - return memoize('create', pattern, options, create); -}; + this.emit('get', key, val); + return val; + }; -/** - * 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 - */ + /** + * 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 + */ -braces.makeRe = function(pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('expected a string'); - } + Cache.prototype.has = function(key) { + key = toPath(arguments); - var maxLength = (options && options.maxLength) || MAX_LENGTH; - if (pattern.length >= maxLength) { - throw new Error('expected pattern to be less than ' + maxLength + ' characters'); - } + var ctx = prop ? this[prop] : this; + var val = get(ctx, key); - function makeRe() { - var arr = braces(pattern, options); - var opts = extend({strictErrors: false}, options); - return toRegex(arr, opts); - } + var has = typeof val !== 'undefined'; + this.emit('has', key, has); + return has; + }; - return memoize('makeRe', pattern, options, makeRe); -}; + /** + * 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 + */ -/** - * 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 - */ + 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; + }; -braces.parse = function(pattern, options) { - var proto = new Braces(options); - return proto.parse(pattern, options); -}; + /** + * Reset the entire cache to an empty object. + * + * ```js + * app.clear(); + * ``` + * @api public + */ -/** - * 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 - */ + Cache.prototype.clear = function() { + if (prop) { + this[prop] = {}; + } + }; -braces.compile = function(ast, options) { - var proto = new Braces(options); - return proto.compile(ast, options); -}; + /** + * 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 + */ -/** - * Clear the regex cache. - * - * ```js - * braces.clearCache(); - * ``` - * @api public - */ + Cache.prototype.visit = function(method, val) { + visit(this, method, val); + return this; + }; -braces.clearCache = function() { - cache = braces.cache = {}; -}; + return 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. + * Cast val to an array */ -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; +function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; } /** - * Expose `Braces` constructor and methods - * @type {Function} + * Expose `Cache` */ -braces.Braces = Braces; -braces.compilers = compilers; -braces.parsers = parsers; -braces.cache = cache; +module.exports = namespace(); /** - * Expose `braces` - * @type {Function} + * Expose `Cache.namespace` */ -module.exports = braces; +module.exports.namespace = namespace; /***/ }), -/***/ 68297: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 92430: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; - -var extend = __webpack_require__(28727); -var Snapdragon = __webpack_require__(79285); -var compilers = __webpack_require__(46109); -var parsers = __webpack_require__(49665); -var utils = __webpack_require__(68130); - /** - * Customize Snapdragon parser and renderer + * trace-event - A library to create a trace of your node app per + * Google's Trace Event format: + * // JSSTYLED + * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU */ - -function Braces(options) { - this.options = extend({}, options); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var tslib_1 = __webpack_require__(29859); +var stream_1 = __webpack_require__(92413); +function evCommon() { + var hrtime = process.hrtime(); // [seconds, nanoseconds] + var ts = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); // microseconds + return { + ts: ts, + pid: process.pid, + tid: process.pid // no meaningful tid for node.js + }; } - -/** - * 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); +var Tracer = /** @class */ (function (_super) { + tslib_1.__extends(Tracer, _super); + function Tracer(opts) { + if (opts === void 0) { opts = {}; } + var _this = _super.call(this) || this; + _this.noStream = false; + _this.events = []; + if (typeof opts !== "object") { + throw new Error("Invalid options passed (must be an object)"); + } + if (opts.parent != null && typeof opts.parent !== "object") { + throw new Error("Invalid option (parent) passed (must be an object)"); + } + if (opts.fields != null && typeof opts.fields !== "object") { + throw new Error("Invalid option (fields) passed (must be an object)"); + } + if (opts.objectMode != null && + (opts.objectMode !== true && opts.objectMode !== false)) { + throw new Error("Invalid option (objectsMode) passed (must be a boolean)"); + } + _this.noStream = opts.noStream || false; + _this.parent = opts.parent; + if (_this.parent) { + _this.fields = Object.assign({}, opts.parent && opts.parent.fields); + } + else { + _this.fields = {}; + } + if (opts.fields) { + Object.assign(_this.fields, opts.fields); + } + if (!_this.fields.cat) { + // trace-viewer *requires* `cat`, so let's have a fallback. + _this.fields.cat = "default"; + } + else if (Array.isArray(_this.fields.cat)) { + _this.fields.cat = _this.fields.cat.join(","); + } + if (!_this.fields.args) { + // trace-viewer *requires* `args`, so let's have a fallback. + _this.fields.args = {}; + } + if (_this.parent) { + // TODO: Not calling Readable ctor here. Does that cause probs? + // Probably if trying to pipe from the child. + // Might want a serpate TracerChild class for these guys. + _this._push = _this.parent._push.bind(_this.parent); + } + else { + _this._objectMode = Boolean(opts.objectMode); + var streamOpts = { objectMode: _this._objectMode }; + if (_this._objectMode) { + _this._push = _this.push; + } + else { + _this._push = _this._pushString; + streamOpts.encoding = "utf8"; + } + stream_1.Readable.call(_this, streamOpts); + } + return _this; } + /** + * If in no streamMode in order to flush out the trace + * you need to call flush. + */ + Tracer.prototype.flush = function () { + if (this.noStream === true) { + for (var _i = 0, _a = this.events; _i < _a.length; _i++) { + var evt = _a[_i]; + this._push(evt); + } + this._flush(); + } + }; + Tracer.prototype._read = function (_) { }; + Tracer.prototype._pushString = function (ev) { + var separator = ""; + if (!this.firstPush) { + this.push("["); + this.firstPush = true; + } + else { + separator = ",\n"; + } + this.push(separator + JSON.stringify(ev), "utf8"); + }; + Tracer.prototype._flush = function () { + if (!this._objectMode) { + this.push("]"); + } + }; + Tracer.prototype.child = function (fields) { + return new Tracer({ + parent: this, + fields: fields + }); + }; + Tracer.prototype.begin = function (fields) { + return this.mkEventFunc("b")(fields); + }; + Tracer.prototype.end = function (fields) { + return this.mkEventFunc("e")(fields); + }; + Tracer.prototype.completeEvent = function (fields) { + return this.mkEventFunc("X")(fields); + }; + Tracer.prototype.instantEvent = function (fields) { + return this.mkEventFunc("I")(fields); + }; + Tracer.prototype.mkEventFunc = function (ph) { + var _this = this; + return function (fields) { + var ev = evCommon(); + // Assign the event phase. + ev.ph = ph; + if (fields) { + if (typeof fields === "string") { + ev.name = fields; + } + else { + for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) { + var k = _a[_i]; + if (k === "cat") { + ev.cat = fields.cat.join(","); + } + else { + ev[k] = fields[k]; + } + } + } + } + if (!_this.noStream) { + _this._push(ev); + } + else { + _this.events.push(ev); + } + }; + }; + return Tracer; +}(stream_1.Readable)); +exports.Tracer = Tracer; +/* + * These correspond to the "Async events" in the Trace Events doc. + * + * Required fields: + * - name + * - id + * + * Optional fields: + * - cat (array) + * - args (object) + * - TODO: stack fields, other optional fields? + * + * Dev Note: We don't explicitly assert that correct fields are + * used for speed (premature optimization alert!). + */ +//# sourceMappingURL=trace-event.js.map - // add non-enumerable parser reference - utils.define(parsed, 'parser', this.parser); - return parsed; - }); -}; +/***/ }), -/** - * Decorate `.parse` method - */ +/***/ 71523: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -Braces.prototype.parse = function(ast, options) { - if (ast && typeof ast === 'object' && ast.nodes) return ast; - this.init(options); - return this.snapdragon.parse(ast, options); -}; +"use strict"; -/** - * 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); -}; +var util = __webpack_require__(31669); +var union = __webpack_require__(69123); +var define = __webpack_require__(5477); +var staticExtend = __webpack_require__(69457); +var isObj = __webpack_require__(96667); /** - * Expand + * Expose class utils */ -Braces.prototype.expand = function(pattern) { - var ast = this.parse(pattern, {expand: true}); - return this.compile(ast, {expand: true}); -}; +var cu = module.exports; /** - * Optimize + * Expose class utils: `cu` */ -Braces.prototype.optimize = function(pattern) { - var ast = this.parse(pattern, {optimize: true}); - return this.compile(ast, {optimize: true}); +cu.isObject = function isObject(val) { + return isObj(val) || typeof val === 'function'; }; /** - * Expose `Braces` + * 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 */ -module.exports = Braces; - +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; + } + } -/***/ 46109: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; + 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; + } -var utils = __webpack_require__(68130); + throw new TypeError('expected an array or object.'); +}; -module.exports = function(braces, options) { - braces.compiler +/** + * 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 + */ - /** - * bos - */ +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; +}; - .set('bos', function() { - if (this.output) return; - this.ast.queue = isEscaped(this.ast) ? [this.ast.val] : []; - this.ast.count = 1; - }) +/** + * Cast the given value to an array. + * + * ```js + * cu.arrayify('foo'); + * //=> ['foo'] + * + * cu.arrayify(['foo']); + * //=> ['foo'] + * ``` + * + * @param {String|Array} `val` + * @return {Array} + * @api public + */ - /** - * Square brackets - */ +cu.arrayify = function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; +}; - .set('bracket', function(node) { - var close = node.close; - var open = !node.escaped ? '[' : '\\['; - var negated = node.negated; - var inner = node.inner; +/** + * Noop + */ - inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\'); - if (inner === ']-') { - inner = '\\]\\-'; - } +cu.noop = function noop() { + return; +}; - if (negated && inner.indexOf('.') === -1) { - inner += '.'; - } - if (negated && inner.indexOf('/') === -1) { - inner += '/'; - } +/** + * Returns the first argument passed to the function. + */ - var val = open + negated + inner + close; - var queue = node.parent.queue; - var last = utils.arrayify(queue.pop()); +cu.identity = function identity(val) { + return val; +}; - queue.push(utils.join(last, val)); - queue.push.apply(queue, []); - }) +/** + * 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 + */ - /** - * Brace - */ +cu.hasConstructor = function hasConstructor(val) { + return cu.isObject(val) && typeof val.constructor !== 'undefined'; +}; - .set('brace', function(node) { - node.queue = isEscaped(node) ? [node.val] : []; - node.count = 1; - return this.mapVisit(node.nodes); - }) +/** + * 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 + */ - /** - * Open - */ +cu.nativeKeys = function nativeKeys(val) { + if (!cu.hasConstructor(val)) return []; + var keys = Object.getOwnPropertyNames(val); + if ('caller' in val) keys.push('caller'); + return keys; +}; - .set('brace.open', function(node) { - node.parent.open = node.val; - }) +/** + * 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 + */ - /** - * Inner - */ +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); +}; - .set('text', function(node) { - var queue = node.parent.queue; - var escaped = node.escaped; - var segs = [node.val]; +/** + * 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 + */ - if (node.optimize === false) { - options = utils.extend({}, options, {optimize: false}); - } +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.'); + } - if (node.multiplier > 1) { - node.parent.count *= node.multiplier; - } + var val = cu.getDescriptor(provider, name); + if (val) Object.defineProperty(receiver, name, val); +}; - if (options.quantifiers === true && utils.isQuantifier(node.val)) { - escaped = true; +/** + * 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 + */ - } 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, ''); - } +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); - segs = [val]; - escaped = true; - } - } + while (len--) { + key = props[len]; - } else if (node.val === ',') { - if (options.expand) { - node.parent.queue.push(['']); - segs = ['']; - } else { - segs = ['|']; - } - } else { - escaped = true; - } + if (cu.has(keys, key)) { + define(receiver, key, provider[key]); + } else if (!(key in receiver) && !cu.has(omit, key)) { + cu.copyDescriptor(receiver, provider, key); + } + } +}; - 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; - } - } +/** + * 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 + */ - if (!hasQueue(node.parent)) { - node.parent.queue = segs; - return; - } +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 last = utils.arrayify(queue.pop()); - if (node.parent.count > 1 && options.expand) { - last = multiply(last, node.parent.count); - node.parent.count = 1; - } + var keys = []; + for (var key in provider) { + keys.push(key); + receiver[key] = provider[key]; + } - queue.push(utils.join(utils.flatten(last), segs.shift())); - queue.push.apply(queue, segs); - }) + keys = keys.concat(cu.arrayify(omit)); - /** - * Close - */ + var a = provider.prototype || provider; + var b = receiver.prototype || receiver; + cu.copy(b, a, keys); +}; - .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; +/** + * 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 + */ - if (open && close && isOptimized(node, options)) { - open = '('; - close = ')'; - } +cu.extend = function() { + // keep it lazy, instead of assigning to `cu.extend` + return staticExtend.apply(null, arguments); +}; - // 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); - } +/** + * Bubble up events emitted from static methods on the Parent ctor. + * + * @param {Object} `Parent` + * @param {Array} `events` Event names to bubble up + * @api public + */ - if (close && typeof ele === 'string' && ele.length === 1) { - open = ''; - close = ''; - } +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); + }; +}; - 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 - */ +/***/ 16704: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - .set('eos', function(node) { - if (this.input) return; +"use strict"; +/*! + * collection-visit + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ - 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 = []; - }); +var visit = __webpack_require__(59248); +var mapVisit = __webpack_require__(11270); -}; +module.exports = function(collection, method, val) { + var result; -/** - * Multiply the segments in the current brace level - */ + 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); + } -function multiply(queue, n, options) { - return utils.flatten(utils.repeat(utils.arrayify(queue), n)); -} + if (typeof result !== 'undefined') { + return result; + } -/** - * Return true if `node` is escaped - */ + return collection; +}; -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; -} +/***/ 79458: +/***/ (function(module) { -/** - * 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; -} + +/** + * 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; +}; /***/ }), -/***/ 49665: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 3605: +/***/ (function(module) { "use strict"; - - -var Node = __webpack_require__(12579); -var utils = __webpack_require__(68130); - -/** - * Braces parsers +/*! + * copy-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. */ -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; +/** + * 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 + */ - while ((ch = str[++idx])) { - this.consume(1); - node.val += ch; - if (ch === '\\') { - node.val += str[++idx]; - continue; - } - if (ch === '}') { - break; - } - } - } +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 (this.options.unescape !== false) { - node.val = node.val.replace(/\\([{}])/g, '$1'); - } + if (typeof to !== 'string') { + to = from; + } + if (typeof from !== 'string') { + throw new TypeError('expected key to be a string'); + } - if (last.val === '"' && this.input.charAt(0) === '"') { - last.val = node.val; - this.consume(1); - return; - } + if (!(from in provider)) { + throw new Error('property "' + from + '" does not exist'); + } - return concatNodes.call(this, pos, node, prev, options); - }) + var val = Object.getOwnPropertyDescriptor(provider, from); + if (val) Object.defineProperty(receiver, to, val); +}; - /** - * Brackets: "[...]" (basic, this is overridden by - * other parsers in more advanced implementations) - */ +function isObject(val) { + return {}.toString.call(val) === '[object Object]'; +} - .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); +/***/ 78334: +/***/ (function(__unused_webpack_module, exports) { - var str = this.input; - var idx = -1; - var ch; +// 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. - while ((ch = str[++idx])) { - this.consume(1); - if (ch === ']') { - close = ch; - break; - } - inner += ch; - } - } +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. - return pos(new Node({ - type: 'bracket', - val: val, - escaped: close !== ']', - negated: negated, - inner: inner, - close: close - })); - }) +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; - /** - * Empty braces (we capture these early to - * speed up processing in the compiler) - */ +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; - .set('multiplier', function() { - var isInside = this.isInside('brace'); - var pos = this.position(); - var m = this.match(/^\{((?:,|\{,+\})+)\}/); - if (!m) return; +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; - this.multiplier = true; - var prev = this.prev(); - var val = m[0]; +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; - if (isInside && prev.type === 'brace') { - prev.text = prev.text || ''; - prev.text += val; - } +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - var node = pos(new Node({ - type: 'text', - multiplier: 1, - match: m, - val: val - })); +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - return concatNodes.call(this, pos, node, prev, options); - }) +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - /** - * Open - */ +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - .set('brace.open', function() { - var pos = this.position(); - var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); - if (!m) return; +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; - var prev = this.prev(); - var last = utils.last(prev.nodes); +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; - // 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; - } +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; - var open = pos(new Node({ - type: 'brace.open', - val: m[0] - })); +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; - 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; - } - } - } +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; - 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); - } - } +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; - brace.push(node); - }) +exports.isBuffer = Buffer.isBuffer; - /** - * Capture boundary characters - */ +function objectToString(o) { + return Object.prototype.toString.call(o); +} - .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; +/***/ 95748: +/***/ (function(module) { - var prev = this.prev(); - var val = m[0]; +"use strict"; - if (isInside && prev.type === 'brace') { - prev.text = prev.text || ''; - prev.text += val; - } +var token = '%[a-f0-9]{2}'; +var singleMatcher = new RegExp(token, 'gi'); +var multiMatcher = new RegExp('(' + token + ')+', 'gi'); - return pos(new Node({ - type: 'text', - multiplier: 0, - val: val - })); - }) +function decodeComponents(components, split) { + try { + // Try to decode the entire string first + return decodeURIComponent(components.join('')); + } catch (err) { + // Do nothing + } - /** - * Text - */ + if (components.length === 1) { + return components; + } - .set('text', function() { - var isInside = this.isInside('brace'); - var pos = this.position(); - var m = this.match(/^((?!\\)[^${}[\]])+/); - if (!m) return; + split = split || 1; - var prev = this.prev(); - var val = m[0]; + // Split the array in 2 parts + var left = components.slice(0, split); + var right = components.slice(split); - if (isInside && prev.type === 'brace') { - prev.text = prev.text || ''; - prev.text += val; - } + return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); +} - var node = pos(new Node({ - type: 'text', - multiplier: 1, - val: val - })); +function decode(input) { + try { + return decodeURIComponent(input); + } catch (err) { + var tokens = input.match(singleMatcher); - return concatNodes.call(this, pos, node, prev, options); - }); -}; + for (var i = 1; i < tokens.length; i++) { + input = decodeComponents(tokens, i).join(''); -/** - * Returns true if the character is an extglob character. - */ + tokens = input.match(singleMatcher); + } -function isExtglobChar(ch) { - return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; + return input; + } } -/** - * Combine text nodes, and calculate empty sets (`{,,}`) - * @param {Function} `pos` Function to calculate node position - * @param {Object} `node` AST node - * @return {Object} - */ +function customDecodeURIComponent(input) { + // Keep track of all the replacements and prefill the map with the `BOM` + var replaceMap = { + '%FE%FF': '\uFFFD\uFFFD', + '%FF%FE': '\uFFFD\uFFFD' + }; -function concatNodes(pos, node, parent, options) { - node.orig = node.val; - var prev = this.prev(); - var last = utils.last(prev.nodes); - var isEscaped = false; + var match = multiMatcher.exec(input); + while (match) { + try { + // Decode as big chunks as possible + replaceMap[match[0]] = decodeURIComponent(match[0]); + } catch (err) { + var result = decode(match[0]); - if (node.val.length > 1) { - var a = node.val.charAt(0); - var b = node.val.slice(-1); + if (result !== match[0]) { + replaceMap[match[0]] = result; + } + } - isEscaped = (a === '"' && b === '"') - || (a === "'" && b === "'") - || (a === '`' && b === '`'); - } + match = multiMatcher.exec(input); + } - if (isEscaped && options.unescape !== false) { - node.val = node.val.slice(1, node.val.length - 1); - node.escaped = true; - } + // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else + replaceMap['%C2'] = '\uFFFD'; - if (node.match) { - var match = node.match[1]; - if (!match || match.indexOf('}') === -1) { - match = node.match[0]; - } + var entries = Object.keys(replaceMap); - // replace each set with a single "," - var val = match.replace(/\{/g, ',').replace(/\}/g, ''); - node.multiplier *= val.length; - node.val = ''; - } + for (var i = 0; i < entries.length; i++) { + // Replace all decoded components + var key = entries[i]; + input = input.replace(new RegExp(key, 'g'), replaceMap[key]); + } - var simpleText = last.type === 'text' - && last.multiplier === 1 - && node.multiplier === 1 - && node.val; + return input; +} - if (simpleText) { - last.val += node.val; - return; - } +module.exports = function (encodedURI) { + if (typeof encodedURI !== 'string') { + throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); + } - prev.push(node); -} + try { + encodedURI = encodedURI.replace(/\+/g, ' '); + + // Try the built in decoder first + return decodeURIComponent(encodedURI); + } catch (err) { + // Fallback to a more advanced decoder + return customDecodeURIComponent(encodedURI); + } +}; /***/ }), -/***/ 68130: +/***/ 5477: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; - - -var splitString = __webpack_require__(33218); -var utils = module.exports; - -/** - * Module dependencies +/*! + * define-property + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. */ -utils.extend = __webpack_require__(28727); -utils.flatten = __webpack_require__(27299); -utils.isObject = __webpack_require__(96667); -utils.fillRange = __webpack_require__(35955); -utils.repeat = __webpack_require__(69523); -utils.unique = __webpack_require__(19009); -utils.define = function(obj, key, val) { - Object.defineProperty(obj, key, { - writable: true, + +var isDescriptor = __webpack_require__(49924); + +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 }); }; -/** - * 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. +/***/ 30138: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. */ -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; -}; +var typeOf = __webpack_require__(1057); -/** - * Normalize options - */ +// accessor descriptor properties +var accessor = { + get: 'function', + set: 'function', + configurable: 'boolean', + enumerable: 'boolean' +}; -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; +function isAccessorDescriptor(obj, prop) { + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; } - return opts; -}; -/** - * Join patterns in `a` to patterns in `b` - */ + if (typeOf(obj) !== 'object') { + return false; + } -utils.join = function(a, b, options) { - options = options || {}; - a = utils.arrayify(a); - b = utils.arrayify(b); + if (has(obj, 'value') || has(obj, 'writable')) { + return false; + } - if (!a.length) return b; - if (!b.length) return a; + if (!has(obj, 'get') || typeof obj.get !== 'function') { + return false; + } - var len = a.length; - var idx = -1; - var arr = []; + // 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; + } - 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); + for (var key in obj) { + if (!accessor.hasOwnProperty(key)) { continue; } - for (var j = 0; j < b.length; j++) { - var bval = b[j]; + if (typeOf(obj[key]) === accessor[key]) { + continue; + } - if (Array.isArray(bval)) { - arr.push(utils.join(val, bval, options)); - } else { - arr.push(val + bval); - } + if (typeof obj[key] !== 'undefined') { + return false; } } - return arr; -}; + return true; +} + +function has(obj, key) { + return {}.hasOwnProperty.call(obj, key); +} /** - * Split the given string on `,` if not escaped. + * Expose `isAccessorDescriptor` */ -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)); -}; +module.exports = isAccessorDescriptor; + + +/***/ }), + +/***/ 1057: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var isBuffer = __webpack_require__(72195); +var toString = Object.prototype.toString; /** - * Expand ranges or sets in the given `pattern`. + * Get the native `typeof` a value. * - * @param {String} `str` - * @param {Object} `options` - * @return {Object} + * @param {*} `val` + * @return {*} Native javascript type */ -utils.expand = function(str, options) { - var opts = utils.extend({rangeLimit: 10000}, options); - var segs = utils.split(str, opts); - var tok = { segs: segs }; +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'; + } - if (utils.isQuotedString(str)) { - return tok; + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; } - if (opts.rangeLimit === true) { - opts.rangeLimit = 10000; + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; } - if (segs.length > 1) { - if (opts.optimize === false) { - tok.val = segs[0]; - return tok; - } + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } - tok.segs = utils.stringifyArray(tok.segs); - } else if (segs.length === 1) { - var arr = str.split('..'); + // other objects + var type = toString.call(val); - if (arr.length === 1) { - tok.val = tok.segs[tok.segs.length - 1] || tok.val || str; - tok.segs = []; - return tok; - } + 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 (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); - } + // buffer + if (isBuffer(val)) { + return 'buffer'; + } - if (tok.segs === '') { - tok.val = str; - } else { - tok.val = tok.segs[0]; - } - return tok; - } - } else { - tok.val = str; + // 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'; } - return tok; -}; -/** - * Ensure commas inside brackets and parens are not split. - * @param {Object} `tok` Token from the `split-string` module - * @return {undefined} - */ + // 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'; + } -utils.escapeBrackets = function(options) { - return function(tok) { - if (tok.escaped && tok.val === 'b') { - tok.val = '\\b'; - return; - } + // must be a plain object + return 'object'; +}; - 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; - } +/***/ 54963: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (ch === '(') { - parens.push(ch); - stack.push(ch); - } +"use strict"; +/*! + * is-data-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ - 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; - } +var typeOf = __webpack_require__(31072); - tok.split = false; - tok.val = val.slice(1); - tok.idx = i; - }; +// data descriptor properties +var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' }; -/** - * 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); -}; +function isDataDescriptor(obj, prop) { + if (typeOf(obj) !== 'object') { + return false; + } -/** - * Cast `val` to an array. - * @param {*} `val` - */ + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } -utils.stringifyArray = function(arr) { - return [utils.arrayify(arr).join('|')]; -}; + if (!('value' in obj) && !('writable' in obj)) { + return false; + } -/** - * Cast `val` to an array. - * @param {*} `val` - */ + for (var key in obj) { + if (key === 'value') continue; -utils.arrayify = function(arr) { - if (typeof arr === 'undefined') { - return []; - } - if (typeof arr === 'string') { - return [arr]; - } - return arr; -}; + if (!data.hasOwnProperty(key)) { + continue; + } -/** - * Returns true if the given `str` is a non-empty string - * @return {Boolean} - */ + if (typeOf(obj[key]) === data[key]) { + continue; + } -utils.isString = function(str) { - return str != null && typeof str === 'string'; -}; + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} /** - * Get the last element from `array` - * @param {Array} `array` - * @return {*} + * Expose `isDataDescriptor` */ -utils.last = function(arr, n) { - return arr[arr.length - (n || 1)]; -}; - -utils.escapeRegex = function(str) { - return str.replace(/\\?([!^*?()[\]{}+?/])/g, '\\$1'); -}; +module.exports = isDataDescriptor; /***/ }), -/***/ 63375: +/***/ 31072: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; - - -var isObject = __webpack_require__(96667); -var Emitter = __webpack_require__(79458); -var visit = __webpack_require__(16704); -var toPath = __webpack_require__(71708); -var union = __webpack_require__(7716); -var del = __webpack_require__(5834); -var get = __webpack_require__(89304); -var has = __webpack_require__(41825); -var set = __webpack_require__(34857); +var isBuffer = __webpack_require__(72195); +var toString = Object.prototype.toString; /** - * Create a `Cache` constructor that when instantiated will - * store values on the given `prop`. + * Get the native `typeof` a value. * - * ```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 + * @param {*} `val` + * @return {*} Native javascript type */ -function namespace(prop) { +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'; + } - /** - * 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 - */ + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } - function Cache(cache) { - if (prop) { - this[prop] = {}; - } - if (cache) { - this.set(cache); - } + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; } - /** - * Inherit Emitter - */ + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } - Emitter(Cache.prototype); + // other objects + var type = toString.call(val); - /** - * 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 - */ + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } - 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; - }; + // buffer + if (isBuffer(val)) { + return 'buffer'; + } - /** - * 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 - */ + // 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'; + } - 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; - }; + // 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'; + } - /** - * 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 - */ + // must be a plain object + return 'object'; +}; - 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; - }; +/***/ 49924: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * 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 - */ +"use strict"; +/*! + * is-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ - 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; - }; +var typeOf = __webpack_require__(42649); +var isAccessor = __webpack_require__(30138); +var isData = __webpack_require__(54963); - /** - * 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 - */ +module.exports = function isDescriptor(obj, key) { + if (typeOf(obj) !== 'object') { + return false; + } + if ('get' in obj) { + return isAccessor(obj, key); + } + return isData(obj, key); +}; - 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] = {}; +/***/ 42649: +/***/ (function(module) { + +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'; + } - /** - * 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 - */ + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } - Cache.prototype.visit = function(method, val) { - visit(this, method, val); - return this; - }; + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } - return Cache; -} + // other objects + type = toString.call(val); -/** - * Cast val to an array - */ + 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'; + } -function arrayify(val) { - return val ? (Array.isArray(val) ? val : [val]) : []; -} + // buffer + if (isBuffer(val)) { + return 'buffer'; + } -/** - * Expose `Cache` - */ + // 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'; + } -module.exports = namespace(); + // must be a plain object + return 'object'; +}; /** - * Expose `Cache.namespace` + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer */ -module.exports.namespace = namespace; +function isBuffer(val) { + return val.constructor + && typeof val.constructor.isBuffer === 'function' + && val.constructor.isBuffer(val); +} /***/ }), -/***/ 92430: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 89901: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * trace-event - A library to create a trace of your node app per - * Google's Trace Event format: - * // JSSTYLED - * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -var tslib_1 = __webpack_require__(29859); -var stream_1 = __webpack_require__(92413); -function evCommon() { - var hrtime = process.hrtime(); // [seconds, nanoseconds] - var ts = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000); // microseconds - return { - ts: ts, - pid: process.pid, - tid: process.pid // no meaningful tid for node.js - }; -} -var Tracer = /** @class */ (function (_super) { - tslib_1.__extends(Tracer, _super); - function Tracer(opts) { - if (opts === void 0) { opts = {}; } - var _this = _super.call(this) || this; - _this.noStream = false; - _this.events = []; - if (typeof opts !== "object") { - throw new Error("Invalid options passed (must be an object)"); - } - if (opts.parent != null && typeof opts.parent !== "object") { - throw new Error("Invalid option (parent) passed (must be an object)"); - } - if (opts.fields != null && typeof opts.fields !== "object") { - throw new Error("Invalid option (fields) passed (must be an object)"); - } - if (opts.objectMode != null && - (opts.objectMode !== true && opts.objectMode !== false)) { - throw new Error("Invalid option (objectsMode) passed (must be a boolean)"); - } - _this.noStream = opts.noStream || false; - _this.parent = opts.parent; - if (_this.parent) { - _this.fields = Object.assign({}, opts.parent && opts.parent.fields); - } - else { - _this.fields = {}; - } - if (opts.fields) { - Object.assign(_this.fields, opts.fields); - } - if (!_this.fields.cat) { - // trace-viewer *requires* `cat`, so let's have a fallback. - _this.fields.cat = "default"; - } - else if (Array.isArray(_this.fields.cat)) { - _this.fields.cat = _this.fields.cat.join(","); - } - if (!_this.fields.args) { - // trace-viewer *requires* `args`, so let's have a fallback. - _this.fields.args = {}; - } - if (_this.parent) { - // TODO: Not calling Readable ctor here. Does that cause probs? - // Probably if trying to pipe from the child. - // Might want a serpate TracerChild class for these guys. - _this._push = _this.parent._push.bind(_this.parent); - } - else { - _this._objectMode = Boolean(opts.objectMode); - var streamOpts = { objectMode: _this._objectMode }; - if (_this._objectMode) { - _this._push = _this.push; - } - else { - _this._push = _this._pushString; - streamOpts.encoding = "utf8"; - } - stream_1.Readable.call(_this, streamOpts); - } - return _this; - } - /** - * If in no streamMode in order to flush out the trace - * you need to call flush. - */ - Tracer.prototype.flush = function () { - if (this.noStream === true) { - for (var _i = 0, _a = this.events; _i < _a.length; _i++) { - var evt = _a[_i]; - this._push(evt); - } - this._flush(); - } - }; - Tracer.prototype._read = function (_) { }; - Tracer.prototype._pushString = function (ev) { - var separator = ""; - if (!this.firstPush) { - this.push("["); - this.firstPush = true; - } - else { - separator = ",\n"; - } - this.push(separator + JSON.stringify(ev), "utf8"); - }; - Tracer.prototype._flush = function () { - if (!this._objectMode) { - this.push("]"); - } - }; - Tracer.prototype.child = function (fields) { - return new Tracer({ - parent: this, - fields: fields - }); - }; - Tracer.prototype.begin = function (fields) { - return this.mkEventFunc("b")(fields); - }; - Tracer.prototype.end = function (fields) { - return this.mkEventFunc("e")(fields); - }; - Tracer.prototype.completeEvent = function (fields) { - return this.mkEventFunc("X")(fields); - }; - Tracer.prototype.instantEvent = function (fields) { - return this.mkEventFunc("I")(fields); - }; - Tracer.prototype.mkEventFunc = function (ph) { - var _this = this; - return function (fields) { - var ev = evCommon(); - // Assign the event phase. - ev.ph = ph; - if (fields) { - if (typeof fields === "string") { - ev.name = fields; - } - else { - for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) { - var k = _a[_i]; - if (k === "cat") { - ev.cat = fields.cat.join(","); - } - else { - ev[k] = fields[k]; - } - } - } - } - if (!_this.noStream) { - _this._push(ev); - } - else { - _this.events.push(ev); - } - }; - }; - return Tracer; -}(stream_1.Readable)); -exports.Tracer = Tracer; -/* - * These correspond to the "Async events" in the Trace Events doc. - * - * Required fields: - * - name - * - id - * - * Optional fields: - * - cat (array) - * - args (object) - * - TODO: stack fields, other optional fields? - * - * Dev Note: We don't explicitly assert that correct fields are - * used for speed (premature optimization alert!). - */ -//# sourceMappingURL=trace-event.js.map -/***/ }), +const DescriptionFileUtils = __webpack_require__(70232); +const getInnerRequest = __webpack_require__(91878); -/***/ 71523: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +module.exports = class AliasFieldPlugin { + constructor(source, field, target) { + this.source = source; + this.field = field; + this.target = target; + } -"use strict"; + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => { + if (!request.descriptionFileData) return callback(); + const innerRequest = getInnerRequest(resolver, request); + if (!innerRequest) return callback(); + const fieldData = DescriptionFileUtils.getField( + request.descriptionFileData, + this.field + ); + if (typeof fieldData !== "object") { + if (resolveContext.log) + resolveContext.log( + "Field '" + + this.field + + "' doesn't contain a valid alias configuration" + ); + return callback(); + } + const data1 = fieldData[innerRequest]; + const data2 = fieldData[innerRequest.replace(/^\.\//, "")]; + const data = typeof data1 !== "undefined" ? data1 : data2; + if (data === innerRequest) return callback(); + if (data === undefined) return callback(); + if (data === false) { + const ignoreObj = Object.assign({}, request, { + path: false + }); + return callback(null, ignoreObj); + } + const obj = Object.assign({}, request, { + path: request.descriptionFileRoot, + request: data + }); + resolver.doResolve( + target, + obj, + "aliased from description file " + + request.descriptionFilePath + + " with mapping '" + + innerRequest + + "' to '" + + data + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); + // Don't allow other aliasing or raw request + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); + } +}; -var util = __webpack_require__(31669); -var union = __webpack_require__(69123); -var define = __webpack_require__(5477); -var staticExtend = __webpack_require__(69457); -var isObj = __webpack_require__(96667); -/** - * Expose class utils - */ +/***/ }), -var cu = module.exports; +/***/ 15005: +/***/ (function(module) { -/** - * Expose class utils: `cu` - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -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 - */ +function startsWith(string, searchString) { + const stringLength = string.length; + const searchLength = searchString.length; -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; - } - } + // early out if the search length is greater than the search string + if (searchLength > stringLength) { + return false; + } + let index = -1; + while (++index < searchLength) { + if (string.charCodeAt(index) !== searchString.charCodeAt(index)) { + return false; + } + } + return true; +} - var keys = cu.nativeKeys(obj); - return cu.has(keys, val); - } +module.exports = class AliasPlugin { + constructor(source, options, target) { + this.source = source; + this.options = Array.isArray(options) ? options : [options]; + this.target = target; + } - if (Array.isArray(obj)) { - var arr = obj; - while (len--) { - if (arr.indexOf(val[len]) > -1) { - return true; - } - } - return false; - } + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AliasPlugin", (request, resolveContext, callback) => { + const innerRequest = request.request || request.path; + if (!innerRequest) return callback(); + for (const item of this.options) { + if ( + innerRequest === item.name || + (!item.onlyModule && startsWith(innerRequest, item.name + "/")) + ) { + if ( + innerRequest !== item.alias && + !startsWith(innerRequest, item.alias + "/") + ) { + const newRequestStr = + item.alias + innerRequest.substr(item.name.length); + const obj = Object.assign({}, request, { + request: newRequestStr + }); + return resolver.doResolve( + target, + obj, + "aliased with mapping '" + + item.name + + "': '" + + item.alias + + "' to '" + + newRequestStr + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); - throw new TypeError('expected an array or object.'); + // Don't allow other aliasing or raw request + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + } + } + } + return callback(); + }); + } }; -/** - * 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]) : []; -}; +/***/ 2271: +/***/ (function(module) { -/** - * Noop - */ +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -cu.noop = function noop() { - return; -}; -/** - * Returns the first argument passed to the function. - */ +module.exports = class AppendPlugin { + constructor(source, appending, target) { + this.source = source; + this.appending = appending; + this.target = target; + } -cu.identity = function identity(val) { - return val; + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("AppendPlugin", (request, resolveContext, callback) => { + const obj = Object.assign({}, request, { + path: request.path + this.appending, + relativePath: + request.relativePath && request.relativePath + this.appending + }); + resolver.doResolve( + target, + obj, + this.appending, + resolveContext, + callback + ); + }); + } }; -/** - * 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 - */ +/***/ 75544: +/***/ (function(module) { -cu.nativeKeys = function nativeKeys(val) { - if (!cu.hasConstructor(val)) return []; - var keys = Object.getOwnPropertyNames(val); - if ('caller' in val) keys.push('caller'); - return keys; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/** - * 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); -}; +class Storage { + constructor(duration) { + this.duration = duration; + this.running = new Map(); + this.data = new Map(); + this.levels = []; + if (duration > 0) { + this.levels.push( + new Set(), + new Set(), + new Set(), + new Set(), + new Set(), + new Set(), + new Set(), + new Set(), + new Set() + ); + for (let i = 8000; i < duration; i += 500) this.levels.push(new Set()); + } + this.count = 0; + this.interval = null; + this.needTickCheck = false; + this.nextTick = null; + this.passive = true; + this.tick = this.tick.bind(this); + } -/** - * 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 - */ + ensureTick() { + if (!this.interval && this.duration > 0 && !this.nextTick) + this.interval = setInterval( + this.tick, + Math.floor(this.duration / this.levels.length) + ); + } -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.'); - } + finished(name, err, result) { + const callbacks = this.running.get(name); + this.running.delete(name); + if (this.duration > 0) { + this.data.set(name, [err, result]); + const levelData = this.levels[0]; + this.count -= levelData.size; + levelData.add(name); + this.count += levelData.size; + this.ensureTick(); + } + for (let i = 0; i < callbacks.length; i++) { + callbacks[i](err, result); + } + } - var val = cu.getDescriptor(provider, name); - if (val) Object.defineProperty(receiver, name, val); -}; + finishedSync(name, err, result) { + if (this.duration > 0) { + this.data.set(name, [err, result]); + const levelData = this.levels[0]; + this.count -= levelData.size; + levelData.add(name); + this.count += levelData.size; + this.ensureTick(); + } + } -/** - * 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 - */ + provide(name, provider, callback) { + if (typeof name !== "string") { + callback(new TypeError("path must be a string")); + return; + } + let running = this.running.get(name); + if (running) { + running.push(callback); + return; + } + if (this.duration > 0) { + this.checkTicks(); + const data = this.data.get(name); + if (data) { + return process.nextTick(() => { + callback.apply(null, data); + }); + } + } + this.running.set(name, (running = [callback])); + provider(name, (err, result) => { + this.finished(name, err, result); + }); + } -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); + provideSync(name, provider) { + if (typeof name !== "string") { + throw new TypeError("path must be a string"); + } + if (this.duration > 0) { + this.checkTicks(); + const data = this.data.get(name); + if (data) { + if (data[0]) throw data[0]; + return data[1]; + } + } + let result; + try { + result = provider(name); + } catch (e) { + this.finishedSync(name, e); + throw e; + } + this.finishedSync(name, null, result); + return result; + } - while (len--) { - key = props[len]; + tick() { + const decay = this.levels.pop(); + for (let item of decay) { + this.data.delete(item); + } + this.count -= decay.size; + decay.clear(); + this.levels.unshift(decay); + if (this.count === 0) { + clearInterval(this.interval); + this.interval = null; + this.nextTick = null; + return true; + } else if (this.nextTick) { + this.nextTick += Math.floor(this.duration / this.levels.length); + const time = new Date().getTime(); + if (this.nextTick > time) { + this.nextTick = null; + this.interval = setInterval( + this.tick, + Math.floor(this.duration / this.levels.length) + ); + return true; + } + } else if (this.passive) { + clearInterval(this.interval); + this.interval = null; + this.nextTick = + new Date().getTime() + Math.floor(this.duration / this.levels.length); + } else { + this.passive = true; + } + } - if (cu.has(keys, key)) { - define(receiver, key, provider[key]); - } else if (!(key in receiver) && !cu.has(omit, key)) { - cu.copyDescriptor(receiver, provider, key); - } - } -}; + checkTicks() { + this.passive = false; + if (this.nextTick) { + while (!this.tick()); + } + } -/** - * 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 - */ + purge(what) { + if (!what) { + this.count = 0; + clearInterval(this.interval); + this.nextTick = null; + this.data.clear(); + this.levels.forEach(level => { + level.clear(); + }); + } else if (typeof what === "string") { + for (let key of this.data.keys()) { + if (key.startsWith(what)) this.data.delete(key); + } + } else { + for (let i = what.length - 1; i >= 0; i--) { + this.purge(what[i]); + } + } + } +} -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.'); - } +module.exports = class CachedInputFileSystem { + constructor(fileSystem, duration) { + this.fileSystem = fileSystem; + this._statStorage = new Storage(duration); + this._readdirStorage = new Storage(duration); + this._readFileStorage = new Storage(duration); + this._readJsonStorage = new Storage(duration); + this._readlinkStorage = new Storage(duration); - var keys = []; - for (var key in provider) { - keys.push(key); - receiver[key] = provider[key]; - } + this._stat = this.fileSystem.stat + ? this.fileSystem.stat.bind(this.fileSystem) + : null; + if (!this._stat) this.stat = null; - keys = keys.concat(cu.arrayify(omit)); + this._statSync = this.fileSystem.statSync + ? this.fileSystem.statSync.bind(this.fileSystem) + : null; + if (!this._statSync) this.statSync = null; - var a = provider.prototype || provider; - var b = receiver.prototype || receiver; - cu.copy(b, a, keys); -}; + this._readdir = this.fileSystem.readdir + ? this.fileSystem.readdir.bind(this.fileSystem) + : null; + if (!this._readdir) this.readdir = null; -/** - * 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 - */ + this._readdirSync = this.fileSystem.readdirSync + ? this.fileSystem.readdirSync.bind(this.fileSystem) + : null; + if (!this._readdirSync) this.readdirSync = null; -cu.extend = function() { - // keep it lazy, instead of assigning to `cu.extend` - return staticExtend.apply(null, arguments); -}; + this._readFile = this.fileSystem.readFile + ? this.fileSystem.readFile.bind(this.fileSystem) + : null; + if (!this._readFile) this.readFile = null; -/** - * Bubble up events emitted from static methods on the Parent ctor. - * - * @param {Object} `Parent` - * @param {Array} `events` Event names to bubble up - * @api public - */ + this._readFileSync = this.fileSystem.readFileSync + ? this.fileSystem.readFileSync.bind(this.fileSystem) + : null; + if (!this._readFileSync) this.readFileSync = null; -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); - }; + if (this.fileSystem.readJson) { + this._readJson = this.fileSystem.readJson.bind(this.fileSystem); + } else if (this.readFile) { + this._readJson = (path, callback) => { + this.readFile(path, (err, buffer) => { + if (err) return callback(err); + let data; + try { + data = JSON.parse(buffer.toString("utf-8")); + } catch (e) { + return callback(e); + } + callback(null, data); + }); + }; + } else { + this.readJson = null; + } + if (this.fileSystem.readJsonSync) { + this._readJsonSync = this.fileSystem.readJsonSync.bind(this.fileSystem); + } else if (this.readFileSync) { + this._readJsonSync = path => { + const buffer = this.readFileSync(path); + const data = JSON.parse(buffer.toString("utf-8")); + return data; + }; + } else { + this.readJsonSync = null; + } + + this._readlink = this.fileSystem.readlink + ? this.fileSystem.readlink.bind(this.fileSystem) + : null; + if (!this._readlink) this.readlink = null; + + this._readlinkSync = this.fileSystem.readlinkSync + ? this.fileSystem.readlinkSync.bind(this.fileSystem) + : null; + if (!this._readlinkSync) this.readlinkSync = null; + } + + stat(path, callback) { + this._statStorage.provide(path, this._stat, callback); + } + + readdir(path, callback) { + this._readdirStorage.provide(path, this._readdir, callback); + } + + readFile(path, callback) { + this._readFileStorage.provide(path, this._readFile, callback); + } + + readJson(path, callback) { + this._readJsonStorage.provide(path, this._readJson, callback); + } + + readlink(path, callback) { + this._readlinkStorage.provide(path, this._readlink, callback); + } + + statSync(path) { + return this._statStorage.provideSync(path, this._statSync); + } + + readdirSync(path) { + return this._readdirStorage.provideSync(path, this._readdirSync); + } + + readFileSync(path) { + return this._readFileStorage.provideSync(path, this._readFileSync); + } + + readJsonSync(path) { + return this._readJsonStorage.provideSync(path, this._readJsonSync); + } + + readlinkSync(path) { + return this._readlinkStorage.provideSync(path, this._readlinkSync); + } + + purge(what) { + this._statStorage.purge(what); + this._readdirStorage.purge(what); + this._readFileStorage.purge(what); + this._readlinkStorage.purge(what); + this._readJsonStorage.purge(what); + } }; /***/ }), -/***/ 16704: +/***/ 56821: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/*! - * collection-visit - * - * Copyright (c) 2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */ - - +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -var visit = __webpack_require__(59248); -var mapVisit = __webpack_require__(11270); -module.exports = function(collection, method, val) { - var result; +const concord = __webpack_require__(94323); +const DescriptionFileUtils = __webpack_require__(70232); +const forEachBail = __webpack_require__(60059); - 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); - } +module.exports = class ConcordExtensionsPlugin { + constructor(source, options, target) { + this.source = source; + this.options = options; + this.target = target; + } - if (typeof result !== 'undefined') { - return result; - } + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "ConcordExtensionsPlugin", + (request, resolveContext, callback) => { + const concordField = DescriptionFileUtils.getField( + request.descriptionFileData, + "concord" + ); + if (!concordField) return callback(); + const extensions = concord.getExtensions( + request.context, + concordField + ); + if (!extensions) return callback(); + forEachBail( + extensions, + (appending, callback) => { + const obj = Object.assign({}, request, { + path: request.path + appending, + relativePath: + request.relativePath && request.relativePath + appending + }); + resolver.doResolve( + target, + obj, + "concord extension: " + appending, + resolveContext, + callback + ); + }, + (err, result) => { + if (err) return callback(err); - return collection; + // Don't allow other processing + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + } + ); + } }; /***/ }), -/***/ 79458: -/***/ (function(module) { +/***/ 27878: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/** - * 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; -}; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const path = __webpack_require__(85622); +const concord = __webpack_require__(94323); +const DescriptionFileUtils = __webpack_require__(70232); + +module.exports = class ConcordMainPlugin { + constructor(source, options, target) { + this.source = source; + this.options = options; + this.target = target; + } + + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ConcordMainPlugin", (request, resolveContext, callback) => { + if (request.path !== request.descriptionFileRoot) return callback(); + const concordField = DescriptionFileUtils.getField( + request.descriptionFileData, + "concord" + ); + if (!concordField) return callback(); + const mainModule = concord.getMain(request.context, concordField); + if (!mainModule) return callback(); + const obj = Object.assign({}, request, { + request: mainModule + }); + const filename = path.basename(request.descriptionFilePath); + return resolver.doResolve( + target, + obj, + "use " + mainModule + " from " + filename, + resolveContext, + callback + ); + }); + } +}; /***/ }), -/***/ 3605: -/***/ (function(module) { +/***/ 50297: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/*! - * copy-descriptor - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +const concord = __webpack_require__(94323); +const DescriptionFileUtils = __webpack_require__(70232); +const getInnerRequest = __webpack_require__(91878); -/** - * 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'); - } +module.exports = class ConcordModulesPlugin { + constructor(source, options, target) { + this.source = source; + this.options = options; + this.target = target; + } - if (!(from in provider)) { - throw new Error('property "' + from + '" does not exist'); - } + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ConcordModulesPlugin", (request, resolveContext, callback) => { + const innerRequest = getInnerRequest(resolver, request); + if (!innerRequest) return callback(); + const concordField = DescriptionFileUtils.getField( + request.descriptionFileData, + "concord" + ); + if (!concordField) return callback(); + const data = concord.matchModule( + request.context, + concordField, + innerRequest + ); + if (data === innerRequest) return callback(); + if (data === undefined) return callback(); + if (data === false) { + const ignoreObj = Object.assign({}, request, { + path: false + }); + return callback(null, ignoreObj); + } + const obj = Object.assign({}, request, { + path: request.descriptionFileRoot, + request: data + }); + resolver.doResolve( + target, + obj, + "aliased from description file " + + request.descriptionFilePath + + " with mapping '" + + innerRequest + + "' to '" + + data + + "'", + resolveContext, + (err, result) => { + if (err) return callback(err); - var val = Object.getOwnPropertyDescriptor(provider, from); - if (val) Object.defineProperty(receiver, to, val); + // Don't allow other aliasing or raw request + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); + } }; -function isObject(val) { - return {}.toString.call(val) === '[object Object]'; -} - - /***/ }), -/***/ 78334: -/***/ (function(__unused_webpack_module, exports) { - -// 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. +/***/ 95637: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. +"use strict"; +/* +MIT License http://www.opensource.org/licenses/mit-license.php +Author Tobias Koppers @sokra +*/ -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; +const DescriptionFileUtils = __webpack_require__(70232); -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; +module.exports = class DescriptionFilePlugin { + constructor(source, filenames, target) { + this.source = source; + this.filenames = [].concat(filenames); + this.target = target; + } -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "DescriptionFilePlugin", + (request, resolveContext, callback) => { + const directory = request.path; + DescriptionFileUtils.loadDescriptionFile( + resolver, + directory, + this.filenames, + resolveContext, + (err, result) => { + if (err) return callback(err); + if (!result) { + if (resolveContext.missing) { + this.filenames.forEach(filename => { + resolveContext.missing.add( + resolver.join(directory, filename) + ); + }); + } + if (resolveContext.log) + resolveContext.log("No description file found"); + return callback(); + } + const relativePath = + "." + + request.path + .substr(result.directory.length) + .replace(/\\/g, "/"); + const obj = Object.assign({}, request, { + descriptionFilePath: result.path, + descriptionFileData: result.content, + descriptionFileRoot: result.directory, + relativePath: relativePath + }); + resolver.doResolve( + target, + obj, + "using description file: " + + result.path + + " (relative path: " + + relativePath + + ")", + resolveContext, + (err, result) => { + if (err) return callback(err); -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; + // Don't allow other processing + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + } + ); + } + ); + } +}; -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; +/***/ 70232: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; +const forEachBail = __webpack_require__(60059); -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; +function loadDescriptionFile( + resolver, + directory, + filenames, + resolveContext, + callback +) { + (function findDescriptionFile() { + forEachBail( + filenames, + (filename, callback) => { + const descriptionFilePath = resolver.join(directory, filename); + if (resolver.fileSystem.readJson) { + resolver.fileSystem.readJson(descriptionFilePath, (err, content) => { + if (err) { + if (typeof err.code !== "undefined") return callback(); + return onJson(err); + } + onJson(null, content); + }); + } else { + resolver.fileSystem.readFile(descriptionFilePath, (err, content) => { + if (err) return callback(); + let json; + try { + json = JSON.parse(content); + } catch (e) { + onJson(e); + } + onJson(null, json); + }); + } -function isFunction(arg) { - return typeof arg === 'function'; + function onJson(err, content) { + if (err) { + if (resolveContext.log) + resolveContext.log( + descriptionFilePath + " (directory description file): " + err + ); + else + err.message = + descriptionFilePath + " (directory description file): " + err; + return callback(err); + } + callback(null, { + content: content, + directory: directory, + path: descriptionFilePath + }); + } + }, + (err, result) => { + if (err) return callback(err); + if (result) { + return callback(null, result); + } else { + directory = cdUp(directory); + if (!directory) { + return callback(); + } else { + return findDescriptionFile(); + } + } + } + ); + })(); } -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'; +function getField(content, field) { + if (!content) return undefined; + if (Array.isArray(field)) { + let current = content; + for (let j = 0; j < field.length; j++) { + if (current === null || typeof current !== "object") { + current = null; + break; + } + current = current[field[j]]; + } + if (typeof current === "object") { + return current; + } + } else { + if (typeof content[field] === "object") { + return content[field]; + } + } } -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; -function objectToString(o) { - return Object.prototype.toString.call(o); +function cdUp(directory) { + if (directory === "/") return null; + const i = directory.lastIndexOf("/"), + j = directory.lastIndexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if (p < 0) return null; + return directory.substr(0, p || 1); } +exports.loadDescriptionFile = loadDescriptionFile; +exports.getField = getField; +exports.cdUp = cdUp; + /***/ }), -/***/ 95748: +/***/ 48504: /***/ (function(module) { "use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -var token = '%[a-f0-9]{2}'; -var singleMatcher = new RegExp(token, 'gi'); -var multiMatcher = new RegExp('(' + token + ')+', 'gi'); -function decodeComponents(components, split) { - try { - // Try to decode the entire string first - return decodeURIComponent(components.join('')); - } catch (err) { - // Do nothing +module.exports = class DirectoryExistsPlugin { + constructor(source, target) { + this.source = source; + this.target = target; } - if (components.length === 1) { - return components; + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "DirectoryExistsPlugin", + (request, resolveContext, callback) => { + const fs = resolver.fileSystem; + const directory = request.path; + fs.stat(directory, (err, stat) => { + if (err || !stat) { + if (resolveContext.missing) resolveContext.missing.add(directory); + if (resolveContext.log) + resolveContext.log(directory + " doesn't exist"); + return callback(); + } + if (!stat.isDirectory()) { + if (resolveContext.missing) resolveContext.missing.add(directory); + if (resolveContext.log) + resolveContext.log(directory + " is not a directory"); + return callback(); + } + resolver.doResolve( + target, + request, + "existing directory", + resolveContext, + callback + ); + }); + } + ); } +}; - split = split || 1; - // Split the array in 2 parts - var left = components.slice(0, split); - var right = components.slice(split); +/***/ }), - return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); -} +/***/ 68372: +/***/ (function(module) { -function decode(input) { - try { - return decodeURIComponent(input); - } catch (err) { - var tokens = input.match(singleMatcher); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - for (var i = 1; i < tokens.length; i++) { - input = decodeComponents(tokens, i).join(''); - tokens = input.match(singleMatcher); - } +module.exports = class FileExistsPlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } - return input; + apply(resolver) { + const target = resolver.ensureHook(this.target); + const fs = resolver.fileSystem; + resolver + .getHook(this.source) + .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => { + const file = request.path; + fs.stat(file, (err, stat) => { + if (err || !stat) { + if (resolveContext.missing) resolveContext.missing.add(file); + if (resolveContext.log) resolveContext.log(file + " doesn't exist"); + return callback(); + } + if (!stat.isFile()) { + if (resolveContext.missing) resolveContext.missing.add(file); + if (resolveContext.log) resolveContext.log(file + " is not a file"); + return callback(); + } + resolver.doResolve( + target, + request, + "existing file: " + file, + resolveContext, + callback + ); + }); + }); } -} +}; -function customDecodeURIComponent(input) { - // Keep track of all the replacements and prefill the map with the `BOM` - var replaceMap = { - '%FE%FF': '\uFFFD\uFFFD', - '%FF%FE': '\uFFFD\uFFFD' - }; - var match = multiMatcher.exec(input); - while (match) { - try { - // Decode as big chunks as possible - replaceMap[match[0]] = decodeURIComponent(match[0]); - } catch (err) { - var result = decode(match[0]); +/***/ }), - if (result !== match[0]) { - replaceMap[match[0]] = result; - } - } +/***/ 63602: +/***/ (function(module) { - match = multiMatcher.exec(input); - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else - replaceMap['%C2'] = '\uFFFD'; - var entries = Object.keys(replaceMap); - - for (var i = 0; i < entries.length; i++) { - // Replace all decoded components - var key = entries[i]; - input = input.replace(new RegExp(key, 'g'), replaceMap[key]); - } - - return input; -} - -module.exports = function (encodedURI) { - if (typeof encodedURI !== 'string') { - throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); +module.exports = class FileKindPlugin { + constructor(source, target) { + this.source = source; + this.target = target; } - try { - encodedURI = encodedURI.replace(/\+/g, ' '); - - // Try the built in decoder first - return decodeURIComponent(encodedURI); - } catch (err) { - // Fallback to a more advanced decoder - return customDecodeURIComponent(encodedURI); + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("FileKindPlugin", (request, resolveContext, callback) => { + if (request.directory) return callback(); + const obj = Object.assign({}, request); + delete obj.directory; + resolver.doResolve(target, obj, null, resolveContext, callback); + }); } }; /***/ }), -/***/ 5477: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 31693: +/***/ (function(module) { "use strict"; -/*! - * define-property - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - - - -var isDescriptor = __webpack_require__(49924); - -module.exports = function defineProperty(obj, prop, val) { - if (typeof obj !== 'object' && typeof obj !== 'function') { - throw new TypeError('expected an object or function.'); - } +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - 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); - } +module.exports = class JoinRequestPlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } - return Object.defineProperty(obj, prop, { - configurable: true, - enumerable: false, - writable: true, - value: val - }); + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => { + const obj = Object.assign({}, request, { + path: resolver.join(request.path, request.request), + relativePath: + request.relativePath && + resolver.join(request.relativePath, request.request), + request: undefined + }); + resolver.doResolve(target, obj, null, resolveContext, callback); + }); + } }; /***/ }), -/***/ 30138: +/***/ 7064: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/*! - * is-accessor-descriptor - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +const path = __webpack_require__(85622); -var typeOf = __webpack_require__(1057); +module.exports = class MainFieldPlugin { + constructor(source, options, target) { + this.source = source; + this.options = options; + this.target = target; + } -// accessor descriptor properties -var accessor = { - get: 'function', - set: 'function', - configurable: 'boolean', - enumerable: 'boolean' + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => { + if (request.path !== request.descriptionFileRoot) return callback(); + if (request.alreadyTriedMainField === request.descriptionFilePath) + return callback(); + const content = request.descriptionFileData; + const filename = path.basename(request.descriptionFilePath); + let mainModule; + const field = this.options.name; + if (Array.isArray(field)) { + let current = content; + for (let j = 0; j < field.length; j++) { + if (current === null || typeof current !== "object") { + current = null; + break; + } + current = current[field[j]]; + } + if (typeof current === "string") { + mainModule = current; + } + } else { + if (typeof content[field] === "string") { + mainModule = content[field]; + } + } + if (!mainModule) return callback(); + if (this.options.forceRelative && !/^\.\.?\//.test(mainModule)) + mainModule = "./" + mainModule; + const obj = Object.assign({}, request, { + request: mainModule, + alreadyTriedMainField: request.descriptionFilePath + }); + return resolver.doResolve( + target, + obj, + "use " + + mainModule + + " from " + + this.options.name + + " in " + + filename, + resolveContext, + callback + ); + }); + } }; -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; - } +/***/ 23780: +/***/ (function(module) { - if (typeof obj[key] !== 'undefined') { - return false; - } - } - return true; -} +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -function has(obj, key) { - return {}.hasOwnProperty.call(obj, key); -} -/** - * Expose `isAccessorDescriptor` - */ +module.exports = class ModuleAppendPlugin { + constructor(source, appending, target) { + this.source = source; + this.appending = appending; + this.target = target; + } -module.exports = isAccessorDescriptor; + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ModuleAppendPlugin", (request, resolveContext, callback) => { + const i = request.request.indexOf("/"), + j = request.request.indexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? i : j; + let moduleName, remainingRequest; + if (p < 0) { + moduleName = request.request; + remainingRequest = ""; + } else { + moduleName = request.request.substr(0, p); + remainingRequest = request.request.substr(p); + } + if (moduleName === "." || moduleName === "..") return callback(); + const moduleFinalName = moduleName + this.appending; + const obj = Object.assign({}, request, { + request: moduleFinalName + remainingRequest + }); + resolver.doResolve( + target, + obj, + "module variation " + moduleFinalName, + resolveContext, + callback + ); + }); + } +}; /***/ }), -/***/ 1057: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var isBuffer = __webpack_require__(72195); -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); +/***/ 9529: +/***/ (function(module) { - if (type === '[object RegExp]') { - return 'regexp'; - } - if (type === '[object Date]') { - return 'date'; - } - if (type === '[object Arguments]') { - return 'arguments'; - } - if (type === '[object Error]') { - return 'error'; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // 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'; - } +module.exports = class ModuleKindPlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } - // 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'; - } + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ModuleKindPlugin", (request, resolveContext, callback) => { + if (!request.module) return callback(); + const obj = Object.assign({}, request); + delete obj.module; + resolver.doResolve( + target, + obj, + "resolve as module", + resolveContext, + (err, result) => { + if (err) return callback(err); - // must be a plain object - return 'object'; + // Don't allow other alternatives + if (result === undefined) return callback(null, null); + callback(null, result); + } + ); + }); + } }; /***/ }), -/***/ 54963: +/***/ 23195: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/*! - * is-data-descriptor - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +const forEachBail = __webpack_require__(60059); +const getPaths = __webpack_require__(49395); -var typeOf = __webpack_require__(31072); +module.exports = class ModulesInHierachicDirectoriesPlugin { + constructor(source, directories, target) { + this.source = source; + this.directories = [].concat(directories); + this.target = target; + } -// data descriptor properties -var data = { - configurable: 'boolean', - enumerable: 'boolean', - writable: 'boolean' + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync( + "ModulesInHierachicDirectoriesPlugin", + (request, resolveContext, callback) => { + const fs = resolver.fileSystem; + const addrs = getPaths(request.path) + .paths.map(p => { + return this.directories.map(d => resolver.join(p, d)); + }) + .reduce((array, p) => { + array.push.apply(array, p); + return array; + }, []); + forEachBail( + addrs, + (addr, callback) => { + fs.stat(addr, (err, stat) => { + if (!err && stat && stat.isDirectory()) { + const obj = Object.assign({}, request, { + path: addr, + request: "./" + request.request + }); + const message = "looking for modules in " + addr; + return resolver.doResolve( + target, + obj, + message, + resolveContext, + callback + ); + } + if (resolveContext.log) + resolveContext.log( + addr + " doesn't exist or is not a directory" + ); + if (resolveContext.missing) resolveContext.missing.add(addr); + return callback(); + }); + }, + callback + ); + } + ); + } }; -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; - } +/***/ 3092: +/***/ (function(module) { - for (var key in obj) { - if (key === 'value') continue; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (!data.hasOwnProperty(key)) { - continue; - } - if (typeOf(obj[key]) === data[key]) { - continue; - } +module.exports = class ModulesInRootPlugin { + constructor(source, path, target) { + this.source = source; + this.path = path; + this.target = target; + } - if (typeof obj[key] !== 'undefined') { - return false; - } - } - return true; -} + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => { + const obj = Object.assign({}, request, { + path: this.path, + request: "./" + request.request + }); + resolver.doResolve( + target, + obj, + "looking for modules in " + this.path, + resolveContext, + callback + ); + }); + } +}; -/** - * Expose `isDataDescriptor` - */ -module.exports = isDataDescriptor; +/***/ }), +/***/ 50959: +/***/ (function(module) { -/***/ }), +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -/***/ 31072: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -var isBuffer = __webpack_require__(72195); -var toString = Object.prototype.toString; +module.exports = class NextPlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } -/** - * Get the native `typeof` a value. - * - * @param {*} `val` - * @return {*} Native javascript type - */ + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("NextPlugin", (request, resolveContext, callback) => { + resolver.doResolve(target, request, null, resolveContext, callback); + }); + } +}; -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'; - } +/***/ 13445: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // check for instances of RegExp and Date before calling `toString` - if (val instanceof RegExp) { - return 'regexp'; - } - if (val instanceof Date) { - return 'date'; - } +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - // 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'; - } +const fs = __webpack_require__(82161); - // buffer - if (isBuffer(val)) { - return 'buffer'; - } +class NodeJsInputFileSystem { + readdir(path, callback) { + fs.readdir(path, (err, files) => { + callback( + err, + files && + files.map(file => { + return file.normalize ? file.normalize("NFC") : file; + }) + ); + }); + } - // 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'; - } + readdirSync(path) { + const files = fs.readdirSync(path); + return ( + files && + files.map(file => { + return file.normalize ? file.normalize("NFC") : file; + }) + ); + } +} - // 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'; - } +const fsMethods = [ + "stat", + "statSync", + "readFile", + "readFileSync", + "readlink", + "readlinkSync" +]; - // must be a plain object - return 'object'; -}; +for (const key of fsMethods) { + Object.defineProperty(NodeJsInputFileSystem.prototype, key, { + configurable: true, + writable: true, + value: fs[key].bind(fs) + }); +} + +module.exports = NodeJsInputFileSystem; /***/ }), -/***/ 49924: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 9743: +/***/ (function(module) { "use strict"; -/*! - * is-descriptor - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */ - +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -var typeOf = __webpack_require__(42649); -var isAccessor = __webpack_require__(30138); -var isData = __webpack_require__(54963); +module.exports = class ParsePlugin { + constructor(source, target) { + this.source = source; + this.target = target; + } -module.exports = function isDescriptor(obj, key) { - if (typeOf(obj) !== 'object') { - return false; - } - if ('get' in obj) { - return isAccessor(obj, key); - } - return isData(obj, key); + apply(resolver) { + const target = resolver.ensureHook(this.target); + resolver + .getHook(this.source) + .tapAsync("ParsePlugin", (request, resolveContext, callback) => { + const parsed = resolver.parse(request.request); + const obj = Object.assign({}, request, parsed); + if (request.query && !parsed.query) { + obj.query = request.query; + } + if (parsed && resolveContext.log) { + if (parsed.module) resolveContext.log("Parsed request is a module"); + if (parsed.directory) + resolveContext.log("Parsed request is a directory"); + } + resolver.doResolve(target, obj, null, resolveContext, callback); + }); + } }; /***/ }), -/***/ 42649: -/***/ (function(module) { - -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); -} - - -/***/ }), - -/***/ 89901: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 82797: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -24129,803 +24183,777 @@ function isBuffer(val) { */ -const DescriptionFileUtils = __webpack_require__(70232); -const getInnerRequest = __webpack_require__(91878); +const util = __webpack_require__(31669); -module.exports = class AliasFieldPlugin { - constructor(source, field, target) { - this.source = source; - this.field = field; - this.target = target; - } +const Tapable = __webpack_require__(72693); +const SyncHook = __webpack_require__(77633); +const AsyncSeriesBailHook = __webpack_require__(89674); +const AsyncSeriesHook = __webpack_require__(55328); +const createInnerContext = __webpack_require__(6369); - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => { - if (!request.descriptionFileData) return callback(); - const innerRequest = getInnerRequest(resolver, request); - if (!innerRequest) return callback(); - const fieldData = DescriptionFileUtils.getField( - request.descriptionFileData, - this.field - ); - if (typeof fieldData !== "object") { - if (resolveContext.log) - resolveContext.log( - "Field '" + - this.field + - "' doesn't contain a valid alias configuration" - ); - return callback(); - } - const data1 = fieldData[innerRequest]; - const data2 = fieldData[innerRequest.replace(/^\.\//, "")]; - const data = typeof data1 !== "undefined" ? data1 : data2; - if (data === innerRequest) return callback(); - if (data === undefined) return callback(); - if (data === false) { - const ignoreObj = Object.assign({}, request, { - path: false - }); - return callback(null, ignoreObj); - } - const obj = Object.assign({}, request, { - path: request.descriptionFileRoot, - request: data - }); - resolver.doResolve( - target, - obj, - "aliased from description file " + - request.descriptionFilePath + - " with mapping '" + - innerRequest + - "' to '" + - data + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); +const REGEXP_NOT_MODULE = /^\.$|^\.[\\/]|^\.\.$|^\.\.[\\/]|^\/|^[A-Z]:[\\/]/i; +const REGEXP_DIRECTORY = /[\\/]$/i; - // Don't allow other aliasing or raw request - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - }); - } -}; +const memoryFsJoin = __webpack_require__(65775); +const memoizedJoin = new Map(); +const memoryFsNormalize = __webpack_require__(69038); +function withName(name, hook) { + hook.name = name; + return hook; +} -/***/ }), +function toCamelCase(str) { + return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase()); +} -/***/ 15005: -/***/ (function(module) { +const deprecatedPushToMissing = util.deprecate((set, item) => { + set.add(item); +}, "Resolver: 'missing' is now a Set. Use add instead of push."); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +const deprecatedResolveContextInCallback = util.deprecate(x => { + return x; +}, "Resolver: The callback argument was splitted into resolveContext and callback."); +const deprecatedHookAsString = util.deprecate(x => { + return x; +}, "Resolver#doResolve: The type arguments (string) is now a hook argument (Hook). Pass a reference to the hook instead."); -function startsWith(string, searchString) { - const stringLength = string.length; - const searchLength = searchString.length; - - // early out if the search length is greater than the search string - if (searchLength > stringLength) { - return false; - } - let index = -1; - while (++index < searchLength) { - if (string.charCodeAt(index) !== searchString.charCodeAt(index)) { - return false; - } +class Resolver extends Tapable { + constructor(fileSystem) { + super(); + this.fileSystem = fileSystem; + this.hooks = { + resolveStep: withName("resolveStep", new SyncHook(["hook", "request"])), + noResolve: withName("noResolve", new SyncHook(["request", "error"])), + resolve: withName( + "resolve", + new AsyncSeriesBailHook(["request", "resolveContext"]) + ), + result: new AsyncSeriesHook(["result", "resolveContext"]) + }; + this._pluginCompat.tap("Resolver: before/after", options => { + if (/^before-/.test(options.name)) { + options.name = options.name.substr(7); + options.stage = -10; + } else if (/^after-/.test(options.name)) { + options.name = options.name.substr(6); + options.stage = 10; + } + }); + this._pluginCompat.tap("Resolver: step hooks", options => { + const name = options.name; + const stepHook = !/^resolve(-s|S)tep$|^no(-r|R)esolve$/.test(name); + if (stepHook) { + options.async = true; + this.ensureHook(name); + const fn = options.fn; + options.fn = (request, resolverContext, callback) => { + const innerCallback = (err, result) => { + if (err) return callback(err); + if (result !== undefined) return callback(null, result); + callback(); + }; + for (const key in resolverContext) { + innerCallback[key] = resolverContext[key]; + } + fn.call(this, request, innerCallback); + }; + } + }); } - return true; -} -module.exports = class AliasPlugin { - constructor(source, options, target) { - this.source = source; - this.options = Array.isArray(options) ? options : [options]; - this.target = target; + ensureHook(name) { + if (typeof name !== "string") return name; + name = toCamelCase(name); + if (/^before/.test(name)) { + return this.ensureHook( + name[6].toLowerCase() + name.substr(7) + ).withOptions({ + stage: -10 + }); + } + if (/^after/.test(name)) { + return this.ensureHook( + name[5].toLowerCase() + name.substr(6) + ).withOptions({ + stage: 10 + }); + } + const hook = this.hooks[name]; + if (!hook) { + return (this.hooks[name] = withName( + name, + new AsyncSeriesBailHook(["request", "resolveContext"]) + )); + } + return hook; } - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AliasPlugin", (request, resolveContext, callback) => { - const innerRequest = request.request || request.path; - if (!innerRequest) return callback(); - for (const item of this.options) { - if ( - innerRequest === item.name || - (!item.onlyModule && startsWith(innerRequest, item.name + "/")) - ) { - if ( - innerRequest !== item.alias && - !startsWith(innerRequest, item.alias + "/") - ) { - const newRequestStr = - item.alias + innerRequest.substr(item.name.length); - const obj = Object.assign({}, request, { - request: newRequestStr - }); - return resolver.doResolve( - target, - obj, - "aliased with mapping '" + - item.name + - "': '" + - item.alias + - "' to '" + - newRequestStr + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); - - // Don't allow other aliasing or raw request - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - } - } - } - return callback(); + getHook(name) { + if (typeof name !== "string") return name; + name = toCamelCase(name); + if (/^before/.test(name)) { + return this.getHook(name[6].toLowerCase() + name.substr(7)).withOptions({ + stage: -10 + }); + } + if (/^after/.test(name)) { + return this.getHook(name[5].toLowerCase() + name.substr(6)).withOptions({ + stage: 10 }); + } + const hook = this.hooks[name]; + if (!hook) { + throw new Error(`Hook ${name} doesn't exist`); + } + return hook; } -}; - -/***/ }), + resolveSync(context, path, request) { + let err, + result, + sync = false; + this.resolve(context, path, request, {}, (e, r) => { + err = e; + result = r; + sync = true; + }); + if (!sync) + throw new Error( + "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!" + ); + if (err) throw err; + return result; + } -/***/ 2271: -/***/ (function(module) { + resolve(context, path, request, resolveContext, callback) { + // TODO remove in enhanced-resolve 5 + // For backward compatiblity START + if (typeof callback !== "function") { + callback = deprecatedResolveContextInCallback(resolveContext); + // resolveContext is a function containing additional properties + // It's now used for resolveContext and callback + } + // END + const obj = { + context: context, + path: path, + request: request + }; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + const message = "resolve '" + request + "' in '" + path + "'"; + // Try to resolve assuming there is no error + // We don't log stuff in this case + return this.doResolve( + this.hooks.resolve, + obj, + message, + { + missing: resolveContext.missing, + stack: resolveContext.stack + }, + (err, result) => { + if (!err && result) { + return callback( + null, + result.path === false ? false : result.path + (result.query || ""), + result + ); + } -module.exports = class AppendPlugin { - constructor(source, appending, target) { - this.source = source; - this.appending = appending; - this.target = target; - } + const localMissing = new Set(); + // TODO remove in enhanced-resolve 5 + localMissing.push = item => deprecatedPushToMissing(localMissing, item); + const log = []; - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("AppendPlugin", (request, resolveContext, callback) => { - const obj = Object.assign({}, request, { - path: request.path + this.appending, - relativePath: - request.relativePath && request.relativePath + this.appending - }); - resolver.doResolve( - target, + return this.doResolve( + this.hooks.resolve, obj, - this.appending, - resolveContext, - callback + message, + { + log: msg => { + if (resolveContext.log) { + resolveContext.log(msg); + } + log.push(msg); + }, + missing: localMissing, + stack: resolveContext.stack + }, + (err, result) => { + if (err) return callback(err); + + const error = new Error("Can't " + message); + error.details = log.join("\n"); + error.missing = Array.from(localMissing); + this.hooks.noResolve.call(obj, error); + return callback(error); + } ); - }); + } + ); } -}; - -/***/ }), - -/***/ 75544: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -class Storage { - constructor(duration) { - this.duration = duration; - this.running = new Map(); - this.data = new Map(); - this.levels = []; - if (duration > 0) { - this.levels.push( - new Set(), - new Set(), - new Set(), - new Set(), - new Set(), - new Set(), - new Set(), - new Set(), - new Set() - ); - for (let i = 8000; i < duration; i += 500) this.levels.push(new Set()); + doResolve(hook, request, message, resolveContext, callback) { + // TODO remove in enhanced-resolve 5 + // For backward compatiblity START + if (typeof callback !== "function") { + callback = deprecatedResolveContextInCallback(resolveContext); + // resolveContext is a function containing additional properties + // It's now used for resolveContext and callback } - this.count = 0; - this.interval = null; - this.needTickCheck = false; - this.nextTick = null; - this.passive = true; - this.tick = this.tick.bind(this); - } - - ensureTick() { - if (!this.interval && this.duration > 0 && !this.nextTick) - this.interval = setInterval( - this.tick, - Math.floor(this.duration / this.levels.length) + if (typeof hook === "string") { + const name = toCamelCase(hook); + hook = deprecatedHookAsString(this.hooks[name]); + if (!hook) { + throw new Error(`Hook "${name}" doesn't exist`); + } + } + // END + if (typeof callback !== "function") + throw new Error("callback is not a function " + Array.from(arguments)); + if (!resolveContext) + throw new Error( + "resolveContext is not an object " + Array.from(arguments) ); - } - finished(name, err, result) { - const callbacks = this.running.get(name); - this.running.delete(name); - if (this.duration > 0) { - this.data.set(name, [err, result]); - const levelData = this.levels[0]; - this.count -= levelData.size; - levelData.add(name); - this.count += levelData.size; - this.ensureTick(); - } - for (let i = 0; i < callbacks.length; i++) { - callbacks[i](err, result); + const stackLine = + hook.name + + ": (" + + request.path + + ") " + + (request.request || "") + + (request.query || "") + + (request.directory ? " directory" : "") + + (request.module ? " module" : ""); + + let newStack; + if (resolveContext.stack) { + newStack = new Set(resolveContext.stack); + if (resolveContext.stack.has(stackLine)) { + // Prevent recursion + const recursionError = new Error( + "Recursion in resolving\nStack:\n " + + Array.from(newStack).join("\n ") + ); + recursionError.recursion = true; + if (resolveContext.log) + resolveContext.log("abort resolving because of recursion"); + return callback(recursionError); + } + newStack.add(stackLine); + } else { + newStack = new Set([stackLine]); } - } + this.hooks.resolveStep.call(hook, request); - finishedSync(name, err, result) { - if (this.duration > 0) { - this.data.set(name, [err, result]); - const levelData = this.levels[0]; - this.count -= levelData.size; - levelData.add(name); - this.count += levelData.size; - this.ensureTick(); + if (hook.isUsed()) { + const innerContext = createInnerContext( + { + log: resolveContext.log, + missing: resolveContext.missing, + stack: newStack + }, + message + ); + return hook.callAsync(request, innerContext, (err, result) => { + if (err) return callback(err); + if (result) return callback(null, result); + callback(); + }); + } else { + callback(); } } - provide(name, provider, callback) { - if (typeof name !== "string") { - callback(new TypeError("path must be a string")); - return; - } - let running = this.running.get(name); - if (running) { - running.push(callback); - return; + parse(identifier) { + if (identifier === "") return null; + const part = { + request: "", + query: "", + module: false, + directory: false, + file: false + }; + const idxQuery = identifier.indexOf("?"); + if (idxQuery === 0) { + part.query = identifier; + } else if (idxQuery > 0) { + part.request = identifier.slice(0, idxQuery); + part.query = identifier.slice(idxQuery); + } else { + part.request = identifier; } - if (this.duration > 0) { - this.checkTicks(); - const data = this.data.get(name); - if (data) { - return process.nextTick(() => { - callback.apply(null, data); - }); + if (part.request) { + part.module = this.isModule(part.request); + part.directory = this.isDirectory(part.request); + if (part.directory) { + part.request = part.request.substr(0, part.request.length - 1); } } - this.running.set(name, (running = [callback])); - provider(name, (err, result) => { - this.finished(name, err, result); - }); + return part; } - provideSync(name, provider) { - if (typeof name !== "string") { - throw new TypeError("path must be a string"); - } - if (this.duration > 0) { - this.checkTicks(); - const data = this.data.get(name); - if (data) { - if (data[0]) throw data[0]; - return data[1]; - } - } - let result; - try { - result = provider(name); - } catch (e) { - this.finishedSync(name, e); - throw e; - } - this.finishedSync(name, null, result); - return result; + isModule(path) { + return !REGEXP_NOT_MODULE.test(path); } - tick() { - const decay = this.levels.pop(); - for (let item of decay) { - this.data.delete(item); - } - this.count -= decay.size; - decay.clear(); - this.levels.unshift(decay); - if (this.count === 0) { - clearInterval(this.interval); - this.interval = null; - this.nextTick = null; - return true; - } else if (this.nextTick) { - this.nextTick += Math.floor(this.duration / this.levels.length); - const time = new Date().getTime(); - if (this.nextTick > time) { - this.nextTick = null; - this.interval = setInterval( - this.tick, - Math.floor(this.duration / this.levels.length) - ); - return true; - } - } else if (this.passive) { - clearInterval(this.interval); - this.interval = null; - this.nextTick = - new Date().getTime() + Math.floor(this.duration / this.levels.length); + isDirectory(path) { + return REGEXP_DIRECTORY.test(path); + } + + join(path, request) { + let cacheEntry; + let pathCache = memoizedJoin.get(path); + if (typeof pathCache === "undefined") { + memoizedJoin.set(path, (pathCache = new Map())); } else { - this.passive = true; + cacheEntry = pathCache.get(request); + if (typeof cacheEntry !== "undefined") return cacheEntry; } + cacheEntry = memoryFsJoin(path, request); + pathCache.set(request, cacheEntry); + return cacheEntry; } - checkTicks() { - this.passive = false; - if (this.nextTick) { - while (!this.tick()); - } + normalize(path) { + return memoryFsNormalize(path); } +} - purge(what) { - if (!what) { - this.count = 0; - clearInterval(this.interval); - this.nextTick = null; - this.data.clear(); - this.levels.forEach(level => { - level.clear(); - }); - } else if (typeof what === "string") { - for (let key of this.data.keys()) { - if (key.startsWith(what)) this.data.delete(key); - } - } else { - for (let i = what.length - 1; i >= 0; i--) { - this.purge(what[i]); - } - } - } -} +module.exports = Resolver; -module.exports = class CachedInputFileSystem { - constructor(fileSystem, duration) { - this.fileSystem = fileSystem; - this._statStorage = new Storage(duration); - this._readdirStorage = new Storage(duration); - this._readFileStorage = new Storage(duration); - this._readJsonStorage = new Storage(duration); - this._readlinkStorage = new Storage(duration); - this._stat = this.fileSystem.stat - ? this.fileSystem.stat.bind(this.fileSystem) - : null; - if (!this._stat) this.stat = null; +/***/ }), - this._statSync = this.fileSystem.statSync - ? this.fileSystem.statSync.bind(this.fileSystem) - : null; - if (!this._statSync) this.statSync = null; +/***/ 34129: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - this._readdir = this.fileSystem.readdir - ? this.fileSystem.readdir.bind(this.fileSystem) - : null; - if (!this._readdir) this.readdir = null; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - this._readdirSync = this.fileSystem.readdirSync - ? this.fileSystem.readdirSync.bind(this.fileSystem) - : null; - if (!this._readdirSync) this.readdirSync = null; - this._readFile = this.fileSystem.readFile - ? this.fileSystem.readFile.bind(this.fileSystem) - : null; - if (!this._readFile) this.readFile = null; +const Resolver = __webpack_require__(82797); - this._readFileSync = this.fileSystem.readFileSync - ? this.fileSystem.readFileSync.bind(this.fileSystem) - : null; - if (!this._readFileSync) this.readFileSync = null; +const SyncAsyncFileSystemDecorator = __webpack_require__(83230); - if (this.fileSystem.readJson) { - this._readJson = this.fileSystem.readJson.bind(this.fileSystem); - } else if (this.readFile) { - this._readJson = (path, callback) => { - this.readFile(path, (err, buffer) => { - if (err) return callback(err); - let data; - try { - data = JSON.parse(buffer.toString("utf-8")); - } catch (e) { - return callback(e); - } - callback(null, data); - }); - }; - } else { - this.readJson = null; - } - if (this.fileSystem.readJsonSync) { - this._readJsonSync = this.fileSystem.readJsonSync.bind(this.fileSystem); - } else if (this.readFileSync) { - this._readJsonSync = path => { - const buffer = this.readFileSync(path); - const data = JSON.parse(buffer.toString("utf-8")); - return data; - }; - } else { - this.readJsonSync = null; - } +const ParsePlugin = __webpack_require__(9743); +const DescriptionFilePlugin = __webpack_require__(95637); +const NextPlugin = __webpack_require__(50959); +const TryNextPlugin = __webpack_require__(31702); +const ModuleKindPlugin = __webpack_require__(9529); +const FileKindPlugin = __webpack_require__(63602); +const JoinRequestPlugin = __webpack_require__(31693); +const ModulesInHierachicDirectoriesPlugin = __webpack_require__(23195); +const ModulesInRootPlugin = __webpack_require__(3092); +const AliasPlugin = __webpack_require__(15005); +const AliasFieldPlugin = __webpack_require__(89901); +const ConcordExtensionsPlugin = __webpack_require__(56821); +const ConcordMainPlugin = __webpack_require__(27878); +const ConcordModulesPlugin = __webpack_require__(50297); +const DirectoryExistsPlugin = __webpack_require__(48504); +const FileExistsPlugin = __webpack_require__(68372); +const SymlinkPlugin = __webpack_require__(51104); +const MainFieldPlugin = __webpack_require__(7064); +const UseFilePlugin = __webpack_require__(41232); +const AppendPlugin = __webpack_require__(2271); +const RootPlugin = __webpack_require__(32669); +const RestrictionsPlugin = __webpack_require__(49751); +const ResultPlugin = __webpack_require__(19258); +const ModuleAppendPlugin = __webpack_require__(23780); +const UnsafeCachePlugin = __webpack_require__(81809); - this._readlink = this.fileSystem.readlink - ? this.fileSystem.readlink.bind(this.fileSystem) - : null; - if (!this._readlink) this.readlink = null; +exports.createResolver = function(options) { + //// OPTIONS //// - this._readlinkSync = this.fileSystem.readlinkSync - ? this.fileSystem.readlinkSync.bind(this.fileSystem) - : null; - if (!this._readlinkSync) this.readlinkSync = null; - } + // A list of directories to resolve modules from, can be absolute path or folder name + let modules = options.modules || ["node_modules"]; - stat(path, callback) { - this._statStorage.provide(path, this._stat, callback); - } + // A list of description files to read from + const descriptionFiles = options.descriptionFiles || ["package.json"]; - readdir(path, callback) { - this._readdirStorage.provide(path, this._readdir, callback); - } + // A list of additional resolve plugins which should be applied + // The slice is there to create a copy, because otherwise pushing into plugins + // changes the original options.plugins array, causing duplicate plugins + const plugins = (options.plugins && options.plugins.slice()) || []; - readFile(path, callback) { - this._readFileStorage.provide(path, this._readFile, callback); - } + // A list of main fields in description files + let mainFields = options.mainFields || ["main"]; - readJson(path, callback) { - this._readJsonStorage.provide(path, this._readJson, callback); - } + // A list of alias fields in description files + const aliasFields = options.aliasFields || []; - readlink(path, callback) { - this._readlinkStorage.provide(path, this._readlink, callback); - } + // A list of main files in directories + const mainFiles = options.mainFiles || ["index"]; - statSync(path) { - return this._statStorage.provideSync(path, this._statSync); - } + // A list of extensions which should be tried for files + let extensions = options.extensions || [".js", ".json", ".node"]; - readdirSync(path) { - return this._readdirStorage.provideSync(path, this._readdirSync); - } + // Enforce that a extension from extensions must be used + const enforceExtension = options.enforceExtension || false; - readFileSync(path) { - return this._readFileStorage.provideSync(path, this._readFileSync); - } + // A list of module extensions which should be tried for modules + let moduleExtensions = options.moduleExtensions || []; - readJsonSync(path) { - return this._readJsonStorage.provideSync(path, this._readJsonSync); - } + // Enforce that a extension from moduleExtensions must be used + const enforceModuleExtension = options.enforceModuleExtension || false; - readlinkSync(path) { - return this._readlinkStorage.provideSync(path, this._readlinkSync); - } + // A list of module alias configurations or an object which maps key to value + let alias = options.alias || []; - purge(what) { - this._statStorage.purge(what); - this._readdirStorage.purge(what); - this._readFileStorage.purge(what); - this._readlinkStorage.purge(what); - this._readJsonStorage.purge(what); - } -}; + // Resolve symlinks to their symlinked location + const symlinks = + typeof options.symlinks !== "undefined" ? options.symlinks : true; + // Resolve to a context instead of a file + const resolveToContext = options.resolveToContext || false; -/***/ }), + // A list of root paths + const roots = options.roots || []; -/***/ 56821: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + const restrictions = options.restrictions || []; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // Use this cache object to unsafely cache the successful requests + let unsafeCache = options.unsafeCache || false; + // Whether or not the unsafeCache should include request context as part of the cache key. + const cacheWithContext = + typeof options.cacheWithContext !== "undefined" + ? options.cacheWithContext + : true; -const concord = __webpack_require__(94323); -const DescriptionFileUtils = __webpack_require__(70232); -const forEachBail = __webpack_require__(60059); + // Enable concord description file instructions + const enableConcord = options.concord || false; -module.exports = class ConcordExtensionsPlugin { - constructor(source, options, target) { - this.source = source; - this.options = options; - this.target = target; + // A function which decides whether a request should be cached or not. + // an object is passed with `path` and `request` properties. + const cachePredicate = + options.cachePredicate || + function() { + return true; + }; + + // The file system which should be used + const fileSystem = options.fileSystem; + + // Use only the sync constiants of the file system calls + const useSyncFileSystemCalls = options.useSyncFileSystemCalls; + + // A prepared Resolver to which the plugins are attached + let resolver = options.resolver; + + //// options processing //// + + if (!resolver) { + resolver = new Resolver( + useSyncFileSystemCalls + ? new SyncAsyncFileSystemDecorator(fileSystem) + : fileSystem + ); } - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "ConcordExtensionsPlugin", - (request, resolveContext, callback) => { - const concordField = DescriptionFileUtils.getField( - request.descriptionFileData, - "concord" - ); - if (!concordField) return callback(); - const extensions = concord.getExtensions( - request.context, - concordField - ); - if (!extensions) return callback(); - forEachBail( - extensions, - (appending, callback) => { - const obj = Object.assign({}, request, { - path: request.path + appending, - relativePath: - request.relativePath && request.relativePath + appending - }); - resolver.doResolve( - target, - obj, - "concord extension: " + appending, - resolveContext, - callback - ); - }, - (err, result) => { - if (err) return callback(err); + extensions = [].concat(extensions); + moduleExtensions = [].concat(moduleExtensions); - // Don't allow other processing - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - } + modules = mergeFilteredToArray([].concat(modules), item => { + return !isAbsolutePath(item); + }); + + mainFields = mainFields.map(item => { + if (typeof item === "string" || Array.isArray(item)) { + item = { + name: item, + forceRelative: true + }; + } + return item; + }); + + if (typeof alias === "object" && !Array.isArray(alias)) { + alias = Object.keys(alias).map(key => { + let onlyModule = false; + let obj = alias[key]; + if (/\$$/.test(key)) { + onlyModule = true; + key = key.substr(0, key.length - 1); + } + if (typeof obj === "string") { + obj = { + alias: obj + }; + } + obj = Object.assign( + { + name: key, + onlyModule: onlyModule + }, + obj ); + return obj; + }); } -}; - -/***/ }), + if (unsafeCache && typeof unsafeCache !== "object") { + unsafeCache = {}; + } -/***/ 27878: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + //// pipeline //// -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + resolver.ensureHook("resolve"); + resolver.ensureHook("parsedResolve"); + resolver.ensureHook("describedResolve"); + resolver.ensureHook("rawModule"); + resolver.ensureHook("module"); + resolver.ensureHook("relative"); + resolver.ensureHook("describedRelative"); + resolver.ensureHook("directory"); + resolver.ensureHook("existingDirectory"); + resolver.ensureHook("undescribedRawFile"); + resolver.ensureHook("rawFile"); + resolver.ensureHook("file"); + resolver.ensureHook("existingFile"); + resolver.ensureHook("resolved"); + // resolve + if (unsafeCache) { + plugins.push( + new UnsafeCachePlugin( + "resolve", + cachePredicate, + unsafeCache, + cacheWithContext, + "new-resolve" + ) + ); + plugins.push(new ParsePlugin("new-resolve", "parsed-resolve")); + } else { + plugins.push(new ParsePlugin("resolve", "parsed-resolve")); + } -const path = __webpack_require__(85622); -const concord = __webpack_require__(94323); -const DescriptionFileUtils = __webpack_require__(70232); + // parsed-resolve + plugins.push( + new DescriptionFilePlugin( + "parsed-resolve", + descriptionFiles, + "described-resolve" + ) + ); + plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve")); -module.exports = class ConcordMainPlugin { - constructor(source, options, target) { - this.source = source; - this.options = options; - this.target = target; + // described-resolve + if (alias.length > 0) + plugins.push(new AliasPlugin("described-resolve", alias, "resolve")); + if (enableConcord) { + plugins.push(new ConcordModulesPlugin("described-resolve", {}, "resolve")); } + aliasFields.forEach(item => { + plugins.push(new AliasFieldPlugin("described-resolve", item, "resolve")); + }); + plugins.push(new ModuleKindPlugin("after-described-resolve", "raw-module")); + roots.forEach(root => { + plugins.push(new RootPlugin("after-described-resolve", root, "relative")); + }); + plugins.push(new JoinRequestPlugin("after-described-resolve", "relative")); - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ConcordMainPlugin", (request, resolveContext, callback) => { - if (request.path !== request.descriptionFileRoot) return callback(); - const concordField = DescriptionFileUtils.getField( - request.descriptionFileData, - "concord" - ); - if (!concordField) return callback(); - const mainModule = concord.getMain(request.context, concordField); - if (!mainModule) return callback(); - const obj = Object.assign({}, request, { - request: mainModule - }); - const filename = path.basename(request.descriptionFilePath); - return resolver.doResolve( - target, - obj, - "use " + mainModule + " from " + filename, - resolveContext, - callback - ); - }); - } -}; + // raw-module + moduleExtensions.forEach(item => { + plugins.push(new ModuleAppendPlugin("raw-module", item, "module")); + }); + if (!enforceModuleExtension) + plugins.push(new TryNextPlugin("raw-module", null, "module")); + // module + modules.forEach(item => { + if (Array.isArray(item)) + plugins.push( + new ModulesInHierachicDirectoriesPlugin("module", item, "resolve") + ); + else plugins.push(new ModulesInRootPlugin("module", item, "resolve")); + }); -/***/ }), + // relative + plugins.push( + new DescriptionFilePlugin( + "relative", + descriptionFiles, + "described-relative" + ) + ); + plugins.push(new NextPlugin("after-relative", "described-relative")); -/***/ 50297: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // described-relative + plugins.push(new FileKindPlugin("described-relative", "raw-file")); + plugins.push( + new TryNextPlugin("described-relative", "as directory", "directory") + ); -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + // directory + plugins.push(new DirectoryExistsPlugin("directory", "existing-directory")); + if (resolveToContext) { + // existing-directory + plugins.push(new NextPlugin("existing-directory", "resolved")); + } else { + // existing-directory + if (enableConcord) { + plugins.push(new ConcordMainPlugin("existing-directory", {}, "resolve")); + } + mainFields.forEach(item => { + plugins.push(new MainFieldPlugin("existing-directory", item, "resolve")); + }); + mainFiles.forEach(item => { + plugins.push( + new UseFilePlugin("existing-directory", item, "undescribed-raw-file") + ); + }); -const concord = __webpack_require__(94323); -const DescriptionFileUtils = __webpack_require__(70232); -const getInnerRequest = __webpack_require__(91878); + // undescribed-raw-file + plugins.push( + new DescriptionFilePlugin( + "undescribed-raw-file", + descriptionFiles, + "raw-file" + ) + ); + plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file")); -module.exports = class ConcordModulesPlugin { - constructor(source, options, target) { - this.source = source; - this.options = options; - this.target = target; - } + // raw-file + if (!enforceExtension) { + plugins.push(new TryNextPlugin("raw-file", "no extension", "file")); + } + if (enableConcord) { + plugins.push(new ConcordExtensionsPlugin("raw-file", {}, "file")); + } + extensions.forEach(item => { + plugins.push(new AppendPlugin("raw-file", item, "file")); + }); - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ConcordModulesPlugin", (request, resolveContext, callback) => { - const innerRequest = getInnerRequest(resolver, request); - if (!innerRequest) return callback(); - const concordField = DescriptionFileUtils.getField( - request.descriptionFileData, - "concord" - ); - if (!concordField) return callback(); - const data = concord.matchModule( - request.context, - concordField, - innerRequest - ); - if (data === innerRequest) return callback(); - if (data === undefined) return callback(); - if (data === false) { - const ignoreObj = Object.assign({}, request, { - path: false - }); - return callback(null, ignoreObj); - } - const obj = Object.assign({}, request, { - path: request.descriptionFileRoot, - request: data - }); - resolver.doResolve( - target, - obj, - "aliased from description file " + - request.descriptionFilePath + - " with mapping '" + - innerRequest + - "' to '" + - data + - "'", - resolveContext, - (err, result) => { - if (err) return callback(err); + // file + if (alias.length > 0) + plugins.push(new AliasPlugin("file", alias, "resolve")); + if (enableConcord) { + plugins.push(new ConcordModulesPlugin("file", {}, "resolve")); + } + aliasFields.forEach(item => { + plugins.push(new AliasFieldPlugin("file", item, "resolve")); + }); + if (symlinks) plugins.push(new SymlinkPlugin("file", "relative")); + plugins.push(new FileExistsPlugin("file", "existing-file")); - // Don't allow other aliasing or raw request - if (result === undefined) return callback(null, null); - callback(null, result); - } - ); - }); + // existing-file + plugins.push(new NextPlugin("existing-file", "resolved")); + } + + // resolved + if (restrictions.length > 0) { + plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions)); } + plugins.push(new ResultPlugin(resolver.hooks.resolved)); + + //// RESOLVER //// + + plugins.forEach(plugin => { + plugin.apply(resolver); + }); + + return resolver; }; +function mergeFilteredToArray(array, filter) { + return array.reduce((array, item) => { + if (filter(item)) { + const lastElement = array[array.length - 1]; + if (Array.isArray(lastElement)) { + lastElement.push(item); + } else { + array.push([item]); + } + return array; + } else { + array.push(item); + return array; + } + }, []); +} + +function isAbsolutePath(path) { + return /^[A-Z]:|^\//.test(path); +} + /***/ }), -/***/ 95637: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 49751: +/***/ (function(module) { "use strict"; /* -MIT License http://www.opensource.org/licenses/mit-license.php -Author Tobias Koppers @sokra + MIT License http://www.opensource.org/licenses/mit-license.php + Author Ivan Kopeykin @vankop */ -const DescriptionFileUtils = __webpack_require__(70232); -module.exports = class DescriptionFilePlugin { - constructor(source, filenames, target) { +const slashCode = "/".charCodeAt(0); +const backslashCode = "\\".charCodeAt(0); + +const isInside = (path, parent) => { + if (!path.startsWith(parent)) return false; + if (path.length === parent.length) return true; + const charCode = path.charCodeAt(parent.length); + return charCode === slashCode || charCode === backslashCode; +}; + +module.exports = class RestrictionsPlugin { + constructor(source, restrictions) { this.source = source; - this.filenames = [].concat(filenames); - this.target = target; + this.restrictions = restrictions; } apply(resolver) { - const target = resolver.ensureHook(this.target); resolver .getHook(this.source) - .tapAsync( - "DescriptionFilePlugin", - (request, resolveContext, callback) => { - const directory = request.path; - DescriptionFileUtils.loadDescriptionFile( - resolver, - directory, - this.filenames, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (!result) { - if (resolveContext.missing) { - this.filenames.forEach(filename => { - resolveContext.missing.add( - resolver.join(directory, filename) - ); - }); - } - if (resolveContext.log) - resolveContext.log("No description file found"); - return callback(); - } - const relativePath = - "." + - request.path - .substr(result.directory.length) - .replace(/\\/g, "/"); - const obj = Object.assign({}, request, { - descriptionFilePath: result.path, - descriptionFileData: result.content, - descriptionFileRoot: result.directory, - relativePath: relativePath - }); - resolver.doResolve( - target, - obj, - "using description file: " + - result.path + - " (relative path: " + - relativePath + - ")", - resolveContext, - (err, result) => { - if (err) return callback(err); + .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => { + if (typeof request.path === "string") { + const path = request.path; - // Don't allow other processing - if (result === undefined) return callback(null, null); - callback(null, result); + for (let i = 0; i < this.restrictions.length; i++) { + const rule = this.restrictions[i]; + if (typeof rule === "string") { + if (!isInside(path, rule)) { + if (resolveContext.log) { + resolveContext.log( + `${path} is not inside of the restriction ${rule}` + ); } - ); + return callback(null, null); + } + } else if (!rule.test(path)) { + if (resolveContext.log) { + resolveContext.log( + `${path} doesn't match the restriction ${rule}` + ); + } + return callback(null, null); } - ); + } } - ); + + callback(); + }); } }; /***/ }), -/***/ 70232: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 19258: +/***/ (function(module) { "use strict"; /* @@ -24934,218 +24962,93 @@ module.exports = class DescriptionFilePlugin { */ -const forEachBail = __webpack_require__(60059); +module.exports = class ResultPlugin { + constructor(source) { + this.source = source; + } -function loadDescriptionFile( - resolver, - directory, - filenames, - resolveContext, - callback -) { - (function findDescriptionFile() { - forEachBail( - filenames, - (filename, callback) => { - const descriptionFilePath = resolver.join(directory, filename); - if (resolver.fileSystem.readJson) { - resolver.fileSystem.readJson(descriptionFilePath, (err, content) => { - if (err) { - if (typeof err.code !== "undefined") return callback(); - return onJson(err); - } - onJson(null, content); - }); - } else { - resolver.fileSystem.readFile(descriptionFilePath, (err, content) => { - if (err) return callback(); - let json; - try { - json = JSON.parse(content); - } catch (e) { - onJson(e); - } - onJson(null, json); - }); - } - - function onJson(err, content) { - if (err) { - if (resolveContext.log) - resolveContext.log( - descriptionFilePath + " (directory description file): " + err - ); - else - err.message = - descriptionFilePath + " (directory description file): " + err; - return callback(err); - } - callback(null, { - content: content, - directory: directory, - path: descriptionFilePath - }); - } - }, - (err, result) => { - if (err) return callback(err); - if (result) { - return callback(null, result); - } else { - directory = cdUp(directory); - if (!directory) { - return callback(); - } else { - return findDescriptionFile(); - } - } - } - ); - })(); -} - -function getField(content, field) { - if (!content) return undefined; - if (Array.isArray(field)) { - let current = content; - for (let j = 0; j < field.length; j++) { - if (current === null || typeof current !== "object") { - current = null; - break; - } - current = current[field[j]]; - } - if (typeof current === "object") { - return current; - } - } else { - if (typeof content[field] === "object") { - return content[field]; - } - } -} - -function cdUp(directory) { - if (directory === "/") return null; - const i = directory.lastIndexOf("/"), - j = directory.lastIndexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; - if (p < 0) return null; - return directory.substr(0, p || 1); -} - -exports.loadDescriptionFile = loadDescriptionFile; -exports.getField = getField; -exports.cdUp = cdUp; + apply(resolver) { + this.source.tapAsync( + "ResultPlugin", + (request, resolverContext, callback) => { + const obj = Object.assign({}, request); + if (resolverContext.log) + resolverContext.log("reporting result " + obj.path); + resolver.hooks.result.callAsync(obj, resolverContext, err => { + if (err) return callback(err); + callback(null, obj); + }); + } + ); + } +}; /***/ }), -/***/ 48504: +/***/ 32669: /***/ (function(module) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra + Author Ivan Kopeykin @vankop */ -module.exports = class DirectoryExistsPlugin { - constructor(source, target) { - this.source = source; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "DirectoryExistsPlugin", - (request, resolveContext, callback) => { - const fs = resolver.fileSystem; - const directory = request.path; - fs.stat(directory, (err, stat) => { - if (err || !stat) { - if (resolveContext.missing) resolveContext.missing.add(directory); - if (resolveContext.log) - resolveContext.log(directory + " doesn't exist"); - return callback(); - } - if (!stat.isDirectory()) { - if (resolveContext.missing) resolveContext.missing.add(directory); - if (resolveContext.log) - resolveContext.log(directory + " is not a directory"); - return callback(); - } - resolver.doResolve( - target, - request, - "existing directory", - resolveContext, - callback - ); - }); - } - ); - } -}; - - -/***/ }), - -/***/ 68372: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/** @typedef {import("./Resolver")} Resolver */ +/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ -module.exports = class FileExistsPlugin { - constructor(source, target) { +class RootPlugin { + /** + * @param {string | ResolveStepHook} source source hook + * @param {Array} root roots + * @param {string | ResolveStepHook} target target hook + */ + constructor(source, root, target) { + this.root = root; this.source = source; this.target = target; } + /** + * @param {Resolver} resolver the resolver + * @returns {void} + */ apply(resolver) { const target = resolver.ensureHook(this.target); - const fs = resolver.fileSystem; + resolver .getHook(this.source) - .tapAsync("FileExistsPlugin", (request, resolveContext, callback) => { - const file = request.path; - fs.stat(file, (err, stat) => { - if (err || !stat) { - if (resolveContext.missing) resolveContext.missing.add(file); - if (resolveContext.log) resolveContext.log(file + " doesn't exist"); - return callback(); - } - if (!stat.isFile()) { - if (resolveContext.missing) resolveContext.missing.add(file); - if (resolveContext.log) resolveContext.log(file + " is not a file"); - return callback(); - } - resolver.doResolve( - target, - request, - "existing file: " + file, - resolveContext, - callback - ); + .tapAsync("RootPlugin", (request, resolveContext, callback) => { + const req = request.request; + if (!req) return callback(); + if (!req.startsWith("/")) return callback(); + + const path = resolver.join(this.root, req.slice(1)); + const obj = Object.assign(request, { + path, + relativePath: request.relativePath && path }); + resolver.doResolve( + target, + obj, + `root path ${this.root}`, + resolveContext, + callback + ); }); } -}; +} + +module.exports = RootPlugin; /***/ }), -/***/ 63602: -/***/ (function(module) { +/***/ 51104: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -25154,7 +25057,10 @@ module.exports = class FileExistsPlugin { */ -module.exports = class FileKindPlugin { +const getPaths = __webpack_require__(49395); +const forEachBail = __webpack_require__(60059); + +module.exports = class SymlinkPlugin { constructor(source, target) { this.source = source; this.target = target; @@ -25162,13 +25068,50 @@ module.exports = class FileKindPlugin { apply(resolver) { const target = resolver.ensureHook(this.target); + const fs = resolver.fileSystem; resolver .getHook(this.source) - .tapAsync("FileKindPlugin", (request, resolveContext, callback) => { - if (request.directory) return callback(); - const obj = Object.assign({}, request); - delete obj.directory; - resolver.doResolve(target, obj, null, resolveContext, callback); + .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => { + const pathsResult = getPaths(request.path); + const pathSeqments = pathsResult.seqments; + const paths = pathsResult.paths; + + let containsSymlink = false; + forEachBail.withIndex( + paths, + (path, idx, callback) => { + fs.readlink(path, (err, result) => { + if (!err && result) { + pathSeqments[idx] = result; + containsSymlink = true; + // Shortcut when absolute symlink found + if (/^(\/|[a-zA-Z]:($|\\))/.test(result)) + return callback(null, idx); + } + callback(); + }); + }, + (err, idx) => { + if (!containsSymlink) return callback(); + const resultSeqments = + typeof idx === "number" + ? pathSeqments.slice(0, idx + 1) + : pathSeqments.slice(); + const result = resultSeqments.reverse().reduce((a, b) => { + return resolver.join(a, b); + }); + const obj = Object.assign({}, request, { + path: result + }); + resolver.doResolve( + target, + obj, + "resolved symlink to " + result, + resolveContext, + callback + ); + } + ); }); } }; @@ -25176,7 +25119,7 @@ module.exports = class FileKindPlugin { /***/ }), -/***/ 31693: +/***/ 83230: /***/ (function(module) { "use strict"; @@ -25186,34 +25129,71 @@ module.exports = class FileKindPlugin { */ -module.exports = class JoinRequestPlugin { - constructor(source, target) { - this.source = source; - this.target = target; +function SyncAsyncFileSystemDecorator(fs) { + this.fs = fs; + if (fs.statSync) { + this.stat = function(arg, callback) { + let result; + try { + result = fs.statSync(arg); + } catch (e) { + return callback(e); + } + callback(null, result); + }; } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => { - const obj = Object.assign({}, request, { - path: resolver.join(request.path, request.request), - relativePath: - request.relativePath && - resolver.join(request.relativePath, request.request), - request: undefined - }); - resolver.doResolve(target, obj, null, resolveContext, callback); - }); + if (fs.readdirSync) { + this.readdir = function(arg, callback) { + let result; + try { + result = fs.readdirSync(arg); + } catch (e) { + return callback(e); + } + callback(null, result); + }; } -}; + if (fs.readFileSync) { + this.readFile = function(arg, callback) { + let result; + try { + result = fs.readFileSync(arg); + } catch (e) { + return callback(e); + } + callback(null, result); + }; + } + if (fs.readlinkSync) { + this.readlink = function(arg, callback) { + let result; + try { + result = fs.readlinkSync(arg); + } catch (e) { + return callback(e); + } + callback(null, result); + }; + } + if (fs.readJsonSync) { + this.readJson = function(arg, callback) { + let result; + try { + result = fs.readJsonSync(arg); + } catch (e) { + return callback(e); + } + callback(null, result); + }; + } +} +module.exports = SyncAsyncFileSystemDecorator; /***/ }), -/***/ 7064: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 31702: +/***/ (function(module) { "use strict"; /* @@ -25222,12 +25202,10 @@ module.exports = class JoinRequestPlugin { */ -const path = __webpack_require__(85622); - -module.exports = class MainFieldPlugin { - constructor(source, options, target) { +module.exports = class TryNextPlugin { + constructor(source, message, target) { this.source = source; - this.options = options; + this.message = message; this.target = target; } @@ -25235,47 +25213,11 @@ module.exports = class MainFieldPlugin { const target = resolver.ensureHook(this.target); resolver .getHook(this.source) - .tapAsync("MainFieldPlugin", (request, resolveContext, callback) => { - if (request.path !== request.descriptionFileRoot) return callback(); - if (request.alreadyTriedMainField === request.descriptionFilePath) - return callback(); - const content = request.descriptionFileData; - const filename = path.basename(request.descriptionFilePath); - let mainModule; - const field = this.options.name; - if (Array.isArray(field)) { - let current = content; - for (let j = 0; j < field.length; j++) { - if (current === null || typeof current !== "object") { - current = null; - break; - } - current = current[field[j]]; - } - if (typeof current === "string") { - mainModule = current; - } - } else { - if (typeof content[field] === "string") { - mainModule = content[field]; - } - } - if (!mainModule) return callback(); - if (this.options.forceRelative && !/^\.\.?\//.test(mainModule)) - mainModule = "./" + mainModule; - const obj = Object.assign({}, request, { - request: mainModule, - alreadyTriedMainField: request.descriptionFilePath - }); - return resolver.doResolve( + .tapAsync("TryNextPlugin", (request, resolveContext, callback) => { + resolver.doResolve( target, - obj, - "use " + - mainModule + - " from " + - this.options.name + - " in " + - filename, + request, + this.message, resolveContext, callback ); @@ -25286,7 +25228,7 @@ module.exports = class MainFieldPlugin { /***/ }), -/***/ 23780: +/***/ 81809: /***/ (function(module) { "use strict"; @@ -25296,10 +25238,21 @@ module.exports = class MainFieldPlugin { */ -module.exports = class ModuleAppendPlugin { - constructor(source, appending, target) { +function getCacheId(request, withContext) { + return JSON.stringify({ + context: withContext ? request.context : "", + path: request.path, + query: request.query, + request: request.request + }); +} + +module.exports = class UnsafeCachePlugin { + constructor(source, filterPredicate, cache, withContext, target) { this.source = source; - this.appending = appending; + this.filterPredicate = filterPredicate; + this.withContext = withContext; + this.cache = cache || {}; this.target = target; } @@ -25307,29 +25260,23 @@ module.exports = class ModuleAppendPlugin { const target = resolver.ensureHook(this.target); resolver .getHook(this.source) - .tapAsync("ModuleAppendPlugin", (request, resolveContext, callback) => { - const i = request.request.indexOf("/"), - j = request.request.indexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? i : j; - let moduleName, remainingRequest; - if (p < 0) { - moduleName = request.request; - remainingRequest = ""; - } else { - moduleName = request.request.substr(0, p); - remainingRequest = request.request.substr(p); + .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => { + if (!this.filterPredicate(request)) return callback(); + const cacheId = getCacheId(request, this.withContext); + const cacheEntry = this.cache[cacheId]; + if (cacheEntry) { + return callback(null, cacheEntry); } - if (moduleName === "." || moduleName === "..") return callback(); - const moduleFinalName = moduleName + this.appending; - const obj = Object.assign({}, request, { - request: moduleFinalName + remainingRequest - }); resolver.doResolve( target, - obj, - "module variation " + moduleFinalName, + request, + null, resolveContext, - callback + (err, result) => { + if (err) return callback(err); + if (result) return callback(null, (this.cache[cacheId] = result)); + callback(); + } ); }); } @@ -25338,7 +25285,7 @@ module.exports = class ModuleAppendPlugin { /***/ }), -/***/ 9529: +/***/ 41232: /***/ (function(module) { "use strict"; @@ -25348,9 +25295,10 @@ module.exports = class ModuleAppendPlugin { */ -module.exports = class ModuleKindPlugin { - constructor(source, target) { +module.exports = class UseFilePlugin { + constructor(source, filename, target) { this.source = source; + this.filename = filename; this.target = target; } @@ -25358,22 +25306,20 @@ module.exports = class ModuleKindPlugin { const target = resolver.ensureHook(this.target); resolver .getHook(this.source) - .tapAsync("ModuleKindPlugin", (request, resolveContext, callback) => { - if (!request.module) return callback(); - const obj = Object.assign({}, request); - delete obj.module; + .tapAsync("UseFilePlugin", (request, resolveContext, callback) => { + const filePath = resolver.join(request.path, this.filename); + const obj = Object.assign({}, request, { + path: filePath, + relativePath: + request.relativePath && + resolver.join(request.relativePath, this.filename) + }); resolver.doResolve( target, obj, - "resolve as module", + "using path: " + filePath, resolveContext, - (err, result) => { - if (err) return callback(err); - - // Don't allow other alternatives - if (result === undefined) return callback(null, null); - callback(null, result); - } + callback ); }); } @@ -25382,8 +25328,8 @@ module.exports = class ModuleKindPlugin { /***/ }), -/***/ 23195: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 94323: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* @@ -25392,109 +25338,210 @@ module.exports = class ModuleKindPlugin { */ -const forEachBail = __webpack_require__(60059); -const getPaths = __webpack_require__(49395); +const globToRegExp = __webpack_require__(82876)/* .globToRegExp */ .P; -module.exports = class ModulesInHierachicDirectoriesPlugin { - constructor(source, directories, target) { - this.source = source; - this.directories = [].concat(directories); - this.target = target; +function parseType(type) { + const items = type.split("+"); + const t = items.shift(); + return { + type: t === "*" ? null : t, + features: items + }; +} + +function isTypeMatched(baseType, testedType) { + if (typeof baseType === "string") baseType = parseType(baseType); + if (typeof testedType === "string") testedType = parseType(testedType); + if (testedType.type && testedType.type !== baseType.type) return false; + return testedType.features.every(requiredFeature => { + return baseType.features.indexOf(requiredFeature) >= 0; + }); +} + +function isResourceTypeMatched(baseType, testedType) { + baseType = baseType.split("/"); + testedType = testedType.split("/"); + if (baseType.length !== testedType.length) return false; + for (let i = 0; i < baseType.length; i++) { + if (!isTypeMatched(baseType[i], testedType[i])) return false; } + return true; +} - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync( - "ModulesInHierachicDirectoriesPlugin", - (request, resolveContext, callback) => { - const fs = resolver.fileSystem; - const addrs = getPaths(request.path) - .paths.map(p => { - return this.directories.map(d => resolver.join(p, d)); - }) - .reduce((array, p) => { - array.push.apply(array, p); - return array; - }, []); - forEachBail( - addrs, - (addr, callback) => { - fs.stat(addr, (err, stat) => { - if (!err && stat && stat.isDirectory()) { - const obj = Object.assign({}, request, { - path: addr, - request: "./" + request.request - }); - const message = "looking for modules in " + addr; - return resolver.doResolve( - target, - obj, - message, - resolveContext, - callback - ); - } - if (resolveContext.log) - resolveContext.log( - addr + " doesn't exist or is not a directory" - ); - if (resolveContext.missing) resolveContext.missing.add(addr); - return callback(); - }); - }, - callback - ); - } - ); - } -}; +function isResourceTypeSupported(context, type) { + return ( + context.supportedResourceTypes && + context.supportedResourceTypes.some(supportedType => { + return isResourceTypeMatched(supportedType, type); + }) + ); +} +function isEnvironment(context, env) { + return ( + context.environments && + context.environments.every(environment => { + return isTypeMatched(environment, env); + }) + ); +} -/***/ }), +const globCache = {}; -/***/ 3092: -/***/ (function(module) { +function getGlobRegExp(glob) { + const regExp = globCache[glob] || (globCache[glob] = globToRegExp(glob)); + return regExp; +} -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +function matchGlob(glob, relativePath) { + const regExp = getGlobRegExp(glob); + return regExp.exec(relativePath); +} +function isGlobMatched(glob, relativePath) { + return !!matchGlob(glob, relativePath); +} -module.exports = class ModulesInRootPlugin { - constructor(source, path, target) { - this.source = source; - this.path = path; - this.target = target; +function isConditionMatched(context, condition) { + const items = condition.split("|"); + return items.some(function testFn(item) { + item = item.trim(); + const inverted = /^!/.test(item); + if (inverted) return !testFn(item.substr(1)); + if (/^[a-z]+:/.test(item)) { + // match named condition + const match = /^([a-z]+):\s*/.exec(item); + const value = item.substr(match[0].length); + const name = match[1]; + switch (name) { + case "referrer": + return isGlobMatched(value, context.referrer); + default: + return false; + } + } else if (item.indexOf("/") >= 0) { + // match supported type + return isResourceTypeSupported(context, item); + } else { + // match environment + return isEnvironment(context, item); + } + }); +} + +function isKeyMatched(context, key) { + for (;;) { + const match = /^\[([^\]]+)\]\s*/.exec(key); + if (!match) return key; + key = key.substr(match[0].length); + const condition = match[1]; + if (!isConditionMatched(context, condition)) { + return false; + } } +} - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => { - const obj = Object.assign({}, request, { - path: this.path, - request: "./" + request.request - }); - resolver.doResolve( - target, - obj, - "looking for modules in " + this.path, - resolveContext, - callback - ); - }); +function getField(context, configuration, field) { + let value; + Object.keys(configuration).forEach(key => { + const pureKey = isKeyMatched(context, key); + if (pureKey === field) { + value = configuration[key]; + } + }); + return value; +} + +function getMain(context, configuration) { + return getField(context, configuration, "main"); +} + +function getExtensions(context, configuration) { + return getField(context, configuration, "extensions"); +} + +function matchModule(context, configuration, request) { + const modulesField = getField(context, configuration, "modules"); + if (!modulesField) return request; + let newRequest = request; + const keys = Object.keys(modulesField); + let iteration = 0; + let match; + let index; + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const pureKey = isKeyMatched(context, key); + match = matchGlob(pureKey, newRequest); + if (match) { + const value = modulesField[key]; + if (typeof value !== "string") { + return value; + } else if (/^\(.+\)$/.test(pureKey)) { + newRequest = newRequest.replace(getGlobRegExp(pureKey), value); + } else { + index = 1; + newRequest = value.replace(/(\/?\*)?\*/g, replaceMatcher); + } + i = -1; + if (iteration++ > keys.length) { + throw new Error("Request '" + request + "' matches recursively"); + } + } } -}; + return newRequest; + + function replaceMatcher(find) { + switch (find) { + case "/**": { + const m = match[index++]; + return m ? "/" + m : ""; + } + case "**": + case "*": + return match[index++]; + } + } +} + +function matchType(context, configuration, relativePath) { + const typesField = getField(context, configuration, "types"); + if (!typesField) return undefined; + let type; + Object.keys(typesField).forEach(key => { + const pureKey = isKeyMatched(context, key); + if (isGlobMatched(pureKey, relativePath)) { + const value = typesField[key]; + if (!type && /\/\*$/.test(value)) + throw new Error( + "value ('" + + value + + "') of key '" + + key + + "' contains '*', but there is no previous value defined" + ); + type = value.replace(/\/\*$/, "/" + type); + } + }); + return type; +} + +exports.parseType = parseType; +exports.isTypeMatched = isTypeMatched; +exports.isResourceTypeSupported = isResourceTypeSupported; +exports.isEnvironment = isEnvironment; +exports.isGlobMatched = isGlobMatched; +exports.isConditionMatched = isConditionMatched; +exports.isKeyMatched = isKeyMatched; +exports.getField = getField; +exports.getMain = getMain; +exports.getExtensions = getExtensions; +exports.matchModule = matchModule; +exports.matchType = matchType; /***/ }), -/***/ 50959: +/***/ 6369: /***/ (function(module) { "use strict"; @@ -25504,27 +25551,36 @@ module.exports = class ModulesInRootPlugin { */ -module.exports = class NextPlugin { - constructor(source, target) { - this.source = source; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("NextPlugin", (request, resolveContext, callback) => { - resolver.doResolve(target, request, null, resolveContext, callback); - }); - } +module.exports = function createInnerContext( + options, + message, + messageOptional +) { + let messageReported = false; + const childContext = { + log: (() => { + if (!options.log) return undefined; + if (!message) return options.log; + const logFunction = msg => { + if (!messageReported) { + options.log(message); + messageReported = true; + } + options.log(" " + msg); + }; + return logFunction; + })(), + stack: options.stack, + missing: options.missing + }; + return childContext; }; /***/ }), -/***/ 13445: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 60059: +/***/ (function(module) { "use strict"; /* @@ -25533,55 +25589,74 @@ module.exports = class NextPlugin { */ -const fs = __webpack_require__(82161); - -class NodeJsInputFileSystem { - readdir(path, callback) { - fs.readdir(path, (err, files) => { - callback( - err, - files && - files.map(file => { - return file.normalize ? file.normalize("NFC") : file; - }) - ); - }); +module.exports = function forEachBail(array, iterator, callback) { + if (array.length === 0) return callback(); + let currentPos = array.length; + let currentResult; + let done = []; + for (let i = 0; i < array.length; i++) { + const itCb = createIteratorCallback(i); + iterator(array[i], itCb); + if (currentPos === 0) break; } - readdirSync(path) { - const files = fs.readdirSync(path); - return ( - files && - files.map(file => { - return file.normalize ? file.normalize("NFC") : file; - }) - ); + function createIteratorCallback(i) { + return (...args) => { + if (i >= currentPos) return; // ignore + done.push(i); + if (args.length > 0) { + currentPos = i + 1; + done = done.filter(item => { + return item <= i; + }); + currentResult = args; + } + if (done.length === currentPos) { + callback.apply(null, currentResult); + currentPos = 0; + } + }; } -} - -const fsMethods = [ - "stat", - "statSync", - "readFile", - "readFileSync", - "readlink", - "readlinkSync" -]; +}; -for (const key of fsMethods) { - Object.defineProperty(NodeJsInputFileSystem.prototype, key, { - configurable: true, - writable: true, - value: fs[key].bind(fs) - }); -} +module.exports.withIndex = function forEachBailWithIndex( + array, + iterator, + callback +) { + if (array.length === 0) return callback(); + let currentPos = array.length; + let currentResult; + let done = []; + for (let i = 0; i < array.length; i++) { + const itCb = createIteratorCallback(i); + iterator(array[i], i, itCb); + if (currentPos === 0) break; + } -module.exports = NodeJsInputFileSystem; + function createIteratorCallback(i) { + return (...args) => { + if (i >= currentPos) return; // ignore + done.push(i); + if (args.length > 0) { + currentPos = i + 1; + done = done.filter(item => { + return item <= i; + }); + currentResult = args; + } + if (done.length === currentPos) { + callback.apply(null, currentResult); + currentPos = 0; + } + }; + } +}; /***/ }), -/***/ 9743: +/***/ 91878: /***/ (function(module) { "use strict"; @@ -25591,37 +25666,32 @@ module.exports = NodeJsInputFileSystem; */ -module.exports = class ParsePlugin { - constructor(source, target) { - this.source = source; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("ParsePlugin", (request, resolveContext, callback) => { - const parsed = resolver.parse(request.request); - const obj = Object.assign({}, request, parsed); - if (request.query && !parsed.query) { - obj.query = request.query; - } - if (parsed && resolveContext.log) { - if (parsed.module) resolveContext.log("Parsed request is a module"); - if (parsed.directory) - resolveContext.log("Parsed request is a directory"); - } - resolver.doResolve(target, obj, null, resolveContext, callback); - }); +module.exports = function getInnerRequest(resolver, request) { + if ( + typeof request.__innerRequest === "string" && + request.__innerRequest_request === request.request && + request.__innerRequest_relativePath === request.relativePath + ) + return request.__innerRequest; + let innerRequest; + if (request.request) { + innerRequest = request.request; + if (/^\.\.?\//.test(innerRequest) && request.relativePath) { + innerRequest = resolver.join(request.relativePath, innerRequest); + } + } else { + innerRequest = request.relativePath; } + request.__innerRequest_request = request.request; + request.__innerRequest_relativePath = request.relativePath; + return (request.__innerRequest = innerRequest); }; /***/ }), -/***/ 82797: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 49395: +/***/ (function(module) { "use strict"; /* @@ -25630,2171 +25700,654 @@ module.exports = class ParsePlugin { */ -const util = __webpack_require__(31669); +module.exports = function getPaths(path) { + const parts = path.split(/(.*?[\\/]+)/); + const paths = [path]; + const seqments = [parts[parts.length - 1]]; + let part = parts[parts.length - 1]; + path = path.substr(0, path.length - part.length - 1); + for (let i = parts.length - 2; i > 2; i -= 2) { + paths.push(path); + part = parts[i]; + path = path.substr(0, path.length - part.length) || "/"; + seqments.push(part.substr(0, part.length - 1)); + } + part = parts[1]; + seqments.push(part); + paths.push(part); + return { + paths: paths, + seqments: seqments + }; +}; -const Tapable = __webpack_require__(72693); -const SyncHook = __webpack_require__(77633); -const AsyncSeriesBailHook = __webpack_require__(89674); -const AsyncSeriesHook = __webpack_require__(55328); -const createInnerContext = __webpack_require__(6369); +module.exports.basename = function basename(path) { + const i = path.lastIndexOf("/"), + j = path.lastIndexOf("\\"); + const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; + if (p < 0) return null; + const s = path.substr(p + 1); + return s; +}; -const REGEXP_NOT_MODULE = /^\.$|^\.[\\/]|^\.\.$|^\.\.[\\/]|^\/|^[A-Z]:[\\/]/i; -const REGEXP_DIRECTORY = /[\\/]$/i; -const memoryFsJoin = __webpack_require__(65775); -const memoizedJoin = new Map(); -const memoryFsNormalize = __webpack_require__(69038); +/***/ }), -function withName(name, hook) { - hook.name = name; - return hook; -} +/***/ 82876: +/***/ (function(__unused_webpack_module, exports) { -function toCamelCase(str) { - return str.replace(/-([a-z])/g, str => str.substr(1).toUpperCase()); -} +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const deprecatedPushToMissing = util.deprecate((set, item) => { - set.add(item); -}, "Resolver: 'missing' is now a Set. Use add instead of push."); -const deprecatedResolveContextInCallback = util.deprecate(x => { - return x; -}, "Resolver: The callback argument was splitted into resolveContext and callback."); +function globToRegExp(glob) { + // * [^\\\/]* + // /**/ /.+/ + // ^* \./.+ (concord special) + // ? [^\\\/] + // [!...] [^...] + // [^...] [^...] + // / [\\\/] + // {...,...} (...|...) + // ?(...|...) (...|...)? + // +(...|...) (...|...)+ + // *(...|...) (...|...)* + // @(...|...) (...|...) + if (/^\(.+\)$/.test(glob)) { + // allow to pass an RegExp in brackets + return new RegExp(glob.substr(1, glob.length - 2)); + } + const tokens = tokenize(glob); + const process = createRoot(); + const regExpStr = tokens.map(process).join(""); + return new RegExp("^" + regExpStr + "$"); +} -const deprecatedHookAsString = util.deprecate(x => { - return x; -}, "Resolver#doResolve: The type arguments (string) is now a hook argument (Hook). Pass a reference to the hook instead."); +const SIMPLE_TOKENS = { + "@(": "one", + "?(": "zero-one", + "+(": "one-many", + "*(": "zero-many", + "|": "segment-sep", + "/**/": "any-path-segments", + "**": "any-path", + "*": "any-path-segment", + "?": "any-char", + "{": "or", + "/": "path-sep", + ",": "comma", + ")": "closing-segment", + "}": "closing-or" +}; -class Resolver extends Tapable { - constructor(fileSystem) { - super(); - this.fileSystem = fileSystem; - this.hooks = { - resolveStep: withName("resolveStep", new SyncHook(["hook", "request"])), - noResolve: withName("noResolve", new SyncHook(["request", "error"])), - resolve: withName( - "resolve", - new AsyncSeriesBailHook(["request", "resolveContext"]) - ), - result: new AsyncSeriesHook(["result", "resolveContext"]) - }; - this._pluginCompat.tap("Resolver: before/after", options => { - if (/^before-/.test(options.name)) { - options.name = options.name.substr(7); - options.stage = -10; - } else if (/^after-/.test(options.name)) { - options.name = options.name.substr(6); - options.stage = 10; +function tokenize(glob) { + return glob + .split( + /([@?+*]\(|\/\*\*\/|\*\*|[?*]|\[[!^]?(?:[^\]\\]|\\.)+\]|\{|,|\/|[|)}])/g + ) + .map(item => { + if (!item) return null; + const t = SIMPLE_TOKENS[item]; + if (t) { + return { + type: t + }; } - }); - this._pluginCompat.tap("Resolver: step hooks", options => { - const name = options.name; - const stepHook = !/^resolve(-s|S)tep$|^no(-r|R)esolve$/.test(name); - if (stepHook) { - options.async = true; - this.ensureHook(name); - const fn = options.fn; - options.fn = (request, resolverContext, callback) => { - const innerCallback = (err, result) => { - if (err) return callback(err); - if (result !== undefined) return callback(null, result); - callback(); + if (item[0] === "[") { + if (item[1] === "^" || item[1] === "!") { + return { + type: "inverted-char-set", + value: item.substr(2, item.length - 3) }; - for (const key in resolverContext) { - innerCallback[key] = resolverContext[key]; - } - fn.call(this, request, innerCallback); - }; + } else { + return { + type: "char-set", + value: item.substr(1, item.length - 2) + }; + } } + return { + type: "string", + value: item + }; + }) + .filter(Boolean) + .concat({ + type: "end" }); - } +} - ensureHook(name) { - if (typeof name !== "string") return name; - name = toCamelCase(name); - if (/^before/.test(name)) { - return this.ensureHook( - name[6].toLowerCase() + name.substr(7) - ).withOptions({ - stage: -10 - }); - } - if (/^after/.test(name)) { - return this.ensureHook( - name[5].toLowerCase() + name.substr(6) - ).withOptions({ - stage: 10 - }); - } - const hook = this.hooks[name]; - if (!hook) { - return (this.hooks[name] = withName( - name, - new AsyncSeriesBailHook(["request", "resolveContext"]) - )); +function createRoot() { + const inOr = []; + const process = createSeqment(); + let initial = true; + return function(token) { + switch (token.type) { + case "or": + inOr.push(initial); + return "("; + case "comma": + if (inOr.length) { + initial = inOr[inOr.length - 1]; + return "|"; + } else { + return process( + { + type: "string", + value: "," + }, + initial + ); + } + case "closing-or": + if (inOr.length === 0) throw new Error("Unmatched '}'"); + inOr.pop(); + return ")"; + case "end": + if (inOr.length) throw new Error("Unmatched '{'"); + return process(token, initial); + default: { + const result = process(token, initial); + initial = false; + return result; + } } - return hook; - } + }; +} - getHook(name) { - if (typeof name !== "string") return name; - name = toCamelCase(name); - if (/^before/.test(name)) { - return this.getHook(name[6].toLowerCase() + name.substr(7)).withOptions({ - stage: -10 - }); - } - if (/^after/.test(name)) { - return this.getHook(name[5].toLowerCase() + name.substr(6)).withOptions({ - stage: 10 - }); +function createSeqment() { + const inSeqment = []; + const process = createSimple(); + return function(token, initial) { + switch (token.type) { + case "one": + case "one-many": + case "zero-many": + case "zero-one": + inSeqment.push(token.type); + return "("; + case "segment-sep": + if (inSeqment.length) { + return "|"; + } else { + return process( + { + type: "string", + value: "|" + }, + initial + ); + } + case "closing-segment": { + const segment = inSeqment.pop(); + switch (segment) { + case "one": + return ")"; + case "one-many": + return ")+"; + case "zero-many": + return ")*"; + case "zero-one": + return ")?"; + } + throw new Error("Unexcepted segment " + segment); + } + case "end": + if (inSeqment.length > 0) { + throw new Error("Unmatched segment, missing ')'"); + } + return process(token, initial); + default: + return process(token, initial); } - const hook = this.hooks[name]; - if (!hook) { - throw new Error(`Hook ${name} doesn't exist`); + }; +} + +function createSimple() { + return function(token, initial) { + switch (token.type) { + case "path-sep": + return "[\\\\/]+"; + case "any-path-segments": + return "[\\\\/]+(?:(.+)[\\\\/]+)?"; + case "any-path": + return "(.*)"; + case "any-path-segment": + if (initial) { + return "\\.[\\\\/]+(?:.*[\\\\/]+)?([^\\\\/]+)"; + } else { + return "([^\\\\/]*)"; + } + case "any-char": + return "[^\\\\/]"; + case "inverted-char-set": + return "[^" + token.value + "]"; + case "char-set": + return "[" + token.value + "]"; + case "string": + return token.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + case "end": + return ""; + default: + throw new Error("Unsupported token '" + token.type + "'"); } - return hook; - } + }; +} - resolveSync(context, path, request) { - let err, - result, - sync = false; - this.resolve(context, path, request, {}, (e, r) => { - err = e; - result = r; - sync = true; - }); - if (!sync) - throw new Error( - "Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!" - ); - if (err) throw err; - return result; - } +exports.P = globToRegExp; - resolve(context, path, request, resolveContext, callback) { - // TODO remove in enhanced-resolve 5 - // For backward compatiblity START - if (typeof callback !== "function") { - callback = deprecatedResolveContextInCallback(resolveContext); - // resolveContext is a function containing additional properties - // It's now used for resolveContext and callback - } - // END - const obj = { - context: context, - path: path, - request: request - }; - const message = "resolve '" + request + "' in '" + path + "'"; +/***/ }), - // Try to resolve assuming there is no error - // We don't log stuff in this case - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - missing: resolveContext.missing, - stack: resolveContext.stack - }, - (err, result) => { - if (!err && result) { - return callback( - null, - result.path === false ? false : result.path + (result.query || ""), - result - ); - } +/***/ 87450: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const localMissing = new Set(); - // TODO remove in enhanced-resolve 5 - localMissing.push = item => deprecatedPushToMissing(localMissing, item); - const log = []; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - return this.doResolve( - this.hooks.resolve, - obj, - message, - { - log: msg => { - if (resolveContext.log) { - resolveContext.log(msg); - } - log.push(msg); - }, - missing: localMissing, - stack: resolveContext.stack - }, - (err, result) => { - if (err) return callback(err); - const error = new Error("Can't " + message); - error.details = log.join("\n"); - error.missing = Array.from(localMissing); - this.hooks.noResolve.call(obj, error); - return callback(error); - } - ); - } - ); - } +const ResolverFactory = __webpack_require__(34129); - doResolve(hook, request, message, resolveContext, callback) { - // TODO remove in enhanced-resolve 5 - // For backward compatiblity START - if (typeof callback !== "function") { - callback = deprecatedResolveContextInCallback(resolveContext); - // resolveContext is a function containing additional properties - // It's now used for resolveContext and callback - } - if (typeof hook === "string") { - const name = toCamelCase(hook); - hook = deprecatedHookAsString(this.hooks[name]); - if (!hook) { - throw new Error(`Hook "${name}" doesn't exist`); - } - } - // END - if (typeof callback !== "function") - throw new Error("callback is not a function " + Array.from(arguments)); - if (!resolveContext) - throw new Error( - "resolveContext is not an object " + Array.from(arguments) - ); +const NodeJsInputFileSystem = __webpack_require__(13445); +const CachedInputFileSystem = __webpack_require__(75544); - const stackLine = - hook.name + - ": (" + - request.path + - ") " + - (request.request || "") + - (request.query || "") + - (request.directory ? " directory" : "") + - (request.module ? " module" : ""); +const nodeFileSystem = new CachedInputFileSystem( + new NodeJsInputFileSystem(), + 4000 +); - let newStack; - if (resolveContext.stack) { - newStack = new Set(resolveContext.stack); - if (resolveContext.stack.has(stackLine)) { - // Prevent recursion - const recursionError = new Error( - "Recursion in resolving\nStack:\n " + - Array.from(newStack).join("\n ") - ); - recursionError.recursion = true; - if (resolveContext.log) - resolveContext.log("abort resolving because of recursion"); - return callback(recursionError); - } - newStack.add(stackLine); - } else { - newStack = new Set([stackLine]); - } - this.hooks.resolveStep.call(hook, request); +const nodeContext = { + environments: ["node+es3+es5+process+native"] +}; - if (hook.isUsed()) { - const innerContext = createInnerContext( - { - log: resolveContext.log, - missing: resolveContext.missing, - stack: newStack - }, - message - ); - return hook.callAsync(request, innerContext, (err, result) => { - if (err) return callback(err); - if (result) return callback(null, result); - callback(); - }); - } else { - callback(); - } +const asyncResolver = ResolverFactory.createResolver({ + extensions: [".js", ".json", ".node"], + fileSystem: nodeFileSystem +}); +module.exports = function resolve( + context, + path, + request, + resolveContext, + callback +) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; } - - parse(identifier) { - if (identifier === "") return null; - const part = { - request: "", - query: "", - module: false, - directory: false, - file: false - }; - const idxQuery = identifier.indexOf("?"); - if (idxQuery === 0) { - part.query = identifier; - } else if (idxQuery > 0) { - part.request = identifier.slice(0, idxQuery); - part.query = identifier.slice(idxQuery); - } else { - part.request = identifier; - } - if (part.request) { - part.module = this.isModule(part.request); - part.directory = this.isDirectory(part.request); - if (part.directory) { - part.request = part.request.substr(0, part.request.length - 1); - } - } - return part; + if (typeof callback !== "function") { + callback = resolveContext; } + asyncResolver.resolve(context, path, request, resolveContext, callback); +}; - isModule(path) { - return !REGEXP_NOT_MODULE.test(path); +const syncResolver = ResolverFactory.createResolver({ + extensions: [".js", ".json", ".node"], + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem +}); +module.exports.sync = function resolveSync(context, path, request) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; } + return syncResolver.resolveSync(context, path, request); +}; - isDirectory(path) { - return REGEXP_DIRECTORY.test(path); +const asyncContextResolver = ResolverFactory.createResolver({ + extensions: [".js", ".json", ".node"], + resolveToContext: true, + fileSystem: nodeFileSystem +}); +module.exports.context = function resolveContext( + context, + path, + request, + resolveContext, + callback +) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; } - - join(path, request) { - let cacheEntry; - let pathCache = memoizedJoin.get(path); - if (typeof pathCache === "undefined") { - memoizedJoin.set(path, (pathCache = new Map())); - } else { - cacheEntry = pathCache.get(request); - if (typeof cacheEntry !== "undefined") return cacheEntry; - } - cacheEntry = memoryFsJoin(path, request); - pathCache.set(request, cacheEntry); - return cacheEntry; + if (typeof callback !== "function") { + callback = resolveContext; } + asyncContextResolver.resolve( + context, + path, + request, + resolveContext, + callback + ); +}; - normalize(path) { - return memoryFsNormalize(path); +const syncContextResolver = ResolverFactory.createResolver({ + extensions: [".js", ".json", ".node"], + resolveToContext: true, + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem +}); +module.exports.context.sync = function resolveContextSync( + context, + path, + request +) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; } -} - -module.exports = Resolver; - - -/***/ }), - -/***/ 34129: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + return syncContextResolver.resolveSync(context, path, request); +}; +const asyncLoaderResolver = ResolverFactory.createResolver({ + extensions: [".js", ".json", ".node"], + moduleExtensions: ["-loader"], + mainFields: ["loader", "main"], + fileSystem: nodeFileSystem +}); +module.exports.loader = function resolveLoader( + context, + path, + request, + resolveContext, + callback +) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; + } + if (typeof callback !== "function") { + callback = resolveContext; + } + asyncLoaderResolver.resolve(context, path, request, resolveContext, callback); +}; -const Resolver = __webpack_require__(82797); - -const SyncAsyncFileSystemDecorator = __webpack_require__(83230); - -const ParsePlugin = __webpack_require__(9743); -const DescriptionFilePlugin = __webpack_require__(95637); -const NextPlugin = __webpack_require__(50959); -const TryNextPlugin = __webpack_require__(31702); -const ModuleKindPlugin = __webpack_require__(9529); -const FileKindPlugin = __webpack_require__(63602); -const JoinRequestPlugin = __webpack_require__(31693); -const ModulesInHierachicDirectoriesPlugin = __webpack_require__(23195); -const ModulesInRootPlugin = __webpack_require__(3092); -const AliasPlugin = __webpack_require__(15005); -const AliasFieldPlugin = __webpack_require__(89901); -const ConcordExtensionsPlugin = __webpack_require__(56821); -const ConcordMainPlugin = __webpack_require__(27878); -const ConcordModulesPlugin = __webpack_require__(50297); -const DirectoryExistsPlugin = __webpack_require__(48504); -const FileExistsPlugin = __webpack_require__(68372); -const SymlinkPlugin = __webpack_require__(51104); -const MainFieldPlugin = __webpack_require__(7064); -const UseFilePlugin = __webpack_require__(41232); -const AppendPlugin = __webpack_require__(2271); -const RootPlugin = __webpack_require__(32669); -const RestrictionsPlugin = __webpack_require__(49751); -const ResultPlugin = __webpack_require__(19258); -const ModuleAppendPlugin = __webpack_require__(23780); -const UnsafeCachePlugin = __webpack_require__(81809); - -exports.createResolver = function(options) { - //// OPTIONS //// - - // A list of directories to resolve modules from, can be absolute path or folder name - let modules = options.modules || ["node_modules"]; - - // A list of description files to read from - const descriptionFiles = options.descriptionFiles || ["package.json"]; - - // A list of additional resolve plugins which should be applied - // The slice is there to create a copy, because otherwise pushing into plugins - // changes the original options.plugins array, causing duplicate plugins - const plugins = (options.plugins && options.plugins.slice()) || []; - - // A list of main fields in description files - let mainFields = options.mainFields || ["main"]; - - // A list of alias fields in description files - const aliasFields = options.aliasFields || []; - - // A list of main files in directories - const mainFiles = options.mainFiles || ["index"]; - - // A list of extensions which should be tried for files - let extensions = options.extensions || [".js", ".json", ".node"]; - - // Enforce that a extension from extensions must be used - const enforceExtension = options.enforceExtension || false; - - // A list of module extensions which should be tried for modules - let moduleExtensions = options.moduleExtensions || []; - - // Enforce that a extension from moduleExtensions must be used - const enforceModuleExtension = options.enforceModuleExtension || false; +const syncLoaderResolver = ResolverFactory.createResolver({ + extensions: [".js", ".json", ".node"], + moduleExtensions: ["-loader"], + mainFields: ["loader", "main"], + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem +}); +module.exports.loader.sync = function resolveLoaderSync( + context, + path, + request +) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; + } + return syncLoaderResolver.resolveSync(context, path, request); +}; - // A list of module alias configurations or an object which maps key to value - let alias = options.alias || []; +module.exports.create = function create(options) { + options = Object.assign( + { + fileSystem: nodeFileSystem + }, + options + ); + const resolver = ResolverFactory.createResolver(options); + return function(context, path, request, resolveContext, callback) { + if (typeof context === "string") { + callback = resolveContext; + resolveContext = request; + request = path; + path = context; + context = nodeContext; + } + if (typeof callback !== "function") { + callback = resolveContext; + } + resolver.resolve(context, path, request, resolveContext, callback); + }; +}; - // Resolve symlinks to their symlinked location - const symlinks = - typeof options.symlinks !== "undefined" ? options.symlinks : true; +module.exports.create.sync = function createSync(options) { + options = Object.assign( + { + useSyncFileSystemCalls: true, + fileSystem: nodeFileSystem + }, + options + ); + const resolver = ResolverFactory.createResolver(options); + return function(context, path, request) { + if (typeof context === "string") { + request = path; + path = context; + context = nodeContext; + } + return resolver.resolveSync(context, path, request); + }; +}; - // Resolve to a context instead of a file - const resolveToContext = options.resolveToContext || false; +// Export Resolver, FileSystems and Plugins +module.exports.ResolverFactory = ResolverFactory; - // A list of root paths - const roots = options.roots || []; +module.exports.NodeJsInputFileSystem = NodeJsInputFileSystem; +module.exports.CachedInputFileSystem = CachedInputFileSystem; - const restrictions = options.restrictions || []; - // Use this cache object to unsafely cache the successful requests - let unsafeCache = options.unsafeCache || false; +/***/ }), - // Whether or not the unsafeCache should include request context as part of the cache key. - const cacheWithContext = - typeof options.cacheWithContext !== "undefined" - ? options.cacheWithContext - : true; +/***/ 65775: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Enable concord description file instructions - const enableConcord = options.concord || false; +"use strict"; - // A function which decides whether a request should be cached or not. - // an object is passed with `path` and `request` properties. - const cachePredicate = - options.cachePredicate || - function() { - return true; - }; - // The file system which should be used - const fileSystem = options.fileSystem; +const normalize = __webpack_require__(69038); - // Use only the sync constiants of the file system calls - const useSyncFileSystemCalls = options.useSyncFileSystemCalls; +const absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i; +const absoluteNixRegExp = /^\//i; - // A prepared Resolver to which the plugins are attached - let resolver = options.resolver; +module.exports = function join(path, request) { + if(!request) return normalize(path); + if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\")); + if(absoluteNixRegExp.test(request)) return normalize(request); + if(path == "/") return normalize(path + request); + if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\")); + if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request); + return normalize(path + "/" + request); +}; - //// options processing //// - if (!resolver) { - resolver = new Resolver( - useSyncFileSystemCalls - ? new SyncAsyncFileSystemDecorator(fileSystem) - : fileSystem - ); - } +/***/ }), - extensions = [].concat(extensions); - moduleExtensions = [].concat(moduleExtensions); +/***/ 69038: +/***/ (function(module) { - modules = mergeFilteredToArray([].concat(modules), item => { - return !isAbsolutePath(item); - }); +"use strict"; - mainFields = mainFields.map(item => { - if (typeof item === "string" || Array.isArray(item)) { - item = { - name: item, - forceRelative: true - }; - } - return item; - }); - if (typeof alias === "object" && !Array.isArray(alias)) { - alias = Object.keys(alias).map(key => { - let onlyModule = false; - let obj = alias[key]; - if (/\$$/.test(key)) { - onlyModule = true; - key = key.substr(0, key.length - 1); - } - if (typeof obj === "string") { - obj = { - alias: obj - }; +// eslint-disable-next-line complexity +module.exports = function normalize(path) { + var parts = path.split(/(\\+|\/+)/); + if(parts.length === 1) + return path; + var result = []; + var absolutePathStart = 0; + for(var i = 0, sep = false; i < parts.length; i += 1, sep = !sep) { + var part = parts[i]; + if(i === 0 && /^([A-Z]:)?$/i.test(part)) { + result.push(part); + absolutePathStart = 2; + } else if(sep) { + // UNC paths on Windows begin with a double backslash. + if (i === 1 && parts[0].length === 0 && part === "\\\\") { + result.push(part); + } else { + result.push(part[0]); } - obj = Object.assign( - { - name: key, - onlyModule: onlyModule - }, - obj - ); - return obj; - }); - } - - if (unsafeCache && typeof unsafeCache !== "object") { - unsafeCache = {}; + } else if(part === "..") { + switch(result.length) { + case 0: + // i. e. ".." => ".." + // i. e. "../a/b/c" => "../a/b/c" + result.push(part); + break; + case 2: + // i. e. "a/.." => "" + // i. e. "/.." => "/" + // i. e. "C:\.." => "C:\" + // i. e. "a/../b/c" => "b/c" + // i. e. "/../b/c" => "/b/c" + // i. e. "C:\..\a\b\c" => "C:\a\b\c" + if (result[0] !== ".") { + i += 1; + sep = !sep; + result.length = absolutePathStart; + } else { + result.length = 0; + result.push(part); + } + break; + case 4: + // i. e. "a/b/.." => "a" + // i. e. "/a/.." => "/" + // i. e. "C:\a\.." => "C:\" + // i. e. "/a/../b/c" => "/b/c" + if(absolutePathStart === 0) { + result.length -= 3; + } else { + i += 1; + sep = !sep; + result.length = 2; + } + break; + default: + // i. e. "/a/b/.." => "/a" + // i. e. "/a/b/../c" => "/a/c" + result.length -= 3; + break; + } + } else if(part === ".") { + switch(result.length) { + case 0: + // i. e. "." => "." + // i. e. "./a/b/c" => "./a/b/c" + result.push(part); + break; + case 2: + // i. e. "a/." => "a" + // i. e. "/." => "/" + // i. e. "C:\." => "C:\" + // i. e. "C:\.\a\b\c" => "C:\a\b\c" + if(absolutePathStart === 0) { + result.length -= 1; + } else { + i += 1; + sep = !sep; + } + break; + default: + // i. e. "a/b/." => "a/b" + // i. e. "/a/." => "/" + // i. e. "C:\a\." => "C:\" + // i. e. "a/./b/c" => "a/b/c" + // i. e. "/a/./b/c" => "/a/b/c" + result.length -= 1; + break; + } + } else if(part) { + result.push(part); + } } + if(result.length === 1 && /^[A-Za-z]:$/.test(result[0])) + return result[0] + "\\"; + return result.join(""); +}; - //// pipeline //// - resolver.ensureHook("resolve"); - resolver.ensureHook("parsedResolve"); - resolver.ensureHook("describedResolve"); - resolver.ensureHook("rawModule"); - resolver.ensureHook("module"); - resolver.ensureHook("relative"); - resolver.ensureHook("describedRelative"); - resolver.ensureHook("directory"); - resolver.ensureHook("existingDirectory"); - resolver.ensureHook("undescribedRawFile"); - resolver.ensureHook("rawFile"); - resolver.ensureHook("file"); - resolver.ensureHook("existingFile"); - resolver.ensureHook("resolved"); +/***/ }), - // resolve - if (unsafeCache) { - plugins.push( - new UnsafeCachePlugin( - "resolve", - cachePredicate, - unsafeCache, - cacheWithContext, - "new-resolve" - ) - ); - plugins.push(new ParsePlugin("new-resolve", "parsed-resolve")); - } else { - plugins.push(new ParsePlugin("resolve", "parsed-resolve")); - } +/***/ 81744: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // parsed-resolve - plugins.push( - new DescriptionFilePlugin( - "parsed-resolve", - descriptionFiles, - "described-resolve" - ) - ); - plugins.push(new NextPlugin("after-parsed-resolve", "described-resolve")); +var prr = __webpack_require__(59570) - // described-resolve - if (alias.length > 0) - plugins.push(new AliasPlugin("described-resolve", alias, "resolve")); - if (enableConcord) { - plugins.push(new ConcordModulesPlugin("described-resolve", {}, "resolve")); - } - aliasFields.forEach(item => { - plugins.push(new AliasFieldPlugin("described-resolve", item, "resolve")); - }); - plugins.push(new ModuleKindPlugin("after-described-resolve", "raw-module")); - roots.forEach(root => { - plugins.push(new RootPlugin("after-described-resolve", root, "relative")); - }); - plugins.push(new JoinRequestPlugin("after-described-resolve", "relative")); +function init (type, message, cause) { + if (!!message && typeof message != 'string') { + message = message.message || message.name + } + prr(this, { + type : type + , name : type + // can be passed just a 'cause' + , cause : typeof message != 'string' ? message : cause + , message : message + }, 'ewr') +} - // raw-module - moduleExtensions.forEach(item => { - plugins.push(new ModuleAppendPlugin("raw-module", item, "module")); - }); - if (!enforceModuleExtension) - plugins.push(new TryNextPlugin("raw-module", null, "module")); +// generic prototype, not intended to be actually used - helpful for `instanceof` +function CustomError (message, cause) { + Error.call(this) + if (Error.captureStackTrace) + Error.captureStackTrace(this, this.constructor) + init.call(this, 'CustomError', message, cause) +} - // module - modules.forEach(item => { - if (Array.isArray(item)) - plugins.push( - new ModulesInHierachicDirectoriesPlugin("module", item, "resolve") - ); - else plugins.push(new ModulesInRootPlugin("module", item, "resolve")); - }); +CustomError.prototype = new Error() - // relative - plugins.push( - new DescriptionFilePlugin( - "relative", - descriptionFiles, - "described-relative" - ) - ); - plugins.push(new NextPlugin("after-relative", "described-relative")); +function createError (errno, type, proto) { + var err = function (message, cause) { + init.call(this, type, message, cause) + //TODO: the specificity here is stupid, errno should be available everywhere + if (type == 'FilesystemError') { + this.code = this.cause.code + this.path = this.cause.path + this.errno = this.cause.errno + this.message = + (errno.errno[this.cause.errno] + ? errno.errno[this.cause.errno].description + : this.cause.message) + + (this.cause.path ? ' [' + this.cause.path + ']' : '') + } + Error.call(this) + if (Error.captureStackTrace) + Error.captureStackTrace(this, err) + } + err.prototype = !!proto ? new proto() : new CustomError() + return err +} - // described-relative - plugins.push(new FileKindPlugin("described-relative", "raw-file")); - plugins.push( - new TryNextPlugin("described-relative", "as directory", "directory") - ); +module.exports = function (errno) { + var ce = function (type, proto) { + return createError(errno, type, proto) + } + return { + CustomError : CustomError + , FilesystemError : ce('FilesystemError') + , createError : ce + } +} - // directory - plugins.push(new DirectoryExistsPlugin("directory", "existing-directory")); - if (resolveToContext) { - // existing-directory - plugins.push(new NextPlugin("existing-directory", "resolved")); - } else { - // existing-directory - if (enableConcord) { - plugins.push(new ConcordMainPlugin("existing-directory", {}, "resolve")); - } - mainFields.forEach(item => { - plugins.push(new MainFieldPlugin("existing-directory", item, "resolve")); - }); - mainFiles.forEach(item => { - plugins.push( - new UseFilePlugin("existing-directory", item, "undescribed-raw-file") - ); - }); +/***/ }), - // undescribed-raw-file - plugins.push( - new DescriptionFilePlugin( - "undescribed-raw-file", - descriptionFiles, - "raw-file" - ) - ); - plugins.push(new NextPlugin("after-undescribed-raw-file", "raw-file")); - - // raw-file - if (!enforceExtension) { - plugins.push(new TryNextPlugin("raw-file", "no extension", "file")); - } - if (enableConcord) { - plugins.push(new ConcordExtensionsPlugin("raw-file", {}, "file")); - } - extensions.forEach(item => { - plugins.push(new AppendPlugin("raw-file", item, "file")); - }); - - // file - if (alias.length > 0) - plugins.push(new AliasPlugin("file", alias, "resolve")); - if (enableConcord) { - plugins.push(new ConcordModulesPlugin("file", {}, "resolve")); - } - aliasFields.forEach(item => { - plugins.push(new AliasFieldPlugin("file", item, "resolve")); - }); - if (symlinks) plugins.push(new SymlinkPlugin("file", "relative")); - plugins.push(new FileExistsPlugin("file", "existing-file")); - - // existing-file - plugins.push(new NextPlugin("existing-file", "resolved")); - } - - // resolved - if (restrictions.length > 0) { - plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions)); - } - plugins.push(new ResultPlugin(resolver.hooks.resolved)); - - //// RESOLVER //// - - plugins.forEach(plugin => { - plugin.apply(resolver); - }); - - return resolver; -}; - -function mergeFilteredToArray(array, filter) { - return array.reduce((array, item) => { - if (filter(item)) { - const lastElement = array[array.length - 1]; - if (Array.isArray(lastElement)) { - lastElement.push(item); - } else { - array.push([item]); - } - return array; - } else { - array.push(item); - return array; - } - }, []); -} - -function isAbsolutePath(path) { - return /^[A-Z]:|^\//.test(path); -} - - -/***/ }), - -/***/ 49751: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -const slashCode = "/".charCodeAt(0); -const backslashCode = "\\".charCodeAt(0); - -const isInside = (path, parent) => { - if (!path.startsWith(parent)) return false; - if (path.length === parent.length) return true; - const charCode = path.charCodeAt(parent.length); - return charCode === slashCode || charCode === backslashCode; -}; - -module.exports = class RestrictionsPlugin { - constructor(source, restrictions) { - this.source = source; - this.restrictions = restrictions; - } - - apply(resolver) { - resolver - .getHook(this.source) - .tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => { - if (typeof request.path === "string") { - const path = request.path; - - for (let i = 0; i < this.restrictions.length; i++) { - const rule = this.restrictions[i]; - if (typeof rule === "string") { - if (!isInside(path, rule)) { - if (resolveContext.log) { - resolveContext.log( - `${path} is not inside of the restriction ${rule}` - ); - } - return callback(null, null); - } - } else if (!rule.test(path)) { - if (resolveContext.log) { - resolveContext.log( - `${path} doesn't match the restriction ${rule}` - ); - } - return callback(null, null); - } - } - } - - callback(); - }); - } -}; - - -/***/ }), - -/***/ 19258: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = class ResultPlugin { - constructor(source) { - this.source = source; - } - - apply(resolver) { - this.source.tapAsync( - "ResultPlugin", - (request, resolverContext, callback) => { - const obj = Object.assign({}, request); - if (resolverContext.log) - resolverContext.log("reporting result " + obj.path); - resolver.hooks.result.callAsync(obj, resolverContext, err => { - if (err) return callback(err); - callback(null, obj); - }); - } - ); - } -}; - - -/***/ }), - -/***/ 32669: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Ivan Kopeykin @vankop -*/ - - - -/** @typedef {import("./Resolver")} Resolver */ -/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */ - -class RootPlugin { - /** - * @param {string | ResolveStepHook} source source hook - * @param {Array} root roots - * @param {string | ResolveStepHook} target target hook - */ - constructor(source, root, target) { - this.root = root; - this.source = source; - this.target = target; - } - - /** - * @param {Resolver} resolver the resolver - * @returns {void} - */ - apply(resolver) { - const target = resolver.ensureHook(this.target); - - resolver - .getHook(this.source) - .tapAsync("RootPlugin", (request, resolveContext, callback) => { - const req = request.request; - if (!req) return callback(); - if (!req.startsWith("/")) return callback(); - - const path = resolver.join(this.root, req.slice(1)); - const obj = Object.assign(request, { - path, - relativePath: request.relativePath && path - }); - resolver.doResolve( - target, - obj, - `root path ${this.root}`, - resolveContext, - callback - ); - }); - } -} - -module.exports = RootPlugin; - - -/***/ }), - -/***/ 51104: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const getPaths = __webpack_require__(49395); -const forEachBail = __webpack_require__(60059); - -module.exports = class SymlinkPlugin { - constructor(source, target) { - this.source = source; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - const fs = resolver.fileSystem; - resolver - .getHook(this.source) - .tapAsync("SymlinkPlugin", (request, resolveContext, callback) => { - const pathsResult = getPaths(request.path); - const pathSeqments = pathsResult.seqments; - const paths = pathsResult.paths; - - let containsSymlink = false; - forEachBail.withIndex( - paths, - (path, idx, callback) => { - fs.readlink(path, (err, result) => { - if (!err && result) { - pathSeqments[idx] = result; - containsSymlink = true; - // Shortcut when absolute symlink found - if (/^(\/|[a-zA-Z]:($|\\))/.test(result)) - return callback(null, idx); - } - callback(); - }); - }, - (err, idx) => { - if (!containsSymlink) return callback(); - const resultSeqments = - typeof idx === "number" - ? pathSeqments.slice(0, idx + 1) - : pathSeqments.slice(); - const result = resultSeqments.reverse().reduce((a, b) => { - return resolver.join(a, b); - }); - const obj = Object.assign({}, request, { - path: result - }); - resolver.doResolve( - target, - obj, - "resolved symlink to " + result, - resolveContext, - callback - ); - } - ); - }); - } -}; - - -/***/ }), - -/***/ 83230: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -function SyncAsyncFileSystemDecorator(fs) { - this.fs = fs; - if (fs.statSync) { - this.stat = function(arg, callback) { - let result; - try { - result = fs.statSync(arg); - } catch (e) { - return callback(e); - } - callback(null, result); - }; - } - if (fs.readdirSync) { - this.readdir = function(arg, callback) { - let result; - try { - result = fs.readdirSync(arg); - } catch (e) { - return callback(e); - } - callback(null, result); - }; - } - if (fs.readFileSync) { - this.readFile = function(arg, callback) { - let result; - try { - result = fs.readFileSync(arg); - } catch (e) { - return callback(e); - } - callback(null, result); - }; - } - if (fs.readlinkSync) { - this.readlink = function(arg, callback) { - let result; - try { - result = fs.readlinkSync(arg); - } catch (e) { - return callback(e); - } - callback(null, result); - }; - } - if (fs.readJsonSync) { - this.readJson = function(arg, callback) { - let result; - try { - result = fs.readJsonSync(arg); - } catch (e) { - return callback(e); - } - callback(null, result); - }; - } -} -module.exports = SyncAsyncFileSystemDecorator; - - -/***/ }), - -/***/ 31702: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = class TryNextPlugin { - constructor(source, message, target) { - this.source = source; - this.message = message; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("TryNextPlugin", (request, resolveContext, callback) => { - resolver.doResolve( - target, - request, - this.message, - resolveContext, - callback - ); - }); - } -}; - - -/***/ }), - -/***/ 81809: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -function getCacheId(request, withContext) { - return JSON.stringify({ - context: withContext ? request.context : "", - path: request.path, - query: request.query, - request: request.request - }); -} - -module.exports = class UnsafeCachePlugin { - constructor(source, filterPredicate, cache, withContext, target) { - this.source = source; - this.filterPredicate = filterPredicate; - this.withContext = withContext; - this.cache = cache || {}; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("UnsafeCachePlugin", (request, resolveContext, callback) => { - if (!this.filterPredicate(request)) return callback(); - const cacheId = getCacheId(request, this.withContext); - const cacheEntry = this.cache[cacheId]; - if (cacheEntry) { - return callback(null, cacheEntry); - } - resolver.doResolve( - target, - request, - null, - resolveContext, - (err, result) => { - if (err) return callback(err); - if (result) return callback(null, (this.cache[cacheId] = result)); - callback(); - } - ); - }); - } -}; - - -/***/ }), - -/***/ 41232: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = class UseFilePlugin { - constructor(source, filename, target) { - this.source = source; - this.filename = filename; - this.target = target; - } - - apply(resolver) { - const target = resolver.ensureHook(this.target); - resolver - .getHook(this.source) - .tapAsync("UseFilePlugin", (request, resolveContext, callback) => { - const filePath = resolver.join(request.path, this.filename); - const obj = Object.assign({}, request, { - path: filePath, - relativePath: - request.relativePath && - resolver.join(request.relativePath, this.filename) - }); - resolver.doResolve( - target, - obj, - "using path: " + filePath, - resolveContext, - callback - ); - }); - } -}; - - -/***/ }), - -/***/ 94323: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const globToRegExp = __webpack_require__(82876)/* .globToRegExp */ .P; - -function parseType(type) { - const items = type.split("+"); - const t = items.shift(); - return { - type: t === "*" ? null : t, - features: items - }; -} - -function isTypeMatched(baseType, testedType) { - if (typeof baseType === "string") baseType = parseType(baseType); - if (typeof testedType === "string") testedType = parseType(testedType); - if (testedType.type && testedType.type !== baseType.type) return false; - return testedType.features.every(requiredFeature => { - return baseType.features.indexOf(requiredFeature) >= 0; - }); -} - -function isResourceTypeMatched(baseType, testedType) { - baseType = baseType.split("/"); - testedType = testedType.split("/"); - if (baseType.length !== testedType.length) return false; - for (let i = 0; i < baseType.length; i++) { - if (!isTypeMatched(baseType[i], testedType[i])) return false; - } - return true; -} - -function isResourceTypeSupported(context, type) { - return ( - context.supportedResourceTypes && - context.supportedResourceTypes.some(supportedType => { - return isResourceTypeMatched(supportedType, type); - }) - ); -} - -function isEnvironment(context, env) { - return ( - context.environments && - context.environments.every(environment => { - return isTypeMatched(environment, env); - }) - ); -} - -const globCache = {}; - -function getGlobRegExp(glob) { - const regExp = globCache[glob] || (globCache[glob] = globToRegExp(glob)); - return regExp; -} - -function matchGlob(glob, relativePath) { - const regExp = getGlobRegExp(glob); - return regExp.exec(relativePath); -} - -function isGlobMatched(glob, relativePath) { - return !!matchGlob(glob, relativePath); -} - -function isConditionMatched(context, condition) { - const items = condition.split("|"); - return items.some(function testFn(item) { - item = item.trim(); - const inverted = /^!/.test(item); - if (inverted) return !testFn(item.substr(1)); - if (/^[a-z]+:/.test(item)) { - // match named condition - const match = /^([a-z]+):\s*/.exec(item); - const value = item.substr(match[0].length); - const name = match[1]; - switch (name) { - case "referrer": - return isGlobMatched(value, context.referrer); - default: - return false; - } - } else if (item.indexOf("/") >= 0) { - // match supported type - return isResourceTypeSupported(context, item); - } else { - // match environment - return isEnvironment(context, item); - } - }); -} - -function isKeyMatched(context, key) { - for (;;) { - const match = /^\[([^\]]+)\]\s*/.exec(key); - if (!match) return key; - key = key.substr(match[0].length); - const condition = match[1]; - if (!isConditionMatched(context, condition)) { - return false; - } - } -} - -function getField(context, configuration, field) { - let value; - Object.keys(configuration).forEach(key => { - const pureKey = isKeyMatched(context, key); - if (pureKey === field) { - value = configuration[key]; - } - }); - return value; -} - -function getMain(context, configuration) { - return getField(context, configuration, "main"); -} - -function getExtensions(context, configuration) { - return getField(context, configuration, "extensions"); -} - -function matchModule(context, configuration, request) { - const modulesField = getField(context, configuration, "modules"); - if (!modulesField) return request; - let newRequest = request; - const keys = Object.keys(modulesField); - let iteration = 0; - let match; - let index; - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - const pureKey = isKeyMatched(context, key); - match = matchGlob(pureKey, newRequest); - if (match) { - const value = modulesField[key]; - if (typeof value !== "string") { - return value; - } else if (/^\(.+\)$/.test(pureKey)) { - newRequest = newRequest.replace(getGlobRegExp(pureKey), value); - } else { - index = 1; - newRequest = value.replace(/(\/?\*)?\*/g, replaceMatcher); - } - i = -1; - if (iteration++ > keys.length) { - throw new Error("Request '" + request + "' matches recursively"); - } - } - } - return newRequest; - - function replaceMatcher(find) { - switch (find) { - case "/**": { - const m = match[index++]; - return m ? "/" + m : ""; - } - case "**": - case "*": - return match[index++]; - } - } -} - -function matchType(context, configuration, relativePath) { - const typesField = getField(context, configuration, "types"); - if (!typesField) return undefined; - let type; - Object.keys(typesField).forEach(key => { - const pureKey = isKeyMatched(context, key); - if (isGlobMatched(pureKey, relativePath)) { - const value = typesField[key]; - if (!type && /\/\*$/.test(value)) - throw new Error( - "value ('" + - value + - "') of key '" + - key + - "' contains '*', but there is no previous value defined" - ); - type = value.replace(/\/\*$/, "/" + type); - } - }); - return type; -} - -exports.parseType = parseType; -exports.isTypeMatched = isTypeMatched; -exports.isResourceTypeSupported = isResourceTypeSupported; -exports.isEnvironment = isEnvironment; -exports.isGlobMatched = isGlobMatched; -exports.isConditionMatched = isConditionMatched; -exports.isKeyMatched = isKeyMatched; -exports.getField = getField; -exports.getMain = getMain; -exports.getExtensions = getExtensions; -exports.matchModule = matchModule; -exports.matchType = matchType; - - -/***/ }), - -/***/ 6369: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = function createInnerContext( - options, - message, - messageOptional -) { - let messageReported = false; - const childContext = { - log: (() => { - if (!options.log) return undefined; - if (!message) return options.log; - const logFunction = msg => { - if (!messageReported) { - options.log(message); - messageReported = true; - } - options.log(" " + msg); - }; - return logFunction; - })(), - stack: options.stack, - missing: options.missing - }; - return childContext; -}; - - -/***/ }), - -/***/ 60059: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = function forEachBail(array, iterator, callback) { - if (array.length === 0) return callback(); - let currentPos = array.length; - let currentResult; - let done = []; - for (let i = 0; i < array.length; i++) { - const itCb = createIteratorCallback(i); - iterator(array[i], itCb); - if (currentPos === 0) break; - } - - function createIteratorCallback(i) { - return (...args) => { - if (i >= currentPos) return; // ignore - done.push(i); - if (args.length > 0) { - currentPos = i + 1; - done = done.filter(item => { - return item <= i; - }); - currentResult = args; - } - if (done.length === currentPos) { - callback.apply(null, currentResult); - currentPos = 0; - } - }; - } -}; - -module.exports.withIndex = function forEachBailWithIndex( - array, - iterator, - callback -) { - if (array.length === 0) return callback(); - let currentPos = array.length; - let currentResult; - let done = []; - for (let i = 0; i < array.length; i++) { - const itCb = createIteratorCallback(i); - iterator(array[i], i, itCb); - if (currentPos === 0) break; - } - - function createIteratorCallback(i) { - return (...args) => { - if (i >= currentPos) return; // ignore - done.push(i); - if (args.length > 0) { - currentPos = i + 1; - done = done.filter(item => { - return item <= i; - }); - currentResult = args; - } - if (done.length === currentPos) { - callback.apply(null, currentResult); - currentPos = 0; - } - }; - } -}; - - -/***/ }), - -/***/ 91878: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = function getInnerRequest(resolver, request) { - if ( - typeof request.__innerRequest === "string" && - request.__innerRequest_request === request.request && - request.__innerRequest_relativePath === request.relativePath - ) - return request.__innerRequest; - let innerRequest; - if (request.request) { - innerRequest = request.request; - if (/^\.\.?\//.test(innerRequest) && request.relativePath) { - innerRequest = resolver.join(request.relativePath, innerRequest); - } - } else { - innerRequest = request.relativePath; - } - request.__innerRequest_request = request.request; - request.__innerRequest_relativePath = request.relativePath; - return (request.__innerRequest = innerRequest); -}; - - -/***/ }), - -/***/ 49395: -/***/ (function(module) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -module.exports = function getPaths(path) { - const parts = path.split(/(.*?[\\/]+)/); - const paths = [path]; - const seqments = [parts[parts.length - 1]]; - let part = parts[parts.length - 1]; - path = path.substr(0, path.length - part.length - 1); - for (let i = parts.length - 2; i > 2; i -= 2) { - paths.push(path); - part = parts[i]; - path = path.substr(0, path.length - part.length) || "/"; - seqments.push(part.substr(0, part.length - 1)); - } - part = parts[1]; - seqments.push(part); - paths.push(part); - return { - paths: paths, - seqments: seqments - }; -}; - -module.exports.basename = function basename(path) { - const i = path.lastIndexOf("/"), - j = path.lastIndexOf("\\"); - const p = i < 0 ? j : j < 0 ? i : i < j ? j : i; - if (p < 0) return null; - const s = path.substr(p + 1); - return s; -}; - - -/***/ }), - -/***/ 82876: -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -function globToRegExp(glob) { - // * [^\\\/]* - // /**/ /.+/ - // ^* \./.+ (concord special) - // ? [^\\\/] - // [!...] [^...] - // [^...] [^...] - // / [\\\/] - // {...,...} (...|...) - // ?(...|...) (...|...)? - // +(...|...) (...|...)+ - // *(...|...) (...|...)* - // @(...|...) (...|...) - if (/^\(.+\)$/.test(glob)) { - // allow to pass an RegExp in brackets - return new RegExp(glob.substr(1, glob.length - 2)); - } - const tokens = tokenize(glob); - const process = createRoot(); - const regExpStr = tokens.map(process).join(""); - return new RegExp("^" + regExpStr + "$"); -} - -const SIMPLE_TOKENS = { - "@(": "one", - "?(": "zero-one", - "+(": "one-many", - "*(": "zero-many", - "|": "segment-sep", - "/**/": "any-path-segments", - "**": "any-path", - "*": "any-path-segment", - "?": "any-char", - "{": "or", - "/": "path-sep", - ",": "comma", - ")": "closing-segment", - "}": "closing-or" -}; - -function tokenize(glob) { - return glob - .split( - /([@?+*]\(|\/\*\*\/|\*\*|[?*]|\[[!^]?(?:[^\]\\]|\\.)+\]|\{|,|\/|[|)}])/g - ) - .map(item => { - if (!item) return null; - const t = SIMPLE_TOKENS[item]; - if (t) { - return { - type: t - }; - } - if (item[0] === "[") { - if (item[1] === "^" || item[1] === "!") { - return { - type: "inverted-char-set", - value: item.substr(2, item.length - 3) - }; - } else { - return { - type: "char-set", - value: item.substr(1, item.length - 2) - }; - } - } - return { - type: "string", - value: item - }; - }) - .filter(Boolean) - .concat({ - type: "end" - }); -} - -function createRoot() { - const inOr = []; - const process = createSeqment(); - let initial = true; - return function(token) { - switch (token.type) { - case "or": - inOr.push(initial); - return "("; - case "comma": - if (inOr.length) { - initial = inOr[inOr.length - 1]; - return "|"; - } else { - return process( - { - type: "string", - value: "," - }, - initial - ); - } - case "closing-or": - if (inOr.length === 0) throw new Error("Unmatched '}'"); - inOr.pop(); - return ")"; - case "end": - if (inOr.length) throw new Error("Unmatched '{'"); - return process(token, initial); - default: { - const result = process(token, initial); - initial = false; - return result; - } - } - }; -} - -function createSeqment() { - const inSeqment = []; - const process = createSimple(); - return function(token, initial) { - switch (token.type) { - case "one": - case "one-many": - case "zero-many": - case "zero-one": - inSeqment.push(token.type); - return "("; - case "segment-sep": - if (inSeqment.length) { - return "|"; - } else { - return process( - { - type: "string", - value: "|" - }, - initial - ); - } - case "closing-segment": { - const segment = inSeqment.pop(); - switch (segment) { - case "one": - return ")"; - case "one-many": - return ")+"; - case "zero-many": - return ")*"; - case "zero-one": - return ")?"; - } - throw new Error("Unexcepted segment " + segment); - } - case "end": - if (inSeqment.length > 0) { - throw new Error("Unmatched segment, missing ')'"); - } - return process(token, initial); - default: - return process(token, initial); - } - }; -} - -function createSimple() { - return function(token, initial) { - switch (token.type) { - case "path-sep": - return "[\\\\/]+"; - case "any-path-segments": - return "[\\\\/]+(?:(.+)[\\\\/]+)?"; - case "any-path": - return "(.*)"; - case "any-path-segment": - if (initial) { - return "\\.[\\\\/]+(?:.*[\\\\/]+)?([^\\\\/]+)"; - } else { - return "([^\\\\/]*)"; - } - case "any-char": - return "[^\\\\/]"; - case "inverted-char-set": - return "[^" + token.value + "]"; - case "char-set": - return "[" + token.value + "]"; - case "string": - return token.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - case "end": - return ""; - default: - throw new Error("Unsupported token '" + token.type + "'"); - } - }; -} - -exports.P = globToRegExp; - - -/***/ }), - -/***/ 87450: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const ResolverFactory = __webpack_require__(34129); - -const NodeJsInputFileSystem = __webpack_require__(13445); -const CachedInputFileSystem = __webpack_require__(75544); - -const nodeFileSystem = new CachedInputFileSystem( - new NodeJsInputFileSystem(), - 4000 -); - -const nodeContext = { - environments: ["node+es3+es5+process+native"] -}; - -const asyncResolver = ResolverFactory.createResolver({ - extensions: [".js", ".json", ".node"], - fileSystem: nodeFileSystem -}); -module.exports = function resolve( - context, - path, - request, - resolveContext, - callback -) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; - } - asyncResolver.resolve(context, path, request, resolveContext, callback); -}; - -const syncResolver = ResolverFactory.createResolver({ - extensions: [".js", ".json", ".node"], - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem -}); -module.exports.sync = function resolveSync(context, path, request) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return syncResolver.resolveSync(context, path, request); -}; - -const asyncContextResolver = ResolverFactory.createResolver({ - extensions: [".js", ".json", ".node"], - resolveToContext: true, - fileSystem: nodeFileSystem -}); -module.exports.context = function resolveContext( - context, - path, - request, - resolveContext, - callback -) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; - } - asyncContextResolver.resolve( - context, - path, - request, - resolveContext, - callback - ); -}; - -const syncContextResolver = ResolverFactory.createResolver({ - extensions: [".js", ".json", ".node"], - resolveToContext: true, - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem -}); -module.exports.context.sync = function resolveContextSync( - context, - path, - request -) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return syncContextResolver.resolveSync(context, path, request); -}; - -const asyncLoaderResolver = ResolverFactory.createResolver({ - extensions: [".js", ".json", ".node"], - moduleExtensions: ["-loader"], - mainFields: ["loader", "main"], - fileSystem: nodeFileSystem -}); -module.exports.loader = function resolveLoader( - context, - path, - request, - resolveContext, - callback -) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; - } - asyncLoaderResolver.resolve(context, path, request, resolveContext, callback); -}; - -const syncLoaderResolver = ResolverFactory.createResolver({ - extensions: [".js", ".json", ".node"], - moduleExtensions: ["-loader"], - mainFields: ["loader", "main"], - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem -}); -module.exports.loader.sync = function resolveLoaderSync( - context, - path, - request -) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return syncLoaderResolver.resolveSync(context, path, request); -}; - -module.exports.create = function create(options) { - options = Object.assign( - { - fileSystem: nodeFileSystem - }, - options - ); - const resolver = ResolverFactory.createResolver(options); - return function(context, path, request, resolveContext, callback) { - if (typeof context === "string") { - callback = resolveContext; - resolveContext = request; - request = path; - path = context; - context = nodeContext; - } - if (typeof callback !== "function") { - callback = resolveContext; - } - resolver.resolve(context, path, request, resolveContext, callback); - }; -}; - -module.exports.create.sync = function createSync(options) { - options = Object.assign( - { - useSyncFileSystemCalls: true, - fileSystem: nodeFileSystem - }, - options - ); - const resolver = ResolverFactory.createResolver(options); - return function(context, path, request) { - if (typeof context === "string") { - request = path; - path = context; - context = nodeContext; - } - return resolver.resolveSync(context, path, request); - }; -}; - -// Export Resolver, FileSystems and Plugins -module.exports.ResolverFactory = ResolverFactory; - -module.exports.NodeJsInputFileSystem = NodeJsInputFileSystem; -module.exports.CachedInputFileSystem = CachedInputFileSystem; - - -/***/ }), - -/***/ 65775: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const normalize = __webpack_require__(69038); - -const absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i; -const absoluteNixRegExp = /^\//i; - -module.exports = function join(path, request) { - if(!request) return normalize(path); - if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\")); - if(absoluteNixRegExp.test(request)) return normalize(request); - if(path == "/") return normalize(path + request); - if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\")); - if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request); - return normalize(path + "/" + request); -}; - - -/***/ }), - -/***/ 69038: -/***/ (function(module) { - -"use strict"; - - -// eslint-disable-next-line complexity -module.exports = function normalize(path) { - var parts = path.split(/(\\+|\/+)/); - if(parts.length === 1) - return path; - var result = []; - var absolutePathStart = 0; - for(var i = 0, sep = false; i < parts.length; i += 1, sep = !sep) { - var part = parts[i]; - if(i === 0 && /^([A-Z]:)?$/i.test(part)) { - result.push(part); - absolutePathStart = 2; - } else if(sep) { - // UNC paths on Windows begin with a double backslash. - if (i === 1 && parts[0].length === 0 && part === "\\\\") { - result.push(part); - } else { - result.push(part[0]); - } - } else if(part === "..") { - switch(result.length) { - case 0: - // i. e. ".." => ".." - // i. e. "../a/b/c" => "../a/b/c" - result.push(part); - break; - case 2: - // i. e. "a/.." => "" - // i. e. "/.." => "/" - // i. e. "C:\.." => "C:\" - // i. e. "a/../b/c" => "b/c" - // i. e. "/../b/c" => "/b/c" - // i. e. "C:\..\a\b\c" => "C:\a\b\c" - if (result[0] !== ".") { - i += 1; - sep = !sep; - result.length = absolutePathStart; - } else { - result.length = 0; - result.push(part); - } - break; - case 4: - // i. e. "a/b/.." => "a" - // i. e. "/a/.." => "/" - // i. e. "C:\a\.." => "C:\" - // i. e. "/a/../b/c" => "/b/c" - if(absolutePathStart === 0) { - result.length -= 3; - } else { - i += 1; - sep = !sep; - result.length = 2; - } - break; - default: - // i. e. "/a/b/.." => "/a" - // i. e. "/a/b/../c" => "/a/c" - result.length -= 3; - break; - } - } else if(part === ".") { - switch(result.length) { - case 0: - // i. e. "." => "." - // i. e. "./a/b/c" => "./a/b/c" - result.push(part); - break; - case 2: - // i. e. "a/." => "a" - // i. e. "/." => "/" - // i. e. "C:\." => "C:\" - // i. e. "C:\.\a\b\c" => "C:\a\b\c" - if(absolutePathStart === 0) { - result.length -= 1; - } else { - i += 1; - sep = !sep; - } - break; - default: - // i. e. "a/b/." => "a/b" - // i. e. "/a/." => "/" - // i. e. "C:\a\." => "C:\" - // i. e. "a/./b/c" => "a/b/c" - // i. e. "/a/./b/c" => "/a/b/c" - result.length -= 1; - break; - } - } else if(part) { - result.push(part); - } - } - if(result.length === 1 && /^[A-Za-z]:$/.test(result[0])) - return result[0] + "\\"; - return result.join(""); -}; - - -/***/ }), - -/***/ 81744: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var prr = __webpack_require__(59570) - -function init (type, message, cause) { - if (!!message && typeof message != 'string') { - message = message.message || message.name - } - prr(this, { - type : type - , name : type - // can be passed just a 'cause' - , cause : typeof message != 'string' ? message : cause - , message : message - }, 'ewr') -} - -// generic prototype, not intended to be actually used - helpful for `instanceof` -function CustomError (message, cause) { - Error.call(this) - if (Error.captureStackTrace) - Error.captureStackTrace(this, this.constructor) - init.call(this, 'CustomError', message, cause) -} - -CustomError.prototype = new Error() - -function createError (errno, type, proto) { - var err = function (message, cause) { - init.call(this, type, message, cause) - //TODO: the specificity here is stupid, errno should be available everywhere - if (type == 'FilesystemError') { - this.code = this.cause.code - this.path = this.cause.path - this.errno = this.cause.errno - this.message = - (errno.errno[this.cause.errno] - ? errno.errno[this.cause.errno].description - : this.cause.message) - + (this.cause.path ? ' [' + this.cause.path + ']' : '') - } - Error.call(this) - if (Error.captureStackTrace) - Error.captureStackTrace(this, err) - } - err.prototype = !!proto ? new proto() : new CustomError() - return err -} - -module.exports = function (errno) { - var ce = function (type, proto) { - return createError(errno, type, proto) - } - return { - CustomError : CustomError - , FilesystemError : ce('FilesystemError') - , createError : ce - } -} - - -/***/ }), - -/***/ 48916: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 48916: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { var all = module.exports.all = [ { @@ -30593,278 +29146,62 @@ module.exports = function equal(a, b) { module.exports = function (data, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { cmp: opts }; - var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; - - var cmp = opts.cmp && (function (f) { - return function (node) { - return function (a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - })(opts.cmp); - - var seen = []; - return (function stringify (node) { - if (node && node.toJSON && typeof node.toJSON === 'function') { - node = node.toJSON(); - } - - if (node === undefined) return; - if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; - if (typeof node !== 'object') return JSON.stringify(node); - - var i, out; - if (Array.isArray(node)) { - out = '['; - for (i = 0; i < node.length; i++) { - if (i) out += ','; - out += stringify(node[i]) || 'null'; - } - return out + ']'; - } - - if (node === null) return 'null'; - - if (seen.indexOf(node) !== -1) { - if (cycles) return JSON.stringify('__cycle__'); - throw new TypeError('Converting circular structure to JSON'); - } - - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ''; - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node[key]); - - if (!value) continue; - if (out) out += ','; - out += JSON.stringify(key) + ':' + value; - } - seen.splice(seenIndex, 1); - return '{' + out + '}'; - })(data); -}; - - -/***/ }), - -/***/ 35955: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/*! - * fill-range - * - * Copyright (c) 2014-2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */ - - - -var util = __webpack_require__(31669); -var isNumber = __webpack_require__(87218); -var extend = __webpack_require__(28727); -var repeat = __webpack_require__(6332); -var toRegex = __webpack_require__(1353); - -/** - * 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; -} + if (!opts) opts = {}; + if (typeof opts === 'function') opts = { cmp: opts }; + var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; -function toNumber(val) { - return Number(val) || 0; -} + var cmp = opts.cmp && (function (f) { + return function (node) { + return function (a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + })(opts.cmp); -function isPadded(str) { - return /^-?0\d/.test(str); -} + var seen = []; + return (function stringify (node) { + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } -function isValid(min, max) { - return (isValidNumber(min) || isValidLetter(min)) - && (isValidNumber(max) || isValidLetter(max)); -} + if (node === undefined) return; + if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; + if (typeof node !== 'object') return JSON.stringify(node); -function isValidLetter(ch) { - return typeof ch === 'string' && ch.length === 1 && /^\w+$/.test(ch); -} + var i, out; + if (Array.isArray(node)) { + out = '['; + for (i = 0; i < node.length; i++) { + if (i) out += ','; + out += stringify(node[i]) || 'null'; + } + return out + ']'; + } -function isValidNumber(n) { - return isNumber(n) && !/\./.test(n); -} + if (node === null) return 'null'; -/** - * Expose `fillRange` - * @type {Function} - */ + if (seen.indexOf(node) !== -1) { + if (cycles) return JSON.stringify('__cycle__'); + throw new TypeError('Converting circular structure to JSON'); + } -module.exports = fillRange; + var seenIndex = seen.push(node) - 1; + var keys = Object.keys(node).sort(cmp && cmp(node)); + out = ''; + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node[key]); + + if (!value) continue; + if (out) out += ','; + out += JSON.stringify(key) + ':' + value; + } + seen.splice(seenIndex, 1); + return '{' + out + '}'; + })(data); +}; /***/ }), @@ -34160,1776 +32497,3865 @@ MemoryFileSystem.prototype.writeFile = function (path, content, encoding, callba }; -/***/ }), +/***/ }), + +/***/ 89597: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var normalize = __webpack_require__(25458); + +var absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i; +var absoluteNixRegExp = /^\//i; + +module.exports = function join(path, request) { + if(!request) return normalize(path); + if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\")); + if(absoluteNixRegExp.test(request)) return normalize(request); + if(path == "/") return normalize(path + request); + if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\")); + if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request); + return normalize(path + "/" + request); +}; + + +/***/ }), + +/***/ 25458: +/***/ (function(module) { + +module.exports = function normalize(path) { + var parts = path.split(/(\\+|\/+)/); + if(parts.length === 1) + return path; + var result = []; + var absolutePathStart = 0; + for(var i = 0, sep = false; i < parts.length; i++, sep = !sep) { + var part = parts[i]; + if(i === 0 && /^([A-Z]:)?$/i.test(part)) { + result.push(part); + absolutePathStart = 2; + } else if(sep) { + result.push(part[0]); + } else if(part === "..") { + switch(result.length) { + case 0: + // i. e. ".." => ".." + // i. e. "../a/b/c" => "../a/b/c" + result.push(part); + break; + case 2: + // i. e. "a/.." => "" + // i. e. "/.." => "/" + // i. e. "C:\.." => "C:\" + // i. e. "a/../b/c" => "b/c" + // i. e. "/../b/c" => "/b/c" + // i. e. "C:\..\a\b\c" => "C:\a\b\c" + i++; + sep = !sep; + result.length = absolutePathStart; + break; + case 4: + // i. e. "a/b/.." => "a" + // i. e. "/a/.." => "/" + // i. e. "C:\a\.." => "C:\" + // i. e. "/a/../b/c" => "/b/c" + if(absolutePathStart === 0) { + result.length -= 3; + } else { + i++; + sep = !sep; + result.length = 2; + } + break; + default: + // i. e. "/a/b/.." => "/a" + // i. e. "/a/b/../c" => "/a/c" + result.length -= 3; + break; + } + } else if(part === ".") { + switch(result.length) { + case 0: + // i. e. "." => "." + // i. e. "./a/b/c" => "./a/b/c" + result.push(part); + break; + case 2: + // i. e. "a/." => "a" + // i. e. "/." => "/" + // i. e. "C:\." => "C:\" + // i. e. "C:\.\a\b\c" => "C:\a\b\c" + if(absolutePathStart === 0) { + result.length--; + } else { + i++; + sep = !sep; + } + break; + default: + // i. e. "a/b/." => "a/b" + // i. e. "/a/." => "/" + // i. e. "C:\a\." => "C:\" + // i. e. "a/./b/c" => "a/b/c" + // i. e. "/a/./b/c" => "/a/b/c" + result.length--; + break; + } + } else if(part) { + result.push(part); + } + } + if(result.length === 1 && /^[A-Za-z]:$/.test(result)) + return result[0] + "\\"; + return result.join(""); +}; + + +/***/ }), + +/***/ 53024: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var util = __webpack_require__(31669); +var braces = __webpack_require__(50559); +var toRegex = __webpack_require__(51279); +var extend = __webpack_require__(3767); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(26113); +var parsers = __webpack_require__(14086); +var cache = __webpack_require__(34743); +var utils = __webpack_require__(63976); +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; + + +/***/ }), + +/***/ 34743: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +module.exports = new (__webpack_require__(49908))(); + + +/***/ }), + +/***/ 26113: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var nanomatch = __webpack_require__(57925); +var extglob = __webpack_require__(66675); + +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); + } + } +} + + +/***/ }), + +/***/ 14086: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var extglob = __webpack_require__(66675); +var nanomatch = __webpack_require__(57925); +var regexNot = __webpack_require__(30931); +var toRegex = __webpack_require__(51279); +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(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}); +} + + +/***/ }), + +/***/ 63976: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = module.exports; +var path = __webpack_require__(85622); + +/** + * Module dependencies + */ + +var Snapdragon = __webpack_require__(79285); +utils.define = __webpack_require__(35851); +utils.diff = __webpack_require__(9455); +utils.extend = __webpack_require__(3767); +utils.pick = __webpack_require__(38509); +utils.typeOf = __webpack_require__(19613); +utils.unique = __webpack_require__(19009); + +/** + * 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; + }; +}; + + +/***/ }), + +/***/ 50559: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +/** + * Module dependencies + */ + +var toRegex = __webpack_require__(51279); +var unique = __webpack_require__(19009); +var extend = __webpack_require__(92845); + +/** + * Local dependencies + */ + +var compilers = __webpack_require__(90808); +var parsers = __webpack_require__(46362); +var Braces = __webpack_require__(12638); +var utils = __webpack_require__(38640); +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; + + +/***/ }), + +/***/ 12638: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var extend = __webpack_require__(92845); +var Snapdragon = __webpack_require__(79285); +var compilers = __webpack_require__(90808); +var parsers = __webpack_require__(46362); +var utils = __webpack_require__(38640); + +/** + * 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; + + +/***/ }), + +/***/ 90808: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(38640); + +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; +} + + +/***/ }), + +/***/ 46362: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var Node = __webpack_require__(12579); +var utils = __webpack_require__(38640); + +/** + * 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; -/***/ 89597: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var prev = this.prev(); + var last = utils.last(prev.nodes); -var normalize = __webpack_require__(25458); - -var absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i; -var absoluteNixRegExp = /^\//i; - -module.exports = function join(path, request) { - if(!request) return normalize(path); - if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\")); - if(absoluteNixRegExp.test(request)) return normalize(request); - if(path == "/") return normalize(path + request); - if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\")); - if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request); - return normalize(path + "/" + request); -}; + 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; -/***/ 25458: -/***/ (function(module) { + while ((ch = str[++idx])) { + this.consume(1); + node.val += ch; + if (ch === '\\') { + node.val += str[++idx]; + continue; + } + if (ch === '}') { + break; + } + } + } -module.exports = function normalize(path) { - var parts = path.split(/(\\+|\/+)/); - if(parts.length === 1) - return path; - var result = []; - var absolutePathStart = 0; - for(var i = 0, sep = false; i < parts.length; i++, sep = !sep) { - var part = parts[i]; - if(i === 0 && /^([A-Z]:)?$/i.test(part)) { - result.push(part); - absolutePathStart = 2; - } else if(sep) { - result.push(part[0]); - } else if(part === "..") { - switch(result.length) { - case 0: - // i. e. ".." => ".." - // i. e. "../a/b/c" => "../a/b/c" - result.push(part); - break; - case 2: - // i. e. "a/.." => "" - // i. e. "/.." => "/" - // i. e. "C:\.." => "C:\" - // i. e. "a/../b/c" => "b/c" - // i. e. "/../b/c" => "/b/c" - // i. e. "C:\..\a\b\c" => "C:\a\b\c" - i++; - sep = !sep; - result.length = absolutePathStart; - break; - case 4: - // i. e. "a/b/.." => "a" - // i. e. "/a/.." => "/" - // i. e. "C:\a\.." => "C:\" - // i. e. "/a/../b/c" => "/b/c" - if(absolutePathStart === 0) { - result.length -= 3; - } else { - i++; - sep = !sep; - result.length = 2; - } - break; - default: - // i. e. "/a/b/.." => "/a" - // i. e. "/a/b/../c" => "/a/c" - result.length -= 3; - break; - } - } else if(part === ".") { - switch(result.length) { - case 0: - // i. e. "." => "." - // i. e. "./a/b/c" => "./a/b/c" - result.push(part); - break; - case 2: - // i. e. "a/." => "a" - // i. e. "/." => "/" - // i. e. "C:\." => "C:\" - // i. e. "C:\.\a\b\c" => "C:\a\b\c" - if(absolutePathStart === 0) { - result.length--; - } else { - i++; - sep = !sep; - } - break; - default: - // i. e. "a/b/." => "a/b" - // i. e. "/a/." => "/" - // i. e. "C:\a\." => "C:\" - // i. e. "a/./b/c" => "a/b/c" - // i. e. "/a/./b/c" => "/a/b/c" - result.length--; - break; - } - } else if(part) { - result.push(part); - } - } - if(result.length === 1 && /^[A-Za-z]:$/.test(result)) - return result[0] + "\\"; - return result.join(""); -}; + 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); + }) -/***/ 53024: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * Brackets: "[...]" (basic, this is overridden by + * other parsers in more advanced implementations) + */ -"use strict"; + .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] || ''; -/** - * Module dependencies - */ + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } -var util = __webpack_require__(31669); -var braces = __webpack_require__(22706); -var toRegex = __webpack_require__(51279); -var extend = __webpack_require__(3767); + var esc = this.input.slice(0, 2); + if (inner === '' && esc === '\\]') { + inner += esc; + this.consume(2); -/** - * Local dependencies - */ + var str = this.input; + var idx = -1; + var ch; -var compilers = __webpack_require__(26113); -var parsers = __webpack_require__(14086); -var cache = __webpack_require__(34743); -var utils = __webpack_require__(63976); -var MAX_LENGTH = 1024 * 64; + while ((ch = str[++idx])) { + this.consume(1); + if (ch === ']') { + close = ch; + break; + } + inner += ch; + } + } -/** - * 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 - */ + 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 + })); -function micromatch(list, patterns, options) { - patterns = utils.arrayify(patterns); - list = utils.arrayify(list); + return concatNodes.call(this, pos, node, prev, options); + }) - var len = patterns.length; - if (list.length === 0 || len === 0) { - return []; - } + /** + * Open + */ - if (len === 1) { - return micromatch.match(list, patterns[0], options); - } + .set('brace.open', function() { + var pos = this.position(); + var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); + if (!m) return; - var omit = []; - var keep = []; - var idx = -1; + var prev = this.prev(); + var last = utils.last(prev.nodes); - while (++idx < len) { - var pattern = patterns[idx]; + // 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; + } - 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 open = pos(new Node({ + type: 'brace.open', + val: m[0] + })); - var matches = utils.diff(keep, omit); - if (!options || options.nodupes !== false) { - return utils.unique(matches); - } + var node = pos(new Node({ + type: 'brace', + nodes: [] + })); - return matches; -} + node.push(open); + prev.push(node); + this.push('brace', node); + }) -/** - * 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 - */ + /** + * Close + */ -micromatch.match = function(list, pattern, options) { - if (Array.isArray(pattern)) { - throw new TypeError('expected pattern to be a string'); - } + .set('brace.close', function() { + var pos = this.position(); + var m = this.match(/^\}/); + if (!m || !m[0]) return; - var unixify = utils.unixify(options); - var isMatch = memoize('match', pattern, options, micromatch.matcher); - var matches = []; + var brace = this.pop('brace'); + var node = pos(new Node({ + type: 'brace.close', + val: m[0] + })); - list = utils.arrayify(list); - var len = list.length; - var idx = -1; + 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; + } - while (++idx < len) { - var ele = list[idx]; - if (ele === pattern || isMatch(ele)) { - matches.push(utils.value(ele, unixify, options)); - } - } + 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 no options were passed, uniquify results and return - if (typeof options === 'undefined') { - return utils.unique(matches); - } + 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); + } + } - 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]; - } - } + brace.push(node); + }) - // if `opts.ignore` was defined, diff ignored list - if (options.ignore) { - matches = micromatch.not(matches, options.ignore, options); - } + /** + * Capture boundary characters + */ - return options.nodupes !== false ? utils.unique(matches) : matches; -}; + .set('boundary', function() { + var pos = this.position(); + var m = this.match(/^[$^](?!\{)/); + if (!m) return; + return pos(new Node({ + type: 'text', + val: m[0] + })); + }) -/** - * 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 - */ + /** + * One or zero, non-comma characters wrapped in braces + */ -micromatch.isMatch = function(str, pattern, options) { - if (typeof str !== 'string') { - throw new TypeError('expected a string: "' + util.inspect(str) + '"'); - } + .set('nobrace', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{[^,]?\}/); + if (!m) return; - if (isEmptyString(str) || isEmptyString(pattern)) { - return false; - } + var prev = this.prev(); + var val = m[0]; - var equals = utils.equalsPattern(options); - if (equals(str)) { - return true; - } + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } - var isMatch = memoize('isMatch', pattern, options, micromatch.matcher); - return isMatch(str); -}; + return pos(new Node({ + type: 'text', + multiplier: 0, + val: val + })); + }) -/** - * 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 - */ + /** + * Text + */ -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; + .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 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 + * Returns true if the character is an extglob character. */ -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; -}; +function isExtglobChar(ch) { + return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; +} /** - * 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 + * Combine text nodes, and calculate empty sets (`{,,}`) + * @param {Function} `pos` Function to calculate node position + * @param {Object} `node` AST node + * @return {Object} */ -micromatch.any = function(str, patterns, options) { - if (typeof str !== 'string') { - throw new TypeError('expected a string: "' + util.inspect(str) + '"'); - } +function concatNodes(pos, node, parent, options) { + node.orig = node.val; + var prev = this.prev(); + var last = utils.last(prev.nodes); + var isEscaped = false; - if (isEmptyString(str) || isEmptyString(patterns)) { - return 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 (typeof patterns === 'string') { - patterns = [patterns]; + if (isEscaped && options.unescape !== false) { + node.val = node.val.slice(1, node.val.length - 1); + node.escaped = true; } - for (var i = 0; i < patterns.length; i++) { - if (micromatch.isMatch(str, patterns[i], options)) { - return 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 = ''; } - 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 - */ + var simpleText = last.type === 'text' + && last.multiplier === 1 + && node.multiplier === 1 + && node.val; -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; - } + if (simpleText) { + last.val += node.val; + return; } - return true; -}; + + prev.push(node); +} + + +/***/ }), + +/***/ 38640: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var splitString = __webpack_require__(33218); +var utils = module.exports; /** - * 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 + * Module dependencies */ -micromatch.not = function(list, patterns, options) { - var opts = extend({}, options); - var ignore = opts.ignore; - delete opts.ignore; +utils.extend = __webpack_require__(92845); +utils.flatten = __webpack_require__(27299); +utils.isObject = __webpack_require__(96667); +utils.fillRange = __webpack_require__(82593); +utils.repeat = __webpack_require__(69523); +utils.unique = __webpack_require__(19009); - var unixify = utils.unixify(opts); - list = utils.arrayify(list).map(unixify); +utils.define = function(obj, key, val) { + Object.defineProperty(obj, key, { + writable: true, + configurable: true, + enumerable: false, + value: val + }); +}; - var matches = utils.diff(list, micromatch(list, patterns, opts)); - if (ignore) { - matches = utils.diff(matches, micromatch(list, ignore)); - } +/** + * Returns true if the given string contains only empty brace sets. + */ - return opts.nodupes !== false ? utils.unique(matches) : matches; +utils.isEmptySets = function(str) { + return /^(?:\{,\})+$/.test(str); }; /** - * 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 + * Returns true if the given string contains only empty brace sets. */ -micromatch.contains = function(str, patterns, options) { - if (typeof str !== 'string') { - throw new TypeError('expected a string: "' + util.inspect(str) + '"'); +utils.isQuotedString = function(str) { + var open = str.charAt(0); + if (open === '\'' || open === '"' || open === '`') { + return str.slice(-1) === open; } + return false; +}; - if (typeof patterns === 'string') { - if (isEmptyString(str) || isEmptyString(patterns)) { - 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. + */ - var equals = utils.equalsPattern(patterns, options); - if (equals(str)) { - return true; - } - var contains = utils.containsPattern(patterns, options); - if (contains(str)) { - return true; - } +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; +}; - var opts = extend({}, options, {contains: true}); - return micromatch.any(str, patterns, opts); +/** + * 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; }; /** - * Returns true if the given pattern and options should enable - * the `matchBase` option. - * @return {Boolean} - * @api private + * Join patterns in `a` to patterns in `b` */ -micromatch.matchBase = function(pattern, options) { - if (pattern && pattern.indexOf('/') !== -1 || !options) return false; - return options.basename === true || options.matchBase === true; +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; }; /** - * 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 + * Split the given string on `,` if not escaped. */ -micromatch.matchKeys = function(obj, patterns, options) { - if (!utils.isObject(obj)) { - throw new TypeError('expected the first argument to be an object'); +utils.split = function(str, options) { + var opts = utils.extend({sep: ','}, options); + if (typeof opts.keepQuotes !== 'boolean') { + opts.keepQuotes = true; } - var keys = micromatch(Object.keys(obj), patterns, options); - return utils.pick(obj, keys); + if (opts.unescape === false) { + opts.keepEscaping = true; + } + return splitString(str, opts, utils.escapeBrackets(opts)); }; /** - * 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]); + * Expand ranges or sets in the given `pattern`. * - * 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 + * @param {String} `str` + * @param {Object} `options` + * @return {Object} */ -micromatch.matcher = function matcher(pattern, options) { - if (Array.isArray(pattern)) { - return compose(pattern, options, matcher); - } +utils.expand = function(str, options) { + var opts = utils.extend({rangeLimit: 10000}, options); + var segs = utils.split(str, opts); + var tok = { segs: segs }; - // if pattern is a regex - if (pattern instanceof RegExp) { - return test(pattern); + if (utils.isQuotedString(str)) { + return tok; } - // if pattern is invalid - if (!utils.isString(pattern)) { - throw new TypeError('expected pattern to be an array, string or regex'); + if (opts.rangeLimit === true) { + opts.rangeLimit = 10000; } - // if pattern is a non-glob string - if (!utils.hasSpecialChars(pattern)) { - if (options && options.nocase === true) { - pattern = pattern.toLowerCase(); + if (segs.length > 1) { + if (opts.optimize === false) { + tok.val = segs[0]; + return tok; } - return utils.matchPath(pattern, options); - } - // if pattern is a glob string - var re = micromatch.makeRe(pattern, options); + tok.segs = utils.stringifyArray(tok.segs); + } else if (segs.length === 1) { + var arr = str.split('..'); - // if `options.matchBase` or `options.basename` is defined - if (micromatch.matchBase(pattern, options)) { - return utils.matchBasename(re, options); - } + if (arr.length === 1) { + tok.val = tok.segs[tok.segs.length - 1] || tok.val || str; + tok.segs = []; + return tok; + } - function test(regex) { - var equals = utils.equalsPattern(options); - var unixify = utils.unixify(options); + if (arr.length === 2 && arr[0] === arr[1]) { + tok.escaped = true; + tok.val = arr[0]; + tok.segs = []; + return tok; + } - return function(str) { - if (equals(str)) { - return true; + if (arr.length > 1) { + if (opts.optimize !== false) { + opts.optimize = true; + delete opts.expand; } - if (regex.test(unixify(str))) { - return true; + 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.'); + } } - return false; - }; - } - var fn = test(re); - Object.defineProperty(fn, 'result', { - configurable: true, - enumerable: false, - value: re.result - }); - return fn; + 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; }; /** - * 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 + * Ensure commas inside brackets and parens are not split. + * @param {Object} `tok` Token from the `split-string` module + * @return {undefined} */ -micromatch.capture = function(pattern, str, options) { - var re = micromatch.makeRe(pattern, extend({capture: true}, options)); - var unixify = utils.unixify(options); +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; + } - function match() { - return function(string) { - var match = re.exec(unixify(string)); - if (!match) { - return null; + if (ch === '(') { + parens.push(ch); + stack.push(ch); } - return match.slice(1); - }; - } + if (ch === '[') { + brackets.push(ch); + stack.push(ch); + } - var capture = memoize('capture', pattern, options, match); - return capture(str); + 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; + }; }; /** - * 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 + * Returns true if the given string looks like a regex quantifier + * @return {Boolean} */ -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; - }); +utils.isQuantifier = function(str) { + return /^(?:[0-9]?,[0-9]|[0-9],)$/.test(str); +}; - var regex = toRegex(output.join('|'), options); - Object.defineProperty(regex, 'result', { - configurable: true, - enumerable: false, - value: ast_array - }); - return regex; - } +/** + * Cast `val` to an array. + * @param {*} `val` + */ - return memoize('makeRe', pattern, options, makeRe); +utils.stringifyArray = function(arr) { + return [utils.arrayify(arr).join('|')]; }; /** - * 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 + * Cast `val` to an array. + * @param {*} `val` */ -micromatch.braces = function(pattern, options) { - if (typeof pattern !== 'string' && !Array.isArray(pattern)) { - throw new TypeError('expected pattern to be an array or string'); +utils.arrayify = function(arr) { + if (typeof arr === 'undefined') { + return []; } - - function expand() { - if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) { - return utils.arrayify(pattern); - } - return braces(pattern, options); + if (typeof arr === 'string') { + return [arr]; } - - return memoize('braces', pattern, options, expand); + return arr; }; /** - * Proxy to the [micromatch.braces](#method), for parity with - * minimatch. + * Returns true if the given `str` is a non-empty string + * @return {Boolean} */ -micromatch.braceExpand = function(pattern, options) { - var opts = extend({}, options, {expand: true}); - return micromatch.braces(pattern, opts); +utils.isString = function(str) { + return str != null && typeof str === 'string'; }; /** - * 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 + * Get the last element from `array` + * @param {Array} `array` + * @return {*} */ -micromatch.create = function(pattern, options) { - return memoize('create', pattern, options, function() { - function create(str, opts) { - return micromatch.compile(micromatch.parse(str, opts), opts); - } +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; - pattern = micromatch.braces(pattern, options); - var len = pattern.length; - var idx = -1; - var res = []; +utils.escapeRegex = function(str) { + return str.replace(/\\?([!^*?()[\]{}+?/])/g, '\\$1'); +}; - while (++idx < len) { - res.push(create(pattern[idx], options)); + +/***/ }), + +/***/ 92845: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var isObject = __webpack_require__(4585); + +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 res; - }); + } + return o; }; -/** - * 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 +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`. */ -micromatch.parse = function(pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('expected a string'); - } +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} - 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); -}; +/***/ 4585: +/***/ (function(module) { -/** - * Compile the given `ast` or string with the given `options`. - * - * ```js - * var mm = require('micromatch'); - * mm.compile(ast[, options]); +"use strict"; +/*! + * is-extendable * - * 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 + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. */ -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); - }); + +module.exports = function isExtendable(val) { + return typeof val !== 'undefined' && val !== null + && (typeof val === 'object' || typeof val === 'function'); }; -/** - * Clear the regex cache. + +/***/ }), + +/***/ 35851: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/*! + * define-property * - * ```js - * mm.clearCache(); - * ``` - * @api public + * Copyright (c) 2015-2018, Jon Schlinkert. + * Released under the MIT License. */ -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) === './'; -} +var isobject = __webpack_require__(96667); +var isDescriptor = __webpack_require__(44133); +var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) + ? Reflect.defineProperty + : Object.defineProperty; -/** - * Compose a matcher function with the given patterns. - * This allows matcher functions to be compiled once and - * called multiple times. - */ +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'); + } -function compose(patterns, options, matcher) { - var matchers; + if (typeof key !== 'string') { + throw new TypeError('expected "key" to be a string'); + } - 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)); - } - } + if (isDescriptor(val)) { + define(obj, key, val); + return obj; + } - var len = matchers.length; - while (len--) { - if (matchers[len](file) === true) { - return true; - } - } - return false; - }; + define(obj, key, { + configurable: true, + enumerable: false, + writable: true, + value: val }); -} -/** - * Memoize a generated regex or function. A unique key is generated - * from the `type` (usually method name), the `pattern`, and - * user-defined options. - */ + return obj; +}; -function memoize(type, pattern, options, fn) { - var key = utils.createKey(type + '=' + pattern, options); - if (options && options.cache === false) { - return fn(pattern, options); +/***/ }), + +/***/ 3767: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var isExtendable = __webpack_require__(98775); +var assignSymbols = __webpack_require__(64353); + +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; +}; - if (cache.has(type, key)) { - return cache.get(type, key); +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } } +} - var val = fn(pattern, options); - cache.set(type, key, val); - return val; +function isString(val) { + return (val && typeof val === 'string'); } -/** - * Expose compiler, parser and cache on `micromatch` - */ +function toObject(str) { + var obj = {}; + for (var i in str) { + obj[i] = str[i]; + } + return obj; +} -micromatch.compilers = compilers; -micromatch.parsers = parsers; -micromatch.caches = cache.caches; +function isObject(val) { + return (val && typeof val === 'object') || isExtendable(val); +} /** - * Expose `micromatch` - * @type {Function} + * Returns true if the given `key` is an own property of `obj`. */ -module.exports = micromatch; - - -/***/ }), - -/***/ 34743: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} -module.exports = new (__webpack_require__(49908))(); +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); +} /***/ }), -/***/ 26113: +/***/ 82593: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +/*! + * fill-range + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ -var nanomatch = __webpack_require__(57925); -var extglob = __webpack_require__(66675); - -module.exports = function(snapdragon) { - var compilers = snapdragon.compiler.compilers; - var opts = snapdragon.options; - // register nanomatch compilers - snapdragon.use(nanomatch.compilers); +var util = __webpack_require__(31669); +var isNumber = __webpack_require__(87218); +var extend = __webpack_require__(13342); +var repeat = __webpack_require__(6332); +var toRegex = __webpack_require__(11846); - // 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; +/** + * 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} + */ - // register extglob compilers or escape exglobs if disabled - if (opts.extglob === false || opts.noext === true) { - snapdragon.compiler.use(escapeExtglobs); - } else { - snapdragon.use(extglob.compilers); +function fillRange(start, stop, step, options) { + if (typeof start === 'undefined') { + return []; } - snapdragon.use(function() { - this.options.star = this.options.star || function(/*node*/) { - return '[^\\\\/]*?'; - }; - }); - - // custom micromatch compilers - snapdragon.compiler + 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]; + } - // reset referenced compiler - .set('dot', dot) - .set('escape', escape) - .set('plus', plus) - .set('slash', slash) - .set('qmark', qmark) - .set('star', star) - .set('text', text); -}; + if (typeof step !== 'number' && typeof step !== 'string') { + options = step; + step = undefined; + } -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); - }); + if (typeof options === 'function') { + options = { transform: options }; + } - /** - * Visit `node` with the given `fn` - */ + 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 []; + } - function visit(node, fn) { - return node.nodes ? mapVisit(node.nodes, fn) : fn(node); + 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 []; } - /** - * Map visit over array of `nodes`. - */ + opts.isPadded = isPadded(start) || isPadded(stop); + opts.toString = opts.stringify + || typeof opts.step === 'string' + || typeof start === 'string' + || typeof stop === 'string' + || !opts.isNumber; - function mapVisit(nodes, fn) { - var len = nodes.length; - var idx = -1; - while (++idx < len) { - visit(nodes[idx], fn); - } + 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); + } -/***/ 14086: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var zero = {greater: [], lesser: []}; + var asc = a < b; + var arr = new Array(Math.round((asc ? b - a : a - b) / step)); + var idx = 0; -"use strict"; + 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); + } -var extglob = __webpack_require__(66675); -var nanomatch = __webpack_require__(57925); -var regexNot = __webpack_require__(30931); -var toRegex = __webpack_require__(51279); -var not; + if (options.toString) { + val = String(val); + } -/** - * Characters to use in negation regex (we want to "not" match - * characters that are matched by other parsers) - */ + if (typeof options.transform === 'function') { + arr[idx++] = options.transform(val, a, b, step, idx, arr, options); + } else { + arr[idx++] = val; + } -var TEXT = '([!@*?+]?\\(|\\)|\\[:?(?=.*?:?\\])|:?\\]|[*+?!^$.\\\\/])+'; -var createNotRegex = function(opts) { - return not || (not = textRegex(TEXT)); -}; + if (asc) { + a += step; + } else { + a -= step; + } + } -/** - * Parsers - */ + if (options.toRegex === true) { + return toSequence(arr, zero, options); + } + return arr; +} -module.exports = function(snapdragon) { - var parsers = snapdragon.parser.parsers; +function toRange(a, b, start, stop, options) { + if (options.isPadded) { + return toRegex(start, stop, options); + } - // register nanomatch parsers - snapdragon.use(nanomatch.parsers); + if (options.isNumber) { + return toRegex(Math.min(a, b), Math.max(a, b), options); + } - // 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; + var start = String.fromCharCode(Math.min(a, b)); + var stop = String.fromCharCode(Math.max(a, b)); + return '[' + start + '-' + stop + ']'; +} - // register extglob parsers - snapdragon.use(extglob.parsers); +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; - // 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) + if (options.capture) { + return '(' + res + ')'; + } + return res; +} - /** - * Override `text` parser - */ +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; +} - .capture('text', function() { - if (this.isInside('bracket')) return; - var pos = this.position(); - var m = this.match(createNotRegex(this.options)); - if (!m || !m[0]) return; +function toNumber(val) { + return Number(val) || 0; +} - // escape regex boundary characters and simple brackets - var val = m[0].replace(/([[\]^$])/g, '\\$1'); +function isPadded(str) { + return /^-?0\d/.test(str); +} - return pos({ - type: 'text', - val: val - }); - }); -}; +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); +} /** - * Create text regex + * Expose `fillRange` + * @type {Function} */ -function textRegex(pattern) { - var notStr = regexNot.create(pattern, {contains: true, strictClose: false}); - var prefix = '(?:[\\^]|\\\\|'; - return toRegex(prefix + notStr + ')', {strictClose: false}); -} +module.exports = fillRange; /***/ }), -/***/ 63976: +/***/ 13342: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -var utils = module.exports; -var path = __webpack_require__(85622); - -/** - * Module dependencies - */ - -var Snapdragon = __webpack_require__(79285); -utils.define = __webpack_require__(35851); -utils.diff = __webpack_require__(9455); -utils.extend = __webpack_require__(3767); -utils.pick = __webpack_require__(38509); -utils.typeOf = __webpack_require__(19613); -utils.unique = __webpack_require__(19009); - -/** - * 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); - } +var isObject = __webpack_require__(27244); - utils.define(snapdragon, 'parse', function(str, options) { - var parsed = Snapdragon.prototype.parse.apply(this, arguments); - parsed.input = str; +module.exports = function extend(o/*, objects*/) { + if (!isObject(o)) { o = {}; } - // 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; - } + var len = arguments.length; + for (var i = 1; i < len; i++) { + var obj = arguments[i]; - } else { - open.val = '\\' + open.val; - var sibling = open.parent.nodes[1]; - if (sibling.type === 'star') { - sibling.loose = true; - } - } + if (isObject(obj)) { + assign(o, obj); } - - // add non-enumerable parser reference - utils.define(parsed, 'parser', this.parser); - return parsed; - }); - - return snapdragon; + } + return o; }; -/** - * 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]); +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } } - return val; -}; +} /** - * Cast `val` to an array - * @return {Array} + * Returns true if the given `key` is an own property of `obj`. */ -utils.arrayify = function(val) { - if (typeof val === 'string') return [val]; - return val ? (Array.isArray(val) ? val : [val]) : []; -}; +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} -/** - * 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 +/***/ 27244: +/***/ (function(module) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. */ -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); +module.exports = function isExtendable(val) { + return typeof val !== 'undefined' && val !== null + && (typeof val === 'object' || typeof val === 'function'); }; -/** - * Escape regex characters in the given string - */ -utils.escapeRegex = function(str) { - return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&'); -}; +/***/ }), -/** - * Normalize slashes in the given filepath. +/***/ 98775: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable * - * @param {String} `filepath` - * @return {String} + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. */ -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, '')); +var isPlainObject = __webpack_require__(81064); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); }; -/** - * 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 - */ +/***/ 19613: +/***/ (function(module) { -utils.isSlash = function(str) { - return str === '/' || str === '\\/' || str === '\\' || str === '\\\\'; -}; +var toString = Object.prototype.toString; -/** - * Returns a function that returns true if the given - * pattern matches or contains a `filepath` - * - * @param {String} `pattern` - * @return {Function} - */ +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; -utils.matchPath = function(pattern, options) { - return (options && options.contains) - ? utils.containsPattern(pattern, options) - : utils.equalsPattern(pattern, options); -}; + 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'; + } -/** - * Returns true if the given (original) filepath or unixified path are equal - * to the given pattern. - */ + 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'; -utils._equals = function(filepath, unixPath, pattern) { - return pattern === filepath || pattern === unixPath; -}; + 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'; -/** - * Returns true if the given (original) filepath or unixified path contain - * the given pattern. - */ + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; -utils._contains = function(filepath, unixPath, pattern) { - return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1; -}; + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; -/** - * Returns a function that returns true if the given - * pattern is the same as a given `filepath` - * - * @param {String} `pattern` - * @return {Function} - */ + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } -utils.equalsPattern = function(pattern, options) { - var unixify = utils.unixify(options); - options = options || {}; + if (isGeneratorObj(val)) { + return 'generator'; + } - 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); - }; + // 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, ''); }; -/** - * Returns a function that returns true if the given - * pattern contains a `filepath` - * - * @param {String} `pattern` - * @return {Function} - */ +function ctorName(val) { + return typeof val.constructor === 'function' ? val.constructor.name : null; +} -utils.containsPattern = function(pattern, options) { - var unixify = utils.unixify(options); - options = options || {}; +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} - 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); - }; -}; +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} -/** - * Returns a function that returns true if the given - * regex matches the `filename` of a file path. - * - * @param {RegExp} `re` Matching regex - * @return {Function} - */ +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} -utils.matchBasename = function(re) { - return function(filepath) { - return re.test(path.basename(filepath)); - }; -}; +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'; +} -/** - * Determines the filepath to return based on the provided options. - * @return {any} - */ +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} -utils.value = function(str, unixify, options) { - if (options && options.unixify === false) { - return str; +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 unixify(str); -}; + return false; +} /** - * Returns a function that normalizes slashes in a string to forward - * slashes, strips `./` from beginning of paths, and optionally unescapes - * special characters. - * @return {Function} + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer */ -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; - }; -}; +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} /***/ }), -/***/ 35851: +/***/ 11846: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /*! - * define-property + * to-regex-range * - * Copyright (c) 2015-2018, Jon Schlinkert. + * Copyright (c) 2015, 2017, Jon Schlinkert. * Released under the MIT License. */ -var isobject = __webpack_require__(96667); -var isDescriptor = __webpack_require__(44133); -var define = (typeof Reflect !== 'undefined' && Reflect.defineProperty) - ? Reflect.defineProperty - : Object.defineProperty; +var repeat = __webpack_require__(6332); +var isNumber = __webpack_require__(87218); +var cache = {}; -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'); +function toRegexRange(min, max, options) { + if (isNumber(min) === false) { + throw new RangeError('toRegexRange: first argument is invalid.'); } - if (typeof key !== 'string') { - throw new TypeError('expected "key" to be a string'); + if (typeof max === 'undefined' || min === max) { + return String(min); } - if (isDescriptor(val)) { - define(obj, key, val); - return obj; + if (isNumber(max) === false) { + throw new RangeError('toRegexRange: second argument is invalid.'); } - define(obj, key, { - configurable: true, - enumerable: false, - writable: true, - value: val - }); - - return obj; -}; - - -/***/ }), - -/***/ 3767: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + 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; + } -"use strict"; + 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 isExtendable = __webpack_require__(98775); -var assignSymbols = __webpack_require__(64353); + var isPadded = padding(min) || padding(max); + var positives = []; + var negatives = []; -module.exports = Object.assign || function(obj/*, objects*/) { - if (obj === null || typeof obj === 'undefined') { - throw new TypeError('Cannot convert undefined or null to object'); + var tok = {min: min, max: max, a: a, b: b}; + if (isPadded) { + tok.isPadded = isPadded; + tok.maxLen = String(tok.max).length; } - if (!isObject(obj)) { - obj = {}; + + 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; } - 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); - } + + if (b >= 0) { + positives = splitToPatterns(a, b, tok, options); } - return obj; -}; -function assign(a, b) { - for (var key in b) { - if (hasOwn(b, key)) { - a[key] = b[key]; - } + 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 isString(val) { - return (val && typeof val === 'string'); +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 toObject(str) { - var obj = {}; - for (var i in str) { - obj[i] = str[i]; +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); } - return obj; -} -function isObject(val) { - return (val && typeof val === 'object') || isExtendable(val); + 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; } /** - * Returns true if the given `key` is an own property of `obj`. + * Convert a range to a regex pattern + * @param {Number} `start` + * @param {Number} `stop` + * @return {String} */ -function hasOwn(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -function isEnum(obj, key) { - return Object.prototype.propertyIsEnumerable.call(obj, key); -} +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; -/***/ 98775: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + while (++i < len) { + var numbers = zipped[i]; + var startDigit = numbers[0]; + var stopDigit = numbers[1]; -"use strict"; -/*! - * is-extendable - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */ + if (startDigit === stopDigit) { + pattern += startDigit; + } else if (startDigit !== '0' || stopDigit !== '9') { + pattern += toCharacterClass(startDigit, stopDigit); + } else { + digits += 1; + } + } -var isPlainObject = __webpack_require__(81064); + if (digits) { + pattern += options.shorthand ? '\\d' : '[0-9]'; + } -module.exports = function isExtendable(val) { - return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); -}; + 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; -/***/ 19613: -/***/ (function(module) { + while (++idx < len) { + var range = ranges[idx]; + var obj = rangeToPattern(start, range, options); + var zeros = ''; -var toString = Object.prototype.toString; + 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; + } -module.exports = function kindOf(val) { - if (val === void 0) return 'undefined'; - if (val === null) return 'null'; + if (tok.isPadded) { + zeros = padZeros(range, tok); + } - 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'; + obj.string = zeros + obj.pattern + toQuantifier(obj.digits); + tokens.push(obj); + start = range + 1; + prev = obj; } - 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'; + return tokens; +} - // Set, Map, WeakSet, WeakMap - case 'WeakMap': return 'weakmap'; - case 'WeakSet': return 'weakset'; - case 'Map': return 'map'; - case 'Set': return 'set'; +function filterPatterns(arr, comparison, prefix, intersection, options) { + var res = []; - // 8-bit typed arrays - case 'Int8Array': return 'int8array'; - case 'Uint8Array': return 'uint8array'; - case 'Uint8ClampedArray': return 'uint8clampedarray'; + for (var i = 0; i < arr.length; i++) { + var tok = arr[i]; + var ele = tok.string; - // 16-bit typed arrays - case 'Int16Array': return 'int16array'; - case 'Uint16Array': return 'uint16array'; + 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); + } + } + } - // 32-bit typed arrays - case 'Int32Array': return 'int32array'; - case 'Uint32Array': return 'uint32array'; - case 'Float32Array': return 'float32array'; - case 'Float64Array': return 'float64array'; - } + if (!intersection && !contains(comparison, 'string', ele)) { + res.push(prefix + ele); + } - if (isGeneratorObj(val)) { - return 'generator'; + if (intersection && contains(comparison, 'string', ele)) { + res.push(prefix + ele); + } } + return res; +} - // 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'; - } +/** + * Zip strings (`for in` can be used on string characters) + */ - // other - return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); -}; +function zip(a, b) { + var arr = []; + for (var ch in a) arr.push([a[ch], b[ch]]); + return arr; +} -function ctorName(val) { - return typeof val.constructor === 'function' ? val.constructor.name : null; +function compare(a, b) { + return a > b ? 1 : b > a ? -1 : 0; } -function isArray(val) { - if (Array.isArray) return Array.isArray(val); - return val instanceof Array; +function push(arr, ele) { + if (arr.indexOf(ele) === -1) arr.push(ele); + return arr; } -function isError(val) { - return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +function contains(arr, key, val) { + for (var i = 0; i < arr.length; i++) { + if (arr[i][key] === val) { + return true; + } + } + return false; } -function isDate(val) { - if (val instanceof Date) return true; - return typeof val.toDateString === 'function' - && typeof val.getDate === 'function' - && typeof val.setDate === 'function'; +function countNines(min, len) { + return String(min).slice(0, -len) + repeat('9', len); } -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 countZeros(integer, zeros) { + return integer - (integer % Math.pow(10, zeros)); } -function isGeneratorFn(name, val) { - return ctorName(name) === 'GeneratorFunction'; +function toQuantifier(digits) { + var start = digits[0]; + var stop = digits[1] ? (',' + digits[1]) : ''; + if (!stop && (!start || start === 1)) { + return ''; + } + return '{' + start + stop + '}'; } -function isGeneratorObj(val) { - return typeof val.throw === 'function' - && typeof val.return === 'function' - && typeof val.next === 'function'; +function toCharacterClass(a, b) { + return '[' + a + ((b - a === 1) ? '' : '-') + b + ']'; } -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; +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 false; + return val; } /** - * If you need to support Safari 5-7 (8-10 yr-old browser), - * take a look at https://github.com/feross/is-buffer + * Expose `toRegexRange` */ -function isBuffer(val) { - if (val.constructor && typeof val.constructor.isBuffer === 'function') { - return val.constructor.isBuffer(val); - } - return false; -} +module.exports = toRegexRange; /***/ }), @@ -41479,1720 +41905,1222 @@ if (process.env.READABLE_STREAM === 'disable' && Stream) { /***/ 30931: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; - - -var extend = __webpack_require__(39700); -var safe = __webpack_require__(71217); - -/** - * 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; - - -/***/ }), - -/***/ 39700: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -var isExtendable = __webpack_require__(93295); -var assignSymbols = __webpack_require__(64353); - -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); -} - - -/***/ }), - -/***/ 93295: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/*! - * is-extendable - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */ - - - -var isPlainObject = __webpack_require__(81064); - -module.exports = function isExtendable(val) { - return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); -}; - - -/***/ }), - -/***/ 69523: -/***/ (function(module) { - -"use strict"; -/*! - * 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; -}; - - -/***/ }), - -/***/ 6332: -/***/ (function(module) { - -"use strict"; -/*! - * repeat-string - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - - +"use strict"; -/** - * Results cache - */ -var res = ''; -var cache; +var extend = __webpack_require__(39700); +var safe = __webpack_require__(71217); /** - * Expose `repeat` + * 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 */ -module.exports = repeat; +function toRegex(pattern, options) { + return new RegExp(toRegex.create(pattern, options)); +} /** - * Repeat the given `string` the specified `number` - * of times. - * - * **Example:** + * Create a regex-compatible string from the given `pattern` and `options`. * * ```js - * var repeat = require('repeat-string'); - * repeat('A', 5); - * //=> AAAAA + & var not = require('regex-not'); + & console.log(not.create('foo')); + & //=> '^(?:(?!^(?:foo)$).)*$' * ``` - * - * @param {String} `string` The string to repeat - * @param {Number} `number` The number of times to repeat the string - * @return {String} Repeated string + * @param {String} `pattern` + * @param {Object} `options` + * @return {String} * @api public */ -function repeat(str, num) { - if (typeof str !== 'string') { +toRegex.create = function(pattern, options) { + if (typeof pattern !== '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); + var opts = extend({}, options); + if (opts.contains === true) { + opts.strictNegate = false; } - while (max > res.length && num > 1) { - if (num & 1) { - res += str; - } + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var endChar = opts.endChar ? opts.endChar : '+'; + var str = pattern; - num >>= 1; - str += str; + if (opts.strictNegate === false) { + str = '(?:(?!(?:' + pattern + ')).)' + endChar; + } else { + str = '(?:(?!^(?:' + pattern + ')$).)' + endChar; } - res += str; - res = res.substr(0, max); - return res; -} - - -/***/ }), - -/***/ 25622: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var util = __webpack_require__(10265); -var types = __webpack_require__(40432); -var sets = __webpack_require__(28135); -var positions = __webpack_require__(54771); - - -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(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; + var res = open + str + close; + if (opts.safe === true && safe(res) === false) { + throw new Error('potentially unsafe regular expression: ' + res); + } - 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) }); + return res; +}; - // Escaped character. - } else { - last.push({ type: types.CHAR, value: c.charCodeAt(0) }); - } - } +/** + * Expose `toRegex` + */ - break; +module.exports = toRegex; - // Positionals. - case '^': - last.push(positions.begin()); - break; +/***/ }), - case '$': - last.push(positions.end()); - break; +/***/ 39700: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +"use strict"; - // 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); +var isExtendable = __webpack_require__(93295); +var assignSymbols = __webpack_require__(64353); - // Increase index by length of class. - i += classTokens[1]; - last.push({ - type: types.SET, - set: classTokens[0], - not: not, - }); +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; +}; - break; +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'); +} - // Class of any character except \n. - case '.': - last.push(sets.anyChar()); - break; +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); +} - // Push group onto stack. - case '(': - // Create group. - var group = { - type: types.GROUP, - stack: [], - remember: true, - }; +/** + * Returns true if the given `key` is an own property of `obj`. + */ - c = str[i]; +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} - // If if this is a special kind of group. - if (c === '?') { - c = str[i + 1]; - i += 2; +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); +} - // 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)); - } +/***/ 93295: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - group.remember = false; - } +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ - // 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; +var isPlainObject = __webpack_require__(81064); +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; - // 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; +/***/ }), +/***/ 69523: +/***/ (function(module) { - // 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; - } +"use strict"; +/*! + * repeat-element + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Licensed under the MIT license. + */ - // 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; +module.exports = function repeat(ele, num) { + var arr = new Array(num); - last.push({ - type: types.REPETITION, - min: min, - max: max, - value: last.pop(), - }); - } else { - last.push({ - type: types.CHAR, - value: 123, - }); - } - break; + for (var i = 0; i < num; i++) { + arr[i] = ele; + } - case '?': - if (last.length === 0) { - repeatErr(i); - } - last.push({ - type: types.REPETITION, - min: 0, - max: 1, - value: last.pop(), - }); - break; + return arr; +}; - 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; +/***/ }), +/***/ 6332: +/***/ (function(module) { - // Default is a character that is not `\[](){}?+*^$`. - default: - last.push({ - type: types.CHAR, - value: c.charCodeAt(0), - }); - } +"use strict"; +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ - } - // Check if any groups have not been closed. - if (groupStack.length !== 0) { - util.error(regexpStr, 'Unterminated group'); - } - return start; -}; +/** + * Results cache + */ -module.exports.types = types; +var res = ''; +var cache; +/** + * Expose `repeat` + */ -/***/ }), +module.exports = repeat; -/***/ 54771: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/** + * 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 + */ -var types = __webpack_require__(40432); +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } -exports.wordBoundary = function() { - return { type: types.POSITION, value: 'b' }; -}; + // cover common, quick use cases + if (num === 1) return str; + if (num === 2) return str + str; -exports.nonWordBoundary = function() { - return { type: types.POSITION, value: 'B' }; -}; + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } else if (res.length >= max) { + return res.substr(0, max); + } -exports.begin = function() { - return { type: types.POSITION, value: '^' }; -}; + while (max > res.length && num > 1) { + if (num & 1) { + res += str; + } -exports.end = function() { - return { type: types.POSITION, value: '$' }; -}; + num >>= 1; + str += str; + } + + res += str; + res = res.substr(0, max); + return res; +} /***/ }), -/***/ 28135: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 25622: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -var types = __webpack_require__(40432); +var util = __webpack_require__(10265); +var types = __webpack_require__(40432); +var sets = __webpack_require__(28135); +var positions = __webpack_require__(54771); -var INTS = function() { - return [{ type: types.RANGE , from: 48, to: 57 }]; -}; -var WORDS = function() { - return [ - { type: types.CHAR, value: 95 }, - { type: types.RANGE, from: 97, to: 122 }, - { type: types.RANGE, from: 65, to: 90 } - ].concat(INTS()); -}; +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 WHITESPACE = function() { - 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() { - return [ - { type: types.CHAR, value: 10 }, - { type: types.CHAR, value: 13 }, - { type: types.CHAR, value: 8232 }, - { type: types.CHAR, value: 8233 }, - ]; -}; + var repeatErr = function(i) { + util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1)); + }; -// Predefined class objects. -exports.words = function() { - return { type: types.SET, set: WORDS(), not: false }; -}; + // Decode a few escaped characters. + var str = util.strToChars(regexpStr); + l = str.length; -exports.notWords = function() { - return { type: types.SET, set: WORDS(), not: true }; -}; + // Iterate through each character in string. + while (i < l) { + c = str[i++]; -exports.ints = function() { - return { type: types.SET, set: INTS(), not: false }; -}; + switch (c) { + // Handle escaped characters, inclues a few sets. + case '\\': + c = str[i++]; -exports.notInts = function() { - return { type: types.SET, set: INTS(), not: true }; -}; + switch (c) { + case 'b': + last.push(positions.wordBoundary()); + break; -exports.whitespace = function() { - return { type: types.SET, set: WHITESPACE(), not: false }; -}; + case 'B': + last.push(positions.nonWordBoundary()); + break; -exports.notWhitespace = function() { - return { type: types.SET, set: WHITESPACE(), not: true }; -}; + case 'w': + last.push(sets.words()); + break; -exports.anyChar = function() { - return { type: types.SET, set: NOTANYCHAR(), not: true }; -}; + case 'W': + last.push(sets.notWords()); + break; + case 'd': + last.push(sets.ints()); + break; -/***/ }), + case 'D': + last.push(sets.notInts()); + break; -/***/ 40432: -/***/ (function(module) { + case 's': + last.push(sets.whitespace()); + break; -module.exports = { - ROOT : 0, - GROUP : 1, - POSITION : 2, - SET : 3, - RANGE : 4, - REPETITION : 5, - REFERENCE : 6, - CHAR : 7, -}; + 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) }); + } + } -/***/ 10265: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + break; -var types = __webpack_require__(40432); -var sets = __webpack_require__(28135); + // Positionals. + case '^': + last.push(positions.begin()); + break; -// All of these are private and only used by randexp. -// It's assumed that they will always be called with the correct input. + case '$': + last.push(positions.end()); + break; -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; - } + // Handle custom sets. + case '[': + // Check if this class is 'anti' i.e. [^abc]. + var not; + if (str[i] === '^') { + not = true; + i++; + } else { + not = false; + } - var code = b ? 8 : - a16 ? parseInt(a16, 16) : - b16 ? parseInt(b16, 16) : - c8 ? parseInt(c8, 8) : - dctrl ? CTRL.indexOf(dctrl) : - SLSH[eslsh]; + // Get all the characters in class. + var classTokens = util.tokenizeClass(str.slice(i), regexpStr); - var c = String.fromCharCode(code); + // Increase index by length of class. + i += classTokens[1]; + last.push({ + type: types.SET, + set: classTokens[0], + not: not, + }); - // Escape special regex characters. - if (/[\[\]{}\^$.|?*+()]/.test(c)) { - c = '\\' + c; - } + break; - return c; - }); - return str; -}; + // Class of any character except \n. + case '.': + last.push(sets.anyChar()); + break; -/** - * turns class into tokens - * reads str until it encounters a ] not preceeded by a \ - * - * @param {String} str - * @param {String} regexpStr - * @return {Array., Number>} - */ -exports.tokenizeClass = function(str, regexpStr) { - /* jshint maxlen: false */ - var tokens = []; - var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g; - var rs, c; + // Push group onto stack. + case '(': + // Create group. + var group = { + type: types.GROUP, + stack: [], + remember: true, + }; + c = str[i]; - while ((rs = regexp.exec(str)) != null) { - if (rs[1]) { - tokens.push(sets.words()); + // If if this is a special kind of group. + if (c === '?') { + c = str[i + 1]; + i += 2; - } else if (rs[2]) { - tokens.push(sets.ints()); + // Match if followed by. + if (c === '=') { + group.followedBy = true; - } else if (rs[3]) { - tokens.push(sets.whitespace()); + // Match if not followed by. + } else if (c === '!') { + group.notFollowedBy = true; - } else if (rs[4]) { - tokens.push(sets.notWords()); + } else if (c !== ':') { + util.error(regexpStr, + 'Invalid group, character \'' + c + + '\' after \'?\' at column ' + (i - 1)); + } - } else if (rs[5]) { - tokens.push(sets.notInts()); + group.remember = false; + } - } else if (rs[6]) { - tokens.push(sets.notWhitespace()); + // Insert subgroup into current group stack. + last.push(group); - } else if (rs[7]) { - tokens.push({ - type: types.RANGE, - from: (rs[8] || rs[9]).charCodeAt(0), - to: rs[10].charCodeAt(0), - }); + // Remember the current group for when the group closes. + groupStack.push(lastGroup); - } else if (c = rs[12]) { - tokens.push({ - type: types.CHAR, - value: c.charCodeAt(0), - }); + // Make this new group the current group. + lastGroup = group; + last = group.stack; + break; - } else { - return [tokens, regexp.lastIndex]; - } - } - exports.error(regexpStr, 'Unterminated character class'); -}; + // 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; -/** - * Shortcut to throw errors. - * - * @param {String} regexp - * @param {String} msg - */ -exports.error = function(regexp, msg) { - throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg); -}; + // 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; -/***/ 71217: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -var parse = __webpack_require__(25622); -var types = parse.types; + // 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; -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; + last.push({ + type: types.REPETITION, + min: min, + max: max, + value: last.pop(), + }); + } else { + last.push({ + type: types.CHAR, + value: 123, + }); } - - 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; - } + break; + + case '?': + if (last.length === 0) { + repeatErr(i); } - 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; + last.push({ + type: types.REPETITION, + min: 0, + max: 1, + value: last.pop(), + }); + break; + + case '+': + if (last.length === 0) { + repeatErr(i); } - - return true; - })(re, 0); -}; + last.push({ + type: types.REPETITION, + min: 1, + max: Infinity, + value: last.pop(), + }); + break; -function isRegExp (x) { - return {}.toString.call(x) === '[object RegExp]'; -} + 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), + }); + } -/***/ 85841: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + } -"use strict"; -/* -Copyright (c) 2014, Yahoo! Inc. All rights reserved. -Copyrights licensed under the New BSD License. -See the accompanying LICENSE file for terms. -*/ + // Check if any groups have not been closed. + if (groupStack.length !== 0) { + util.error(regexpStr, 'Unterminated group'); + } + return start; +}; +module.exports.types = types; -var randomBytes = __webpack_require__(79822); -// Generate an internal UID to make the regexp pattern harder to guess. -var UID_LENGTH = 16; -var UID = generateUID(); -var PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|U|I)-' + UID + '-(\\d+)__@"', 'g'); +/***/ }), -var IS_NATIVE_CODE_REGEXP = /\{\s*\[native code\]\s*\}/g; -var IS_PURE_FUNCTION = /function.*?\(/; -var IS_ARROW_FUNCTION = /.*?=>.*?/; -var UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g; +/***/ 54771: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -var RESERVED_SYMBOLS = ['*', 'async']; +var types = __webpack_require__(40432); -// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their -// Unicode char counterparts which are safe to use in JavaScript strings. -var ESCAPED_CHARS = { - '<' : '\\u003C', - '>' : '\\u003E', - '/' : '\\u002F', - '\u2028': '\\u2028', - '\u2029': '\\u2029' +exports.wordBoundary = function() { + return { type: types.POSITION, value: 'b' }; }; -function escapeUnsafeChars(unsafeChar) { - return ESCAPED_CHARS[unsafeChar]; -} - -function generateUID() { - var bytes = randomBytes(UID_LENGTH); - var result = ''; - for(var i=0; i arg1+5 - if(IS_ARROW_FUNCTION.test(serializedFn)) { - return serializedFn; - } +/***/ }), - var argsStartsAt = serializedFn.indexOf('('); - var def = serializedFn.substr(0, argsStartsAt) - .trim() - .split(' ') - .filter(function(val) { return val.length > 0 }); +/***/ 40432: +/***/ (function(module) { - var nonReservedSymbols = def.filter(function(val) { - return RESERVED_SYMBOLS.indexOf(val) === -1 - }); +module.exports = { + ROOT : 0, + GROUP : 1, + POSITION : 2, + SET : 3, + RANGE : 4, + REPETITION : 5, + REFERENCE : 6, + CHAR : 7, +}; - // enhanced literal objects, example: {key() {}} - if(nonReservedSymbols.length > 0) { - return (def.indexOf('async') > -1 ? 'async ' : '') + 'function' - + (def.join('').indexOf('*') > -1 ? '*' : '') - + serializedFn.substr(argsStartsAt); - } - // arrow functions - return serializedFn; - } +/***/ }), - // Check if the parameter is function - if (options.ignoreFunction && typeof obj === "function") { - obj = undefined; - } - // Protects against `JSON.stringify()` returning `undefined`, by serializing - // to the literal string: "undefined". - if (obj === undefined) { - return String(obj); - } +/***/ 10265: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - var str; +var types = __webpack_require__(40432); +var sets = __webpack_require__(28135); - // Creates a JSON string representation of the value. - // NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args. - if (options.isJSON && !options.space) { - str = JSON.stringify(obj); - } else { - str = JSON.stringify(obj, options.isJSON ? null : replacer, options.space); - } - // Protects against `JSON.stringify()` returning `undefined`, by serializing - // to the literal string: "undefined". - if (typeof str !== 'string') { - return String(str); - } +// All of these are private and only used by randexp. +// It's assumed that they will always be called with the correct input. - // Replace unsafe HTML and invalid JavaScript line terminator chars with - // their safe Unicode char counterpart. This _must_ happen before the - // regexps and functions are serialized and added back to the string. - if (options.unsafe !== true) { - str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars); - } +var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?'; +var SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 }; - if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && undefs.length === 0 && infinities.length === 0) { - return str; +/** + * 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; } - // Replaces all occurrences of function, regexp, date, map and set placeholders in the - // JSON string with their string representations. If the original value can - // not be found, then `undefined` is used. - return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) { - // The placeholder may not be preceded by a backslash. This is to prevent - // replacing things like `"a\"@__R--0__@"` and thus outputting - // invalid JS. - if (backSlash) { - return match; - } + var code = b ? 8 : + a16 ? parseInt(a16, 16) : + b16 ? parseInt(b16, 16) : + c8 ? parseInt(c8, 8) : + dctrl ? CTRL.indexOf(dctrl) : + SLSH[eslsh]; - if (type === 'D') { - return "new Date(\"" + dates[valueIndex].toISOString() + "\")"; - } + var c = String.fromCharCode(code); - if (type === 'R') { - return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")"; - } + // Escape special regex characters. + if (/[\[\]{}\^$.|?*+()]/.test(c)) { + c = '\\' + c; + } - if (type === 'M') { - return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")"; - } + return c; + }); - if (type === 'S') { - return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")"; - } + return str; +}; - if (type === 'U') { - return 'undefined' - } - if (type === 'I') { - return infinities[valueIndex]; - } +/** + * turns class into tokens + * reads str until it encounters a ] not preceeded by a \ + * + * @param {String} str + * @param {String} regexpStr + * @return {Array., Number>} + */ +exports.tokenizeClass = function(str, regexpStr) { + /* jshint maxlen: false */ + var tokens = []; + var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g; + var rs, c; - var fn = functions[valueIndex]; - return serializeFunc(fn); - }); -} + 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()); -/***/ 34857: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + } else if (rs[4]) { + tokens.push(sets.notWords()); -"use strict"; -/*! - * set-value - * - * Copyright (c) 2014-2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */ + } 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), + }); -var split = __webpack_require__(33218); -var extend = __webpack_require__(28727); -var isPlainObject = __webpack_require__(81064); -var isObject = __webpack_require__(18493); + } else if (c = rs[12]) { + tokens.push({ + type: types.CHAR, + value: c.charCodeAt(0), + }); -module.exports = function(obj, prop, val) { - if (!isObject(obj)) { - return obj; + } else { + return [tokens, regexp.lastIndex]; + } } - if (Array.isArray(prop)) { - prop = [].concat.apply([], prop).join('.'); - } + exports.error(regexpStr, 'Unterminated character class'); +}; - 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; +/** + * Shortcut to throw errors. + * + * @param {String} regexp + * @param {String} msg + */ +exports.error = function(regexp, msg) { + throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg); +}; - 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; +/***/ 71217: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +var parse = __webpack_require__(25622); +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 isValidKey(key) { - return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +function isRegExp (x) { + return {}.toString.call(x) === '[object RegExp]'; } /***/ }), -/***/ 12579: -/***/ (function(module, exports, __webpack_require__) { +/***/ 85841: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +/* +Copyright (c) 2014, Yahoo! Inc. All rights reserved. +Copyrights licensed under the New BSD License. +See the accompanying LICENSE file for terms. +*/ -var isObject = __webpack_require__(96667); -var define = __webpack_require__(88599); -var utils = __webpack_require__(82071); -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; - } +var randomBytes = __webpack_require__(79822); - define(this, 'parent', parent); - define(this, 'isNode', true); - define(this, 'expect', null); +// Generate an internal UID to make the regexp pattern harder to guess. +var UID_LENGTH = 16; +var UID = generateUID(); +var PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|U|I)-' + UID + '-(\\d+)__@"', 'g'); - 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; - } -} +var IS_NATIVE_CODE_REGEXP = /\{\s*\[native code\]\s*\}/g; +var IS_PURE_FUNCTION = /function.*?\(/; +var IS_ARROW_FUNCTION = /.*?=>.*?/; +var UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g; -/** - * 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 - */ +var RESERVED_SYMBOLS = ['*', 'async']; -Node.isNode = function(node) { - return utils.isNode(node); +// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their +// Unicode char counterparts which are safe to use in JavaScript strings. +var ESCAPED_CHARS = { + '<' : '\\u003C', + '>' : '\\u003E', + '/' : '\\u002F', + '\u2028': '\\u2028', + '\u2029': '\\u2029' }; -/** - * 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; -}; +function escapeUnsafeChars(unsafeChar) { + return ESCAPED_CHARS[unsafeChar]; +} -/** - * 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 - */ +function generateUID() { + var bytes = randomBytes(UID_LENGTH); + var result = ''; + for(var i=0; i 4 - * node.pop(); - * console.log(node.nodes.length); - * //=> 3 - * ``` - * @return {Number} Returns the popped `node` - * @api public - */ + // If the value is an object w/ a toJSON method, toJSON is called before + // the replacer runs, so we use this[key] to get the non-toJSONed value. + var origValue = this[key]; + var type = typeof origValue; -Node.prototype.pop = function() { - return this.nodes && this.nodes.pop(); -}; + if (type === 'object') { + if(origValue instanceof RegExp) { + return '@__R-' + UID + '-' + (regexps.push(origValue) - 1) + '__@'; + } -/** - * 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 - */ + if(origValue instanceof Date) { + return '@__D-' + UID + '-' + (dates.push(origValue) - 1) + '__@'; + } -Node.prototype.shift = function() { - return this.nodes && this.nodes.shift(); -}; + if(origValue instanceof Map) { + return '@__M-' + UID + '-' + (maps.push(origValue) - 1) + '__@'; + } -/** - * Remove `node` from `node.nodes`. - * - * ```js - * node.remove(childNode); - * ``` - * @param {Object} `node` - * @return {Object} Returns the removed node. - * @api public - */ + if(origValue instanceof Set) { + return '@__S-' + UID + '-' + (sets.push(origValue) - 1) + '__@'; + } + } -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; -}; + if (type === 'function') { + return '@__F-' + UID + '-' + (functions.push(origValue) - 1) + '__@'; + } -/** - * 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 - */ + if (type === 'undefined') { + return '@__U-' + UID + '-' + (undefs.push(origValue) - 1) + '__@'; + } -Node.prototype.find = function(type) { - return utils.findNode(this.nodes, type); -}; + if (type === 'number' && !isNaN(origValue) && !isFinite(origValue)) { + return '@__I-' + UID + '-' + (infinities.push(origValue) - 1) + '__@'; + } -/** - * 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 - */ + return value; + } -Node.prototype.isType = function(type) { - return utils.isType(this, type); -}; + function serializeFunc(fn) { + var serializedFn = fn.toString(); + if (IS_NATIVE_CODE_REGEXP.test(serializedFn)) { + throw new TypeError('Serializing native function: ' + fn.name); + } -/** - * 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 - */ + // pure functions, example: {key: function() {}} + if(IS_PURE_FUNCTION.test(serializedFn)) { + return serializedFn; + } -Node.prototype.hasType = function(type) { - return utils.hasType(this, type); -}; + // arrow functions, example: arg1 => arg1+5 + if(IS_ARROW_FUNCTION.test(serializedFn)) { + return serializedFn; + } -/** - * 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 - */ + var argsStartsAt = serializedFn.indexOf('('); + var def = serializedFn.substr(0, argsStartsAt) + .trim() + .split(' ') + .filter(function(val) { return val.length > 0 }); -Object.defineProperty(Node.prototype, 'siblings', { - set: function() { - throw new Error('node.siblings is a getter and cannot be defined'); - }, - get: function() { - return this.parent ? this.parent.nodes : null; - } -}); + var nonReservedSymbols = def.filter(function(val) { + return RESERVED_SYMBOLS.indexOf(val) === -1 + }); -/** - * 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 - */ + // enhanced literal objects, example: {key() {}} + if(nonReservedSymbols.length > 0) { + return (def.indexOf('async') > -1 ? 'async ' : '') + 'function' + + (def.join('').indexOf('*') > -1 ? '*' : '') + + serializedFn.substr(argsStartsAt); + } -Object.defineProperty(Node.prototype, 'index', { - set: function(index) { - define(this, 'idx', index); - }, - get: function() { - if (!Array.isArray(this.siblings)) { - return -1; + // arrow functions + return serializedFn; } - var tok = this.idx !== -1 ? this.siblings[this.idx] : null; - if (tok !== this) { - this.idx = this.siblings.indexOf(this); + + // Check if the parameter is function + if (options.ignoreFunction && typeof obj === "function") { + obj = undefined; + } + // Protects against `JSON.stringify()` returning `undefined`, by serializing + // to the literal string: "undefined". + if (obj === undefined) { + return String(obj); } - 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 - */ + var str; -Object.defineProperty(Node.prototype, 'prev', { - set: function() { - throw new Error('node.prev is a getter and cannot be defined'); - }, - get: function() { - if (Array.isArray(this.siblings)) { - return this.siblings[this.index - 1] || this.parent.prev; + // Creates a JSON string representation of the value. + // NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args. + if (options.isJSON && !options.space) { + str = JSON.stringify(obj); + } else { + str = JSON.stringify(obj, options.isJSON ? null : replacer, options.space); } - 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 - */ + // Protects against `JSON.stringify()` returning `undefined`, by serializing + // to the literal string: "undefined". + if (typeof str !== 'string') { + return String(str); + } -Object.defineProperty(Node.prototype, 'next', { - set: function() { - throw new Error('node.next is a getter and cannot be defined'); - }, - get: function() { - if (Array.isArray(this.siblings)) { - return this.siblings[this.index + 1] || this.parent.next; + // Replace unsafe HTML and invalid JavaScript line terminator chars with + // their safe Unicode char counterpart. This _must_ happen before the + // regexps and functions are serialized and added back to the string. + if (options.unsafe !== true) { + str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars); } - 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 - */ + if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && undefs.length === 0 && infinities.length === 0) { + return str; + } -Object.defineProperty(Node.prototype, 'first', { - get: function() { - return this.nodes ? this.nodes[0] : null; - } -}); + // Replaces all occurrences of function, regexp, date, map and set placeholders in the + // JSON string with their string representations. If the original value can + // not be found, then `undefined` is used. + return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) { + // The placeholder may not be preceded by a backslash. This is to prevent + // replacing things like `"a\"@__R--0__@"` and thus outputting + // invalid JS. + if (backSlash) { + return match; + } -/** - * 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 - */ + if (type === 'D') { + return "new Date(\"" + dates[valueIndex].toISOString() + "\")"; + } -Object.defineProperty(Node.prototype, 'last', { - get: function() { - return this.nodes ? utils.last(this.nodes) : null; - } -}); + if (type === 'R') { + return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")"; + } -/** - * 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 - */ + if (type === 'M') { + return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")"; + } -Object.defineProperty(Node.prototype, 'scope', { - get: function() { - if (this.isScope !== true) { - return this.parent ? this.parent.scope : this; - } - return this; - } -}); + if (type === 'S') { + return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")"; + } -/** - * Get own property names from Node prototype, but only the - * first time `Node` is instantiated - */ + if (type === 'U') { + return 'undefined' + } -function lazyKeys() { - if (!ownNames) { - ownNames = Object.getOwnPropertyNames(Node.prototype); - } -} + if (type === 'I') { + return infinities[valueIndex]; + } -/** - * Simplified assertion. Throws an error is `val` is falsey. - */ + var fn = functions[valueIndex]; -function assert(val, message) { - if (!val) throw new Error(message); + return serializeFunc(fn); + }); } -/** - * Expose `Node` - */ - -exports = module.exports = Node; - /***/ }), -/***/ 88599: +/***/ 34857: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /*! - * define-property + * set-value * - * Copyright (c) 2015, 2017, Jon Schlinkert. + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. * Released under the MIT License. */ -var isDescriptor = __webpack_require__(44133); +var split = __webpack_require__(33218); +var extend = __webpack_require__(28727); +var isPlainObject = __webpack_require__(81064); +var isObject = __webpack_require__(18493); -module.exports = function defineProperty(obj, prop, val) { - if (typeof obj !== 'object' && typeof obj !== 'function') { - throw new TypeError('expected an object or function.'); +module.exports = function(obj, prop, val) { + if (!isObject(obj)) { + return obj; + } + + if (Array.isArray(prop)) { + prop = [].concat.apply([], prop).join('.'); } if (typeof prop !== 'string') { - throw new TypeError('expected `prop` to be a string.'); + return obj; } - if (isDescriptor(val) && ('set' in val || 'get' in val)) { - return Object.defineProperty(obj, prop, val); + 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 Object.defineProperty(obj, prop, { - configurable: true, - enumerable: false, - writable: true, - value: val - }); + return obj; }; +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +} + /***/ }), -/***/ 82071: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 12579: +/***/ (function(module, exports, __webpack_require__) { "use strict"; -var typeOf = __webpack_require__(48865); -var utils = module.exports; +var isObject = __webpack_require__(96667); +var define = __webpack_require__(88599); +var utils = __webpack_require__(82071); +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. @@ -43200,3834 +43128,3554 @@ var utils = module.exports; * ```js * var Node = require('snapdragon-node'); * var node = new Node({type: 'foo'}); - * console.log(utils.isNode(node)); //=> true - * console.log(utils.isNode({})); //=> false + * console.log(Node.isNode(node)); //=> true + * console.log(Node.isNode({})); //=> false * ``` - * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Object} `node` * @returns {Boolean} * @api public */ -utils.isNode = function(node) { - return typeOf(node) === 'object' && node.isNode === true; +Node.isNode = function(node) { + return utils.isNode(node); }; /** - * Emit an empty string for the given `node`. + * Define a non-enumberable property on the node instance. + * Useful for adding properties that shouldn't be extended + * or visible during debugging. * * ```js - * // do nothing for beginning-of-string - * snapdragon.compiler.set('bos', utils.noop); + * var node = new Node(); + * node.define('foo', 'something non-enumerable'); * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @returns {undefined} + * @param {String} `name` + * @param {any} `val` + * @return {Object} returns the node instance * @api public */ -utils.noop = function(node) { - append(this, '', node); +Node.prototype.define = function(name, val) { + define(this, name, val); + return this; }; /** - * Appdend `node.val` to `compiler.output`, exactly as it was created - * by the parser. + * Returns true if `node.val` is an empty string, or `node.nodes` does + * not contain any non-empty text nodes. * * ```js - * snapdragon.compiler.set('text', utils.identity); + * var node = new Node({type: 'text'}); + * node.isEmpty(); //=> true + * node.val = 'foo'; + * node.isEmpty(); //=> false * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @returns {undefined} + * @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 */ -utils.identity = function(node) { - append(this, node.val, node); +Node.prototype.isEmpty = function(fn) { + return utils.isEmpty(this, fn); }; /** - * 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`. + * Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and + * set `foo` as `bar.parent`. * * ```js - * snapdragon.compiler - * .set('i', function(node) { - * this.mapVisit(node); - * }) - * .set('i.open', utils.append('')) - * .set('i.close', utils.append('')) + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.push(bar); * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @returns {Function} Returns a compiler middleware function. + * @param {Object} `node` + * @return {Number} Returns the length of `node.nodes` * @api public */ -utils.append = function(val) { - return function(node) { - append(this, val, node); - }; +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); }; /** - * 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. + * Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and + * set `foo` as `bar.parent`. * * ```js - * utils.toNoop(node); - * // convert `node.nodes` to the given value instead of deleting it - * utils.toNoop(node, []); + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.unshift(bar); * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array. + * @param {Object} `node` + * @return {Number} Returns the length of `node.nodes` * @api public */ -utils.toNoop = function(node, nodes) { - if (nodes) { - node.nodes = nodes; - } else { - delete node.nodes; - node.type = 'text'; - node.val = ''; - } +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); }; /** - * 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. + * Pop a node from `node.nodes`. * * ```js - * snapdragon.compiler.set('i', function(node) { - * utils.visit(node, function(childNode) { - * // do stuff with "childNode" - * return childNode; - * }); - * }); + * 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 * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @param {Function} `fn` - * @return {Object} returns the node after recursively visiting all child nodes. + * @return {Number} Returns the popped `node` * @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; +Node.prototype.pop = function() { + return this.nodes && this.nodes.pop(); }; /** - * 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. + * Shift a node from `node.nodes`. * * ```js - * snapdragon.compiler.set('i', function(node) { - * utils.mapVisit(node, function(childNode) { - * // do stuff with "childNode" - * return childNode; - * }); - * }); + * 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 * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @param {Object} `options` - * @param {Function} `fn` - * @return {Object} returns the node + * @return {Object} Returns the shifted `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; +Node.prototype.shift = function() { + return this.nodes && this.nodes.shift(); }; /** - * Unshift an `*.open` node onto `node.nodes`. + * Remove `node` from `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; - * } - * }); + * node.remove(childNode); * ``` - * @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. + * @param {Object} `node` + * @return {Object} Returns the removed 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); +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 open; + return null; }; /** - * Push a `*.close` node onto `node.nodes`. + * 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 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; - * } - * }); + * 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 {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. + * @param {String} `type` + * @return {Object} Returns a child node or undefined. * @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; +Node.prototype.find = function(type) { + return utils.findNode(this.nodes, type); }; /** - * Wraps the given `node` with `*.open` and `*.close` nodes. + * Return true if the node is the given `type`. * - * @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 + * ```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 */ -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; +Node.prototype.isType = function(type) { + return utils.isType(this, type); }; /** - * Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent. + * Return true if the `node.nodes` has the given `type`. * * ```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' + * 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 {Object} `parent` - * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Object} Returns the child node + * @param {String} `type` + * @return {Boolean} * @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; +Node.prototype.hasType = function(type) { + return utils.hasType(this, type); }; /** - * Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent. + * Get the siblings array, or `null` if it doesn't exist. * * ```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' + * 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 * ``` - * @param {Object} `parent` - * @param {Object} `node` Instance of [snapdragon-node][] - * @return {undefined} + * @return {Array} * @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); -}; +Object.defineProperty(Node.prototype, 'siblings', { + set: function() { + throw new Error('node.siblings is a getter and cannot be defined'); + }, + get: function() { + return this.parent ? this.parent.nodes : null; + } +}); /** - * 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`. + * Get the node's current index from `node.parent.nodes`. + * This should always be correct, even when the parent adds nodes. * * ```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 + * 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 * ``` - * @param {Object} `parent` - * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Number|Undefined} Returns the length of `node.nodes` or undefined. + * @return {Number} * @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(); +Object.defineProperty(Node.prototype, 'index', { + set: function(index) { + define(this, 'idx', index); + }, + get: function() { + 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; } - 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`. +/** + * Get the previous node from the siblings array or `null`. * * ```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 + * 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' * ``` - * @param {Object} `parent` - * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Number|Undefined} Returns the length of `node.nodes` or undefined. + * @return {Object} * @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(); +Object.defineProperty(Node.prototype, 'prev', { + set: function() { + throw new Error('node.prev is a getter and cannot be defined'); + }, + get: function() { + if (Array.isArray(this.siblings)) { + return this.siblings[this.index - 1] || this.parent.prev; + } + return null; } - return node.nodes && node.nodes.shift(); -}; +}); /** - * Remove the specified `node` from `parent.nodes`. + * Get the siblings array, or `null` if it doesn't exist. * * ```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 + * 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 * ``` - * @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`. + * @return {Object} * @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) { +Object.defineProperty(Node.prototype, 'next', { + set: function() { + throw new Error('node.next is a getter and cannot be defined'); + }, + get: function() { + if (Array.isArray(this.siblings)) { + return this.siblings[this.index + 1] || this.parent.next; + } 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`. + * Get the first node from `node.nodes`. * * ```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 + * 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' * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @param {String} `type` - * @return {Boolean} + * @return {Object} The first node, or undefiend * @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'); - } +Object.defineProperty(Node.prototype, 'first', { + get: function() { + return this.nodes ? this.nodes[0] : null; } -}; +}); /** - * Returns true if the given `node` has the given `type` in `node.nodes`. - * Throws a `TypeError` if `node` is not an instance of `Node`. + * Get the last node from `node.nodes`. * * ```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 + * 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' * ``` - * @param {Object} `node` Instance of [snapdragon-node][] - * @param {String} `type` - * @return {Boolean} + * @return {Object} The last node, or undefiend * @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; - } +Object.defineProperty(Node.prototype, 'last', { + get: function() { + return this.nodes ? utils.last(this.nodes) : null; } - return false; -}; +}); /** - * Returns the first node from `node.nodes` of the given `type` + * Get the last node from `node.nodes`. * * ```js - * var node = new Node({ - * type: 'foo', - * nodes: [ - * new Node({type: 'text', val: 'abc'}), - * new Node({type: 'text', val: 'xyz'}) - * ] - * }); + * 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); * - * var textNode = utils.firstOfType(node.nodes, 'text'); - * console.log(textNode.val); - * //=> 'abc' + * console.log(foo.last.type) // 'qux' * ``` - * @param {Array} `nodes` - * @param {String} `type` - * @return {Object|undefined} Returns the first matching node or undefined. + * @return {Object} The last node, or undefiend * @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; +Object.defineProperty(Node.prototype, 'scope', { + get: function() { + if (this.isScope !== true) { + return this.parent ? this.parent.scope : this; } + return this; } -}; +}); /** - * 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 + * 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; + + +/***/ }), + +/***/ 88599: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/*! + * define-property + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. */ -utils.findNode = function(nodes, type) { - if (!Array.isArray(nodes)) { - return null; + + +var isDescriptor = __webpack_require__(44133); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); } - if (typeof type === 'number') { - return nodes[type]; + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); } - 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 - */ + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } -utils.isOpen = function(node) { - assert(utils.isNode(node), 'expected node to be an instance of Node'); - return node.type.slice(-5) === '.open'; + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); }; + +/***/ }), + +/***/ 82071: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +var typeOf = __webpack_require__(48865); +var utils = module.exports; + /** - * Returns true if the given node is a "*.close" node. + * Returns true if the given value is a 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 + * var node = new Node({type: 'foo'}); + * console.log(utils.isNode(node)); //=> true + * console.log(utils.isNode({})); //=> false * ``` * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Boolean} + * @returns {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'; +utils.isNode = function(node) { + return typeOf(node) === 'object' && node.isNode === true; }; /** - * Returns true if `node.nodes` **has** an `.open` node + * Emit an empty string for the given `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 + * // do nothing for beginning-of-string + * snapdragon.compiler.set('bos', utils.noop); * ``` * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Boolean} + * @returns {undefined} * @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; +utils.noop = function(node) { + append(this, '', node); }; /** - * Returns true if `node.nodes` **has** a `.close` node + * Appdend `node.val` to `compiler.output`, exactly as it was created + * by the parser. * * ```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 + * snapdragon.compiler.set('text', utils.identity); * ``` * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Boolean} + * @returns {undefined} * @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; +utils.identity = function(node) { + append(this, node.val, node); }; /** - * Returns true if `node.nodes` has both `.open` and `.close` nodes + * 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 - * 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 + * snapdragon.compiler + * .set('i', function(node) { + * this.mapVisit(node); + * }) + * .set('i.open', utils.append('')) + * .set('i.close', utils.append('')) * ``` * @param {Object} `node` Instance of [snapdragon-node][] - * @return {Boolean} + * @returns {Function} Returns a compiler middleware function. * @api public */ -utils.hasOpenAndClose = function(node) { - return utils.hasOpen(node) && utils.hasClose(node); +utils.append = function(val) { + return function(node) { + append(this, val, 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`. + * 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 - * var state = { inside: {}}; - * var node = new Node({type: 'brace'}); - * utils.addType(state, node); - * console.log(state.inside); - * //=> { brace: [{type: 'brace'}] } + * utils.toNoop(node); + * // convert `node.nodes` to the given value instead of deleting it + * utils.toNoop(node, []); * ``` - * @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. + * @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array. * @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] = []; +utils.toNoop = function(node, nodes) { + if (nodes) { + node.nodes = nodes; + } else { + delete node.nodes; + node.type = 'text'; + node.val = ''; } - - 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`. + * 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 - * 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: [] } + * snapdragon.compiler.set('i', function(node) { + * utils.visit(node, function(childNode) { + * // do stuff with "childNode" + * return childNode; + * }); + * }); * ``` - * @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. + * @param {Function} `fn` + * @return {Object} returns the node after recursively visiting all child nodes. * @api public */ -utils.removeType = function(state, node) { +utils.visit = function(node, fn) { 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(); - } + assert(isFunction(fn), 'expected a visitor function'); + fn(node); + return node.nodes ? utils.mapVisit(node, fn) : node; }; /** - * Returns true if `node.val` is an empty string, or `node.nodes` does - * not contain any non-empty text nodes. + * 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 - * var node = new Node({type: 'text'}); - * utils.isEmpty(node); //=> true - * node.val = 'foo'; - * utils.isEmpty(node); //=> false + * ```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 {Boolean} + * @return {Object} returns the node * @api public */ -utils.isEmpty = function(node, fn) { +utils.mapVisit = 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); - } + 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++) { - var child = node.nodes[i]; - if (utils.isOpen(child) || utils.isClose(child)) { - continue; - } - if (!utils.isEmpty(child, fn)) { - return false; - } + utils.visit(node.nodes[i], fn); } - - return true; + return node; }; /** - * Returns true if the `state.inside` stack for the given type exists - * and has one or more nodes on it. + * Unshift an `*.open` node onto `node.nodes`. * * ```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 + * 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} `state` - * @param {String} `type` - * @return {Boolean} + * @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.isInsideType = function(state, type) { - assert(isObject(state), 'expected state to be an object'); - assert(isString(type), 'expected type to be a string'); +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 (!state.hasOwnProperty('inside')) { - return false; + if (typeof val === 'function') { + filter = val; + val = ''; } - if (!state.inside.hasOwnProperty(type)) { - return false; + 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 state.inside[type].length > 0; + return open; }; /** - * Returns true if `node` is either a child or grand-child of the given `type`, - * or `state.inside[type]` is a non-empty array. + * Push a `*.close` node onto `node.nodes`. * * ```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 + * 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} `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} + * @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.isInside = function(state, node, type) { +utils.addClose = function(node, Node, val, filter) { assert(utils.isNode(node), 'expected node to be an instance of Node'); - assert(isObject(state), 'expected state to be an object'); + assert(isFunction(Node), 'expected Node to be a constructor function'); - if (Array.isArray(type)) { - for (var i = 0; i < type.length; i++) { - if (utils.isInside(state, node, type[i])) { - return true; - } - } - return false; + if (typeof val === 'function') { + filter = val; + val = ''; } - var parent = node.parent; - if (typeof type === 'string') { - return (parent && parent.type === type) || utils.isInsideType(state, type); + 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; +}; - if (typeOf(type) === 'regexp') { - if (parent && parent.type && type.test(parent.type)) { - return true; - } +/** + * 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 + */ - 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]; +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'); - if (Array.isArray(val) && val.length !== 0 && type.test(key)) { - return true; - } - } - } - return false; + utils.addOpen(node, Node, filter); + utils.addClose(node, Node, filter); + return node; }; /** - * Get the last `n` element from the given `array`. Used for getting - * a node from `node.nodes.` + * Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent. * - * @param {Array} `array` - * @param {Number} `n` - * @return {undefined} + * ```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.last = function(arr, n) { - return arr[arr.length - (n || 1)]; +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; }; /** - * Cast the given `val` to an array. + * Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent. * * ```js - * console.log(utils.arrayify('')); - * //=> [] - * console.log(utils.arrayify('foo')); - * //=> ['foo'] - * console.log(utils.arrayify(['foo'])); - * //=> ['foo'] + * 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 {any} `val` - * @return {Array} + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {undefined} * @api public */ -utils.arrayify = function(val) { - if (typeof val === 'string' && val !== '') { - return [val]; - } - if (!Array.isArray(val)) { - return []; - } - return val; +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); }; /** - * Convert the given `val` to a string by joining with `,`. Useful - * for creating a cheerio/CSS/DOM-style selector from a list of strings. + * 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`. * - * @param {any} `val` - * @return {Array} + * ```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.stringify = function(val) { - return utils.arrayify(val).join(','); +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(); }; /** - * Ensure that the given value is a string and call `.trim()` on it, - * or return an empty string. + * 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`. * - * @param {String} `str` - * @return {String} + * ```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.trim = function(str) { - return typeof str === 'string' ? str.trim() : ''; +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(); }; /** - * Return true if val is an object + * 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 */ -function isObject(val) { - return typeOf(val) === 'object'; -} - -/** - * Return true if val is a string - */ +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'); -function isString(val) { - return typeof val === 'string'; -} + if (!parent.nodes) { + return null; + } -/** - * Return true if val is a function - */ + if (typeof parent.remove === 'function') { + return parent.remove(node); + } -function isFunction(val) { - return typeof val === 'function'; -} + var idx = parent.nodes.indexOf(node); + if (idx !== -1) { + return parent.nodes.splice(idx, 1); + } +}; /** - * Return true if val is an array + * 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 */ -function isArray(val) { - return Array.isArray(val); -} +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'); + } + } +}; /** - * Shim to ensure the `.append` methods work with any version of snapdragon + * 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 */ -function append(compiler, val, node) { - if (typeof compiler.append !== 'function') { - return compiler.emit(val, node); +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 compiler.append(val, node); -} + return false; +}; /** - * Simplified assertion. Throws an error is `val` is falsey. + * 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 */ -function assert(val, message) { - if (!val) throw new Error(message); -} - - -/***/ }), - -/***/ 79285: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -var Base = __webpack_require__(87263); -var define = __webpack_require__(5477); -var Compiler = __webpack_require__(33003); -var Parser = __webpack_require__(35573); -var utils = __webpack_require__(622); -var regexCache = {}; -var cache = {}; +utils.firstOfType = function(nodes, type) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (utils.isType(node, type)) { + return node; + } + } +}; /** - * Create a new instance of `Snapdragon` with the given `options`. + * Returns the node at the specified index, or the first node of the + * given `type` from `node.nodes`. * * ```js - * var snapdragon = new Snapdragon(); + * 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 {Object} `options` + * @param {Array} `nodes` + * @param {String|Number} `type` Node type or index. + * @return {Object} Returns a node or undefined. * @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() { - return this.compiler.compilers; - } - }); - - Object.defineProperty(this, 'parsers', { - get: function() { - return this.parser.parsers; - } - }); - - Object.defineProperty(this, 'regex', { - get: function() { - return this.parser.regex; - } - }); -} +utils.findNode = function(nodes, type) { + if (!Array.isArray(nodes)) { + return null; + } + if (typeof type === 'number') { + return nodes[type]; + } + return utils.firstOfType(nodes, type); +}; /** - * Inherit Base + * 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 */ -Base.extend(Snapdragon); +utils.isOpen = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + return node.type.slice(-5) === '.open'; +}; /** - * 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. + * Returns true if the given node is a "*.close" node. * * ```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] - * }); - * }); + * 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 {String} `type` - * @param {RegExp|Function} `regex` - * @return {Object} Returns the parser instance for chaining + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} * @api public */ -Snapdragon.prototype.capture = function() { - return this.parser.capture.apply(this.parser, arguments); +utils.isClose = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + return node.type.slice(-6) === '.close'; }; /** - * Register a plugin `fn`. + * Returns true if `node.nodes` **has** an `.open` node * * ```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 + * 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} `fn` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} * @api public */ -Snapdragon.prototype.use = function(fn) { - fn.call(this, this); - return this; +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; }; /** - * Parse the given `str`. + * Returns true if `node.nodes` **has** a `.close` node * * ```js - * var snapdragon = new Snapdgragon([options]); - * // register parsers - * snapdragon.parser.use(function() {}); + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); * - * // parse - * var ast = snapdragon.parse('foo/bar'); - * console.log(ast); + * var close = new Node({type: 'brace.close'}); + * console.log(utils.hasClose(brace)); // false + * + * brace.pushNode(close); + * console.log(utils.hasClose(brace)); // true * ``` - * @param {String} `str` - * @param {Object} `options` Set `options.sourcemap` to true to enable source maps. - * @return {Object} Returns an AST. + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} * @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; +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; }; /** - * Compile the given `AST`. + * Returns true if `node.nodes` has both `.open` and `.close` nodes * * ```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() {}); + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); * - * // parse - * var ast = snapdragon.parse('foo/bar'); + * 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 * - * // compile - * var res = snapdragon.compile(ast); - * console.log(res.output); + * brace.pushNode(open); + * brace.pushNode(close); + * console.log(utils.hasOpen(brace)); // true + * console.log(utils.hasClose(brace)); // true * ``` - * @param {Object} `ast` - * @param {Object} `options` - * @return {Object} Returns an object with an `output` property with the rendered string. + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} * @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; +utils.hasOpenAndClose = function(node) { + return utils.hasOpen(node) && utils.hasClose(node); }; /** - * Expose `Snapdragon` - */ - -module.exports = Snapdragon; - -/** - * Expose `Parser` and `Compiler` + * 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 */ -module.exports.Compiler = Compiler; -module.exports.Parser = Parser; - - -/***/ }), - -/***/ 33003: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - +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 use = __webpack_require__(77709); -var define = __webpack_require__(5477); -var debug = __webpack_require__(31185)('snapdragon:compiler'); -var utils = __webpack_require__(622); + var type = node.parent + ? node.parent.type + : node.type.replace(/\.open$/, ''); -/** - * Create a new `Compiler` with the given `options`. - * @param {Object} `options` - */ + if (!state.hasOwnProperty('inside')) { + state.inside = {}; + } + if (!state.inside.hasOwnProperty(type)) { + state.inside[type] = []; + } -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); -} + var arr = state.inside[type]; + arr.push(node); + return arr; +}; /** - * Prototype methods + * 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 */ -Compiler.prototype = { - - /** - * Throw an error message with details including the cursor position. - * @param {String} `msg` Message to use in the Error. - */ - - error: function(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; - } - }, +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'); - /** - * 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 - */ + var type = node.parent + ? node.parent.type + : node.type.replace(/\.close$/, ''); - define: function(key, val) { - define(this, key, val); - return this; - }, + if (state.inside.hasOwnProperty(type)) { + return state.inside[type].pop(); + } +}; - /** - * Emit `node.val` - */ +/** + * 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 + */ - emit: function(str, node) { - this.output += str; - return str; - }, +utils.isEmpty = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); - /** - * Add a compiler `fn` with the given `name` - */ + 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); + } - set: function(name, fn) { - this.compilers[name] = fn; - return this; - }, + 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; + } + } - /** - * Get compiler `name`. - */ + return true; +}; - get: function(name) { - return this.compilers[name]; - }, +/** + * 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 + */ - /** - * Get the previous AST node. - */ +utils.isInsideType = function(state, type) { + assert(isObject(state), 'expected state to be an object'); + assert(isString(type), 'expected type to be a string'); - prev: function(n) { - return this.ast.nodes[this.idx - (n || 1)] || { type: 'bos', val: '' }; - }, + if (!state.hasOwnProperty('inside')) { + return false; + } - /** - * Get the next AST node. - */ + if (!state.inside.hasOwnProperty(type)) { + return false; + } - next: function(n) { - return this.ast.nodes[this.idx + (n || 1)] || { type: 'eos', val: '' }; - }, + return state.inside[type].length > 0; +}; - /** - * Visit `node`. - */ +/** + * 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 + */ - visit: function(node, nodes, i) { - var fn = this.compilers[node.type]; - this.idx = i; +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 (typeof fn !== 'function') { - throw this.error('compiler "' + node.type + '" is not registered', node); + if (Array.isArray(type)) { + for (var i = 0; i < type.length; i++) { + if (utils.isInside(state, node, type[i])) { + return true; + } } - return fn.call(this, node, nodes, i); - }, + return false; + } - /** - * Map visit over array of `nodes`. - */ + var parent = node.parent; + if (typeof type === 'string') { + return (parent && parent.type === type) || utils.isInsideType(state, type); + } - mapVisit: function(nodes) { - if (!Array.isArray(nodes)) { - throw new TypeError('expected an array'); + if (typeOf(type) === 'regexp') { + if (parent && parent.type && type.test(parent.type)) { + return true; } - var len = nodes.length; + + var keys = Object.keys(state.inside); + var len = keys.length; var idx = -1; while (++idx < len) { - this.visit(nodes[idx], nodes, idx); + var key = keys[idx]; + var val = state.inside[key]; + + if (Array.isArray(val) && val.length !== 0 && type.test(key)) { + return true; + } } - return this; - }, + } + return false; +}; - /** - * Compile `ast`. - */ +/** + * 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 + */ - compile: function(ast, options) { - var opts = utils.extend({}, this.options, options); - this.ast = ast; - this.parsingErrors = this.ast.errors; - this.output = ''; +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; - // source map support - if (opts.sourcemap) { - var sourcemaps = __webpack_require__(59657); - sourcemaps(this); - this.mapVisit(this.ast.nodes); - this.applySourceMaps(); - this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON(); - return this; - } +/** + * 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 + */ - this.mapVisit(this.ast.nodes); - return this; +utils.arrayify = function(val) { + if (typeof val === 'string' && val !== '') { + return [val]; + } + if (!Array.isArray(val)) { + return []; } + return val; }; /** - * Expose `Compiler` + * 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 */ -module.exports = Compiler; - - -/***/ }), - -/***/ 35573: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -var use = __webpack_require__(77709); -var util = __webpack_require__(31669); -var Cache = __webpack_require__(4337); -var define = __webpack_require__(5477); -var debug = __webpack_require__(31185)('snapdragon:parser'); -var Position = __webpack_require__(7974); -var utils = __webpack_require__(622); +utils.stringify = function(val) { + return utils.arrayify(val).join(','); +}; /** - * Create a new `Parser` with the given `input` and `options`. - * @param {String} `input` - * @param {Object} `options` + * 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 */ -function Parser(options) { - debug('initializing', __filename); - this.options = utils.extend({source: 'string'}, options); - this.init(this.options); - use(this); -} +utils.trim = function(str) { + return typeof str === 'string' ? str.trim() : ''; +}; /** - * Prototype methods + * Return true if val is an object */ -Parser.prototype = { - constructor: Parser, - - init: function(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(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 + ' : ' + 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(key, val) { - define(this, key, val); - return this; - }, - - /** - * Mark position and patch `node.position`. - */ - - position: function() { - 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 - */ +function isObject(val) { + return typeOf(val) === 'object'; +} - set: function(type, fn) { - if (this.types.indexOf(type) === -1) { - this.types.push(type); - } - this.parsers[type] = fn.bind(this); - return this; - }, +/** + * Return true if val is a string + */ - /** - * Get parser `name` - * @param {String} `name` - * @api public - */ +function isString(val) { + return typeof val === 'string'; +} - get: function(name) { - return this.parsers[name]; - }, +/** + * Return true if val is a function + */ - /** - * Push a `token` onto the `type` stack. - * - * @param {String} `type` - * @return {Object} `token` - * @api public - */ +function isFunction(val) { + return typeof val === 'function'; +} - push: function(type, token) { - this.sets[type] = this.sets[type] || []; - this.count++; - this.stack.push(token); - return this.sets[type].push(token); - }, +/** + * Return true if val is an array + */ - /** - * Pop a token off of the `type` stack - * @param {String} `type` - * @returns {Object} Returns a token - * @api public - */ +function isArray(val) { + return Array.isArray(val); +} - pop: function(type) { - this.sets[type] = this.sets[type] || []; - this.count--; - this.stack.pop(); - return this.sets[type].pop(); - }, +/** + * Shim to ensure the `.append` methods work with any version of snapdragon + */ - /** - * Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`. - * - * @param {String} `type` - * @return {Boolean} - * @api public - */ +function append(compiler, val, node) { + if (typeof compiler.append !== 'function') { + return compiler.emit(val, node); + } + return compiler.append(val, node); +} - isInside: function(type) { - this.sets[type] = this.sets[type] || []; - return this.sets[type].length > 0; - }, +/** + * Simplified assertion. Throws an error is `val` is falsey. + */ - /** - * Return true if `node` is the given `type`. - * - * ```js - * parser.isType(node, 'brace'); - * ``` - * @param {Object} `node` - * @param {String} `type` - * @return {Boolean} - * @api public - */ +function assert(val, message) { + if (!val) throw new Error(message); +} - isType: function(node, type) { - return node && node.type === type; - }, - /** - * Get the previous AST node - * @return {Object} - */ +/***/ }), - prev: function(n) { - return this.stack.length > 0 - ? utils.last(this.stack, n) - : utils.last(this.nodes, n); - }, +/***/ 79285: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - /** - * Update line and column based on `str`. - */ +"use strict"; - consume: function(len) { - this.input = this.input.substr(len); - }, - /** - * Update column based on `str`. - */ +var Base = __webpack_require__(87263); +var define = __webpack_require__(5477); +var Compiler = __webpack_require__(33003); +var Parser = __webpack_require__(35573); +var utils = __webpack_require__(622); +var regexCache = {}; +var cache = {}; - updatePosition: function(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); - }, +/** + * Create a new instance of `Snapdragon` with the given `options`. + * + * ```js + * var snapdragon = new Snapdragon(); + * ``` + * + * @param {Object} `options` + * @api public + */ - /** - * Match `regex`, return captures, and update the cursor position by `match[0]` length. - * @param {RegExp} `regex` - * @return {Object} - */ +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); - match: function(regex) { - var m = regex.exec(this.input); - if (m) { - this.updatePosition(m[0], m[0].length); - return m; + Object.defineProperty(this, 'compilers', { + get: function() { + return this.compiler.compilers; } - }, + }); - /** - * Capture `type` with the given regex. - * @param {String} `type` - * @param {RegExp} `regex` - * @return {Function} - */ + Object.defineProperty(this, 'parsers', { + get: function() { + return this.parser.parsers; + } + }); - capture: function(type, regex) { - if (typeof regex === 'function') { - return this.set.apply(this, arguments); + Object.defineProperty(this, 'regex', { + get: function() { + return this.parser.regex; } + }); +} - 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; +/** + * Inherit Base + */ - var prev = this.prev(); - var node = pos({ - type: type, - val: m[0], - parsed: parsed, - rest: this.input - }); +Base.extend(Snapdragon); - if (m[1]) { - node.inner = m[1]; - } +/** + * 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 + */ - define(node, 'inside', this.stack.length > 0); - define(node, 'parent', prev); - prev.nodes.push(node); - }.bind(this)); - return this; - }, +Snapdragon.prototype.capture = function() { + return this.parser.capture.apply(this.parser, arguments); +}; - /** - * Create a parser with open and close for parens, - * brackets or braces - */ +/** + * 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 + */ - capturePair: function(type, openRegex, closeRegex, fn) { - this.sets[type] = this.sets[type] || []; +Snapdragon.prototype.use = function(fn) { + fn.call(this, this); + return this; +}; - /** - * Open - */ +/** + * 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 + */ - this.set(type + '.open', function() { - var parsed = this.parsed; - var pos = this.position(); - var m = this.match(openRegex); - if (!m || !m[0]) return; +Snapdragon.prototype.parse = function(str, options) { + this.options = utils.extend({}, this.options, options); + var parsed = this.parser.parse(str, this.options); - var val = m[0]; - this.setCount++; - this.specialChars = true; - var open = pos({ - type: type + '.open', - val: val, - rest: this.input - }); + // add non-enumerable parser reference + define(parsed, 'parser', this.parser); + return parsed; +}; - if (typeof m[1] !== 'undefined') { - open.inner = m[1]; - } +/** + * 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 + */ - var prev = this.prev(); - var node = pos({ - type: type, - nodes: [open] - }); +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` + */ - define(node, 'rest', this.input); - define(node, 'parsed', parsed); - define(node, 'prefix', m[1]); - define(node, 'parent', prev); - define(open, 'parent', node); +module.exports.Compiler = Compiler; +module.exports.Parser = Parser; - if (typeof fn === 'function') { - fn.call(this, open, node); - } - this.push(type, node); - prev.nodes.push(node); - }); +/***/ }), - /** - * Close - */ +/***/ 33003: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - this.set(type + '.close', function() { - var pos = this.position(); - var m = this.match(closeRegex); - if (!m || !m[0]) return; +"use strict"; - 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 + '"'); - } +var use = __webpack_require__(77709); +var define = __webpack_require__(5477); +var debug = __webpack_require__(31185)('snapdragon:compiler'); +var utils = __webpack_require__(622); - this.setCount--; - node.escaped = true; - return node; - } +/** + * Create a new `Compiler` with the given `options`. + * @param {Object} `options` + */ - if (node.suffix === '\\') { - parent.escaped = true; - node.escaped = true; - } +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); +} - parent.nodes.push(node); - define(node, 'parent', parent); - }); +/** + * Prototype methods + */ - return this; - }, +Compiler.prototype = { /** - * Capture end-of-string + * Throw an error message with details including the cursor position. + * @param {String} `msg` Message to use in the Error. */ - eos: function() { - 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; - } + error: function(msg, node) { + var pos = node.position || {start: {column: 0}}; + var message = this.options.source + ' column:' + pos.start.column + ': ' + msg; - visit(prev, function(node) { - if (!hasDelims(node.parent)) { - node.parent.escaped = true; - node.escaped = true; - } - }); + var err = new Error(message); + err.reason = msg; + err.column = pos.start.column; + err.source = this.pattern; - prev = prev.parent; + if (this.options.silent) { + this.errors.push(err); + } else { + throw err; } + }, - var tok = pos({ - type: 'eos', - val: this.append || '' - }); + /** + * 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(tok, 'parent', this.ast); - return tok; + define: function(key, val) { + define(this, key, val); + return this; }, /** - * Run parsers to advance the cursor position + * Emit `node.val` */ - next: function() { - 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; - } - } + emit: function(str, node) { + this.output += str; + return str; }, /** - * Parse the given string. - * @return {Array} + * Add a compiler `fn` with the given `name` */ - parse: function(input) { - if (typeof input !== 'string') { - throw new TypeError('expected a string'); - } + set: function(name, fn) { + this.compilers[name] = fn; + return this; + }, - this.init(this.options); - this.orig = input; - this.input = input; - var self = this; + /** + * Get compiler `name`. + */ - function parse() { - // check input before calling `.next()` - input = self.input; + get: function(name) { + return this.compilers[name]; + }, - // 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); - } - } + /** + * Get the previous AST node. + */ - if (self.sets.hasOwnProperty(prev.type)) { - self.currentType = prev.type; - } - } + prev: function(n) { + return this.ast.nodes[this.idx - (n || 1)] || { type: 'bos', val: '' }; + }, - // 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) + '"'); - } - } + /** + * Get the next AST node. + */ - 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 + '"'); - } + next: function(n) { + return this.ast.nodes[this.idx + (n || 1)] || { type: 'eos', val: '' }; + }, - var eos = this.eos(); - var tok = this.prev(); - if (tok.type !== 'eos') { - this.ast.nodes.push(eos); - } + /** + * Visit `node`. + */ - return this.ast; - } -}; + visit: function(node, nodes, i) { + var fn = this.compilers[node.type]; + this.idx = i; -/** - * Visit `node` with the given `fn` - */ + if (typeof fn !== 'function') { + throw this.error('compiler "' + node.type + '" is not registered', node); + } + return fn.call(this, node, nodes, i); + }, -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`. + */ -/** - * Map visit over array of `nodes`. - */ + mapVisit: function(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; + }, -function mapVisit(nodes, fn) { - var len = nodes.length; - var idx = -1; - while (++idx < len) { - visit(nodes[idx], fn); - } -} + /** + * Compile `ast`. + */ -function hasOpen(node) { - return node.nodes && node.nodes[0].type === (node.type + '.open'); -} + compile: function(ast, options) { + var opts = utils.extend({}, this.options, options); + this.ast = ast; + this.parsingErrors = this.ast.errors; + this.output = ''; -function hasClose(node) { - return node.nodes && utils.last(node.nodes).type === (node.type + '.close'); -} + // source map support + if (opts.sourcemap) { + var sourcemaps = __webpack_require__(59657); + sourcemaps(this); + this.mapVisit(this.ast.nodes); + this.applySourceMaps(); + this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON(); + return this; + } -function hasDelims(node) { - return hasOpen(node) && hasClose(node); -} + this.mapVisit(this.ast.nodes); + return this; + } +}; /** - * Expose `Parser` + * Expose `Compiler` */ -module.exports = Parser; +module.exports = Compiler; /***/ }), -/***/ 7974: +/***/ 35573: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +var use = __webpack_require__(77709); +var util = __webpack_require__(31669); +var Cache = __webpack_require__(4337); var define = __webpack_require__(5477); +var debug = __webpack_require__(31185)('snapdragon:parser'); +var Position = __webpack_require__(7974); +var utils = __webpack_require__(622); /** - * Store position for a node + * Create a new `Parser` with the given `input` and `options`. + * @param {String} `input` + * @param {Object} `options` + * @api public */ -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); -}; +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, -/***/ 59657: -/***/ (function(module, exports, __webpack_require__) { + init: function(options) { + this.orig = ''; + this.input = ''; + this.parsed = ''; -"use strict"; + 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 fs = __webpack_require__(35747); -var path = __webpack_require__(85622); -var define = __webpack_require__(5477); -var utils = __webpack_require__(622); + var pos = this.position(); + this.bos = pos({type: 'bos', val: ''}); -/** - * 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 - */ + this.ast = { + type: 'root', + errors: this.errors, + nodes: [this.bos] + }; -module.exports = mixin; + define(this.bos, 'parent', this.ast); + this.nodes = [this.ast]; -/** - * Mixin source map support into `compiler`. - * - * @param {Object} `compiler` - * @api public - */ + this.count = 0; + this.setCount = 0; + this.stack = []; + }, -function mixin(compiler) { - define(compiler, '_comment', compiler.comment); - compiler.map = new utils.SourceMap.SourceMapGenerator(); - compiler.position = { line: 1, column: 1 }; - compiler.content = {}; - compiler.files = {}; + /** + * Throw a formatted error with the cursor column and `msg`. + * @param {String} `msg` Message to use in the Error. + */ - for (var key in exports) { - define(compiler, key, exports[key]); - } -} + error: function(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; -/** - * Update position. - * - * @param {String} str - */ + var message = source + ' : ' + msg; + var err = new Error(message); + err.source = source; + err.reason = msg; + err.pos = pos; -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; -}; + if (this.options.silent) { + this.errors.push(err); + } else { + throw err; + } + }, -/** - * Emit `str` with `position`. - * - * @param {String} str - * @param {Object} [pos] - * @return {String} - */ + /** + * 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 + */ -exports.emit = function(str, node) { - var position = node.position || {}; - var source = position.source; - if (source) { - if (position.filepath) { - source = utils.unixify(position.filepath); - } + define: function(key, val) { + define(this, key, val); + return this; + }, - 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 - } - }); + /** + * Mark position and patch `node.position`. + */ - if (position.content) { - this.addContent(source, position); - } - if (position.filepath) { - this.addFile(source, position); + position: function() { + 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(type, fn) { + if (this.types.indexOf(type) === -1) { + this.types.push(type); } + this.parsers[type] = fn.bind(this); + return this; + }, - this.updatePosition(str); - this.output += str; - } - return str; -}; + /** + * Get parser `name` + * @param {String} `name` + * @api public + */ + + get: function(name) { + return this.parsers[name]; + }, + + /** + * Push a `token` onto the `type` stack. + * + * @param {String} `type` + * @return {Object} `token` + * @api public + */ -/** - * Adds a file to the source map output if it has not already been added - * @param {String} `file` - * @param {Object} `pos` - */ + push: function(type, token) { + this.sets[type] = this.sets[type] || []; + this.count++; + this.stack.push(token); + return this.sets[type].push(token); + }, -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; -}; + /** + * Pop a token off of the `type` stack + * @param {String} `type` + * @returns {Object} Returns a token + * @api public + */ -/** - * Adds a content source to the source map output if it has not already been added - * @param {String} `source` - * @param {Object} `position` - */ + pop: function(type) { + this.sets[type] = this.sets[type] || []; + this.count--; + this.stack.pop(); + return this.sets[type].pop(); + }, -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); -}; + /** + * Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`. + * + * @param {String} `type` + * @return {Boolean} + * @api public + */ -/** - * Applies any original source maps to the output and embeds the source file - * contents in the source map. - */ + isInside: function(type) { + this.sets[type] = this.sets[type] || []; + return this.sets[type].length > 0; + }, -exports.applySourceMaps = function() { - Object.keys(this.files).forEach(function(file) { - var content = this.files[file]; - this.map.setSourceContent(file, content); + /** + * Return true if `node` is the given `type`. + * + * ```js + * parser.isType(node, 'brace'); + * ``` + * @param {Object} `node` + * @param {String} `type` + * @return {Boolean} + * @api public + */ - 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); -}; + isType: function(node, type) { + return node && node.type === type; + }, -/** - * Process comments, drops sourceMap comments. - * @param {Object} node - */ + /** + * Get the previous AST node + * @return {Object} + */ -exports.comment = function(node) { - if (/^# sourceMappingURL=/.test(node.comment)) { - return this.emit('', node.position); - } - return this._comment(node); -}; + prev: function(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(len) { + this.input = this.input.substr(len); + }, -/***/ 622: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + /** + * Update column based on `str`. + */ -"use strict"; + updatePosition: function(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} + */ -/** - * Module dependencies - */ + match: function(regex) { + var m = regex.exec(this.input); + if (m) { + this.updatePosition(m[0], m[0].length); + return m; + } + }, -exports.extend = __webpack_require__(28727); -exports.SourceMap = __webpack_require__(96241); -exports.sourceMapResolve = __webpack_require__(10227); + /** + * Capture `type` with the given regex. + * @param {String} `type` + * @param {RegExp} `regex` + * @return {Function} + */ -/** - * Convert backslash in the given string to forward slashes - */ + capture: function(type, regex) { + if (typeof regex === 'function') { + return this.set.apply(this, arguments); + } -exports.unixify = function(fp) { - return fp.split(/\\+/).join('/'); -}; + 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; -/** - * Return true if `val` is a non-empty string - * - * @param {String} `str` - * @return {Boolean} - */ + var prev = this.prev(); + var node = pos({ + type: type, + val: m[0], + parsed: parsed, + rest: this.input + }); -exports.isString = function(str) { - return str && typeof str === 'string'; -}; + if (m[1]) { + node.inner = m[1]; + } -/** - * Cast `val` to an array - * @return {Array} - */ + define(node, 'inside', this.stack.length > 0); + define(node, 'parent', prev); + prev.nodes.push(node); + }.bind(this)); + return this; + }, -exports.arrayify = function(val) { - if (typeof val === 'string') return [val]; - return val ? (Array.isArray(val) ? val : [val]) : []; -}; + /** + * Create a parser with open and close for parens, + * brackets or braces + */ -/** - * Get the last `n` element from the given `array` - * @param {Array} `array` - * @return {*} - */ + capturePair: function(type, openRegex, closeRegex, fn) { + this.sets[type] = this.sets[type] || []; -exports.last = function(arr, n) { - return arr[arr.length - (n || 1)]; -}; + /** + * 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 + }); -/***/ 56609: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (typeof m[1] !== 'undefined') { + open.inner = m[1]; + } -var decodeUriComponent = __webpack_require__(95748) + var prev = this.prev(); + var node = pos({ + type: type, + nodes: [open] + }); -function customDecodeUriComponent(string) { - // `decodeUriComponent` turns `+` into ` `, but that's not wanted. - return decodeUriComponent(string.replace(/\+/g, "%2B")) -} + define(node, 'rest', this.input); + define(node, 'parsed', parsed); + define(node, 'prefix', m[1]); + define(node, 'parent', prev); + define(open, 'parent', node); -module.exports = customDecodeUriComponent + 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; -/***/ 89825: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var parent = this.pop(type); + var node = pos({ + type: type + '.close', + rest: this.input, + suffix: m[1], + val: m[0] + }); -var url = __webpack_require__(78835) + if (!this.isType(parent, type)) { + if (this.options.strict) { + throw new Error('missing opening "' + type + '"'); + } -function resolveUrl(/* ...urls */) { - return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) { - return url.resolve(resolved, nextUrl) - }) -} + this.setCount--; + node.escaped = true; + return node; + } -module.exports = resolveUrl + if (node.suffix === '\\') { + parent.escaped = true; + node.escaped = true; + } + parent.nodes.push(node); + define(node, 'parent', parent); + }); -/***/ }), + return this; + }, -/***/ 10227: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + /** + * Capture end-of-string + */ -var sourceMappingURL = __webpack_require__(21707) + eos: function() { + var pos = this.position(); + if (this.input) return; + var prev = this.prev(); -var resolveUrl = __webpack_require__(89825) -var decodeUriComponent = __webpack_require__(56609) -var urix = __webpack_require__(67806) -var atob = __webpack_require__(83327) + 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; + } + }); -function callbackAsync(callback, error, result) { - setImmediate(function() { callback(error, result) }) -} + prev = prev.parent; + } -function parseMapToJSON(string, data) { - try { - return JSON.parse(string.replace(/^\)\]\}'/, "")) - } catch (error) { - error.sourceMapData = data - throw error - } -} + var tok = pos({ + type: 'eos', + val: this.append || '' + }); -function readSync(read, url, data) { - var readUrl = decodeUriComponent(url) - try { - return String(read(readUrl)) - } catch (error) { - error.sourceMapData = data - throw error - } -} + define(tok, 'parent', this.ast); + return tok; + }, + /** + * Run parsers to advance the cursor position + */ + next: function() { + var parsed = this.parsed; + var len = this.types.length; + var idx = -1; + var tok; -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 = decodeUriComponent(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) + 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; + } } - 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:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ + }, -/** - * The media type for JSON text is application/json. - * - * {@link https://tools.ietf.org/html/rfc8259#section-11 | IANA Considerations } - * - * `text/json` is non-standard media type - */ -var jsonMimeTypeRegex = /^(?:application|text)\/json$/ + /** + * Parse the given string. + * @return {Array} + */ -/** - * JSON text exchanged between systems that are not part of a closed ecosystem - * MUST be encoded using UTF-8. - * - * {@link https://tools.ietf.org/html/rfc8259#section-8.1 | Character Encoding} - */ -var jsonCharacterEncoding = "utf-8" + parse: function(input) { + if (typeof input !== 'string') { + throw new TypeError('expected a string'); + } -function base64ToBuf(b64) { - var binStr = atob(b64) - var len = binStr.length - var arr = new Uint8Array(len) - for (var i = 0; i < len; i++) { - arr[i] = binStr.charCodeAt(i) - } - return arr -} + this.init(this.options); + this.orig = input; + this.input = input; + var self = this; -function decodeBase64String(b64) { - if (typeof TextDecoder === "undefined" || typeof Uint8Array === "undefined") { - return atob(b64) - } - var buf = base64ToBuf(b64); - // Note: `decoder.decode` method will throw a `DOMException` with the - // `"EncodingError"` value when an coding error is found. - var decoder = new TextDecoder(jsonCharacterEncoding, {fatal: true}) - return decoder.decode(buf); -} + function parse() { + // check input before calling `.next()` + input = self.input; -function resolveSourceMapHelper(code, codeUrl) { - codeUrl = urix(codeUrl) + // 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); + } + } - var url = sourceMappingURL.getFrom(code) - if (!url) { - return null - } + if (self.sets.hasOwnProperty(prev.type)) { + self.currentType = prev.type; + } + } - var dataUri = url.match(dataUriRegex) - if (dataUri) { - var mimeType = dataUri[1] || "text/plain" - 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) - error.sourceMapData = data - throw error - } - try { - data.map = parseMapToJSON( - lastParameter === ";base64" ? decodeBase64String(encoded) : decodeURIComponent(encoded), - data - ) - } catch (error) { - error.sourceMapData = data - throw error + // 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) + '"'); + } } - return data - } - - var mapUrl = resolveUrl(codeUrl, url) - return { - sourceMappingURL: url, - url: mapUrl, - sourcesRelativeTo: mapUrl, - map: null - } -} + 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); + } -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: [] + return this.ast; } +}; - if (pending === 0) { - callbackAsync(callback, null, result) - return - } +/** + * Visit `node` with the given `fn` + */ - var done = function() { - pending-- - if (pending === 0) { - callback(null, result) - } +function visit(node, fn) { + if (!node.visited) { + define(node, 'visited', true); + return node.nodes ? mapVisit(node.nodes, fn) : fn(node); } - - 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 = decodeUriComponent(fullUrl) - read(readUrl, function(error, source) { - result.sourcesContent[index] = error ? error : String(source) - done() - }) - } - }) + return node; } -function resolveSourcesSync(map, mapUrl, read, options) { - var result = { - sourcesResolved: [], - sourcesContent: [] - } +/** + * Map visit over array of `nodes`. + */ - if (!map.sources || map.sources.length === 0) { - return result +function mapVisit(nodes, fn) { + var len = nodes.length; + var idx = -1; + while (++idx < len) { + visit(nodes[idx], fn); } +} - 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 = decodeUriComponent(fullUrl) - try { - result.sourcesContent[index] = String(read(readUrl)) - } catch (error) { - result.sourcesContent[index] = error - } - } - } - }) - - return result +function hasOpen(node) { + return node.nodes && node.nodes[0].type === (node.type + '.open'); } -var endingSlash = /\/?$/ +function hasClose(node) { + return node.nodes && utils.last(node.nodes).type === (node.type + '.close'); +} -function resolveSourcesHelper(map, mapUrl, options, fn) { - options = options || {} - mapUrl = urix(mapUrl) - 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/`, not `/scripts/`. 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 hasDelims(node) { + return hasOpen(node) && hasClose(node); } +/** + * Expose `Parser` + */ +module.exports = Parser; -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 = decodeUriComponent(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 -} +/***/ 7974: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +"use strict"; -module.exports = { - resolveSourceMap: resolveSourceMap, - resolveSourceMapSync: resolveSourceMapSync, - resolveSources: resolveSources, - resolveSourcesSync: resolveSourcesSync, - resolve: resolve, - resolveSync: resolveSync, - parseMapToJSON: parseMapToJSON -} +var define = __webpack_require__(5477); + +/** + * 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); +}; /***/ }), -/***/ 21707: -/***/ (function(module) { +/***/ 59657: +/***/ (function(module, exports, __webpack_require__) { -// Copyright 2014 Simon Lydell -// X11 (“MIT”) Licensed. (See LICENSE.) +"use strict"; -void (function(root, factory) { - if (typeof define === "function" && define.amd) { - define(factory) - } else if (true) { - module.exports = factory() - } else {} -}(this, function() { - var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/ +var fs = __webpack_require__(35747); +var path = __webpack_require__(85622); +var define = __webpack_require__(5477); +var utils = __webpack_require__(622); - var regex = RegExp( - "(?:" + - "/\\*" + - "(?:\\s*\r?\n(?://)?)?" + - "(?:" + innerRegex.source + ")" + - "\\s*" + - "\\*/" + - "|" + - "//(?:" + innerRegex.source + ")" + - ")" + - "\\s*" - ) +/** + * 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 + */ - return { +module.exports = mixin; - regex: regex, - _innerRegex: innerRegex, +/** + * Mixin source map support into `compiler`. + * + * @param {Object} `compiler` + * @api public + */ - getFrom: function(code) { - var match = code.match(regex) - return (match ? match[1] || match[2] || "" : null) - }, +function mixin(compiler) { + define(compiler, '_comment', compiler.comment); + compiler.map = new utils.SourceMap.SourceMapGenerator(); + compiler.position = { line: 1, column: 1 }; + compiler.content = {}; + compiler.files = {}; - existsIn: function(code) { - return regex.test(code) - }, + for (var key in exports) { + define(compiler, key, exports[key]); + } +} - removeFrom: function(code) { - return code.replace(regex, "") - }, +/** + * Update position. + * + * @param {String} str + */ - insertBefore: function(code, string) { - var match = code.match(regex) - if (match) { - return code.slice(0, match.index) + string + code.slice(match.index) - } else { - return code + string +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` + */ -/***/ 33218: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +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); +}; -"use strict"; -/*! - * split-string - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. +/** + * 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); +}; -var extend = __webpack_require__(66889); +/** + * Process comments, drops sourceMap comments. + * @param {Object} node + */ -module.exports = function(str, options, fn) { - if (typeof str !== 'string') { - throw new TypeError('expected a string'); +exports.comment = function(node) { + if (/^# sourceMappingURL=/.test(node.comment)) { + return this.emit('', node.position); } + return this._comment(node); +}; - 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; +/***/ 622: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - if (opts.brackets === true) { - brackets = { - '<': '>', - '(': ')', - '[': ']', - '{': '}' - }; - } else if (opts.brackets) { - brackets = opts.brackets; - } +"use strict"; - 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]]; - } - } +/** + * Module dependencies + */ - 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); +exports.extend = __webpack_require__(28727); +exports.SourceMap = __webpack_require__(96241); +exports.sourceMapResolve = __webpack_require__(10227); - 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; - } +/** + * Convert backslash in the given string to forward slashes + */ - if (brackets && brackets[ch]) { - stack.push(ch); - var e = expected(); - var i = idx + 1; +exports.unixify = function(fp) { + return fp.split(/\\+/).join('/'); +}; - if (str.indexOf(e, i + 1) !== -1) { - while (stack.length && i < len) { - var s = str[++i]; - if (s === '\\') { - s++; - continue; - } +/** + * Return true if `val` is a non-empty string + * + * @param {String} `str` + * @return {Boolean} + */ - if (quotes.indexOf(s) !== -1) { - i = getClosingQuote(str, s, i + 1); - continue; - } +exports.isString = function(str) { + return str && typeof str === 'string'; +}; - e = expected(); - if (stack.length && str.indexOf(e, i + 1) === -1) { - break; - } +/** + * Cast `val` to an array + * @return {Array} + */ - if (brackets[s]) { - stack.push(s); - continue; - } +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 {*} + */ - if (e === s) { - stack.pop(); - } - } - } +exports.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; - 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; - } +/***/ 56609: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (keepQuotes(ch, opts) === true) { - ch = str.slice(idx, closeIdx + 1); - } else { - ch = str.slice(idx + 1, closeIdx); - } +var decodeUriComponent = __webpack_require__(95748) - tok.val = ch; - tok.idx = idx = closeIdx; - } +function customDecodeUriComponent(string) { + // `decodeUriComponent` turns `+` into ` `, but that's not wanted. + return decodeUriComponent(string.replace(/\+/g, "%2B")) +} - if (typeof fn === 'function') { - fn(tok, tokens); - ch = tok.val; - idx = tok.idx; - } +module.exports = customDecodeUriComponent - if (tok.val === sep && tok.split !== false) { - arr.push(''); - continue; - } - arr[arr.length - 1] += tok.val; - } +/***/ }), - return arr; -}; +/***/ 89825: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -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; -} +var url = __webpack_require__(78835) -function keepQuotes(ch, opts) { - if (opts.keepDoubleQuotes === true && ch === '"') return true; - if (opts.keepSingleQuotes === true && ch === "'") return true; - return opts.keepQuotes; +function resolveUrl(/* ...urls */) { + return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) { + return url.resolve(resolved, nextUrl) + }) } -function keepEscaping(opts, str, idx) { - if (typeof opts.keepEscaping === 'function') { - return opts.keepEscaping(str, idx); - } - return opts.keepEscaping === true || str[idx + 1] === '\\'; -} +module.exports = resolveUrl /***/ }), -/***/ 66889: +/***/ 10227: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -"use strict"; +var sourceMappingURL = __webpack_require__(21707) +var resolveUrl = __webpack_require__(89825) +var decodeUriComponent = __webpack_require__(56609) +var urix = __webpack_require__(67806) +var atob = __webpack_require__(83327) -var isExtendable = __webpack_require__(28730); -var assignSymbols = __webpack_require__(64353); -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 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 isString(val) { - return (val && typeof val === 'string'); +function readSync(read, url, data) { + var readUrl = decodeUriComponent(url) + try { + return String(read(readUrl)) + } catch (error) { + error.sourceMapData = data + throw error + } } -function toObject(str) { - var obj = {}; - for (var i in str) { - obj[i] = str[i]; + + +function resolveSourceMap(code, codeUrl, read, callback) { + var mapData + try { + mapData = resolveSourceMapHelper(code, codeUrl) + } catch (error) { + return callbackAsync(callback, error) } - return obj; + if (!mapData || mapData.map) { + return callbackAsync(callback, null, mapData) + } + var readUrl = decodeUriComponent(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 isObject(val) { - return (val && typeof val === 'object') || isExtendable(val); +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:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ + /** - * Returns true if the given `key` is an own property of `obj`. + * The media type for JSON text is application/json. + * + * {@link https://tools.ietf.org/html/rfc8259#section-11 | IANA Considerations } + * + * `text/json` is non-standard media type */ +var jsonMimeTypeRegex = /^(?:application|text)\/json$/ -function hasOwn(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); +/** + * JSON text exchanged between systems that are not part of a closed ecosystem + * MUST be encoded using UTF-8. + * + * {@link https://tools.ietf.org/html/rfc8259#section-8.1 | Character Encoding} + */ +var jsonCharacterEncoding = "utf-8" + +function base64ToBuf(b64) { + var binStr = atob(b64) + var len = binStr.length + var arr = new Uint8Array(len) + for (var i = 0; i < len; i++) { + arr[i] = binStr.charCodeAt(i) + } + return arr } -function isEnum(obj, key) { - return Object.prototype.propertyIsEnumerable.call(obj, key); +function decodeBase64String(b64) { + if (typeof TextDecoder === "undefined" || typeof Uint8Array === "undefined") { + return atob(b64) + } + var buf = base64ToBuf(b64); + // Note: `decoder.decode` method will throw a `DOMException` with the + // `"EncodingError"` value when an coding error is found. + var decoder = new TextDecoder(jsonCharacterEncoding, {fatal: true}) + return decoder.decode(buf); +} + +function resolveSourceMapHelper(code, codeUrl) { + codeUrl = urix(codeUrl) + + var url = sourceMappingURL.getFrom(code) + if (!url) { + return null + } + + var dataUri = url.match(dataUriRegex) + if (dataUri) { + var mimeType = dataUri[1] || "text/plain" + 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) + error.sourceMapData = data + throw error + } + try { + data.map = parseMapToJSON( + lastParameter === ";base64" ? decodeBase64String(encoded) : decodeURIComponent(encoded), + data + ) + } catch (error) { + error.sourceMapData = data + throw error + } + return data + } + + var mapUrl = resolveUrl(codeUrl, url) + return { + sourceMappingURL: url, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } } -/***/ }), - -/***/ 28730: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/*! - * is-extendable - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */ +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 isPlainObject = __webpack_require__(81064); + var done = function() { + pending-- + if (pending === 0) { + callback(null, result) + } + } -module.exports = function isExtendable(val) { - return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); -}; + 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 = decodeUriComponent(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 + } -/***/ 69457: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + 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 = decodeUriComponent(fullUrl) + try { + result.sourcesContent[index] = String(read(readUrl)) + } catch (error) { + result.sourcesContent[index] = error + } + } + } + }) -"use strict"; -/*! - * static-extend - * - * Copyright (c) 2016, Jon Schlinkert. - * Licensed under the MIT License. - */ + return result +} +var endingSlash = /\/?$/ +function resolveSourcesHelper(map, mapUrl, options, fn) { + options = options || {} + mapUrl = urix(mapUrl) + 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/`, not `/scripts/`. 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) + } +} -var copy = __webpack_require__(31368); -var define = __webpack_require__(5477); -var util = __webpack_require__(31669); -/** - * 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.'); +function resolve(code, codeUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} } - - return function(Ctor, proto) { - if (typeof Ctor !== 'function') { - throw new TypeError('expected Ctor to be a function.'); + if (code === null) { + var mapUrl = codeUrl + var data = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null } - - 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]; + var readUrl = decodeUriComponent(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) + }) + } - // keep a reference to the parent prototype - define(Ctor.prototype, '_parent_', { - configurable: true, - set: function() {}, - get: function() { - return Parent.prototype; + 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) + }) + } +} - if (typeof extendFn === 'function') { - extendFn(Ctor, Parent); +function resolveSync(code, codeUrl, read, options) { + var mapData + if (code === null) { + var mapUrl = codeUrl + mapData = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null } - - Ctor.extend = extend(Ctor, extendFn); - }; -}; - -/** - * Expose `extend` - */ - -module.exports = extend; - - -/***/ }), - -/***/ 27836: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + 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 +} -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); -class AsyncParallelBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, onDone }) { - let code = ""; - code += `var _results = new Array(${this.options.taps.length});\n`; - code += "var _checkDone = () => {\n"; - code += "for(var i = 0; i < _results.length; i++) {\n"; - code += "var item = _results[i];\n"; - code += "if(item === undefined) return false;\n"; - code += "if(item.result !== undefined) {\n"; - code += onResult("item.result"); - code += "return true;\n"; - code += "}\n"; - code += "if(item.error) {\n"; - code += onError("item.error"); - code += "return true;\n"; - code += "}\n"; - code += "}\n"; - code += "return false;\n"; - code += "}\n"; - code += this.callTapsParallel({ - onError: (i, err, done, doneBreak) => { - let code = ""; - code += `if(${i} < _results.length && ((_results.length = ${i + - 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`; - code += doneBreak(true); - code += "} else {\n"; - code += done(); - code += "}\n"; - return code; - }, - onResult: (i, result, done, doneBreak) => { - let code = ""; - code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i + - 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`; - code += doneBreak(true); - code += "} else {\n"; - code += done(); - code += "}\n"; - return code; - }, - onTap: (i, run, done, doneBreak) => { - let code = ""; - if (i > 0) { - code += `if(${i} >= _results.length) {\n`; - code += done(); - code += "} else {\n"; - } - code += run(); - if (i > 0) code += "}\n"; - return code; - }, - onDone - }); - return code; - } +module.exports = { + resolveSourceMap: resolveSourceMap, + resolveSourceMapSync: resolveSourceMapSync, + resolveSources: resolveSources, + resolveSourcesSync: resolveSourcesSync, + resolve: resolve, + resolveSync: resolveSync, + parseMapToJSON: parseMapToJSON } -const factory = new AsyncParallelBailHookCodeFactory(); - -class AsyncParallelBailHook extends Hook { - compile(options) { - factory.setup(this, options); - return factory.create(options); - } -} -Object.defineProperties(AsyncParallelBailHook.prototype, { - _call: { value: undefined, configurable: true, writable: true } -}); +/***/ }), -module.exports = AsyncParallelBailHook; +/***/ 21707: +/***/ (function(module) { +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) -/***/ }), +void (function(root, factory) { + if (typeof define === "function" && define.amd) { + define(factory) + } else if (true) { + module.exports = factory() + } else {} +}(this, function() { -/***/ 14616: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/ -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + var regex = RegExp( + "(?:" + + "/\\*" + + "(?:\\s*\r?\n(?://)?)?" + + "(?:" + innerRegex.source + ")" + + "\\s*" + + "\\*/" + + "|" + + "//(?:" + innerRegex.source + ")" + + ")" + + "\\s*" + ) + return { -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); + regex: regex, + _innerRegex: innerRegex, -class AsyncParallelHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsParallel({ - onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true), - onDone - }); - } -} + getFrom: function(code) { + var match = code.match(regex) + return (match ? match[1] || match[2] || "" : null) + }, -const factory = new AsyncParallelHookCodeFactory(); + existsIn: function(code) { + return regex.test(code) + }, -class AsyncParallelHook extends Hook { - compile(options) { - factory.setup(this, options); - return factory.create(options); - } -} + removeFrom: function(code) { + return code.replace(regex, "") + }, -Object.defineProperties(AsyncParallelHook.prototype, { - _call: { value: undefined, configurable: true, writable: true } -}); + insertBefore: function(code, string) { + var match = code.match(regex) + if (match) { + return code.slice(0, match.index) + string + code.slice(match.index) + } else { + return code + string + } + } + } -module.exports = AsyncParallelHook; +})); /***/ }), -/***/ 89674: +/***/ 33218: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/*! + * split-string + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); -class AsyncSeriesBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onResult: (i, result, next) => - `if(${result} !== undefined) {\n${onResult( - result - )};\n} else {\n${next()}}\n`, - resultReturns, - onDone - }); - } -} +var extend = __webpack_require__(66889); -const factory = new AsyncSeriesBailHookCodeFactory(); +module.exports = function(str, options, fn) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } -class AsyncSeriesBailHook extends Hook { - compile(options) { - factory.setup(this, options); - return factory.create(options); - } -} + if (typeof options === 'function') { + fn = options; + options = null; + } -Object.defineProperties(AsyncSeriesBailHook.prototype, { - _call: { value: undefined, configurable: true, writable: true } -}); + // allow separator to be defined as a string + if (typeof options === 'string') { + options = { sep: options }; + } -module.exports = AsyncSeriesBailHook; + 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; + } -/***/ 55328: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (brackets && brackets[ch]) { + stack.push(ch); + var e = expected(); + var i = idx + 1; -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + 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; + } -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); + e = expected(); + if (stack.length && str.indexOf(e, i + 1) === -1) { + break; + } -class AsyncSeriesHookCodeFactory extends HookCodeFactory { - content({ onError, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onDone - }); - } -} + if (brackets[s]) { + stack.push(s); + continue; + } -const factory = new AsyncSeriesHookCodeFactory(); + if (e === s) { + stack.pop(); + } + } + } -class AsyncSeriesHook extends Hook { - compile(options) { - factory.setup(this, options); - return factory.create(options); - } -} + closeIdx = i; + if (closeIdx === -1) { + arr[arr.length - 1] += ch; + continue; + } -Object.defineProperties(AsyncSeriesHook.prototype, { - _call: { value: undefined, configurable: true, writable: true } -}); + ch = str.slice(idx, closeIdx + 1); + tok.val = ch; + tok.idx = idx = closeIdx; + } -module.exports = AsyncSeriesHook; + 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; + } -/***/ 14568: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (typeof fn === 'function') { + fn(tok, tokens); + ch = tok.val; + idx = tok.idx; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + if (tok.val === sep && tok.split !== false) { + arr.push(''); + continue; + } + arr[arr.length - 1] += tok.val; + } -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); + return arr; +}; -class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, onDone }) { - return this.callTapsSeries({ - onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), - onResult: (i, result, next) => { - let code = ""; - code += `if(${result} !== undefined) {\n`; - code += `${this._args[0]} = ${result};\n`; - code += `}\n`; - code += next(); - return code; - }, - onDone: () => onResult(this._args[0]) - }); - } +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; } -const factory = new AsyncSeriesWaterfallHookCodeFactory(); - -class AsyncSeriesWaterfallHook extends Hook { - constructor(args) { - super(args); - if (args.length < 1) - throw new Error("Waterfall hooks must have at least one argument"); - } - - compile(options) { - factory.setup(this, options); - return factory.create(options); - } +function keepQuotes(ch, opts) { + if (opts.keepDoubleQuotes === true && ch === '"') return true; + if (opts.keepSingleQuotes === true && ch === "'") return true; + return opts.keepQuotes; } -Object.defineProperties(AsyncSeriesWaterfallHook.prototype, { - _call: { value: undefined, configurable: true, writable: true } -}); - -module.exports = AsyncSeriesWaterfallHook; +function keepEscaping(opts, str, idx) { + if (typeof opts.keepEscaping === 'function') { + return opts.keepEscaping(str, idx); + } + return opts.keepEscaping === true || str[idx + 1] === '\\'; +} /***/ }), -/***/ 12233: -/***/ (function(module) { +/***/ 66889: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -class Hook { - constructor(args) { - if (!Array.isArray(args)) args = []; - this._args = args; - this.taps = []; - this.interceptors = []; - this.call = this._call; - this.promise = this._promise; - this.callAsync = this._callAsync; - this._x = undefined; - } - - compile(options) { - throw new Error("Abstract: should be overriden"); - } - - _createCall(type) { - return this.compile({ - taps: this.taps, - interceptors: this.interceptors, - args: this._args, - type: type - }); - } - - tap(options, fn) { - if (typeof options === "string") options = { name: options }; - if (typeof options !== "object" || options === null) - throw new Error( - "Invalid arguments to tap(options: Object, fn: function)" - ); - options = Object.assign({ type: "sync", fn: fn }, options); - if (typeof options.name !== "string" || options.name === "") - throw new Error("Missing name for tap"); - options = this._runRegisterInterceptors(options); - this._insert(options); - } - - tapAsync(options, fn) { - if (typeof options === "string") options = { name: options }; - if (typeof options !== "object" || options === null) - throw new Error( - "Invalid arguments to tapAsync(options: Object, fn: function)" - ); - options = Object.assign({ type: "async", fn: fn }, options); - if (typeof options.name !== "string" || options.name === "") - throw new Error("Missing name for tapAsync"); - options = this._runRegisterInterceptors(options); - this._insert(options); - } - tapPromise(options, fn) { - if (typeof options === "string") options = { name: options }; - if (typeof options !== "object" || options === null) - throw new Error( - "Invalid arguments to tapPromise(options: Object, fn: function)" - ); - options = Object.assign({ type: "promise", fn: fn }, options); - if (typeof options.name !== "string" || options.name === "") - throw new Error("Missing name for tapPromise"); - options = this._runRegisterInterceptors(options); - this._insert(options); - } - _runRegisterInterceptors(options) { - for (const interceptor of this.interceptors) { - if (interceptor.register) { - const newOptions = interceptor.register(options); - if (newOptions !== undefined) options = newOptions; - } - } - return options; - } +var isExtendable = __webpack_require__(28730); +var assignSymbols = __webpack_require__(64353); - withOptions(options) { - const mergeOptions = opt => - Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt); +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; +}; - // Prevent creating endless prototype chains - options = Object.assign({}, options, this._withOptions); - const base = this._withOptionsBase || this; - const newHook = Object.create(base); +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} - (newHook.tapAsync = (opt, fn) => base.tapAsync(mergeOptions(opt), fn)), - (newHook.tap = (opt, fn) => base.tap(mergeOptions(opt), fn)); - newHook.tapPromise = (opt, fn) => base.tapPromise(mergeOptions(opt), fn); - newHook._withOptions = options; - newHook._withOptionsBase = base; - return newHook; - } +function isString(val) { + return (val && typeof val === 'string'); +} - isUsed() { - return this.taps.length > 0 || this.interceptors.length > 0; - } +function toObject(str) { + var obj = {}; + for (var i in str) { + obj[i] = str[i]; + } + return obj; +} - intercept(interceptor) { - this._resetCompilation(); - this.interceptors.push(Object.assign({}, interceptor)); - if (interceptor.register) { - for (let i = 0; i < this.taps.length; i++) - this.taps[i] = interceptor.register(this.taps[i]); - } - } +function isObject(val) { + return (val && typeof val === 'object') || isExtendable(val); +} - _resetCompilation() { - this.call = this._call; - this.callAsync = this._callAsync; - this.promise = this._promise; - } +/** + * Returns true if the given `key` is an own property of `obj`. + */ - _insert(item) { - this._resetCompilation(); - let before; - if (typeof item.before === "string") before = new Set([item.before]); - else if (Array.isArray(item.before)) { - before = new Set(item.before); - } - let stage = 0; - if (typeof item.stage === "number") stage = item.stage; - let i = this.taps.length; - while (i > 0) { - i--; - const x = this.taps[i]; - this.taps[i + 1] = x; - const xStage = x.stage || 0; - if (before) { - if (before.has(x.name)) { - before.delete(x.name); - continue; - } - if (before.size > 0) { - continue; - } - } - if (xStage > stage) { - continue; - } - i++; - break; - } - this.taps[i] = item; - } +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); } -function createCompileDelegate(name, type) { - return function lazyCompileHook(...args) { - this[name] = this._createCall(type); - return this[name](...args); - }; +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); } -Object.defineProperties(Hook.prototype, { - _call: { - value: createCompileDelegate("call", "sync"), - configurable: true, - writable: true - }, - _promise: { - value: createCompileDelegate("promise", "promise"), - configurable: true, - writable: true - }, - _callAsync: { - value: createCompileDelegate("callAsync", "async"), - configurable: true, - writable: true - } -}); -module.exports = Hook; +/***/ }), + +/***/ 28730: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + + +var isPlainObject = __webpack_require__(81064); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; /***/ }), -/***/ 64288: -/***/ (function(module) { +/***/ 69457: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ +/*! + * static-extend + * + * Copyright (c) 2016, Jon Schlinkert. + * Licensed under the MIT License. + */ -class HookCodeFactory { - constructor(config) { - this.config = config; - this.options = undefined; - this._args = undefined; - } - create(options) { - this.init(options); - let fn; - switch (this.options.type) { - case "sync": - fn = new Function( - this.args(), - '"use strict";\n' + - this.header() + - this.content({ - onError: err => `throw ${err};\n`, - onResult: result => `return ${result};\n`, - resultReturns: true, - onDone: () => "", - rethrowIfPossible: true - }) - ); - break; - case "async": - fn = new Function( - this.args({ - after: "_callback" - }), - '"use strict";\n' + - this.header() + - this.content({ - onError: err => `_callback(${err});\n`, - onResult: result => `_callback(null, ${result});\n`, - onDone: () => "_callback();\n" - }) - ); - break; - case "promise": - let errorHelperUsed = false; - const content = this.content({ - onError: err => { - errorHelperUsed = true; - return `_error(${err});\n`; - }, - onResult: result => `_resolve(${result});\n`, - onDone: () => "_resolve();\n" - }); - let code = ""; - code += '"use strict";\n'; - code += "return new Promise((_resolve, _reject) => {\n"; - if (errorHelperUsed) { - code += "var _sync = true;\n"; - code += "function _error(_err) {\n"; - code += "if(_sync)\n"; - code += "_resolve(Promise.resolve().then(() => { throw _err; }));\n"; - code += "else\n"; - code += "_reject(_err);\n"; - code += "};\n"; - } - code += this.header(); - code += content; - if (errorHelperUsed) { - code += "_sync = false;\n"; - } - code += "});\n"; - fn = new Function(this.args(), code); - break; - } - this.deinit(); - return fn; - } +var copy = __webpack_require__(31368); +var define = __webpack_require__(5477); +var util = __webpack_require__(31669); + +/** + * 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.'); + } - setup(instance, options) { - instance._x = options.taps.map(t => t.fn); - } + return function(Ctor, proto) { + if (typeof Ctor !== 'function') { + throw new TypeError('expected Ctor to be a function.'); + } - /** - * @param {{ type: "sync" | "promise" | "async", taps: Array, interceptors: Array }} options - */ - init(options) { - this.options = options; - this._args = options.args.slice(); - } + util.inherits(Ctor, Parent); + copy(Ctor, Parent); - deinit() { - this.options = undefined; - this._args = undefined; - } + // proto can be null or a plain object + if (typeof proto === 'object') { + var obj = Object.create(proto); - header() { - let code = ""; - if (this.needContext()) { - code += "var _context = {};\n"; - } else { - code += "var _context;\n"; - } - code += "var _x = this._x;\n"; - if (this.options.interceptors.length > 0) { - code += "var _taps = this.taps;\n"; - code += "var _interceptors = this.interceptors;\n"; - } - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.call) { - code += `${this.getInterceptor(i)}.call(${this.args({ - before: interceptor.context ? "_context" : undefined - })});\n`; - } - } - return code; - } + for (var k in obj) { + Ctor.prototype[k] = obj[k]; + } + } - needContext() { - for (const tap of this.options.taps) if (tap.context) return true; - return false; - } + // keep a reference to the parent prototype + define(Ctor.prototype, '_parent_', { + configurable: true, + set: function() {}, + get: function() { + return Parent.prototype; + } + }); - callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) { - let code = ""; - let hasTapCached = false; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.tap) { - if (!hasTapCached) { - code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`; - hasTapCached = true; - } - code += `${this.getInterceptor(i)}.tap(${ - interceptor.context ? "_context, " : "" - }_tap${tapIndex});\n`; - } - } - code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`; - const tap = this.options.taps[tapIndex]; - switch (tap.type) { - case "sync": - if (!rethrowIfPossible) { - code += `var _hasError${tapIndex} = false;\n`; - code += "try {\n"; - } - if (onResult) { - code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - } else { - code += `_fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - } - if (!rethrowIfPossible) { - code += "} catch(_err) {\n"; - code += `_hasError${tapIndex} = true;\n`; - code += onError("_err"); - code += "}\n"; - code += `if(!_hasError${tapIndex}) {\n`; - } - if (onResult) { - code += onResult(`_result${tapIndex}`); - } - if (onDone) { - code += onDone(); - } - if (!rethrowIfPossible) { - code += "}\n"; - } - break; - case "async": - let cbCode = ""; - if (onResult) cbCode += `(_err${tapIndex}, _result${tapIndex}) => {\n`; - else cbCode += `_err${tapIndex} => {\n`; - cbCode += `if(_err${tapIndex}) {\n`; - cbCode += onError(`_err${tapIndex}`); - cbCode += "} else {\n"; - if (onResult) { - cbCode += onResult(`_result${tapIndex}`); - } - if (onDone) { - cbCode += onDone(); - } - cbCode += "}\n"; - cbCode += "}"; - code += `_fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined, - after: cbCode - })});\n`; - break; - case "promise": - code += `var _hasResult${tapIndex} = false;\n`; - code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({ - before: tap.context ? "_context" : undefined - })});\n`; - code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`; - code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`; - code += `_promise${tapIndex}.then(_result${tapIndex} => {\n`; - code += `_hasResult${tapIndex} = true;\n`; - if (onResult) { - code += onResult(`_result${tapIndex}`); - } - if (onDone) { - code += onDone(); - } - code += `}, _err${tapIndex} => {\n`; - code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`; - code += onError(`_err${tapIndex}`); - code += "});\n"; - break; - } - return code; - } + if (typeof extendFn === 'function') { + extendFn(Ctor, Parent); + } - callTapsSeries({ - onError, - onResult, - resultReturns, - onDone, - doneReturns, - rethrowIfPossible - }) { - if (this.options.taps.length === 0) return onDone(); - const firstAsync = this.options.taps.findIndex(t => t.type !== "sync"); - const somethingReturns = resultReturns || doneReturns || false; - let code = ""; - let current = onDone; - for (let j = this.options.taps.length - 1; j >= 0; j--) { - const i = j; - const unroll = current !== onDone && this.options.taps[i].type !== "sync"; - if (unroll) { - code += `function _next${i}() {\n`; - code += current(); - code += `}\n`; - current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`; - } - const done = current; - const doneBreak = skipDone => { - if (skipDone) return ""; - return onDone(); - }; - const content = this.callTap(i, { - onError: error => onError(i, error, done, doneBreak), - onResult: - onResult && - (result => { - return onResult(i, result, done, doneBreak); - }), - onDone: !onResult && done, - rethrowIfPossible: - rethrowIfPossible && (firstAsync < 0 || i < firstAsync) - }); - current = () => content; - } - code += current(); - return code; - } + Ctor.extend = extend(Ctor, extendFn); + }; +}; - callTapsLooping({ onError, onDone, rethrowIfPossible }) { - if (this.options.taps.length === 0) return onDone(); - const syncOnly = this.options.taps.every(t => t.type === "sync"); +/** + * Expose `extend` + */ + +module.exports = extend; + + +/***/ }), + +/***/ 27836: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); + +class AsyncParallelBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, onDone }) { let code = ""; - if (!syncOnly) { - code += "var _looper = () => {\n"; - code += "var _loopAsync = false;\n"; - } - code += "var _loop;\n"; - code += "do {\n"; - code += "_loop = false;\n"; - for (let i = 0; i < this.options.interceptors.length; i++) { - const interceptor = this.options.interceptors[i]; - if (interceptor.loop) { - code += `${this.getInterceptor(i)}.loop(${this.args({ - before: interceptor.context ? "_context" : undefined - })});\n`; - } - } - code += this.callTapsSeries({ - onError, - onResult: (i, result, next, doneBreak) => { + code += `var _results = new Array(${this.options.taps.length});\n`; + code += "var _checkDone = () => {\n"; + code += "for(var i = 0; i < _results.length; i++) {\n"; + code += "var item = _results[i];\n"; + code += "if(item === undefined) return false;\n"; + code += "if(item.result !== undefined) {\n"; + code += onResult("item.result"); + code += "return true;\n"; + code += "}\n"; + code += "if(item.error) {\n"; + code += onError("item.error"); + code += "return true;\n"; + code += "}\n"; + code += "}\n"; + code += "return false;\n"; + code += "}\n"; + code += this.callTapsParallel({ + onError: (i, err, done, doneBreak) => { let code = ""; - code += `if(${result} !== undefined) {\n`; - code += "_loop = true;\n"; - if (!syncOnly) code += "if(_loopAsync) _looper();\n"; + code += `if(${i} < _results.length && ((_results.length = ${i + + 1}), (_results[${i}] = { error: ${err} }), _checkDone())) {\n`; code += doneBreak(true); - code += `} else {\n`; - code += next(); - code += `}\n`; + code += "} else {\n"; + code += done(); + code += "}\n"; return code; }, - onDone: - onDone && - (() => { - let code = ""; - code += "if(!_loop) {\n"; - code += onDone(); - code += "}\n"; - return code; - }), - rethrowIfPossible: rethrowIfPossible && syncOnly + onResult: (i, result, done, doneBreak) => { + let code = ""; + code += `if(${i} < _results.length && (${result} !== undefined && (_results.length = ${i + + 1}), (_results[${i}] = { result: ${result} }), _checkDone())) {\n`; + code += doneBreak(true); + code += "} else {\n"; + code += done(); + code += "}\n"; + return code; + }, + onTap: (i, run, done, doneBreak) => { + let code = ""; + if (i > 0) { + code += `if(${i} >= _results.length) {\n`; + code += done(); + code += "} else {\n"; + } + code += run(); + if (i > 0) code += "}\n"; + return code; + }, + onDone }); - code += "} while(_loop);\n"; - if (!syncOnly) { - code += "_loopAsync = true;\n"; - code += "};\n"; - code += "_looper();\n"; - } - return code; - } - - callTapsParallel({ - onError, - onResult, - onDone, - rethrowIfPossible, - onTap = (i, run) => run() - }) { - if (this.options.taps.length <= 1) { - return this.callTapsSeries({ - onError, - onResult, - onDone, - rethrowIfPossible - }); - } - let code = ""; - code += "do {\n"; - code += `var _counter = ${this.options.taps.length};\n`; - if (onDone) { - code += "var _done = () => {\n"; - code += onDone(); - code += "};\n"; - } - for (let i = 0; i < this.options.taps.length; i++) { - const done = () => { - if (onDone) return "if(--_counter === 0) _done();\n"; - else return "--_counter;"; - }; - const doneBreak = skipDone => { - if (skipDone || !onDone) return "_counter = 0;\n"; - else return "_counter = 0;\n_done();\n"; - }; - code += "if(_counter <= 0) break;\n"; - code += onTap( - i, - () => - this.callTap(i, { - onError: error => { - let code = ""; - code += "if(_counter > 0) {\n"; - code += onError(i, error, done, doneBreak); - code += "}\n"; - return code; - }, - onResult: - onResult && - (result => { - let code = ""; - code += "if(_counter > 0) {\n"; - code += onResult(i, result, done, doneBreak); - code += "}\n"; - return code; - }), - onDone: - !onResult && - (() => { - return done(); - }), - rethrowIfPossible - }), - done, - doneBreak - ); - } - code += "} while(false);\n"; return code; } +} - args({ before, after } = {}) { - let allArgs = this._args; - if (before) allArgs = [before].concat(allArgs); - if (after) allArgs = allArgs.concat(after); - if (allArgs.length === 0) { - return ""; - } else { - return allArgs.join(", "); - } - } - - getTapFn(idx) { - return `_x[${idx}]`; - } - - getTap(idx) { - return `_taps[${idx}]`; - } +const factory = new AsyncParallelBailHookCodeFactory(); - getInterceptor(idx) { - return `_interceptors[${idx}]`; +class AsyncParallelBailHook extends Hook { + compile(options) { + factory.setup(this, options); + return factory.create(options); } } -module.exports = HookCodeFactory; +Object.defineProperties(AsyncParallelBailHook.prototype, { + _call: { value: undefined, configurable: true, writable: true } +}); + +module.exports = AsyncParallelBailHook; /***/ }), -/***/ 35233: -/***/ (function(module) { +/***/ 14616: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* @@ -47036,61 +46684,82 @@ module.exports = HookCodeFactory; */ -class HookMap { - constructor(factory) { - this._map = new Map(); - this._factory = factory; - this._interceptors = []; - } +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); - get(key) { - return this._map.get(key); +class AsyncParallelHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsParallel({ + onError: (i, err, done, doneBreak) => onError(err) + doneBreak(true), + onDone + }); } +} - for(key) { - const hook = this.get(key); - if (hook !== undefined) { - return hook; - } - let newHook = this._factory(key); - const interceptors = this._interceptors; - for (let i = 0; i < interceptors.length; i++) { - newHook = interceptors[i].factory(key, newHook); - } - this._map.set(key, newHook); - return newHook; - } +const factory = new AsyncParallelHookCodeFactory(); - intercept(interceptor) { - this._interceptors.push( - Object.assign( - { - factory: (key, hook) => hook - }, - interceptor - ) - ); +class AsyncParallelHook extends Hook { + compile(options) { + factory.setup(this, options); + return factory.create(options); } +} - tap(key, options, fn) { - return this.for(key).tap(options, fn); - } +Object.defineProperties(AsyncParallelHook.prototype, { + _call: { value: undefined, configurable: true, writable: true } +}); - tapAsync(key, options, fn) { - return this.for(key).tapAsync(options, fn); +module.exports = AsyncParallelHook; + + +/***/ }), + +/***/ 89674: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); + +class AsyncSeriesBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onResult: (i, result, next) => + `if(${result} !== undefined) {\n${onResult( + result + )};\n} else {\n${next()}}\n`, + resultReturns, + onDone + }); } +} - tapPromise(key, options, fn) { - return this.for(key).tapPromise(options, fn); +const factory = new AsyncSeriesBailHookCodeFactory(); + +class AsyncSeriesBailHook extends Hook { + compile(options) { + factory.setup(this, options); + return factory.create(options); } } -module.exports = HookMap; +Object.defineProperties(AsyncSeriesBailHook.prototype, { + _call: { value: undefined, configurable: true, writable: true } +}); + +module.exports = AsyncSeriesBailHook; /***/ }), -/***/ 93607: +/***/ 55328: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -47101,54 +46770,36 @@ module.exports = HookMap; const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); -class MultiHook { - constructor(hooks) { - this.hooks = hooks; - } - - tap(options, fn) { - for (const hook of this.hooks) { - hook.tap(options, fn); - } - } - - tapAsync(options, fn) { - for (const hook of this.hooks) { - hook.tapAsync(options, fn); - } - } - - tapPromise(options, fn) { - for (const hook of this.hooks) { - hook.tapPromise(options, fn); - } - } - - isUsed() { - for (const hook of this.hooks) { - if (hook.isUsed()) return true; - } - return false; +class AsyncSeriesHookCodeFactory extends HookCodeFactory { + content({ onError, onDone }) { + return this.callTapsSeries({ + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onDone + }); } +} - intercept(interceptor) { - for (const hook of this.hooks) { - hook.intercept(interceptor); - } - } +const factory = new AsyncSeriesHookCodeFactory(); - withOptions(options) { - return new MultiHook(this.hooks.map(h => h.withOptions(options))); +class AsyncSeriesHook extends Hook { + compile(options) { + factory.setup(this, options); + return factory.create(options); } } -module.exports = MultiHook; +Object.defineProperties(AsyncSeriesHook.prototype, { + _call: { value: undefined, configurable: true, writable: true } +}); + +module.exports = AsyncSeriesHook; /***/ }), -/***/ 16477: +/***/ 14568: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; @@ -47161,30 +46812,30 @@ module.exports = MultiHook; const Hook = __webpack_require__(12233); const HookCodeFactory = __webpack_require__(64288); -class SyncBailHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) { +class AsyncSeriesWaterfallHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, onDone }) { return this.callTapsSeries({ - onError: (i, err) => onError(err), - onResult: (i, result, next) => - `if(${result} !== undefined) {\n${onResult( - result - )};\n} else {\n${next()}}\n`, - resultReturns, - onDone, - rethrowIfPossible + onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true), + onResult: (i, result, next) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += `${this._args[0]} = ${result};\n`; + code += `}\n`; + code += next(); + return code; + }, + onDone: () => onResult(this._args[0]) }); } } -const factory = new SyncBailHookCodeFactory(); - -class SyncBailHook extends Hook { - tapAsync() { - throw new Error("tapAsync is not supported on a SyncBailHook"); - } +const factory = new AsyncSeriesWaterfallHookCodeFactory(); - tapPromise() { - throw new Error("tapPromise is not supported on a SyncBailHook"); +class AsyncSeriesWaterfallHook extends Hook { + constructor(args) { + super(args); + if (args.length < 1) + throw new Error("Waterfall hooks must have at least one argument"); } compile(options) { @@ -47193,13 +46844,17 @@ class SyncBailHook extends Hook { } } -module.exports = SyncBailHook; +Object.defineProperties(AsyncSeriesWaterfallHook.prototype, { + _call: { value: undefined, configurable: true, writable: true } +}); + +module.exports = AsyncSeriesWaterfallHook; /***/ }), -/***/ 77633: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 12233: +/***/ (function(module) { "use strict"; /* @@ -47208,43 +46863,182 @@ module.exports = SyncBailHook; */ -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); +class Hook { + constructor(args) { + if (!Array.isArray(args)) args = []; + this._args = args; + this.taps = []; + this.interceptors = []; + this.call = this._call; + this.promise = this._promise; + this.callAsync = this._callAsync; + this._x = undefined; + } -class SyncHookCodeFactory extends HookCodeFactory { - content({ onError, onDone, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onDone, - rethrowIfPossible + compile(options) { + throw new Error("Abstract: should be overriden"); + } + + _createCall(type) { + return this.compile({ + taps: this.taps, + interceptors: this.interceptors, + args: this._args, + type: type }); } -} -const factory = new SyncHookCodeFactory(); + tap(options, fn) { + if (typeof options === "string") options = { name: options }; + if (typeof options !== "object" || options === null) + throw new Error( + "Invalid arguments to tap(options: Object, fn: function)" + ); + options = Object.assign({ type: "sync", fn: fn }, options); + if (typeof options.name !== "string" || options.name === "") + throw new Error("Missing name for tap"); + options = this._runRegisterInterceptors(options); + this._insert(options); + } -class SyncHook extends Hook { - tapAsync() { - throw new Error("tapAsync is not supported on a SyncHook"); + tapAsync(options, fn) { + if (typeof options === "string") options = { name: options }; + if (typeof options !== "object" || options === null) + throw new Error( + "Invalid arguments to tapAsync(options: Object, fn: function)" + ); + options = Object.assign({ type: "async", fn: fn }, options); + if (typeof options.name !== "string" || options.name === "") + throw new Error("Missing name for tapAsync"); + options = this._runRegisterInterceptors(options); + this._insert(options); } - tapPromise() { - throw new Error("tapPromise is not supported on a SyncHook"); + tapPromise(options, fn) { + if (typeof options === "string") options = { name: options }; + if (typeof options !== "object" || options === null) + throw new Error( + "Invalid arguments to tapPromise(options: Object, fn: function)" + ); + options = Object.assign({ type: "promise", fn: fn }, options); + if (typeof options.name !== "string" || options.name === "") + throw new Error("Missing name for tapPromise"); + options = this._runRegisterInterceptors(options); + this._insert(options); + } + + _runRegisterInterceptors(options) { + for (const interceptor of this.interceptors) { + if (interceptor.register) { + const newOptions = interceptor.register(options); + if (newOptions !== undefined) options = newOptions; + } + } + return options; + } + + withOptions(options) { + const mergeOptions = opt => + Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt); + + // Prevent creating endless prototype chains + options = Object.assign({}, options, this._withOptions); + const base = this._withOptionsBase || this; + const newHook = Object.create(base); + + (newHook.tapAsync = (opt, fn) => base.tapAsync(mergeOptions(opt), fn)), + (newHook.tap = (opt, fn) => base.tap(mergeOptions(opt), fn)); + newHook.tapPromise = (opt, fn) => base.tapPromise(mergeOptions(opt), fn); + newHook._withOptions = options; + newHook._withOptionsBase = base; + return newHook; + } + + isUsed() { + return this.taps.length > 0 || this.interceptors.length > 0; + } + + intercept(interceptor) { + this._resetCompilation(); + this.interceptors.push(Object.assign({}, interceptor)); + if (interceptor.register) { + for (let i = 0; i < this.taps.length; i++) + this.taps[i] = interceptor.register(this.taps[i]); + } + } + + _resetCompilation() { + this.call = this._call; + this.callAsync = this._callAsync; + this.promise = this._promise; + } + + _insert(item) { + this._resetCompilation(); + let before; + if (typeof item.before === "string") before = new Set([item.before]); + else if (Array.isArray(item.before)) { + before = new Set(item.before); + } + let stage = 0; + if (typeof item.stage === "number") stage = item.stage; + let i = this.taps.length; + while (i > 0) { + i--; + const x = this.taps[i]; + this.taps[i + 1] = x; + const xStage = x.stage || 0; + if (before) { + if (before.has(x.name)) { + before.delete(x.name); + continue; + } + if (before.size > 0) { + continue; + } + } + if (xStage > stage) { + continue; + } + i++; + break; + } + this.taps[i] = item; } +} - compile(options) { - factory.setup(this, options); - return factory.create(options); - } +function createCompileDelegate(name, type) { + return function lazyCompileHook(...args) { + this[name] = this._createCall(type); + return this[name](...args); + }; } -module.exports = SyncHook; +Object.defineProperties(Hook.prototype, { + _call: { + value: createCompileDelegate("call", "sync"), + configurable: true, + writable: true + }, + _promise: { + value: createCompileDelegate("promise", "promise"), + configurable: true, + writable: true + }, + _callAsync: { + value: createCompileDelegate("callAsync", "async"), + configurable: true, + writable: true + } +}); + +module.exports = Hook; /***/ }), -/***/ 13608: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 64288: +/***/ (function(module) { "use strict"; /* @@ -47253,192 +47047,413 @@ module.exports = SyncHook; */ -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); - -class SyncLoopHookCodeFactory extends HookCodeFactory { - content({ onError, onDone, rethrowIfPossible }) { - return this.callTapsLooping({ - onError: (i, err) => onError(err), - onDone, - rethrowIfPossible - }); +class HookCodeFactory { + constructor(config) { + this.config = config; + this.options = undefined; + this._args = undefined; } -} - -const factory = new SyncLoopHookCodeFactory(); -class SyncLoopHook extends Hook { - tapAsync() { - throw new Error("tapAsync is not supported on a SyncLoopHook"); + create(options) { + this.init(options); + let fn; + switch (this.options.type) { + case "sync": + fn = new Function( + this.args(), + '"use strict";\n' + + this.header() + + this.content({ + onError: err => `throw ${err};\n`, + onResult: result => `return ${result};\n`, + resultReturns: true, + onDone: () => "", + rethrowIfPossible: true + }) + ); + break; + case "async": + fn = new Function( + this.args({ + after: "_callback" + }), + '"use strict";\n' + + this.header() + + this.content({ + onError: err => `_callback(${err});\n`, + onResult: result => `_callback(null, ${result});\n`, + onDone: () => "_callback();\n" + }) + ); + break; + case "promise": + let errorHelperUsed = false; + const content = this.content({ + onError: err => { + errorHelperUsed = true; + return `_error(${err});\n`; + }, + onResult: result => `_resolve(${result});\n`, + onDone: () => "_resolve();\n" + }); + let code = ""; + code += '"use strict";\n'; + code += "return new Promise((_resolve, _reject) => {\n"; + if (errorHelperUsed) { + code += "var _sync = true;\n"; + code += "function _error(_err) {\n"; + code += "if(_sync)\n"; + code += "_resolve(Promise.resolve().then(() => { throw _err; }));\n"; + code += "else\n"; + code += "_reject(_err);\n"; + code += "};\n"; + } + code += this.header(); + code += content; + if (errorHelperUsed) { + code += "_sync = false;\n"; + } + code += "});\n"; + fn = new Function(this.args(), code); + break; + } + this.deinit(); + return fn; } - tapPromise() { - throw new Error("tapPromise is not supported on a SyncLoopHook"); + setup(instance, options) { + instance._x = options.taps.map(t => t.fn); } - compile(options) { - factory.setup(this, options); - return factory.create(options); + /** + * @param {{ type: "sync" | "promise" | "async", taps: Array, interceptors: Array }} options + */ + init(options) { + this.options = options; + this._args = options.args.slice(); } -} - -module.exports = SyncLoopHook; - -/***/ }), + deinit() { + this.options = undefined; + this._args = undefined; + } -/***/ 6548: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + header() { + let code = ""; + if (this.needContext()) { + code += "var _context = {};\n"; + } else { + code += "var _context;\n"; + } + code += "var _x = this._x;\n"; + if (this.options.interceptors.length > 0) { + code += "var _taps = this.taps;\n"; + code += "var _interceptors = this.interceptors;\n"; + } + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.call) { + code += `${this.getInterceptor(i)}.call(${this.args({ + before: interceptor.context ? "_context" : undefined + })});\n`; + } + } + return code; + } -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ + needContext() { + for (const tap of this.options.taps) if (tap.context) return true; + return false; + } + callTap(tapIndex, { onError, onResult, onDone, rethrowIfPossible }) { + let code = ""; + let hasTapCached = false; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.tap) { + if (!hasTapCached) { + code += `var _tap${tapIndex} = ${this.getTap(tapIndex)};\n`; + hasTapCached = true; + } + code += `${this.getInterceptor(i)}.tap(${ + interceptor.context ? "_context, " : "" + }_tap${tapIndex});\n`; + } + } + code += `var _fn${tapIndex} = ${this.getTapFn(tapIndex)};\n`; + const tap = this.options.taps[tapIndex]; + switch (tap.type) { + case "sync": + if (!rethrowIfPossible) { + code += `var _hasError${tapIndex} = false;\n`; + code += "try {\n"; + } + if (onResult) { + code += `var _result${tapIndex} = _fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + } else { + code += `_fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + } + if (!rethrowIfPossible) { + code += "} catch(_err) {\n"; + code += `_hasError${tapIndex} = true;\n`; + code += onError("_err"); + code += "}\n"; + code += `if(!_hasError${tapIndex}) {\n`; + } + if (onResult) { + code += onResult(`_result${tapIndex}`); + } + if (onDone) { + code += onDone(); + } + if (!rethrowIfPossible) { + code += "}\n"; + } + break; + case "async": + let cbCode = ""; + if (onResult) cbCode += `(_err${tapIndex}, _result${tapIndex}) => {\n`; + else cbCode += `_err${tapIndex} => {\n`; + cbCode += `if(_err${tapIndex}) {\n`; + cbCode += onError(`_err${tapIndex}`); + cbCode += "} else {\n"; + if (onResult) { + cbCode += onResult(`_result${tapIndex}`); + } + if (onDone) { + cbCode += onDone(); + } + cbCode += "}\n"; + cbCode += "}"; + code += `_fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined, + after: cbCode + })});\n`; + break; + case "promise": + code += `var _hasResult${tapIndex} = false;\n`; + code += `var _promise${tapIndex} = _fn${tapIndex}(${this.args({ + before: tap.context ? "_context" : undefined + })});\n`; + code += `if (!_promise${tapIndex} || !_promise${tapIndex}.then)\n`; + code += ` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${tapIndex} + ')');\n`; + code += `_promise${tapIndex}.then(_result${tapIndex} => {\n`; + code += `_hasResult${tapIndex} = true;\n`; + if (onResult) { + code += onResult(`_result${tapIndex}`); + } + if (onDone) { + code += onDone(); + } + code += `}, _err${tapIndex} => {\n`; + code += `if(_hasResult${tapIndex}) throw _err${tapIndex};\n`; + code += onError(`_err${tapIndex}`); + code += "});\n"; + break; + } + return code; + } -const Hook = __webpack_require__(12233); -const HookCodeFactory = __webpack_require__(64288); + callTapsSeries({ + onError, + onResult, + resultReturns, + onDone, + doneReturns, + rethrowIfPossible + }) { + if (this.options.taps.length === 0) return onDone(); + const firstAsync = this.options.taps.findIndex(t => t.type !== "sync"); + const somethingReturns = resultReturns || doneReturns || false; + let code = ""; + let current = onDone; + for (let j = this.options.taps.length - 1; j >= 0; j--) { + const i = j; + const unroll = current !== onDone && this.options.taps[i].type !== "sync"; + if (unroll) { + code += `function _next${i}() {\n`; + code += current(); + code += `}\n`; + current = () => `${somethingReturns ? "return " : ""}_next${i}();\n`; + } + const done = current; + const doneBreak = skipDone => { + if (skipDone) return ""; + return onDone(); + }; + const content = this.callTap(i, { + onError: error => onError(i, error, done, doneBreak), + onResult: + onResult && + (result => { + return onResult(i, result, done, doneBreak); + }), + onDone: !onResult && done, + rethrowIfPossible: + rethrowIfPossible && (firstAsync < 0 || i < firstAsync) + }); + current = () => content; + } + code += current(); + return code; + } -class SyncWaterfallHookCodeFactory extends HookCodeFactory { - content({ onError, onResult, resultReturns, rethrowIfPossible }) { - return this.callTapsSeries({ - onError: (i, err) => onError(err), - onResult: (i, result, next) => { + callTapsLooping({ onError, onDone, rethrowIfPossible }) { + if (this.options.taps.length === 0) return onDone(); + const syncOnly = this.options.taps.every(t => t.type === "sync"); + let code = ""; + if (!syncOnly) { + code += "var _looper = () => {\n"; + code += "var _loopAsync = false;\n"; + } + code += "var _loop;\n"; + code += "do {\n"; + code += "_loop = false;\n"; + for (let i = 0; i < this.options.interceptors.length; i++) { + const interceptor = this.options.interceptors[i]; + if (interceptor.loop) { + code += `${this.getInterceptor(i)}.loop(${this.args({ + before: interceptor.context ? "_context" : undefined + })});\n`; + } + } + code += this.callTapsSeries({ + onError, + onResult: (i, result, next, doneBreak) => { let code = ""; code += `if(${result} !== undefined) {\n`; - code += `${this._args[0]} = ${result};\n`; - code += `}\n`; + code += "_loop = true;\n"; + if (!syncOnly) code += "if(_loopAsync) _looper();\n"; + code += doneBreak(true); + code += `} else {\n`; code += next(); + code += `}\n`; return code; }, - onDone: () => onResult(this._args[0]), - doneReturns: resultReturns, - rethrowIfPossible + onDone: + onDone && + (() => { + let code = ""; + code += "if(!_loop) {\n"; + code += onDone(); + code += "}\n"; + return code; + }), + rethrowIfPossible: rethrowIfPossible && syncOnly }); + code += "} while(_loop);\n"; + if (!syncOnly) { + code += "_loopAsync = true;\n"; + code += "};\n"; + code += "_looper();\n"; + } + return code; } -} - -const factory = new SyncWaterfallHookCodeFactory(); - -class SyncWaterfallHook extends Hook { - constructor(args) { - super(args); - if (args.length < 1) - throw new Error("Waterfall hooks must have at least one argument"); - } - - tapAsync() { - throw new Error("tapAsync is not supported on a SyncWaterfallHook"); - } - - tapPromise() { - throw new Error("tapPromise is not supported on a SyncWaterfallHook"); - } - - compile(options) { - factory.setup(this, options); - return factory.create(options); - } -} - -module.exports = SyncWaterfallHook; - - -/***/ }), - -/***/ 72693: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ - - -const util = __webpack_require__(31669); -const SyncBailHook = __webpack_require__(16477); -function Tapable() { - this._pluginCompat = new SyncBailHook(["options"]); - this._pluginCompat.tap( - { - name: "Tapable camelCase", - stage: 100 - }, - options => { - options.names.add( - options.name.replace(/[- ]([a-z])/g, (str, ch) => ch.toUpperCase()) + callTapsParallel({ + onError, + onResult, + onDone, + rethrowIfPossible, + onTap = (i, run) => run() + }) { + if (this.options.taps.length <= 1) { + return this.callTapsSeries({ + onError, + onResult, + onDone, + rethrowIfPossible + }); + } + let code = ""; + code += "do {\n"; + code += `var _counter = ${this.options.taps.length};\n`; + if (onDone) { + code += "var _done = () => {\n"; + code += onDone(); + code += "};\n"; + } + for (let i = 0; i < this.options.taps.length; i++) { + const done = () => { + if (onDone) return "if(--_counter === 0) _done();\n"; + else return "--_counter;"; + }; + const doneBreak = skipDone => { + if (skipDone || !onDone) return "_counter = 0;\n"; + else return "_counter = 0;\n_done();\n"; + }; + code += "if(_counter <= 0) break;\n"; + code += onTap( + i, + () => + this.callTap(i, { + onError: error => { + let code = ""; + code += "if(_counter > 0) {\n"; + code += onError(i, error, done, doneBreak); + code += "}\n"; + return code; + }, + onResult: + onResult && + (result => { + let code = ""; + code += "if(_counter > 0) {\n"; + code += onResult(i, result, done, doneBreak); + code += "}\n"; + return code; + }), + onDone: + !onResult && + (() => { + return done(); + }), + rethrowIfPossible + }), + done, + doneBreak ); } - ); - this._pluginCompat.tap( - { - name: "Tapable this.hooks", - stage: 200 - }, - options => { - let hook; - for (const name of options.names) { - hook = this.hooks[name]; - if (hook !== undefined) { - break; - } - } - if (hook !== undefined) { - const tapOpt = { - name: options.fn.name || "unnamed compat plugin", - stage: options.stage || 0 - }; - if (options.async) hook.tapAsync(tapOpt, options.fn); - else hook.tap(tapOpt, options.fn); - return true; - } + code += "} while(false);\n"; + return code; + } + + args({ before, after } = {}) { + let allArgs = this._args; + if (before) allArgs = [before].concat(allArgs); + if (after) allArgs = allArgs.concat(after); + if (allArgs.length === 0) { + return ""; + } else { + return allArgs.join(", "); } - ); -} -module.exports = Tapable; - -Tapable.addCompatLayer = function addCompatLayer(instance) { - Tapable.call(instance); - instance.plugin = Tapable.prototype.plugin; - instance.apply = Tapable.prototype.apply; -}; + } -Tapable.prototype.plugin = util.deprecate(function plugin(name, fn) { - if (Array.isArray(name)) { - name.forEach(function(name) { - this.plugin(name, fn); - }, this); - return; + getTapFn(idx) { + return `_x[${idx}]`; } - const result = this._pluginCompat.call({ - name: name, - fn: fn, - names: new Set([name]) - }); - if (!result) { - throw new Error( - `Plugin could not be registered at '${name}'. Hook was not found.\n` + - "BREAKING CHANGE: There need to exist a hook at 'this.hooks'. " + - "To create a compatibility layer for this hook, hook into 'this._pluginCompat'." - ); + + getTap(idx) { + return `_taps[${idx}]`; } -}, "Tapable.plugin is deprecated. Use new API on `.hooks` instead"); -Tapable.prototype.apply = util.deprecate(function apply() { - for (var i = 0; i < arguments.length; i++) { - arguments[i].apply(this); + getInterceptor(idx) { + return `_interceptors[${idx}]`; } -}, "Tapable.apply is deprecated. Call apply on the plugin directly instead"); +} + +module.exports = HookCodeFactory; /***/ }), -/***/ 92402: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 35233: +/***/ (function(module) { "use strict"; /* @@ -47447,532 +47462,580 @@ Tapable.prototype.apply = util.deprecate(function apply() { */ -exports.__esModule = true; -exports.Tapable = __webpack_require__(72693); -exports.SyncHook = __webpack_require__(77633); -exports.SyncBailHook = __webpack_require__(16477); -exports.SyncWaterfallHook = __webpack_require__(6548); -exports.SyncLoopHook = __webpack_require__(13608); -exports.AsyncParallelHook = __webpack_require__(14616); -exports.AsyncParallelBailHook = __webpack_require__(27836); -exports.AsyncSeriesHook = __webpack_require__(55328); -exports.AsyncSeriesBailHook = __webpack_require__(89674); -exports.AsyncSeriesWaterfallHook = __webpack_require__(14568); -exports.HookMap = __webpack_require__(35233); -exports.MultiHook = __webpack_require__(93607); +class HookMap { + constructor(factory) { + this._map = new Map(); + this._factory = factory; + this._interceptors = []; + } + get(key) { + return this._map.get(key); + } -/***/ }), + for(key) { + const hook = this.get(key); + if (hook !== undefined) { + return hook; + } + let newHook = this._factory(key); + const interceptors = this._interceptors; + for (let i = 0; i < interceptors.length; i++) { + newHook = interceptors[i].factory(key, newHook); + } + this._map.set(key, newHook); + return newHook; + } -/***/ 16326: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + intercept(interceptor) { + this._interceptors.push( + Object.assign( + { + factory: (key, hook) => hook + }, + interceptor + ) + ); + } -"use strict"; + tap(key, options, fn) { + return this.for(key).tap(options, fn); + } + tapAsync(key, options, fn) { + return this.for(key).tapAsync(options, fn); + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.default = void 0; + tapPromise(key, options, fn) { + return this.for(key).tapPromise(options, fn); + } +} -var _os = _interopRequireDefault(__webpack_require__(12087)); +module.exports = HookMap; -var _cacache = _interopRequireDefault(__webpack_require__(36801)); -var _findCacheDir = _interopRequireDefault(__webpack_require__(61844)); +/***/ }), -var _workerFarm = _interopRequireDefault(__webpack_require__(18921)); +/***/ 93607: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -var _serializeJavascript = _interopRequireDefault(__webpack_require__(85841)); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -var _isWsl = _interopRequireDefault(__webpack_require__(47543)); -var _minify = _interopRequireDefault(__webpack_require__(30787)); +const Hook = __webpack_require__(12233); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +class MultiHook { + constructor(hooks) { + this.hooks = hooks; + } -const worker = __webpack_require__.ab + "worker.js"; + tap(options, fn) { + for (const hook of this.hooks) { + hook.tap(options, fn); + } + } -class TaskRunner { - constructor(options = {}) { - const { - cache, - parallel - } = options; - this.cacheDir = cache === true ? (0, _findCacheDir.default)({ - name: 'terser-webpack-plugin' - }) || _os.default.tmpdir() : cache; // In some cases cpus() returns undefined - // https://github.com/nodejs/node/issues/19022 + tapAsync(options, fn) { + for (const hook of this.hooks) { + hook.tapAsync(options, fn); + } + } - const cpus = _os.default.cpus() || { - length: 1 - }; // WSL sometimes freezes, error seems to be on the WSL side - // https://github.com/webpack-contrib/terser-webpack-plugin/issues/21 + tapPromise(options, fn) { + for (const hook of this.hooks) { + hook.tapPromise(options, fn); + } + } - this.maxConcurrentWorkers = _isWsl.default ? 1 : parallel === true ? cpus.length - 1 : Math.min(Number(parallel) || 0, cpus.length - 1); - } + isUsed() { + for (const hook of this.hooks) { + if (hook.isUsed()) return true; + } + return false; + } - run(tasks, callback) { - /* istanbul ignore if */ - if (!tasks.length) { - callback(null, []); - return; - } + intercept(interceptor) { + for (const hook of this.hooks) { + hook.intercept(interceptor); + } + } - if (this.maxConcurrentWorkers > 1) { - const workerOptions = process.platform === 'win32' ? { - maxConcurrentWorkers: this.maxConcurrentWorkers, - maxConcurrentCallsPerWorker: 1 - } : { - maxConcurrentWorkers: this.maxConcurrentWorkers - }; - this.workers = (0, _workerFarm.default)(workerOptions, __webpack_require__.ab + "worker.js"); + withOptions(options) { + return new MultiHook(this.hooks.map(h => h.withOptions(options))); + } +} - this.boundWorkers = (options, cb) => { - try { - this.workers((0, _serializeJavascript.default)(options), cb); - } catch (error) { - // worker-farm can fail with ENOMEM or something else - cb(error); - } - }; - } else { - this.boundWorkers = (options, cb) => { - try { - cb(null, (0, _minify.default)(options)); - } catch (error) { - cb(error); - } - }; - } +module.exports = MultiHook; - let toRun = tasks.length; - const results = []; - const step = (index, data) => { - toRun -= 1; - results[index] = data; +/***/ }), - if (!toRun) { - callback(null, results); - } - }; +/***/ 16477: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - tasks.forEach((task, index) => { - const enqueue = () => { - this.boundWorkers(task, (error, data) => { - const result = error ? { - error - } : data; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - const done = () => step(index, result); - if (this.cacheDir && !result.error) { - _cacache.default.put(this.cacheDir, (0, _serializeJavascript.default)(task.cacheKeys), JSON.stringify(data)).then(done, done); - } else { - done(); - } - }); - }; +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); + +class SyncBailHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, onDone, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onResult: (i, result, next) => + `if(${result} !== undefined) {\n${onResult( + result + )};\n} else {\n${next()}}\n`, + resultReturns, + onDone, + rethrowIfPossible + }); + } +} + +const factory = new SyncBailHookCodeFactory(); - if (this.cacheDir) { - _cacache.default.get(this.cacheDir, (0, _serializeJavascript.default)(task.cacheKeys)).then(({ - data - }) => step(index, JSON.parse(data)), enqueue); - } else { - enqueue(); - } - }); - } +class SyncBailHook extends Hook { + tapAsync() { + throw new Error("tapAsync is not supported on a SyncBailHook"); + } - exit() { - if (this.workers) { - _workerFarm.default.end(this.workers); - } - } + tapPromise() { + throw new Error("tapPromise is not supported on a SyncBailHook"); + } + compile(options) { + factory.setup(this, options); + return factory.create(options); + } } -exports.default = TaskRunner; +module.exports = SyncBailHook; + /***/ }), -/***/ 89301: +/***/ 77633: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -const plugin = __webpack_require__(43884); +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); -module.exports = plugin.default; +class SyncHookCodeFactory extends HookCodeFactory { + content({ onError, onDone, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onDone, + rethrowIfPossible + }); + } +} -/***/ }), +const factory = new SyncHookCodeFactory(); -/***/ 43884: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +class SyncHook extends Hook { + tapAsync() { + throw new Error("tapAsync is not supported on a SyncHook"); + } -"use strict"; + tapPromise() { + throw new Error("tapPromise is not supported on a SyncHook"); + } + compile(options) { + factory.setup(this, options); + return factory.create(options); + } +} -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.default = void 0; +module.exports = SyncHook; -var _crypto = _interopRequireDefault(__webpack_require__(76417)); -var _path = _interopRequireDefault(__webpack_require__(85622)); +/***/ }), -var _sourceMap = __webpack_require__(96241); +/***/ 13608: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -var _webpackSources = __webpack_require__(53665); +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -var _RequestShortener = _interopRequireDefault(__webpack_require__(54254)); -var _ModuleFilenameHelpers = _interopRequireDefault(__webpack_require__(71474)); +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); -var _schemaUtils = _interopRequireDefault(__webpack_require__(33225)); +class SyncLoopHookCodeFactory extends HookCodeFactory { + content({ onError, onDone, rethrowIfPossible }) { + return this.callTapsLooping({ + onError: (i, err) => onError(err), + onDone, + rethrowIfPossible + }); + } +} -var _serializeJavascript = _interopRequireDefault(__webpack_require__(85841)); +const factory = new SyncLoopHookCodeFactory(); -var _package = _interopRequireDefault(__webpack_require__(92203)); +class SyncLoopHook extends Hook { + tapAsync() { + throw new Error("tapAsync is not supported on a SyncLoopHook"); + } -var _options = _interopRequireDefault(__webpack_require__(11840)); + tapPromise() { + throw new Error("tapPromise is not supported on a SyncLoopHook"); + } -var _TaskRunner = _interopRequireDefault(__webpack_require__(16326)); + compile(options) { + factory.setup(this, options); + return factory.create(options); + } +} -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +module.exports = SyncLoopHook; -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(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; } +/***/ 6548: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const warningRegex = /\[.+:([0-9]+),([0-9]+)\]/; +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ -class TerserPlugin { - constructor(options = {}) { - (0, _schemaUtils.default)(_options.default, options, 'Terser Plugin'); - const { - minify, - terserOptions = {}, - test = /\.m?js(\?.*)?$/i, - chunkFilter = () => true, - warningsFilter = () => true, - extractComments = false, - sourceMap = false, - cache = false, - cacheKeys = defaultCacheKeys => defaultCacheKeys, - parallel = false, - include, - exclude - } = options; - this.options = { - test, - chunkFilter, - warningsFilter, - extractComments, - sourceMap, - cache, - cacheKeys, - parallel, - include, - exclude, - minify, - terserOptions: _objectSpread({ - output: { - comments: extractComments ? false : /^\**!|@preserve|@license|@cc_on/i - } - }, terserOptions) - }; - } - static isSourceMap(input) { - // All required options for `new SourceMapConsumer(...options)` - // https://github.com/mozilla/source-map#new-sourcemapconsumerrawsourcemap - return Boolean(input && input.version && input.sources && Array.isArray(input.sources) && typeof input.mappings === 'string'); - } +const Hook = __webpack_require__(12233); +const HookCodeFactory = __webpack_require__(64288); - static buildSourceMap(inputSourceMap) { - if (!inputSourceMap || !TerserPlugin.isSourceMap(inputSourceMap)) { - return null; - } +class SyncWaterfallHookCodeFactory extends HookCodeFactory { + content({ onError, onResult, resultReturns, rethrowIfPossible }) { + return this.callTapsSeries({ + onError: (i, err) => onError(err), + onResult: (i, result, next) => { + let code = ""; + code += `if(${result} !== undefined) {\n`; + code += `${this._args[0]} = ${result};\n`; + code += `}\n`; + code += next(); + return code; + }, + onDone: () => onResult(this._args[0]), + doneReturns: resultReturns, + rethrowIfPossible + }); + } +} - return new _sourceMap.SourceMapConsumer(inputSourceMap); - } +const factory = new SyncWaterfallHookCodeFactory(); - static buildError(err, file, sourceMap, requestShortener) { - // Handling error which should have line, col, filename and message - if (err.line) { - const original = sourceMap && sourceMap.originalPositionFor({ - line: err.line, - column: err.col - }); +class SyncWaterfallHook extends Hook { + constructor(args) { + super(args); + if (args.length < 1) + throw new Error("Waterfall hooks must have at least one argument"); + } - if (original && original.source && requestShortener) { - return new Error(`${file} from Terser\n${err.message} [${requestShortener.shorten(original.source)}:${original.line},${original.column}][${file}:${err.line},${err.col}]`); - } + tapAsync() { + throw new Error("tapAsync is not supported on a SyncWaterfallHook"); + } - return new Error(`${file} from Terser\n${err.message} [${file}:${err.line},${err.col}]`); - } else if (err.stack) { - return new Error(`${file} from Terser\n${err.stack}`); - } + tapPromise() { + throw new Error("tapPromise is not supported on a SyncWaterfallHook"); + } - return new Error(`${file} from Terser\n${err.message}`); - } + compile(options) { + factory.setup(this, options); + return factory.create(options); + } +} - static buildWarning(warning, file, sourceMap, requestShortener, warningsFilter) { - let warningMessage = warning; - let locationMessage = ''; - let source = null; +module.exports = SyncWaterfallHook; - if (sourceMap) { - const match = warningRegex.exec(warning); - if (match) { - const line = +match[1]; - const column = +match[2]; - const original = sourceMap.originalPositionFor({ - line, - column - }); +/***/ }), + +/***/ 72693: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - if (original && original.source && original.source !== file && requestShortener) { - ({ - source - } = original); - warningMessage = `${warningMessage.replace(warningRegex, '')}`; - locationMessage = `[${requestShortener.shorten(original.source)}:${original.line},${original.column}]`; - } - } - } - if (warningsFilter && !warningsFilter(warning, source)) { - return null; - } +const util = __webpack_require__(31669); +const SyncBailHook = __webpack_require__(16477); - return `Terser Plugin: ${warningMessage}${locationMessage}`; - } +function Tapable() { + this._pluginCompat = new SyncBailHook(["options"]); + this._pluginCompat.tap( + { + name: "Tapable camelCase", + stage: 100 + }, + options => { + options.names.add( + options.name.replace(/[- ]([a-z])/g, (str, ch) => ch.toUpperCase()) + ); + } + ); + this._pluginCompat.tap( + { + name: "Tapable this.hooks", + stage: 200 + }, + options => { + let hook; + for (const name of options.names) { + hook = this.hooks[name]; + if (hook !== undefined) { + break; + } + } + if (hook !== undefined) { + const tapOpt = { + name: options.fn.name || "unnamed compat plugin", + stage: options.stage || 0 + }; + if (options.async) hook.tapAsync(tapOpt, options.fn); + else hook.tap(tapOpt, options.fn); + return true; + } + } + ); +} +module.exports = Tapable; - apply(compiler) { - const buildModuleFn = moduleArg => { - // to get detailed location info about errors - moduleArg.useSourceMap = true; - }; +Tapable.addCompatLayer = function addCompatLayer(instance) { + Tapable.call(instance); + instance.plugin = Tapable.prototype.plugin; + instance.apply = Tapable.prototype.apply; +}; - const optimizeFn = (compilation, chunks, callback) => { - const taskRunner = new _TaskRunner.default({ - cache: this.options.cache, - parallel: this.options.parallel - }); - const processedAssets = new WeakSet(); - const tasks = []; - const { - chunkFilter - } = this.options; - Array.from(chunks).filter(chunk => chunkFilter && chunkFilter(chunk)).reduce((acc, chunk) => acc.concat(chunk.files || []), []).concat(compilation.additionalChunkAssets || []).filter(_ModuleFilenameHelpers.default.matchObject.bind(null, this.options)).forEach(file => { - let inputSourceMap; - const asset = compilation.assets[file]; +Tapable.prototype.plugin = util.deprecate(function plugin(name, fn) { + if (Array.isArray(name)) { + name.forEach(function(name) { + this.plugin(name, fn); + }, this); + return; + } + const result = this._pluginCompat.call({ + name: name, + fn: fn, + names: new Set([name]) + }); + if (!result) { + throw new Error( + `Plugin could not be registered at '${name}'. Hook was not found.\n` + + "BREAKING CHANGE: There need to exist a hook at 'this.hooks'. " + + "To create a compatibility layer for this hook, hook into 'this._pluginCompat'." + ); + } +}, "Tapable.plugin is deprecated. Use new API on `.hooks` instead"); - if (processedAssets.has(asset)) { - return; - } +Tapable.prototype.apply = util.deprecate(function apply() { + for (var i = 0; i < arguments.length; i++) { + arguments[i].apply(this); + } +}, "Tapable.apply is deprecated. Call apply on the plugin directly instead"); - try { - let input; - if (this.options.sourceMap && asset.sourceAndMap) { - const { - source, - map - } = asset.sourceAndMap(); - input = source; +/***/ }), - if (TerserPlugin.isSourceMap(map)) { - inputSourceMap = map; - } else { - inputSourceMap = map; - compilation.warnings.push(new Error(`${file} contains invalid source map`)); - } - } else { - input = asset.source(); - inputSourceMap = null; - } // Handling comment extraction +/***/ 92402: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +"use strict"; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ - let commentsFile = false; - if (this.options.extractComments) { - commentsFile = this.options.extractComments.filename || `${file}.LICENSE`; +exports.__esModule = true; +exports.Tapable = __webpack_require__(72693); +exports.SyncHook = __webpack_require__(77633); +exports.SyncBailHook = __webpack_require__(16477); +exports.SyncWaterfallHook = __webpack_require__(6548); +exports.SyncLoopHook = __webpack_require__(13608); +exports.AsyncParallelHook = __webpack_require__(14616); +exports.AsyncParallelBailHook = __webpack_require__(27836); +exports.AsyncSeriesHook = __webpack_require__(55328); +exports.AsyncSeriesBailHook = __webpack_require__(89674); +exports.AsyncSeriesWaterfallHook = __webpack_require__(14568); +exports.HookMap = __webpack_require__(35233); +exports.MultiHook = __webpack_require__(93607); - if (typeof commentsFile === 'function') { - commentsFile = commentsFile(file); - } - } - const task = { - file, - input, - inputSourceMap, - commentsFile, - extractComments: this.options.extractComments, - terserOptions: this.options.terserOptions, - minify: this.options.minify - }; +/***/ }), - if (this.options.cache) { - const defaultCacheKeys = { - terser: _package.default.version, - node_version: process.version, - // eslint-disable-next-line global-require - 'terser-webpack-plugin': __webpack_require__(9122)/* .version */ .i8, - 'terser-webpack-plugin-options': this.options, - hash: _crypto.default.createHash('md4').update(input).digest('hex') - }; - task.cacheKeys = this.options.cacheKeys(defaultCacheKeys, file); - } +/***/ 16326: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - tasks.push(task); - } catch (error) { - compilation.errors.push(TerserPlugin.buildError(error, file, TerserPlugin.buildSourceMap(inputSourceMap), new _RequestShortener.default(compiler.context))); - } - }); - taskRunner.run(tasks, (tasksError, results) => { - if (tasksError) { - compilation.errors.push(tasksError); - return; - } +"use strict"; - results.forEach((data, index) => { - const { - file, - input, - inputSourceMap, - commentsFile - } = tasks[index]; - const { - error, - map, - code, - warnings - } = data; - let { - extractedComments - } = data; - let sourceMap = null; - if (error || warnings && warnings.length > 0) { - sourceMap = TerserPlugin.buildSourceMap(inputSourceMap); - } // Handling results - // Error case: add errors, and go to next file +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _os = _interopRequireDefault(__webpack_require__(12087)); - if (error) { - compilation.errors.push(TerserPlugin.buildError(error, file, sourceMap, new _RequestShortener.default(compiler.context))); - return; - } +var _cacache = _interopRequireDefault(__webpack_require__(36801)); - let outputSource; +var _findCacheDir = _interopRequireDefault(__webpack_require__(61844)); - if (map) { - outputSource = new _webpackSources.SourceMapSource(code, file, JSON.parse(map), input, inputSourceMap, true); - } else { - outputSource = new _webpackSources.RawSource(code); - } // Write extracted comments to commentsFile +var _workerFarm = _interopRequireDefault(__webpack_require__(18921)); +var _serializeJavascript = _interopRequireDefault(__webpack_require__(85841)); - if (commentsFile && extractedComments && extractedComments.length > 0) { - if (commentsFile in compilation.assets) { - const commentsFileSource = compilation.assets[commentsFile].source(); - extractedComments = extractedComments.filter(comment => !commentsFileSource.includes(comment)); - } +var _isWsl = _interopRequireDefault(__webpack_require__(47543)); - if (extractedComments.length > 0) { - // Add a banner to the original file - if (this.options.extractComments.banner !== false) { - let banner = this.options.extractComments.banner || `For license information please see ${_path.default.posix.basename(commentsFile)}`; +var _minify = _interopRequireDefault(__webpack_require__(30787)); - if (typeof banner === 'function') { - banner = banner(commentsFile); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const worker = __webpack_require__.ab + "worker.js"; + +class TaskRunner { + constructor(options = {}) { + const { + cache, + parallel + } = options; + this.cacheDir = cache === true ? (0, _findCacheDir.default)({ + name: 'terser-webpack-plugin' + }) || _os.default.tmpdir() : cache; // In some cases cpus() returns undefined + // https://github.com/nodejs/node/issues/19022 - if (banner) { - outputSource = new _webpackSources.ConcatSource(`/*! ${banner} */\n`, outputSource); - } - } + const cpus = _os.default.cpus() || { + length: 1 + }; // WSL sometimes freezes, error seems to be on the WSL side + // https://github.com/webpack-contrib/terser-webpack-plugin/issues/21 - const commentsSource = new _webpackSources.RawSource(`${extractedComments.join('\n\n')}\n`); + this.maxConcurrentWorkers = _isWsl.default ? 1 : parallel === true ? cpus.length - 1 : Math.min(Number(parallel) || 0, cpus.length - 1); + } - if (commentsFile in compilation.assets) { - // commentsFile already exists, append new comments... - if (compilation.assets[commentsFile] instanceof _webpackSources.ConcatSource) { - compilation.assets[commentsFile].add('\n'); - compilation.assets[commentsFile].add(commentsSource); - } else { - compilation.assets[commentsFile] = new _webpackSources.ConcatSource(compilation.assets[commentsFile], '\n', commentsSource); - } - } else { - compilation.assets[commentsFile] = commentsSource; - } - } - } // Updating assets + run(tasks, callback) { + /* istanbul ignore if */ + if (!tasks.length) { + callback(null, []); + return; + } + if (this.maxConcurrentWorkers > 1) { + const workerOptions = process.platform === 'win32' ? { + maxConcurrentWorkers: this.maxConcurrentWorkers, + maxConcurrentCallsPerWorker: 1 + } : { + maxConcurrentWorkers: this.maxConcurrentWorkers + }; + this.workers = (0, _workerFarm.default)(workerOptions, __webpack_require__.ab + "worker.js"); - processedAssets.add(compilation.assets[file] = outputSource); // Handling warnings + this.boundWorkers = (options, cb) => { + try { + this.workers((0, _serializeJavascript.default)(options), cb); + } catch (error) { + // worker-farm can fail with ENOMEM or something else + cb(error); + } + }; + } else { + this.boundWorkers = (options, cb) => { + try { + cb(null, (0, _minify.default)(options)); + } catch (error) { + cb(error); + } + }; + } - if (warnings && warnings.length > 0) { - warnings.forEach(warning => { - const builtWarning = TerserPlugin.buildWarning(warning, file, sourceMap, new _RequestShortener.default(compiler.context), this.options.warningsFilter); + let toRun = tasks.length; + const results = []; - if (builtWarning) { - compilation.warnings.push(builtWarning); - } - }); - } - }); - taskRunner.exit(); - callback(); - }); - }; + const step = (index, data) => { + toRun -= 1; + results[index] = data; - const plugin = { - name: this.constructor.name - }; - compiler.hooks.compilation.tap(plugin, compilation => { - if (this.options.sourceMap) { - compilation.hooks.buildModule.tap(plugin, buildModuleFn); + if (!toRun) { + callback(null, results); } + }; - const { - mainTemplate, - chunkTemplate - } = compilation; // Regenerate `contenthash` for minified assets + tasks.forEach((task, index) => { + const enqueue = () => { + this.boundWorkers(task, (error, data) => { + const result = error ? { + error + } : data; - for (const template of [mainTemplate, chunkTemplate]) { - template.hooks.hashForChunk.tap(plugin, hash => { - const data = (0, _serializeJavascript.default)({ - terser: _package.default.version, - terserOptions: this.options.terserOptions - }); - hash.update('TerserPlugin'); - hash.update(data); + const done = () => step(index, result); + + if (this.cacheDir && !result.error) { + _cacache.default.put(this.cacheDir, (0, _serializeJavascript.default)(task.cacheKeys), JSON.stringify(data)).then(done, done); + } else { + done(); + } }); - } + }; - compilation.hooks.optimizeChunkAssets.tapAsync(plugin, optimizeFn.bind(this, compilation)); + if (this.cacheDir) { + _cacache.default.get(this.cacheDir, (0, _serializeJavascript.default)(task.cacheKeys)).then(({ + data + }) => step(index, JSON.parse(data)), enqueue); + } else { + enqueue(); + } }); } + exit() { + if (this.workers) { + _workerFarm.default.end(this.workers); + } + } + } -var _default = TerserPlugin; -exports.default = _default; +exports.default = TaskRunner; /***/ }), -/***/ 30787: +/***/ 89301: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const plugin = __webpack_require__(43884); + +module.exports = plugin.default; + +/***/ }), + +/***/ 43884: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; @@ -47983,528 +48046,589 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.default = void 0; -var _terser = __webpack_require__(54775); +var _crypto = _interopRequireDefault(__webpack_require__(76417)); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } +var _path = _interopRequireDefault(__webpack_require__(85622)); -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +var _sourceMap = __webpack_require__(96241); -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 _webpackSources = __webpack_require__(53665); -const buildTerserOptions = ({ - ecma, - warnings, - parse = {}, - compress = {}, - mangle, - module, - output, - toplevel, - nameCache, - ie8, +var _RequestShortener = _interopRequireDefault(__webpack_require__(54254)); - /* eslint-disable camelcase */ - keep_classnames, - keep_fnames, +var _ModuleFilenameHelpers = _interopRequireDefault(__webpack_require__(71474)); - /* eslint-enable camelcase */ - safari10 -} = {}) => ({ - ecma, - warnings, - parse: _objectSpread({}, parse), - compress: typeof compress === 'boolean' ? compress : _objectSpread({}, compress), - // eslint-disable-next-line no-nested-ternary - mangle: mangle == null ? true : typeof mangle === 'boolean' ? mangle : _objectSpread({}, mangle), - output: _objectSpread({ - shebang: true, - comments: false, - beautify: false, - semicolons: true - }, output), - module, - // Ignoring sourceMap from options - sourceMap: null, - toplevel, - nameCache, - ie8, - keep_classnames, - keep_fnames, - safari10 -}); +var _schemaUtils = _interopRequireDefault(__webpack_require__(33225)); -const buildComments = (options, terserOptions, extractedComments) => { - const condition = {}; - const commentsOpts = terserOptions.output.comments; // Use /^\**!|@preserve|@license|@cc_on/i RegExp +var _serializeJavascript = _interopRequireDefault(__webpack_require__(85841)); - if (typeof options.extractComments === 'boolean') { - condition.preserve = commentsOpts; - condition.extract = /^\**!|@preserve|@license|@cc_on/i; - } else if (typeof options.extractComments === 'string' || options.extractComments instanceof RegExp) { - // extractComments specifies the extract condition and commentsOpts specifies the preserve condition - condition.preserve = commentsOpts; - condition.extract = options.extractComments; - } else if (typeof options.extractComments === 'function') { - condition.preserve = commentsOpts; - condition.extract = options.extractComments; - } else if (Object.prototype.hasOwnProperty.call(options.extractComments, 'condition')) { - // Extract condition is given in extractComments.condition - condition.preserve = commentsOpts; - condition.extract = options.extractComments.condition; - } else { - // No extract condition is given. Extract comments that match commentsOpts instead of preserving them - condition.preserve = false; - condition.extract = commentsOpts; - } // Ensure that both conditions are functions +var _package = _interopRequireDefault(__webpack_require__(92203)); + +var _options = _interopRequireDefault(__webpack_require__(11840)); + +var _TaskRunner = _interopRequireDefault(__webpack_require__(16326)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(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; } + +const warningRegex = /\[.+:([0-9]+),([0-9]+)\]/; + +class TerserPlugin { + constructor(options = {}) { + (0, _schemaUtils.default)(_options.default, options, 'Terser Plugin'); + const { + minify, + terserOptions = {}, + test = /\.m?js(\?.*)?$/i, + chunkFilter = () => true, + warningsFilter = () => true, + extractComments = false, + sourceMap = false, + cache = false, + cacheKeys = defaultCacheKeys => defaultCacheKeys, + parallel = false, + include, + exclude + } = options; + this.options = { + test, + chunkFilter, + warningsFilter, + extractComments, + sourceMap, + cache, + cacheKeys, + parallel, + include, + exclude, + minify, + terserOptions: _objectSpread({ + output: { + comments: extractComments ? false : /^\**!|@preserve|@license|@cc_on/i + } + }, terserOptions) + }; + } + static isSourceMap(input) { + // All required options for `new SourceMapConsumer(...options)` + // https://github.com/mozilla/source-map#new-sourcemapconsumerrawsourcemap + return Boolean(input && input.version && input.sources && Array.isArray(input.sources) && typeof input.mappings === 'string'); + } - ['preserve', 'extract'].forEach(key => { - let regexStr; - let regex; + static buildSourceMap(inputSourceMap) { + if (!inputSourceMap || !TerserPlugin.isSourceMap(inputSourceMap)) { + return null; + } - switch (typeof condition[key]) { - case 'boolean': - condition[key] = condition[key] ? () => true : () => false; - break; + return new _sourceMap.SourceMapConsumer(inputSourceMap); + } - case 'function': - break; + static buildError(err, file, sourceMap, requestShortener) { + // Handling error which should have line, col, filename and message + if (err.line) { + const original = sourceMap && sourceMap.originalPositionFor({ + line: err.line, + column: err.col + }); - case 'string': - if (condition[key] === 'all') { - condition[key] = () => true; + if (original && original.source && requestShortener) { + return new Error(`${file} from Terser\n${err.message} [${requestShortener.shorten(original.source)}:${original.line},${original.column}][${file}:${err.line},${err.col}]`); + } - break; - } + return new Error(`${file} from Terser\n${err.message} [${file}:${err.line},${err.col}]`); + } else if (err.stack) { + return new Error(`${file} from Terser\n${err.stack}`); + } - if (condition[key] === 'some') { - condition[key] = (astNode, comment) => { - return comment.type === 'comment2' && /^\**!|@preserve|@license|@cc_on/i.test(comment.value); - }; + return new Error(`${file} from Terser\n${err.message}`); + } - break; - } + static buildWarning(warning, file, sourceMap, requestShortener, warningsFilter) { + let warningMessage = warning; + let locationMessage = ''; + let source = null; - regexStr = condition[key]; + if (sourceMap) { + const match = warningRegex.exec(warning); - condition[key] = (astNode, comment) => { - return new RegExp(regexStr).test(comment.value); - }; + if (match) { + const line = +match[1]; + const column = +match[2]; + const original = sourceMap.originalPositionFor({ + line, + column + }); - break; + if (original && original.source && original.source !== file && requestShortener) { + ({ + source + } = original); + warningMessage = `${warningMessage.replace(warningRegex, '')}`; + locationMessage = `[${requestShortener.shorten(original.source)}:${original.line},${original.column}]`; + } + } + } - default: - regex = condition[key]; + if (warningsFilter && !warningsFilter(warning, source)) { + return null; + } - condition[key] = (astNode, comment) => regex.test(comment.value); + return `Terser Plugin: ${warningMessage}${locationMessage}`; + } - } - }); // Redefine the comments function to extract and preserve - // comments according to the two conditions + apply(compiler) { + const buildModuleFn = moduleArg => { + // to get detailed location info about errors + moduleArg.useSourceMap = true; + }; - return (astNode, comment) => { - if (condition.extract(astNode, comment)) { - const commentText = comment.type === 'comment2' ? `/*${comment.value}*/` : `//${comment.value}`; // Don't include duplicate comments + const optimizeFn = (compilation, chunks, callback) => { + const taskRunner = new _TaskRunner.default({ + cache: this.options.cache, + parallel: this.options.parallel + }); + const processedAssets = new WeakSet(); + const tasks = []; + const { + chunkFilter + } = this.options; + Array.from(chunks).filter(chunk => chunkFilter && chunkFilter(chunk)).reduce((acc, chunk) => acc.concat(chunk.files || []), []).concat(compilation.additionalChunkAssets || []).filter(_ModuleFilenameHelpers.default.matchObject.bind(null, this.options)).forEach(file => { + let inputSourceMap; + const asset = compilation.assets[file]; - if (!extractedComments.includes(commentText)) { - extractedComments.push(commentText); - } - } + if (processedAssets.has(asset)) { + return; + } - return condition.preserve(astNode, comment); - }; -}; + try { + let input; -const minify = options => { - const { - file, - input, - inputSourceMap, - extractComments, - minify: minifyFn - } = options; + if (this.options.sourceMap && asset.sourceAndMap) { + const { + source, + map + } = asset.sourceAndMap(); + input = source; - if (minifyFn) { - return minifyFn({ - [file]: input - }, inputSourceMap); - } // Copy terser options + if (TerserPlugin.isSourceMap(map)) { + inputSourceMap = map; + } else { + inputSourceMap = map; + compilation.warnings.push(new Error(`${file} contains invalid source map`)); + } + } else { + input = asset.source(); + inputSourceMap = null; + } // Handling comment extraction - const terserOptions = buildTerserOptions(options.terserOptions); // Let terser generate a SourceMap + let commentsFile = false; - if (inputSourceMap) { - terserOptions.sourceMap = true; - } + if (this.options.extractComments) { + commentsFile = this.options.extractComments.filename || `${file}.LICENSE`; - const extractedComments = []; + if (typeof commentsFile === 'function') { + commentsFile = commentsFile(file); + } + } - if (extractComments) { - terserOptions.output.comments = buildComments(options, terserOptions, extractedComments); - } + const task = { + file, + input, + inputSourceMap, + commentsFile, + extractComments: this.options.extractComments, + terserOptions: this.options.terserOptions, + minify: this.options.minify + }; - const { - error, - map, - code, - warnings - } = (0, _terser.minify)({ - [file]: input - }, terserOptions); - return { - error, - map, - code, - warnings, - extractedComments - }; -}; + if (this.options.cache) { + const defaultCacheKeys = { + terser: _package.default.version, + node_version: process.version, + // eslint-disable-next-line global-require + 'terser-webpack-plugin': __webpack_require__(9122)/* .version */ .i8, + 'terser-webpack-plugin-options': this.options, + hash: _crypto.default.createHash('md4').update(input).digest('hex') + }; + task.cacheKeys = this.options.cacheKeys(defaultCacheKeys, file); + } -var _default = minify; -exports.default = _default; + tasks.push(task); + } catch (error) { + compilation.errors.push(TerserPlugin.buildError(error, file, TerserPlugin.buildSourceMap(inputSourceMap), new _RequestShortener.default(compiler.context))); + } + }); + taskRunner.run(tasks, (tasksError, results) => { + if (tasksError) { + compilation.errors.push(tasksError); + return; + } -/***/ }), + results.forEach((data, index) => { + const { + file, + input, + inputSourceMap, + commentsFile + } = tasks[index]; + const { + error, + map, + code, + warnings + } = data; + let { + extractedComments + } = data; + let sourceMap = null; -/***/ 71708: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (error || warnings && warnings.length > 0) { + sourceMap = TerserPlugin.buildSourceMap(inputSourceMap); + } // Handling results + // Error case: add errors, and go to next file -"use strict"; -/*! - * to-object-path - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */ + if (error) { + compilation.errors.push(TerserPlugin.buildError(error, file, sourceMap, new _RequestShortener.default(compiler.context))); + return; + } + + let outputSource; + if (map) { + outputSource = new _webpackSources.SourceMapSource(code, file, JSON.parse(map), input, inputSourceMap, true); + } else { + outputSource = new _webpackSources.RawSource(code); + } // Write extracted comments to commentsFile -var typeOf = __webpack_require__(48865); -module.exports = function toPath(args) { - if (typeOf(args) !== 'arguments') { - args = arguments; - } - return filter(args).join('.'); -}; + if (commentsFile && extractedComments && extractedComments.length > 0) { + if (commentsFile in compilation.assets) { + const commentsFileSource = compilation.assets[commentsFile].source(); + extractedComments = extractedComments.filter(comment => !commentsFileSource.includes(comment)); + } -function filter(arr) { - var len = arr.length; - var idx = -1; - var res = []; + if (extractedComments.length > 0) { + // Add a banner to the original file + if (this.options.extractComments.banner !== false) { + let banner = this.options.extractComments.banner || `For license information please see ${_path.default.posix.basename(commentsFile)}`; - 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; -} + if (typeof banner === 'function') { + banner = banner(commentsFile); + } + if (banner) { + outputSource = new _webpackSources.ConcatSource(`/*! ${banner} */\n`, outputSource); + } + } -/***/ }), + const commentsSource = new _webpackSources.RawSource(`${extractedComments.join('\n\n')}\n`); -/***/ 1353: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + if (commentsFile in compilation.assets) { + // commentsFile already exists, append new comments... + if (compilation.assets[commentsFile] instanceof _webpackSources.ConcatSource) { + compilation.assets[commentsFile].add('\n'); + compilation.assets[commentsFile].add(commentsSource); + } else { + compilation.assets[commentsFile] = new _webpackSources.ConcatSource(compilation.assets[commentsFile], '\n', commentsSource); + } + } else { + compilation.assets[commentsFile] = commentsSource; + } + } + } // Updating assets -"use strict"; -/*! - * to-regex-range - * - * Copyright (c) 2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */ + processedAssets.add(compilation.assets[file] = outputSource); // Handling warnings + if (warnings && warnings.length > 0) { + warnings.forEach(warning => { + const builtWarning = TerserPlugin.buildWarning(warning, file, sourceMap, new _RequestShortener.default(compiler.context), this.options.warningsFilter); -var repeat = __webpack_require__(6332); -var isNumber = __webpack_require__(87218); -var cache = {}; + if (builtWarning) { + compilation.warnings.push(builtWarning); + } + }); + } + }); + taskRunner.exit(); + callback(); + }); + }; -function toRegexRange(min, max, options) { - if (isNumber(min) === false) { - throw new RangeError('toRegexRange: first argument is invalid.'); - } + const plugin = { + name: this.constructor.name + }; + compiler.hooks.compilation.tap(plugin, compilation => { + if (this.options.sourceMap) { + compilation.hooks.buildModule.tap(plugin, buildModuleFn); + } - if (typeof max === 'undefined' || min === max) { - return String(min); - } + const { + mainTemplate, + chunkTemplate + } = compilation; // Regenerate `contenthash` for minified assets - if (isNumber(max) === false) { - throw new RangeError('toRegexRange: second argument is invalid.'); - } + for (const template of [mainTemplate, chunkTemplate]) { + template.hooks.hashForChunk.tap(plugin, hash => { + const data = (0, _serializeJavascript.default)({ + terser: _package.default.version, + terserOptions: this.options.terserOptions + }); + hash.update('TerserPlugin'); + hash.update(data); + }); + } - 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; + compilation.hooks.optimizeChunkAssets.tapAsync(plugin, optimizeFn.bind(this, compilation)); + }); } - 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 _default = TerserPlugin; +exports.default = _default; - 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; - } +/***/ 30787: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - 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; - } +"use strict"; - if (b >= 0) { - positives = splitToPatterns(a, b, tok, options); - } - tok.negatives = negatives; - tok.positives = positives; - tok.result = siftPatterns(negatives, positives, options); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; - if (options.capture && (positives.length + negatives.length) > 1) { - tok.result = '(' + tok.result + ')'; - } +var _terser = __webpack_require__(54775); - cache[key] = tok; - return tok.result; -} +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -function splitToRanges(min, max) { - min = Number(min); - max = Number(max); +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 nines = 1; - var stops = [max]; - var stop = +countNines(min, nines); +const buildTerserOptions = ({ + ecma, + warnings, + parse = {}, + compress = {}, + mangle, + module, + output, + toplevel, + nameCache, + ie8, - while (min <= stop && stop <= max) { - stops = push(stops, stop); - nines += 1; - stop = +countNines(min, nines); - } + /* eslint-disable camelcase */ + keep_classnames, + keep_fnames, - var zeros = 1; - stop = countZeros(max + 1, zeros) - 1; + /* eslint-enable camelcase */ + safari10 +} = {}) => ({ + ecma, + warnings, + parse: _objectSpread({}, parse), + compress: typeof compress === 'boolean' ? compress : _objectSpread({}, compress), + // eslint-disable-next-line no-nested-ternary + mangle: mangle == null ? true : typeof mangle === 'boolean' ? mangle : _objectSpread({}, mangle), + output: _objectSpread({ + shebang: true, + comments: false, + beautify: false, + semicolons: true + }, output), + module, + // Ignoring sourceMap from options + sourceMap: null, + toplevel, + nameCache, + ie8, + keep_classnames, + keep_fnames, + safari10 +}); + +const buildComments = (options, terserOptions, extractedComments) => { + const condition = {}; + const commentsOpts = terserOptions.output.comments; // Use /^\**!|@preserve|@license|@cc_on/i RegExp + + if (typeof options.extractComments === 'boolean') { + condition.preserve = commentsOpts; + condition.extract = /^\**!|@preserve|@license|@cc_on/i; + } else if (typeof options.extractComments === 'string' || options.extractComments instanceof RegExp) { + // extractComments specifies the extract condition and commentsOpts specifies the preserve condition + condition.preserve = commentsOpts; + condition.extract = options.extractComments; + } else if (typeof options.extractComments === 'function') { + condition.preserve = commentsOpts; + condition.extract = options.extractComments; + } else if (Object.prototype.hasOwnProperty.call(options.extractComments, 'condition')) { + // Extract condition is given in extractComments.condition + condition.preserve = commentsOpts; + condition.extract = options.extractComments.condition; + } else { + // No extract condition is given. Extract comments that match commentsOpts instead of preserving them + condition.preserve = false; + condition.extract = commentsOpts; + } // Ensure that both conditions are functions - while (min < stop && stop <= max) { - stops = push(stops, stop); - zeros += 1; - stop = countZeros(max + 1, zeros) - 1; - } - stops.sort(compare); - return stops; -} + ['preserve', 'extract'].forEach(key => { + let regexStr; + let regex; -/** - * Convert a range to a regex pattern - * @param {Number} `start` - * @param {Number} `stop` - * @return {String} - */ + switch (typeof condition[key]) { + case 'boolean': + condition[key] = condition[key] ? () => true : () => false; + break; -function rangeToPattern(start, stop, options) { - if (start === stop) { - return {pattern: String(start), digits: []}; - } + case 'function': + break; - var zipped = zip(String(start), String(stop)); - var len = zipped.length, i = -1; + case 'string': + if (condition[key] === 'all') { + condition[key] = () => true; - var pattern = ''; - var digits = 0; + break; + } - while (++i < len) { - var numbers = zipped[i]; - var startDigit = numbers[0]; - var stopDigit = numbers[1]; + if (condition[key] === 'some') { + condition[key] = (astNode, comment) => { + return comment.type === 'comment2' && /^\**!|@preserve|@license|@cc_on/i.test(comment.value); + }; - if (startDigit === stopDigit) { - pattern += startDigit; + break; + } - } else if (startDigit !== '0' || stopDigit !== '9') { - pattern += toCharacterClass(startDigit, stopDigit); + regexStr = condition[key]; - } else { - digits += 1; - } - } + condition[key] = (astNode, comment) => { + return new RegExp(regexStr).test(comment.value); + }; - if (digits) { - pattern += options.shorthand ? '\\d' : '[0-9]'; - } + break; - return { pattern: pattern, digits: [digits] }; -} + default: + regex = condition[key]; -function splitToPatterns(min, max, tok, options) { - var ranges = splitToRanges(min, max); - var len = ranges.length; - var idx = -1; + condition[key] = (astNode, comment) => regex.test(comment.value); - var tokens = []; - var start = min; - var prev; + } + }); // Redefine the comments function to extract and preserve + // comments according to the two conditions - while (++idx < len) { - var range = ranges[idx]; - var obj = rangeToPattern(start, range, options); - var zeros = ''; + return (astNode, comment) => { + if (condition.extract(astNode, comment)) { + const commentText = comment.type === 'comment2' ? `/*${comment.value}*/` : `//${comment.value}`; // Don't include duplicate comments - if (!tok.isPadded && prev && prev.pattern === obj.pattern) { - if (prev.digits.length > 1) { - prev.digits.pop(); + if (!extractedComments.includes(commentText)) { + extractedComments.push(commentText); } - prev.digits.push(obj.digits[0]); - prev.string = prev.pattern + toQuantifier(prev.digits); - start = range + 1; - continue; } - if (tok.isPadded) { - zeros = padZeros(range, tok); - } + return condition.preserve(astNode, comment); + }; +}; - obj.string = zeros + obj.pattern + toQuantifier(obj.digits); - tokens.push(obj); - start = range + 1; - prev = obj; - } +const minify = options => { + const { + file, + input, + inputSourceMap, + extractComments, + minify: minifyFn + } = options; - return tokens; -} + if (minifyFn) { + return minifyFn({ + [file]: input + }, inputSourceMap); + } // Copy terser options -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; + const terserOptions = buildTerserOptions(options.terserOptions); // Let terser generate a SourceMap - 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 (inputSourceMap) { + terserOptions.sourceMap = true; + } - if (!intersection && !contains(comparison, 'string', ele)) { - res.push(prefix + ele); - } + const extractedComments = []; - if (intersection && contains(comparison, 'string', ele)) { - res.push(prefix + ele); - } + if (extractComments) { + terserOptions.output.comments = buildComments(options, terserOptions, extractedComments); } - return res; -} -/** - * Zip strings (`for in` can be used on string characters) - */ + const { + error, + map, + code, + warnings + } = (0, _terser.minify)({ + [file]: input + }, terserOptions); + return { + error, + map, + code, + warnings, + extractedComments + }; +}; -function zip(a, b) { - var arr = []; - for (var ch in a) arr.push([a[ch], b[ch]]); - return arr; -} +var _default = minify; +exports.default = _default; -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; -} +/***/ 71708: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -function contains(arr, key, val) { - for (var i = 0; i < arr.length; i++) { - if (arr[i][key] === val) { - return true; - } - } - return false; -} +"use strict"; +/*! + * to-object-path + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ -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 + '}'; -} +var typeOf = __webpack_require__(48865); -function toCharacterClass(a, b) { - return '[' + a + ((b - a === 1) ? '' : '-') + b + ']'; -} +module.exports = function toPath(args) { + if (typeOf(args) !== 'arguments') { + args = arguments; + } + return filter(args).join('.'); +}; -function padding(str) { - return /^-?(0+)\d/.exec(str); -} +function filter(arr) { + var len = arr.length; + var idx = -1; + var res = []; -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 + '}'; - } + 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 val; + return res; } -/** - * Expose `toRegexRange` - */ - -module.exports = toRegexRange; - /***/ }), diff --git a/packages/next/package.json b/packages/next/package.json index 0d6928f25296f..a763cb9e4eec6 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -73,7 +73,7 @@ "buffer": "5.6.0", "caniuse-lite": "^1.0.30001113", "chalk": "2.4.2", - "chokidar": "3.4.3", + "chokidar": "3.5.1", "crypto-browserify": "3.12.0", "css-loader": "4.3.0", "cssnano-simple": "1.2.1", diff --git a/yarn.lock b/yarn.lock index 88aa37b229935..3c5a8e927802c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4648,10 +4648,10 @@ child-process-promise@^2.1.3: node-version "^1.0.0" promise-polyfill "^6.0.1" -chokidar@3.4.3, chokidar@^3.4.1: - version "3.4.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" - integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== +chokidar@3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" + integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== dependencies: anymatch "~3.1.1" braces "~3.0.2" @@ -4661,7 +4661,7 @@ chokidar@3.4.3, chokidar@^3.4.1: normalize-path "~3.0.0" readdirp "~3.5.0" optionalDependencies: - fsevents "~2.1.2" + fsevents "~2.3.1" chokidar@^1.7.0: version "1.7.0" @@ -4698,6 +4698,21 @@ chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" +chokidar@^3.4.1: + version "3.4.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" + integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.1.2" + chownr@^1.1.1, chownr@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" @@ -7278,6 +7293,11 @@ fsevents@^2.1.2, fsevents@~2.1.2: version "2.1.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" +fsevents@~2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f" + integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"