555 lines
14 KiB
JavaScript
555 lines
14 KiB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
/*!
|
|
* parse-glob <https://github.com/jonschlinkert/parse-glob>
|
|
*
|
|
* Copyright (c) 2015, Jon Schlinkert.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var isGlob = require('is-glob');
|
|
var findBase = require('glob-base');
|
|
var extglob = require('is-extglob');
|
|
var dotfile = require('is-dotfile');
|
|
|
|
/**
|
|
* Expose `cache`
|
|
*/
|
|
|
|
var cache = module.exports.cache = {};
|
|
|
|
/**
|
|
* Parse a glob pattern into tokens.
|
|
*
|
|
* When no paths or '**' are in the glob, we use a
|
|
* different strategy for parsing the filename, since
|
|
* file names can contain braces and other difficult
|
|
* patterns. such as:
|
|
*
|
|
* - `*.{a,b}`
|
|
* - `(**|*.js)`
|
|
*/
|
|
|
|
module.exports = function parseGlob(glob) {
|
|
if (cache.hasOwnProperty(glob)) {
|
|
return cache[glob];
|
|
}
|
|
|
|
var tok = {};
|
|
tok.orig = glob;
|
|
tok.is = {};
|
|
|
|
// unescape dots and slashes in braces/brackets
|
|
glob = escape(glob);
|
|
|
|
var parsed = findBase(glob);
|
|
tok.is.glob = parsed.isGlob;
|
|
|
|
tok.glob = parsed.glob;
|
|
tok.base = parsed.base;
|
|
var segs = /([^\/]*)$/.exec(glob);
|
|
|
|
tok.path = {};
|
|
tok.path.dirname = '';
|
|
tok.path.basename = segs[1] || '';
|
|
tok.path.dirname = glob.split(tok.path.basename).join('') || '';
|
|
var basename = (tok.path.basename || '').split('.') || '';
|
|
tok.path.filename = basename[0] || '';
|
|
tok.path.extname = basename.slice(1).join('.') || '';
|
|
tok.path.ext = '';
|
|
|
|
if (isGlob(tok.path.dirname) && !tok.path.basename) {
|
|
if (!/\/$/.test(tok.glob)) {
|
|
tok.path.basename = tok.glob;
|
|
}
|
|
tok.path.dirname = tok.base;
|
|
}
|
|
|
|
if (glob.indexOf('/') === -1 && !tok.is.globstar) {
|
|
tok.path.dirname = '';
|
|
tok.path.basename = tok.orig;
|
|
}
|
|
|
|
var dot = tok.path.basename.indexOf('.');
|
|
if (dot !== -1) {
|
|
tok.path.filename = tok.path.basename.slice(0, dot);
|
|
tok.path.extname = tok.path.basename.slice(dot);
|
|
}
|
|
|
|
if (tok.path.extname.charAt(0) === '.') {
|
|
var exts = tok.path.extname.split('.');
|
|
tok.path.ext = exts[exts.length - 1];
|
|
}
|
|
|
|
// unescape dots and slashes in braces/brackets
|
|
tok.glob = unescape(tok.glob);
|
|
tok.path.dirname = unescape(tok.path.dirname);
|
|
tok.path.basename = unescape(tok.path.basename);
|
|
tok.path.filename = unescape(tok.path.filename);
|
|
tok.path.extname = unescape(tok.path.extname);
|
|
|
|
// Booleans
|
|
var is = (glob && tok.is.glob);
|
|
tok.is.negated = glob && glob.charAt(0) === '!';
|
|
tok.is.extglob = glob && extglob(glob);
|
|
tok.is.braces = has(is, glob, '{');
|
|
tok.is.brackets = has(is, glob, '[:');
|
|
tok.is.globstar = has(is, glob, '**');
|
|
tok.is.dotfile = dotfile(tok.path.basename);
|
|
tok.is.dotdir = dotdir(tok.path.dirname);
|
|
return (cache[glob] = tok);
|
|
}
|
|
|
|
/**
|
|
* Returns true if the glob matches dot-directories.
|
|
*
|
|
* @param {Object} `tok` The tokens object
|
|
* @param {Object} `path` The path object
|
|
* @return {Object}
|
|
*/
|
|
|
|
function dotdir(base) {
|
|
if (base.indexOf('/.') !== -1) {
|
|
return true;
|
|
}
|
|
if (base.charAt(0) === '.' && base.charAt(1) !== '/') {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Returns true if the pattern has the given `ch`aracter(s)
|
|
*
|
|
* @param {Object} `glob` The glob pattern.
|
|
* @param {Object} `ch` The character to test for
|
|
* @return {Object}
|
|
*/
|
|
|
|
function has(is, glob, ch) {
|
|
return is && glob.indexOf(ch) !== -1;
|
|
}
|
|
|
|
/**
|
|
* Escape/unescape utils
|
|
*/
|
|
|
|
function escape(str) {
|
|
var re = /\{([^{}]*?)}|\(([^()]*?)\)|\[([^\[\]]*?)\]/g;
|
|
return str.replace(re, function (outter, inner) {
|
|
if (!inner) { return outter; }
|
|
return outter.split(inner).join(esc(inner));
|
|
});
|
|
}
|
|
|
|
function esc(str) {
|
|
str = str.split('/').join('__SLASH__');
|
|
str = str.split('.').join('__DOT__');
|
|
return str;
|
|
}
|
|
|
|
function unescape(str) {
|
|
str = str.split('__SLASH__').join('/');
|
|
str = str.split('__DOT__').join('.');
|
|
return str;
|
|
}
|
|
|
|
},{"glob-base":2,"is-dotfile":5,"is-extglob":6,"is-glob":7}],2:[function(require,module,exports){
|
|
/*!
|
|
* glob-base <https://github.com/jonschlinkert/glob-base>
|
|
*
|
|
* Copyright (c) 2015, Jon Schlinkert.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var path = require('path');
|
|
var parent = require('glob-parent');
|
|
|
|
module.exports = function globBase(pattern) {
|
|
if (typeof pattern !== 'string') {
|
|
throw new TypeError('glob-base expects a string.');
|
|
}
|
|
|
|
var res = {};
|
|
res.base = parent(pattern);
|
|
res.isGlob = res.base !== pattern;
|
|
|
|
if (res.base !== '.') {
|
|
res.glob = pattern.substr(res.base.length);
|
|
if (res.glob.charAt(0) === '/') {
|
|
res.glob = res.glob.substr(1);
|
|
}
|
|
} else {
|
|
res.glob = pattern;
|
|
}
|
|
|
|
if (!res.isGlob) {
|
|
res.base = dirname(pattern);
|
|
res.glob = res.base !== '.'
|
|
? pattern.substr(res.base.length)
|
|
: pattern;
|
|
}
|
|
|
|
if (res.glob.substr(0, 2) === './') {
|
|
res.glob = res.glob.substr(2);
|
|
}
|
|
if (res.glob.charAt(0) === '/') {
|
|
res.glob = res.glob.substr(1);
|
|
}
|
|
return res;
|
|
};
|
|
|
|
function dirname(glob) {
|
|
if (glob.slice(-1) === '/') return glob;
|
|
return path.dirname(glob);
|
|
}
|
|
|
|
},{"glob-parent":3,"path":8}],3:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var path = require('path');
|
|
var isglob = require('is-glob');
|
|
|
|
module.exports = function globParent(str) {
|
|
while (isglob(str)) str = path.dirname(str);
|
|
return str;
|
|
};
|
|
|
|
},{"is-glob":4,"path":8}],4:[function(require,module,exports){
|
|
/*!
|
|
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
*
|
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
|
|
module.exports = function isGlob(str) {
|
|
return typeof str === 'string'
|
|
&& /[!*{}?(|)[\]]/.test(str);
|
|
};
|
|
|
|
},{}],5:[function(require,module,exports){
|
|
/*!
|
|
* is-dotfile <https://github.com/regexps/is-dotfile>
|
|
*
|
|
* Copyright (c) 2015 Jon Schlinkert, contributors.
|
|
* Licensed under the MIT license.
|
|
*/
|
|
|
|
module.exports = function(str) {
|
|
if (str.charCodeAt(0) === 46 /* . */ && str.indexOf('/', 1) === -1) {
|
|
return true;
|
|
}
|
|
|
|
var last = str.lastIndexOf('/');
|
|
return last !== -1 ? str.charCodeAt(last + 1) === 46 /* . */ : false;
|
|
};
|
|
|
|
},{}],6:[function(require,module,exports){
|
|
/*!
|
|
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
*
|
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
|
|
module.exports = function isExtglob(str) {
|
|
return typeof str === 'string'
|
|
&& /[@?!+*]\(/.test(str);
|
|
};
|
|
|
|
},{}],7:[function(require,module,exports){
|
|
arguments[4][4][0].apply(exports,arguments)
|
|
},{"dup":4}],8:[function(require,module,exports){
|
|
(function (process){
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the
|
|
// "Software"), to deal in the Software without restriction, including
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
// following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
// resolves . and .. elements in a path array with directory names there
|
|
// must be no slashes, empty elements, or device names (c:\) in the array
|
|
// (so also no leading and trailing slashes - it does not distinguish
|
|
// relative and absolute paths)
|
|
function normalizeArray(parts, allowAboveRoot) {
|
|
// if the path tries to go above the root, `up` ends up > 0
|
|
var up = 0;
|
|
for (var i = parts.length - 1; i >= 0; i--) {
|
|
var last = parts[i];
|
|
if (last === '.') {
|
|
parts.splice(i, 1);
|
|
} else if (last === '..') {
|
|
parts.splice(i, 1);
|
|
up++;
|
|
} else if (up) {
|
|
parts.splice(i, 1);
|
|
up--;
|
|
}
|
|
}
|
|
|
|
// if the path is allowed to go above the root, restore leading ..s
|
|
if (allowAboveRoot) {
|
|
for (; up--; up) {
|
|
parts.unshift('..');
|
|
}
|
|
}
|
|
|
|
return parts;
|
|
}
|
|
|
|
// Split a filename into [root, dir, basename, ext], unix version
|
|
// 'root' is just a slash, or nothing.
|
|
var splitPathRe =
|
|
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
var splitPath = function(filename) {
|
|
return splitPathRe.exec(filename).slice(1);
|
|
};
|
|
|
|
// path.resolve([from ...], to)
|
|
// posix version
|
|
exports.resolve = function() {
|
|
var resolvedPath = '',
|
|
resolvedAbsolute = false;
|
|
|
|
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
var path = (i >= 0) ? arguments[i] : process.cwd();
|
|
|
|
// Skip empty and invalid entries
|
|
if (typeof path !== 'string') {
|
|
throw new TypeError('Arguments to path.resolve must be strings');
|
|
} else if (!path) {
|
|
continue;
|
|
}
|
|
|
|
resolvedPath = path + '/' + resolvedPath;
|
|
resolvedAbsolute = path.charAt(0) === '/';
|
|
}
|
|
|
|
// At this point the path should be resolved to a full absolute path, but
|
|
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
|
|
// Normalize the path
|
|
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
|
return !!p;
|
|
}), !resolvedAbsolute).join('/');
|
|
|
|
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
|
};
|
|
|
|
// path.normalize(path)
|
|
// posix version
|
|
exports.normalize = function(path) {
|
|
var isAbsolute = exports.isAbsolute(path),
|
|
trailingSlash = substr(path, -1) === '/';
|
|
|
|
// Normalize the path
|
|
path = normalizeArray(filter(path.split('/'), function(p) {
|
|
return !!p;
|
|
}), !isAbsolute).join('/');
|
|
|
|
if (!path && !isAbsolute) {
|
|
path = '.';
|
|
}
|
|
if (path && trailingSlash) {
|
|
path += '/';
|
|
}
|
|
|
|
return (isAbsolute ? '/' : '') + path;
|
|
};
|
|
|
|
// posix version
|
|
exports.isAbsolute = function(path) {
|
|
return path.charAt(0) === '/';
|
|
};
|
|
|
|
// posix version
|
|
exports.join = function() {
|
|
var paths = Array.prototype.slice.call(arguments, 0);
|
|
return exports.normalize(filter(paths, function(p, index) {
|
|
if (typeof p !== 'string') {
|
|
throw new TypeError('Arguments to path.join must be strings');
|
|
}
|
|
return p;
|
|
}).join('/'));
|
|
};
|
|
|
|
|
|
// path.relative(from, to)
|
|
// posix version
|
|
exports.relative = function(from, to) {
|
|
from = exports.resolve(from).substr(1);
|
|
to = exports.resolve(to).substr(1);
|
|
|
|
function trim(arr) {
|
|
var start = 0;
|
|
for (; start < arr.length; start++) {
|
|
if (arr[start] !== '') break;
|
|
}
|
|
|
|
var end = arr.length - 1;
|
|
for (; end >= 0; end--) {
|
|
if (arr[end] !== '') break;
|
|
}
|
|
|
|
if (start > end) return [];
|
|
return arr.slice(start, end - start + 1);
|
|
}
|
|
|
|
var fromParts = trim(from.split('/'));
|
|
var toParts = trim(to.split('/'));
|
|
|
|
var length = Math.min(fromParts.length, toParts.length);
|
|
var samePartsLength = length;
|
|
for (var i = 0; i < length; i++) {
|
|
if (fromParts[i] !== toParts[i]) {
|
|
samePartsLength = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
var outputParts = [];
|
|
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
outputParts.push('..');
|
|
}
|
|
|
|
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
|
|
return outputParts.join('/');
|
|
};
|
|
|
|
exports.sep = '/';
|
|
exports.delimiter = ':';
|
|
|
|
exports.dirname = function(path) {
|
|
var result = splitPath(path),
|
|
root = result[0],
|
|
dir = result[1];
|
|
|
|
if (!root && !dir) {
|
|
// No dirname whatsoever
|
|
return '.';
|
|
}
|
|
|
|
if (dir) {
|
|
// It has a dirname, strip trailing slash
|
|
dir = dir.substr(0, dir.length - 1);
|
|
}
|
|
|
|
return root + dir;
|
|
};
|
|
|
|
|
|
exports.basename = function(path, ext) {
|
|
var f = splitPath(path)[2];
|
|
// TODO: make this comparison case-insensitive on windows?
|
|
if (ext && f.substr(-1 * ext.length) === ext) {
|
|
f = f.substr(0, f.length - ext.length);
|
|
}
|
|
return f;
|
|
};
|
|
|
|
|
|
exports.extname = function(path) {
|
|
return splitPath(path)[3];
|
|
};
|
|
|
|
function filter (xs, f) {
|
|
if (xs.filter) return xs.filter(f);
|
|
var res = [];
|
|
for (var i = 0; i < xs.length; i++) {
|
|
if (f(xs[i], i, xs)) res.push(xs[i]);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
// String.prototype.substr - negative index don't work in IE8
|
|
var substr = 'ab'.substr(-1) === 'b'
|
|
? function (str, start, len) { return str.substr(start, len) }
|
|
: function (str, start, len) {
|
|
if (start < 0) start = str.length + start;
|
|
return str.substr(start, len);
|
|
}
|
|
;
|
|
|
|
}).call(this,require('_process'))
|
|
},{"_process":9}],9:[function(require,module,exports){
|
|
// shim for using process in browser
|
|
|
|
var process = module.exports = {};
|
|
var queue = [];
|
|
var draining = false;
|
|
|
|
function drainQueue() {
|
|
if (draining) {
|
|
return;
|
|
}
|
|
draining = true;
|
|
var currentQueue;
|
|
var len = queue.length;
|
|
while(len) {
|
|
currentQueue = queue;
|
|
queue = [];
|
|
var i = -1;
|
|
while (++i < len) {
|
|
currentQueue[i]();
|
|
}
|
|
len = queue.length;
|
|
}
|
|
draining = false;
|
|
}
|
|
process.nextTick = function (fun) {
|
|
queue.push(fun);
|
|
if (!draining) {
|
|
setTimeout(drainQueue, 0);
|
|
}
|
|
};
|
|
|
|
process.title = 'browser';
|
|
process.browser = true;
|
|
process.env = {};
|
|
process.argv = [];
|
|
process.version = ''; // empty string to avoid regexp issues
|
|
process.versions = {};
|
|
|
|
function noop() {}
|
|
|
|
process.on = noop;
|
|
process.addListener = noop;
|
|
process.once = noop;
|
|
process.off = noop;
|
|
process.removeListener = noop;
|
|
process.removeAllListeners = noop;
|
|
process.emit = noop;
|
|
|
|
process.binding = function (name) {
|
|
throw new Error('process.binding is not supported');
|
|
};
|
|
|
|
// TODO(shtylman)
|
|
process.cwd = function () { return '/' };
|
|
process.chdir = function (dir) {
|
|
throw new Error('process.chdir is not supported');
|
|
};
|
|
process.umask = function() { return 0; };
|
|
|
|
},{}]},{},[1]);
|