UNPKG

obtain-github-app-installation-access-token

Version:
1,962 lines (1,602 loc) 627 kB
require('./sourcemap-register.js');module.exports = /******/ (function(modules, runtime) { // webpackBootstrap /******/ "use strict"; /******/ // 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; /******/ } /******/ /******/ /******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { /******/ // Load entry module and return exports /******/ return __webpack_require__(131); /******/ }; /******/ // initialize runtime /******/ runtime(__webpack_require__); /******/ /******/ // run startup /******/ return startup(); /******/ }) /************************************************************************/ /******/ ({ /***/ 2: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const os = __webpack_require__(87); const macosRelease = __webpack_require__(118); const winRelease = __webpack_require__(49); const osName = (platform, release) => { if (!platform && release) { throw new Error('You can\'t specify a `release` without specifying `platform`'); } platform = platform || os.platform(); let id; if (platform === 'darwin') { if (!release && os.platform() === 'darwin') { release = os.release(); } const prefix = release ? (Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X') : 'macOS'; id = release ? macosRelease(release).name : ''; return prefix + (id ? ' ' + id : ''); } if (platform === 'linux') { if (!release && os.platform() === 'linux') { release = os.release(); } id = release ? release.replace(/^(\d+\.\d+).*/, '$1') : ''; return 'Linux' + (id ? ' ' + id : ''); } if (platform === 'win32') { if (!release && os.platform() === 'win32') { release = os.release(); } id = release ? winRelease(release) : ''; return 'Windows' + (id ? ' ' + id : ''); } return platform; }; module.exports = osName; /***/ }), /***/ 9: /***/ (function(module, __unusedexports, __webpack_require__) { var once = __webpack_require__(370); var noop = function() {}; var isRequest = function(stream) { return stream.setHeader && typeof stream.abort === 'function'; }; var isChildProcess = function(stream) { return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3 }; var eos = function(stream, opts, callback) { if (typeof opts === 'function') return eos(stream, null, opts); if (!opts) opts = {}; callback = once(callback || noop); var ws = stream._writableState; var rs = stream._readableState; var readable = opts.readable || (opts.readable !== false && stream.readable); var writable = opts.writable || (opts.writable !== false && stream.writable); var cancelled = false; var onlegacyfinish = function() { if (!stream.writable) onfinish(); }; var onfinish = function() { writable = false; if (!readable) callback.call(stream); }; var onend = function() { readable = false; if (!writable) callback.call(stream); }; var onexit = function(exitCode) { callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); }; var onerror = function(err) { callback.call(stream, err); }; var onclose = function() { process.nextTick(onclosenexttick); }; var onclosenexttick = function() { if (cancelled) return; if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close')); if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close')); }; var onrequest = function() { stream.req.on('finish', onfinish); }; if (isRequest(stream)) { stream.on('complete', onfinish); stream.on('abort', onclose); if (stream.req) onrequest(); else stream.on('request', onrequest); } else if (writable && !ws) { // legacy streams stream.on('end', onlegacyfinish); stream.on('close', onlegacyfinish); } if (isChildProcess(stream)) stream.on('exit', onexit); stream.on('end', onend); stream.on('finish', onfinish); if (opts.error !== false) stream.on('error', onerror); stream.on('close', onclose); return function() { cancelled = true; stream.removeListener('complete', onfinish); stream.removeListener('abort', onclose); stream.removeListener('request', onrequest); if (stream.req) stream.req.removeListener('finish', onfinish); stream.removeListener('end', onlegacyfinish); stream.removeListener('close', onlegacyfinish); stream.removeListener('finish', onfinish); stream.removeListener('exit', onexit); stream.removeListener('end', onend); stream.removeListener('error', onerror); stream.removeListener('close', onclose); }; }; module.exports = eos; /***/ }), /***/ 10: /***/ (function(module) { module.exports = function (_require) { _require = _require || require var main = _require.main if (main && isIISNode(main)) return handleIISNode(main) else return main ? main.filename : process.cwd() } function isIISNode (main) { return /\\iisnode\\/.test(main.filename) } function handleIISNode (main) { if (!main.children.length) { return main.filename } else { return main.children[0].filename } } /***/ }), /***/ 11: /***/ (function(module) { // Returns a wrapper function that returns a wrapped callback // The wrapper function should do some stuff, and return a // presumably different callback function. // This makes sure that own properties are retained, so that // decorations and such are not lost along the way. module.exports = wrappy function wrappy (fn, cb) { if (fn && cb) return wrappy(fn)(cb) if (typeof fn !== 'function') throw new TypeError('need wrapper function') Object.keys(fn).forEach(function (k) { wrapper[k] = fn[k] }) return wrapper function wrapper() { var args = new Array(arguments.length) for (var i = 0; i < args.length; i++) { args[i] = arguments[i] } var ret = fn.apply(this, args) var cb = args[args.length-1] if (typeof ret === 'function' && ret !== cb) { Object.keys(cb).forEach(function (k) { ret[k] = cb[k] }) } return ret } } /***/ }), /***/ 13: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; // hoisted due to circular dependency on command. module.exports = argsert const command = __webpack_require__(562)() const YError = __webpack_require__(546) const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'] function argsert (expected, callerArguments, length) { // TODO: should this eventually raise an exception. try { // preface the argument description with "cmd", so // that we can run it through yargs' command parser. let position = 0 let parsed = { demanded: [], optional: [] } if (typeof expected === 'object') { length = callerArguments callerArguments = expected } else { parsed = command.parseCommand(`cmd ${expected}`) } const args = [].slice.call(callerArguments) while (args.length && args[args.length - 1] === undefined) args.pop() length = length || args.length if (length < parsed.demanded.length) { throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`) } const totalCommands = parsed.demanded.length + parsed.optional.length if (length > totalCommands) { throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`) } parsed.demanded.forEach((demanded) => { const arg = args.shift() const observedType = guessType(arg) const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*') if (matchingTypes.length === 0) argumentTypeError(observedType, demanded.cmd, position, false) position += 1 }) parsed.optional.forEach((optional) => { if (args.length === 0) return const arg = args.shift() const observedType = guessType(arg) const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*') if (matchingTypes.length === 0) argumentTypeError(observedType, optional.cmd, position, true) position += 1 }) } catch (err) { console.warn(err.stack) } } function guessType (arg) { if (Array.isArray(arg)) { return 'array' } else if (arg === null) { return 'null' } return typeof arg } function argumentTypeError (observedType, allowedTypes, position, optional) { throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`) } /***/ }), /***/ 18: /***/ (function() { eval("require")("encoding"); /***/ }), /***/ 20: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const cp = __webpack_require__(129); const parse = __webpack_require__(568); const enoent = __webpack_require__(881); function spawn(command, args, options) { // Parse the arguments const parsed = parse(command, args, options); // Spawn the child process const 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) { // Parse the arguments const parsed = parse(command, args, options); // Spawn the child process const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); // Analyze if the command does not exist, 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; /***/ }), /***/ 32: /***/ (function(module, __unusedexports, __webpack_require__) { /*global module, process*/ var Buffer = __webpack_require__(149).Buffer; var Stream = __webpack_require__(413); var util = __webpack_require__(669); function DataStream(data) { this.buffer = null; this.writable = true; this.readable = true; // No input if (!data) { this.buffer = Buffer.alloc(0); return this; } // Stream if (typeof data.pipe === 'function') { this.buffer = Buffer.alloc(0); data.pipe(this); return this; } // Buffer or String // or Object (assumedly a passworded key) if (data.length || typeof data === 'object') { this.buffer = data; this.writable = false; process.nextTick(function () { this.emit('end', data); this.readable = false; this.emit('close'); }.bind(this)); return this; } throw new TypeError('Unexpected data type ('+ typeof data + ')'); } util.inherits(DataStream, Stream); DataStream.prototype.write = function write(data) { this.buffer = Buffer.concat([this.buffer, Buffer.from(data)]); this.emit('data', data); }; DataStream.prototype.end = function end(data) { if (data) this.write(data); this.emit('end', data); this.emit('close'); this.writable = false; this.readable = false; }; module.exports = DataStream; /***/ }), /***/ 39: /***/ (function(module) { "use strict"; module.exports = opts => { opts = opts || {}; const env = opts.env || process.env; const platform = opts.platform || process.platform; if (platform !== 'win32') { return 'PATH'; } return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path'; }; /***/ }), /***/ 49: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const os = __webpack_require__(87); const execa = __webpack_require__(955); // Reference: https://www.gaijin.at/en/lstwinver.php const names = new Map([ ['10.0', '10'], ['6.3', '8.1'], ['6.2', '8'], ['6.1', '7'], ['6.0', 'Vista'], ['5.2', 'Server 2003'], ['5.1', 'XP'], ['5.0', '2000'], ['4.9', 'ME'], ['4.1', '98'], ['4.0', '95'] ]); const windowsRelease = release => { const version = /\d+\.\d/.exec(release || os.release()); if (release && !version) { throw new Error('`release` argument doesn\'t match `n.n`'); } const ver = (version || [])[0]; // Server 2008, 2012 and 2016 versions are ambiguous with desktop versions and must be detected at runtime. // If `release` is omitted or we're on a Windows system, and the version number is an ambiguous version // then use `wmic` to get the OS caption: https://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx // If the resulting caption contains the year 2008, 2012 or 2016, it is a server version, so return a server OS name. if ((!release || release === os.release()) && ['6.1', '6.2', '6.3', '10.0'].includes(ver)) { const stdout = execa.sync('wmic', ['os', 'get', 'Caption']).stdout || ''; const year = (stdout.match(/2008|2012|2016/) || [])[0]; if (year) { return `Server ${year}`; } } return names.get(ver); }; module.exports = windowsRelease; /***/ }), /***/ 72: /***/ (function(module) { "use strict"; const pTry = (fn, ...arguments_) => new Promise(resolve => { resolve(fn(...arguments_)); }); module.exports = pTry; // TODO: remove this in the next major version module.exports.default = pTry; /***/ }), /***/ 76: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; // this file handles outputting usage instructions, // failures, etc. keeps logging in one place. const decamelize = __webpack_require__(883) const stringWidth = __webpack_require__(892) const objFilter = __webpack_require__(92) const path = __webpack_require__(622) const setBlocking = __webpack_require__(286) const YError = __webpack_require__(546) module.exports = function usage (yargs, y18n) { const __ = y18n.__ const self = {} // methods for ouputting/building failure message. const fails = [] self.failFn = function failFn (f) { fails.push(f) } let failMessage = null let showHelpOnFail = true self.showHelpOnFail = function showHelpOnFailFn (enabled, message) { if (typeof enabled === 'string') { message = enabled enabled = true } else if (typeof enabled === 'undefined') { enabled = true } failMessage = message showHelpOnFail = enabled return self } let failureOutput = false self.fail = function fail (msg, err) { const logger = yargs._getLoggerInstance() if (fails.length) { for (let i = fails.length - 1; i >= 0; --i) { fails[i](msg, err, self) } } else { if (yargs.getExitProcess()) setBlocking(true) // don't output failure message more than once if (!failureOutput) { failureOutput = true if (showHelpOnFail) { yargs.showHelp('error') logger.error() } if (msg || err) logger.error(msg || err) if (failMessage) { if (msg || err) logger.error('') logger.error(failMessage) } } err = err || new YError(msg) if (yargs.getExitProcess()) { return yargs.exit(1) } else if (yargs._hasParseCallback()) { return yargs.exit(1, err) } else { throw err } } } // methods for ouputting/building help (usage) message. let usages = [] let usageDisabled = false self.usage = (msg, description) => { if (msg === null) { usageDisabled = true usages = [] return } usageDisabled = false usages.push([msg, description || '']) return self } self.getUsage = () => { return usages } self.getUsageDisabled = () => { return usageDisabled } self.getPositionalGroupName = () => { return __('Positionals:') } let examples = [] self.example = (cmd, description) => { examples.push([cmd, description || '']) } let commands = [] self.command = function command (cmd, description, isDefault, aliases) { // the last default wins, so cancel out any previously set default if (isDefault) { commands = commands.map((cmdArray) => { cmdArray[2] = false return cmdArray }) } commands.push([cmd, description || '', isDefault, aliases]) } self.getCommands = () => commands let descriptions = {} self.describe = function describe (key, desc) { if (typeof key === 'object') { Object.keys(key).forEach((k) => { self.describe(k, key[k]) }) } else { descriptions[key] = desc } } self.getDescriptions = () => descriptions let epilog self.epilog = (msg) => { epilog = msg } let wrapSet = false let wrap self.wrap = (cols) => { wrapSet = true wrap = cols } function getWrap () { if (!wrapSet) { wrap = windowWidth() wrapSet = true } return wrap } const deferY18nLookupPrefix = '__yargsString__:' self.deferY18nLookup = str => deferY18nLookupPrefix + str const defaultGroup = 'Options:' self.help = function help () { normalizeAliases() // handle old demanded API const base$0 = path.basename(yargs.$0) const demandedOptions = yargs.getDemandedOptions() const demandedCommands = yargs.getDemandedCommands() const groups = yargs.getGroups() const options = yargs.getOptions() let keys = [] keys = keys.concat(Object.keys(descriptions)) keys = keys.concat(Object.keys(demandedOptions)) keys = keys.concat(Object.keys(demandedCommands)) keys = keys.concat(Object.keys(options.default)) keys = keys.filter(filterHiddenOptions) keys = Object.keys(keys.reduce((acc, key) => { if (key !== '_') acc[key] = true return acc }, {})) const theWrap = getWrap() const ui = __webpack_require__(811)({ width: theWrap, wrap: !!theWrap }) // the usage string. if (!usageDisabled) { if (usages.length) { // user-defined usage. usages.forEach((usage) => { ui.div(`${usage[0].replace(/\$0/g, base$0)}`) if (usage[1]) { ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] }) } }) ui.div() } else if (commands.length) { let u = null // demonstrate how commands are used. if (demandedCommands._) { u = `${base$0} <${__('command')}>\n` } else { u = `${base$0} [${__('command')}]\n` } ui.div(`${u}`) } } // your application's commands, i.e., non-option // arguments populated in '_'. if (commands.length) { ui.div(__('Commands:')) const context = yargs.getContext() const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : '' if (yargs.getParserConfiguration()['sort-commands'] === true) { commands = commands.sort((a, b) => a[0].localeCompare(b[0])) } commands.forEach((command) => { const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands. ui.span( { text: commandString, padding: [0, 2, 0, 2], width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4 }, { text: command[1] } ) const hints = [] if (command[2]) hints.push(`[${__('default:').slice(0, -1)}]`) // TODO hacking around i18n here if (command[3] && command[3].length) { hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`) } if (hints.length) { ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' }) } else { ui.div() } }) ui.div() } // perform some cleanup on the keys array, making it // only include top-level keys not their aliases. const aliasKeys = (Object.keys(options.alias) || []) .concat(Object.keys(yargs.parsed.newAliases) || []) keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1)) // populate 'Options:' group with any keys that have not // explicitly had a group set. if (!groups[defaultGroup]) groups[defaultGroup] = [] addUngroupedKeys(keys, options.alias, groups) // display 'Options:' table along with any custom tables: Object.keys(groups).forEach((groupName) => { if (!groups[groupName].length) return // if we've grouped the key 'f', but 'f' aliases 'foobar', // normalizedKeys should contain only 'foobar'. const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => { if (~aliasKeys.indexOf(key)) return key for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) { if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey } return key }) if (normalizedKeys.length < 1) return ui.div(__(groupName)) // actually generate the switches string --foo, -f, --bar. const switches = normalizedKeys.reduce((acc, key) => { acc[key] = [ key ].concat(options.alias[key] || []) .map(sw => { // for the special positional group don't // add '--' or '-' prefix. if (groupName === self.getPositionalGroupName()) return sw else return (sw.length > 1 ? '--' : '-') + sw }) .join(', ') return acc }, {}) normalizedKeys.forEach((key) => { const kswitch = switches[key] let desc = descriptions[key] || '' let type = null if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length)) if (~options.boolean.indexOf(key)) type = `[${__('boolean')}]` if (~options.count.indexOf(key)) type = `[${__('count')}]` if (~options.string.indexOf(key)) type = `[${__('string')}]` if (~options.normalize.indexOf(key)) type = `[${__('string')}]` if (~options.array.indexOf(key)) type = `[${__('array')}]` if (~options.number.indexOf(key)) type = `[${__('number')}]` const extra = [ type, (key in demandedOptions) ? `[${__('required')}]` : null, options.choices && options.choices[key] ? `[${__('choices:')} ${ self.stringifiedValues(options.choices[key])}]` : null, defaultString(options.default[key], options.defaultDescription[key]) ].filter(Boolean).join(' ') ui.span( { text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc ) if (extra) ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }) else ui.div() }) ui.div() }) // describe some common use-cases for your application. if (examples.length) { ui.div(__('Examples:')) examples.forEach((example) => { example[0] = example[0].replace(/\$0/g, base$0) }) examples.forEach((example) => { if (example[1] === '') { ui.div( { text: example[0], padding: [0, 2, 0, 2] } ) } else { ui.div( { text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples, theWrap) + 4 }, { text: example[1] } ) } }) ui.div() } // the usage string. if (epilog) { const e = epilog.replace(/\$0/g, base$0) ui.div(`${e}\n`) } // Remove the trailing white spaces return ui.toString().replace(/\s*$/, '') } // return the maximum width of a string // in the left-hand column of a table. function maxWidth (table, theWrap, modifier) { let width = 0 // table might be of the form [leftColumn], // or {key: leftColumn} if (!Array.isArray(table)) { table = Object.keys(table).map(key => [table[key]]) } table.forEach((v) => { width = Math.max( stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width ) }) // if we've enabled 'wrap' we should limit // the max-width of the left-column. if (theWrap) width = Math.min(width, parseInt(theWrap * 0.5, 10)) return width } // make sure any options set for aliases, // are copied to the keys being aliased. function normalizeAliases () { // handle old demanded API const demandedOptions = yargs.getDemandedOptions() const options = yargs.getOptions() ;(Object.keys(options.alias) || []).forEach((key) => { options.alias[key].forEach((alias) => { // copy descriptions. if (descriptions[alias]) self.describe(key, descriptions[alias]) // copy demanded. if (alias in demandedOptions) yargs.demandOption(key, demandedOptions[alias]) // type messages. if (~options.boolean.indexOf(alias)) yargs.boolean(key) if (~options.count.indexOf(alias)) yargs.count(key) if (~options.string.indexOf(alias)) yargs.string(key) if (~options.normalize.indexOf(alias)) yargs.normalize(key) if (~options.array.indexOf(alias)) yargs.array(key) if (~options.number.indexOf(alias)) yargs.number(key) }) }) } // given a set of keys, place any keys that are // ungrouped under the 'Options:' grouping. function addUngroupedKeys (keys, aliases, groups) { let groupedKeys = [] let toCheck = null Object.keys(groups).forEach((group) => { groupedKeys = groupedKeys.concat(groups[group]) }) keys.forEach((key) => { toCheck = [key].concat(aliases[key]) if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) { groups[defaultGroup].push(key) } }) return groupedKeys } function filterHiddenOptions (key) { return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt] } self.showHelp = (level) => { const logger = yargs._getLoggerInstance() if (!level) level = 'error' const emit = typeof level === 'function' ? level : logger[level] emit(self.help()) } self.functionDescription = (fn) => { const description = fn.name ? decamelize(fn.name, '-') : __('generated-value') return ['(', description, ')'].join('') } self.stringifiedValues = function stringifiedValues (values, separator) { let string = '' const sep = separator || ', ' const array = [].concat(values) if (!values || !array.length) return string array.forEach((value) => { if (string.length) string += sep string += JSON.stringify(value) }) return string } // format the default-value-string displayed in // the right-hand column. function defaultString (value, defaultDescription) { let string = `[${__('default:')} ` if (value === undefined && !defaultDescription) return null if (defaultDescription) { string += defaultDescription } else { switch (typeof value) { case 'string': string += `"${value}"` break case 'object': string += JSON.stringify(value) break default: string += value } } return `${string}]` } // guess the width of the console window, max-width 80. function windowWidth () { const maxWidth = 80 if (typeof process === 'object' && process.stdout && process.stdout.columns) { return Math.min(maxWidth, process.stdout.columns) } else { return maxWidth } } // logic for displaying application version. let version = null self.version = (ver) => { version = ver } self.showVersion = () => { const logger = yargs._getLoggerInstance() logger.log(version) } self.reset = function reset (localLookup) { // do not reset wrap here // do not reset fails here failMessage = null failureOutput = false usages = [] usageDisabled = false epilog = undefined examples = [] commands = [] descriptions = objFilter(descriptions, (k, v) => !localLookup[k]) return self } let frozen self.freeze = function freeze () { frozen = {} frozen.failMessage = failMessage frozen.failureOutput = failureOutput frozen.usages = usages frozen.usageDisabled = usageDisabled frozen.epilog = epilog frozen.examples = examples frozen.commands = commands frozen.descriptions = descriptions } self.unfreeze = function unfreeze () { failMessage = frozen.failMessage failureOutput = frozen.failureOutput usages = frozen.usages usageDisabled = frozen.usageDisabled epilog = frozen.epilog examples = frozen.examples commands = frozen.commands descriptions = frozen.descriptions frozen = undefined } return self } /***/ }), /***/ 78: /***/ (function(module) { "use strict"; const alias = ['stdin', 'stdout', 'stderr']; const hasAlias = opts => alias.some(x => Boolean(opts[x])); module.exports = opts => { if (!opts) { return null; } if (opts.stdio && hasAlias(opts)) { throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${alias.map(x => `\`${x}\``).join(', ')}`); } if (typeof opts.stdio === 'string') { return opts.stdio; } const stdio = opts.stdio || []; if (!Array.isArray(stdio)) { throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``); } const result = []; const len = Math.max(stdio.length, alias.length); for (let i = 0; i < len; i++) { let value = null; if (stdio[i] !== undefined) { value = stdio[i]; } else if (opts[alias[i]] !== undefined) { value = opts[alias[i]]; } result[i] = value; } return result; }; /***/ }), /***/ 79: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; /*jshint node:true */ var Buffer = __webpack_require__(293).Buffer; // browserify var SlowBuffer = __webpack_require__(293).SlowBuffer; module.exports = bufferEq; function bufferEq(a, b) { // shortcutting on type is necessary for correctness if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { return false; } // buffer sizes should be well-known information, so despite this // shortcutting, it doesn't leak any information about the *contents* of the // buffers. if (a.length !== b.length) { return false; } var c = 0; for (var i = 0; i < a.length; i++) { /*jshint bitwise:false */ c |= a[i] ^ b[i]; // XOR } return c === 0; } bufferEq.install = function() { Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) { return bufferEq(this, that); }; }; var origBufEqual = Buffer.prototype.equal; var origSlowBufEqual = SlowBuffer.prototype.equal; bufferEq.restore = function() { Buffer.prototype.equal = origBufEqual; SlowBuffer.prototype.equal = origSlowBufEqual; }; /***/ }), /***/ 86: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var request = __webpack_require__(753); var LRU = _interopDefault(__webpack_require__(702)); var jsonwebtoken = _interopDefault(__webpack_require__(439)); // https://github.com/isaacs/node-lru-cache#readme function getCache() { return new LRU({ // cache max. 15000 tokens, that will use less than 10mb memory max: 15000, // Cache for 59 minutes (1 minute less than GitHub expiry) maxAge: 1000 * 60 * 59 }); } function getSignedJsonWebToken({ id, privateKey }) { const now = Math.floor(Date.now() / 1000); const payload = { iat: now, exp: now + 60 * 10 - 30, iss: id }; const token = jsonwebtoken.sign(payload, privateKey, { algorithm: "RS256" }); return token; } function getInstallationAccessToken(state, { installationId, repositoryIds, permissions }) { const token = state.cache.get(installationId); if (token) { return Promise.resolve(token); } return state.request({ method: "POST", url: "/app/installations/:installation_id/access_tokens", installation_id: installationId, headers: { accept: "application/vnd.github.machine-man-preview+json", // TODO: cache the installation token if it's been less than 60 minutes authorization: `bearer ${getSignedJsonWebToken(state)}` }, repository_ids: repositoryIds, permissions }).then(response => { state.cache.set(installationId, response.data.token); return response.data.token; }); } const VERSION = "4.2.0"; class App { constructor({ id, privateKey, baseUrl, cache }) { const state = { id, privateKey, request: baseUrl ? request.request.defaults({ baseUrl }) : request.request, cache: cache || getCache() }; this.getSignedJsonWebToken = getSignedJsonWebToken.bind(null, state); this.getInstallationAccessToken = getInstallationAccessToken.bind(null, state); } } App.VERSION = VERSION; exports.App = App; //# sourceMappingURL=index.js.map /***/ }), /***/ 87: /***/ (function(module) { module.exports = require("os"); /***/ }), /***/ 90: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const ansiRegex = __webpack_require__(963); const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; module.exports = stripAnsi; module.exports.default = stripAnsi; /***/ }), /***/ 92: /***/ (function(module) { "use strict"; module.exports = function objFilter (original, filter) { const obj = {} filter = filter || ((k, v) => true) Object.keys(original || {}).forEach((key) => { if (filter(key, original[key])) { obj[key] = original[key] } }) return obj } /***/ }), /***/ 97: /***/ (function(module) { module.exports = stringify stringify.default = stringify stringify.stable = deterministicStringify stringify.stableStringify = deterministicStringify var arr = [] var replacerStack = [] // Regular stringify function stringify (obj, replacer, spacer) { decirc(obj, '', [], undefined) var res if (replacerStack.length === 0) { res = JSON.stringify(obj, replacer, spacer) } else { res = JSON.stringify(obj, replaceGetterValues(replacer), spacer) } while (arr.length !== 0) { var part = arr.pop() if (part.length === 4) { Object.defineProperty(part[0], part[1], part[3]) } else { part[0][part[1]] = part[2] } } return res } function decirc (val, k, stack, parent) { var i if (typeof val === 'object' && val !== null) { for (i = 0; i < stack.length; i++) { if (stack[i] === val) { var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k) if (propertyDescriptor.get !== undefined) { if (propertyDescriptor.configurable) { Object.defineProperty(parent, k, { value: '[Circular]' }) arr.push([parent, k, val, propertyDescriptor]) } else { replacerStack.push([val, k]) } } else { parent[k] = '[Circular]' arr.push([parent, k, val]) } return } } stack.push(val) // Optimize for Arrays. Big arrays could kill the performance otherwise! if (Array.isArray(val)) { for (i = 0; i < val.length; i++) { decirc(val[i], i, stack, val) } } else { var keys = Object.keys(val) for (i = 0; i < keys.length; i++) { var key = keys[i] decirc(val[key], key, stack, val) } } stack.pop() } } // Stable-stringify function compareFunction (a, b) { if (a < b) { return -1 } if (a > b) { return 1 } return 0 } function deterministicStringify (obj, replacer, spacer) { var tmp = deterministicDecirc(obj, '', [], undefined) || obj var res if (replacerStack.length === 0) { res = JSON.stringify(tmp, replacer, spacer) } else { res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer) } while (arr.length !== 0) { var part = arr.pop() if (part.length === 4) { Object.defineProperty(part[0], part[1], part[3]) } else { part[0][part[1]] = part[2] } } return res } function deterministicDecirc (val, k, stack, parent) { var i if (typeof val === 'object' && val !== null) { for (i = 0; i < stack.length; i++) { if (stack[i] === val) { var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k) if (propertyDescriptor.get !== undefined) { if (propertyDescriptor.configurable) { Object.defineProperty(parent, k, { value: '[Circular]' }) arr.push([parent, k, val, propertyDescriptor]) } else { replacerStack.push([val, k]) } } else { parent[k] = '[Circular]' arr.push([parent, k, val]) } return } } if (typeof val.toJSON === 'function') { return } stack.push(val) // Optimize for Arrays. Big arrays could kill the performance otherwise! if (Array.isArray(val)) { for (i = 0; i < val.length; i++) { deterministicDecirc(val[i], i, stack, val) } } else { // Create a temporary object in the required way var tmp = {} var keys = Object.keys(val).sort(compareFunction) for (i = 0; i < keys.length; i++) { var key = keys[i] deterministicDecirc(val[key], key, stack, val) tmp[key] = val[key] } if (parent !== undefined) { arr.push([parent, k, val]) parent[k] = tmp } else { return tmp } } stack.pop() } } // wraps replacer function to handle values we couldn't replace // and mark them as [Circular] function replaceGetterValues (replacer) { replacer = replacer !== undefined ? replacer : function (k, v) { return v } return function (key, val) { if (replacerStack.length > 0) { for (var i = 0; i < replacerStack.length; i++) { var part = replacerStack[i] if (part[1] === key && part[0] === val) { val = '[Circular]' replacerStack.splice(i, 1) break } } } return replacer.call(this, key, val) } } /***/ }), /***/ 108: /***/ (function(module, __unusedexports, __webpack_require__) { var bufferEqual = __webpack_require__(79); var Buffer = __webpack_require__(149).Buffer; var crypto = __webpack_require__(417); var formatEcdsa = __webpack_require__(815); var util = __webpack_require__(669); var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".' var MSG_INVALID_SECRET = 'secret must be a string or buffer'; var MSG_INVALID_VERIFIER_KEY = 'key must be a string or a buffer'; var MSG_INVALID_SIGNER_KEY = 'key must be a string, a buffer or an object'; var supportsKeyObjects = typeof crypto.createPublicKey === 'function'; if (supportsKeyObjects) { MSG_INVALID_VERIFIER_KEY += ' or a KeyObject'; MSG_INVALID_SECRET += 'or a KeyObject'; } function checkIsPublicKey(key) { if (Buffer.isBuffer(key)) { return; } if (typeof key === 'string') { return; } if (!supportsKeyObjects) { throw typeError(MSG_INVALID_VERIFIER_KEY); } if (typeof key !== 'object') { throw typeError(MSG_INVALID_VERIFIER_KEY); } if (typeof key.type !== 'string') { throw typeError(MSG_INVALID_VERIFIER_KEY); } if (typeof key.asymmetricKeyType !== 'string') { throw typeError(MSG_INVALID_VERIFIER_KEY); } if (typeof key.export !== 'function') { throw typeError(MSG_INVALID_VERIFIER_KEY); } }; function checkIsPrivateKey(key) { if (Buffer.isBuffer(key)) { return; } if (typeof key === 'string') { return; } if (typeof key === 'object') { return; } throw typeError(MSG_INVALID_SIGNER_KEY); }; function checkIsSecretKey(key) { if (Buffer.isBuffer(key)) { return; } if (typeof key === 'string') { return key; } if (!supportsKeyObjects) { throw typeError(MSG_INVALID_SECRET); } if (typeof key !== 'object') { throw typeError(MSG_INVALID_SECRET); } if (key.type !== 'secret') { throw typeError(MSG_INVALID_SECRET); } if (typeof key.export !== 'function') { throw typeError(MSG_INVALID_SECRET); } } function fromBase64(base64) { return base64 .replace(/=/g, '') .replace(/\+/g, '-') .replace(/\//g, '_'); } function toBase64(base64url) { base64url = base64url.toString(); var padding = 4 - base64url.length % 4; if (padding !== 4) { for (var i = 0; i < padding; ++i) { base64url += '='; } } return base64url .replace(/\-/g, '+') .replace(/_/g, '/'); } function typeError(template) { var args = [].slice.call(arguments, 1); var errMsg = util.format.bind(util, template).apply(null, args); return new TypeError(errMsg); } function bufferOrString(obj) { return Buffer.isBuffer(obj) || typeof obj === 'string'; } function normalizeInput(thing) { if (!bufferOrString(thing)) thing = JSON.stringify(thing); return thing; } function createHmacSigner(bits) { return function sign(thing, secret) { checkIsSecretKey(secret); thing = normalizeInput(thing); var hmac = crypto.createHmac('sha' + bits, secret); var sig = (hmac.update(thing), hmac.digest('base64')) return fromBase64(sig); } } function createHmacVerifier(bits) { return function verify(thing, signature, secret) { var computedSig = createHmacSigner(bits)(thing, secret); return bufferEqual(Buffer.from(signature), Buffer.from(computedSig)); } } function createKeySigner(bits) { return function sign(thing, privateKey) { checkIsPrivateKey(privateKey); thing = normalizeInput(thing); // Even though we are specifying "RSA" here, this works with ECDSA // keys as well. var signer = crypto.createSign('RSA-SHA' + bits); var sig = (signer.update(thing), signer.sign(privateKey, 'base64')); return fromBase64(sig); } } function createKeyVerifier(bits) { return function verify(thing, signature, publicKey) { checkIsPublicKey(publicKey); thing = normalizeInput(thing); signature = toBase64(signature); var verifier = crypto.createVerify('RSA-SHA' + bits); verifier.update(thing); return verifier.verify(publicKey, signature, 'base64'); } } function createPSSKeySigner(bits) { return function sign(thing, privateKey) { checkIsPrivateKey(privateKey); thing = normalizeInput(thing); var signer = crypto.createSign('RSA-SHA' + bits); var sig = (signer.update(thing), signer.sign({ key: privateKey, padding: crypto.constants.RSA_PKCS1_PSS_PADDING, saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST }, 'base64')); return fromBase64(sig); } } function createPSSKeyVerifier(bits) { return function verify(thing, signature, publicKey) { checkIsPublicKey(publicKey); thing = normalizeInput(thing); signature = toBase64(signature); var verifier = crypto.createVerify('RSA-SHA' + bits); verifier.update(thing); return verifier.verify({ key: publicKey, padding: crypto.constants.RSA_PKCS1_PSS_PADDING, saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST }, signature, 'base64'); } } function createECDSASigner(bits) { var inner = createKeySigner(bits); return function sign() { var signature = inner.apply(null, arguments); signature = formatEcdsa.derToJose(signature, 'ES' + bits); return signature; }; } function createECDSAVerifer(bits) { var inner = createKeyVerifier(bits); return function verify(thing, signature, publicKey) { signature = formatEcdsa.joseToDer(signature, 'ES' + bits).toString('base64'); var result = inner(thing, signature, publicKey); return result; }; } function createNoneSigner() { return function sign() { return ''; } } function createNoneVerifier() { return function verify(thing, signature) { return signature === ''; } } module.exports = function jwa(algorithm) { var signerFactories = { hs: createHmacSigner, rs: createKeySigner, ps: createPSSKeySigner, es: createECDSASigner, none: createNoneSigner, } var verifierFactories = { hs: createHmacVerifier, rs: createKeyVerifier, ps: createPSSKeyVerifier, es: createECDSAVerifer, none: createNoneVerifier, } var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i); if (!match) throw typeError(MSG_INVALID_ALGORITHM, algorithm); var algo = (match[1] || match[3]).toLowerCase(); var bits = match[2]; return { sign: signerFactories[algo](bits), verify: verifierFactories[algo](bits), } }; /***/ }), /***/ 111: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const os = __webpack_require__(87); const hasFlag = __webpack_require__(364); const env = process.env; let forceColor; if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { forceColor = false; } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { forceColor = true; } if ('FORCE_COLOR' in env) { forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; } function translateLevel(level) { if (level === 0) { return false; } return { level, hasBasic: true, has256: level >= 2, has16m: level >= 3 }; } function supportsColor(stream) { if (forceColor === false) { return 0; } if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) { return 3; } if (hasFlag('color=256')) { return 2; } if (stream && !stream.isTTY && forceColor !== true) { return 0; } const min = forceColor ? 1 : 0; if (process.platform === 'win32') { // Node.js 7.5.0 is the first version of Node.js to include a patch to // libuv that enables 256 color output on Windows. Anything earlier and it // won't work. However, here we target Node.js 8 at minimum as it is an LTS // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows // release that supports 256 colors. Windows 10 build 14931 is the first release // that supports 16m/TrueColor. const osRelease = os.release().split('.'); if ( Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; } if ('CI' in env) { if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { return 1; } return min; } if ('TEAMCITY_VERSION' in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } if (env.COLORTERM === 'truecolor') { return 3; } if ('TERM_PROGRAM' in env) { const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch (env.TERM_PROGRAM) { case 'iTerm.app': return version >= 3 ? 3 : 2; case 'Apple_Terminal': return 2; // No default } } if (/-256(color)?$/i.test(env.TERM)) { return 2; } if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } if ('COLORTERM' in env) { return 1; } if (env.TERM === 'dumb') { return min; } return min; } function getSupportLevel(stream) { const level = supportsColor(stream); return translateLevel(level); } module.exports = { supportsColor: getSupportLevel, stdout: getSupportLevel(process.stdout), stderr: getSupportLevel(process.stderr) }; /***/ }), /***/ 118: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const os = __webpack_require__(87); const nameMap = new Map([ [19, 'Catalina'], [18, 'Mojave'], [17, 'High Sierra'], [16, 'Sierra'], [15, 'El Capitan'], [14, 'Yosemite'], [13, 'Mavericks'], [12, 'Mountain Lion'], [11, 'Lion'], [10, 'Snow Leopard'], [9, 'Leopard'], [8, 'Tiger'], [7, 'Panther'], [6, 'Jaguar'], [5, 'Puma'] ]); const macosRelease = release => { release = Number((release || os.release()).split('.')[0]); return { name: nameMap.get(release), version: '10.' + (release - 4) }; }; module.exports = macosRelease; // TODO: remove this in the next major version module.exports.default = macosRelease; /***/ }), /***/ 123: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; const chalk = __webpack_require__(968) const jmespath = __webpack_require__(802) const colors = __webpack_require__(350) const { ERROR_LIKE_KEYS, MESSAGE_KEY, TIMESTAMP_KEY } = __webpack_require__(495) const { isObject, prettifyErrorLog, prettifyLevel, prettifyMessage, prettifyMetadata, prettifyObject, prettifyTime } = __webpack_require__(586) const bourne = __webpack_requ