UNPKG

dragonbones-runtime

Version:

the tools to build dragonbones file for diffrent framework

2,196 lines (1,788 loc) 69.6 kB
/******/ module.exports = (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 7); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = require("fs"); /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = require("path"); /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = require("child_process"); /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = require("util"); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var path = __webpack_require__(1); var which = __webpack_require__(11); var LRU = __webpack_require__(5); var commandCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec function resolveCommand(command, noExtension) { var resolved; noExtension = !!noExtension; resolved = commandCache.get(command + '!' + noExtension); // Check if its resolved in the cache if (commandCache.has(command)) { return commandCache.get(command); } try { resolved = !noExtension ? which.sync(command) : which.sync(command, { pathExt: path.delimiter + (process.env.PATHEXT || '') }); } catch (e) { /* empty */ } commandCache.set(command + '!' + noExtension, resolved); return resolved; } module.exports = resolveCommand; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = LRUCache // This will be a proper iterable 'Map' in engines that support it, // or a fakey-fake PseudoMap in older versions. var Map = __webpack_require__(15) var util = __webpack_require__(3) // A linked list to keep track of recently-used-ness var Yallist = __webpack_require__(17) // use symbols if possible, otherwise just _props var hasSymbol = typeof Symbol === 'function' var makeSymbol if (hasSymbol) { makeSymbol = function (key) { return Symbol.for(key) } } else { makeSymbol = function (key) { return '_' + key } } var MAX = makeSymbol('max') var LENGTH = makeSymbol('length') var LENGTH_CALCULATOR = makeSymbol('lengthCalculator') var ALLOW_STALE = makeSymbol('allowStale') var MAX_AGE = makeSymbol('maxAge') var DISPOSE = makeSymbol('dispose') var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet') var LRU_LIST = makeSymbol('lruList') var CACHE = makeSymbol('cache') function naiveLength () { return 1 } // lruList is a yallist where the head is the youngest // item, and the tail is the oldest. the list contains the Hit // objects as the entries. // Each Hit object has a reference to its Yallist.Node. This // never changes. // // cache is a Map (or PseudoMap) that matches the keys to // the Yallist.Node object. function LRUCache (options) { if (!(this instanceof LRUCache)) { return new LRUCache(options) } if (typeof options === 'number') { options = { max: options } } if (!options) { options = {} } var max = this[MAX] = options.max // Kind of weird to have a default max of Infinity, but oh well. if (!max || !(typeof max === 'number') || max <= 0) { this[MAX] = Infinity } var lc = options.length || naiveLength if (typeof lc !== 'function') { lc = naiveLength } this[LENGTH_CALCULATOR] = lc this[ALLOW_STALE] = options.stale || false this[MAX_AGE] = options.maxAge || 0 this[DISPOSE] = options.dispose this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false this.reset() } // resize the cache when the max changes. Object.defineProperty(LRUCache.prototype, 'max', { set: function (mL) { if (!mL || !(typeof mL === 'number') || mL <= 0) { mL = Infinity } this[MAX] = mL trim(this) }, get: function () { return this[MAX] }, enumerable: true }) Object.defineProperty(LRUCache.prototype, 'allowStale', { set: function (allowStale) { this[ALLOW_STALE] = !!allowStale }, get: function () { return this[ALLOW_STALE] }, enumerable: true }) Object.defineProperty(LRUCache.prototype, 'maxAge', { set: function (mA) { if (!mA || !(typeof mA === 'number') || mA < 0) { mA = 0 } this[MAX_AGE] = mA trim(this) }, get: function () { return this[MAX_AGE] }, enumerable: true }) // resize the cache when the lengthCalculator changes. Object.defineProperty(LRUCache.prototype, 'lengthCalculator', { set: function (lC) { if (typeof lC !== 'function') { lC = naiveLength } if (lC !== this[LENGTH_CALCULATOR]) { this[LENGTH_CALCULATOR] = lC this[LENGTH] = 0 this[LRU_LIST].forEach(function (hit) { hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) this[LENGTH] += hit.length }, this) } trim(this) }, get: function () { return this[LENGTH_CALCULATOR] }, enumerable: true }) Object.defineProperty(LRUCache.prototype, 'length', { get: function () { return this[LENGTH] }, enumerable: true }) Object.defineProperty(LRUCache.prototype, 'itemCount', { get: function () { return this[LRU_LIST].length }, enumerable: true }) LRUCache.prototype.rforEach = function (fn, thisp) { thisp = thisp || this for (var walker = this[LRU_LIST].tail; walker !== null;) { var prev = walker.prev forEachStep(this, fn, walker, thisp) walker = prev } } function forEachStep (self, fn, node, thisp) { var hit = node.value if (isStale(self, hit)) { del(self, node) if (!self[ALLOW_STALE]) { hit = undefined } } if (hit) { fn.call(thisp, hit.value, hit.key, self) } } LRUCache.prototype.forEach = function (fn, thisp) { thisp = thisp || this for (var walker = this[LRU_LIST].head; walker !== null;) { var next = walker.next forEachStep(this, fn, walker, thisp) walker = next } } LRUCache.prototype.keys = function () { return this[LRU_LIST].toArray().map(function (k) { return k.key }, this) } LRUCache.prototype.values = function () { return this[LRU_LIST].toArray().map(function (k) { return k.value }, this) } LRUCache.prototype.reset = function () { if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { this[LRU_LIST].forEach(function (hit) { this[DISPOSE](hit.key, hit.value) }, this) } this[CACHE] = new Map() // hash of items by key this[LRU_LIST] = new Yallist() // list of items in order of use recency this[LENGTH] = 0 // length of items in the list } LRUCache.prototype.dump = function () { return this[LRU_LIST].map(function (hit) { if (!isStale(this, hit)) { return { k: hit.key, v: hit.value, e: hit.now + (hit.maxAge || 0) } } }, this).toArray().filter(function (h) { return h }) } LRUCache.prototype.dumpLru = function () { return this[LRU_LIST] } LRUCache.prototype.inspect = function (n, opts) { var str = 'LRUCache {' var extras = false var as = this[ALLOW_STALE] if (as) { str += '\n allowStale: true' extras = true } var max = this[MAX] if (max && max !== Infinity) { if (extras) { str += ',' } str += '\n max: ' + util.inspect(max, opts) extras = true } var maxAge = this[MAX_AGE] if (maxAge) { if (extras) { str += ',' } str += '\n maxAge: ' + util.inspect(maxAge, opts) extras = true } var lc = this[LENGTH_CALCULATOR] if (lc && lc !== naiveLength) { if (extras) { str += ',' } str += '\n length: ' + util.inspect(this[LENGTH], opts) extras = true } var didFirst = false this[LRU_LIST].forEach(function (item) { if (didFirst) { str += ',\n ' } else { if (extras) { str += ',\n' } didFirst = true str += '\n ' } var key = util.inspect(item.key).split('\n').join('\n ') var val = { value: item.value } if (item.maxAge !== maxAge) { val.maxAge = item.maxAge } if (lc !== naiveLength) { val.length = item.length } if (isStale(this, item)) { val.stale = true } val = util.inspect(val, opts).split('\n').join('\n ') str += key + ' => ' + val }) if (didFirst || extras) { str += '\n' } str += '}' return str } LRUCache.prototype.set = function (key, value, maxAge) { maxAge = maxAge || this[MAX_AGE] var now = maxAge ? Date.now() : 0 var len = this[LENGTH_CALCULATOR](value, key) if (this[CACHE].has(key)) { if (len > this[MAX]) { del(this, this[CACHE].get(key)) return false } var node = this[CACHE].get(key) var item = node.value // dispose of the old one before overwriting // split out into 2 ifs for better coverage tracking if (this[DISPOSE]) { if (!this[NO_DISPOSE_ON_SET]) { this[DISPOSE](key, item.value) } } item.now = now item.maxAge = maxAge item.value = value this[LENGTH] += len - item.length item.length = len this.get(key) trim(this) return true } var hit = new Entry(key, value, len, now, maxAge) // oversized objects fall out of cache automatically. if (hit.length > this[MAX]) { if (this[DISPOSE]) { this[DISPOSE](key, value) } return false } this[LENGTH] += hit.length this[LRU_LIST].unshift(hit) this[CACHE].set(key, this[LRU_LIST].head) trim(this) return true } LRUCache.prototype.has = function (key) { if (!this[CACHE].has(key)) return false var hit = this[CACHE].get(key).value if (isStale(this, hit)) { return false } return true } LRUCache.prototype.get = function (key) { return get(this, key, true) } LRUCache.prototype.peek = function (key) { return get(this, key, false) } LRUCache.prototype.pop = function () { var node = this[LRU_LIST].tail if (!node) return null del(this, node) return node.value } LRUCache.prototype.del = function (key) { del(this, this[CACHE].get(key)) } LRUCache.prototype.load = function (arr) { // reset the cache this.reset() var now = Date.now() // A previous serialized cache has the most recent items first for (var l = arr.length - 1; l >= 0; l--) { var hit = arr[l] var expiresAt = hit.e || 0 if (expiresAt === 0) { // the item was created without expiration in a non aged cache this.set(hit.k, hit.v) } else { var maxAge = expiresAt - now // dont add already expired items if (maxAge > 0) { this.set(hit.k, hit.v, maxAge) } } } } LRUCache.prototype.prune = function () { var self = this this[CACHE].forEach(function (value, key) { get(self, key, false) }) } function get (self, key, doUse) { var node = self[CACHE].get(key) if (node) { var hit = node.value if (isStale(self, hit)) { del(self, node) if (!self[ALLOW_STALE]) hit = undefined } else { if (doUse) { self[LRU_LIST].unshiftNode(node) } } if (hit) hit = hit.value } return hit } function isStale (self, hit) { if (!hit || (!hit.maxAge && !self[MAX_AGE])) { return false } var stale = false var diff = Date.now() - hit.now if (hit.maxAge) { stale = diff > hit.maxAge } else { stale = self[MAX_AGE] && (diff > self[MAX_AGE]) } return stale } function trim (self) { if (self[LENGTH] > self[MAX]) { for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { // We know that we're about to delete this one, and also // what the next least recently used key will be, so just // go ahead and set it now. var prev = walker.prev del(self, walker) walker = prev } } } function del (self, node) { if (node) { var hit = node.value if (self[DISPOSE]) { self[DISPOSE](hit.key, hit.value) } self[LENGTH] -= hit.length self[CACHE].delete(hit.key) self[LRU_LIST].removeNode(node) } } // classy, since V8 prefers predictable objects. function Entry (key, value, length, now, maxAge) { this.key = key this.value = value this.length = length this.now = now this.maxAge = maxAge || 0 } /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function escapeArgument(arg, quote) { // Convert to string arg = '' + arg; // If we are not going to quote the argument, // escape shell metacharacters, including double and single quotes: if (!quote) { arg = arg.replace(/([()%!^<>&|;,"'\s])/g, '^$1'); } else { // Sequence of backslashes followed by a double quote: // double up all the backslashes and escape the double quote arg = arg.replace(/(\\*)"/g, '$1$1\\"'); // Sequence of backslashes followed by the end of the string // (which will become a double quote later): // double up all the backslashes arg = arg.replace(/(\\*)$/, '$1$1'); // All other backslashes occur literally // Quote the whole thing: arg = '"' + arg + '"'; } return arg; } module.exports = escapeArgument; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const execa = __webpack_require__(8); const lcid = __webpack_require__(38); const mem = __webpack_require__(41); const defaultOpts = {spawn: true}; const defaultLocale = 'en_US'; function getEnvLocale(env) { env = env || process.env; return env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE; } function parseLocale(x) { const env = x.split('\n').reduce((env, def) => { def = def.split('='); env[def[0]] = def[1].replace(/^"|"$/g, ''); return env; }, {}); return getEnvLocale(env); } function getLocale(str) { return (str && str.replace(/[.:].*/, '')); } function getAppleLocale() { return execa.stdout('defaults', ['read', '-g', 'AppleLocale']); } function getAppleLocaleSync() { return execa.sync('defaults', ['read', '-g', 'AppleLocale']).stdout; } function getUnixLocale() { if (process.platform === 'darwin') { return getAppleLocale(); } return execa.stdout('locale') .then(stdout => getLocale(parseLocale(stdout))); } function getUnixLocaleSync() { if (process.platform === 'darwin') { return getAppleLocaleSync(); } return getLocale(parseLocale(execa.sync('locale').stdout)); } function getWinLocale() { return execa.stdout('wmic', ['os', 'get', 'locale']) .then(stdout => { const lcidCode = parseInt(stdout.replace('Locale', ''), 16); return lcid.from(lcidCode); }); } function getWinLocaleSync() { const stdout = execa.sync('wmic', ['os', 'get', 'locale']).stdout; const lcidCode = parseInt(stdout.replace('Locale', ''), 16); return lcid.from(lcidCode); } // module.exports = mem(opts => { // opts = opts || defaultOpts; // const envLocale = getEnvLocale(); // let thenable; // if (envLocale || opts.spawn === false) { // thenable = Promise.resolve(getLocale(envLocale)); // } else if (process.platform === 'win32') { // thenable = getWinLocale(); // } else { // thenable = getUnixLocale(); // } // return thenable.then(locale => locale || defaultLocale) // .catch(() => defaultLocale); // }); module.exports = mem(opts => { opts = opts || defaultOpts; const envLocale = getEnvLocale(); let res; if (envLocale || opts.spawn === false) { res = getLocale(envLocale); } else { try { if (process.platform === 'win32') { res = getWinLocaleSync(); } else { res = getUnixLocaleSync(); } } catch (err) {} } return res || defaultLocale; }); /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const childProcess = __webpack_require__(2); const util = __webpack_require__(3); const crossSpawn = __webpack_require__(9); const stripEof = __webpack_require__(24); const npmRunPath = __webpack_require__(25); const isStream = __webpack_require__(27); const _getStream = __webpack_require__(28); const pFinally = __webpack_require__(31); const onExit = __webpack_require__(32); const errname = __webpack_require__(36); const stdio = __webpack_require__(37); const TEN_MEGABYTES = 1000 * 1000 * 10; function handleArgs(cmd, args, opts) { let parsed; if (opts && opts.env && opts.extendEnv !== false) { opts.env = Object.assign({}, process.env, opts.env); } if (opts && opts.__winShell === true) { delete opts.__winShell; parsed = { command: cmd, args, options: opts, file: cmd, original: cmd }; } else { parsed = crossSpawn._parse(cmd, args, opts); } opts = Object.assign({ maxBuffer: TEN_MEGABYTES, stripEof: true, preferLocal: true, localDir: parsed.options.cwd || process.cwd(), encoding: 'utf8', reject: true, cleanup: true }, parsed.options); opts.stdio = stdio(opts); if (opts.preferLocal) { opts.env = npmRunPath.env(Object.assign({}, opts, {cwd: opts.localDir})); } return { cmd: parsed.command, args: parsed.args, opts, parsed }; } function handleInput(spawned, opts) { const input = opts.input; if (input === null || input === undefined) { return; } if (isStream(input)) { input.pipe(spawned.stdin); } else { spawned.stdin.end(input); } } function handleOutput(opts, val) { if (val && opts.stripEof) { val = stripEof(val); } return val; } function handleShell(fn, cmd, opts) { let file = '/bin/sh'; let args = ['-c', cmd]; opts = Object.assign({}, opts); if (process.platform === 'win32') { opts.__winShell = true; file = process.env.comspec || 'cmd.exe'; args = ['/s', '/c', `"${cmd}"`]; opts.windowsVerbatimArguments = true; } if (opts.shell) { file = opts.shell; delete opts.shell; } return fn(file, args, opts); } function getStream(process, stream, encoding, maxBuffer) { if (!process[stream]) { return null; } let ret; if (encoding) { ret = _getStream(process[stream], { encoding, maxBuffer }); } else { ret = _getStream.buffer(process[stream], {maxBuffer}); } return ret.catch(err => { err.stream = stream; err.message = `${stream} ${err.message}`; throw err; }); } module.exports = (cmd, args, opts) => { let joinedCmd = cmd; if (Array.isArray(args) && args.length > 0) { joinedCmd += ' ' + args.join(' '); } const parsed = handleArgs(cmd, args, opts); const encoding = parsed.opts.encoding; const maxBuffer = parsed.opts.maxBuffer; let spawned; try { spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts); } catch (err) { return Promise.reject(err); } let removeExitHandler; if (parsed.opts.cleanup) { removeExitHandler = onExit(() => { spawned.kill(); }); } let timeoutId = null; let timedOut = false; const cleanupTimeout = () => { if (timeoutId) { clearTimeout(timeoutId); timeoutId = null; } }; if (parsed.opts.timeout > 0) { timeoutId = setTimeout(() => { timeoutId = null; timedOut = true; spawned.kill(parsed.opts.killSignal); }, parsed.opts.timeout); } const processDone = new Promise(resolve => { spawned.on('exit', (code, signal) => { cleanupTimeout(); resolve({code, signal}); }); spawned.on('error', err => { cleanupTimeout(); resolve({err}); }); if (spawned.stdin) { spawned.stdin.on('error', err => { cleanupTimeout(); resolve({err}); }); } }); function destroy() { if (spawned.stdout) { spawned.stdout.destroy(); } if (spawned.stderr) { spawned.stderr.destroy(); } } const promise = pFinally(Promise.all([ processDone, getStream(spawned, 'stdout', encoding, maxBuffer), getStream(spawned, 'stderr', encoding, maxBuffer) ]).then(arr => { const result = arr[0]; const stdout = arr[1]; const stderr = arr[2]; let err = result.err; const code = result.code; const signal = result.signal; if (removeExitHandler) { removeExitHandler(); } if (err || code !== 0 || signal !== null) { if (!err) { let output = ''; if (Array.isArray(parsed.opts.stdio)) { if (parsed.opts.stdio[2] !== 'inherit') { output += output.length > 0 ? stderr : `\n${stderr}`; } if (parsed.opts.stdio[1] !== 'inherit') { output += `\n${stdout}`; } } else if (parsed.opts.stdio !== 'inherit') { output = `\n${stderr}${stdout}`; } err = new Error(`Command failed: ${joinedCmd}${output}`); err.code = code < 0 ? errname(code) : code; } // TODO: missing some timeout logic for killed // https://github.com/nodejs/node/blob/master/lib/child_process.js#L203 // err.killed = spawned.killed || killed; err.killed = err.killed || spawned.killed; err.stdout = stdout; err.stderr = stderr; err.failed = true; err.signal = signal || null; err.cmd = joinedCmd; err.timedOut = timedOut; if (!parsed.opts.reject) { return err; } throw err; } return { stdout: handleOutput(parsed.opts, stdout), stderr: handleOutput(parsed.opts, stderr), code: 0, failed: false, killed: false, signal: null, cmd: joinedCmd, timedOut: false }; }), destroy); crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed); handleInput(spawned, parsed.opts); spawned.then = promise.then.bind(promise); spawned.catch = promise.catch.bind(promise); return spawned; }; module.exports.stdout = function () { // TODO: set `stderr: 'ignore'` when that option is implemented return module.exports.apply(null, arguments).then(x => x.stdout); }; module.exports.stderr = function () { // TODO: set `stdout: 'ignore'` when that option is implemented return module.exports.apply(null, arguments).then(x => x.stderr); }; module.exports.shell = (cmd, opts) => handleShell(module.exports, cmd, opts); module.exports.sync = (cmd, args, opts) => { const parsed = handleArgs(cmd, args, opts); if (isStream(parsed.opts.input)) { throw new TypeError('The `input` option cannot be a stream in sync mode'); } const result = childProcess.spawnSync(parsed.cmd, parsed.args, parsed.opts); if (result.error || result.status !== 0) { throw (result.error || new Error(result.stderr === '' ? result.stdout : result.stderr)); } result.stdout = handleOutput(parsed.opts, result.stdout); result.stderr = handleOutput(parsed.opts, result.stderr); return result; }; module.exports.shellSync = (cmd, opts) => handleShell(module.exports.sync, cmd, opts); module.exports.spawn = util.deprecate(module.exports, 'execa.spawn() is deprecated. Use execa() instead.'); /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var cp = __webpack_require__(2); var parse = __webpack_require__(10); var enoent = __webpack_require__(23); var cpSpawnSync = cp.spawnSync; function spawn(command, args, options) { var parsed; var spawned; // Parse the arguments parsed = parse(command, args, options); // Spawn the child process spawned = cp.spawn(parsed.command, parsed.args, parsed.options); // Hook into child process "exit" event to emit an error if the command // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 enoent.hookChildProcess(spawned, parsed); return spawned; } function spawnSync(command, args, options) { var parsed; var result; if (!cpSpawnSync) { try { cpSpawnSync = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"spawn-sync\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); // eslint-disable-line global-require } catch (ex) { throw new Error( 'In order to use spawnSync on node 0.10 or older, you must ' + 'install spawn-sync:\n\n' + ' npm install spawn-sync --save' ); } } // Parse the arguments parsed = parse(command, args, options); // Spawn the child process result = cpSpawnSync(parsed.command, parsed.args, parsed.options); // Analyze if the command does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); return result; } module.exports = spawn; module.exports.spawn = spawn; module.exports.sync = spawnSync; module.exports._parse = parse; module.exports._enoent = enoent; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var resolveCommand = __webpack_require__(4); var hasEmptyArgumentBug = __webpack_require__(18); var escapeArgument = __webpack_require__(6); var escapeCommand = __webpack_require__(19); var readShebang = __webpack_require__(20); var isWin = process.platform === 'win32'; var skipShellRegExp = /\.(?:com|exe)$/i; // Supported in Node >= 6 and >= 4.8 var supportsShellOption = parseInt(process.version.substr(1).split('.')[0], 10) >= 6 || parseInt(process.version.substr(1).split('.')[0], 10) === 4 && parseInt(process.version.substr(1).split('.')[1], 10) >= 8; function parseNonShell(parsed) { var shebang; var needsShell; var applyQuotes; if (!isWin) { return parsed; } // Detect & add support for shebangs parsed.file = resolveCommand(parsed.command); parsed.file = parsed.file || resolveCommand(parsed.command, true); shebang = parsed.file && readShebang(parsed.file); if (shebang) { parsed.args.unshift(parsed.file); parsed.command = shebang; needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(resolveCommand(shebang) || resolveCommand(shebang, true)); } else { needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(parsed.file); } // If a shell is required, use cmd.exe and take care of escaping everything correctly if (needsShell) { // Escape command & arguments applyQuotes = (parsed.command !== 'echo'); // Do not quote arguments for the special "echo" command parsed.command = escapeCommand(parsed.command); parsed.args = parsed.args.map(function (arg) { return escapeArgument(arg, applyQuotes); }); // Make use of cmd.exe parsed.args = ['/d', '/s', '/c', '"' + parsed.command + (parsed.args.length ? ' ' + parsed.args.join(' ') : '') + '"']; parsed.command = process.env.comspec || 'cmd.exe'; parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped } return parsed; } function parseShell(parsed) { var shellCommand; // If node supports the shell option, there's no need to mimic its behavior if (supportsShellOption) { return parsed; } // Mimic node shell option, see: https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335 shellCommand = [parsed.command].concat(parsed.args).join(' '); if (isWin) { parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe'; parsed.args = ['/d', '/s', '/c', '"' + shellCommand + '"']; parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped } else { if (typeof parsed.options.shell === 'string') { parsed.command = parsed.options.shell; } else if (process.platform === 'android') { parsed.command = '/system/bin/sh'; } else { parsed.command = '/bin/sh'; } parsed.args = ['-c', shellCommand]; } return parsed; } // ------------------------------------------------ function parse(command, args, options) { var parsed; // Normalize arguments, similar to nodejs if (args && !Array.isArray(args)) { options = args; args = null; } args = args ? args.slice(0) : []; // Clone array to avoid changing the original options = options || {}; // Build our parsed object parsed = { command: command, args: args, options: options, file: undefined, original: command, }; // Delegate further parsing to shell or non-shell return options.shell ? parseShell(parsed) : parseNonShell(parsed); } module.exports = parse; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { module.exports = which which.sync = whichSync var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys' var path = __webpack_require__(1) var COLON = isWindows ? ';' : ':' var isexe = __webpack_require__(12) function getNotFoundError (cmd) { var er = new Error('not found: ' + cmd) er.code = 'ENOENT' return er } function getPathInfo (cmd, opt) { var colon = opt.colon || COLON var pathEnv = opt.path || process.env.PATH || '' var pathExt = [''] pathEnv = pathEnv.split(colon) var pathExtExe = '' if (isWindows) { pathEnv.unshift(process.cwd()) pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') pathExt = pathExtExe.split(colon) // Always test the cmd itself first. isexe will check to make sure // it's found in the pathExt set. if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('') } // If it has a slash, then we don't bother searching the pathenv. // just check the file itself, and that's it. if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) pathEnv = [''] return { env: pathEnv, ext: pathExt, extExe: pathExtExe } } function which (cmd, opt, cb) { if (typeof opt === 'function') { cb = opt opt = {} } var info = getPathInfo(cmd, opt) var pathEnv = info.env var pathExt = info.ext var pathExtExe = info.extExe var found = [] ;(function F (i, l) { if (i === l) { if (opt.all && found.length) return cb(null, found) else return cb(getNotFoundError(cmd)) } var pathPart = pathEnv[i] if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1) var p = path.join(pathPart, cmd) if (!pathPart && (/^\.[\\\/]/).test(cmd)) { p = cmd.slice(0, 2) + p } ;(function E (ii, ll) { if (ii === ll) return F(i + 1, l) var ext = pathExt[ii] isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { if (!er && is) { if (opt.all) found.push(p + ext) else return cb(null, p + ext) } return E(ii + 1, ll) }) })(0, pathExt.length) })(0, pathEnv.length) } function whichSync (cmd, opt) { opt = opt || {} var info = getPathInfo(cmd, opt) var pathEnv = info.env var pathExt = info.ext var pathExtExe = info.extExe var found = [] for (var i = 0, l = pathEnv.length; i < l; i ++) { var pathPart = pathEnv[i] if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1) var p = path.join(pathPart, cmd) if (!pathPart && /^\.[\\\/]/.test(cmd)) { p = cmd.slice(0, 2) + p } for (var j = 0, ll = pathExt.length; j < ll; j ++) { var cur = p + pathExt[j] var is try { is = isexe.sync(cur, { pathExt: pathExtExe }) if (is) { if (opt.all) found.push(cur) else return cur } } catch (ex) {} } } if (opt.all && found.length) return found if (opt.nothrow) return null throw getNotFoundError(cmd) } /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { var fs = __webpack_require__(0) var core if (process.platform === 'win32' || global.TESTING_WINDOWS) { core = __webpack_require__(13) } else { core = __webpack_require__(14) } module.exports = isexe isexe.sync = sync function isexe (path, options, cb) { if (typeof options === 'function') { cb = options options = {} } if (!cb) { if (typeof Promise !== 'function') { throw new TypeError('callback not provided') } return new Promise(function (resolve, reject) { isexe(path, options || {}, function (er, is) { if (er) { reject(er) } else { resolve(is) } }) }) } core(path, options || {}, function (er, is) { // ignore EACCES because that just means we aren't allowed to run it if (er) { if (er.code === 'EACCES' || options && options.ignoreErrors) { er = null is = false } } cb(er, is) }) } function sync (path, options) { // my kingdom for a filtered catch try { return core.sync(path, options || {}) } catch (er) { if (options && options.ignoreErrors || er.code === 'EACCES') { return false } else { throw er } } } /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { module.exports = isexe isexe.sync = sync var fs = __webpack_require__(0) function checkPathExt (path, options) { var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT if (!pathext) { return true } pathext = pathext.split(';') if (pathext.indexOf('') !== -1) { return true } for (var i = 0; i < pathext.length; i++) { var p = pathext[i].toLowerCase() if (p && path.substr(-p.length).toLowerCase() === p) { return true } } return false } function checkStat (stat, path, options) { if (!stat.isSymbolicLink() && !stat.isFile()) { return false } return checkPathExt(path, options) } function isexe (path, options, cb) { fs.stat(path, function (er, stat) { cb(er, er ? false : checkStat(stat, path, options)) }) } function sync (path, options) { return checkStat(fs.statSync(path), path, options) } /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { module.exports = isexe isexe.sync = sync var fs = __webpack_require__(0) function isexe (path, options, cb) { fs.stat(path, function (er, stat) { cb(er, er ? false : checkStat(stat, options)) }) } function sync (path, options) { return checkStat(fs.statSync(path), options) } function checkStat (stat, options) { return stat.isFile() && checkMode(stat, options) } function checkMode (stat, options) { var mod = stat.mode var uid = stat.uid var gid = stat.gid var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid() var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid() var u = parseInt('100', 8) var g = parseInt('010', 8) var o = parseInt('001', 8) var ug = u | g var ret = (mod & o) || (mod & g) && gid === myGid || (mod & u) && uid === myUid || (mod & ug) && myUid === 0 return ret } /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { if (process.env.npm_package_name === 'pseudomap' && process.env.npm_lifecycle_script === 'test') process.env.TEST_PSEUDOMAP = 'true' if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) { module.exports = Map } else { module.exports = __webpack_require__(16) } /***/ }), /* 16 */ /***/ (function(module, exports) { var hasOwnProperty = Object.prototype.hasOwnProperty module.exports = PseudoMap function PseudoMap (set) { if (!(this instanceof PseudoMap)) // whyyyyyyy throw new TypeError("Constructor PseudoMap requires 'new'") this.clear() if (set) { if ((set instanceof PseudoMap) || (typeof Map === 'function' && set instanceof Map)) set.forEach(function (value, key) { this.set(key, value) }, this) else if (Array.isArray(set)) set.forEach(function (kv) { this.set(kv[0], kv[1]) }, this) else throw new TypeError('invalid argument') } } PseudoMap.prototype.forEach = function (fn, thisp) { thisp = thisp || this Object.keys(this._data).forEach(function (k) { if (k !== 'size') fn.call(thisp, this._data[k].value, this._data[k].key) }, this) } PseudoMap.prototype.has = function (k) { return !!find(this._data, k) } PseudoMap.prototype.get = function (k) { var res = find(this._data, k) return res && res.value } PseudoMap.prototype.set = function (k, v) { set(this._data, k, v) } PseudoMap.prototype.delete = function (k) { var res = find(this._data, k) if (res) { delete this._data[res._index] this._data.size-- } } PseudoMap.prototype.clear = function () { var data = Object.create(null) data.size = 0 Object.defineProperty(this, '_data', { value: data, enumerable: false, configurable: true, writable: false }) } Object.defineProperty(PseudoMap.prototype, 'size', { get: function () { return this._data.size }, set: function (n) {}, enumerable: true, configurable: true }) PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function () { throw new Error('iterators are not implemented in this version') } // Either identical, or both NaN function same (a, b) { return a === b || a !== a && b !== b } function Entry (k, v, i) { this.key = k this.value = v this._index = i } function find (data, k) { for (var i = 0, s = '_' + k, key = s; hasOwnProperty.call(data, key); key = s + i++) { if (same(data[key].key, k)) return data[key] } } function set (data, k, v) { for (var i = 0, s = '_' + k, key = s; hasOwnProperty.call(data, key); key = s + i++) { if (same(data[key].key, k)) { data[key].value = v return } } data.size++ data[key] = new Entry(k, v, key) } /***/ }), /* 17 */ /***/ (function(module, exports) { module.exports = Yallist Yallist.Node = Node Yallist.create = Yallist function Yallist (list) { var self = this if (!(self instanceof Yallist)) { self = new Yallist() } self.tail = null self.head = null self.length = 0 if (list && typeof list.forEach === 'function') { list.forEach(function (item) { self.push(item) }) } else if (arguments.length > 0) { for (var i = 0, l = arguments.length; i < l; i++) { self.push(arguments[i]) } } return self } Yallist.prototype.removeNode = function (node) { if (node.list !== this) { throw new Error('removing node which does not belong to this list') } var next = node.next var prev = node.prev if (next) { next.prev = prev } if (prev) { prev.next = next } if (node === this.head) { this.head = next } if (node === this.tail) { this.tail = prev } node.list.length-- node.next = null node.prev = null node.list = null } Yallist.prototype.unshiftNode = function (node) { if (node === this.head) { return } if (node.list) { node.list.removeNode(node) } var head = this.head node.list = this node.next = head if (head) { head.prev = node } this.head = node if (!this.tail) { this.tail = node } this.length++ } Yallist.prototype.pushNode = function (node) { if (node === this.tail) { return } if (node.list) { node.list.removeNode(node) } var tail = this.tail node.list = this node.prev = tail if (tail) { tail.next = node } this.tail = node if (!this.head) { this.head = node } this.length++ } Yallist.prototype.push = function () { for (var i = 0, l = arguments.length; i < l; i++) { push(this, arguments[i]) } return this.length } Yallist.prototype.unshift = function () { for (var i = 0, l = arguments.length; i < l; i++) { unshift(this, arguments[i]) } return this.length } Yallist.prototype.pop = function () { if (!this.tail) { return undefined } var res = this.tail.value this.tail = this.tail.prev if (this.tail) { this.tail.next = null } else { this.head = null } this.length-- return res } Yallist.prototype.shift = function () { if (!this.head) { return undefined } var res = this.head.value this.head = this.head.next if (this.head) { this.head.prev = null } else { this.tail = null } this.length-- return res } Yallist.prototype.forEach = function (fn, thisp) { thisp = thisp || this for (var walker = this.head, i = 0; walker !== null; i++) { fn.call(thisp, walker.value, i, this) walker = walker.next } } Yallist.prototype.forEachReverse = function (fn, thisp) { thisp = thisp || this for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { fn.call(thisp, walker.value, i, this) walker = walker.prev } } Yallist.prototype.get = function (n) { for (var i = 0, walker = this.head; walker !== null && i < n; i++) { // abort out of the list early if we hit a cycle walker = walker.next } if (i === n && walker !== null) { return walker.value } } Yallist.prototype.getReverse = function (n) { for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { // abort out of the list early if we hit a cycle walker = walker.prev } if (i === n && walker !== null) { return walker.value } } Yallist.prototype.map = function (fn, thisp) { thisp = thisp || this var res = new Yallist() for (var walker = this.head; walker !== null;) { res.push(fn.call(thisp, walker.value, this)) walker = walker.next } return res } Yallist.prototype.mapReverse = function (fn, thisp) { thisp = thisp || this var res = new Yallist() for (var walker = this.tail; walker !== null;) { res.push(fn.call(thisp, walker.value, this)) walker = walker.prev } return res } Yallist.prototype.reduce = function (fn, initial) { var acc var walker = this.head if (arguments.length > 1) { acc = initial } else if (this.head) { walker = this.head.next acc = this.head.value } else { throw new TypeError('Reduce of empty list with no initial value') } for (var i = 0; walker !== null; i++) { acc = fn(acc, walker.value, i) walker = walker.next } return acc } Yallist.prototype.reduceReverse = function (fn, initial) { var acc var walker = this.tail if (arguments.length > 1) { acc = initial } else if (this.tail) { walker = this.tail.prev acc = this.tail.value } else { throw new TypeError('Reduce of empty list with no initial value') } for (var i = this.length - 1; walker !== null; i--) { acc = fn(acc, walker.value, i) walker = walker.prev } return acc } Yallist.prototype.toArray = function () { var arr = new Array(this.length) for (var i = 0, walker = this.head; walker !== null; i++) { arr[i] = walker.value walker = walker.next } return arr } Yallist.prototype.toArrayReverse = function () { var arr = new Array(this.length) for (var i = 0, walker = this.tail; walker !== null; i++) { arr[i] = walker.value walker = walker.prev } return arr } Yallist.prototype.slice = function (from, to) { to = to || this.length if (to < 0) { to += this.length } from = from || 0 if (from < 0) { from += this.length } var ret = new Yallist() if (to < from || to < 0) { return ret } if (from < 0) { from = 0 } if (to > this.length) { to = this.length } for (var i = 0, walker = this.head; walker !== null && i < from; i++) { walker = walker.next } for (; walker !== null && i < to; i++, walker = walker.next) { ret.push(walker.value) } return ret } Yallist.prototype.sliceReverse = function (from, to) { to = to || this.length if (to < 0) { to += this.length } from = from || 0 if (from < 0) { from += this.length } var ret = new Yallist() if (to < from || to < 0) { return ret } if (from < 0) { from = 0 } if (to > this.length) { to = this.length } for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { walker = walker.prev } for (; walker !== null && i > from; i--, walker = walker.prev) { ret.push(walker.value) } return ret } Yallist.prototype.reverse = function () { var head = this.head var tail = this.tail for (var walker = head; walker !== null; walker = walker.prev) { var p = walker.prev walker.prev = walker.next walker.next = p } this.head = tail this.tail = head return this } function push (self, item) { self.tail = new Node(item, self.tail, null, self) if (!self.head) { self.head = self.tail } self.length++ } function unshift (self, item) { self.head = new Node(item, null, self.head, self) if (!self.tail) { self.tail = self.head } self.length++ } function Node (value, prev, next, list) { if (!(this instanceof Node)) { return new Node(value, prev, next, list) } this.list = list this.value = value if (prev) { prev.next = this this.prev = prev } else { this.prev = null } if (next) { next.prev = this this.next = next } else { this.next = null } } /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // See: https://github.com/IndigoUnited/node-cross-spawn/pull/34#issuecomment-221623455 function hasEmptyArgumentBug() { var nodeVer; if (process.platform !== 'win32') { return false; } nodeVer = process.version.substr(1).split('.').map(function (num) { return parseInt(num, 10); }); return (nodeVer[0] === 0 && nodeVer[1] < 12); } module.exports = hasEmptyArgumentBug(); /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var escapeArgument = __webpack_require__(6); function escapeCommand(command) { // Do not escape if this command is not dangerous.. // We do this so that commands like "echo" or "ifconfig" work // Quoting them, will make them unaccessible return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArgument(command, true); } module.exports = escapeCommand; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fs = __webpack_require__(0); var LRU = __webpack_require__(5); var shebangCommand = __webpack_require__(21); var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec function readShebang(command) { var buffer; var fd; var shebang; // Check if it is in the cache first if (shebangCache.has(command)) { return shebangCache.get(command); } // Read the first 150 bytes from the file buffer = new Buffer(150); try { fd = fs.openSync(command, 'r'); fs.readSync(fd, buffer, 0, 150, 0); fs.closeSync(fd); } catch (e) { /* empty */ } // Attempt to extract shebang (null is returned if not a shebang) shebang = shebangCommand(buffer.toString()); // Store the shebang in the cache shebangCache.set(command, shebang); return shebang; } module.exports = readShebang; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var shebangRegex = __webpack_require__(22); module.exports = function (str) { var match = str.match(shebangRegex); if (!match) { return null; } var arr = match[0].replace(/#! ?/, '').split(' '); var bin = arr[0].split('/').pop(); var arg = arr[1]; return (bin === 'env' ? arg : bin + (arg ? ' ' + arg : '') ); }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = /^#!.*/; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isWin = process.platform === 'win32'; var resolveCommand = __webpack_require__(4); var isNode10 = process.version.indexOf('v0.10.') === 0; function notFoundError(command, syscall) { var err; err = new Error(syscall + ' ' + comman