diff --git a/dist/azure/execute/icon.png b/dist/azure/execute/icon.png new file mode 100644 index 0000000..e9efbda Binary files /dev/null and b/dist/azure/execute/icon.png differ diff --git a/dist/azure/execute/task.json b/dist/azure/execute/task.json new file mode 100644 index 0000000..239a0a2 --- /dev/null +++ b/dist/azure/execute/task.json @@ -0,0 +1,106 @@ +{ + "id": "dd065e3b-6aef-46af-845c-520195836b35", + "name": "UseGitVersion", + "friendlyName": "GitVersion Task$titleSuffix$", + "description": "Easy Semantic Versioning (http://semver.org) for projects using Git", + "author": "GitVersion Contributors", + "helpMarkDown": "See the [documentation](http://gitversion.readthedocs.org/en/latest/) for help", + "category": "Build", + "demands": [], + "version": { + "Major": "5", + "Minor": "0", + "Patch": "2" + }, + "minimumAgentVersion": "2.115.0", + "groups": [ + { + "name": "gitversionDetails", + "displayName": "GitVersion details", + "isExpanded": true + }, + { + "name": "additional", + "displayName": "Additional Options", + "isExpanded": false + } + ], + "instanceNameFormat": "GitVersion", + "inputs": [ + { + "name": "versionSpec", + "type": "string", + "label": "The version spec", + "defaultValue": "", + "required": true, + "helpMarkDown": "Required version in the form of 5.x or exact version like 5.0.0" + }, + { + "name": "includePrerelease", + "type": "boolean", + "label": "Include pre-release versions", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Include pre-release versions when matching a version" + }, + { + "name": "targetPath", + "type": "string", + "label": "Working directory path", + "defaultValue": "", + "required": false, + "helpMarkDown": "Optionally supply the path to the working directory", + "groupName": "gitversionDetails" + }, + { + "name": "useConfigFile", + "type": "boolean", + "label": "Specify Configuration file", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Whether to use a custom configuration file" + }, + { + "name": "configFilePath", + "type": "filePath", + "label": "Configuration file", + "defaultValue": "", + "required": false, + "helpMarkDown": "Optional path to config file (defaults to GitVersion.yml)", + "visibleRule": "useConfigFile = true" + }, + { + "name": "updateAssemblyInfo", + "type": "boolean", + "label": "Update AssemblyInfo files", + "defaultValue": "false", + "required": false, + "helpMarkDown": "Whether to update versions in the AssemblyInfo files" + }, + { + "name": "updateAssemblyInfoFilename", + "type": "string", + "label": "Update Assembly File", + "defaultValue": "", + "required": false, + "helpMarkDown": "Update versions in specified file", + "visibleRule": "updateAssemblyInfo = true" + }, + { + "name": "additionalArguments", + "type": "string", + "label": "Additional GitVersion arguments", + "defaultValue": "", + "required": false, + "helpMarkDown": "Additional arguments to send to GitVersion", + "groupName": "additional" + } + ], + "execution": { + "Node": { + "target": "GitVersion.js", + "argumentFormat": "", + "workingDirectory": "." + } + } +} diff --git a/dist/azure/images/build-task.png b/dist/azure/images/build-task.png new file mode 100644 index 0000000..6431fb1 Binary files /dev/null and b/dist/azure/images/build-task.png differ diff --git a/dist/azure/images/builds.png b/dist/azure/images/builds.png new file mode 100644 index 0000000..0e03728 Binary files /dev/null and b/dist/azure/images/builds.png differ diff --git a/dist/azure/images/extension-icon.png b/dist/azure/images/extension-icon.png new file mode 100644 index 0000000..e9efbda Binary files /dev/null and b/dist/azure/images/extension-icon.png differ diff --git a/dist/azure/index.js b/dist/azure/index.js deleted file mode 100644 index d4b31b2..0000000 --- a/dist/azure/index.js +++ /dev/null @@ -1,16558 +0,0 @@ -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ __webpack_require__.ab = __dirname + "/"; -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(776); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 2: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERROR_MSGS = __webpack_require__(516); -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; - - -/***/ }), - -/***/ 9: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var error_msgs_1 = __webpack_require__(516); -var literal_types_1 = __webpack_require__(186); -var METADATA_KEY = __webpack_require__(677); -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; - - -/***/ }), - -/***/ 15: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [0, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var binding_1 = __webpack_require__(119); -var ERROR_MSGS = __webpack_require__(516); -var literal_types_1 = __webpack_require__(186); -var METADATA_KEY = __webpack_require__(677); -var metadata_reader_1 = __webpack_require__(202); -var planner_1 = __webpack_require__(787); -var resolver_1 = __webpack_require__(502); -var binding_to_syntax_1 = __webpack_require__(538); -var id_1 = __webpack_require__(786); -var serialization_1 = __webpack_require__(571); -var container_snapshot_1 = __webpack_require__(649); -var lookup_1 = __webpack_require__(2); -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; - - -/***/ }), - -/***/ 16: -/***/ (function(module) { - -module.exports = require("tls"); - -/***/ }), - -/***/ 20: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var binding_when_syntax_1 = __webpack_require__(653); -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; - - -/***/ }), - -/***/ 36: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var fs = __webpack_require__(747); -var common = __webpack_require__(164); -var _ls = __webpack_require__(951); - -//@ -//@ ### find(path [,path ...]) -//@ ### find(path_array) -//@ Examples: -//@ -//@ ```javascript -//@ find('src', 'lib'); -//@ find(['src', 'lib']); // same as above -//@ find('.').filter(function(file) { return file.match(/\.js$/); }); -//@ ``` -//@ -//@ Returns array of all files (however deep) in the given paths. -//@ -//@ The main difference from `ls('-R', path)` is that the resulting file names -//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`. -function _find(options, paths) { - if (!paths) - common.error('no path specified'); - else if (typeof paths === 'object') - paths = paths; // assume array - else if (typeof paths === 'string') - paths = [].slice.call(arguments, 1); - - var list = []; - - function pushFile(file) { - if (common.platform === 'win') - file = file.replace(/\\/g, '/'); - list.push(file); - } - - // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs - // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory - - paths.forEach(function(file) { - pushFile(file); - - if (fs.statSync(file).isDirectory()) { - _ls('-RA', file+'/*').forEach(function(subfile) { - pushFile(subfile); - }); - } - }); - - return list; -} -module.exports = _find; - - -/***/ }), - -/***/ 87: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var id_1 = __webpack_require__(786); -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; - - -/***/ }), - -/***/ 94: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); -var fs = __webpack_require__(747); - -// Recursively removes 'dir' -// Adapted from https://github.com/ryanmcgrath/wrench-js -// -// Copyright (c) 2010 Ryan McGrath -// Copyright (c) 2012 Artur Adib -// -// Licensed under the MIT License -// http://www.opensource.org/licenses/mit-license.php -function rmdirSyncRecursive(dir, force) { - var files; - - files = fs.readdirSync(dir); - - // Loop through and delete everything in the sub-tree after checking it - for(var i = 0; i < files.length; i++) { - var file = dir + "/" + files[i], - currFile = fs.lstatSync(file); - - if(currFile.isDirectory()) { // Recursive function back to the beginning - rmdirSyncRecursive(file, force); - } - - else if(currFile.isSymbolicLink()) { // Unlink symlinks - if (force || isWriteable(file)) { - try { - common.unlinkSync(file); - } catch (e) { - common.error('could not remove file (code '+e.code+'): ' + file, true); - } - } - } - - else // Assume it's a file - perhaps a try/catch belongs here? - if (force || isWriteable(file)) { - try { - common.unlinkSync(file); - } catch (e) { - common.error('could not remove file (code '+e.code+'): ' + file, true); - } - } - } - - // Now that we know everything in the sub-tree has been deleted, we can delete the main directory. - // Huzzah for the shopkeep. - - var result; - try { - result = fs.rmdirSync(dir); - } catch(e) { - common.error('could not remove directory (code '+e.code+'): ' + dir, true); - } - - return result; -} // rmdirSyncRecursive - -// Hack to determine if file has write permissions for current user -// Avoids having to check user, group, etc, but it's probably slow -function isWriteable(file) { - var writePermission = true; - try { - var __fd = fs.openSync(file, 'a'); - fs.closeSync(__fd); - } catch(e) { - writePermission = false; - } - - return writePermission; -} - -//@ -//@ ### rm([options ,] file [, file ...]) -//@ ### rm([options ,] file_array) -//@ Available options: -//@ -//@ + `-f`: force -//@ + `-r, -R`: recursive -//@ -//@ Examples: -//@ -//@ ```javascript -//@ rm('-rf', '/tmp/*'); -//@ rm('some_file.txt', 'another_file.txt'); -//@ rm(['some_file.txt', 'another_file.txt']); // same as above -//@ ``` -//@ -//@ Removes files. The wildcard `*` is accepted. -function _rm(options, files) { - options = common.parseOptions(options, { - 'f': 'force', - 'r': 'recursive', - 'R': 'recursive' - }); - if (!files) - common.error('no paths given'); - - if (typeof files === 'string') - files = [].slice.call(arguments, 1); - // if it's array leave it as it is - - files = common.expand(files); - - files.forEach(function(file) { - if (!fs.existsSync(file)) { - // Path does not exist, no force flag given - if (!options.force) - common.error('no such file or directory: '+file, true); - - return; // skip file - } - - // If here, path exists - - var stats = fs.lstatSync(file); - if (stats.isFile() || stats.isSymbolicLink()) { - - // Do not check for file writing permissions - if (options.force) { - common.unlinkSync(file); - return; - } - - if (isWriteable(file)) - common.unlinkSync(file); - else - common.error('permission denied: '+file, true); - - return; - } // simple file - - // Path is an existing directory, but no -r flag given - if (stats.isDirectory() && !options.recursive) { - common.error('path is a directory', true); - return; // skip path - } - - // Recursively remove existing directory - if (stats.isDirectory() && options.recursive) { - rmdirSyncRecursive(file, options.force); - } - }); // forEach(file) -} // rm -module.exports = _rm; - - -/***/ }), - -/***/ 95: -/***/ (function(module, __unusedexports, __webpack_require__) { - -// Unique ID creation requires a high quality random # generator. In node.js -// this is pretty straight-forward - we use the crypto API. - -var crypto = __webpack_require__(417); - -module.exports = function nodeRNG() { - return crypto.randomBytes(16); -}; - - -/***/ }), - -/***/ 105: -/***/ (function(module, exports) { - -exports = module.exports = SemVer - -var debug -/* istanbul ignore next */ -if (typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0) - args.unshift('SEMVER') - console.log.apply(console, args) - } -} else { - debug = function () {} -} - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0' - -var MAX_LENGTH = 256 -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16 - -// The actual regexps go on exports.re -var re = exports.re = [] -var src = exports.src = [] -var R = 0 - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -var NUMERICIDENTIFIER = R++ -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' -var NUMERICIDENTIFIERLOOSE = R++ -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -var NONNUMERICIDENTIFIER = R++ -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' - -// ## Main Version -// Three dot-separated numeric identifiers. - -var MAINVERSION = R++ -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')' - -var MAINVERSIONLOOSE = R++ -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')' - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -var PRERELEASEIDENTIFIER = R++ -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')' - -var PRERELEASEIDENTIFIERLOOSE = R++ -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')' - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -var PRERELEASE = R++ -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' - -var PRERELEASELOOSE = R++ -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -var BUILDIDENTIFIER = R++ -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -var BUILD = R++ -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -var FULL = R++ -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?' - -src[FULL] = '^' + FULLPLAIN + '$' - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?' - -var LOOSE = R++ -src[LOOSE] = '^' + LOOSEPLAIN + '$' - -var GTLT = R++ -src[GTLT] = '((?:<|>)?=?)' - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++ -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' -var XRANGEIDENTIFIER = R++ -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' - -var XRANGEPLAIN = R++ -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?' - -var XRANGEPLAINLOOSE = R++ -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?' - -var XRANGE = R++ -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' -var XRANGELOOSE = R++ -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++ -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])' - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++ -src[LONETILDE] = '(?:~>?)' - -var TILDETRIM = R++ -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') -var tildeTrimReplace = '$1~' - -var TILDE = R++ -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' -var TILDELOOSE = R++ -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++ -src[LONECARET] = '(?:\\^)' - -var CARETTRIM = R++ -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') -var caretTrimReplace = '$1^' - -var CARET = R++ -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' -var CARETLOOSE = R++ -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++ -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' -var COMPARATOR = R++ -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++ -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' - -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') -var comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++ -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$' - -var HYPHENRANGELOOSE = R++ -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$' - -// Star ranges basically just allow anything at all. -var STAR = R++ -src[STAR] = '(<|>)?=?\\s*\\*' - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]) - if (!re[i]) { - re[i] = new RegExp(src[i]) - } -} - -exports.parse = parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - var r = options.loose ? re[LOOSE] : re[FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -exports.valid = valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} - -exports.clean = clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -exports.SemVer = SemVer - -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - - var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) - - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() -} - -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.') - } - return this.version -} - -SemVer.prototype.toString = function () { - return this.version -} - -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return this.compareMain(other) || this.comparePre(other) -} - -SemVer.prototype.compareMain = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) -} - -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - var i = 0 - do { - var a = this.prerelease[i] - var b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - var i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break - - default: - throw new Error('invalid increment argument: ' + release) - } - this.format() - this.raw = this.version - return this -} - -exports.inc = inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } - - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} - -exports.diff = diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} - -exports.compareIdentifiers = compareIdentifiers - -var numeric = /^[0-9]+$/ -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -exports.rcompareIdentifiers = rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} - -exports.major = major -function major (a, loose) { - return new SemVer(a, loose).major -} - -exports.minor = minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} - -exports.patch = patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} - -exports.compare = compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} - -exports.compareLoose = compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} - -exports.rcompare = rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} - -exports.sort = sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compare(a, b, loose) - }) -} - -exports.rsort = rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.rcompare(a, b, loose) - }) -} - -exports.gt = gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} - -exports.lt = lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} - -exports.eq = eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} - -exports.neq = neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} - -exports.gte = gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} - -exports.lte = lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} - -exports.cmp = cmp -function cmp (a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b - - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError('Invalid operator: ' + op) - } -} - -exports.Comparator = Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } - - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) -} - -var ANY = {} -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var m = comp.match(r) - - if (!m) { - throw new TypeError('Invalid comparator: ' + comp) - } - - this.operator = m[1] - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } -} - -Comparator.prototype.toString = function () { - return this.value -} - -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY) { - return true - } - - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } - - return cmp(version, this.operator, this.semver, this.options) -} - -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - var rangeTmp - - if (this.operator === '') { - rangeTmp = new Range(comp.value, options) - return satisfies(this.value, rangeTmp, options) - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, options) - return satisfies(comp.semver, rangeTmp, options) - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - var sameSemVer = this.semver.version === comp.semver.version - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')) - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')) - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan -} - -exports.Range = Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - return new Range(range.value, options) - } - - if (!(this instanceof Range)) { - return new Range(range, options) - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First, split based on boolean or || - this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) - } - - this.format() -} - -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim() - }).join('||').trim() - return this.range -} - -Range.prototype.toString = function () { - return this.range -} - -Range.prototype.parseRange = function (range) { - var loose = this.options.loose - range = range.trim() - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] - range = range.replace(hr, hyphenReplace) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options) - }, this).join(' ').split(/\s+/) - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe) - }) - } - set = set.map(function (comp) { - return new Comparator(comp, this.options) - }, this) - - return set -} - -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some(function (thisComparators) { - return thisComparators.every(function (thisComparator) { - return range.set.some(function (rangeComparators) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options) - }) - }) - }) - }) -} - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator (comp, options) { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -function isX (id) { - return !id || id.toLowerCase() === 'x' || id === '*' -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options) - }).join(' ') -} - -function replaceTilde (comp, options) { - var r = options.loose ? re[TILDELOOSE] : re[TILDE] - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else if (pr) { - debug('replaceTilde pr', pr) - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options) - }).join(' ') -} - -function replaceCaret (comp, options) { - debug('caret', comp, options) - var r = options.loose ? re[CARETLOOSE] : re[CARET] - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + (+M + 1) + '.0.0' - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0' - } - } - - debug('caret return', ret) - return ret - }) -} - -function replaceXRanges (comp, options) { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options) - }).join(' ') -} - -function replaceXRange (comp, options) { - comp = comp.trim() - var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - var xM = isX(M) - var xm = xM || isX(m) - var xp = xm || isX(p) - var anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - ret = gtlt + M + '.' + m + '.' + p - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars (comp, options) { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], '') -} - -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = '>=' + fM + '.0.0' - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0' - } else { - from = '>=' + from - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0' - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0' - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr - } else { - to = '<=' + to - } - - return (from + ' ' + to).trim() -} - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - version = new SemVer(version, this.options) - } - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false -} - -function testSet (set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - -exports.satisfies = satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} - -exports.maxSatisfying = maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} - -exports.minSatisfying = minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} - -exports.minVersion = minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - - var minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} - -exports.validRange = validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} - -exports.outside = outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) - - var gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - var high = null - var low = null - - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -exports.prerelease = prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} - -exports.intersects = intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -exports.coerce = coerce -function coerce (version) { - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - var match = version.match(re[COERCE]) - - if (match == null) { - return null - } - - return parse(match[1] + - '.' + (match[2] || '0') + - '.' + (match[3] || '0')) -} - - -/***/ }), - -/***/ 119: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var literal_types_1 = __webpack_require__(186); -var id_1 = __webpack_require__(786); -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; - - -/***/ }), - -/***/ 124: -/***/ (function(module, __unusedexports, __webpack_require__) { - -module.exports = minimatch -minimatch.Minimatch = Minimatch - -var path = { sep: '/' } -try { - path = __webpack_require__(622) -} catch (er) {} - -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(792) - -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, '\\$&') -} - - -/***/ }), - -/***/ 129: -/***/ (function(module) { - -module.exports = require("child_process"); - -/***/ }), - -/***/ 131: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); -var fs = __webpack_require__(747); -var path = __webpack_require__(622); - -//@ -//@ ### 'string'.toEnd(file) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ cat('input.txt').toEnd('output.txt'); -//@ ``` -//@ -//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as -//@ those returned by `cat`, `grep`, etc). -function _toEnd(options, file) { - if (!file) - common.error('wrong arguments'); - - if (!fs.existsSync( path.dirname(file) )) - common.error('no such file or directory: ' + path.dirname(file)); - - try { - fs.appendFileSync(file, this.toString(), 'utf8'); - } catch(e) { - common.error('could not append to file (code '+e.code+'): '+file, true); - } -} -module.exports = _toEnd; - - -/***/ }), - -/***/ 148: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var metadata_1 = __webpack_require__(173); -var decorator_utils_1 = __webpack_require__(289); -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; - - -/***/ }), - -/***/ 156: -/***/ (function(module) { - -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]'; -}; - - -/***/ }), - -/***/ 164: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -var os = __webpack_require__(365); -var fs = __webpack_require__(747); -var _ls = __webpack_require__(951); - -// Module globals -var config = { - silent: false, - fatal: false -}; -exports.config = config; - -var state = { - error: null, - currentCmd: 'shell.js', - tempDir: null -}; -exports.state = state; - -var platform = os.type().match(/^Win/) ? 'win' : 'unix'; -exports.platform = platform; - -function log() { - if (!config.silent) - console.log.apply(this, arguments); -} -exports.log = log; - -// Shows error message. Throws unless _continue or config.fatal are true -function error(msg, _continue) { - if (state.error === null) - state.error = ''; - state.error += state.currentCmd + ': ' + msg + '\n'; - - if (msg.length > 0) - log(state.error); - - if (config.fatal) - process.exit(1); - - if (!_continue) - throw ''; -} -exports.error = error; - -// In the future, when Proxies are default, we can add methods like `.to()` to primitive strings. -// For now, this is a dummy function to bookmark places we need such strings -function ShellString(str) { - return str; -} -exports.ShellString = ShellString; - -// Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.: -// parseOptions('-a', {'a':'alice', 'b':'bob'}); -function parseOptions(str, map) { - if (!map) - error('parseOptions() internal error: no map given'); - - // All options are false by default - var options = {}; - for (var letter in map) - options[map[letter]] = false; - - if (!str) - return options; // defaults - - if (typeof str !== 'string') - error('parseOptions() internal error: wrong str'); - - // e.g. match[1] = 'Rf' for str = '-Rf' - var match = str.match(/^\-(.+)/); - if (!match) - return options; - - // e.g. chars = ['R', 'f'] - var chars = match[1].split(''); - - chars.forEach(function(c) { - if (c in map) - options[map[c]] = true; - else - error('option not recognized: '+c); - }); - - return options; -} -exports.parseOptions = parseOptions; - -// Expands wildcards with matching (ie. existing) file names. -// For example: -// expand(['file*.js']) = ['file1.js', 'file2.js', ...] -// (if the files 'file1.js', 'file2.js', etc, exist in the current dir) -function expand(list) { - var expanded = []; - list.forEach(function(listEl) { - // Wildcard present on directory names ? - if(listEl.search(/\*[^\/]*\//) > -1 || listEl.search(/\*\*[^\/]*\//) > -1) { - var match = listEl.match(/^([^*]+\/|)(.*)/); - var root = match[1]; - var rest = match[2]; - var restRegex = rest.replace(/\*\*/g, ".*").replace(/\*/g, "[^\\/]*"); - restRegex = new RegExp(restRegex); - - _ls('-R', root).filter(function (e) { - return restRegex.test(e); - }).forEach(function(file) { - expanded.push(file); - }); - } - // Wildcard present on file names ? - else if (listEl.search(/\*/) > -1) { - _ls('', listEl).forEach(function(file) { - expanded.push(file); - }); - } else { - expanded.push(listEl); - } - }); - return expanded; -} -exports.expand = expand; - -// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e. -// file can be unlinked even if it's read-only, see https://github.com/joyent/node/issues/3006 -function unlinkSync(file) { - try { - fs.unlinkSync(file); - } catch(e) { - // Try to override file permission - if (e.code === 'EPERM') { - fs.chmodSync(file, '0666'); - fs.unlinkSync(file); - } else { - throw e; - } - } -} -exports.unlinkSync = unlinkSync; - -// e.g. 'shelljs_a5f185d0443ca...' -function randomFileName() { - function randomHash(count) { - if (count === 1) - return parseInt(16*Math.random(), 10).toString(16); - else { - var hash = ''; - for (var i=0; i 0 && options.charAt(0) === '-') { - // Special case where the specified file permissions started with - to subtract perms, which - // get picked up by the option parser as command flags. - // If we are down by one argument and options starts with -, shift everything over. - filePattern = mode; - mode = options; - options = ''; - } - else { - common.error('You must specify a file.'); - } - } - - options = common.parseOptions(options, { - 'R': 'recursive', - 'c': 'changes', - 'v': 'verbose' - }); - - if (typeof filePattern === 'string') { - filePattern = [ filePattern ]; - } - - var files; - - if (options.recursive) { - files = []; - common.expand(filePattern).forEach(function addFile(expandedFile) { - var stat = fs.lstatSync(expandedFile); - - if (!stat.isSymbolicLink()) { - files.push(expandedFile); - - if (stat.isDirectory()) { // intentionally does not follow symlinks. - fs.readdirSync(expandedFile).forEach(function (child) { - addFile(expandedFile + '/' + child); - }); - } - } - }); - } - else { - files = common.expand(filePattern); - } - - files.forEach(function innerChmod(file) { - file = path.resolve(file); - if (!fs.existsSync(file)) { - common.error('File not found: ' + file); - } - - // When recursing, don't follow symlinks. - if (options.recursive && fs.lstatSync(file).isSymbolicLink()) { - return; - } - - var perms = fs.statSync(file).mode; - var type = perms & PERMS.TYPE_MASK; - - var newPerms = perms; - - if (isNaN(parseInt(mode, 8))) { - // parse options - mode.split(',').forEach(function (symbolicMode) { - /*jshint regexdash:true */ - var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i; - var matches = pattern.exec(symbolicMode); - - if (matches) { - var applyTo = matches[1]; - var operator = matches[2]; - var change = matches[3]; - - var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === ''; - var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === ''; - var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === ''; - - var changeRead = change.indexOf('r') != -1; - var changeWrite = change.indexOf('w') != -1; - var changeExec = change.indexOf('x') != -1; - var changeSticky = change.indexOf('t') != -1; - var changeSetuid = change.indexOf('s') != -1; - - var mask = 0; - if (changeOwner) { - mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0); - } - if (changeGroup) { - mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0); - } - if (changeOther) { - mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0); - } - - // Sticky bit is special - it's not tied to user, group or other. - if (changeSticky) { - mask |= PERMS.STICKY; - } - - switch (operator) { - case '+': - newPerms |= mask; - break; - - case '-': - newPerms &= ~mask; - break; - - case '=': - newPerms = type + mask; - - // According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared. - if (fs.statSync(file).isDirectory()) { - newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; - } - break; - } - - if (options.verbose) { - log(file + ' -> ' + newPerms.toString(8)); - } - - if (perms != newPerms) { - if (!options.verbose && options.changes) { - log(file + ' -> ' + newPerms.toString(8)); - } - fs.chmodSync(file, newPerms); - } - } - else { - common.error('Invalid symbolic mode change: ' + symbolicMode); - } - }); - } - else { - // they gave us a full number - newPerms = type + parseInt(mode, 8); - - // POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared. - if (fs.statSync(file).isDirectory()) { - newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; - } - - fs.chmodSync(file, newPerms); - } - }); -} -module.exports = _chmod; - - -/***/ }), - -/***/ 173: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var METADATA_KEY = __webpack_require__(677); -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; - - -/***/ }), - -/***/ 175: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; -var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(747); -const os = __webpack_require__(365); -const path = __webpack_require__(622); -const semver = __webpack_require__(105); -const http = __webpack_require__(549); -const inversify_1 = __webpack_require__(386); -const types_1 = __webpack_require__(834); -let DotnetTool = class DotnetTool { - constructor(buildAgent, versionManager) { - this.buildAgent = buildAgent; - this.versionManager = versionManager; - this.httpClient = new http.HttpClient("dotnet"); - } - run(args) { - return this.buildAgent.exec("dotnet", args); - } - toolInstall(toolName, versionSpec, checkLatest, includePre) { - return __awaiter(this, void 0, void 0, function* () { - console.log(""); - console.log("--------------------------"); - console.log(`Installing ${toolName} version ` + versionSpec); - console.log("--------------------------"); - if (this.versionManager.isExplicitVersion(versionSpec)) { - checkLatest = false; // check latest doesn't make sense when explicit version - } - let toolPath; - if (!checkLatest) { - // - // Let's try and resolve the version spec locally first - // - toolPath = this.buildAgent.find(toolName, versionSpec); - } - if (!toolPath) { - let version; - if (this.versionManager.isExplicitVersion(versionSpec)) { - // - // Explicit version was specified. No need to query for list of versions. - // - version = versionSpec; - } - else { - // - // Let's query and resolve the latest version for the versionSpec. - // If the version is an explicit version (1.1.1 or v1.1.1) then no need to query. - // If your tool doesn't offer a mechanism to query, - // then it can only support exact version inputs. - // - version = yield this.queryLatestMatch(toolName, versionSpec, includePre); - if (!version) { - throw new Error(`Unable to find ${toolName} version '${versionSpec}'.`); - } - // - // Check the cache for the resolved version. - // - toolPath = this.buildAgent.find(toolName, version); - } - if (!toolPath) { - // - // Download, extract, cache - // - toolPath = yield this.acquireTool(toolName, version); - } - } - // - // Prepend the tools path. This prepends the PATH for the current process and - // instructs the agent to prepend for each task that follows. - // - this.buildAgent.debug(`toolPath: ${toolPath}`); - if (os.platform() !== "win32") { - const dotnetRoot = path.dirname(fs.readlinkSync(yield this.buildAgent.which("dotnet"))); - this.buildAgent.exportVariable("DOTNET_ROOT", dotnetRoot); - } - this.buildAgent.addPath(toolPath); - return toolPath; - }); - } - queryLatestMatch(toolName, versionSpec, includePrerelease) { - return __awaiter(this, void 0, void 0, function* () { - this.buildAgent.debug(`querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ""} ${includePrerelease ? "including pre-releases" : ""}`); - const downloadPath = `https://api-v2v3search-0.nuget.org/query?q=${encodeURIComponent(toolName.toLowerCase())}&prerelease=${includePrerelease ? "true" : "false"}&semVerLevel=2.0.0`; - const res = yield this.httpClient.get(downloadPath); - if (!res || res.message.statusCode !== 200) { - return null; - } - const body = yield res.readBody(); - const data = JSON.parse(body).data; - const versions = data[0].versions.map((x) => x.version); - if (!versions || !versions.length) { - return null; - } - this.buildAgent.debug(`got versions: ${versions.join(", ")}`); - return this.versionManager.evaluateVersions(versions, versionSpec); - }); - } - acquireTool(toolName, version) { - return __awaiter(this, void 0, void 0, function* () { - const tempDirectory = yield this.buildAgent.createTempDir(); - let args = ["tool", "install", toolName, "--tool-path", tempDirectory]; - if (version) { - version = this.versionManager.cleanVersion(version); - args = args.concat(["--version", version]); - } - const result = yield this.run(args); - const status = result.code === 0 ? "success" : "failure"; - const message = result.code === 0 ? result.stdout : result.stderr; - this.buildAgent.debug(`tool install result: ${status} ${message}`); - if (result.code) { - throw new Error("Error installing tool"); - } - return yield this.buildAgent.cacheDir(tempDirectory, toolName, version); - }); - } -}; -DotnetTool = __decorate([ - inversify_1.injectable(), - __param(0, inversify_1.inject(types_1.TYPES.IBuildAgent)), - __param(1, inversify_1.inject(types_1.TYPES.IVersionManager)), - __metadata("design:paramtypes", [Object, Object]) -], DotnetTool); -exports.DotnetTool = DotnetTool; -let GitVersionTool = class GitVersionTool { - constructor(dotnetTool) { - this.dotnetTool = dotnetTool; - } - install(versionSpec, includePrerelease) { - return __awaiter(this, void 0, void 0, function* () { - const toolPath = yield this.dotnetTool.toolInstall("GitVersion.Tool", versionSpec, false, includePrerelease); - }); - } - run(...params) { - return; - } -}; -GitVersionTool = __decorate([ - inversify_1.injectable(), - __param(0, inversify_1.inject(types_1.TYPES.IDotnetTool)), - __metadata("design:paramtypes", [Object]) -], GitVersionTool); -exports.GitVersionTool = GitVersionTool; -const cmp = __webpack_require__(651); -let VersionManager = class VersionManager { - constructor(buildAgent) { - this.buildAgent = buildAgent; - } - isExplicitVersion(versionSpec) { - const c = semver.clean(versionSpec); - this.buildAgent.debug("isExplicit: " + c); - const valid = semver.valid(c) != null; - this.buildAgent.debug("explicit? " + valid); - return valid; - } - evaluateVersions(versions, versionSpec) { - let version; - this.buildAgent.debug("evaluating " + versions.length + " versions"); - versions = versions.sort(cmp); - for (let i = versions.length - 1; i >= 0; i--) { - const potential = versions[i]; - const satisfied = semver.satisfies(potential, versionSpec); - if (satisfied) { - version = potential; - break; - } - } - if (version) { - this.buildAgent.debug("matched: " + version); - } - else { - this.buildAgent.debug("match not found"); - } - return version; - } - cleanVersion(version) { - this.buildAgent.debug("cleaning: " + version); - return semver.clean(version); - } -}; -VersionManager = __decorate([ - inversify_1.injectable(), - __param(0, inversify_1.inject(types_1.TYPES.IBuildAgent)), - __metadata("design:paramtypes", [Object]) -], VersionManager); -exports.VersionManager = VersionManager; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZmlsZTovLy9EOi9Qcm9qZWN0cy9PU1MvR2l0VG9vbHMvdXNlLWdpdHZlcnNpb24yL3NyYy9jb21tb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFDQSx5QkFBeUI7QUFDekIseUJBQXlCO0FBQ3pCLDZCQUE2QjtBQUM3QixpQ0FBaUM7QUFDakMscURBQXFEO0FBRXJELHlDQUErQztBQUcvQyxtQ0FBZ0M7QUFHaEMsSUFBTSxVQUFVLEdBQWhCLE1BQU0sVUFBVTtJQU1aLFlBQytCLFVBQXVCLEVBQ25CLGNBQStCO1FBRTlELElBQUksQ0FBQyxVQUFVLEdBQUcsVUFBVSxDQUFDO1FBQzdCLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFDO1FBQ3JDLElBQUksQ0FBQyxVQUFVLEdBQUcsSUFBSSxJQUFJLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQ3BELENBQUM7SUFFTSxHQUFHLENBQUMsSUFBYztRQUNyQixPQUFPLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNoRCxDQUFDO0lBRVksV0FBVyxDQUFDLFFBQWdCLEVBQUUsV0FBbUIsRUFBRSxXQUFvQixFQUFFLFVBQW1COztZQUVyRyxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ2hCLE9BQU8sQ0FBQyxHQUFHLENBQUMsNEJBQTRCLENBQUMsQ0FBQztZQUMxQyxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsUUFBUSxXQUFXLEdBQUcsV0FBVyxDQUFDLENBQUM7WUFDN0QsT0FBTyxDQUFDLEdBQUcsQ0FBQyw0QkFBNEIsQ0FBQyxDQUFDO1lBRTFDLElBQUksSUFBSSxDQUFDLGNBQWMsQ0FBQyxpQkFBaUIsQ0FBQyxXQUFXLENBQUMsRUFBRTtnQkFDcEQsV0FBVyxHQUFHLEtBQUssQ0FBQyxDQUFDLHdEQUF3RDthQUNoRjtZQUVELElBQUksUUFBZ0IsQ0FBQztZQUNyQixJQUFJLENBQUMsV0FBVyxFQUFFO2dCQUNkLEVBQUU7Z0JBQ0YsdURBQXVEO2dCQUN2RCxFQUFFO2dCQUNGLFFBQVEsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsV0FBVyxDQUFDLENBQUM7YUFDMUQ7WUFFRCxJQUFJLENBQUMsUUFBUSxFQUFFO2dCQUNYLElBQUksT0FBZSxDQUFDO2dCQUNwQixJQUFJLElBQUksQ0FBQyxjQUFjLENBQUMsaUJBQWlCLENBQUMsV0FBVyxDQUFDLEVBQUU7b0JBQ3BELEVBQUU7b0JBQ0YseUVBQXlFO29CQUN6RSxFQUFFO29CQUNGLE9BQU8sR0FBRyxXQUFXLENBQUM7aUJBQ3pCO3FCQUFNO29CQUNILEVBQUU7b0JBQ0Ysa0VBQWtFO29CQUNsRSxpRkFBaUY7b0JBQ2pGLG1EQUFtRDtvQkFDbkQsaURBQWlEO29CQUNqRCxFQUFFO29CQUNGLE9BQU8sR0FBRyxNQUFNLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxRQUFRLEVBQUUsV0FBVyxFQUFFLFVBQVUsQ0FBQyxDQUFDO29CQUN6RSxJQUFJLENBQUMsT0FBTyxFQUFFO3dCQUNWLE1BQU0sSUFBSSxLQUFLLENBQUMsa0JBQWtCLFFBQVEsYUFBYSxXQUFXLElBQUksQ0FBQyxDQUFDO3FCQUMzRTtvQkFFRCxFQUFFO29CQUNGLDRDQUE0QztvQkFDNUMsRUFBRTtvQkFDRixRQUFRLEdBQUcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO2lCQUN0RDtnQkFDRCxJQUFJLENBQUMsUUFBUSxFQUFFO29CQUNYLEVBQUU7b0JBQ0YsMkJBQTJCO29CQUMzQixFQUFFO29CQUNGLFFBQVEsR0FBRyxNQUFNLElBQUksQ0FBQyxXQUFXLENBQUMsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO2lCQUN4RDthQUNKO1lBRUQsRUFBRTtZQUNGLDZFQUE2RTtZQUM3RSw2REFBNkQ7WUFDN0QsRUFBRTtZQUNGLElBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLGFBQWEsUUFBUSxFQUFFLENBQUMsQ0FBQztZQUUvQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUUsS0FBSyxPQUFPLEVBQUU7Z0JBQzNCLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxNQUFNLElBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDeEYsSUFBSSxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsYUFBYSxFQUFFLFVBQVUsQ0FBQyxDQUFDO2FBQzdEO1lBQ0QsSUFBSSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7WUFFbEMsT0FBTyxRQUFRLENBQUM7UUFDcEIsQ0FBQztLQUFBO0lBRWEsZ0JBQWdCLENBQUMsUUFBZ0IsRUFBRSxXQUFtQixFQUFFLGlCQUEwQjs7WUFDNUYsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsOEJBQThCLFFBQVEsR0FBRyxXQUFXLENBQUMsQ0FBQyxDQUFDLElBQUksV0FBVyxFQUFFLENBQUMsQ0FBQyxDQUFDLEVBQUUsSUFBSSxpQkFBaUIsQ0FBQyxDQUFDLENBQUMsd0JBQXdCLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUM7WUFFNUosTUFBTSxZQUFZLEdBQUcsOENBQThDLGtCQUFrQixDQUFDLFFBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQyxlQUFlLGlCQUFpQixDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLE9BQU8sb0JBQW9CLENBQUM7WUFDckwsTUFBTSxHQUFHLEdBQUcsTUFBTSxJQUFJLENBQUMsVUFBVSxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsQ0FBQztZQUVwRCxJQUFJLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsVUFBVSxLQUFLLEdBQUcsRUFBRTtnQkFDeEMsT0FBTyxJQUFJLENBQUM7YUFDZjtZQUVELE1BQU0sSUFBSSxHQUFXLE1BQU0sR0FBRyxDQUFDLFFBQVEsRUFBRSxDQUFDO1lBQzFDLE1BQU0sSUFBSSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDO1lBRW5DLE1BQU0sUUFBUSxHQUFJLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUF1QyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQ3hGLElBQUksQ0FBQyxRQUFRLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxFQUFFO2dCQUMvQixPQUFPLElBQUksQ0FBQzthQUNmO1lBRUQsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsaUJBQWlCLFFBQVEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBRTlELE9BQU8sSUFBSSxDQUFDLGNBQWMsQ0FBQyxnQkFBZ0IsQ0FBQyxRQUFRLEVBQUUsV0FBVyxDQUFDLENBQUM7UUFDdkUsQ0FBQztLQUFBO0lBRWEsV0FBVyxDQUFDLFFBQWdCLEVBQUUsT0FBZTs7WUFFdkQsTUFBTSxhQUFhLEdBQUcsTUFBTSxJQUFJLENBQUMsVUFBVSxDQUFDLGFBQWEsRUFBRSxDQUFDO1lBQzVELElBQUksSUFBSSxHQUFHLENBQUMsTUFBTSxFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsYUFBYSxFQUFFLGFBQWEsQ0FBQyxDQUFDO1lBRXZFLElBQUksT0FBTyxFQUFFO2dCQUNULE9BQU8sR0FBRyxJQUFJLENBQUMsY0FBYyxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDcEQsSUFBSSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQyxXQUFXLEVBQUUsT0FBTyxDQUFDLENBQUMsQ0FBQzthQUM5QztZQUVELE1BQU0sTUFBTSxHQUFHLE1BQU0sSUFBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUNwQyxNQUFNLE1BQU0sR0FBRyxNQUFNLENBQUMsSUFBSSxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUM7WUFDekQsTUFBTSxPQUFPLEdBQUcsTUFBTSxDQUFDLElBQUksS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUM7WUFFbEUsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsd0JBQXdCLE1BQU0sSUFBSSxPQUFPLEVBQUUsQ0FBQyxDQUFDO1lBRW5FLElBQUksTUFBTSxDQUFDLElBQUksRUFBRTtnQkFDYixNQUFNLElBQUksS0FBSyxDQUFDLHVCQUF1QixDQUFDLENBQUM7YUFDNUM7WUFFRCxPQUFPLE1BQU0sSUFBSSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsYUFBYSxFQUFFLFFBQVEsRUFBRSxPQUFPLENBQUMsQ0FBQztRQUM1RSxDQUFDO0tBQUE7Q0FDSixDQUFBO0FBbElLLFVBQVU7SUFEZixzQkFBVSxFQUFFO0lBUUosV0FBQSxrQkFBTSxDQUFDLGFBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQTtJQUN6QixXQUFBLGtCQUFNLENBQUMsYUFBSyxDQUFDLGVBQWUsQ0FBQyxDQUFBOztHQVJoQyxVQUFVLENBa0lmO0FBd0VHLGdDQUFVO0FBckVkLElBQU0sY0FBYyxHQUFwQixNQUFNLGNBQWM7SUFHaEIsWUFDK0IsVUFBdUI7UUFFbEQsSUFBSSxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUM7SUFDakMsQ0FBQztJQUVZLE9BQU8sQ0FBQyxXQUFtQixFQUFFLGlCQUEwQjs7WUFDaEUsTUFBTSxRQUFRLEdBQUcsTUFBTSxJQUFJLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxpQkFBaUIsRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLGlCQUFpQixDQUFDLENBQUM7UUFDakgsQ0FBQztLQUFBO0lBRU0sR0FBRyxDQUFDLEdBQUcsTUFBa0I7UUFDNUIsT0FBTztJQUNYLENBQUM7Q0FDSixDQUFBO0FBaEJLLGNBQWM7SUFEbkIsc0JBQVUsRUFBRTtJQUtKLFdBQUEsa0JBQU0sQ0FBQyxhQUFLLENBQUMsV0FBVyxDQUFDLENBQUE7O0dBSjVCLGNBQWMsQ0FnQm5CO0FBc0RHLHdDQUFjO0FBcERsQixNQUFNLEdBQUcsR0FBRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQUd0QyxJQUFNLGNBQWMsR0FBcEIsTUFBTSxjQUFjO0lBR2hCLFlBQytCLFVBQXVCO1FBRWxELElBQUksQ0FBQyxVQUFVLEdBQUcsVUFBVSxDQUFDO0lBQ2pDLENBQUM7SUFFTSxpQkFBaUIsQ0FBQyxXQUFtQjtRQUN4QyxNQUFNLENBQUMsR0FBRyxNQUFNLENBQUMsS0FBSyxDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBQ3BDLElBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLGNBQWMsR0FBRyxDQUFDLENBQUMsQ0FBQztRQUUxQyxNQUFNLEtBQUssR0FBRyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLElBQUksQ0FBQztRQUN0QyxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxZQUFZLEdBQUcsS0FBSyxDQUFDLENBQUM7UUFFNUMsT0FBTyxLQUFLLENBQUM7SUFDakIsQ0FBQztJQUVNLGdCQUFnQixDQUFDLFFBQWtCLEVBQUUsV0FBbUI7UUFDM0QsSUFBSSxPQUFlLENBQUM7UUFDcEIsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsYUFBYSxHQUFHLFFBQVEsQ0FBQyxNQUFNLEdBQUcsV0FBVyxDQUFDLENBQUM7UUFDckUsUUFBUSxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDOUIsS0FBSyxJQUFJLENBQUMsR0FBRyxRQUFRLENBQUMsTUFBTSxHQUFHLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFO1lBQy9DLE1BQU0sU0FBUyxHQUFXLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUN0QyxNQUFNLFNBQVMsR0FBWSxNQUFNLENBQUMsU0FBUyxDQUFDLFNBQVMsRUFBRSxXQUFXLENBQUMsQ0FBQztZQUNwRSxJQUFJLFNBQVMsRUFBRTtnQkFDWCxPQUFPLEdBQUcsU0FBUyxDQUFDO2dCQUNwQixNQUFNO2FBQ1Q7U0FDSjtRQUVHLElBQUksT0FBTyxFQUFFO1lBQ1QsSUFBSSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsV0FBVyxHQUFHLE9BQU8sQ0FBQyxDQUFDO1NBQ3BEO2FBQU07WUFDSCxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO1NBQzVDO1FBRUcsT0FBTyxPQUFPLENBQUM7SUFDbkIsQ0FBQztJQUVNLFlBQVksQ0FBQyxPQUFlO1FBQy9CLElBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLFlBQVksR0FBRyxPQUFPLENBQUMsQ0FBQztRQUM5QyxPQUFPLE1BQU0sQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDakMsQ0FBQztDQUNKLENBQUE7QUE3Q0ssY0FBYztJQURuQixzQkFBVSxFQUFFO0lBS0osV0FBQSxrQkFBTSxDQUFDLGFBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQTs7R0FKNUIsY0FBYyxDQTZDbkI7QUFLRyx3Q0FBYyJ9 - -/***/ }), - -/***/ 179: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var binding_on_syntax_1 = __webpack_require__(20); -var binding_when_syntax_1 = __webpack_require__(653); -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; - - -/***/ }), - -/***/ 186: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var BindingScopeEnum = { - Request: "Request", - Singleton: "Singleton", - Transient: "Transient" -}; -exports.BindingScopeEnum = BindingScopeEnum; -var BindingTypeEnum = { - ConstantValue: "ConstantValue", - Constructor: "Constructor", - DynamicValue: "DynamicValue", - Factory: "Factory", - Function: "Function", - Instance: "Instance", - Invalid: "Invalid", - Provider: "Provider" -}; -exports.BindingTypeEnum = BindingTypeEnum; -var TargetTypeEnum = { - ClassProperty: "ClassProperty", - ConstructorArgument: "ConstructorArgument", - Variable: "Variable" -}; -exports.TargetTypeEnum = TargetTypeEnum; - - -/***/ }), - -/***/ 188: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var METADATA_KEY = __webpack_require__(677); -var metadata_1 = __webpack_require__(173); -var decorator_utils_1 = __webpack_require__(289); -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; - - -/***/ }), - -/***/ 202: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var METADATA_KEY = __webpack_require__(677); -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; - - -/***/ }), - -/***/ 209: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); -var os = __webpack_require__(365); -var fs = __webpack_require__(747); - -// Returns false if 'dir' is not a writeable directory, 'dir' otherwise -function writeableDir(dir) { - if (!dir || !fs.existsSync(dir)) - return false; - - if (!fs.statSync(dir).isDirectory()) - return false; - - var testFile = dir+'/'+common.randomFileName(); - try { - fs.writeFileSync(testFile, ' '); - common.unlinkSync(testFile); - return dir; - } catch (e) { - return false; - } -} - - -//@ -//@ ### tempdir() -//@ -//@ Examples: -//@ -//@ ```javascript -//@ var tmp = tempdir(); // "/tmp" for most *nix platforms -//@ ``` -//@ -//@ Searches and returns string containing a writeable, platform-dependent temporary directory. -//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). -function _tempDir() { - var state = common.state; - if (state.tempDir) - return state.tempDir; // from cache - - state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+ - writeableDir(process.env['TMPDIR']) || - writeableDir(process.env['TEMP']) || - writeableDir(process.env['TMP']) || - writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS - writeableDir('C:\\TEMP') || // Windows - writeableDir('C:\\TMP') || // Windows - writeableDir('\\TEMP') || // Windows - writeableDir('\\TMP') || // Windows - writeableDir('/tmp') || - writeableDir('/var/tmp') || - writeableDir('/usr/tmp') || - writeableDir('.'); // last resort - - return state.tempDir; -} -module.exports = _tempDir; - - -/***/ }), - -/***/ 211: -/***/ (function(module) { - -module.exports = require("https"); - -/***/ }), - -/***/ 212: -/***/ (function(module, __unusedexports, __webpack_require__) { - -module.exports = __webpack_require__(851); - - -/***/ }), - -/***/ 225: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); -var fs = __webpack_require__(747); - -//@ -//@ ### cat(file [, file ...]) -//@ ### cat(file_array) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ var str = cat('file*.txt'); -//@ var str = cat('file1', 'file2'); -//@ var str = cat(['file1', 'file2']); // same as above -//@ ``` -//@ -//@ Returns a string containing the given file, or a concatenated string -//@ containing the files if more than one file is given (a new line character is -//@ introduced between each file). Wildcard `*` accepted. -function _cat(options, files) { - var cat = ''; - - if (!files) - common.error('no paths given'); - - if (typeof files === 'string') - files = [].slice.call(arguments, 1); - // if it's array leave it as it is - - files = common.expand(files); - - files.forEach(function(file) { - if (!fs.existsSync(file)) - common.error('no such file or directory: ' + file); - - cat += fs.readFileSync(file, 'utf8') + '\n'; - }); - - if (cat[cat.length-1] === '\n') - cat = cat.substring(0, cat.length-1); - - return common.ShellString(cat); -} -module.exports = _cat; - - -/***/ }), - -/***/ 226: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var binding_in_syntax_1 = __webpack_require__(902); -var binding_on_syntax_1 = __webpack_require__(20); -var binding_when_syntax_1 = __webpack_require__(653); -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; - - -/***/ }), - -/***/ 244: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -// -// ShellJS -// Unix shell commands on top of Node's API -// -// Copyright (c) 2012 Artur Adib -// http://github.com/arturadib/shelljs -// - -var common = __webpack_require__(164); - - -//@ -//@ All commands run synchronously, unless otherwise stated. -//@ - -//@include ./src/cd -var _cd = __webpack_require__(369); -exports.cd = common.wrap('cd', _cd); - -//@include ./src/pwd -var _pwd = __webpack_require__(693); -exports.pwd = common.wrap('pwd', _pwd); - -//@include ./src/ls -var _ls = __webpack_require__(951); -exports.ls = common.wrap('ls', _ls); - -//@include ./src/find -var _find = __webpack_require__(36); -exports.find = common.wrap('find', _find); - -//@include ./src/cp -var _cp = __webpack_require__(263); -exports.cp = common.wrap('cp', _cp); - -//@include ./src/rm -var _rm = __webpack_require__(94); -exports.rm = common.wrap('rm', _rm); - -//@include ./src/mv -var _mv = __webpack_require__(700); -exports.mv = common.wrap('mv', _mv); - -//@include ./src/mkdir -var _mkdir = __webpack_require__(981); -exports.mkdir = common.wrap('mkdir', _mkdir); - -//@include ./src/test -var _test = __webpack_require__(862); -exports.test = common.wrap('test', _test); - -//@include ./src/cat -var _cat = __webpack_require__(225); -exports.cat = common.wrap('cat', _cat); - -//@include ./src/to -var _to = __webpack_require__(295); -String.prototype.to = common.wrap('to', _to); - -//@include ./src/toEnd -var _toEnd = __webpack_require__(131); -String.prototype.toEnd = common.wrap('toEnd', _toEnd); - -//@include ./src/sed -var _sed = __webpack_require__(826); -exports.sed = common.wrap('sed', _sed); - -//@include ./src/grep -var _grep = __webpack_require__(367); -exports.grep = common.wrap('grep', _grep); - -//@include ./src/which -var _which = __webpack_require__(750); -exports.which = common.wrap('which', _which); - -//@include ./src/echo -var _echo = __webpack_require__(490); -exports.echo = _echo; // don't common.wrap() as it could parse '-options' - -//@include ./src/dirs -var _dirs = __webpack_require__(853).dirs; -exports.dirs = common.wrap("dirs", _dirs); -var _pushd = __webpack_require__(853).pushd; -exports.pushd = common.wrap('pushd', _pushd); -var _popd = __webpack_require__(853).popd; -exports.popd = common.wrap("popd", _popd); - -//@include ./src/ln -var _ln = __webpack_require__(756); -exports.ln = common.wrap('ln', _ln); - -//@ -//@ ### exit(code) -//@ Exits the current process with the given exit code. -exports.exit = process.exit; - -//@ -//@ ### env['VAR_NAME'] -//@ Object containing environment variables (both getter and setter). Shortcut to process.env. -exports.env = process.env; - -//@include ./src/exec -var _exec = __webpack_require__(696); -exports.exec = common.wrap('exec', _exec, {notUnix:true}); - -//@include ./src/chmod -var _chmod = __webpack_require__(171); -exports.chmod = common.wrap('chmod', _chmod); - - - -//@ -//@ ## Non-Unix commands -//@ - -//@include ./src/tempdir -var _tempDir = __webpack_require__(209); -exports.tempdir = common.wrap('tempdir', _tempDir); - - -//@include ./src/error -var _error = __webpack_require__(353); -exports.error = _error; - - - -//@ -//@ ## Configuration -//@ - -exports.config = common.config; - -//@ -//@ ### config.silent -//@ Example: -//@ -//@ ```javascript -//@ var silentState = config.silent; // save old silent state -//@ config.silent = true; -//@ /* ... */ -//@ config.silent = silentState; // restore old silent state -//@ ``` -//@ -//@ Suppresses all command output if `true`, except for `echo()` calls. -//@ Default is `false`. - -//@ -//@ ### config.fatal -//@ Example: -//@ -//@ ```javascript -//@ config.fatal = true; -//@ cp('this_file_does_not_exist', '/dev/null'); // dies here -//@ /* more commands... */ -//@ ``` -//@ -//@ If `true` the script will die on errors. Default is `false`. - - -/***/ }), - -/***/ 263: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var fs = __webpack_require__(747); -var path = __webpack_require__(622); -var common = __webpack_require__(164); -var os = __webpack_require__(365); - -// Buffered file copy, synchronous -// (Using readFileSync() + writeFileSync() could easily cause a memory overflow -// with large files) -function copyFileSync(srcFile, destFile) { - if (!fs.existsSync(srcFile)) - common.error('copyFileSync: no such file or directory: ' + srcFile); - - var BUF_LENGTH = 64*1024, - buf = new Buffer(BUF_LENGTH), - bytesRead = BUF_LENGTH, - pos = 0, - fdr = null, - fdw = null; - - try { - fdr = fs.openSync(srcFile, 'r'); - } catch(e) { - common.error('copyFileSync: could not read src file ('+srcFile+')'); - } - - try { - fdw = fs.openSync(destFile, 'w'); - } catch(e) { - common.error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile); - } - - while (bytesRead === BUF_LENGTH) { - bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos); - fs.writeSync(fdw, buf, 0, bytesRead); - pos += bytesRead; - } - - fs.closeSync(fdr); - fs.closeSync(fdw); - - fs.chmodSync(destFile, fs.statSync(srcFile).mode); -} - -// Recursively copies 'sourceDir' into 'destDir' -// Adapted from https://github.com/ryanmcgrath/wrench-js -// -// Copyright (c) 2010 Ryan McGrath -// Copyright (c) 2012 Artur Adib -// -// Licensed under the MIT License -// http://www.opensource.org/licenses/mit-license.php -function cpdirSyncRecursive(sourceDir, destDir, opts) { - if (!opts) opts = {}; - - /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */ - var checkDir = fs.statSync(sourceDir); - try { - fs.mkdirSync(destDir, checkDir.mode); - } catch (e) { - //if the directory already exists, that's okay - if (e.code !== 'EEXIST') throw e; - } - - var files = fs.readdirSync(sourceDir); - - for (var i = 0; i < files.length; i++) { - var srcFile = sourceDir + "/" + files[i]; - var destFile = destDir + "/" + files[i]; - var srcFileStat = fs.lstatSync(srcFile); - - if (srcFileStat.isDirectory()) { - /* recursion this thing right on back. */ - cpdirSyncRecursive(srcFile, destFile, opts); - } else if (srcFileStat.isSymbolicLink()) { - var symlinkFull = fs.readlinkSync(srcFile); - fs.symlinkSync(symlinkFull, destFile, os.platform() === "win32" ? "junction" : null); - } else { - /* At this point, we've hit a file actually worth copying... so copy it on over. */ - if (fs.existsSync(destFile) && !opts.force) { - common.log('skipping existing file: ' + files[i]); - } else { - copyFileSync(srcFile, destFile); - } - } - - } // for files -} // cpdirSyncRecursive - - -//@ -//@ ### cp([options ,] source [,source ...], dest) -//@ ### cp([options ,] source_array, dest) -//@ Available options: -//@ -//@ + `-f`: force -//@ + `-r, -R`: recursive -//@ -//@ Examples: -//@ -//@ ```javascript -//@ cp('file1', 'dir1'); -//@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp'); -//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above -//@ ``` -//@ -//@ Copies files. The wildcard `*` is accepted. -function _cp(options, sources, dest) { - options = common.parseOptions(options, { - 'f': 'force', - 'R': 'recursive', - 'r': 'recursive' - }); - - // Get sources, dest - if (arguments.length < 3) { - common.error('missing and/or '); - } else if (arguments.length > 3) { - sources = [].slice.call(arguments, 1, arguments.length - 1); - dest = arguments[arguments.length - 1]; - } else if (typeof sources === 'string') { - sources = [sources]; - } else if ('length' in sources) { - sources = sources; // no-op for array - } else { - common.error('invalid arguments'); - } - - var exists = fs.existsSync(dest), - stats = exists && fs.statSync(dest); - - // Dest is not existing dir, but multiple sources given - if ((!exists || !stats.isDirectory()) && sources.length > 1) - common.error('dest is not a directory (too many sources)'); - - // Dest is an existing file, but no -f given - if (exists && stats.isFile() && !options.force) - common.error('dest file already exists: ' + dest); - - if (options.recursive) { - // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*" - // (see Github issue #15) - sources.forEach(function(src, i) { - if (src[src.length - 1] === '/') - sources[i] += '*'; - }); - - // Create dest - try { - fs.mkdirSync(dest, parseInt('0777', 8)); - } catch (e) { - // like Unix's cp, keep going even if we can't create dest dir - } - } - - sources = common.expand(sources); - - sources.forEach(function(src) { - if (!fs.existsSync(src)) { - common.error('no such file or directory: '+src, true); - return; // skip file - } - - // If here, src exists - if (fs.statSync(src).isDirectory()) { - if (!options.recursive) { - // Non-Recursive - common.log(src + ' is a directory (not copied)'); - } else { - // Recursive - // 'cp /a/source dest' should create 'source' in 'dest' - var newDest = path.join(dest, path.basename(src)), - checkDir = fs.statSync(src); - try { - fs.mkdirSync(newDest, checkDir.mode); - } catch (e) { - //if the directory already exists, that's okay - if (e.code !== 'EEXIST') throw e; - } - - cpdirSyncRecursive(src, newDest, {force: options.force}); - } - return; // done with dir - } - - // If here, src is a file - - // When copying to '/path/dir': - // thisDest = '/path/dir/file1' - var thisDest = dest; - if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) - thisDest = path.normalize(dest + '/' + path.basename(src)); - - if (fs.existsSync(thisDest) && !options.force) { - common.error('dest file already exists: ' + thisDest, true); - return; // skip file - } - - copyFileSync(src, thisDest); - }); // forEach(src) -} -module.exports = _cp; - - -/***/ }), - -/***/ 289: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERROR_MSGS = __webpack_require__(516); -var METADATA_KEY = __webpack_require__(677); -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; - - -/***/ }), - -/***/ 295: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); -var fs = __webpack_require__(747); -var path = __webpack_require__(622); - -//@ -//@ ### 'string'.to(file) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ cat('input.txt').to('output.txt'); -//@ ``` -//@ -//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as -//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ -function _to(options, file) { - if (!file) - common.error('wrong arguments'); - - if (!fs.existsSync( path.dirname(file) )) - common.error('no such file or directory: ' + path.dirname(file)); - - try { - fs.writeFileSync(file, this.toString(), 'utf8'); - } catch(e) { - common.error('could not write to file (code '+e.code+'): '+file, true); - } -} -module.exports = _to; - - -/***/ }), - -/***/ 330: -/***/ (function(module) { - -module.exports = {"_args":[["azure-pipelines-tool-lib@0.12.0","D:\\Projects\\OSS\\GitTools\\use-gitversion2"]],"_from":"azure-pipelines-tool-lib@0.12.0","_id":"azure-pipelines-tool-lib@0.12.0","_inBundle":false,"_integrity":"sha512-JAlFvMTtEXISrnJY/kgq0LecLi089RqXRf/gMsXYbflmzszklkc+LUJpR0A7NDmJ+9/MWpKY/ZX+Q/zirYa7gw==","_location":"/azure-pipelines-tool-lib","_phantomChildren":{"tunnel":"0.0.4","underscore":"1.8.3"},"_requested":{"type":"version","registry":true,"raw":"azure-pipelines-tool-lib@0.12.0","name":"azure-pipelines-tool-lib","escapedName":"azure-pipelines-tool-lib","rawSpec":"0.12.0","saveSpec":null,"fetchSpec":"0.12.0"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/azure-pipelines-tool-lib/-/azure-pipelines-tool-lib-0.12.0.tgz","_spec":"0.12.0","_where":"D:\\Projects\\OSS\\GitTools\\use-gitversion2","author":{"name":"Microsoft"},"bugs":{"url":"https://github.com/microsoft/azure-pipelines-tool-lib/issues"},"dependencies":{"@types/semver":"^5.3.0","@types/uuid":"^3.0.1","azure-pipelines-task-lib":"^2.8.0","semver":"^5.3.0","semver-compare":"^1.0.0","typed-rest-client":"1.0.9","uuid":"^3.0.1"},"description":"Azure Pipelines Tool Installer Lib for CI/CD Tasks","devDependencies":{"@types/mocha":"^2.2.41","@types/node":"^8.0.19","@types/shelljs":"^0.7.4","@types/xml2js":"^0.4.0","mocha":"^3.2.0","nock":"9.6.1","shelljs":"^0.7.6","typescript":"^2.2.1","xml2js":"^0.4.17"},"homepage":"https://github.com/microsoft/azure-pipelines-tool-lib#readme","keywords":["VSTS"],"license":"MIT","main":"tool.js","name":"azure-pipelines-tool-lib","repository":{"type":"git","url":"git+https://github.com/microsoft/azure-pipelines-tool-lib.git"},"scripts":{"build":"node make.js build","sample":"node make.js sample","test":"node make.js test","units":"node make.js units"},"version":"0.12.0"}; - -/***/ }), - -/***/ 351: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const httpm = __webpack_require__(871); -const path = __webpack_require__(622); -const os = __webpack_require__(365); -const process = __webpack_require__(765); -const fs = __webpack_require__(747); -const semver = __webpack_require__(105); -const tl = __webpack_require__(735); -const cmp = __webpack_require__(651); -const uuidV4 = __webpack_require__(542); -let pkg = __webpack_require__(330); -let userAgent = 'vsts-task-installer/' + pkg.version; -let requestOptions = { - // ignoreSslError: true, - proxy: tl.getHttpProxyConfiguration(), - cert: tl.getHttpCertConfiguration() -}; -let http = new httpm.HttpClient(userAgent, null, requestOptions); -tl.setResourcePath(__webpack_require__.ab + "lib.json"); -function debug(message) { - tl.debug(message); -} -exports.debug = debug; -function prependPath(toolPath) { - tl.assertAgent('2.115.0'); - if (!toolPath) { - throw new Error('Parameter toolPath must not be null or empty'); - } - else if (!tl.exist(toolPath) || !tl.stats(toolPath).isDirectory()) { - throw new Error('Directory does not exist: ' + toolPath); - } - // todo: add a test for path - console.log(tl.loc('TOOL_LIB_PrependPath', toolPath)); - let newPath = toolPath + path.delimiter + process.env['PATH']; - tl.debug('new Path: ' + newPath); - process.env['PATH'] = newPath; - // instruct the agent to set this path on future tasks - console.log('##vso[task.prependpath]' + toolPath); -} -exports.prependPath = prependPath; -function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} -//----------------------------- -// Version Functions -//----------------------------- -/** - * Checks if a version spec is an explicit version (e.g. 1.0.1 or v1.0.1) - * As opposed to a version spec like 1.x - * - * @param versionSpec - */ -function isExplicitVersion(versionSpec) { - let c = semver.clean(versionSpec); - tl.debug('isExplicit: ' + c); - let valid = semver.valid(c) != null; - tl.debug('explicit? ' + valid); - return valid; -} -exports.isExplicitVersion = isExplicitVersion; -/** - * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) - * and parsed version, or null if version is invalid. - */ -function cleanVersion(version) { - tl.debug('cleaning: ' + version); - return semver.clean(version); -} -exports.cleanVersion = cleanVersion; -/** - * evaluates a list of versions and returns the latest version matching the version spec - * - * @param versions an array of versions to evaluate - * @param versionSpec a version spec (e.g. 1.x) - */ -function evaluateVersions(versions, versionSpec) { - let version; - tl.debug('evaluating ' + versions.length + ' versions'); - versions = versions.sort(cmp); - for (let i = versions.length - 1; i >= 0; i--) { - let potential = versions[i]; - let satisfied = semver.satisfies(potential, versionSpec); - if (satisfied) { - version = potential; - break; - } - } - if (version) { - tl.debug('matched: ' + version); - } - else { - tl.debug('match not found'); - } - return version; -} -exports.evaluateVersions = evaluateVersions; -//----------------------------- -// Local Tool Cache Functions -//----------------------------- -/** - * finds the path to a tool in the local installed tool cache - * - * @param toolName name of the tool - * @param versionSpec version of the tool - * @param arch optional arch. defaults to arch of computer - */ -function findLocalTool(toolName, versionSpec, arch) { - if (!toolName) { - throw new Error('toolName parameter is required'); - } - if (!versionSpec) { - throw new Error('versionSpec parameter is required'); - } - arch = arch || os.arch(); - // attempt to resolve an explicit version - if (!isExplicitVersion(versionSpec)) { - let localVersions = findLocalToolVersions(toolName, arch); - let match = evaluateVersions(localVersions, versionSpec); - versionSpec = match; - } - // check for the explicit version in the cache - let toolPath; - if (versionSpec) { - versionSpec = semver.clean(versionSpec); - let cacheRoot = _getCacheRoot(); - let cachePath = path.join(cacheRoot, toolName, versionSpec, arch); - tl.debug('checking cache: ' + cachePath); - if (tl.exist(cachePath) && tl.exist(`${cachePath}.complete`)) { - console.log(tl.loc('TOOL_LIB_FoundInCache', toolName, versionSpec, arch)); - toolPath = cachePath; - } - else { - tl.debug('not found'); - } - } - return toolPath; -} -exports.findLocalTool = findLocalTool; -/** - * Retrieves the versions of a tool that is intalled in the local tool cache - * - * @param toolName name of the tool - * @param arch optional arch. defaults to arch of computer - */ -function findLocalToolVersions(toolName, arch) { - let versions = []; - arch = arch || os.arch(); - let toolPath = path.join(_getCacheRoot(), toolName); - if (tl.exist(toolPath)) { - let children = tl.ls('', [toolPath]); - children.forEach((child) => { - if (isExplicitVersion(child)) { - let fullPath = path.join(toolPath, child, arch); - if (tl.exist(fullPath) && tl.exist(`${fullPath}.complete`)) { - versions.push(child); - } - } - }); - } - return versions; -} -exports.findLocalToolVersions = findLocalToolVersions; -//--------------------- -// Download Functions -//--------------------- -// -// TODO: keep extension intact -// -/** - * Download a tool from an url and stream it into a file - * - * @param url url of tool to download - * @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path. - */ -function downloadTool(url, fileName) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { - try { - tl.debug(fileName); - fileName = fileName || uuidV4(); - // check if it's an absolute path already - var destPath; - if (path.isAbsolute(fileName)) { - destPath = fileName; - } - else { - destPath = path.join(_getAgentTemp(), fileName); - } - // make sure that the folder exists - tl.mkdirP(path.dirname(destPath)); - console.log(tl.loc('TOOL_LIB_Downloading', url)); - tl.debug('destination ' + destPath); - if (fs.existsSync(destPath)) { - throw new Error("Destination file path already exists"); - } - tl.debug('downloading'); - const statusCodesToRetry = [httpm.HttpCodes.BadGateway, httpm.HttpCodes.ServiceUnavailable, httpm.HttpCodes.GatewayTimeout]; - let retryCount = 1; - const maxRetries = 3; - let response = yield http.get(url); - while (retryCount < maxRetries && statusCodesToRetry.indexOf(response.message.statusCode) > -1) { - tl.debug(`Download attempt "${retryCount}" of "${maxRetries}" failed with status code "${response.message.statusCode}".`); - retryCount += 1; - yield delay(1000); - tl.debug(`Downloading attempt "${retryCount}" of "${maxRetries}"`); - response = yield http.get(url); - } - if (response.message.statusCode != 200) { - let err = new Error('Unexpected HTTP response: ' + response.message.statusCode); - err['httpStatusCode'] = response.message.statusCode; - tl.debug(`Failed to download "${fileName}" from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); - throw err; - } - tl.debug('creating stream'); - let file = fs.createWriteStream(destPath); - file.on('open', (fd) => __awaiter(this, void 0, void 0, function* () { - try { - let stream = response.message.pipe(file); - stream.on('close', () => { - tl.debug('download complete'); - resolve(destPath); - }); - } - catch (err) { - reject(err); - } - })); - file.on('error', (err) => { - file.end(); - reject(err); - }); - } - catch (error) { - reject(error); - } - })); - }); -} -exports.downloadTool = downloadTool; -//--------------------- -// Install Functions -//--------------------- -function _createToolPath(tool, version, arch) { - // todo: add test for clean - let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); - tl.debug('destination ' + folderPath); - let markerPath = `${folderPath}.complete`; - tl.rmRF(folderPath); - tl.rmRF(markerPath); - tl.mkdirP(folderPath); - return folderPath; -} -function _completeToolPath(tool, version, arch) { - let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); - let markerPath = `${folderPath}.complete`; - tl.writeFile(markerPath, ''); - tl.debug('finished caching tool'); -} -/** - * Caches a directory and installs it into the tool cacheDir - * - * @param sourceDir the directory to cache into tools - * @param tool tool name - * @param version version of the tool. semver format - * @param arch architecture of the tool. Optional. Defaults to machine architecture - */ -function cacheDir(sourceDir, tool, version, arch) { - return __awaiter(this, void 0, void 0, function* () { - version = semver.clean(version); - arch = arch || os.arch(); - console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); - tl.debug('source dir: ' + sourceDir); - if (!tl.stats(sourceDir).isDirectory()) { - throw new Error('sourceDir is not a directory'); - } - // create the tool dir - let destPath = _createToolPath(tool, version, arch); - // copy each child item. do not move. move can fail on Windows - // due to anti-virus software having an open handle on a file. - for (let itemName of fs.readdirSync(sourceDir)) { - let s = path.join(sourceDir, itemName); - tl.cp(s, destPath + '/', '-r'); - } - // write .complete - _completeToolPath(tool, version, arch); - return destPath; - }); -} -exports.cacheDir = cacheDir; -/** - * Caches a downloaded file (GUID) and installs it - * into the tool cache with a given targetName - * - * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid. - * @param targetFile the name of the file name in the tools directory - * @param tool tool name - * @param version version of the tool. semver format - * @param arch architecture of the tool. Optional. Defaults to machine architecture - */ -function cacheFile(sourceFile, targetFile, tool, version, arch) { - return __awaiter(this, void 0, void 0, function* () { - version = semver.clean(version); - arch = arch || os.arch(); - console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); - tl.debug('source file:' + sourceFile); - if (!tl.stats(sourceFile).isFile()) { - throw new Error('sourceFile is not a file'); - } - // create the tool dir - let destFolder = _createToolPath(tool, version, arch); - // copy instead of move. move can fail on Windows due to - // anti-virus software having an open handle on a file. - let destPath = path.join(destFolder, targetFile); - tl.debug('destination file' + destPath); - tl.cp(sourceFile, destPath); - // write .complete - _completeToolPath(tool, version, arch); - return destFolder; - }); -} -exports.cacheFile = cacheFile; -//--------------------- -// Extract Functions -//--------------------- -/** - * Extract a .7z file - * - * @param file path to the .7z file - * @param dest destination directory. Optional. - * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this - * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will - * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is - * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line - * interface, it is smaller than the full command line interface, and it does support long paths. At the - * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website. - * Be sure to check the current license agreement. If 7zr.exe is bundled with your task, then the path - * to 7zr.exe can be pass to this function. - * @returns path to the destination directory - */ -function extract7z(file, dest, _7zPath) { - return __awaiter(this, void 0, void 0, function* () { - if (process.platform != 'win32') { - throw new Error('extract7z() not supported on current OS'); - } - if (!file) { - throw new Error("parameter 'file' is required"); - } - console.log(tl.loc('TOOL_LIB_ExtractingArchive')); - dest = _createExtractFolder(dest); - let originalCwd = process.cwd(); - try { - process.chdir(dest); - if (_7zPath) { - // extract - let _7z = tl.tool(_7zPath) - .arg('x') // eXtract files with full paths - .arg('-bb1') // -bb[0-3] : set output log level - .arg('-bd') // disable progress indicator - .arg('-sccUTF-8') // set charset for for console input/output - .arg(file); - yield _7z.exec(); - } - else { - // extract - let escapedScript = path.join(__dirname, 'Invoke-7zdec.ps1').replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines - let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); - let escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); - let command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; - let powershellPath = tl.which('powershell', true); - let powershell = tl.tool(powershellPath) - .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') - .arg(command); - powershell.on('stdout', (buffer) => { - process.stdout.write(buffer); - }); - powershell.on('stderr', (buffer) => { - process.stderr.write(buffer); - }); - yield powershell.exec({ silent: true }); - } - } - finally { - process.chdir(originalCwd); - } - return dest; - }); -} -exports.extract7z = extract7z; -/** - * installs a tool from a tar by extracting the tar and installing it into the tool cache - * - * @param file file path of the tar - * @param tool name of tool in the tool cache - * @param version version of the tool - * @param arch arch of the tool. optional. defaults to the arch of the machine - * @param options IExtractOptions - * @param destination destination directory. optional. - */ -function extractTar(file, destination) { - return __awaiter(this, void 0, void 0, function* () { - // mkdir -p node/4.7.0/x64 - // tar xzC ./node/4.7.0/x64 -f node-v4.7.0-darwin-x64.tar.gz --strip-components 1 - console.log(tl.loc('TOOL_LIB_ExtractingArchive')); - let dest = _createExtractFolder(destination); - let tr = tl.tool('tar'); - tr.arg(['xzC', dest, '-f', file]); - yield tr.exec(); - return dest; - }); -} -exports.extractTar = extractTar; -function extractZip(file, destination) { - return __awaiter(this, void 0, void 0, function* () { - if (!file) { - throw new Error("parameter 'file' is required"); - } - console.log(tl.loc('TOOL_LIB_ExtractingArchive')); - let dest = _createExtractFolder(destination); - if (process.platform == 'win32') { - // build the powershell command - let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines - let escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); - let command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`; - // change the console output code page to UTF-8. - // TODO: FIX WHICH: let chcpPath = tl.which('chcp.com', true); - let chcpPath = path.join(process.env.windir, "system32", "chcp.com"); - yield tl.exec(chcpPath, '65001'); - // run powershell - let powershell = tl.tool('powershell') - .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') - .arg(command); - yield powershell.exec(); - } - else { - let unzip = tl.tool('unzip') - .arg(file); - yield unzip.exec({ cwd: dest }); - } - return dest; - }); -} -exports.extractZip = extractZip; -function _createExtractFolder(dest) { - if (!dest) { - // create a temp dir - dest = path.join(_getAgentTemp(), uuidV4()); - } - tl.mkdirP(dest); - return dest; -} -//--------------------- -// Query Functions -//--------------------- -// default input will be >= LTS version. drop label different than value. -// v4 (LTS) would have a value of 4.x -// option to always download? (not cache), TTL? -/** - * Scrape a web page for versions by regex - * - * @param url url to scrape - * @param regex regex to use for version matches - */ -function scrape(url, regex) { - return __awaiter(this, void 0, void 0, function* () { - let output = yield (yield http.get(url)).readBody(); - let matches = output.match(regex); - let seen = {}; - let versions = []; - for (let i = 0; i < matches.length; i++) { - let ver = semver.clean(matches[i]); - if (!seen.hasOwnProperty(ver)) { - seen[ver] = true; - versions.push(ver); - } - } - return versions; - }); -} -exports.scrape = scrape; -function _getCacheRoot() { - tl.assertAgent('2.115.0'); - let cacheRoot = tl.getVariable('Agent.ToolsDirectory'); - if (!cacheRoot) { - throw new Error('Agent.ToolsDirectory is not set'); - } - return cacheRoot; -} -function _getAgentTemp() { - tl.assertAgent('2.115.0'); - let tempDirectory = tl.getVariable('Agent.TempDirectory'); - if (!tempDirectory) { - throw new Error('Agent.TempDirectory is not set'); - } - return tempDirectory; -} - - -/***/ }), - -/***/ 353: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); - -//@ -//@ ### error() -//@ Tests if error occurred in the last command. Returns `null` if no error occurred, -//@ otherwise returns string explaining the error -function error() { - return common.state.error; -}; -module.exports = error; - - -/***/ }), - -/***/ 355: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERROR_MSGS = __webpack_require__(516); -function isStackOverflowExeption(error) { - return (error instanceof RangeError || - error.message === ERROR_MSGS.STACK_OVERFLOW); -} -exports.isStackOverflowExeption = isStackOverflowExeption; - - -/***/ }), - -/***/ 357: -/***/ (function(module) { - -module.exports = require("assert"); - -/***/ }), - -/***/ 358: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var fs = __webpack_require__(747); -var path = __webpack_require__(622); -var os = __webpack_require__(365); -var minimatch = __webpack_require__(124); -var util = __webpack_require__(669); -var tcm = __webpack_require__(443); -var vm = __webpack_require__(643); -var semver = __webpack_require__(105); -var crypto = __webpack_require__(417); -/** - * Hash table of known variable info. The formatted env var name is the lookup key. - * - * 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. - * - * @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. - * - * @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 = __webpack_require__.ab + "lib1.json"; - var libLocStrs = _loadLocStrings(__webpack_require__.ab + "lib1.json", _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. - * - * @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. - * - * @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. - * - * @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'); - } -} - - -/***/ }), - -/***/ 365: -/***/ (function(module) { - -module.exports = require("os"); - -/***/ }), - -/***/ 367: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); -var fs = __webpack_require__(747); - -//@ -//@ ### grep([options ,] regex_filter, file [, file ...]) -//@ ### grep([options ,] regex_filter, file_array) -//@ Available options: -//@ -//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. -//@ -//@ Examples: -//@ -//@ ```javascript -//@ grep('-v', 'GLOBAL_VARIABLE', '*.js'); -//@ grep('GLOBAL_VARIABLE', '*.js'); -//@ ``` -//@ -//@ Reads input string from given files and returns a string containing all lines of the -//@ file that match the given `regex_filter`. Wildcard `*` accepted. -function _grep(options, regex, files) { - options = common.parseOptions(options, { - 'v': 'inverse' - }); - - if (!files) - common.error('no paths given'); - - if (typeof files === 'string') - files = [].slice.call(arguments, 2); - // if it's array leave it as it is - - files = common.expand(files); - - var grep = ''; - files.forEach(function(file) { - if (!fs.existsSync(file)) { - common.error('no such file or directory: ' + file, true); - return; - } - - var contents = fs.readFileSync(file, 'utf8'), - lines = contents.split(/\r*\n/); - lines.forEach(function(line) { - var matched = line.match(regex); - if ((options.inverse && !matched) || (!options.inverse && matched)) - grep += line + '\n'; - }); - }); - - return common.ShellString(grep); -} -module.exports = _grep; - - -/***/ }), - -/***/ 369: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var fs = __webpack_require__(747); -var common = __webpack_require__(164); - -//@ -//@ ### cd('dir') -//@ Changes to directory `dir` for the duration of the script -function _cd(options, dir) { - if (!dir) - common.error('directory not specified'); - - if (!fs.existsSync(dir)) - common.error('no such file or directory: ' + dir); - - if (!fs.statSync(dir).isDirectory()) - common.error('not a directory: ' + dir); - - process.chdir(dir); -} -module.exports = _cd; - - -/***/ }), - -/***/ 380: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var error_msgs_1 = __webpack_require__(516); -var METADATA_KEY = __webpack_require__(677); -var metadata_1 = __webpack_require__(173); -var decorator_utils_1 = __webpack_require__(289); -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; - - -/***/ }), - -/***/ 386: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var keys = __webpack_require__(677); -exports.METADATA_KEY = keys; -var container_1 = __webpack_require__(15); -exports.Container = container_1.Container; -var literal_types_1 = __webpack_require__(186); -exports.BindingScopeEnum = literal_types_1.BindingScopeEnum; -exports.BindingTypeEnum = literal_types_1.BindingTypeEnum; -exports.TargetTypeEnum = literal_types_1.TargetTypeEnum; -var container_module_1 = __webpack_require__(752); -exports.AsyncContainerModule = container_module_1.AsyncContainerModule; -exports.ContainerModule = container_module_1.ContainerModule; -var injectable_1 = __webpack_require__(919); -exports.injectable = injectable_1.injectable; -var tagged_1 = __webpack_require__(148); -exports.tagged = tagged_1.tagged; -var named_1 = __webpack_require__(758); -exports.named = named_1.named; -var inject_1 = __webpack_require__(380); -exports.inject = inject_1.inject; -exports.LazyServiceIdentifer = inject_1.LazyServiceIdentifer; -var optional_1 = __webpack_require__(996); -exports.optional = optional_1.optional; -var unmanaged_1 = __webpack_require__(656); -exports.unmanaged = unmanaged_1.unmanaged; -var multi_inject_1 = __webpack_require__(891); -exports.multiInject = multi_inject_1.multiInject; -var target_name_1 = __webpack_require__(188); -exports.targetName = target_name_1.targetName; -var post_construct_1 = __webpack_require__(442); -exports.postConstruct = post_construct_1.postConstruct; -var metadata_reader_1 = __webpack_require__(202); -exports.MetadataReader = metadata_reader_1.MetadataReader; -var id_1 = __webpack_require__(786); -exports.id = id_1.id; -var decorator_utils_1 = __webpack_require__(289); -exports.decorate = decorator_utils_1.decorate; -var constraint_helpers_1 = __webpack_require__(599); -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__(571); -exports.getServiceIdentifierAsString = serialization_1.getServiceIdentifierAsString; -var binding_utils_1 = __webpack_require__(911); -exports.multiBindToService = binding_utils_1.multiBindToService; - - -/***/ }), - -/***/ 417: -/***/ (function(module) { - -module.exports = require("crypto"); - -/***/ }), - -/***/ 442: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERRORS_MSGS = __webpack_require__(516); -var METADATA_KEY = __webpack_require__(677); -var metadata_1 = __webpack_require__(173); -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; - - -/***/ }), - -/***/ 443: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -// -// Command Format: -// ##vso[artifact.command key=value;key=value]user message -// -// Examples: -// ##vso[task.progress value=58] -// ##vso[task.issue type=warning;]This is the user warning message -// -var CMD_PREFIX = '##vso['; -var TaskCommand = /** @class */ (function () { - function TaskCommand(command, properties, message) { - if (!command) { - command = 'missing.command'; - } - this.command = command; - this.properties = properties; - this.message = message; - } - TaskCommand.prototype.toString = function () { - var cmdStr = CMD_PREFIX + this.command; - if (this.properties && Object.keys(this.properties).length > 0) { - cmdStr += ' '; - for (var key in this.properties) { - if (this.properties.hasOwnProperty(key)) { - var val = this.properties[key]; - if (val) { - // safely append the val - avoid blowing up when attempting to - // call .replace() if message is not a string for some reason - cmdStr += key + '=' + escape('' + (val || '')) + ';'; - } - } - } - } - cmdStr += ']'; - // safely append the message - avoid blowing up when attempting to - // call .replace() if message is not a string for some reason - var message = '' + (this.message || ''); - cmdStr += escapedata(message); - return cmdStr; - }; - return TaskCommand; -}()); -exports.TaskCommand = TaskCommand; -function commandFromString(commandLine) { - var preLen = CMD_PREFIX.length; - var lbPos = commandLine.indexOf('['); - var rbPos = commandLine.indexOf(']'); - if (lbPos == -1 || rbPos == -1 || rbPos - lbPos < 3) { - throw new Error('Invalid command brackets'); - } - var cmdInfo = commandLine.substring(lbPos + 1, rbPos); - var spaceIdx = cmdInfo.indexOf(' '); - var command = cmdInfo; - var properties = {}; - if (spaceIdx > 0) { - command = cmdInfo.trim().substring(0, spaceIdx); - var propSection = cmdInfo.trim().substring(spaceIdx + 1); - var propLines = propSection.split(';'); - propLines.forEach(function (propLine) { - propLine = propLine.trim(); - if (propLine.length > 0) { - var eqIndex = propLine.indexOf('='); - if (eqIndex == -1) { - throw new Error('Invalid property: ' + propLine); - } - var key = propLine.substring(0, eqIndex); - var val = propLine.substring(eqIndex + 1); - properties[key] = unescape(val); - } - }); - } - var msg = unescapedata(commandLine.substring(rbPos + 1)); - var cmd = new TaskCommand(command, properties, msg); - return cmd; -} -exports.commandFromString = commandFromString; -function escapedata(s) { - return s.replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A'); -} -function unescapedata(s) { - return s.replace(/%0D/g, '\r') - .replace(/%0A/g, '\n') - .replace(/%25/g, '%'); -} -function escape(s) { - return s.replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A') - .replace(/]/g, '%5D') - .replace(/;/g, '%3B'); -} -function unescape(s) { - return s.replace(/%0D/g, '\r') - .replace(/%0A/g, '\n') - .replace(/%5D/g, ']') - .replace(/%3B/g, ';') - .replace(/%25/g, '%'); -} - - -/***/ }), - -/***/ 462: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var Plan = (function () { - function Plan(parentContext, rootRequest) { - this.parentContext = parentContext; - this.rootRequest = rootRequest; - } - return Plan; -}()); -exports.Plan = Plan; - - -/***/ }), - -/***/ 478: -/***/ (function(__unusedmodule, 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__(637); -var os = __webpack_require__(365); -var events = __webpack_require__(614); -var child = __webpack_require__(129); -var im = __webpack_require__(358); -var fs = __webpack_require__(747); -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)); - - -/***/ }), - -/***/ 490: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var common = __webpack_require__(164); - -//@ -//@ ### echo(string [,string ...]) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ echo('hello world'); -//@ var str = echo('hello world'); -//@ ``` -//@ -//@ Prints string to stdout, and returns string with additional utility methods -//@ like `.to()`. -function _echo() { - var messages = [].slice.call(arguments, 0); - console.log.apply(this, messages); - return common.ShellString(messages.join(' ')); -} -module.exports = _echo; - - -/***/ }), - -/***/ 502: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERROR_MSGS = __webpack_require__(516); -var literal_types_1 = __webpack_require__(186); -var exceptions_1 = __webpack_require__(355); -var serialization_1 = __webpack_require__(571); -var instantiation_1 = __webpack_require__(9); -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; - - -/***/ }), - -/***/ 516: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times."; -exports.DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:"; -exports.NULL_ARGUMENT = "NULL argument"; -exports.KEY_NOT_FOUND = "Key Not Found"; -exports.AMBIGUOUS_MATCH = "Ambiguous match found for serviceIdentifier:"; -exports.CANNOT_UNBIND = "Could not unbind serviceIdentifier:"; -exports.NOT_REGISTERED = "No matching bindings found for serviceIdentifier:"; -exports.MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:"; -exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:"; -exports.UNDEFINED_INJECT_ANNOTATION = function (name) { - return "@inject called with undefined this could mean that the class " + name + " has " + - "a circular dependency problem. You can use a LazyServiceIdentifer to " + - "overcome this limitation."; -}; -exports.CIRCULAR_DEPENDENCY = "Circular dependency found:"; -exports.NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet."; -exports.INVALID_BINDING_TYPE = "Invalid binding type:"; -exports.NO_MORE_SNAPSHOTS_AVAILABLE = "No snapshot available to restore."; -exports.INVALID_MIDDLEWARE_RETURN = "Invalid return type in middleware. Middleware must return!"; -exports.INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!"; -exports.INVALID_TO_SELF_VALUE = "The toSelf function can only be applied when a constructor is " + - "used as service identifier"; -exports.INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators " + - "must be applied to the parameters of a class constructor or a class property."; -exports.ARGUMENTS_LENGTH_MISMATCH = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return "The number of constructor arguments in the derived class " + - (values[0] + " must be >= than the number of constructor arguments of its base class."); -}; -exports.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = "Invalid Container constructor argument. Container options " + - "must be an object."; -exports.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = "Invalid Container option. Default scope must " + - "be a string ('singleton' or 'transient')."; -exports.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = "Invalid Container option. Auto bind injectable must " + - "be a boolean"; -exports.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = "Invalid Container option. Skip base check must " + - "be a boolean"; -exports.MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class"; -exports.POST_CONSTRUCT_ERROR = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return "@postConstruct error in class " + values[0] + ": " + values[1]; -}; -exports.CIRCULAR_DEPENDENCY_IN_FACTORY = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - return "It looks like there is a circular dependency " + - ("in one of the '" + values[0] + "' bindings. Please investigate bindings with") + - ("service identifier '" + values[1] + "'."); -}; -exports.STACK_OVERFLOW = "Maximum call stack size exceeded"; - - -/***/ }), - -/***/ 534: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var METADATA_KEY = __webpack_require__(677); -var id_1 = __webpack_require__(786); -var metadata_1 = __webpack_require__(173); -var queryable_string_1 = __webpack_require__(657); -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; - - -/***/ }), - -/***/ 538: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERROR_MSGS = __webpack_require__(516); -var literal_types_1 = __webpack_require__(186); -var binding_in_when_on_syntax_1 = __webpack_require__(226); -var binding_when_on_syntax_1 = __webpack_require__(179); -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; - - -/***/ }), - -/***/ 542: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var rng = __webpack_require__(95); -var bytesToUuid = __webpack_require__(722); - -function v4(options, buf, offset) { - var i = buf && offset || 0; - - if (typeof(options) == 'string') { - buf = options === 'binary' ? new Array(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || bytesToUuid(rnds); -} - -module.exports = v4; - - -/***/ }), - -/***/ 549: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const url = __webpack_require__(835); -const http = __webpack_require__(605); -const https = __webpack_require__(211); -let fs; -let tunnel; -var HttpCodes; -(function (HttpCodes) { - HttpCodes[HttpCodes["OK"] = 200] = "OK"; - HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; - HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; - HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; - HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; - HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; - HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; - HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; - HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; - HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; - HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; - HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; - HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; - HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; - HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; - HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; - HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; - HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; - HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; - HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; - HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; - HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; - HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; - HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; - HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; - HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; -})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); -const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; -const HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout]; -const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; -const ExponentialBackoffCeiling = 10; -const ExponentialBackoffTimeSlice = 5; -class HttpClientResponse { - constructor(message) { - this.message = message; - } - readBody() { - return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { - let output = ''; - this.message.on('data', (chunk) => { - output += chunk; - }); - this.message.on('end', () => { - resolve(output); - }); - })); - } -} -exports.HttpClientResponse = HttpClientResponse; -function isHttps(requestUrl) { - let parsedUrl = url.parse(requestUrl); - return parsedUrl.protocol === 'https:'; -} -exports.isHttps = isHttps; -var EnvironmentVariables; -(function (EnvironmentVariables) { - EnvironmentVariables["HTTP_PROXY"] = "HTTP_PROXY"; - EnvironmentVariables["HTTPS_PROXY"] = "HTTPS_PROXY"; -})(EnvironmentVariables || (EnvironmentVariables = {})); -class HttpClient { - constructor(userAgent, handlers, requestOptions) { - this._ignoreSslError = false; - this._allowRedirects = true; - this._maxRedirects = 50; - this._allowRetries = false; - this._maxRetries = 1; - this._keepAlive = false; - this._disposed = false; - this.userAgent = userAgent; - this.handlers = handlers || []; - this.requestOptions = requestOptions; - if (requestOptions) { - if (requestOptions.ignoreSslError != null) { - this._ignoreSslError = requestOptions.ignoreSslError; - } - this._socketTimeout = requestOptions.socketTimeout; - this._httpProxy = requestOptions.proxy; - if (requestOptions.proxy && requestOptions.proxy.proxyBypassHosts) { - this._httpProxyBypassHosts = []; - requestOptions.proxy.proxyBypassHosts.forEach(bypass => { - this._httpProxyBypassHosts.push(new RegExp(bypass, 'i')); - }); - } - this._certConfig = requestOptions.cert; - if (this._certConfig) { - // If using cert, need fs - fs = __webpack_require__(747); - // cache the cert content into memory, so we don't have to read it from disk every time - if (this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) { - this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8'); - } - if (this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) { - this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8'); - } - if (this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) { - this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8'); - } - } - if (requestOptions.allowRedirects != null) { - this._allowRedirects = requestOptions.allowRedirects; - } - if (requestOptions.maxRedirects != null) { - this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); - } - if (requestOptions.keepAlive != null) { - this._keepAlive = requestOptions.keepAlive; - } - if (requestOptions.allowRetries != null) { - this._allowRetries = requestOptions.allowRetries; - } - if (requestOptions.maxRetries != null) { - this._maxRetries = requestOptions.maxRetries; - } - } - } - options(requestUrl, additionalHeaders) { - return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); - } - get(requestUrl, additionalHeaders) { - return this.request('GET', requestUrl, null, additionalHeaders || {}); - } - del(requestUrl, additionalHeaders) { - return this.request('DELETE', requestUrl, null, additionalHeaders || {}); - } - post(requestUrl, data, additionalHeaders) { - return this.request('POST', requestUrl, data, additionalHeaders || {}); - } - patch(requestUrl, data, additionalHeaders) { - return this.request('PATCH', requestUrl, data, additionalHeaders || {}); - } - put(requestUrl, data, additionalHeaders) { - return this.request('PUT', requestUrl, data, additionalHeaders || {}); - } - head(requestUrl, additionalHeaders) { - return this.request('HEAD', requestUrl, null, additionalHeaders || {}); - } - sendStream(verb, requestUrl, stream, additionalHeaders) { - return this.request(verb, requestUrl, stream, additionalHeaders); - } - /** - * Makes a raw http request. - * All other methods such as get, post, patch, and request ultimately call this. - * Prefer get, del, post and patch - */ - request(verb, requestUrl, data, headers) { - return __awaiter(this, void 0, void 0, function* () { - if (this._disposed) { - throw new Error("Client has already been disposed."); - } - let info = this._prepareRequest(verb, requestUrl, headers); - // Only perform retries on reads since writes may not be idempotent. - let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1; - let numTries = 0; - let response; - while (numTries < maxTries) { - response = yield this.requestRaw(info, data); - // Check if it's an authentication challenge - if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { - let authenticationHandler; - for (let i = 0; i < this.handlers.length; i++) { - if (this.handlers[i].canHandleAuthentication(response)) { - authenticationHandler = this.handlers[i]; - break; - } - } - if (authenticationHandler) { - return authenticationHandler.handleAuthentication(this, info, data); - } - else { - // We have received an unauthorized response but have no handlers to handle it. - // Let the response return to the caller. - return response; - } - } - let redirectsRemaining = this._maxRedirects; - while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 - && this._allowRedirects - && redirectsRemaining > 0) { - const redirectUrl = response.message.headers["location"]; - if (!redirectUrl) { - // if there's no location to redirect to, we won't - break; - } - // we need to finish reading the response before reassigning response - // which will leak the open socket. - yield response.readBody(); - // let's make the request with the new redirectUrl - info = this._prepareRequest(verb, redirectUrl, headers); - response = yield this.requestRaw(info, data); - redirectsRemaining--; - } - if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { - // If not a retry code, return immediately instead of retrying - return response; - } - numTries += 1; - if (numTries < maxTries) { - yield response.readBody(); - yield this._performExponentialBackoff(numTries); - } - } - return response; - }); - } - /** - * Needs to be called if keepAlive is set to true in request options. - */ - dispose() { - if (this._agent) { - this._agent.destroy(); - } - this._disposed = true; - } - /** - * Raw request. - * @param info - * @param data - */ - requestRaw(info, data) { - return new Promise((resolve, reject) => { - let callbackForResult = function (err, res) { - if (err) { - reject(err); - } - resolve(res); - }; - this.requestRawWithCallback(info, data, callbackForResult); - }); - } - /** - * Raw request with callback. - * @param info - * @param data - * @param onResult - */ - requestRawWithCallback(info, data, onResult) { - let socket; - let isDataString = typeof (data) === 'string'; - if (typeof (data) === 'string') { - info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8'); - } - let callbackCalled = false; - let handleResult = (err, res) => { - if (!callbackCalled) { - callbackCalled = true; - onResult(err, res); - } - }; - let req = info.httpModule.request(info.options, (msg) => { - let res = new HttpClientResponse(msg); - handleResult(null, res); - }); - req.on('socket', (sock) => { - socket = sock; - }); - // If we ever get disconnected, we want the socket to timeout eventually - req.setTimeout(this._socketTimeout || 3 * 60000, () => { - if (socket) { - socket.end(); - } - handleResult(new Error('Request timeout: ' + info.options.path), null); - }); - req.on('error', function (err) { - // err has statusCode property - // res should have headers - handleResult(err, null); - }); - if (data && typeof (data) === 'string') { - req.write(data, 'utf8'); - } - if (data && typeof (data) !== 'string') { - data.on('close', function () { - req.end(); - }); - data.pipe(req); - } - else { - req.end(); - } - } - _prepareRequest(method, requestUrl, headers) { - const info = {}; - info.parsedUrl = url.parse(requestUrl); - const usingSsl = info.parsedUrl.protocol === 'https:'; - info.httpModule = usingSsl ? https : http; - const defaultPort = usingSsl ? 443 : 80; - info.options = {}; - info.options.host = info.parsedUrl.hostname; - info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; - info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); - info.options.method = method; - info.options.headers = this._mergeHeaders(headers); - info.options.headers["user-agent"] = this.userAgent; - info.options.agent = this._getAgent(requestUrl); - // gives handlers an opportunity to participate - if (this.handlers && !this._isPresigned(requestUrl)) { - this.handlers.forEach((handler) => { - handler.prepareRequest(info.options); - }); - } - return info; - } - _isPresigned(requestUrl) { - if (this.requestOptions && this.requestOptions.presignedUrlPatterns) { - const patterns = this.requestOptions.presignedUrlPatterns; - for (let i = 0; i < patterns.length; i++) { - if (requestUrl.match(patterns[i])) { - return true; - } - } - } - return false; - } - _mergeHeaders(headers) { - const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); - if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); - } - return lowercaseKeys(headers || {}); - } - _getAgent(requestUrl) { - let agent; - let proxy = this._getProxy(requestUrl); - let useProxy = proxy.proxyUrl && proxy.proxyUrl.hostname && !this._isBypassProxy(requestUrl); - if (this._keepAlive && useProxy) { - agent = this._proxyAgent; - } - if (this._keepAlive && !useProxy) { - agent = this._agent; - } - // if agent is already assigned use that agent. - if (!!agent) { - return agent; - } - let parsedUrl = url.parse(requestUrl); - const usingSsl = parsedUrl.protocol === 'https:'; - let maxSockets = 100; - if (!!this.requestOptions) { - maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; - } - if (useProxy) { - // If using proxy, need tunnel - if (!tunnel) { - tunnel = __webpack_require__(212); - } - const agentOptions = { - maxSockets: maxSockets, - keepAlive: this._keepAlive, - proxy: { - proxyAuth: proxy.proxyAuth, - host: proxy.proxyUrl.hostname, - port: proxy.proxyUrl.port - }, - }; - let tunnelAgent; - const overHttps = proxy.proxyUrl.protocol === 'https:'; - if (usingSsl) { - tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; - } - else { - tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; - } - agent = tunnelAgent(agentOptions); - this._proxyAgent = agent; - } - // if reusing agent across request and tunneling agent isn't assigned create a new agent - if (this._keepAlive && !agent) { - const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; - agent = usingSsl ? new https.Agent(options) : new http.Agent(options); - this._agent = agent; - } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } - if (usingSsl && this._ignoreSslError) { - // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process - // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options - // we have to cast it to any and change it directly - agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); - } - if (usingSsl && this._certConfig) { - agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase }); - } - return agent; - } - _getProxy(requestUrl) { - const parsedUrl = url.parse(requestUrl); - let usingSsl = parsedUrl.protocol === 'https:'; - let proxyConfig = this._httpProxy; - // fallback to http_proxy and https_proxy env - let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY]; - let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY]; - if (!proxyConfig) { - if (https_proxy && usingSsl) { - proxyConfig = { - proxyUrl: https_proxy - }; - } - else if (http_proxy) { - proxyConfig = { - proxyUrl: http_proxy - }; - } - } - let proxyUrl; - let proxyAuth; - if (proxyConfig) { - if (proxyConfig.proxyUrl.length > 0) { - proxyUrl = url.parse(proxyConfig.proxyUrl); - } - if (proxyConfig.proxyUsername || proxyConfig.proxyPassword) { - proxyAuth = proxyConfig.proxyUsername + ":" + proxyConfig.proxyPassword; - } - } - return { proxyUrl: proxyUrl, proxyAuth: proxyAuth }; - } - _isBypassProxy(requestUrl) { - if (!this._httpProxyBypassHosts) { - return false; - } - let bypass = false; - this._httpProxyBypassHosts.forEach(bypassHost => { - if (bypassHost.test(requestUrl)) { - bypass = true; - } - }); - return bypass; - } - _performExponentialBackoff(retryNumber) { - retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); - const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); - return new Promise(resolve => setTimeout(() => resolve(), ms)); - } -} -exports.HttpClient = HttpClient; - - -/***/ }), - -/***/ 571: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var ERROR_MSGS = __webpack_require__(516); -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; - - -/***/ }), - -/***/ 599: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var METADATA_KEY = __webpack_require__(677); -var metadata_1 = __webpack_require__(173); -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; - - -/***/ }), - -/***/ 605: -/***/ (function(module) { - -module.exports = require("http"); - -/***/ }), - -/***/ 614: -/***/ (function(module) { - -module.exports = require("events"); - -/***/ }), - -/***/ 622: -/***/ (function(module) { - -module.exports = require("path"); - -/***/ }), - -/***/ 631: -/***/ (function(module) { - -module.exports = require("net"); - -/***/ }), - -/***/ 637: -/***/ (function(module) { - -// vim:ts=4:sts=4:sw=4: -/*! - * - * Copyright 2009-2017 Kris Kowal under the terms of the MIT - * license found at https://github.com/kriskowal/q/blob/v1/LICENSE - * - * With parts by Tyler Close - * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found - * at http://www.opensource.org/licenses/mit-license.html - * Forked at ref_send.js version: 2009-05-11 - * - * With parts by Mark Miller - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -(function (definition) { - "use strict"; - - // This file will function properly as a