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__(479); /******/ }; /******/ /******/ // run startup /******/ return startup(); /******/ }) /************************************************************************/ /******/ ({ /***/ 6: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // // Command Format: // ##vso[artifact.command key=value;key=value]user message // // Examples: // ##vso[task.progress value=58] // ##vso[task.issue type=warning;]This is the user warning message // var CMD_PREFIX = '##vso['; var TaskCommand = /** @class */ (function () { function TaskCommand(command, properties, message) { if (!command) { command = 'missing.command'; } this.command = command; this.properties = properties; this.message = message; } TaskCommand.prototype.toString = function () { var cmdStr = CMD_PREFIX + this.command; if (this.properties && Object.keys(this.properties).length > 0) { cmdStr += ' '; for (var key in this.properties) { if (this.properties.hasOwnProperty(key)) { var val = this.properties[key]; if (val) { // safely append the val - avoid blowing up when attempting to // call .replace() if message is not a string for some reason cmdStr += key + '=' + escape('' + (val || '')) + ';'; } } } } cmdStr += ']'; // safely append the message - avoid blowing up when attempting to // call .replace() if message is not a string for some reason var message = '' + (this.message || ''); cmdStr += escapedata(message); return cmdStr; }; return TaskCommand; }()); exports.TaskCommand = TaskCommand; function commandFromString(commandLine) { var preLen = CMD_PREFIX.length; var lbPos = commandLine.indexOf('['); var rbPos = commandLine.indexOf(']'); if (lbPos == -1 || rbPos == -1 || rbPos - lbPos < 3) { throw new Error('Invalid command brackets'); } var cmdInfo = commandLine.substring(lbPos + 1, rbPos); var spaceIdx = cmdInfo.indexOf(' '); var command = cmdInfo; var properties = {}; if (spaceIdx > 0) { command = cmdInfo.trim().substring(0, spaceIdx); var propSection = cmdInfo.trim().substring(spaceIdx + 1); var propLines = propSection.split(';'); propLines.forEach(function (propLine) { propLine = propLine.trim(); if (propLine.length > 0) { var eqIndex = propLine.indexOf('='); if (eqIndex == -1) { throw new Error('Invalid property: ' + propLine); } var key = propLine.substring(0, eqIndex); var val = propLine.substring(eqIndex + 1); properties[key] = unescape(val); } }); } var msg = unescapedata(commandLine.substring(rbPos + 1)); var cmd = new TaskCommand(command, properties, msg); return cmd; } exports.commandFromString = commandFromString; function escapedata(s) { return s.replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A'); } function unescapedata(s) { return s.replace(/%0D/g, '\r') .replace(/%0A/g, '\n') .replace(/%25/g, '%'); } function escape(s) { return s.replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A') .replace(/]/g, '%5D') .replace(/;/g, '%3B'); } function unescape(s) { return s.replace(/%0D/g, '\r') .replace(/%0A/g, '\n') .replace(/%5D/g, ']') .replace(/%3B/g, ';') .replace(/%25/g, '%'); } /***/ }), /***/ 7: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var metadata_1 = __webpack_require__(355); var decorator_utils_1 = __webpack_require__(309); function tagged(metadataKey, metadataValue) { return function (target, targetKey, index) { var metadata = new metadata_1.Metadata(metadataKey, metadataValue); if (typeof index === "number") { decorator_utils_1.tagParameter(target, targetKey, index, metadata); } else { decorator_utils_1.tagProperty(target, targetKey, metadata); } }; } exports.tagged = tagged; /***/ }), /***/ 8: /***/ (function(module, __unusedexports, __webpack_require__) { var fs = __webpack_require__(747); var common = __webpack_require__(602); //@ //@ ### cd('dir') //@ Changes to directory `dir` for the duration of the script function _cd(options, dir) { if (!dir) common.error('directory not specified'); if (!fs.existsSync(dir)) common.error('no such file or directory: ' + dir); if (!fs.statSync(dir).isDirectory()) common.error('not a directory: ' + dir); process.chdir(dir); } module.exports = _cd; /***/ }), /***/ 12: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var fs = __webpack_require__(747); var path = __webpack_require__(622); var crypto = __webpack_require__(417); var uuidV4 = __webpack_require__(826); var algorithm = "aes-256-ctr"; var encryptEncoding = 'hex'; var unencryptedEncoding = 'utf8'; // // Store sensitive data in proc. // Main goal: Protects tasks which would dump envvars from leaking secrets inadvertently // the task lib clears after storing. // Also protects against a dump of a process getting the secrets // The secret is generated and stored externally for the lifetime of the task. // var Vault = /** @class */ (function () { function Vault(keyPath) { this._keyFile = path.join(keyPath, '.taskkey'); this._store = {}; this.genKey(); } Vault.prototype.initialize = function () { }; Vault.prototype.storeSecret = function (name, data) { if (!name || name.length == 0) { return false; } name = name.toLowerCase(); if (!data || data.length == 0) { if (this._store.hasOwnProperty(name)) { delete this._store[name]; } return false; } var key = this.getKey(); var iv = crypto.randomBytes(16); var cipher = crypto.createCipheriv(algorithm, key, iv); var crypted = cipher.update(data, unencryptedEncoding, encryptEncoding); var cryptedFinal = cipher.final(encryptEncoding); this._store[name] = iv.toString(encryptEncoding) + crypted + cryptedFinal; return true; }; Vault.prototype.retrieveSecret = function (name) { var secret; name = (name || '').toLowerCase(); if (this._store.hasOwnProperty(name)) { var key = this.getKey(); var data = this._store[name]; var ivDataBuffer = Buffer.from(data, encryptEncoding); var iv = ivDataBuffer.slice(0, 16); var encryptedText = ivDataBuffer.slice(16); var decipher = crypto.createDecipheriv(algorithm, key, iv); var dec = decipher.update(encryptedText, encryptEncoding, unencryptedEncoding); var decFinal = decipher.final(unencryptedEncoding); secret = dec + decFinal; } return secret; }; Vault.prototype.getKey = function () { var key = fs.readFileSync(this._keyFile).toString('utf8'); // Key needs to be hashed to correct length to match algorithm (aes-256-ctr) return crypto.createHash('sha256').update(key).digest(); }; Vault.prototype.genKey = function () { fs.writeFileSync(this._keyFile, uuidV4(), { encoding: 'utf8' }); }; return Vault; }()); exports.Vault = Vault; /***/ }), /***/ 15: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ContainerSnapshot = (function () { function ContainerSnapshot() { } ContainerSnapshot.of = function (bindings, middleware) { var snapshot = new ContainerSnapshot(); snapshot.bindings = bindings; snapshot.middleware = middleware; return snapshot; }; return ContainerSnapshot; }()); exports.ContainerSnapshot = ContainerSnapshot; /***/ }), /***/ 16: /***/ (function(module) { module.exports = require("tls"); /***/ }), /***/ 22: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var QueryableString = (function () { function QueryableString(str) { this.str = str; } QueryableString.prototype.startsWith = function (searchString) { return this.str.indexOf(searchString) === 0; }; QueryableString.prototype.endsWith = function (searchString) { var reverseString = ""; var reverseSearchString = searchString.split("").reverse().join(""); reverseString = this.str.split("").reverse().join(""); return this.startsWith.call({ str: reverseString }, reverseSearchString); }; QueryableString.prototype.contains = function (searchString) { return (this.str.indexOf(searchString) !== -1); }; QueryableString.prototype.equals = function (compareString) { return this.str === compareString; }; QueryableString.prototype.value = function () { return this.str; }; return QueryableString; }()); exports.QueryableString = QueryableString; /***/ }), /***/ 32: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var id_1 = __webpack_require__(862); var Context = (function () { function Context(container) { this.id = id_1.id(); this.container = container; } Context.prototype.addPlan = function (plan) { this.plan = plan; }; Context.prototype.setCurrentRequest = function (currentRequest) { this.currentRequest = currentRequest; }; return Context; }()); exports.Context = Context; /***/ }), /***/ 87: /***/ (function(module) { module.exports = require("os"); /***/ }), /***/ 93: /***/ (function(module, __unusedexports, __webpack_require__) { module.exports = minimatch minimatch.Minimatch = Minimatch var path = { sep: '/' } try { path = __webpack_require__(622) } catch (er) {} var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} var expand = __webpack_require__(306) var plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, '?': { open: '(?:', close: ')?' }, '+': { open: '(?:', close: ')+' }, '*': { open: '(?:', close: ')*' }, '@': { open: '(?:', close: ')' } } // any single thing other than / // don't need to escape / when using new RegExp() var qmark = '[^/]' // * => any number of characters var star = qmark + '*?' // ** when dots are allowed. Anything goes, except .. and . // not (^ or / followed by one or two dots followed by $ or /), // followed by anything, any number of times. var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' // not a ^ or / followed by a dot, // followed by anything, any number of times. var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' // characters that need to be escaped in RegExp. var reSpecials = charSet('().*{}+?[]^$\\!') // "abc" -> { a:true, b:true, c:true } function charSet (s) { return s.split('').reduce(function (set, c) { set[c] = true return set }, {}) } // normalizes slashes. var slashSplit = /\/+/ minimatch.filter = filter function filter (pattern, options) { options = options || {} return function (p, i, list) { return minimatch(p, pattern, options) } } function ext (a, b) { a = a || {} b = b || {} var t = {} Object.keys(b).forEach(function (k) { t[k] = b[k] }) Object.keys(a).forEach(function (k) { t[k] = a[k] }) return t } minimatch.defaults = function (def) { if (!def || !Object.keys(def).length) return minimatch var orig = minimatch var m = function minimatch (p, pattern, options) { return orig.minimatch(p, pattern, ext(def, options)) } m.Minimatch = function Minimatch (pattern, options) { return new orig.Minimatch(pattern, ext(def, options)) } return m } Minimatch.defaults = function (def) { if (!def || !Object.keys(def).length) return Minimatch return minimatch.defaults(def).Minimatch } function minimatch (p, pattern, options) { if (typeof pattern !== 'string') { throw new TypeError('glob pattern string required') } if (!options) options = {} // shortcut: comments match nothing. if (!options.nocomment && pattern.charAt(0) === '#') { return false } // "" only matches "" if (pattern.trim() === '') return p === '' return new Minimatch(pattern, options).match(p) } function Minimatch (pattern, options) { if (!(this instanceof Minimatch)) { return new Minimatch(pattern, options) } if (typeof pattern !== 'string') { throw new TypeError('glob pattern string required') } if (!options) options = {} pattern = pattern.trim() // windows support: need to use /, not \ if (path.sep !== '/') { pattern = pattern.split(path.sep).join('/') } this.options = options this.set = [] this.pattern = pattern this.regexp = null this.negate = false this.comment = false this.empty = false // make the set of regexps etc. this.make() } Minimatch.prototype.debug = function () {} Minimatch.prototype.make = make function make () { // don't do it more than once. if (this._made) return var pattern = this.pattern var options = this.options // empty patterns and comments match nothing. if (!options.nocomment && pattern.charAt(0) === '#') { this.comment = true return } if (!pattern) { this.empty = true return } // step 1: figure out negation, etc. this.parseNegate() // step 2: expand braces var set = this.globSet = this.braceExpand() if (options.debug) this.debug = console.error this.debug(this.pattern, set) // step 3: now we have a set, so turn each one into a series of path-portion // matching patterns. // These will be regexps, except in the case of "**", which is // set to the GLOBSTAR object for globstar behavior, // and will not contain any / characters set = this.globParts = set.map(function (s) { return s.split(slashSplit) }) this.debug(this.pattern, set) // glob --> regexps set = set.map(function (s, si, set) { return s.map(this.parse, this) }, this) this.debug(this.pattern, set) // filter out everything that didn't compile properly. set = set.filter(function (s) { return s.indexOf(false) === -1 }) this.debug(this.pattern, set) this.set = set } Minimatch.prototype.parseNegate = parseNegate function parseNegate () { var pattern = this.pattern var negate = false var options = this.options var negateOffset = 0 if (options.nonegate) return for (var i = 0, l = pattern.length ; i < l && pattern.charAt(i) === '!' ; i++) { negate = !negate negateOffset++ } if (negateOffset) this.pattern = pattern.substr(negateOffset) this.negate = negate } // Brace expansion: // a{b,c}d -> abd acd // a{b,}c -> abc ac // a{0..3}d -> a0d a1d a2d a3d // a{b,c{d,e}f}g -> abg acdfg acefg // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg // // Invalid sets are not expanded. // a{2..}b -> a{2..}b // a{b}c -> a{b}c minimatch.braceExpand = function (pattern, options) { return braceExpand(pattern, options) } Minimatch.prototype.braceExpand = braceExpand function braceExpand (pattern, options) { if (!options) { if (this instanceof Minimatch) { options = this.options } else { options = {} } } pattern = typeof pattern === 'undefined' ? this.pattern : pattern if (typeof pattern === 'undefined') { throw new TypeError('undefined pattern') } if (options.nobrace || !pattern.match(/\{.*\}/)) { // shortcut. no need to expand. return [pattern] } return expand(pattern) } // parse a component of the expanded set. // At this point, no pattern may contain "/" in it // so we're going to return a 2d array, where each entry is the full // pattern, split on '/', and then turned into a regular expression. // A regexp is made at the end which joins each array with an // escaped /, and another full one which joins each regexp with |. // // Following the lead of Bash 4.1, note that "**" only has special meaning // when it is the *only* thing in a path portion. Otherwise, any series // of * is equivalent to a single *. Globstar behavior is enabled by // default, and can be disabled by setting options.noglobstar. Minimatch.prototype.parse = parse var SUBPARSE = {} function parse (pattern, isSub) { if (pattern.length > 1024 * 64) { throw new TypeError('pattern is too long') } var options = this.options // shortcuts if (!options.noglobstar && pattern === '**') return GLOBSTAR if (pattern === '') return '' var re = '' var hasMagic = !!options.nocase var escaping = false // ? => one single character var patternListStack = [] var negativeLists = [] var stateChar var inClass = false var reClassStart = -1 var classStart = -1 // . and .. never match anything that doesn't start with ., // even when options.dot is set. var patternStart = pattern.charAt(0) === '.' ? '' // anything // not (start or / followed by . or .. followed by / or end) : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' : '(?!\\.)' var self = this function clearStateChar () { if (stateChar) { // we had some state-tracking character // that wasn't consumed by this pass. switch (stateChar) { case '*': re += star hasMagic = true break case '?': re += qmark hasMagic = true break default: re += '\\' + stateChar break } self.debug('clearStateChar %j %j', stateChar, re) stateChar = false } } for (var i = 0, len = pattern.length, c ; (i < len) && (c = pattern.charAt(i)) ; i++) { this.debug('%s\t%s %s %j', pattern, i, re, c) // skip over any that are escaped. if (escaping && reSpecials[c]) { re += '\\' + c escaping = false continue } switch (c) { case '/': // completely not allowed, even escaped. // Should already be path-split by now. return false case '\\': clearStateChar() escaping = true continue // the various stateChar values // for the "extglob" stuff. case '?': case '*': case '+': case '@': case '!': this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) // all of those are literals inside a class, except that // the glob [!a] means [^a] in regexp if (inClass) { this.debug(' in class') if (c === '!' && i === classStart + 1) c = '^' re += c continue } // if we already have a stateChar, then it means // that there was something like ** or +? in there. // Handle the stateChar, then proceed with this one. self.debug('call clearStateChar %j', stateChar) clearStateChar() stateChar = c // if extglob is disabled, then +(asdf|foo) isn't a thing. // just clear the statechar *now*, rather than even diving into // the patternList stuff. if (options.noext) clearStateChar() continue case '(': if (inClass) { re += '(' continue } if (!stateChar) { re += '\\(' continue } patternListStack.push({ type: stateChar, start: i - 1, reStart: re.length, open: plTypes[stateChar].open, close: plTypes[stateChar].close }) // negation is (?:(?!js)[^/]*) re += stateChar === '!' ? '(?:(?!(?:' : '(?:' this.debug('plType %j %j', stateChar, re) stateChar = false continue case ')': if (inClass || !patternListStack.length) { re += '\\)' continue } clearStateChar() hasMagic = true var pl = patternListStack.pop() // negation is (?:(?!js)[^/]*) // The others are (?:) re += pl.close if (pl.type === '!') { negativeLists.push(pl) } pl.reEnd = re.length continue case '|': if (inClass || !patternListStack.length || escaping) { re += '\\|' escaping = false continue } clearStateChar() re += '|' continue // these are mostly the same in regexp and glob case '[': // swallow any state-tracking char before the [ clearStateChar() if (inClass) { re += '\\' + c continue } inClass = true classStart = i reClassStart = re.length re += c continue case ']': // a right bracket shall lose its special // meaning and represent itself in // a bracket expression if it occurs // first in the list. -- POSIX.2 2.8.3.2 if (i === classStart + 1 || !inClass) { re += '\\' + c escaping = false continue } // handle the case where we left a class open. // "[z-a]" is valid, equivalent to "\[z-a\]" if (inClass) { // split where the last [ was, make sure we don't have // an invalid re. if so, re-walk the contents of the // would-be class to re-translate any characters that // were passed through as-is // TODO: It would probably be faster to determine this // without a try/catch and a new RegExp, but it's tricky // to do safely. For now, this is safe and works. var cs = pattern.substring(classStart + 1, i) try { RegExp('[' + cs + ']') } catch (er) { // not a valid class! var sp = this.parse(cs, SUBPARSE) re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' hasMagic = hasMagic || sp[1] inClass = false continue } } // finish up the class. hasMagic = true inClass = false re += c continue default: // swallow any state char that wasn't consumed clearStateChar() if (escaping) { // no need escaping = false } else if (reSpecials[c] && !(c === '^' && inClass)) { re += '\\' } re += c } // switch } // for // handle the case where we left a class open. // "[abc" is valid, equivalent to "\[abc" if (inClass) { // split where the last [ was, and escape it // this is a huge pita. We now have to re-walk // the contents of the would-be class to re-translate // any characters that were passed through as-is cs = pattern.substr(classStart + 1) sp = this.parse(cs, SUBPARSE) re = re.substr(0, reClassStart) + '\\[' + sp[0] hasMagic = hasMagic || sp[1] } // handle the case where we had a +( thing at the *end* // of the pattern. // each pattern list stack adds 3 chars, and we need to go through // and escape any | chars that were passed through as-is for the regexp. // Go through and escape them, taking care not to double-escape any // | chars that were already escaped. for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { var tail = re.slice(pl.reStart + pl.open.length) this.debug('setting tail', re, pl) // maybe some even number of \, then maybe 1 \, followed by a | tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { if (!$2) { // the | isn't already escaped, so escape it. $2 = '\\' } // need to escape all those slashes *again*, without escaping the // one that we need for escaping the | character. As it works out, // escaping an even number of slashes can be done by simply repeating // it exactly after itself. That's why this trick works. // // I am sorry that you have to see this. return $1 + $1 + $2 + '|' }) this.debug('tail=%j\n %s', tail, tail, pl, re) var t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type hasMagic = true re = re.slice(0, pl.reStart) + t + '\\(' + tail } // handle trailing things that only matter at the very end. clearStateChar() if (escaping) { // trailing \\ re += '\\\\' } // only need to apply the nodot start if the re starts with // something that could conceivably capture a dot var addPatternStart = false switch (re.charAt(0)) { case '.': case '[': case '(': addPatternStart = true } // Hack to work around lack of negative lookbehind in JS // A pattern like: *.!(x).!(y|z) needs to ensure that a name // like 'a.xyz.yz' doesn't match. So, the first negative // lookahead, has to look ALL the way ahead, to the end of // the pattern. for (var n = negativeLists.length - 1; n > -1; n--) { var nl = negativeLists[n] var nlBefore = re.slice(0, nl.reStart) var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) var nlAfter = re.slice(nl.reEnd) nlLast += nlAfter // Handle nested stuff like *(*.js|!(*.json)), where open parens // mean that we should *not* include the ) in the bit that is considered // "after" the negated section. var openParensBefore = nlBefore.split('(').length - 1 var cleanAfter = nlAfter for (i = 0; i < openParensBefore; i++) { cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') } nlAfter = cleanAfter var dollar = '' if (nlAfter === '' && isSub !== SUBPARSE) { dollar = '$' } var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast re = newRe } // if the re is not "" at this point, then we need to make sure // it doesn't match against an empty path part. // Otherwise a/* will match a/, which it should not. if (re !== '' && hasMagic) { re = '(?=.)' + re } if (addPatternStart) { re = patternStart + re } // parsing just a piece of a larger pattern. if (isSub === SUBPARSE) { return [re, hasMagic] } // skip the regexp for non-magical patterns // unescape anything in it, though, so that it'll be // an exact match against a file etc. if (!hasMagic) { return globUnescape(pattern) } var flags = options.nocase ? 'i' : '' try { var regExp = new RegExp('^' + re + '$', flags) } catch (er) { // If it was an invalid regular expression, then it can't match // anything. This trick looks for a character after the end of // the string, which is of course impossible, except in multi-line // mode, but it's not a /m regex. return new RegExp('$.') } regExp._glob = pattern regExp._src = re return regExp } minimatch.makeRe = function (pattern, options) { return new Minimatch(pattern, options || {}).makeRe() } Minimatch.prototype.makeRe = makeRe function makeRe () { if (this.regexp || this.regexp === false) return this.regexp // at this point, this.set is a 2d array of partial // pattern strings, or "**". // // It's better to use .match(). This function shouldn't // be used, really, but it's pretty convenient sometimes, // when you just want to work with a regex. var set = this.set if (!set.length) { this.regexp = false return this.regexp } var options = this.options var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot var flags = options.nocase ? 'i' : '' var re = set.map(function (pattern) { return pattern.map(function (p) { return (p === GLOBSTAR) ? twoStar : (typeof p === 'string') ? regExpEscape(p) : p._src }).join('\\\/') }).join('|') // must match entire pattern // ending in a * or ** will make it less strict. re = '^(?:' + re + ')$' // can match anything, as long as it's not this. if (this.negate) re = '^(?!' + re + ').*$' try { this.regexp = new RegExp(re, flags) } catch (ex) { this.regexp = false } return this.regexp } minimatch.match = function (list, pattern, options) { options = options || {} var mm = new Minimatch(pattern, options) list = list.filter(function (f) { return mm.match(f) }) if (mm.options.nonull && !list.length) { list.push(pattern) } return list } Minimatch.prototype.match = match function match (f, partial) { this.debug('match', f, this.pattern) // short-circuit in the case of busted things. // comments, etc. if (this.comment) return false if (this.empty) return f === '' if (f === '/' && partial) return true var options = this.options // windows: need to use /, not \ if (path.sep !== '/') { f = f.split(path.sep).join('/') } // treat the test path as a set of pathparts. f = f.split(slashSplit) this.debug(this.pattern, 'split', f) // just ONE of the pattern sets in this.set needs to match // in order for it to be valid. If negating, then just one // match means that we have failed. // Either way, return on the first hit. var set = this.set this.debug(this.pattern, 'set', set) // Find the basename of the path by looking for the last non-empty segment var filename var i for (i = f.length - 1; i >= 0; i--) { filename = f[i] if (filename) break } for (i = 0; i < set.length; i++) { var pattern = set[i] var file = f if (options.matchBase && pattern.length === 1) { file = [filename] } var hit = this.matchOne(file, pattern, partial) if (hit) { if (options.flipNegate) return true return !this.negate } } // didn't get any hits. this is success if it's a negative // pattern, failure otherwise. if (options.flipNegate) return false return this.negate } // set partial to true to test if, for example, // "/a/b" matches the start of "/*/b/*/d" // Partial means, if you run out of file before you run // out of pattern, then that's fine, as long as all // the parts match. Minimatch.prototype.matchOne = function (file, pattern, partial) { var options = this.options this.debug('matchOne', { 'this': this, file: file, pattern: pattern }) this.debug('matchOne', file.length, pattern.length) for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length ; (fi < fl) && (pi < pl) ; fi++, pi++) { this.debug('matchOne loop') var p = pattern[pi] var f = file[fi] this.debug(pattern, p, f) // should be impossible. // some invalid regexp stuff in the set. if (p === false) return false if (p === GLOBSTAR) { this.debug('GLOBSTAR', [pattern, p, f]) // "**" // a/**/b/**/c would match the following: // a/b/x/y/z/c // a/x/y/z/b/c // a/b/x/b/x/c // a/b/c // To do this, take the rest of the pattern after // the **, and see if it would match the file remainder. // If so, return success. // If not, the ** "swallows" a segment, and try again. // This is recursively awful. // // a/**/b/**/c matching a/b/x/y/z/c // - a matches a // - doublestar // - matchOne(b/x/y/z/c, b/**/c) // - b matches b // - doublestar // - matchOne(x/y/z/c, c) -> no // - matchOne(y/z/c, c) -> no // - matchOne(z/c, c) -> no // - matchOne(c, c) yes, hit var fr = fi var pr = pi + 1 if (pr === pl) { this.debug('** at the end') // a ** at the end will just swallow the rest. // We have found a match. // however, it will not swallow /.x, unless // options.dot is set. // . and .. are *never* matched by **, for explosively // exponential reasons. for (; fi < fl; fi++) { if (file[fi] === '.' || file[fi] === '..' || (!options.dot && file[fi].charAt(0) === '.')) return false } return true } // ok, let's see if we can swallow whatever we can. while (fr < fl) { var swallowee = file[fr] this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) // XXX remove this slice. Just pass the start index. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { this.debug('globstar found match!', fr, fl, swallowee) // found a match. return true } else { // can't swallow "." or ".." ever. // can only swallow ".foo" when explicitly asked. if (swallowee === '.' || swallowee === '..' || (!options.dot && swallowee.charAt(0) === '.')) { this.debug('dot detected!', file, fr, pattern, pr) break } // ** swallows a segment, and continue. this.debug('globstar swallow a segment, and continue') fr++ } } // no match was found. // However, in partial mode, we can't say this is necessarily over. // If there's more *pattern* left, then if (partial) { // ran out of file this.debug('\n>>> no match, partial?', file, fr, pattern, pr) if (fr === fl) return true } return false } // something other than ** // non-magic patterns just have to match exactly // patterns with magic have been turned into regexps. var hit if (typeof p === 'string') { if (options.nocase) { hit = f.toLowerCase() === p.toLowerCase() } else { hit = f === p } this.debug('string match', p, f, hit) } else { hit = f.match(p) this.debug('pattern match', p, f, hit) } if (!hit) return false } // Note: ending in / means that we'll get a final "" // at the end of the pattern. This can only match a // corresponding "" at the end of the file. // If the file ends in /, then it can only match a // a pattern that ends in /, unless the pattern just // doesn't have any more for it. But, a/b/ should *not* // match "a/b/*", even though "" matches against the // [^/]*? pattern, except in partial mode, where it might // simply not be reached yet. // However, a/b/ should still satisfy a/* // now either we fell off the end of the pattern, or we're done. if (fi === fl && pi === pl) { // ran out of pattern and filename at the same time. // an exact hit! return true } else if (fi === fl) { // ran out of file, but still had pattern left. // this is ok if we're doing the match as part of // a glob fs traversal. return partial } else if (pi === pl) { // ran out of pattern, still have file left. // this is only acceptable if we're on the very last // empty segment of a file with a trailing slash. // a/* should match a/b/ var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') return emptyFileEnd } // should be unreachable. throw new Error('wtf?') } // replace stuff like \* with * function globUnescape (s) { return s.replace(/\\(.)/g, '$1') } function regExpEscape (s) { return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') } /***/ }), /***/ 96: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.multiBindToService = function (container) { return function (service) { return function () { var types = []; for (var _i = 0; _i < arguments.length; _i++) { types[_i] = arguments[_i]; } return types.forEach(function (t) { return container.bind(t).toService(service); }); }; }; }; /***/ }), /***/ 107: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var binding_on_syntax_1 = __webpack_require__(956); var binding_when_syntax_1 = __webpack_require__(954); var BindingWhenOnSyntax = (function () { function BindingWhenOnSyntax(binding) { this._binding = binding; this._bindingWhenSyntax = new binding_when_syntax_1.BindingWhenSyntax(this._binding); this._bindingOnSyntax = new binding_on_syntax_1.BindingOnSyntax(this._binding); } BindingWhenOnSyntax.prototype.when = function (constraint) { return this._bindingWhenSyntax.when(constraint); }; BindingWhenOnSyntax.prototype.whenTargetNamed = function (name) { return this._bindingWhenSyntax.whenTargetNamed(name); }; BindingWhenOnSyntax.prototype.whenTargetIsDefault = function () { return this._bindingWhenSyntax.whenTargetIsDefault(); }; BindingWhenOnSyntax.prototype.whenTargetTagged = function (tag, value) { return this._bindingWhenSyntax.whenTargetTagged(tag, value); }; BindingWhenOnSyntax.prototype.whenInjectedInto = function (parent) { return this._bindingWhenSyntax.whenInjectedInto(parent); }; BindingWhenOnSyntax.prototype.whenParentNamed = function (name) { return this._bindingWhenSyntax.whenParentNamed(name); }; BindingWhenOnSyntax.prototype.whenParentTagged = function (tag, value) { return this._bindingWhenSyntax.whenParentTagged(tag, value); }; BindingWhenOnSyntax.prototype.whenAnyAncestorIs = function (ancestor) { return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor); }; BindingWhenOnSyntax.prototype.whenNoAncestorIs = function (ancestor) { return this._bindingWhenSyntax.whenNoAncestorIs(ancestor); }; BindingWhenOnSyntax.prototype.whenAnyAncestorNamed = function (name) { return this._bindingWhenSyntax.whenAnyAncestorNamed(name); }; BindingWhenOnSyntax.prototype.whenAnyAncestorTagged = function (tag, value) { return this._bindingWhenSyntax.whenAnyAncestorTagged(tag, value); }; BindingWhenOnSyntax.prototype.whenNoAncestorNamed = function (name) { return this._bindingWhenSyntax.whenNoAncestorNamed(name); }; BindingWhenOnSyntax.prototype.whenNoAncestorTagged = function (tag, value) { return this._bindingWhenSyntax.whenNoAncestorTagged(tag, value); }; BindingWhenOnSyntax.prototype.whenAnyAncestorMatches = function (constraint) { return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint); }; BindingWhenOnSyntax.prototype.whenNoAncestorMatches = function (constraint) { return this._bindingWhenSyntax.whenNoAncestorMatches(constraint); }; BindingWhenOnSyntax.prototype.onActivation = function (handler) { return this._bindingOnSyntax.onActivation(handler); }; return BindingWhenOnSyntax; }()); exports.BindingWhenOnSyntax = BindingWhenOnSyntax; /***/ }), /***/ 124: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var error_msgs_1 = __webpack_require__(800); var literal_types_1 = __webpack_require__(274); var METADATA_KEY = __webpack_require__(946); function _injectProperties(instance, childRequests, resolveRequest) { var propertyInjectionsRequests = childRequests.filter(function (childRequest) { return (childRequest.target !== null && childRequest.target.type === literal_types_1.TargetTypeEnum.ClassProperty); }); var propertyInjections = propertyInjectionsRequests.map(resolveRequest); propertyInjectionsRequests.forEach(function (r, index) { var propertyName = ""; propertyName = r.target.name.value(); var injection = propertyInjections[index]; instance[propertyName] = injection; }); return instance; } function _createInstance(Func, injections) { return new (Func.bind.apply(Func, [void 0].concat(injections)))(); } function _postConstruct(constr, result) { if (Reflect.hasMetadata(METADATA_KEY.POST_CONSTRUCT, constr)) { var data = Reflect.getMetadata(METADATA_KEY.POST_CONSTRUCT, constr); try { result[data.value](); } catch (e) { throw new Error(error_msgs_1.POST_CONSTRUCT_ERROR(constr.name, e.message)); } } } function resolveInstance(constr, childRequests, resolveRequest) { var result = null; if (childRequests.length > 0) { var constructorInjectionsRequests = childRequests.filter(function (childRequest) { return (childRequest.target !== null && childRequest.target.type === literal_types_1.TargetTypeEnum.ConstructorArgument); }); var constructorInjections = constructorInjectionsRequests.map(resolveRequest); result = _createInstance(constr, constructorInjections); result = _injectProperties(result, childRequests, resolveRequest); } else { result = new constr(); } _postConstruct(constr, result); return result; } exports.resolveInstance = resolveInstance; /***/ }), /***/ 129: /***/ (function(module) { module.exports = require("child_process"); /***/ }), /***/ 131: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const types_1 = __webpack_require__(639); function setup(buildAgent, gitVersionTool) { return __awaiter(this, void 0, void 0, function* () { try { buildAgent.exportVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1"); const versionSpec = buildAgent.getInput(types_1.SetupOptions.versionSpec); const includePrerelease = buildAgent.getBooleanInput(types_1.SetupOptions.includePrerelease); yield gitVersionTool.install(versionSpec, includePrerelease); buildAgent.setSucceeded("GitVersion installed successfully", true); } catch (error) { buildAgent.setFailed(error.message, true); } }); } exports.setup = setup; function run(buildAgent, gitVersionTool) { return __awaiter(this, void 0, void 0, function* () { try { const inputOptions = getGitVersionOptions(buildAgent); const result = yield gitVersionTool.run(inputOptions); const gitversion = JSON.parse(result.stdout); writeGitVersionToAgent(buildAgent, gitversion); if (result.code === 0) { buildAgent.setSucceeded("GitVersion executed successfully", true); } else { buildAgent.setFailed(result.error.message, true); } } catch (error) { buildAgent.setFailed(error, true); } }); } exports.run = run; function getGitVersionOptions(buildAgent) { const targetPath = buildAgent.getInput(types_1.RunOptions.targetPath); const useConfigFile = buildAgent.getBooleanInput(types_1.RunOptions.useConfigFile); const configFilePath = buildAgent.getInput(types_1.RunOptions.configFilePath); const updateAssemblyInfo = buildAgent.getBooleanInput(types_1.RunOptions.updateAssemblyInfo); const updateAssemblyInfoFilename = buildAgent.getInput(types_1.RunOptions.updateAssemblyInfoFilename); const additionalArguments = buildAgent.getInput(types_1.RunOptions.additionalArguments); const srcDir = buildAgent.getSourceDir().replace(/\\/g, "/"); return { targetPath, useConfigFile, configFilePath, updateAssemblyInfo, updateAssemblyInfoFilename, additionalArguments, srcDir, }; } function writeGitVersionToAgent(buildAgent, gitversion) { buildAgent.setOutput("major", gitversion.Major.toString()); buildAgent.setOutput("minor", gitversion.Minor.toString()); buildAgent.setOutput("patch", gitversion.Patch.toString()); buildAgent.setOutput("preReleaseTag", gitversion.PreReleaseTag); buildAgent.setOutput("preReleaseTagWithDash", gitversion.PreReleaseTagWithDash); buildAgent.setOutput("preReleaseLabel", gitversion.PreReleaseLabel); buildAgent.setOutput("preReleaseNumber", gitversion.PreReleaseNumber.toString()); buildAgent.setOutput("weightedPreReleaseNumber", gitversion.WeightedPreReleaseNumber.toString()); buildAgent.setOutput("buildMetaData", gitversion.BuildMetaData.toString()); buildAgent.setOutput("buildMetaDataPadded", gitversion.BuildMetaDataPadded); buildAgent.setOutput("fullBuildMetaData", gitversion.FullBuildMetaData); buildAgent.setOutput("majorMinorPatch", gitversion.MajorMinorPatch); buildAgent.setOutput("semVer", gitversion.SemVer); buildAgent.setOutput("legacySemVer", gitversion.LegacySemVer); buildAgent.setOutput("legacySemVerPadded", gitversion.LegacySemVerPadded); buildAgent.setOutput("assemblySemVer", gitversion.AssemblySemVer); buildAgent.setOutput("assemblySemFileVer", gitversion.AssemblySemFileVer); buildAgent.setOutput("fullSemVer", gitversion.FullSemVer); buildAgent.setOutput("informationalVersion", gitversion.InformationalVersion); buildAgent.setOutput("branchName", gitversion.BranchName); buildAgent.setOutput("sha", gitversion.Sha); buildAgent.setOutput("shortSha", gitversion.ShortSha); buildAgent.setOutput("nuGetVersionV2", gitversion.NuGetVersionV2); buildAgent.setOutput("nuGetVersion", gitversion.NuGetVersion); buildAgent.setOutput("nuGetPreReleaseTagV2", gitversion.NuGetPreReleaseTagV2); buildAgent.setOutput("nuGetPreReleaseTag", gitversion.NuGetPreReleaseTag); buildAgent.setOutput("versionSourceSha", gitversion.VersionSourceSha); buildAgent.setOutput("commitsSinceVersionSource", gitversion.CommitsSinceVersionSource.toString()); buildAgent.setOutput("commitsSinceVersionSourcePadded", gitversion.CommitsSinceVersionSourcePadded); buildAgent.setOutput("commitDate", gitversion.CommitDate); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZmlsZTovLy9EOi9Qcm9qZWN0cy9PU1MvR2l0VG9vbHMvdXNlLWdpdHZlcnNpb24vc3JjL21haW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFFQSxtQ0FBbUQ7QUFFbkQsU0FBc0IsS0FBSyxDQUFDLFVBQXVCLEVBQUUsY0FBK0I7O1FBQ2hGLElBQUk7WUFFQSxVQUFVLENBQUMsY0FBYyxDQUFDLDZCQUE2QixFQUFFLEdBQUcsQ0FBQyxDQUFDO1lBRTlELE1BQU0sV0FBVyxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUMsb0JBQVksQ0FBQyxXQUFXLENBQUMsQ0FBQztZQUNsRSxNQUFNLGlCQUFpQixHQUFHLFVBQVUsQ0FBQyxlQUFlLENBQUMsb0JBQVksQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO1lBRXJGLE1BQU0sY0FBYyxDQUFDLE9BQU8sQ0FBQyxXQUFXLEVBQUUsaUJBQWlCLENBQUMsQ0FBQztZQUU3RCxVQUFVLENBQUMsWUFBWSxDQUFDLG1DQUFtQyxFQUFFLElBQUksQ0FBQyxDQUFDO1NBQ3RFO1FBQUMsT0FBTyxLQUFLLEVBQUU7WUFDWixVQUFVLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLENBQUM7U0FDN0M7SUFDTCxDQUFDO0NBQUE7QUFkRCxzQkFjQztBQUVELFNBQXNCLEdBQUcsQ0FBQyxVQUF1QixFQUFFLGNBQStCOztRQUM5RSxJQUFJO1lBQ0EsTUFBTSxZQUFZLEdBQXVCLG9CQUFvQixDQUFDLFVBQVUsQ0FBQyxDQUFDO1lBRTFFLE1BQU0sTUFBTSxHQUFHLE1BQU0sY0FBYyxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsQ0FBQztZQUV0RCxNQUFNLFVBQVUsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQWdCLENBQUM7WUFDNUQsc0JBQXNCLENBQUMsVUFBVSxFQUFFLFVBQVUsQ0FBQyxDQUFDO1lBRS9DLElBQUksTUFBTSxDQUFDLElBQUksS0FBSyxDQUFDLEVBQUU7Z0JBQ25CLFVBQVUsQ0FBQyxZQUFZLENBQUMsa0NBQWtDLEVBQUUsSUFBSSxDQUFDLENBQUM7YUFDckU7aUJBQU07Z0JBQ0gsVUFBVSxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQzthQUNwRDtTQUVKO1FBQUMsT0FBTyxLQUFLLEVBQUU7WUFDWixVQUFVLENBQUMsU0FBUyxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQztTQUNyQztJQUNMLENBQUM7Q0FBQTtBQWxCRCxrQkFrQkM7QUFFRCxTQUFTLG9CQUFvQixDQUFDLFVBQXVCO0lBRWpELE1BQU0sVUFBVSxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUMsa0JBQVUsQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUU5RCxNQUFNLGFBQWEsR0FBRyxVQUFVLENBQUMsZUFBZSxDQUFDLGtCQUFVLENBQUMsYUFBYSxDQUFDLENBQUM7SUFDM0UsTUFBTSxjQUFjLEdBQUcsVUFBVSxDQUFDLFFBQVEsQ0FBQyxrQkFBVSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBRXRFLE1BQU0sa0JBQWtCLEdBQUcsVUFBVSxDQUFDLGVBQWUsQ0FBQyxrQkFBVSxDQUFDLGtCQUFrQixDQUFDLENBQUM7SUFDckYsTUFBTSwwQkFBMEIsR0FBRyxVQUFVLENBQUMsUUFBUSxDQUFDLGtCQUFVLENBQUMsMEJBQTBCLENBQUMsQ0FBQztJQUU5RixNQUFNLG1CQUFtQixHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUMsa0JBQVUsQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDO0lBRWhGLE1BQU0sTUFBTSxHQUFHLFVBQVUsQ0FBQyxZQUFZLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0lBRTdELE9BQU87UUFDSCxVQUFVO1FBQ1YsYUFBYTtRQUNiLGNBQWM7UUFDZCxrQkFBa0I7UUFDbEIsMEJBQTBCO1FBQzFCLG1CQUFtQjtRQUNuQixNQUFNO0tBQ1QsQ0FBQztBQUNOLENBQUM7QUFFRCxTQUFTLHNCQUFzQixDQUFDLFVBQXVCLEVBQUUsVUFBdUI7SUFFNUUsVUFBVSxDQUFDLFNBQVMsQ0FBQyxPQUFPLEVBQTRCLFVBQVUsQ0FBQyxLQUFLLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQztJQUNyRixVQUFVLENBQUMsU0FBUyxDQUFDLE9BQU8sRUFBNEIsVUFBVSxDQUFDLEtBQUssQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDO0lBQ3JGLFVBQVUsQ0FBQyxTQUFTLENBQUMsT0FBTyxFQUE0QixVQUFVLENBQUMsS0FBSyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDckYsVUFBVSxDQUFDLFNBQVMsQ0FBQyxlQUFlLEVBQW9CLFVBQVUsQ0FBQyxhQUFhLENBQUMsQ0FBQztJQUNsRixVQUFVLENBQUMsU0FBUyxDQUFDLHVCQUF1QixFQUFZLFVBQVUsQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0lBQzFGLFVBQVUsQ0FBQyxTQUFTLENBQUMsaUJBQWlCLEVBQWtCLFVBQVUsQ0FBQyxlQUFlLENBQUMsQ0FBQztJQUNwRixVQUFVLENBQUMsU0FBUyxDQUFDLGtCQUFrQixFQUFpQixVQUFVLENBQUMsZ0JBQWdCLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQztJQUNoRyxVQUFVLENBQUMsU0FBUyxDQUFDLDBCQUEwQixFQUFTLFVBQVUsQ0FBQyx3QkFBd0IsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDO0lBQ3hHLFVBQVUsQ0FBQyxTQUFTLENBQUMsZUFBZSxFQUFvQixVQUFVLENBQUMsYUFBYSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDN0YsVUFBVSxDQUFDLFNBQVMsQ0FBQyxxQkFBcUIsRUFBYyxVQUFVLENBQUMsbUJBQW1CLENBQUMsQ0FBQztJQUN4RixVQUFVLENBQUMsU0FBUyxDQUFDLG1CQUFtQixFQUFnQixVQUFVLENBQUMsaUJBQWlCLENBQUMsQ0FBQztJQUN0RixVQUFVLENBQUMsU0FBUyxDQUFDLGlCQUFpQixFQUFrQixVQUFVLENBQUMsZUFBZSxDQUFDLENBQUM7SUFDcEYsVUFBVSxDQUFDLFNBQVMsQ0FBQyxRQUFRLEVBQTJCLFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUMzRSxVQUFVLENBQUMsU0FBUyxDQUFDLGNBQWMsRUFBcUIsVUFBVSxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ2pGLFVBQVUsQ0FBQyxTQUFTLENBQUMsb0JBQW9CLEVBQWUsVUFBVSxDQUFDLGtCQUFrQixDQUFDLENBQUM7SUFDdkYsVUFBVSxDQUFDLFNBQVMsQ0FBQyxnQkFBZ0IsRUFBbUIsVUFBVSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBQ25GLFVBQVUsQ0FBQyxTQUFTLENBQUMsb0JBQW9CLEVBQWUsVUFBVSxDQUFDLGtCQUFrQixDQUFDLENBQUM7SUFDdkYsVUFBVSxDQUFDLFNBQVMsQ0FBQyxZQUFZLEVBQXVCLFVBQVUsQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUMvRSxVQUFVLENBQUMsU0FBUyxDQUFDLHNCQUFzQixFQUFhLFVBQVUsQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0lBQ3pGLFVBQVUsQ0FBQyxTQUFTLENBQUMsWUFBWSxFQUF1QixVQUFVLENBQUMsVUFBVSxDQUFDLENBQUM7SUFDL0UsVUFBVSxDQUFDLFNBQVMsQ0FBQyxLQUFLLEVBQThCLFVBQVUsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUN4RSxVQUFVLENBQUMsU0FBUyxDQUFDLFVBQVUsRUFBeUIsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQzdFLFVBQVUsQ0FBQyxTQUFTLENBQUMsZ0JBQWdCLEVBQW1CLFVBQVUsQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUNuRixVQUFVLENBQUMsU0FBUyxDQUFDLGNBQWMsRUFBcUIsVUFBVSxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ2pGLFVBQVUsQ0FBQyxTQUFTLENBQUMsc0JBQXNCLEVBQWEsVUFBVSxDQUFDLG9CQUFvQixDQUFDLENBQUM7SUFDekYsVUFBVSxDQUFDLFNBQVMsQ0FBQyxvQkFBb0IsRUFBZSxVQUFVLENBQUMsa0JBQWtCLENBQUMsQ0FBQztJQUN2RixVQUFVLENBQUMsU0FBUyxDQUFDLGtCQUFrQixFQUFpQixVQUFVLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztJQUNyRixVQUFVLENBQUMsU0FBUyxDQUFDLDJCQUEyQixFQUFRLFVBQVUsQ0FBQyx5QkFBeUIsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDO0lBQ3pHLFVBQVUsQ0FBQyxTQUFTLENBQUMsaUNBQWlDLEVBQUUsVUFBVSxDQUFDLCtCQUErQixDQUFDLENBQUM7SUFDcEcsVUFBVSxDQUFDLFNBQVMsQ0FBQyxZQUFZLEVBQXVCLFVBQVUsQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUVuRixDQUFDIn0= /***/ }), /***/ 139: /***/ (function(module, __unusedexports, __webpack_require__) { // Unique ID creation requires a high quality random # generator. In node.js // this is pretty straight-forward - we use the crypto API. var crypto = __webpack_require__(417); module.exports = function nodeRNG() { return crypto.randomBytes(16); }; /***/ }), /***/ 141: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; var net = __webpack_require__(631); var tls = __webpack_require__(16); var http = __webpack_require__(876); var https = __webpack_require__(211); var events = __webpack_require__(614); var assert = __webpack_require__(357); var util = __webpack_require__(669); exports.httpOverHttp = httpOverHttp; exports.httpsOverHttp = httpsOverHttp; exports.httpOverHttps = httpOverHttps; exports.httpsOverHttps = httpsOverHttps; function httpOverHttp(options) { var agent = new TunnelingAgent(options); agent.request = http.request; return agent; } function httpsOverHttp(options) { var agent = new TunnelingAgent(options); agent.request = http.request; agent.createSocket = createSecureSocket; return agent; } function httpOverHttps(options) { var agent = new TunnelingAgent(options); agent.request = https.request; return agent; } function httpsOverHttps(options) { var agent = new TunnelingAgent(options); agent.request = https.request; agent.createSocket = createSecureSocket; return agent; } function TunnelingAgent(options) { var self = this; self.options = options || {}; self.proxyOptions = self.options.proxy || {}; self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; self.requests = []; self.sockets = []; self.on('free', function onFree(socket, host, port, localAddress) { var options = toOptions(host, port, localAddress); for (var i = 0, len = self.requests.length; i < len; ++i) { var pending = self.requests[i]; if (pending.host === options.host && pending.port === options.port) { // Detect the request to connect same origin server, // reuse the connection. self.requests.splice(i, 1); pending.request.onSocket(socket); return; } } socket.destroy(); self.removeSocket(socket); }); } util.inherits(TunnelingAgent, events.EventEmitter); TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { var self = this; var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); if (self.sockets.length >= this.maxSockets) { // We are over limit so we'll add it to the queue. self.requests.push(options); return; } // If we are under maxSockets create a new one. self.createSocket(options, function(socket) { socket.on('free', onFree); socket.on('close', onCloseOrRemove); socket.on('agentRemove', onCloseOrRemove); req.onSocket(socket); function onFree() { self.emit('free', socket, options); } function onCloseOrRemove(err) { self.removeSocket(socket); socket.removeListener('free', onFree); socket.removeListener('close', onCloseOrRemove); socket.removeListener('agentRemove', onCloseOrRemove); } }); }; TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { var self = this; var placeholder = {}; self.sockets.push(placeholder); var connectOptions = mergeOptions({}, self.proxyOptions, { method: 'CONNECT', path: options.host + ':' + options.port, agent: false }); if (connectOptions.proxyAuth) { connectOptions.headers = connectOptions.headers || {}; connectOptions.headers['Proxy-Authorization'] = 'Basic ' + new Buffer(connectOptions.proxyAuth).toString('base64'); } debug('making CONNECT request'); var connectReq = self.request(connectOptions); connectReq.useChunkedEncodingByDefault = false; // for v0.6 connectReq.once('response', onResponse); // for v0.6 connectReq.once('upgrade', onUpgrade); // for v0.6 connectReq.once('connect', onConnect); // for v0.7 or later connectReq.once('error', onError); connectReq.end(); function onResponse(res) { // Very hacky. This is necessary to avoid http-parser leaks. res.upgrade = true; } function onUpgrade(res, socket, head) { // Hacky. process.nextTick(function() { onConnect(res, socket, head); }); } function onConnect(res, socket, head) { connectReq.removeAllListeners(); socket.removeAllListeners(); if (res.statusCode === 200) { assert.equal(head.length, 0); debug('tunneling connection has established'); self.sockets[self.sockets.indexOf(placeholder)] = socket; cb(socket); } else { debug('tunneling socket could not be established, statusCode=%d', res.statusCode); var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode); error.code = 'ECONNRESET'; options.request.emit('error', error); self.removeSocket(placeholder); } } function onError(cause) { connectReq.removeAllListeners(); debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack); var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message); error.code = 'ECONNRESET'; options.request.emit('error', error); self.removeSocket(placeholder); } }; TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { var pos = this.sockets.indexOf(socket) if (pos === -1) { return; } this.sockets.splice(pos, 1); var pending = this.requests.shift(); if (pending) { // If we have pending requests and a socket gets closed a new one // needs to be created to take over in the pool for the one that closed. this.createSocket(pending, function(socket) { pending.request.onSocket(socket); }); } }; function createSecureSocket(options, cb) { var self = this; TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { var hostHeader = options.request.getHeader('host'); var tlsOptions = mergeOptions({}, self.options, { socket: socket, servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host }); // 0 is dummy port for v0.6 var secureSocket = tls.connect(0, tlsOptions); self.sockets[self.sockets.indexOf(socket)] = secureSocket; cb(secureSocket); }); } function toOptions(host, port, localAddress) { if (typeof host === 'string') { // since v0.10 return { host: host, port: port, localAddress: localAddress }; } return host; // for v0.11 or later } function mergeOptions(target) { for (var i = 1, len = arguments.length; i < len; ++i) { var overrides = arguments[i]; if (typeof overrides === 'object') { var keys = Object.keys(overrides); for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { var k = keys[j]; if (overrides[k] !== undefined) { target[k] = overrides[k]; } } } } return target; } var debug; if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { debug = function() { var args = Array.prototype.slice.call(arguments); if (typeof args[0] === 'string') { args[0] = 'TUNNEL: ' + args[0]; } else { args.unshift('TUNNEL:'); } console.error.apply(console, args); } } else { debug = function() {}; } exports.debug = debug; // for test /***/ }), /***/ 167: /***/ (function(module, __unusedexports, __webpack_require__) { var fs = __webpack_require__(747); var path = __webpack_require__(622); var common = __webpack_require__(602); var os = __webpack_require__(87); // Buffered file copy, synchronous // (Using readFileSync() + writeFileSync() could easily cause a memory overflow // with large files) function copyFileSync(srcFile, destFile) { if (!fs.existsSync(srcFile)) common.error('copyFileSync: no such file or directory: ' + srcFile); var BUF_LENGTH = 64*1024, buf = new Buffer(BUF_LENGTH), bytesRead = BUF_LENGTH, pos = 0, fdr = null, fdw = null; try { fdr = fs.openSync(srcFile, 'r'); } catch(e) { common.error('copyFileSync: could not read src file ('+srcFile+')'); } try { fdw = fs.openSync(destFile, 'w'); } catch(e) { common.error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile); } while (bytesRead === BUF_LENGTH) { bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos); fs.writeSync(fdw, buf, 0, bytesRead); pos += bytesRead; } fs.closeSync(fdr); fs.closeSync(fdw); fs.chmodSync(destFile, fs.statSync(srcFile).mode); } // Recursively copies 'sourceDir' into 'destDir' // Adapted from https://github.com/ryanmcgrath/wrench-js // // Copyright (c) 2010 Ryan McGrath // Copyright (c) 2012 Artur Adib // // Licensed under the MIT License // http://www.opensource.org/licenses/mit-license.php function cpdirSyncRecursive(sourceDir, destDir, opts) { if (!opts) opts = {}; /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */ var checkDir = fs.statSync(sourceDir); try { fs.mkdirSync(destDir, checkDir.mode); } catch (e) { //if the directory already exists, that's okay if (e.code !== 'EEXIST') throw e; } var files = fs.readdirSync(sourceDir); for (var i = 0; i < files.length; i++) { var srcFile = sourceDir + "/" + files[i]; var destFile = destDir + "/" + files[i]; var srcFileStat = fs.lstatSync(srcFile); if (srcFileStat.isDirectory()) { /* recursion this thing right on back. */ cpdirSyncRecursive(srcFile, destFile, opts); } else if (srcFileStat.isSymbolicLink()) { var symlinkFull = fs.readlinkSync(srcFile); fs.symlinkSync(symlinkFull, destFile, os.platform() === "win32" ? "junction" : null); } else { /* At this point, we've hit a file actually worth copying... so copy it on over. */ if (fs.existsSync(destFile) && !opts.force) { common.log('skipping existing file: ' + files[i]); } else { copyFileSync(srcFile, destFile); } } } // for files } // cpdirSyncRecursive //@ //@ ### cp([options ,] source [,source ...], dest) //@ ### cp([options ,] source_array, dest) //@ Available options: //@ //@ + `-f`: force //@ + `-r, -R`: recursive //@ //@ Examples: //@ //@ ```javascript //@ cp('file1', 'dir1'); //@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp'); //@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above //@ ``` //@ //@ Copies files. The wildcard `*` is accepted. function _cp(options, sources, dest) { options = common.parseOptions(options, { 'f': 'force', 'R': 'recursive', 'r': 'recursive' }); // Get sources, dest if (arguments.length < 3) { common.error('missing and/or '); } else if (arguments.length > 3) { sources = [].slice.call(arguments, 1, arguments.length - 1); dest = arguments[arguments.length - 1]; } else if (typeof sources === 'string') { sources = [sources]; } else if ('length' in sources) { sources = sources; // no-op for array } else { common.error('invalid arguments'); } var exists = fs.existsSync(dest), stats = exists && fs.statSync(dest); // Dest is not existing dir, but multiple sources given if ((!exists || !stats.isDirectory()) && sources.length > 1) common.error('dest is not a directory (too many sources)'); // Dest is an existing file, but no -f given if (exists && stats.isFile() && !options.force) common.error('dest file already exists: ' + dest); if (options.recursive) { // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*" // (see Github issue #15) sources.forEach(function(src, i) { if (src[src.length - 1] === '/') sources[i] += '*'; }); // Create dest try { fs.mkdirSync(dest, parseInt('0777', 8)); } catch (e) { // like Unix's cp, keep going even if we can't create dest dir } } sources = common.expand(sources); sources.forEach(function(src) { if (!fs.existsSync(src)) { common.error('no such file or directory: '+src, true); return; // skip file } // If here, src exists if (fs.statSync(src).isDirectory()) { if (!options.recursive) { // Non-Recursive common.log(src + ' is a directory (not copied)'); } else { // Recursive // 'cp /a/source dest' should create 'source' in 'dest' var newDest = path.join(dest, path.basename(src)), checkDir = fs.statSync(src); try { fs.mkdirSync(newDest, checkDir.mode); } catch (e) { //if the directory already exists, that's okay if (e.code !== 'EEXIST') throw e; } cpdirSyncRecursive(src, newDest, {force: options.force}); } return; // done with dir } // If here, src is a file // When copying to '/path/dir': // thisDest = '/path/dir/file1' var thisDest = dest; if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) thisDest = path.normalize(dest + '/' + path.basename(src)); if (fs.existsSync(thisDest) && !options.force) { common.error('dest file already exists: ' + thisDest, true); return; // skip file } copyFileSync(src, thisDest); }); // forEach(src) } module.exports = _cp; /***/ }), /***/ 199: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); //@ //@ ### grep([options ,] regex_filter, file [, file ...]) //@ ### grep([options ,] regex_filter, file_array) //@ Available options: //@ //@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. //@ //@ Examples: //@ //@ ```javascript //@ grep('-v', 'GLOBAL_VARIABLE', '*.js'); //@ grep('GLOBAL_VARIABLE', '*.js'); //@ ``` //@ //@ Reads input string from given files and returns a string containing all lines of the //@ file that match the given `regex_filter`. Wildcard `*` accepted. function _grep(options, regex, files) { options = common.parseOptions(options, { 'v': 'inverse' }); if (!files) common.error('no paths given'); if (typeof files === 'string') files = [].slice.call(arguments, 2); // if it's array leave it as it is files = common.expand(files); var grep = ''; files.forEach(function(file) { if (!fs.existsSync(file)) { common.error('no such file or directory: ' + file, true); return; } var contents = fs.readFileSync(file, 'utf8'), lines = contents.split(/\r*\n/); lines.forEach(function(line) { var matched = line.match(regex); if ((options.inverse && !matched) || (!options.inverse && matched)) grep += line + '\n'; }); }); return common.ShellString(grep); } module.exports = _grep; /***/ }), /***/ 211: /***/ (function(module) { module.exports = require("https"); /***/ }), /***/ 216: /***/ (function(module, __unusedexports, __webpack_require__) { var fs = __webpack_require__(747); var common = __webpack_require__(602); var _ls = __webpack_require__(705); //@ //@ ### find(path [,path ...]) //@ ### find(path_array) //@ Examples: //@ //@ ```javascript //@ find('src', 'lib'); //@ find(['src', 'lib']); // same as above //@ find('.').filter(function(file) { return file.match(/\.js$/); }); //@ ``` //@ //@ Returns array of all files (however deep) in the given paths. //@ //@ The main difference from `ls('-R', path)` is that the resulting file names //@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`. function _find(options, paths) { if (!paths) common.error('no path specified'); else if (typeof paths === 'object') paths = paths; // assume array else if (typeof paths === 'string') paths = [].slice.call(arguments, 1); var list = []; function pushFile(file) { if (common.platform === 'win') file = file.replace(/\\/g, '/'); list.push(file); } // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory paths.forEach(function(file) { pushFile(file); if (fs.statSync(file).isDirectory()) { _ls('-RA', file+'/*').forEach(function(subfile) { pushFile(subfile); }); } }); return list; } module.exports = _find; /***/ }), /***/ 223: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); const inversify_1 = __webpack_require__(410); const taskLib = __webpack_require__(562); const toolLib = __webpack_require__(324); let BuildAgent = class BuildAgent { find(toolName, versionSpec, arch) { return toolLib.findLocalTool(toolName, versionSpec, arch); } cacheDir(sourceDir, tool, version, arch) { return toolLib.cacheDir(sourceDir, tool, version, arch); } createTempDir() { return Promise.resolve(taskLib.getVariable("Agent.TempDirectory")); } debug(message) { taskLib.debug(message); } setFailed(message, done) { taskLib.setResult(taskLib.TaskResult.Failed, message, done); } setSucceeded(message, done) { taskLib.setResult(taskLib.TaskResult.Succeeded, message, done); } exportVariable(name, val) { taskLib.setVariable(name, val); } getVariable(name) { return taskLib.getVariable(name); } addPath(inputPath) { toolLib.prependPath(inputPath); } which(tool, check) { return Promise.resolve(taskLib.which(tool, check)); } exec(exec, args) { const tr = taskLib.tool(exec); tr.arg(args); const result = tr.execSync(); return Promise.resolve({ code: result.code, error: result.error, stderr: result.stderr, stdout: result.stdout, }); } getSourceDir() { return this.getVariable("Build.SourcesDirectory"); } setOutput(name, value) { taskLib.setVariable(name, value); } getInput(input, required) { return taskLib.getInput(input, required); } getBooleanInput(input, required) { return taskLib.getBoolInput(input, required); } isValidInputFile(input, file) { return taskLib.filePathSupplied(input) && this.fileExists(file); } fileExists(file) { return taskLib.exist(file) && taskLib.stats(file).isFile(); } directoryExists(file) { return taskLib.exist(file) && taskLib.stats(file).isDirectory(); } }; BuildAgent = __decorate([ inversify_1.injectable() ], BuildAgent); exports.BuildAgent = BuildAgent; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQtYWdlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJmaWxlOi8vL0Q6L1Byb2plY3RzL09TUy9HaXRUb29scy91c2UtZ2l0dmVyc2lvbi9zcmMvYXp1cmUvYnVpbGQtYWdlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFBQSx5Q0FBdUM7QUFFdkMseURBQXlEO0FBQ3pELHlEQUF5RDtBQUt6RCxJQUFNLFVBQVUsR0FBaEIsTUFBTSxVQUFVO0lBRUwsSUFBSSxDQUFDLFFBQWdCLEVBQUUsV0FBbUIsRUFBRSxJQUFhO1FBQzVELE9BQU8sT0FBTyxDQUFDLGFBQWEsQ0FBQyxRQUFRLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQzlELENBQUM7SUFFTSxRQUFRLENBQUMsU0FBaUIsRUFBRSxJQUFZLEVBQUUsT0FBZSxFQUFFLElBQWE7UUFDM0UsT0FBTyxPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVMsRUFBRSxJQUFJLEVBQUUsT0FBTyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQzVELENBQUM7SUFFTSxhQUFhO1FBQ2hCLE9BQU8sT0FBTyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLHFCQUFxQixDQUFDLENBQUMsQ0FBQztJQUN2RSxDQUFDO0lBRU0sS0FBSyxDQUFDLE9BQWU7UUFDeEIsT0FBTyxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUMzQixDQUFDO0lBRU0sU0FBUyxDQUFDLE9BQWUsRUFBRSxJQUFjO1FBQzVDLE9BQU8sQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxNQUFNLEVBQUUsT0FBTyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQ2hFLENBQUM7SUFFTSxZQUFZLENBQUMsT0FBZSxFQUFFLElBQWM7UUFDL0MsT0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLFNBQVMsRUFBRSxPQUFPLEVBQUUsSUFBSSxDQUFDLENBQUM7SUFDbkUsQ0FBQztJQUVNLGNBQWMsQ0FBQyxJQUFZLEVBQUUsR0FBVztRQUMzQyxPQUFPLENBQUMsV0FBVyxDQUFDLElBQUksRUFBRSxHQUFHLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBRU0sV0FBVyxDQUFDLElBQVk7UUFDM0IsT0FBTyxPQUFPLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3JDLENBQUM7SUFFTSxPQUFPLENBQUMsU0FBaUI7UUFDNUIsT0FBTyxDQUFDLFdBQVcsQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBRU0sS0FBSyxDQUFDLElBQVksRUFBRSxLQUFlO1FBQ3RDLE9BQU8sT0FBTyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsQ0FBQyxDQUFDO0lBQ3ZELENBQUM7SUFFTSxJQUFJLENBQUMsSUFBWSxFQUFFLElBQWM7UUFDcEMsTUFBTSxFQUFFLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUM5QixFQUFFLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBRWIsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDLFFBQVEsRUFBRSxDQUFDO1FBQzdCLE9BQU8sT0FBTyxDQUFDLE9BQU8sQ0FBQztZQUNuQixJQUFJLEVBQUUsTUFBTSxDQUFDLElBQUk7WUFDakIsS0FBSyxFQUFFLE1BQU0sQ0FBQyxLQUFLO1lBQ25CLE1BQU0sRUFBRSxNQUFNLENBQUMsTUFBTTtZQUNyQixNQUFNLEVBQUUsTUFBTSxDQUFDLE1BQU07U0FDeEIsQ0FBQyxDQUFDO0lBQ1AsQ0FBQztJQUVNLFlBQVk7UUFDZixPQUFPLElBQUksQ0FBQyxXQUFXLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUN0RCxDQUFDO0lBRU0sU0FBUyxDQUFDLElBQVksRUFBRSxLQUFhO1FBQ3hDLE9BQU8sQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ3JDLENBQUM7SUFFTSxRQUFRLENBQUMsS0FBYSxFQUFFLFFBQWtCO1FBQzdDLE9BQU8sT0FBTyxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsUUFBUSxDQUFDLENBQUM7SUFDN0MsQ0FBQztJQUVNLGVBQWUsQ0FBQyxLQUFhLEVBQUUsUUFBa0I7UUFDcEQsT0FBTyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxRQUFRLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBRU0sZ0JBQWdCLENBQUMsS0FBYSxFQUFFLElBQVk7UUFDL0MsT0FBTyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsS0FBSyxDQUFDLElBQUksSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNwRSxDQUFDO0lBRU0sVUFBVSxDQUFDLElBQVk7UUFDMUIsT0FBTyxPQUFPLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxJQUFJLE9BQU8sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsTUFBTSxFQUFFLENBQUM7SUFDL0QsQ0FBQztJQUVNLGVBQWUsQ0FBQyxJQUFZO1FBQy9CLE9BQU8sT0FBTyxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsSUFBSSxPQUFPLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLFdBQVcsRUFBRSxDQUFDO0lBQ3BFLENBQUM7Q0FDSixDQUFBO0FBbEZLLFVBQVU7SUFEZixzQkFBVSxFQUFFO0dBQ1AsVUFBVSxDQWtGZjtBQUdHLGdDQUFVIn0= /***/ }), /***/ 231: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var id_1 = __webpack_require__(862); var Request = (function () { function Request(serviceIdentifier, parentContext, parentRequest, bindings, target) { this.id = id_1.id(); this.serviceIdentifier = serviceIdentifier; this.parentContext = parentContext; this.parentRequest = parentRequest; this.target = target; this.childRequests = []; this.bindings = (Array.isArray(bindings) ? bindings : [bindings]); this.requestScope = parentRequest === null ? new Map() : null; } Request.prototype.addChildRequest = function (serviceIdentifier, bindings, target) { var child = new Request(serviceIdentifier, this.parentContext, this, bindings, target); this.childRequests.push(child); return child; }; return Request; }()); exports.Request = Request; /***/ }), /***/ 240: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); var path = __webpack_require__(622); //@ //@ ### 'string'.toEnd(file) //@ //@ Examples: //@ //@ ```javascript //@ cat('input.txt').toEnd('output.txt'); //@ ``` //@ //@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as //@ those returned by `cat`, `grep`, etc). function _toEnd(options, file) { if (!file) common.error('wrong arguments'); if (!fs.existsSync( path.dirname(file) )) common.error('no such file or directory: ' + path.dirname(file)); try { fs.appendFileSync(file, this.toString(), 'utf8'); } catch(e) { common.error('could not append to file (code '+e.code+'): '+file, true); } } module.exports = _toEnd; /***/ }), /***/ 272: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); // Recursively removes 'dir' // Adapted from https://github.com/ryanmcgrath/wrench-js // // Copyright (c) 2010 Ryan McGrath // Copyright (c) 2012 Artur Adib // // Licensed under the MIT License // http://www.opensource.org/licenses/mit-license.php function rmdirSyncRecursive(dir, force) { var files; files = fs.readdirSync(dir); // Loop through and delete everything in the sub-tree after checking it for(var i = 0; i < files.length; i++) { var file = dir + "/" + files[i], currFile = fs.lstatSync(file); if(currFile.isDirectory()) { // Recursive function back to the beginning rmdirSyncRecursive(file, force); } else if(currFile.isSymbolicLink()) { // Unlink symlinks if (force || isWriteable(file)) { try { common.unlinkSync(file); } catch (e) { common.error('could not remove file (code '+e.code+'): ' + file, true); } } } else // Assume it's a file - perhaps a try/catch belongs here? if (force || isWriteable(file)) { try { common.unlinkSync(file); } catch (e) { common.error('could not remove file (code '+e.code+'): ' + file, true); } } } // Now that we know everything in the sub-tree has been deleted, we can delete the main directory. // Huzzah for the shopkeep. var result; try { result = fs.rmdirSync(dir); } catch(e) { common.error('could not remove directory (code '+e.code+'): ' + dir, true); } return result; } // rmdirSyncRecursive // Hack to determine if file has write permissions for current user // Avoids having to check user, group, etc, but it's probably slow function isWriteable(file) { var writePermission = true; try { var __fd = fs.openSync(file, 'a'); fs.closeSync(__fd); } catch(e) { writePermission = false; } return writePermission; } //@ //@ ### rm([options ,] file [, file ...]) //@ ### rm([options ,] file_array) //@ Available options: //@ //@ + `-f`: force //@ + `-r, -R`: recursive //@ //@ Examples: //@ //@ ```javascript //@ rm('-rf', '/tmp/*'); //@ rm('some_file.txt', 'another_file.txt'); //@ rm(['some_file.txt', 'another_file.txt']); // same as above //@ ``` //@ //@ Removes files. The wildcard `*` is accepted. function _rm(options, files) { options = common.parseOptions(options, { 'f': 'force', 'r': 'recursive', 'R': 'recursive' }); if (!files) common.error('no paths given'); if (typeof files === 'string') files = [].slice.call(arguments, 1); // if it's array leave it as it is files = common.expand(files); files.forEach(function(file) { if (!fs.existsSync(file)) { // Path does not exist, no force flag given if (!options.force) common.error('no such file or directory: '+file, true); return; // skip file } // If here, path exists var stats = fs.lstatSync(file); if (stats.isFile() || stats.isSymbolicLink()) { // Do not check for file writing permissions if (options.force) { common.unlinkSync(file); return; } if (isWriteable(file)) common.unlinkSync(file); else common.error('permission denied: '+file, true); return; } // simple file // Path is an existing directory, but no -r flag given if (stats.isDirectory() && !options.recursive) { common.error('path is a directory', true); return; // skip path } // Recursively remove existing directory if (stats.isDirectory() && options.recursive) { rmdirSyncRecursive(file, options.force); } }); // forEach(file) } // rm module.exports = _rm; /***/ }), /***/ 274: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var BindingScopeEnum = { Request: "Request", Singleton: "Singleton", Transient: "Transient" }; exports.BindingScopeEnum = BindingScopeEnum; var BindingTypeEnum = { ConstantValue: "ConstantValue", Constructor: "Constructor", DynamicValue: "DynamicValue", Factory: "Factory", Function: "Function", Instance: "Instance", Invalid: "Invalid", Provider: "Provider" }; exports.BindingTypeEnum = BindingTypeEnum; var TargetTypeEnum = { ClassProperty: "ClassProperty", ConstructorArgument: "ConstructorArgument", Variable: "Variable" }; exports.TargetTypeEnum = TargetTypeEnum; /***/ }), /***/ 280: /***/ (function(module, exports) { exports = module.exports = SemVer var debug /* istanbul ignore next */ if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) { debug = function () { var args = Array.prototype.slice.call(arguments, 0) args.unshift('SEMVER') console.log.apply(console, args) } } else { debug = function () {} } // Note: this is the semver.org version of the spec that it implements // Not necessarily the package version of this code. exports.SEMVER_SPEC_VERSION = '2.0.0' var MAX_LENGTH = 256 var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ 9007199254740991 // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 // The actual regexps go on exports.re var re = exports.re = [] var src = exports.src = [] var R = 0 // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. // ## Numeric Identifier // A single `0`, or a non-zero digit followed by zero or more digits. var NUMERICIDENTIFIER = R++ src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' var NUMERICIDENTIFIERLOOSE = R++ src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. var NONNUMERICIDENTIFIER = R++ src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' // ## Main Version // Three dot-separated numeric identifiers. var MAINVERSION = R++ src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')' var MAINVERSIONLOOSE = R++ src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' // ## Pre-release Version Identifier // A numeric identifier, or a non-numeric identifier. var PRERELEASEIDENTIFIER = R++ src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + '|' + src[NONNUMERICIDENTIFIER] + ')' var PRERELEASEIDENTIFIERLOOSE = R++ src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + '|' + src[NONNUMERICIDENTIFIER] + ')' // ## Pre-release Version // Hyphen, followed by one or more dot-separated pre-release version // identifiers. var PRERELEASE = R++ src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' var PRERELEASELOOSE = R++ src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' // ## Build Metadata Identifier // Any combination of digits, letters, or hyphens. var BUILDIDENTIFIER = R++ src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata // identifiers. var BUILD = R++ src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' // ## Full Version String // A main version, followed optionally by a pre-release version and // build metadata. // Note that the only major, minor, patch, and pre-release sections of // the version string are capturing groups. The build metadata is not a // capturing group, because it should not ever be used in version // comparison. var FULL = R++ var FULLPLAIN = 'v?' + src[MAINVERSION] + src[PRERELEASE] + '?' + src[BUILD] + '?' src[FULL] = '^' + FULLPLAIN + '$' // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty // common in the npm registry. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + src[PRERELEASELOOSE] + '?' + src[BUILD] + '?' var LOOSE = R++ src[LOOSE] = '^' + LOOSEPLAIN + '$' var GTLT = R++ src[GTLT] = '((?:<|>)?=?)' // Something like "2.*" or "1.2.x". // Note that "x.x" is a valid xRange identifer, meaning "any version" // Only the first item is strictly required. var XRANGEIDENTIFIERLOOSE = R++ src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' var XRANGEIDENTIFIER = R++ src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' var XRANGEPLAIN = R++ src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:' + src[PRERELEASE] + ')?' + src[BUILD] + '?' + ')?)?' var XRANGEPLAINLOOSE = R++ src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[PRERELEASELOOSE] + ')?' + src[BUILD] + '?' + ')?)?' var XRANGE = R++ src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' var XRANGELOOSE = R++ src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' // Coercion. // Extract anything that could conceivably be a part of a valid semver var COERCE = R++ src[COERCE] = '(?:^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])' // Tilde ranges. // Meaning is "reasonably at or greater than" var LONETILDE = R++ src[LONETILDE] = '(?:~>?)' var TILDETRIM = R++ src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') var tildeTrimReplace = '$1~' var TILDE = R++ src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' var TILDELOOSE = R++ src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' // Caret ranges. // Meaning is "at least and backwards compatible with" var LONECARET = R++ src[LONECARET] = '(?:\\^)' var CARETTRIM = R++ src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') var caretTrimReplace = '$1^' var CARET = R++ src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' var CARETLOOSE = R++ src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' // A simple gt/lt/eq thing, or just "" to indicate "any version" var COMPARATORLOOSE = R++ src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' var COMPARATOR = R++ src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' // An expression to strip any whitespace between the gtlt and the thing // it modifies, so that `> 1.2.3` ==> `>1.2.3` var COMPARATORTRIM = R++ src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' // this one has to use the /g flag re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` // Note that these all use the loose form, because they'll be // checked against either the strict or loose comparator form // later. var HYPHENRANGE = R++ src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAIN] + ')' + '\\s*$' var HYPHENRANGELOOSE = R++ src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAINLOOSE] + ')' + '\\s*$' // Star ranges basically just allow anything at all. var STAR = R++ src[STAR] = '(<|>)?=?\\s*\\*' // Compile to actual regexp objects. // All are flag-free, unless they were created above with a flag. for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) } } exports.parse = parse function parse (version, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false } } if (version instanceof SemVer) { return version } if (typeof version !== 'string') { return null } if (version.length > MAX_LENGTH) { return null } var r = options.loose ? re[LOOSE] : re[FULL] if (!r.test(version)) { return null } try { return new SemVer(version, options) } catch (er) { return null } } exports.valid = valid function valid (version, options) { var v = parse(version, options) return v ? v.version : null } exports.clean = clean function clean (version, options) { var s = parse(version.trim().replace(/^[=v]+/, ''), options) return s ? s.version : null } exports.SemVer = SemVer function SemVer (version, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false } } if (version instanceof SemVer) { if (version.loose === options.loose) { return version } else { version = version.version } } else if (typeof version !== 'string') { throw new TypeError('Invalid Version: ' + version) } if (version.length > MAX_LENGTH) { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') } if (!(this instanceof SemVer)) { return new SemVer(version, options) } debug('SemVer', version, options) this.options = options this.loose = !!options.loose var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) } this.raw = version // these are actually numbers this.major = +m[1] this.minor = +m[2] this.patch = +m[3] if (this.major > MAX_SAFE_INTEGER || this.major < 0) { throw new TypeError('Invalid major version') } if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { throw new TypeError('Invalid minor version') } if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { throw new TypeError('Invalid patch version') } // numberify any prerelease numeric ids if (!m[4]) { this.prerelease = [] } else { this.prerelease = m[4].split('.').map(function (id) { if (/^[0-9]+$/.test(id)) { var num = +id if (num >= 0 && num < MAX_SAFE_INTEGER) { return num } } return id }) } this.build = m[5] ? m[5].split('.') : [] this.format() } SemVer.prototype.format = function () { this.version = this.major + '.' + this.minor + '.' + this.patch if (this.prerelease.length) { this.version += '-' + this.prerelease.join('.') } return this.version } SemVer.prototype.toString = function () { return this.version } SemVer.prototype.compare = function (other) { debug('SemVer.compare', this.version, this.options, other) if (!(other instanceof SemVer)) { other = new SemVer(other, this.options) } return this.compareMain(other) || this.comparePre(other) } SemVer.prototype.compareMain = function (other) { if (!(other instanceof SemVer)) { other = new SemVer(other, this.options) } return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch) } SemVer.prototype.comparePre = function (other) { if (!(other instanceof SemVer)) { other = new SemVer(other, this.options) } // NOT having a prerelease is > having one if (this.prerelease.length && !other.prerelease.length) { return -1 } else if (!this.prerelease.length && other.prerelease.length) { return 1 } else if (!this.prerelease.length && !other.prerelease.length) { return 0 } var i = 0 do { var a = this.prerelease[i] var b = other.prerelease[i] debug('prerelease compare', i, a, b) if (a === undefined && b === undefined) { return 0 } else if (b === undefined) { return 1 } else if (a === undefined) { return -1 } else if (a === b) { continue } else { return compareIdentifiers(a, b) } } while (++i) } // preminor will bump the version up to the next minor release, and immediately // down to pre-release. premajor and prepatch work the same way. SemVer.prototype.inc = function (release, identifier) { switch (release) { case 'premajor': this.prerelease.length = 0 this.patch = 0 this.minor = 0 this.major++ this.inc('pre', identifier) break case 'preminor': this.prerelease.length = 0 this.patch = 0 this.minor++ this.inc('pre', identifier) break case 'prepatch': // If this is already a prerelease, it will bump to the next version // drop any prereleases that might already exist, since they are not // relevant at this point. this.prerelease.length = 0 this.inc('patch', identifier) this.inc('pre', identifier) break // If the input is a non-prerelease version, this acts the same as // prepatch. case 'prerelease': if (this.prerelease.length === 0) { this.inc('patch', identifier) } this.inc('pre', identifier) break case 'major': // If this is a pre-major version, bump up to the same major version. // Otherwise increment major. // 1.0.0-5 bumps to 1.0.0 // 1.1.0 bumps to 2.0.0 if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { this.major++ } this.minor = 0 this.patch = 0 this.prerelease = [] break case 'minor': // If this is a pre-minor version, bump up to the same minor version. // Otherwise increment minor. // 1.2.0-5 bumps to 1.2.0 // 1.2.1 bumps to 1.3.0 if (this.patch !== 0 || this.prerelease.length === 0) { this.minor++ } this.patch = 0 this.prerelease = [] break case 'patch': // If this is not a pre-release version, it will increment the patch. // If it is a pre-release it will bump up to the same patch version. // 1.2.0-5 patches to 1.2.0 // 1.2.0 patches to 1.2.1 if (this.prerelease.length === 0) { this.patch++ } this.prerelease = [] break // This probably shouldn't be used publicly. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. case 'pre': if (this.prerelease.length === 0) { this.prerelease = [0] } else { var i = this.prerelease.length while (--i >= 0) { if (typeof this.prerelease[i] === 'number') { this.prerelease[i]++ i = -2 } } if (i === -1) { // didn't increment anything this.prerelease.push(0) } } if (identifier) { // 1.2.0-beta.1 bumps to 1.2.0-beta.2, // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 if (this.prerelease[0] === identifier) { if (isNaN(this.prerelease[1])) { this.prerelease = [identifier, 0] } } else { this.prerelease = [identifier, 0] } } break default: throw new Error('invalid increment argument: ' + release) } this.format() this.raw = this.version return this } exports.inc = inc function inc (version, release, loose, identifier) { if (typeof (loose) === 'string') { identifier = loose loose = undefined } try { return new SemVer(version, loose).inc(release, identifier).version } catch (er) { return null } } exports.diff = diff function diff (version1, version2) { if (eq(version1, version2)) { return null } else { var v1 = parse(version1) var v2 = parse(version2) var prefix = '' if (v1.prerelease.length || v2.prerelease.length) { prefix = 'pre' var defaultResult = 'prerelease' } for (var key in v1) { if (key === 'major' || key === 'minor' || key === 'patch') { if (v1[key] !== v2[key]) { return prefix + key } } } return defaultResult // may be undefined } } exports.compareIdentifiers = compareIdentifiers var numeric = /^[0-9]+$/ function compareIdentifiers (a, b) { var anum = numeric.test(a) var bnum = numeric.test(b) if (anum && bnum) { a = +a b = +b } return a === b ? 0 : (anum && !bnum) ? -1 : (bnum && !anum) ? 1 : a < b ? -1 : 1 } exports.rcompareIdentifiers = rcompareIdentifiers function rcompareIdentifiers (a, b) { return compareIdentifiers(b, a) } exports.major = major function major (a, loose) { return new SemVer(a, loose).major } exports.minor = minor function minor (a, loose) { return new SemVer(a, loose).minor } exports.patch = patch function patch (a, loose) { return new SemVer(a, loose).patch } exports.compare = compare function compare (a, b, loose) { return new SemVer(a, loose).compare(new SemVer(b, loose)) } exports.compareLoose = compareLoose function compareLoose (a, b) { return compare(a, b, true) } exports.rcompare = rcompare function rcompare (a, b, loose) { return compare(b, a, loose) } exports.sort = sort function sort (list, loose) { return list.sort(function (a, b) { return exports.compare(a, b, loose) }) } exports.rsort = rsort function rsort (list, loose) { return list.sort(function (a, b) { return exports.rcompare(a, b, loose) }) } exports.gt = gt function gt (a, b, loose) { return compare(a, b, loose) > 0 } exports.lt = lt function lt (a, b, loose) { return compare(a, b, loose) < 0 } exports.eq = eq function eq (a, b, loose) { return compare(a, b, loose) === 0 } exports.neq = neq function neq (a, b, loose) { return compare(a, b, loose) !== 0 } exports.gte = gte function gte (a, b, loose) { return compare(a, b, loose) >= 0 } exports.lte = lte function lte (a, b, loose) { return compare(a, b, loose) <= 0 } exports.cmp = cmp function cmp (a, op, b, loose) { switch (op) { case '===': if (typeof a === 'object') a = a.version if (typeof b === 'object') b = b.version return a === b case '!==': if (typeof a === 'object') a = a.version if (typeof b === 'object') b = b.version return a !== b case '': case '=': case '==': return eq(a, b, loose) case '!=': return neq(a, b, loose) case '>': return gt(a, b, loose) case '>=': return gte(a, b, loose) case '<': return lt(a, b, loose) case '<=': return lte(a, b, loose) default: throw new TypeError('Invalid operator: ' + op) } } exports.Comparator = Comparator function Comparator (comp, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false } } if (comp instanceof Comparator) { if (comp.loose === !!options.loose) { return comp } else { comp = comp.value } } if (!(this instanceof Comparator)) { return new Comparator(comp, options) } debug('comparator', comp, options) this.options = options this.loose = !!options.loose this.parse(comp) if (this.semver === ANY) { this.value = '' } else { this.value = this.operator + this.semver.version } debug('comp', this) } var ANY = {} Comparator.prototype.parse = function (comp) { var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] var m = comp.match(r) if (!m) { throw new TypeError('Invalid comparator: ' + comp) } this.operator = m[1] if (this.operator === '=') { this.operator = '' } // if it literally is just '>' or '' then allow anything. if (!m[2]) { this.semver = ANY } else { this.semver = new SemVer(m[2], this.options.loose) } } Comparator.prototype.toString = function () { return this.value } Comparator.prototype.test = function (version) { debug('Comparator.test', version, this.options.loose) if (this.semver === ANY) { return true } if (typeof version === 'string') { version = new SemVer(version, this.options) } return cmp(version, this.operator, this.semver, this.options) } Comparator.prototype.intersects = function (comp, options) { if (!(comp instanceof Comparator)) { throw new TypeError('a Comparator is required') } if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false } } var rangeTmp if (this.operator === '') { rangeTmp = new Range(comp.value, options) return satisfies(this.value, rangeTmp, options) } else if (comp.operator === '') { rangeTmp = new Range(this.value, options) return satisfies(comp.semver, rangeTmp, options) } var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>') var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<') var sameSemVer = this.semver.version === comp.semver.version var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=') var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && ((this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<')) var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && ((this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>')) return sameDirectionIncreasing || sameDirectionDecreasing || (sameSemVer && differentDirectionsInclusive) || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan } exports.Range = Range function Range (range, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false } } if (range instanceof Range) { if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { return range } else { return new Range(range.raw, options) } } if (range instanceof Comparator) { return new Range(range.value, options) } if (!(this instanceof Range)) { return new Range(range, options) } this.options = options this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease // First, split based on boolean or || this.raw = range this.set = range.split(/\s*\|\|\s*/).map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason return c.length }) if (!this.set.length) { throw new TypeError('Invalid SemVer Range: ' + range) } this.format() } Range.prototype.format = function () { this.range = this.set.map(function (comps) { return comps.join(' ').trim() }).join('||').trim() return this.range } Range.prototype.toString = function () { return this.range } Range.prototype.parseRange = function (range) { var loose = this.options.loose range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) debug('comparator trim', range, re[COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` range = range.replace(re[TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` range = range.replace(re[CARETTRIM], caretTrimReplace) // normalize spaces range = range.split(/\s+/).join(' ') // At this point, the range is completely trimmed and // ready to be split into comparators. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) if (this.options.loose) { // in loose mode, throw out any that are not valid comparators set = set.filter(function (comp) { return !!comp.match(compRe) }) } set = set.map(function (comp) { return new Comparator(comp, this.options) }, this) return set } Range.prototype.intersects = function (range, options) { if (!(range instanceof Range)) { throw new TypeError('a Range is required') } return this.set.some(function (thisComparators) { return thisComparators.every(function (thisComparator) { return range.set.some(function (rangeComparators) { return rangeComparators.every(function (rangeComparator) { return thisComparator.intersects(rangeComparator, options) }) }) }) }) } // Mostly just for testing and legacy API reasons exports.toComparators = toComparators function toComparators (range, options) { return new Range(range, options).set.map(function (comp) { return comp.map(function (c) { return c.value }).join(' ').trim().split(' ') }) } // comprised of xranges, tildes, stars, and gtlt's at this point. // already replaced the hyphen ranges // turn into a set of JUST comparators. function parseComparator (comp, options) { debug('comp', comp, options) comp = replaceCarets(comp, options) debug('caret', comp) comp = replaceTildes(comp, options) debug('tildes', comp) comp = replaceXRanges(comp, options) debug('xrange', comp) comp = replaceStars(comp, options) debug('stars', comp) return comp } function isX (id) { return !id || id.toLowerCase() === 'x' || id === '*' } // ~, ~> --> * (any, kinda silly) // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 function replaceTildes (comp, options) { return comp.trim().split(/\s+/).map(function (comp) { return replaceTilde(comp, options) }).join(' ') } function replaceTilde (comp, options) { var r = options.loose ? re[TILDELOOSE] : re[TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret if (isX(M)) { ret = '' } else if (isX(m)) { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' } else if (isX(p)) { // ~1.2 == >=1.2.0 <1.3.0 ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' } else if (pr) { debug('replaceTilde pr', pr) ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0' } else { // ~1.2.3 == >=1.2.3 <1.3.0 ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0' } debug('tilde return', ret) return ret }) } // ^ --> * (any, kinda silly) // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 // ^1.2.3 --> >=1.2.3 <2.0.0 // ^1.2.0 --> >=1.2.0 <2.0.0 function replaceCarets (comp, options) { return comp.trim().split(/\s+/).map(function (comp) { return replaceCaret(comp, options) }).join(' ') } function replaceCaret (comp, options) { debug('caret', comp, options) var r = options.loose ? re[CARETLOOSE] : re[CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret if (isX(M)) { ret = '' } else if (isX(m)) { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' } else if (isX(p)) { if (M === '0') { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' } else { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' } } else if (pr) { debug('replaceCaret pr', pr) if (M === '0') { if (m === '0') { ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1) } else { ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0' } } else { ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0' } } else { debug('no pr') if (M === '0') { if (m === '0') { ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1) } else { ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0' } } else { ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0' } } debug('caret return', ret) return ret }) } function replaceXRanges (comp, options) { debug('replaceXRanges', comp, options) return comp.split(/\s+/).map(function (comp) { return replaceXRange(comp, options) }).join(' ') } function replaceXRange (comp, options) { comp = comp.trim() var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) var xm = xM || isX(m) var xp = xm || isX(p) var anyX = xp if (gtlt === '=' && anyX) { gtlt = '' } if (xM) { if (gtlt === '>' || gtlt === '<') { // nothing is allowed ret = '<0.0.0' } else { // nothing is forbidden ret = '*' } } else if (gtlt && anyX) { // we know patch is an x, because we have any x at all. // replace X with 0 if (xm) { m = 0 } p = 0 if (gtlt === '>') { // >1 => >=2.0.0 // >1.2 => >=1.3.0 // >1.2.3 => >= 1.2.4 gtlt = '>=' if (xm) { M = +M + 1 m = 0 p = 0 } else { m = +m + 1 p = 0 } } else if (gtlt === '<=') { // <=0.7.x is actually <0.8.0, since any 0.7.x should // pass. Similarly, <=7.x is actually <8.0.0, etc. gtlt = '<' if (xm) { M = +M + 1 } else { m = +m + 1 } } ret = gtlt + M + '.' + m + '.' + p } else if (xm) { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' } else if (xp) { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' } debug('xRange return', ret) return ret }) } // Because * is AND-ed with everything else in the comparator, // and '' means "any version", just remove the *s entirely. function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! return comp.trim().replace(re[STAR], '') } // This function is passed to string.replace(re[HYPHENRANGE]) // M, m, patch, prerelease, build // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do // 1.2 - 3.4 => >=1.2.0 <3.5.0 function hyphenReplace ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) { if (isX(fM)) { from = '' } else if (isX(fm)) { from = '>=' + fM + '.0.0' } else if (isX(fp)) { from = '>=' + fM + '.' + fm + '.0' } else { from = '>=' + from } if (isX(tM)) { to = '' } else if (isX(tm)) { to = '<' + (+tM + 1) + '.0.0' } else if (isX(tp)) { to = '<' + tM + '.' + (+tm + 1) + '.0' } else if (tpr) { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr } else { to = '<=' + to } return (from + ' ' + to).trim() } // if ANY of the sets match ALL of its comparators, then pass Range.prototype.test = function (version) { if (!version) { return false } if (typeof version === 'string') { version = new SemVer(version, this.options) } for (var i = 0; i < this.set.length; i++) { if (testSet(this.set[i], version, this.options)) { return true } } return false } function testSet (set, version, options) { for (var i = 0; i < set.length; i++) { if (!set[i].test(version)) { return false } } if (version.prerelease.length && !options.includePrerelease) { // Find the set of versions that are allowed to have prereleases // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 // That should allow `1.2.3-pr.2` to pass. // However, `1.2.4-alpha.notready` should NOT be allowed, // even though it's within the range set by the comparators. for (i = 0; i < set.length; i++) { debug(set[i].semver) if (set[i].semver === ANY) { continue } if (set[i].semver.prerelease.length > 0) { var allowed = set[i].semver if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { return true } } } // Version has a -pre, but it's not one of the ones we like. return false } return true } exports.satisfies = satisfies function satisfies (version, range, options) { try { range = new Range(range, options) } catch (er) { return false } return range.test(version) } exports.maxSatisfying = maxSatisfying function maxSatisfying (versions, range, options) { var max = null var maxSV = null try { var rangeObj = new Range(range, options) } catch (er) { return null } versions.forEach(function (v) { if (rangeObj.test(v)) { // satisfies(v, range, options) if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) max = v maxSV = new SemVer(max, options) } } }) return max } exports.minSatisfying = minSatisfying function minSatisfying (versions, range, options) { var min = null var minSV = null try { var rangeObj = new Range(range, options) } catch (er) { return null } versions.forEach(function (v) { if (rangeObj.test(v)) { // satisfies(v, range, options) if (!min || minSV.compare(v) === 1) { // compare(min, v, true) min = v minSV = new SemVer(min, options) } } }) return min } exports.minVersion = minVersion function minVersion (range, loose) { range = new Range(range, loose) var minver = new SemVer('0.0.0') if (range.test(minver)) { return minver } minver = new SemVer('0.0.0-0') if (range.test(minver)) { return minver } minver = null for (var i = 0; i < range.set.length; ++i) { var comparators = range.set[i] comparators.forEach(function (comparator) { // Clone to avoid manipulating the comparator's semver object. var compver = new SemVer(comparator.semver.version) switch (comparator.operator) { case '>': if (compver.prerelease.length === 0) { compver.patch++ } else { compver.prerelease.push(0) } compver.raw = compver.format() /* fallthrough */ case '': case '>=': if (!minver || gt(minver, compver)) { minver = compver } break case '<': case '<=': /* Ignore maximum versions */ break /* istanbul ignore next */ default: throw new Error('Unexpected operation: ' + comparator.operator) } }) } if (minver && range.test(minver)) { return minver } return null } exports.validRange = validRange function validRange (range, options) { try { // Return '*' instead of '' so that truthiness works. // This will throw if it's invalid anyway return new Range(range, options).range || '*' } catch (er) { return null } } // Determine if version is less than all the versions possible in the range exports.ltr = ltr function ltr (version, range, options) { return outside(version, range, '<', options) } // Determine if version is greater than all the versions possible in the range. exports.gtr = gtr function gtr (version, range, options) { return outside(version, range, '>', options) } exports.outside = outside function outside (version, range, hilo, options) { version = new SemVer(version, options) range = new Range(range, options) var gtfn, ltefn, ltfn, comp, ecomp switch (hilo) { case '>': gtfn = gt ltefn = lte ltfn = lt comp = '>' ecomp = '>=' break case '<': gtfn = lt ltefn = gte ltfn = gt comp = '<' ecomp = '<=' break default: throw new TypeError('Must provide a hilo val of "<" or ">"') } // If it satisifes the range it is not outside if (satisfies(version, range, options)) { return false } // From now on, variable terms are as if we're in "gtr" mode. // but note that everything is flipped for the "ltr" function. for (var i = 0; i < range.set.length; ++i) { var comparators = range.set[i] var high = null var low = null comparators.forEach(function (comparator) { if (comparator.semver === ANY) { comparator = new Comparator('>=0.0.0') } high = high || comparator low = low || comparator if (gtfn(comparator.semver, high.semver, options)) { high = comparator } else if (ltfn(comparator.semver, low.semver, options)) { low = comparator } }) // If the edge version comparator has a operator then our version // isn't outside it if (high.operator === comp || high.operator === ecomp) { return false } // If the lowest version comparator has an operator and our version // is less than it then it isn't higher than the range if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { return false } else if (low.operator === ecomp && ltfn(version, low.semver)) { return false } } return true } exports.prerelease = prerelease function prerelease (version, options) { var parsed = parse(version, options) return (parsed && parsed.prerelease.length) ? parsed.prerelease : null } exports.intersects = intersects function intersects (r1, r2, options) { r1 = new Range(r1, options) r2 = new Range(r2, options) return r1.intersects(r2) } exports.coerce = coerce function coerce (version) { if (version instanceof SemVer) { return version } if (typeof version !== 'string') { return null } var match = version.match(re[COERCE]) if (match == null) { return null } return parse(match[1] + '.' + (match[2] || '0') + '.' + (match[3] || '0')) } /***/ }), /***/ 284: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); //@ //@ ### test(expression) //@ Available expression primaries: //@ //@ + `'-b', 'path'`: true if path is a block device //@ + `'-c', 'path'`: true if path is a character device //@ + `'-d', 'path'`: true if path is a directory //@ + `'-e', 'path'`: true if path exists //@ + `'-f', 'path'`: true if path is a regular file //@ + `'-L', 'path'`: true if path is a symboilc link //@ + `'-p', 'path'`: true if path is a pipe (FIFO) //@ + `'-S', 'path'`: true if path is a socket //@ //@ Examples: //@ //@ ```javascript //@ if (test('-d', path)) { /* do something with dir */ }; //@ if (!test('-f', path)) continue; // skip if it's a regular file //@ ``` //@ //@ Evaluates expression using the available primaries and returns corresponding value. function _test(options, path) { if (!path) common.error('no path given'); // hack - only works with unary primaries options = common.parseOptions(options, { 'b': 'block', 'c': 'character', 'd': 'directory', 'e': 'exists', 'f': 'file', 'L': 'link', 'p': 'pipe', 'S': 'socket' }); var canInterpret = false; for (var key in options) if (options[key] === true) { canInterpret = true; break; } if (!canInterpret) common.error('could not interpret expression'); if (options.link) { try { return fs.lstatSync(path).isSymbolicLink(); } catch(e) { return false; } } if (!fs.existsSync(path)) return false; if (options.exists) return true; var stats = fs.statSync(path); if (options.block) return stats.isBlockDevice(); if (options.character) return stats.isCharacterDevice(); if (options.directory) return stats.isDirectory(); if (options.file) return stats.isFile(); if (options.pipe) return stats.isFIFO(); if (options.socket) return stats.isSocket(); } // test module.exports = _test; /***/ }), /***/ 306: /***/ (function(module, __unusedexports, __webpack_require__) { var concatMap = __webpack_require__(896); var balanced = __webpack_require__(621); module.exports = expandTop; var escSlash = '\0SLASH'+Math.random()+'\0'; var escOpen = '\0OPEN'+Math.random()+'\0'; var escClose = '\0CLOSE'+Math.random()+'\0'; var escComma = '\0COMMA'+Math.random()+'\0'; var escPeriod = '\0PERIOD'+Math.random()+'\0'; function numeric(str) { return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); } function escapeBraces(str) { return str.split('\\\\').join(escSlash) .split('\\{').join(escOpen) .split('\\}').join(escClose) .split('\\,').join(escComma) .split('\\.').join(escPeriod); } function unescapeBraces(str) { return str.split(escSlash).join('\\') .split(escOpen).join('{') .split(escClose).join('}') .split(escComma).join(',') .split(escPeriod).join('.'); } // Basically just str.split(","), but handling cases // where we have nested braced sections, which should be // treated as individual members, like {a,{b,c},d} function parseCommaParts(str) { if (!str) return ['']; var parts = []; var m = balanced('{', '}', str); if (!m) return str.split(','); var pre = m.pre; var body = m.body; var post = m.post; var p = pre.split(','); p[p.length-1] += '{' + body + '}'; var postParts = parseCommaParts(post); if (post.length) { p[p.length-1] += postParts.shift(); p.push.apply(p, postParts); } parts.push.apply(parts, p); return parts; } function expandTop(str) { if (!str) return []; // I don't know why Bash 4.3 does this, but it does. // Anything starting with {} will have the first two bytes preserved // but *only* at the top level, so {},a}b will not expand to anything, // but a{},b}c will be expanded to [a}c,abc]. // One could argue that this is a bug in Bash, but since the goal of // this module is to match Bash's rules, we escape a leading {} if (str.substr(0, 2) === '{}') { str = '\\{\\}' + str.substr(2); } return expand(escapeBraces(str), true).map(unescapeBraces); } function identity(e) { return e; } function embrace(str) { return '{' + str + '}'; } function isPadded(el) { return /^-?0\d/.test(el); } function lte(i, y) { return i <= y; } function gte(i, y) { return i >= y; } function expand(str, isTop) { var expansions = []; var m = balanced('{', '}', str); if (!m || /\$$/.test(m.pre)) return [str]; var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); var isSequence = isNumericSequence || isAlphaSequence; var isOptions = m.body.indexOf(',') >= 0; if (!isSequence && !isOptions) { // {a},b} if (m.post.match(/,.*\}/)) { str = m.pre + '{' + m.body + escClose + m.post; return expand(str); } return [str]; } var n; if (isSequence) { n = m.body.split(/\.\./); } else { n = parseCommaParts(m.body); if (n.length === 1) { // x{{a,b}}y ==> x{a}y x{b}y n = expand(n[0], false).map(embrace); if (n.length === 1) { var post = m.post.length ? expand(m.post, false) : ['']; return post.map(function(p) { return m.pre + n[0] + p; }); } } } // at this point, n is the parts, and we know it's not a comma set // with a single entry. // no need to expand pre, since it is guaranteed to be free of brace-sets var pre = m.pre; var post = m.post.length ? expand(m.post, false) : ['']; var N; if (isSequence) { var x = numeric(n[0]); var y = numeric(n[1]); var width = Math.max(n[0].length, n[1].length) var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1; var test = lte; var reverse = y < x; if (reverse) { incr *= -1; test = gte; } var pad = n.some(isPadded); N = []; for (var i = x; test(i, y); i += incr) { var c; if (isAlphaSequence) { c = String.fromCharCode(i); if (c === '\\') c = ''; } else { c = String(i); if (pad) { var need = width - c.length; if (need > 0) { var z = new Array(need + 1).join('0'); if (i < 0) c = '-' + z + c.slice(1); else c = z + c; } } } N.push(c); } } else { N = concatMap(n, function(el) { return expand(el, false) }); } for (var j = 0; j < N.length; j++) { for (var k = 0; k < post.length; k++) { var expansion = pre + N[j] + post[k]; if (!isTop || isSequence || expansion) expansions.push(expansion); } } return expansions; } /***/ }), /***/ 307: /***/ (function() { /*! ***************************************************************************** Copyright (C) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var Reflect; (function (Reflect) { // Metadata Proposal // https://rbuckton.github.io/reflect-metadata/ (function (factory) { var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : Function("return this;")(); var exporter = makeExporter(Reflect); if (typeof root.Reflect === "undefined") { root.Reflect = Reflect; } else { exporter = makeExporter(root.Reflect, exporter); } factory(exporter); function makeExporter(target, previous) { return function (key, value) { if (typeof target[key] !== "function") { Object.defineProperty(target, key, { configurable: true, writable: true, value: value }); } if (previous) previous(key, value); }; } })(function (exporter) { var hasOwn = Object.prototype.hasOwnProperty; // feature test for Symbol support var supportsSymbol = typeof Symbol === "function"; var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support var downLevel = !supportsCreate && !supportsProto; var HashMap = { // create an object in dictionary mode (a.k.a. "slow" mode in v8) create: supportsCreate ? function () { return MakeDictionary(Object.create(null)); } : supportsProto ? function () { return MakeDictionary({ __proto__: null }); } : function () { return MakeDictionary({}); }, has: downLevel ? function (map, key) { return hasOwn.call(map, key); } : function (map, key) { return key in map; }, get: downLevel ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } : function (map, key) { return map[key]; }, }; // Load global or shim versions of Map, Set, and WeakMap var functionPrototype = Object.getPrototypeOf(Function); var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); // [[Metadata]] internal slot // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots var Metadata = new _WeakMap(); /** * Applies a set of decorators to a property of a target object. * @param decorators An array of decorators. * @param target The target object. * @param propertyKey (Optional) The property key to decorate. * @param attributes (Optional) The property descriptor for the target key. * @remarks Decorators are applied in reverse order. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * Example = Reflect.decorate(decoratorsArray, Example); * * // property (on constructor) * Reflect.decorate(decoratorsArray, Example, "staticProperty"); * * // property (on prototype) * Reflect.decorate(decoratorsArray, Example.prototype, "property"); * * // method (on constructor) * Object.defineProperty(Example, "staticMethod", * Reflect.decorate(decoratorsArray, Example, "staticMethod", * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); * * // method (on prototype) * Object.defineProperty(Example.prototype, "method", * Reflect.decorate(decoratorsArray, Example.prototype, "method", * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); * */ function decorate(decorators, target, propertyKey, attributes) { if (!IsUndefined(propertyKey)) { if (!IsArray(decorators)) throw new TypeError(); if (!IsObject(target)) throw new TypeError(); if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) throw new TypeError(); if (IsNull(attributes)) attributes = undefined; propertyKey = ToPropertyKey(propertyKey); return DecorateProperty(decorators, target, propertyKey, attributes); } else { if (!IsArray(decorators)) throw new TypeError(); if (!IsConstructor(target)) throw new TypeError(); return DecorateConstructor(decorators, target); } } exporter("decorate", decorate); // 4.1.2 Reflect.metadata(metadataKey, metadataValue) // https://rbuckton.github.io/reflect-metadata/#reflect.metadata /** * A default metadata decorator factory that can be used on a class, class member, or parameter. * @param metadataKey The key for the metadata entry. * @param metadataValue The value for the metadata entry. * @returns A decorator function. * @remarks * If `metadataKey` is already defined for the target and target key, the * metadataValue for that key will be overwritten. * @example * * // constructor * @Reflect.metadata(key, value) * class Example { * } * * // property (on constructor, TypeScript only) * class Example { * @Reflect.metadata(key, value) * static staticProperty; * } * * // property (on prototype, TypeScript only) * class Example { * @Reflect.metadata(key, value) * property; * } * * // method (on constructor) * class Example { * @Reflect.metadata(key, value) * static staticMethod() { } * } * * // method (on prototype) * class Example { * @Reflect.metadata(key, value) * method() { } * } * */ function metadata(metadataKey, metadataValue) { function decorator(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) throw new TypeError(); OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); } return decorator; } exporter("metadata", metadata); /** * Define a unique metadata entry on the target. * @param metadataKey A key used to store and retrieve metadata. * @param metadataValue A value that contains attached metadata. * @param target The target object on which to define metadata. * @param propertyKey (Optional) The property key for the target. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * Reflect.defineMetadata("custom:annotation", options, Example); * * // property (on constructor) * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); * * // property (on prototype) * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); * * // method (on constructor) * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); * * // method (on prototype) * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); * * // decorator factory as metadata-producing annotation. * function MyAnnotation(options): Decorator { * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); * } * */ function defineMetadata(metadataKey, metadataValue, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); } exporter("defineMetadata", defineMetadata); /** * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. * @param metadataKey A key used to store and retrieve metadata. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.hasMetadata("custom:annotation", Example); * * // property (on constructor) * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); * * // property (on prototype) * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); * * // method (on constructor) * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); * * // method (on prototype) * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); * */ function hasMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryHasMetadata(metadataKey, target, propertyKey); } exporter("hasMetadata", hasMetadata); /** * Gets a value indicating whether the target object has the provided metadata key defined. * @param metadataKey A key used to store and retrieve metadata. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.hasOwnMetadata("custom:annotation", Example); * * // property (on constructor) * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); * * // property (on prototype) * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); * * // method (on constructor) * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); * * // method (on prototype) * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); * */ function hasOwnMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); } exporter("hasOwnMetadata", hasOwnMetadata); /** * Gets the metadata value for the provided metadata key on the target object or its prototype chain. * @param metadataKey A key used to store and retrieve metadata. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns The metadata value for the metadata key if found; otherwise, `undefined`. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.getMetadata("custom:annotation", Example); * * // property (on constructor) * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); * * // property (on prototype) * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); * * // method (on constructor) * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); * * // method (on prototype) * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); * */ function getMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryGetMetadata(metadataKey, target, propertyKey); } exporter("getMetadata", getMetadata); /** * Gets the metadata value for the provided metadata key on the target object. * @param metadataKey A key used to store and retrieve metadata. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns The metadata value for the metadata key if found; otherwise, `undefined`. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.getOwnMetadata("custom:annotation", Example); * * // property (on constructor) * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); * * // property (on prototype) * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); * * // method (on constructor) * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); * * // method (on prototype) * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); * */ function getOwnMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); } exporter("getOwnMetadata", getOwnMetadata); /** * Gets the metadata keys defined on the target object or its prototype chain. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns An array of unique metadata keys. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.getMetadataKeys(Example); * * // property (on constructor) * result = Reflect.getMetadataKeys(Example, "staticProperty"); * * // property (on prototype) * result = Reflect.getMetadataKeys(Example.prototype, "property"); * * // method (on constructor) * result = Reflect.getMetadataKeys(Example, "staticMethod"); * * // method (on prototype) * result = Reflect.getMetadataKeys(Example.prototype, "method"); * */ function getMetadataKeys(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryMetadataKeys(target, propertyKey); } exporter("getMetadataKeys", getMetadataKeys); /** * Gets the unique metadata keys defined on the target object. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns An array of unique metadata keys. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.getOwnMetadataKeys(Example); * * // property (on constructor) * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); * * // property (on prototype) * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); * * // method (on constructor) * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); * * // method (on prototype) * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); * */ function getOwnMetadataKeys(target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); return OrdinaryOwnMetadataKeys(target, propertyKey); } exporter("getOwnMetadataKeys", getOwnMetadataKeys); /** * Deletes the metadata entry from the target object with the provided key. * @param metadataKey A key used to store and retrieve metadata. * @param target The target object on which the metadata is defined. * @param propertyKey (Optional) The property key for the target. * @returns `true` if the metadata entry was found and deleted; otherwise, false. * @example * * class Example { * // property declarations are not part of ES6, though they are valid in TypeScript: * // static staticProperty; * // property; * * constructor(p) { } * static staticMethod(p) { } * method(p) { } * } * * // constructor * result = Reflect.deleteMetadata("custom:annotation", Example); * * // property (on constructor) * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); * * // property (on prototype) * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); * * // method (on constructor) * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); * * // method (on prototype) * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); * */ function deleteMetadata(metadataKey, target, propertyKey) { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); if (IsUndefined(metadataMap)) return false; if (!metadataMap.delete(metadataKey)) return false; if (metadataMap.size > 0) return true; var targetMetadata = Metadata.get(target); targetMetadata.delete(propertyKey); if (targetMetadata.size > 0) return true; Metadata.delete(target); return true; } exporter("deleteMetadata", deleteMetadata); function DecorateConstructor(decorators, target) { for (var i = decorators.length - 1; i >= 0; --i) { var decorator = decorators[i]; var decorated = decorator(target); if (!IsUndefined(decorated) && !IsNull(decorated)) { if (!IsConstructor(decorated)) throw new TypeError(); target = decorated; } } return target; } function DecorateProperty(decorators, target, propertyKey, descriptor) { for (var i = decorators.length - 1; i >= 0; --i) { var decorator = decorators[i]; var decorated = decorator(target, propertyKey, descriptor); if (!IsUndefined(decorated) && !IsNull(decorated)) { if (!IsObject(decorated)) throw new TypeError(); descriptor = decorated; } } return descriptor; } function GetOrCreateMetadataMap(O, P, Create) { var targetMetadata = Metadata.get(O); if (IsUndefined(targetMetadata)) { if (!Create) return undefined; targetMetadata = new _Map(); Metadata.set(O, targetMetadata); } var metadataMap = targetMetadata.get(P); if (IsUndefined(metadataMap)) { if (!Create) return undefined; metadataMap = new _Map(); targetMetadata.set(P, metadataMap); } return metadataMap; } // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata function OrdinaryHasMetadata(MetadataKey, O, P) { var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; var parent = OrdinaryGetPrototypeOf(O); if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P); return false; } // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata function OrdinaryHasOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); if (IsUndefined(metadataMap)) return false; return ToBoolean(metadataMap.has(MetadataKey)); } // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata function OrdinaryGetMetadata(MetadataKey, O, P) { var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return OrdinaryGetOwnMetadata(MetadataKey, O, P); var parent = OrdinaryGetPrototypeOf(O); if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P); return undefined; } // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata function OrdinaryGetOwnMetadata(MetadataKey, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); if (IsUndefined(metadataMap)) return undefined; return metadataMap.get(MetadataKey); } // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); metadataMap.set(MetadataKey, MetadataValue); } // 3.1.6.1 OrdinaryMetadataKeys(O, P) // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys function OrdinaryMetadataKeys(O, P) { var ownKeys = OrdinaryOwnMetadataKeys(O, P); var parent = OrdinaryGetPrototypeOf(O); if (parent === null) return ownKeys; var parentKeys = OrdinaryMetadataKeys(parent, P); if (parentKeys.length <= 0) return ownKeys; if (ownKeys.length <= 0) return parentKeys; var set = new _Set(); var keys = []; for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { var key = ownKeys_1[_i]; var hasKey = set.has(key); if (!hasKey) { set.add(key); keys.push(key); } } for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { var key = parentKeys_1[_a]; var hasKey = set.has(key); if (!hasKey) { set.add(key); keys.push(key); } } return keys; } // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys function OrdinaryOwnMetadataKeys(O, P) { var keys = []; var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); if (IsUndefined(metadataMap)) return keys; var keysObj = metadataMap.keys(); var iterator = GetIterator(keysObj); var k = 0; while (true) { var next = IteratorStep(iterator); if (!next) { keys.length = k; return keys; } var nextValue = IteratorValue(next); try { keys[k] = nextValue; } catch (e) { try { IteratorClose(iterator); } finally { throw e; } } k++; } } // 6 ECMAScript Data Typ0es and Values // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values function Type(x) { if (x === null) return 1 /* Null */; switch (typeof x) { case "undefined": return 0 /* Undefined */; case "boolean": return 2 /* Boolean */; case "string": return 3 /* String */; case "symbol": return 4 /* Symbol */; case "number": return 5 /* Number */; case "object": return x === null ? 1 /* Null */ : 6 /* Object */; default: return 6 /* Object */; } } // 6.1.1 The Undefined Type // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type function IsUndefined(x) { return x === undefined; } // 6.1.2 The Null Type // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type function IsNull(x) { return x === null; } // 6.1.5 The Symbol Type // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type function IsSymbol(x) { return typeof x === "symbol"; } // 6.1.7 The Object Type // https://tc39.github.io/ecma262/#sec-object-type function IsObject(x) { return typeof x === "object" ? x !== null : typeof x === "function"; } // 7.1 Type Conversion // https://tc39.github.io/ecma262/#sec-type-conversion // 7.1.1 ToPrimitive(input [, PreferredType]) // https://tc39.github.io/ecma262/#sec-toprimitive function ToPrimitive(input, PreferredType) { switch (Type(input)) { case 0 /* Undefined */: return input; case 1 /* Null */: return input; case 2 /* Boolean */: return input; case 3 /* String */: return input; case 4 /* Symbol */: return input; case 5 /* Number */: return input; } var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; var exoticToPrim = GetMethod(input, toPrimitiveSymbol); if (exoticToPrim !== undefined) { var result = exoticToPrim.call(input, hint); if (IsObject(result)) throw new TypeError(); return result; } return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); } // 7.1.1.1 OrdinaryToPrimitive(O, hint) // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive function OrdinaryToPrimitive(O, hint) { if (hint === "string") { var toString_1 = O.toString; if (IsCallable(toString_1)) { var result = toString_1.call(O); if (!IsObject(result)) return result; } var valueOf = O.valueOf; if (IsCallable(valueOf)) { var result = valueOf.call(O); if (!IsObject(result)) return result; } } else { var valueOf = O.valueOf; if (IsCallable(valueOf)) { var result = valueOf.call(O); if (!IsObject(result)) return result; } var toString_2 = O.toString; if (IsCallable(toString_2)) { var result = toString_2.call(O); if (!IsObject(result)) return result; } } throw new TypeError(); } // 7.1.2 ToBoolean(argument) // https://tc39.github.io/ecma262/2016/#sec-toboolean function ToBoolean(argument) { return !!argument; } // 7.1.12 ToString(argument) // https://tc39.github.io/ecma262/#sec-tostring function ToString(argument) { return "" + argument; } // 7.1.14 ToPropertyKey(argument) // https://tc39.github.io/ecma262/#sec-topropertykey function ToPropertyKey(argument) { var key = ToPrimitive(argument, 3 /* String */); if (IsSymbol(key)) return key; return ToString(key); } // 7.2 Testing and Comparison Operations // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations // 7.2.2 IsArray(argument) // https://tc39.github.io/ecma262/#sec-isarray function IsArray(argument) { return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]"; } // 7.2.3 IsCallable(argument) // https://tc39.github.io/ecma262/#sec-iscallable function IsCallable(argument) { // NOTE: This is an approximation as we cannot check for [[Call]] internal method. return typeof argument === "function"; } // 7.2.4 IsConstructor(argument) // https://tc39.github.io/ecma262/#sec-isconstructor function IsConstructor(argument) { // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. return typeof argument === "function"; } // 7.2.7 IsPropertyKey(argument) // https://tc39.github.io/ecma262/#sec-ispropertykey function IsPropertyKey(argument) { switch (Type(argument)) { case 3 /* String */: return true; case 4 /* Symbol */: return true; default: return false; } } // 7.3 Operations on Objects // https://tc39.github.io/ecma262/#sec-operations-on-objects // 7.3.9 GetMethod(V, P) // https://tc39.github.io/ecma262/#sec-getmethod function GetMethod(V, P) { var func = V[P]; if (func === undefined || func === null) return undefined; if (!IsCallable(func)) throw new TypeError(); return func; } // 7.4 Operations on Iterator Objects // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects function GetIterator(obj) { var method = GetMethod(obj, iteratorSymbol); if (!IsCallable(method)) throw new TypeError(); // from Call var iterator = method.call(obj); if (!IsObject(iterator)) throw new TypeError(); return iterator; } // 7.4.4 IteratorValue(iterResult) // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue function IteratorValue(iterResult) { return iterResult.value; } // 7.4.5 IteratorStep(iterator) // https://tc39.github.io/ecma262/#sec-iteratorstep function IteratorStep(iterator) { var result = iterator.next(); return result.done ? false : result; } // 7.4.6 IteratorClose(iterator, completion) // https://tc39.github.io/ecma262/#sec-iteratorclose function IteratorClose(iterator) { var f = iterator["return"]; if (f) f.call(iterator); } // 9.1 Ordinary Object Internal Methods and Internal Slots // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots // 9.1.1.1 OrdinaryGetPrototypeOf(O) // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof function OrdinaryGetPrototypeOf(O) { var proto = Object.getPrototypeOf(O); if (typeof O !== "function" || O === functionPrototype) return proto; // TypeScript doesn't set __proto__ in ES5, as it's non-standard. // Try to determine the superclass constructor. Compatible implementations // must either set __proto__ on a subclass constructor to the superclass constructor, // or ensure each class has a valid `constructor` property on its prototype that // points back to the constructor. // If this is not the same as Function.[[Prototype]], then this is definately inherited. // This is the case when in ES6 or when using __proto__ in a compatible browser. if (proto !== functionPrototype) return proto; // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. var prototype = O.prototype; var prototypeProto = prototype && Object.getPrototypeOf(prototype); if (prototypeProto == null || prototypeProto === Object.prototype) return proto; // If the constructor was not a function, then we cannot determine the heritage. var constructor = prototypeProto.constructor; if (typeof constructor !== "function") return proto; // If we have some kind of self-reference, then we cannot determine the heritage. if (constructor === O) return proto; // we have a pretty good guess at the heritage. return constructor; } // naive Map shim function CreateMapPolyfill() { var cacheSentinel = {}; var arraySentinel = []; var MapIterator = /** @class */ (function () { function MapIterator(keys, values, selector) { this._index = 0; this._keys = keys; this._values = values; this._selector = selector; } MapIterator.prototype["@@iterator"] = function () { return this; }; MapIterator.prototype[iteratorSymbol] = function () { return this; }; MapIterator.prototype.next = function () { var index = this._index; if (index >= 0 && index < this._keys.length) { var result = this._selector(this._keys[index], this._values[index]); if (index + 1 >= this._keys.length) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } else { this._index++; } return { value: result, done: false }; } return { value: undefined, done: true }; }; MapIterator.prototype.throw = function (error) { if (this._index >= 0) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } throw error; }; MapIterator.prototype.return = function (value) { if (this._index >= 0) { this._index = -1; this._keys = arraySentinel; this._values = arraySentinel; } return { value: value, done: true }; }; return MapIterator; }()); return /** @class */ (function () { function Map() { this._keys = []; this._values = []; this._cacheKey = cacheSentinel; this._cacheIndex = -2; } Object.defineProperty(Map.prototype, "size", { get: function () { return this._keys.length; }, enumerable: true, configurable: true }); Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; Map.prototype.get = function (key) { var index = this._find(key, /*insert*/ false); return index >= 0 ? this._values[index] : undefined; }; Map.prototype.set = function (key, value) { var index = this._find(key, /*insert*/ true); this._values[index] = value; return this; }; Map.prototype.delete = function (key) { var index = this._find(key, /*insert*/ false); if (index >= 0) { var size = this._keys.length; for (var i = index + 1; i < size; i++) { this._keys[i - 1] = this._keys[i]; this._values[i - 1] = this._values[i]; } this._keys.length--; this._values.length--; if (key === this._cacheKey) { this._cacheKey = cacheSentinel; this._cacheIndex = -2; } return true; } return false; }; Map.prototype.clear = function () { this._keys.length = 0; this._values.length = 0; this._cacheKey = cacheSentinel; this._cacheIndex = -2; }; Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; Map.prototype["@@iterator"] = function () { return this.entries(); }; Map.prototype[iteratorSymbol] = function () { return this.entries(); }; Map.prototype._find = function (key, insert) { if (this._cacheKey !== key) { this._cacheIndex = this._keys.indexOf(this._cacheKey = key); } if (this._cacheIndex < 0 && insert) { this._cacheIndex = this._keys.length; this._keys.push(key); this._values.push(undefined); } return this._cacheIndex; }; return Map; }()); function getKey(key, _) { return key; } function getValue(_, value) { return value; } function getEntry(key, value) { return [key, value]; } } // naive Set shim function CreateSetPolyfill() { return /** @class */ (function () { function Set() { this._map = new _Map(); } Object.defineProperty(Set.prototype, "size", { get: function () { return this._map.size; }, enumerable: true, configurable: true }); Set.prototype.has = function (value) { return this._map.has(value); }; Set.prototype.add = function (value) { return this._map.set(value, value), this; }; Set.prototype.delete = function (value) { return this._map.delete(value); }; Set.prototype.clear = function () { this._map.clear(); }; Set.prototype.keys = function () { return this._map.keys(); }; Set.prototype.values = function () { return this._map.values(); }; Set.prototype.entries = function () { return this._map.entries(); }; Set.prototype["@@iterator"] = function () { return this.keys(); }; Set.prototype[iteratorSymbol] = function () { return this.keys(); }; return Set; }()); } // naive WeakMap shim function CreateWeakMapPolyfill() { var UUID_SIZE = 16; var keys = HashMap.create(); var rootKey = CreateUniqueKey(); return /** @class */ (function () { function WeakMap() { this._key = CreateUniqueKey(); } WeakMap.prototype.has = function (target) { var table = GetOrCreateWeakMapTable(target, /*create*/ false); return table !== undefined ? HashMap.has(table, this._key) : false; }; WeakMap.prototype.get = function (target) { var table = GetOrCreateWeakMapTable(target, /*create*/ false); return table !== undefined ? HashMap.get(table, this._key) : undefined; }; WeakMap.prototype.set = function (target, value) { var table = GetOrCreateWeakMapTable(target, /*create*/ true); table[this._key] = value; return this; }; WeakMap.prototype.delete = function (target) { var table = GetOrCreateWeakMapTable(target, /*create*/ false); return table !== undefined ? delete table[this._key] : false; }; WeakMap.prototype.clear = function () { // NOTE: not a real clear, just makes the previous data unreachable this._key = CreateUniqueKey(); }; return WeakMap; }()); function CreateUniqueKey() { var key; do key = "@@WeakMap@@" + CreateUUID(); while (HashMap.has(keys, key)); keys[key] = true; return key; } function GetOrCreateWeakMapTable(target, create) { if (!hasOwn.call(target, rootKey)) { if (!create) return undefined; Object.defineProperty(target, rootKey, { value: HashMap.create() }); } return target[rootKey]; } function FillRandomBytes(buffer, size) { for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 0xff | 0; return buffer; } function GenRandomBytes(size) { if (typeof Uint8Array === "function") { if (typeof crypto !== "undefined") return crypto.getRandomValues(new Uint8Array(size)); if (typeof msCrypto !== "undefined") return msCrypto.getRandomValues(new Uint8Array(size)); return FillRandomBytes(new Uint8Array(size), size); } return FillRandomBytes(new Array(size), size); } function CreateUUID() { var data = GenRandomBytes(UUID_SIZE); // mark as random - RFC 4122 § 4.4 data[6] = data[6] & 0x4f | 0x40; data[8] = data[8] & 0xbf | 0x80; var result = ""; for (var offset = 0; offset < UUID_SIZE; ++offset) { var byte = data[offset]; if (offset === 4 || offset === 6 || offset === 8) result += "-"; if (byte < 16) result += "0"; result += byte.toString(16).toLowerCase(); } return result; } } // uses a heuristic used by v8 and chakra to force an object into dictionary mode. function MakeDictionary(obj) { obj.__ = undefined; delete obj.__; return obj; } }); })(Reflect || (Reflect = {})); /***/ }), /***/ 309: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERROR_MSGS = __webpack_require__(800); var METADATA_KEY = __webpack_require__(946); function tagParameter(annotationTarget, propertyName, parameterIndex, metadata) { var metadataKey = METADATA_KEY.TAGGED; _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex); } exports.tagParameter = tagParameter; function tagProperty(annotationTarget, propertyName, metadata) { var metadataKey = METADATA_KEY.TAGGED_PROP; _tagParameterOrProperty(metadataKey, annotationTarget.constructor, propertyName, metadata); } exports.tagProperty = tagProperty; function _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex) { var paramsOrPropertiesMetadata = {}; var isParameterDecorator = (typeof parameterIndex === "number"); var key = (parameterIndex !== undefined && isParameterDecorator) ? parameterIndex.toString() : propertyName; if (isParameterDecorator && propertyName !== undefined) { throw new Error(ERROR_MSGS.INVALID_DECORATOR_OPERATION); } if (Reflect.hasOwnMetadata(metadataKey, annotationTarget)) { paramsOrPropertiesMetadata = Reflect.getMetadata(metadataKey, annotationTarget); } var paramOrPropertyMetadata = paramsOrPropertiesMetadata[key]; if (!Array.isArray(paramOrPropertyMetadata)) { paramOrPropertyMetadata = []; } else { for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) { var m = paramOrPropertyMetadata_1[_i]; if (m.key === metadata.key) { throw new Error(ERROR_MSGS.DUPLICATED_METADATA + " " + m.key.toString()); } } } paramOrPropertyMetadata.push(metadata); paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata; Reflect.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget); } function _decorate(decorators, target) { Reflect.decorate(decorators, target); } function _param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); }; } function decorate(decorator, target, parameterIndex) { if (typeof parameterIndex === "number") { _decorate([_param(parameterIndex, decorator)], target); } else if (typeof parameterIndex === "string") { Reflect.decorate([decorator], target, parameterIndex); } else { _decorate([decorator], target); } } exports.decorate = decorate; /***/ }), /***/ 319: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERROR_MSGS = __webpack_require__(800); var Lookup = (function () { function Lookup() { this._map = new Map(); } Lookup.prototype.getMap = function () { return this._map; }; Lookup.prototype.add = function (serviceIdentifier, value) { if (serviceIdentifier === null || serviceIdentifier === undefined) { throw new Error(ERROR_MSGS.NULL_ARGUMENT); } if (value === null || value === undefined) { throw new Error(ERROR_MSGS.NULL_ARGUMENT); } var entry = this._map.get(serviceIdentifier); if (entry !== undefined) { entry.push(value); this._map.set(serviceIdentifier, entry); } else { this._map.set(serviceIdentifier, [value]); } }; Lookup.prototype.get = function (serviceIdentifier) { if (serviceIdentifier === null || serviceIdentifier === undefined) { throw new Error(ERROR_MSGS.NULL_ARGUMENT); } var entry = this._map.get(serviceIdentifier); if (entry !== undefined) { return entry; } else { throw new Error(ERROR_MSGS.KEY_NOT_FOUND); } }; Lookup.prototype.remove = function (serviceIdentifier) { if (serviceIdentifier === null || serviceIdentifier === undefined) { throw new Error(ERROR_MSGS.NULL_ARGUMENT); } if (!this._map.delete(serviceIdentifier)) { throw new Error(ERROR_MSGS.KEY_NOT_FOUND); } }; Lookup.prototype.removeByCondition = function (condition) { var _this = this; this._map.forEach(function (entries, key) { var updatedEntries = entries.filter(function (entry) { return !condition(entry); }); if (updatedEntries.length > 0) { _this._map.set(key, updatedEntries); } else { _this._map.delete(key); } }); }; Lookup.prototype.hasKey = function (serviceIdentifier) { if (serviceIdentifier === null || serviceIdentifier === undefined) { throw new Error(ERROR_MSGS.NULL_ARGUMENT); } return this._map.has(serviceIdentifier); }; Lookup.prototype.clone = function () { var copy = new Lookup(); this._map.forEach(function (value, key) { value.forEach(function (b) { return copy.add(key, b.clone()); }); }); return copy; }; Lookup.prototype.traverse = function (func) { this._map.forEach(function (value, key) { func(key, value); }); }; return Lookup; }()); exports.Lookup = Lookup; /***/ }), /***/ 324: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const httpm = __webpack_require__(630); const path = __webpack_require__(622); const os = __webpack_require__(87); const process = __webpack_require__(765); const fs = __webpack_require__(747); const semver = __webpack_require__(280); const tl = __webpack_require__(562); const cmp = __webpack_require__(523); const uuidV4 = __webpack_require__(826); let pkg = __webpack_require__(824); let userAgent = 'vsts-task-installer/' + pkg.version; let requestOptions = { // ignoreSslError: true, proxy: tl.getHttpProxyConfiguration(), cert: tl.getHttpCertConfiguration() }; let http = new httpm.HttpClient(userAgent, null, requestOptions); tl.setResourcePath(__webpack_require__.ab + "lib.json"); function debug(message) { tl.debug(message); } exports.debug = debug; function prependPath(toolPath) { tl.assertAgent('2.115.0'); if (!toolPath) { throw new Error('Parameter toolPath must not be null or empty'); } else if (!tl.exist(toolPath) || !tl.stats(toolPath).isDirectory()) { throw new Error('Directory does not exist: ' + toolPath); } // todo: add a test for path console.log(tl.loc('TOOL_LIB_PrependPath', toolPath)); let newPath = toolPath + path.delimiter + process.env['PATH']; tl.debug('new Path: ' + newPath); process.env['PATH'] = newPath; // instruct the agent to set this path on future tasks console.log('##vso[task.prependpath]' + toolPath); } exports.prependPath = prependPath; function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } //----------------------------- // Version Functions //----------------------------- /** * Checks if a version spec is an explicit version (e.g. 1.0.1 or v1.0.1) * As opposed to a version spec like 1.x * * @param versionSpec */ function isExplicitVersion(versionSpec) { let c = semver.clean(versionSpec); tl.debug('isExplicit: ' + c); let valid = semver.valid(c) != null; tl.debug('explicit? ' + valid); return valid; } exports.isExplicitVersion = isExplicitVersion; /** * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) * and parsed version, or null if version is invalid. */ function cleanVersion(version) { tl.debug('cleaning: ' + version); return semver.clean(version); } exports.cleanVersion = cleanVersion; /** * evaluates a list of versions and returns the latest version matching the version spec * * @param versions an array of versions to evaluate * @param versionSpec a version spec (e.g. 1.x) */ function evaluateVersions(versions, versionSpec) { let version; tl.debug('evaluating ' + versions.length + ' versions'); versions = versions.sort(cmp); for (let i = versions.length - 1; i >= 0; i--) { let potential = versions[i]; let satisfied = semver.satisfies(potential, versionSpec); if (satisfied) { version = potential; break; } } if (version) { tl.debug('matched: ' + version); } else { tl.debug('match not found'); } return version; } exports.evaluateVersions = evaluateVersions; //----------------------------- // Local Tool Cache Functions //----------------------------- /** * finds the path to a tool in the local installed tool cache * * @param toolName name of the tool * @param versionSpec version of the tool * @param arch optional arch. defaults to arch of computer */ function findLocalTool(toolName, versionSpec, arch) { if (!toolName) { throw new Error('toolName parameter is required'); } if (!versionSpec) { throw new Error('versionSpec parameter is required'); } arch = arch || os.arch(); // attempt to resolve an explicit version if (!isExplicitVersion(versionSpec)) { let localVersions = findLocalToolVersions(toolName, arch); let match = evaluateVersions(localVersions, versionSpec); versionSpec = match; } // check for the explicit version in the cache let toolPath; if (versionSpec) { versionSpec = semver.clean(versionSpec); let cacheRoot = _getCacheRoot(); let cachePath = path.join(cacheRoot, toolName, versionSpec, arch); tl.debug('checking cache: ' + cachePath); if (tl.exist(cachePath) && tl.exist(`${cachePath}.complete`)) { console.log(tl.loc('TOOL_LIB_FoundInCache', toolName, versionSpec, arch)); toolPath = cachePath; } else { tl.debug('not found'); } } return toolPath; } exports.findLocalTool = findLocalTool; /** * Retrieves the versions of a tool that is intalled in the local tool cache * * @param toolName name of the tool * @param arch optional arch. defaults to arch of computer */ function findLocalToolVersions(toolName, arch) { let versions = []; arch = arch || os.arch(); let toolPath = path.join(_getCacheRoot(), toolName); if (tl.exist(toolPath)) { let children = tl.ls('', [toolPath]); children.forEach((child) => { if (isExplicitVersion(child)) { let fullPath = path.join(toolPath, child, arch); if (tl.exist(fullPath) && tl.exist(`${fullPath}.complete`)) { versions.push(child); } } }); } return versions; } exports.findLocalToolVersions = findLocalToolVersions; //--------------------- // Download Functions //--------------------- // // TODO: keep extension intact // /** * Download a tool from an url and stream it into a file * * @param url url of tool to download * @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path. */ function downloadTool(url, fileName) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { try { tl.debug(fileName); fileName = fileName || uuidV4(); // check if it's an absolute path already var destPath; if (path.isAbsolute(fileName)) { destPath = fileName; } else { destPath = path.join(_getAgentTemp(), fileName); } // make sure that the folder exists tl.mkdirP(path.dirname(destPath)); console.log(tl.loc('TOOL_LIB_Downloading', url)); tl.debug('destination ' + destPath); if (fs.existsSync(destPath)) { throw new Error("Destination file path already exists"); } tl.debug('downloading'); const statusCodesToRetry = [httpm.HttpCodes.BadGateway, httpm.HttpCodes.ServiceUnavailable, httpm.HttpCodes.GatewayTimeout]; let retryCount = 1; const maxRetries = 3; let response = yield http.get(url); while (retryCount < maxRetries && statusCodesToRetry.indexOf(response.message.statusCode) > -1) { tl.debug(`Download attempt "${retryCount}" of "${maxRetries}" failed with status code "${response.message.statusCode}".`); retryCount += 1; yield delay(1000); tl.debug(`Downloading attempt "${retryCount}" of "${maxRetries}"`); response = yield http.get(url); } if (response.message.statusCode != 200) { let err = new Error('Unexpected HTTP response: ' + response.message.statusCode); err['httpStatusCode'] = response.message.statusCode; tl.debug(`Failed to download "${fileName}" from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); throw err; } tl.debug('creating stream'); let file = fs.createWriteStream(destPath); file.on('open', (fd) => __awaiter(this, void 0, void 0, function* () { try { let stream = response.message.pipe(file); stream.on('close', () => { tl.debug('download complete'); resolve(destPath); }); } catch (err) { reject(err); } })); file.on('error', (err) => { file.end(); reject(err); }); } catch (error) { reject(error); } })); }); } exports.downloadTool = downloadTool; //--------------------- // Install Functions //--------------------- function _createToolPath(tool, version, arch) { // todo: add test for clean let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); tl.debug('destination ' + folderPath); let markerPath = `${folderPath}.complete`; tl.rmRF(folderPath); tl.rmRF(markerPath); tl.mkdirP(folderPath); return folderPath; } function _completeToolPath(tool, version, arch) { let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); let markerPath = `${folderPath}.complete`; tl.writeFile(markerPath, ''); tl.debug('finished caching tool'); } /** * Caches a directory and installs it into the tool cacheDir * * @param sourceDir the directory to cache into tools * @param tool tool name * @param version version of the tool. semver format * @param arch architecture of the tool. Optional. Defaults to machine architecture */ function cacheDir(sourceDir, tool, version, arch) { return __awaiter(this, void 0, void 0, function* () { version = semver.clean(version); arch = arch || os.arch(); console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); tl.debug('source dir: ' + sourceDir); if (!tl.stats(sourceDir).isDirectory()) { throw new Error('sourceDir is not a directory'); } // create the tool dir let destPath = _createToolPath(tool, version, arch); // copy each child item. do not move. move can fail on Windows // due to anti-virus software having an open handle on a file. for (let itemName of fs.readdirSync(sourceDir)) { let s = path.join(sourceDir, itemName); tl.cp(s, destPath + '/', '-r'); } // write .complete _completeToolPath(tool, version, arch); return destPath; }); } exports.cacheDir = cacheDir; /** * Caches a downloaded file (GUID) and installs it * into the tool cache with a given targetName * * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid. * @param targetFile the name of the file name in the tools directory * @param tool tool name * @param version version of the tool. semver format * @param arch architecture of the tool. Optional. Defaults to machine architecture */ function cacheFile(sourceFile, targetFile, tool, version, arch) { return __awaiter(this, void 0, void 0, function* () { version = semver.clean(version); arch = arch || os.arch(); console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); tl.debug('source file:' + sourceFile); if (!tl.stats(sourceFile).isFile()) { throw new Error('sourceFile is not a file'); } // create the tool dir let destFolder = _createToolPath(tool, version, arch); // copy instead of move. move can fail on Windows due to // anti-virus software having an open handle on a file. let destPath = path.join(destFolder, targetFile); tl.debug('destination file' + destPath); tl.cp(sourceFile, destPath); // write .complete _completeToolPath(tool, version, arch); return destFolder; }); } exports.cacheFile = cacheFile; //--------------------- // Extract Functions //--------------------- /** * Extract a .7z file * * @param file path to the .7z file * @param dest destination directory. Optional. * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line * interface, it is smaller than the full command line interface, and it does support long paths. At the * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website. * Be sure to check the current license agreement. If 7zr.exe is bundled with your task, then the path * to 7zr.exe can be pass to this function. * @returns path to the destination directory */ function extract7z(file, dest, _7zPath) { return __awaiter(this, void 0, void 0, function* () { if (process.platform != 'win32') { throw new Error('extract7z() not supported on current OS'); } if (!file) { throw new Error("parameter 'file' is required"); } console.log(tl.loc('TOOL_LIB_ExtractingArchive')); dest = _createExtractFolder(dest); let originalCwd = process.cwd(); try { process.chdir(dest); if (_7zPath) { // extract let _7z = tl.tool(_7zPath) .arg('x') // eXtract files with full paths .arg('-bb1') // -bb[0-3] : set output log level .arg('-bd') // disable progress indicator .arg('-sccUTF-8') // set charset for for console input/output .arg(file); yield _7z.exec(); } else { // extract let escapedScript = path.join(__dirname, 'Invoke-7zdec.ps1').replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); let escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); let command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; let powershellPath = tl.which('powershell', true); let powershell = tl.tool(powershellPath) .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') .arg(command); powershell.on('stdout', (buffer) => { process.stdout.write(buffer); }); powershell.on('stderr', (buffer) => { process.stderr.write(buffer); }); yield powershell.exec({ silent: true }); } } finally { process.chdir(originalCwd); } return dest; }); } exports.extract7z = extract7z; /** * installs a tool from a tar by extracting the tar and installing it into the tool cache * * @param file file path of the tar * @param tool name of tool in the tool cache * @param version version of the tool * @param arch arch of the tool. optional. defaults to the arch of the machine * @param options IExtractOptions * @param destination destination directory. optional. */ function extractTar(file, destination) { return __awaiter(this, void 0, void 0, function* () { // mkdir -p node/4.7.0/x64 // tar xzC ./node/4.7.0/x64 -f node-v4.7.0-darwin-x64.tar.gz --strip-components 1 console.log(tl.loc('TOOL_LIB_ExtractingArchive')); let dest = _createExtractFolder(destination); let tr = tl.tool('tar'); tr.arg(['xzC', dest, '-f', file]); yield tr.exec(); return dest; }); } exports.extractTar = extractTar; function extractZip(file, destination) { return __awaiter(this, void 0, void 0, function* () { if (!file) { throw new Error("parameter 'file' is required"); } console.log(tl.loc('TOOL_LIB_ExtractingArchive')); let dest = _createExtractFolder(destination); if (process.platform == 'win32') { // build the powershell command let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines let escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); let command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`; // change the console output code page to UTF-8. // TODO: FIX WHICH: let chcpPath = tl.which('chcp.com', true); let chcpPath = path.join(process.env.windir, "system32", "chcp.com"); yield tl.exec(chcpPath, '65001'); // run powershell let powershell = tl.tool('powershell') .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') .arg(command); yield powershell.exec(); } else { let unzip = tl.tool('unzip') .arg(file); yield unzip.exec({ cwd: dest }); } return dest; }); } exports.extractZip = extractZip; function _createExtractFolder(dest) { if (!dest) { // create a temp dir dest = path.join(_getAgentTemp(), uuidV4()); } tl.mkdirP(dest); return dest; } //--------------------- // Query Functions //--------------------- // default input will be >= LTS version. drop label different than value. // v4 (LTS) would have a value of 4.x // option to always download? (not cache), TTL? /** * Scrape a web page for versions by regex * * @param url url to scrape * @param regex regex to use for version matches */ function scrape(url, regex) { return __awaiter(this, void 0, void 0, function* () { let output = yield (yield http.get(url)).readBody(); let matches = output.match(regex); let seen = {}; let versions = []; for (let i = 0; i < matches.length; i++) { let ver = semver.clean(matches[i]); if (!seen.hasOwnProperty(ver)) { seen[ver] = true; versions.push(ver); } } return versions; }); } exports.scrape = scrape; function _getCacheRoot() { tl.assertAgent('2.115.0'); let cacheRoot = tl.getVariable('Agent.ToolsDirectory'); if (!cacheRoot) { throw new Error('Agent.ToolsDirectory is not set'); } return cacheRoot; } function _getAgentTemp() { tl.assertAgent('2.115.0'); let tempDirectory = tl.getVariable('Agent.TempDirectory'); if (!tempDirectory) { throw new Error('Agent.TempDirectory is not set'); } return tempDirectory; } /***/ }), /***/ 344: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var METADATA_KEY = __webpack_require__(946); var metadata_1 = __webpack_require__(355); var decorator_utils_1 = __webpack_require__(309); function unmanaged() { return function (target, targetKey, index) { var metadata = new metadata_1.Metadata(METADATA_KEY.UNMANAGED_TAG, true); decorator_utils_1.tagParameter(target, targetKey, index, metadata); }; } exports.unmanaged = unmanaged; /***/ }), /***/ 355: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var METADATA_KEY = __webpack_require__(946); var Metadata = (function () { function Metadata(key, value) { this.key = key; this.value = value; } Metadata.prototype.toString = function () { if (this.key === METADATA_KEY.NAMED_TAG) { return "named: " + this.value.toString() + " "; } else { return "tagged: { key:" + this.key.toString() + ", value: " + this.value + " }"; } }; return Metadata; }()); exports.Metadata = Metadata; /***/ }), /***/ 357: /***/ (function(module) { module.exports = require("assert"); /***/ }), /***/ 359: /***/ (function(module, __unusedexports, __webpack_require__) { var path = __webpack_require__(622); var common = __webpack_require__(602); //@ //@ ### pwd() //@ Returns the current directory. function _pwd(options) { var pwd = path.resolve(process.cwd()); return common.ShellString(pwd); } module.exports = _pwd; /***/ }), /***/ 380: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); var path = __webpack_require__(622); //@ //@ ### 'string'.to(file) //@ //@ Examples: //@ //@ ```javascript //@ cat('input.txt').to('output.txt'); //@ ``` //@ //@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as //@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ function _to(options, file) { if (!file) common.error('wrong arguments'); if (!fs.existsSync( path.dirname(file) )) common.error('no such file or directory: ' + path.dirname(file)); try { fs.writeFileSync(file, this.toString(), 'utf8'); } catch(e) { common.error('could not write to file (code '+e.code+'): '+file, true); } } module.exports = _to; /***/ }), /***/ 388: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERRORS_MSGS = __webpack_require__(800); var METADATA_KEY = __webpack_require__(946); function injectable() { return function (target) { if (Reflect.hasOwnMetadata(METADATA_KEY.PARAM_TYPES, target)) { throw new Error(ERRORS_MSGS.DUPLICATED_INJECTABLE_DECORATOR); } var types = Reflect.getMetadata(METADATA_KEY.DESIGN_PARAM_TYPES, target) || []; Reflect.defineMetadata(METADATA_KEY.PARAM_TYPES, types, target); return target; }; } exports.injectable = injectable; /***/ }), /***/ 395: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERROR_MSGS = __webpack_require__(800); function getServiceIdentifierAsString(serviceIdentifier) { if (typeof serviceIdentifier === "function") { var _serviceIdentifier = serviceIdentifier; return _serviceIdentifier.name; } else if (typeof serviceIdentifier === "symbol") { return serviceIdentifier.toString(); } else { var _serviceIdentifier = serviceIdentifier; return _serviceIdentifier; } } exports.getServiceIdentifierAsString = getServiceIdentifierAsString; function listRegisteredBindingsForServiceIdentifier(container, serviceIdentifier, getBindings) { var registeredBindingsList = ""; var registeredBindings = getBindings(container, serviceIdentifier); if (registeredBindings.length !== 0) { registeredBindingsList = "\nRegistered bindings:"; registeredBindings.forEach(function (binding) { var name = "Object"; if (binding.implementationType !== null) { name = getFunctionName(binding.implementationType); } registeredBindingsList = registeredBindingsList + "\n " + name; if (binding.constraint.metaData) { registeredBindingsList = registeredBindingsList + " - " + binding.constraint.metaData; } }); } return registeredBindingsList; } exports.listRegisteredBindingsForServiceIdentifier = listRegisteredBindingsForServiceIdentifier; function alreadyDependencyChain(request, serviceIdentifier) { if (request.parentRequest === null) { return false; } else if (request.parentRequest.serviceIdentifier === serviceIdentifier) { return true; } else { return alreadyDependencyChain(request.parentRequest, serviceIdentifier); } } function dependencyChainToString(request) { function _createStringArr(req, result) { if (result === void 0) { result = []; } var serviceIdentifier = getServiceIdentifierAsString(req.serviceIdentifier); result.push(serviceIdentifier); if (req.parentRequest !== null) { return _createStringArr(req.parentRequest, result); } return result; } var stringArr = _createStringArr(request); return stringArr.reverse().join(" --> "); } function circularDependencyToException(request) { request.childRequests.forEach(function (childRequest) { if (alreadyDependencyChain(childRequest, childRequest.serviceIdentifier)) { var services = dependencyChainToString(childRequest); throw new Error(ERROR_MSGS.CIRCULAR_DEPENDENCY + " " + services); } else { circularDependencyToException(childRequest); } }); } exports.circularDependencyToException = circularDependencyToException; function listMetadataForTarget(serviceIdentifierString, target) { if (target.isTagged() || target.isNamed()) { var m_1 = ""; var namedTag = target.getNamedTag(); var otherTags = target.getCustomTags(); if (namedTag !== null) { m_1 += namedTag.toString() + "\n"; } if (otherTags !== null) { otherTags.forEach(function (tag) { m_1 += tag.toString() + "\n"; }); } return " " + serviceIdentifierString + "\n " + serviceIdentifierString + " - " + m_1; } else { return " " + serviceIdentifierString; } } exports.listMetadataForTarget = listMetadataForTarget; function getFunctionName(v) { if (v.name) { return v.name; } else { var name_1 = v.toString(); var match = name_1.match(/^function\s*([^\s(]+)/); return match ? match[1] : "Anonymous function: " + name_1; } } exports.getFunctionName = getFunctionName; /***/ }), /***/ 403: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var BindingCount = { MultipleBindingsAvailable: 2, NoBindingsAvailable: 0, OnlyOneBindingAvailable: 1 }; exports.BindingCount = BindingCount; /***/ }), /***/ 410: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var keys = __webpack_require__(946); exports.METADATA_KEY = keys; var container_1 = __webpack_require__(702); exports.Container = container_1.Container; var literal_types_1 = __webpack_require__(274); exports.BindingScopeEnum = literal_types_1.BindingScopeEnum; exports.BindingTypeEnum = literal_types_1.BindingTypeEnum; exports.TargetTypeEnum = literal_types_1.TargetTypeEnum; var container_module_1 = __webpack_require__(864); exports.AsyncContainerModule = container_module_1.AsyncContainerModule; exports.ContainerModule = container_module_1.ContainerModule; var injectable_1 = __webpack_require__(388); exports.injectable = injectable_1.injectable; var tagged_1 = __webpack_require__(7); exports.tagged = tagged_1.tagged; var named_1 = __webpack_require__(904); exports.named = named_1.named; var inject_1 = __webpack_require__(625); exports.inject = inject_1.inject; exports.LazyServiceIdentifer = inject_1.LazyServiceIdentifer; var optional_1 = __webpack_require__(804); exports.optional = optional_1.optional; var unmanaged_1 = __webpack_require__(344); exports.unmanaged = unmanaged_1.unmanaged; var multi_inject_1 = __webpack_require__(708); exports.multiInject = multi_inject_1.multiInject; var target_name_1 = __webpack_require__(567); exports.targetName = target_name_1.targetName; var post_construct_1 = __webpack_require__(871); exports.postConstruct = post_construct_1.postConstruct; var metadata_reader_1 = __webpack_require__(975); exports.MetadataReader = metadata_reader_1.MetadataReader; var id_1 = __webpack_require__(862); exports.id = id_1.id; var decorator_utils_1 = __webpack_require__(309); exports.decorate = decorator_utils_1.decorate; var constraint_helpers_1 = __webpack_require__(912); exports.traverseAncerstors = constraint_helpers_1.traverseAncerstors; exports.taggedConstraint = constraint_helpers_1.taggedConstraint; exports.namedConstraint = constraint_helpers_1.namedConstraint; exports.typeConstraint = constraint_helpers_1.typeConstraint; var serialization_1 = __webpack_require__(395); exports.getServiceIdentifierAsString = serialization_1.getServiceIdentifierAsString; var binding_utils_1 = __webpack_require__(96); exports.multiBindToService = binding_utils_1.multiBindToService; /***/ }), /***/ 412: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var METADATA_KEY = __webpack_require__(946); var id_1 = __webpack_require__(862); var metadata_1 = __webpack_require__(355); var queryable_string_1 = __webpack_require__(22); var Target = (function () { function Target(type, name, serviceIdentifier, namedOrTagged) { this.id = id_1.id(); this.type = type; this.serviceIdentifier = serviceIdentifier; this.name = new queryable_string_1.QueryableString(name || ""); this.metadata = new Array(); var metadataItem = null; if (typeof namedOrTagged === "string") { metadataItem = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, namedOrTagged); } else if (namedOrTagged instanceof metadata_1.Metadata) { metadataItem = namedOrTagged; } if (metadataItem !== null) { this.metadata.push(metadataItem); } } Target.prototype.hasTag = function (key) { for (var _i = 0, _a = this.metadata; _i < _a.length; _i++) { var m = _a[_i]; if (m.key === key) { return true; } } return false; }; Target.prototype.isArray = function () { return this.hasTag(METADATA_KEY.MULTI_INJECT_TAG); }; Target.prototype.matchesArray = function (name) { return this.matchesTag(METADATA_KEY.MULTI_INJECT_TAG)(name); }; Target.prototype.isNamed = function () { return this.hasTag(METADATA_KEY.NAMED_TAG); }; Target.prototype.isTagged = function () { return this.metadata.some(function (m) { return (m.key !== METADATA_KEY.INJECT_TAG) && (m.key !== METADATA_KEY.MULTI_INJECT_TAG) && (m.key !== METADATA_KEY.NAME_TAG) && (m.key !== METADATA_KEY.UNMANAGED_TAG) && (m.key !== METADATA_KEY.NAMED_TAG); }); }; Target.prototype.isOptional = function () { return this.matchesTag(METADATA_KEY.OPTIONAL_TAG)(true); }; Target.prototype.getNamedTag = function () { if (this.isNamed()) { return this.metadata.filter(function (m) { return m.key === METADATA_KEY.NAMED_TAG; })[0]; } return null; }; Target.prototype.getCustomTags = function () { if (this.isTagged()) { return this.metadata.filter(function (m) { return (m.key !== METADATA_KEY.INJECT_TAG) && (m.key !== METADATA_KEY.MULTI_INJECT_TAG) && (m.key !== METADATA_KEY.NAME_TAG) && (m.key !== METADATA_KEY.UNMANAGED_TAG) && (m.key !== METADATA_KEY.NAMED_TAG); }); } return null; }; Target.prototype.matchesNamedTag = function (name) { return this.matchesTag(METADATA_KEY.NAMED_TAG)(name); }; Target.prototype.matchesTag = function (key) { var _this = this; return function (value) { for (var _i = 0, _a = _this.metadata; _i < _a.length; _i++) { var m = _a[_i]; if (m.key === key && m.value === value) { return true; } } return false; }; }; return Target; }()); exports.Target = Target; /***/ }), /***/ 413: /***/ (function(module, __unusedexports, __webpack_require__) { module.exports = __webpack_require__(141); /***/ }), /***/ 415: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var literal_types_1 = __webpack_require__(274); var binding_when_on_syntax_1 = __webpack_require__(107); var BindingInSyntax = (function () { function BindingInSyntax(binding) { this._binding = binding; } BindingInSyntax.prototype.inRequestScope = function () { this._binding.scope = literal_types_1.BindingScopeEnum.Request; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingInSyntax.prototype.inSingletonScope = function () { this._binding.scope = literal_types_1.BindingScopeEnum.Singleton; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingInSyntax.prototype.inTransientScope = function () { this._binding.scope = literal_types_1.BindingScopeEnum.Transient; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; return BindingInSyntax; }()); exports.BindingInSyntax = BindingInSyntax; /***/ }), /***/ 417: /***/ (function(module) { module.exports = require("crypto"); /***/ }), /***/ 477: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); var path = __webpack_require__(622); var PERMS = (function (base) { return { OTHER_EXEC : base.EXEC, OTHER_WRITE : base.WRITE, OTHER_READ : base.READ, GROUP_EXEC : base.EXEC << 3, GROUP_WRITE : base.WRITE << 3, GROUP_READ : base.READ << 3, OWNER_EXEC : base.EXEC << 6, OWNER_WRITE : base.WRITE << 6, OWNER_READ : base.READ << 6, // Literal octal numbers are apparently not allowed in "strict" javascript. Using parseInt is // the preferred way, else a jshint warning is thrown. STICKY : parseInt('01000', 8), SETGID : parseInt('02000', 8), SETUID : parseInt('04000', 8), TYPE_MASK : parseInt('0770000', 8) }; })({ EXEC : 1, WRITE : 2, READ : 4 }); //@ //@ ### chmod(octal_mode || octal_string, file) //@ ### chmod(symbolic_mode, file) //@ //@ Available options: //@ //@ + `-v`: output a diagnostic for every file processed//@ //@ + `-c`: like verbose but report only when a change is made//@ //@ + `-R`: change files and directories recursively//@ //@ //@ Examples: //@ //@ ```javascript //@ chmod(755, '/Users/brandon'); //@ chmod('755', '/Users/brandon'); // same as above //@ chmod('u+x', '/Users/brandon'); //@ ``` //@ //@ Alters the permissions of a file or directory by either specifying the //@ absolute permissions in octal form or expressing the changes in symbols. //@ This command tries to mimic the POSIX behavior as much as possible. //@ Notable exceptions: //@ //@ + In symbolic modes, 'a-r' and '-r' are identical. No consideration is //@ given to the umask. //@ + There is no "quiet" option since default behavior is to run silent. function _chmod(options, mode, filePattern) { if (!filePattern) { if (options.length > 0 && options.charAt(0) === '-') { // Special case where the specified file permissions started with - to subtract perms, which // get picked up by the option parser as command flags. // If we are down by one argument and options starts with -, shift everything over. filePattern = mode; mode = options; options = ''; } else { common.error('You must specify a file.'); } } options = common.parseOptions(options, { 'R': 'recursive', 'c': 'changes', 'v': 'verbose' }); if (typeof filePattern === 'string') { filePattern = [ filePattern ]; } var files; if (options.recursive) { files = []; common.expand(filePattern).forEach(function addFile(expandedFile) { var stat = fs.lstatSync(expandedFile); if (!stat.isSymbolicLink()) { files.push(expandedFile); if (stat.isDirectory()) { // intentionally does not follow symlinks. fs.readdirSync(expandedFile).forEach(function (child) { addFile(expandedFile + '/' + child); }); } } }); } else { files = common.expand(filePattern); } files.forEach(function innerChmod(file) { file = path.resolve(file); if (!fs.existsSync(file)) { common.error('File not found: ' + file); } // When recursing, don't follow symlinks. if (options.recursive && fs.lstatSync(file).isSymbolicLink()) { return; } var perms = fs.statSync(file).mode; var type = perms & PERMS.TYPE_MASK; var newPerms = perms; if (isNaN(parseInt(mode, 8))) { // parse options mode.split(',').forEach(function (symbolicMode) { /*jshint regexdash:true */ var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i; var matches = pattern.exec(symbolicMode); if (matches) { var applyTo = matches[1]; var operator = matches[2]; var change = matches[3]; var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === ''; var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === ''; var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === ''; var changeRead = change.indexOf('r') != -1; var changeWrite = change.indexOf('w') != -1; var changeExec = change.indexOf('x') != -1; var changeSticky = change.indexOf('t') != -1; var changeSetuid = change.indexOf('s') != -1; var mask = 0; if (changeOwner) { mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0); } if (changeGroup) { mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0); } if (changeOther) { mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0); } // Sticky bit is special - it's not tied to user, group or other. if (changeSticky) { mask |= PERMS.STICKY; } switch (operator) { case '+': newPerms |= mask; break; case '-': newPerms &= ~mask; break; case '=': newPerms = type + mask; // According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared. if (fs.statSync(file).isDirectory()) { newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; } break; } if (options.verbose) { log(file + ' -> ' + newPerms.toString(8)); } if (perms != newPerms) { if (!options.verbose && options.changes) { log(file + ' -> ' + newPerms.toString(8)); } fs.chmodSync(file, newPerms); } } else { common.error('Invalid symbolic mode change: ' + symbolicMode); } }); } else { // they gave us a full number newPerms = type + parseInt(mode, 8); // POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared. if (fs.statSync(file).isDirectory()) { newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; } fs.chmodSync(file, newPerms); } }); } module.exports = _chmod; /***/ }), /***/ 479: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); __webpack_require__(307); const ioc_1 = __webpack_require__(533); const main_1 = __webpack_require__(131); const types_1 = __webpack_require__(639); const build_agent_1 = __webpack_require__(223); ioc_1.ioc.bind(types_1.TYPES.IBuildAgent).to(build_agent_1.BuildAgent); const gitVersionTool = ioc_1.ioc.get(types_1.TYPES.IGitVersionTool); const buildAgent = ioc_1.ioc.get(types_1.TYPES.IBuildAgent); main_1.run(buildAgent, gitVersionTool); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZpbGU6Ly8vRDovUHJvamVjdHMvT1NTL0dpdFRvb2xzL3VzZS1naXR2ZXJzaW9uL3NyYy9henVyZS9leGVjdXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNEJBQTBCO0FBRzFCLGdDQUE2QjtBQUM3QixrQ0FBOEI7QUFDOUIsb0NBQWlDO0FBQ2pDLCtDQUEyQztBQUUzQyxTQUFHLENBQUMsSUFBSSxDQUFjLGFBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQyxFQUFFLENBQUMsd0JBQVUsQ0FBQyxDQUFDO0FBRXhELE1BQU0sY0FBYyxHQUFHLFNBQUcsQ0FBQyxHQUFHLENBQWtCLGFBQUssQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUN2RSxNQUFNLFVBQVUsR0FBRyxTQUFHLENBQUMsR0FBRyxDQUFjLGFBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUUzRCxVQUFHLENBQUMsVUFBVSxFQUFFLGNBQWMsQ0FBQyxDQUFDIn0= /***/ }), /***/ 480: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERROR_MSGS = __webpack_require__(800); function isStackOverflowExeption(error) { return (error instanceof RangeError || error.message === ERROR_MSGS.STACK_OVERFLOW); } exports.isStackOverflowExeption = isStackOverflowExeption; /***/ }), /***/ 523: /***/ (function(module) { module.exports = function cmp (a, b) { var pa = a.split('.'); var pb = b.split('.'); for (var i = 0; i < 3; i++) { var na = Number(pa[i]); var nb = Number(pb[i]); if (na > nb) return 1; if (nb > na) return -1; if (!isNaN(na) && isNaN(nb)) return 1; if (isNaN(na) && !isNaN(nb)) return -1; } return 0; }; /***/ }), /***/ 533: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const inversify_1 = __webpack_require__(410); const common_1 = __webpack_require__(605); const types_1 = __webpack_require__(639); const ioc = new inversify_1.Container(); exports.ioc = ioc; ioc.bind(types_1.TYPES.IVersionManager).to(common_1.VersionManager); ioc.bind(types_1.TYPES.IDotnetTool).to(common_1.DotnetTool); ioc.bind(types_1.TYPES.IGitVersionTool).to(common_1.GitVersionTool); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZmlsZTovLy9EOi9Qcm9qZWN0cy9PU1MvR2l0VG9vbHMvdXNlLWdpdHZlcnNpb24vc3JjL2lvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUFzQztBQUV0QyxxQ0FBc0U7QUFFdEUsbUNBQWdDO0FBRWhDLE1BQU0sR0FBRyxHQUFHLElBQUkscUJBQVMsRUFBRSxDQUFDO0FBTW5CLGtCQUFHO0FBSlosR0FBRyxDQUFDLElBQUksQ0FBa0IsYUFBSyxDQUFDLGVBQWUsQ0FBQyxDQUFDLEVBQUUsQ0FBQyx1QkFBYyxDQUFDLENBQUM7QUFDcEUsR0FBRyxDQUFDLElBQUksQ0FBYyxhQUFLLENBQUMsV0FBVyxDQUFDLENBQUMsRUFBRSxDQUFDLG1CQUFVLENBQUMsQ0FBQztBQUN4RCxHQUFHLENBQUMsSUFBSSxDQUFrQixhQUFLLENBQUMsZUFBZSxDQUFDLENBQUMsRUFBRSxDQUFDLHVCQUFjLENBQUMsQ0FBQyJ9 /***/ }), /***/ 535: /***/ (function(module, __unusedexports, __webpack_require__) { var fs = __webpack_require__(747); var path = __webpack_require__(622); var common = __webpack_require__(602); var os = __webpack_require__(87); //@ //@ ### ln(options, source, dest) //@ ### ln(source, dest) //@ Available options: //@ //@ + `s`: symlink //@ + `f`: force //@ //@ Examples: //@ //@ ```javascript //@ ln('file', 'newlink'); //@ ln('-sf', 'file', 'existing'); //@ ``` //@ //@ Links source to dest. Use -f to force the link, should dest already exist. function _ln(options, source, dest) { options = common.parseOptions(options, { 's': 'symlink', 'f': 'force' }); if (!source || !dest) { common.error('Missing and/or '); } source = path.resolve(process.cwd(), String(source)); dest = path.resolve(process.cwd(), String(dest)); if (!fs.existsSync(source)) { common.error('Source file does not exist', true); } if (fs.existsSync(dest)) { if (!options.force) { common.error('Destination file exists', true); } fs.unlinkSync(dest); } if (options.symlink) { fs.symlinkSync(source, dest, os.platform() === "win32" ? "junction" : null); } else { fs.linkSync(source, dest, os.platform() === "win32" ? "junction" : null); } } module.exports = _ln; /***/ }), /***/ 542: /***/ (function(__unusedmodule, exports, __webpack_require__) { var common = __webpack_require__(602); var _cd = __webpack_require__(8); var path = __webpack_require__(622); // Pushd/popd/dirs internals var _dirStack = []; function _isStackIndex(index) { return (/^[\-+]\d+$/).test(index); } function _parseStackIndex(index) { if (_isStackIndex(index)) { if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd return (/^-/).test(index) ? Number(index) - 1 : Number(index); } else { common.error(index + ': directory stack index out of range'); } } else { common.error(index + ': invalid number'); } } function _actualDirStack() { return [process.cwd()].concat(_dirStack); } //@ //@ ### pushd([options,] [dir | '-N' | '+N']) //@ //@ Available options: //@ //@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. //@ //@ Arguments: //@ //@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`. //@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. //@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. //@ //@ Examples: //@ //@ ```javascript //@ // process.cwd() === '/usr' //@ pushd('/etc'); // Returns /etc /usr //@ pushd('+1'); // Returns /usr /etc //@ ``` //@ //@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack. function _pushd(options, dir) { if (_isStackIndex(options)) { dir = options; options = ''; } options = common.parseOptions(options, { 'n' : 'no-cd' }); var dirs = _actualDirStack(); if (dir === '+0') { return dirs; // +0 is a noop } else if (!dir) { if (dirs.length > 1) { dirs = dirs.splice(1, 1).concat(dirs); } else { return common.error('no other directory'); } } else if (_isStackIndex(dir)) { var n = _parseStackIndex(dir); dirs = dirs.slice(n).concat(dirs.slice(0, n)); } else { if (options['no-cd']) { dirs.splice(1, 0, dir); } else { dirs.unshift(dir); } } if (options['no-cd']) { dirs = dirs.slice(1); } else { dir = path.resolve(dirs.shift()); _cd('', dir); } _dirStack = dirs; return _dirs(''); } exports.pushd = _pushd; //@ //@ ### popd([options,] ['-N' | '+N']) //@ //@ Available options: //@ //@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. //@ //@ Arguments: //@ //@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero. //@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero. //@ //@ Examples: //@ //@ ```javascript //@ echo(process.cwd()); // '/usr' //@ pushd('/etc'); // '/etc /usr' //@ echo(process.cwd()); // '/etc' //@ popd(); // '/usr' //@ echo(process.cwd()); // '/usr' //@ ``` //@ //@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack. function _popd(options, index) { if (_isStackIndex(options)) { index = options; options = ''; } options = common.parseOptions(options, { 'n' : 'no-cd' }); if (!_dirStack.length) { return common.error('directory stack empty'); } index = _parseStackIndex(index || '+0'); if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) { index = index > 0 ? index - 1 : index; _dirStack.splice(index, 1); } else { var dir = path.resolve(_dirStack.shift()); _cd('', dir); } return _dirs(''); } exports.popd = _popd; //@ //@ ### dirs([options | '+N' | '-N']) //@ //@ Available options: //@ //@ + `-c`: Clears the directory stack by deleting all of the elements. //@ //@ Arguments: //@ //@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero. //@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero. //@ //@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified. //@ //@ See also: pushd, popd function _dirs(options, index) { if (_isStackIndex(options)) { index = options; options = ''; } options = common.parseOptions(options, { 'c' : 'clear' }); if (options['clear']) { _dirStack = []; return _dirStack; } var stack = _actualDirStack(); if (index) { index = _parseStackIndex(index); if (index < 0) { index = stack.length + index; } common.log(stack[index]); return stack[index]; } common.log(stack.join(' ')); return stack; } exports.dirs = _dirs; /***/ }), /***/ 562: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var shell = __webpack_require__(739); var childProcess = __webpack_require__(129); var fs = __webpack_require__(747); var path = __webpack_require__(622); var os = __webpack_require__(87); var minimatch = __webpack_require__(93); var im = __webpack_require__(995); var tcm = __webpack_require__(6); var trm = __webpack_require__(958); var semver = __webpack_require__(280); var TaskResult; (function (TaskResult) { TaskResult[TaskResult["Succeeded"] = 0] = "Succeeded"; TaskResult[TaskResult["SucceededWithIssues"] = 1] = "SucceededWithIssues"; TaskResult[TaskResult["Failed"] = 2] = "Failed"; TaskResult[TaskResult["Cancelled"] = 3] = "Cancelled"; TaskResult[TaskResult["Skipped"] = 4] = "Skipped"; })(TaskResult = exports.TaskResult || (exports.TaskResult = {})); var TaskState; (function (TaskState) { TaskState[TaskState["Unknown"] = 0] = "Unknown"; TaskState[TaskState["Initialized"] = 1] = "Initialized"; TaskState[TaskState["InProgress"] = 2] = "InProgress"; TaskState[TaskState["Completed"] = 3] = "Completed"; })(TaskState = exports.TaskState || (exports.TaskState = {})); var IssueType; (function (IssueType) { IssueType[IssueType["Error"] = 0] = "Error"; IssueType[IssueType["Warning"] = 1] = "Warning"; })(IssueType = exports.IssueType || (exports.IssueType = {})); var ArtifactType; (function (ArtifactType) { ArtifactType[ArtifactType["Container"] = 0] = "Container"; ArtifactType[ArtifactType["FilePath"] = 1] = "FilePath"; ArtifactType[ArtifactType["VersionControl"] = 2] = "VersionControl"; ArtifactType[ArtifactType["GitRef"] = 3] = "GitRef"; ArtifactType[ArtifactType["TfvcLabel"] = 4] = "TfvcLabel"; })(ArtifactType = exports.ArtifactType || (exports.ArtifactType = {})); var FieldType; (function (FieldType) { FieldType[FieldType["AuthParameter"] = 0] = "AuthParameter"; FieldType[FieldType["DataParameter"] = 1] = "DataParameter"; FieldType[FieldType["Url"] = 2] = "Url"; })(FieldType = exports.FieldType || (exports.FieldType = {})); /** Platforms supported by our build agent */ var Platform; (function (Platform) { Platform[Platform["Windows"] = 0] = "Windows"; Platform[Platform["MacOS"] = 1] = "MacOS"; Platform[Platform["Linux"] = 2] = "Linux"; })(Platform = exports.Platform || (exports.Platform = {})); //----------------------------------------------------- // General Helpers //----------------------------------------------------- exports.setStdStream = im._setStdStream; exports.setErrStream = im._setErrStream; //----------------------------------------------------- // Results //----------------------------------------------------- /** * Sets the result of the task. * Execution will continue. * If not set, task will be Succeeded. * If multiple calls are made to setResult the most pessimistic call wins (Failed) regardless of the order of calls. * * @param result TaskResult enum of Succeeded, SucceededWithIssues, Failed, Cancelled or Skipped. * @param message A message which will be logged as an error issue if the result is Failed. * @param done Optional. Instructs the agent the task is done. This is helpful when child processes * may still be running and prevent node from fully exiting. This argument is supported * from agent version 2.142.0 or higher (otherwise will no-op). * @returns void */ function setResult(result, message, done) { exports.debug('task result: ' + TaskResult[result]); // add an error issue if (result == TaskResult.Failed && message) { exports.error(message); } else if (result == TaskResult.SucceededWithIssues && message) { exports.warning(message); } // task.complete var properties = { 'result': TaskResult[result] }; if (done) { properties['done'] = 'true'; } exports.command('task.complete', properties, message); } exports.setResult = setResult; // // Catching all exceptions // process.on('uncaughtException', function (err) { setResult(TaskResult.Failed, exports.loc('LIB_UnhandledEx', err.message)); }); //----------------------------------------------------- // Loc Helpers //----------------------------------------------------- exports.setResourcePath = im._setResourcePath; exports.loc = im._loc; //----------------------------------------------------- // Input Helpers //----------------------------------------------------- exports.getVariable = im._getVariable; /** * Asserts the agent version is at least the specified minimum. * * @param minimum minimum version version - must be 2.104.1 or higher */ function assertAgent(minimum) { if (semver.lt(minimum, '2.104.1')) { throw new Error('assertAgent() requires the parameter to be 2.104.1 or higher'); } var agent = exports.getVariable('Agent.Version'); if (agent && semver.lt(agent, minimum)) { throw new Error("Agent version " + minimum + " or higher is required"); } } exports.assertAgent = assertAgent; /** * Gets a snapshot of the current state of all job variables available to the task. * Requires a 2.104.1 agent or higher for full functionality. * * Limitations on an agent prior to 2.104.1: * 1) The return value does not include all public variables. Only public variables * that have been added using setVariable are returned. * 2) The name returned for each secret variable is the formatted environment variable * name, not the actual variable name (unless it was set explicitly at runtime using * setVariable). * * @returns VariableInfo[] */ function getVariables() { return Object.keys(im._knownVariableMap) .map(function (key) { var info = im._knownVariableMap[key]; return { name: info.name, value: exports.getVariable(info.name), secret: info.secret }; }); } exports.getVariables = getVariables; /** * Sets a variable which will be available to subsequent tasks as well. * * @param name name of the variable to set * @param val value to set * @param secret whether variable is secret. Multi-line secrets are not allowed. Optional, defaults to false * @returns void */ function setVariable(name, val, secret) { if (secret === void 0) { secret = false; } // once a secret always a secret var key = im._getVariableKey(name); if (im._knownVariableMap.hasOwnProperty(key)) { secret = secret || im._knownVariableMap[key].secret; } // store the value var varValue = val || ''; exports.debug('set ' + name + '=' + (secret && varValue ? '********' : varValue)); if (secret) { if (varValue && varValue.match(/\r|\n/) && ("" + process.env['SYSTEM_UNSAFEALLOWMULTILINESECRET']).toUpperCase() != 'TRUE') { throw new Error(exports.loc('LIB_MultilineSecret')); } im._vault.storeSecret('SECRET_' + key, varValue); delete process.env[key]; } else { process.env[key] = varValue; } // store the metadata im._knownVariableMap[key] = { name: name, secret: secret }; // write the command exports.command('task.setvariable', { 'variable': name || '', 'issecret': (secret || false).toString() }, varValue); } exports.setVariable = setVariable; /** * Registers a value with the logger, so the value will be masked from the logs. Multi-line secrets are not allowed. * * @param val value to register */ function setSecret(val) { if (val) { if (val.match(/\r|\n/) && ("" + process.env['SYSTEM_UNSAFEALLOWMULTILINESECRET']).toUpperCase() !== 'TRUE') { throw new Error(exports.loc('LIB_MultilineSecret')); } exports.command('task.setsecret', {}, val); } } exports.setSecret = setSecret; /** * Gets the value of an input. The value is also trimmed. * If required is true and the value is not set, it will throw. * * @param name name of the input to get * @param required whether input is required. optional, defaults to false * @returns string */ function getInput(name, required) { var inval = im._vault.retrieveSecret('INPUT_' + im._getVariableKey(name)); if (inval) { inval = inval.trim(); } if (required && !inval) { throw new Error(exports.loc('LIB_InputRequired', name)); } exports.debug(name + '=' + inval); return inval; } exports.getInput = getInput; /** * Gets the value of an input and converts to a bool. Convenience. * If required is true and the value is not set, it will throw. * If required is false and the value is not set, returns false. * * @param name name of the bool input to get * @param required whether input is required. optional, defaults to false * @returns boolean */ function getBoolInput(name, required) { return (getInput(name, required) || '').toUpperCase() == "TRUE"; } exports.getBoolInput = getBoolInput; /** * Gets the value of an input and splits the value using a delimiter (space, comma, etc). * Empty values are removed. This function is useful for splitting an input containing a simple * list of items - such as build targets. * IMPORTANT: Do not use this function for splitting additional args! Instead use argString(), which * follows normal argument splitting rules and handles values encapsulated by quotes. * If required is true and the value is not set, it will throw. * * @param name name of the input to get * @param delim delimiter to split on * @param required whether input is required. optional, defaults to false * @returns string[] */ function getDelimitedInput(name, delim, required) { var inputVal = getInput(name, required); if (!inputVal) { return []; } var result = []; inputVal.split(delim).forEach(function (x) { if (x) { result.push(x); } }); return result; } exports.getDelimitedInput = getDelimitedInput; /** * Checks whether a path inputs value was supplied by the user * File paths are relative with a picker, so an empty path is the root of the repo. * Useful if you need to condition work (like append an arg) if a value was supplied * * @param name name of the path input to check * @returns boolean */ function filePathSupplied(name) { // normalize paths var pathValue = this.resolve(this.getPathInput(name) || ''); var repoRoot = this.resolve(exports.getVariable('build.sourcesDirectory') || exports.getVariable('system.defaultWorkingDirectory') || ''); var supplied = pathValue !== repoRoot; exports.debug(name + 'path supplied :' + supplied); return supplied; } exports.filePathSupplied = filePathSupplied; /** * Gets the value of a path input * It will be quoted for you if it isn't already and contains spaces * If required is true and the value is not set, it will throw. * If check is true and the path does not exist, it will throw. * * @param name name of the input to get * @param required whether input is required. optional, defaults to false * @param check whether path is checked. optional, defaults to false * @returns string */ function getPathInput(name, required, check) { var inval = getInput(name, required); if (inval) { if (check) { exports.checkPath(inval, name); } } return inval; } exports.getPathInput = getPathInput; //----------------------------------------------------- // Endpoint Helpers //----------------------------------------------------- /** * Gets the url for a service endpoint * If the url was not set and is not optional, it will throw. * * @param id name of the service endpoint * @param optional whether the url is optional * @returns string */ function getEndpointUrl(id, optional) { var urlval = process.env['ENDPOINT_URL_' + id]; if (!optional && !urlval) { throw new Error(exports.loc('LIB_EndpointNotExist', id)); } exports.debug(id + '=' + urlval); return urlval; } exports.getEndpointUrl = getEndpointUrl; /* * Gets the endpoint data parameter value with specified key for a service endpoint * If the endpoint data parameter was not set and is not optional, it will throw. * * @param id name of the service endpoint * @param key of the parameter * @param optional whether the endpoint data is optional * @returns {string} value of the endpoint data parameter */ function getEndpointDataParameter(id, key, optional) { var dataParamVal = process.env['ENDPOINT_DATA_' + id + '_' + key.toUpperCase()]; if (!optional && !dataParamVal) { throw new Error(exports.loc('LIB_EndpointDataNotExist', id, key)); } exports.debug(id + ' data ' + key + ' = ' + dataParamVal); return dataParamVal; } exports.getEndpointDataParameter = getEndpointDataParameter; /** * Gets the endpoint authorization scheme for a service endpoint * If the endpoint authorization scheme is not set and is not optional, it will throw. * * @param id name of the service endpoint * @param optional whether the endpoint authorization scheme is optional * @returns {string} value of the endpoint authorization scheme */ function getEndpointAuthorizationScheme(id, optional) { var authScheme = im._vault.retrieveSecret('ENDPOINT_AUTH_SCHEME_' + id); if (!optional && !authScheme) { throw new Error(exports.loc('LIB_EndpointAuthNotExist', id)); } exports.debug(id + ' auth scheme = ' + authScheme); return authScheme; } exports.getEndpointAuthorizationScheme = getEndpointAuthorizationScheme; /** * Gets the endpoint authorization parameter value for a service endpoint with specified key * If the endpoint authorization parameter is not set and is not optional, it will throw. * * @param id name of the service endpoint * @param key key to find the endpoint authorization parameter * @param optional optional whether the endpoint authorization scheme is optional * @returns {string} value of the endpoint authorization parameter value */ function getEndpointAuthorizationParameter(id, key, optional) { var authParam = im._vault.retrieveSecret('ENDPOINT_AUTH_PARAMETER_' + id + '_' + key.toUpperCase()); if (!optional && !authParam) { throw new Error(exports.loc('LIB_EndpointAuthNotExist', id)); } exports.debug(id + ' auth param ' + key + ' = ' + authParam); return authParam; } exports.getEndpointAuthorizationParameter = getEndpointAuthorizationParameter; /** * Gets the authorization details for a service endpoint * If the authorization was not set and is not optional, it will throw. * * @param id name of the service endpoint * @param optional whether the url is optional * @returns string */ function getEndpointAuthorization(id, optional) { var aval = im._vault.retrieveSecret('ENDPOINT_AUTH_' + id); if (!optional && !aval) { setResult(TaskResult.Failed, exports.loc('LIB_EndpointAuthNotExist', id)); } exports.debug(id + ' exists ' + (aval !== null)); var auth; try { if (aval) { auth = JSON.parse(aval); } } catch (err) { throw new Error(exports.loc('LIB_InvalidEndpointAuth', aval)); } return auth; } exports.getEndpointAuthorization = getEndpointAuthorization; //----------------------------------------------------- // SecureFile Helpers //----------------------------------------------------- /** * Gets the name for a secure file * * @param id secure file id * @returns string */ function getSecureFileName(id) { var name = process.env['SECUREFILE_NAME_' + id]; exports.debug('secure file name for id ' + id + ' = ' + name); return name; } exports.getSecureFileName = getSecureFileName; /** * Gets the secure file ticket that can be used to download the secure file contents * * @param id name of the secure file * @returns {string} secure file ticket */ function getSecureFileTicket(id) { var ticket = im._vault.retrieveSecret('SECUREFILE_TICKET_' + id); exports.debug('secure file ticket for id ' + id + ' = ' + ticket); return ticket; } exports.getSecureFileTicket = getSecureFileTicket; //----------------------------------------------------- // Task Variable Helpers //----------------------------------------------------- /** * Gets a variable value that is set by previous step from the same wrapper task. * Requires a 2.115.0 agent or higher. * * @param name name of the variable to get * @returns string */ function getTaskVariable(name) { assertAgent('2.115.0'); var inval = im._vault.retrieveSecret('VSTS_TASKVARIABLE_' + im._getVariableKey(name)); if (inval) { inval = inval.trim(); } exports.debug('task variable: ' + name + '=' + inval); return inval; } exports.getTaskVariable = getTaskVariable; /** * Sets a task variable which will only be available to subsequent steps belong to the same wrapper task. * Requires a 2.115.0 agent or higher. * * @param name name of the variable to set * @param val value to set * @param secret whether variable is secret. optional, defaults to false * @returns void */ function setTaskVariable(name, val, secret) { if (secret === void 0) { secret = false; } assertAgent('2.115.0'); var key = im._getVariableKey(name); // store the value var varValue = val || ''; exports.debug('set task variable: ' + name + '=' + (secret && varValue ? '********' : varValue)); im._vault.storeSecret('VSTS_TASKVARIABLE_' + key, varValue); delete process.env[key]; // write the command exports.command('task.settaskvariable', { 'variable': name || '', 'issecret': (secret || false).toString() }, varValue); } exports.setTaskVariable = setTaskVariable; //----------------------------------------------------- // Cmd Helpers //----------------------------------------------------- exports.command = im._command; exports.warning = im._warning; exports.error = im._error; exports.debug = im._debug; //----------------------------------------------------- // Disk Functions //----------------------------------------------------- function _checkShell(cmd, continueOnError) { var se = shell.error(); if (se) { exports.debug(cmd + ' failed'); var errMsg = exports.loc('LIB_OperationFailed', cmd, se); exports.debug(errMsg); if (!continueOnError) { throw new Error(errMsg); } } } /** * Get's stat on a path. * Useful for checking whether a file or directory. Also getting created, modified and accessed time. * see [fs.stat](https://nodejs.org/api/fs.html#fs_class_fs_stats) * * @param path path to check * @returns fsStat */ function stats(path) { return fs.statSync(path); } exports.stats = stats; exports.exist = im._exist; function writeFile(file, data, options) { if (typeof (options) === 'string') { fs.writeFileSync(file, data, { encoding: options }); } else { fs.writeFileSync(file, data, options); } } exports.writeFile = writeFile; /** * @deprecated Use `getPlatform` * Useful for determining the host operating system. * see [os.type](https://nodejs.org/api/os.html#os_os_type) * * @return the name of the operating system */ function osType() { return os.type(); } exports.osType = osType; /** * Determine the operating system the build agent is running on. * @returns {Platform} * @throws {Error} Platform is not supported by our agent */ function getPlatform() { switch (process.platform) { case 'win32': return Platform.Windows; case 'darwin': return Platform.MacOS; case 'linux': return Platform.Linux; default: throw Error(exports.loc('LIB_PlatformNotSupported', process.platform)); } } exports.getPlatform = getPlatform; /** * Returns the process's current working directory. * see [process.cwd](https://nodejs.org/api/process.html#process_process_cwd) * * @return the path to the current working directory of the process */ function cwd() { return process.cwd(); } exports.cwd = cwd; exports.checkPath = im._checkPath; /** * Change working directory. * * @param path new working directory path * @returns void */ function cd(path) { if (path) { shell.cd(path); _checkShell('cd'); } } exports.cd = cd; /** * Change working directory and push it on the stack * * @param path new working directory path * @returns void */ function pushd(path) { shell.pushd(path); _checkShell('pushd'); } exports.pushd = pushd; /** * Change working directory back to previously pushed directory * * @returns void */ function popd() { shell.popd(); _checkShell('popd'); } exports.popd = popd; /** * Make a directory. Creates the full path with folders in between * Will throw if it fails * * @param p path to create * @returns void */ function mkdirP(p) { if (!p) { throw new Error(exports.loc('LIB_ParameterIsRequired', 'p')); } // build a stack of directories to create var stack = []; var testDir = p; while (true) { // validate the loop is not out of control if (stack.length >= (process.env['TASKLIB_TEST_MKDIRP_FAILSAFE'] || 1000)) { // let the framework throw exports.debug('loop is out of control'); fs.mkdirSync(p); return; } exports.debug("testing directory '" + testDir + "'"); var stats_1 = void 0; try { stats_1 = fs.statSync(testDir); } catch (err) { if (err.code == 'ENOENT') { // validate the directory is not the drive root var parentDir = path.dirname(testDir); if (testDir == parentDir) { throw new Error(exports.loc('LIB_MkdirFailedInvalidDriveRoot', p, testDir)); // Unable to create directory '{p}'. Root directory does not exist: '{testDir}' } // push the dir and test the parent stack.push(testDir); testDir = parentDir; continue; } else if (err.code == 'UNKNOWN') { throw new Error(exports.loc('LIB_MkdirFailedInvalidShare', p, testDir)); // Unable to create directory '{p}'. Unable to verify the directory exists: '{testDir}'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share. } else { throw err; } } if (!stats_1.isDirectory()) { throw new Error(exports.loc('LIB_MkdirFailedFileExists', p, testDir)); // Unable to create directory '{p}'. Conflicting file exists: '{testDir}' } // testDir exists break; } // create each directory while (stack.length) { var dir = stack.pop(); // non-null because `stack.length` was truthy exports.debug("mkdir '" + dir + "'"); try { fs.mkdirSync(dir); } catch (err) { throw new Error(exports.loc('LIB_MkdirFailed', p, err.message)); // Unable to create directory '{p}'. {err.message} } } } exports.mkdirP = mkdirP; /** * Resolves a sequence of paths or path segments into an absolute path. * Calls node.js path.resolve() * Allows L0 testing with consistent path formats on Mac/Linux and Windows in the mock implementation * @param pathSegments * @returns {string} */ function resolve() { var pathSegments = []; for (var _i = 0; _i < arguments.length; _i++) { pathSegments[_i] = arguments[_i]; } var absolutePath = path.resolve.apply(this, pathSegments); exports.debug('Absolute path for pathSegments: ' + pathSegments + ' = ' + absolutePath); return absolutePath; } exports.resolve = resolve; exports.which = im._which; /** * Returns array of files in the given path, or in current directory if no path provided. See shelljs.ls * @param {string} options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..) * @param {string[]} paths Paths to search. * @return {string[]} An array of files in the given path(s). */ function ls(options, paths) { if (options) { return shell.ls(options, paths); } else { return shell.ls(paths); } } exports.ls = ls; /** * Copies a file or folder. * * @param source source path * @param dest destination path * @param options string -r, -f or -rf for recursive and force * @param continueOnError optional. whether to continue on error */ function cp(source, dest, options, continueOnError) { if (options) { shell.cp(options, source, dest); } else { shell.cp(source, dest); } _checkShell('cp', continueOnError); } exports.cp = cp; /** * Moves a path. * * @param source source path * @param dest destination path * @param options string -f or -n for force and no clobber * @param continueOnError optional. whether to continue on error */ function mv(source, dest, options, continueOnError) { if (options) { shell.mv(options, source, dest); } else { shell.mv(source, dest); } _checkShell('mv', continueOnError); } exports.mv = mv; /** * Recursively finds all paths a given path. Returns an array of paths. * * @param findPath path to search * @param options optional. defaults to { followSymbolicLinks: true }. following soft links is generally appropriate unless deleting files. * @returns string[] */ function find(findPath, options) { if (!findPath) { exports.debug('no path specified'); return []; } // normalize the path, otherwise the first result is inconsistently formatted from the rest of the results // because path.join() performs normalization. findPath = path.normalize(findPath); // debug trace the parameters exports.debug("findPath: '" + findPath + "'"); options = options || _getDefaultFindOptions(); _debugFindOptions(options); // return empty if not exists try { fs.lstatSync(findPath); } catch (err) { if (err.code == 'ENOENT') { exports.debug('0 results'); return []; } throw err; } try { var result = []; // push the first item var stack = [new _FindItem(findPath, 1)]; var traversalChain = []; // used to detect cycles var _loop_1 = function () { // pop the next item and push to the result array var item = stack.pop(); // non-null because `stack.length` was truthy result.push(item.path); // stat the item. the stat info is used further below to determine whether to traverse deeper // // stat returns info about the target of a symlink (or symlink chain), // lstat returns info about a symlink itself var stats_2 = void 0; if (options.followSymbolicLinks) { try { // use stat (following all symlinks) stats_2 = fs.statSync(item.path); } catch (err) { if (err.code == 'ENOENT' && options.allowBrokenSymbolicLinks) { // fallback to lstat (broken symlinks allowed) stats_2 = fs.lstatSync(item.path); exports.debug(" " + item.path + " (broken symlink)"); } else { throw err; } } } else if (options.followSpecifiedSymbolicLink && result.length == 1) { try { // use stat (following symlinks for the specified path and this is the specified path) stats_2 = fs.statSync(item.path); } catch (err) { if (err.code == 'ENOENT' && options.allowBrokenSymbolicLinks) { // fallback to lstat (broken symlinks allowed) stats_2 = fs.lstatSync(item.path); exports.debug(" " + item.path + " (broken symlink)"); } else { throw err; } } } else { // use lstat (not following symlinks) stats_2 = fs.lstatSync(item.path); } // note, isDirectory() returns false for the lstat of a symlink if (stats_2.isDirectory()) { exports.debug(" " + item.path + " (directory)"); if (options.followSymbolicLinks) { // get the realpath var realPath_1 = fs.realpathSync(item.path); // fixup the traversal chain to match the item level while (traversalChain.length >= item.level) { traversalChain.pop(); } // test for a cycle if (traversalChain.some(function (x) { return x == realPath_1; })) { exports.debug(' cycle detected'); return "continue"; } // update the traversal chain traversalChain.push(realPath_1); } // push the child items in reverse onto the stack var childLevel_1 = item.level + 1; var childItems = fs.readdirSync(item.path) .map(function (childName) { return new _FindItem(path.join(item.path, childName), childLevel_1); }); for (var i = childItems.length - 1; i >= 0; i--) { stack.push(childItems[i]); } } else { exports.debug(" " + item.path + " (file)"); } }; while (stack.length) { _loop_1(); } exports.debug(result.length + " results"); return result; } catch (err) { throw new Error(exports.loc('LIB_OperationFailed', 'find', err.message)); } } exports.find = find; var _FindItem = /** @class */ (function () { function _FindItem(path, level) { this.path = path; this.level = level; } return _FindItem; }()); function _debugFindOptions(options) { exports.debug("findOptions.allowBrokenSymbolicLinks: '" + options.allowBrokenSymbolicLinks + "'"); exports.debug("findOptions.followSpecifiedSymbolicLink: '" + options.followSpecifiedSymbolicLink + "'"); exports.debug("findOptions.followSymbolicLinks: '" + options.followSymbolicLinks + "'"); } function _getDefaultFindOptions() { return { allowBrokenSymbolicLinks: false, followSpecifiedSymbolicLink: true, followSymbolicLinks: true }; } /** * Prefer tl.find() and tl.match() instead. This function is for backward compatibility * when porting tasks to Node from the PowerShell or PowerShell3 execution handler. * * @param rootDirectory path to root unrooted patterns with * @param pattern include and exclude patterns * @param includeFiles whether to include files in the result. defaults to true when includeFiles and includeDirectories are both false * @param includeDirectories whether to include directories in the result * @returns string[] */ function legacyFindFiles(rootDirectory, pattern, includeFiles, includeDirectories) { if (!pattern) { throw new Error('pattern parameter cannot be empty'); } exports.debug("legacyFindFiles rootDirectory: '" + rootDirectory + "'"); exports.debug("pattern: '" + pattern + "'"); exports.debug("includeFiles: '" + includeFiles + "'"); exports.debug("includeDirectories: '" + includeDirectories + "'"); if (!includeFiles && !includeDirectories) { includeFiles = true; } // organize the patterns into include patterns and exclude patterns var includePatterns = []; var excludePatterns = []; pattern = pattern.replace(/;;/g, '\0'); for (var _i = 0, _a = pattern.split(';'); _i < _a.length; _i++) { var pat = _a[_i]; if (!pat) { continue; } pat = pat.replace(/\0/g, ';'); // determine whether include pattern and remove any include/exclude prefix. // include patterns start with +: or anything other than -: // exclude patterns start with -: var isIncludePattern = void 0; if (im._startsWith(pat, '+:')) { pat = pat.substring(2); isIncludePattern = true; } else if (im._startsWith(pat, '-:')) { pat = pat.substring(2); isIncludePattern = false; } else { isIncludePattern = true; } // validate pattern does not end with a slash if (im._endsWith(pat, '/') || (process.platform == 'win32' && im._endsWith(pat, '\\'))) { throw new Error(exports.loc('LIB_InvalidPattern', pat)); } // root the pattern if (rootDirectory && !path.isAbsolute(pat)) { pat = path.join(rootDirectory, pat); // remove trailing slash sometimes added by path.join() on Windows, e.g. // path.join('\\\\hello', 'world') => '\\\\hello\\world\\' // path.join('//hello', 'world') => '\\\\hello\\world\\' if (im._endsWith(pat, '\\')) { pat = pat.substring(0, pat.length - 1); } } if (isIncludePattern) { includePatterns.push(pat); } else { excludePatterns.push(im._legacyFindFiles_convertPatternToRegExp(pat)); } } // find and apply patterns var count = 0; var result = _legacyFindFiles_getMatchingItems(includePatterns, excludePatterns, !!includeFiles, !!includeDirectories); exports.debug('all matches:'); for (var _b = 0, result_1 = result; _b < result_1.length; _b++) { var resultItem = result_1[_b]; exports.debug(' ' + resultItem); } exports.debug('total matched: ' + result.length); return result; } exports.legacyFindFiles = legacyFindFiles; function _legacyFindFiles_getMatchingItems(includePatterns, excludePatterns, includeFiles, includeDirectories) { exports.debug('getMatchingItems()'); for (var _i = 0, includePatterns_1 = includePatterns; _i < includePatterns_1.length; _i++) { var pattern = includePatterns_1[_i]; exports.debug("includePattern: '" + pattern + "'"); } for (var _a = 0, excludePatterns_1 = excludePatterns; _a < excludePatterns_1.length; _a++) { var pattern = excludePatterns_1[_a]; exports.debug("excludePattern: " + pattern); } exports.debug('includeFiles: ' + includeFiles); exports.debug('includeDirectories: ' + includeDirectories); var allFiles = {}; var _loop_2 = function (pattern) { // determine the directory to search // // note, getDirectoryName removes redundant path separators var findPath = void 0; var starIndex = pattern.indexOf('*'); var questionIndex = pattern.indexOf('?'); if (starIndex < 0 && questionIndex < 0) { // if no wildcards are found, use the directory name portion of the path. // if there is no directory name (file name only in pattern or drive root), // this will return empty string. findPath = im._getDirectoryName(pattern); } else { // extract the directory prior to the first wildcard var index = Math.min(starIndex >= 0 ? starIndex : questionIndex, questionIndex >= 0 ? questionIndex : starIndex); findPath = im._getDirectoryName(pattern.substring(0, index)); } // note, due to this short-circuit and the above usage of getDirectoryName, this // function has the same limitations regarding drive roots as the powershell // implementation. // // also note, since getDirectoryName eliminates slash redundancies, some additional // work may be required if removal of this limitation is attempted. if (!findPath) { return "continue"; } var patternRegex = im._legacyFindFiles_convertPatternToRegExp(pattern); // find files/directories var items = find(findPath, { followSymbolicLinks: true }) .filter(function (item) { if (includeFiles && includeDirectories) { return true; } var isDir = fs.statSync(item).isDirectory(); return (includeFiles && !isDir) || (includeDirectories && isDir); }) .forEach(function (item) { var normalizedPath = process.platform == 'win32' ? item.replace(/\\/g, '/') : item; // normalize separators // **/times/** will not match C:/fun/times because there isn't a trailing slash // so try both if including directories var alternatePath = normalizedPath + "/"; // potential bug: it looks like this will result in a false // positive if the item is a regular file and not a directory var isMatch = false; if (patternRegex.test(normalizedPath) || (includeDirectories && patternRegex.test(alternatePath))) { isMatch = true; // test whether the path should be excluded for (var _i = 0, excludePatterns_2 = excludePatterns; _i < excludePatterns_2.length; _i++) { var regex = excludePatterns_2[_i]; if (regex.test(normalizedPath) || (includeDirectories && regex.test(alternatePath))) { isMatch = false; break; } } } if (isMatch) { allFiles[item] = item; } }); }; for (var _b = 0, includePatterns_2 = includePatterns; _b < includePatterns_2.length; _b++) { var pattern = includePatterns_2[_b]; _loop_2(pattern); } return Object.keys(allFiles).sort(); } /** * Remove a path recursively with force * Returns whether it succeeds * * @param path path to remove * @returns void */ function rmRF(inputPath) { exports.debug('rm -rf ' + inputPath); if (getPlatform() == Platform.Windows) { // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. try { if (fs.statSync(inputPath).isDirectory()) { exports.debug('removing directory ' + inputPath); childProcess.execSync("rd /s /q \"" + inputPath + "\""); } else { exports.debug('removing file ' + inputPath); childProcess.execSync("del /f /a \"" + inputPath + "\""); } } catch (err) { // if you try to delete a file that doesn't exist, desired result is achieved // other errors are valid if (err.code != 'ENOENT') { throw new Error(exports.loc('LIB_OperationFailed', 'rmRF', err.message)); } } // Shelling out fails to remove a symlink folder with missing source, this unlink catches that try { fs.unlinkSync(inputPath); } catch (err) { // if you try to delete a file that doesn't exist, desired result is achieved // other errors are valid if (err.code != 'ENOENT') { throw new Error(exports.loc('LIB_OperationFailed', 'rmRF', err.message)); } } } else { // get the lstats in order to workaround a bug in shelljs@0.3.0 where symlinks // with missing targets are not handled correctly by "rm('-rf', path)" var lstats = void 0; try { lstats = fs.lstatSync(inputPath); } catch (err) { // if you try to delete a file that doesn't exist, desired result is achieved // other errors are valid if (err.code == 'ENOENT') { return; } throw new Error(exports.loc('LIB_OperationFailed', 'rmRF', err.message)); } if (lstats.isDirectory()) { exports.debug('removing directory'); shell.rm('-rf', inputPath); var errMsg = shell.error(); if (errMsg) { throw new Error(exports.loc('LIB_OperationFailed', 'rmRF', errMsg)); } return; } exports.debug('removing file'); try { fs.unlinkSync(inputPath); } catch (err) { throw new Error(exports.loc('LIB_OperationFailed', 'rmRF', err.message)); } } } exports.rmRF = rmRF; /** * Exec a tool. Convenience wrapper over ToolRunner to exec with args in one call. * Output will be streamed to the live console. * Returns promise with return code * * @param tool path to tool to exec * @param args an arg string or array of args * @param options optional exec options. See IExecOptions * @returns number */ function exec(tool, args, options) { var tr = this.tool(tool); tr.on('debug', function (data) { exports.debug(data); }); if (args) { if (args instanceof Array) { tr.arg(args); } else if (typeof (args) === 'string') { tr.line(args); } } return tr.exec(options); } exports.exec = exec; /** * Exec a tool synchronously. Convenience wrapper over ToolRunner to execSync with args in one call. * Output will be *not* be streamed to the live console. It will be returned after execution is complete. * Appropriate for short running tools * Returns IExecResult with output and return code * * @param tool path to tool to exec * @param args an arg string or array of args * @param options optional exec options. See IExecSyncOptions * @returns IExecSyncResult */ function execSync(tool, args, options) { var tr = this.tool(tool); tr.on('debug', function (data) { exports.debug(data); }); if (args) { if (args instanceof Array) { tr.arg(args); } else if (typeof (args) === 'string') { tr.line(args); } } return tr.execSync(options); } exports.execSync = execSync; /** * Convenience factory to create a ToolRunner. * * @param tool path to tool to exec * @returns ToolRunner */ function tool(tool) { var tr = new trm.ToolRunner(tool); tr.on('debug', function (message) { exports.debug(message); }); return tr; } exports.tool = tool; /** * Applies glob patterns to a list of paths. Supports interleaved exclude patterns. * * @param list array of paths * @param patterns patterns to apply. supports interleaved exclude patterns. * @param patternRoot optional. default root to apply to unrooted patterns. not applied to basename-only patterns when matchBase:true. * @param options optional. defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }. */ function match(list, patterns, patternRoot, options) { // trace parameters exports.debug("patternRoot: '" + patternRoot + "'"); options = options || _getDefaultMatchOptions(); // default match options _debugMatchOptions(options); // convert pattern to an array if (typeof patterns == 'string') { patterns = [patterns]; } // hashtable to keep track of matches var map = {}; var originalOptions = options; for (var _i = 0, patterns_1 = patterns; _i < patterns_1.length; _i++) { var pattern = patterns_1[_i]; exports.debug("pattern: '" + pattern + "'"); // trim and skip empty pattern = (pattern || '').trim(); if (!pattern) { exports.debug('skipping empty pattern'); continue; } // clone match options var options_1 = im._cloneMatchOptions(originalOptions); // skip comments if (!options_1.nocomment && im._startsWith(pattern, '#')) { exports.debug('skipping comment'); continue; } // set nocomment - brace expansion could result in a leading '#' options_1.nocomment = true; // determine whether pattern is include or exclude var negateCount = 0; if (!options_1.nonegate) { while (pattern.charAt(negateCount) == '!') { negateCount++; } pattern = pattern.substring(negateCount); // trim leading '!' if (negateCount) { exports.debug("trimmed leading '!'. pattern: '" + pattern + "'"); } } var isIncludePattern = negateCount == 0 || (negateCount % 2 == 0 && !options_1.flipNegate) || (negateCount % 2 == 1 && options_1.flipNegate); // set nonegate - brace expansion could result in a leading '!' options_1.nonegate = true; options_1.flipNegate = false; // expand braces - required to accurately root patterns var expanded = void 0; var preExpanded = pattern; if (options_1.nobrace) { expanded = [pattern]; } else { // convert slashes on Windows before calling braceExpand(). unfortunately this means braces cannot // be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). exports.debug('expanding braces'); var convertedPattern = process.platform == 'win32' ? pattern.replace(/\\/g, '/') : pattern; expanded = minimatch.braceExpand(convertedPattern); } // set nobrace options_1.nobrace = true; for (var _a = 0, expanded_1 = expanded; _a < expanded_1.length; _a++) { var pattern_1 = expanded_1[_a]; if (expanded.length != 1 || pattern_1 != preExpanded) { exports.debug("pattern: '" + pattern_1 + "'"); } // trim and skip empty pattern_1 = (pattern_1 || '').trim(); if (!pattern_1) { exports.debug('skipping empty pattern'); continue; } // root the pattern when all of the following conditions are true: if (patternRoot && // patternRoot supplied !im._isRooted(pattern_1) && // AND pattern not rooted // AND matchBase:false or not basename only (!options_1.matchBase || (process.platform == 'win32' ? pattern_1.replace(/\\/g, '/') : pattern_1).indexOf('/') >= 0)) { pattern_1 = im._ensureRooted(patternRoot, pattern_1); exports.debug("rooted pattern: '" + pattern_1 + "'"); } if (isIncludePattern) { // apply the pattern exports.debug('applying include pattern against original list'); var matchResults = minimatch.match(list, pattern_1, options_1); exports.debug(matchResults.length + ' matches'); // union the results for (var _b = 0, matchResults_1 = matchResults; _b < matchResults_1.length; _b++) { var matchResult = matchResults_1[_b]; map[matchResult] = true; } } else { // apply the pattern exports.debug('applying exclude pattern against original list'); var matchResults = minimatch.match(list, pattern_1, options_1); exports.debug(matchResults.length + ' matches'); // substract the results for (var _c = 0, matchResults_2 = matchResults; _c < matchResults_2.length; _c++) { var matchResult = matchResults_2[_c]; delete map[matchResult]; } } } } // return a filtered version of the original list (preserves order and prevents duplication) var result = list.filter(function (item) { return map.hasOwnProperty(item); }); exports.debug(result.length + ' final results'); return result; } exports.match = match; /** * Filter to apply glob patterns * * @param pattern pattern to apply * @param options optional. defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }. */ function filter(pattern, options) { options = options || _getDefaultMatchOptions(); return minimatch.filter(pattern, options); } exports.filter = filter; function _debugMatchOptions(options) { exports.debug("matchOptions.debug: '" + options.debug + "'"); exports.debug("matchOptions.nobrace: '" + options.nobrace + "'"); exports.debug("matchOptions.noglobstar: '" + options.noglobstar + "'"); exports.debug("matchOptions.dot: '" + options.dot + "'"); exports.debug("matchOptions.noext: '" + options.noext + "'"); exports.debug("matchOptions.nocase: '" + options.nocase + "'"); exports.debug("matchOptions.nonull: '" + options.nonull + "'"); exports.debug("matchOptions.matchBase: '" + options.matchBase + "'"); exports.debug("matchOptions.nocomment: '" + options.nocomment + "'"); exports.debug("matchOptions.nonegate: '" + options.nonegate + "'"); exports.debug("matchOptions.flipNegate: '" + options.flipNegate + "'"); } function _getDefaultMatchOptions() { return { debug: false, nobrace: true, noglobstar: false, dot: true, noext: false, nocase: process.platform == 'win32', nonull: false, matchBase: false, nocomment: false, nonegate: false, flipNegate: false }; } /** * Determines the find root from a list of patterns. Performs the find and then applies the glob patterns. * Supports interleaved exclude patterns. Unrooted patterns are rooted using defaultRoot, unless * matchOptions.matchBase is specified and the pattern is a basename only. For matchBase cases, the * defaultRoot is used as the find root. * * @param defaultRoot default path to root unrooted patterns. falls back to System.DefaultWorkingDirectory or process.cwd(). * @param patterns pattern or array of patterns to apply * @param findOptions defaults to { followSymbolicLinks: true }. following soft links is generally appropriate unless deleting files. * @param matchOptions defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' } */ function findMatch(defaultRoot, patterns, findOptions, matchOptions) { // apply defaults for parameters and trace defaultRoot = defaultRoot || this.getVariable('system.defaultWorkingDirectory') || process.cwd(); exports.debug("defaultRoot: '" + defaultRoot + "'"); patterns = patterns || []; patterns = typeof patterns == 'string' ? [patterns] : patterns; findOptions = findOptions || _getDefaultFindOptions(); _debugFindOptions(findOptions); matchOptions = matchOptions || _getDefaultMatchOptions(); _debugMatchOptions(matchOptions); // normalize slashes for root dir defaultRoot = im._normalizeSeparators(defaultRoot); var results = {}; var originalMatchOptions = matchOptions; for (var _i = 0, _a = (patterns || []); _i < _a.length; _i++) { var pattern = _a[_i]; exports.debug("pattern: '" + pattern + "'"); // trim and skip empty pattern = (pattern || '').trim(); if (!pattern) { exports.debug('skipping empty pattern'); continue; } // clone match options var matchOptions_1 = im._cloneMatchOptions(originalMatchOptions); // skip comments if (!matchOptions_1.nocomment && im._startsWith(pattern, '#')) { exports.debug('skipping comment'); continue; } // set nocomment - brace expansion could result in a leading '#' matchOptions_1.nocomment = true; // determine whether pattern is include or exclude var negateCount = 0; if (!matchOptions_1.nonegate) { while (pattern.charAt(negateCount) == '!') { negateCount++; } pattern = pattern.substring(negateCount); // trim leading '!' if (negateCount) { exports.debug("trimmed leading '!'. pattern: '" + pattern + "'"); } } var isIncludePattern = negateCount == 0 || (negateCount % 2 == 0 && !matchOptions_1.flipNegate) || (negateCount % 2 == 1 && matchOptions_1.flipNegate); // set nonegate - brace expansion could result in a leading '!' matchOptions_1.nonegate = true; matchOptions_1.flipNegate = false; // expand braces - required to accurately interpret findPath var expanded = void 0; var preExpanded = pattern; if (matchOptions_1.nobrace) { expanded = [pattern]; } else { // convert slashes on Windows before calling braceExpand(). unfortunately this means braces cannot // be escaped on Windows, this limitation is consistent with current limitations of minimatch (3.0.3). exports.debug('expanding braces'); var convertedPattern = process.platform == 'win32' ? pattern.replace(/\\/g, '/') : pattern; expanded = minimatch.braceExpand(convertedPattern); } // set nobrace matchOptions_1.nobrace = true; for (var _b = 0, expanded_2 = expanded; _b < expanded_2.length; _b++) { var pattern_2 = expanded_2[_b]; if (expanded.length != 1 || pattern_2 != preExpanded) { exports.debug("pattern: '" + pattern_2 + "'"); } // trim and skip empty pattern_2 = (pattern_2 || '').trim(); if (!pattern_2) { exports.debug('skipping empty pattern'); continue; } if (isIncludePattern) { // determine the findPath var findInfo = im._getFindInfoFromPattern(defaultRoot, pattern_2, matchOptions_1); var findPath = findInfo.findPath; exports.debug("findPath: '" + findPath + "'"); if (!findPath) { exports.debug('skipping empty path'); continue; } // perform the find exports.debug("statOnly: '" + findInfo.statOnly + "'"); var findResults = []; if (findInfo.statOnly) { // simply stat the path - all path segments were used to build the path try { fs.statSync(findPath); findResults.push(findPath); } catch (err) { if (err.code != 'ENOENT') { throw err; } exports.debug('ENOENT'); } } else { findResults = find(findPath, findOptions); } exports.debug("found " + findResults.length + " paths"); // apply the pattern exports.debug('applying include pattern'); if (findInfo.adjustedPattern != pattern_2) { exports.debug("adjustedPattern: '" + findInfo.adjustedPattern + "'"); pattern_2 = findInfo.adjustedPattern; } var matchResults = minimatch.match(findResults, pattern_2, matchOptions_1); exports.debug(matchResults.length + ' matches'); // union the results for (var _c = 0, matchResults_3 = matchResults; _c < matchResults_3.length; _c++) { var matchResult = matchResults_3[_c]; var key = process.platform == 'win32' ? matchResult.toUpperCase() : matchResult; results[key] = matchResult; } } else { // check if basename only and matchBase=true if (matchOptions_1.matchBase && !im._isRooted(pattern_2) && (process.platform == 'win32' ? pattern_2.replace(/\\/g, '/') : pattern_2).indexOf('/') < 0) { // do not root the pattern exports.debug('matchBase and basename only'); } else { // root the exclude pattern pattern_2 = im._ensurePatternRooted(defaultRoot, pattern_2); exports.debug("after ensurePatternRooted, pattern: '" + pattern_2 + "'"); } // apply the pattern exports.debug('applying exclude pattern'); var matchResults = minimatch.match(Object.keys(results).map(function (key) { return results[key]; }), pattern_2, matchOptions_1); exports.debug(matchResults.length + ' matches'); // substract the results for (var _d = 0, matchResults_4 = matchResults; _d < matchResults_4.length; _d++) { var matchResult = matchResults_4[_d]; var key = process.platform == 'win32' ? matchResult.toUpperCase() : matchResult; delete results[key]; } } } } var finalResult = Object.keys(results) .map(function (key) { return results[key]; }) .sort(); exports.debug(finalResult.length + ' final results'); return finalResult; } exports.findMatch = findMatch; /** * Gets http proxy configuration used by Build/Release agent * * @return ProxyConfiguration */ function getHttpProxyConfiguration(requestUrl) { var proxyUrl = exports.getVariable('Agent.ProxyUrl'); if (proxyUrl && proxyUrl.length > 0) { var proxyUsername = exports.getVariable('Agent.ProxyUsername'); var proxyPassword = exports.getVariable('Agent.ProxyPassword'); var proxyBypassHosts = JSON.parse(exports.getVariable('Agent.ProxyBypassList') || '[]'); var bypass_1 = false; if (requestUrl) { proxyBypassHosts.forEach(function (bypassHost) { if (new RegExp(bypassHost, 'i').test(requestUrl)) { bypass_1 = true; } }); } if (bypass_1) { return null; } else { return { proxyUrl: proxyUrl, proxyUsername: proxyUsername, proxyPassword: proxyPassword, proxyBypassHosts: proxyBypassHosts }; } } else { return null; } } exports.getHttpProxyConfiguration = getHttpProxyConfiguration; /** * Gets http certificate configuration used by Build/Release agent * * @return CertConfiguration */ function getHttpCertConfiguration() { var ca = exports.getVariable('Agent.CAInfo'); var clientCert = exports.getVariable('Agent.ClientCert'); if (ca || clientCert) { var certConfig = {}; certConfig.caFile = ca; certConfig.certFile = clientCert; if (clientCert) { var clientCertKey = exports.getVariable('Agent.ClientCertKey'); var clientCertArchive = exports.getVariable('Agent.ClientCertArchive'); var clientCertPassword = exports.getVariable('Agent.ClientCertPassword'); certConfig.keyFile = clientCertKey; certConfig.certArchiveFile = clientCertArchive; certConfig.passphrase = clientCertPassword; } return certConfig; } else { return null; } } exports.getHttpCertConfiguration = getHttpCertConfiguration; //----------------------------------------------------- // Test Publisher //----------------------------------------------------- var TestPublisher = /** @class */ (function () { function TestPublisher(testRunner) { this.testRunner = testRunner; } TestPublisher.prototype.publish = function (resultFiles, mergeResults, platform, config, runTitle, publishRunAttachments, testRunSystem) { // Could have used an initializer, but wanted to avoid reordering parameters when converting to strict null checks // (A parameter cannot both be optional and have an initializer) testRunSystem = testRunSystem || "VSTSTask"; var properties = {}; properties['type'] = this.testRunner; if (mergeResults) { properties['mergeResults'] = mergeResults; } if (platform) { properties['platform'] = platform; } if (config) { properties['config'] = config; } if (runTitle) { properties['runTitle'] = runTitle; } if (publishRunAttachments) { properties['publishRunAttachments'] = publishRunAttachments; } if (resultFiles) { properties['resultFiles'] = resultFiles; } properties['testRunSystem'] = testRunSystem; exports.command('results.publish', properties, ''); }; return TestPublisher; }()); exports.TestPublisher = TestPublisher; //----------------------------------------------------- // Code coverage Publisher //----------------------------------------------------- var CodeCoveragePublisher = /** @class */ (function () { function CodeCoveragePublisher() { } CodeCoveragePublisher.prototype.publish = function (codeCoverageTool, summaryFileLocation, reportDirectory, additionalCodeCoverageFiles) { var properties = {}; if (codeCoverageTool) { properties['codecoveragetool'] = codeCoverageTool; } if (summaryFileLocation) { properties['summaryfile'] = summaryFileLocation; } if (reportDirectory) { properties['reportdirectory'] = reportDirectory; } if (additionalCodeCoverageFiles) { properties['additionalcodecoveragefiles'] = additionalCodeCoverageFiles; } exports.command('codecoverage.publish', properties, ""); }; return CodeCoveragePublisher; }()); exports.CodeCoveragePublisher = CodeCoveragePublisher; //----------------------------------------------------- // Code coverage Publisher //----------------------------------------------------- var CodeCoverageEnabler = /** @class */ (function () { function CodeCoverageEnabler(buildTool, ccTool) { this.buildTool = buildTool; this.ccTool = ccTool; } CodeCoverageEnabler.prototype.enableCodeCoverage = function (buildProps) { buildProps['buildtool'] = this.buildTool; buildProps['codecoveragetool'] = this.ccTool; exports.command('codecoverage.enable', buildProps, ""); }; return CodeCoverageEnabler; }()); exports.CodeCoverageEnabler = CodeCoverageEnabler; //----------------------------------------------------- // Task Logging Commands //----------------------------------------------------- /** * Upload user interested file as additional log information * to the current timeline record. * * The file shall be available for download along with task logs. * * @param path Path to the file that should be uploaded. * @returns void */ function uploadFile(path) { exports.command("task.uploadfile", null, path); } exports.uploadFile = uploadFile; /** * Instruction for the agent to update the PATH environment variable. * The specified directory is prepended to the PATH. * The updated environment variable will be reflected in subsequent tasks. * * @param path Local directory path. * @returns void */ function prependPath(path) { assertAgent("2.115.0"); exports.command("task.prependpath", null, path); } exports.prependPath = prependPath; /** * Upload and attach summary markdown to current timeline record. * This summary shall be added to the build/release summary and * not available for download with logs. * * @param path Local directory path. * @returns void */ function uploadSummary(path) { exports.command("task.uploadsummary", null, path); } exports.uploadSummary = uploadSummary; /** * Upload and attach attachment to current timeline record. * These files are not available for download with logs. * These can only be referred to by extensions using the type or name values. * * @param type Attachment type. * @param name Attachment name. * @param path Attachment path. * @returns void */ function addAttachment(type, name, path) { exports.command("task.addattachment", { "type": type, "name": name }, path); } exports.addAttachment = addAttachment; /** * Set an endpoint field with given value. * Value updated will be retained in the endpoint for * the subsequent tasks that execute within the same job. * * @param id Endpoint id. * @param field FieldType enum of AuthParameter, DataParameter or Url. * @param key Key. * @param value Value for key or url. * @returns void */ function setEndpoint(id, field, key, value) { exports.command("task.setendpoint", { "id": id, "field": FieldType[field].toLowerCase(), "key": key }, value); } exports.setEndpoint = setEndpoint; /** * Set progress and current operation for current task. * * @param percent Percentage of completion. * @param currentOperation Current pperation. * @returns void */ function setProgress(percent, currentOperation) { exports.command("task.setprogress", { "value": "" + percent }, currentOperation); } exports.setProgress = setProgress; /** * Indicates whether to write the logging command directly to the host or to the output pipeline. * * @param id Timeline record Guid. * @param parentId Parent timeline record Guid. * @param recordType Record type. * @param recordName Record name. * @param order Order of timeline record. * @param startTime Start time. * @param finishTime End time. * @param progress Percentage of completion. * @param state TaskState enum of Unknown, Initialized, InProgress or Completed. * @param result TaskResult enum of Succeeded, SucceededWithIssues, Failed, Cancelled or Skipped. * @param message current operation * @returns void */ function logDetail(id, message, parentId, recordType, recordName, order, startTime, finishTime, progress, state, result) { var properties = { "id": id, "parentid": parentId, "type": recordType, "name": recordName, "order": order ? order.toString() : undefined, "starttime": startTime, "finishtime": finishTime, "progress": progress ? progress.toString() : undefined, "state": state ? TaskState[state] : undefined, "result": result ? TaskResult[result] : undefined }; exports.command("task.logdetail", properties, message); } exports.logDetail = logDetail; /** * Log error or warning issue to timeline record of current task. * * @param type IssueType enum of Error or Warning. * @param sourcePath Source file location. * @param lineNumber Line number. * @param columnNumber Column number. * @param code Error or warning code. * @param message Error or warning message. * @returns void */ function logIssue(type, message, sourcePath, lineNumber, columnNumber, errorCode) { var properties = { "type": IssueType[type].toLowerCase(), "code": errorCode, "sourcepath": sourcePath, "linenumber": lineNumber ? lineNumber.toString() : undefined, "columnnumber": columnNumber ? columnNumber.toString() : undefined, }; exports.command("task.logissue", properties, message); } exports.logIssue = logIssue; //----------------------------------------------------- // Artifact Logging Commands //----------------------------------------------------- /** * Upload user interested file as additional log information * to the current timeline record. * * The file shall be available for download along with task logs. * * @param containerFolder Folder that the file will upload to, folder will be created if needed. * @param path Path to the file that should be uploaded. * @param name Artifact name. * @returns void */ function uploadArtifact(containerFolder, path, name) { exports.command("artifact.upload", { "containerfolder": containerFolder, "artifactname": name }, path); } exports.uploadArtifact = uploadArtifact; /** * Create an artifact link, artifact location is required to be * a file container path, VC path or UNC share path. * * The file shall be available for download along with task logs. * * @param name Artifact name. * @param path Path to the file that should be associated. * @param artifactType ArtifactType enum of Container, FilePath, VersionControl, GitRef or TfvcLabel. * @returns void */ function associateArtifact(name, path, artifactType) { exports.command("artifact.associate", { "type": ArtifactType[artifactType].toLowerCase(), "artifactname": name }, path); } exports.associateArtifact = associateArtifact; //----------------------------------------------------- // Build Logging Commands //----------------------------------------------------- /** * Upload user interested log to build’s container “logs\tool” folder. * * @param path Path to the file that should be uploaded. * @returns void */ function uploadBuildLog(path) { exports.command("build.uploadlog", null, path); } exports.uploadBuildLog = uploadBuildLog; /** * Update build number for current build. * * @param value Value to be assigned as the build number. * @returns void */ function updateBuildNumber(value) { exports.command("build.updatebuildnumber", null, value); } exports.updateBuildNumber = updateBuildNumber; /** * Add a tag for current build. * * @param value Tag value. * @returns void */ function addBuildTag(value) { exports.command("build.addbuildtag", null, value); } exports.addBuildTag = addBuildTag; //----------------------------------------------------- // Release Logging Commands //----------------------------------------------------- /** * Update release name for current release. * * @param value Value to be assigned as the release name. * @returns void */ function updateReleaseName(name) { assertAgent("2.132"); exports.command("release.updatereleasename", null, name); } exports.updateReleaseName = updateReleaseName; //----------------------------------------------------- // Tools //----------------------------------------------------- exports.TaskCommand = tcm.TaskCommand; exports.commandFromString = tcm.commandFromString; exports.ToolRunner = trm.ToolRunner; //----------------------------------------------------- // Validation Checks //----------------------------------------------------- // async await needs generators in node 4.x+ if (semver.lt(process.versions.node, '4.2.0')) { this.warning('Tasks require a new agent. Upgrade your agent or node to 4.2.0 or later'); } //------------------------------------------------------------------- // Populate the vault with sensitive data. Inputs and Endpoints //------------------------------------------------------------------- // avoid loading twice (overwrites .taskkey) if (!global['_vsts_task_lib_loaded']) { im._loadData(); im._exposeProxySettings(); im._exposeCertSettings(); } /***/ }), /***/ 567: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var METADATA_KEY = __webpack_require__(946); var metadata_1 = __webpack_require__(355); var decorator_utils_1 = __webpack_require__(309); function targetName(name) { return function (target, targetKey, index) { var metadata = new metadata_1.Metadata(METADATA_KEY.NAME_TAG, name); decorator_utils_1.tagParameter(target, targetKey, index, metadata); }; } exports.targetName = targetName; /***/ }), /***/ 574: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); //@ //@ ### echo(string [,string ...]) //@ //@ Examples: //@ //@ ```javascript //@ echo('hello world'); //@ var str = echo('hello world'); //@ ``` //@ //@ Prints string to stdout, and returns string with additional utility methods //@ like `.to()`. function _echo() { var messages = [].slice.call(arguments, 0); console.log.apply(this, messages); return common.ShellString(messages.join(' ')); } module.exports = _echo; /***/ }), /***/ 602: /***/ (function(__unusedmodule, exports, __webpack_require__) { var os = __webpack_require__(87); var fs = __webpack_require__(747); var _ls = __webpack_require__(705); // Module globals var config = { silent: false, fatal: false }; exports.config = config; var state = { error: null, currentCmd: 'shell.js', tempDir: null }; exports.state = state; var platform = os.type().match(/^Win/) ? 'win' : 'unix'; exports.platform = platform; function log() { if (!config.silent) console.log.apply(this, arguments); } exports.log = log; // Shows error message. Throws unless _continue or config.fatal are true function error(msg, _continue) { if (state.error === null) state.error = ''; state.error += state.currentCmd + ': ' + msg + '\n'; if (msg.length > 0) log(state.error); if (config.fatal) process.exit(1); if (!_continue) throw ''; } exports.error = error; // In the future, when Proxies are default, we can add methods like `.to()` to primitive strings. // For now, this is a dummy function to bookmark places we need such strings function ShellString(str) { return str; } exports.ShellString = ShellString; // Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.: // parseOptions('-a', {'a':'alice', 'b':'bob'}); function parseOptions(str, map) { if (!map) error('parseOptions() internal error: no map given'); // All options are false by default var options = {}; for (var letter in map) options[map[letter]] = false; if (!str) return options; // defaults if (typeof str !== 'string') error('parseOptions() internal error: wrong str'); // e.g. match[1] = 'Rf' for str = '-Rf' var match = str.match(/^\-(.+)/); if (!match) return options; // e.g. chars = ['R', 'f'] var chars = match[1].split(''); chars.forEach(function(c) { if (c in map) options[map[c]] = true; else error('option not recognized: '+c); }); return options; } exports.parseOptions = parseOptions; // Expands wildcards with matching (ie. existing) file names. // For example: // expand(['file*.js']) = ['file1.js', 'file2.js', ...] // (if the files 'file1.js', 'file2.js', etc, exist in the current dir) function expand(list) { var expanded = []; list.forEach(function(listEl) { // Wildcard present on directory names ? if(listEl.search(/\*[^\/]*\//) > -1 || listEl.search(/\*\*[^\/]*\//) > -1) { var match = listEl.match(/^([^*]+\/|)(.*)/); var root = match[1]; var rest = match[2]; var restRegex = rest.replace(/\*\*/g, ".*").replace(/\*/g, "[^\\/]*"); restRegex = new RegExp(restRegex); _ls('-R', root).filter(function (e) { return restRegex.test(e); }).forEach(function(file) { expanded.push(file); }); } // Wildcard present on file names ? else if (listEl.search(/\*/) > -1) { _ls('', listEl).forEach(function(file) { expanded.push(file); }); } else { expanded.push(listEl); } }); return expanded; } exports.expand = expand; // Normalizes _unlinkSync() across platforms to match Unix behavior, i.e. // file can be unlinked even if it's read-only, see https://github.com/joyent/node/issues/3006 function unlinkSync(file) { try { fs.unlinkSync(file); } catch(e) { // Try to override file permission if (e.code === 'EPERM') { fs.chmodSync(file, '0666'); fs.unlinkSync(file); } else { throw e; } } } exports.unlinkSync = unlinkSync; // e.g. 'shelljs_a5f185d0443ca...' function randomFileName() { function randomHash(count) { if (count === 1) return parseInt(16*Math.random(), 10).toString(16); else { var hash = ''; for (var i=0; i= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const fs = __webpack_require__(747); const os = __webpack_require__(87); const path = __webpack_require__(622); const semver = __webpack_require__(280); const http = __webpack_require__(874); const inversify_1 = __webpack_require__(410); const types_1 = __webpack_require__(639); let DotnetTool = class DotnetTool { constructor(buildAgent, versionManager) { this.buildAgent = buildAgent; this.versionManager = versionManager; this.httpClient = new http.HttpClient("dotnet"); } run(args) { return this.buildAgent.exec("dotnet", args); } toolInstall(toolName, versionSpec, checkLatest, includePre) { return __awaiter(this, void 0, void 0, function* () { console.log(""); console.log("--------------------------"); console.log(`Installing ${toolName} version ` + versionSpec); console.log("--------------------------"); if (this.versionManager.isExplicitVersion(versionSpec)) { checkLatest = false; // check latest doesn't make sense when explicit version } let toolPath; if (!checkLatest) { // // Let's try and resolve the version spec locally first // toolPath = this.buildAgent.find(toolName, versionSpec); } if (!toolPath) { let version; if (this.versionManager.isExplicitVersion(versionSpec)) { // // Explicit version was specified. No need to query for list of versions. // version = versionSpec; } else { // // Let's query and resolve the latest version for the versionSpec. // If the version is an explicit version (1.1.1 or v1.1.1) then no need to query. // If your tool doesn't offer a mechanism to query, // then it can only support exact version inputs. // version = yield this.queryLatestMatch(toolName, versionSpec, includePre); if (!version) { throw new Error(`Unable to find ${toolName} version '${versionSpec}'.`); } // // Check the cache for the resolved version. // toolPath = this.buildAgent.find(toolName, version); } if (!toolPath) { // // Download, extract, cache // toolPath = yield this.acquireTool(toolName, version); } } // // Prepend the tools path. This prepends the PATH for the current process and // instructs the agent to prepend for each task that follows. // this.buildAgent.debug(`toolPath: ${toolPath}`); if (os.platform() !== "win32") { const dotnetRoot = path.dirname(fs.readlinkSync(yield this.buildAgent.which("dotnet"))); this.buildAgent.exportVariable("DOTNET_ROOT", dotnetRoot); } this.buildAgent.addPath(toolPath); return toolPath; }); } queryLatestMatch(toolName, versionSpec, includePrerelease) { return __awaiter(this, void 0, void 0, function* () { this.buildAgent.debug(`querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ""} ${includePrerelease ? "including pre-releases" : ""}`); const downloadPath = `https://api-v2v3search-0.nuget.org/query?q=${encodeURIComponent(toolName.toLowerCase())}&prerelease=${includePrerelease ? "true" : "false"}&semVerLevel=2.0.0`; const res = yield this.httpClient.get(downloadPath); if (!res || res.message.statusCode !== 200) { return null; } const body = yield res.readBody(); const data = JSON.parse(body).data; const versions = data[0].versions.map((x) => x.version); if (!versions || !versions.length) { return null; } this.buildAgent.debug(`got versions: ${versions.join(", ")}`); return this.versionManager.evaluateVersions(versions, versionSpec); }); } acquireTool(toolName, version) { return __awaiter(this, void 0, void 0, function* () { const tempDirectory = yield this.buildAgent.createTempDir(); let args = ["tool", "install", toolName, "--tool-path", tempDirectory]; if (version) { version = this.versionManager.cleanVersion(version); args = args.concat(["--version", version]); } const result = yield this.run(args); const status = result.code === 0 ? "success" : "failure"; const message = result.code === 0 ? result.stdout : result.stderr; this.buildAgent.debug(`tool install result: ${status} ${message}`); if (result.code) { throw new Error("Error installing tool"); } return yield this.buildAgent.cacheDir(tempDirectory, toolName, version); }); } }; DotnetTool = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject(types_1.TYPES.IBuildAgent)), __param(1, inversify_1.inject(types_1.TYPES.IVersionManager)), __metadata("design:paramtypes", [Object, Object]) ], DotnetTool); exports.DotnetTool = DotnetTool; let GitVersionTool = class GitVersionTool { constructor(buildAgent, dotnetTool) { this.buildAgent = buildAgent; this.dotnetTool = dotnetTool; } install(versionSpec, includePrerelease) { return __awaiter(this, void 0, void 0, function* () { yield this.dotnetTool.toolInstall("GitVersion.Tool", versionSpec, false, includePrerelease); }); } run(options) { const workDir = this.getRepoDir(options.targetPath); const args = this.getArguments(workDir, options); return this.buildAgent.exec("dotnet-gitversion", args); } getRepoDir(targetPath) { let workDir; const srcDir = this.buildAgent.getSourceDir(); if (!targetPath) { workDir = srcDir; } else { if (this.buildAgent.directoryExists(targetPath)) { workDir = path.join(srcDir, targetPath); } else { throw new Error("Directory not found at " + targetPath); } } return workDir.replace(/\\/g, "/"); } getArguments(workDir, options) { const args = [ workDir, "/output", "json", ]; const { useConfigFile, configFilePath, updateAssemblyInfo, updateAssemblyInfoFilename, additionalArguments, } = options; if (useConfigFile) { if (this.buildAgent.isValidInputFile("configFilePath", configFilePath)) { args.push("/config", configFilePath); } else { throw new Error("GitVersion configuration file not found at " + configFilePath); } } if (updateAssemblyInfo) { args.push("/updateassemblyinfo"); if (this.buildAgent.isValidInputFile("updateAssemblyInfoFilename", updateAssemblyInfoFilename)) { args.push(updateAssemblyInfoFilename); } else { throw new Error("AssemblyInfoFilename file not found at " + updateAssemblyInfoFilename); } } args.push(additionalArguments); return args; } }; GitVersionTool = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject(types_1.TYPES.IBuildAgent)), __param(1, inversify_1.inject(types_1.TYPES.IDotnetTool)), __metadata("design:paramtypes", [Object, Object]) ], GitVersionTool); exports.GitVersionTool = GitVersionTool; const cmp = __webpack_require__(523); let VersionManager = class VersionManager { constructor(buildAgent) { this.buildAgent = buildAgent; } isExplicitVersion(versionSpec) { const c = semver.clean(versionSpec); this.buildAgent.debug("isExplicit: " + c); const valid = semver.valid(c) != null; this.buildAgent.debug("explicit? " + valid); return valid; } evaluateVersions(versions, versionSpec) { let version; this.buildAgent.debug("evaluating " + versions.length + " versions"); versions = versions.sort(cmp); for (let i = versions.length - 1; i >= 0; i--) { const potential = versions[i]; const satisfied = semver.satisfies(potential, versionSpec); if (satisfied) { version = potential; break; } } if (version) { this.buildAgent.debug("matched: " + version); } else { this.buildAgent.debug("match not found"); } return version; } cleanVersion(version) { this.buildAgent.debug("cleaning: " + version); return semver.clean(version); } }; VersionManager = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject(types_1.TYPES.IBuildAgent)), __metadata("design:paramtypes", [Object]) ], VersionManager); exports.VersionManager = VersionManager; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZmlsZTovLy9EOi9Qcm9qZWN0cy9PU1MvR2l0VG9vbHMvdXNlLWdpdHZlcnNpb24vc3JjL2NvbW1vbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUNBLHlCQUF5QjtBQUN6Qix5QkFBeUI7QUFDekIsNkJBQTZCO0FBQzdCLGlDQUFpQztBQUNqQyxxREFBcUQ7QUFFckQseUNBQStDO0FBRy9DLG1DQUFnQztBQUdoQyxJQUFNLFVBQVUsR0FBaEIsTUFBTSxVQUFVO0lBTVosWUFDK0IsVUFBdUIsRUFDbkIsY0FBK0I7UUFFOUQsSUFBSSxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUM7UUFDN0IsSUFBSSxDQUFDLGNBQWMsR0FBRyxjQUFjLENBQUM7UUFDckMsSUFBSSxDQUFDLFVBQVUsR0FBRyxJQUFJLElBQUksQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDcEQsQ0FBQztJQUVNLEdBQUcsQ0FBQyxJQUFjO1FBQ3JCLE9BQU8sSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQ2hELENBQUM7SUFFWSxXQUFXLENBQUMsUUFBZ0IsRUFBRSxXQUFtQixFQUFFLFdBQW9CLEVBQUUsVUFBbUI7O1lBRXJHLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLENBQUM7WUFDaEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyw0QkFBNEIsQ0FBQyxDQUFDO1lBQzFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxRQUFRLFdBQVcsR0FBRyxXQUFXLENBQUMsQ0FBQztZQUM3RCxPQUFPLENBQUMsR0FBRyxDQUFDLDRCQUE0QixDQUFDLENBQUM7WUFFMUMsSUFBSSxJQUFJLENBQUMsY0FBYyxDQUFDLGlCQUFpQixDQUFDLFdBQVcsQ0FBQyxFQUFFO2dCQUNwRCxXQUFXLEdBQUcsS0FBSyxDQUFDLENBQUMsd0RBQXdEO2FBQ2hGO1lBRUQsSUFBSSxRQUFnQixDQUFDO1lBQ3JCLElBQUksQ0FBQyxXQUFXLEVBQUU7Z0JBQ2QsRUFBRTtnQkFDRix1REFBdUQ7Z0JBQ3ZELEVBQUU7Z0JBQ0YsUUFBUSxHQUFHLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQzthQUMxRDtZQUVELElBQUksQ0FBQyxRQUFRLEVBQUU7Z0JBQ1gsSUFBSSxPQUFlLENBQUM7Z0JBQ3BCLElBQUksSUFBSSxDQUFDLGNBQWMsQ0FBQyxpQkFBaUIsQ0FBQyxXQUFXLENBQUMsRUFBRTtvQkFDcEQsRUFBRTtvQkFDRix5RUFBeUU7b0JBQ3pFLEVBQUU7b0JBQ0YsT0FBTyxHQUFHLFdBQVcsQ0FBQztpQkFDekI7cUJBQU07b0JBQ0gsRUFBRTtvQkFDRixrRUFBa0U7b0JBQ2xFLGlGQUFpRjtvQkFDakYsbURBQW1EO29CQUNuRCxpREFBaUQ7b0JBQ2pELEVBQUU7b0JBQ0YsT0FBTyxHQUFHLE1BQU0sSUFBSSxDQUFDLGdCQUFnQixDQUFDLFFBQVEsRUFBRSxXQUFXLEVBQUUsVUFBVSxDQUFDLENBQUM7b0JBQ3pFLElBQUksQ0FBQyxPQUFPLEVBQUU7d0JBQ1YsTUFBTSxJQUFJLEtBQUssQ0FBQyxrQkFBa0IsUUFBUSxhQUFhLFdBQVcsSUFBSSxDQUFDLENBQUM7cUJBQzNFO29CQUVELEVBQUU7b0JBQ0YsNENBQTRDO29CQUM1QyxFQUFFO29CQUNGLFFBQVEsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsT0FBTyxDQUFDLENBQUM7aUJBQ3REO2dCQUNELElBQUksQ0FBQyxRQUFRLEVBQUU7b0JBQ1gsRUFBRTtvQkFDRiwyQkFBMkI7b0JBQzNCLEVBQUU7b0JBQ0YsUUFBUSxHQUFHLE1BQU0sSUFBSSxDQUFDLFdBQVcsQ0FBQyxRQUFRLEVBQUUsT0FBTyxDQUFDLENBQUM7aUJBQ3hEO2FBQ0o7WUFFRCxFQUFFO1lBQ0YsNkVBQTZFO1lBQzdFLDZEQUE2RDtZQUM3RCxFQUFFO1lBQ0YsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsYUFBYSxRQUFRLEVBQUUsQ0FBQyxDQUFDO1lBRS9DLElBQUksRUFBRSxDQUFDLFFBQVEsRUFBRSxLQUFLLE9BQU8sRUFBRTtnQkFDM0IsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUMsWUFBWSxDQUFDLE1BQU0sSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUN4RixJQUFJLENBQUMsVUFBVSxDQUFDLGNBQWMsQ0FBQyxhQUFhLEVBQUUsVUFBVSxDQUFDLENBQUM7YUFDN0Q7WUFDRCxJQUFJLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztZQUVsQyxPQUFPLFFBQVEsQ0FBQztRQUNwQixDQUFDO0tBQUE7SUFFYSxnQkFBZ0IsQ0FBQyxRQUFnQixFQUFFLFdBQW1CLEVBQUUsaUJBQTBCOztZQUM1RixJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyw4QkFBOEIsUUFBUSxHQUFHLFdBQVcsQ0FBQyxDQUFDLENBQUMsSUFBSSxXQUFXLEVBQUUsQ0FBQyxDQUFDLENBQUMsRUFBRSxJQUFJLGlCQUFpQixDQUFDLENBQUMsQ0FBQyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztZQUU1SixNQUFNLFlBQVksR0FBRyw4Q0FBOEMsa0JBQWtCLENBQUMsUUFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDLGVBQWUsaUJBQWlCLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsT0FBTyxvQkFBb0IsQ0FBQztZQUNyTCxNQUFNLEdBQUcsR0FBRyxNQUFNLElBQUksQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxDQUFDO1lBRXBELElBQUksQ0FBQyxHQUFHLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxVQUFVLEtBQUssR0FBRyxFQUFFO2dCQUN4QyxPQUFPLElBQUksQ0FBQzthQUNmO1lBRUQsTUFBTSxJQUFJLEdBQVcsTUFBTSxHQUFHLENBQUMsUUFBUSxFQUFFLENBQUM7WUFDMUMsTUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUM7WUFFbkMsTUFBTSxRQUFRLEdBQUksSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLFFBQXVDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDeEYsSUFBSSxDQUFDLFFBQVEsSUFBSSxDQUFDLFFBQVEsQ0FBQyxNQUFNLEVBQUU7Z0JBQy9CLE9BQU8sSUFBSSxDQUFDO2FBQ2Y7WUFFRCxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxpQkFBaUIsUUFBUSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUM7WUFFOUQsT0FBTyxJQUFJLENBQUMsY0FBYyxDQUFDLGdCQUFnQixDQUFDLFFBQVEsRUFBRSxXQUFXLENBQUMsQ0FBQztRQUN2RSxDQUFDO0tBQUE7SUFFYSxXQUFXLENBQUMsUUFBZ0IsRUFBRSxPQUFlOztZQUV2RCxNQUFNLGFBQWEsR0FBRyxNQUFNLElBQUksQ0FBQyxVQUFVLENBQUMsYUFBYSxFQUFFLENBQUM7WUFDNUQsSUFBSSxJQUFJLEdBQUcsQ0FBQyxNQUFNLEVBQUUsU0FBUyxFQUFFLFFBQVEsRUFBRSxhQUFhLEVBQUUsYUFBYSxDQUFDLENBQUM7WUFFdkUsSUFBSSxPQUFPLEVBQUU7Z0JBQ1QsT0FBTyxHQUFHLElBQUksQ0FBQyxjQUFjLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxDQUFDO2dCQUNwRCxJQUFJLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLFdBQVcsRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFDO2FBQzlDO1lBRUQsTUFBTSxNQUFNLEdBQUcsTUFBTSxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO1lBQ3BDLE1BQU0sTUFBTSxHQUFHLE1BQU0sQ0FBQyxJQUFJLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLFNBQVMsQ0FBQztZQUN6RCxNQUFNLE9BQU8sR0FBRyxNQUFNLENBQUMsSUFBSSxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQztZQUVsRSxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyx3QkFBd0IsTUFBTSxJQUFJLE9BQU8sRUFBRSxDQUFDLENBQUM7WUFFbkUsSUFBSSxNQUFNLENBQUMsSUFBSSxFQUFFO2dCQUNiLE1BQU0sSUFBSSxLQUFLLENBQUMsdUJBQXVCLENBQUMsQ0FBQzthQUM1QztZQUVELE9BQU8sTUFBTSxJQUFJLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxhQUFhLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQzVFLENBQUM7S0FBQTtDQUNKLENBQUE7QUFsSUssVUFBVTtJQURmLHNCQUFVLEVBQUU7SUFRSixXQUFBLGtCQUFNLENBQUMsYUFBSyxDQUFDLFdBQVcsQ0FBQyxDQUFBO0lBQ3pCLFdBQUEsa0JBQU0sQ0FBQyxhQUFLLENBQUMsZUFBZSxDQUFDLENBQUE7O0dBUmhDLFVBQVUsQ0FrSWY7QUFrSUcsZ0NBQVU7QUEvSGQsSUFBTSxjQUFjLEdBQXBCLE1BQU0sY0FBYztJQUtoQixZQUMrQixVQUF1QixFQUN2QixVQUF1QjtRQUVsRCxJQUFJLENBQUMsVUFBVSxHQUFHLFVBQVUsQ0FBQztRQUM3QixJQUFJLENBQUMsVUFBVSxHQUFHLFVBQVUsQ0FBQztJQUNqQyxDQUFDO0lBRVksT0FBTyxDQUFDLFdBQW1CLEVBQUUsaUJBQTBCOztZQUNoRSxNQUFNLElBQUksQ0FBQyxVQUFVLENBQUMsV0FBVyxDQUFDLGlCQUFpQixFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsaUJBQWlCLENBQUMsQ0FBQztRQUNoRyxDQUFDO0tBQUE7SUFFTSxHQUFHLENBQUMsT0FBMkI7UUFDbEMsTUFBTSxPQUFPLEdBQUcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUM7UUFFcEQsTUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFFakQsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxtQkFBbUIsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUMzRCxDQUFDO0lBRU8sVUFBVSxDQUFDLFVBQWtCO1FBQ2pDLElBQUksT0FBZSxDQUFDO1FBQ3BCLE1BQU0sTUFBTSxHQUFHLElBQUksQ0FBQyxVQUFVLENBQUMsWUFBWSxFQUFFLENBQUM7UUFDOUMsSUFBSSxDQUFDLFVBQVUsRUFBRTtZQUNiLE9BQU8sR0FBRyxNQUFNLENBQUM7U0FDcEI7YUFBTTtZQUNILElBQUksSUFBSSxDQUFDLFVBQVUsQ0FBQyxlQUFlLENBQUMsVUFBVSxDQUFDLEVBQUU7Z0JBQzdDLE9BQU8sR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxVQUFVLENBQUMsQ0FBQzthQUMzQztpQkFBTTtnQkFDSCxNQUFNLElBQUksS0FBSyxDQUFDLHlCQUF5QixHQUFHLFVBQVUsQ0FBQyxDQUFDO2FBQzNEO1NBQ0o7UUFDRCxPQUFPLE9BQU8sQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0lBQ3ZDLENBQUM7SUFFTyxZQUFZLENBQUMsT0FBZSxFQUFFLE9BQTJCO1FBQzdELE1BQU0sSUFBSSxHQUFHO1lBQ1QsT0FBTztZQUNQLFNBQVM7WUFDVCxNQUFNO1NBQ1QsQ0FBQztRQUVGLE1BQU0sRUFDRixhQUFhLEVBQ2IsY0FBYyxFQUNkLGtCQUFrQixFQUNsQiwwQkFBMEIsRUFDMUIsbUJBQW1CLEdBQ3JCLEdBQUcsT0FBTyxDQUFDO1FBRWIsSUFBSSxhQUFhLEVBQUU7WUFDZixJQUFJLElBQUksQ0FBQyxVQUFVLENBQUMsZ0JBQWdCLENBQUMsZ0JBQWdCLEVBQUUsY0FBYyxDQUFDLEVBQUU7Z0JBQ3BFLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLGNBQWMsQ0FBQyxDQUFDO2FBQ3hDO2lCQUFNO2dCQUNILE1BQU0sSUFBSSxLQUFLLENBQUMsNkNBQTZDLEdBQUcsY0FBYyxDQUFDLENBQUM7YUFDbkY7U0FDSjtRQUNELElBQUksa0JBQWtCLEVBQUU7WUFDcEIsSUFBSSxDQUFDLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO1lBQ2pDLElBQUksSUFBSSxDQUFDLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyw0QkFBNEIsRUFBRSwwQkFBMEIsQ0FBQyxFQUFFO2dCQUM1RixJQUFJLENBQUMsSUFBSSxDQUFDLDBCQUEwQixDQUFDLENBQUM7YUFDekM7aUJBQU07Z0JBQ0gsTUFBTSxJQUFJLEtBQUssQ0FBQyx5Q0FBeUMsR0FBRywwQkFBMEIsQ0FBQyxDQUFDO2FBQzNGO1NBQ0o7UUFFRCxJQUFJLENBQUMsSUFBSSxDQUFDLG1CQUFtQixDQUFDLENBQUM7UUFDL0IsT0FBTyxJQUFJLENBQUM7SUFDaEIsQ0FBQztDQUNKLENBQUE7QUExRUssY0FBYztJQURuQixzQkFBVSxFQUFFO0lBT0osV0FBQSxrQkFBTSxDQUFDLGFBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQTtJQUN6QixXQUFBLGtCQUFNLENBQUMsYUFBSyxDQUFDLFdBQVcsQ0FBQyxDQUFBOztHQVA1QixjQUFjLENBMEVuQjtBQXNERyx3Q0FBYztBQXBEbEIsTUFBTSxHQUFHLEdBQUcsT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQUM7QUFHdEMsSUFBTSxjQUFjLEdBQXBCLE1BQU0sY0FBYztJQUdoQixZQUMrQixVQUF1QjtRQUVsRCxJQUFJLENBQUMsVUFBVSxHQUFHLFVBQVUsQ0FBQztJQUNqQyxDQUFDO0lBRU0saUJBQWlCLENBQUMsV0FBbUI7UUFDeEMsTUFBTSxDQUFDLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQztRQUNwQyxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxjQUFjLEdBQUcsQ0FBQyxDQUFDLENBQUM7UUFFMUMsTUFBTSxLQUFLLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsSUFBSSxJQUFJLENBQUM7UUFDdEMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsWUFBWSxHQUFHLEtBQUssQ0FBQyxDQUFDO1FBRTVDLE9BQU8sS0FBSyxDQUFDO0lBQ2pCLENBQUM7SUFFTSxnQkFBZ0IsQ0FBQyxRQUFrQixFQUFFLFdBQW1CO1FBQzNELElBQUksT0FBZSxDQUFDO1FBQ3BCLElBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLGFBQWEsR0FBRyxRQUFRLENBQUMsTUFBTSxHQUFHLFdBQVcsQ0FBQyxDQUFDO1FBQ3JFLFFBQVEsR0FBRyxRQUFRLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQzlCLEtBQUssSUFBSSxDQUFDLEdBQUcsUUFBUSxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRTtZQUMvQyxNQUFNLFNBQVMsR0FBVyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDdEMsTUFBTSxTQUFTLEdBQVksTUFBTSxDQUFDLFNBQVMsQ0FBQyxTQUFTLEVBQUUsV0FBVyxDQUFDLENBQUM7WUFDcEUsSUFBSSxTQUFTLEVBQUU7Z0JBQ1gsT0FBTyxHQUFHLFNBQVMsQ0FBQztnQkFDcEIsTUFBTTthQUNUO1NBQ0o7UUFFRyxJQUFJLE9BQU8sRUFBRTtZQUNULElBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLFdBQVcsR0FBRyxPQUFPLENBQUMsQ0FBQztTQUNwRDthQUFNO1lBQ0gsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsaUJBQWlCLENBQUMsQ0FBQztTQUM1QztRQUVHLE9BQU8sT0FBTyxDQUFDO0lBQ25CLENBQUM7SUFFTSxZQUFZLENBQUMsT0FBZTtRQUMvQixJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxZQUFZLEdBQUcsT0FBTyxDQUFDLENBQUM7UUFDOUMsT0FBTyxNQUFNLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ2pDLENBQUM7Q0FDSixDQUFBO0FBN0NLLGNBQWM7SUFEbkIsc0JBQVUsRUFBRTtJQUtKLFdBQUEsa0JBQU0sQ0FBQyxhQUFLLENBQUMsV0FBVyxDQUFDLENBQUE7O0dBSjVCLGNBQWMsQ0E2Q25CO0FBS0csd0NBQWMifQ== /***/ }), /***/ 614: /***/ (function(module) { module.exports = require("events"); /***/ }), /***/ 621: /***/ (function(module) { "use strict"; module.exports = balanced; function balanced(a, b, str) { if (a instanceof RegExp) a = maybeMatch(a, str); if (b instanceof RegExp) b = maybeMatch(b, str); var r = range(a, b, str); return r && { start: r[0], end: r[1], pre: str.slice(0, r[0]), body: str.slice(r[0] + a.length, r[1]), post: str.slice(r[1] + b.length) }; } function maybeMatch(reg, str) { var m = str.match(reg); return m ? m[0] : null; } balanced.range = range; function range(a, b, str) { var begs, beg, left, right, result; var ai = str.indexOf(a); var bi = str.indexOf(b, ai + 1); var i = ai; if (ai >= 0 && bi > 0) { begs = []; left = str.length; while (i >= 0 && !result) { if (i == ai) { begs.push(i); ai = str.indexOf(a, i + 1); } else if (begs.length == 1) { result = [ begs.pop(), bi ]; } else { beg = begs.pop(); if (beg < left) { left = beg; right = bi; } bi = str.indexOf(b, i + 1); } i = ai < bi && ai >= 0 ? ai : bi; } if (begs.length) { result = [ left, right ]; } } return result; } /***/ }), /***/ 622: /***/ (function(module) { module.exports = require("path"); /***/ }), /***/ 625: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var error_msgs_1 = __webpack_require__(800); var METADATA_KEY = __webpack_require__(946); var metadata_1 = __webpack_require__(355); var decorator_utils_1 = __webpack_require__(309); var LazyServiceIdentifer = (function () { function LazyServiceIdentifer(cb) { this._cb = cb; } LazyServiceIdentifer.prototype.unwrap = function () { return this._cb(); }; return LazyServiceIdentifer; }()); exports.LazyServiceIdentifer = LazyServiceIdentifer; function inject(serviceIdentifier) { return function (target, targetKey, index) { if (serviceIdentifier === undefined) { throw new Error(error_msgs_1.UNDEFINED_INJECT_ANNOTATION(target.name)); } var metadata = new metadata_1.Metadata(METADATA_KEY.INJECT_TAG, serviceIdentifier); if (typeof index === "number") { decorator_utils_1.tagParameter(target, targetKey, index, metadata); } else { decorator_utils_1.tagProperty(target, targetKey, metadata); } }; } exports.inject = inject; /***/ }), /***/ 630: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const url = __webpack_require__(835); const http = __webpack_require__(876); const https = __webpack_require__(211); const tunnel = __webpack_require__(413); const fs = __webpack_require__(747); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; class HttpClientResponse { constructor(message) { this.message = message; } readBody() { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let output = ''; this.message.on('data', (chunk) => { output += chunk; }); this.message.on('end', () => { resolve(output); }); })); } } exports.HttpClientResponse = HttpClientResponse; function isHttps(requestUrl) { let parsedUrl = url.parse(requestUrl); return parsedUrl.protocol === 'https:'; } exports.isHttps = isHttps; var EnvironmentVariables; (function (EnvironmentVariables) { EnvironmentVariables["HTTP_PROXY"] = "HTTP_PROXY"; EnvironmentVariables["HTTPS_PROXY"] = "HTTPS_PROXY"; })(EnvironmentVariables || (EnvironmentVariables = {})); class HttpClient { constructor(userAgent, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._maxRedirects = 50; this._keepAlive = false; this._disposed = false; this.userAgent = userAgent; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { if (requestOptions.ignoreSslError != null) { this._ignoreSslError = requestOptions.ignoreSslError; } this._socketTimeout = requestOptions.socketTimeout; this._httpProxy = requestOptions.proxy; if (requestOptions.proxy && requestOptions.proxy.proxyBypassHosts) { this._httpProxyBypassHosts = []; requestOptions.proxy.proxyBypassHosts.forEach(bypass => { this._httpProxyBypassHosts.push(new RegExp(bypass, 'i')); }); } this._certConfig = requestOptions.cert; // cache the cert content into memory, so we don't have to read it from disk every time if (this._certConfig && this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) { this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8'); } if (this._certConfig && this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) { this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8'); } if (this._certConfig && this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) { this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8'); } if (requestOptions.allowRedirects != null) { this._allowRedirects = requestOptions.allowRedirects; } if (requestOptions.maxRedirects != null) { this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); } if (requestOptions.keepAlive != null) { this._keepAlive = requestOptions.keepAlive; } } } options(requestUrl, additionalHeaders) { return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); } get(requestUrl, additionalHeaders) { return this.request('GET', requestUrl, null, additionalHeaders || {}); } del(requestUrl, additionalHeaders) { return this.request('DELETE', requestUrl, null, additionalHeaders || {}); } post(requestUrl, data, additionalHeaders) { return this.request('POST', requestUrl, data, additionalHeaders || {}); } patch(requestUrl, data, additionalHeaders) { return this.request('PATCH', requestUrl, data, additionalHeaders || {}); } put(requestUrl, data, additionalHeaders) { return this.request('PUT', requestUrl, data, additionalHeaders || {}); } head(requestUrl, additionalHeaders) { return this.request('HEAD', requestUrl, null, additionalHeaders || {}); } sendStream(verb, requestUrl, stream, additionalHeaders) { return this.request(verb, requestUrl, stream, additionalHeaders); } /** * Makes a raw http request. * All other methods such as get, post, patch, and request ultimately call this. * Prefer get, del, post and patch */ request(verb, requestUrl, data, headers) { return __awaiter(this, void 0, void 0, function* () { if (this._disposed) { throw new Error("Client has already been disposed."); } let info = this._prepareRequest(verb, requestUrl, headers); let response = yield this.requestRaw(info, data); // Check if it's an authentication challenge if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { let authenticationHandler; for (let i = 0; i < this.handlers.length; i++) { if (this.handlers[i].canHandleAuthentication(response)) { authenticationHandler = this.handlers[i]; break; } } if (authenticationHandler) { return authenticationHandler.handleAuthentication(this, info, data); } else { // We have received an unauthorized response but have no handlers to handle it. // Let the response return to the caller. return response; } } let redirectsRemaining = this._maxRedirects; while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && this._allowRedirects && redirectsRemaining > 0) { const redirectUrl = response.message.headers["location"]; if (!redirectUrl) { // if there's no location to redirect to, we won't break; } // we need to finish reading the response before reassigning response // which will leak the open socket. yield response.readBody(); // let's make the request with the new redirectUrl info = this._prepareRequest(verb, redirectUrl, headers); response = yield this.requestRaw(info, data); redirectsRemaining--; } return response; }); } /** * Needs to be called if keepAlive is set to true in request options. */ dispose() { if (this._agent) { this._agent.destroy(); } this._disposed = true; } /** * Raw request. * @param info * @param data */ requestRaw(info, data) { return new Promise((resolve, reject) => { let callbackForResult = function (err, res) { if (err) { reject(err); } resolve(res); }; this.requestRawWithCallback(info, data, callbackForResult); }); } /** * Raw request with callback. * @param info * @param data * @param onResult */ requestRawWithCallback(info, data, onResult) { let socket; let isDataString = typeof (data) === 'string'; if (typeof (data) === 'string') { info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8'); } let callbackCalled = false; let handleResult = (err, res) => { if (!callbackCalled) { callbackCalled = true; onResult(err, res); } }; let req = info.httpModule.request(info.options, (msg) => { let res = new HttpClientResponse(msg); handleResult(null, res); }); req.on('socket', (sock) => { socket = sock; }); // If we ever get disconnected, we want the socket to timeout eventually req.setTimeout(this._socketTimeout || 3 * 60000, () => { if (socket) { socket.end(); } handleResult(new Error('Request timeout: ' + info.options.path), null); }); req.on('error', function (err) { // err has statusCode property // res should have headers handleResult(err, null); }); if (data && typeof (data) === 'string') { req.write(data, 'utf8'); } if (data && typeof (data) !== 'string') { data.on('close', function () { req.end(); }); data.pipe(req); } else { req.end(); } } _prepareRequest(method, requestUrl, headers) { const info = {}; info.parsedUrl = url.parse(requestUrl); const usingSsl = info.parsedUrl.protocol === 'https:'; info.httpModule = usingSsl ? https : http; const defaultPort = usingSsl ? 443 : 80; info.options = {}; info.options.host = info.parsedUrl.hostname; info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); info.options.method = method; info.options.headers = headers || {}; info.options.headers["User-Agent"] = this.userAgent; info.options.agent = this._getAgent(requestUrl); // gives handlers an opportunity to participate if (this.handlers) { this.handlers.forEach((handler) => { handler.prepareRequest(info.options); }); } return info; } _getAgent(requestUrl) { let agent; let proxy = this._getProxy(requestUrl); let useProxy = proxy.proxyUrl && proxy.proxyUrl.hostname && !this._isBypassProxy(requestUrl); if (this._keepAlive && useProxy) { agent = this._proxyAgent; } if (this._keepAlive && !useProxy) { agent = this._agent; } // if agent is already assigned use that agent. if (!!agent) { return agent; } let parsedUrl = url.parse(requestUrl); const usingSsl = parsedUrl.protocol === 'https:'; let maxSockets = 100; if (!!this.requestOptions) { maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; } if (useProxy) { const agentOptions = { maxSockets: maxSockets, keepAlive: this._keepAlive, proxy: { proxyAuth: proxy.proxyAuth, host: proxy.proxyUrl.hostname, port: proxy.proxyUrl.port }, }; let tunnelAgent; const overHttps = proxy.proxyUrl.protocol === 'https:'; if (usingSsl) { tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; } else { tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; } agent = tunnelAgent(agentOptions); this._proxyAgent = agent; } // if reusing agent across request and tunneling agent isn't assigned create a new agent if (this._keepAlive && !agent) { const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } // if not using private agent and tunnel agent isn't setup then use global agent if (!agent) { agent = usingSsl ? https.globalAgent : http.globalAgent; } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options // we have to cast it to any and change it directly agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); } if (usingSsl && this._certConfig) { agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase }); } return agent; } _getProxy(requestUrl) { const parsedUrl = url.parse(requestUrl); let usingSsl = parsedUrl.protocol === 'https:'; let proxyConfig = this._httpProxy; // fallback to http_proxy and https_proxy env let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY]; let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY]; if (!proxyConfig) { if (https_proxy && usingSsl) { proxyConfig = { proxyUrl: https_proxy }; } else if (http_proxy) { proxyConfig = { proxyUrl: http_proxy }; } } let proxyUrl; let proxyAuth; if (proxyConfig) { if (proxyConfig.proxyUrl.length > 0) { proxyUrl = url.parse(proxyConfig.proxyUrl); } if (proxyConfig.proxyUsername || proxyConfig.proxyPassword) { proxyAuth = proxyConfig.proxyUsername + ":" + proxyConfig.proxyPassword; } } return { proxyUrl: proxyUrl, proxyAuth: proxyAuth }; } _isBypassProxy(requestUrl) { if (!this._httpProxyBypassHosts) { return false; } let bypass = false; this._httpProxyBypassHosts.forEach(bypassHost => { if (bypassHost.test(requestUrl)) { bypass = true; } }); return bypass; } } exports.HttpClient = HttpClient; /***/ }), /***/ 631: /***/ (function(module) { module.exports = require("net"); /***/ }), /***/ 639: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const TYPES = { IBuildAgent: Symbol.for("BuildAgent"), IDotnetTool: Symbol.for("DotnetTool"), IGitVersionTool: Symbol.for("GitVersionTool"), IVersionManager: Symbol.for("VersionManager"), }; exports.TYPES = TYPES; const SetupOptions = { includePrerelease: "includePrerelease", versionSpec: "versionSpec", }; exports.SetupOptions = SetupOptions; const RunOptions = { targetPath: "targetPath", useConfigFile: "useConfigFile", configFilePath: "configFilePath", updateAssemblyInfo: "configFilePath", updateAssemblyInfoFilename: "configFilePath", additionalArguments: "additionalArguments", }; exports.RunOptions = RunOptions; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZmlsZTovLy9EOi9Qcm9qZWN0cy9PU1MvR2l0VG9vbHMvdXNlLWdpdHZlcnNpb24vc3JjL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsTUFBTSxLQUFLLEdBQUc7SUFDVixXQUFXLEVBQUUsTUFBTSxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUM7SUFDckMsV0FBVyxFQUFFLE1BQU0sQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDO0lBQ3JDLGVBQWUsRUFBRSxNQUFNLENBQUMsR0FBRyxDQUFDLGdCQUFnQixDQUFDO0lBQzdDLGVBQWUsRUFBRSxNQUFNLENBQUMsR0FBRyxDQUFDLGdCQUFnQixDQUFDO0NBQ2hELENBQUM7QUFtQmlDLHNCQUFLO0FBakJ4QyxNQUFNLFlBQVksR0FBRztJQUNqQixpQkFBaUIsRUFBRSxtQkFBbUI7SUFDdEMsV0FBVyxFQUFFLGFBQWE7Q0FDN0IsQ0FBQztBQWNPLG9DQUFZO0FBWnJCLE1BQU0sVUFBVSxHQUFHO0lBQ2YsVUFBVSxFQUFFLFlBQVk7SUFFeEIsYUFBYSxFQUFFLGVBQWU7SUFDOUIsY0FBYyxFQUFFLGdCQUFnQjtJQUVoQyxrQkFBa0IsRUFBRSxnQkFBZ0I7SUFDcEMsMEJBQTBCLEVBQUUsZ0JBQWdCO0lBRTVDLG1CQUFtQixFQUFFLHFCQUFxQjtDQUM3QyxDQUFDO0FBRXFCLGdDQUFVIn0= /***/ }), /***/ 661: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); var path = __webpack_require__(622); // Recursively creates 'dir' function mkdirSyncRecursive(dir) { var baseDir = path.dirname(dir); // Base dir exists, no recursion necessary if (fs.existsSync(baseDir)) { fs.mkdirSync(dir, parseInt('0777', 8)); return; } // Base dir does not exist, go recursive mkdirSyncRecursive(baseDir); // Base dir created, can create dir fs.mkdirSync(dir, parseInt('0777', 8)); } //@ //@ ### mkdir([options ,] dir [, dir ...]) //@ ### mkdir([options ,] dir_array) //@ Available options: //@ //@ + `p`: full path (will create intermediate dirs if necessary) //@ //@ Examples: //@ //@ ```javascript //@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g'); //@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above //@ ``` //@ //@ Creates directories. function _mkdir(options, dirs) { options = common.parseOptions(options, { 'p': 'fullpath' }); if (!dirs) common.error('no paths given'); if (typeof dirs === 'string') dirs = [].slice.call(arguments, 1); // if it's array leave it as it is dirs.forEach(function(dir) { if (fs.existsSync(dir)) { if (!options.fullpath) common.error('path already exists: ' + dir, true); return; // skip dir } // Base dir does not exist, and no -p option given var baseDir = path.dirname(dir); if (!fs.existsSync(baseDir) && !options.fullpath) { common.error('no such file or directory: ' + baseDir, true); return; // skip dir } if (options.fullpath) mkdirSyncRecursive(dir); else fs.mkdirSync(dir, parseInt('0777', 8)); }); } // mkdir module.exports = _mkdir; /***/ }), /***/ 669: /***/ (function(module) { module.exports = require("util"); /***/ }), /***/ 691: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); var path = __webpack_require__(622); // Cross-platform method for splitting environment PATH variables function splitPath(p) { for (i=1;i<2;i++) {} if (!p) return []; if (common.platform === 'win') return p.split(';'); else return p.split(':'); } function checkPath(path) { return fs.existsSync(path) && fs.statSync(path).isDirectory() == false; } //@ //@ ### which(command) //@ //@ Examples: //@ //@ ```javascript //@ var nodeExec = which('node'); //@ ``` //@ //@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions. //@ Returns string containing the absolute path to the command. function _which(options, cmd) { if (!cmd) common.error('must specify command'); var pathEnv = process.env.path || process.env.Path || process.env.PATH, pathArray = splitPath(pathEnv), where = null; // No relative/absolute paths provided? if (cmd.search(/\//) === -1) { // Search for command in PATH pathArray.forEach(function(dir) { if (where) return; // already found it var attempt = path.resolve(dir + '/' + cmd); if (checkPath(attempt)) { where = attempt; return; } if (common.platform === 'win') { var baseAttempt = attempt; attempt = baseAttempt + '.exe'; if (checkPath(attempt)) { where = attempt; return; } attempt = baseAttempt + '.cmd'; if (checkPath(attempt)) { where = attempt; return; } attempt = baseAttempt + '.bat'; if (checkPath(attempt)) { where = attempt; return; } } // if 'win' }); } // Command not found anywhere? if (!checkPath(cmd) && !where) return null; where = where || path.resolve(cmd); return common.ShellString(where); } module.exports = _which; /***/ }), /***/ 693: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var _tempDir = __webpack_require__(953); var _pwd = __webpack_require__(359); var path = __webpack_require__(622); var fs = __webpack_require__(747); var child = __webpack_require__(129); // Hack to run child_process.exec() synchronously (sync avoids callback hell) // Uses a custom wait loop that checks for a flag file, created when the child process is done. // (Can't do a wait loop that checks for internal Node variables/messages as // Node is single-threaded; callbacks and other internal state changes are done in the // event loop). function execSync(cmd, opts) { var tempDir = _tempDir(); var stdoutFile = path.resolve(tempDir+'/'+common.randomFileName()), codeFile = path.resolve(tempDir+'/'+common.randomFileName()), scriptFile = path.resolve(tempDir+'/'+common.randomFileName()), sleepFile = path.resolve(tempDir+'/'+common.randomFileName()); var options = common.extend({ silent: common.config.silent }, opts); var previousStdoutContent = ''; // Echoes stdout changes from running process, if not silent function updateStdout() { if (options.silent || !fs.existsSync(stdoutFile)) return; var stdoutContent = fs.readFileSync(stdoutFile, 'utf8'); // No changes since last time? if (stdoutContent.length <= previousStdoutContent.length) return; process.stdout.write(stdoutContent.substr(previousStdoutContent.length)); previousStdoutContent = stdoutContent; } function escape(str) { return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0"); } cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix var script = "var child = require('child_process')," + " fs = require('fs');" + "child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {" + " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');" + "});"; if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile); if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile); if (fs.existsSync(codeFile)) common.unlinkSync(codeFile); fs.writeFileSync(scriptFile, script); child.exec('"'+process.execPath+'" '+scriptFile, { env: process.env, cwd: _pwd(), maxBuffer: 20*1024*1024 }); // The wait loop // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing // CPU usage, though apparently not so much on Windows) while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); } while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); } // At this point codeFile exists, but it's not necessarily flushed yet. // Keep reading it until it is. var code = parseInt('', 10); while (isNaN(code)) { code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10); } var stdout = fs.readFileSync(stdoutFile, 'utf8'); // No biggie if we can't erase the files now -- they're in a temp dir anyway try { common.unlinkSync(scriptFile); } catch(e) {} try { common.unlinkSync(stdoutFile); } catch(e) {} try { common.unlinkSync(codeFile); } catch(e) {} try { common.unlinkSync(sleepFile); } catch(e) {} // some shell return codes are defined as errors, per http://tldp.org/LDP/abs/html/exitcodes.html if (code === 1 || code === 2 || code >= 126) { common.error('', true); // unix/shell doesn't really give an error message after non-zero exit codes } // True if successful, false if not var obj = { code: code, output: stdout }; return obj; } // execSync() // Wrapper around exec() to enable echoing output to console in real time function execAsync(cmd, opts, callback) { var output = ''; var options = common.extend({ silent: common.config.silent }, opts); var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) { if (callback) callback(err ? err.code : 0, output); }); c.stdout.on('data', function(data) { output += data; if (!options.silent) process.stdout.write(data); }); c.stderr.on('data', function(data) { output += data; if (!options.silent) process.stdout.write(data); }); return c; } //@ //@ ### exec(command [, options] [, callback]) //@ Available options (all `false` by default): //@ //@ + `async`: Asynchronous execution. Defaults to true if a callback is provided. //@ + `silent`: Do not echo program output to console. //@ //@ Examples: //@ //@ ```javascript //@ var version = exec('node --version', {silent:true}).output; //@ //@ var child = exec('some_long_running_process', {async:true}); //@ child.stdout.on('data', function(data) { //@ /* ... do something with data ... */ //@ }); //@ //@ exec('some_long_running_process', function(code, output) { //@ console.log('Exit code:', code); //@ console.log('Program output:', output); //@ }); //@ ``` //@ //@ Executes the given `command` _synchronously_, unless otherwise specified. //@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's //@ `output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and //@ the `callback` gets the arguments `(code, output)`. //@ //@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as //@ the current synchronous implementation uses a lot of CPU. This should be getting //@ fixed soon. function _exec(command, options, callback) { if (!command) common.error('must specify command'); // Callback is defined instead of options. if (typeof options === 'function') { callback = options; options = { async: true }; } // Callback is defined with options. if (typeof options === 'object' && typeof callback === 'function') { options.async = true; } options = common.extend({ silent: common.config.silent, async: false }, options); if (options.async) return execAsync(command, options, callback); else return execSync(command, options); } module.exports = _exec; /***/ }), /***/ 695: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERROR_MSGS = __webpack_require__(800); var literal_types_1 = __webpack_require__(274); var binding_in_when_on_syntax_1 = __webpack_require__(766); var binding_when_on_syntax_1 = __webpack_require__(107); var BindingToSyntax = (function () { function BindingToSyntax(binding) { this._binding = binding; } BindingToSyntax.prototype.to = function (constructor) { this._binding.type = literal_types_1.BindingTypeEnum.Instance; this._binding.implementationType = constructor; return new binding_in_when_on_syntax_1.BindingInWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toSelf = function () { if (typeof this._binding.serviceIdentifier !== "function") { throw new Error("" + ERROR_MSGS.INVALID_TO_SELF_VALUE); } var self = this._binding.serviceIdentifier; return this.to(self); }; BindingToSyntax.prototype.toConstantValue = function (value) { this._binding.type = literal_types_1.BindingTypeEnum.ConstantValue; this._binding.cache = value; this._binding.dynamicValue = null; this._binding.implementationType = null; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toDynamicValue = function (func) { this._binding.type = literal_types_1.BindingTypeEnum.DynamicValue; this._binding.cache = null; this._binding.dynamicValue = func; this._binding.implementationType = null; return new binding_in_when_on_syntax_1.BindingInWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toConstructor = function (constructor) { this._binding.type = literal_types_1.BindingTypeEnum.Constructor; this._binding.implementationType = constructor; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toFactory = function (factory) { this._binding.type = literal_types_1.BindingTypeEnum.Factory; this._binding.factory = factory; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toFunction = function (func) { if (typeof func !== "function") { throw new Error(ERROR_MSGS.INVALID_FUNCTION_BINDING); } var bindingWhenOnSyntax = this.toConstantValue(func); this._binding.type = literal_types_1.BindingTypeEnum.Function; return bindingWhenOnSyntax; }; BindingToSyntax.prototype.toAutoFactory = function (serviceIdentifier) { this._binding.type = literal_types_1.BindingTypeEnum.Factory; this._binding.factory = function (context) { var autofactory = function () { return context.container.get(serviceIdentifier); }; return autofactory; }; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toProvider = function (provider) { this._binding.type = literal_types_1.BindingTypeEnum.Provider; this._binding.provider = provider; return new binding_when_on_syntax_1.BindingWhenOnSyntax(this._binding); }; BindingToSyntax.prototype.toService = function (service) { this.toDynamicValue(function (context) { return context.container.get(service); }); }; return BindingToSyntax; }()); exports.BindingToSyntax = BindingToSyntax; /***/ }), /***/ 702: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [0, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); var binding_1 = __webpack_require__(773); var ERROR_MSGS = __webpack_require__(800); var literal_types_1 = __webpack_require__(274); var METADATA_KEY = __webpack_require__(946); var metadata_reader_1 = __webpack_require__(975); var planner_1 = __webpack_require__(845); var resolver_1 = __webpack_require__(911); var binding_to_syntax_1 = __webpack_require__(695); var id_1 = __webpack_require__(862); var serialization_1 = __webpack_require__(395); var container_snapshot_1 = __webpack_require__(15); var lookup_1 = __webpack_require__(319); var Container = (function () { function Container(containerOptions) { var options = containerOptions || {}; if (typeof options !== "object") { throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT); } if (options.defaultScope === undefined) { options.defaultScope = literal_types_1.BindingScopeEnum.Transient; } else if (options.defaultScope !== literal_types_1.BindingScopeEnum.Singleton && options.defaultScope !== literal_types_1.BindingScopeEnum.Transient && options.defaultScope !== literal_types_1.BindingScopeEnum.Request) { throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE); } if (options.autoBindInjectable === undefined) { options.autoBindInjectable = false; } else if (typeof options.autoBindInjectable !== "boolean") { throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE); } if (options.skipBaseClassChecks === undefined) { options.skipBaseClassChecks = false; } else if (typeof options.skipBaseClassChecks !== "boolean") { throw new Error("" + ERROR_MSGS.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK); } this.options = { autoBindInjectable: options.autoBindInjectable, defaultScope: options.defaultScope, skipBaseClassChecks: options.skipBaseClassChecks }; this.id = id_1.id(); this._bindingDictionary = new lookup_1.Lookup(); this._snapshots = []; this._middleware = null; this.parent = null; this._metadataReader = new metadata_reader_1.MetadataReader(); } Container.merge = function (container1, container2) { var container = new Container(); var bindingDictionary = planner_1.getBindingDictionary(container); var bindingDictionary1 = planner_1.getBindingDictionary(container1); var bindingDictionary2 = planner_1.getBindingDictionary(container2); function copyDictionary(origin, destination) { origin.traverse(function (key, value) { value.forEach(function (binding) { destination.add(binding.serviceIdentifier, binding.clone()); }); }); } copyDictionary(bindingDictionary1, bindingDictionary); copyDictionary(bindingDictionary2, bindingDictionary); return container; }; Container.prototype.load = function () { var modules = []; for (var _i = 0; _i < arguments.length; _i++) { modules[_i] = arguments[_i]; } var getHelpers = this._getContainerModuleHelpersFactory(); for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) { var currentModule = modules_1[_a]; var containerModuleHelpers = getHelpers(currentModule.id); currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction); } }; Container.prototype.loadAsync = function () { var modules = []; for (var _i = 0; _i < arguments.length; _i++) { modules[_i] = arguments[_i]; } return __awaiter(this, void 0, void 0, function () { var getHelpers, _a, modules_2, currentModule, containerModuleHelpers; return __generator(this, function (_b) { switch (_b.label) { case 0: getHelpers = this._getContainerModuleHelpersFactory(); _a = 0, modules_2 = modules; _b.label = 1; case 1: if (!(_a < modules_2.length)) return [3, 4]; currentModule = modules_2[_a]; containerModuleHelpers = getHelpers(currentModule.id); return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)]; case 2: _b.sent(); _b.label = 3; case 3: _a++; return [3, 1]; case 4: return [2]; } }); }); }; Container.prototype.unload = function () { var _this = this; var modules = []; for (var _i = 0; _i < arguments.length; _i++) { modules[_i] = arguments[_i]; } var conditionFactory = function (expected) { return function (item) { return item.moduleId === expected; }; }; modules.forEach(function (module) { var condition = conditionFactory(module.id); _this._bindingDictionary.removeByCondition(condition); }); }; Container.prototype.bind = function (serviceIdentifier) { var scope = this.options.defaultScope || literal_types_1.BindingScopeEnum.Transient; var binding = new binding_1.Binding(serviceIdentifier, scope); this._bindingDictionary.add(serviceIdentifier, binding); return new binding_to_syntax_1.BindingToSyntax(binding); }; Container.prototype.rebind = function (serviceIdentifier) { this.unbind(serviceIdentifier); return this.bind(serviceIdentifier); }; Container.prototype.unbind = function (serviceIdentifier) { try { this._bindingDictionary.remove(serviceIdentifier); } catch (e) { throw new Error(ERROR_MSGS.CANNOT_UNBIND + " " + serialization_1.getServiceIdentifierAsString(serviceIdentifier)); } }; Container.prototype.unbindAll = function () { this._bindingDictionary = new lookup_1.Lookup(); }; Container.prototype.isBound = function (serviceIdentifier) { var bound = this._bindingDictionary.hasKey(serviceIdentifier); if (!bound && this.parent) { bound = this.parent.isBound(serviceIdentifier); } return bound; }; Container.prototype.isBoundNamed = function (serviceIdentifier, named) { return this.isBoundTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named); }; Container.prototype.isBoundTagged = function (serviceIdentifier, key, value) { var bound = false; if (this._bindingDictionary.hasKey(serviceIdentifier)) { var bindings = this._bindingDictionary.get(serviceIdentifier); var request_1 = planner_1.createMockRequest(this, serviceIdentifier, key, value); bound = bindings.some(function (b) { return b.constraint(request_1); }); } if (!bound && this.parent) { bound = this.parent.isBoundTagged(serviceIdentifier, key, value); } return bound; }; Container.prototype.snapshot = function () { this._snapshots.push(container_snapshot_1.ContainerSnapshot.of(this._bindingDictionary.clone(), this._middleware)); }; Container.prototype.restore = function () { var snapshot = this._snapshots.pop(); if (snapshot === undefined) { throw new Error(ERROR_MSGS.NO_MORE_SNAPSHOTS_AVAILABLE); } this._bindingDictionary = snapshot.bindings; this._middleware = snapshot.middleware; }; Container.prototype.createChild = function (containerOptions) { var child = new Container(containerOptions || this.options); child.parent = this; return child; }; Container.prototype.applyMiddleware = function () { var middlewares = []; for (var _i = 0; _i < arguments.length; _i++) { middlewares[_i] = arguments[_i]; } var initial = (this._middleware) ? this._middleware : this._planAndResolve(); this._middleware = middlewares.reduce(function (prev, curr) { return curr(prev); }, initial); }; Container.prototype.applyCustomMetadataReader = function (metadataReader) { this._metadataReader = metadataReader; }; Container.prototype.get = function (serviceIdentifier) { return this._get(false, false, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier); }; Container.prototype.getTagged = function (serviceIdentifier, key, value) { return this._get(false, false, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier, key, value); }; Container.prototype.getNamed = function (serviceIdentifier, named) { return this.getTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named); }; Container.prototype.getAll = function (serviceIdentifier) { return this._get(true, true, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier); }; Container.prototype.getAllTagged = function (serviceIdentifier, key, value) { return this._get(false, true, literal_types_1.TargetTypeEnum.Variable, serviceIdentifier, key, value); }; Container.prototype.getAllNamed = function (serviceIdentifier, named) { return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named); }; Container.prototype.resolve = function (constructorFunction) { var tempContainer = this.createChild(); tempContainer.bind(constructorFunction).toSelf(); return tempContainer.get(constructorFunction); }; Container.prototype._getContainerModuleHelpersFactory = function () { var _this = this; var setModuleId = function (bindingToSyntax, moduleId) { bindingToSyntax._binding.moduleId = moduleId; }; var getBindFunction = function (moduleId) { return function (serviceIdentifier) { var _bind = _this.bind.bind(_this); var bindingToSyntax = _bind(serviceIdentifier); setModuleId(bindingToSyntax, moduleId); return bindingToSyntax; }; }; var getUnbindFunction = function (moduleId) { return function (serviceIdentifier) { var _unbind = _this.unbind.bind(_this); _unbind(serviceIdentifier); }; }; var getIsboundFunction = function (moduleId) { return function (serviceIdentifier) { var _isBound = _this.isBound.bind(_this); return _isBound(serviceIdentifier); }; }; var getRebindFunction = function (moduleId) { return function (serviceIdentifier) { var _rebind = _this.rebind.bind(_this); var bindingToSyntax = _rebind(serviceIdentifier); setModuleId(bindingToSyntax, moduleId); return bindingToSyntax; }; }; return function (mId) { return ({ bindFunction: getBindFunction(mId), isboundFunction: getIsboundFunction(mId), rebindFunction: getRebindFunction(mId), unbindFunction: getUnbindFunction(mId) }); }; }; Container.prototype._get = function (avoidConstraints, isMultiInject, targetType, serviceIdentifier, key, value) { var result = null; var defaultArgs = { avoidConstraints: avoidConstraints, contextInterceptor: function (context) { return context; }, isMultiInject: isMultiInject, key: key, serviceIdentifier: serviceIdentifier, targetType: targetType, value: value }; if (this._middleware) { result = this._middleware(defaultArgs); if (result === undefined || result === null) { throw new Error(ERROR_MSGS.INVALID_MIDDLEWARE_RETURN); } } else { result = this._planAndResolve()(defaultArgs); } return result; }; Container.prototype._planAndResolve = function () { var _this = this; return function (args) { var context = planner_1.plan(_this._metadataReader, _this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints); context = args.contextInterceptor(context); var result = resolver_1.resolve(context); return result; }; }; return Container; }()); exports.Container = Container; /***/ }), /***/ 705: /***/ (function(module, __unusedexports, __webpack_require__) { var path = __webpack_require__(622); var fs = __webpack_require__(747); var common = __webpack_require__(602); var _cd = __webpack_require__(8); var _pwd = __webpack_require__(359); //@ //@ ### ls([options ,] path [,path ...]) //@ ### ls([options ,] path_array) //@ Available options: //@ //@ + `-R`: recursive //@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`) //@ //@ Examples: //@ //@ ```javascript //@ ls('projs/*.js'); //@ ls('-R', '/users/me', '/tmp'); //@ ls('-R', ['/users/me', '/tmp']); // same as above //@ ``` //@ //@ Returns array of files in the given path, or in current directory if no path provided. function _ls(options, paths) { options = common.parseOptions(options, { 'R': 'recursive', 'A': 'all', 'a': 'all_deprecated' }); if (options.all_deprecated) { // We won't support the -a option as it's hard to image why it's useful // (it includes '.' and '..' in addition to '.*' files) // For backwards compatibility we'll dump a deprecated message and proceed as before common.log('ls: Option -a is deprecated. Use -A instead'); options.all = true; } if (!paths) paths = ['.']; else if (typeof paths === 'object') paths = paths; // assume array else if (typeof paths === 'string') paths = [].slice.call(arguments, 1); var list = []; // Conditionally pushes file to list - returns true if pushed, false otherwise // (e.g. prevents hidden files to be included unless explicitly told so) function pushFile(file, query) { // hidden file? if (path.basename(file)[0] === '.') { // not explicitly asking for hidden files? if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1)) return false; } if (common.platform === 'win') file = file.replace(/\\/g, '/'); list.push(file); return true; } paths.forEach(function(p) { if (fs.existsSync(p)) { var stats = fs.statSync(p); // Simple file? if (stats.isFile()) { pushFile(p, p); return; // continue } // Simple dir? if (stats.isDirectory()) { // Iterate over p contents fs.readdirSync(p).forEach(function(file) { if (!pushFile(file, p)) return; // Recursive? if (options.recursive) { var oldDir = _pwd(); _cd('', p); if (fs.statSync(file).isDirectory()) list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*')); _cd('', oldDir); } }); return; // continue } } // p does not exist - possible wildcard present var basename = path.basename(p); var dirname = path.dirname(p); // Wildcard present on an existing dir? (e.g. '/tmp/*.js') if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) { // Escape special regular expression chars var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1'); // Translates wildcard into regex regexp = '^' + regexp.replace(/\*/g, '.*') + '$'; // Iterate over directory contents fs.readdirSync(dirname).forEach(function(file) { if (file.match(new RegExp(regexp))) { if (!pushFile(path.normalize(dirname+'/'+file), basename)) return; // Recursive? if (options.recursive) { var pp = dirname + '/' + file; if (fs.lstatSync(pp).isDirectory()) list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*')); } // recursive } // if file matches }); // forEach return; } common.error('no such file or directory: ' + p, true); }); return list; } module.exports = _ls; /***/ }), /***/ 708: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var METADATA_KEY = __webpack_require__(946); var metadata_1 = __webpack_require__(355); var decorator_utils_1 = __webpack_require__(309); function multiInject(serviceIdentifier) { return function (target, targetKey, index) { var metadata = new metadata_1.Metadata(METADATA_KEY.MULTI_INJECT_TAG, serviceIdentifier); if (typeof index === "number") { decorator_utils_1.tagParameter(target, targetKey, index, metadata); } else { decorator_utils_1.tagProperty(target, targetKey, metadata); } }; } exports.multiInject = multiInject; /***/ }), /***/ 722: /***/ (function(module) { /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ var byteToHex = []; for (var i = 0; i < 256; ++i) { byteToHex[i] = (i + 0x100).toString(16).substr(1); } function bytesToUuid(buf, offset) { var i = offset || 0; var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return ([bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]]).join(''); } module.exports = bytesToUuid; /***/ }), /***/ 729: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Plan = (function () { function Plan(parentContext, rootRequest) { this.parentContext = parentContext; this.rootRequest = rootRequest; } return Plan; }()); exports.Plan = Plan; /***/ }), /***/ 739: /***/ (function(__unusedmodule, exports, __webpack_require__) { // // ShellJS // Unix shell commands on top of Node's API // // Copyright (c) 2012 Artur Adib // http://github.com/arturadib/shelljs // var common = __webpack_require__(602); //@ //@ All commands run synchronously, unless otherwise stated. //@ //@include ./src/cd var _cd = __webpack_require__(8); exports.cd = common.wrap('cd', _cd); //@include ./src/pwd var _pwd = __webpack_require__(359); exports.pwd = common.wrap('pwd', _pwd); //@include ./src/ls var _ls = __webpack_require__(705); exports.ls = common.wrap('ls', _ls); //@include ./src/find var _find = __webpack_require__(216); exports.find = common.wrap('find', _find); //@include ./src/cp var _cp = __webpack_require__(167); exports.cp = common.wrap('cp', _cp); //@include ./src/rm var _rm = __webpack_require__(272); exports.rm = common.wrap('rm', _rm); //@include ./src/mv var _mv = __webpack_require__(809); exports.mv = common.wrap('mv', _mv); //@include ./src/mkdir var _mkdir = __webpack_require__(661); exports.mkdir = common.wrap('mkdir', _mkdir); //@include ./src/test var _test = __webpack_require__(284); exports.test = common.wrap('test', _test); //@include ./src/cat var _cat = __webpack_require__(833); exports.cat = common.wrap('cat', _cat); //@include ./src/to var _to = __webpack_require__(380); String.prototype.to = common.wrap('to', _to); //@include ./src/toEnd var _toEnd = __webpack_require__(240); String.prototype.toEnd = common.wrap('toEnd', _toEnd); //@include ./src/sed var _sed = __webpack_require__(989); exports.sed = common.wrap('sed', _sed); //@include ./src/grep var _grep = __webpack_require__(199); exports.grep = common.wrap('grep', _grep); //@include ./src/which var _which = __webpack_require__(691); exports.which = common.wrap('which', _which); //@include ./src/echo var _echo = __webpack_require__(574); exports.echo = _echo; // don't common.wrap() as it could parse '-options' //@include ./src/dirs var _dirs = __webpack_require__(542).dirs; exports.dirs = common.wrap("dirs", _dirs); var _pushd = __webpack_require__(542).pushd; exports.pushd = common.wrap('pushd', _pushd); var _popd = __webpack_require__(542).popd; exports.popd = common.wrap("popd", _popd); //@include ./src/ln var _ln = __webpack_require__(535); exports.ln = common.wrap('ln', _ln); //@ //@ ### exit(code) //@ Exits the current process with the given exit code. exports.exit = process.exit; //@ //@ ### env['VAR_NAME'] //@ Object containing environment variables (both getter and setter). Shortcut to process.env. exports.env = process.env; //@include ./src/exec var _exec = __webpack_require__(693); exports.exec = common.wrap('exec', _exec, {notUnix:true}); //@include ./src/chmod var _chmod = __webpack_require__(477); exports.chmod = common.wrap('chmod', _chmod); //@ //@ ## Non-Unix commands //@ //@include ./src/tempdir var _tempDir = __webpack_require__(953); exports.tempdir = common.wrap('tempdir', _tempDir); //@include ./src/error var _error = __webpack_require__(901); exports.error = _error; //@ //@ ## Configuration //@ exports.config = common.config; //@ //@ ### config.silent //@ Example: //@ //@ ```javascript //@ var silentState = config.silent; // save old silent state //@ config.silent = true; //@ /* ... */ //@ config.silent = silentState; // restore old silent state //@ ``` //@ //@ Suppresses all command output if `true`, except for `echo()` calls. //@ Default is `false`. //@ //@ ### config.fatal //@ Example: //@ //@ ```javascript //@ config.fatal = true; //@ cp('this_file_does_not_exist', '/dev/null'); // dies here //@ /* more commands... */ //@ ``` //@ //@ If `true` the script will die on errors. Default is `false`. /***/ }), /***/ 747: /***/ (function(module) { module.exports = require("fs"); /***/ }), /***/ 765: /***/ (function(module) { module.exports = require("process"); /***/ }), /***/ 766: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var binding_in_syntax_1 = __webpack_require__(415); var binding_on_syntax_1 = __webpack_require__(956); var binding_when_syntax_1 = __webpack_require__(954); var BindingInWhenOnSyntax = (function () { function BindingInWhenOnSyntax(binding) { this._binding = binding; this._bindingWhenSyntax = new binding_when_syntax_1.BindingWhenSyntax(this._binding); this._bindingOnSyntax = new binding_on_syntax_1.BindingOnSyntax(this._binding); this._bindingInSyntax = new binding_in_syntax_1.BindingInSyntax(binding); } BindingInWhenOnSyntax.prototype.inRequestScope = function () { return this._bindingInSyntax.inRequestScope(); }; BindingInWhenOnSyntax.prototype.inSingletonScope = function () { return this._bindingInSyntax.inSingletonScope(); }; BindingInWhenOnSyntax.prototype.inTransientScope = function () { return this._bindingInSyntax.inTransientScope(); }; BindingInWhenOnSyntax.prototype.when = function (constraint) { return this._bindingWhenSyntax.when(constraint); }; BindingInWhenOnSyntax.prototype.whenTargetNamed = function (name) { return this._bindingWhenSyntax.whenTargetNamed(name); }; BindingInWhenOnSyntax.prototype.whenTargetIsDefault = function () { return this._bindingWhenSyntax.whenTargetIsDefault(); }; BindingInWhenOnSyntax.prototype.whenTargetTagged = function (tag, value) { return this._bindingWhenSyntax.whenTargetTagged(tag, value); }; BindingInWhenOnSyntax.prototype.whenInjectedInto = function (parent) { return this._bindingWhenSyntax.whenInjectedInto(parent); }; BindingInWhenOnSyntax.prototype.whenParentNamed = function (name) { return this._bindingWhenSyntax.whenParentNamed(name); }; BindingInWhenOnSyntax.prototype.whenParentTagged = function (tag, value) { return this._bindingWhenSyntax.whenParentTagged(tag, value); }; BindingInWhenOnSyntax.prototype.whenAnyAncestorIs = function (ancestor) { return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor); }; BindingInWhenOnSyntax.prototype.whenNoAncestorIs = function (ancestor) { return this._bindingWhenSyntax.whenNoAncestorIs(ancestor); }; BindingInWhenOnSyntax.prototype.whenAnyAncestorNamed = function (name) { return this._bindingWhenSyntax.whenAnyAncestorNamed(name); }; BindingInWhenOnSyntax.prototype.whenAnyAncestorTagged = function (tag, value) { return this._bindingWhenSyntax.whenAnyAncestorTagged(tag, value); }; BindingInWhenOnSyntax.prototype.whenNoAncestorNamed = function (name) { return this._bindingWhenSyntax.whenNoAncestorNamed(name); }; BindingInWhenOnSyntax.prototype.whenNoAncestorTagged = function (tag, value) { return this._bindingWhenSyntax.whenNoAncestorTagged(tag, value); }; BindingInWhenOnSyntax.prototype.whenAnyAncestorMatches = function (constraint) { return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint); }; BindingInWhenOnSyntax.prototype.whenNoAncestorMatches = function (constraint) { return this._bindingWhenSyntax.whenNoAncestorMatches(constraint); }; BindingInWhenOnSyntax.prototype.onActivation = function (handler) { return this._bindingOnSyntax.onActivation(handler); }; return BindingInWhenOnSyntax; }()); exports.BindingInWhenOnSyntax = BindingInWhenOnSyntax; /***/ }), /***/ 773: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var literal_types_1 = __webpack_require__(274); var id_1 = __webpack_require__(862); var Binding = (function () { function Binding(serviceIdentifier, scope) { this.id = id_1.id(); this.activated = false; this.serviceIdentifier = serviceIdentifier; this.scope = scope; this.type = literal_types_1.BindingTypeEnum.Invalid; this.constraint = function (request) { return true; }; this.implementationType = null; this.cache = null; this.factory = null; this.provider = null; this.onActivation = null; this.dynamicValue = null; } Binding.prototype.clone = function () { var clone = new Binding(this.serviceIdentifier, this.scope); clone.activated = false; clone.implementationType = this.implementationType; clone.dynamicValue = this.dynamicValue; clone.scope = this.scope; clone.type = this.type; clone.factory = this.factory; clone.provider = this.provider; clone.constraint = this.constraint; clone.onActivation = this.onActivation; clone.cache = this.cache; return clone; }; return Binding; }()); exports.Binding = Binding; /***/ }), /***/ 778: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var inject_1 = __webpack_require__(625); var ERROR_MSGS = __webpack_require__(800); var literal_types_1 = __webpack_require__(274); var METADATA_KEY = __webpack_require__(946); var serialization_1 = __webpack_require__(395); exports.getFunctionName = serialization_1.getFunctionName; var target_1 = __webpack_require__(412); function getDependencies(metadataReader, func) { var constructorName = serialization_1.getFunctionName(func); var targets = getTargets(metadataReader, constructorName, func, false); return targets; } exports.getDependencies = getDependencies; function getTargets(metadataReader, constructorName, func, isBaseClass) { var metadata = metadataReader.getConstructorMetadata(func); var serviceIdentifiers = metadata.compilerGeneratedMetadata; if (serviceIdentifiers === undefined) { var msg = ERROR_MSGS.MISSING_INJECTABLE_ANNOTATION + " " + constructorName + "."; throw new Error(msg); } var constructorArgsMetadata = metadata.userGeneratedMetadata; var keys = Object.keys(constructorArgsMetadata); var hasUserDeclaredUnknownInjections = (func.length === 0 && keys.length > 0); var iterations = (hasUserDeclaredUnknownInjections) ? keys.length : func.length; var constructorTargets = getConstructorArgsAsTargets(isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata, iterations); var propertyTargets = getClassPropsAsTargets(metadataReader, func); var targets = constructorTargets.concat(propertyTargets); return targets; } function getConstructorArgsAsTarget(index, isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata) { var targetMetadata = constructorArgsMetadata[index.toString()] || []; var metadata = formatTargetMetadata(targetMetadata); var isManaged = metadata.unmanaged !== true; var serviceIdentifier = serviceIdentifiers[index]; var injectIdentifier = (metadata.inject || metadata.multiInject); serviceIdentifier = (injectIdentifier) ? (injectIdentifier) : serviceIdentifier; if (serviceIdentifier instanceof inject_1.LazyServiceIdentifer) { serviceIdentifier = serviceIdentifier.unwrap(); } if (isManaged) { var isObject = serviceIdentifier === Object; var isFunction = serviceIdentifier === Function; var isUndefined = serviceIdentifier === undefined; var isUnknownType = (isObject || isFunction || isUndefined); if (!isBaseClass && isUnknownType) { var msg = ERROR_MSGS.MISSING_INJECT_ANNOTATION + " argument " + index + " in class " + constructorName + "."; throw new Error(msg); } var target = new target_1.Target(literal_types_1.TargetTypeEnum.ConstructorArgument, metadata.targetName, serviceIdentifier); target.metadata = targetMetadata; return target; } return null; } function getConstructorArgsAsTargets(isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata, iterations) { var targets = []; for (var i = 0; i < iterations; i++) { var index = i; var target = getConstructorArgsAsTarget(index, isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata); if (target !== null) { targets.push(target); } } return targets; } function getClassPropsAsTargets(metadataReader, constructorFunc) { var classPropsMetadata = metadataReader.getPropertiesMetadata(constructorFunc); var targets = []; var keys = Object.keys(classPropsMetadata); for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { var key = keys_1[_i]; var targetMetadata = classPropsMetadata[key]; var metadata = formatTargetMetadata(classPropsMetadata[key]); var targetName = metadata.targetName || key; var serviceIdentifier = (metadata.inject || metadata.multiInject); var target = new target_1.Target(literal_types_1.TargetTypeEnum.ClassProperty, targetName, serviceIdentifier); target.metadata = targetMetadata; targets.push(target); } var baseConstructor = Object.getPrototypeOf(constructorFunc.prototype).constructor; if (baseConstructor !== Object) { var baseTargets = getClassPropsAsTargets(metadataReader, baseConstructor); targets = targets.concat(baseTargets); } return targets; } function getBaseClassDependencyCount(metadataReader, func) { var baseConstructor = Object.getPrototypeOf(func.prototype).constructor; if (baseConstructor !== Object) { var baseConstructorName = serialization_1.getFunctionName(baseConstructor); var targets = getTargets(metadataReader, baseConstructorName, baseConstructor, true); var metadata = targets.map(function (t) { return t.metadata.filter(function (m) { return m.key === METADATA_KEY.UNMANAGED_TAG; }); }); var unmanagedCount = [].concat.apply([], metadata).length; var dependencyCount = targets.length - unmanagedCount; if (dependencyCount > 0) { return dependencyCount; } else { return getBaseClassDependencyCount(metadataReader, baseConstructor); } } else { return 0; } } exports.getBaseClassDependencyCount = getBaseClassDependencyCount; function formatTargetMetadata(targetMetadata) { var targetMetadataMap = {}; targetMetadata.forEach(function (m) { targetMetadataMap[m.key.toString()] = m.value; }); return { inject: targetMetadataMap[METADATA_KEY.INJECT_TAG], multiInject: targetMetadataMap[METADATA_KEY.MULTI_INJECT_TAG], targetName: targetMetadataMap[METADATA_KEY.NAME_TAG], unmanaged: targetMetadataMap[METADATA_KEY.UNMANAGED_TAG] }; } /***/ }), /***/ 800: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times."; exports.DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:"; exports.NULL_ARGUMENT = "NULL argument"; exports.KEY_NOT_FOUND = "Key Not Found"; exports.AMBIGUOUS_MATCH = "Ambiguous match found for serviceIdentifier:"; exports.CANNOT_UNBIND = "Could not unbind serviceIdentifier:"; exports.NOT_REGISTERED = "No matching bindings found for serviceIdentifier:"; exports.MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:"; exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:"; exports.UNDEFINED_INJECT_ANNOTATION = function (name) { return "@inject called with undefined this could mean that the class " + name + " has " + "a circular dependency problem. You can use a LazyServiceIdentifer to " + "overcome this limitation."; }; exports.CIRCULAR_DEPENDENCY = "Circular dependency found:"; exports.NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet."; exports.INVALID_BINDING_TYPE = "Invalid binding type:"; exports.NO_MORE_SNAPSHOTS_AVAILABLE = "No snapshot available to restore."; exports.INVALID_MIDDLEWARE_RETURN = "Invalid return type in middleware. Middleware must return!"; exports.INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!"; exports.INVALID_TO_SELF_VALUE = "The toSelf function can only be applied when a constructor is " + "used as service identifier"; exports.INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators " + "must be applied to the parameters of a class constructor or a class property."; exports.ARGUMENTS_LENGTH_MISMATCH = function () { var values = []; for (var _i = 0; _i < arguments.length; _i++) { values[_i] = arguments[_i]; } return "The number of constructor arguments in the derived class " + (values[0] + " must be >= than the number of constructor arguments of its base class."); }; exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = "Invalid Container constructor argument. Container options " + "must be an object."; exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = "Invalid Container option. Default scope must " + "be a string ('singleton' or 'transient')."; exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = "Invalid Container option. Auto bind injectable must " + "be a boolean"; exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = "Invalid Container option. Skip base check must " + "be a boolean"; exports.MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class"; exports.POST_CONSTRUCT_ERROR = function () { var values = []; for (var _i = 0; _i < arguments.length; _i++) { values[_i] = arguments[_i]; } return "@postConstruct error in class " + values[0] + ": " + values[1]; }; exports.CIRCULAR_DEPENDENCY_IN_FACTORY = function () { var values = []; for (var _i = 0; _i < arguments.length; _i++) { values[_i] = arguments[_i]; } return "It looks like there is a circular dependency " + ("in one of the '" + values[0] + "' bindings. Please investigate bindings with") + ("service identifier '" + values[1] + "'."); }; exports.STACK_OVERFLOW = "Maximum call stack size exceeded"; /***/ }), /***/ 804: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var METADATA_KEY = __webpack_require__(946); var metadata_1 = __webpack_require__(355); var decorator_utils_1 = __webpack_require__(309); function optional() { return function (target, targetKey, index) { var metadata = new metadata_1.Metadata(METADATA_KEY.OPTIONAL_TAG, true); if (typeof index === "number") { decorator_utils_1.tagParameter(target, targetKey, index, metadata); } else { decorator_utils_1.tagProperty(target, targetKey, metadata); } }; } exports.optional = optional; /***/ }), /***/ 809: /***/ (function(module, __unusedexports, __webpack_require__) { var fs = __webpack_require__(747); var path = __webpack_require__(622); var common = __webpack_require__(602); //@ //@ ### mv(source [, source ...], dest') //@ ### mv(source_array, dest') //@ Available options: //@ //@ + `f`: force //@ //@ Examples: //@ //@ ```javascript //@ mv('-f', 'file', 'dir/'); //@ mv('file1', 'file2', 'dir/'); //@ mv(['file1', 'file2'], 'dir/'); // same as above //@ ``` //@ //@ Moves files. The wildcard `*` is accepted. function _mv(options, sources, dest) { options = common.parseOptions(options, { 'f': 'force' }); // Get sources, dest if (arguments.length < 3) { common.error('missing and/or '); } else if (arguments.length > 3) { sources = [].slice.call(arguments, 1, arguments.length - 1); dest = arguments[arguments.length - 1]; } else if (typeof sources === 'string') { sources = [sources]; } else if ('length' in sources) { sources = sources; // no-op for array } else { common.error('invalid arguments'); } sources = common.expand(sources); var exists = fs.existsSync(dest), stats = exists && fs.statSync(dest); // Dest is not existing dir, but multiple sources given if ((!exists || !stats.isDirectory()) && sources.length > 1) common.error('dest is not a directory (too many sources)'); // Dest is an existing file, but no -f given if (exists && stats.isFile() && !options.force) common.error('dest file already exists: ' + dest); sources.forEach(function(src) { if (!fs.existsSync(src)) { common.error('no such file or directory: '+src, true); return; // skip file } // If here, src exists // When copying to '/path/dir': // thisDest = '/path/dir/file1' var thisDest = dest; if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) thisDest = path.normalize(dest + '/' + path.basename(src)); if (fs.existsSync(thisDest) && !options.force) { common.error('dest file already exists: ' + thisDest, true); return; // skip file } if (path.resolve(src) === path.dirname(path.resolve(thisDest))) { common.error('cannot move to self: '+src, true); return; // skip file } fs.renameSync(src, thisDest); }); // forEach(src) } // mv module.exports = _mv; /***/ }), /***/ 824: /***/ (function(module) { module.exports = {"_args":[["azure-pipelines-tool-lib@0.12.0","D:\\Projects\\OSS\\GitTools\\use-gitversion"]],"_from":"azure-pipelines-tool-lib@0.12.0","_id":"azure-pipelines-tool-lib@0.12.0","_inBundle":false,"_integrity":"sha512-JAlFvMTtEXISrnJY/kgq0LecLi089RqXRf/gMsXYbflmzszklkc+LUJpR0A7NDmJ+9/MWpKY/ZX+Q/zirYa7gw==","_location":"/azure-pipelines-tool-lib","_phantomChildren":{"tunnel":"0.0.4","underscore":"1.8.3"},"_requested":{"type":"version","registry":true,"raw":"azure-pipelines-tool-lib@0.12.0","name":"azure-pipelines-tool-lib","escapedName":"azure-pipelines-tool-lib","rawSpec":"0.12.0","saveSpec":null,"fetchSpec":"0.12.0"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/azure-pipelines-tool-lib/-/azure-pipelines-tool-lib-0.12.0.tgz","_spec":"0.12.0","_where":"D:\\Projects\\OSS\\GitTools\\use-gitversion","author":{"name":"Microsoft"},"bugs":{"url":"https://github.com/microsoft/azure-pipelines-tool-lib/issues"},"dependencies":{"@types/semver":"^5.3.0","@types/uuid":"^3.0.1","azure-pipelines-task-lib":"^2.8.0","semver":"^5.3.0","semver-compare":"^1.0.0","typed-rest-client":"1.0.9","uuid":"^3.0.1"},"description":"Azure Pipelines Tool Installer Lib for CI/CD Tasks","devDependencies":{"@types/mocha":"^2.2.41","@types/node":"^8.0.19","@types/shelljs":"^0.7.4","@types/xml2js":"^0.4.0","mocha":"^3.2.0","nock":"9.6.1","shelljs":"^0.7.6","typescript":"^2.2.1","xml2js":"^0.4.17"},"homepage":"https://github.com/microsoft/azure-pipelines-tool-lib#readme","keywords":["VSTS"],"license":"MIT","main":"tool.js","name":"azure-pipelines-tool-lib","repository":{"type":"git","url":"git+https://github.com/microsoft/azure-pipelines-tool-lib.git"},"scripts":{"build":"node make.js build","sample":"node make.js sample","test":"node make.js test","units":"node make.js units"},"version":"0.12.0"}; /***/ }), /***/ 826: /***/ (function(module, __unusedexports, __webpack_require__) { var rng = __webpack_require__(139); var bytesToUuid = __webpack_require__(722); function v4(options, buf, offset) { var i = buf && offset || 0; if (typeof(options) == 'string') { buf = options === 'binary' ? new Array(16) : null; options = null; } options = options || {}; var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = (rnds[6] & 0x0f) | 0x40; rnds[8] = (rnds[8] & 0x3f) | 0x80; // Copy bytes to buffer, if provided if (buf) { for (var ii = 0; ii < 16; ++ii) { buf[i + ii] = rnds[ii]; } } return buf || bytesToUuid(rnds); } module.exports = v4; /***/ }), /***/ 833: /***/ (function(module, __unusedexports, __webpack_require__) { var common = __webpack_require__(602); var fs = __webpack_require__(747); //@ //@ ### cat(file [, file ...]) //@ ### cat(file_array) //@ //@ Examples: //@ //@ ```javascript //@ var str = cat('file*.txt'); //@ var str = cat('file1', 'file2'); //@ var str = cat(['file1', 'file2']); // same as above //@ ``` //@ //@ Returns a string containing the given file, or a concatenated string //@ containing the files if more than one file is given (a new line character is //@ introduced between each file). Wildcard `*` accepted. function _cat(options, files) { var cat = ''; if (!files) common.error('no paths given'); if (typeof files === 'string') files = [].slice.call(arguments, 1); // if it's array leave it as it is files = common.expand(files); files.forEach(function(file) { if (!fs.existsSync(file)) common.error('no such file or directory: ' + file); cat += fs.readFileSync(file, 'utf8') + '\n'; }); if (cat[cat.length-1] === '\n') cat = cat.substring(0, cat.length-1); return common.ShellString(cat); } module.exports = _cat; /***/ }), /***/ 835: /***/ (function(module) { module.exports = require("url"); /***/ }), /***/ 845: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var binding_count_1 = __webpack_require__(403); var ERROR_MSGS = __webpack_require__(800); var literal_types_1 = __webpack_require__(274); var METADATA_KEY = __webpack_require__(946); var exceptions_1 = __webpack_require__(480); var serialization_1 = __webpack_require__(395); var context_1 = __webpack_require__(32); var metadata_1 = __webpack_require__(355); var plan_1 = __webpack_require__(729); var reflection_utils_1 = __webpack_require__(778); var request_1 = __webpack_require__(231); var target_1 = __webpack_require__(412); function getBindingDictionary(cntnr) { return cntnr._bindingDictionary; } exports.getBindingDictionary = getBindingDictionary; function _createTarget(isMultiInject, targetType, serviceIdentifier, name, key, value) { var metadataKey = isMultiInject ? METADATA_KEY.MULTI_INJECT_TAG : METADATA_KEY.INJECT_TAG; var injectMetadata = new metadata_1.Metadata(metadataKey, serviceIdentifier); var target = new target_1.Target(targetType, name, serviceIdentifier, injectMetadata); if (key !== undefined) { var tagMetadata = new metadata_1.Metadata(key, value); target.metadata.push(tagMetadata); } return target; } function _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target) { var bindings = getBindings(context.container, target.serviceIdentifier); var activeBindings = []; if (bindings.length === binding_count_1.BindingCount.NoBindingsAvailable && context.container.options.autoBindInjectable && typeof target.serviceIdentifier === "function" && metadataReader.getConstructorMetadata(target.serviceIdentifier).compilerGeneratedMetadata) { context.container.bind(target.serviceIdentifier).toSelf(); bindings = getBindings(context.container, target.serviceIdentifier); } if (!avoidConstraints) { activeBindings = bindings.filter(function (binding) { var request = new request_1.Request(binding.serviceIdentifier, context, parentRequest, binding, target); return binding.constraint(request); }); } else { activeBindings = bindings; } _validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container); return activeBindings; } function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) { switch (bindings.length) { case binding_count_1.BindingCount.NoBindingsAvailable: if (target.isOptional()) { return bindings; } else { var serviceIdentifierString = serialization_1.getServiceIdentifierAsString(serviceIdentifier); var msg = ERROR_MSGS.NOT_REGISTERED; msg += serialization_1.listMetadataForTarget(serviceIdentifierString, target); msg += serialization_1.listRegisteredBindingsForServiceIdentifier(container, serviceIdentifierString, getBindings); throw new Error(msg); } case binding_count_1.BindingCount.OnlyOneBindingAvailable: if (!target.isArray()) { return bindings; } case binding_count_1.BindingCount.MultipleBindingsAvailable: default: if (!target.isArray()) { var serviceIdentifierString = serialization_1.getServiceIdentifierAsString(serviceIdentifier); var msg = ERROR_MSGS.AMBIGUOUS_MATCH + " " + serviceIdentifierString; msg += serialization_1.listRegisteredBindingsForServiceIdentifier(container, serviceIdentifierString, getBindings); throw new Error(msg); } else { return bindings; } } } function _createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, parentRequest, target) { var activeBindings; var childRequest; if (parentRequest === null) { activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, null, target); childRequest = new request_1.Request(serviceIdentifier, context, null, activeBindings, target); var thePlan = new plan_1.Plan(context, childRequest); context.addPlan(thePlan); } else { activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target); childRequest = parentRequest.addChildRequest(target.serviceIdentifier, activeBindings, target); } activeBindings.forEach(function (binding) { var subChildRequest = null; if (target.isArray()) { subChildRequest = childRequest.addChildRequest(binding.serviceIdentifier, binding, target); } else { if (binding.cache) { return; } subChildRequest = childRequest; } if (binding.type === literal_types_1.BindingTypeEnum.Instance && binding.implementationType !== null) { var dependencies = reflection_utils_1.getDependencies(metadataReader, binding.implementationType); if (!context.container.options.skipBaseClassChecks) { var baseClassDependencyCount = reflection_utils_1.getBaseClassDependencyCount(metadataReader, binding.implementationType); if (dependencies.length < baseClassDependencyCount) { var error = ERROR_MSGS.ARGUMENTS_LENGTH_MISMATCH(reflection_utils_1.getFunctionName(binding.implementationType)); throw new Error(error); } } dependencies.forEach(function (dependency) { _createSubRequests(metadataReader, false, dependency.serviceIdentifier, context, subChildRequest, dependency); }); } }); } function getBindings(container, serviceIdentifier) { var bindings = []; var bindingDictionary = getBindingDictionary(container); if (bindingDictionary.hasKey(serviceIdentifier)) { bindings = bindingDictionary.get(serviceIdentifier); } else if (container.parent !== null) { bindings = getBindings(container.parent, serviceIdentifier); } return bindings; } function plan(metadataReader, container, isMultiInject, targetType, serviceIdentifier, key, value, avoidConstraints) { if (avoidConstraints === void 0) { avoidConstraints = false; } var context = new context_1.Context(container); var target = _createTarget(isMultiInject, targetType, serviceIdentifier, "", key, value); try { _createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, null, target); return context; } catch (error) { if (exceptions_1.isStackOverflowExeption(error)) { if (context.plan) { serialization_1.circularDependencyToException(context.plan.rootRequest); } } throw error; } } exports.plan = plan; function createMockRequest(container, serviceIdentifier, key, value) { var target = new target_1.Target(literal_types_1.TargetTypeEnum.Variable, "", serviceIdentifier, new metadata_1.Metadata(key, value)); var context = new context_1.Context(container); var request = new request_1.Request(serviceIdentifier, context, null, [], target); return request; } exports.createMockRequest = createMockRequest; /***/ }), /***/ 862: /***/ (function(__unusedmodule, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var idCounter = 0; function id() { return idCounter++; } exports.id = id; /***/ }), /***/ 864: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var id_1 = __webpack_require__(862); var ContainerModule = (function () { function ContainerModule(registry) { this.id = id_1.id(); this.registry = registry; } return ContainerModule; }()); exports.ContainerModule = ContainerModule; var AsyncContainerModule = (function () { function AsyncContainerModule(registry) { this.id = id_1.id(); this.registry = registry; } return AsyncContainerModule; }()); exports.AsyncContainerModule = AsyncContainerModule; /***/ }), /***/ 871: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ERRORS_MSGS = __webpack_require__(800); var METADATA_KEY = __webpack_require__(946); var metadata_1 = __webpack_require__(355); function postConstruct() { return function (target, propertyKey, descriptor) { var metadata = new metadata_1.Metadata(METADATA_KEY.POST_CONSTRUCT, propertyKey); if (Reflect.hasOwnMetadata(METADATA_KEY.POST_CONSTRUCT, target.constructor)) { throw new Error(ERRORS_MSGS.MULTIPLE_POST_CONSTRUCT_METHODS); } Reflect.defineMetadata(METADATA_KEY.POST_CONSTRUCT, metadata, target.constructor); }; } exports.postConstruct = postConstruct; /***/ }), /***/ 874: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const url = __webpack_require__(835); const http = __webpack_require__(876); const https = __webpack_require__(211); let fs; let tunnel; var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; })(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; const HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout]; const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; const ExponentialBackoffCeiling = 10; const ExponentialBackoffTimeSlice = 5; class HttpClientResponse { constructor(message) { this.message = message; } readBody() { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let output = ''; this.message.on('data', (chunk) => { output += chunk; }); this.message.on('end', () => { resolve(output); }); })); } } exports.HttpClientResponse = HttpClientResponse; function isHttps(requestUrl) { let parsedUrl = url.parse(requestUrl); return parsedUrl.protocol === 'https:'; } exports.isHttps = isHttps; var EnvironmentVariables; (function (EnvironmentVariables) { EnvironmentVariables["HTTP_PROXY"] = "HTTP_PROXY"; EnvironmentVariables["HTTPS_PROXY"] = "HTTPS_PROXY"; })(EnvironmentVariables || (EnvironmentVariables = {})); class HttpClient { constructor(userAgent, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; this._maxRedirects = 50; this._allowRetries = false; this._maxRetries = 1; this._keepAlive = false; this._disposed = false; this.userAgent = userAgent; this.handlers = handlers || []; this.requestOptions = requestOptions; if (requestOptions) { if (requestOptions.ignoreSslError != null) { this._ignoreSslError = requestOptions.ignoreSslError; } this._socketTimeout = requestOptions.socketTimeout; this._httpProxy = requestOptions.proxy; if (requestOptions.proxy && requestOptions.proxy.proxyBypassHosts) { this._httpProxyBypassHosts = []; requestOptions.proxy.proxyBypassHosts.forEach(bypass => { this._httpProxyBypassHosts.push(new RegExp(bypass, 'i')); }); } this._certConfig = requestOptions.cert; if (this._certConfig) { // If using cert, need fs fs = __webpack_require__(747); // cache the cert content into memory, so we don't have to read it from disk every time if (this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) { this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8'); } if (this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) { this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8'); } if (this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) { this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8'); } } if (requestOptions.allowRedirects != null) { this._allowRedirects = requestOptions.allowRedirects; } if (requestOptions.maxRedirects != null) { this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); } if (requestOptions.keepAlive != null) { this._keepAlive = requestOptions.keepAlive; } if (requestOptions.allowRetries != null) { this._allowRetries = requestOptions.allowRetries; } if (requestOptions.maxRetries != null) { this._maxRetries = requestOptions.maxRetries; } } } options(requestUrl, additionalHeaders) { return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); } get(requestUrl, additionalHeaders) { return this.request('GET', requestUrl, null, additionalHeaders || {}); } del(requestUrl, additionalHeaders) { return this.request('DELETE', requestUrl, null, additionalHeaders || {}); } post(requestUrl, data, additionalHeaders) { return this.request('POST', requestUrl, data, additionalHeaders || {}); } patch(requestUrl, data, additionalHeaders) { return this.request('PATCH', requestUrl, data, additionalHeaders || {}); } put(requestUrl, data, additionalHeaders) { return this.request('PUT', requestUrl, data, additionalHeaders || {}); } head(requestUrl, additionalHeaders) { return this.request('HEAD', requestUrl, null, additionalHeaders || {}); } sendStream(verb, requestUrl, stream, additionalHeaders) { return this.request(verb, requestUrl, stream, additionalHeaders); } /** * Makes a raw http request. * All other methods such as get, post, patch, and request ultimately call this. * Prefer get, del, post and patch */ request(verb, requestUrl, data, headers) { return __awaiter(this, void 0, void 0, function* () { if (this._disposed) { throw new Error("Client has already been disposed."); } let info = this._prepareRequest(verb, requestUrl, headers); // Only perform retries on reads since writes may not be idempotent. let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1; let numTries = 0; let response; while (numTries < maxTries) { response = yield this.requestRaw(info, data); // Check if it's an authentication challenge if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { let authenticationHandler; for (let i = 0; i < this.handlers.length; i++) { if (this.handlers[i].canHandleAuthentication(response)) { authenticationHandler = this.handlers[i]; break; } } if (authenticationHandler) { return authenticationHandler.handleAuthentication(this, info, data); } else { // We have received an unauthorized response but have no handlers to handle it. // Let the response return to the caller. return response; } } let redirectsRemaining = this._maxRedirects; while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && this._allowRedirects && redirectsRemaining > 0) { const redirectUrl = response.message.headers["location"]; if (!redirectUrl) { // if there's no location to redirect to, we won't break; } // we need to finish reading the response before reassigning response // which will leak the open socket. yield response.readBody(); // let's make the request with the new redirectUrl info = this._prepareRequest(verb, redirectUrl, headers); response = yield this.requestRaw(info, data); redirectsRemaining--; } if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { // If not a retry code, return immediately instead of retrying return response; } numTries += 1; if (numTries < maxTries) { yield response.readBody(); yield this._performExponentialBackoff(numTries); } } return response; }); } /** * Needs to be called if keepAlive is set to true in request options. */ dispose() { if (this._agent) { this._agent.destroy(); } this._disposed = true; } /** * Raw request. * @param info * @param data */ requestRaw(info, data) { return new Promise((resolve, reject) => { let callbackForResult = function (err, res) { if (err) { reject(err); } resolve(res); }; this.requestRawWithCallback(info, data, callbackForResult); }); } /** * Raw request with callback. * @param info * @param data * @param onResult */ requestRawWithCallback(info, data, onResult) { let socket; let isDataString = typeof (data) === 'string'; if (typeof (data) === 'string') { info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8'); } let callbackCalled = false; let handleResult = (err, res) => { if (!callbackCalled) { callbackCalled = true; onResult(err, res); } }; let req = info.httpModule.request(info.options, (msg) => { let res = new HttpClientResponse(msg); handleResult(null, res); }); req.on('socket', (sock) => { socket = sock; }); // If we ever get disconnected, we want the socket to timeout eventually req.setTimeout(this._socketTimeout || 3 * 60000, () => { if (socket) { socket.end(); } handleResult(new Error('Request timeout: ' + info.options.path), null); }); req.on('error', function (err) { // err has statusCode property // res should have headers handleResult(err, null); }); if (data && typeof (data) === 'string') { req.write(data, 'utf8'); } if (data && typeof (data) !== 'string') { data.on('close', function () { req.end(); }); data.pipe(req); } else { req.end(); } } _prepareRequest(method, requestUrl, headers) { const info = {}; info.parsedUrl = url.parse(requestUrl); const usingSsl = info.parsedUrl.protocol === 'https:'; info.httpModule = usingSsl ? https : http; const defaultPort = usingSsl ? 443 : 80; info.options = {}; info.options.host = info.parsedUrl.hostname; info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); info.options.method = method; info.options.headers = this._mergeHeaders(headers); info.options.headers["user-agent"] = this.userAgent; info.options.agent = this._getAgent(requestUrl); // gives handlers an opportunity to participate if (this.handlers && !this._isPresigned(requestUrl)) { this.handlers.forEach((handler) => { handler.prepareRequest(info.options); }); } return info; } _isPresigned(requestUrl) { if (this.requestOptions && this.requestOptions.presignedUrlPatterns) { const patterns = this.requestOptions.presignedUrlPatterns; for (let i = 0; i < patterns.length; i++) { if (requestUrl.match(patterns[i])) { return true; } } } return false; } _mergeHeaders(headers) { const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); if (this.requestOptions && this.requestOptions.headers) { return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); } return lowercaseKeys(headers || {}); } _getAgent(requestUrl) { let agent; let proxy = this._getProxy(requestUrl); let useProxy = proxy.proxyUrl && proxy.proxyUrl.hostname && !this._isBypassProxy(requestUrl); if (this._keepAlive && useProxy) { agent = this._proxyAgent; } if (this._keepAlive && !useProxy) { agent = this._agent; } // if agent is already assigned use that agent. if (!!agent) { return agent; } let parsedUrl = url.parse(requestUrl); const usingSsl = parsedUrl.protocol === 'https:'; let maxSockets = 100; if (!!this.requestOptions) { maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; } if (useProxy) { // If using proxy, need tunnel if (!tunnel) { tunnel = __webpack_require__(413); } const agentOptions = { maxSockets: maxSockets, keepAlive: this._keepAlive, proxy: { proxyAuth: proxy.proxyAuth, host: proxy.proxyUrl.hostname, port: proxy.proxyUrl.port }, }; let tunnelAgent; const overHttps = proxy.proxyUrl.protocol === 'https:'; if (usingSsl) { tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; } else { tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; } agent = tunnelAgent(agentOptions); this._proxyAgent = agent; } // if reusing agent across request and tunneling agent isn't assigned create a new agent if (this._keepAlive && !agent) { const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } // if not using private agent and tunnel agent isn't setup then use global agent if (!agent) { agent = usingSsl ? https.globalAgent : http.globalAgent; } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options // we have to cast it to any and change it directly agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); } if (usingSsl && this._certConfig) { agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase }); } return agent; } _getProxy(requestUrl) { const parsedUrl = url.parse(requestUrl); let usingSsl = parsedUrl.protocol === 'https:'; let proxyConfig = this._httpProxy; // fallback to http_proxy and https_proxy env let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY]; let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY]; if (!proxyConfig) { if (https_proxy && usingSsl) { proxyConfig = { proxyUrl: https_proxy }; } else if (http_proxy) { proxyConfig = { proxyUrl: http_proxy }; } } let proxyUrl; let proxyAuth; if (proxyConfig) { if (proxyConfig.proxyUrl.length > 0) { proxyUrl = url.parse(proxyConfig.proxyUrl); } if (proxyConfig.proxyUsername || proxyConfig.proxyPassword) { proxyAuth = proxyConfig.proxyUsername + ":" + proxyConfig.proxyPassword; } } return { proxyUrl: proxyUrl, proxyAuth: proxyAuth }; } _isBypassProxy(requestUrl) { if (!this._httpProxyBypassHosts) { return false; } let bypass = false; this._httpProxyBypassHosts.forEach(bypassHost => { if (bypassHost.test(requestUrl)) { bypass = true; } }); return bypass; } _performExponentialBackoff(retryNumber) { retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); return new Promise(resolve => setTimeout(() => resolve(), ms)); } } exports.HttpClient = HttpClient; /***/ }), /***/ 876: /***/ (function(module) { module.exports = require("http"); /***/ }), /***/ 885: /***/ (function(module) { // vim:ts=4:sts=4:sw=4: /*! * * Copyright 2009-2017 Kris Kowal under the terms of the MIT * license found at https://github.com/kriskowal/q/blob/v1/LICENSE * * With parts by Tyler Close * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found * at http://www.opensource.org/licenses/mit-license.html * Forked at ref_send.js version: 2009-05-11 * * With parts by Mark Miller * Copyright (C) 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ (function (definition) { "use strict"; // This file will function properly as a