diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00d7d2e8a..66f4f67c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,8 +17,8 @@ jobs: git fetch --prune --unshallow - run: | npm install - npm run build:github:prod - npm run build:azure:prod + npm run build:github + npm run build:azure name: Build code - name: Install GitVersion uses: ./setup-gitversion diff --git a/dist/azure/execute-gitversion/bundle.js b/dist/azure/execute-gitversion/bundle.js index b813e3099..3c4b7dca7 100644 --- a/dist/azure/execute-gitversion/bundle.js +++ b/dist/azure/execute-gitversion/bundle.js @@ -1,43 +1,18286 @@ -module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=116)}([function(e,t){e.exports=require("fs")},function(e,t,n){var r=n(7),i=n(0),o=n(15),s={silent:!1,fatal:!1};t.config=s;var a={error:null,currentCmd:"shell.js",tempDir:null};t.state=a;var c=r.type().match(/^Win/)?"win":"unix";function u(){s.silent||console.log.apply(this,arguments)}function l(e,t){if(null===a.error&&(a.error=""),a.error+=a.currentCmd+": "+e+"\n",e.length>0&&u(a.error),s.fatal&&process.exit(1),!t)throw""}t.platform=c,t.log=u,t.error=l,t.ShellString=function(e){return e},t.parseOptions=function(e,t){t||l("parseOptions() internal error: no map given");var n={};for(var r in t)n[t[r]]=!1;if(!e)return n;"string"!=typeof e&&l("parseOptions() internal error: wrong str");var i=e.match(/^\-(.+)/);return i?(i[1].split("").forEach((function(e){e in t?n[t[e]]=!0:l("option not recognized: "+e)})),n):n},t.expand=function(e){var t=[];return e.forEach((function(e){if(e.search(/\*[^\/]*\//)>-1||e.search(/\*\*[^\/]*\//)>-1){var n=e.match(/^([^*]+\/|)(.*)/),r=n[1],i=n[2].replace(/\*\*/g,".*").replace(/\*/g,"[^\\/]*");i=new RegExp(i),o("-R",r).filter((function(e){return i.test(e)})).forEach((function(e){t.push(e)}))}else e.search(/\*/)>-1?o("",e).forEach((function(e){t.push(e)})):t.push(e)})),t},t.unlinkSync=function(e){try{i.unlinkSync(e)}catch(t){if("EPERM"!==t.code)throw t;i.chmodSync(e,"0666"),i.unlinkSync(e)}},t.randomFileName=function(){return"shelljs_"+function e(t){if(1===t)return parseInt(16*Math.random(),10).toString(16);for(var n="",r=0;r= than the number of constructor arguments of its base class."},t.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",t.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",t.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",t.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",t.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class",t.POST_CONSTRUCT_ERROR=function(){for(var e=[],t=0;t)?=?)";var E=s++;o[E]=o[c]+"|x|X|\\*";var T=s++;o[T]=o[a]+"|x|X|\\*";var O=s++;o[O]="[v=\\s]*("+o[T]+")(?:\\.("+o[T]+")(?:\\.("+o[T]+")(?:"+o[h]+")?"+o[v]+"?)?)?";var x=s++;o[x]="[v=\\s]*("+o[E]+")(?:\\.("+o[E]+")(?:\\.("+o[E]+")(?:"+o[g]+")?"+o[v]+"?)?)?";var A=s++;o[A]="^"+o[S]+"\\s*"+o[O]+"$";var P=s++;o[P]="^"+o[S]+"\\s*"+o[x]+"$";var R=s++;o[R]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var C=s++;o[C]="(?:~>?)";var I=s++;o[I]="(\\s*)"+o[C]+"\\s+",i[I]=new RegExp(o[I],"g");var k=s++;o[k]="^"+o[C]+o[O]+"$";var N=s++;o[N]="^"+o[C]+o[x]+"$";var j=s++;o[j]="(?:\\^)";var M=s++;o[M]="(\\s*)"+o[j]+"\\s+",i[M]=new RegExp(o[M],"g");var D=s++;o[D]="^"+o[j]+o[O]+"$";var B=s++;o[B]="^"+o[j]+o[x]+"$";var F=s++;o[F]="^"+o[S]+"\\s*("+b+")$|^$";var L=s++;o[L]="^"+o[S]+"\\s*("+_+")$|^$";var U=s++;o[U]="(\\s*)"+o[S]+"\\s*("+b+"|"+o[O]+")",i[U]=new RegExp(o[U],"g");var V=s++;o[V]="^\\s*("+o[O]+")\\s+-\\s+("+o[O]+")\\s*$";var q=s++;o[q]="^\\s*("+o[x]+")\\s+-\\s+("+o[x]+")\\s*$";var G=s++;o[G]="(<|>)?=?\\s*\\*";for(var H=0;H<35;H++)n(H,o[H]),i[H]||(i[H]=new RegExp(o[H]));function W(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof $)return e;if("string"!=typeof e)return null;if(e.length>256)return null;if(!(t.loose?i[w]:i[m]).test(e))return null;try{return new $(e,t)}catch(e){return null}}function $(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof $){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof $))return new $(e,t);n("SemVer",e,t),this.options=t,this.loose=!!t.loose;var o=e.trim().match(t.loose?i[w]:i[m]);if(!o)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);-1===n&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},t.inc=function(e,t,n,r){"string"==typeof n&&(r=n,n=void 0);try{return new $(e,n).inc(t,r).version}catch(e){return null}},t.diff=function(e,t){if(Q(e,t))return null;var n=W(e),r=W(t),i="";if(n.prerelease.length||r.prerelease.length){i="pre";var o="prerelease"}for(var s in n)if(("major"===s||"minor"===s||"patch"===s)&&n[s]!==r[s])return i+s;return o},t.compareIdentifiers=Y;var z=/^[0-9]+$/;function Y(e,t){var n=z.test(e),r=z.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e0}function X(e,t,n){return K(e,t,n)<0}function Q(e,t,n){return 0===K(e,t,n)}function Z(e,t,n){return 0!==K(e,t,n)}function ee(e,t,n){return K(e,t,n)>=0}function te(e,t,n){return K(e,t,n)<=0}function ne(e,t,n,r){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return Q(e,n,r);case"!=":return Z(e,n,r);case">":return J(e,n,r);case">=":return ee(e,n,r);case"<":return X(e,n,r);case"<=":return te(e,n,r);default:throw new TypeError("Invalid operator: "+t)}}function re(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof re){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof re))return new re(e,t);n("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ie?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}t.rcompareIdentifiers=function(e,t){return Y(t,e)},t.major=function(e,t){return new $(e,t).major},t.minor=function(e,t){return new $(e,t).minor},t.patch=function(e,t){return new $(e,t).patch},t.compare=K,t.compareLoose=function(e,t){return K(e,t,!0)},t.rcompare=function(e,t,n){return K(t,e,n)},t.sort=function(e,n){return e.sort((function(e,r){return t.compare(e,r,n)}))},t.rsort=function(e,n){return e.sort((function(e,r){return t.rcompare(e,r,n)}))},t.gt=J,t.lt=X,t.eq=Q,t.neq=Z,t.gte=ee,t.lte=te,t.cmp=ne,t.Comparator=re;var ie={};function oe(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof oe)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new oe(e.raw,t);if(e instanceof re)return new oe(e.value,t);if(!(this instanceof oe))return new oe(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}function se(e){return!e||"x"===e.toLowerCase()||"*"===e}function ae(e,t,n,r,i,o,s,a,c,u,l,p,f){return((t=se(n)?"":se(r)?">="+n+".0.0":se(i)?">="+n+"."+r+".0":">="+t)+" "+(a=se(c)?"":se(u)?"<"+(+c+1)+".0.0":se(l)?"<"+c+"."+(+u+1)+".0":p?"<="+c+"."+u+"."+l+"-"+p:"<="+a)).trim()}function ce(e,t,r){for(var i=0;i0){var o=e[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}function ue(e,t,n){try{t=new oe(t,n)}catch(e){return!1}return t.test(e)}function le(e,t,n,r){var i,o,s,a,c;switch(e=new $(e,r),t=new oe(t,r),n){case">":i=J,o=te,s=X,a=">",c=">=";break;case"<":i=X,o=ee,s=J,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ue(e,t,r))return!1;for(var u=0;u=0.0.0")),p=p||e,f=f||e,i(e.semver,p.semver,r)?p=e:s(e.semver,f.semver,r)&&(f=e)})),p.operator===a||p.operator===c)return!1;if((!f.operator||f.operator===a)&&o(e,f.semver))return!1;if(f.operator===c&&s(e,f.semver))return!1}return!0}re.prototype.parse=function(e){var t=this.options.loose?i[F]:i[L],n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=n[1],"="===this.operator&&(this.operator=""),n[2]?this.semver=new $(n[2],this.options.loose):this.semver=ie},re.prototype.toString=function(){return this.value},re.prototype.test=function(e){return n("Comparator.test",e,this.options.loose),this.semver===ie||("string"==typeof e&&(e=new $(e,this.options)),ne(e,this.operator,this.semver,this.options))},re.prototype.intersects=function(e,t){if(!(e instanceof re))throw new TypeError("a Comparator is required");var n;if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return n=new oe(e.value,t),ue(this.value,n,t);if(""===e.operator)return n=new oe(this.value,t),ue(e.semver,n,t);var r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),o=this.semver.version===e.semver.version,s=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=ne(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),c=ne(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||i||o&&s||a||c},t.Range=oe,oe.prototype.format=function(){return this.range=this.set.map((function(e){return e.join(" ").trim()})).join("||").trim(),this.range},oe.prototype.toString=function(){return this.range},oe.prototype.parseRange=function(e){var t=this.options.loose;e=e.trim();var r=t?i[q]:i[V];e=e.replace(r,ae),n("hyphen replace",e),e=e.replace(i[U],"$1$2$3"),n("comparator trim",e,i[U]),e=(e=(e=e.replace(i[I],"$1~")).replace(i[M],"$1^")).split(/\s+/).join(" ");var o=t?i[F]:i[L],s=e.split(" ").map((function(e){return function(e,t){return n("comp",e,t),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){n("caret",e,t);var r=t.loose?i[B]:i[D];return e.replace(r,(function(t,r,i,o,s){var a;return n("caret",e,t,r,i,o,s),se(r)?a="":se(i)?a=">="+r+".0.0 <"+(+r+1)+".0.0":se(o)?a="0"===r?">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":">="+r+"."+i+".0 <"+(+r+1)+".0.0":s?(n("replaceCaret pr",s),a="0"===r?"0"===i?">="+r+"."+i+"."+o+"-"+s+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+"-"+s+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+"-"+s+" <"+(+r+1)+".0.0"):(n("no pr"),a="0"===r?"0"===i?">="+r+"."+i+"."+o+" <"+r+"."+i+"."+(+o+1):">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0":">="+r+"."+i+"."+o+" <"+(+r+1)+".0.0"),n("caret return",a),a}))}(e,t)})).join(" ")}(e,t),n("caret",e),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){var r=t.loose?i[N]:i[k];return e.replace(r,(function(t,r,i,o,s){var a;return n("tilde",e,t,r,i,o,s),se(r)?a="":se(i)?a=">="+r+".0.0 <"+(+r+1)+".0.0":se(o)?a=">="+r+"."+i+".0 <"+r+"."+(+i+1)+".0":s?(n("replaceTilde pr",s),a=">="+r+"."+i+"."+o+"-"+s+" <"+r+"."+(+i+1)+".0"):a=">="+r+"."+i+"."+o+" <"+r+"."+(+i+1)+".0",n("tilde return",a),a}))}(e,t)})).join(" ")}(e,t),n("tildes",e),e=function(e,t){return n("replaceXRanges",e,t),e.split(/\s+/).map((function(e){return function(e,t){e=e.trim();var r=t.loose?i[P]:i[A];return e.replace(r,(function(t,r,i,o,s,a){n("xRange",e,t,r,i,o,s,a);var c=se(i),u=c||se(o),l=u||se(s);return"="===r&&l&&(r=""),c?t=">"===r||"<"===r?"<0.0.0":"*":r&&l?(u&&(o=0),s=0,">"===r?(r=">=",u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",u?i=+i+1:o=+o+1),t=r+i+"."+o+"."+s):u?t=">="+i+".0.0 <"+(+i+1)+".0.0":l&&(t=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),n("xRange return",t),t}))}(e,t)})).join(" ")}(e,t),n("xrange",e),e=function(e,t){return n("replaceStars",e,t),e.trim().replace(i[G],"")}(e,t),n("stars",e),e}(e,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(s=s.filter((function(e){return!!e.match(o)}))),s=s.map((function(e){return new re(e,this.options)}),this)},oe.prototype.intersects=function(e,t){if(!(e instanceof oe))throw new TypeError("a Range is required");return this.set.some((function(n){return n.every((function(n){return e.set.some((function(e){return e.every((function(e){return n.intersects(e,t)}))}))}))}))},t.toComparators=function(e,t){return new oe(e,t).set.map((function(e){return e.map((function(e){return e.value})).join(" ").trim().split(" ")}))},oe.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new $(e,this.options));for(var t=0;t":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!J(n,t)||(n=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}}))}if(n&&e.test(n))return n;return null},t.validRange=function(e,t){try{return new oe(e,t).range||"*"}catch(e){return null}},t.ltr=function(e,t,n){return le(e,t,"<",n)},t.gtr=function(e,t,n){return le(e,t,">",n)},t.outside=le,t.prerelease=function(e,t){var n=W(e,t);return n&&n.prerelease.length?n.prerelease:null},t.intersects=function(e,t,n){return e=new oe(e,n),t=new oe(t,n),e.intersects(t)},t.coerce=function(e){if(e instanceof $)return e;if("string"!=typeof e)return null;var t=e.match(i[R]);if(null==t)return null;return W(t[1]+"."+(t[2]||"0")+"."+(t[3]||"0"))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);t.METADATA_KEY=r;var i=n(46);t.Container=i.Container;var o=n(6);t.BindingScopeEnum=o.BindingScopeEnum,t.BindingTypeEnum=o.BindingTypeEnum,t.TargetTypeEnum=o.TargetTypeEnum;var s=n(62);t.AsyncContainerModule=s.AsyncContainerModule,t.ContainerModule=s.ContainerModule;var a=n(63);t.injectable=a.injectable;var c=n(64);t.tagged=c.tagged;var u=n(65);t.named=u.named;var l=n(28);t.inject=l.inject,t.LazyServiceIdentifer=l.LazyServiceIdentifer;var p=n(66);t.optional=p.optional;var f=n(67);t.unmanaged=f.unmanaged;var d=n(68);t.multiInject=d.multiInject;var h=n(69);t.targetName=h.targetName;var g=n(70);t.postConstruct=g.postConstruct;var y=n(26);t.MetadataReader=y.MetadataReader;var v=n(9);t.id=v.id;var m=n(8);t.decorate=m.decorate;var _=n(31);t.traverseAncerstors=_.traverseAncerstors,t.taggedConstraint=_.taggedConstraint,t.namedConstraint=_.namedConstraint,t.typeConstraint=_.typeConstraint;var b=n(10);t.getServiceIdentifierAsString=b.getServiceIdentifierAsString;var w=n(71);t.multiBindToService=w.multiBindToService},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),i=function(){function e(e){this._binding=e}return e.prototype.onActivation=function(e){return this._binding.onActivation=e,new r.BindingWhenSyntax(this._binding)},e}();t.BindingOnSyntax=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),i=n(31),o=function(){function e(e){this._binding=e}return e.prototype.when=function(e){return this._binding.constraint=e,new r.BindingOnSyntax(this._binding)},e.prototype.whenTargetNamed=function(e){return this._binding.constraint=i.namedConstraint(e),new r.BindingOnSyntax(this._binding)},e.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){return null!==e.target&&!e.target.isNamed()&&!e.target.isTagged()},new r.BindingOnSyntax(this._binding)},e.prototype.whenTargetTagged=function(e,t){return this._binding.constraint=i.taggedConstraint(e)(t),new r.BindingOnSyntax(this._binding)},e.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(t){return i.typeConstraint(e)(t.parentRequest)},new r.BindingOnSyntax(this._binding)},e.prototype.whenParentNamed=function(e){return this._binding.constraint=function(t){return i.namedConstraint(e)(t.parentRequest)},new r.BindingOnSyntax(this._binding)},e.prototype.whenParentTagged=function(e,t){return this._binding.constraint=function(n){return i.taggedConstraint(e)(t)(n.parentRequest)},new r.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(t){return i.traverseAncerstors(t,i.typeConstraint(e))},new r.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(t){return!i.traverseAncerstors(t,i.typeConstraint(e))},new r.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(t){return i.traverseAncerstors(t,i.namedConstraint(e))},new r.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(t){return!i.traverseAncerstors(t,i.namedConstraint(e))},new r.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._binding.constraint=function(n){return i.traverseAncerstors(n,i.taggedConstraint(e)(t))},new r.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorTagged=function(e,t){return this._binding.constraint=function(n){return!i.traverseAncerstors(n,i.taggedConstraint(e)(t))},new r.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(t){return i.traverseAncerstors(t,e)},new r.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(t){return!i.traverseAncerstors(t,e)},new r.BindingOnSyntax(this._binding)},e}();t.BindingWhenSyntax=o},function(e,t,n){var r=n(2),i=n(0),o=n(1),s=n(16),a=n(17);e.exports=function e(t,n){(t=o.parseOptions(t,{R:"recursive",A:"all",a:"all_deprecated"})).all_deprecated&&(o.log("ls: Option -a is deprecated. Use -A instead"),t.all=!0),n?"object"==typeof n?n=n:"string"==typeof n&&(n=[].slice.call(arguments,1)):n=["."];var c=[];function u(e,n){return!!("."!==r.basename(e)[0]||t.all||"."===r.basename(n)[0]&&r.basename(n).length>1)&&("win"===o.platform&&(e=e.replace(/\\/g,"/")),c.push(e),!0)}return n.forEach((function(n){if(i.existsSync(n)){var l=i.statSync(n);if(l.isFile())return void u(n,n);if(l.isDirectory())return void i.readdirSync(n).forEach((function(r){if(u(r,n)&&t.recursive){var o=a();s("",n),i.statSync(r).isDirectory()&&(c=c.concat(e("-R"+(t.all?"A":""),r+"/*"))),s("",o)}}))}var p=r.basename(n),f=r.dirname(n);if(p.search(/\*/)>-1&&i.existsSync(f)&&i.statSync(f).isDirectory){var d=p.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g,"\\$1");return d="^"+d.replace(/\*/g,".*")+"$",void i.readdirSync(f).forEach((function(n){if(n.match(new RegExp(d))){if(!u(r.normalize(f+"/"+n),p))return;if(t.recursive){var o=f+"/"+n;i.lstatSync(o).isDirectory()&&(c=c.concat(e("-R"+(t.all?"A":""),o+"/*")))}}}))}o.error("no such file or directory: "+n,!0)})),c}},function(e,t,n){var r=n(0),i=n(1);e.exports=function(e,t){t||i.error("directory not specified"),r.existsSync(t)||i.error("no such file or directory: "+t),r.statSync(t).isDirectory()||i.error("not a directory: "+t),process.chdir(t)}},function(e,t,n){var r=n(2),i=n(1);e.exports=function(e){var t=r.resolve(process.cwd());return i.ShellString(t)}},function(e,t,n){var r=n(1),i=n(16),o=n(2),s=[];function a(e){return/^[\-+]\d+$/.test(e)}function c(e){if(a(e)){if(Math.abs(e)1))return r.error("no other directory");n=n.splice(1,1).concat(n)}return e["no-cd"]?n=n.slice(1):(t=o.resolve(n.shift()),i("",t)),s=n,l("")},t.popd=function(e,t){if(a(e)&&(t=e,e=""),e=r.parseOptions(e,{n:"no-cd"}),!s.length)return r.error("directory stack empty");if(t=c(t||"+0"),e["no-cd"]||t>0||s.length+t===0)t=t>0?t-1:t,s.splice(t,1);else{var n=o.resolve(s.shift());i("",n)}return l("")},t.dirs=l},function(e,t){e.exports=require("child_process")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?i+=r.charAt(s):a<128?i+=o[a]:a<2048?i+=o[192|a>>6]+o[128|63&a]:a<55296||a>=57344?i+=o[224|a>>12]+o[128|a>>6&63]+o[128|63&a]:(s+=1,a=65536+((1023&a)<<10|1023&r.charCodeAt(s)),i+=o[240|a>>18]+o[128|a>>12&63]+o[128|a>>6&63]+o[128|63&a])}return i},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,n,o){if(!n)return t;if("object"!=typeof n){if(i(t))t.push(n);else{if(!t||"object"!=typeof t)return[t,n];(o&&(o.plainObjects||o.allowPrototypes)||!r.call(Object.prototype,n))&&(t[n]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(n);var a=t;return i(t)&&!i(n)&&(a=s(t,o)),i(t)&&i(n)?(n.forEach((function(n,i){if(r.call(t,i)){var s=t[i];s&&"object"==typeof s&&n&&"object"==typeof n?t[i]=e(s,n,o):t.push(n)}else t[i]=n})),t):Object.keys(n).reduce((function(t,i){var s=n[i];return r.call(t,i)?t[i]=e(t[i],s,o):t[i]=s,t}),a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={IBuildAgent:Symbol.for("BuildAgent"),IDotnetTool:Symbol.for("DotnetTool"),IGitVersionTool:Symbol.for("GitVersionTool"),IVersionManager:Symbol.for("VersionManager")};t.TYPES=r;t.SetupOptions={includePrerelease:"includePrerelease",versionSpec:"versionSpec"};t.RunOptions={targetPath:"targetPath",useConfigFile:"useConfigFile",configFilePath:"configFilePath",updateAssemblyInfo:"configFilePath",updateAssemblyInfoFilename:"configFilePath",additionalArguments:"additionalArguments"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=function(){function e(){}return e.prototype.getConstructorMetadata=function(e){return{compilerGeneratedMetadata:Reflect.getMetadata(r.PARAM_TYPES,e),userGeneratedMetadata:Reflect.getMetadata(r.TAGGED,e)||{}}},e.prototype.getPropertiesMetadata=function(e){return Reflect.getMetadata(r.TAGGED_PROP,e)||[]},e}();t.MetadataReader=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);t.isStackOverflowExeption=function(e){return e instanceof RangeError||e.message===r.STACK_OVERFLOW}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(3),o=n(5),s=n(8),a=function(){function e(e){this._cb=e}return e.prototype.unwrap=function(){return this._cb()},e}();t.LazyServiceIdentifer=a,t.inject=function(e){return function(t,n,a){if(void 0===e)throw new Error(r.UNDEFINED_INJECT_ANNOTATION(t.name));var c=new o.Metadata(i.INJECT_TAG,e);"number"==typeof a?s.tagParameter(t,n,a,c):s.tagProperty(t,n,c)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(9),o=n(5),s=n(53),a=function(){function e(e,t,n,a){this.id=i.id(),this.type=e,this.serviceIdentifier=n,this.name=new s.QueryableString(t||""),this.metadata=new Array;var c=null;"string"==typeof a?c=new o.Metadata(r.NAMED_TAG,a):a instanceof o.Metadata&&(c=a),null!==c&&this.metadata.push(c)}return e.prototype.hasTag=function(e){for(var t=0,n=this.metadata;t=e.level;)o.pop();if(o.some((function(e){return e==a})))return t.debug(" cycle detected"),"continue";o.push(a)}for(var c=e.level+1,u=p.readdirSync(e.path).map((function(t){return new O(f.join(e.path,t),c)})),l=u.length-1;l>=0;l--)i.push(u[l])}else t.debug(" "+e.path+" (file)")};i.length;)s();return t.debug(r.length+" results"),r}catch(e){throw new Error(t.loc("LIB_OperationFailed","find",e.message))}}!function(e){e[e.Succeeded=0]="Succeeded",e[e.SucceededWithIssues=1]="SucceededWithIssues",e[e.Failed=2]="Failed",e[e.Cancelled=3]="Cancelled",e[e.Skipped=4]="Skipped"}(r=t.TaskResult||(t.TaskResult={})),function(e){e[e.Unknown=0]="Unknown",e[e.Initialized=1]="Initialized",e[e.InProgress=2]="InProgress",e[e.Completed=3]="Completed"}(i=t.TaskState||(t.TaskState={})),function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning"}(o=t.IssueType||(t.IssueType={})),function(e){e[e.Container=0]="Container",e[e.FilePath=1]="FilePath",e[e.VersionControl=2]="VersionControl",e[e.GitRef=3]="GitRef",e[e.TfvcLabel=4]="TfvcLabel"}(s=t.ArtifactType||(t.ArtifactType={})),function(e){e[e.AuthParameter=0]="AuthParameter",e[e.DataParameter=1]="DataParameter",e[e.Url=2]="Url"}(a=t.FieldType||(t.FieldType={})),function(e){e[e.Windows=0]="Windows",e[e.MacOS=1]="MacOS",e[e.Linux=2]="Linux"}(c=t.Platform||(t.Platform={})),t.setStdStream=g._setStdStream,t.setErrStream=g._setErrStream,t.setResult=_,process.on("uncaughtException",(function(e){_(r.Failed,t.loc("LIB_UnhandledEx",e.message))})),t.setResourcePath=g._setResourcePath,t.loc=g._loc,t.getVariable=g._getVariable,t.assertAgent=b,t.getVariables=function(){return Object.keys(g._knownVariableMap).map((function(e){var n=g._knownVariableMap[e];return{name:n.name,value:t.getVariable(n.name),secret:n.secret}}))},t.setVariable=function(e,n,r){void 0===r&&(r=!1);var i=g._getVariableKey(e);g._knownVariableMap.hasOwnProperty(i)&&(r=r||g._knownVariableMap[i].secret);var o=n||"";if(t.debug("set "+e+"="+(r&&o?"********":o)),r){if(o&&o.match(/\r|\n/)&&"TRUE"!=(""+process.env.SYSTEM_UNSAFEALLOWMULTILINESECRET).toUpperCase())throw new Error(t.loc("LIB_MultilineSecret"));g._vault.storeSecret("SECRET_"+i,o),delete process.env[i]}else process.env[i]=o;g._knownVariableMap[i]={name:e,secret:r},t.command("task.setvariable",{variable:e||"",issecret:(r||!1).toString()},o)},t.setSecret=function(e){if(e){if(e.match(/\r|\n/)&&"TRUE"!==(""+process.env.SYSTEM_UNSAFEALLOWMULTILINESECRET).toUpperCase())throw new Error(t.loc("LIB_MultilineSecret"));t.command("task.setsecret",{},e)}},t.getInput=w,t.getBoolInput=function(e,t){return"TRUE"==(w(e,t)||"").toUpperCase()},t.getDelimitedInput=function(e,t,n){var r=w(e,n);if(!r)return[];var i=[];return r.split(t).forEach((function(e){e&&i.push(e)})),i},t.filePathSupplied=function(e){var n=this.resolve(this.getPathInput(e)||"")!==this.resolve(t.getVariable("build.sourcesDirectory")||t.getVariable("system.defaultWorkingDirectory")||"");return t.debug(e+"path supplied :"+n),n},t.getPathInput=function(e,n,r){var i=w(e,n);return i&&r&&t.checkPath(i,e),i},t.getEndpointUrl=function(e,n){var r=process.env["ENDPOINT_URL_"+e];if(!n&&!r)throw new Error(t.loc("LIB_EndpointNotExist",e));return t.debug(e+"="+r),r},t.getEndpointDataParameter=function(e,n,r){var i=process.env["ENDPOINT_DATA_"+e+"_"+n.toUpperCase()];if(!r&&!i)throw new Error(t.loc("LIB_EndpointDataNotExist",e,n));return t.debug(e+" data "+n+" = "+i),i},t.getEndpointAuthorizationScheme=function(e,n){var r=g._vault.retrieveSecret("ENDPOINT_AUTH_SCHEME_"+e);if(!n&&!r)throw new Error(t.loc("LIB_EndpointAuthNotExist",e));return t.debug(e+" auth scheme = "+r),r},t.getEndpointAuthorizationParameter=function(e,n,r){var i=g._vault.retrieveSecret("ENDPOINT_AUTH_PARAMETER_"+e+"_"+n.toUpperCase());if(!r&&!i)throw new Error(t.loc("LIB_EndpointAuthNotExist",e));return t.debug(e+" auth param "+n+" = "+i),i},t.getEndpointAuthorization=function(e,n){var i,o=g._vault.retrieveSecret("ENDPOINT_AUTH_"+e);n||o||_(r.Failed,t.loc("LIB_EndpointAuthNotExist",e)),t.debug(e+" exists "+(null!==o));try{o&&(i=JSON.parse(o))}catch(e){throw new Error(t.loc("LIB_InvalidEndpointAuth",o))}return i},t.getSecureFileName=function(e){var n=process.env["SECUREFILE_NAME_"+e];return t.debug("secure file name for id "+e+" = "+n),n},t.getSecureFileTicket=function(e){var n=g._vault.retrieveSecret("SECUREFILE_TICKET_"+e);return t.debug("secure file ticket for id "+e+" = "+n),n},t.getTaskVariable=function(e){b("2.115.0");var n=g._vault.retrieveSecret("VSTS_TASKVARIABLE_"+g._getVariableKey(e));return n&&(n=n.trim()),t.debug("task variable: "+e+"="+n),n},t.setTaskVariable=function(e,n,r){void 0===r&&(r=!1),b("2.115.0");var i=g._getVariableKey(e),o=n||"";t.debug("set task variable: "+e+"="+(r&&o?"********":o)),g._vault.storeSecret("VSTS_TASKVARIABLE_"+i,o),delete process.env[i],t.command("task.settaskvariable",{variable:e||"",issecret:(r||!1).toString()},o)},t.command=g._command,t.warning=g._warning,t.error=g._error,t.debug=g._debug,t.stats=function(e){return p.statSync(e)},t.exist=g._exist,t.writeFile=function(e,t,n){"string"==typeof n?p.writeFileSync(e,t,{encoding:n}):p.writeFileSync(e,t,n)},t.osType=function(){return d.type()},t.getPlatform=E,t.cwd=function(){return process.cwd()},t.checkPath=g._checkPath,t.cd=function(e){e&&(u.cd(e),S("cd"))},t.pushd=function(e){u.pushd(e),S("pushd")},t.popd=function(){u.popd(),S("popd")},t.mkdirP=function(e){if(!e)throw new Error(t.loc("LIB_ParameterIsRequired","p"));for(var n=[],r=e;;){if(n.length>=(process.env.TASKLIB_TEST_MKDIRP_FAILSAFE||1e3))return t.debug("loop is out of control"),void p.mkdirSync(e);t.debug("testing directory '"+r+"'");var i=void 0;try{i=p.statSync(r)}catch(i){if("ENOENT"==i.code){var o=f.dirname(r);if(r==o)throw new Error(t.loc("LIB_MkdirFailedInvalidDriveRoot",e,r));n.push(r),r=o;continue}throw"UNKNOWN"==i.code?new Error(t.loc("LIB_MkdirFailedInvalidShare",e,r)):i}if(!i.isDirectory())throw new Error(t.loc("LIB_MkdirFailedFileExists",e,r));break}for(;n.length;){var s=n.pop();t.debug("mkdir '"+s+"'");try{p.mkdirSync(s)}catch(n){throw new Error(t.loc("LIB_MkdirFailed",e,n.message))}}},t.resolve=function(){for(var e=[],n=0;n=0?o:s,s>=0?s:o);t=g._getDirectoryName(e.substring(0,a))}if(!t)return"continue";var c=g._legacyFindFiles_convertPatternToRegExp(e);T(t,{followSymbolicLinks:!0}).filter((function(e){if(r&&i)return!0;var t=p.statSync(e).isDirectory();return r&&!t||i&&t})).forEach((function(e){var t="win32"==process.platform?e.replace(/\\/g,"/"):e,r=t+"/",o=!1;if(c.test(t)||i&&c.test(r)){o=!0;for(var s=0,a=n;s=0)&&(b=g._ensureRooted(r,b),t.debug("rooted pattern: '"+b+"'")),f){t.debug("applying include pattern against original list");var w=h.match(e,b,l);t.debug(w.length+" matches");for(var S=0,E=w;S0){var r=t.getVariable("Agent.ProxyUsername"),i=t.getVariable("Agent.ProxyPassword"),o=JSON.parse(t.getVariable("Agent.ProxyBypassList")||"[]"),s=!1;return e&&o.forEach((function(t){new RegExp(t,"i").test(e)&&(s=!0)})),s?null:{proxyUrl:n,proxyUsername:r,proxyPassword:i,proxyBypassHosts:o}}return null},t.getHttpCertConfiguration=function(){var e=t.getVariable("Agent.CAInfo"),n=t.getVariable("Agent.ClientCert");if(e||n){var r={};if(r.caFile=e,r.certFile=n,n){var i=t.getVariable("Agent.ClientCertKey"),o=t.getVariable("Agent.ClientCertArchive"),s=t.getVariable("Agent.ClientCertPassword");r.keyFile=i,r.certArchiveFile=o,r.passphrase=s}return r}return null};var R=function(){function e(e){this.testRunner=e}return e.prototype.publish=function(e,n,r,i,o,s,a){a=a||"VSTSTask";var c={};c.type=this.testRunner,n&&(c.mergeResults=n),r&&(c.platform=r),i&&(c.config=i),o&&(c.runTitle=o),s&&(c.publishRunAttachments=s),e&&(c.resultFiles=e),c.testRunSystem=a,t.command("results.publish",c,"")},e}();t.TestPublisher=R;var C=function(){function e(){}return e.prototype.publish=function(e,n,r,i){var o={};e&&(o.codecoveragetool=e),n&&(o.summaryfile=n),r&&(o.reportdirectory=r),i&&(o.additionalcodecoveragefiles=i),t.command("codecoverage.publish",o,"")},e}();t.CodeCoveragePublisher=C;var I=function(){function e(e,t){this.buildTool=e,this.ccTool=t}return e.prototype.enableCodeCoverage=function(e){e.buildtool=this.buildTool,e.codecoveragetool=this.ccTool,t.command("codecoverage.enable",e,"")},e}();t.CodeCoverageEnabler=I,t.uploadFile=function(e){t.command("task.uploadfile",null,e)},t.prependPath=function(e){b("2.115.0"),t.command("task.prependpath",null,e)},t.uploadSummary=function(e){t.command("task.uploadsummary",null,e)},t.addAttachment=function(e,n,r){t.command("task.addattachment",{type:e,name:n},r)},t.setEndpoint=function(e,n,r,i){t.command("task.setendpoint",{id:e,field:a[n].toLowerCase(),key:r},i)},t.setProgress=function(e,n){t.command("task.setprogress",{value:""+e},n)},t.logDetail=function(e,n,o,s,a,c,u,l,p,f,d){var h={id:e,parentid:o,type:s,name:a,order:c?c.toString():void 0,starttime:u,finishtime:l,progress:p?p.toString():void 0,state:f?i[f]:void 0,result:d?r[d]:void 0};t.command("task.logdetail",h,n)},t.logIssue=function(e,n,r,i,s,a){var c={type:o[e].toLowerCase(),code:a,sourcepath:r,linenumber:i?i.toString():void 0,columnnumber:s?s.toString():void 0};t.command("task.logissue",c,n)},t.uploadArtifact=function(e,n,r){t.command("artifact.upload",{containerfolder:e,artifactname:r},n)},t.associateArtifact=function(e,n,r){t.command("artifact.associate",{type:s[r].toLowerCase(),artifactname:e},n)},t.uploadBuildLog=function(e){t.command("build.uploadlog",null,e)},t.updateBuildNumber=function(e){t.command("build.updatebuildnumber",null,e)},t.addBuildTag=function(e){t.command("build.addbuildtag",null,e)},t.updateReleaseName=function(e){b("2.132"),t.command("release.updatereleasename",null,e)},t.TaskCommand=y.TaskCommand,t.commandFromString=y.commandFromString,t.ToolRunner=v.ToolRunner,m.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"),global._vsts_task_lib_loaded||(g._loadData(),g._exposeProxySettings(),g._exposeCertSettings())},function(e,t,n){var r=n(1),i=n(7),o=n(0);function s(e){if(!e||!o.existsSync(e))return!1;if(!o.statSync(e).isDirectory())return!1;var t=e+"/"+r.randomFileName();try{return o.writeFileSync(t," "),r.unlinkSync(t),e}catch(e){return!1}}e.exports=function(){var e=r.state;return e.tempDir?e.tempDir:(e.tempDir=s(i.tempDir&&i.tempDir())||s(process.env.TMPDIR)||s(process.env.TEMP)||s(process.env.TMP)||s(process.env.Wimp$ScrapDir)||s("C:\\TEMP")||s("C:\\TMP")||s("\\TEMP")||s("\\TMP")||s("/tmp")||s("/var/tmp")||s("/usr/tmp")||s("."),e.tempDir)}},function(e,t,n){e.exports=l,l.Minimatch=p;var r={sep:"/"};try{r=n(2)}catch(e){}var i=l.GLOBSTAR=p.GLOBSTAR={},o=n(91),s={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},a="().*{}+?[]^$\\!".split("").reduce((function(e,t){return e[t]=!0,e}),{});var c=/\/+/;function u(e,t){e=e||{},t=t||{};var n={};return Object.keys(t).forEach((function(e){n[e]=t[e]})),Object.keys(e).forEach((function(t){n[t]=e[t]})),n}function l(e,t,n){if("string"!=typeof t)throw new TypeError("glob pattern string required");return n||(n={}),!(!n.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new p(t,n).match(e))}function p(e,t){if(!(this instanceof p))return new p(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==r.sep&&(e=e.split(r.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function f(e,t){if(t||(t=this instanceof p?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:o(e)}l.filter=function(e,t){return t=t||{},function(n,r,i){return l(n,e,t)}},l.defaults=function(e){if(!e||!Object.keys(e).length)return l;var t=l,n=function(n,r,i){return t.minimatch(n,r,u(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,u(e,r))},n},p.defaults=function(e){return e&&Object.keys(e).length?l.defaults(e).Minimatch:p},p.prototype.debug=function(){},p.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,n),n=this.globParts=n.map((function(e){return e.split(c)})),this.debug(this.pattern,n),n=n.map((function(e,t,n){return e.map(this.parse,this)}),this),this.debug(this.pattern,n),n=n.filter((function(e){return-1===e.indexOf(!1)})),this.debug(this.pattern,n),this.set=n},p.prototype.parseNegate=function(){var e=this.pattern,t=!1,n=this.options,r=0;if(n.nonegate)return;for(var i=0,o=e.length;i65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return i;if(""===e)return"";var r,o="",c=!!n.nocase,u=!1,l=[],p=[],f=!1,h=-1,g=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",v=this;function m(){if(r){switch(r){case"*":o+="[^/]*?",c=!0;break;case"?":o+="[^/]",c=!0;break;default:o+="\\"+r}v.debug("clearStateChar %j %j",r,o),r=!1}}for(var _,b=0,w=e.length;b-1;P--){var R=p[P],C=o.slice(0,R.reStart),I=o.slice(R.reStart,R.reEnd-8),k=o.slice(R.reEnd-8,R.reEnd),N=o.slice(R.reEnd);k+=N;var j=C.split("(").length-1,M=N;for(b=0;b=0&&!(i=e[o]);o--);for(o=0;o>> no match, partial?",e,f,t,d),f!==a))}if("string"==typeof l?(u=r.nocase?p.toLowerCase()===l.toLowerCase():p===l,this.debug("string match",l,p,u)):(u=p.match(l),this.debug("pattern match",l,p,u)),!u)return!1}if(o===a&&s===c)return!0;if(o===a)return n;if(s===c)return o===a-1&&""===e[o];throw new Error("wtf?")}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(2),o=n(7),s=n(34),a=n(36),c=n(37),u=n(94),l=n(11),p=n(20);function f(e,t){return e.slice(0,t.length)==t}function d(e,t){return e.slice(-t.length)==t}t._knownVariableMap={},l.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"),t._startsWith=f,t._endsWith=d;var h=process.stdout;process.stderr;function g(e){h.write(e+o.EOL)}t._writeLine=g,t._setStdStream=function(e){h=e},t._setErrStream=function(e){e};var y={},v={},m=!1,_="en-US";function b(e){var t;if(P(e)){var n=r.readFileSync(e,"utf8").toString();0==n.indexOf("\ufeff")&&(n=n.slice(1));try{t=JSON.parse(n)}catch(e){A("unable to parse resjson with err: "+e.message)}}else A(".resjson file not found: "+e);return t}function w(e,t){var o={};if(P(e)){var s=n(97)(e);if(s&&s.hasOwnProperty("messages")){var a,c=i.join(i.dirname(e),"Strings","resources.resjson"),u=t.toUpperCase(),l=[];try{l=r.readdirSync(c)}catch(e){}for(var p=0;p0?a.format.apply(this,[n].concat(r)):n}function E(e){var n,r,i=T(e);return t._knownVariableMap.hasOwnProperty(i)&&(r=t._knownVariableMap[i]),r&&r.secret?n=t._vault.retrieveSecret("SECRET_"+i):(n=process.env[i])||"AGENT.JOBSTATUS"!=e.toUpperCase()||(n=process.env["agent.jobstatus"]),A(e+"="+n),n}function T(e){if(!e)throw new Error(S("LIB_ParameterIsRequired","name"));return e.replace(/\./g,"_").replace(/ /g,"_").toUpperCase()}function O(e,t,n){g(new c.TaskCommand(e,t,n).toString())}function x(e){O("task.issue",{type:"warning"},e)}function A(e){O("task.debug",null,e)}function P(e){var t=!1;try{t=!(!e||null==r.statSync(e))}catch(e){if(!e||"ENOENT"!==e.code)throw e;t=!1}return t}function R(e,t){if(A("check path : "+e),!P(e))throw new Error(S("LIB_PathNotFound",t,e))}function C(e,t){try{if((p=r.statSync(e)).isFile())if("win32"==process.platform){var n=i.basename(e),o=n.lastIndexOf(".");if(o>=0){var s=n.substr(o).toUpperCase();if(t.some((function(e){return e.toUpperCase()==s})))return e}}else if(I(p))return e}catch(t){"ENOENT"!=t.code&&A("Unexpected error attempting to determine if executable file exists '"+e+"': "+t)}for(var a=e,c=0,u=t;c0||(8&e.mode)>0&&e.gid===process.getgid()||(64&e.mode)>0&&e.uid===process.getuid()}function k(e){return{debug:e.debug,nobrace:e.nobrace,noglobstar:e.noglobstar,dot:e.dot,noext:e.noext,nocase:e.nocase,nonull:e.nonull,matchBase:e.matchBase,nocomment:e.nocomment,nonegate:e.nonegate,flipNegate:e.flipNegate}}function N(e,t){if(!e)throw new Error('ensurePatternRooted() parameter "root" cannot be empty');if(!t)throw new Error('ensurePatternRooted() parameter "p" cannot be empty');return D(t)?t:(e=B(e),j(e=("win32"==process.platform?e:e.replace(/\\/g,"\\\\")).replace(/(\[)(?=[^\/]+\])/g,"[[]").replace(/\?/g,"[?]").replace(/\*/g,"[*]").replace(/\+\(/g,"[+](").replace(/@\(/g,"[@](").replace(/!\(/g,"[!]("),t))}function j(e,t){if(!e)throw new Error('ensureRooted() parameter "root" cannot be empty');if(!t)throw new Error('ensureRooted() parameter "p" cannot be empty');return D(t)?t:"win32"==process.platform&&e.match(/^[A-Z]:$/i)?e+t:(d(e,"/")||"win32"==process.platform&&d(e,"\\")||(e+=i.sep),e+t)}function M(e){if(!e)return"";if(e=B(e),"win32"==process.platform){if(/^[A-Z]:\\?[^\\]+$/i.test(e))return"\\"==e.charAt(2)?e.substring(0,3):e.substring(0,2);if(/^[A-Z]:\\?$/i.test(e))return"";var t=e.lastIndexOf("\\");return t<0?"":"\\"==e?"":0==t?"\\":/^\\\\[^\\]+(\\[^\\]*)?$/.test(e)?"":e.substring(0,t)}return e.indexOf("/")<0?"":"/"==e?"":d(e,"/")?e.substring(0,e.length-1):i.dirname(e)}function D(e){if(!(e=B(e)))throw new Error('isRooted() parameter "p" cannot be empty');return"win32"==process.platform?f(e,"\\")||/^[A-Z]:/i.test(e):f(e,"/")}function B(e){return e=e||"","win32"==process.platform?(e=e.replace(/\//g,"\\"),(/^\\\\+[^\\]/.test(e)?"\\":"")+e.replace(/\\\\+/g,"\\")):e.replace(/\/\/+/g,"/")}function F(e,t){if(t){var n=p.randomBytes(256),o=p.createCipher("aes-256-ctr",n),s=o.update(t,"utf8","hex");s+=o.final("hex");var a=i.join(E("Agent.TempDirectory")||E("agent.workFolder")||process.cwd(),e);return r.writeFileSync(a,n.toString("base64"),{encoding:"utf8"}),new Buffer(a).toString("base64")+":"+new Buffer(s).toString("base64")}}t._setResourcePath=function(e){if(process.env.TASKLIB_INPROC_UNITS&&(v={},m=!1,y={},_="en-US"),v[e])x(S("LIB_ResourceFileAlreadySet",e));else{R(e,"resource file path"),v[e]=e,A("adding resource file: "+e);var t=w(e,_=E("system.culture")||_);for(var n in t)y[n]=t[n]}},t._loc=S,t._getVariable=E,t._getVariableKey=T,t._command=O,t._warning=x,t._error=function(e){O("task.issue",{type:"error"},e)},t._debug=A,t._exist=P,t._checkPath=R,t._which=function e(t,n){if(!t)throw new Error("parameter 'tool' is required");if(n){var r=e(t,!1);if(r)return r;throw"win32"==process.platform?new Error(S("LIB_WhichNotFound_Win",t)):new Error(S("LIB_WhichNotFound_Linux",t))}A("which '"+t+"'");try{var o=[];if("win32"==process.platform&&process.env.PATHEXT)for(var s=0,a=process.env.PATHEXT.split(i.delimiter);s=0||"win32"==process.platform&&t.indexOf("\\")>=0)return A("not found"),"";var u=[];if(process.env.PATH)for(var l=0,p=process.env.PATH.split(i.delimiter);l0){var t=E("Agent.ProxyUsername"),n=E("Agent.ProxyPassword"),r=E("Agent.ProxyBypassList");global._vsts_task_lib_proxy_url=e,global._vsts_task_lib_proxy_username=t,global._vsts_task_lib_proxy_bypass=r,global._vsts_task_lib_proxy_password=F("proxy",n||""),A("expose agent proxy configuration."),global._vsts_task_lib_proxy=!0}},t._exposeCertSettings=function(){var e=E("Agent.CAInfo");e&&(global._vsts_task_lib_cert_ca=e);var t=E("Agent.ClientCert");if(t){var n=E("Agent.ClientCertKey"),r=E("Agent.ClientCertArchive"),i=E("Agent.ClientCertPassword");global._vsts_task_lib_cert_clientcert=t,global._vsts_task_lib_cert_key=n,global._vsts_task_lib_cert_archive=r,global._vsts_task_lib_cert_passphrase=F("cert",i||"")}(e||t)&&(A("expose agent certificate configuration."),global._vsts_task_lib_cert=!0);var o=E("Agent.SkipCertValidation")||"false";o&&(global._vsts_task_lib_skip_cert_validation="TRUE"===o.toUpperCase())}}).call(this,"/")},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n){e||(e="missing.command"),this.command=e,this.properties=t,this.message=n}return e.prototype.toString=function(){var e="##vso["+this.command;if(this.properties&&Object.keys(this.properties).length>0)for(var t in e+=" ",this.properties)if(this.properties.hasOwnProperty(t)){var n=this.properties[t];n&&(e+=t+"="+(""+(n||"")).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/]/g,"%5D").replace(/;/g,"%3B")+";")}return e+="]",e+=function(e){return e.replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}(""+(this.message||""))},e}();t.TaskCommand=r,t.commandFromString=function(e){var t=e.indexOf("["),n=e.indexOf("]");if(-1==t||-1==n||n-t<3)throw new Error("Invalid command brackets");var i=e.substring(t+1,n),o=i.indexOf(" "),s=i,a={};o>0&&(s=i.trim().substring(0,o),i.trim().substring(o+1).split(";").forEach((function(e){if((e=e.trim()).length>0){var t=e.indexOf("=");if(-1==t)throw new Error("Invalid property: "+e);var n=e.substring(0,t),r=e.substring(t+1);a[n]=r.replace(/%0D/g,"\r").replace(/%0A/g,"\n").replace(/%5D/g,"]").replace(/%3B/g,";").replace(/%25/g,"%")}})));var c=e.substring(n+1).replace(/%0D/g,"\r").replace(/%0A/g,"\n").replace(/%25/g,"%");return new r(s,a,c)}},function(e,t,n){var r=n(95),i=n(96);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t){e.exports=require("events")},function(e,t,n){e.exports=n(102)},function(e,t){e.exports=function(e,t){for(var n=e.split("."),r=t.split("."),i=0;i<3;i++){var o=Number(n[i]),s=Number(r[i]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return 0}},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g,o=n(24),s={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports=o.assign({default:s.RFC3986,formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return String(e)}}},s)},function(e,t){ -/*! ***************************************************************************** -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 +module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./src/execute-gitversion.ts"); +/******/ }) +/************************************************************************/ +/******/ ({ -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. +/***/ "./node_modules/azure-pipelines-task-lib sync recursive": +/*!****************************************************!*\ + !*** ./node_modules/azure-pipelines-task-lib sync ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -var n;!function(e){!function(t){var n="object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),r=i(e);function i(e,t){return function(n,r){"function"!=typeof e[n]&&Object.defineProperty(e,n,{configurable:!0,writable:!0,value:r}),t&&t(n,r)}}void 0===n.Reflect?n.Reflect=e:r=i(n.Reflect,r),function(e){var t=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!o&&!s,c={create:o?function(){return k(Object.create(null))}:s?function(){return k({__proto__:null})}:function(){return k({})},has:a?function(e,n){return t.call(e,n)}:function(e,t){return t in e},get:a?function(e,n){return t.call(e,n)?e[n]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),l="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,p=l||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[i]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i=0;--n){var r=(0,e[n])(t);if(!b(r)&&!w(r)){if(!A(r))throw new TypeError;t=r}}return t}(e,t)}if(!O(e))throw new TypeError;if(!S(t))throw new TypeError;if(!S(r)&&!b(r)&&!w(r))throw new TypeError;return w(r)&&(r=void 0),function(e,t,n,r){for(var i=e.length-1;i>=0;--i){var o=(0,e[i])(t,n,r);if(!b(o)&&!w(o)){if(!S(o))throw new TypeError;r=o}}return r}(e,t,n=T(n),r)})),e("metadata",(function(e,t){return function(n,r){if(!S(n))throw new TypeError;if(!b(r)&&!function(e){switch(_(e)){case 3:case 4:return!0;default:return!1}}(r))throw new TypeError;v(e,t,n,r)}})),e("defineMetadata",(function(e,t,n,r){if(!S(n))throw new TypeError;return b(r)||(r=T(r)),v(e,t,n,r)})),e("hasMetadata",(function(e,t,n){if(!S(t))throw new TypeError;return b(n)||(n=T(n)),function e(t,n,r){if(g(t,n,r))return!0;var i=I(n);return!w(i)&&e(t,i,r)}(e,t,n)})),e("hasOwnMetadata",(function(e,t,n){if(!S(t))throw new TypeError;return b(n)||(n=T(n)),g(e,t,n)})),e("getMetadata",(function(e,t,n){if(!S(t))throw new TypeError;return b(n)||(n=T(n)),function e(t,n,r){if(g(t,n,r))return y(t,n,r);var i=I(n);return w(i)?void 0:e(t,i,r)}(e,t,n)})),e("getOwnMetadata",(function(e,t,n){if(!S(t))throw new TypeError;return b(n)||(n=T(n)),y(e,t,n)})),e("getMetadataKeys",(function(e,t){if(!S(e))throw new TypeError;return b(t)||(t=T(t)),function e(t,n){var r=m(t,n),i=I(t);if(null===i)return r;var o=e(i,n);if(o.length<=0)return r;if(r.length<=0)return o;for(var s=new f,a=[],c=0,u=r;c0)return!0;var i=d.get(t);return i.delete(n),i.size>0||(d.delete(t),!0)}))}(r)}()}(n||(n={}))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(45),o=n(25),s=i.ioc.get(o.TYPES.IGitVersionTool),a=i.ioc.get(o.TYPES.IBuildAgent);t.setup=function(){return r(this,void 0,void 0,(function*(){try{a.exportVariable("DOTNET_CLI_TELEMETRY_OPTOUT","1");const e=a.getInput(o.SetupOptions.versionSpec),t=a.getBooleanInput(o.SetupOptions.includePrerelease);yield s.install(e,t),a.setSucceeded("GitVersion installed successfully",!0)}catch(e){a.setFailed(e.message,!0)}}))},t.run=function(){return r(this,void 0,void 0,(function*(){try{const e=function(){const e=a.getInput(o.RunOptions.targetPath),t=a.getBooleanInput(o.RunOptions.useConfigFile),n=a.getInput(o.RunOptions.configFilePath),r=a.getBooleanInput(o.RunOptions.updateAssemblyInfo),i=a.getInput(o.RunOptions.updateAssemblyInfoFilename),s=a.getInput(o.RunOptions.additionalArguments),c=a.getSourceDir().replace(/\\/g,"/");return{targetPath:e,useConfigFile:t,configFilePath:n,updateAssemblyInfo:r,updateAssemblyInfoFilename:i,additionalArguments:s,srcDir:c}}(),t=yield s.run(e);!function(e){a.setOutput("major",e.Major.toString()),a.setOutput("minor",e.Minor.toString()),a.setOutput("patch",e.Patch.toString()),a.setOutput("preReleaseTag",e.PreReleaseTag),a.setOutput("preReleaseTagWithDash",e.PreReleaseTagWithDash),a.setOutput("preReleaseLabel",e.PreReleaseLabel),a.setOutput("preReleaseNumber",e.PreReleaseNumber.toString()),a.setOutput("weightedPreReleaseNumber",e.WeightedPreReleaseNumber.toString()),a.setOutput("buildMetaData",e.BuildMetaData.toString()),a.setOutput("buildMetaDataPadded",e.BuildMetaDataPadded),a.setOutput("fullBuildMetaData",e.FullBuildMetaData),a.setOutput("majorMinorPatch",e.MajorMinorPatch),a.setOutput("semVer",e.SemVer),a.setOutput("legacySemVer",e.LegacySemVer),a.setOutput("legacySemVerPadded",e.LegacySemVerPadded),a.setOutput("assemblySemVer",e.AssemblySemVer),a.setOutput("assemblySemFileVer",e.AssemblySemFileVer),a.setOutput("fullSemVer",e.FullSemVer),a.setOutput("informationalVersion",e.InformationalVersion),a.setOutput("branchName",e.BranchName),a.setOutput("sha",e.Sha),a.setOutput("shortSha",e.ShortSha),a.setOutput("nuGetVersionV2",e.NuGetVersionV2),a.setOutput("nuGetVersion",e.NuGetVersion),a.setOutput("nuGetPreReleaseTagV2",e.NuGetPreReleaseTagV2),a.setOutput("nuGetPreReleaseTag",e.NuGetPreReleaseTag),a.setOutput("versionSourceSha",e.VersionSourceSha),a.setOutput("commitsSinceVersionSource",e.CommitsSinceVersionSource.toString()),a.setOutput("commitsSinceVersionSourcePadded",e.CommitsSinceVersionSourcePadded),a.setOutput("commitDate",e.CommitDate)}(JSON.parse(t.stdout)),0===t.code?a.setSucceeded("GitVersion executed successfully",!0):a.setFailed(t.error.message,!0)}catch(e){a.setFailed(e,!0)}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(12),i=n(72),o=n(108),s=n(25),a=new r.Container;t.ioc=a,a.bind(s.TYPES.IVersionManager).to(o.VersionManager),a.bind(s.TYPES.IBuildAgent).to(i.BuildAgent),a.bind(s.TYPES.IDotnetTool).to(o.DotnetTool),a.bind(s.TYPES.IGitVersionTool).to(o.GitVersionTool)},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?d.length:n.length),g=function e(t,n){for(var r=t.getPropertiesMetadata(n),i=[],s=Object.keys(r),a=0,u=s;a0?l:e(t,r)}return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.str=e}return e.prototype.startsWith=function(e){return 0===this.str.indexOf(e)},e.prototype.endsWith=function(e){var t,n=e.split("").reverse().join("");return t=this.str.split("").reverse().join(""),this.startsWith.call({str:t},n)},e.prototype.contains=function(e){return-1!==this.str.indexOf(e)},e.prototype.equals=function(e){return this.str===e},e.prototype.value=function(){return this.str},e}();t.QueryableString=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),i=function(){function e(e,t,n,i,o){this.id=r.id(),this.serviceIdentifier=e,this.parentContext=t,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return e.prototype.addChildRequest=function(t,n,r){var i=new e(t,this.parentContext,this,n,r);return this.childRequests.push(i),i},e}();t.Request=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(6),o=n(27),s=n(10),a=n(56),c=function(e,t,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(e,t.toString())):n}},u=function(e){return function(t){t.parentContext.setCurrentRequest(t);var n=t.bindings,o=t.childRequests,l=t.target&&t.target.isArray(),p=!(t.parentRequest&&t.parentRequest.target&&t.target&&t.parentRequest.target.matchesArray(t.target.serviceIdentifier));if(l&&p)return o.map((function(t){return u(e)(t)}));var f=null;if(!t.target.isOptional()||0!==n.length){var d=n[0],h=d.scope===i.BindingScopeEnum.Singleton,g=d.scope===i.BindingScopeEnum.Request;if(h&&d.activated)return d.cache;if(g&&null!==e&&e.has(d.id))return e.get(d.id);if(d.type===i.BindingTypeEnum.ConstantValue)f=d.cache;else if(d.type===i.BindingTypeEnum.Function)f=d.cache;else if(d.type===i.BindingTypeEnum.Constructor)f=d.implementationType;else if(d.type===i.BindingTypeEnum.DynamicValue&&null!==d.dynamicValue)f=c("toDynamicValue",d.serviceIdentifier,(function(){return d.dynamicValue(t.parentContext)}));else if(d.type===i.BindingTypeEnum.Factory&&null!==d.factory)f=c("toFactory",d.serviceIdentifier,(function(){return d.factory(t.parentContext)}));else if(d.type===i.BindingTypeEnum.Provider&&null!==d.provider)f=c("toProvider",d.serviceIdentifier,(function(){return d.provider(t.parentContext)}));else{if(d.type!==i.BindingTypeEnum.Instance||null===d.implementationType){var y=s.getServiceIdentifierAsString(t.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+y)}f=a.resolveInstance(d.implementationType,o,u(e))}return"function"==typeof d.onActivation&&(f=d.onActivation(t.parentContext,f)),h&&(d.cache=f,d.activated=!0),g&&null!==e&&!e.has(d.id)&&e.set(d.id,f),f}}};t.resolve=function(e){return u(e.plan.rootRequest.requestScope)(e.plan.rootRequest)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(6),o=n(3);t.resolveInstance=function(e,t,n){var s,a,c=null;if(t.length>0){var u=t.filter((function(e){return null!==e.target&&e.target.type===i.TargetTypeEnum.ConstructorArgument})).map(n);a=u,c=function(e,t,n){var r=t.filter((function(e){return null!==e.target&&e.target.type===i.TargetTypeEnum.ClassProperty})),o=r.map(n);return r.forEach((function(t,n){var r;r=t.target.name.value();var i=o[n];e[r]=i})),e}(c=new((s=e).bind.apply(s,[void 0].concat(a))),t,n)}else c=new e;return function(e,t){if(Reflect.hasMetadata(o.POST_CONSTRUCT,e)){var n=Reflect.getMetadata(o.POST_CONSTRUCT,e);try{t[n.value]()}catch(t){throw new Error(r.POST_CONSTRUCT_ERROR(e.name,t.message))}}}(e,c),c}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(6),o=n(58),s=n(30),a=function(){function e(e){this._binding=e}return e.prototype.to=function(e){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=e,new o.BindingInWhenOnSyntax(this._binding)},e.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var e=this._binding.serviceIdentifier;return this.to(e)},e.prototype.toConstantValue=function(e){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toDynamicValue=function(e){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},e.prototype.toConstructor=function(e){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=e,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toFactory=function(e){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=e,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toFunction=function(e){if("function"!=typeof e)throw new Error(r.INVALID_FUNCTION_BINDING);var t=this.toConstantValue(e);return this._binding.type=i.BindingTypeEnum.Function,t},e.prototype.toAutoFactory=function(e){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(t){return function(){return t.container.get(e)}},new s.BindingWhenOnSyntax(this._binding)},e.prototype.toProvider=function(e){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=e,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toService=function(e){this.toDynamicValue((function(t){return t.container.get(e)}))},e}();t.BindingToSyntax=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(59),i=n(13),o=n(14),s=function(){function e(e){this._binding=e,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(e)}return e.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},e.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},e.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},e.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},e.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},e.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},e.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},e.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},e.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},e.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},e.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},e.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},e.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},e.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},e.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},e.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},e.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},e.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},e}();t.BindingInWhenOnSyntax=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),i=n(30),o=function(){function e(e){this._binding=e}return e.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},e.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},e.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},e}();t.BindingInSyntax=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.of=function(t,n){var r=new e;return r.bindings=t,r.middleware=n,r},e}();t.ContainerSnapshot=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=function(){function e(){this._map=new Map}return e.prototype.getMap=function(){return this._map},e.prototype.add=function(e,t){if(null==e)throw new Error(r.NULL_ARGUMENT);if(null==t)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(e);void 0!==n?(n.push(t),this._map.set(e,n)):this._map.set(e,[t])},e.prototype.get=function(e){if(null==e)throw new Error(r.NULL_ARGUMENT);var t=this._map.get(e);if(void 0!==t)return t;throw new Error(r.KEY_NOT_FOUND)},e.prototype.remove=function(e){if(null==e)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(e))throw new Error(r.KEY_NOT_FOUND)},e.prototype.removeByCondition=function(e){var t=this;this._map.forEach((function(n,r){var i=n.filter((function(t){return!e(t)}));i.length>0?t._map.set(r,i):t._map.delete(r)}))},e.prototype.hasKey=function(e){if(null==e)throw new Error(r.NULL_ARGUMENT);return this._map.has(e)},e.prototype.clone=function(){var t=new e;return this._map.forEach((function(e,n){e.forEach((function(e){return t.add(n,e.clone())}))})),t},e.prototype.traverse=function(e){this._map.forEach((function(t,n){e(n,t)}))},e}();t.Lookup=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),i=function(e){this.id=r.id(),this.registry=e};t.ContainerModule=i;var o=function(e){this.id=r.id(),this.registry=e};t.AsyncContainerModule=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(3);t.injectable=function(){return function(e){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,e))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var t=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,e)||[];return Reflect.defineMetadata(i.PARAM_TYPES,t,e),e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),i=n(8);t.tagged=function(e,t){return function(n,o,s){var a=new r.Metadata(e,t);"number"==typeof s?i.tagParameter(n,o,s,a):i.tagProperty(n,o,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(5),o=n(8);t.named=function(e){return function(t,n,s){var a=new i.Metadata(r.NAMED_TAG,e);"number"==typeof s?o.tagParameter(t,n,s,a):o.tagProperty(t,n,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(5),o=n(8);t.optional=function(){return function(e,t,n){var s=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(e,t,n,s):o.tagProperty(e,t,s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(5),o=n(8);t.unmanaged=function(){return function(e,t,n){var s=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(e,t,n,s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(5),o=n(8);t.multiInject=function(e){return function(t,n,s){var a=new i.Metadata(r.MULTI_INJECT_TAG,e);"number"==typeof s?o.tagParameter(t,n,s,a):o.tagProperty(t,n,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(5),o=n(8);t.targetName=function(e){return function(t,n,s){var a=new i.Metadata(r.NAME_TAG,e);o.tagParameter(t,n,s,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(3),o=n(5);t.postConstruct=function(){return function(e,t,n){var s=new o.Metadata(i.POST_CONSTRUCT,t);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,e.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,s,e.constructor)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiBindToService=function(e){return function(t){return function(){for(var n=[],r=0;r=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const o=n(12),s=i(n(32)),a=i(n(100));let c=class{get agentName(){return"Azure Pipelines"}find(e,t,n){return a.findLocalTool(e,t,n)}cacheDir(e,t,n,r){return a.cacheDir(e,t,n,r)}createTempDir(){return Promise.resolve(s.getVariable("Agent.TempDirectory"))}debug(e){s.debug(e)}setFailed(e,t){s.setResult(s.TaskResult.Failed,e,t)}setSucceeded(e,t){s.setResult(s.TaskResult.Succeeded,e,t)}exportVariable(e,t){s.setVariable(e,t)}getVariable(e){return s.getVariable(e)}addPath(e){a.prependPath(e)}which(e,t){return Promise.resolve(s.which(e,t))}exec(e,t){const n=s.tool(e);n.arg(t);const r=n.execSync();return Promise.resolve({code:r.code,error:r.error,stderr:r.stderr,stdout:r.stdout})}getSourceDir(){return this.getVariable("Build.SourcesDirectory")}setOutput(e,t){s.setVariable(e,t)}getInput(e,t){return s.getInput(e,t)}getBooleanInput(e,t){return s.getBoolInput(e,t)}isValidInputFile(e,t){return s.filePathSupplied(e)&&this.fileExists(t)}fileExists(e){return s.exist(e)&&s.stats(e).isFile()}directoryExists(e){return s.exist(e)&&s.stats(e).isDirectory()}};c=r([o.injectable()],c),t.BuildAgent=c},function(e,t,n){var r=n(1),i=n(16);t.cd=r.wrap("cd",i);var o=n(17);t.pwd=r.wrap("pwd",o);var s=n(15);t.ls=r.wrap("ls",s);var a=n(74);t.find=r.wrap("find",a);var c=n(75);t.cp=r.wrap("cp",c);var u=n(76);t.rm=r.wrap("rm",u);var l=n(77);t.mv=r.wrap("mv",l);var p=n(78);t.mkdir=r.wrap("mkdir",p);var f=n(79);t.test=r.wrap("test",f);var d=n(80);t.cat=r.wrap("cat",d);var h=n(81);String.prototype.to=r.wrap("to",h);var g=n(82);String.prototype.toEnd=r.wrap("toEnd",g);var y=n(83);t.sed=r.wrap("sed",y);var v=n(84);t.grep=r.wrap("grep",v);var m=n(85);t.which=r.wrap("which",m);var _=n(86);t.echo=_;var b=n(18).dirs;t.dirs=r.wrap("dirs",b);var w=n(18).pushd;t.pushd=r.wrap("pushd",w);var S=n(18).popd;t.popd=r.wrap("popd",S);var E=n(87);t.ln=r.wrap("ln",E),t.exit=process.exit,t.env=process.env;var T=n(88);t.exec=r.wrap("exec",T,{notUnix:!0});var O=n(89);t.chmod=r.wrap("chmod",O);var x=n(33);t.tempdir=r.wrap("tempdir",x);var A=n(90);t.error=A,t.config=r.config},function(e,t,n){var r=n(0),i=n(1),o=n(15);e.exports=function(e,t){t?"object"==typeof t?t=t:"string"==typeof t&&(t=[].slice.call(arguments,1)):i.error("no path specified");var n=[];function s(e){"win"===i.platform&&(e=e.replace(/\\/g,"/")),n.push(e)}return t.forEach((function(e){s(e),r.statSync(e).isDirectory()&&o("-RA",e+"/*").forEach((function(e){s(e)}))})),n}},function(e,t,n){var r=n(0),i=n(2),o=n(1),s=n(7);function a(e,t){r.existsSync(e)||o.error("copyFileSync: no such file or directory: "+e);var n=new Buffer(65536),i=65536,s=0,a=null,c=null;try{a=r.openSync(e,"r")}catch(t){o.error("copyFileSync: could not read src file ("+e+")")}try{c=r.openSync(t,"w")}catch(e){o.error("copyFileSync: could not write to dest file (code="+e.code+"):"+t)}for(;65536===i;)i=r.readSync(a,n,0,65536,s),r.writeSync(c,n,0,i),s+=i;r.closeSync(a),r.closeSync(c),r.chmodSync(t,r.statSync(e).mode)}function c(e,t,n){n||(n={});var i=r.statSync(e);try{r.mkdirSync(t,i.mode)}catch(e){if("EEXIST"!==e.code)throw e}for(var u=r.readdirSync(e),l=0;l and/or "):arguments.length>3?(t=[].slice.call(arguments,1,arguments.length-1),n=arguments[arguments.length-1]):"string"==typeof t?t=[t]:"length"in t?t=t:o.error("invalid arguments");var s=r.existsSync(n),u=s&&r.statSync(n);if(s&&u.isDirectory()||!(t.length>1)||o.error("dest is not a directory (too many sources)"),s&&u.isFile()&&!e.force&&o.error("dest file already exists: "+n),e.recursive){t.forEach((function(e,n){"/"===e[e.length-1]&&(t[n]+="*")}));try{r.mkdirSync(n,parseInt("0777",8))}catch(e){}}(t=o.expand(t)).forEach((function(t){if(r.existsSync(t))if(r.statSync(t).isDirectory())if(e.recursive){var s=i.join(n,i.basename(t)),u=r.statSync(t);try{r.mkdirSync(s,u.mode)}catch(e){if("EEXIST"!==e.code)throw e}c(t,s,{force:e.force})}else o.log(t+" is a directory (not copied)");else{var l=n;r.existsSync(n)&&r.statSync(n).isDirectory()&&(l=i.normalize(n+"/"+i.basename(t))),!r.existsSync(l)||e.force?a(t,l):o.error("dest file already exists: "+l,!0)}else o.error("no such file or directory: "+t,!0)}))}},function(e,t,n){var r=n(1),i=n(0);function o(e,t){var n,a;n=i.readdirSync(e);for(var c=0;c and/or "):arguments.length>3?(t=[].slice.call(arguments,1,arguments.length-1),n=arguments[arguments.length-1]):"string"==typeof t?t=[t]:"length"in t?t=t:o.error("invalid arguments"),t=o.expand(t);var s=r.existsSync(n),a=s&&r.statSync(n);s&&a.isDirectory()||!(t.length>1)||o.error("dest is not a directory (too many sources)"),s&&a.isFile()&&!e.force&&o.error("dest file already exists: "+n),t.forEach((function(t){if(r.existsSync(t)){var s=n;r.existsSync(n)&&r.statSync(n).isDirectory()&&(s=i.normalize(n+"/"+i.basename(t))),!r.existsSync(s)||e.force?i.resolve(t)!==i.dirname(i.resolve(s))?r.renameSync(t,s):o.error("cannot move to self: "+t,!0):o.error("dest file already exists: "+s,!0)}else o.error("no such file or directory: "+t,!0)}))}},function(e,t,n){var r=n(1),i=n(0),o=n(2);function s(e){var t=o.dirname(e);i.existsSync(t)?i.mkdirSync(e,parseInt("0777",8)):(s(t),i.mkdirSync(e,parseInt("0777",8)))}e.exports=function(e,t){e=r.parseOptions(e,{p:"fullpath"}),t||r.error("no paths given"),"string"==typeof t&&(t=[].slice.call(arguments,1)),t.forEach((function(t){if(i.existsSync(t))e.fullpath||r.error("path already exists: "+t,!0);else{var n=o.dirname(t);i.existsSync(n)||e.fullpath?e.fullpath?s(t):i.mkdirSync(t,parseInt("0777",8)):r.error("no such file or directory: "+n,!0)}}))}},function(e,t,n){var r=n(1),i=n(0);e.exports=function(e,t){t||r.error("no path given"),e=r.parseOptions(e,{b:"block",c:"character",d:"directory",e:"exists",f:"file",L:"link",p:"pipe",S:"socket"});var n=!1;for(var o in e)if(!0===e[o]){n=!0;break}if(n||r.error("could not interpret expression"),e.link)try{return i.lstatSync(t).isSymbolicLink()}catch(e){return!1}if(!i.existsSync(t))return!1;if(e.exists)return!0;var s=i.statSync(t);return e.block?s.isBlockDevice():e.character?s.isCharacterDevice():e.directory?s.isDirectory():e.file?s.isFile():e.pipe?s.isFIFO():e.socket?s.isSocket():void 0}},function(e,t,n){var r=n(1),i=n(0);e.exports=function(e,t){var n="";return t||r.error("no paths given"),"string"==typeof t&&(t=[].slice.call(arguments,1)),(t=r.expand(t)).forEach((function(e){i.existsSync(e)||r.error("no such file or directory: "+e),n+=i.readFileSync(e,"utf8")+"\n"})),"\n"===n[n.length-1]&&(n=n.substring(0,n.length-1)),r.ShellString(n)}},function(e,t,n){var r=n(1),i=n(0),o=n(2);e.exports=function(e,t){t||r.error("wrong arguments"),i.existsSync(o.dirname(t))||r.error("no such file or directory: "+o.dirname(t));try{i.writeFileSync(t,this.toString(),"utf8")}catch(e){r.error("could not write to file (code "+e.code+"): "+t,!0)}}},function(e,t,n){var r=n(1),i=n(0),o=n(2);e.exports=function(e,t){t||r.error("wrong arguments"),i.existsSync(o.dirname(t))||r.error("no such file or directory: "+o.dirname(t));try{i.appendFileSync(t,this.toString(),"utf8")}catch(e){r.error("could not append to file (code "+e.code+"): "+t,!0)}}},function(e,t,n){var r=n(1),i=n(0);e.exports=function(e,t,n,o){e=r.parseOptions(e,{i:"inplace"}),"string"==typeof n||"function"==typeof n?n=n:"number"==typeof n?n=n.toString():r.error("invalid replacement string"),o||r.error("no file given"),i.existsSync(o)||r.error("no such file or directory: "+o);var s=i.readFileSync(o,"utf8").replace(t,n);return e.inplace&&i.writeFileSync(o,s,"utf8"),r.ShellString(s)}},function(e,t,n){var r=n(1),i=n(0);e.exports=function(e,t,n){e=r.parseOptions(e,{v:"inverse"}),n||r.error("no paths given"),"string"==typeof n&&(n=[].slice.call(arguments,2)),n=r.expand(n);var o="";return n.forEach((function(n){i.existsSync(n)?i.readFileSync(n,"utf8").split(/\r*\n/).forEach((function(n){var r=n.match(t);(e.inverse&&!r||!e.inverse&&r)&&(o+=n+"\n")})):r.error("no such file or directory: "+n,!0)})),r.ShellString(o)}},function(e,t,n){var r=n(1),o=n(0),s=n(2);function a(e){return o.existsSync(e)&&0==o.statSync(e).isDirectory()}e.exports=function(e,t){t||r.error("must specify command");var n=function(e){for(i=1;i<2;i++);return e?"win"===r.platform?e.split(";"):e.split(":"):[]}(process.env.path||process.env.Path||process.env.PATH),o=null;return-1===t.search(/\//)&&n.forEach((function(e){if(!o){var n=s.resolve(e+"/"+t);if(a(n))o=n;else if("win"===r.platform){var i=n;if(a(n=i+".exe"))return void(o=n);if(a(n=i+".cmd"))return void(o=n);if(a(n=i+".bat"))return void(o=n)}}})),a(t)||o?(o=o||s.resolve(t),r.ShellString(o)):null}},function(e,t,n){var r=n(1);e.exports=function(){var e=[].slice.call(arguments,0);return console.log.apply(this,e),r.ShellString(e.join(" "))}},function(e,t,n){var r=n(0),i=n(2),o=n(1),s=n(7);e.exports=function(e,t,n){e=o.parseOptions(e,{s:"symlink",f:"force"}),t&&n||o.error("Missing and/or "),t=i.resolve(process.cwd(),String(t)),n=i.resolve(process.cwd(),String(n)),r.existsSync(t)||o.error("Source file does not exist",!0),r.existsSync(n)&&(e.force||o.error("Destination file exists",!0),r.unlinkSync(n)),e.symlink?r.symlinkSync(t,n,"win32"===s.platform()?"junction":null):r.linkSync(t,n,"win32"===s.platform()?"junction":null)}},function(e,t,n){var r=n(1),i=n(33),o=n(17),s=n(2),a=n(0),c=n(19);e.exports=function(e,t,n){return e||r.error("must specify command"),"function"==typeof t&&(n=t,t={async:!0}),"object"==typeof t&&"function"==typeof n&&(t.async=!0),(t=r.extend({silent:r.config.silent,async:!1},t)).async?function(e,t,n){var i="",o=r.extend({silent:r.config.silent},t),s=c.exec(e,{env:process.env,maxBuffer:20971520},(function(e){n&&n(e?e.code:0,i)}));return s.stdout.on("data",(function(e){i+=e,o.silent||process.stdout.write(e)})),s.stderr.on("data",(function(e){i+=e,o.silent||process.stdout.write(e)})),s}(e,t,n):function(e,t){var n=i(),u=s.resolve(n+"/"+r.randomFileName()),l=s.resolve(n+"/"+r.randomFileName()),p=s.resolve(n+"/"+r.randomFileName()),f=s.resolve(n+"/"+r.randomFileName()),d=r.extend({silent:r.config.silent},t),h="";function g(){if(!d.silent&&a.existsSync(u)){var e=a.readFileSync(u,"utf8");e.length<=h.length||(process.stdout.write(e.substr(h.length)),h=e)}}function y(e){return(e+"").replace(/([\\"'])/g,"\\$1").replace(/\0/g,"\\0")}var v="var child = require('child_process'), fs = require('fs');child.exec('"+y(e+=" > "+u+" 2>&1")+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) { fs.writeFileSync('"+y(l)+"', err ? err.code.toString() : '0');});";for(a.existsSync(p)&&r.unlinkSync(p),a.existsSync(u)&&r.unlinkSync(u),a.existsSync(l)&&r.unlinkSync(l),a.writeFileSync(p,v),c.exec('"'+process.execPath+'" '+p,{env:process.env,cwd:o(),maxBuffer:20971520});!a.existsSync(l);)g(),a.writeFileSync(f,"a");for(;!a.existsSync(u);)g(),a.writeFileSync(f,"a");for(var m=parseInt("",10);isNaN(m);)m=parseInt(a.readFileSync(l,"utf8"),10);var _=a.readFileSync(u,"utf8");try{r.unlinkSync(p)}catch(e){}try{r.unlinkSync(u)}catch(e){}try{r.unlinkSync(l)}catch(e){}try{r.unlinkSync(f)}catch(e){}return(1===m||2===m||m>=126)&&r.error("",!0),{code:m,output:_}}(e,t)}},function(e,t,n){var r,i=n(1),o=n(0),s=n(2),a={OTHER_EXEC:(r={EXEC:1,WRITE:2,READ:4}).EXEC,OTHER_WRITE:r.WRITE,OTHER_READ:r.READ,GROUP_EXEC:r.EXEC<<3,GROUP_WRITE:r.WRITE<<3,GROUP_READ:r.READ<<3,OWNER_EXEC:r.EXEC<<6,OWNER_WRITE:r.WRITE<<6,OWNER_READ:r.READ<<6,STICKY:parseInt("01000",8),SETGID:parseInt("02000",8),SETUID:parseInt("04000",8),TYPE_MASK:parseInt("0770000",8)};e.exports=function(e,t,n){var r;n||(e.length>0&&"-"===e.charAt(0)?(n=t,t=e,e=""):i.error("You must specify a file.")),"string"==typeof n&&(n=[n]),(e=i.parseOptions(e,{R:"recursive",c:"changes",v:"verbose"})).recursive?(r=[],i.expand(n).forEach((function e(t){var n=o.lstatSync(t);n.isSymbolicLink()||(r.push(t),n.isDirectory()&&o.readdirSync(t).forEach((function(n){e(t+"/"+n)})))}))):r=i.expand(n),r.forEach((function(n){if(n=s.resolve(n),o.existsSync(n)||i.error("File not found: "+n),!e.recursive||!o.lstatSync(n).isSymbolicLink()){var r=o.statSync(n).mode,c=r&a.TYPE_MASK,u=r;isNaN(parseInt(t,8))?t.split(",").forEach((function(t){var s=/([ugoa]*)([=\+-])([rwxXst]*)/i.exec(t);if(s){var l=s[1],p=s[2],f=s[3],d=-1!=l.indexOf("u")||"a"===l||""===l,h=-1!=l.indexOf("g")||"a"===l||""===l,g=-1!=l.indexOf("o")||"a"===l||""===l,y=-1!=f.indexOf("r"),v=-1!=f.indexOf("w"),m=-1!=f.indexOf("x"),_=-1!=f.indexOf("t"),b=-1!=f.indexOf("s"),w=0;switch(d&&(w|=(y?a.OWNER_READ:0)+(v?a.OWNER_WRITE:0)+(m?a.OWNER_EXEC:0)+(b?a.SETUID:0)),h&&(w|=(y?a.GROUP_READ:0)+(v?a.GROUP_WRITE:0)+(m?a.GROUP_EXEC:0)+(b?a.SETGID:0)),g&&(w|=(y?a.OTHER_READ:0)+(v?a.OTHER_WRITE:0)+(m?a.OTHER_EXEC:0)),_&&(w|=a.STICKY),p){case"+":u|=w;break;case"-":u&=~w;break;case"=":u=c+w,o.statSync(n).isDirectory()&&(u|=a.SETUID+a.SETGID&r)}e.verbose&&log(n+" -> "+u.toString(8)),r!=u&&(!e.verbose&&e.changes&&log(n+" -> "+u.toString(8)),o.chmodSync(n,u))}else i.error("Invalid symbolic mode change: "+t)})):(u=c+parseInt(t,8),o.statSync(n).isDirectory()&&(u|=a.SETUID+a.SETGID&r),o.chmodSync(n,u))}}))}},function(e,t,n){var r=n(1);e.exports=function(){return r.state.error}},function(e,t,n){var r=n(92),i=n(93);e.exports=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,n){var o=[],s=i("{","}",t);if(!s||/\$$/.test(s.pre))return[t];var c,u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),p=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),y=u||p,v=s.body.indexOf(",")>=0;if(!y&&!v)return s.post.match(/,.*\}/)?(t=s.pre+"{"+s.body+a+s.post,e(t)):[t];if(y)c=s.body.split(/\.\./);else{if(1===(c=function e(t){if(!t)return[""];var n=[],r=i("{","}",t);if(!r)return t.split(",");var o=r.pre,s=r.body,a=r.post,c=o.split(",");c[c.length-1]+="{"+s+"}";var u=e(a);a.length&&(c[c.length-1]+=u.shift(),c.push.apply(c,u));return n.push.apply(n,c),n}(s.body)).length)if(1===(c=e(c[0],!1).map(f)).length)return(b=s.post.length?e(s.post,!1):[""]).map((function(e){return s.pre+c[0]+e}))}var m,_=s.pre,b=s.post.length?e(s.post,!1):[""];if(y){var w=l(c[0]),S=l(c[1]),E=Math.max(c[0].length,c[1].length),T=3==c.length?Math.abs(l(c[2])):1,O=h;S0){var C=new Array(R+1).join("0");P=A<0?"-"+C+P.slice(1):C+P}}m.push(P)}}else m=r(c,(function(t){return e(t,!1)}));for(var I=0;I=t}},function(e,t){e.exports=function(e,t){for(var r=[],i=0;i=0&&u>0){for(r=[],o=n.length;l>=0&&!a;)l==c?(r.push(l),c=n.indexOf(e,l+1)):1==r.length?a=[r.pop(),u]:((i=r.pop())=0?c:u;r.length&&(a=[o,s])}return a}e.exports=r,r.range=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(2),o=n(20),s=n(38),a=function(){function e(e){this._keyFile=i.join(e,".taskkey"),this._store={},this.genKey()}return e.prototype.initialize=function(){},e.prototype.storeSecret=function(e,t){if(!e||0==e.length)return!1;if(e=e.toLowerCase(),!t||0==t.length)return this._store.hasOwnProperty(e)&&delete this._store[e],!1;var n=this.getKey(),r=o.randomBytes(16),i=o.createCipheriv("aes-256-ctr",n,r),s=i.update(t,"utf8","hex"),a=i.final("hex");return this._store[e]=r.toString("hex")+s+a,!0},e.prototype.retrieveSecret=function(e){var t;if(e=(e||"").toLowerCase(),this._store.hasOwnProperty(e)){var n=this.getKey(),r=this._store[e],i=Buffer.from(r,"hex"),s=i.slice(0,16),a=i.slice(16),c=o.createDecipheriv("aes-256-ctr",n,s);t=c.update(a,"hex","utf8")+c.final("utf8")}return t},e.prototype.getKey=function(){var e=r.readFileSync(this._keyFile).toString("utf8");return o.createHash("sha256").update(e).digest()},e.prototype.genKey=function(){r.writeFileSync(this._keyFile,s(),{encoding:"utf8"})},e}();t.Vault=a},function(e,t,n){var r=n(20);e.exports=function(){return r.randomBytes(16)}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=97},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(99),s=n(7),a=n(39),c=n(19),u=n(35),l=n(0),p=function(e){function t(t){var n=e.call(this)||this;if(!t)throw new Error("Parameter 'toolPath' cannot be null or empty.");return n.toolPath=u._which(t,!0),n.args=[],n._debug("toolRunner toolPath: "+t),n}return i(t,e),t.prototype._debug=function(e){this.emit("debug",e)},t.prototype._argStringToArray=function(e){for(var t=[],n=!1,r=!1,i=!0,o="",s=function(e){r&&'"'!==e&&(o+="\\"),o+=e,r=!1},a=0;a-1;){n(r.substring(0,i)),i=(r=r.substring(i+s.EOL.length)).indexOf(s.EOL)}t=r}catch(e){this._debug("error processing line")}},t.prototype._getSpawnFileName=function(){return"win32"==process.platform&&this._isCmdFile()?process.env.COMSPEC||"cmd.exe":this.toolPath},t.prototype._getSpawnArgs=function(e){if("win32"==process.platform){if(this._isCmdFile()){for(var t='/D /S /C "'+this._windowsQuoteCmdArg(this.toolPath),n=0;n",'"'],n=!1,r=function(e){if(t.some((function(t){return t==e})))return n=!0,"break"},i=0,o=e;i0;c--)s+=e[c-1],a&&"\\"==e[c-1]?s+="\\":'"'==e[c-1]?(a=!0,s+='"'):a=!1;return(s+='"').split("").reverse().join("")},t.prototype._uv_quote_cmd_arg=function(e){if(!e)return'""';if(e.indexOf(" ")<0&&e.indexOf("\t")<0&&e.indexOf('"')<0)return e;if(e.indexOf('"')<0&&e.indexOf("\\")<0)return'"'+e+'"';for(var t='"',n=!0,r=e.length;r>0;r--)t+=e[r-1],n&&"\\"==e[r-1]?t+="\\":'"'==e[r-1]?(n=!0,t+="\\"):n=!1;return(t+='"').split("").reverse().join("")},t.prototype._cloneExecOptions=function(e){var t={cwd:(e=e||{}).cwd||process.cwd(),env:e.env||process.env,silent:e.silent||!1,failOnStdErr:e.failOnStdErr||!1,ignoreReturnCode:e.ignoreReturnCode||!1,windowsVerbatimArguments:e.windowsVerbatimArguments||!1};return t.outStream=e.outStream||process.stdout,t.errStream=e.errStream||process.stderr,t},t.prototype._getSpawnOptions=function(e){e=e||{};var t={};return t.cwd=e.cwd,t.env=e.env,t.windowsVerbatimArguments=e.windowsVerbatimArguments||this._isCmdFile(),t},t.prototype._getSpawnSyncOptions=function(e){var t={};return t.cwd=e.cwd,t.env=e.env,t.windowsVerbatimArguments=e.windowsVerbatimArguments||this._isCmdFile(),t},t.prototype.execWithPiping=function(e,t){var n=this,r=o.defer();this._debug("exec tool: "+this.toolPath),this._debug("arguments:"),this.args.forEach((function(e){n._debug(" "+e)}));var i,a=!0,u=this._cloneExecOptions(t);u.silent||u.outStream.write(this._getCommandString(u)+s.EOL);var p,f,d,h,g=e.toolPath,y=!0,v=0,m=0;p=this.toolPath,v++;var _=c.spawn(this._getSpawnFileName(),this._getSpawnArgs(u),this._getSpawnOptions(u));v++,i=c.spawn(e._getSpawnFileName(),e._getSpawnArgs(u),e._getSpawnOptions(u)),(d=this.pipeOutputToFile?l.createWriteStream(this.pipeOutputToFile):null)&&(v++,d.on("finish",(function(){v--,d=null,0==v&&(h?r.reject(h):r.resolve(m))})),d.on("error",(function(e){v--,n._debug("Failed to pipe output of "+p+" to file "+n.pipeOutputToFile+". Error = "+e),d=null,0==v&&(h?r.reject(h):r.resolve(m))}))),_.stdout.on("data",(function(e){try{d&&d.write(e),i.stdin.write(e)}catch(e){n._debug("Failed to pipe output of "+p+" to "+g),n._debug(g+" might have exited due to errors prematurely. Verify the arguments passed are valid.")}})),_.stderr.on("data",(function(e){(d&&d.write(e),y=!u.failOnStdErr,u.silent)||(u.failOnStdErr?u.errStream:u.outStream).write(e)})),_.on("error",(function(e){v--,d&&d.end(),i.stdin.end(),h=new Error(p+" failed. "+e.message),0==v&&r.reject(h)})),_.on("close",(function(e,t){v--,0==e||u.ignoreReturnCode||(y=!1,m=f=e),n._debug("success of first tool:"+y),d&&d.end(),i.stdin.end(),0==v&&(h?r.reject(h):r.resolve(m))}));i.stdout.on("data",(function(e){n.emit("stdout",e),u.silent||u.outStream.write(e),n._processLineBuffer(e,"",(function(e){n.emit("stdline",e)}))}));return i.stderr.on("data",(function(e){(n.emit("stderr",e),a=!u.failOnStdErr,u.silent)||(u.failOnStdErr?u.errStream:u.outStream).write(e);n._processLineBuffer(e,"",(function(e){n.emit("errline",e)}))})),i.on("error",(function(e){v--,h=new Error(g+" failed. "+e.message),0==v&&r.reject(h)})),i.on("close",(function(e,t){v--,n._debug("rc:"+e),m=e,"".length>0&&n.emit("stdline",""),"".length>0&&n.emit("errline",""),0==e||u.ignoreReturnCode||(a=!1),n._debug("success:"+a),y?a||(h=new Error(g+" failed with return code: "+e)):h=new Error(p+" failed with return code: "+f),0==v&&(h?r.reject(h):r.resolve(m))})),r.promise},t.prototype.arg=function(e){return e?(e instanceof Array?(this._debug(this.toolPath+" arg: "+JSON.stringify(e)),this.args=this.args.concat(e)):"string"==typeof e&&(this._debug(this.toolPath+" arg: "+e),this.args=this.args.concat(e.trim())),this):this},t.prototype.line=function(e){return e?(this._debug(this.toolPath+" arg: "+e),this.args=this.args.concat(this._argStringToArray(e)),this):this},t.prototype.argIf=function(e,t){return e&&this.arg(t),this},t.prototype.pipeExecOutputToTool=function(e,t){return this.pipeOutputToTool=e,this.pipeOutputToFile=t,this},t.prototype.exec=function(e){var t=this;if(this.pipeOutputToTool)return this.execWithPiping(this.pipeOutputToTool,e);var n=o.defer();this._debug("exec tool: "+this.toolPath),this._debug("arguments:"),this.args.forEach((function(e){t._debug(" "+e)}));var r=this._cloneExecOptions(e);r.silent||r.outStream.write(this._getCommandString(r)+s.EOL);var i=new f(r,this.toolPath);i.on("debug",(function(e){t._debug(e)}));var a=c.spawn(this._getSpawnFileName(),this._getSpawnArgs(r),this._getSpawnOptions(e));a.stdout.on("finish",(function(){r.silent||r.outStream.write(s.EOL)}));a.stdout.on("data",(function(e){t.emit("stdout",e),r.silent||r.outStream.write(e),t._processLineBuffer(e,"",(function(e){t.emit("stdline",e)}))}));return a.stderr.on("data",(function(e){(i.processStderr=!0,t.emit("stderr",e),r.silent)||(r.failOnStdErr?r.errStream:r.outStream).write(e);t._processLineBuffer(e,"",(function(e){t.emit("errline",e)}))})),a.on("error",(function(e){i.processError=e.message,i.processExited=!0,i.processClosed=!0,i.CheckComplete()})),a.on("exit",(function(e,n){i.processExitCode=e,i.processExited=!0,t._debug("Exit code "+e+" received from tool '"+t.toolPath+"'"),i.CheckComplete()})),a.on("close",(function(e,n){i.processExitCode=e,i.processExited=!0,i.processClosed=!0,t._debug("STDIO streams have closed for tool '"+t.toolPath+"'"),i.CheckComplete()})),i.on("done",(function(e,r){"".length>0&&t.emit("stdline",""),"".length>0&&t.emit("errline",""),a.removeAllListeners(),e?n.reject(e):n.resolve(r)})),n.promise},t.prototype.execSync=function(e){var t=this;this._debug("exec tool: "+this.toolPath),this._debug("arguments:"),this.args.forEach((function(e){t._debug(" "+e)}));(e=this._cloneExecOptions(e)).silent||e.outStream.write(this._getCommandString(e)+s.EOL);var n=c.spawnSync(this._getSpawnFileName(),this._getSpawnArgs(e),this._getSpawnSyncOptions(e));!e.silent&&n.stdout&&n.stdout.length>0&&e.outStream.write(n.stdout),!e.silent&&n.stderr&&n.stderr.length>0&&e.errStream.write(n.stderr);var r={code:n.status,error:n.error};return r.stdout=n.stdout?n.stdout.toString():"",r.stderr=n.stderr?n.stderr.toString():"",r},t}(a.EventEmitter);t.ToolRunner=p;var f=function(e){function t(t,n){var r=e.call(this)||this;if(r.delay=1e4,r.timeout=null,!n)throw new Error("toolPath must not be empty");r.options=t,r.toolPath=n;var i=process.env.TASKLIB_TEST_TOOLRUNNER_EXITDELAY;return i&&(r.delay=parseInt(i)),r}return i(t,e),t.prototype.CheckComplete=function(){this.done||(this.processClosed?this._setResult():this.processExited&&(this.timeout=setTimeout(t.HandleTimeout,this.delay,this)))},t.prototype._debug=function(e){this.emit("debug",e)},t.prototype._setResult=function(){var e;this.processExited&&(this.processError?e=new Error(u._loc("LIB_ProcessError",this.toolPath,this.processError)):0==this.processExitCode||this.options.ignoreReturnCode?this.processStderr&&this.options.failOnStdErr&&(e=new Error(u._loc("LIB_ProcessStderr",this.toolPath))):e=new Error(u._loc("LIB_ProcessExitCode",this.toolPath,this.processExitCode))),this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.done=!0,this.emit("done",e,this.processExitCode)},t.HandleTimeout=function(e){e.done||(!e.processClosed&&e.processExited&&(console.log(u._loc("LIB_StdioNotClosed",e.delay/1e3,e.toolPath)),e._debug(u._loc("LIB_StdioNotClosed",e.delay/1e3,e.toolPath))),e._setResult())},t}(a.EventEmitter)},function(e,t,n){ -/*! +function webpackEmptyContext(req) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = "./node_modules/azure-pipelines-task-lib sync recursive"; + +/***/ }), + +/***/ "./node_modules/azure-pipelines-task-lib/internal.js": +/*!***********************************************************!*\ + !*** ./node_modules/azure-pipelines-task-lib/internal.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(__dirname) { +Object.defineProperty(exports, "__esModule", { value: true }); +var fs = __webpack_require__(/*! fs */ "fs"); +var path = __webpack_require__(/*! path */ "path"); +var os = __webpack_require__(/*! os */ "os"); +var minimatch = __webpack_require__(/*! minimatch */ "./node_modules/minimatch/minimatch.js"); +var util = __webpack_require__(/*! util */ "util"); +var tcm = __webpack_require__(/*! ./taskcommand */ "./node_modules/azure-pipelines-task-lib/taskcommand.js"); +var vm = __webpack_require__(/*! ./vault */ "./node_modules/azure-pipelines-task-lib/vault.js"); +var semver = __webpack_require__(/*! semver */ "./node_modules/semver/semver.js"); +var crypto = __webpack_require__(/*! crypto */ "crypto"); +/** + * Hash table of known variable info. The formatted env var name is the lookup key. * - * Copyright 2009-2017 Kris Kowal under the terms of the MIT - * license found at https://github.com/kriskowal/q/blob/v1/LICENSE + * The purpose of this hash table is to keep track of known variables. The hash table + * needs to be maintained for multiple reasons: + * 1) to distinguish between env vars and job vars + * 2) to distinguish between secret vars and public + * 3) to know the real variable name and not just the formatted env var name. + */ +exports._knownVariableMap = {}; +//----------------------------------------------------- +// 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'); +} +//----------------------------------------------------- +// String convenience +//----------------------------------------------------- +function _startsWith(str, start) { + return str.slice(0, start.length) == start; +} +exports._startsWith = _startsWith; +function _endsWith(str, end) { + return str.slice(-end.length) == end; +} +exports._endsWith = _endsWith; +//----------------------------------------------------- +// General Helpers +//----------------------------------------------------- +var _outStream = process.stdout; +var _errStream = process.stderr; +function _writeLine(str) { + _outStream.write(str + os.EOL); +} +exports._writeLine = _writeLine; +function _setStdStream(stdStream) { + _outStream = stdStream; +} +exports._setStdStream = _setStdStream; +function _setErrStream(errStream) { + _errStream = errStream; +} +exports._setErrStream = _setErrStream; +//----------------------------------------------------- +// Loc Helpers +//----------------------------------------------------- +var _locStringCache = {}; +var _resourceFiles = {}; +var _libResourceFileLoaded = false; +var _resourceCulture = 'en-US'; +function _loadResJson(resjsonFile) { + var resJson; + if (_exist(resjsonFile)) { + var resjsonContent = fs.readFileSync(resjsonFile, 'utf8').toString(); + // remove BOM + if (resjsonContent.indexOf('\uFEFF') == 0) { + resjsonContent = resjsonContent.slice(1); + } + try { + resJson = JSON.parse(resjsonContent); + } + catch (err) { + _debug('unable to parse resjson with err: ' + err.message); + } + } + else { + _debug('.resjson file not found: ' + resjsonFile); + } + return resJson; +} +function _loadLocStrings(resourceFile, culture) { + var locStrings = {}; + if (_exist(resourceFile)) { + var resourceJson = require(resourceFile); + if (resourceJson && resourceJson.hasOwnProperty('messages')) { + var locResourceJson; + // load up resource resjson for different culture + var localizedResourceFile = path.join(path.dirname(resourceFile), 'Strings', 'resources.resjson'); + var upperCulture = culture.toUpperCase(); + var cultures = []; + try { + cultures = fs.readdirSync(localizedResourceFile); + } + catch (ex) { } + for (var i = 0; i < cultures.length; i++) { + if (cultures[i].toUpperCase() == upperCulture) { + localizedResourceFile = path.join(localizedResourceFile, cultures[i], 'resources.resjson'); + if (_exist(localizedResourceFile)) { + locResourceJson = _loadResJson(localizedResourceFile); + } + break; + } + } + for (var key in resourceJson.messages) { + if (locResourceJson && locResourceJson.hasOwnProperty('loc.messages.' + key)) { + locStrings[key] = locResourceJson['loc.messages.' + key]; + } + else { + locStrings[key] = resourceJson.messages[key]; + } + } + } + } + else { + _warning('LIB_ResourceFile does not exist'); + } + return locStrings; +} +/** + * Sets the location of the resources json. This is typically the task.json file. + * Call once at the beginning of the script before any calls to loc. * - * 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 + * @param path Full path to the json. + * @returns void + */ +function _setResourcePath(path) { + if (process.env['TASKLIB_INPROC_UNITS']) { + _resourceFiles = {}; + _libResourceFileLoaded = false; + _locStringCache = {}; + _resourceCulture = 'en-US'; + } + if (!_resourceFiles[path]) { + _checkPath(path, 'resource file path'); + _resourceFiles[path] = path; + _debug('adding resource file: ' + path); + _resourceCulture = _getVariable('system.culture') || _resourceCulture; + var locStrs = _loadLocStrings(path, _resourceCulture); + for (var key in locStrs) { + //cache loc string + _locStringCache[key] = locStrs[key]; + } + } + else { + _warning(_loc('LIB_ResourceFileAlreadySet', path)); + } +} +exports._setResourcePath = _setResourcePath; +/** + * Gets the localized string from the json resource file. Optionally formats with additional params. * - * With parts by Mark Miller - * Copyright (C) 2011 Google Inc. + * @param key key of the resources string in the resource file + * @param param additional params for formatting the string + * @returns string + */ +function _loc(key) { + var param = []; + for (var _i = 1; _i < arguments.length; _i++) { + param[_i - 1] = arguments[_i]; + } + if (!_libResourceFileLoaded) { + // merge loc strings from azure-pipelines-task-lib. + var libResourceFile = path.join(__dirname, 'lib.json'); + var libLocStrs = _loadLocStrings(libResourceFile, _resourceCulture); + for (var libKey in libLocStrs) { + //cache azure-pipelines-task-lib loc string + _locStringCache[libKey] = libLocStrs[libKey]; + } + _libResourceFileLoaded = true; + } + var locString; + ; + if (_locStringCache.hasOwnProperty(key)) { + locString = _locStringCache[key]; + } + else { + if (Object.keys(_resourceFiles).length <= 0) { + _warning(_loc('LIB_ResourceFileNotSet', key)); + } + else { + _warning(_loc('LIB_LocStringNotFound', key)); + } + locString = key; + } + if (param.length > 0) { + return util.format.apply(this, [locString].concat(param)); + } + else { + return locString; + } +} +exports._loc = _loc; +//----------------------------------------------------- +// Input Helpers +//----------------------------------------------------- +/** + * Gets a variable value that is defined on the build/release definition or set at runtime. * - * 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 + * @param name name of the variable to get + * @returns string + */ +function _getVariable(name) { + var varval; + // get the metadata + var info; + var key = _getVariableKey(name); + if (exports._knownVariableMap.hasOwnProperty(key)) { + info = exports._knownVariableMap[key]; + } + if (info && info.secret) { + // get the secret value + varval = exports._vault.retrieveSecret('SECRET_' + key); + } + else { + // get the public value + varval = process.env[key]; + // fallback for pre 2.104.1 agent + if (!varval && name.toUpperCase() == 'AGENT.JOBSTATUS') { + varval = process.env['agent.jobstatus']; + } + } + _debug(name + '=' + varval); + return varval; +} +exports._getVariable = _getVariable; +function _getVariableKey(name) { + if (!name) { + throw new Error(_loc('LIB_ParameterIsRequired', 'name')); + } + return name.replace(/\./g, '_').replace(/ /g, '_').toUpperCase(); +} +exports._getVariableKey = _getVariableKey; +//----------------------------------------------------- +// Cmd Helpers +//----------------------------------------------------- +function _command(command, properties, message) { + var taskCmd = new tcm.TaskCommand(command, properties, message); + _writeLine(taskCmd.toString()); +} +exports._command = _command; +function _warning(message) { + _command('task.issue', { 'type': 'warning' }, message); +} +exports._warning = _warning; +function _error(message) { + _command('task.issue', { 'type': 'error' }, message); +} +exports._error = _error; +function _debug(message) { + _command('task.debug', null, message); +} +exports._debug = _debug; +// //----------------------------------------------------- +// // Disk Functions +// //----------------------------------------------------- +/** + * Returns whether a path exists. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @param path path to check + * @returns boolean + */ +function _exist(path) { + var exist = false; + try { + exist = !!(path && fs.statSync(path) != null); + } + catch (err) { + if (err && err.code === 'ENOENT') { + exist = false; + } + else { + throw err; + } + } + return exist; +} +exports._exist = _exist; +/** + * Checks whether a path exists. + * If the path does not exist, it will throw. * - * 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. + * @param p path to check + * @param name name only used in error message to identify the path + * @returns void + */ +function _checkPath(p, name) { + _debug('check path : ' + p); + if (!_exist(p)) { + throw new Error(_loc('LIB_PathNotFound', name, p)); + } +} +exports._checkPath = _checkPath; +/** + * Returns path of a tool had the tool actually been invoked. Resolves via paths. + * If you check and the tool does not exist, it will throw. + * + * @param tool name of the tool + * @param check whether to check if tool exists + * @returns string + */ +function _which(tool, check) { + if (!tool) { + throw new Error('parameter \'tool\' is required'); + } + // recursive when check=true + if (check) { + var result = _which(tool, false); + if (result) { + return result; + } + else { + if (process.platform == 'win32') { + throw new Error(_loc('LIB_WhichNotFound_Win', tool)); + } + else { + throw new Error(_loc('LIB_WhichNotFound_Linux', tool)); + } + } + } + _debug("which '" + tool + "'"); + try { + // build the list of extensions to try + var extensions = []; + if (process.platform == 'win32' && process.env['PATHEXT']) { + for (var _i = 0, _a = process.env['PATHEXT'].split(path.delimiter); _i < _a.length; _i++) { + var extension = _a[_i]; + if (extension) { + extensions.push(extension); + } + } + } + // if it's rooted, return it if exists. otherwise return empty. + if (_isRooted(tool)) { + var filePath = _tryGetExecutablePath(tool, extensions); + if (filePath) { + _debug("found: '" + filePath + "'"); + return filePath; + } + _debug('not found'); + return ''; + } + // if any path separators, return empty + if (tool.indexOf('/') >= 0 || (process.platform == 'win32' && tool.indexOf('\\') >= 0)) { + _debug('not found'); + return ''; + } + // build the list of directories + // + // Note, technically "where" checks the current directory on Windows. From a task lib perspective, + // it feels like we should not do this. Checking the current directory seems like more of a use + // case of a shell, and the which() function exposed by the task lib should strive for consistency + // across platforms. + var directories = []; + if (process.env['PATH']) { + for (var _b = 0, _c = process.env['PATH'].split(path.delimiter); _b < _c.length; _b++) { + var p = _c[_b]; + if (p) { + directories.push(p); + } + } + } + // return the first match + for (var _d = 0, directories_1 = directories; _d < directories_1.length; _d++) { + var directory = directories_1[_d]; + var filePath = _tryGetExecutablePath(directory + path.sep + tool, extensions); + if (filePath) { + _debug("found: '" + filePath + "'"); + return filePath; + } + } + _debug('not found'); + return ''; + } + catch (err) { + throw new Error(_loc('LIB_OperationFailed', 'which', err.message)); + } +} +exports._which = _which; +/** + * Best effort attempt to determine whether a file exists and is executable. + * @param filePath file path to check + * @param extensions additional file extensions to try + * @return if file exists and is executable, returns the file path. otherwise empty string. + */ +function _tryGetExecutablePath(filePath, extensions) { + try { + // test file exists + var stats = fs.statSync(filePath); + if (stats.isFile()) { + if (process.platform == 'win32') { + // on Windows, test for valid extension + var isExecutable = false; + var fileName = path.basename(filePath); + var dotIndex = fileName.lastIndexOf('.'); + if (dotIndex >= 0) { + var upperExt_1 = fileName.substr(dotIndex).toUpperCase(); + if (extensions.some(function (validExt) { return validExt.toUpperCase() == upperExt_1; })) { + return filePath; + } + } + } + else { + if (isUnixExecutable(stats)) { + return filePath; + } + } + } + } + catch (err) { + if (err.code != 'ENOENT') { + _debug("Unexpected error attempting to determine if executable file exists '" + filePath + "': " + err); + } + } + // try each extension + var originalFilePath = filePath; + for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) { + var extension = extensions_1[_i]; + var found = false; + var filePath_1 = originalFilePath + extension; + try { + var stats = fs.statSync(filePath_1); + if (stats.isFile()) { + if (process.platform == 'win32') { + // preserve the case of the actual file (since an extension was appended) + try { + var directory = path.dirname(filePath_1); + var upperName = path.basename(filePath_1).toUpperCase(); + for (var _a = 0, _b = fs.readdirSync(directory); _a < _b.length; _a++) { + var actualName = _b[_a]; + if (upperName == actualName.toUpperCase()) { + filePath_1 = path.join(directory, actualName); + break; + } + } + } + catch (err) { + _debug("Unexpected error attempting to determine the actual case of the file '" + filePath_1 + "': " + err); + } + return filePath_1; + } + else { + if (isUnixExecutable(stats)) { + return filePath_1; + } + } + } + } + catch (err) { + if (err.code != 'ENOENT') { + _debug("Unexpected error attempting to determine if executable file exists '" + filePath_1 + "': " + err); + } + } + } + return ''; +} +// on Mac/Linux, test the execute bit +// R W X R W X R W X +// 256 128 64 32 16 8 4 2 1 +function isUnixExecutable(stats) { + return (stats.mode & 1) > 0 || ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || ((stats.mode & 64) > 0 && stats.uid === process.getuid()); +} +function _legacyFindFiles_convertPatternToRegExp(pattern) { + pattern = (process.platform == 'win32' ? pattern.replace(/\\/g, '/') : pattern) // normalize separator on Windows + .replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') // regex escape - from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + .replace(/\\\/\\\*\\\*\\\//g, '((\/.+/)|(\/))') // replace directory globstar, e.g. /hello/**/world + .replace(/\\\*\\\*/g, '.*') // replace remaining globstars with a wildcard that can span directory separators, e.g. /hello/**dll + .replace(/\\\*/g, '[^\/]*') // replace asterisks with a wildcard that cannot span directory separators, e.g. /hello/*.dll + .replace(/\\\?/g, '[^\/]'); // replace single character wildcards, e.g. /hello/log?.dll + pattern = "^" + pattern + "$"; + var flags = process.platform == 'win32' ? 'i' : ''; + return new RegExp(pattern, flags); +} +exports._legacyFindFiles_convertPatternToRegExp = _legacyFindFiles_convertPatternToRegExp; +function _cloneMatchOptions(matchOptions) { + return { + debug: matchOptions.debug, + nobrace: matchOptions.nobrace, + noglobstar: matchOptions.noglobstar, + dot: matchOptions.dot, + noext: matchOptions.noext, + nocase: matchOptions.nocase, + nonull: matchOptions.nonull, + matchBase: matchOptions.matchBase, + nocomment: matchOptions.nocomment, + nonegate: matchOptions.nonegate, + flipNegate: matchOptions.flipNegate + }; +} +exports._cloneMatchOptions = _cloneMatchOptions; +function _getFindInfoFromPattern(defaultRoot, pattern, matchOptions) { + // parameter validation + if (!defaultRoot) { + throw new Error('getFindRootFromPattern() parameter defaultRoot cannot be empty'); + } + if (!pattern) { + throw new Error('getFindRootFromPattern() parameter pattern cannot be empty'); + } + if (!matchOptions.nobrace) { + throw new Error('getFindRootFromPattern() expected matchOptions.nobrace to be true'); + } + // for the sake of determining the findPath, pretend nocase=false + matchOptions = _cloneMatchOptions(matchOptions); + matchOptions.nocase = false; + // check if basename only and matchBase=true + if (matchOptions.matchBase && + !_isRooted(pattern) && + (process.platform == 'win32' ? pattern.replace(/\\/g, '/') : pattern).indexOf('/') < 0) { + return { + adjustedPattern: pattern, + findPath: defaultRoot, + statOnly: false, + }; + } + // the technique applied by this function is to use the information on the Minimatch object determine + // the findPath. Minimatch breaks the pattern into path segments, and exposes information about which + // segments are literal vs patterns. + // + // note, the technique currently imposes a limitation for drive-relative paths with a glob in the + // first segment, e.g. C:hello*/world. it's feasible to overcome this limitation, but is left unsolved + // for now. + var minimatchObj = new minimatch.Minimatch(pattern, matchOptions); + // the "set" property is an array of arrays of parsed path segment info. the outer array should only + // contain one item, otherwise something went wrong. brace expansion can result in multiple arrays, + // but that should be turned off by the time this function is reached. + if (minimatchObj.set.length != 1) { + throw new Error('getFindRootFromPattern() expected Minimatch(...).set.length to be 1. Actual: ' + minimatchObj.set.length); + } + var literalSegments = []; + for (var _i = 0, _a = minimatchObj.set[0]; _i < _a.length; _i++) { + var parsedSegment = _a[_i]; + if (typeof parsedSegment == 'string') { + // the item is a string when the original input for the path segment does not contain any + // unescaped glob characters. + // + // note, the string here is already unescaped (i.e. glob escaping removed), so it is ready + // to pass to find() as-is. for example, an input string 'hello\\*world' => 'hello*world'. + literalSegments.push(parsedSegment); + continue; + } + break; + } + // join the literal segments back together. Minimatch converts '\' to '/' on Windows, then squashes + // consequetive slashes, and finally splits on slash. this means that UNC format is lost, but can + // be detected from the original pattern. + var joinedSegments = literalSegments.join('/'); + if (joinedSegments && process.platform == 'win32' && _startsWith(pattern.replace(/\\/g, '/'), '//')) { + joinedSegments = '/' + joinedSegments; // restore UNC format + } + // determine the find path + var findPath; + if (_isRooted(pattern)) { // the pattern was rooted + findPath = joinedSegments; + } + else if (joinedSegments) { // the pattern was not rooted, and literal segments were found + findPath = _ensureRooted(defaultRoot, joinedSegments); + } + else { // the pattern was not rooted, and no literal segments were found + findPath = defaultRoot; + } + // clean up the path + if (findPath) { + findPath = _getDirectoryName(_ensureRooted(findPath, '_')); // hack to remove unnecessary trailing slash + findPath = _normalizeSeparators(findPath); // normalize slashes + } + return { + adjustedPattern: _ensurePatternRooted(defaultRoot, pattern), + findPath: findPath, + statOnly: literalSegments.length == minimatchObj.set[0].length, + }; +} +exports._getFindInfoFromPattern = _getFindInfoFromPattern; +function _ensurePatternRooted(root, p) { + if (!root) { + throw new Error('ensurePatternRooted() parameter "root" cannot be empty'); + } + if (!p) { + throw new Error('ensurePatternRooted() parameter "p" cannot be empty'); + } + if (_isRooted(p)) { + return p; + } + // normalize root + root = _normalizeSeparators(root); + // escape special glob characters + root = (process.platform == 'win32' ? root : root.replace(/\\/g, '\\\\')) // escape '\' on OSX/Linux + .replace(/(\[)(?=[^\/]+\])/g, '[[]') // escape '[' when ']' follows within the path segment + .replace(/\?/g, '[?]') // escape '?' + .replace(/\*/g, '[*]') // escape '*' + .replace(/\+\(/g, '[+](') // escape '+(' + .replace(/@\(/g, '[@](') // escape '@(' + .replace(/!\(/g, '[!]('); // escape '!(' + return _ensureRooted(root, p); +} +exports._ensurePatternRooted = _ensurePatternRooted; +//------------------------------------------------------------------- +// Populate the vault with sensitive data. Inputs and Endpoints +//------------------------------------------------------------------- +function _loadData() { + // in agent, prefer TempDirectory then workFolder. + // In interactive dev mode, it won't be + var keyPath = _getVariable("agent.TempDirectory") || _getVariable("agent.workFolder") || process.cwd(); + exports._vault = new vm.Vault(keyPath); + exports._knownVariableMap = {}; + _debug('loading inputs and endpoints'); + var loaded = 0; + for (var envvar in process.env) { + if (_startsWith(envvar, 'INPUT_') || + _startsWith(envvar, 'ENDPOINT_AUTH_') || + _startsWith(envvar, 'SECUREFILE_TICKET_') || + _startsWith(envvar, 'SECRET_') || + _startsWith(envvar, 'VSTS_TASKVARIABLE_')) { + // Record the secret variable metadata. This is required by getVariable to know whether + // to retrieve the value from the vault. In a 2.104.1 agent or higher, this metadata will + // be overwritten when the VSTS_SECRET_VARIABLES env var is processed below. + if (_startsWith(envvar, 'SECRET_')) { + var variableName = envvar.substring('SECRET_'.length); + if (variableName) { + // This is technically not the variable name (has underscores instead of dots), + // but it's good enough to make getVariable work in a pre-2.104.1 agent where + // the VSTS_SECRET_VARIABLES env var is not defined. + exports._knownVariableMap[_getVariableKey(variableName)] = { name: variableName, secret: true }; + } + } + // store the secret + if (process.env[envvar]) { + ++loaded; + _debug('loading ' + envvar); + exports._vault.storeSecret(envvar, process.env[envvar]); + delete process.env[envvar]; + } + } + } + _debug('loaded ' + loaded); + // store public variable metadata + var names; + try { + names = JSON.parse(process.env['VSTS_PUBLIC_VARIABLES'] || '[]'); + } + catch (err) { + throw new Error('Failed to parse VSTS_PUBLIC_VARIABLES as JSON. ' + err); // may occur during interactive testing + } + names.forEach(function (name) { + exports._knownVariableMap[_getVariableKey(name)] = { name: name, secret: false }; + }); + delete process.env['VSTS_PUBLIC_VARIABLES']; + // store secret variable metadata + try { + names = JSON.parse(process.env['VSTS_SECRET_VARIABLES'] || '[]'); + } + catch (err) { + throw new Error('Failed to parse VSTS_SECRET_VARIABLES as JSON. ' + err); // may occur during interactive testing + } + names.forEach(function (name) { + exports._knownVariableMap[_getVariableKey(name)] = { name: name, secret: true }; + }); + delete process.env['VSTS_SECRET_VARIABLES']; + // avoid loading twice (overwrites .taskkey) + global['_vsts_task_lib_loaded'] = true; +} +exports._loadData = _loadData; +//-------------------------------------------------------------------------------- +// Internal path helpers. +//-------------------------------------------------------------------------------- +function _ensureRooted(root, p) { + if (!root) { + throw new Error('ensureRooted() parameter "root" cannot be empty'); + } + if (!p) { + throw new Error('ensureRooted() parameter "p" cannot be empty'); + } + if (_isRooted(p)) { + return p; + } + if (process.platform == 'win32' && root.match(/^[A-Z]:$/i)) { // e.g. C: + return root + p; + } + // ensure root ends with a separator + if (_endsWith(root, '/') || (process.platform == 'win32' && _endsWith(root, '\\'))) { + // root already ends with a separator + } + else { + root += path.sep; // append separator + } + return root + p; +} +exports._ensureRooted = _ensureRooted; +/** + * Determines the parent path and trims trailing slashes (when safe). Path separators are normalized + * in the result. This function works similar to the .NET System.IO.Path.GetDirectoryName() method. + * For example, C:\hello\world\ returns C:\hello\world (trailing slash removed). Returns empty when + * no higher directory can be determined. + */ +function _getDirectoryName(p) { + // short-circuit if empty + if (!p) { + return ''; + } + // normalize separators + p = _normalizeSeparators(p); + // on Windows, the goal of this function is to match the behavior of + // [System.IO.Path]::GetDirectoryName(), e.g. + // C:/ => + // C:/hello => C:\ + // C:/hello/ => C:\hello + // C:/hello/world => C:\hello + // C:/hello/world/ => C:\hello\world + // C: => + // C:hello => C: + // C:hello/ => C:hello + // / => + // /hello => \ + // /hello/ => \hello + // //hello => + // //hello/ => + // //hello/world => + // //hello/world/ => \\hello\world + // + // unfortunately, path.dirname() can't simply be used. for example, on Windows + // it yields different results from Path.GetDirectoryName: + // C:/ => C:/ + // C:/hello => C:/ + // C:/hello/ => C:/ + // C:/hello/world => C:/hello + // C:/hello/world/ => C:/hello + // C: => C: + // C:hello => C: + // C:hello/ => C: + // / => / + // /hello => / + // /hello/ => / + // //hello => / + // //hello/ => / + // //hello/world => //hello/world + // //hello/world/ => //hello/world/ + // //hello/world/again => //hello/world/ + // //hello/world/again/ => //hello/world/ + // //hello/world/again/again => //hello/world/again + // //hello/world/again/again/ => //hello/world/again + if (process.platform == 'win32') { + if (/^[A-Z]:\\?[^\\]+$/i.test(p)) { // e.g. C:\hello or C:hello + return p.charAt(2) == '\\' ? p.substring(0, 3) : p.substring(0, 2); + } + else if (/^[A-Z]:\\?$/i.test(p)) { // e.g. C:\ or C: + return ''; + } + var lastSlashIndex = p.lastIndexOf('\\'); + if (lastSlashIndex < 0) { // file name only + return ''; + } + else if (p == '\\') { // relative root + return ''; + } + else if (lastSlashIndex == 0) { // e.g. \\hello + return '\\'; + } + else if (/^\\\\[^\\]+(\\[^\\]*)?$/.test(p)) { // UNC root, e.g. \\hello or \\hello\ or \\hello\world + return ''; + } + return p.substring(0, lastSlashIndex); // e.g. hello\world => hello or hello\world\ => hello\world + // note, this means trailing slashes for non-root directories + // (i.e. not C:\, \, or \\unc\) will simply be removed. + } + // OSX/Linux + if (p.indexOf('/') < 0) { // file name only + return ''; + } + else if (p == '/') { + return ''; + } + else if (_endsWith(p, '/')) { + return p.substring(0, p.length - 1); + } + return path.dirname(p); +} +exports._getDirectoryName = _getDirectoryName; +/** + * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: + * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). + */ +function _isRooted(p) { + p = _normalizeSeparators(p); + if (!p) { + throw new Error('isRooted() parameter "p" cannot be empty'); + } + if (process.platform == 'win32') { + return _startsWith(p, '\\') || // e.g. \ or \hello or \\hello + /^[A-Z]:/i.test(p); // e.g. C: or C:\hello + } + return _startsWith(p, '/'); // e.g. /hello +} +exports._isRooted = _isRooted; +function _normalizeSeparators(p) { + p = p || ''; + if (process.platform == 'win32') { + // convert slashes on Windows + p = p.replace(/\//g, '\\'); + // remove redundant slashes + var isUnc = /^\\\\+[^\\]/.test(p); // e.g. \\hello + return (isUnc ? '\\' : '') + p.replace(/\\\\+/g, '\\'); // preserve leading // for UNC + } + // remove redundant slashes + return p.replace(/\/\/+/g, '/'); +} +exports._normalizeSeparators = _normalizeSeparators; +//----------------------------------------------------- +// Expose proxy information to vsts-node-api +//----------------------------------------------------- +function _exposeProxySettings() { + var proxyUrl = _getVariable('Agent.ProxyUrl'); + if (proxyUrl && proxyUrl.length > 0) { + var proxyUsername = _getVariable('Agent.ProxyUsername'); + var proxyPassword = _getVariable('Agent.ProxyPassword'); + var proxyBypassHostsJson = _getVariable('Agent.ProxyBypassList'); + global['_vsts_task_lib_proxy_url'] = proxyUrl; + global['_vsts_task_lib_proxy_username'] = proxyUsername; + global['_vsts_task_lib_proxy_bypass'] = proxyBypassHostsJson; + global['_vsts_task_lib_proxy_password'] = _exposeTaskLibSecret('proxy', proxyPassword || ''); + _debug('expose agent proxy configuration.'); + global['_vsts_task_lib_proxy'] = true; + } +} +exports._exposeProxySettings = _exposeProxySettings; +//----------------------------------------------------- +// Expose certificate information to vsts-node-api +//----------------------------------------------------- +function _exposeCertSettings() { + var ca = _getVariable('Agent.CAInfo'); + if (ca) { + global['_vsts_task_lib_cert_ca'] = ca; + } + var clientCert = _getVariable('Agent.ClientCert'); + if (clientCert) { + var clientCertKey = _getVariable('Agent.ClientCertKey'); + var clientCertArchive = _getVariable('Agent.ClientCertArchive'); + var clientCertPassword = _getVariable('Agent.ClientCertPassword'); + global['_vsts_task_lib_cert_clientcert'] = clientCert; + global['_vsts_task_lib_cert_key'] = clientCertKey; + global['_vsts_task_lib_cert_archive'] = clientCertArchive; + global['_vsts_task_lib_cert_passphrase'] = _exposeTaskLibSecret('cert', clientCertPassword || ''); + } + if (ca || clientCert) { + _debug('expose agent certificate configuration.'); + global['_vsts_task_lib_cert'] = true; + } + var skipCertValidation = _getVariable('Agent.SkipCertValidation') || 'false'; + if (skipCertValidation) { + global['_vsts_task_lib_skip_cert_validation'] = skipCertValidation.toUpperCase() === 'TRUE'; + } +} +exports._exposeCertSettings = _exposeCertSettings; +// We store the encryption key on disk and hold the encrypted content and key file in memory +// return base64encoded:base64encoded +// downstream vsts-node-api will retrieve the secret later +function _exposeTaskLibSecret(keyFile, secret) { + if (secret) { + var encryptKey = crypto.randomBytes(256); + var cipher = crypto.createCipher("aes-256-ctr", encryptKey); + var encryptedContent = cipher.update(secret, "utf8", "hex"); + encryptedContent += cipher.final("hex"); + var storageFile = path.join(_getVariable('Agent.TempDirectory') || _getVariable("agent.workFolder") || process.cwd(), keyFile); + fs.writeFileSync(storageFile, encryptKey.toString('base64'), { encoding: 'utf8' }); + return new Buffer(storageFile).toString('base64') + ':' + new Buffer(encryptedContent).toString('base64'); + } +} + +/* WEBPACK VAR INJECTION */}.call(this, __dirname)) + +/***/ }), + +/***/ "./node_modules/azure-pipelines-task-lib/task.js": +/*!*******************************************************!*\ + !*** ./node_modules/azure-pipelines-task-lib/task.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var shell = __webpack_require__(/*! shelljs */ "./node_modules/shelljs/shell.js"); +var childProcess = __webpack_require__(/*! child_process */ "child_process"); +var fs = __webpack_require__(/*! fs */ "fs"); +var path = __webpack_require__(/*! path */ "path"); +var os = __webpack_require__(/*! os */ "os"); +var minimatch = __webpack_require__(/*! minimatch */ "./node_modules/minimatch/minimatch.js"); +var im = __webpack_require__(/*! ./internal */ "./node_modules/azure-pipelines-task-lib/internal.js"); +var tcm = __webpack_require__(/*! ./taskcommand */ "./node_modules/azure-pipelines-task-lib/taskcommand.js"); +var trm = __webpack_require__(/*! ./toolrunner */ "./node_modules/azure-pipelines-task-lib/toolrunner.js"); +var semver = __webpack_require__(/*! semver */ "./node_modules/semver/semver.js"); +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(); +} + + +/***/ }), + +/***/ "./node_modules/azure-pipelines-task-lib/taskcommand.js": +/*!**************************************************************!*\ + !*** ./node_modules/azure-pipelines-task-lib/taskcommand.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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, '%'); +} + + +/***/ }), + +/***/ "./node_modules/azure-pipelines-task-lib/toolrunner.js": +/*!*************************************************************!*\ + !*** ./node_modules/azure-pipelines-task-lib/toolrunner.js ***! + \*************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + } + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Q = __webpack_require__(/*! q */ "./node_modules/q/q.js"); +var os = __webpack_require__(/*! os */ "os"); +var events = __webpack_require__(/*! events */ "events"); +var child = __webpack_require__(/*! child_process */ "child_process"); +var im = __webpack_require__(/*! ./internal */ "./node_modules/azure-pipelines-task-lib/internal.js"); +var fs = __webpack_require__(/*! fs */ "fs"); +var ToolRunner = /** @class */ (function (_super) { + __extends(ToolRunner, _super); + function ToolRunner(toolPath) { + var _this = _super.call(this) || this; + if (!toolPath) { + throw new Error('Parameter \'toolPath\' cannot be null or empty.'); + } + _this.toolPath = im._which(toolPath, true); + _this.args = []; + _this._debug('toolRunner toolPath: ' + toolPath); + return _this; + } + ToolRunner.prototype._debug = function (message) { + this.emit('debug', message); + }; + ToolRunner.prototype._argStringToArray = function (argString) { + var args = []; + var inQuotes = false; + var escaped = false; + var lastCharWasSpace = true; + var arg = ''; + var append = function (c) { + // we only escape double quotes. + if (escaped && c !== '"') { + arg += '\\'; + } + arg += c; + escaped = false; + }; + for (var i = 0; i < argString.length; i++) { + var c = argString.charAt(i); + if (c === ' ' && !inQuotes) { + if (!lastCharWasSpace) { + args.push(arg); + arg = ''; + } + lastCharWasSpace = true; + continue; + } + else { + lastCharWasSpace = false; + } + if (c === '"') { + if (!escaped) { + inQuotes = !inQuotes; + } + else { + append(c); + } + continue; + } + if (c === "\\" && escaped) { + append(c); + continue; + } + if (c === "\\" && inQuotes) { + escaped = true; + continue; + } + append(c); + lastCharWasSpace = false; + } + if (!lastCharWasSpace) { + args.push(arg.trim()); + } + return args; + }; + ToolRunner.prototype._getCommandString = function (options, noPrefix) { + var _this = this; + var toolPath = this._getSpawnFileName(); + var args = this._getSpawnArgs(options); + var cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool + if (process.platform == 'win32') { + // Windows + cmd file + if (this._isCmdFile()) { + cmd += toolPath; + args.forEach(function (a) { + cmd += " " + a; + }); + } + // Windows + verbatim + else if (options.windowsVerbatimArguments) { + cmd += "\"" + toolPath + "\""; + args.forEach(function (a) { + cmd += " " + a; + }); + } + // Windows (regular) + else { + cmd += this._windowsQuoteCmdArg(toolPath); + args.forEach(function (a) { + cmd += " " + _this._windowsQuoteCmdArg(a); + }); + } + } + else { + // OSX/Linux - this can likely be improved with some form of quoting. + // creating processes on Unix is fundamentally different than Windows. + // on Unix, execvp() takes an arg array. + cmd += toolPath; + args.forEach(function (a) { + cmd += " " + a; + }); + } + // append second tool + if (this.pipeOutputToTool) { + cmd += ' | ' + this.pipeOutputToTool._getCommandString(options, /*noPrefix:*/ true); + } + return cmd; + }; + ToolRunner.prototype._processLineBuffer = function (data, strBuffer, onLine) { + try { + var s = strBuffer + data.toString(); + var n = s.indexOf(os.EOL); + while (n > -1) { + var line = s.substring(0, n); + onLine(line); + // the rest of the string ... + s = s.substring(n + os.EOL.length); + n = s.indexOf(os.EOL); + } + strBuffer = s; + } + catch (err) { + // streaming lines to console is best effort. Don't fail a build. + this._debug('error processing line'); + } + }; + ToolRunner.prototype._getSpawnFileName = function () { + if (process.platform == 'win32') { + if (this._isCmdFile()) { + return process.env['COMSPEC'] || 'cmd.exe'; + } + } + return this.toolPath; + }; + ToolRunner.prototype._getSpawnArgs = function (options) { + if (process.platform == 'win32') { + if (this._isCmdFile()) { + var argline = "/D /S /C \"" + this._windowsQuoteCmdArg(this.toolPath); + for (var i = 0; i < this.args.length; i++) { + argline += ' '; + argline += options.windowsVerbatimArguments ? this.args[i] : this._windowsQuoteCmdArg(this.args[i]); + } + argline += '"'; + return [argline]; + } + if (options.windowsVerbatimArguments) { + // note, in Node 6.x options.argv0 can be used instead of overriding args.slice and args.unshift. + // for more details, refer to https://github.com/nodejs/node/blob/v6.x/lib/child_process.js + var args_1 = this.args.slice(0); // copy the array + // override slice to prevent Node from creating a copy of the arg array. + // we need Node to use the "unshift" override below. + args_1.slice = function () { + if (arguments.length != 1 || arguments[0] != 0) { + throw new Error('Unexpected arguments passed to args.slice when windowsVerbatimArguments flag is set.'); + } + return args_1; + }; + // override unshift + // + // when using the windowsVerbatimArguments option, Node does not quote the tool path when building + // the cmdline parameter for the win32 function CreateProcess(). an unquoted space in the tool path + // causes problems for tools when attempting to parse their own command line args. tools typically + // assume their arguments begin after arg 0. + // + // by hijacking unshift, we can quote the tool path when it pushed onto the args array. Node builds + // the cmdline parameter from the args array. + // + // note, we can't simply pass a quoted tool path to Node for multiple reasons: + // 1) Node verifies the file exists (calls win32 function GetFileAttributesW) and the check returns + // false if the path is quoted. + // 2) Node passes the tool path as the application parameter to CreateProcess, which expects the + // path to be unquoted. + // + // also note, in addition to the tool path being embedded within the cmdline parameter, Node also + // passes the tool path to CreateProcess via the application parameter (optional parameter). when + // present, Windows uses the application parameter to determine which file to run, instead of + // interpreting the file from the cmdline parameter. + args_1.unshift = function () { + if (arguments.length != 1) { + throw new Error('Unexpected arguments passed to args.unshift when windowsVerbatimArguments flag is set.'); + } + return Array.prototype.unshift.call(args_1, "\"" + arguments[0] + "\""); // quote the file name + }; + return args_1; + } + } + return this.args; + }; + ToolRunner.prototype._isCmdFile = function () { + var upperToolPath = this.toolPath.toUpperCase(); + return im._endsWith(upperToolPath, '.CMD') || im._endsWith(upperToolPath, '.BAT'); + }; + ToolRunner.prototype._windowsQuoteCmdArg = function (arg) { + // for .exe, apply the normal quoting rules that libuv applies + if (!this._isCmdFile()) { + return this._uv_quote_cmd_arg(arg); + } + // otherwise apply quoting rules specific to the cmd.exe command line parser. + // the libuv rules are generic and are not designed specifically for cmd.exe + // command line parser. + // + // for a detailed description of the cmd.exe command line parser, refer to + // http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912 + // need quotes for empty arg + if (!arg) { + return '""'; + } + // determine whether the arg needs to be quoted + var cmdSpecialChars = [' ', '\t', '&', '(', ')', '[', ']', '{', '}', '^', '=', ';', '!', '\'', '+', ',', '`', '~', '|', '<', '>', '"']; + var needsQuotes = false; + var _loop_1 = function (char) { + if (cmdSpecialChars.some(function (x) { return x == char; })) { + needsQuotes = true; + return "break"; + } + }; + for (var _i = 0, arg_1 = arg; _i < arg_1.length; _i++) { + var char = arg_1[_i]; + var state_1 = _loop_1(char); + if (state_1 === "break") + break; + } + // short-circuit if quotes not needed + if (!needsQuotes) { + return arg; + } + // the following quoting rules are very similar to the rules that by libuv applies. + // + // 1) wrap the string in quotes + // + // 2) double-up quotes - i.e. " => "" + // + // this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately + // doesn't work well with a cmd.exe command line. + // + // note, replacing " with "" also works well if the arg is passed to a downstream .NET console app. + // for example, the command line: + // foo.exe "myarg:""my val""" + // is parsed by a .NET console app into an arg array: + // [ "myarg:\"my val\"" ] + // which is the same end result when applying libuv quoting rules. although the actual + // command line from libuv quoting rules would look like: + // foo.exe "myarg:\"my val\"" + // + // 3) double-up slashes that preceed a quote, + // e.g. hello \world => "hello \world" + // hello\"world => "hello\\""world" + // hello\\"world => "hello\\\\""world" + // hello world\ => "hello world\\" + // + // technically this is not required for a cmd.exe command line, or the batch argument parser. + // the reasons for including this as a .cmd quoting rule are: + // + // a) this is optimized for the scenario where the argument is passed from the .cmd file to an + // external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule. + // + // b) it's what we've been doing previously (by deferring to node default behavior) and we + // haven't heard any complaints about that aspect. + // + // note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be + // escaped when used on the command line directly - even though within a .cmd file % can be escaped + // by using %%. + // + // the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts + // the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing. + // + // one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would + // often work, since it is unlikely that var^ would exist, and the ^ character is removed when the + // variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args + // to an external program. + // + // an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file. + // % can be escaped within a .cmd file. + var reverse = '"'; + var quote_hit = true; + for (var i = arg.length; i > 0; i--) { // walk the string in reverse + reverse += arg[i - 1]; + if (quote_hit && arg[i - 1] == '\\') { + reverse += '\\'; // double the slash + } + else if (arg[i - 1] == '"') { + quote_hit = true; + reverse += '"'; // double the quote + } + else { + quote_hit = false; + } + } + reverse += '"'; + return reverse.split('').reverse().join(''); + }; + ToolRunner.prototype._uv_quote_cmd_arg = function (arg) { + // Tool runner wraps child_process.spawn() and needs to apply the same quoting as + // Node in certain cases where the undocumented spawn option windowsVerbatimArguments + // is used. + // + // Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV, + // see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details), + // pasting copyright notice from Node within this function: + // + // Copyright Joyent, Inc. and other Node contributors. All rights reserved. + // + // Permission is hereby granted, free of charge, to any person obtaining a copy + // of this software and associated documentation files (the "Software"), to + // deal in the Software without restriction, including without limitation the + // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + // sell copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + // + // The above copyright notice and this permission notice shall be included in + // all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + // IN THE SOFTWARE. + if (!arg) { + // Need double quotation for empty argument + return '""'; + } + if (arg.indexOf(' ') < 0 && arg.indexOf('\t') < 0 && arg.indexOf('"') < 0) { + // No quotation needed + return arg; + } + if (arg.indexOf('"') < 0 && arg.indexOf('\\') < 0) { + // No embedded double quotes or backslashes, so I can just wrap + // quote marks around the whole thing. + return "\"" + arg + "\""; + } + // Expected input/output: + // input : hello"world + // output: "hello\"world" + // input : hello""world + // output: "hello\"\"world" + // input : hello\world + // output: hello\world + // input : hello\\world + // output: hello\\world + // input : hello\"world + // output: "hello\\\"world" + // input : hello\\"world + // output: "hello\\\\\"world" + // input : hello world\ + // output: "hello world\\" - note the comment in libuv actually reads "hello world\" + // but it appears the comment is wrong, it should be "hello world\\" + var reverse = '"'; + var quote_hit = true; + for (var i = arg.length; i > 0; i--) { // walk the string in reverse + reverse += arg[i - 1]; + if (quote_hit && arg[i - 1] == '\\') { + reverse += '\\'; + } + else if (arg[i - 1] == '"') { + quote_hit = true; + reverse += '\\'; + } + else { + quote_hit = false; + } + } + reverse += '"'; + return reverse.split('').reverse().join(''); + }; + ToolRunner.prototype._cloneExecOptions = function (options) { + options = options || {}; + var result = { + cwd: options.cwd || process.cwd(), + env: options.env || process.env, + silent: options.silent || false, + failOnStdErr: options.failOnStdErr || false, + ignoreReturnCode: options.ignoreReturnCode || false, + windowsVerbatimArguments: options.windowsVerbatimArguments || false + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; + }; + ToolRunner.prototype._getSpawnOptions = function (options) { + options = options || {}; + var result = {}; + result.cwd = options.cwd; + result.env = options.env; + result['windowsVerbatimArguments'] = options.windowsVerbatimArguments || this._isCmdFile(); + return result; + }; + ToolRunner.prototype._getSpawnSyncOptions = function (options) { + var result = {}; + result.cwd = options.cwd; + result.env = options.env; + result['windowsVerbatimArguments'] = options.windowsVerbatimArguments || this._isCmdFile(); + return result; + }; + ToolRunner.prototype.execWithPiping = function (pipeOutputToTool, options) { + var _this = this; + var defer = Q.defer(); + this._debug('exec tool: ' + this.toolPath); + this._debug('arguments:'); + this.args.forEach(function (arg) { + _this._debug(' ' + arg); + }); + var success = true; + var optionsNonNull = this._cloneExecOptions(options); + if (!optionsNonNull.silent) { + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + } + var cp; + var toolPath = pipeOutputToTool.toolPath; + var toolPathFirst; + var successFirst = true; + var returnCodeFirst; + var fileStream; + var waitingEvents = 0; // number of process or stream events we are waiting on to complete + var returnCode = 0; + var error; + toolPathFirst = this.toolPath; + // Following node documentation example from this link on how to pipe output of one process to another + // https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options + //start the child process for both tools + waitingEvents++; + var cpFirst = child.spawn(this._getSpawnFileName(), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(optionsNonNull)); + waitingEvents++; + cp = child.spawn(pipeOutputToTool._getSpawnFileName(), pipeOutputToTool._getSpawnArgs(optionsNonNull), pipeOutputToTool._getSpawnOptions(optionsNonNull)); + fileStream = this.pipeOutputToFile ? fs.createWriteStream(this.pipeOutputToFile) : null; + if (fileStream) { + waitingEvents++; + fileStream.on('finish', function () { + waitingEvents--; //file write is complete + fileStream = null; + if (waitingEvents == 0) { + if (error) { + defer.reject(error); + } + else { + defer.resolve(returnCode); + } + } + }); + fileStream.on('error', function (err) { + waitingEvents--; //there were errors writing to the file, write is done + _this._debug("Failed to pipe output of " + toolPathFirst + " to file " + _this.pipeOutputToFile + ". Error = " + err); + fileStream = null; + if (waitingEvents == 0) { + if (error) { + defer.reject(error); + } + else { + defer.resolve(returnCode); + } + } + }); + } + //pipe stdout of first tool to stdin of second tool + cpFirst.stdout.on('data', function (data) { + try { + if (fileStream) { + fileStream.write(data); + } + cp.stdin.write(data); + } + catch (err) { + _this._debug('Failed to pipe output of ' + toolPathFirst + ' to ' + toolPath); + _this._debug(toolPath + ' might have exited due to errors prematurely. Verify the arguments passed are valid.'); + } + }); + cpFirst.stderr.on('data', function (data) { + if (fileStream) { + fileStream.write(data); + } + successFirst = !optionsNonNull.failOnStdErr; + if (!optionsNonNull.silent) { + var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; + s.write(data); + } + }); + cpFirst.on('error', function (err) { + waitingEvents--; //first process is complete with errors + if (fileStream) { + fileStream.end(); + } + cp.stdin.end(); + error = new Error(toolPathFirst + ' failed. ' + err.message); + if (waitingEvents == 0) { + defer.reject(error); + } + }); + cpFirst.on('close', function (code, signal) { + waitingEvents--; //first process is complete + if (code != 0 && !optionsNonNull.ignoreReturnCode) { + successFirst = false; + returnCodeFirst = code; + returnCode = returnCodeFirst; + } + _this._debug('success of first tool:' + successFirst); + if (fileStream) { + fileStream.end(); + } + cp.stdin.end(); + if (waitingEvents == 0) { + if (error) { + defer.reject(error); + } + else { + defer.resolve(returnCode); + } + } + }); + var stdbuffer = ''; + cp.stdout.on('data', function (data) { + _this.emit('stdout', data); + if (!optionsNonNull.silent) { + optionsNonNull.outStream.write(data); + } + _this._processLineBuffer(data, stdbuffer, function (line) { + _this.emit('stdline', line); + }); + }); + var errbuffer = ''; + cp.stderr.on('data', function (data) { + _this.emit('stderr', data); + success = !optionsNonNull.failOnStdErr; + if (!optionsNonNull.silent) { + var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; + s.write(data); + } + _this._processLineBuffer(data, errbuffer, function (line) { + _this.emit('errline', line); + }); + }); + cp.on('error', function (err) { + waitingEvents--; //process is done with errors + error = new Error(toolPath + ' failed. ' + err.message); + if (waitingEvents == 0) { + defer.reject(error); + } + }); + cp.on('close', function (code, signal) { + waitingEvents--; //process is complete + _this._debug('rc:' + code); + returnCode = code; + if (stdbuffer.length > 0) { + _this.emit('stdline', stdbuffer); + } + if (errbuffer.length > 0) { + _this.emit('errline', errbuffer); + } + if (code != 0 && !optionsNonNull.ignoreReturnCode) { + success = false; + } + _this._debug('success:' + success); + if (!successFirst) { //in the case output is piped to another tool, check exit code of both tools + error = new Error(toolPathFirst + ' failed with return code: ' + returnCodeFirst); + } + else if (!success) { + error = new Error(toolPath + ' failed with return code: ' + code); + } + if (waitingEvents == 0) { + if (error) { + defer.reject(error); + } + else { + defer.resolve(returnCode); + } + } + }); + return defer.promise; + }; + /** + * Add argument + * Append an argument or an array of arguments + * returns ToolRunner for chaining + * + * @param val string cmdline or array of strings + * @returns ToolRunner + */ + ToolRunner.prototype.arg = function (val) { + if (!val) { + return this; + } + if (val instanceof Array) { + this._debug(this.toolPath + ' arg: ' + JSON.stringify(val)); + this.args = this.args.concat(val); + } + else if (typeof (val) === 'string') { + this._debug(this.toolPath + ' arg: ' + val); + this.args = this.args.concat(val.trim()); + } + return this; + }; + /** + * Parses an argument line into one or more arguments + * e.g. .line('"arg one" two -z') is equivalent to .arg(['arg one', 'two', '-z']) + * returns ToolRunner for chaining + * + * @param val string argument line + * @returns ToolRunner + */ + ToolRunner.prototype.line = function (val) { + if (!val) { + return this; + } + this._debug(this.toolPath + ' arg: ' + val); + this.args = this.args.concat(this._argStringToArray(val)); + return this; + }; + /** + * Add argument(s) if a condition is met + * Wraps arg(). See arg for details + * returns ToolRunner for chaining + * + * @param condition boolean condition + * @param val string cmdline or array of strings + * @returns ToolRunner + */ + ToolRunner.prototype.argIf = function (condition, val) { + if (condition) { + this.arg(val); + } + return this; + }; + /** + * Pipe output of exec() to another tool + * @param tool + * @param file optional filename to additionally stream the output to. + * @returns {ToolRunner} + */ + ToolRunner.prototype.pipeExecOutputToTool = function (tool, file) { + this.pipeOutputToTool = tool; + this.pipeOutputToFile = file; + return this; + }; + /** + * Exec a tool. + * Output will be streamed to the live console. + * Returns promise with return code + * + * @param tool path to tool to exec + * @param options optional exec options. See IExecOptions + * @returns number + */ + ToolRunner.prototype.exec = function (options) { + var _this = this; + if (this.pipeOutputToTool) { + return this.execWithPiping(this.pipeOutputToTool, options); + } + var defer = Q.defer(); + this._debug('exec tool: ' + this.toolPath); + this._debug('arguments:'); + this.args.forEach(function (arg) { + _this._debug(' ' + arg); + }); + var optionsNonNull = this._cloneExecOptions(options); + if (!optionsNonNull.silent) { + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + } + var state = new ExecState(optionsNonNull, this.toolPath); + state.on('debug', function (message) { + _this._debug(message); + }); + var cp = child.spawn(this._getSpawnFileName(), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(options)); + // it is possible for the child process to end its last line without a new line. + // because stdout is buffered, this causes the last line to not get sent to the parent + // stream. Adding this event forces a flush before the child streams are closed. + cp.stdout.on('finish', function () { + if (!optionsNonNull.silent) { + optionsNonNull.outStream.write(os.EOL); + } + }); + var stdbuffer = ''; + cp.stdout.on('data', function (data) { + _this.emit('stdout', data); + if (!optionsNonNull.silent) { + optionsNonNull.outStream.write(data); + } + _this._processLineBuffer(data, stdbuffer, function (line) { + _this.emit('stdline', line); + }); + }); + var errbuffer = ''; + cp.stderr.on('data', function (data) { + state.processStderr = true; + _this.emit('stderr', data); + if (!optionsNonNull.silent) { + var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; + s.write(data); + } + _this._processLineBuffer(data, errbuffer, function (line) { + _this.emit('errline', line); + }); + }); + cp.on('error', function (err) { + state.processError = err.message; + state.processExited = true; + state.processClosed = true; + state.CheckComplete(); + }); + cp.on('exit', function (code, signal) { + state.processExitCode = code; + state.processExited = true; + _this._debug("Exit code " + code + " received from tool '" + _this.toolPath + "'"); + state.CheckComplete(); + }); + cp.on('close', function (code, signal) { + state.processExitCode = code; + state.processExited = true; + state.processClosed = true; + _this._debug("STDIO streams have closed for tool '" + _this.toolPath + "'"); + state.CheckComplete(); + }); + state.on('done', function (error, exitCode) { + if (stdbuffer.length > 0) { + _this.emit('stdline', stdbuffer); + } + if (errbuffer.length > 0) { + _this.emit('errline', errbuffer); + } + cp.removeAllListeners(); + if (error) { + defer.reject(error); + } + else { + defer.resolve(exitCode); + } + }); + return defer.promise; + }; + /** + * Exec a tool synchronously. + * Output will be *not* be streamed to the live console. It will be returned after execution is complete. + * Appropriate for short running tools + * Returns IExecSyncResult with output and return code + * + * @param tool path to tool to exec + * @param options optional exec options. See IExecSyncOptions + * @returns IExecSyncResult + */ + ToolRunner.prototype.execSync = function (options) { + var _this = this; + this._debug('exec tool: ' + this.toolPath); + this._debug('arguments:'); + this.args.forEach(function (arg) { + _this._debug(' ' + arg); + }); + var success = true; + options = this._cloneExecOptions(options); + if (!options.silent) { + options.outStream.write(this._getCommandString(options) + os.EOL); + } + var r = child.spawnSync(this._getSpawnFileName(), this._getSpawnArgs(options), this._getSpawnSyncOptions(options)); + if (!options.silent && r.stdout && r.stdout.length > 0) { + options.outStream.write(r.stdout); + } + if (!options.silent && r.stderr && r.stderr.length > 0) { + options.errStream.write(r.stderr); + } + var res = { code: r.status, error: r.error }; + res.stdout = (r.stdout) ? r.stdout.toString() : ''; + res.stderr = (r.stderr) ? r.stderr.toString() : ''; + return res; + }; + return ToolRunner; +}(events.EventEmitter)); +exports.ToolRunner = ToolRunner; +var ExecState = /** @class */ (function (_super) { + __extends(ExecState, _super); + function ExecState(options, toolPath) { + var _this = _super.call(this) || this; + _this.delay = 10000; // 10 seconds + _this.timeout = null; + if (!toolPath) { + throw new Error('toolPath must not be empty'); + } + _this.options = options; + _this.toolPath = toolPath; + var delay = process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY']; + if (delay) { + _this.delay = parseInt(delay); + } + return _this; + } + ExecState.prototype.CheckComplete = function () { + if (this.done) { + return; + } + if (this.processClosed) { + this._setResult(); + } + else if (this.processExited) { + this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this); + } + }; + ExecState.prototype._debug = function (message) { + this.emit('debug', message); + }; + ExecState.prototype._setResult = function () { + // determine whether there is an error + var error; + if (this.processExited) { + if (this.processError) { + error = new Error(im._loc('LIB_ProcessError', this.toolPath, this.processError)); + } + else if (this.processExitCode != 0 && !this.options.ignoreReturnCode) { + error = new Error(im._loc('LIB_ProcessExitCode', this.toolPath, this.processExitCode)); + } + else if (this.processStderr && this.options.failOnStdErr) { + error = new Error(im._loc('LIB_ProcessStderr', this.toolPath)); + } + } + // clear the timeout + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = null; + } + this.done = true; + this.emit('done', error, this.processExitCode); + }; + ExecState.HandleTimeout = function (state) { + if (state.done) { + return; + } + if (!state.processClosed && state.processExited) { + console.log(im._loc('LIB_StdioNotClosed', state.delay / 1000, state.toolPath)); + state._debug(im._loc('LIB_StdioNotClosed', state.delay / 1000, state.toolPath)); + } + state._setResult(); + }; + return ExecState; +}(events.EventEmitter)); + + +/***/ }), + +/***/ "./node_modules/azure-pipelines-task-lib/vault.js": +/*!********************************************************!*\ + !*** ./node_modules/azure-pipelines-task-lib/vault.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var fs = __webpack_require__(/*! fs */ "fs"); +var path = __webpack_require__(/*! path */ "path"); +var crypto = __webpack_require__(/*! crypto */ "crypto"); +var uuidV4 = __webpack_require__(/*! uuid/v4 */ "./node_modules/uuid/v4.js"); +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; + + +/***/ }), + +/***/ "./node_modules/azure-pipelines-tool-lib sync recursive": +/*!****************************************************!*\ + !*** ./node_modules/azure-pipelines-tool-lib sync ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +function webpackEmptyContext(req) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = "./node_modules/azure-pipelines-tool-lib sync recursive"; + +/***/ }), + +/***/ "./node_modules/azure-pipelines-tool-lib/node_modules/typed-rest-client/HttpClient.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/azure-pipelines-tool-lib/node_modules/typed-rest-client/HttpClient.js ***! + \********************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, 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__(/*! url */ "url"); +const http = __webpack_require__(/*! http */ "http"); +const https = __webpack_require__(/*! https */ "https"); +const tunnel = __webpack_require__(/*! tunnel */ "./node_modules/tunnel/index.js"); +const fs = __webpack_require__(/*! fs */ "fs"); +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; + + +/***/ }), + +/***/ "./node_modules/azure-pipelines-tool-lib/tool.js": +/*!*******************************************************!*\ + !*** ./node_modules/azure-pipelines-tool-lib/tool.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(__dirname) { +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__(/*! typed-rest-client/HttpClient */ "./node_modules/azure-pipelines-tool-lib/node_modules/typed-rest-client/HttpClient.js"); +const path = __webpack_require__(/*! path */ "path"); +const os = __webpack_require__(/*! os */ "os"); +const process = __webpack_require__(/*! process */ "process"); +const fs = __webpack_require__(/*! fs */ "fs"); +const semver = __webpack_require__(/*! semver */ "./node_modules/semver/semver.js"); +const tl = __webpack_require__(/*! azure-pipelines-task-lib/task */ "./node_modules/azure-pipelines-task-lib/task.js"); +const cmp = __webpack_require__(/*! semver-compare */ "./node_modules/semver-compare/index.js"); +const uuidV4 = __webpack_require__(/*! uuid/v4 */ "./node_modules/uuid/v4.js"); + +let userAgent = 'vsts-task-installer' +let requestOptions = { + // ignoreSslError: true, + proxy: tl.getHttpProxyConfiguration(), + cert: tl.getHttpCertConfiguration() +}; +let http = new httpm.HttpClient(userAgent, null, requestOptions); +tl.setResourcePath(path.join(__dirname, '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(t){"use strict";"function"==typeof bootstrap?bootstrap("promise",t):e.exports=t()}((function(){"use strict";var e=!1;try{throw new Error}catch(t){e=!!t.stack}var t,n=w(),r=function(){},i=function(){var e={task:void 0,next:null},t=e,n=!1,r=void 0,o=!1,s=[];function a(){for(var t,r;e.next;)t=(e=e.next).task,e.task=void 0,(r=e.domain)&&(e.domain=void 0,r.enter()),c(t,r);for(;s.length;)c(t=s.pop());n=!1}function c(e,t){try{e()}catch(e){if(o)throw t&&t.exit(),setTimeout(a,0),t&&t.enter(),e;setTimeout((function(){throw e}),0)}t&&t.exit()}if(i=function(e){t=t.next={task:e,domain:o&&process.domain,next:null},n||(n=!0,r())},"object"==typeof process&&"[object process]"===process.toString()&&process.nextTick)o=!0,r=function(){process.nextTick(a)};else if("function"==typeof setImmediate)r="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){r=l,u.port1.onmessage=a,a()};var l=function(){u.port2.postMessage(0)};r=function(){setTimeout(a,0),l()}}else r=function(){setTimeout(a,0)};return i.runAfter=function(e){s.push(e),n||(n=!0,r())},i}(),o=Function.call;function s(e){return function(){return o.apply(e,arguments)}}var a,c=s(Array.prototype.slice),u=s(Array.prototype.reduce||function(e,t){var n=0,r=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=r)throw new TypeError}for(;ni.stackCounter)&&(d(t,"__minimumStackCounter__",{value:i.stackCounter,configurable:!0}),r.unshift(i.stack));r.unshift(t.stack);var o=function(e){for(var t=e.split("\n"),n=[],r=0;r=n&&o<=z}function w(){if(e)try{throw new Error}catch(e){var n=e.stack.split("\n"),r=_(n[0].indexOf("@")>0?n[1]:n[2]);if(!r)return;return t=r[0],r[1]}}function S(e){return e instanceof A?e:I(e)?function(e){var t=T();return S.nextTick((function(){try{e.then(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}})),t.promise}(e):V(e)}S.resolve=S,S.nextTick=i,S.longStackSupport=!1;var E=1;function T(){var t,n=[],r=[],i=f(T.prototype),o=f(A.prototype);if(o.promiseDispatch=function(e,i,o){var s=c(arguments);n?(n.push(s),"when"===i&&o[1]&&r.push(o[1])):S.nextTick((function(){t.promiseDispatch.apply(t,s)}))},o.valueOf=function(){if(n)return o;var e=R(t);return C(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},S.longStackSupport&&e)try{throw new Error}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=E++}function s(i){t=i,S.longStackSupport&&e&&(o.source=i),u(n,(function(e,t){S.nextTick((function(){i.promiseDispatch.apply(i,t)}))}),void 0),n=void 0,r=void 0}return i.promise=o,i.resolve=function(e){t||s(S(e))},i.fulfill=function(e){t||s(V(e))},i.reject=function(e){t||s(U(e))},i.notify=function(e){t||u(r,(function(t,n){S.nextTick((function(){n(e)}))}),void 0)},i}function O(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=T();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function x(e){return O((function(t,n){for(var r=0,i=e.length;r2?e.resolve(c(arguments,1)):e.resolve(n)}},S.Promise=O,S.promise=O,O.race=x,O.all=H,O.reject=U,O.resolve=S,S.passByCopy=function(e){return e},A.prototype.passByCopy=function(){return this},S.join=function(e,t){return S(e).join(t)},A.prototype.join=function(e){return S([this,e]).spread((function(e,t){if(e===t)return e;throw new Error("Q can't join: not the same: "+e+" "+t)}))},S.race=x,A.prototype.race=function(){return this.then(S.race)},S.makePromise=A,A.prototype.toString=function(){return"[object Promise]"},A.prototype.then=function(e,t,n){var r=this,i=T(),o=!1;return S.nextTick((function(){r.promiseDispatch((function(t){o||(o=!0,i.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return U(e)}}(t)))}),"when",[function(e){o||(o=!0,i.resolve(function(e){if("function"==typeof t){m(e,r);try{return t(e)}catch(e){return U(e)}}return U(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,r=!1;try{t=function(e){return"function"==typeof n?n(e):e}(e)}catch(e){if(r=!0,!S.onerror)throw e;S.onerror(e)}r||i.notify(t)}]),i.promise},S.tap=function(e,t){return S(e).tap(t)},A.prototype.tap=function(e){return e=S(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},S.when=P,A.prototype.thenResolve=function(e){return this.then((function(){return e}))},S.thenResolve=function(e,t){return S(e).thenResolve(t)},A.prototype.thenReject=function(e){return this.then((function(){throw e}))},S.thenReject=function(e,t){return S(e).thenReject(t)},S.nearer=R,S.isPromise=C,S.isPromiseAlike=I,S.isPending=function(e){return C(e)&&"pending"===e.inspect().state},A.prototype.isPending=function(){return"pending"===this.inspect().state},S.isFulfilled=function(e){return!C(e)||"fulfilled"===e.inspect().state},A.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},S.isRejected=function(e){return C(e)&&"rejected"===e.inspect().state},A.prototype.isRejected=function(){return"rejected"===this.inspect().state};var k,N,j,M=[],D=[],B=[],F=!0;function L(){M.length=0,D.length=0,F||(F=!0)}function U(e){var t=A({when:function(t){return t&&function(e){if(F){var t=l(D,e);-1!==t&&("object"==typeof process&&"function"==typeof process.emit&&S.nextTick.runAfter((function(){var n=l(B,e);-1!==n&&(process.emit("rejectionHandled",M[t],e),B.splice(n,1))})),D.splice(t,1),M.splice(t,1))}}(this),t?t(e):this}},(function(){return this}),(function(){return{state:"rejected",reason:e}}));return function(e,t){F&&("object"==typeof process&&"function"==typeof process.emit&&S.nextTick.runAfter((function(){-1!==l(D,e)&&(process.emit("unhandledRejection",t,e),B.push(e))})),D.push(e),t&&void 0!==t.stack?M.push(t.stack):M.push("(no stack) "+t))}(t,e),t}function V(e){return A({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return g(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function q(e,t,n){return S(e).spread(t,n)}function G(e,t,n){return S(e).dispatch(t,n)}function H(e){return P(e,(function(e){var t=0,n=T();return u(e,(function(r,i,o){var s;C(i)&&"fulfilled"===(s=i.inspect()).state?e[o]=s.value:(++t,P(i,(function(r){e[o]=r,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function W(e){if(0===e.length)return S.resolve();var t=S.defer(),n=0;return u(e,(function(r,i,o){var s=e[o];n++,P(s,(function(e){t.resolve(e)}),(function(e){if(0===--n){var r=e||new Error(""+e);r.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+r.message,t.reject(r)}}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function $(e){return P(e,(function(e){return e=p(e,S),P(H(p(e,(function(e){return P(e,r,r)}))),(function(){return e}))}))}S.resetUnhandledRejections=L,S.getUnhandledReasons=function(){return M.slice()},S.stopUnhandledRejectionTracking=function(){L(),F=!1},L(),S.reject=U,S.fulfill=V,S.master=function(e){return A({isDef:function(){}},(function(t,n){return G(e,t,n)}),(function(){return S(e).inspect()}))},S.spread=q,A.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},S.async=function(e){return function(){function t(e,t){var o;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return U(e)}return o.done?S(o.value):P(o.value,r,i)}try{o=n[e](t)}catch(e){return v(e)?S(e.value):U(e)}return P(o,r,i)}var n=e.apply(this,arguments),r=t.bind(t,"next"),i=t.bind(t,"throw");return r()}},S.spawn=function(e){S.done(S.async(e)())},S.return=function(e){throw new a(e)},S.promised=function(e){return function(){return q([this,H(arguments)],(function(t,n){return e.apply(t,n)}))}},S.dispatch=G,A.prototype.dispatch=function(e,t){var n=this,r=T();return S.nextTick((function(){n.promiseDispatch(r.resolve,e,t)})),r.promise},S.get=function(e,t){return S(e).dispatch("get",[t])},A.prototype.get=function(e){return this.dispatch("get",[e])},S.set=function(e,t,n){return S(e).dispatch("set",[t,n])},A.prototype.set=function(e,t){return this.dispatch("set",[e,t])},S.del=S.delete=function(e,t){return S(e).dispatch("delete",[t])},A.prototype.del=A.prototype.delete=function(e){return this.dispatch("delete",[e])},S.mapply=S.post=function(e,t,n){return S(e).dispatch("post",[t,n])},A.prototype.mapply=A.prototype.post=function(e,t){return this.dispatch("post",[e,t])},S.send=S.mcall=S.invoke=function(e,t){return S(e).dispatch("post",[t,c(arguments,2)])},A.prototype.send=A.prototype.mcall=A.prototype.invoke=function(e){return this.dispatch("post",[e,c(arguments,1)])},S.fapply=function(e,t){return S(e).dispatch("apply",[void 0,t])},A.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},S.try=S.fcall=function(e){return S(e).dispatch("apply",[void 0,c(arguments,1)])},A.prototype.fcall=function(){return this.dispatch("apply",[void 0,c(arguments)])},S.fbind=function(e){var t=S(e),n=c(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(c(arguments))])}},A.prototype.fbind=function(){var e=this,t=c(arguments);return function(){return e.dispatch("apply",[this,t.concat(c(arguments))])}},S.keys=function(e){return S(e).dispatch("keys",[])},A.prototype.keys=function(){return this.dispatch("keys",[])},S.all=H,A.prototype.all=function(){return H(this)},S.any=W,A.prototype.any=function(){return W(this)},S.allResolved=(k=$,N="allResolved",j="allSettled",function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(N+" is deprecated, use "+j+" instead.",new Error("").stack),k.apply(k,arguments)}),A.prototype.allResolved=function(){return $(this)},S.allSettled=function(e){return S(e).allSettled()},A.prototype.allSettled=function(){return this.then((function(e){return H(p(e,(function(e){function t(){return e.inspect()}return(e=S(e)).then(t,t)})))}))},S.fail=S.catch=function(e,t){return S(e).then(void 0,t)},A.prototype.fail=A.prototype.catch=function(e){return this.then(void 0,e)},S.progress=function(e,t){return S(e).then(void 0,void 0,t)},A.prototype.progress=function(e){return this.then(void 0,void 0,e)},S.fin=S.finally=function(e,t){return S(e).finally(t)},A.prototype.fin=A.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw new Error("Q can't apply finally callback");return e=S(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},S.done=function(e,t,n,r){return S(e).done(t,n,r)},A.prototype.done=function(e,t,n){var r=function(e){S.nextTick((function(){if(m(e,i),!S.onerror)throw e;S.onerror(e)}))},i=e||t||n?this.then(e,t,n):this;"object"==typeof process&&process&&process.domain&&(r=process.domain.bind(r)),i.then(void 0,r)},S.timeout=function(e,t,n){return S(e).timeout(t,n)},A.prototype.timeout=function(e,t){var n=T(),r=setTimeout((function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(r),n.resolve(e)}),(function(e){clearTimeout(r),n.reject(e)}),n.notify),n.promise},S.delay=function(e,t){return void 0===t&&(t=e,e=void 0),S(e).delay(t)},A.prototype.delay=function(e){return this.then((function(t){var n=T();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},S.nfapply=function(e,t){return S(e).nfapply(t)},A.prototype.nfapply=function(e){var t=T(),n=c(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},S.nfcall=function(e){var t=c(arguments,1);return S(e).nfapply(t)},A.prototype.nfcall=function(){var e=c(arguments),t=T();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},S.nfbind=S.denodeify=function(e){if(void 0===e)throw new Error("Q can't wrap an undefined function");var t=c(arguments,1);return function(){var n=t.concat(c(arguments)),r=T();return n.push(r.makeNodeResolver()),S(e).fapply(n).fail(r.reject),r.promise}},A.prototype.nfbind=A.prototype.denodeify=function(){var e=c(arguments);return e.unshift(this),S.denodeify.apply(void 0,e)},S.nbind=function(e,t){var n=c(arguments,2);return function(){var r=n.concat(c(arguments)),i=T();function o(){return e.apply(t,arguments)}return r.push(i.makeNodeResolver()),S(o).fapply(r).fail(i.reject),i.promise}},A.prototype.nbind=function(){var e=c(arguments,0);return e.unshift(this),S.nbind.apply(void 0,e)},S.nmapply=S.npost=function(e,t,n){return S(e).npost(t,n)},A.prototype.nmapply=A.prototype.npost=function(e,t){var n=c(t||[]),r=T();return n.push(r.makeNodeResolver()),this.dispatch("post",[e,n]).fail(r.reject),r.promise},S.nsend=S.nmcall=S.ninvoke=function(e,t){var n=c(arguments,2),r=T();return n.push(r.makeNodeResolver()),S(e).dispatch("post",[t,n]).fail(r.reject),r.promise},A.prototype.nsend=A.prototype.nmcall=A.prototype.ninvoke=function(e){var t=c(arguments,1),n=T();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},S.nodeify=function(e,t){return S(e).nodeify(t)},A.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){S.nextTick((function(){e(null,t)}))}),(function(t){S.nextTick((function(){e(t)}))}))},S.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var z=w();return S}))},function(e,t,n){"use strict";(function(e){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(101),o=n(2),s=n(7),a=n(106),c=n(0),u=n(11),l=n(32),p=n(41),f=n(38);let d="vsts-task-installer/"+n(107)(o.join(e,"package.json")).version,h={proxy:l.getHttpProxyConfiguration(),cert:l.getHttpCertConfiguration()},g=new i.HttpClient(d,null,h);function y(e){return new Promise(t=>setTimeout(t,e))}function v(e){let t=u.clean(e);l.debug("isExplicit: "+t);let n=null!=u.valid(t);return l.debug("explicit? "+n),n}function m(e,t){let n;l.debug("evaluating "+e.length+" versions");for(let r=(e=e.sort(p)).length-1;r>=0;r--){let i=e[r];if(u.satisfies(i,t)){n=i;break}}return n?l.debug("matched: "+n):l.debug("match not found"),n}function _(e,t){let n=[];t=t||s.arch();let r=o.join(E(),e);if(l.exist(r)){l.ls("",[r]).forEach(e=>{if(v(e)){let i=o.join(r,e,t);l.exist(i)&&l.exist(`${i}.complete`)&&n.push(e)}})}return n}function b(e,t,n){let r=o.join(E(),e,u.clean(t),n);l.debug("destination "+r);let i=`${r}.complete`;return l.rmRF(r),l.rmRF(i),l.mkdirP(r),r}function w(e,t,n){let r=`${o.join(E(),e,u.clean(t),n)}.complete`;l.writeFile(r,""),l.debug("finished caching tool")}function S(e){return e||(e=o.join(T(),f())),l.mkdirP(e),e}function E(){l.assertAgent("2.115.0");let e=l.getVariable("Agent.ToolsDirectory");if(!e)throw new Error("Agent.ToolsDirectory is not set");return e}function T(){l.assertAgent("2.115.0");let e=l.getVariable("Agent.TempDirectory");if(!e)throw new Error("Agent.TempDirectory is not set");return e}l.setResourcePath(o.join(e,"lib.json")),t.debug=function(e){l.debug(e)},t.prependPath=function(e){if(l.assertAgent("2.115.0"),!e)throw new Error("Parameter toolPath must not be null or empty");if(!l.exist(e)||!l.stats(e).isDirectory())throw new Error("Directory does not exist: "+e);console.log(l.loc("TOOL_LIB_PrependPath",e));let t=e+o.delimiter+a.env.PATH;l.debug("new Path: "+t),a.env.PATH=t,console.log("##vso[task.prependpath]"+e)},t.isExplicitVersion=v,t.cleanVersion=function(e){return l.debug("cleaning: "+e),u.clean(e)},t.evaluateVersions=m,t.findLocalTool=function(e,t,n){if(!e)throw new Error("toolName parameter is required");if(!t)throw new Error("versionSpec parameter is required");if(n=n||s.arch(),!v(t)){t=m(_(e,n),t)}let r;if(t){t=u.clean(t);let i=E(),s=o.join(i,e,t,n);l.debug("checking cache: "+s),l.exist(s)&&l.exist(`${s}.complete`)?(console.log(l.loc("TOOL_LIB_FoundInCache",e,t,n)),r=s):l.debug("not found")}return r},t.findLocalToolVersions=_,t.downloadTool=function(e,t){return r(this,void 0,void 0,(function*(){return new Promise((n,s)=>r(this,void 0,void 0,(function*(){try{var a;if(l.debug(t),t=t||f(),a=o.isAbsolute(t)?t:o.join(T(),t),l.mkdirP(o.dirname(a)),console.log(l.loc("TOOL_LIB_Downloading",e)),l.debug("destination "+a),c.existsSync(a))throw new Error("Destination file path already exists");l.debug("downloading");const u=[i.HttpCodes.BadGateway,i.HttpCodes.ServiceUnavailable,i.HttpCodes.GatewayTimeout];let p=1;const d=3;let h=yield g.get(e);for(;p-1;)l.debug(`Download attempt "${p}" of "${d}" failed with status code "${h.message.statusCode}".`),p+=1,yield y(1e3),l.debug(`Downloading attempt "${p}" of "${d}"`),h=yield g.get(e);if(200!=h.message.statusCode){let n=new Error("Unexpected HTTP response: "+h.message.statusCode);throw n.httpStatusCode=h.message.statusCode,l.debug(`Failed to download "${t}" from "${e}". Code(${h.message.statusCode}) Message(${h.message.statusMessage})`),n}l.debug("creating stream");let v=c.createWriteStream(a);v.on("open",e=>r(this,void 0,void 0,(function*(){try{h.message.pipe(v).on("close",()=>{l.debug("download complete"),n(a)})}catch(e){s(e)}}))),v.on("error",e=>{v.end(),s(e)})}catch(e){s(e)}})))}))},t.cacheDir=function(e,t,n,i){return r(this,void 0,void 0,(function*(){if(n=u.clean(n),i=i||s.arch(),console.log(l.loc("TOOL_LIB_CachingTool",t,n,i)),l.debug("source dir: "+e),!l.stats(e).isDirectory())throw new Error("sourceDir is not a directory");let r=b(t,n,i);for(let t of c.readdirSync(e)){let n=o.join(e,t);l.cp(n,r+"/","-r")}return w(t,n,i),r}))},t.cacheFile=function(e,t,n,i,a){return r(this,void 0,void 0,(function*(){if(i=u.clean(i),a=a||s.arch(),console.log(l.loc("TOOL_LIB_CachingTool",n,i,a)),l.debug("source file:"+e),!l.stats(e).isFile())throw new Error("sourceFile is not a file");let r=b(n,i,a),c=o.join(r,t);return l.debug("destination file"+c),l.cp(e,c),w(n,i,a),r}))},t.extract7z=function(t,n,i){return r(this,void 0,void 0,(function*(){if("win32"!=a.platform)throw new Error("extract7z() not supported on current OS");if(!t)throw new Error("parameter 'file' is required");console.log(l.loc("TOOL_LIB_ExtractingArchive")),n=S(n);let r=a.cwd();try{if(a.chdir(n),i){let e=l.tool(i).arg("x").arg("-bb1").arg("-bd").arg("-sccUTF-8").arg(t);yield e.exec()}else{let r=`& '${o.join(e,"Invoke-7zdec.ps1").replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Source '${t.replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Target '${n.replace(/'/g,"''").replace(/"|\n|\r/g,"")}'`,i=l.which("powershell",!0),s=l.tool(i).line("-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command").arg(r);s.on("stdout",e=>{a.stdout.write(e)}),s.on("stderr",e=>{a.stderr.write(e)}),yield s.exec({silent:!0})}}finally{a.chdir(r)}return n}))},t.extractTar=function(e,t){return r(this,void 0,void 0,(function*(){console.log(l.loc("TOOL_LIB_ExtractingArchive"));let n=S(t),r=l.tool("tar");return r.arg(["xzC",n,"-f",e]),yield r.exec(),n}))},t.extractZip=function(e,t){return r(this,void 0,void 0,(function*(){if(!e)throw new Error("parameter 'file' is required");console.log(l.loc("TOOL_LIB_ExtractingArchive"));let n=S(t);if("win32"==a.platform){let t=`$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${e.replace(/'/g,"''").replace(/"|\n|\r/g,"")}', '${n.replace(/'/g,"''").replace(/"|\n|\r/g,"")}')`,r=o.join(a.env.windir,"system32","chcp.com");yield l.exec(r,"65001");let i=l.tool("powershell").line("-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command").arg(t);yield i.exec()}else{let t=l.tool("unzip").arg(e);yield t.exec({cwd:n})}return n}))},t.scrape=function(e,t){return r(this,void 0,void 0,(function*(){let n=(yield(yield g.get(e)).readBody()).match(t),r={},i=[];for(let e=0;er(this,void 0,void 0,(function*(){let t="";this.message.on("data",e=>{t+=e}),this.message.on("end",()=>{e(t)})})))}}var f;t.HttpClientResponse=p,t.isHttps=function(e){return"https:"===i.parse(e).protocol},function(e){e.HTTP_PROXY="HTTP_PROXY",e.HTTPS_PROXY="HTTPS_PROXY"}(f||(f={}));t.HttpClient=class{constructor(e,t,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._maxRedirects=50,this._keepAlive=!1,this._disposed=!1,this.userAgent=e,this.handlers=t||[],this.requestOptions=n,n&&(null!=n.ignoreSslError&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,this._httpProxy=n.proxy,n.proxy&&n.proxy.proxyBypassHosts&&(this._httpProxyBypassHosts=[],n.proxy.proxyBypassHosts.forEach(e=>{this._httpProxyBypassHosts.push(new RegExp(e,"i"))})),this._certConfig=n.cert,this._certConfig&&this._certConfig.caFile&&c.existsSync(this._certConfig.caFile)&&(this._ca=c.readFileSync(this._certConfig.caFile,"utf8")),this._certConfig&&this._certConfig.certFile&&c.existsSync(this._certConfig.certFile)&&(this._cert=c.readFileSync(this._certConfig.certFile,"utf8")),this._certConfig&&this._certConfig.keyFile&&c.existsSync(this._certConfig.keyFile)&&(this._key=c.readFileSync(this._certConfig.keyFile,"utf8")),null!=n.allowRedirects&&(this._allowRedirects=n.allowRedirects),null!=n.maxRedirects&&(this._maxRedirects=Math.max(n.maxRedirects,0)),null!=n.keepAlive&&(this._keepAlive=n.keepAlive))}options(e,t){return this.request("OPTIONS",e,null,t||{})}get(e,t){return this.request("GET",e,null,t||{})}del(e,t){return this.request("DELETE",e,null,t||{})}post(e,t,n){return this.request("POST",e,t,n||{})}patch(e,t,n){return this.request("PATCH",e,t,n||{})}put(e,t,n){return this.request("PUT",e,t,n||{})}head(e,t){return this.request("HEAD",e,null,t||{})}sendStream(e,t,n,r){return this.request(e,t,n,r)}request(e,t,n,i){return r(this,void 0,void 0,(function*(){if(this._disposed)throw new Error("Client has already been disposed.");let r=this._prepareRequest(e,t,i),o=yield this.requestRaw(r,n);if(o&&o.message&&o.message.statusCode===u.Unauthorized){let e;for(let t=0;t0;){const t=o.message.headers.location;if(!t)break;yield o.readBody(),r=this._prepareRequest(e,t,i),o=yield this.requestRaw(r,n),s--}return o}))}dispose(){this._agent&&this._agent.destroy(),this._disposed=!0}requestRaw(e,t){return new Promise((n,r)=>{this.requestRawWithCallback(e,t,(function(e,t){e&&r(e),n(t)}))})}requestRawWithCallback(e,t,n){let r;"string"==typeof t&&(e.options.headers["Content-Length"]=Buffer.byteLength(t,"utf8"));let i=!1,o=(e,t)=>{i||(i=!0,n(e,t))},s=e.httpModule.request(e.options,e=>{let t=new p(e);o(null,t)});s.on("socket",e=>{r=e}),s.setTimeout(this._socketTimeout||18e4,()=>{r&&r.end(),o(new Error("Request timeout: "+e.options.path),null)}),s.on("error",(function(e){o(e,null)})),t&&"string"==typeof t&&s.write(t,"utf8"),t&&"string"!=typeof t?(t.on("close",(function(){s.end()})),t.pipe(s)):s.end()}_prepareRequest(e,t,n){const r={};r.parsedUrl=i.parse(t);const a="https:"===r.parsedUrl.protocol;r.httpModule=a?s:o;const c=a?443:80;return r.options={},r.options.host=r.parsedUrl.hostname,r.options.port=r.parsedUrl.port?parseInt(r.parsedUrl.port):c,r.options.path=(r.parsedUrl.pathname||"")+(r.parsedUrl.search||""),r.options.method=e,r.options.headers=n||{},r.options.headers["User-Agent"]=this.userAgent,r.options.agent=this._getAgent(t),this.handlers&&this.handlers.forEach(e=>{e.prepareRequest(r.options)}),r}_getAgent(e){let t,n=this._getProxy(e),r=n.proxyUrl&&n.proxyUrl.hostname&&!this._isBypassProxy(e);if(this._keepAlive&&r&&(t=this._proxyAgent),this._keepAlive&&!r&&(t=this._agent),t)return t;const c="https:"===i.parse(e).protocol;let u=100;if(this.requestOptions&&(u=this.requestOptions.maxSockets||o.globalAgent.maxSockets),r){const e={maxSockets:u,keepAlive:this._keepAlive,proxy:{proxyAuth:n.proxyAuth,host:n.proxyUrl.hostname,port:n.proxyUrl.port}};let r;const i="https:"===n.proxyUrl.protocol;r=c?i?a.httpsOverHttps:a.httpsOverHttp:i?a.httpOverHttps:a.httpOverHttp,t=r(e),this._proxyAgent=t}if(this._keepAlive&&!t){const e={keepAlive:this._keepAlive,maxSockets:u};t=c?new s.Agent(e):new o.Agent(e),this._agent=t}return t||(t=c?s.globalAgent:o.globalAgent),c&&this._ignoreSslError&&(t.options=Object.assign(t.options||{},{rejectUnauthorized:!1})),c&&this._certConfig&&(t.options=Object.assign(t.options||{},{ca:this._ca,cert:this._cert,key:this._key,passphrase:this._certConfig.passphrase})),t}_getProxy(e){let t,n,r="https:"===i.parse(e).protocol,o=this._httpProxy,s=process.env[f.HTTPS_PROXY],a=process.env[f.HTTP_PROXY];return o||(s&&r?o={proxyUrl:s}:a&&(o={proxyUrl:a})),o&&(o.proxyUrl.length>0&&(t=i.parse(o.proxyUrl)),(o.proxyUsername||o.proxyPassword)&&(n=o.proxyUsername+":"+o.proxyPassword)),{proxyUrl:t,proxyAuth:n}}_isBypassProxy(e){if(!this._httpProxyBypassHosts)return!1;let t=!1;return this._httpProxyBypassHosts.forEach(n=>{n.test(e)&&(t=!0)}),t}}},function(e,t,n){"use strict";n(103);var r,i=n(104),o=n(22),s=n(23),a=n(39),c=n(105),u=n(36);function l(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||o.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",(function(e,n,r,i){for(var o=f(n,r,i),s=0,a=t.requests.length;s=this.maxSockets?i.requests.push(o):i.createSocket(o,(function(t){function n(){i.emit("free",t,o)}function r(e){i.removeSocket(t),t.removeListener("free",n),t.removeListener("close",r),t.removeListener("agentRemove",r)}t.on("free",n),t.on("close",r),t.on("agentRemove",r),e.onSocket(t)}))},l.prototype.createSocket=function(e,t){var n=this,i={};n.sockets.push(i);var o=d({},n.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1});o.proxyAuth&&(o.headers=o.headers||{},o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64")),r("making CONNECT request");var s=n.request(o);function a(o,a,u){if(s.removeAllListeners(),a.removeAllListeners(),200===o.statusCode)c.equal(u.length,0),r("tunneling connection has established"),n.sockets[n.sockets.indexOf(i)]=a,t(a);else{r("tunneling socket could not be established, statusCode=%d",o.statusCode);var l=new Error("tunneling socket could not be established, statusCode="+o.statusCode);l.code="ECONNRESET",e.request.emit("error",l),n.removeSocket(i)}}s.useChunkedEncodingByDefault=!1,s.once("response",(function(e){e.upgrade=!0})),s.once("upgrade",(function(e,t,n){process.nextTick((function(){a(e,t,n)}))})),s.once("connect",a),s.once("error",(function(t){s.removeAllListeners(),r("tunneling socket could not be established, cause=%s\n",t.message,t.stack);var o=new Error("tunneling socket could not be established, cause="+t.message);o.code="ECONNRESET",e.request.emit("error",o),n.removeSocket(i)})),s.end()},l.prototype.removeSocket=function(e){var t=this.sockets.indexOf(e);if(-1!==t){this.sockets.splice(t,1);var n=this.requests.shift();n&&this.createSocket(n,(function(e){n.request.onSocket(e)}))}},r=process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments);"string"==typeof e[0]?e[0]="TUNNEL: "+e[0]:e.unshift("TUNNEL:"),console.error.apply(console,e)}:function(){},t.debug=r},function(e,t){e.exports=require("net")},function(e,t){e.exports=require("tls")},function(e,t){e.exports=require("assert")},function(e,t){e.exports=require("process")},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=107},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},o=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=a(n(0)),l=a(n(7)),p=a(n(2)),f=a(n(11)),d=a(n(109)),h=c(n(41)),g=n(12),y=n(25);let v=class{constructor(e,t){this.buildAgent=e,this.versionManager=t,this.httpClient=new d.HttpClient("dotnet")}run(e){return this.buildAgent.exec("dotnet",e)}toolInstall(e,t,n,r){return s(this,void 0,void 0,(function*(){let i;if(console.log(""),console.log("--------------------------"),console.log(`Installing ${e} version `+t),console.log("--------------------------"),this.versionManager.isExplicitVersion(t)&&(n=!1),n||(i=this.buildAgent.find(e,t)),!i){let n;if(this.versionManager.isExplicitVersion(t))n=t;else{if(n=yield this.queryLatestMatch(e,t,r),!n)throw new Error(`Unable to find ${e} version '${t}'.`);i=this.buildAgent.find(e,n)}i||(i=yield this.acquireTool(e,n))}if(this.buildAgent.debug(`toolPath: ${i}`),"win32"!==l.platform()){const e=p.dirname(u.readlinkSync(yield this.buildAgent.which("dotnet")));this.buildAgent.exportVariable("DOTNET_ROOT",e)}return this.buildAgent.addPath(i),i}))}queryLatestMatch(e,t,n){return s(this,void 0,void 0,(function*(){this.buildAgent.debug(`querying tool versions for ${e}${t?`@${t}`:""} ${n?"including pre-releases":""}`);const r=`https://api-v2v3search-0.nuget.org/query?q=${encodeURIComponent(e.toLowerCase())}&prerelease=${n?"true":"false"}&semVerLevel=2.0.0`,i=yield this.httpClient.get(r);if(!i||200!==i.message.statusCode)return null;const o=yield i.readBody(),s=JSON.parse(o).data[0].versions.map(e=>e.version);return s&&s.length?(this.buildAgent.debug(`got versions: ${s.join(", ")}`),this.versionManager.evaluateVersions(s,t)):null}))}acquireTool(e,t){return s(this,void 0,void 0,(function*(){const n=yield this.buildAgent.createTempDir();let r=["tool","install",e,"--tool-path",n];t&&(t=this.versionManager.cleanVersion(t),r=r.concat(["--version",t]));const i=yield this.run(r),o=0===i.code?"success":"failure",s=0===i.code?i.stdout:i.stderr;if(this.buildAgent.debug(`tool install result: ${o} ${s}`),i.code)throw new Error("Error installing tool");return yield this.buildAgent.cacheDir(n,e,t)}))}};v=r([g.injectable(),o(0,g.inject(y.TYPES.IBuildAgent)),o(1,g.inject(y.TYPES.IVersionManager)),i("design:paramtypes",[Object,Object])],v),t.DotnetTool=v;let m=class{constructor(e,t){this.buildAgent=e,this.dotnetTool=t}install(e,t){return s(this,void 0,void 0,(function*(){yield this.dotnetTool.toolInstall("GitVersion.Tool",e,!1,t)}))}run(e){const t=this.getRepoDir(e.targetPath),n=this.getArguments(t,e);return this.buildAgent.exec("dotnet-gitversion",n)}getRepoDir(e){let t;const n=this.buildAgent.getSourceDir();if(e){if(!this.buildAgent.directoryExists(e))throw new Error("Directory not found at "+e);t=p.join(n,e)}else t=n;return t.replace(/\\/g,"/")}getArguments(e,t){const n=[e,"/output","json"],{useConfigFile:r,configFilePath:i,updateAssemblyInfo:o,updateAssemblyInfoFilename:s,additionalArguments:a}=t;if(r){if(!this.buildAgent.isValidInputFile("configFilePath",i))throw new Error("GitVersion configuration file not found at "+i);n.push("/config",i)}if(o){if(n.push("/updateassemblyinfo"),!this.buildAgent.isValidInputFile("updateAssemblyInfoFilename",s))throw new Error("AssemblyInfoFilename file not found at "+s);n.push(s)}return n.push(a),n}};m=r([g.injectable(),o(0,g.inject(y.TYPES.IBuildAgent)),o(1,g.inject(y.TYPES.IDotnetTool)),i("design:paramtypes",[Object,Object])],m),t.GitVersionTool=m;let _=class{constructor(e){this.buildAgent=e}isExplicitVersion(e){const t=f.clean(e);this.buildAgent.debug("isExplicit: "+t);const n=null!=f.valid(t);return this.buildAgent.debug("explicit? "+n),n}evaluateVersions(e,t){let n;this.buildAgent.debug("evaluating "+e.length+" versions");for(let r=(e=e.sort(h.default)).length-1;r>=0;r--){const i=e[r];if(f.satisfies(i,t)){n=i;break}}return n?this.buildAgent.debug("matched: "+n):this.buildAgent.debug("match not found"),n}cleanVersion(e){return this.buildAgent.debug("cleaning: "+e),f.clean(e)}};_=r([g.injectable(),o(0,g.inject(y.TYPES.IBuildAgent)),i("design:paramtypes",[Object])],_),t.VersionManager=_},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(21),o=n(22),s=n(23),a=n(110);let c,u;var l;!function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"}(l=t.HttpCodes||(t.HttpCodes={}));const p=[l.MovedPermanently,l.ResourceMoved,l.SeeOther,l.TemporaryRedirect,l.PermanentRedirect],f=[l.BadGateway,l.ServiceUnavailable,l.GatewayTimeout],d=["OPTIONS","GET","DELETE","HEAD"];class h{constructor(e){this.message=e}readBody(){return new Promise((e,t)=>r(this,void 0,void 0,(function*(){let n=Buffer.alloc(0);const i=a.obtainContentCharset(this),o=this.message.headers["content-encoding"]||"",s=new RegExp("(gzip$)|(gzip, *deflate)").test(o);this.message.on("data",(function(e){const t="string"==typeof e?Buffer.from(e,i):e;n=Buffer.concat([n,t])})).on("end",(function(){return r(this,void 0,void 0,(function*(){if(s){const t=yield a.decompressGzippedContent(n,i);e(t)}e(n.toString(i))}))})).on("error",(function(e){t(e)}))})))}}var g;t.HttpClientResponse=h,t.isHttps=function(e){return"https:"===i.parse(e).protocol},function(e){e.HTTP_PROXY="HTTP_PROXY",e.HTTPS_PROXY="HTTPS_PROXY",e.NO_PROXY="NO_PROXY"}(g||(g={}));t.HttpClient=class{constructor(e,t,r){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=e,this.handlers=t||[];let i=process.env[g.NO_PROXY];i&&(this._httpProxyBypassHosts=[],i.split(",").forEach(e=>{this._httpProxyBypassHosts.push(new RegExp(e,"i"))})),this.requestOptions=r,r&&(null!=r.ignoreSslError&&(this._ignoreSslError=r.ignoreSslError),this._socketTimeout=r.socketTimeout,this._httpProxy=r.proxy,r.proxy&&r.proxy.proxyBypassHosts&&(this._httpProxyBypassHosts=[],r.proxy.proxyBypassHosts.forEach(e=>{this._httpProxyBypassHosts.push(new RegExp(e,"i"))})),this._certConfig=r.cert,this._certConfig&&(c=n(0),this._certConfig.caFile&&c.existsSync(this._certConfig.caFile)&&(this._ca=c.readFileSync(this._certConfig.caFile,"utf8")),this._certConfig.certFile&&c.existsSync(this._certConfig.certFile)&&(this._cert=c.readFileSync(this._certConfig.certFile,"utf8")),this._certConfig.keyFile&&c.existsSync(this._certConfig.keyFile)&&(this._key=c.readFileSync(this._certConfig.keyFile,"utf8"))),null!=r.allowRedirects&&(this._allowRedirects=r.allowRedirects),null!=r.allowRedirectDowngrade&&(this._allowRedirectDowngrade=r.allowRedirectDowngrade),null!=r.maxRedirects&&(this._maxRedirects=Math.max(r.maxRedirects,0)),null!=r.keepAlive&&(this._keepAlive=r.keepAlive),null!=r.allowRetries&&(this._allowRetries=r.allowRetries),null!=r.maxRetries&&(this._maxRetries=r.maxRetries))}options(e,t){return this.request("OPTIONS",e,null,t||{})}get(e,t){return this.request("GET",e,null,t||{})}del(e,t){return this.request("DELETE",e,null,t||{})}post(e,t,n){return this.request("POST",e,t,n||{})}patch(e,t,n){return this.request("PATCH",e,t,n||{})}put(e,t,n){return this.request("PUT",e,t,n||{})}head(e,t){return this.request("HEAD",e,null,t||{})}sendStream(e,t,n,r){return this.request(e,t,n,r)}request(e,t,n,o){return r(this,void 0,void 0,(function*(){if(this._disposed)throw new Error("Client has already been disposed.");let r,s=i.parse(t),a=this._prepareRequest(e,s,o),c=this._allowRetries&&-1!=d.indexOf(e)?this._maxRetries+1:1,u=0;for(;u0;){const c=r.message.headers.location;if(!c)break;let u=i.parse(c);if("https:"==s.protocol&&s.protocol!=u.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");yield r.readBody(),a=this._prepareRequest(e,u,o),r=yield this.requestRaw(a,n),t--}if(-1==f.indexOf(r.message.statusCode))return r;u+=1,u{this.requestRawWithCallback(e,t,(function(e,t){e&&r(e),n(t)}))})}requestRawWithCallback(e,t,n){let r;"string"==typeof t&&(e.options.headers["Content-Length"]=Buffer.byteLength(t,"utf8"));let i=!1,o=(e,t)=>{i||(i=!0,n(e,t))},s=e.httpModule.request(e.options,e=>{let t=new h(e);o(null,t)});s.on("socket",e=>{r=e}),s.setTimeout(this._socketTimeout||18e4,()=>{r&&r.end(),o(new Error("Request timeout: "+e.options.path),null)}),s.on("error",(function(e){o(e,null)})),t&&"string"==typeof t&&s.write(t,"utf8"),t&&"string"!=typeof t?(t.on("close",(function(){s.end()})),t.pipe(s)):s.end()}_prepareRequest(e,t,n){const r={};r.parsedUrl=t;const a="https:"===r.parsedUrl.protocol;r.httpModule=a?s:o;const c=a?443:80;return r.options={},r.options.host=r.parsedUrl.hostname,r.options.port=r.parsedUrl.port?parseInt(r.parsedUrl.port):c,r.options.path=(r.parsedUrl.pathname||"")+(r.parsedUrl.search||""),r.options.method=e,r.options.headers=this._mergeHeaders(n),null!=this.userAgent&&(r.options.headers["user-agent"]=this.userAgent),r.options.agent=this._getAgent(r.parsedUrl),this.handlers&&!this._isPresigned(i.format(t))&&this.handlers.forEach(e=>{e.prepareRequest(r.options)}),r}_isPresigned(e){if(this.requestOptions&&this.requestOptions.presignedUrlPatterns){const t=this.requestOptions.presignedUrlPatterns;for(let n=0;nObject.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{});return this.requestOptions&&this.requestOptions.headers?Object.assign({},t(this.requestOptions.headers),t(e)):t(e||{})}_getAgent(e){let t,r=this._getProxy(e),i=r.proxyUrl&&r.proxyUrl.hostname&&!this._isMatchInBypassProxyList(e);if(this._keepAlive&&i&&(t=this._proxyAgent),this._keepAlive&&!i&&(t=this._agent),t)return t;const a="https:"===e.protocol;let c=100;if(this.requestOptions&&(c=this.requestOptions.maxSockets||o.globalAgent.maxSockets),i){u||(u=n(40));const e={maxSockets:c,keepAlive:this._keepAlive,proxy:{proxyAuth:r.proxyAuth,host:r.proxyUrl.hostname,port:r.proxyUrl.port}};let i;const o="https:"===r.proxyUrl.protocol;i=a?o?u.httpsOverHttps:u.httpsOverHttp:o?u.httpOverHttps:u.httpOverHttp,t=i(e),this._proxyAgent=t}if(this._keepAlive&&!t){const e={keepAlive:this._keepAlive,maxSockets:c};t=a?new s.Agent(e):new o.Agent(e),this._agent=t}return t||(t=a?s.globalAgent:o.globalAgent),a&&this._ignoreSslError&&(t.options=Object.assign(t.options||{},{rejectUnauthorized:!1})),a&&this._certConfig&&(t.options=Object.assign(t.options||{},{ca:this._ca,cert:this._cert,key:this._key,passphrase:this._certConfig.passphrase})),t}_getProxy(e){let t,n,r="https:"===e.protocol,o=this._httpProxy,s=process.env[g.HTTPS_PROXY],a=process.env[g.HTTP_PROXY];return o||(s&&r?o={proxyUrl:s}:a&&(o={proxyUrl:a})),o&&(o.proxyUrl.length>0&&(t=i.parse(o.proxyUrl)),(o.proxyUsername||o.proxyPassword)&&(n=o.proxyUsername+":"+o.proxyPassword)),{proxyUrl:t,proxyAuth:n}}_isMatchInBypassProxyList(e){if(!this._httpProxyBypassHosts)return!1;let t=!1;return this._httpProxyBypassHosts.forEach(n=>{n.test(e.href)&&(t=!0)}),t}_performExponentialBackoff(e){e=Math.min(10,e);const t=5*Math.pow(2,e);return new Promise(e=>setTimeout(()=>e(),t))}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(s,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(111),o=n(21),s=n(2),a=n(114);t.getUrl=function(e,t,n){const r=s.posix||s;let a="";if(t)if(e){const n=o.parse(t),i=o.parse(e);i.protocol=i.protocol||n.protocol,i.auth=i.auth||n.auth,i.host=i.host||n.host,i.pathname=r.resolve(n.pathname,i.pathname),!i.pathname.endsWith("/")&&e.endsWith("/")&&(i.pathname+="/"),a=o.format(i)}else a=t;else a=e;return n?function(e,t){const n=e.replace(/\?$/g,""),r=i.stringify(t.params,function(e){return{addQueryPrefix:!0,delimiter:(e.options||{}).separator||"&",allowDots:(e.options||{}).shouldAllowDots||!1,arrayFormat:(e.options||{}).arrayFormat||"repeat",encodeValuesOnly:(e.options||{}).shouldOnlyEncodeValues||!0}}(t));return`${n}${r}`}(a,n):a},t.decompressGzippedContent=function(e,t){return r(this,void 0,void 0,(function*(){return new Promise((n,i)=>r(this,void 0,void 0,(function*(){a.gunzip(e,(function(e,r){e&&i(e),n(r.toString(t||"utf-8"))}))})))}))},t.obtainContentCharset=function(e){const t=(e.message.headers["content-type"]||"").match(/charset=([^;,\r\n]+)/i);return t&&t[1]?t[1]:"utf-8"}},function(e,t,n){"use strict";var r=n(112),i=n(113),o=n(42);e.exports={formats:o,parse:i,stringify:r}},function(e,t,n){"use strict";var r=n(24),i=n(42),o=Object.prototype.hasOwnProperty,s={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},a=Array.isArray,c=Array.prototype.push,u=function(e,t){c.apply(e,a(t)?t:[t])},l=Date.prototype.toISOString,p=i.default,f={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,format:p,formatter:i.formatters[p],indices:!1,serializeDate:function(e){return l.call(e)},skipNulls:!1,strictNullHandling:!1},d=function e(t,n,i,o,s,c,l,p,d,h,g,y,v){var m,_=t;if("function"==typeof l?_=l(n,_):_ instanceof Date?_=h(_):"comma"===i&&a(_)&&(_=_.join(",")),null===_){if(o)return c&&!y?c(n,f.encoder,v,"key"):n;_=""}if("string"==typeof(m=_)||"number"==typeof m||"boolean"==typeof m||"symbol"==typeof m||"bigint"==typeof m||r.isBuffer(_))return c?[g(y?n:c(n,f.encoder,v,"key"))+"="+g(c(_,f.encoder,v,"value"))]:[g(n)+"="+g(String(_))];var b,w=[];if(void 0===_)return w;if(a(l))b=l;else{var S=Object.keys(_);b=p?S.sort(p):S}for(var E=0;E0?m+v:""}},function(e,t,n){"use strict";var r=n(24),i=Object.prototype.hasOwnProperty,o=Array.isArray,s={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t,n){if(e){var r=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,s=n.depth>0&&/(\[[^[\]]*])/.exec(r),a=s?r.slice(0,s.index):r,c=[];if(a){if(!n.plainObjects&&i.call(Object.prototype,a)&&!n.allowPrototypes)return;c.push(a)}for(var u=0;n.depth>0&&null!==(s=o.exec(r))&&u=0;--i){var o,s=e[i];if("[]"===s&&n.parseArrays)o=[].concat(r);else{o=n.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,c=parseInt(a,10);n.parseArrays||""!==a?!isNaN(c)&&s!==a&&String(c)===a&&c>=0&&n.parseArrays&&c<=n.arrayLimit?(o=[])[c]=r:o[a]=r:o={0:r}}r=o}return r}(c,t,n)}};e.exports=function(e,t){var n=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var n,c={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,l=t.parameterLimit===1/0?void 0:t.parameterLimit,p=u.split(t.delimiter,l),f=-1,d=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(g=g.split(",")),y.indexOf("[]=")>-1&&(g=o(g)?[g]:g),i.call(c,h)?c[h]=r.combine(c[h],g):c[h]=g}return c}(e,n):e,l=n.plainObjects?Object.create(null):{},p=Object.keys(u),f=0;f= 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; +} + + +/***/ }), + +/***/ "./node_modules/brace-expansion/index.js": +/*!***********************************************!*\ + !*** ./node_modules/brace-expansion/index.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var concatMap = __webpack_require__(/*! concat-map */ "./node_modules/concat-map/index.js"); +var balanced = __webpack_require__(/*! balanced-match */ "./node_modules/balanced-match/index.js"); + +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; +} + + + +/***/ }), + +/***/ "./node_modules/concat-map/index.js": +/*!******************************************!*\ + !*** ./node_modules/concat-map/index.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/decorator_utils.js": +/*!******************************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/decorator_utils.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/inject.js": +/*!*********************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/inject.js ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var error_msgs_1 = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/injectable.js": +/*!*************************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/injectable.js ***! + \*************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERRORS_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/multi_inject.js": +/*!***************************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/multi_inject.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/named.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/named.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +function named(name) { + return function (target, targetKey, index) { + var metadata = new metadata_1.Metadata(METADATA_KEY.NAMED_TAG, name); + if (typeof index === "number") { + decorator_utils_1.tagParameter(target, targetKey, index, metadata); + } + else { + decorator_utils_1.tagProperty(target, targetKey, metadata); + } + }; +} +exports.named = named; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/optional.js": +/*!***********************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/optional.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/post_construct.js": +/*!*****************************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/post_construct.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERRORS_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/tagged.js": +/*!*********************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/tagged.js ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/target_name.js": +/*!**************************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/target_name.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/annotation/unmanaged.js": +/*!************************************************************!*\ + !*** ./node_modules/inversify/lib/annotation/unmanaged.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var decorator_utils_1 = __webpack_require__(/*! ./decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/bindings/binding.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/bindings/binding.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var id_1 = __webpack_require__(/*! ../utils/id */ "./node_modules/inversify/lib/utils/id.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/bindings/binding_count.js": +/*!**************************************************************!*\ + !*** ./node_modules/inversify/lib/bindings/binding_count.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var BindingCount = { + MultipleBindingsAvailable: 2, + NoBindingsAvailable: 0, + OnlyOneBindingAvailable: 1 +}; +exports.BindingCount = BindingCount; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/constants/error_msgs.js": +/*!************************************************************!*\ + !*** ./node_modules/inversify/lib/constants/error_msgs.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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"; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/constants/literal_types.js": +/*!***************************************************************!*\ + !*** ./node_modules/inversify/lib/constants/literal_types.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/constants/metadata_keys.js": +/*!***************************************************************!*\ + !*** ./node_modules/inversify/lib/constants/metadata_keys.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NAMED_TAG = "named"; +exports.NAME_TAG = "name"; +exports.UNMANAGED_TAG = "unmanaged"; +exports.OPTIONAL_TAG = "optional"; +exports.INJECT_TAG = "inject"; +exports.MULTI_INJECT_TAG = "multi_inject"; +exports.TAGGED = "inversify:tagged"; +exports.TAGGED_PROP = "inversify:tagged_props"; +exports.PARAM_TYPES = "inversify:paramtypes"; +exports.DESIGN_PARAM_TYPES = "design:paramtypes"; +exports.POST_CONSTRUCT = "post_construct"; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/container/container.js": +/*!***********************************************************!*\ + !*** ./node_modules/inversify/lib/container/container.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, 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__(/*! ../bindings/binding */ "./node_modules/inversify/lib/bindings/binding.js"); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_reader_1 = __webpack_require__(/*! ../planning/metadata_reader */ "./node_modules/inversify/lib/planning/metadata_reader.js"); +var planner_1 = __webpack_require__(/*! ../planning/planner */ "./node_modules/inversify/lib/planning/planner.js"); +var resolver_1 = __webpack_require__(/*! ../resolution/resolver */ "./node_modules/inversify/lib/resolution/resolver.js"); +var binding_to_syntax_1 = __webpack_require__(/*! ../syntax/binding_to_syntax */ "./node_modules/inversify/lib/syntax/binding_to_syntax.js"); +var id_1 = __webpack_require__(/*! ../utils/id */ "./node_modules/inversify/lib/utils/id.js"); +var serialization_1 = __webpack_require__(/*! ../utils/serialization */ "./node_modules/inversify/lib/utils/serialization.js"); +var container_snapshot_1 = __webpack_require__(/*! ./container_snapshot */ "./node_modules/inversify/lib/container/container_snapshot.js"); +var lookup_1 = __webpack_require__(/*! ./lookup */ "./node_modules/inversify/lib/container/lookup.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/container/container_module.js": +/*!******************************************************************!*\ + !*** ./node_modules/inversify/lib/container/container_module.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var id_1 = __webpack_require__(/*! ../utils/id */ "./node_modules/inversify/lib/utils/id.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/container/container_snapshot.js": +/*!********************************************************************!*\ + !*** ./node_modules/inversify/lib/container/container_snapshot.js ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/container/lookup.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/container/lookup.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/inversify.js": +/*!*************************************************!*\ + !*** ./node_modules/inversify/lib/inversify.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var keys = __webpack_require__(/*! ./constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +exports.METADATA_KEY = keys; +var container_1 = __webpack_require__(/*! ./container/container */ "./node_modules/inversify/lib/container/container.js"); +exports.Container = container_1.Container; +var literal_types_1 = __webpack_require__(/*! ./constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +exports.BindingScopeEnum = literal_types_1.BindingScopeEnum; +exports.BindingTypeEnum = literal_types_1.BindingTypeEnum; +exports.TargetTypeEnum = literal_types_1.TargetTypeEnum; +var container_module_1 = __webpack_require__(/*! ./container/container_module */ "./node_modules/inversify/lib/container/container_module.js"); +exports.AsyncContainerModule = container_module_1.AsyncContainerModule; +exports.ContainerModule = container_module_1.ContainerModule; +var injectable_1 = __webpack_require__(/*! ./annotation/injectable */ "./node_modules/inversify/lib/annotation/injectable.js"); +exports.injectable = injectable_1.injectable; +var tagged_1 = __webpack_require__(/*! ./annotation/tagged */ "./node_modules/inversify/lib/annotation/tagged.js"); +exports.tagged = tagged_1.tagged; +var named_1 = __webpack_require__(/*! ./annotation/named */ "./node_modules/inversify/lib/annotation/named.js"); +exports.named = named_1.named; +var inject_1 = __webpack_require__(/*! ./annotation/inject */ "./node_modules/inversify/lib/annotation/inject.js"); +exports.inject = inject_1.inject; +exports.LazyServiceIdentifer = inject_1.LazyServiceIdentifer; +var optional_1 = __webpack_require__(/*! ./annotation/optional */ "./node_modules/inversify/lib/annotation/optional.js"); +exports.optional = optional_1.optional; +var unmanaged_1 = __webpack_require__(/*! ./annotation/unmanaged */ "./node_modules/inversify/lib/annotation/unmanaged.js"); +exports.unmanaged = unmanaged_1.unmanaged; +var multi_inject_1 = __webpack_require__(/*! ./annotation/multi_inject */ "./node_modules/inversify/lib/annotation/multi_inject.js"); +exports.multiInject = multi_inject_1.multiInject; +var target_name_1 = __webpack_require__(/*! ./annotation/target_name */ "./node_modules/inversify/lib/annotation/target_name.js"); +exports.targetName = target_name_1.targetName; +var post_construct_1 = __webpack_require__(/*! ./annotation/post_construct */ "./node_modules/inversify/lib/annotation/post_construct.js"); +exports.postConstruct = post_construct_1.postConstruct; +var metadata_reader_1 = __webpack_require__(/*! ./planning/metadata_reader */ "./node_modules/inversify/lib/planning/metadata_reader.js"); +exports.MetadataReader = metadata_reader_1.MetadataReader; +var id_1 = __webpack_require__(/*! ./utils/id */ "./node_modules/inversify/lib/utils/id.js"); +exports.id = id_1.id; +var decorator_utils_1 = __webpack_require__(/*! ./annotation/decorator_utils */ "./node_modules/inversify/lib/annotation/decorator_utils.js"); +exports.decorate = decorator_utils_1.decorate; +var constraint_helpers_1 = __webpack_require__(/*! ./syntax/constraint_helpers */ "./node_modules/inversify/lib/syntax/constraint_helpers.js"); +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__(/*! ./utils/serialization */ "./node_modules/inversify/lib/utils/serialization.js"); +exports.getServiceIdentifierAsString = serialization_1.getServiceIdentifierAsString; +var binding_utils_1 = __webpack_require__(/*! ./utils/binding_utils */ "./node_modules/inversify/lib/utils/binding_utils.js"); +exports.multiBindToService = binding_utils_1.multiBindToService; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/context.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/planning/context.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var id_1 = __webpack_require__(/*! ../utils/id */ "./node_modules/inversify/lib/utils/id.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/metadata.js": +/*!*********************************************************!*\ + !*** ./node_modules/inversify/lib/planning/metadata.js ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/metadata_reader.js": +/*!****************************************************************!*\ + !*** ./node_modules/inversify/lib/planning/metadata_reader.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var MetadataReader = (function () { + function MetadataReader() { + } + MetadataReader.prototype.getConstructorMetadata = function (constructorFunc) { + var compilerGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.PARAM_TYPES, constructorFunc); + var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED, constructorFunc); + return { + compilerGeneratedMetadata: compilerGeneratedMetadata, + userGeneratedMetadata: userGeneratedMetadata || {} + }; + }; + MetadataReader.prototype.getPropertiesMetadata = function (constructorFunc) { + var userGeneratedMetadata = Reflect.getMetadata(METADATA_KEY.TAGGED_PROP, constructorFunc) || []; + return userGeneratedMetadata; + }; + return MetadataReader; +}()); +exports.MetadataReader = MetadataReader; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/plan.js": +/*!*****************************************************!*\ + !*** ./node_modules/inversify/lib/planning/plan.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/planner.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/planning/planner.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var binding_count_1 = __webpack_require__(/*! ../bindings/binding_count */ "./node_modules/inversify/lib/bindings/binding_count.js"); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var exceptions_1 = __webpack_require__(/*! ../utils/exceptions */ "./node_modules/inversify/lib/utils/exceptions.js"); +var serialization_1 = __webpack_require__(/*! ../utils/serialization */ "./node_modules/inversify/lib/utils/serialization.js"); +var context_1 = __webpack_require__(/*! ./context */ "./node_modules/inversify/lib/planning/context.js"); +var metadata_1 = __webpack_require__(/*! ./metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var plan_1 = __webpack_require__(/*! ./plan */ "./node_modules/inversify/lib/planning/plan.js"); +var reflection_utils_1 = __webpack_require__(/*! ./reflection_utils */ "./node_modules/inversify/lib/planning/reflection_utils.js"); +var request_1 = __webpack_require__(/*! ./request */ "./node_modules/inversify/lib/planning/request.js"); +var target_1 = __webpack_require__(/*! ./target */ "./node_modules/inversify/lib/planning/target.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/queryable_string.js": +/*!*****************************************************************!*\ + !*** ./node_modules/inversify/lib/planning/queryable_string.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/reflection_utils.js": +/*!*****************************************************************!*\ + !*** ./node_modules/inversify/lib/planning/reflection_utils.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var inject_1 = __webpack_require__(/*! ../annotation/inject */ "./node_modules/inversify/lib/annotation/inject.js"); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var serialization_1 = __webpack_require__(/*! ../utils/serialization */ "./node_modules/inversify/lib/utils/serialization.js"); +exports.getFunctionName = serialization_1.getFunctionName; +var target_1 = __webpack_require__(/*! ./target */ "./node_modules/inversify/lib/planning/target.js"); +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] + }; +} + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/request.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/planning/request.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var id_1 = __webpack_require__(/*! ../utils/id */ "./node_modules/inversify/lib/utils/id.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/planning/target.js": +/*!*******************************************************!*\ + !*** ./node_modules/inversify/lib/planning/target.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var id_1 = __webpack_require__(/*! ../utils/id */ "./node_modules/inversify/lib/utils/id.js"); +var metadata_1 = __webpack_require__(/*! ./metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var queryable_string_1 = __webpack_require__(/*! ./queryable_string */ "./node_modules/inversify/lib/planning/queryable_string.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/resolution/instantiation.js": +/*!****************************************************************!*\ + !*** ./node_modules/inversify/lib/resolution/instantiation.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var error_msgs_1 = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/resolution/resolver.js": +/*!***********************************************************!*\ + !*** ./node_modules/inversify/lib/resolution/resolver.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var exceptions_1 = __webpack_require__(/*! ../utils/exceptions */ "./node_modules/inversify/lib/utils/exceptions.js"); +var serialization_1 = __webpack_require__(/*! ../utils/serialization */ "./node_modules/inversify/lib/utils/serialization.js"); +var instantiation_1 = __webpack_require__(/*! ./instantiation */ "./node_modules/inversify/lib/resolution/instantiation.js"); +var invokeFactory = function (factoryType, serviceIdentifier, fn) { + try { + return fn(); + } + catch (error) { + if (exceptions_1.isStackOverflowExeption(error)) { + throw new Error(ERROR_MSGS.CIRCULAR_DEPENDENCY_IN_FACTORY(factoryType, serviceIdentifier.toString())); + } + else { + throw error; + } + } +}; +var _resolveRequest = function (requestScope) { + return function (request) { + request.parentContext.setCurrentRequest(request); + var bindings = request.bindings; + var childRequests = request.childRequests; + var targetIsAnArray = request.target && request.target.isArray(); + var targetParentIsNotAnArray = !request.parentRequest || + !request.parentRequest.target || + !request.target || + !request.parentRequest.target.matchesArray(request.target.serviceIdentifier); + if (targetIsAnArray && targetParentIsNotAnArray) { + return childRequests.map(function (childRequest) { + var _f = _resolveRequest(requestScope); + return _f(childRequest); + }); + } + else { + var result = null; + if (request.target.isOptional() && bindings.length === 0) { + return undefined; + } + var binding_1 = bindings[0]; + var isSingleton = binding_1.scope === literal_types_1.BindingScopeEnum.Singleton; + var isRequestSingleton = binding_1.scope === literal_types_1.BindingScopeEnum.Request; + if (isSingleton && binding_1.activated) { + return binding_1.cache; + } + if (isRequestSingleton && + requestScope !== null && + requestScope.has(binding_1.id)) { + return requestScope.get(binding_1.id); + } + if (binding_1.type === literal_types_1.BindingTypeEnum.ConstantValue) { + result = binding_1.cache; + } + else if (binding_1.type === literal_types_1.BindingTypeEnum.Function) { + result = binding_1.cache; + } + else if (binding_1.type === literal_types_1.BindingTypeEnum.Constructor) { + result = binding_1.implementationType; + } + else if (binding_1.type === literal_types_1.BindingTypeEnum.DynamicValue && binding_1.dynamicValue !== null) { + result = invokeFactory("toDynamicValue", binding_1.serviceIdentifier, function () { return binding_1.dynamicValue(request.parentContext); }); + } + else if (binding_1.type === literal_types_1.BindingTypeEnum.Factory && binding_1.factory !== null) { + result = invokeFactory("toFactory", binding_1.serviceIdentifier, function () { return binding_1.factory(request.parentContext); }); + } + else if (binding_1.type === literal_types_1.BindingTypeEnum.Provider && binding_1.provider !== null) { + result = invokeFactory("toProvider", binding_1.serviceIdentifier, function () { return binding_1.provider(request.parentContext); }); + } + else if (binding_1.type === literal_types_1.BindingTypeEnum.Instance && binding_1.implementationType !== null) { + result = instantiation_1.resolveInstance(binding_1.implementationType, childRequests, _resolveRequest(requestScope)); + } + else { + var serviceIdentifier = serialization_1.getServiceIdentifierAsString(request.serviceIdentifier); + throw new Error(ERROR_MSGS.INVALID_BINDING_TYPE + " " + serviceIdentifier); + } + if (typeof binding_1.onActivation === "function") { + result = binding_1.onActivation(request.parentContext, result); + } + if (isSingleton) { + binding_1.cache = result; + binding_1.activated = true; + } + if (isRequestSingleton && + requestScope !== null && + !requestScope.has(binding_1.id)) { + requestScope.set(binding_1.id, result); + } + return result; + } + }; +}; +function resolve(context) { + var _f = _resolveRequest(context.plan.rootRequest.requestScope); + return _f(context.plan.rootRequest); +} +exports.resolve = resolve; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/binding_in_syntax.js": +/*!****************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/binding_in_syntax.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var binding_when_on_syntax_1 = __webpack_require__(/*! ./binding_when_on_syntax */ "./node_modules/inversify/lib/syntax/binding_when_on_syntax.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/binding_in_when_on_syntax.js": +/*!************************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/binding_in_when_on_syntax.js ***! + \************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var binding_in_syntax_1 = __webpack_require__(/*! ./binding_in_syntax */ "./node_modules/inversify/lib/syntax/binding_in_syntax.js"); +var binding_on_syntax_1 = __webpack_require__(/*! ./binding_on_syntax */ "./node_modules/inversify/lib/syntax/binding_on_syntax.js"); +var binding_when_syntax_1 = __webpack_require__(/*! ./binding_when_syntax */ "./node_modules/inversify/lib/syntax/binding_when_syntax.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/binding_on_syntax.js": +/*!****************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/binding_on_syntax.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var binding_when_syntax_1 = __webpack_require__(/*! ./binding_when_syntax */ "./node_modules/inversify/lib/syntax/binding_when_syntax.js"); +var BindingOnSyntax = (function () { + function BindingOnSyntax(binding) { + this._binding = binding; + } + BindingOnSyntax.prototype.onActivation = function (handler) { + this._binding.onActivation = handler; + return new binding_when_syntax_1.BindingWhenSyntax(this._binding); + }; + return BindingOnSyntax; +}()); +exports.BindingOnSyntax = BindingOnSyntax; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/binding_to_syntax.js": +/*!****************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/binding_to_syntax.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +var literal_types_1 = __webpack_require__(/*! ../constants/literal_types */ "./node_modules/inversify/lib/constants/literal_types.js"); +var binding_in_when_on_syntax_1 = __webpack_require__(/*! ./binding_in_when_on_syntax */ "./node_modules/inversify/lib/syntax/binding_in_when_on_syntax.js"); +var binding_when_on_syntax_1 = __webpack_require__(/*! ./binding_when_on_syntax */ "./node_modules/inversify/lib/syntax/binding_when_on_syntax.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/binding_when_on_syntax.js": +/*!*********************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/binding_when_on_syntax.js ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var binding_on_syntax_1 = __webpack_require__(/*! ./binding_on_syntax */ "./node_modules/inversify/lib/syntax/binding_on_syntax.js"); +var binding_when_syntax_1 = __webpack_require__(/*! ./binding_when_syntax */ "./node_modules/inversify/lib/syntax/binding_when_syntax.js"); +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; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/binding_when_syntax.js": +/*!******************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/binding_when_syntax.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var binding_on_syntax_1 = __webpack_require__(/*! ./binding_on_syntax */ "./node_modules/inversify/lib/syntax/binding_on_syntax.js"); +var constraint_helpers_1 = __webpack_require__(/*! ./constraint_helpers */ "./node_modules/inversify/lib/syntax/constraint_helpers.js"); +var BindingWhenSyntax = (function () { + function BindingWhenSyntax(binding) { + this._binding = binding; + } + BindingWhenSyntax.prototype.when = function (constraint) { + this._binding.constraint = constraint; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenTargetNamed = function (name) { + this._binding.constraint = constraint_helpers_1.namedConstraint(name); + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenTargetIsDefault = function () { + this._binding.constraint = function (request) { + var targetIsDefault = (request.target !== null) && + (!request.target.isNamed()) && + (!request.target.isTagged()); + return targetIsDefault; + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenTargetTagged = function (tag, value) { + this._binding.constraint = constraint_helpers_1.taggedConstraint(tag)(value); + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenInjectedInto = function (parent) { + this._binding.constraint = function (request) { + return constraint_helpers_1.typeConstraint(parent)(request.parentRequest); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenParentNamed = function (name) { + this._binding.constraint = function (request) { + return constraint_helpers_1.namedConstraint(name)(request.parentRequest); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenParentTagged = function (tag, value) { + this._binding.constraint = function (request) { + return constraint_helpers_1.taggedConstraint(tag)(value)(request.parentRequest); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenAnyAncestorIs = function (ancestor) { + this._binding.constraint = function (request) { + return constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.typeConstraint(ancestor)); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenNoAncestorIs = function (ancestor) { + this._binding.constraint = function (request) { + return !constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.typeConstraint(ancestor)); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenAnyAncestorNamed = function (name) { + this._binding.constraint = function (request) { + return constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.namedConstraint(name)); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenNoAncestorNamed = function (name) { + this._binding.constraint = function (request) { + return !constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.namedConstraint(name)); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenAnyAncestorTagged = function (tag, value) { + this._binding.constraint = function (request) { + return constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.taggedConstraint(tag)(value)); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenNoAncestorTagged = function (tag, value) { + this._binding.constraint = function (request) { + return !constraint_helpers_1.traverseAncerstors(request, constraint_helpers_1.taggedConstraint(tag)(value)); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenAnyAncestorMatches = function (constraint) { + this._binding.constraint = function (request) { + return constraint_helpers_1.traverseAncerstors(request, constraint); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + BindingWhenSyntax.prototype.whenNoAncestorMatches = function (constraint) { + this._binding.constraint = function (request) { + return !constraint_helpers_1.traverseAncerstors(request, constraint); + }; + return new binding_on_syntax_1.BindingOnSyntax(this._binding); + }; + return BindingWhenSyntax; +}()); +exports.BindingWhenSyntax = BindingWhenSyntax; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/syntax/constraint_helpers.js": +/*!*****************************************************************!*\ + !*** ./node_modules/inversify/lib/syntax/constraint_helpers.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var METADATA_KEY = __webpack_require__(/*! ../constants/metadata_keys */ "./node_modules/inversify/lib/constants/metadata_keys.js"); +var metadata_1 = __webpack_require__(/*! ../planning/metadata */ "./node_modules/inversify/lib/planning/metadata.js"); +var traverseAncerstors = function (request, constraint) { + var parent = request.parentRequest; + if (parent !== null) { + return constraint(parent) ? true : traverseAncerstors(parent, constraint); + } + else { + return false; + } +}; +exports.traverseAncerstors = traverseAncerstors; +var taggedConstraint = function (key) { return function (value) { + var constraint = function (request) { + return request !== null && request.target !== null && request.target.matchesTag(key)(value); + }; + constraint.metaData = new metadata_1.Metadata(key, value); + return constraint; +}; }; +exports.taggedConstraint = taggedConstraint; +var namedConstraint = taggedConstraint(METADATA_KEY.NAMED_TAG); +exports.namedConstraint = namedConstraint; +var typeConstraint = function (type) { return function (request) { + var binding = null; + if (request !== null) { + binding = request.bindings[0]; + if (typeof type === "string") { + var serviceIdentifier = binding.serviceIdentifier; + return serviceIdentifier === type; + } + else { + var constructor = request.bindings[0].implementationType; + return type === constructor; + } + } + return false; +}; }; +exports.typeConstraint = typeConstraint; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/utils/binding_utils.js": +/*!***********************************************************!*\ + !*** ./node_modules/inversify/lib/utils/binding_utils.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"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); }); + }; + }; +}; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/utils/exceptions.js": +/*!********************************************************!*\ + !*** ./node_modules/inversify/lib/utils/exceptions.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +function isStackOverflowExeption(error) { + return (error instanceof RangeError || + error.message === ERROR_MSGS.STACK_OVERFLOW); +} +exports.isStackOverflowExeption = isStackOverflowExeption; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/utils/id.js": +/*!************************************************!*\ + !*** ./node_modules/inversify/lib/utils/id.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var idCounter = 0; +function id() { + return idCounter++; +} +exports.id = id; + + +/***/ }), + +/***/ "./node_modules/inversify/lib/utils/serialization.js": +/*!***********************************************************!*\ + !*** ./node_modules/inversify/lib/utils/serialization.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var ERROR_MSGS = __webpack_require__(/*! ../constants/error_msgs */ "./node_modules/inversify/lib/constants/error_msgs.js"); +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; + + +/***/ }), + +/***/ "./node_modules/minimatch/minimatch.js": +/*!*********************************************!*\ + !*** ./node_modules/minimatch/minimatch.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = __webpack_require__(/*! path */ "path") +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __webpack_require__(/*! brace-expansion */ "./node_modules/brace-expansion/index.js") + +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, '\\$&') +} + + +/***/ }), + +/***/ "./node_modules/q/q.js": +/*!*****************************!*\ + !*** ./node_modules/q/q.js ***! + \*****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// 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