From 7ba4481660f0f04c86cfa5f1f24b90effc97bde1 Mon Sep 17 00:00:00 2001 From: luca <681992+lukka@users.noreply.github.com> Date: Wed, 21 Apr 2021 23:26:30 -0700 Subject: [PATCH] consume v1.0.25 --- dist/index.js | 18946 ++++++++++++++++++++++---------------------- package-lock.json | 351 +- package.json | 8 +- 3 files changed, 9754 insertions(+), 9551 deletions(-) diff --git a/dist/index.js b/dist/index.js index c1a47a1..a6c85f7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -396,172 +396,11 @@ exports.default = Provider; /***/ }), -/***/ 11: -/***/ (function(module) { - -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) - - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') - - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) - - return wrapper - - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret - } -} - - -/***/ }), - -/***/ 42: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const merge2 = __webpack_require__(538); -function merge(streams) { - const mergedStream = merge2(streams); - streams.forEach((stream) => { - stream.once('error', (error) => mergedStream.emit('error', error)); - }); - mergedStream.once('close', () => propagateCloseEventToSources(streams)); - mergedStream.once('end', () => propagateCloseEventToSources(streams)); - return mergedStream; -} -exports.merge = merge; -function propagateCloseEventToSources(streams) { - streams.forEach((stream) => stream.emit('close')); -} - - -/***/ }), - -/***/ 43: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); -} -exports.createDirentFromStats = createDirentFromStats; - - -/***/ }), - -/***/ 49: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var wrappy = __webpack_require__(11) -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) - - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} - -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} - - -/***/ }), - -/***/ 72: +/***/ 9: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -// Copyright (c) 2019-2020-2021 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; 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) { @@ -571,5709 +410,4675 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.NinjaProvider = void 0; +const os = __importStar(__webpack_require__(87)); +const events = __importStar(__webpack_require__(614)); +const child = __importStar(__webpack_require__(129)); const path = __importStar(__webpack_require__(622)); -const BaseUtilLib = __importStar(__webpack_require__(758)); -class NinjaProvider { - constructor(baseLib) { - this.baseLib = baseLib; - this.baseUtils = new BaseUtilLib.BaseUtilLib(baseLib); +const io = __importStar(__webpack_require__(1)); +const ioUtil = __importStar(__webpack_require__(672)); +/* eslint-disable @typescript-eslint/unbound-method */ +const IS_WINDOWS = process.platform === 'win32'; +/* + * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. + */ +class ToolRunner extends events.EventEmitter { + constructor(toolPath, args, options) { + super(); + if (!toolPath) { + throw new Error("Parameter 'toolPath' cannot be null or empty."); + } + this.toolPath = toolPath; + this.args = args || []; + this.options = options || {}; } - download(url) { - return __awaiter(this, void 0, void 0, function* () { - if (!url) { - if (this.baseUtils.isLinux()) { - url = `${NinjaProvider.baseUrl}/ninja-linux.zip`; - } - else if (this.baseUtils.isDarwin()) { - url = `${NinjaProvider.baseUrl}/ninja-mac.zip`; + _debug(message) { + if (this.options.listeners && this.options.listeners.debug) { + this.options.listeners.debug(message); + } + } + _getCommandString(options, noPrefix) { + const toolPath = this._getSpawnFileName(); + const args = this._getSpawnArgs(options); + let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool + if (IS_WINDOWS) { + // Windows + cmd file + if (this._isCmdFile()) { + cmd += toolPath; + for (const a of args) { + cmd += ` ${a}`; } - else if (this.baseUtils.isWin32()) { - url = `${NinjaProvider.baseUrl}/ninja-win.zip`; + } + // Windows + verbatim + else if (options.windowsVerbatimArguments) { + cmd += `"${toolPath}"`; + for (const a of args) { + cmd += ` ${a}`; } } - // Create the name of the executable, i.e. ninja or ninja.exe . - let ninjaExeName = 'ninja'; - if (this.baseUtils.isWin32()) { - ninjaExeName += ".exe"; + // Windows (regular) + else { + cmd += this._windowsQuoteCmdArg(toolPath); + for (const a of args) { + cmd += ` ${this._windowsQuoteCmdArg(a)}`; + } } - const ninjaPath = yield this.baseUtils.downloadArchive(url); - const ninjaFullPath = path.join(ninjaPath, ninjaExeName); - if (this.baseUtils.isLinux() || this.baseUtils.isDarwin()) { - yield this.baseLib.exec('chmod', ['+x', ninjaFullPath]); + } + 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; + for (const a of args) { + cmd += ` ${a}`; } - return ninjaFullPath; - }); + } + return cmd; } - findNinjaTool() { - return __awaiter(this, void 0, void 0, function* () { - const ninjaPath = yield this.baseLib.which('ninja', false); - return ninjaPath; - }); - } - ; - /** - * Retrieve the path to 'ninja' executable. If the provided path to ninja is no existent - * it will download the ninja archive from the provided one, if the latter not provided from - * the default URL for ths host platform. - * @param {(string | undefined)} ninjaPath Optional path to ninja executable. - * @param {string} ninjaDownloadUrl Optional URL to download ninja from. - * @returns {Promise} The full path to the ninja executable. - * @memberof NinjaDownloader - */ - retrieveNinjaPath(ninjaPath, ninjaDownloadUrl) { - return __awaiter(this, void 0, void 0, function* () { - if (!ninjaPath) { - this.baseLib.debug("Path to ninja executable has not been explicitly specified on the task. Searching for it now..."); - ninjaPath = yield this.findNinjaTool(); - if (!ninjaPath) { - this.baseLib.debug("Cannot find Ninja in PATH environment variable."); - ninjaPath = - yield this.download(ninjaDownloadUrl); - if (!ninjaPath) { - throw new Error("Cannot find nor download Ninja."); - } - } + _processLineBuffer(data, strBuffer, onLine) { + try { + let s = strBuffer + data.toString(); + let n = s.indexOf(os.EOL); + while (n > -1) { + const line = s.substring(0, n); + onLine(line); + // the rest of the string ... + s = s.substring(n + os.EOL.length); + n = s.indexOf(os.EOL); } - this.baseLib.debug(`Returning ninja at: ${ninjaPath}`); - return ninjaPath; - }); - } -} -exports.NinjaProvider = NinjaProvider; -NinjaProvider.baseUrl = 'https://github.com/ninja-build/ninja/releases/download/v1.10.1'; -//# sourceMappingURL=ninja.js.map - -/***/ }), - -/***/ 74: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -const util = __webpack_require__(669); -const braces = __webpack_require__(783); -const picomatch = __webpack_require__(827); -const utils = __webpack_require__(265); -const isEmptyString = val => typeof val === 'string' && (val === '' || val === './'); - -/** - * Returns an array of strings that match one or more glob patterns. - * - * ```js - * const mm = require('micromatch'); - * // mm(list, patterns[, options]); - * - * console.log(mm(['a.js', 'a.txt'], ['*.js'])); - * //=> [ 'a.js' ] - * ``` - * @param {String|Array} list List of strings to match. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} options See available [options](#options) - * @return {Array} Returns an array of matches - * @summary false - * @api public - */ - -const micromatch = (list, patterns, options) => { - patterns = [].concat(patterns); - list = [].concat(list); - - let omit = new Set(); - let keep = new Set(); - let items = new Set(); - let negatives = 0; - - let onResult = state => { - items.add(state.output); - if (options && options.onResult) { - options.onResult(state); + strBuffer = s; + } + catch (err) { + // streaming lines to console is best effort. Don't fail a build. + this._debug(`error processing line. Failed with error ${err}`); + } } - }; - - for (let i = 0; i < patterns.length; i++) { - let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); - let negated = isMatch.state.negated || isMatch.state.negatedExtglob; - if (negated) negatives++; - - for (let item of list) { - let matched = isMatch(item, true); - - let match = negated ? !matched.isMatch : matched.isMatch; - if (!match) continue; - - if (negated) { - omit.add(matched.output); - } else { - omit.delete(matched.output); - keep.add(matched.output); - } + _getSpawnFileName() { + if (IS_WINDOWS) { + if (this._isCmdFile()) { + return process.env['COMSPEC'] || 'cmd.exe'; + } + } + return this.toolPath; } - } - - let result = negatives === patterns.length ? [...items] : [...keep]; - let matches = result.filter(item => !omit.has(item)); - - if (options && matches.length === 0) { - if (options.failglob === true) { - throw new Error(`No matches found for "${patterns.join(', ')}"`); + _getSpawnArgs(options) { + if (IS_WINDOWS) { + if (this._isCmdFile()) { + let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; + for (const a of this.args) { + argline += ' '; + argline += options.windowsVerbatimArguments + ? a + : this._windowsQuoteCmdArg(a); + } + argline += '"'; + return [argline]; + } + } + return this.args; } - - if (options.nonull === true || options.nullglob === true) { - return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; + _endsWith(str, end) { + return str.endsWith(end); } - } - - return matches; -}; - -/** - * Backwards compatibility - */ - -micromatch.match = micromatch; - -/** - * Returns a matcher function from the given glob `pattern` and `options`. - * The returned function takes a string to match as its only argument and returns - * true if the string is a match. - * - * ```js - * const mm = require('micromatch'); - * // mm.matcher(pattern[, options]); - * - * const isMatch = mm.matcher('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @param {String} `pattern` Glob pattern - * @param {Object} `options` - * @return {Function} Returns a matcher function. - * @api public - */ - -micromatch.matcher = (pattern, options) => picomatch(pattern, options); - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const mm = require('micromatch'); - * // mm.isMatch(string, patterns[, options]); - * - * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(mm.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Backwards compatibility - */ - -micromatch.any = micromatch.isMatch; - -/** - * Returns a list of strings that _**do not match any**_ of the given `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.not(list, patterns[, options]); - * - * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); - * //=> ['b.b', 'c.c'] - * ``` - * @param {Array} `list` Array of strings to match. - * @param {String|Array} `patterns` One or more glob pattern to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Array} Returns an array of strings that **do not match** the given patterns. - * @api public - */ - -micromatch.not = (list, patterns, options = {}) => { - patterns = [].concat(patterns).map(String); - let result = new Set(); - let items = []; - - let onResult = state => { - if (options.onResult) options.onResult(state); - items.push(state.output); - }; - - let matches = micromatch(list, patterns, { ...options, onResult }); - - for (let item of items) { - if (!matches.includes(item)) { - result.add(item); + _isCmdFile() { + const upperToolPath = this.toolPath.toUpperCase(); + return (this._endsWith(upperToolPath, '.CMD') || + this._endsWith(upperToolPath, '.BAT')); } - } - return [...result]; -}; - -/** - * Returns true if the given `string` contains the given pattern. Similar - * to [.isMatch](#isMatch) but the pattern can match any part of the string. - * - * ```js - * var mm = require('micromatch'); - * // mm.contains(string, pattern[, options]); - * - * console.log(mm.contains('aa/bb/cc', '*b')); - * //=> true - * console.log(mm.contains('aa/bb/cc', '*d')); - * //=> false - * ``` - * @param {String} `str` The string to match. - * @param {String|Array} `patterns` Glob pattern to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if the patter matches any part of `str`. - * @api public - */ - -micromatch.contains = (str, pattern, options) => { - if (typeof str !== 'string') { - throw new TypeError(`Expected a string: "${util.inspect(str)}"`); - } - - if (Array.isArray(pattern)) { - return pattern.some(p => micromatch.contains(str, p, options)); - } - - if (typeof pattern === 'string') { - if (isEmptyString(str) || isEmptyString(pattern)) { - return false; + _windowsQuoteCmdArg(arg) { + // for .exe, apply the normal quoting rules that libuv applies + if (!this._isCmdFile()) { + return this._uvQuoteCmdArg(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 + const cmdSpecialChars = [ + ' ', + '\t', + '&', + '(', + ')', + '[', + ']', + '{', + '}', + '^', + '=', + ';', + '!', + "'", + '+', + ',', + '`', + '~', + '|', + '<', + '>', + '"' + ]; + let needsQuotes = false; + for (const char of arg) { + if (cmdSpecialChars.some(x => x === char)) { + needsQuotes = true; + 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 precede 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. + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { + // walk the string in reverse + reverse += arg[i - 1]; + if (quoteHit && arg[i - 1] === '\\') { + reverse += '\\'; // double the slash + } + else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += '"'; // double the quote + } + else { + quoteHit = false; + } + } + reverse += '"'; + return reverse + .split('') + .reverse() + .join(''); } - - if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) { - return true; + _uvQuoteCmdArg(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.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { + // No quotation needed + return arg; + } + if (!arg.includes('"') && !arg.includes('\\')) { + // 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\\" + let reverse = '"'; + let quoteHit = true; + for (let i = arg.length; i > 0; i--) { + // walk the string in reverse + reverse += arg[i - 1]; + if (quoteHit && arg[i - 1] === '\\') { + reverse += '\\'; + } + else if (arg[i - 1] === '"') { + quoteHit = true; + reverse += '\\'; + } + else { + quoteHit = false; + } + } + reverse += '"'; + return reverse + .split('') + .reverse() + .join(''); } - } - - return micromatch.isMatch(str, pattern, { ...options, contains: true }); -}; - -/** - * Filter the keys of the given object with the given `glob` pattern - * and `options`. Does not attempt to match nested keys. If you need this feature, - * use [glob-object][] instead. - * - * ```js - * const mm = require('micromatch'); - * // mm.matchKeys(object, patterns[, options]); - * - * const obj = { aa: 'a', ab: 'b', ac: 'c' }; - * console.log(mm.matchKeys(obj, '*b')); - * //=> { ab: 'b' } - * ``` - * @param {Object} `object` The object with keys to filter. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Object} Returns an object with only keys that match the given patterns. - * @api public - */ - -micromatch.matchKeys = (obj, patterns, options) => { - if (!utils.isObject(obj)) { - throw new TypeError('Expected the first argument to be an object'); - } - let keys = micromatch(Object.keys(obj), patterns, options); - let res = {}; - for (let key of keys) res[key] = obj[key]; - return res; -}; - -/** - * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.some(list, patterns[, options]); - * - * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); - * // true - * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); - * // false - * ``` - * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -micromatch.some = (list, patterns, options) => { - let items = [].concat(list); - - for (let pattern of [].concat(patterns)) { - let isMatch = picomatch(String(pattern), options); - if (items.some(item => isMatch(item))) { - return true; + _cloneExecOptions(options) { + options = options || {}; + const result = { + cwd: options.cwd || process.cwd(), + env: options.env || process.env, + silent: options.silent || false, + windowsVerbatimArguments: options.windowsVerbatimArguments || false, + failOnStdErr: options.failOnStdErr || false, + ignoreReturnCode: options.ignoreReturnCode || false, + delay: options.delay || 10000 + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; } - } - return false; -}; - -/** - * Returns true if every string in the given `list` matches - * any of the given glob `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.every(list, patterns[, options]); - * - * console.log(mm.every('foo.js', ['foo.js'])); - * // true - * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); - * // true - * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); - * // false - * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); - * // false - * ``` - * @param {String|Array} `list` The string or array of strings to test. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -micromatch.every = (list, patterns, options) => { - let items = [].concat(list); - - for (let pattern of [].concat(patterns)) { - let isMatch = picomatch(String(pattern), options); - if (!items.every(item => isMatch(item))) { - return false; + _getSpawnOptions(options, toolPath) { + options = options || {}; + const result = {}; + result.cwd = options.cwd; + result.env = options.env; + result['windowsVerbatimArguments'] = + options.windowsVerbatimArguments || this._isCmdFile(); + if (options.windowsVerbatimArguments) { + result.argv0 = `"${toolPath}"`; + } + return result; } - } - return true; -}; - + /** + * 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 ExecOptions + * @returns number + */ + exec() { + return __awaiter(this, void 0, void 0, function* () { + // root the tool path if it is unrooted and contains relative pathing + if (!ioUtil.isRooted(this.toolPath) && + (this.toolPath.includes('/') || + (IS_WINDOWS && this.toolPath.includes('\\')))) { + // prefer options.cwd if it is specified, however options.cwd may also need to be rooted + this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); + } + // if the tool is only a file name, then resolve it from the PATH + // otherwise verify it exists (add extension on Windows if necessary) + this.toolPath = yield io.which(this.toolPath, true); + return new Promise((resolve, reject) => { + this._debug(`exec tool: ${this.toolPath}`); + this._debug('arguments:'); + for (const arg of this.args) { + this._debug(` ${arg}`); + } + const optionsNonNull = this._cloneExecOptions(this.options); + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + } + const state = new ExecState(optionsNonNull, this.toolPath); + state.on('debug', (message) => { + this._debug(message); + }); + const fileName = this._getSpawnFileName(); + const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); + const stdbuffer = ''; + if (cp.stdout) { + cp.stdout.on('data', (data) => { + if (this.options.listeners && this.options.listeners.stdout) { + this.options.listeners.stdout(data); + } + if (!optionsNonNull.silent && optionsNonNull.outStream) { + optionsNonNull.outStream.write(data); + } + this._processLineBuffer(data, stdbuffer, (line) => { + if (this.options.listeners && this.options.listeners.stdline) { + this.options.listeners.stdline(line); + } + }); + }); + } + const errbuffer = ''; + if (cp.stderr) { + cp.stderr.on('data', (data) => { + state.processStderr = true; + if (this.options.listeners && this.options.listeners.stderr) { + this.options.listeners.stderr(data); + } + if (!optionsNonNull.silent && + optionsNonNull.errStream && + optionsNonNull.outStream) { + const s = optionsNonNull.failOnStdErr + ? optionsNonNull.errStream + : optionsNonNull.outStream; + s.write(data); + } + this._processLineBuffer(data, errbuffer, (line) => { + if (this.options.listeners && this.options.listeners.errline) { + this.options.listeners.errline(line); + } + }); + }); + } + cp.on('error', (err) => { + state.processError = err.message; + state.processExited = true; + state.processClosed = true; + state.CheckComplete(); + }); + cp.on('exit', (code) => { + state.processExitCode = code; + state.processExited = true; + this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); + state.CheckComplete(); + }); + cp.on('close', (code) => { + state.processExitCode = code; + state.processExited = true; + state.processClosed = true; + this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); + state.CheckComplete(); + }); + state.on('done', (error, exitCode) => { + if (stdbuffer.length > 0) { + this.emit('stdline', stdbuffer); + } + if (errbuffer.length > 0) { + this.emit('errline', errbuffer); + } + cp.removeAllListeners(); + if (error) { + reject(error); + } + else { + resolve(exitCode); + } + }); + if (this.options.input) { + if (!cp.stdin) { + throw new Error('child process missing stdin'); + } + cp.stdin.end(this.options.input); + } + }); + }); + } +} +exports.ToolRunner = ToolRunner; /** - * Returns true if **all** of the given `patterns` match - * the specified string. - * - * ```js - * const mm = require('micromatch'); - * // mm.all(string, patterns[, options]); - * - * console.log(mm.all('foo.js', ['foo.js'])); - * // true - * - * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); - * // false - * - * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); - * // true + * Convert an arg string to an array of args. Handles escaping * - * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); - * // true - * ``` - * @param {String|Array} `str` The string to test. - * @param {String|Array} `patterns` One or more glob patterns to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns true if any patterns match `str` - * @api public + * @param argString string of arguments + * @returns string[] array of arguments */ +function argStringToArray(argString) { + const args = []; + let inQuotes = false; + let escaped = false; + let arg = ''; + function append(c) { + // we only escape double quotes. + if (escaped && c !== '"') { + arg += '\\'; + } + arg += c; + escaped = false; + } + for (let i = 0; i < argString.length; i++) { + const c = argString.charAt(i); + if (c === '"') { + if (!escaped) { + inQuotes = !inQuotes; + } + else { + append(c); + } + continue; + } + if (c === '\\' && escaped) { + append(c); + continue; + } + if (c === '\\' && inQuotes) { + escaped = true; + continue; + } + if (c === ' ' && !inQuotes) { + if (arg.length > 0) { + args.push(arg); + arg = ''; + } + continue; + } + append(c); + } + if (arg.length > 0) { + args.push(arg.trim()); + } + return args; +} +exports.argStringToArray = argStringToArray; +class ExecState extends events.EventEmitter { + constructor(options, toolPath) { + super(); + this.processClosed = false; // tracks whether the process has exited and stdio is closed + this.processError = ''; + this.processExitCode = 0; + this.processExited = false; // tracks whether the process has exited + this.processStderr = false; // tracks whether stderr was written to + this.delay = 10000; // 10 seconds + this.done = false; + this.timeout = null; + if (!toolPath) { + throw new Error('toolPath must not be empty'); + } + this.options = options; + this.toolPath = toolPath; + if (options.delay) { + this.delay = options.delay; + } + } + CheckComplete() { + if (this.done) { + return; + } + if (this.processClosed) { + this._setResult(); + } + else if (this.processExited) { + this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this); + } + } + _debug(message) { + this.emit('debug', message); + } + _setResult() { + // determine whether there is an error + let error; + if (this.processExited) { + if (this.processError) { + error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); + } + else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { + error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); + } + else if (this.processStderr && this.options.failOnStdErr) { + error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); + } + } + // clear the timeout + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = null; + } + this.done = true; + this.emit('done', error, this.processExitCode); + } + static HandleTimeout(state) { + if (state.done) { + return; + } + if (!state.processClosed && state.processExited) { + const message = `The STDIO streams did not close within ${state.delay / + 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; + state._debug(message); + } + state._setResult(); + } +} +//# sourceMappingURL=toolrunner.js.map -micromatch.all = (str, patterns, options) => { - if (typeof str !== 'string') { - throw new TypeError(`Expected a string: "${util.inspect(str)}"`); - } - - return [].concat(patterns).every(p => picomatch(p, options)(str)); -}; - -/** - * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. - * - * ```js - * const mm = require('micromatch'); - * // mm.capture(pattern, string[, options]); - * - * console.log(mm.capture('test/*.js', 'test/foo.js')); - * //=> ['foo'] - * console.log(mm.capture('test/*.js', 'foo/bar.css')); - * //=> null - * ``` - * @param {String} `glob` Glob pattern to use for matching. - * @param {String} `input` String to match - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Boolean} Returns an array of captures if the input matches the glob pattern, otherwise `null`. - * @api public - */ - -micromatch.capture = (glob, input, options) => { - let posix = utils.isWindows(options); - let regex = picomatch.makeRe(String(glob), { ...options, capture: true }); - let match = regex.exec(posix ? utils.toPosixSlashes(input) : input); - - if (match) { - return match.slice(1).map(v => v === void 0 ? '' : v); - } -}; +/***/ }), -/** - * Create a regular expression from the given glob `pattern`. - * - * ```js - * const mm = require('micromatch'); - * // mm.makeRe(pattern[, options]); - * - * console.log(mm.makeRe('*.js')); - * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ - * ``` - * @param {String} `pattern` A glob pattern to convert to regex. - * @param {Object} `options` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ +/***/ 11: +/***/ (function(module) { -micromatch.makeRe = (...args) => picomatch.makeRe(...args); +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) -/** - * Scan a glob pattern to separate the pattern into segments. Used - * by the [split](#split) method. - * - * ```js - * const mm = require('micromatch'); - * const state = mm.scan(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') -micromatch.scan = (...args) => picomatch.scan(...args); + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const mm = require('micromatch'); - * const state = mm(pattern[, options]); - * ``` - * @param {String} `glob` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as regex source string. - * @api public - */ + return wrapper -micromatch.parse = (patterns, options) => { - let res = []; - for (let pattern of [].concat(patterns || [])) { - for (let str of braces(String(pattern), options)) { - res.push(picomatch.parse(str, options)); + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret } - return res; -}; - -/** - * Process the given brace `pattern`. - * - * ```js - * const { braces } = require('micromatch'); - * console.log(braces('foo/{a,b,c}/bar')); - * //=> [ 'foo/(a|b|c)/bar' ] - * - * console.log(braces('foo/{a,b,c}/bar', { expand: true })); - * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] - * ``` - * @param {String} `pattern` String with brace pattern to process. - * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. - * @return {Array} - * @api public - */ - -micromatch.braces = (pattern, options) => { - if (typeof pattern !== 'string') throw new TypeError('Expected a string'); - if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) { - return [pattern]; - } - return braces(pattern, options); -}; - -/** - * Expand braces - */ - -micromatch.braceExpand = (pattern, options) => { - if (typeof pattern !== 'string') throw new TypeError('Expected a string'); - return micromatch.braces(pattern, { ...options, expand: true }); -}; - -/** - * Expose micromatch - */ - -module.exports = micromatch; +} /***/ }), -/***/ 78: +/***/ 42: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const sync_1 = __webpack_require__(519); -const provider_1 = __webpack_require__(2); -class ProviderSync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new sync_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = this.api(root, task, options); - return entries.map(options.transform); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } +const merge2 = __webpack_require__(538); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; +} +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); } -exports.default = ProviderSync; /***/ }), -/***/ 81: -/***/ (function(module, exports, __webpack_require__) { +/***/ 43: +/***/ (function(__unusedmodule, exports) { "use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; -/** - * Module dependencies. - */ -var tty = __webpack_require__(867); - -var util = __webpack_require__(669); -/** - * This is the Node.js implementation of `debug()`. - */ - - -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - var supportsColor = __webpack_require__(247); - - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; - } -} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. - -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ - - -exports.inspectOpts = Object.keys(process.env).filter(function (key) { - return /^debug_/i.test(key); -}).reduce(function (obj, key) { - // Camel-case - var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { - return k.toUpperCase(); - }); // Coerce string value into JS value - - var val = process.env[key]; - - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } - - obj[prop] = val; - return obj; -}, {}); -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); -} -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - - -function formatArgs(args) { - var name = this.namespace, - useColors = this.useColors; - - if (useColors) { - var c = this.color; - var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); - var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } +/***/ }), - return new Date().toISOString() + ' '; -} -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ +/***/ 49: +/***/ (function(module, __unusedexports, __webpack_require__) { +var wrappy = __webpack_require__(11) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) -function log() { - return process.stderr.write(util.format.apply(util, arguments) + '\n'); -} -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) } + f.called = false + return f } -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - -function load() { - return process.env.DEBUG; -} -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ - - -function init(debug) { - debug.inspectOpts = {}; - var keys = Object.keys(exports.inspectOpts); - for (var i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f } -module.exports = __webpack_require__(486)(exports); -var formatters = module.exports.formatters; -/** - * Map %o to `util.inspect()`, all on a single line. - */ - -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' '); -}; -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ - - -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; - - /***/ }), -/***/ 82: -/***/ (function(__unusedmodule, exports) { +/***/ 72: +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -// We use any as a valid input type -/* eslint-disable @typescript-eslint/no-explicit-any */ +// Copyright (c) 2019-2020-2021 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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 }); -/** - * Sanitizes an input into a string so it can be passed into issueCommand safely - * @param input input to sanitize into a string - */ -function toCommandValue(input) { - if (input === null || input === undefined) { - return ''; +exports.NinjaProvider = void 0; +const path = __importStar(__webpack_require__(622)); +const BaseUtilLib = __importStar(__webpack_require__(758)); +class NinjaProvider { + constructor(baseLib) { + this.baseLib = baseLib; + this.baseUtils = new BaseUtilLib.BaseUtilLib(baseLib); } - else if (typeof input === 'string' || input instanceof String) { - return input; + download(url) { + return __awaiter(this, void 0, void 0, function* () { + if (!url) { + if (this.baseUtils.isLinux()) { + url = `${NinjaProvider.baseUrl}/ninja-linux.zip`; + } + else if (this.baseUtils.isDarwin()) { + url = `${NinjaProvider.baseUrl}/ninja-mac.zip`; + } + else if (this.baseUtils.isWin32()) { + url = `${NinjaProvider.baseUrl}/ninja-win.zip`; + } + } + // Create the name of the executable, i.e. ninja or ninja.exe . + let ninjaExeName = 'ninja'; + if (this.baseUtils.isWin32()) { + ninjaExeName += ".exe"; + } + const ninjaPath = yield this.baseUtils.downloadArchive(url); + const ninjaFullPath = path.join(ninjaPath, ninjaExeName); + if (this.baseUtils.isLinux() || this.baseUtils.isDarwin()) { + yield this.baseLib.exec('chmod', ['+x', ninjaFullPath]); + } + return ninjaFullPath; + }); + } + findNinjaTool() { + return __awaiter(this, void 0, void 0, function* () { + const ninjaPath = yield this.baseLib.which('ninja', false); + return ninjaPath; + }); + } + ; + /** + * Retrieve the path to 'ninja' executable. If the provided path to ninja is no existent + * it will download the ninja archive from the provided one, if the latter not provided from + * the default URL for ths host platform. + * @param {(string | undefined)} ninjaPath Optional path to ninja executable. + * @param {string} ninjaDownloadUrl Optional URL to download ninja from. + * @returns {Promise} The full path to the ninja executable. + * @memberof NinjaDownloader + */ + retrieveNinjaPath(ninjaPath, ninjaDownloadUrl) { + return __awaiter(this, void 0, void 0, function* () { + if (!ninjaPath) { + this.baseLib.debug("Path to ninja executable has not been explicitly specified on the task. Searching for it now..."); + ninjaPath = yield this.findNinjaTool(); + if (!ninjaPath) { + this.baseLib.debug("Cannot find Ninja in PATH environment variable."); + ninjaPath = + yield this.download(ninjaDownloadUrl); + if (!ninjaPath) { + throw new Error("Cannot find nor download Ninja."); + } + } + } + this.baseLib.debug(`Returning ninja at: ${ninjaPath}`); + return ninjaPath; + }); } - return JSON.stringify(input); } -exports.toCommandValue = toCommandValue; -//# sourceMappingURL=utils.js.map - -/***/ }), - -/***/ 87: -/***/ (function(module) { - -module.exports = require("os"); +exports.NinjaProvider = NinjaProvider; +NinjaProvider.baseUrl = 'https://github.com/ninja-build/ninja/releases/download/v1.10.1'; +//# sourceMappingURL=ninja.js.map /***/ }), -/***/ 93: +/***/ 74: /***/ (function(module, __unusedexports, __webpack_require__) { -module.exports = minimatch -minimatch.Minimatch = Minimatch - -var path = { sep: '/' } -try { - path = __webpack_require__(622) -} catch (er) {} +"use strict"; -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(306) -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } -} +const util = __webpack_require__(669); +const braces = __webpack_require__(783); +const picomatch = __webpack_require__(827); +const utils = __webpack_require__(265); +const isEmptyString = val => typeof val === 'string' && (val === '' || val === './'); -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' +/** + * Returns an array of strings that match one or more glob patterns. + * + * ```js + * const mm = require('micromatch'); + * // mm(list, patterns[, options]); + * + * console.log(mm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {String|Array} list List of strings to match. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} options See available [options](#options) + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ -// * => any number of characters -var star = qmark + '*?' +const micromatch = (list, patterns, options) => { + patterns = [].concat(patterns); + list = [].concat(list); -// ** 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})($|\\\/)).)*?' + let omit = new Set(); + let keep = new Set(); + let items = new Set(); + let negatives = 0; -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + let onResult = state => { + items.add(state.output); + if (options && options.onResult) { + options.onResult(state); + } + }; -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') + for (let i = 0; i < patterns.length; i++) { + let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); + let negated = isMatch.state.negated || isMatch.state.negatedExtglob; + if (negated) negatives++; -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} + for (let item of list) { + let matched = isMatch(item, true); -// normalizes slashes. -var slashSplit = /\/+/ + let match = negated ? !matched.isMatch : matched.isMatch; + if (!match) continue; -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) + if (negated) { + omit.add(matched.output); + } else { + omit.delete(matched.output); + keep.add(matched.output); + } + } } -} - -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 + let result = negatives === patterns.length ? [...items] : [...keep]; + let matches = result.filter(item => !omit.has(item)); - var orig = minimatch + if (options && matches.length === 0) { + if (options.failglob === true) { + throw new Error(`No matches found for "${patterns.join(', ')}"`); + } - var m = function minimatch (p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)) + if (options.nonull === true || options.nullglob === true) { + return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; + } } - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } + return matches; +}; - return m -} +/** + * Backwards compatibility + */ -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 === '' +micromatch.match = micromatch; - return new Minimatch(pattern, options).match(p) -} +/** + * Returns a matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * const mm = require('micromatch'); + * // mm.matcher(pattern[, options]); + * + * const isMatch = mm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` + * @return {Function} Returns a matcher function. + * @api public + */ -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } +micromatch.matcher = (pattern, options) => picomatch(pattern, options); - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const mm = require('micromatch'); + * // mm.isMatch(string, patterns[, options]); + * + * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(mm.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ - if (!options) options = {} - pattern = pattern.trim() +micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - // windows support: need to use /, not \ - if (path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } +/** + * Backwards compatibility + */ - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false +micromatch.any = micromatch.isMatch; - // make the set of regexps etc. - this.make() -} +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.not(list, patterns[, options]); + * + * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ -Minimatch.prototype.debug = function () {} +micromatch.not = (list, patterns, options = {}) => { + patterns = [].concat(patterns).map(String); + let result = new Set(); + let items = []; -Minimatch.prototype.make = make -function make () { - // don't do it more than once. - if (this._made) return + let onResult = state => { + if (options.onResult) options.onResult(state); + items.push(state.output); + }; - var pattern = this.pattern - var options = this.options + let matches = micromatch(list, patterns, { ...options, onResult }); - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return + for (let item of items) { + if (!matches.includes(item)) { + result.add(item); + } } + return [...result]; +}; - // step 1: figure out negation, etc. - this.parseNegate() +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var mm = require('micromatch'); + * // mm.contains(string, pattern[, options]); + * + * console.log(mm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(mm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ - // step 2: expand braces - var set = this.globSet = this.braceExpand() +micromatch.contains = (str, pattern, options) => { + if (typeof str !== 'string') { + throw new TypeError(`Expected a string: "${util.inspect(str)}"`); + } - if (options.debug) this.debug = console.error + if (Array.isArray(pattern)) { + return pattern.some(p => micromatch.contains(str, p, options)); + } - this.debug(this.pattern, set) + if (typeof pattern === 'string') { + if (isEmptyString(str) || isEmptyString(pattern)) { + return false; + } - // 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) - }) + if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) { + return true; + } + } - this.debug(this.pattern, set) + return micromatch.isMatch(str, pattern, { ...options, contains: true }); +}; - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * const mm = require('micromatch'); + * // mm.matchKeys(object, patterns[, options]); + * + * const obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(mm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ - this.debug(this.pattern, set) +micromatch.matchKeys = (obj, patterns, options) => { + if (!utils.isObject(obj)) { + throw new TypeError('Expected the first argument to be an object'); + } + let keys = micromatch(Object.keys(obj), patterns, options); + let res = {}; + for (let key of keys) res[key] = obj[key]; + return res; +}; - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) +/** + * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.some(list, patterns[, options]); + * + * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ - this.debug(this.pattern, set) +micromatch.some = (list, patterns, options) => { + let items = [].concat(list); - this.set = set -} + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch(String(pattern), options); + if (items.some(item => isMatch(item))) { + return true; + } + } + return false; +}; -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) -} +/** + * Returns true if every string in the given `list` matches + * any of the given glob `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.every(list, patterns[, options]); + * + * console.log(mm.every('foo.js', ['foo.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ -Minimatch.prototype.braceExpand = braceExpand +micromatch.every = (list, patterns, options) => { + let items = [].concat(list); -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch(String(pattern), options); + if (!items.every(item => isMatch(item))) { + return false; } } + return true; +}; - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern +/** + * Returns true if **all** of the given `patterns` match + * the specified string. + * + * ```js + * const mm = require('micromatch'); + * // mm.all(string, patterns[, options]); + * + * console.log(mm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ - if (typeof pattern === 'undefined') { - throw new TypeError('undefined pattern') +micromatch.all = (str, patterns, options) => { + if (typeof str !== 'string') { + throw new TypeError(`Expected a string: "${util.inspect(str)}"`); } - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] - } + return [].concat(patterns).every(p => picomatch(p, options)(str)); +}; - return expand(pattern) -} +/** + * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. + * + * ```js + * const mm = require('micromatch'); + * // mm.capture(pattern, string[, options]); + * + * console.log(mm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(mm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `glob` Glob pattern to use for matching. + * @param {String} `input` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the input matches the glob pattern, otherwise `null`. + * @api public + */ -// 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') +micromatch.capture = (glob, input, options) => { + let posix = utils.isWindows(options); + let regex = picomatch.makeRe(String(glob), { ...options, capture: true }); + let match = regex.exec(posix ? utils.toPosixSlashes(input) : input); + + if (match) { + return match.slice(1).map(v => v === void 0 ? '' : v); } +}; - var options = this.options +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * const mm = require('micromatch'); + * // mm.makeRe(pattern[, options]); + * + * console.log(mm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' +micromatch.makeRe = (...args) => picomatch.makeRe(...args); - 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 +/** + * Scan a glob pattern to separate the pattern into segments. Used + * by the [split](#split) method. + * + * ```js + * const mm = require('micromatch'); + * const state = mm.scan(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ - 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 - } - } +micromatch.scan = (...args) => picomatch.scan(...args); - 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) +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const mm = require('micromatch'); + * const state = mm(pattern[, options]); + * ``` + * @param {String} `glob` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as regex source string. + * @api public + */ - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue +micromatch.parse = (patterns, options) => { + let res = []; + for (let pattern of [].concat(patterns || [])) { + for (let str of braces(String(pattern), options)) { + res.push(picomatch.parse(str, options)); } + } + return res; +}; - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - - case '\\': - clearStateChar() - escaping = true - continue +/** + * Process the given brace `pattern`. + * + * ```js + * const { braces } = require('micromatch'); + * console.log(braces('foo/{a,b,c}/bar')); + * //=> [ 'foo/(a|b|c)/bar' ] + * + * console.log(braces('foo/{a,b,c}/bar', { expand: true })); + * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] + * ``` + * @param {String} `pattern` String with brace pattern to process. + * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. + * @return {Array} + * @api public + */ - // 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) +micromatch.braces = (pattern, options) => { + if (typeof pattern !== 'string') throw new TypeError('Expected a string'); + if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) { + return [pattern]; + } + return braces(pattern, options); +}; - // 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 - } +/** + * Expand braces + */ - // 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 +micromatch.braceExpand = (pattern, options) => { + if (typeof pattern !== 'string') throw new TypeError('Expected a string'); + return micromatch.braces(pattern, { ...options, expand: true }); +}; - case '(': - if (inClass) { - re += '(' - continue - } +/** + * Expose micromatch + */ - if (!stateChar) { - re += '\\(' - continue - } +module.exports = micromatch; - 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 +/***/ 78: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const sync_1 = __webpack_require__(519); +const provider_1 = __webpack_require__(2); +class ProviderSync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderSync; - 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 - } +/***/ 81: +/***/ (function(module, exports, __webpack_require__) { - inClass = true - classStart = i - reClassStart = re.length - re += c - continue +"use strict"; - 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 - } - } +/** + * Module dependencies. + */ +var tty = __webpack_require__(867); - // finish up the class. - hasMagic = true - inClass = false - re += c - continue +var util = __webpack_require__(669); +/** + * This is the Node.js implementation of `debug()`. + */ - default: - // swallow any state char that wasn't consumed - clearStateChar() - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +/** + * Colors. + */ - re += c +exports.colors = [6, 2, 3, 4, 5, 1]; - } // switch - } // for +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + var supportsColor = __webpack_require__(247); - // 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] + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; } +} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. - // 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 + '|' - }) +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ - 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 - } +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // Camel-case + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { + return k.toUpperCase(); + }); // Coerce string value into JS value - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } + var val = process.env[key]; - // 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 + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); } - // 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) + obj[prop] = val; + return obj; +}, {}); +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ - nlLast += nlAfter +function useColors() { + return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); +} +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ - // 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 - } +function formatArgs(args) { + var name = this.namespace, + useColors = this.useColors; - // 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 (useColors) { + var c = this.color; + var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); + var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = getDate() + name + ' ' + args[0]; } +} - if (addPatternStart) { - re = patternStart + re +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; } - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } + return new Date().toISOString() + ' '; +} +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ - // 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('$.') - } +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ - regExp._glob = pattern - regExp._src = re - return regExp +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } } +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() + +function load() { + return process.env.DEBUG; } +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ -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 +function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports.inspectOpts); - if (!set.length) { - this.regexp = false - return this.regexp + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; } - var options = this.options +} - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' +module.exports = __webpack_require__(486)(exports); +var formatters = module.exports.formatters; +/** + * Map %o to `util.inspect()`, all on a single line. + */ - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' '); +}; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ - // 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 + ').*$' +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; - 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 +/***/ 82: +/***/ (function(__unusedmodule, exports) { - var options = this.options +"use strict"; - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; +//# sourceMappingURL=utils.js.map - // 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. +/***/ 87: +/***/ (function(module) { - var set = this.set - this.debug(this.pattern, 'set', set) +module.exports = require("os"); - // 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 - } - } +/***/ 93: +/***/ (function(module, __unusedexports, __webpack_require__) { - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} +module.exports = minimatch +minimatch.Minimatch = Minimatch -// 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 +var path = { sep: '/' } +try { + path = __webpack_require__(622) +} catch (er) {} - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __webpack_require__(306) - this.debug('matchOne', file.length, pattern.length) +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} - 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] +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' - this.debug(pattern, p, f) +// * => any number of characters +var star = qmark + '*?' - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false +// ** 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})($|\\\/)).)*?' - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - // "**" - // 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 - } +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) +// normalizes slashes. +var slashSplit = /\/+/ - // 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 - } +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } +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 +} - // 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 - } +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch - // 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) - } + var orig = minimatch - if (!hit) return false + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) } - // 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/* + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } - // 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?') + return m } -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch } -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +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') + } -/***/ 102: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + if (!options) options = {} + pattern = pattern.trim() -"use strict"; + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } -// For internal use, subject to change. -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -// We use any as a valid input type -/* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(__webpack_require__(747)); -const os = __importStar(__webpack_require__(87)); -const utils_1 = __webpack_require__(82); -function issueCommand(command, message) { - const filePath = process.env[`GITHUB_${command}`]; - if (!filePath) { - throw new Error(`Unable to find environment variable for file command ${command}`); - } - if (!fs.existsSync(filePath)) { - throw new Error(`Missing file at path: ${filePath}`); - } - fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { - encoding: 'utf8' - }); + 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() } -exports.issueCommand = issueCommand; -//# sourceMappingURL=file-command.js.map -/***/ }), +Minimatch.prototype.debug = function () {} -/***/ 113: -/***/ (function(__unusedmodule, exports, __webpack_require__) { +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const stream_1 = __webpack_require__(608); -const provider_1 = __webpack_require__(2); -class ProviderAsync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new stream_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = []; - return new Promise((resolve, reject) => { - const stream = this.api(root, task, options); - stream.once('error', reject); - stream.on('data', (entry) => entries.push(options.transform(entry))); - stream.once('end', () => resolve(entries)); - }); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports.default = ProviderAsync; + 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() -/***/ 115: -/***/ (function(__unusedmodule, exports) { + // step 2: expand braces + var set = this.globSet = this.braceExpand() -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -function isEnoentCodeError(error) { - return error.code === 'ENOENT'; -} -exports.isEnoentCodeError = isEnoentCodeError; + 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) + }) -/***/ 117: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + this.debug(this.pattern, set) -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) -var pathModule = __webpack_require__(622); -var isWindows = process.platform === 'win32'; -var fs = __webpack_require__(747); + this.debug(this.pattern, set) -// JavaScript implementation of realpath, ported from node pre-v6 + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + this.debug(this.pattern, set) -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - var callback; - if (DEBUG) { - var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; + this.set = set +} - return callback; +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); - } - } + if (options.nonegate) return - function missingCallback(err) { - if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } - } + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ } -} -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate } -var normalize = pathModule.normalize; - -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} - -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; +// 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) } -exports.realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = pathModule.resolve(p); +Minimatch.prototype.braceExpand = braceExpand - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } } - var original = p, - seenLinks = {}, - knownHard = {}; + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } - start(); + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; + return expand(pattern) +} - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; - } +// 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') } - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; + var options = this.options - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } + 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 - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; - } - } - if (linkTarget === null) { - fs.statSync(base); - linkTarget = fs.readlinkSync(base); + 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 } - resolvedLink = pathModule.resolve(previous, linkTarget); - // track this, if given a cache. - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false } - - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); } - if (cache) cache[original] = p; - - return p; -}; + 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 + } -exports.realpath = function realpath(p, cache, cb) { - if (typeof cb !== 'function') { - cb = maybeCallback(cache); - cache = null; - } + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false - // make p is absolute - p = pathModule.resolve(p); + case '\\': + clearStateChar() + escaping = true + continue - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); - } + // 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) - var original = p, - seenLinks = {}, - knownHard = {}; + // 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 + } - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; + // 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 - start(); + case '(': + if (inClass) { + re += '(' + continue + } - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; - - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { - if (err) return cb(err); - knownHard[base] = true; - LOOP(); - }); - } else { - process.nextTick(LOOP); - } - } - - // walk down the path, swapping out linked pathparts for their real - // values - function LOOP() { - // stop if scanned past end of path - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); - } + if (!stateChar) { + re += '\\(' + continue + } - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; + 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 - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - return process.nextTick(LOOP); - } + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // known symbolic link. no need to stat again. - return gotResolvedLink(cache[base]); - } + 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 - return fs.lstat(base, gotStat); - } + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } - function gotStat(err, stat) { - if (err) return cb(err); + clearStateChar() + re += '|' + continue - // if not a symlink, skip to the next path part - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - return process.nextTick(LOOP); - } + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - // stat & read the link if not read before - // call gotTarget as soon as the link target is known - // dev/ino always return 0 on windows, so skip the check. - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - return gotTarget(null, seenLinks[id], base); - } - } - fs.stat(base, function(err) { - if (err) return cb(err); + if (inClass) { + re += '\\' + c + continue + } - fs.readlink(base, function(err, target) { - if (!isWindows) seenLinks[id] = target; - gotTarget(err, target); - }); - }); - } + inClass = true + classStart = i + reClassStart = re.length + re += c + continue - function gotTarget(err, target, base) { - if (err) return cb(err); + 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 + } - var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base] = resolvedLink; - gotResolvedLink(resolvedLink); - } + // 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 + } + } - function gotResolvedLink(resolvedLink) { - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } -}; + // 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 += '\\' + } -/***/ 129: -/***/ (function(module) { + re += c -module.exports = require("child_process"); + } // 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] + } -/***/ 143: -/***/ (function(module) { + // 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 = '\\' + } -"use strict"; + // 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 + '|' + }) -module.exports = path => { - const isExtendedLengthPath = /^\\\\\?\\/.test(path); - const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type - if (isExtendedLengthPath || hasNonAscii) { - return path; - } + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } - return path.replace(/\\/g, '/'); -}; + // 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] -/***/ 148: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + 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) -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(231); -const constants_1 = __webpack_require__(171); -const utils = __webpack_require__(933); -function read(directory, settings) { - if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - return readdirWithFileTypes(directory, settings); - } - return readdir(directory, settings); -} -exports.read = read; -function readdirWithFileTypes(directory, settings) { - const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); - return dirents.map((dirent) => { - const entry = { - dirent, - name: dirent.name, - path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` - }; - if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { - try { - const stats = settings.fs.statSync(entry.path); - entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); - } - catch (error) { - if (settings.throwErrorOnBrokenSymbolicLink) { - throw error; - } - } - } - return entry; - }); -} -exports.readdirWithFileTypes = readdirWithFileTypes; -function readdir(directory, settings) { - const names = settings.fs.readdirSync(directory); - return names.map((name) => { - const entryPath = `${directory}${settings.pathSegmentSeparator}${name}`; - const stats = fsStat.statSync(entryPath, settings.fsStatSettings); - const entry = { - name, - path: entryPath, - dirent: utils.fs.createDirentFromStats(name, stats) - }; - if (settings.stats) { - entry.stats = stats; - } - return entry; - }); -} -exports.readdir = readdir; + 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 + } -/***/ 162: -/***/ (function(module, __unusedexports, __webpack_require__) { + // 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 + } -"use strict"; + if (addPatternStart) { + re = patternStart + re + } -const {Transform} = __webpack_require__(413); + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } -class ObjectTransform extends Transform { - constructor() { - super({ - objectMode: true - }); - } -} + // 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) + } -class FilterStream extends ObjectTransform { - constructor(filter) { - super(); - this._filter = filter; - } + 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('$.') + } - _transform(data, encoding, callback) { - if (this._filter(data)) { - this.push(data); - } + regExp._glob = pattern + regExp._src = re - callback(); - } + return regExp } -class UniqueStream extends ObjectTransform { - constructor() { - super(); - this._pushed = new Set(); - } +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} - _transform(data, encoding, callback) { - if (!this._pushed.has(data)) { - this.push(data); - this._pushed.add(data); - } +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp - callback(); - } -} + // 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 -module.exports = { - FilterStream, - UniqueStream -}; + 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('|') -/***/ 171: -/***/ (function(__unusedmodule, exports) { + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); -const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); -const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); -const SUPPORTED_MAJOR_VERSION = 10; -const SUPPORTED_MINOR_VERSION = 10; -const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; -const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; -/** - * IS `true` for Node.js 10.10 and greater. - */ -exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; + // 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 +} -/***/ 181: -/***/ (function(__unusedmodule, exports, __webpack_require__) { +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 === '' -exports.EntryHeader = __webpack_require__(239); -exports.MainHeader = __webpack_require__(602); + if (f === '/' && partial) return true + var options = this.options -/***/ }), + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } -/***/ 182: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const fsStat = __webpack_require__(231); -const rpl = __webpack_require__(885); -const constants_1 = __webpack_require__(171); -const utils = __webpack_require__(933); -function read(directory, settings, callback) { - if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - return readdirWithFileTypes(directory, settings, callback); - } - return readdir(directory, settings, callback); -} -exports.read = read; -function readdirWithFileTypes(directory, settings, callback) { - settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { - if (readdirError !== null) { - return callFailureCallback(callback, readdirError); - } - const entries = dirents.map((dirent) => ({ - dirent, - name: dirent.name, - path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` - })); - if (!settings.followSymbolicLinks) { - return callSuccessCallback(callback, entries); - } - const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); - rpl(tasks, (rplError, rplEntries) => { - if (rplError !== null) { - return callFailureCallback(callback, rplError); - } - callSuccessCallback(callback, rplEntries); - }); - }); -} -exports.readdirWithFileTypes = readdirWithFileTypes; -function makeRplTaskEntry(entry, settings) { - return (done) => { - if (!entry.dirent.isSymbolicLink()) { - return done(null, entry); - } - settings.fs.stat(entry.path, (statError, stats) => { - if (statError !== null) { - if (settings.throwErrorOnBrokenSymbolicLink) { - return done(statError); - } - return done(null, entry); - } - entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); - return done(null, entry); - }); - }; -} -function readdir(directory, settings, callback) { - settings.fs.readdir(directory, (readdirError, names) => { - if (readdirError !== null) { - return callFailureCallback(callback, readdirError); - } - const filepaths = names.map((name) => `${directory}${settings.pathSegmentSeparator}${name}`); - const tasks = filepaths.map((filepath) => { - return (done) => fsStat.stat(filepath, settings.fsStatSettings, done); - }); - rpl(tasks, (rplError, results) => { - if (rplError !== null) { - return callFailureCallback(callback, rplError); - } - const entries = []; - names.forEach((name, index) => { - const stats = results[index]; - const entry = { - name, - path: filepaths[index], - dirent: utils.fs.createDirentFromStats(name, stats) - }; - if (settings.stats) { - entry.stats = stats; - } - entries.push(entry); - }); - callSuccessCallback(callback, entries); - }); - }); -} -exports.readdir = readdir; -function callFailureCallback(callback, error) { - callback(error); -} -function callSuccessCallback(callback, result) { - callback(null, result); -} + // 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 + } -/***/ 199: -/***/ (function(module, __unusedexports, __webpack_require__) { + 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 + } + } -"use strict"; + // 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 -const path = __webpack_require__(622); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) -/** - * Posix glob regex - */ + this.debug('matchOne', file.length, pattern.length) -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; + 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] -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; + this.debug(pattern, p, f) -/** - * Windows glob regex - */ + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false -const WINDOWS_CHARS = { - ...POSIX_CHARS, + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; + // "**" + // 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 + } -/** - * POSIX Bracket Regex - */ + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ + // 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 + } - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ + // 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 + } - CHAR_ASTERISK: 42, /* * */ + // 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) + } - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + if (!hit) return false + } - SEP: path.sep, + // 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/* - /** - * Create EXTGLOB_CHARS - */ + // 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 + } - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, + // should be unreachable. + throw new Error('wtf?') +} - /** - * Create GLOB_CHARS - */ +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} /***/ }), -/***/ 201: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 102: +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -const os = __webpack_require__(87); - -const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/; -const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/; -const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir(); - -module.exports = (stack, options) => { - options = Object.assign({pretty: false}, options); - - return stack.replace(/\\/g, '/') - .split('\n') - .filter(line => { - const pathMatches = line.match(extractPathRegex); - if (pathMatches === null || !pathMatches[1]) { - return true; - } - - const match = pathMatches[1]; - - // Electron - if ( - match.includes('.app/Contents/Resources/electron.asar') || - match.includes('.app/Contents/Resources/default_app.asar') - ) { - return false; - } - - return !pathRegex.test(match); - }) - .filter(line => line.trim() !== '') - .map(line => { - if (options.pretty) { - return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~'))); - } - - return line; - }) - .join('\n'); +// For internal use, subject to change. +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; }; - +Object.defineProperty(exports, "__esModule", { value: true }); +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar(__webpack_require__(747)); +const os = __importStar(__webpack_require__(87)); +const utils_1 = __webpack_require__(82); +function issueCommand(command, message) { + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +exports.issueCommand = issueCommand; +//# sourceMappingURL=file-command.js.map /***/ }), -/***/ 210: -/***/ (function(__unusedmodule, exports) { +/***/ 113: +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); +const stream_1 = __webpack_require__(608); +const provider_1 = __webpack_require__(2); +class ProviderAsync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = []; + return new Promise((resolve, reject) => { + const stream = this.api(root, task, options); + stream.once('error', reject); + stream.on('data', (entry) => entries.push(options.transform(entry))); + stream.once('end', () => resolve(entries)); + }); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } } -exports.createDirentFromStats = createDirentFromStats; +exports.default = ProviderAsync; /***/ }), -/***/ 211: -/***/ (function(module) { +/***/ 115: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +function isEnoentCodeError(error) { + return error.code === 'ENOENT'; +} +exports.isEnoentCodeError = isEnoentCodeError; -module.exports = require("https"); /***/ }), -/***/ 214: +/***/ 117: /***/ (function(__unusedmodule, exports, __webpack_require__) { -"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. -// Copyright (c) 2019-2020-2021 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -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 }); -exports.CMakeRunner = void 0; -const baseutillib = __importStar(__webpack_require__(758)); -const path = __importStar(__webpack_require__(622)); -const cmakesettings_runner_1 = __webpack_require__(454); -const cmakeglobals = __importStar(__webpack_require__(330)); -const ninjalib = __importStar(__webpack_require__(72)); -const using_statement_1 = __webpack_require__(443); -const cmakelib = __importStar(__webpack_require__(233)); -var RunCMakeModeType; -(function (RunCMakeModeType) { - RunCMakeModeType[RunCMakeModeType["CMakeListsTxtBasic"] = 1] = "CMakeListsTxtBasic"; - RunCMakeModeType[RunCMakeModeType["CMakeListsTxtAdvanced"] = 2] = "CMakeListsTxtAdvanced"; - RunCMakeModeType[RunCMakeModeType["CMakeSettingsJson"] = 3] = "CMakeSettingsJson"; -})(RunCMakeModeType || (RunCMakeModeType = {})); -function getTargetType(typeString) { - return RunCMakeModeType[typeString]; -} -const CMakeGenerator = { - 'Unknown': {}, - 'VS16Arm': { 'G': 'Visual Studio 16 2019', 'A': 'ARM', 'MultiConfiguration': true }, - 'VS16Win32': { 'G': 'Visual Studio 16 2019', 'A': 'Win32', 'MultiConfiguration': true }, - 'VS16Win64': { 'G': 'Visual Studio 16 2019', 'A': 'x64', 'MultiConfiguration': true }, - 'VS16Arm64': { 'G': 'Visual Studio 16 2019', 'A': 'ARM64', 'MultiConfiguration': true }, - 'VS15Arm': { 'G': 'Visual Studio 15 2017', 'A': 'ARM', 'MultiConfiguration': true }, - 'VS15Win32': { 'G': 'Visual Studio 15 2017', 'A': 'Win32', 'MultiConfiguration': true }, - 'VS15Win64': { 'G': 'Visual Studio 15 2017', 'A': 'x64', 'MultiConfiguration': true }, - 'VS15Arm64': { 'G': 'Visual Studio 15 2017', 'A': 'ARM64', 'MultiConfiguration': true }, - 'Ninja': { 'G': 'Ninja', 'A': '', 'MultiConfiguration': false }, - 'NinjaMulti': { 'G': 'Ninja Multi-Config', 'A': '', 'MultiConfiguration': true }, - 'UnixMakefiles': { 'G': 'Unix Makefiles', 'A': '', 'MultiConfiguration': false } -}; -function getGenerator(generatorString) { - const generatorName = CMakeGenerator[generatorString]; - return generatorName; -} -class CMakeRunner { - /* - // Unfortunately there is not a way to discriminate between a value provided by the user - // from a default value (not provided by the user), hence it is not possible to identify - // what the user provided. - private static warnIfUnused(inputName: string, taskMode: TaskModeType): void { - if (inputName in CMakeRunner.modePerInput) { - const usedInMode: TaskModeType[] = CMakeRunner.modePerInput[name]; - if (usedInMode) { - if (usedInMode.indexOf(taskMode) < 0) { } - - //??this.tl.warning(`The input '${inputName}' is ignored in mode '${taskMode}'`); - } - } - } - */ - constructor(tl) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; - this.tl = tl; - this.buildDir = ""; - this.generator = {}; - this.baseUtils = new baseutillib.BaseUtilLib(this.tl); - this.cmakeUtils = new cmakelib.CMakeUtils(this.baseUtils); - this.ninjaLib = new ninjalib.NinjaProvider(this.tl); - const regs = this.tl.getDelimitedInput(cmakeglobals.logCollectionRegExps, ';', false); - this.logFilesCollector = new baseutillib.LogFileCollector(this.tl, regs, (path) => baseutillib.dumpFile(this.tl, path)); - const mode = (_a = this.tl.getInput(cmakeglobals.cmakeListsOrSettingsJson, true)) !== null && _a !== void 0 ? _a : ""; - const runMode = getTargetType(mode); - if (!runMode) { - throw new Error(`ctor(): invalid mode '${mode}'.`); - } - this.runMode = runMode; - let required = this.runMode === RunCMakeModeType.CMakeSettingsJson; - this.cmakeSettingsJsonPath = (_b = this.tl.getPathInput(cmakeglobals.cmakeSettingsJsonPath, required, required)) !== null && _b !== void 0 ? _b : ""; - required = this.runMode !== RunCMakeModeType.CMakeSettingsJson; - this.cmakeListsTxtPath = (_c = this.tl.getPathInput(cmakeglobals.cmakeListsTxtPath, required, required)) !== null && _c !== void 0 ? _c : ""; - this.buildDir = (_d = this.tl.getInput(cmakeglobals.buildDirectory, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _d !== void 0 ? _d : ""; - this.appendedArgs = (_e = this.tl.getInput(cmakeglobals.cmakeAppendedArgs, false)) !== null && _e !== void 0 ? _e : ""; - this.configurationFilter = (_f = this.tl.getInput(cmakeglobals.configurationRegexFilter, false)) !== null && _f !== void 0 ? _f : ""; - this.ninjaPath = ''; - if (this.tl.isFilePathSupplied(cmakeglobals.ninjaPath)) { - this.ninjaPath = (_g = tl.getInput(cmakeglobals.ninjaPath, false)) !== null && _g !== void 0 ? _g : ""; - } - this.cmakeToolchainPath = ""; - if (this.tl.isFilePathSupplied(cmakeglobals.cmakeToolchainPath)) { - this.cmakeToolchainPath = (_h = tl.getInput(cmakeglobals.cmakeToolchainPath, false)) !== null && _h !== void 0 ? _h : ""; - } - const gen = (_j = this.tl.getInput(cmakeglobals.cmakeGenerator, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _j !== void 0 ? _j : ""; - this.generator = getGenerator(gen); - this.ninjaDownloadUrl = (_k = this.tl.getInput(cmakeglobals.ninjaDownloadUrl, false)) !== null && _k !== void 0 ? _k : ""; - this.doBuild = (_l = this.tl.getBoolInput(cmakeglobals.buildWithCMake, false)) !== null && _l !== void 0 ? _l : false; - this.doBuildArgs = (_m = this.tl.getInput(cmakeglobals.buildWithCMakeArgs, false)) !== null && _m !== void 0 ? _m : ""; - this.cmakeSourceDir = path.dirname((_o = baseutillib.BaseUtilLib.normalizePath(this.cmakeListsTxtPath)) !== null && _o !== void 0 ? _o : ""); - this.useVcpkgToolchainFile = (_p = this.tl.getBoolInput(cmakeglobals.useVcpkgToolchainFile, false)) !== null && _p !== void 0 ? _p : false; - this.cmakeBuildType = (_q = this.tl.getInput(cmakeglobals.cmakeBuildType, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _q !== void 0 ? _q : ""; - this.vcpkgTriplet = (_r = (this.tl.getInput(cmakeglobals.cmakeVcpkgTriplet, false) || - process.env.RUNVCPKG_VCPKG_TRIPLET)) !== null && _r !== void 0 ? _r : ""; - this.sourceScript = (_s = this.tl.getInput(cmakeglobals.cmakeWrapperCommand, false)) !== null && _s !== void 0 ? _s : ""; +var pathModule = __webpack_require__(622); +var isWindows = process.platform === 'win32'; +var fs = __webpack_require__(747); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); } - run() { - return __awaiter(this, void 0, void 0, function* () { - this.tl.debug('run()<<'); - yield this.configure(); - this.tl.debug('run()>>'); - }); - } - configure() { - var _a; - return __awaiter(this, void 0, void 0, function* () { - this.tl.debug('configure()<<'); - // Contains the '--config ' when using multiconfiguration generators. - let prependedBuildArguments = ""; - let cmakeArgs = []; - switch (this.runMode) { - case RunCMakeModeType.CMakeListsTxtAdvanced: - case RunCMakeModeType.CMakeListsTxtBasic: { - // Search for CMake tool and run it. - let cmake; - if (this.sourceScript) { - cmake = this.tl.tool(this.sourceScript); - cmakeArgs.push(yield this.tl.which('cmake', true)); - } - else { - cmake = this.tl.tool(yield this.tl.which('cmake', true)); - } - if (this.runMode === RunCMakeModeType.CMakeListsTxtAdvanced) { - // If Ninja is required, specify the path to it. - if (this.baseUtils.isNinjaGenerator([this.appendedArgs])) { - if (!this.baseUtils.isMakeProgram([this.appendedArgs])) { - const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); - cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); - } - } - if (this.appendedArgs) { - this.tl.debug(`Parsing additional CMake args: ${this.appendedArgs}`); - const addedArgs = cmake._argStringToArray(this.appendedArgs); - this.tl.debug(`Appending args: ${JSON.stringify(addedArgs)}`); - cmakeArgs = [...cmakeArgs, ...addedArgs]; - } - } - else if (this.runMode === RunCMakeModeType.CMakeListsTxtBasic) { - const generatorName = this.generator['G']; - const generatorArch = this.generator['A']; - const generatorIsMultiConf = (_a = this.generator['MultiConfiguration']) !== null && _a !== void 0 ? _a : false; - cmakeArgs.push(`-G${generatorName}`); - if (generatorArch) { - cmakeArgs.push(`-A${generatorArch}`); - } - if (CMakeRunner.isNinjaGenerator(generatorName)) { - const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); - cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); - } - if (this.cmakeToolchainPath) { - cmakeArgs.push(`-DCMAKE_TOOLCHAIN_FILE=${this.cmakeToolchainPath}`); - } - // Add CMake's build type, unless a multi configuration generator is being used. - if (!generatorIsMultiConf) { - cmakeArgs.push(`-DCMAKE_BUILD_TYPE=${this.cmakeBuildType}`); - } - prependedBuildArguments = this.prependBuildConfigIfNeeded(this.doBuildArgs, generatorIsMultiConf, this.cmakeBuildType); - } - // Use vcpkg toolchain if requested. - if (this.useVcpkgToolchainFile === true) { - cmakeArgs = yield this.cmakeUtils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet, this.tl); - } - // The source directory is required for any mode. - cmakeArgs.push(this.cmakeSourceDir); - this.tl.debug(`CMake arguments: ${cmakeArgs}`); - for (const arg of cmakeArgs) { - cmake.arg(arg); - } - // Ensure the build directory is existing. - yield this.tl.mkdirP(this.buildDir); - const options = { - cwd: this.buildDir, - failOnStdErr: false, - errStream: process.stdout, - outStream: process.stdout, - ignoreReturnCode: true, - silent: false, - windowsVerbatimArguments: false, - env: process.env, - listeners: { - stdout: (t) => this.logFilesCollector.handleOutput(t), - stderr: (t) => this.logFilesCollector.handleOutput(t), - } - }; - this.tl.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); - let code = -1; - yield using_statement_1.using(baseutillib.Matcher.createMatcher('cmake', this.tl, this.cmakeSourceDir), (matcher) => __awaiter(this, void 0, void 0, function* () { - code = yield this.baseUtils.wrapOp("Generate project files with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield cmake.exec(options); })); - })); - if (code !== 0) { - throw new Error(`"CMake failed with error code: '${code}'.`); - } - if (this.doBuild) { - yield using_statement_1.using(baseutillib.Matcher.createMatcher(CMakeRunner.getBuildMatcher(this.buildDir, this.tl), this.tl), (matcher) => __awaiter(this, void 0, void 0, function* () { - yield this.baseUtils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield CMakeRunner.build(this.tl, this.buildDir, prependedBuildArguments + this.doBuildArgs, options); })); - })); - } - break; - } - case RunCMakeModeType.CMakeSettingsJson: { - const cmakeJson = new cmakesettings_runner_1.CMakeSettingsJsonRunner(this.tl, this.cmakeSettingsJsonPath, this.configurationFilter, this.appendedArgs, this.tl.getSrcDir(), this.vcpkgTriplet, this.useVcpkgToolchainFile, this.doBuild, this.ninjaPath, this.ninjaDownloadUrl, this.sourceScript, this.buildDir); - yield this.baseUtils.wrapOp("Run CMake with CMakeSettings.json", () => __awaiter(this, void 0, void 0, function* () { return yield cmakeJson.run(); })); - break; - } - } - }); - } - static isNinjaGenerator(generatorName) { - return generatorName === CMakeGenerator['Ninja']['G'] || - generatorName === CMakeGenerator['NinjaMulti']['G']; - } - /// If not already provided, creates the '--config ' argument to pass when building. - /// Return a string of arguments to prepend the build arguments. - prependBuildConfigIfNeeded(buildArgs, multiConfi, buildType) { - let prependArgs = ""; - if (multiConfi && !buildArgs.includes("--config")) { - prependArgs = ` --config ${buildType} `; - } - return prependArgs; - } - /** - * Build with CMake. - * @export - * @param {string} buildDir - * @param {string} buildArgs - * @param {trm.IExecOptions} options - * @param {string} sourceScript - * @returns {Promise} - */ - static build(baseLib, buildDir, buildArgs, options) { - return __awaiter(this, void 0, void 0, function* () { - // Run CMake with the given arguments - const cmake = baseLib.tool(yield baseLib.which('cmake', true)); - cmake.arg("--build"); - cmake.arg("."); - if (buildArgs) - cmake.line(buildArgs); - // Run the command in the build directory - options.cwd = buildDir; - console.log(`Building with CMake in build directory '${options.cwd}' ...`); - const code = yield cmake.exec(options); - if (code !== 0) { - throw new Error(`"Build failed with error code: '${code}'."`); - } - }); - } - static getDefaultMatcher() { - const plat = process.platform; - return plat === "win32" ? CMakeRunner.msvcMatcher : - plat === "darwin" ? CMakeRunner.clangMatcher : CMakeRunner.gccMatcher; - } - static getCompilerMatcher(line) { - let matcherName = undefined; - if (line.includes('g++') || line.includes('gcc') || line.includes('c++')) - matcherName = CMakeRunner.gccMatcher; - else if (line.includes('cl.exe')) - matcherName = CMakeRunner.msvcMatcher; - else if (line.includes('clang')) - matcherName = CMakeRunner.clangMatcher; - return matcherName; - } - static getBuildMatcher(buildDir, tl) { - var _a; - let cxxMatcher; - let ccMatcher; - const utils = new baseutillib.BaseUtilLib(tl); - try { - const cmakeCacheTxtPath = path.join(buildDir, "CMakeCache.txt"); - const [ok, cacheContent] = utils.readFile(cmakeCacheTxtPath); - tl.debug(`Loaded fileCMakeCache.txt at path='${cmakeCacheTxtPath}'`); - if (ok) { - for (const line of cacheContent.split('\n')) { - tl.debug(`text=${line}`); - if (line.includes("CMAKE_CXX_COMPILER:")) { - tl.debug(`Found CXX compiler: '${line}'.`); - cxxMatcher = CMakeRunner.getCompilerMatcher(line); - tl.debug(`Matcher selected for CXX: ${cxxMatcher}`); - break; - } - if (line.includes("CMAKE_C_COMPILER:")) { - tl.debug(`Found C compiler: '${line}'.`); - ccMatcher = CMakeRunner.getCompilerMatcher(line); - tl.debug(`Matcher selected for CC: ${ccMatcher}`); - break; - } - } - } - } - catch (error) { - tl.debug(error.toString()); - } - const defaultMatcher = CMakeRunner.getDefaultMatcher(); - tl.debug(`Default matcher according to platform is: ${defaultMatcher}`); - const selectedMatcher = (_a = cxxMatcher !== null && cxxMatcher !== void 0 ? cxxMatcher : ccMatcher) !== null && _a !== void 0 ? _a : defaultMatcher; - tl.debug(`Selected matcher: ${selectedMatcher}`); - return selectedMatcher; + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } } + } } -exports.CMakeRunner = CMakeRunner; -CMakeRunner.modePerInput = { - [cmakeglobals.cmakeListsTxtPath]: [RunCMakeModeType.CMakeListsTxtBasic, RunCMakeModeType.CMakeListsTxtAdvanced], - [cmakeglobals.cmakeSettingsJsonPath]: [RunCMakeModeType.CMakeSettingsJson], - [cmakeglobals.cmakeToolchainPath]: [RunCMakeModeType.CMakeListsTxtBasic], - /*[globals.useVcpkgToolchainFile]: all */ - /*[globals.vcpkgTriplet]: all */ - [cmakeglobals.cmakeBuildType]: [RunCMakeModeType.CMakeListsTxtBasic], - [cmakeglobals.cmakeGenerator]: [RunCMakeModeType.CMakeListsTxtBasic], - /*[globals.buildDirectory]: all */ - [cmakeglobals.cmakeAppendedArgs]: [RunCMakeModeType.CMakeListsTxtAdvanced, RunCMakeModeType.CMakeSettingsJson], - [cmakeglobals.configurationRegexFilter]: [RunCMakeModeType.CMakeSettingsJson], - [cmakeglobals.buildWithCMakeArgs]: [RunCMakeModeType.CMakeListsTxtAdvanced, RunCMakeModeType.CMakeListsTxtBasic] -}; -CMakeRunner.gccMatcher = 'gcc'; -CMakeRunner.clangMatcher = 'clang'; -CMakeRunner.msvcMatcher = 'msvc'; -//# sourceMappingURL=cmake-runner.js.map - -/***/ }), -/***/ 225: -/***/ (function(__unusedmodule, exports) { +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} -"use strict"; +var normalize = pathModule.normalize; +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); - } - return false; -}; +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} -/** - * Find a node of the given type - */ +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); -exports.find = (node, type) => node.nodes.find(node => node.type === type); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } -/** - * Find a node of the given type - */ + var original = p, + seenLinks = {}, + knownHard = {}; -exports.exceedsLimit = (min, max, step = 1, limit) => { - if (limit === false) return false; - if (!exports.isInteger(min) || !exports.isInteger(max)) return false; - return ((Number(max) - Number(min)) / Number(step)) >= limit; -}; + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; -/** - * Escape the given node with '\\' before node.value - */ + start(); -exports.escapeNode = (block, n = 0, type) => { - let node = block.nodes[n]; - if (!node) return; + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; - if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { - if (node.escaped !== true) { - node.value = '\\' + node.value; - node.escaped = true; + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; } } -}; - -/** - * Returns true if the given brace node should be enclosed in literal braces - */ -exports.encloseBrace = node => { - if (node.type !== 'brace') return false; - if ((node.commas >> 0 + node.ranges >> 0) === 0) { - node.invalid = true; - return true; - } - return false; -}; + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; -/** - * Returns true if a brace node is invalid. - */ + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } -exports.isInvalidBrace = block => { - if (block.type !== 'brace') return false; - if (block.invalid === true || block.dollar) return true; - if ((block.commas >> 0 + block.ranges >> 0) === 0) { - block.invalid = true; - return true; - } - if (block.open !== true || block.close !== true) { - block.invalid = true; - return true; - } - return false; -}; + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } -/** - * Returns true if a node is an open or close node - */ + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } -exports.isOpenOrClose = node => { - if (node.type === 'open' || node.type === 'close') { - return true; + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); } - return node.open === true || node.close === true; -}; - -/** - * Reduce an array of text nodes. - */ - -exports.reduce = nodes => nodes.reduce((acc, node) => { - if (node.type === 'text') acc.push(node.value); - if (node.type === 'range') node.type = 'text'; - return acc; -}, []); -/** - * Flatten an array - */ + if (cache) cache[original] = p; -exports.flatten = (...args) => { - const result = []; - const flat = arr => { - for (let i = 0; i < arr.length; i++) { - let ele = arr[i]; - Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); - } - return result; - }; - flat(args); - return result; + return p; }; -/***/ }), - -/***/ 227: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + // make p is absolute + p = pathModule.resolve(p); -const stringify = __webpack_require__(382); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } -/** - * Constants - */ + var original = p, + seenLinks = {}, + knownHard = {}; -const { - MAX_LENGTH, - CHAR_BACKSLASH, /* \ */ - CHAR_BACKTICK, /* ` */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_RIGHT_SQUARE_BRACKET, /* ] */ - CHAR_DOUBLE_QUOTE, /* " */ - CHAR_SINGLE_QUOTE, /* ' */ - CHAR_NO_BREAK_SPACE, - CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = __webpack_require__(807); + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; -/** - * parse - */ + start(); -const parse = (input, options = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; - let opts = options || {}; - let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - if (input.length > max) { - throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } } - let ast = { type: 'root', input, nodes: [] }; - let stack = [ast]; - let block = ast; - let prev = ast; - let brackets = 0; - let length = input.length; - let index = 0; - let depth = 0; - let value; - let memo = {}; + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } - /** - * Helpers - */ + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; - const advance = () => input[index++]; - const push = node => { - if (node.type === 'text' && prev.type === 'dot') { - prev.type = 'text'; + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); } - if (prev && prev.type === 'text' && node.type === 'text') { - prev.value += node.value; - return; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); } - block.nodes.push(node); - node.parent = block; - node.prev = prev; - prev = node; - return node; - }; + return fs.lstat(base, gotStat); + } - push({ type: 'bos' }); + function gotStat(err, stat) { + if (err) return cb(err); - while (index < length) { - block = stack[stack.length - 1]; - value = advance(); - - /** - * Invalid chars - */ - - if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { - continue; + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); } - /** - * Escaped chars - */ - - if (value === CHAR_BACKSLASH) { - push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); - continue; + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } } + fs.stat(base, function(err) { + if (err) return cb(err); - /** - * Right square bracket (literal): ']' - */ - - if (value === CHAR_RIGHT_SQUARE_BRACKET) { - push({ type: 'text', value: '\\' + value }); - continue; - } + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } - /** - * Left square bracket: '[' - */ + function gotTarget(err, target, base) { + if (err) return cb(err); - if (value === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } - let closed = true; - let next; + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; - while (index < length && (next = advance())) { - value += next; - if (next === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - continue; - } +/***/ }), - if (next === CHAR_BACKSLASH) { - value += advance(); - continue; - } +/***/ 129: +/***/ (function(module) { - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - brackets--; +module.exports = require("child_process"); - if (brackets === 0) { - break; - } - } - } +/***/ }), - push({ type: 'text', value }); - continue; - } +/***/ 143: +/***/ (function(module) { - /** - * Parentheses - */ +"use strict"; - if (value === CHAR_LEFT_PARENTHESES) { - block = push({ type: 'paren', nodes: [] }); - stack.push(block); - push({ type: 'text', value }); - continue; - } +module.exports = path => { + const isExtendedLengthPath = /^\\\\\?\\/.test(path); + const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex - if (value === CHAR_RIGHT_PARENTHESES) { - if (block.type !== 'paren') { - push({ type: 'text', value }); - continue; - } - block = stack.pop(); - push({ type: 'text', value }); - block = stack[stack.length - 1]; - continue; - } + if (isExtendedLengthPath || hasNonAscii) { + return path; + } - /** - * Quotes: '|"|` - */ + return path.replace(/\\/g, '/'); +}; - if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { - let open = value; - let next; - if (options.keepQuotes !== true) { - value = ''; - } +/***/ }), - while (index < length && (next = advance())) { - if (next === CHAR_BACKSLASH) { - value += next + advance(); - continue; - } +/***/ 148: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - if (next === open) { - if (options.keepQuotes === true) value += next; - break; - } +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const fsStat = __webpack_require__(231); +const constants_1 = __webpack_require__(171); +const utils = __webpack_require__(933); +function read(directory, settings) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + return readdir(directory, settings); +} +exports.read = read; +function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + return dirents.map((dirent) => { + const entry = { + dirent, + name: dirent.name, + path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` + }; + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } + catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + return entry; + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map((name) => { + const entryPath = `${directory}${settings.pathSegmentSeparator}${name}`; + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + return entry; + }); +} +exports.readdir = readdir; - value += next; - } - push({ type: 'text', value }); - continue; - } +/***/ }), - /** - * Left curly brace: '{' - */ +/***/ 162: +/***/ (function(module, __unusedexports, __webpack_require__) { - if (value === CHAR_LEFT_CURLY_BRACE) { - depth++; +"use strict"; - let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; - let brace = { - type: 'brace', - open: true, - close: false, - dollar, - depth, - commas: 0, - ranges: 0, - nodes: [] - }; +const {Transform} = __webpack_require__(413); - block = push(brace); - stack.push(block); - push({ type: 'open', value }); - continue; - } +class ObjectTransform extends Transform { + constructor() { + super({ + objectMode: true + }); + } +} - /** - * Right curly brace: '}' - */ +class FilterStream extends ObjectTransform { + constructor(filter) { + super(); + this._filter = filter; + } - if (value === CHAR_RIGHT_CURLY_BRACE) { - if (block.type !== 'brace') { - push({ type: 'text', value }); - continue; - } + _transform(data, encoding, callback) { + if (this._filter(data)) { + this.push(data); + } - let type = 'close'; - block = stack.pop(); - block.close = true; + callback(); + } +} - push({ type, value }); - depth--; - - block = stack[stack.length - 1]; - continue; - } - - /** - * Comma: ',' - */ - - if (value === CHAR_COMMA && depth > 0) { - if (block.ranges > 0) { - block.ranges = 0; - let open = block.nodes.shift(); - block.nodes = [open, { type: 'text', value: stringify(block) }]; - } - - push({ type: 'comma', value }); - block.commas++; - continue; - } - - /** - * Dot: '.' - */ - - if (value === CHAR_DOT && depth > 0 && block.commas === 0) { - let siblings = block.nodes; - - if (depth === 0 || siblings.length === 0) { - push({ type: 'text', value }); - continue; - } - - if (prev.type === 'dot') { - block.range = []; - prev.value += value; - prev.type = 'range'; - - if (block.nodes.length !== 3 && block.nodes.length !== 5) { - block.invalid = true; - block.ranges = 0; - prev.type = 'text'; - continue; - } +class UniqueStream extends ObjectTransform { + constructor() { + super(); + this._pushed = new Set(); + } - block.ranges++; - block.args = []; - continue; - } + _transform(data, encoding, callback) { + if (!this._pushed.has(data)) { + this.push(data); + this._pushed.add(data); + } - if (prev.type === 'range') { - siblings.pop(); + callback(); + } +} - let before = siblings[siblings.length - 1]; - before.value += prev.value + value; - prev = before; - block.ranges--; - continue; - } +module.exports = { + FilterStream, + UniqueStream +}; - push({ type: 'dot', value }); - continue; - } - /** - * Text - */ +/***/ }), - push({ type: 'text', value }); - } +/***/ 171: +/***/ (function(__unusedmodule, exports) { - // Mark imbalanced braces and brackets as invalid - do { - block = stack.pop(); +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); +const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); +const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); +const SUPPORTED_MAJOR_VERSION = 10; +const SUPPORTED_MINOR_VERSION = 10; +const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; +const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; +/** + * IS `true` for Node.js 10.10 and greater. + */ +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; - if (block.type !== 'root') { - block.nodes.forEach(node => { - if (!node.nodes) { - if (node.type === 'open') node.isOpen = true; - if (node.type === 'close') node.isClose = true; - if (!node.nodes) node.type = 'text'; - node.invalid = true; - } - }); - // get the location of the block on parent.nodes (block's siblings) - let parent = stack[stack.length - 1]; - let index = parent.nodes.indexOf(block); - // replace the (invalid) block with it's nodes - parent.nodes.splice(index, 1, ...block.nodes); - } - } while (stack.length > 0); +/***/ }), - push({ type: 'eos' }); - return ast; -}; +/***/ 181: +/***/ (function(__unusedmodule, exports, __webpack_require__) { -module.exports = parse; +exports.EntryHeader = __webpack_require__(239); +exports.MainHeader = __webpack_require__(602); /***/ }), -/***/ 231: +/***/ 182: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const async = __webpack_require__(728); -const sync = __webpack_require__(593); -const settings_1 = __webpack_require__(872); -exports.Settings = settings_1.default; -function stat(path, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - return async.read(path, getSettings(), optionsOrSettingsOrCallback); +const fsStat = __webpack_require__(231); +const rpl = __webpack_require__(885); +const constants_1 = __webpack_require__(171); +const utils = __webpack_require__(933); +function read(directory, settings, callback) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings, callback); } - async.read(path, getSettings(optionsOrSettingsOrCallback), callback); + return readdir(directory, settings, callback); } -exports.stat = stat; -function statSync(path, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - return sync.read(path, settings); +exports.read = read; +function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + const entries = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: `${directory}${settings.pathSegmentSeparator}${dirent.name}` + })); + if (!settings.followSymbolicLinks) { + return callSuccessCallback(callback, entries); + } + const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); + rpl(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + callSuccessCallback(callback, rplEntries); + }); + }); } -exports.statSync = statSync; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; - } - return new settings_1.default(settingsOrOptions); +exports.readdirWithFileTypes = readdirWithFileTypes; +function makeRplTaskEntry(entry, settings) { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + return done(null, entry); + } + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return done(statError); + } + return done(null, entry); + } + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + return done(null, entry); + }); + }; +} +function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + const filepaths = names.map((name) => `${directory}${settings.pathSegmentSeparator}${name}`); + const tasks = filepaths.map((filepath) => { + return (done) => fsStat.stat(filepath, settings.fsStatSettings, done); + }); + rpl(tasks, (rplError, results) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + const entries = []; + names.forEach((name, index) => { + const stats = results[index]; + const entry = { + name, + path: filepaths[index], + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + entries.push(entry); + }); + callSuccessCallback(callback, entries); + }); + }); +} +exports.readdir = readdir; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); } /***/ }), -/***/ 233: -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ 199: +/***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; -// Copyright (c) 2019-2020-2021 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; + +const path = __webpack_require__(622); +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR }; -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()); - }); + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` }; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CMakeUtils = void 0; -const path = __importStar(__webpack_require__(622)); -const vcpkgGlobals = __importStar(__webpack_require__(946)); -class CMakeUtils { - constructor(baseUtils) { - this.baseUtils = baseUtils; - } - injectEnvVariables(vcpkgRoot, triplet, baseLib) { - return __awaiter(this, void 0, void 0, function* () { - yield this.baseUtils.wrapOp(`Setup environment variables for triplet '${triplet}' using 'vcpkg env'`, () => __awaiter(this, void 0, void 0, function* () { - var _a; - if (!vcpkgRoot) { - vcpkgRoot = (_a = process.env[vcpkgGlobals.outVcpkgRootPath]) !== null && _a !== void 0 ? _a : ""; - if (!vcpkgRoot) { - throw new Error(`${vcpkgGlobals.outVcpkgRootPath} environment variable is not set.`); - } - } - // Search for vcpkg tool and run it - let vcpkgPath = path.join(vcpkgRoot, 'vcpkg'); - if (this.baseUtils.isWin32()) { - vcpkgPath += '.exe'; - } - const vcpkg = baseLib.tool(vcpkgPath); - vcpkg.arg("env"); - vcpkg.arg("--bin"); - vcpkg.arg("--include"); - vcpkg.arg("--tools"); - vcpkg.arg("--python"); - vcpkg.line(`--triplet ${triplet} set`); - const options = { - cwd: vcpkgRoot, - failOnStdErr: false, - errStream: process.stdout, - outStream: process.stdout, - ignoreReturnCode: true, - silent: false, - windowsVerbatimArguments: false, - env: process.env - }; - const output = yield vcpkg.execSync(options); - if (output.code !== 0) { - throw new Error(`${output.stdout}\n\n${output.stderr}`); - } - const map = this.baseUtils.parseVcpkgEnvOutput(output.stdout); - for (const key in map) { - if (this.baseUtils.isVariableStrippingPath(key)) - continue; - if (key.toUpperCase() === "PATH") { - process.env[key] = process.env[key] + path.delimiter + map[key]; - } - else { - process.env[key] = map[key]; - } - baseLib.debug(`set ${key}=${process.env[key]}`); - } - })); - }); - } - injectVcpkgToolchain(args, triplet, baseLib) { - return __awaiter(this, void 0, void 0, function* () { - args = args !== null && args !== void 0 ? args : []; - const vcpkgRoot = process.env[vcpkgGlobals.outVcpkgRootPath]; - // if RUNVCPKG_VCPKG_ROOT is defined, then use it, and put aside into - // VCPKG_CHAINLOAD_TOOLCHAIN_FILE the existing toolchain. - if (vcpkgRoot && vcpkgRoot.length > 1) { - const toolchainFile = this.baseUtils.getToolchainFile(args); - args = this.baseUtils.removeToolchainFile(args); - const vcpkgToolchain = path.join(vcpkgRoot, '/scripts/buildsystems/vcpkg.cmake'); - args.push(`-DCMAKE_TOOLCHAIN_FILE=${vcpkgToolchain}`); - if (toolchainFile) { - args.push(`-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${toolchainFile}`); - } - // If the triplet is provided, specify the same triplet on the cmd line and set the environment for msvc. - if (triplet) { - args.push(`-DVCPKG_TARGET_TRIPLET=${triplet}`); - // For Windows build agents, inject the environment variables used - // for the MSVC compiler using the 'vcpkg env' command. - // This is not needed for others compiler on Windows, but it should be harmless. - if (this.baseUtils.isWin32() && triplet) { - if (triplet.indexOf("windows") !== -1) { - process.env.CC = "cl.exe"; - process.env.CXX = "cl.exe"; - baseLib.setVariable("CC", "cl.exe"); - baseLib.setVariable("CXX", "cl.exe"); - } - yield this.injectEnvVariables(vcpkgRoot, triplet, baseLib); - } - } - } - return args; - }); - } -} -exports.CMakeUtils = CMakeUtils; -//# sourceMappingURL=utils.js.map -/***/ }), +/** + * POSIX Bracket Regex + */ -/***/ 239: -/***/ (function(module, __unusedexports, __webpack_require__) { +const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; -var Utils = __webpack_require__(643), - Constants = Utils.Constants; - -/* The central directory file header */ -module.exports = function () { - var _verMade = 0x0A, - _version = 0x0A, - _flags = 0, - _method = 0, - _time = 0, - _crc = 0, - _compressedSize = 0, - _size = 0, - _fnameLen = 0, - _extraLen = 0, - - _comLen = 0, - _diskStart = 0, - _inattr = 0, - _attr = 0, - _offset = 0; - - var _dataHeader = {}; - - function setTime(val) { - val = new Date(val); - _time = (val.getFullYear() - 1980 & 0x7f) << 25 // b09-16 years from 1980 - | (val.getMonth() + 1) << 21 // b05-08 month - | val.getDate() << 16 // b00-04 hour - - // 2 bytes time - | val.getHours() << 11 // b11-15 hour - | val.getMinutes() << 5 // b05-10 minute - | val.getSeconds() >> 1; // b00-04 seconds divided by 2 - } - - setTime(+new Date()); - - return { - get made () { return _verMade; }, - set made (val) { _verMade = val; }, - - get version () { return _version; }, - set version (val) { _version = val }, - - get flags () { return _flags }, - set flags (val) { _flags = val; }, - - get method () { return _method; }, - set method (val) { _method = val; }, - - get time () { return new Date( - ((_time >> 25) & 0x7f) + 1980, - ((_time >> 21) & 0x0f) - 1, - (_time >> 16) & 0x1f, - (_time >> 11) & 0x1f, - (_time >> 5) & 0x3f, - (_time & 0x1f) << 1 - ); - }, - set time (val) { - setTime(val); - }, - - get crc () { return _crc; }, - set crc (val) { _crc = val; }, - - get compressedSize () { return _compressedSize; }, - set compressedSize (val) { _compressedSize = val; }, - - get size () { return _size; }, - set size (val) { _size = val; }, - - get fileNameLength () { return _fnameLen; }, - set fileNameLength (val) { _fnameLen = val; }, - - get extraLength () { return _extraLen }, - set extraLength (val) { _extraLen = val; }, - - get commentLength () { return _comLen }, - set commentLength (val) { _comLen = val }, - - get diskNumStart () { return _diskStart }, - set diskNumStart (val) { _diskStart = val }, - - get inAttr () { return _inattr }, - set inAttr (val) { _inattr = val }, - - get attr () { return _attr }, - set attr (val) { _attr = val }, - - get offset () { return _offset }, - set offset (val) { _offset = val }, - - get encripted () { return (_flags & 1) === 1 }, - - get entryHeaderSize () { - return Constants.CENHDR + _fnameLen + _extraLen + _comLen; - }, - - get realDataOffset () { - return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen; - }, - - get dataHeader () { - return _dataHeader; - }, - - loadDataHeaderFromBinary : function(/*Buffer*/input) { - var data = input.slice(_offset, _offset + Constants.LOCHDR); - // 30 bytes and should start with "PK\003\004" - if (data.readUInt32LE(0) !== Constants.LOCSIG) { - throw Utils.Errors.INVALID_LOC; - } - _dataHeader = { - // version needed to extract - version : data.readUInt16LE(Constants.LOCVER), - // general purpose bit flag - flags : data.readUInt16LE(Constants.LOCFLG), - // compression method - method : data.readUInt16LE(Constants.LOCHOW), - // modification time (2 bytes time, 2 bytes date) - time : data.readUInt32LE(Constants.LOCTIM), - // uncompressed file crc-32 value - crc : data.readUInt32LE(Constants.LOCCRC), - // compressed size - compressedSize : data.readUInt32LE(Constants.LOCSIZ), - // uncompressed size - size : data.readUInt32LE(Constants.LOCLEN), - // filename length - fnameLen : data.readUInt16LE(Constants.LOCNAM), - // extra field length - extraLen : data.readUInt16LE(Constants.LOCEXT) - } - }, - - loadFromBinary : function(/*Buffer*/data) { - // data should be 46 bytes and start with "PK 01 02" - if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) { - throw Utils.Errors.INVALID_CEN; - } - // version made by - _verMade = data.readUInt16LE(Constants.CENVEM); - // version needed to extract - _version = data.readUInt16LE(Constants.CENVER); - // encrypt, decrypt flags - _flags = data.readUInt16LE(Constants.CENFLG); - // compression method - _method = data.readUInt16LE(Constants.CENHOW); - // modification time (2 bytes time, 2 bytes date) - _time = data.readUInt32LE(Constants.CENTIM); - // uncompressed file crc-32 value - _crc = data.readUInt32LE(Constants.CENCRC); - // compressed size - _compressedSize = data.readUInt32LE(Constants.CENSIZ); - // uncompressed size - _size = data.readUInt32LE(Constants.CENLEN); - // filename length - _fnameLen = data.readUInt16LE(Constants.CENNAM); - // extra field length - _extraLen = data.readUInt16LE(Constants.CENEXT); - // file comment length - _comLen = data.readUInt16LE(Constants.CENCOM); - // volume number start - _diskStart = data.readUInt16LE(Constants.CENDSK); - // internal file attributes - _inattr = data.readUInt16LE(Constants.CENATT); - // external file attributes - _attr = data.readUInt32LE(Constants.CENATX); - // LOC header offset - _offset = data.readUInt32LE(Constants.CENOFF); - }, - - dataHeaderToBinary : function() { - // LOC header size (30 bytes) - var data = Buffer.alloc(Constants.LOCHDR); - // "PK\003\004" - data.writeUInt32LE(Constants.LOCSIG, 0); - // version needed to extract - data.writeUInt16LE(_version, Constants.LOCVER); - // general purpose bit flag - data.writeUInt16LE(_flags, Constants.LOCFLG); - // compression method - data.writeUInt16LE(_method, Constants.LOCHOW); - // modification time (2 bytes time, 2 bytes date) - data.writeUInt32LE(_time, Constants.LOCTIM); - // uncompressed file crc-32 value - data.writeUInt32LE(_crc, Constants.LOCCRC); - // compressed size - data.writeUInt32LE(_compressedSize, Constants.LOCSIZ); - // uncompressed size - data.writeUInt32LE(_size, Constants.LOCLEN); - // filename length - data.writeUInt16LE(_fnameLen, Constants.LOCNAM); - // extra field length - data.writeUInt16LE(_extraLen, Constants.LOCEXT); - return data; - }, - - entryHeaderToBinary : function() { - // CEN header size (46 bytes) - var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen); - // "PK\001\002" - data.writeUInt32LE(Constants.CENSIG, 0); - // version made by - data.writeUInt16LE(_verMade, Constants.CENVEM); - // version needed to extract - data.writeUInt16LE(_version, Constants.CENVER); - // encrypt, decrypt flags - data.writeUInt16LE(_flags, Constants.CENFLG); - // compression method - data.writeUInt16LE(_method, Constants.CENHOW); - // modification time (2 bytes time, 2 bytes date) - data.writeUInt32LE(_time, Constants.CENTIM); - // uncompressed file crc-32 value - data.writeInt32LE(_crc & 0xFFFF, Constants.CENCRC, true); - // compressed size - data.writeUInt32LE(_compressedSize, Constants.CENSIZ); - // uncompressed size - data.writeUInt32LE(_size, Constants.CENLEN); - // filename length - data.writeUInt16LE(_fnameLen, Constants.CENNAM); - // extra field length - data.writeUInt16LE(_extraLen, Constants.CENEXT); - // file comment length - data.writeUInt16LE(_comLen, Constants.CENCOM); - // volume number start - data.writeUInt16LE(_diskStart, Constants.CENDSK); - // internal file attributes - data.writeUInt16LE(_inattr, Constants.CENATT); - // external file attributes - data.writeUInt32LE(_attr, Constants.CENATX); - // LOC header offset - data.writeUInt32LE(_offset, Constants.CENOFF); - // fill all with - data.fill(0x00, Constants.CENHDR); - return data; - }, - - toString : function() { - return '{\n' + - '\t"made" : ' + _verMade + ",\n" + - '\t"version" : ' + _version + ",\n" + - '\t"flags" : ' + _flags + ",\n" + - '\t"method" : ' + Utils.methodToString(_method) + ",\n" + - '\t"time" : ' + this.time + ",\n" + - '\t"crc" : 0x' + _crc.toString(16).toUpperCase() + ",\n" + - '\t"compressedSize" : ' + _compressedSize + " bytes,\n" + - '\t"size" : ' + _size + " bytes,\n" + - '\t"fileNameLength" : ' + _fnameLen + ",\n" + - '\t"extraLength" : ' + _extraLen + " bytes,\n" + - '\t"commentLength" : ' + _comLen + " bytes,\n" + - '\t"diskNumStart" : ' + _diskStart + ",\n" + - '\t"inAttr" : ' + _inattr + ",\n" + - '\t"attr" : ' + _attr + ",\n" + - '\t"offset" : ' + _offset + ",\n" + - '\t"entryHeaderSize" : ' + (Constants.CENHDR + _fnameLen + _extraLen + _comLen) + " bytes\n" + - '}'; - } - } -}; - - -/***/ }), +module.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, -/***/ 245: -/***/ (function(module, __unusedexports, __webpack_require__) { + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, -"use strict"; + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, -const {promisify} = __webpack_require__(669); -const path = __webpack_require__(622); -const globby = __webpack_require__(625); -const isGlob = __webpack_require__(846); -const slash = __webpack_require__(143); -const gracefulFs = __webpack_require__(598); -const isPathCwd = __webpack_require__(350); -const isPathInside = __webpack_require__(697); -const rimraf = __webpack_require__(569); -const pMap = __webpack_require__(521); + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ -const rimrafP = promisify(rimraf); + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ -const rimrafOptions = { - glob: false, - unlink: gracefulFs.unlink, - unlinkSync: gracefulFs.unlinkSync, - chmod: gracefulFs.chmod, - chmodSync: gracefulFs.chmodSync, - stat: gracefulFs.stat, - statSync: gracefulFs.statSync, - lstat: gracefulFs.lstat, - lstatSync: gracefulFs.lstatSync, - rmdir: gracefulFs.rmdir, - rmdirSync: gracefulFs.rmdirSync, - readdir: gracefulFs.readdir, - readdirSync: gracefulFs.readdirSync -}; + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ -function safeCheck(file, cwd) { - if (isPathCwd(file)) { - throw new Error('Cannot delete the current working directory. Can be overridden with the `force` option.'); - } + CHAR_ASTERISK: 42, /* * */ - if (!isPathInside(file, cwd)) { - throw new Error('Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.'); - } -} - -function normalizePatterns(patterns) { - patterns = Array.isArray(patterns) ? patterns : [patterns]; - - patterns = patterns.map(pattern => { - if (process.platform === 'win32' && isGlob(pattern) === false) { - return slash(pattern); - } - - return pattern; - }); - - return patterns; -} - -module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => { - options = { - expandDirectories: false, - onlyFiles: false, - followSymbolicLinks: false, - cwd, - ...options - }; - - patterns = normalizePatterns(patterns); + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - const files = (await globby(patterns, options)) - .sort((a, b) => b.localeCompare(a)); + SEP: path.sep, - const mapper = async file => { - file = path.resolve(cwd, file); + /** + * Create EXTGLOB_CHARS + */ - if (!force) { - safeCheck(file, cwd); - } + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, - if (!dryRun) { - await rimrafP(file, rimrafOptions); - } + /** + * Create GLOB_CHARS + */ - return file; - }; + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } +}; - const removedFiles = await pMap(files, mapper, options); - removedFiles.sort((a, b) => a.localeCompare(b)); +/***/ }), - return removedFiles; -}; +/***/ 201: +/***/ (function(module, __unusedexports, __webpack_require__) { -module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => { - options = { - expandDirectories: false, - onlyFiles: false, - followSymbolicLinks: false, - cwd, - ...options - }; +"use strict"; - patterns = normalizePatterns(patterns); +const os = __webpack_require__(87); - const files = globby.sync(patterns, options) - .sort((a, b) => b.localeCompare(a)); +const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/; +const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/; +const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir(); - const removedFiles = files.map(file => { - file = path.resolve(cwd, file); +module.exports = (stack, options) => { + options = Object.assign({pretty: false}, options); - if (!force) { - safeCheck(file, cwd); - } + return stack.replace(/\\/g, '/') + .split('\n') + .filter(line => { + const pathMatches = line.match(extractPathRegex); + if (pathMatches === null || !pathMatches[1]) { + return true; + } - if (!dryRun) { - rimraf.sync(file, rimrafOptions); - } + const match = pathMatches[1]; - return file; - }); + // Electron + if ( + match.includes('.app/Contents/Resources/electron.asar') || + match.includes('.app/Contents/Resources/default_app.asar') + ) { + return false; + } - removedFiles.sort((a, b) => a.localeCompare(b)); + return !pathRegex.test(match); + }) + .filter(line => line.trim() !== '') + .map(line => { + if (options.pretty) { + return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~'))); + } - return removedFiles; + return line; + }) + .join('\n'); }; /***/ }), -/***/ 247: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 210: +/***/ (function(__unusedmodule, exports) { "use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; -const os = __webpack_require__(87); -const hasFlag = __webpack_require__(364); - -const env = process.env; - -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } +/***/ }), - if (hasFlag('color=256')) { - return 2; - } +/***/ 211: +/***/ (function(module) { - if (stream && !stream.isTTY && forceColor !== true) { - return 0; - } +module.exports = require("https"); - const min = forceColor ? 1 : 0; +/***/ }), - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(process.versions.node.split('.')[0]) >= 8 && - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } +/***/ 214: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - return 1; - } +"use strict"; - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - - if (env.COLORTERM === 'truecolor') { - return 3; - } - - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - if (env.TERM === 'dumb') { - return min; - } - - return min; -} - -function getSupportLevel(stream) { - const level = supportsColor(stream); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) +// Copyright (c) 2019-2020-2021 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; }; - - -/***/ }), - -/***/ 250: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var constants = __webpack_require__(619) - -var origCwd = process.cwd -var cwd = null - -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform - -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd +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 }); +exports.CMakeRunner = void 0; +const baseutillib = __importStar(__webpack_require__(758)); +const path = __importStar(__webpack_require__(622)); +const cmakesettings_runner_1 = __webpack_require__(454); +const cmakeglobals = __importStar(__webpack_require__(330)); +const ninjalib = __importStar(__webpack_require__(72)); +const using_statement_1 = __webpack_require__(443); +const cmakelib = __importStar(__webpack_require__(233)); +var RunCMakeModeType; +(function (RunCMakeModeType) { + RunCMakeModeType[RunCMakeModeType["CMakeListsTxtBasic"] = 1] = "CMakeListsTxtBasic"; + RunCMakeModeType[RunCMakeModeType["CMakeListsTxtAdvanced"] = 2] = "CMakeListsTxtAdvanced"; + RunCMakeModeType[RunCMakeModeType["CMakeSettingsJson"] = 3] = "CMakeSettingsJson"; +})(RunCMakeModeType || (RunCMakeModeType = {})); +function getTargetType(typeString) { + return RunCMakeModeType[typeString]; } -try { - process.cwd() -} catch (er) {} - -var chdir = process.chdir -process.chdir = function(d) { - cwd = null - chdir.call(process, d) +const CMakeGenerator = { + 'Unknown': {}, + 'VS16Arm': { 'G': 'Visual Studio 16 2019', 'A': 'ARM', 'MultiConfiguration': true }, + 'VS16Win32': { 'G': 'Visual Studio 16 2019', 'A': 'Win32', 'MultiConfiguration': true }, + 'VS16Win64': { 'G': 'Visual Studio 16 2019', 'A': 'x64', 'MultiConfiguration': true }, + 'VS16Arm64': { 'G': 'Visual Studio 16 2019', 'A': 'ARM64', 'MultiConfiguration': true }, + 'VS15Arm': { 'G': 'Visual Studio 15 2017', 'A': 'ARM', 'MultiConfiguration': true }, + 'VS15Win32': { 'G': 'Visual Studio 15 2017', 'A': 'Win32', 'MultiConfiguration': true }, + 'VS15Win64': { 'G': 'Visual Studio 15 2017', 'A': 'x64', 'MultiConfiguration': true }, + 'VS15Arm64': { 'G': 'Visual Studio 15 2017', 'A': 'ARM64', 'MultiConfiguration': true }, + 'Ninja': { 'G': 'Ninja', 'A': '', 'MultiConfiguration': false }, + 'NinjaMulti': { 'G': 'Ninja Multi-Config', 'A': '', 'MultiConfiguration': true }, + 'UnixMakefiles': { 'G': 'Unix Makefiles', 'A': '', 'MultiConfiguration': false } +}; +function getGenerator(generatorString) { + const generatorName = CMakeGenerator[generatorString]; + return generatorName; } - -module.exports = patch - -function patch (fs) { - // (re-)implement some things that are known busted or missing. - - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } - - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } - - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. - - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) - - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) - - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) - - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) - - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) - - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) - - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } - - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. - - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; +class CMakeRunner { + /* + // Unfortunately there is not a way to discriminate between a value provided by the user + // from a default value (not provided by the user), hence it is not possible to identify + // what the user provided. + private static warnIfUnused(inputName: string, taskMode: TaskModeType): void { + if (inputName in CMakeRunner.modePerInput) { + const usedInMode: TaskModeType[] = CMakeRunner.modePerInput[name]; + if (usedInMode) { + if (usedInMode.indexOf(taskMode) < 0) { } + + //??this.tl.warning(`The input '${inputName}' is ignored in mode '${taskMode}'`); + } } - if (cb) cb(er) - }) - }})(fs.rename) - } - - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - - // This ensures `util.promisify` works as it does for native `fs.read`. - read.__proto__ = fs$read - return read - })(fs.read) - - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er } - } - }})(fs.readSync) - - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) + */ + constructor(tl) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + this.tl = tl; + this.buildDir = ""; + this.generator = {}; + this.baseUtils = new baseutillib.BaseUtilLib(this.tl); + this.cmakeUtils = new cmakelib.CMakeUtils(this.baseUtils); + this.ninjaLib = new ninjalib.NinjaProvider(this.tl); + const regs = this.tl.getDelimitedInput(cmakeglobals.logCollectionRegExps, ';', false); + this.logFilesCollector = new baseutillib.LogFileCollector(this.tl, regs, (path) => baseutillib.dumpFile(this.tl, path)); + const mode = (_a = this.tl.getInput(cmakeglobals.cmakeListsOrSettingsJson, true)) !== null && _a !== void 0 ? _a : ""; + const runMode = getTargetType(mode); + if (!runMode) { + throw new Error(`ctor(): invalid mode '${mode}'.`); } - } - return ret - } - } - - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } - - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } + this.runMode = runMode; + let required = this.runMode === RunCMakeModeType.CMakeSettingsJson; + this.cmakeSettingsJsonPath = (_b = this.tl.getPathInput(cmakeglobals.cmakeSettingsJsonPath, required, required)) !== null && _b !== void 0 ? _b : ""; + required = this.runMode !== RunCMakeModeType.CMakeSettingsJson; + this.cmakeListsTxtPath = (_c = this.tl.getPathInput(cmakeglobals.cmakeListsTxtPath, required, required)) !== null && _c !== void 0 ? _c : ""; + this.buildDir = (_d = this.tl.getInput(cmakeglobals.buildDirectory, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _d !== void 0 ? _d : ""; + this.appendedArgs = (_e = this.tl.getInput(cmakeglobals.cmakeAppendedArgs, false)) !== null && _e !== void 0 ? _e : ""; + this.configurationFilter = (_f = this.tl.getInput(cmakeglobals.configurationRegexFilter, false)) !== null && _f !== void 0 ? _f : ""; + this.ninjaPath = ''; + if (this.tl.isFilePathSupplied(cmakeglobals.ninjaPath)) { + this.ninjaPath = (_g = tl.getInput(cmakeglobals.ninjaPath, false)) !== null && _g !== void 0 ? _g : ""; } - return ret - } - - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } - - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } - - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } - - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 + this.cmakeToolchainPath = ""; + if (this.tl.isFilePathSupplied(cmakeglobals.cmakeToolchainPath)) { + this.cmakeToolchainPath = (_h = tl.getInput(cmakeglobals.cmakeToolchainPath, false)) !== null && _h !== void 0 ? _h : ""; } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } - - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; + const gen = (_j = this.tl.getInput(cmakeglobals.cmakeGenerator, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _j !== void 0 ? _j : ""; + this.generator = getGenerator(gen); + this.ninjaDownloadUrl = (_k = this.tl.getInput(cmakeglobals.ninjaDownloadUrl, false)) !== null && _k !== void 0 ? _k : ""; + this.doBuild = (_l = this.tl.getBoolInput(cmakeglobals.buildWithCMake, false)) !== null && _l !== void 0 ? _l : false; + this.doBuildArgs = (_m = this.tl.getInput(cmakeglobals.buildWithCMakeArgs, false)) !== null && _m !== void 0 ? _m : ""; + this.cmakeSourceDir = path.dirname((_o = baseutillib.BaseUtilLib.normalizePath(this.cmakeListsTxtPath)) !== null && _o !== void 0 ? _o : ""); + this.useVcpkgToolchainFile = (_p = this.tl.getBoolInput(cmakeglobals.useVcpkgToolchainFile, false)) !== null && _p !== void 0 ? _p : false; + this.cmakeBuildType = (_q = this.tl.getInput(cmakeglobals.cmakeBuildType, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _q !== void 0 ? _q : ""; + this.vcpkgTriplet = (_r = (this.tl.getInput(cmakeglobals.cmakeVcpkgTriplet, false) || + process.env.RUNVCPKG_VCPKG_TRIPLET)) !== null && _r !== void 0 ? _r : ""; + this.sourceScript = (_s = this.tl.getInput(cmakeglobals.cmakeWrapperCommand, false)) !== null && _s !== void 0 ? _s : ""; } - } - - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true + run() { + return __awaiter(this, void 0, void 0, function* () { + this.tl.debug('run()<<'); + yield this.configure(); + this.tl.debug('run()>>'); + }); + } + configure() { + var _a; + return __awaiter(this, void 0, void 0, function* () { + this.tl.debug('configure()<<'); + // Contains the '--config ' when using multiconfiguration generators. + let prependedBuildArguments = ""; + let cmakeArgs = []; + switch (this.runMode) { + case RunCMakeModeType.CMakeListsTxtAdvanced: + case RunCMakeModeType.CMakeListsTxtBasic: { + // Search for CMake tool and run it. + let cmake; + if (this.sourceScript) { + cmake = this.tl.tool(this.sourceScript); + cmakeArgs.push(yield this.tl.which('cmake', true)); + } + else { + cmake = this.tl.tool(yield this.tl.which('cmake', true)); + } + if (this.runMode === RunCMakeModeType.CMakeListsTxtAdvanced) { + // If Ninja is required, specify the path to it. + if (this.baseUtils.isNinjaGenerator([this.appendedArgs])) { + if (!this.baseUtils.isMakeProgram([this.appendedArgs])) { + const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); + cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); + } + } + if (this.appendedArgs) { + this.tl.debug(`Parsing additional CMake args: ${this.appendedArgs}`); + const addedArgs = cmake._argStringToArray(this.appendedArgs); + this.tl.debug(`Appending args: ${JSON.stringify(addedArgs)}`); + cmakeArgs = [...cmakeArgs, ...addedArgs]; + } + } + else if (this.runMode === RunCMakeModeType.CMakeListsTxtBasic) { + const generatorName = this.generator['G']; + const generatorArch = this.generator['A']; + const generatorIsMultiConf = (_a = this.generator['MultiConfiguration']) !== null && _a !== void 0 ? _a : false; + cmakeArgs.push(`-G${generatorName}`); + if (generatorArch) { + cmakeArgs.push(`-A${generatorArch}`); + } + if (CMakeRunner.isNinjaGenerator(generatorName)) { + const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); + cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); + } + if (this.cmakeToolchainPath) { + cmakeArgs.push(`-DCMAKE_TOOLCHAIN_FILE=${this.cmakeToolchainPath}`); + } + // Add CMake's build type, unless a multi configuration generator is being used. + if (!generatorIsMultiConf) { + cmakeArgs.push(`-DCMAKE_BUILD_TYPE=${this.cmakeBuildType}`); + } + prependedBuildArguments = this.prependBuildConfigIfNeeded(this.doBuildArgs, generatorIsMultiConf, this.cmakeBuildType); + } + // Use vcpkg toolchain if requested. + if (this.useVcpkgToolchainFile === true) { + cmakeArgs = yield this.cmakeUtils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet, this.tl); + } + // The source directory is required for any mode. + cmakeArgs.push(this.cmakeSourceDir); + this.tl.debug(`CMake arguments: ${cmakeArgs}`); + for (const arg of cmakeArgs) { + cmake.arg(arg); + } + // Ensure the build directory is existing. + yield this.tl.mkdirP(this.buildDir); + const options = { + cwd: this.buildDir, + failOnStdErr: false, + errStream: process.stdout, + outStream: process.stdout, + ignoreReturnCode: true, + silent: false, + windowsVerbatimArguments: false, + env: process.env, + listeners: { + stdout: (t) => this.logFilesCollector.handleOutput(t), + stderr: (t) => this.logFilesCollector.handleOutput(t), + } + }; + this.tl.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); + let code = -1; + yield using_statement_1.using(baseutillib.Matcher.createMatcher('cmake', this.tl, this.cmakeSourceDir), (matcher) => __awaiter(this, void 0, void 0, function* () { + code = yield this.baseUtils.wrapOp("Generate project files with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield cmake.exec(options); })); + })); + if (code !== 0) { + throw new Error(`"CMake failed with error code: '${code}'.`); + } + if (this.doBuild) { + yield using_statement_1.using(baseutillib.Matcher.createMatcher(CMakeRunner.getBuildMatcher(this.buildDir, this.tl), this.tl), (matcher) => __awaiter(this, void 0, void 0, function* () { + yield this.baseUtils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield CMakeRunner.build(this.tl, this.buildDir, prependedBuildArguments + this.doBuildArgs, options); })); + })); + } + break; + } + case RunCMakeModeType.CMakeSettingsJson: { + const cmakeJson = new cmakesettings_runner_1.CMakeSettingsJsonRunner(this.tl, this.cmakeSettingsJsonPath, this.configurationFilter, this.appendedArgs, this.tl.getSrcDir(), this.vcpkgTriplet, this.useVcpkgToolchainFile, this.doBuild, this.ninjaPath, this.ninjaDownloadUrl, this.sourceScript, this.buildDir); + yield this.baseUtils.wrapOp("Run CMake with CMakeSettings.json", () => __awaiter(this, void 0, void 0, function* () { return yield cmakeJson.run(); })); + break; + } + } + }); + } + static isNinjaGenerator(generatorName) { + return generatorName === CMakeGenerator['Ninja']['G'] || + generatorName === CMakeGenerator['NinjaMulti']['G']; + } + /// If not already provided, creates the '--config ' argument to pass when building. + /// Return a string of arguments to prepend the build arguments. + prependBuildConfigIfNeeded(buildArgs, multiConfi, buildType) { + let prependArgs = ""; + if (multiConfi && !buildArgs.includes("--config")) { + prependArgs = ` --config ${buildType} `; + } + return prependArgs; + } + /** + * Build with CMake. + * @export + * @param {string} buildDir + * @param {string} buildArgs + * @param {trm.IExecOptions} options + * @param {string} sourceScript + * @returns {Promise} + */ + static build(baseLib, buildDir, buildArgs, options) { + return __awaiter(this, void 0, void 0, function* () { + // Run CMake with the given arguments + const cmake = baseLib.tool(yield baseLib.which('cmake', true)); + cmake.arg("--build"); + cmake.arg("."); + if (buildArgs) + cmake.line(buildArgs); + // Run the command in the build directory + options.cwd = buildDir; + console.log(`Building with CMake in build directory '${options.cwd}' ...`); + const code = yield cmake.exec(options); + if (code !== 0) { + throw new Error(`"Build failed with error code: '${code}'."`); + } + }); + } + static getDefaultMatcher() { + const plat = process.platform; + return plat === "win32" ? CMakeRunner.msvcMatcher : + plat === "darwin" ? CMakeRunner.clangMatcher : CMakeRunner.gccMatcher; + } + static getCompilerMatcher(line) { + let matcherName = undefined; + if (line.includes('g++') || line.includes('gcc') || line.includes('c++')) + matcherName = CMakeRunner.gccMatcher; + else if (line.includes('cl.exe')) + matcherName = CMakeRunner.msvcMatcher; + else if (line.includes('clang')) + matcherName = CMakeRunner.clangMatcher; + return matcherName; + } + static getBuildMatcher(buildDir, tl) { + var _a; + let cxxMatcher; + let ccMatcher; + const utils = new baseutillib.BaseUtilLib(tl); + try { + const cmakeCacheTxtPath = path.join(buildDir, "CMakeCache.txt"); + const [ok, cacheContent] = utils.readFile(cmakeCacheTxtPath); + tl.debug(`Loaded fileCMakeCache.txt at path='${cmakeCacheTxtPath}'`); + if (ok) { + for (const line of cacheContent.split('\n')) { + tl.debug(`text=${line}`); + if (line.includes("CMAKE_CXX_COMPILER:")) { + tl.debug(`Found CXX compiler: '${line}'.`); + cxxMatcher = CMakeRunner.getCompilerMatcher(line); + tl.debug(`Matcher selected for CXX: ${cxxMatcher}`); + break; + } + if (line.includes("CMAKE_C_COMPILER:")) { + tl.debug(`Found C compiler: '${line}'.`); + ccMatcher = CMakeRunner.getCompilerMatcher(line); + tl.debug(`Matcher selected for CC: ${ccMatcher}`); + break; + } + } + } + } + catch (error) { + tl.debug(error.toString()); + } + const defaultMatcher = CMakeRunner.getDefaultMatcher(); + tl.debug(`Default matcher according to platform is: ${defaultMatcher}`); + const selectedMatcher = (_a = cxxMatcher !== null && cxxMatcher !== void 0 ? cxxMatcher : ccMatcher) !== null && _a !== void 0 ? _a : defaultMatcher; + tl.debug(`Selected matcher: ${selectedMatcher}`); + return selectedMatcher; } - - return false - } } - +exports.CMakeRunner = CMakeRunner; +CMakeRunner.modePerInput = { + [cmakeglobals.cmakeListsTxtPath]: [RunCMakeModeType.CMakeListsTxtBasic, RunCMakeModeType.CMakeListsTxtAdvanced], + [cmakeglobals.cmakeSettingsJsonPath]: [RunCMakeModeType.CMakeSettingsJson], + [cmakeglobals.cmakeToolchainPath]: [RunCMakeModeType.CMakeListsTxtBasic], + /*[globals.useVcpkgToolchainFile]: all */ + /*[globals.vcpkgTriplet]: all */ + [cmakeglobals.cmakeBuildType]: [RunCMakeModeType.CMakeListsTxtBasic], + [cmakeglobals.cmakeGenerator]: [RunCMakeModeType.CMakeListsTxtBasic], + /*[globals.buildDirectory]: all */ + [cmakeglobals.cmakeAppendedArgs]: [RunCMakeModeType.CMakeListsTxtAdvanced, RunCMakeModeType.CMakeSettingsJson], + [cmakeglobals.configurationRegexFilter]: [RunCMakeModeType.CMakeSettingsJson], + [cmakeglobals.buildWithCMakeArgs]: [RunCMakeModeType.CMakeListsTxtAdvanced, RunCMakeModeType.CMakeListsTxtBasic] +}; +CMakeRunner.gccMatcher = 'gcc'; +CMakeRunner.clangMatcher = 'clang'; +CMakeRunner.msvcMatcher = 'msvc'; +//# sourceMappingURL=cmake-runner.js.map /***/ }), -/***/ 257: -/***/ (function(module) { +/***/ 225: +/***/ (function(__unusedmodule, exports) { "use strict"; -module.exports = (string, count = 1, options) => { - options = { - indent: ' ', - includeEmptyLines: false, - ...options - }; +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; - if (typeof string !== 'string') { - throw new TypeError( - `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` - ); - } +/** + * Find a node of the given type + */ - if (typeof count !== 'number') { - throw new TypeError( - `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` - ); - } +exports.find = (node, type) => node.nodes.find(node => node.type === type); - if (typeof options.indent !== 'string') { - throw new TypeError( - `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` - ); - } +/** + * Find a node of the given type + */ - if (count === 0) { - return string; - } - - const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; - - return string.replace(regex, options.indent.repeat(count)); +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; }; +/** + * Escape the given node with '\\' before node.value + */ -/***/ }), - -/***/ 265: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(622); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = __webpack_require__(199); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); +exports.escapeNode = (block, n = 0, type) => { + let node = block.nodes[n]; + if (!node) return; -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } }; -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; return true; } return false; }; -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; +/** + * Returns true if a brace node is invalid. + */ + +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; } - return win32 === true || path.sep === '\\'; + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; }; -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; +/** + * Returns true if a node is an open or close node + */ -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; } - return output; + return node.open === true || node.close === true; }; -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; +/** + * Reduce an array of text nodes. + */ - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ + +exports.flatten = (...args) => { + const result = []; + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + let ele = arr[i]; + Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); + } + return result; + }; + flat(args); + return result; }; /***/ }), -/***/ 273: +/***/ 227: /***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; -const indentString = __webpack_require__(257); -const cleanStack = __webpack_require__(201); -const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); +const stringify = __webpack_require__(382); -class AggregateError extends Error { - constructor(errors) { - if (!Array.isArray(errors)) { - throw new TypeError(`Expected input to be an Array, got ${typeof errors}`); - } +/** + * Constants + */ - errors = [...errors].map(error => { - if (error instanceof Error) { - return error; - } +const { + MAX_LENGTH, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, /* ] */ + CHAR_DOUBLE_QUOTE, /* " */ + CHAR_SINGLE_QUOTE, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = __webpack_require__(807); - if (error !== null && typeof error === 'object') { - // Handle plain error objects with message property and/or possibly other metadata - return Object.assign(new Error(error.message), error); - } +/** + * parse + */ - return new Error(error); - }); +const parse = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } - let message = errors - .map(error => { - // The `stack` property is not standardized, so we can't assume it exists - return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error); - }) - .join('\n'); - message = '\n' + indentString(message, 4); - super(message); + let opts = options || {}; + let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } - this.name = 'AggregateError'; + let ast = { type: 'root', input, nodes: [] }; + let stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + let length = input.length; + let index = 0; + let depth = 0; + let value; + let memo = {}; - Object.defineProperty(this, '_errors', {value: errors}); - } + /** + * Helpers + */ - * [Symbol.iterator]() { - for (const error of this._errors) { - yield error; - } - } -} + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } -module.exports = AggregateError; + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; -/***/ }), + push({ type: 'bos' }); -/***/ 291: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const events_1 = __webpack_require__(614); -const fsScandir = __webpack_require__(661); -const fastq = __webpack_require__(830); -const common = __webpack_require__(617); -const reader_1 = __webpack_require__(962); -class AsyncReader extends reader_1.default { - constructor(_root, _settings) { - super(_root, _settings); - this._settings = _settings; - this._scandir = fsScandir.scandir; - this._emitter = new events_1.EventEmitter(); - this._queue = fastq(this._worker.bind(this), this._settings.concurrency); - this._isFatalError = false; - this._isDestroyed = false; - this._queue.drain = () => { - if (!this._isFatalError) { - this._emitter.emit('end'); - } - }; - } - read() { - this._isFatalError = false; - this._isDestroyed = false; - setImmediate(() => { - this._pushToQueue(this._root, this._settings.basePath); - }); - return this._emitter; - } - destroy() { - if (this._isDestroyed) { - throw new Error('The reader is already destroyed'); - } - this._isDestroyed = true; - this._queue.killAndDrain(); - } - onEntry(callback) { - this._emitter.on('entry', callback); - } - onError(callback) { - this._emitter.once('error', callback); - } - onEnd(callback) { - this._emitter.once('end', callback); - } - _pushToQueue(directory, base) { - const queueItem = { directory, base }; - this._queue.push(queueItem, (error) => { - if (error !== null) { - this._handleError(error); - } - }); - } - _worker(item, done) { - this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { - if (error !== null) { - return done(error, undefined); - } - for (const entry of entries) { - this._handleEntry(entry, item.base); - } - done(null, undefined); - }); - } - _handleError(error) { - if (!common.isFatalError(this._settings, error)) { - return; - } - this._isFatalError = true; - this._isDestroyed = true; - this._emitter.emit('error', error); - } - _handleEntry(entry, base) { - if (this._isDestroyed || this._isFatalError) { - return; - } - const fullpath = entry.path; - if (base !== undefined) { - entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); - } - if (common.isAppliedFilter(this._settings.entryFilter, entry)) { - this._emitEntry(entry); - } - if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { - this._pushToQueue(fullpath, entry.path); - } - } - _emitEntry(entry) { - this._emitter.emit('entry', entry); - } -} -exports.default = AsyncReader; + /** + * Invalid chars + */ + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } -/***/ }), + /** + * Escaped chars + */ -/***/ 302: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } -module.exports = realpath -realpath.realpath = realpath -realpath.sync = realpathSync -realpath.realpathSync = realpathSync -realpath.monkeypatch = monkeypatch -realpath.unmonkeypatch = unmonkeypatch + /** + * Right square bracket (literal): ']' + */ -var fs = __webpack_require__(747) -var origRealpath = fs.realpath -var origRealpathSync = fs.realpathSync + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: 'text', value: '\\' + value }); + continue; + } -var version = process.version -var ok = /^v[0-5]\./.test(version) -var old = __webpack_require__(117) + /** + * Left square bracket: '[' + */ -function newError (er) { - return er && er.syscall === 'realpath' && ( - er.code === 'ELOOP' || - er.code === 'ENOMEM' || - er.code === 'ENAMETOOLONG' - ) -} + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; -function realpath (p, cache, cb) { - if (ok) { - return origRealpath(p, cache, cb) - } + let closed = true; + let next; - if (typeof cache === 'function') { - cb = cache - cache = null - } - origRealpath(p, cache, function (er, result) { - if (newError(er)) { - old.realpath(p, cache, cb) - } else { - cb(er, result) - } - }) -} + while (index < length && (next = advance())) { + value += next; -function realpathSync (p, cache) { - if (ok) { - return origRealpathSync(p, cache) - } + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } - try { - return origRealpathSync(p, cache) - } catch (er) { - if (newError(er)) { - return old.realpathSync(p, cache) - } else { - throw er - } - } -} + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } -function monkeypatch () { - fs.realpath = realpath - fs.realpathSync = realpathSync -} + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; -function unmonkeypatch () { - fs.realpath = origRealpath - fs.realpathSync = origRealpathSync -} + if (brackets === 0) { + break; + } + } + } + push({ type: 'text', value }); + continue; + } -/***/ }), + /** + * Parentheses + */ -/***/ 306: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } -var concatMap = __webpack_require__(896); -var balanced = __webpack_require__(621); + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } -module.exports = expandTop; + /** + * Quotes: '|"|` + */ -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + let open = value; + let next; -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} + if (options.keepQuotes !== true) { + value = ''; + } -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + value += next; + } -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); + push({ type: 'text', value }); + continue; + } - if (!m) - return str.split(','); + /** + * Left curly brace: '{' + */ - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } + let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + let brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; - parts.push.apply(parts, p); + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } - return parts; -} + /** + * Right curly brace: '}' + */ -function expandTop(str) { - if (!str) - return []; + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } + let type = 'close'; + block = stack.pop(); + block.close = true; - return expand(escapeBraces(str), true).map(unescapeBraces); -} + push({ type, value }); + depth--; -function identity(e) { - return e; -} + block = stack[stack.length - 1]; + continue; + } -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} + /** + * Comma: ',' + */ -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + let open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify(block) }]; + } -function expand(str, isTop) { - var expansions = []; + push({ type: 'comma', value }); + block.commas++; + continue; + } - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; + /** + * Dot: '.' + */ - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + let siblings = block.nodes; - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; - var N; + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); + block.ranges++; + block.args = []; + continue; + } - N = []; + if (prev.type === 'range') { + siblings.pop(); - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } + let before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; } - N.push(c); + + push({ type: 'dot', value }); + continue; } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); + + /** + * Text + */ + + push({ type: 'text', value }); } - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); + + // get the location of the block on parent.nodes (block's siblings) + let parent = stack[stack.length - 1]; + let index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); } - } + } while (stack.length > 0); - return expansions; -} + push({ type: 'eos' }); + return ast; +}; +module.exports = parse; /***/ }), -/***/ 307: +/***/ 231: /***/ (function(__unusedmodule, exports, __webpack_require__) { -exports.require = function() { - var fs = __webpack_require__(747); - if (process.versions['electron']) { - try { - originalFs = __webpack_require__(708); - if (Object.keys(originalFs).length > 0) { - fs = originalFs; - } - } catch (e) {} - } - return fs -}; +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const async = __webpack_require__(728); +const sync = __webpack_require__(593); +const settings_1 = __webpack_require__(872); +exports.Settings = settings_1.default; +function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async.read(path, getSettings(), optionsOrSettingsOrCallback); + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.stat = stat; +function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.statSync = statSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} /***/ }), -/***/ 315: -/***/ (function(module) { +/***/ 233: +/***/ (function(__unusedmodule, exports, __webpack_require__) { -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) +"use strict"; + +// Copyright (c) 2019-2020-2021 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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 }); +exports.CMakeUtils = void 0; +const path = __importStar(__webpack_require__(622)); +const vcpkgGlobals = __importStar(__webpack_require__(946)); +class CMakeUtils { + constructor(baseUtils) { + this.baseUtils = baseUtils; } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor + injectEnvVariables(vcpkgRoot, triplet, baseLib) { + return __awaiter(this, void 0, void 0, function* () { + yield this.baseUtils.wrapOp(`Setup environment variables for triplet '${triplet}' using 'vcpkg env'`, () => __awaiter(this, void 0, void 0, function* () { + var _a; + if (!vcpkgRoot) { + vcpkgRoot = (_a = process.env[vcpkgGlobals.outVcpkgRootPath]) !== null && _a !== void 0 ? _a : ""; + if (!vcpkgRoot) { + throw new Error(`${vcpkgGlobals.outVcpkgRootPath} environment variable is not set.`); + } + } + // Search for vcpkg tool and run it + let vcpkgPath = path.join(vcpkgRoot, 'vcpkg'); + if (this.baseUtils.isWin32()) { + vcpkgPath += '.exe'; + } + const vcpkg = baseLib.tool(vcpkgPath); + vcpkg.arg("env"); + vcpkg.arg("--bin"); + vcpkg.arg("--include"); + vcpkg.arg("--tools"); + vcpkg.arg("--python"); + vcpkg.line(`--triplet ${triplet} set`); + const options = { + cwd: vcpkgRoot, + failOnStdErr: false, + errStream: process.stdout, + outStream: process.stdout, + ignoreReturnCode: true, + silent: false, + windowsVerbatimArguments: false, + env: process.env + }; + const output = yield vcpkg.execSync(options); + if (output.code !== 0) { + throw new Error(`${output.stdout}\n\n${output.stderr}`); + } + const map = this.baseUtils.parseVcpkgEnvOutput(output.stdout); + for (const key in map) { + if (this.baseUtils.isVariableStrippingPath(key)) + continue; + if (key.toUpperCase() === "PATH") { + process.env[key] = process.env[key] + path.delimiter + map[key]; + } + else { + process.env[key] = map[key]; + } + baseLib.debug(`set ${key}=${process.env[key]}`); + } + })); + }); + } + injectVcpkgToolchain(args, triplet, baseLib) { + return __awaiter(this, void 0, void 0, function* () { + args = args !== null && args !== void 0 ? args : []; + const vcpkgRoot = process.env[vcpkgGlobals.outVcpkgRootPath]; + // if RUNVCPKG_VCPKG_ROOT is defined, then use it, and put aside into + // VCPKG_CHAINLOAD_TOOLCHAIN_FILE the existing toolchain. + if (vcpkgRoot && vcpkgRoot.length > 1) { + const toolchainFile = this.baseUtils.getToolchainFile(args); + args = this.baseUtils.removeToolchainFile(args); + const vcpkgToolchain = path.join(vcpkgRoot, '/scripts/buildsystems/vcpkg.cmake'); + args.push(`-DCMAKE_TOOLCHAIN_FILE=${vcpkgToolchain}`); + if (toolchainFile) { + args.push(`-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${toolchainFile}`); + } + // If the triplet is provided, specify the same triplet on the cmd line and set the environment for msvc. + if (triplet) { + args.push(`-DVCPKG_TARGET_TRIPLET=${triplet}`); + // For Windows build agents, inject the environment variables used + // for the MSVC compiler using the 'vcpkg env' command. + // This is not needed for others compiler on Windows, but it should be harmless. + if (this.baseUtils.isWin32() && triplet) { + if (triplet.indexOf("windows") !== -1) { + process.env.CC = "cl.exe"; + process.env.CXX = "cl.exe"; + baseLib.setVariable("CC", "cl.exe"); + baseLib.setVariable("CXX", "cl.exe"); + } + yield this.injectEnvVariables(vcpkgRoot, triplet, baseLib); + } + } + } + return args; + }); } - } } - +exports.CMakeUtils = CMakeUtils; +//# sourceMappingURL=utils.js.map /***/ }), -/***/ 317: -/***/ (function(module) { - -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); -} - - -/***/ }), - -/***/ 330: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -// Copyright (c) 2019-2020-2021 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -Object.defineProperty(exports, "__esModule", { value: true }); -exports.logCollectionRegExps = exports.useVcpkgToolchainFile = exports.cmakeWrapperCommand = exports.cmakeVcpkgTriplet = exports.cmakeBuildType = exports.buildWithCMakeArgs = exports.buildWithCMake = exports.cmakeToolchainPath = exports.cmakeGenerator = exports.cmakeListsOrSettingsJson = exports.ninjaDownloadUrl = exports.ninjaPath = exports.configurationRegexFilter = exports.cmakeAppendedArgs = exports.buildDirectory = exports.cmakeListsTxtPath = exports.cmakeSettingsJsonPath = void 0; -exports.cmakeSettingsJsonPath = 'cmakeSettingsJsonPath'; -exports.cmakeListsTxtPath = 'cmakeListsTxtPath'; -exports.buildDirectory = 'buildDirectory'; -exports.cmakeAppendedArgs = 'cmakeAppendedArgs'; -exports.configurationRegexFilter = 'configurationRegexFilter'; -exports.ninjaPath = 'ninjaPath'; -exports.ninjaDownloadUrl = 'ninjaDownloadUrl'; -exports.cmakeListsOrSettingsJson = 'cmakeListsOrSettingsJson'; -exports.cmakeGenerator = 'cmakeGenerator'; -exports.cmakeToolchainPath = 'cmakeToolchainPath'; -exports.buildWithCMake = 'buildWithCMake'; -exports.buildWithCMakeArgs = 'buildWithCMakeArgs'; -exports.cmakeBuildType = 'cmakeBuildType'; -exports.cmakeVcpkgTriplet = 'vcpkgTriplet'; -exports.cmakeWrapperCommand = 'cmakeWrapperCommand'; -exports.useVcpkgToolchainFile = 'useVcpkgToolchainFile'; -exports.logCollectionRegExps = 'logCollectionRegExps'; -//# sourceMappingURL=cmake-globals.js.map - -/***/ }), - -/***/ 332: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const fs = __webpack_require__(747); -const os = __webpack_require__(87); -const CPU_COUNT = os.cpus().length; -exports.DEFAULT_FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - lstatSync: fs.lstatSync, - stat: fs.stat, - statSync: fs.statSync, - readdir: fs.readdir, - readdirSync: fs.readdirSync -}; -class Settings { - constructor(_options = {}) { - this._options = _options; - this.absolute = this._getValue(this._options.absolute, false); - this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); - this.braceExpansion = this._getValue(this._options.braceExpansion, true); - this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); - this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); - this.cwd = this._getValue(this._options.cwd, process.cwd()); - this.deep = this._getValue(this._options.deep, Infinity); - this.dot = this._getValue(this._options.dot, false); - this.extglob = this._getValue(this._options.extglob, true); - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); - this.fs = this._getFileSystemMethods(this._options.fs); - this.globstar = this._getValue(this._options.globstar, true); - this.ignore = this._getValue(this._options.ignore, []); - this.markDirectories = this._getValue(this._options.markDirectories, false); - this.objectMode = this._getValue(this._options.objectMode, false); - this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); - this.onlyFiles = this._getValue(this._options.onlyFiles, true); - this.stats = this._getValue(this._options.stats, false); - this.suppressErrors = this._getValue(this._options.suppressErrors, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); - this.unique = this._getValue(this._options.unique, true); - if (this.onlyDirectories) { - this.onlyFiles = false; - } - if (this.stats) { - this.objectMode = true; - } - } - _getValue(option, value) { - return option === undefined ? value : option; - } - _getFileSystemMethods(methods = {}) { - return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); - } -} -exports.default = Settings; - - -/***/ }), - -/***/ 350: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - -const path = __webpack_require__(622); - -module.exports = path_ => { - let cwd = process.cwd(); - - path_ = path.resolve(path_); - - if (process.platform === 'win32') { - cwd = cwd.toLowerCase(); - path_ = path_.toLowerCase(); - } - - return path_ === cwd; -}; - - -/***/ }), - -/***/ 352: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 239: +/***/ (function(module, __unusedexports, __webpack_require__) { var Utils = __webpack_require__(643), - Headers = __webpack_require__(181), - Constants = Utils.Constants, - Methods = __webpack_require__(880); + Constants = Utils.Constants; -module.exports = function (/*Buffer*/input) { +/* The central directory file header */ +module.exports = function () { + var _verMade = 0x0A, + _version = 0x0A, + _flags = 0, + _method = 0, + _time = 0, + _crc = 0, + _compressedSize = 0, + _size = 0, + _fnameLen = 0, + _extraLen = 0, - var _entryHeader = new Headers.EntryHeader(), - _entryName = Buffer.alloc(0), - _comment = Buffer.alloc(0), - _isDirectory = false, - uncompressedData = null, - _extra = Buffer.alloc(0); + _comLen = 0, + _diskStart = 0, + _inattr = 0, + _attr = 0, + _offset = 0; - function getCompressedDataFromZip() { - if (!input || !Buffer.isBuffer(input)) { - return Buffer.alloc(0); - } - _entryHeader.loadDataHeaderFromBinary(input); - return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize) - } + var _dataHeader = {}; - function crc32OK(data) { - // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written - if ((_entryHeader.flags & 0x8) !== 0x8) { - if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) { - return false; - } - } else { - // @TODO: load and check data descriptor header - // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure - // (optionally preceded by a 4-byte signature) immediately after the compressed data: - } - return true; - } + function setTime(val) { + val = new Date(val); + _time = (val.getFullYear() - 1980 & 0x7f) << 25 // b09-16 years from 1980 + | (val.getMonth() + 1) << 21 // b05-08 month + | val.getDate() << 16 // b00-04 hour - function decompress(/*Boolean*/async, /*Function*/callback, /*String*/pass) { - if(typeof callback === 'undefined' && typeof async === 'string') { - pass=async; - async=void 0; - } - if (_isDirectory) { - if (async && callback) { - callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error. - } - return Buffer.alloc(0); - } + // 2 bytes time + | val.getHours() << 11 // b11-15 hour + | val.getMinutes() << 5 // b05-10 minute + | val.getSeconds() >> 1; // b00-04 seconds divided by 2 + } - var compressedData = getCompressedDataFromZip(); - - if (compressedData.length === 0) { - if (async && callback) callback(compressedData, Utils.Errors.NO_DATA);//si added error. - return compressedData; - } + setTime(+new Date()); - var data = Buffer.alloc(_entryHeader.size); + return { + get made () { return _verMade; }, + set made (val) { _verMade = val; }, - switch (_entryHeader.method) { - case Utils.Constants.STORED: - compressedData.copy(data); - if (!crc32OK(data)) { - if (async && callback) callback(data, Utils.Errors.BAD_CRC);//si added error - return Utils.Errors.BAD_CRC; - } else {//si added otherwise did not seem to return data. - if (async && callback) callback(data); - return data; - } - case Utils.Constants.DEFLATED: - var inflater = new Methods.Inflater(compressedData); - if (!async) { - var result = inflater.inflate(data); - result.copy(data, 0); - if (!crc32OK(data)) { - console.warn(Utils.Errors.BAD_CRC + " " + _entryName.toString()) - } - return data; - } else { - inflater.inflateAsync(function(result) { - result.copy(data, 0); - if (!crc32OK(data)) { - if (callback) callback(data, Utils.Errors.BAD_CRC); //si added error - } else { //si added otherwise did not seem to return data. - if (callback) callback(data); - } - }) - } - break; - default: - if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD); - return Utils.Errors.UNKNOWN_METHOD; - } - } + get version () { return _version; }, + set version (val) { _version = val }, - function compress(/*Boolean*/async, /*Function*/callback) { - if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) { - // no data set or the data wasn't changed to require recompression - if (async && callback) callback(getCompressedDataFromZip()); - return getCompressedDataFromZip(); - } + get flags () { return _flags }, + set flags (val) { _flags = val; }, - if (uncompressedData.length && !_isDirectory) { - var compressedData; - // Local file header - switch (_entryHeader.method) { - case Utils.Constants.STORED: - _entryHeader.compressedSize = _entryHeader.size; + get method () { return _method; }, + set method (val) { _method = val; }, - compressedData = Buffer.alloc(uncompressedData.length); - uncompressedData.copy(compressedData); + get time () { return new Date( + ((_time >> 25) & 0x7f) + 1980, + ((_time >> 21) & 0x0f) - 1, + (_time >> 16) & 0x1f, + (_time >> 11) & 0x1f, + (_time >> 5) & 0x3f, + (_time & 0x1f) << 1 + ); + }, + set time (val) { + setTime(val); + }, - if (async && callback) callback(compressedData); - return compressedData; - default: - case Utils.Constants.DEFLATED: + get crc () { return _crc; }, + set crc (val) { _crc = val; }, - var deflater = new Methods.Deflater(uncompressedData); - if (!async) { - var deflated = deflater.deflate(); - _entryHeader.compressedSize = deflated.length; - return deflated; - } else { - deflater.deflateAsync(function(data) { - compressedData = Buffer.alloc(data.length); - _entryHeader.compressedSize = data.length; - data.copy(compressedData); - callback && callback(compressedData); - }) - } - deflater = null; - break; - } - } else { - if (async && callback) { - callback(Buffer.alloc(0)); - } else { - return Buffer.alloc(0); - } - } - } + get compressedSize () { return _compressedSize; }, + set compressedSize (val) { _compressedSize = val; }, - function readUInt64LE(buffer, offset) { - return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset); - } + get size () { return _size; }, + set size (val) { _size = val; }, - function parseExtra(data) { - var offset = 0; - var signature, size, part; - while(offset= Constants.EF_ZIP64_SCOMP) { - size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP); - if(_entryHeader.size === Constants.EF_ZIP64_OR_32) { - _entryHeader.size = size; - } - } - if(data.length >= Constants.EF_ZIP64_RHO) { - compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP); - if(_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) { - _entryHeader.compressedSize = compressedSize; - } - } - if(data.length >= Constants.EF_ZIP64_DSN) { - offset = readUInt64LE(data, Constants.EF_ZIP64_RHO); - if(_entryHeader.offset === Constants.EF_ZIP64_OR_32) { - _entryHeader.offset = offset; - } - } - if(data.length >= Constants.EF_ZIP64_DSN+4) { - diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN); - if(_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) { - _entryHeader.diskNumStart = diskNumStart; - } - } - } + get commentLength () { return _comLen }, + set commentLength (val) { _comLen = val }, + get diskNumStart () { return _diskStart }, + set diskNumStart (val) { _diskStart = val }, - return { - get entryName () { return _entryName.toString(); }, - get rawEntryName() { return _entryName; }, - set entryName (val) { - _entryName = Utils.toBuffer(val); - var lastChar = _entryName[_entryName.length - 1]; - _isDirectory = (lastChar === 47) || (lastChar === 92); - _entryHeader.fileNameLength = _entryName.length; - }, + get inAttr () { return _inattr }, + set inAttr (val) { _inattr = val }, - get extra () { return _extra; }, - set extra (val) { - _extra = val; - _entryHeader.extraLength = val.length; - parseExtra(val); - }, + get attr () { return _attr }, + set attr (val) { _attr = val }, - get comment () { return _comment.toString(); }, - set comment (val) { - _comment = Utils.toBuffer(val); - _entryHeader.commentLength = _comment.length; - }, + get offset () { return _offset }, + set offset (val) { _offset = val }, - get name () { var n = _entryName.toString(); return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); }, - get isDirectory () { return _isDirectory }, + get encripted () { return (_flags & 1) === 1 }, - getCompressedData : function() { - return compress(false, null) + get entryHeaderSize () { + return Constants.CENHDR + _fnameLen + _extraLen + _comLen; }, - getCompressedDataAsync : function(/*Function*/callback) { - compress(true, callback) + get realDataOffset () { + return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen; }, - setData : function(value) { - uncompressedData = Utils.toBuffer(value); - if (!_isDirectory && uncompressedData.length) { - _entryHeader.size = uncompressedData.length; - _entryHeader.method = Utils.Constants.DEFLATED; - _entryHeader.crc = Utils.crc32(value); - _entryHeader.changed = true; - } else { // folders and blank files should be stored - _entryHeader.method = Utils.Constants.STORED; - } + get dataHeader () { + return _dataHeader; }, - getData : function(pass) { - if (_entryHeader.changed) { - return uncompressedData; - } else { - return decompress(false, null, pass); + loadDataHeaderFromBinary : function(/*Buffer*/input) { + var data = input.slice(_offset, _offset + Constants.LOCHDR); + // 30 bytes and should start with "PK\003\004" + if (data.readUInt32LE(0) !== Constants.LOCSIG) { + throw Utils.Errors.INVALID_LOC; } - }, - - getDataAsync : function(/*Function*/callback, pass) { - if (_entryHeader.changed) { - callback(uncompressedData) - } else { - decompress(true, callback, pass) + _dataHeader = { + // version needed to extract + version : data.readUInt16LE(Constants.LOCVER), + // general purpose bit flag + flags : data.readUInt16LE(Constants.LOCFLG), + // compression method + method : data.readUInt16LE(Constants.LOCHOW), + // modification time (2 bytes time, 2 bytes date) + time : data.readUInt32LE(Constants.LOCTIM), + // uncompressed file crc-32 value + crc : data.readUInt32LE(Constants.LOCCRC), + // compressed size + compressedSize : data.readUInt32LE(Constants.LOCSIZ), + // uncompressed size + size : data.readUInt32LE(Constants.LOCLEN), + // filename length + fnameLen : data.readUInt16LE(Constants.LOCNAM), + // extra field length + extraLen : data.readUInt16LE(Constants.LOCEXT) } }, - set attr(attr) { _entryHeader.attr = attr; }, - get attr() { return _entryHeader.attr; }, - - set header(/*Buffer*/data) { - _entryHeader.loadFromBinary(data); + loadFromBinary : function(/*Buffer*/data) { + // data should be 46 bytes and start with "PK 01 02" + if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) { + throw Utils.Errors.INVALID_CEN; + } + // version made by + _verMade = data.readUInt16LE(Constants.CENVEM); + // version needed to extract + _version = data.readUInt16LE(Constants.CENVER); + // encrypt, decrypt flags + _flags = data.readUInt16LE(Constants.CENFLG); + // compression method + _method = data.readUInt16LE(Constants.CENHOW); + // modification time (2 bytes time, 2 bytes date) + _time = data.readUInt32LE(Constants.CENTIM); + // uncompressed file crc-32 value + _crc = data.readUInt32LE(Constants.CENCRC); + // compressed size + _compressedSize = data.readUInt32LE(Constants.CENSIZ); + // uncompressed size + _size = data.readUInt32LE(Constants.CENLEN); + // filename length + _fnameLen = data.readUInt16LE(Constants.CENNAM); + // extra field length + _extraLen = data.readUInt16LE(Constants.CENEXT); + // file comment length + _comLen = data.readUInt16LE(Constants.CENCOM); + // volume number start + _diskStart = data.readUInt16LE(Constants.CENDSK); + // internal file attributes + _inattr = data.readUInt16LE(Constants.CENATT); + // external file attributes + _attr = data.readUInt32LE(Constants.CENATX); + // LOC header offset + _offset = data.readUInt32LE(Constants.CENOFF); }, - get header() { - return _entryHeader; + dataHeaderToBinary : function() { + // LOC header size (30 bytes) + var data = Buffer.alloc(Constants.LOCHDR); + // "PK\003\004" + data.writeUInt32LE(Constants.LOCSIG, 0); + // version needed to extract + data.writeUInt16LE(_version, Constants.LOCVER); + // general purpose bit flag + data.writeUInt16LE(_flags, Constants.LOCFLG); + // compression method + data.writeUInt16LE(_method, Constants.LOCHOW); + // modification time (2 bytes time, 2 bytes date) + data.writeUInt32LE(_time, Constants.LOCTIM); + // uncompressed file crc-32 value + data.writeUInt32LE(_crc, Constants.LOCCRC); + // compressed size + data.writeUInt32LE(_compressedSize, Constants.LOCSIZ); + // uncompressed size + data.writeUInt32LE(_size, Constants.LOCLEN); + // filename length + data.writeUInt16LE(_fnameLen, Constants.LOCNAM); + // extra field length + data.writeUInt16LE(_extraLen, Constants.LOCEXT); + return data; }, - packHeader : function() { - var header = _entryHeader.entryHeaderToBinary(); - // add - _entryName.copy(header, Utils.Constants.CENHDR); - if (_entryHeader.extraLength) { - _extra.copy(header, Utils.Constants.CENHDR + _entryName.length) - } - if (_entryHeader.commentLength) { - _comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length); - } - return header; + entryHeaderToBinary : function() { + // CEN header size (46 bytes) + var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen); + // "PK\001\002" + data.writeUInt32LE(Constants.CENSIG, 0); + // version made by + data.writeUInt16LE(_verMade, Constants.CENVEM); + // version needed to extract + data.writeUInt16LE(_version, Constants.CENVER); + // encrypt, decrypt flags + data.writeUInt16LE(_flags, Constants.CENFLG); + // compression method + data.writeUInt16LE(_method, Constants.CENHOW); + // modification time (2 bytes time, 2 bytes date) + data.writeUInt32LE(_time, Constants.CENTIM); + // uncompressed file crc-32 value + data.writeInt32LE(_crc & 0xFFFF, Constants.CENCRC, true); + // compressed size + data.writeUInt32LE(_compressedSize, Constants.CENSIZ); + // uncompressed size + data.writeUInt32LE(_size, Constants.CENLEN); + // filename length + data.writeUInt16LE(_fnameLen, Constants.CENNAM); + // extra field length + data.writeUInt16LE(_extraLen, Constants.CENEXT); + // file comment length + data.writeUInt16LE(_comLen, Constants.CENCOM); + // volume number start + data.writeUInt16LE(_diskStart, Constants.CENDSK); + // internal file attributes + data.writeUInt16LE(_inattr, Constants.CENATT); + // external file attributes + data.writeUInt32LE(_attr, Constants.CENATX); + // LOC header offset + data.writeUInt32LE(_offset, Constants.CENOFF); + // fill all with + data.fill(0x00, Constants.CENHDR); + return data; }, toString : function() { return '{\n' + - '\t"entryName" : "' + _entryName.toString() + "\",\n" + - '\t"name" : "' + (_isDirectory ? _entryName.toString().replace(/\/$/, '').split("/").pop() : _entryName.toString().split("/").pop()) + "\",\n" + - '\t"comment" : "' + _comment.toString() + "\",\n" + - '\t"isDirectory" : ' + _isDirectory + ",\n" + - '\t"header" : ' + _entryHeader.toString().replace(/\t/mg, "\t\t").replace(/}/mg, "\t}") + ",\n" + - '\t"compressedData" : <' + (input && input.length + " bytes buffer" || "null") + ">\n" + - '\t"data" : <' + (uncompressedData && uncompressedData.length + " bytes buffer" || "null") + ">\n" + + '\t"made" : ' + _verMade + ",\n" + + '\t"version" : ' + _version + ",\n" + + '\t"flags" : ' + _flags + ",\n" + + '\t"method" : ' + Utils.methodToString(_method) + ",\n" + + '\t"time" : ' + this.time + ",\n" + + '\t"crc" : 0x' + _crc.toString(16).toUpperCase() + ",\n" + + '\t"compressedSize" : ' + _compressedSize + " bytes,\n" + + '\t"size" : ' + _size + " bytes,\n" + + '\t"fileNameLength" : ' + _fnameLen + ",\n" + + '\t"extraLength" : ' + _extraLen + " bytes,\n" + + '\t"commentLength" : ' + _comLen + " bytes,\n" + + '\t"diskNumStart" : ' + _diskStart + ",\n" + + '\t"inAttr" : ' + _inattr + ",\n" + + '\t"attr" : ' + _attr + ",\n" + + '\t"offset" : ' + _offset + ",\n" + + '\t"entryHeaderSize" : ' + (Constants.CENHDR + _fnameLen + _extraLen + _comLen) + " bytes\n" + '}'; } } @@ -6282,3259 +5087,4201 @@ module.exports = function (/*Buffer*/input) { /***/ }), -/***/ 357: -/***/ (function(module) { - -module.exports = require("assert"); +/***/ 245: +/***/ (function(module, __unusedexports, __webpack_require__) { -/***/ }), +"use strict"; -/***/ 364: -/***/ (function(module) { +const {promisify} = __webpack_require__(669); +const path = __webpack_require__(622); +const globby = __webpack_require__(625); +const isGlob = __webpack_require__(846); +const slash = __webpack_require__(143); +const gracefulFs = __webpack_require__(598); +const isPathCwd = __webpack_require__(350); +const isPathInside = __webpack_require__(697); +const rimraf = __webpack_require__(569); +const pMap = __webpack_require__(521); -"use strict"; +const rimrafP = promisify(rimraf); -module.exports = (flag, argv) => { - argv = argv || process.argv; - const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const pos = argv.indexOf(prefix + flag); - const terminatorPos = argv.indexOf('--'); - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +const rimrafOptions = { + glob: false, + unlink: gracefulFs.unlink, + unlinkSync: gracefulFs.unlinkSync, + chmod: gracefulFs.chmod, + chmodSync: gracefulFs.chmodSync, + stat: gracefulFs.stat, + statSync: gracefulFs.statSync, + lstat: gracefulFs.lstat, + lstatSync: gracefulFs.lstatSync, + rmdir: gracefulFs.rmdir, + rmdirSync: gracefulFs.rmdirSync, + readdir: gracefulFs.readdir, + readdirSync: gracefulFs.readdirSync }; +function safeCheck(file, cwd) { + if (isPathCwd(file)) { + throw new Error('Cannot delete the current working directory. Can be overridden with the `force` option.'); + } -/***/ }), - -/***/ 366: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (!isPathInside(file, cwd)) { + throw new Error('Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.'); + } +} -"use strict"; +function normalizePatterns(patterns) { + patterns = Array.isArray(patterns) ? patterns : [patterns]; + patterns = patterns.map(pattern => { + if (process.platform === 'win32' && isGlob(pattern) === false) { + return slash(pattern); + } -const path = __webpack_require__(622); -const scan = __webpack_require__(537); -const parse = __webpack_require__(806); -const utils = __webpack_require__(265); -const constants = __webpack_require__(199); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + return pattern; + }); -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ + return patterns; +} -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; +module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => { + options = { + expandDirectories: false, + onlyFiles: false, + followSymbolicLinks: false, + cwd, + ...options + }; - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } + patterns = normalizePatterns(patterns); - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); + const files = (await globby(patterns, options)) + .sort((a, b) => b.localeCompare(a)); - const state = regex.state; - delete regex.state; + const mapper = async file => { + file = path.resolve(cwd, file); - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } + if (!force) { + safeCheck(file, cwd); + } - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; + if (!dryRun) { + await rimrafP(file, rimrafOptions); + } - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } + return file; + }; - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } + const removedFiles = await pMap(files, mapper, options); - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } + removedFiles.sort((a, b) => a.localeCompare(b)); - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; + return removedFiles; +}; - if (returnState) { - matcher.state = state; - } +module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => { + options = { + expandDirectories: false, + onlyFiles: false, + followSymbolicLinks: false, + cwd, + ...options + }; - return matcher; -}; + patterns = normalizePatterns(patterns); -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ + const files = globby.sync(patterns, options) + .sort((a, b) => b.localeCompare(a)); -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } + const removedFiles = files.map(file => { + file = path.resolve(cwd, file); - if (input === '') { - return { isMatch: false, output: '' }; - } + if (!force) { + safeCheck(file, cwd); + } - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; + if (!dryRun) { + rimraf.sync(file, rimrafOptions); + } - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } + return file; + }); - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } + removedFiles.sort((a, b) => a.localeCompare(b)); - return { isMatch: Boolean(match), match, output }; + return removedFiles; }; -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; +/***/ }), -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ +/***/ 247: +/***/ (function(module, __unusedexports, __webpack_require__) { -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); +"use strict"; -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ +const os = __webpack_require__(87); +const hasFlag = __webpack_require__(364); -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; +const env = process.env; -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; +} -picomatch.scan = (input, options) => scan(input, options); +function translateLevel(level) { + if (level === 0) { + return false; + } -/** - * Create a regular expression from a glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.makeRe(input[, options]); - * - * console.log(picomatch.makeRe('*.js')); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `input` A glob pattern to convert to regex. - * @param {Object} `options` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return parsed.output; - } + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } - let source = `${prepend}(?:${parsed.output})${append}`; - if (parsed && parsed.negated === true) { - source = `^(?!${source}).*$`; - } + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = parsed; - } + if (hasFlag('color=256')) { + return 2; + } - return regex; -}; + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } -picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } + const min = forceColor ? 1 : 0; - const opts = options || {}; - let parsed = { negated: false, fastpaths: true }; - let prefix = ''; - let output; + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(process.versions.node.split('.')[0]) >= 8 && + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } - if (input.startsWith('./')) { - input = input.slice(2); - prefix = parsed.prefix = './'; - } + return 1; + } - if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - output = parse.fastpaths(input, options); - } + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } - if (output === undefined) { - parsed = parse(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; - } + return min; + } - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ + if (env.COLORTERM === 'truecolor') { + return 3; + } -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); -/** - * Picomatch constants. - * @return {Object} - */ + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } -picomatch.constants = constants; + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } -/** - * Expose "picomatch" - */ + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } -module.exports = picomatch; + if ('COLORTERM' in env) { + return 1; + } + if (env.TERM === 'dumb') { + return min; + } -/***/ }), + return min; +} -/***/ 375: -/***/ (function(__unusedmodule, exports, __webpack_require__) { +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); +} -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(444); -class ErrorFilter { - constructor(_settings) { - this._settings = _settings; - } - getFilter() { - return (error) => this._isNonFatalError(error); - } - _isNonFatalError(error) { - return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; - } -} -exports.default = ErrorFilter; +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; /***/ }), -/***/ 382: +/***/ 250: /***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +var constants = __webpack_require__(619) +var origCwd = process.cwd +var cwd = null -const utils = __webpack_require__(225); +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform -module.exports = (ast, options = {}) => { - let stringify = (node, parent = {}) => { - let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let output = ''; +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} - if (node.value) { - if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { - return '\\' + node.value; - } - return node.value; - } +var chdir = process.chdir +process.chdir = function(d) { + cwd = null + chdir.call(process, d) +} - if (node.value) { - return node.value; - } +module.exports = patch - if (node.nodes) { - for (let child of node.nodes) { - output += stringify(child); - } - } - return output; - }; +function patch (fs) { + // (re-)implement some things that are known busted or missing. - return stringify(ast); -}; + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. -/***/ }), + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) -/***/ 384: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(444); -function generate(patterns, settings) { - const positivePatterns = getPositivePatterns(patterns); - const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); - const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); - const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); - const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); - const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); - return staticTasks.concat(dynamicTasks); -} -exports.generate = generate; -function convertPatternsToTasks(positive, negative, dynamic) { - const positivePatternsGroup = groupPatternsByBaseDirectory(positive); - // When we have a global group – there is no reason to divide the patterns into independent tasks. - // In this case, the global task covers the rest. - if ('.' in positivePatternsGroup) { - const task = convertPatternGroupToTask('.', positive, negative, dynamic); - return [task]; - } - return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); -} -exports.convertPatternsToTasks = convertPatternsToTasks; -function getPositivePatterns(patterns) { - return utils.pattern.getPositivePatterns(patterns); -} -exports.getPositivePatterns = getPositivePatterns; -function getNegativePatternsAsPositive(patterns, ignore) { - const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); - const positive = negative.map(utils.pattern.convertToPositivePattern); - return positive; -} -exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; -function groupPatternsByBaseDirectory(patterns) { - const group = {}; - return patterns.reduce((collection, pattern) => { - const base = utils.pattern.getBaseDirectory(pattern); - if (base in collection) { - collection[base].push(pattern); - } - else { - collection[base] = [pattern]; - } - return collection; - }, group); -} -exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; -function convertPatternGroupsToTasks(positive, negative, dynamic) { - return Object.keys(positive).map((base) => { - return convertPatternGroupToTask(base, positive[base], negative, dynamic); - }); -} -exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; -function convertPatternGroupToTask(base, positive, negative, dynamic) { - return { - dynamic, - positive, - negative, - base, - patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) - }; -} -exports.convertPatternGroupToTask = convertPatternGroupToTask; + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) -/***/ }), + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) -/***/ 385: -/***/ (function(module, __unusedexports, __webpack_require__) { + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) -var ZipEntry = __webpack_require__(352), - Headers = __webpack_require__(181), - Utils = __webpack_require__(643); - -module.exports = function (/*String|Buffer*/input, /*Number*/inputType) { - var entryList = [], - entryTable = {}, - _comment = Buffer.alloc(0), - filename = "", - fs = Utils.FileSystem.require(), - inBuffer = null, - mainHeader = new Headers.MainHeader(); - - if (inputType === Utils.Constants.FILE) { - // is a filename - filename = input; - inBuffer = fs.readFileSync(filename); - readMainHeader(); - } else if (inputType === Utils.Constants.BUFFER) { - // is a memory buffer - inBuffer = input; - readMainHeader(); - } else { - // none. is a new file - } - - function readEntries() { - entryTable = {}; - entryList = new Array(mainHeader.diskEntries); // total number of entries - var index = mainHeader.offset; // offset of first CEN header - for (var i = 0; i < entryList.length; i++) { - - var tmp = index, - entry = new ZipEntry(inBuffer); - entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR); - - entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength); - - if (entry.header.extraLength) { - entry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength); - } - - if (entry.header.commentLength) - entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength); - - index += entry.header.entryHeaderSize; - - entryList[i] = entry; - entryTable[entry.entryName] = entry; - } - } - - function readMainHeader() { - var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size - n = Math.max(0, i - 0xFFFF), // 0xFFFF is the max zip file comment length - endOffset = -1; // Start offset of the END header - - for (i; i >= n; i--) { - if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P' - if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) { // "PK\005\006" - endOffset = i; - break; - } - } - if (!~endOffset) - throw Utils.Errors.INVALID_FORMAT; - - mainHeader.loadFromBinary(inBuffer.slice(endOffset, endOffset + Utils.Constants.ENDHDR)); - if (mainHeader.commentLength) { - _comment = inBuffer.slice(endOffset + Utils.Constants.ENDHDR); - } - readEntries(); - } - - return { - /** - * Returns an array of ZipEntry objects existent in the current opened archive - * @return Array - */ - get entries() { - return entryList; - }, - - /** - * Archive comment - * @return {String} - */ - get comment() { - return _comment.toString(); - }, - set comment(val) { - mainHeader.commentLength = val.length; - _comment = val; - }, - - /** - * Returns a reference to the entry with the given name or null if entry is inexistent - * - * @param entryName - * @return ZipEntry - */ - getEntry: function (/*String*/entryName) { - return entryTable[entryName] || null; - }, - - /** - * Adds the given entry to the entry list - * - * @param entry - */ - setEntry: function (/*ZipEntry*/entry) { - entryList.push(entry); - entryTable[entry.entryName] = entry; - mainHeader.totalEntries = entryList.length; - }, - - /** - * Removes the entry with the given name from the entry list. - * - * If the entry is a directory, then all nested files and directories will be removed - * @param entryName - */ - deleteEntry: function (/*String*/entryName) { - var entry = entryTable[entryName]; - if (entry && entry.isDirectory) { - var _self = this; - this.getEntryChildren(entry).forEach(function (child) { - if (child.entryName !== entryName) { - _self.deleteEntry(child.entryName) - } - }) - } - entryList.splice(entryList.indexOf(entry), 1); - delete(entryTable[entryName]); - mainHeader.totalEntries = entryList.length; - }, - - /** - * Iterates and returns all nested files and directories of the given entry - * - * @param entry - * @return Array - */ - getEntryChildren: function (/*ZipEntry*/entry) { - if (entry.isDirectory) { - var list = [], - name = entry.entryName, - len = name.length; - - entryList.forEach(function (zipEntry) { - if (zipEntry.entryName.substr(0, len) === name) { - list.push(zipEntry); - } - }); - return list; - } - return [] - }, - - /** - * Returns the zip file - * - * @return Buffer - */ - compressToBuffer: function () { - if (entryList.length > 1) { - entryList.sort(function (a, b) { - var nameA = a.entryName.toLowerCase(); - var nameB = b.entryName.toLowerCase(); - if (nameA < nameB) { - return -1 - } - if (nameA > nameB) { - return 1 - } - return 0; - }); - } - - var totalSize = 0, - dataBlock = [], - entryHeaders = [], - dindex = 0; - - mainHeader.size = 0; - mainHeader.offset = 0; - - entryList.forEach(function (entry) { - // compress data and set local and entry header accordingly. Reason why is called first - var compressedData = entry.getCompressedData(); - // data header - entry.header.offset = dindex; - var dataHeader = entry.header.dataHeaderToBinary(); - var entryNameLen = entry.rawEntryName.length; - var extra = entry.extra.toString(); - var postHeader = Buffer.alloc(entryNameLen + extra.length); - entry.rawEntryName.copy(postHeader, 0); - postHeader.fill(extra, entryNameLen); - - var dataLength = dataHeader.length + postHeader.length + compressedData.length; - - dindex += dataLength; - - dataBlock.push(dataHeader); - dataBlock.push(postHeader); - dataBlock.push(compressedData); - - var entryHeader = entry.packHeader(); - entryHeaders.push(entryHeader); - mainHeader.size += entryHeader.length; - totalSize += (dataLength + entryHeader.length); - }); - - totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length - // point to end of data and beginning of central directory first record - mainHeader.offset = dindex; - - dindex = 0; - var outBuffer = Buffer.alloc(totalSize); - dataBlock.forEach(function (content) { - content.copy(outBuffer, dindex); // write data blocks - dindex += content.length; - }); - entryHeaders.forEach(function (content) { - content.copy(outBuffer, dindex); // write central directory entries - dindex += content.length; - }); - - var mh = mainHeader.toBinary(); - if (_comment) { - _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment - } - - mh.copy(outBuffer, dindex); // write main header - - return outBuffer - }, - - toAsyncBuffer: function (/*Function*/onSuccess, /*Function*/onFail, /*Function*/onItemStart, /*Function*/onItemEnd) { - if (entryList.length > 1) { - entryList.sort(function (a, b) { - var nameA = a.entryName.toLowerCase(); - var nameB = b.entryName.toLowerCase(); - if (nameA > nameB) { - return -1 - } - if (nameA < nameB) { - return 1 - } - return 0; - }); - } - - var totalSize = 0, - dataBlock = [], - entryHeaders = [], - dindex = 0; - - mainHeader.size = 0; - mainHeader.offset = 0; - - var compress = function (entryList) { - var self = arguments.callee; - if (entryList.length) { - var entry = entryList.pop(); - var name = entry.entryName + entry.extra.toString(); - if (onItemStart) onItemStart(name); - entry.getCompressedDataAsync(function (compressedData) { - if (onItemEnd) onItemEnd(name); - - entry.header.offset = dindex; - // data header - var dataHeader = entry.header.dataHeaderToBinary(); - var postHeader; - try { - postHeader = Buffer.alloc(name.length, name); // using alloc will work on node 5.x+ - } catch(e){ - postHeader = new Buffer(name); // use deprecated method if alloc fails... - } - var dataLength = dataHeader.length + postHeader.length + compressedData.length; - - dindex += dataLength; - - dataBlock.push(dataHeader); - dataBlock.push(postHeader); - dataBlock.push(compressedData); - - var entryHeader = entry.packHeader(); - entryHeaders.push(entryHeader); - mainHeader.size += entryHeader.length; - totalSize += (dataLength + entryHeader.length); - - if (entryList.length) { - self(entryList); - } else { - - - totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length - // point to end of data and beginning of central directory first record - mainHeader.offset = dindex; - - dindex = 0; - var outBuffer = Buffer.alloc(totalSize); - dataBlock.forEach(function (content) { - content.copy(outBuffer, dindex); // write data blocks - dindex += content.length; - }); - entryHeaders.forEach(function (content) { - content.copy(outBuffer, dindex); // write central directory entries - dindex += content.length; - }); - - var mh = mainHeader.toBinary(); - if (_comment) { - _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment - } - - mh.copy(outBuffer, dindex); // write main header - - onSuccess(outBuffer); - } - }); - } - }; - - compress(entryList); - } - } -}; + // if lchmod/lchown do not exist, then make them no-ops + if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. -/***/ }), + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = (function (fs$rename) { return function (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + }})(fs.rename) + } -/***/ 394: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + // if read() returns EAGAIN, then just try it again. + fs.read = (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const fsScandir = __webpack_require__(661); -const common = __webpack_require__(617); -const reader_1 = __webpack_require__(962); -class SyncReader extends reader_1.default { - constructor() { - super(...arguments); - this._scandir = fsScandir.scandirSync; - this._storage = new Set(); - this._queue = new Set(); - } - read() { - this._pushToQueue(this._root, this._settings.basePath); - this._handleQueue(); - return [...this._storage]; - } - _pushToQueue(directory, base) { - this._queue.add({ directory, base }); - } - _handleQueue() { - for (const item of this._queue.values()) { - this._handleDirectory(item.directory, item.base); - } - } - _handleDirectory(directory, base) { - try { - const entries = this._scandir(directory, this._settings.fsScandirSettings); - for (const entry of entries) { - this._handleEntry(entry, base); - } - } - catch (error) { - this._handleError(error); - } - } - _handleError(error) { - if (!common.isFatalError(this._settings, error)) { - return; - } - throw error; - } - _handleEntry(entry, base) { - const fullpath = entry.path; - if (base !== undefined) { - entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); - } - if (common.isAppliedFilter(this._settings.entryFilter, entry)) { - this._pushToStorage(entry); - } - if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { - this._pushToQueue(fullpath, entry.path); - } - } - _pushToStorage(entry) { - this._storage.add(entry); - } -} -exports.default = SyncReader; + // This ensures `util.promisify` works as it does for native `fs.read`. + read.__proto__ = fs$read + return read + })(fs.read) + fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) -/***/ }), + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } -/***/ 396: -/***/ (function(module) { + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) -// A simple implementation of make-array -function makeArray (subject) { - return Array.isArray(subject) - ? subject - : [subject] -} + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } -const REGEX_TEST_BLANK_LINE = /^\s+$/ -const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ -const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ -const REGEX_SPLITALL_CRLF = /\r?\n/g -// /foo, -// ./foo, -// ../foo, -// . -// .. -const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } -const SLASH = '/' -const KEY_IGNORE = typeof Symbol !== 'undefined' - ? Symbol.for('node-ignore') - /* istanbul ignore next */ - : 'node-ignore' + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } -const define = (object, key, value) => - Object.defineProperty(object, key, {value}) + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } -const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } -// Sanitize the range of a regular expression -// The cases are complicated, see test cases for details -const sanitizeRange = range => range.replace( - REGEX_REGEXP_RANGE, - (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) - ? match - // Invalid range (out of order) which is ok for gitignore rules but - // fatal for JavaScript regular expression, so eliminate it. - : '' -) + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } -// > If the pattern ends with a slash, -// > it is removed for the purpose of the following description, -// > but it would only find a match with a directory. -// > In other words, foo/ will match a directory foo and paths underneath it, -// > but will not match a regular file or a symbolic link foo -// > (this is consistent with the way how pathspec works in general in Git). -// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' -// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call -// you could use option `mark: true` with `glob` -// '`foo/`' should not continue with the '`..`' -const REPLACERS = [ + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } - // > Trailing spaces are ignored unless they are quoted with backslash ("\") - [ - // (a\ ) -> (a ) - // (a ) -> (a) - // (a \ ) -> (a ) - /\\?\s+$/, - match => match.indexOf('\\') === 0 - ? ' ' - : '' - ], + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } - // replace (\ ) with ' ' - [ - /\\\s/g, - () => ' ' - ], + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } - // Escape metacharacters - // which is written down by users but means special for regular expressions. + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + return stats; + } + } - // > There are 12 characters with special meanings: - // > - the backslash \, - // > - the caret ^, - // > - the dollar sign $, - // > - the period or dot ., - // > - the vertical bar or pipe symbol |, - // > - the question mark ?, - // > - the asterisk or star *, - // > - the plus sign +, - // > - the opening parenthesis (, - // > - the closing parenthesis ), - // > - and the opening square bracket [, - // > - the opening curly brace {, - // > These special characters are often called "metacharacters". - [ - /[\\^$.|*+(){]/g, - match => `\\${match}` - ], - - [ - // > [abc] matches any character inside the brackets - // > (in this case a, b, or c); - /\[([^\]/]*)($|\])/g, - (match, p1, p2) => p2 === ']' - ? `[${sanitizeRange(p1)}]` - : `\\${match}` - ], + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true - [ - // > a question mark (?) matches a single character - /(?!\\)\?/g, - () => '[^/]' - ], + if (er.code === "ENOSYS") + return true - // leading slash - [ + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } - // > A leading slash matches the beginning of the pathname. - // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". - // A leading slash matches the beginning of the pathname - /^\//, - () => '^' - ], + return false + } +} - // replace special metacharacter slash after the leading slash - [ - /\//g, - () => '\\/' - ], - [ - // > A leading "**" followed by a slash means match in all directories. - // > For example, "**/foo" matches file or directory "foo" anywhere, - // > the same as pattern "foo". - // > "**/foo/bar" matches file or directory "bar" anywhere that is directly - // > under directory "foo". - // Notice that the '*'s have been replaced as '\\*' - /^\^*\\\*\\\*\\\//, +/***/ }), - // '**/foo' <-> 'foo' - () => '^(?:.*\\/)?' - ], +/***/ 257: +/***/ (function(module) { - // ending - [ - // 'js' will not match 'js.' - // 'ab' will not match 'abc' - /(?:[^*])$/, +"use strict"; - // WTF! - // https://git-scm.com/docs/gitignore - // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) - // which re-fixes #24, #38 - // > If there is a separator at the end of the pattern then the pattern - // > will only match directories, otherwise the pattern can match both - // > files and directories. +module.exports = (string, count = 1, options) => { + options = { + indent: ' ', + includeEmptyLines: false, + ...options + }; - // 'js*' will not match 'a.js' - // 'js/' will not match 'a.js' - // 'js' will match 'a.js' and 'a.js/' - match => /\/$/.test(match) - // foo/ will not match 'foo' - ? `${match}$` - // foo matches 'foo' and 'foo/' - : `${match}(?=$|\\/$)` - ], + if (typeof string !== 'string') { + throw new TypeError( + `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` + ); + } - // starting - [ - // there will be no leading '/' - // (which has been replaced by section "leading slash") - // If starts with '**', adding a '^' to the regular expression also works - /^(?=[^^])/, - function startingReplacer () { - // If has a slash `/` at the beginning or middle - return !/\/(?!$)/.test(this) - // > Prior to 2.22.1 - // > If the pattern does not contain a slash /, - // > Git treats it as a shell glob pattern - // Actually, if there is only a trailing slash, - // git also treats it as a shell glob pattern + if (typeof count !== 'number') { + throw new TypeError( + `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` + ); + } - // After 2.22.1 (compatible but clearer) - // > If there is a separator at the beginning or middle (or both) - // > of the pattern, then the pattern is relative to the directory - // > level of the particular .gitignore file itself. - // > Otherwise the pattern may also match at any level below - // > the .gitignore level. - ? '(?:^|\\/)' + if (typeof options.indent !== 'string') { + throw new TypeError( + `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` + ); + } - // > Otherwise, Git treats the pattern as a shell glob suitable for - // > consumption by fnmatch(3) - : '^' - } - ], + if (count === 0) { + return string; + } - // two globstars - [ - // Use lookahead assertions so that we could match more than one `'/**'` - /\\\/\\\*\\\*(?=\\\/|$)/g, + const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; - // Zero, one or several directories - // should not use '*', or it will be replaced by the next replacer + return string.replace(regex, options.indent.repeat(count)); +}; - // Check if it is not the last `'/**'` - (_, index, str) => index + 6 < str.length - // case: /**/ - // > A slash followed by two consecutive asterisks then a slash matches - // > zero or more directories. - // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. - // '/**/' - ? '(?:\\/[^\\/]+)*' +/***/ }), - // case: /** - // > A trailing `"/**"` matches everything inside. +/***/ 265: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - // #21: everything inside but it should not include the current folder - : '\\/.+' - ], +"use strict"; - // intermediate wildcards - [ - // Never replace escaped '*' - // ignore rule '\*' will match the path '*' - // 'abc.*/' -> go - // 'abc.*' -> skip this rule - /(^|[^\\]+)\\\*(?=.+)/g, +const path = __webpack_require__(622); +const win32 = process.platform === 'win32'; +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = __webpack_require__(199); - // '*.js' matches '.js' - // '*.js' doesn't match 'abc' - (_, p1) => `${p1}[^\\/]*` - ], +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - // trailing wildcard - [ - /(\^|\\\/)?\\\*$/, - (_, p1) => { - const prefix = p1 - // '\^': - // '/*' does not match '' - // '/*' does not match everything +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; - // '\\\/': - // 'abc/*' does not match 'abc/' - ? `${p1}[^/]+` +exports.supportsLookbehinds = () => { + const segs = process.version.slice(1).split('.').map(Number); + if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { + return true; + } + return false; +}; - // 'a*' matches 'a' - // 'a*' matches 'aa' - : '[^/]*' +exports.isWindows = options => { + if (options && typeof options.windows === 'boolean') { + return options.windows; + } + return win32 === true || path.sep === '\\'; +}; - return `${prefix}(?=$|\\/$)` - } - ], +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; - [ - // unescape - /\\\\\\/g, - () => '\\' - ] -] +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; -// A simple cache, because an ignore rule only has only one certain meaning -const regexCache = Object.create(null) +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; -// @param {pattern} -const makeRegex = (pattern, negative, ignorecase) => { - const r = regexCache[pattern] - if (r) { - return r + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; } + return output; +}; - // const replacers = negative - // ? NEGATIVE_REPLACERS - // : POSITIVE_REPLACERS - const source = REPLACERS.reduce( - (prev, current) => prev.replace(current[0], current[1].bind(pattern)), - pattern - ) +/***/ }), - return regexCache[pattern] = ignorecase - ? new RegExp(source, 'i') - : new RegExp(source) -} +/***/ 273: +/***/ (function(module, __unusedexports, __webpack_require__) { -const isString = subject => typeof subject === 'string' +"use strict"; -// > A blank line matches no files, so it can serve as a separator for readability. -const checkPattern = pattern => pattern - && isString(pattern) - && !REGEX_TEST_BLANK_LINE.test(pattern) +const indentString = __webpack_require__(257); +const cleanStack = __webpack_require__(201); - // > A line starting with # serves as a comment. - && pattern.indexOf('#') !== 0 +const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); -const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) +class AggregateError extends Error { + constructor(errors) { + if (!Array.isArray(errors)) { + throw new TypeError(`Expected input to be an Array, got ${typeof errors}`); + } -class IgnoreRule { - constructor ( - origin, - pattern, - negative, - regex - ) { - this.origin = origin - this.pattern = pattern - this.negative = negative - this.regex = regex - } -} + errors = [...errors].map(error => { + if (error instanceof Error) { + return error; + } -const createRule = (pattern, ignorecase) => { - const origin = pattern - let negative = false + if (error !== null && typeof error === 'object') { + // Handle plain error objects with message property and/or possibly other metadata + return Object.assign(new Error(error.message), error); + } - // > An optional prefix "!" which negates the pattern; - if (pattern.indexOf('!') === 0) { - negative = true - pattern = pattern.substr(1) - } + return new Error(error); + }); - pattern = pattern - // > Put a backslash ("\") in front of the first "!" for patterns that - // > begin with a literal "!", for example, `"\!important!.txt"`. - .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') - // > Put a backslash ("\") in front of the first hash for patterns that - // > begin with a hash. - .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') + let message = errors + .map(error => { + // The `stack` property is not standardized, so we can't assume it exists + return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error); + }) + .join('\n'); + message = '\n' + indentString(message, 4); + super(message); - const regex = makeRegex(pattern, negative, ignorecase) + this.name = 'AggregateError'; - return new IgnoreRule( - origin, - pattern, - negative, - regex - ) -} + Object.defineProperty(this, '_errors', {value: errors}); + } -const throwError = (message, Ctor) => { - throw new Ctor(message) + * [Symbol.iterator]() { + for (const error of this._errors) { + yield error; + } + } } -const checkPath = (path, originalPath, doThrow) => { - if (!isString(path)) { - return doThrow( - `path must be a string, but got \`${originalPath}\``, - TypeError - ) - } - - // We don't know if we should ignore '', so throw - if (!path) { - return doThrow(`path must not be empty`, TypeError) - } +module.exports = AggregateError; - // Check if it is a relative path - if (checkPath.isNotRelative(path)) { - const r = '`path.relative()`d' - return doThrow( - `path should be a ${r} string, but got "${originalPath}"`, - RangeError - ) - } - return true -} +/***/ }), -const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) +/***/ 291: +/***/ (function(__unusedmodule, exports, __webpack_require__) { -checkPath.isNotRelative = isNotRelative -checkPath.convert = p => p +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const events_1 = __webpack_require__(614); +const fsScandir = __webpack_require__(661); +const fastq = __webpack_require__(830); +const common = __webpack_require__(617); +const reader_1 = __webpack_require__(962); +class AsyncReader extends reader_1.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = fsScandir.scandir; + this._emitter = new events_1.EventEmitter(); + this._queue = fastq(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; + } + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; + } + destroy() { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + this._isDestroyed = true; + this._queue.killAndDrain(); + } + onEntry(callback) { + this._emitter.on('entry', callback); + } + onError(callback) { + this._emitter.once('error', callback); + } + onEnd(callback) { + this._emitter.once('end', callback); + } + _pushToQueue(directory, base) { + const queueItem = { directory, base }; + this._queue.push(queueItem, (error) => { + if (error !== null) { + this._handleError(error); + } + }); + } + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + return done(error, undefined); + } + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + done(null, undefined); + }); + } + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit('error', error); + } + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; + } + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + _emitEntry(entry) { + this._emitter.emit('entry', entry); + } +} +exports.default = AsyncReader; -class Ignore { - constructor ({ - ignorecase = true - } = {}) { - this._rules = [] - this._ignorecase = ignorecase - define(this, KEY_IGNORE, true) - this._initCache() - } - _initCache () { - this._ignoreCache = Object.create(null) - this._testCache = Object.create(null) - } +/***/ }), - _addPattern (pattern) { - // #32 - if (pattern && pattern[KEY_IGNORE]) { - this._rules = this._rules.concat(pattern._rules) - this._added = true - return - } +/***/ 302: +/***/ (function(module, __unusedexports, __webpack_require__) { - if (checkPattern(pattern)) { - const rule = createRule(pattern, this._ignorecase) - this._added = true - this._rules.push(rule) - } - } +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch - // @param {Array | string | Ignore} pattern - add (pattern) { - this._added = false +var fs = __webpack_require__(747) +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync - makeArray( - isString(pattern) - ? splitPattern(pattern) - : pattern - ).forEach(this._addPattern, this) +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = __webpack_require__(117) - // Some rules have just added to the ignore, - // making the behavior changed. - if (this._added) { - this._initCache() +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) } + }) +} - return this +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) } - // legacy - addPattern (pattern) { - return this.add(pattern) + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } } +} - // | ignored : unignored - // negative | 0:0 | 0:1 | 1:0 | 1:1 - // -------- | ------- | ------- | ------- | -------- - // 0 | TEST | TEST | SKIP | X - // 1 | TESTIF | SKIP | TEST | X +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} - // - SKIP: always skip - // - TEST: always test - // - TESTIF: only test if checkUnignored - // - X: that never happen +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} - // @param {boolean} whether should check if the path is unignored, - // setting `checkUnignored` to `false` could reduce additional - // path matching. - // @returns {TestResult} true if a file is ignored - _testOne (path, checkUnignored) { - let ignored = false - let unignored = false +/***/ }), - this._rules.forEach(rule => { - const {negative} = rule - if ( - unignored === negative && ignored !== unignored - || negative && !ignored && !unignored && !checkUnignored - ) { - return - } +/***/ 306: +/***/ (function(module, __unusedexports, __webpack_require__) { - const matched = rule.regex.test(path) +var concatMap = __webpack_require__(896); +var balanced = __webpack_require__(621); - if (matched) { - ignored = !negative - unignored = negative - } - }) +module.exports = expandTop; - return { - ignored, - unignored - } - } +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; - // @returns {TestResult} - _test (originalPath, cache, checkUnignored, slices) { - const path = originalPath - // Supports nullable path - && checkPath.convert(originalPath) +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} - checkPath(path, originalPath, throwError) +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} - return this._t(path, cache, checkUnignored, slices) - } +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} - _t (path, cache, checkUnignored, slices) { - if (path in cache) { - return cache[path] - } - if (!slices) { - // path/to/a.js - // ['path', 'to', 'a.js'] - slices = path.split(SLASH) - } +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; - slices.pop() + var parts = []; + var m = balanced('{', '}', str); - // If the path has no parent directory, just test it - if (!slices.length) { - return cache[path] = this._testOne(path, checkUnignored) - } + if (!m) + return str.split(','); - const parent = this._t( - slices.join(SLASH) + SLASH, - cache, - checkUnignored, - slices - ) + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); - // If the path contains a parent directory, check the parent first - return cache[path] = parent.ignored - // > It is not possible to re-include a file if a parent directory of - // > that file is excluded. - ? parent - : this._testOne(path, checkUnignored) + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); } - ignores (path) { - return this._test(path, this._ignoreCache, false).ignored - } + parts.push.apply(parts, p); - createFilter () { - return path => !this.ignores(path) - } + return parts; +} - filter (paths) { - return makeArray(paths).filter(this.createFilter()) - } +function expandTop(str) { + if (!str) + return []; - // @returns {TestResult} - test (path) { - return this._test(path, this._testCache, true) + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); } -} -const factory = options => new Ignore(options) + return expand(escapeBraces(str), true).map(unescapeBraces); +} -const returnFalse = () => false +function identity(e) { + return e; +} -const isPathValid = path => - checkPath(path && checkPath.convert(path), path, returnFalse) +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} -factory.isPathValid = isPathValid +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} -// Fixes typescript -factory.default = factory +function expand(str, isTop) { + var expansions = []; -module.exports = factory - -// Windows -// -------------------------------------------------------------- -/* istanbul ignore if */ -if ( - // Detect `process` so that it can run in browsers. - typeof process !== 'undefined' - && ( - process.env && process.env.IGNORE_TEST_WIN32 - || process.platform === 'win32' - ) -) { - /* eslint no-control-regex: "off" */ - const makePosix = str => /^\\\\\?\\/.test(str) - || /["<>|\u0000-\u001F]+/u.test(str) - ? str - : str.replace(/\\/g, '/') - - checkPath.convert = makePosix - - // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' - // 'd:\\foo' - const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i - checkPath.isNotRelative = path => - REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) - || isNotRelative(path) -} + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } -/***/ }), + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } -/***/ 402: -/***/ (function(module, __unusedexports, __webpack_require__) { + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; -module.exports = glob + var N; -var fs = __webpack_require__(747) -var rp = __webpack_require__(302) -var minimatch = __webpack_require__(93) -var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(689) -var EE = __webpack_require__(614).EventEmitter -var path = __webpack_require__(622) -var assert = __webpack_require__(357) -var isAbsolute = __webpack_require__(681) -var globSync = __webpack_require__(658) -var common = __webpack_require__(856) -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var inflight = __webpack_require__(674) -var util = __webpack_require__(669) -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); -var once = __webpack_require__(49) + N = []; -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {} - if (!options) options = {} + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return globSync(pattern, options) + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } } - return new Glob(pattern, options, cb) + return expansions; } -glob.sync = globSync -var GlobSync = glob.GlobSync = globSync.GlobSync -// old api surface -glob.glob = glob -function extend (origin, add) { - if (add === null || typeof add !== 'object') { - return origin - } +/***/ }), - var keys = Object.keys(add) - var i = keys.length - while (i--) { - origin[keys[i]] = add[keys[i]] - } - return origin -} +/***/ 307: +/***/ (function(__unusedmodule, exports, __webpack_require__) { -glob.hasMagic = function (pattern, options_) { - var options = extend({}, options_) - options.noprocess = true +exports.require = function() { + var fs = __webpack_require__(747); + if (process.versions['electron']) { + try { + originalFs = __webpack_require__(708); + if (Object.keys(originalFs).length > 0) { + fs = originalFs; + } + } catch (e) {} + } + return fs +}; - var g = new Glob(pattern, options) - var set = g.minimatch.set - if (!pattern) - return false +/***/ }), - if (set.length > 1) - return true +/***/ 315: +/***/ (function(module) { - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } } - - return false } -glob.Glob = Glob -inherits(Glob, EE) -function Glob (pattern, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync(pattern, options) - } +/***/ }), - if (!(this instanceof Glob)) - return new Glob(pattern, options, cb) +/***/ 317: +/***/ (function(module) { - setopts(this, pattern, options) - this._didRealPath = false +/** + * Helpers. + */ - // process each pattern in the minimatch set - var n = this.minimatch.set.length +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n) +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ - if (typeof cb === 'function') { - cb = once(cb) - this.on('error', cb) - this.on('end', function (matches) { - cb(null, matches) - }) +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; - var self = this - this._processing = 0 - - this._emitQueue = [] - this._processQueue = [] - this.paused = false - - if (this.noprocess) - return this - - if (n === 0) - return done() +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ - var sync = true - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done) +function parse(str) { + str = String(str); + if (str.length > 100) { + return; } - sync = false - - function done () { - --self._processing - if (self._processing <= 0) { - if (sync) { - process.nextTick(function () { - self._finish() - }) - } else { - self._finish() - } - } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; } } -Glob.prototype._finish = function () { - assert(this instanceof Glob) - if (this.aborted) - return - - if (this.realpath && !this._didRealpath) - return this._realpath() +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - common.finish(this) - this.emit('end', this.found) +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; } -Glob.prototype._realpath = function () { - if (this._didRealpath) - return - - this._didRealpath = true - - var n = this.matches.length - if (n === 0) - return this._finish() - - var self = this - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next) +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - function next () { - if (--n === 0) - self._finish() +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; } -Glob.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index] - if (!matchset) - return cb() +/** + * Pluralization helper. + */ - var found = Object.keys(matchset) - var self = this - var n = found.length +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} - if (n === 0) - return cb() - var set = this.matches[index] = Object.create(null) - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p) - rp.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true - else if (er.syscall === 'stat') - set[p] = true - else - self.emit('error', er) // srsly wtf right here +/***/ }), - if (--n === 0) { - self.matches[index] = set - cb() - } - }) - }) -} +/***/ 330: +/***/ (function(__unusedmodule, exports) { -Glob.prototype._mark = function (p) { - return common.mark(this, p) -} - -Glob.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} - -Glob.prototype.abort = function () { - this.aborted = true - this.emit('abort') -} - -Glob.prototype.pause = function () { - if (!this.paused) { - this.paused = true - this.emit('pause') - } -} - -Glob.prototype.resume = function () { - if (this.paused) { - this.emit('resume') - this.paused = false - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0) - this._emitQueue.length = 0 - for (var i = 0; i < eq.length; i ++) { - var e = eq[i] - this._emitMatch(e[0], e[1]) - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) - } - } - } -} - -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') - - if (this.aborted) - return - - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return - } - - //console.error('PROCESS %d', this._processing, pattern) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break +"use strict"; - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } +// Copyright (c) 2019-2020-2021 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +Object.defineProperty(exports, "__esModule", { value: true }); +exports.logCollectionRegExps = exports.useVcpkgToolchainFile = exports.cmakeWrapperCommand = exports.cmakeVcpkgTriplet = exports.cmakeBuildType = exports.buildWithCMakeArgs = exports.buildWithCMake = exports.cmakeToolchainPath = exports.cmakeGenerator = exports.cmakeListsOrSettingsJson = exports.ninjaDownloadUrl = exports.ninjaPath = exports.configurationRegexFilter = exports.cmakeAppendedArgs = exports.buildDirectory = exports.cmakeListsTxtPath = exports.cmakeSettingsJsonPath = void 0; +exports.cmakeSettingsJsonPath = 'cmakeSettingsJsonPath'; +exports.cmakeListsTxtPath = 'cmakeListsTxtPath'; +exports.buildDirectory = 'buildDirectory'; +exports.cmakeAppendedArgs = 'cmakeAppendedArgs'; +exports.configurationRegexFilter = 'configurationRegexFilter'; +exports.ninjaPath = 'ninjaPath'; +exports.ninjaDownloadUrl = 'ninjaDownloadUrl'; +exports.cmakeListsOrSettingsJson = 'cmakeListsOrSettingsJson'; +exports.cmakeGenerator = 'cmakeGenerator'; +exports.cmakeToolchainPath = 'cmakeToolchainPath'; +exports.buildWithCMake = 'buildWithCMake'; +exports.buildWithCMakeArgs = 'buildWithCMakeArgs'; +exports.cmakeBuildType = 'cmakeBuildType'; +exports.cmakeVcpkgTriplet = 'vcpkgTriplet'; +exports.cmakeWrapperCommand = 'cmakeWrapperCommand'; +exports.useVcpkgToolchainFile = 'useVcpkgToolchainFile'; +exports.logCollectionRegExps = 'logCollectionRegExps'; +//# sourceMappingURL=cmake-globals.js.map - var remain = pattern.slice(n) +/***/ }), - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix +/***/ 332: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - var abs = this._makeAbs(read) +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = __webpack_require__(747); +const os = __webpack_require__(87); +const CPU_COUNT = os.cpus().length; +exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; + } + if (this.stats) { + this.objectMode = true; + } + } + _getValue(option, value) { + return option === undefined ? value : option; + } + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } +} +exports.default = Settings; - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} +/***/ }), -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} +/***/ 350: +/***/ (function(module, __unusedexports, __webpack_require__) { -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { +"use strict"; - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() +const path = __webpack_require__(622); - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' +module.exports = path_ => { + let cwd = process.cwd(); - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } + path_ = path.resolve(path_); - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + if (process.platform === 'win32') { + cwd = cwd.toLowerCase(); + path_ = path_.toLowerCase(); + } - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() + return path_ === cwd; +}; - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) +/***/ }), - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } +/***/ 352: +/***/ (function(module, __unusedexports, __webpack_require__) { - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return cb() - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - this._process([e].concat(remain), index, inGlobStar, cb) - } - cb() -} - -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - - if (isIgnored(this, e)) - return - - if (this.paused) { - this._emitQueue.push([index, e]) - return - } - - var abs = isAbsolute(e) ? e : this._makeAbs(e) - - if (this.mark) - e = this._mark(e) - - if (this.absolute) - e = abs - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) - - this.emit('match', e) -} - -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return - - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) - - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) - - if (lstatcb) - fs.lstat(abs, lstatcb) - - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() - - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) - } -} - -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return - - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return - - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() - - if (Array.isArray(c)) - return cb(null, c) - } - - var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) -} - -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) - } -} - -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return - - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - return cb(null, entries) -} - -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return - - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break - } - - return cb() -} - -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - - -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) - - var isSym = this.symlinks[abs] - var len = entries.length - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) - } - - cb() -} - -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - - //console.error('ps2', prefix, exists) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) - cb() -} - -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return cb() - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) - - if (needDir && c === 'FILE') - return cb() - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) - } - } - - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - fs.lstat(abs, statcb) - - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) - } - } -} - -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() - } - - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat - - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return cb() - - return cb(null, c, stat) -} - - -/***/ }), - -/***/ 403: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); -const fsStat = __webpack_require__(231); -const fs = __webpack_require__(874); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); - this.fs = fs.createFileSystemAdapter(this._options.fs); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); - this.stats = this._getValue(this._options.stats, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); - this.fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this.followSymbolicLinks, - fs: this.fs, - throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink - }); - } - _getValue(option, value) { - return option === undefined ? value : option; - } -} -exports.default = Settings; - - -/***/ }), - -/***/ 406: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - -const taskManager = __webpack_require__(384); -const async_1 = __webpack_require__(113); -const stream_1 = __webpack_require__(775); -const sync_1 = __webpack_require__(78); -const settings_1 = __webpack_require__(332); -const utils = __webpack_require__(444); -function FastGlob(source, options) { - try { - assertPatternsInput(source); - } - catch (error) { - return Promise.reject(error); - } - const works = getWorks(source, async_1.default, options); - return Promise.all(works).then(utils.array.flatten); -} -// https://github.com/typescript-eslint/typescript-eslint/issues/60 -// eslint-disable-next-line no-redeclare -(function (FastGlob) { - function sync(source, options) { - assertPatternsInput(source); - const works = getWorks(source, sync_1.default, options); - return utils.array.flatten(works); - } - FastGlob.sync = sync; - function stream(source, options) { - assertPatternsInput(source); - const works = getWorks(source, stream_1.default, options); - /** - * The stream returned by the provider cannot work with an asynchronous iterator. - * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. - * This affects performance (+25%). I don't see best solution right now. - */ - return utils.stream.merge(works); - } - FastGlob.stream = stream; - function generateTasks(source, options) { - assertPatternsInput(source); - const patterns = [].concat(source); - const settings = new settings_1.default(options); - return taskManager.generate(patterns, settings); - } - FastGlob.generateTasks = generateTasks; - function isDynamicPattern(source, options) { - assertPatternsInput(source); - const settings = new settings_1.default(options); - return utils.pattern.isDynamicPattern(source, settings); - } - FastGlob.isDynamicPattern = isDynamicPattern; - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escape(source); - } - FastGlob.escapePath = escapePath; -})(FastGlob || (FastGlob = {})); -function getWorks(source, _Provider, options) { - const patterns = [].concat(source); - const settings = new settings_1.default(options); - const tasks = taskManager.generate(patterns, settings); - const provider = new _Provider(settings); - return tasks.map(provider.read, provider); -} -function assertPatternsInput(source) { - if ([].concat(source).every(isString)) { - return; - } - throw new TypeError('Patterns must be a string or an array of strings'); -} -function isString(source) { - return typeof source === 'string'; -} -module.exports = FastGlob; - - -/***/ }), - -/***/ 411: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -// Copyright (c) 2019-2020-2021 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -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 }); -exports.ActionLib = exports.ActionToolRunner = void 0; -const utils = __importStar(__webpack_require__(758)); -const core = __importStar(__webpack_require__(470)); -const toolrunner = __importStar(__webpack_require__(478)); -const ioutil = __importStar(__webpack_require__(672)); -const io = __importStar(__webpack_require__(1)); -const fs = __importStar(__webpack_require__(747)); -const path = __importStar(__webpack_require__(622)); -const cp = __importStar(__webpack_require__(129)); -function escapeCmdCommand(command) { - command = command.trim(); - if (!/^\".*\"$/.test(command)) - command = `\"${command}\"`; - return command; -} -function escapeShArgument(argument) { - // escape all blanks: blank -> \blank - return argument.replace(/ /g, '\\ '); -} -function escapeCmdExeArgument(argument) { - // \" -> \\" - argument = argument.replace(/(\\*)"/g, '$1$1\\"'); - // \$ -> \\$ - argument = argument.replace(/(\\*)$/g, '$1$1'); - // All other backslashes occur literally. - // Quote the whole thing: - argument = `"${argument}"`; - // Prefix with caret ^ any character to be escaped, as in: - // http://www.robvanderwoude.com/escapechars.php - // Do not escape %, let variable be passed in as is. - const metaCharsRegExp = /([()\][!^"`<>&|;, *?])/g; - argument = argument.replace(metaCharsRegExp, '^$1'); - return argument; -} -/** - * Run a command with arguments in a shell. - * Note: -G Ninja or -GNinja? The former works witha shell, the second does not work without a shell. - * e.spawnSync('cmake', ['-GNinja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> Configuring done. - * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Ninja - * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - * e.spawnSync('cmake', ['-GNinja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - * Hence the caller of this function is always using no spaces in between arguments. - * Exception is arbitrary text coming from the user, which will hit this problem when not using a shell. - * - * Other corner cases: - * e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix - * e.spawnSync('cmake', ['-GUnix\ Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - > e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - e.spawnSync('cmake', ['-G Unix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix Makefiles - * @static - * @param {string} commandPath - * @param {string[]} args - * @param {baselib.ExecOptions} [execOptions] - * @returns {Promise} - * @memberof ActionLib - */ -function exec(commandPath, args, execOptions) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - core.debug(`exec(${commandPath}, ${JSON.stringify(args)}, {${execOptions === null || execOptions === void 0 ? void 0 : execOptions.cwd}})<<`); - let useShell = false; - if (process.env.INPUT_USESHELL === 'true') - useShell = true; - else if (process.env.INPUT_USESHELL === 'false') { - useShell = false; - } - else if (process.env.INPUT_USESHELL) { - useShell = process.env.INPUT_USESHELL; - } - const opts = { - shell: useShell, - windowsVerbatimArguments: false, - cwd: execOptions === null || execOptions === void 0 ? void 0 : execOptions.cwd, - env: execOptions === null || execOptions === void 0 ? void 0 : execOptions.env, - stdio: "pipe", - }; - let args2 = args; - if ((typeof useShell === 'string' && useShell.includes('cmd')) || - (process.platform === 'win32' && typeof useShell === 'boolean' && useShell === true)) { - args2 = []; - args.map((arg) => args2.push(escapeCmdExeArgument(arg))); - // When using a shell, the command must be enclosed by quotes to handle blanks correctly. - commandPath = escapeCmdCommand(commandPath); - } - else if (((typeof useShell === 'string' && !useShell.includes('cmd')) || - (process.platform !== 'win32' && typeof useShell === 'boolean' && useShell === true))) { - args2 = []; - args.map((arg) => args2.push(escapeShArgument(arg))); - // When using a Unix shell, blanks needs to be escaped in the command as well. - commandPath = escapeShArgument(commandPath); - } - args = args2; - core.debug(`cp.spawn("${commandPath}", ${JSON.stringify(args)}, {cwd=${opts === null || opts === void 0 ? void 0 : opts.cwd}, shell=${opts === null || opts === void 0 ? void 0 : opts.shell}, path=${JSON.stringify((_a = opts === null || opts === void 0 ? void 0 : opts.env) === null || _a === void 0 ? void 0 : _a.PATH)}})`); - return new Promise((resolve, reject) => { - const child = cp.spawn(`${commandPath}`, args, opts); - if (execOptions && child.stdout) { - child.stdout.on('data', (chunk) => { - if (execOptions.listeners && execOptions.listeners.stdout) { - execOptions.listeners.stdout(chunk); - } - process.stdout.write(chunk); - }); - } - if (execOptions && child.stderr) { - child.stderr.on('data', (chunk) => { - if (execOptions.listeners && execOptions.listeners.stderr) { - execOptions.listeners.stderr(chunk); - } - process.stdout.write(chunk); - }); - } - child.on('error', (error) => { - core.debug(`${error}`); - // Wait one second to get still some output. - setTimeout(() => { - reject(error); - child.removeAllListeners(); - }, 1000); - }); - child.on('exit', (exitCode) => { - core.debug(`Exit code '${exitCode}' received from command '${commandPath}'`); - // Do not resolve yet, wait for the close event. - }); - child.on('close', (exitCode) => { - core.debug(`STDIO streams have closed for command '${commandPath}'`); - child.removeAllListeners(); - resolve(exitCode); - }); - }); - }); -} -class ActionToolRunner { - constructor(path) { - this.path = path; - this.arguments = []; - } - _argStringToArray(text) { - return this.__argStringToArray(text); - } - exec(options) { - return exec(this.path, this.arguments, options); - } - line(val) { - this.arguments = this.arguments.concat(toolrunner.argStringToArray(val)); - } - arg(val) { - if (val instanceof Array) { - this.arguments = this.arguments.concat(val); - } - else if (typeof (val) === 'string') { - this.arguments = this.arguments.concat(val.trim()); - } - } - execSync(options) { - return __awaiter(this, void 0, void 0, function* () { - let stdout = ""; - let stderr = ""; - let options2; - if (options) { - options2 = this.convertExecOptions(options); - options2.listeners = { - stdout: (data) => { - stdout += data.toString(); - }, - stderr: (data) => { - stderr += data.toString(); - } - }; - } - const exitCode = yield exec(this.path, this.arguments, options2); - const res2 = { - code: exitCode, - stdout: stdout, - stderr: stderr - }; - return Promise.resolve(res2); - }); - } - convertExecOptions(options) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const result = { - cwd: (_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(), - env: (_b = options.env) !== null && _b !== void 0 ? _b : process.env, - silent: (_c = options.silent) !== null && _c !== void 0 ? _c : false, - failOnStdErr: (_d = options.failOnStdErr) !== null && _d !== void 0 ? _d : false, - ignoreReturnCode: (_e = options.ignoreReturnCode) !== null && _e !== void 0 ? _e : false, - windowsVerbatimArguments: (_f = options.windowsVerbatimArguments) !== null && _f !== void 0 ? _f : false, - listeners: { - stdout: (_g = options.listeners) === null || _g === void 0 ? void 0 : _g.stdout, - stderr: (_h = options.listeners) === null || _h === void 0 ? void 0 : _h.stderr, - } - }; - result.outStream = options.outStream || process.stdout; - result.errStream = options.errStream || process.stderr; - return result; - } - __argStringToArray(argString) { - const args = []; - let inQuotes = false; - let escaped = false; - let lastCharWasSpace = true; - let arg = ''; - const append = function (c) { - // we only escape double quotes. - if (escaped && c !== '"') { - arg += '\\'; - } - arg += c; - escaped = false; - }; - for (let i = 0; i < argString.length; i++) { - const 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; - } - ; -} -exports.ActionToolRunner = ActionToolRunner; -class ActionLib { - getInput(name, isRequired) { - const value = core.getInput(name, { required: isRequired }); - this.debug(`getInput(${name}, ${isRequired}) -> '${value}'`); - return value; - } - getBoolInput(name, isRequired) { - var _a; - const value = ((_a = core.getInput(name, { required: isRequired })) !== null && _a !== void 0 ? _a : "").toUpperCase() === "TRUE"; - this.debug(`getBoolInput(${name}, ${isRequired}) -> '${value}'`); - return value; - } - getPathInput(name, isRequired, checkExists) { - const value = path.resolve(core.getInput(name, { required: isRequired })); - this.debug(`getPathInput(${name}) -> '${value}'`); - if (checkExists) { - if (!fs.existsSync(value)) - throw new Error(`input path '${value}' for '${name}' does not exist.`); - } - return value; - } - isFilePathSupplied(name) { - var _a, _b; - // normalize paths - const pathValue = this.resolve((_a = this.getPathInput(name, false, false)) !== null && _a !== void 0 ? _a : ''); - const repoRoot = this.resolve((_b = process.env.GITHUB_WORKSPACE) !== null && _b !== void 0 ? _b : ''); - const isSupplied = pathValue !== repoRoot; - this.debug(`isFilePathSupplied(s file path=('${name}') -> '${isSupplied}'`); - return isSupplied; - } - getDelimitedInput(name, delim, required) { - const input = core.getInput(name, { required: required }); - const inputs = input.split(delim); - this.debug(`getDelimitedInput(${name}, ${delim}, ${required}) -> '${inputs}'`); - return inputs; - } - // Set an environment variable, re-usable in subsequent actions. - setVariable(name, value) { - core.exportVariable(name, value); - } - // Set the output of the action. - setOutput(name, value) { - core.setOutput(name, value); - } - getVariable(name) { - var _a; - //?? Is it really fine to return an empty string in case of undefined variable? - return (_a = process.env[name]) !== null && _a !== void 0 ? _a : ""; - } - debug(message) { - core.debug(message); - } - error(message) { - core.error(message); - } - warning(message) { - core.warning(message); +var Utils = __webpack_require__(643), + Headers = __webpack_require__(181), + Constants = Utils.Constants, + Methods = __webpack_require__(880); + +module.exports = function (/*Buffer*/input) { + + var _entryHeader = new Headers.EntryHeader(), + _entryName = Buffer.alloc(0), + _comment = Buffer.alloc(0), + _isDirectory = false, + uncompressedData = null, + _extra = Buffer.alloc(0); + + function getCompressedDataFromZip() { + if (!input || !Buffer.isBuffer(input)) { + return Buffer.alloc(0); + } + _entryHeader.loadDataHeaderFromBinary(input); + return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize) + } + + function crc32OK(data) { + // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written + if ((_entryHeader.flags & 0x8) !== 0x8) { + if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) { + return false; + } + } else { + // @TODO: load and check data descriptor header + // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure + // (optionally preceded by a 4-byte signature) immediately after the compressed data: + } + return true; + } + + function decompress(/*Boolean*/async, /*Function*/callback, /*String*/pass) { + if(typeof callback === 'undefined' && typeof async === 'string') { + pass=async; + async=void 0; + } + if (_isDirectory) { + if (async && callback) { + callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error. + } + return Buffer.alloc(0); + } + + var compressedData = getCompressedDataFromZip(); + + if (compressedData.length === 0) { + if (async && callback) callback(compressedData, Utils.Errors.NO_DATA);//si added error. + return compressedData; + } + + var data = Buffer.alloc(_entryHeader.size); + + switch (_entryHeader.method) { + case Utils.Constants.STORED: + compressedData.copy(data); + if (!crc32OK(data)) { + if (async && callback) callback(data, Utils.Errors.BAD_CRC);//si added error + return Utils.Errors.BAD_CRC; + } else {//si added otherwise did not seem to return data. + if (async && callback) callback(data); + return data; + } + case Utils.Constants.DEFLATED: + var inflater = new Methods.Inflater(compressedData); + if (!async) { + var result = inflater.inflate(data); + result.copy(data, 0); + if (!crc32OK(data)) { + console.warn(Utils.Errors.BAD_CRC + " " + _entryName.toString()) + } + return data; + } else { + inflater.inflateAsync(function(result) { + result.copy(data, 0); + if (!crc32OK(data)) { + if (callback) callback(data, Utils.Errors.BAD_CRC); //si added error + } else { //si added otherwise did not seem to return data. + if (callback) callback(data); + } + }) + } + break; + default: + if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD); + return Utils.Errors.UNKNOWN_METHOD; + } + } + + function compress(/*Boolean*/async, /*Function*/callback) { + if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) { + // no data set or the data wasn't changed to require recompression + if (async && callback) callback(getCompressedDataFromZip()); + return getCompressedDataFromZip(); + } + + if (uncompressedData.length && !_isDirectory) { + var compressedData; + // Local file header + switch (_entryHeader.method) { + case Utils.Constants.STORED: + _entryHeader.compressedSize = _entryHeader.size; + + compressedData = Buffer.alloc(uncompressedData.length); + uncompressedData.copy(compressedData); + + if (async && callback) callback(compressedData); + return compressedData; + default: + case Utils.Constants.DEFLATED: + + var deflater = new Methods.Deflater(uncompressedData); + if (!async) { + var deflated = deflater.deflate(); + _entryHeader.compressedSize = deflated.length; + return deflated; + } else { + deflater.deflateAsync(function(data) { + compressedData = Buffer.alloc(data.length); + _entryHeader.compressedSize = data.length; + data.copy(compressedData); + callback && callback(compressedData); + }) + } + deflater = null; + break; + } + } else { + if (async && callback) { + callback(Buffer.alloc(0)); + } else { + return Buffer.alloc(0); + } + } + } + + function readUInt64LE(buffer, offset) { + return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset); + } + + function parseExtra(data) { + var offset = 0; + var signature, size, part; + while(offset= Constants.EF_ZIP64_SCOMP) { + size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP); + if(_entryHeader.size === Constants.EF_ZIP64_OR_32) { + _entryHeader.size = size; + } + } + if(data.length >= Constants.EF_ZIP64_RHO) { + compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP); + if(_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) { + _entryHeader.compressedSize = compressedSize; + } + } + if(data.length >= Constants.EF_ZIP64_DSN) { + offset = readUInt64LE(data, Constants.EF_ZIP64_RHO); + if(_entryHeader.offset === Constants.EF_ZIP64_OR_32) { + _entryHeader.offset = offset; + } + } + if(data.length >= Constants.EF_ZIP64_DSN+4) { + diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN); + if(_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) { + _entryHeader.diskNumStart = diskNumStart; + } + } + } + + + return { + get entryName () { return _entryName.toString(); }, + get rawEntryName() { return _entryName; }, + set entryName (val) { + _entryName = Utils.toBuffer(val); + var lastChar = _entryName[_entryName.length - 1]; + _isDirectory = (lastChar === 47) || (lastChar === 92); + _entryHeader.fileNameLength = _entryName.length; + }, + + get extra () { return _extra; }, + set extra (val) { + _extra = val; + _entryHeader.extraLength = val.length; + parseExtra(val); + }, + + get comment () { return _comment.toString(); }, + set comment (val) { + _comment = Utils.toBuffer(val); + _entryHeader.commentLength = _comment.length; + }, + + get name () { var n = _entryName.toString(); return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); }, + get isDirectory () { return _isDirectory }, + + getCompressedData : function() { + return compress(false, null) + }, + + getCompressedDataAsync : function(/*Function*/callback) { + compress(true, callback) + }, + + setData : function(value) { + uncompressedData = Utils.toBuffer(value); + if (!_isDirectory && uncompressedData.length) { + _entryHeader.size = uncompressedData.length; + _entryHeader.method = Utils.Constants.DEFLATED; + _entryHeader.crc = Utils.crc32(value); + _entryHeader.changed = true; + } else { // folders and blank files should be stored + _entryHeader.method = Utils.Constants.STORED; + } + }, + + getData : function(pass) { + if (_entryHeader.changed) { + return uncompressedData; + } else { + return decompress(false, null, pass); + } + }, + + getDataAsync : function(/*Function*/callback, pass) { + if (_entryHeader.changed) { + callback(uncompressedData) + } else { + decompress(true, callback, pass) + } + }, + + set attr(attr) { _entryHeader.attr = attr; }, + get attr() { return _entryHeader.attr; }, + + set header(/*Buffer*/data) { + _entryHeader.loadFromBinary(data); + }, + + get header() { + return _entryHeader; + }, + + packHeader : function() { + var header = _entryHeader.entryHeaderToBinary(); + // add + _entryName.copy(header, Utils.Constants.CENHDR); + if (_entryHeader.extraLength) { + _extra.copy(header, Utils.Constants.CENHDR + _entryName.length) + } + if (_entryHeader.commentLength) { + _comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length); + } + return header; + }, + + toString : function() { + return '{\n' + + '\t"entryName" : "' + _entryName.toString() + "\",\n" + + '\t"name" : "' + (_isDirectory ? _entryName.toString().replace(/\/$/, '').split("/").pop() : _entryName.toString().split("/").pop()) + "\",\n" + + '\t"comment" : "' + _comment.toString() + "\",\n" + + '\t"isDirectory" : ' + _isDirectory + ",\n" + + '\t"header" : ' + _entryHeader.toString().replace(/\t/mg, "\t\t").replace(/}/mg, "\t}") + ",\n" + + '\t"compressedData" : <' + (input && input.length + " bytes buffer" || "null") + ">\n" + + '\t"data" : <' + (uncompressedData && uncompressedData.length + " bytes buffer" || "null") + ">\n" + + '}'; + } + } +}; + + +/***/ }), + +/***/ 357: +/***/ (function(module) { + +module.exports = require("assert"); + +/***/ }), + +/***/ 364: +/***/ (function(module) { + +"use strict"; + +module.exports = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + + +/***/ }), + +/***/ 366: +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +const path = __webpack_require__(622); +const scan = __webpack_require__(537); +const parse = __webpack_require__(806); +const utils = __webpack_require__(265); +const constants = __webpack_require__(199); +const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = utils.isWindows(options); + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); } - info(message) { - core.info(message); + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; } - tool(name) { - return new ActionToolRunner(name); + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; } - exec(path, args, options) { - return __awaiter(this, void 0, void 0, function* () { - return yield exec(path, args, options); - }); + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); } - execSync(path, args, options) { - return __awaiter(this, void 0, void 0, function* () { - const exitCode = yield exec(path, args, options); - const result = { - code: exitCode, - stdout: "", - stderr: "" - }; - return Promise.resolve(result); - }); + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); } - which(name, required) { - return __awaiter(this, void 0, void 0, function* () { - core.debug(`"which(${name})<<`); - const filePath = yield io.which(name, required); - console.log(`tool: ${filePath}`); - core.debug(`"which(${name}) >> ${filePath}`); - return filePath; - }); + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(path.basename(input)); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch.scan = (input, options) => scan(input, options); + +/** + * Create a regular expression from a glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.makeRe(input[, options]); + * + * console.log(picomatch.makeRe('*.js')); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `input` A glob pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return parsed.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${parsed.output})${append}`; + if (parsed && parsed.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = parsed; + } + + return regex; +}; + +picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + const opts = options || {}; + let parsed = { negated: false, fastpaths: true }; + let prefix = ''; + let output; + + if (input.startsWith('./')) { + input = input.slice(2); + prefix = parsed.prefix = './'; + } + + if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + output = parse.fastpaths(input, options); + } + + if (output === undefined) { + parsed = parse(input, options); + parsed.prefix = prefix + (parsed.prefix || ''); + } else { + parsed.output = output; + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch.constants = constants; + +/** + * Expose "picomatch" + */ + +module.exports = picomatch; + + +/***/ }), + +/***/ 375: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(444); +class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } +} +exports.default = ErrorFilter; + + +/***/ }), + +/***/ 382: +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +const utils = __webpack_require__(225); + +module.exports = (ast, options = {}) => { + let stringify = (node, parent = {}) => { + let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; } - rmRF(path) { - return __awaiter(this, void 0, void 0, function* () { - yield io.rmRF(path); - }); + + if (node.value) { + return node.value; } - mkdirP(path) { - return __awaiter(this, void 0, void 0, function* () { - yield io.mkdirP(path); - }); + + if (node.nodes) { + for (let child of node.nodes) { + output += stringify(child); + } } - cd(path) { - process.chdir(path); + return output; + }; + + return stringify(ast); +}; + + + +/***/ }), + +/***/ 384: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(444); +function generate(patterns, settings) { + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +function convertPatternsToTasks(positive, negative, dynamic) { + const positivePatternsGroup = groupPatternsByBaseDirectory(positive); + // When we have a global group – there is no reason to divide the patterns into independent tasks. + // In this case, the global task covers the rest. + if ('.' in positivePatternsGroup) { + const task = convertPatternGroupToTask('.', positive, negative, dynamic); + return [task]; + } + return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); +} +exports.convertPatternsToTasks = convertPatternsToTasks; +function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, group); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; + + +/***/ }), + +/***/ 385: +/***/ (function(module, __unusedexports, __webpack_require__) { + +var ZipEntry = __webpack_require__(352), + Headers = __webpack_require__(181), + Utils = __webpack_require__(643); + +module.exports = function (/*String|Buffer*/input, /*Number*/inputType) { + var entryList = [], + entryTable = {}, + _comment = Buffer.alloc(0), + filename = "", + fs = Utils.FileSystem.require(), + inBuffer = null, + mainHeader = new Headers.MainHeader(); + + if (inputType === Utils.Constants.FILE) { + // is a filename + filename = input; + inBuffer = fs.readFileSync(filename); + readMainHeader(); + } else if (inputType === Utils.Constants.BUFFER) { + // is a memory buffer + inBuffer = input; + readMainHeader(); + } else { + // none. is a new file + } + + function readEntries() { + entryTable = {}; + entryList = new Array(mainHeader.diskEntries); // total number of entries + var index = mainHeader.offset; // offset of first CEN header + for (var i = 0; i < entryList.length; i++) { + + var tmp = index, + entry = new ZipEntry(inBuffer); + entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR); + + entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength); + + if (entry.header.extraLength) { + entry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength); + } + + if (entry.header.commentLength) + entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength); + + index += entry.header.entryHeaderSize; + + entryList[i] = entry; + entryTable[entry.entryName] = entry; + } + } + + function readMainHeader() { + var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size + n = Math.max(0, i - 0xFFFF), // 0xFFFF is the max zip file comment length + endOffset = -1; // Start offset of the END header + + for (i; i >= n; i--) { + if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P' + if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) { // "PK\005\006" + endOffset = i; + break; + } + } + if (!~endOffset) + throw Utils.Errors.INVALID_FORMAT; + + mainHeader.loadFromBinary(inBuffer.slice(endOffset, endOffset + Utils.Constants.ENDHDR)); + if (mainHeader.commentLength) { + _comment = inBuffer.slice(endOffset + Utils.Constants.ENDHDR); + } + readEntries(); + } + + return { + /** + * Returns an array of ZipEntry objects existent in the current opened archive + * @return Array + */ + get entries() { + return entryList; + }, + + /** + * Archive comment + * @return {String} + */ + get comment() { + return _comment.toString(); + }, + set comment(val) { + mainHeader.commentLength = val.length; + _comment = val; + }, + + /** + * Returns a reference to the entry with the given name or null if entry is inexistent + * + * @param entryName + * @return ZipEntry + */ + getEntry: function (/*String*/entryName) { + return entryTable[entryName] || null; + }, + + /** + * Adds the given entry to the entry list + * + * @param entry + */ + setEntry: function (/*ZipEntry*/entry) { + entryList.push(entry); + entryTable[entry.entryName] = entry; + mainHeader.totalEntries = entryList.length; + }, + + /** + * Removes the entry with the given name from the entry list. + * + * If the entry is a directory, then all nested files and directories will be removed + * @param entryName + */ + deleteEntry: function (/*String*/entryName) { + var entry = entryTable[entryName]; + if (entry && entry.isDirectory) { + var _self = this; + this.getEntryChildren(entry).forEach(function (child) { + if (child.entryName !== entryName) { + _self.deleteEntry(child.entryName) + } + }) + } + entryList.splice(entryList.indexOf(entry), 1); + delete(entryTable[entryName]); + mainHeader.totalEntries = entryList.length; + }, + + /** + * Iterates and returns all nested files and directories of the given entry + * + * @param entry + * @return Array + */ + getEntryChildren: function (/*ZipEntry*/entry) { + if (entry.isDirectory) { + var list = [], + name = entry.entryName, + len = name.length; + + entryList.forEach(function (zipEntry) { + if (zipEntry.entryName.substr(0, len) === name) { + list.push(zipEntry); + } + }); + return list; + } + return [] + }, + + /** + * Returns the zip file + * + * @return Buffer + */ + compressToBuffer: function () { + if (entryList.length > 1) { + entryList.sort(function (a, b) { + var nameA = a.entryName.toLowerCase(); + var nameB = b.entryName.toLowerCase(); + if (nameA < nameB) { + return -1 + } + if (nameA > nameB) { + return 1 + } + return 0; + }); + } + + var totalSize = 0, + dataBlock = [], + entryHeaders = [], + dindex = 0; + + mainHeader.size = 0; + mainHeader.offset = 0; + + entryList.forEach(function (entry) { + // compress data and set local and entry header accordingly. Reason why is called first + var compressedData = entry.getCompressedData(); + // data header + entry.header.offset = dindex; + var dataHeader = entry.header.dataHeaderToBinary(); + var entryNameLen = entry.rawEntryName.length; + var extra = entry.extra.toString(); + var postHeader = Buffer.alloc(entryNameLen + extra.length); + entry.rawEntryName.copy(postHeader, 0); + postHeader.fill(extra, entryNameLen); + + var dataLength = dataHeader.length + postHeader.length + compressedData.length; + + dindex += dataLength; + + dataBlock.push(dataHeader); + dataBlock.push(postHeader); + dataBlock.push(compressedData); + + var entryHeader = entry.packHeader(); + entryHeaders.push(entryHeader); + mainHeader.size += entryHeader.length; + totalSize += (dataLength + entryHeader.length); + }); + + totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length + // point to end of data and beginning of central directory first record + mainHeader.offset = dindex; + + dindex = 0; + var outBuffer = Buffer.alloc(totalSize); + dataBlock.forEach(function (content) { + content.copy(outBuffer, dindex); // write data blocks + dindex += content.length; + }); + entryHeaders.forEach(function (content) { + content.copy(outBuffer, dindex); // write central directory entries + dindex += content.length; + }); + + var mh = mainHeader.toBinary(); + if (_comment) { + _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment + } + + mh.copy(outBuffer, dindex); // write main header + + return outBuffer + }, + + toAsyncBuffer: function (/*Function*/onSuccess, /*Function*/onFail, /*Function*/onItemStart, /*Function*/onItemEnd) { + if (entryList.length > 1) { + entryList.sort(function (a, b) { + var nameA = a.entryName.toLowerCase(); + var nameB = b.entryName.toLowerCase(); + if (nameA > nameB) { + return -1 + } + if (nameA < nameB) { + return 1 + } + return 0; + }); + } + + var totalSize = 0, + dataBlock = [], + entryHeaders = [], + dindex = 0; + + mainHeader.size = 0; + mainHeader.offset = 0; + + var compress = function (entryList) { + var self = arguments.callee; + if (entryList.length) { + var entry = entryList.pop(); + var name = entry.entryName + entry.extra.toString(); + if (onItemStart) onItemStart(name); + entry.getCompressedDataAsync(function (compressedData) { + if (onItemEnd) onItemEnd(name); + + entry.header.offset = dindex; + // data header + var dataHeader = entry.header.dataHeaderToBinary(); + var postHeader; + try { + postHeader = Buffer.alloc(name.length, name); // using alloc will work on node 5.x+ + } catch(e){ + postHeader = new Buffer(name); // use deprecated method if alloc fails... + } + var dataLength = dataHeader.length + postHeader.length + compressedData.length; + + dindex += dataLength; + + dataBlock.push(dataHeader); + dataBlock.push(postHeader); + dataBlock.push(compressedData); + + var entryHeader = entry.packHeader(); + entryHeaders.push(entryHeader); + mainHeader.size += entryHeader.length; + totalSize += (dataLength + entryHeader.length); + + if (entryList.length) { + self(entryList); + } else { + + + totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length + // point to end of data and beginning of central directory first record + mainHeader.offset = dindex; + + dindex = 0; + var outBuffer = Buffer.alloc(totalSize); + dataBlock.forEach(function (content) { + content.copy(outBuffer, dindex); // write data blocks + dindex += content.length; + }); + entryHeaders.forEach(function (content) { + content.copy(outBuffer, dindex); // write central directory entries + dindex += content.length; + }); + + var mh = mainHeader.toBinary(); + if (_comment) { + _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment + } + + mh.copy(outBuffer, dindex); // write main header + + onSuccess(outBuffer); + } + }); + } + }; + + compress(entryList); + } + } +}; + + +/***/ }), + +/***/ 394: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const fsScandir = __webpack_require__(661); +const common = __webpack_require__(617); +const reader_1 = __webpack_require__(962); +class SyncReader extends reader_1.default { + constructor() { + super(...arguments); + this._scandir = fsScandir.scandirSync; + this._storage = new Set(); + this._queue = new Set(); + } + read() { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + return [...this._storage]; + } + _pushToQueue(directory, base) { + this._queue.add({ directory, base }); + } + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + for (const entry of entries) { + this._handleEntry(entry, base); + } + } + catch (error) { + this._handleError(error); + } + } + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + throw error; + } + _handleEntry(entry, base) { + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + _pushToStorage(entry) { + this._storage.add(entry); + } +} +exports.default = SyncReader; + + +/***/ }), + +/***/ 396: +/***/ (function(module) { + +// A simple implementation of make-array +function makeArray (subject) { + return Array.isArray(subject) + ? subject + : [subject] +} + +const REGEX_TEST_BLANK_LINE = /^\s+$/ +const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ +const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ +const REGEX_SPLITALL_CRLF = /\r?\n/g +// /foo, +// ./foo, +// ../foo, +// . +// .. +const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ + +const SLASH = '/' +const KEY_IGNORE = typeof Symbol !== 'undefined' + ? Symbol.for('node-ignore') + /* istanbul ignore next */ + : 'node-ignore' + +const define = (object, key, value) => + Object.defineProperty(object, key, {value}) + +const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g + +// Sanitize the range of a regular expression +// The cases are complicated, see test cases for details +const sanitizeRange = range => range.replace( + REGEX_REGEXP_RANGE, + (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) + ? match + // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : '' +) + +// > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` + +// '`foo/`' should not continue with the '`..`' +const REPLACERS = [ + + // > Trailing spaces are ignored unless they are quoted with backslash ("\") + [ + // (a\ ) -> (a ) + // (a ) -> (a) + // (a \ ) -> (a ) + /\\?\s+$/, + match => match.indexOf('\\') === 0 + ? ' ' + : '' + ], + + // replace (\ ) with ' ' + [ + /\\\s/g, + () => ' ' + ], + + // Escape metacharacters + // which is written down by users but means special for regular expressions. + + // > There are 12 characters with special meanings: + // > - the backslash \, + // > - the caret ^, + // > - the dollar sign $, + // > - the period or dot ., + // > - the vertical bar or pipe symbol |, + // > - the question mark ?, + // > - the asterisk or star *, + // > - the plus sign +, + // > - the opening parenthesis (, + // > - the closing parenthesis ), + // > - and the opening square bracket [, + // > - the opening curly brace {, + // > These special characters are often called "metacharacters". + [ + /[\\^$.|*+(){]/g, + match => `\\${match}` + ], + + [ + // > [abc] matches any character inside the brackets + // > (in this case a, b, or c); + /\[([^\]/]*)($|\])/g, + (match, p1, p2) => p2 === ']' + ? `[${sanitizeRange(p1)}]` + : `\\${match}` + ], + + [ + // > a question mark (?) matches a single character + /(?!\\)\?/g, + () => '[^/]' + ], + + // leading slash + [ + + // > A leading slash matches the beginning of the pathname. + // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". + // A leading slash matches the beginning of the pathname + /^\//, + () => '^' + ], + + // replace special metacharacter slash after the leading slash + [ + /\//g, + () => '\\/' + ], + + [ + // > A leading "**" followed by a slash means match in all directories. + // > For example, "**/foo" matches file or directory "foo" anywhere, + // > the same as pattern "foo". + // > "**/foo/bar" matches file or directory "bar" anywhere that is directly + // > under directory "foo". + // Notice that the '*'s have been replaced as '\\*' + /^\^*\\\*\\\*\\\//, + + // '**/foo' <-> 'foo' + () => '^(?:.*\\/)?' + ], + + // ending + [ + // 'js' will not match 'js.' + // 'ab' will not match 'abc' + /(?:[^*])$/, + + // WTF! + // https://git-scm.com/docs/gitignore + // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) + // which re-fixes #24, #38 + + // > If there is a separator at the end of the pattern then the pattern + // > will only match directories, otherwise the pattern can match both + // > files and directories. + + // 'js*' will not match 'a.js' + // 'js/' will not match 'a.js' + // 'js' will match 'a.js' and 'a.js/' + match => /\/$/.test(match) + // foo/ will not match 'foo' + ? `${match}$` + // foo matches 'foo' and 'foo/' + : `${match}(?=$|\\/$)` + ], + + // starting + [ + // there will be no leading '/' + // (which has been replaced by section "leading slash") + // If starts with '**', adding a '^' to the regular expression also works + /^(?=[^^])/, + function startingReplacer () { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) + // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern + + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' + + // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^' } - writeFile(path, content) { - fs.writeFileSync(path, content); + ], + + // two globstars + [ + // Use lookahead assertions so that we could match more than one `'/**'` + /\\\/\\\*\\\*(?=\\\/|$)/g, + + // Zero, one or several directories + // should not use '*', or it will be replaced by the next replacer + + // Check if it is not the last `'/**'` + (_, index, str) => index + 6 < str.length + + // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' + + // case: /** + // > A trailing `"/**"` matches everything inside. + + // #21: everything inside but it should not include the current folder + : '\\/.+' + ], + + // intermediate wildcards + [ + // Never replace escaped '*' + // ignore rule '\*' will match the path '*' + + // 'abc.*/' -> go + // 'abc.*' -> skip this rule + /(^|[^\\]+)\\\*(?=.+)/g, + + // '*.js' matches '.js' + // '*.js' doesn't match 'abc' + (_, p1) => `${p1}[^\\/]*` + ], + + // trailing wildcard + [ + /(\^|\\\/)?\\\*$/, + (_, p1) => { + const prefix = p1 + // '\^': + // '/*' does not match '' + // '/*' does not match everything + + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` + + // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*' + + return `${prefix}(?=$|\\/$)` } - resolve(apath) { - core.debug(`"resolve(${apath})<<`); - const resolvedPath = path.resolve(apath); - core.debug(`"resolve(${apath})>> '${resolvedPath})'`); - return resolvedPath; + ], + + [ + // unescape + /\\\\\\/g, + () => '\\' + ] +] + +// A simple cache, because an ignore rule only has only one certain meaning +const regexCache = Object.create(null) + +// @param {pattern} +const makeRegex = (pattern, negative, ignorecase) => { + const r = regexCache[pattern] + if (r) { + return r + } + + // const replacers = negative + // ? NEGATIVE_REPLACERS + // : POSITIVE_REPLACERS + + const source = REPLACERS.reduce( + (prev, current) => prev.replace(current[0], current[1].bind(pattern)), + pattern + ) + + return regexCache[pattern] = ignorecase + ? new RegExp(source, 'i') + : new RegExp(source) +} + +const isString = subject => typeof subject === 'string' + +// > A blank line matches no files, so it can serve as a separator for readability. +const checkPattern = pattern => pattern + && isString(pattern) + && !REGEX_TEST_BLANK_LINE.test(pattern) + + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0 + +const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) + +class IgnoreRule { + constructor ( + origin, + pattern, + negative, + regex + ) { + this.origin = origin + this.pattern = pattern + this.negative = negative + this.regex = regex + } +} + +const createRule = (pattern, ignorecase) => { + const origin = pattern + let negative = false + + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true + pattern = pattern.substr(1) + } + + pattern = pattern + // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') + // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') + + const regex = makeRegex(pattern, negative, ignorecase) + + return new IgnoreRule( + origin, + pattern, + negative, + regex + ) +} + +const throwError = (message, Ctor) => { + throw new Ctor(message) +} + +const checkPath = (path, originalPath, doThrow) => { + if (!isString(path)) { + return doThrow( + `path must be a string, but got \`${originalPath}\``, + TypeError + ) + } + + // We don't know if we should ignore '', so throw + if (!path) { + return doThrow(`path must not be empty`, TypeError) + } + + // Check if it is a relative path + if (checkPath.isNotRelative(path)) { + const r = '`path.relative()`d' + return doThrow( + `path should be a ${r} string, but got "${originalPath}"`, + RangeError + ) + } + + return true +} + +const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) + +checkPath.isNotRelative = isNotRelative +checkPath.convert = p => p + +class Ignore { + constructor ({ + ignorecase = true + } = {}) { + this._rules = [] + this._ignorecase = ignorecase + define(this, KEY_IGNORE, true) + this._initCache() + } + + _initCache () { + this._ignoreCache = Object.create(null) + this._testCache = Object.create(null) + } + + _addPattern (pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules) + this._added = true + return } - stats(path) { - return fs.statSync(path); + + if (checkPattern(pattern)) { + const rule = createRule(pattern, this._ignorecase) + this._added = true + this._rules.push(rule) } - exist(path) { - return ioutil.exists(path); + } + + // @param {Array | string | Ignore} pattern + add (pattern) { + this._added = false + + makeArray( + isString(pattern) + ? splitPattern(pattern) + : pattern + ).forEach(this._addPattern, this) + + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache() } - getBinDir() { - if (!process.env.GITHUB_WORKSPACE) { - throw new Error("GITHUB_WORKSPACE is not set."); - } - const binPath = utils.BaseUtilLib.normalizePath(path.join(process.env.GITHUB_WORKSPACE, "../b/")); - if (!fs.existsSync(binPath)) { - core.debug(`BinDir '${binPath}' does not exists, creating it...`); - fs.mkdirSync(binPath); - } - return binPath; + + return this + } + + // legacy + addPattern (pattern) { + return this.add(pattern) + } + + // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X + + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. + + // @returns {TestResult} true if a file is ignored + _testOne (path, checkUnignored) { + let ignored = false + let unignored = false + + this._rules.forEach(rule => { + const {negative} = rule + if ( + unignored === negative && ignored !== unignored + || negative && !ignored && !unignored && !checkUnignored + ) { + return + } + + const matched = rule.regex.test(path) + + if (matched) { + ignored = !negative + unignored = negative + } + }) + + return { + ignored, + unignored } - getSrcDir() { - if (!process.env.GITHUB_WORKSPACE) { - throw new Error("GITHUB_WORKSPACE env var is not set."); - } - const srcPath = utils.BaseUtilLib.normalizePath(process.env.GITHUB_WORKSPACE); - if (!fs.existsSync(srcPath)) { - throw new Error(`SourceDir '${srcPath}' does not exists.`); - } - return srcPath; + } + + // @returns {TestResult} + _test (originalPath, cache, checkUnignored, slices) { + const path = originalPath + // Supports nullable path + && checkPath.convert(originalPath) + + checkPath(path, originalPath, throwError) + + return this._t(path, cache, checkUnignored, slices) + } + + _t (path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path] } - getArtifactsDir() { - if (!process.env.GITHUB_WORKSPACE) { - throw new Error("GITHUB_WORKSPACE is not set."); - } - //?? HACK. How to get the value of '{{ runner.temp }}' in JS's action? - const artifactsPath = utils.BaseUtilLib.normalizePath(path.join(process.env.GITHUB_WORKSPACE, "../../_temp")); - if (!fs.existsSync(artifactsPath)) { - core.debug(`ArtifactsDir '${artifactsPath}' does not exists, creating it...`); - fs.mkdirSync(artifactsPath); - } - return artifactsPath; + + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH) } - beginOperation(message) { - core.startGroup(message); + + slices.pop() + + // If the path has no parent directory, just test it + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored) } - endOperation() { - core.endGroup(); + + const parent = this._t( + slices.join(SLASH) + SLASH, + cache, + checkUnignored, + slices + ) + + // If the path contains a parent directory, check the parent first + return cache[path] = parent.ignored + // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent + : this._testOne(path, checkUnignored) + } + + ignores (path) { + return this._test(path, this._ignoreCache, false).ignored + } + + createFilter () { + return path => !this.ignores(path) + } + + filter (paths) { + return makeArray(paths).filter(this.createFilter()) + } + + // @returns {TestResult} + test (path) { + return this._test(path, this._testCache, true) + } +} + +const factory = options => new Ignore(options) + +const returnFalse = () => false + +const isPathValid = path => + checkPath(path && checkPath.convert(path), path, returnFalse) + +factory.isPathValid = isPathValid + +// Fixes typescript +factory.default = factory + +module.exports = factory + +// Windows +// -------------------------------------------------------------- +/* istanbul ignore if */ +if ( + // Detect `process` so that it can run in browsers. + typeof process !== 'undefined' + && ( + process.env && process.env.IGNORE_TEST_WIN32 + || process.platform === 'win32' + ) +) { + /* eslint no-control-regex: "off" */ + const makePosix = str => /^\\\\\?\\/.test(str) + || /["<>|\u0000-\u001F]+/u.test(str) + ? str + : str.replace(/\\/g, '/') + + checkPath.convert = makePosix + + // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i + checkPath.isNotRelative = path => + REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) + || isNotRelative(path) +} + + +/***/ }), + +/***/ 402: +/***/ (function(module, __unusedexports, __webpack_require__) { + +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = __webpack_require__(747) +var rp = __webpack_require__(302) +var minimatch = __webpack_require__(93) +var Minimatch = minimatch.Minimatch +var inherits = __webpack_require__(689) +var EE = __webpack_require__(614).EventEmitter +var path = __webpack_require__(622) +var assert = __webpack_require__(357) +var isAbsolute = __webpack_require__(681) +var globSync = __webpack_require__(658) +var common = __webpack_require__(856) +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = __webpack_require__(674) +var util = __webpack_require__(669) +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = __webpack_require__(49) + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } } - addMatcher(file) { - console.log(`::add-matcher::${file}`); + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } } - removeMatcher(file) { - console.log(`::remove-matcher::${file}`); + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } } + } } -exports.ActionLib = ActionLib; -//# sourceMappingURL=action-lib.js.map -/***/ }), +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') -/***/ 413: -/***/ (function(module) { + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } -module.exports = require("stream"); + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) -/***/ }), + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() -/***/ 417: -/***/ (function(module) { + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. -module.exports = require("crypto"); + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) -/***/ }), + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } -/***/ 418: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); -const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([*?|(){}[\]]|^!|[@+!](?=\())/g; -/** - * Designed to work only with simple paths: `dir\\file`. - */ -function unixify(filepath) { - return filepath.replace(/\\/g, '/'); -} -exports.unixify = unixify; -function makeAbsolute(cwd, filepath) { - return path.resolve(cwd, filepath); -} -exports.makeAbsolute = makeAbsolute; -function escape(pattern) { - return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); -} -exports.escape = escape; + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return -/***/ }), + if (isIgnored(this, e)) + return -/***/ 431: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + if (this.paused) { + this._emitQueue.push([index, e]) + return + } -"use strict"; + var abs = isAbsolute(e) ? e : this._makeAbs(e) -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const os = __importStar(__webpack_require__(87)); -const utils_1 = __webpack_require__(82); -/** - * Commands - * - * Command Format: - * ::name key=value,key=value::message - * - * Examples: - * ::warning::This is the message - * ::set-env name=MY_VAR::some value - */ -function issueCommand(command, properties, message) { - const cmd = new Command(command, properties, message); - process.stdout.write(cmd.toString() + os.EOL); -} -exports.issueCommand = issueCommand; -function issue(name, message = '') { - issueCommand(name, {}, message); -} -exports.issue = issue; -const CMD_STRING = '::'; -class Command { - constructor(command, properties, message) { - if (!command) { - command = 'missing.command'; - } - this.command = command; - this.properties = properties; - this.message = message; - } - toString() { - let cmdStr = CMD_STRING + this.command; - if (this.properties && Object.keys(this.properties).length > 0) { - cmdStr += ' '; - let first = true; - for (const key in this.properties) { - if (this.properties.hasOwnProperty(key)) { - const val = this.properties[key]; - if (val) { - if (first) { - first = false; - } - else { - cmdStr += ','; - } - cmdStr += `${key}=${escapeProperty(val)}`; - } - } - } - } - cmdStr += `${CMD_STRING}${escapeData(this.message)}`; - return cmdStr; - } -} -function escapeData(s) { - return utils_1.toCommandValue(s) - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A'); -} -function escapeProperty(s) { - return utils_1.toCommandValue(s) - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A') - .replace(/:/g, '%3A') - .replace(/,/g, '%2C'); -} -//# sourceMappingURL=command.js.map + if (this.mark) + e = this._mark(e) -/***/ }), + if (this.absolute) + e = abs -/***/ 435: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (this.matches[index][e]) + return -"use strict"; + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + this.matches[index][e] = true -const fill = __webpack_require__(730); -const utils = __webpack_require__(225); + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) -const compile = (ast, options = {}) => { - let walk = (node, parent = {}) => { - let invalidBlock = utils.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let invalid = invalidBlock === true || invalidNode === true; - let prefix = options.escapeInvalid === true ? '\\' : ''; - let output = ''; + this.emit('match', e) +} - if (node.isOpen === true) { - return prefix + node.value; - } - if (node.isClose === true) { - return prefix + node.value; - } +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return - if (node.type === 'open') { - return invalid ? (prefix + node.value) : '('; - } + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) - if (node.type === 'close') { - return invalid ? (prefix + node.value) : ')'; - } + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) - if (node.type === 'comma') { - return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); - } + if (lstatcb) + fs.lstat(abs, lstatcb) - if (node.value) { - return node.value; - } + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - let range = fill(...args, { ...options, wrap: false, toRegex: true }); + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym - if (range.length !== 0) { - return args.length > 1 && range.length > 1 ? `(${range})` : range; - } - } + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} - if (node.nodes) { - for (let child of node.nodes) { - output += walk(child, node); - } - } - return output; - }; +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return - return walk(ast); -}; + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return -module.exports = compile; + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() -/***/ }), + if (Array.isArray(c)) + return cb(null, c) + } -/***/ 440: -/***/ (function(module) { + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} -"use strict"; +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return -function reusify (Constructor) { - var head = new Constructor() - var tail = head + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } - function get () { - var current = head + this.cache[abs] = entries + return cb(null, entries) +} - if (current.next) { - head = current.next - } else { - head = new Constructor() - tail = head - } +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return - current.next = null + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break - return current - } + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break - function release (obj) { - tail.next = obj - tail = obj + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break } - return { - get: get, - release: release - } + return cb() } -module.exports = reusify +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} -/***/ }), +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) -/***/ 441: -/***/ (function(module, __unusedexports, __webpack_require__) { + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() -"use strict"; + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) -const fill = __webpack_require__(730); -const stringify = __webpack_require__(382); -const utils = __webpack_require__(225); + var isSym = this.symlinks[abs] + var len = entries.length -const append = (queue = '', stash = '', enclose = false) => { - let result = []; + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() - queue = [].concat(queue); - stash = [].concat(stash); + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue - if (!stash.length) return queue; - if (!queue.length) { - return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; - } + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) - for (let item of queue) { - if (Array.isArray(item)) { - for (let value of item) { - result.push(append(value, stash, enclose)); - } - } else { - for (let ele of stash) { - if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; - result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); - } - } + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) } - return utils.flatten(result); -}; -const expand = (ast, options = {}) => { - let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; + cb() +} - let walk = (node, parent = {}) => { - node.queue = []; +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - let p = parent; - let q = parent.queue; + //console.error('ps2', prefix, exists) - while (p.type !== 'brace' && p.type !== 'root' && p.parent) { - p = p.parent; - q = p.queue; - } + if (!this.matches[index]) + this.matches[index] = Object.create(null) - if (node.invalid || node.dollar) { - q.push(append(q.pop(), stringify(node, options))); - return; - } + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() - if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { - q.push(append(q.pop(), ['{}'])); - return; + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' } + } - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - - if (utils.exceedsLimit(...args, options.step, rangeLimit)) { - throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); - } - - let range = fill(...args, options); - if (range.length === 0) { - range = stringify(node, options); - } + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') - q.push(append(q.pop(), range)); - node.nodes = []; - return; - } + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} - let enclose = utils.encloseBrace(node); - let queue = node.queue; - let block = node; +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' - while (block.type !== 'brace' && block.type !== 'root' && block.parent) { - block = block.parent; - queue = block.queue; - } + if (f.length > this.maxLength) + return cb() - for (let i = 0; i < node.nodes.length; i++) { - let child = node.nodes[i]; + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] - if (child.type === 'comma' && node.type === 'brace') { - if (i === 1) queue.push(''); - queue.push(''); - continue; - } + if (Array.isArray(c)) + c = 'DIR' - if (child.type === 'close') { - q.push(append(q.pop(), queue, enclose)); - continue; - } + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) - if (child.value && child.type !== 'open') { - queue.push(append(queue.pop(), child.value)); - continue; - } + if (needDir && c === 'FILE') + return cb() - if (child.nodes) { - walk(child, node); - } + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) } + } - return queue; - }; + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) - return utils.flatten(walk(ast)); -}; + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} -module.exports = expand; +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat -/***/ }), + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) -/***/ 443: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(666)); + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} /***/ }), -/***/ 444: +/***/ 403: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const array = __webpack_require__(453); -exports.array = array; -const errno = __webpack_require__(115); -exports.errno = errno; -const fs = __webpack_require__(43); -exports.fs = fs; -const path = __webpack_require__(418); -exports.path = path; -const pattern = __webpack_require__(724); -exports.pattern = pattern; -const stream = __webpack_require__(42); -exports.stream = stream; +const path = __webpack_require__(622); +const fsStat = __webpack_require__(231); +const fs = __webpack_require__(874); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option === undefined ? value : option; + } +} +exports.default = Settings; /***/ }), -/***/ 453: -/***/ (function(__unusedmodule, exports) { +/***/ 406: +/***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function flatten(items) { - return items.reduce((collection, item) => [].concat(collection, item), []); +const taskManager = __webpack_require__(384); +const async_1 = __webpack_require__(113); +const stream_1 = __webpack_require__(775); +const sync_1 = __webpack_require__(78); +const settings_1 = __webpack_require__(332); +const utils = __webpack_require__(444); +function FastGlob(source, options) { + try { + assertPatternsInput(source); + } + catch (error) { + return Promise.reject(error); + } + const works = getWorks(source, async_1.default, options); + return Promise.all(works).then(utils.array.flatten); } -exports.flatten = flatten; +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(source) { + if ([].concat(source).every(isString)) { + return; + } + throw new TypeError('Patterns must be a string or an array of strings'); +} +function isString(source) { + return typeof source === 'string'; +} +module.exports = FastGlob; /***/ }), -/***/ 454: +/***/ 411: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -9570,1007 +9317,857 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.CMakeSettingsJsonRunner = exports.parseConfigurations = exports.parseEnvironments = exports.PropertyEvaluator = exports.Configuration = exports.Environment = void 0; -const baseutillib = __importStar(__webpack_require__(758)); -const crypto = __importStar(__webpack_require__(417)); +exports.ActionLib = exports.ActionToolRunner = void 0; +const utils = __importStar(__webpack_require__(758)); +const core = __importStar(__webpack_require__(470)); +const toolrunner = __importStar(__webpack_require__(9)); +const ioutil = __importStar(__webpack_require__(672)); +const io = __importStar(__webpack_require__(1)); +const fs = __importStar(__webpack_require__(747)); const path = __importStar(__webpack_require__(622)); -__webpack_require__(966); -const ninjalib = __importStar(__webpack_require__(72)); -const globals = __importStar(__webpack_require__(330)); -const cmakerunner = __importStar(__webpack_require__(214)); -const cmakeutil = __importStar(__webpack_require__(233)); -const using_statement_1 = __webpack_require__(443); -const strip_json_comments_1 = __importDefault(__webpack_require__(966)); -class CMakeGenerators { +const cp = __importStar(__webpack_require__(129)); +function escapeCmdCommand(command) { + command = command.trim(); + if (!/^\".*\"$/.test(command)) + command = `\"${command}\"`; + return command; } -CMakeGenerators.ARM64 = ["ARM64", "ARM64"]; -CMakeGenerators.ARM = ["ARM", "ARM"]; -CMakeGenerators.X64 = ["x64", "x64"]; -CMakeGenerators.WIN64 = ["Win64", "x64"]; -CMakeGenerators.WIN32 = ["Win32", "Win32"]; -class CMakeVariable { - constructor(name, value, type) { - this.name = name; - this.value = value; - this.type = type; - if (!type) { - this.type = 'string'; +function escapeShArgument(argument) { + // escape all blanks: blank -> \blank + return argument.replace(/ /g, '\\ '); +} +function escapeCmdExeArgument(argument) { + // \" -> \\" + argument = argument.replace(/(\\*)"/g, '$1$1\\"'); + // \$ -> \\$ + argument = argument.replace(/(\\*)$/g, '$1$1'); + // All other backslashes occur literally. + // Quote the whole thing: + argument = `"${argument}"`; + // Prefix with caret ^ any character to be escaped, as in: + // http://www.robvanderwoude.com/escapechars.php + // Do not escape %, let variable be passed in as is. + const metaCharsRegExp = /([()\][!^"`<>&|;, *?])/g; + argument = argument.replace(metaCharsRegExp, '^$1'); + return argument; +} +/** + * Run a command with arguments in a shell. + * Note: -G Ninja or -GNinja? The former works witha shell, the second does not work without a shell. + * e.spawnSync('cmake', ['-GNinja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> Configuring done. + * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Ninja + * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + * e.spawnSync('cmake', ['-GNinja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + * Hence the caller of this function is always using no spaces in between arguments. + * Exception is arbitrary text coming from the user, which will hit this problem when not using a shell. + * + * Other corner cases: + * e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix + * e.spawnSync('cmake', ['-GUnix\ Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + > e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + e.spawnSync('cmake', ['-G Unix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix Makefiles + * @static + * @param {string} commandPath + * @param {string[]} args + * @param {baselib.ExecOptions} [execOptions] + * @returns {Promise} + * @memberof ActionLib + */ +function exec(commandPath, args, execOptions) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + core.debug(`exec(${commandPath}, ${JSON.stringify(args)}, {${execOptions === null || execOptions === void 0 ? void 0 : execOptions.cwd}})<<`); + let useShell = false; + if (process.env.INPUT_USESHELL === 'true') + useShell = true; + else if (process.env.INPUT_USESHELL === 'false') { + useShell = false; } - console.log(`Defining CMake variable: [name:'${name}', value='${value}', type='${type}'].`); - } - toString() { - return `-D${this.name}:${this.type}=${this.value}`; - } + else if (process.env.INPUT_USESHELL) { + useShell = process.env.INPUT_USESHELL; + } + const opts = { + shell: useShell, + windowsVerbatimArguments: false, + cwd: execOptions === null || execOptions === void 0 ? void 0 : execOptions.cwd, + env: execOptions === null || execOptions === void 0 ? void 0 : execOptions.env, + stdio: "pipe", + }; + let args2 = args; + if ((typeof useShell === 'string' && useShell.includes('cmd')) || + (process.platform === 'win32' && typeof useShell === 'boolean' && useShell === true)) { + args2 = []; + args.map((arg) => args2.push(escapeCmdExeArgument(arg))); + // When using a shell, the command must be enclosed by quotes to handle blanks correctly. + commandPath = escapeCmdCommand(commandPath); + } + else if (((typeof useShell === 'string' && !useShell.includes('cmd')) || + (process.platform !== 'win32' && typeof useShell === 'boolean' && useShell === true))) { + args2 = []; + args.map((arg) => args2.push(escapeShArgument(arg))); + // When using a Unix shell, blanks needs to be escaped in the command as well. + commandPath = escapeShArgument(commandPath); + } + args = args2; + core.debug(`cp.spawn("${commandPath}", ${JSON.stringify(args)}, {cwd=${opts === null || opts === void 0 ? void 0 : opts.cwd}, shell=${opts === null || opts === void 0 ? void 0 : opts.shell}, path=${JSON.stringify((_a = opts === null || opts === void 0 ? void 0 : opts.env) === null || _a === void 0 ? void 0 : _a.PATH)}})`); + return new Promise((resolve, reject) => { + const child = cp.spawn(`${commandPath}`, args, opts); + if (execOptions && child.stdout) { + child.stdout.on('data', (chunk) => { + if (execOptions.listeners && execOptions.listeners.stdout) { + execOptions.listeners.stdout(chunk); + } + process.stdout.write(chunk); + }); + } + if (execOptions && child.stderr) { + child.stderr.on('data', (chunk) => { + if (execOptions.listeners && execOptions.listeners.stderr) { + execOptions.listeners.stderr(chunk); + } + process.stdout.write(chunk); + }); + } + child.on('error', (error) => { + core.debug(`${error}`); + // Wait one second to get still some output. + setTimeout(() => { + reject(error); + child.removeAllListeners(); + }, 1000); + }); + child.on('exit', (exitCode) => { + core.debug(`Exit code '${exitCode}' received from command '${commandPath}'`); + // Do not resolve yet, wait for the close event. + }); + child.on('close', (exitCode) => { + core.debug(`STDIO streams have closed for command '${commandPath}'`); + child.removeAllListeners(); + resolve(exitCode); + }); + }); + }); } -class Variable { - constructor(name, value) { - this.name = name; - this.value = value; - // Nothing to do here. - } - toString() { - return `{var: '${this.name}'='${this.value}'}`; - } - addToEnvironment() { - process.env[this.stripNamespace(this.name)] = this.value; - } - stripNamespace(varName) { - return varName.substring(varName.indexOf('.') + 1); +class ActionToolRunner { + constructor(path) { + this.path = path; + this.arguments = []; } -} -class Environment { - constructor(name, theVariables) { - this.name = name; - this.theVariables = theVariables; - // Nothing to do. + _argStringToArray(text) { + return this.__argStringToArray(text); } - addVariable(variable) { - this.theVariables.push(variable); + exec(options) { + return exec(this.path, this.arguments, options); } - get variables() { - return this.theVariables; + line(val) { + this.arguments = this.arguments.concat(toolrunner.argStringToArray(val)); } - toString() { - let varsString = ""; - for (const variable of this.theVariables) { - varsString += String(variable) + ", "; + arg(val) { + if (val instanceof Array) { + this.arguments = this.arguments.concat(val); + } + else if (typeof (val) === 'string') { + this.arguments = this.arguments.concat(val.trim()); } - return `{env: '${this.name}', variables=${varsString}}`; } -} -exports.Environment = Environment; -class Configuration { - constructor(name, environments, buildDir, cmakeArgs, makeArgs, generator, type, workspaceRoot, cmakeSettingsJsonPath, cmakeToolchain, variables, inheritEnvironments) { - this.name = name; - this.environments = environments; - this.buildDir = buildDir; - this.cmakeArgs = cmakeArgs; - this.makeArgs = makeArgs; - this.generator = generator; - this.type = type; - this.workspaceRoot = workspaceRoot; - this.cmakeSettingsJsonPath = cmakeSettingsJsonPath; - this.cmakeToolchain = cmakeToolchain; - this.variables = variables; - this.inheritEnvironments = inheritEnvironments; - baseutillib.BaseUtilLib.throwIfUndefined(name, "name"); - baseutillib.BaseUtilLib.throwIfUndefined(buildDir, "buildDir"); - baseutillib.BaseUtilLib.throwIfUndefined(cmakeSettingsJsonPath, "cmakeSettingsJsonPath"); - this.buildDir = path.normalize(buildDir); + execSync(options) { + return __awaiter(this, void 0, void 0, function* () { + let stdout = ""; + let stderr = ""; + let options2; + if (options) { + options2 = this.convertExecOptions(options); + options2.listeners = { + stdout: (data) => { + stdout += data.toString(); + }, + stderr: (data) => { + stderr += data.toString(); + } + }; + } + const exitCode = yield exec(this.path, this.arguments, options2); + const res2 = { + code: exitCode, + stdout: stdout, + stderr: stderr + }; + return Promise.resolve(res2); + }); } - /** - * Add to current process the environment variables defined in this configuration. - * - * @param {EnvironmentMap} globalEnvs The global environments (not defined in this configuration) - * @memberof Configuration - */ - setEnvironment(globalEnvs) { - // Set all 'env' and unnamed environments and inherited environments. - for (const envName in globalEnvs) { - const environment = globalEnvs[envName]; - const nameLowerCased = environment.name.toLowerCase(); - // Unnamed environments (i.e. with no 'environment' property specified), - // empty string named (e.g. {"environment": "", ...} ), or ones called 'env' - // are being set in the environment automatically. All others needs to be - // explicitly inherited. - if (!nameLowerCased || "env" === nameLowerCased || - Configuration.unnamedEnvironmentName === nameLowerCased) { - for (const variable of environment.variables) { - variable.addToEnvironment(); + convertExecOptions(options) { + var _a, _b, _c, _d, _e, _f, _g, _h; + const result = { + cwd: (_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(), + env: (_b = options.env) !== null && _b !== void 0 ? _b : process.env, + silent: (_c = options.silent) !== null && _c !== void 0 ? _c : false, + failOnStdErr: (_d = options.failOnStdErr) !== null && _d !== void 0 ? _d : false, + ignoreReturnCode: (_e = options.ignoreReturnCode) !== null && _e !== void 0 ? _e : false, + windowsVerbatimArguments: (_f = options.windowsVerbatimArguments) !== null && _f !== void 0 ? _f : false, + listeners: { + stdout: (_g = options.listeners) === null || _g === void 0 ? void 0 : _g.stdout, + stderr: (_h = options.listeners) === null || _h === void 0 ? void 0 : _h.stderr, + } + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; + } + __argStringToArray(argString) { + const args = []; + let inQuotes = false; + let escaped = false; + let lastCharWasSpace = true; + let arg = ''; + const append = function (c) { + // we only escape double quotes. + if (escaped && c !== '"') { + arg += '\\'; + } + arg += c; + escaped = false; + }; + for (let i = 0; i < argString.length; i++) { + const 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; } - } - } - // Set all inherited environments. - for (const envName of this.inheritEnvironments) { - const environment = globalEnvs[envName]; - if (environment) { - for (const variable of environment.variables) { - variable.addToEnvironment(); + else { + append(c); } + continue; } - } - // Set all 'env' and unnamed environments. - for (const env in this.environments) { - for (const variable of this.environments[env].variables) { - variable.addToEnvironment(); + if (c === "\\" && escaped) { + append(c); + continue; + } + if (c === "\\" && inQuotes) { + escaped = true; + continue; } + append(c); + lastCharWasSpace = false; } - } - evaluate(evaluator) { - const evaledVars = []; - for (const variable of this.variables) { - evaledVars.push(new CMakeVariable(variable.name, evaluator.evaluateExpression(variable.value), variable.type)); + if (!lastCharWasSpace) { + args.push(arg.trim()); } - const conf = new Configuration(this.name, this.environments, evaluator.evaluateExpression(this.buildDir), evaluator.evaluateExpression(this.cmakeArgs), evaluator.evaluateExpression(this.makeArgs), evaluator.evaluateExpression(this.generator), evaluator.evaluateExpression(this.type), this.workspaceRoot, this.cmakeSettingsJsonPath, evaluator.evaluateExpression(this.cmakeToolchain), evaledVars, this.inheritEnvironments); - return conf; + return args; } - getGeneratorBuildArgs() { - let generatorBuildArgs = ""; - if (this.generator.includes("Visual Studio")) { - generatorBuildArgs = `--config ${this.type}`; - } - else if (this.generator.includes("Ninja Multi-Config")) { - generatorBuildArgs = `--config ${this.type}`; - } - return generatorBuildArgs; + ; +} +exports.ActionToolRunner = ActionToolRunner; +class ActionLib { + getInput(name, isRequired) { + const value = core.getInput(name, { required: isRequired }); + this.debug(`getInput(${name}, ${isRequired}) -> '${value}'`); + return value; } - getGeneratorArgs() { - let gen = this.generator; - let arch; - if (gen.includes("Visual Studio")) { - // for VS generators, add the -A value - let architectureParam = undefined; - const architectures = [ - CMakeGenerators.X64, - CMakeGenerators.WIN32, - CMakeGenerators.WIN64, - CMakeGenerators.ARM64, - CMakeGenerators.ARM - ]; - // Remove the platform - for (const architecture of architectures) { - if (gen.includes(architecture[0])) { - gen = gen.replace(architecture[0], ""); - architectureParam = architecture[1]; - } - } - gen = `-G${gen.trim()}`; - if (architectureParam) { - arch = `-A${architectureParam.trim()}`; - } - } - else { - // All non-VS generators are passed as is. - gen = `-G${gen.trim()}`; + getBoolInput(name, isRequired) { + var _a; + const value = ((_a = core.getInput(name, { required: isRequired })) !== null && _a !== void 0 ? _a : "").toUpperCase() === "TRUE"; + this.debug(`getBoolInput(${name}, ${isRequired}) -> '${value}'`); + return value; + } + getPathInput(name, isRequired, checkExists) { + const value = path.resolve(core.getInput(name, { required: isRequired })); + this.debug(`getPathInput(${name}) -> '${value}'`); + if (checkExists) { + if (!fs.existsSync(value)) + throw new Error(`input path '${value}' for '${name}' does not exist.`); } - return [gen, arch]; + return value; } - toString() { - return `{conf: ${this.name}:${this.type}}`; + isFilePathSupplied(name) { + var _a, _b; + // normalize paths + const pathValue = this.resolve((_a = this.getPathInput(name, false, false)) !== null && _a !== void 0 ? _a : ''); + const repoRoot = this.resolve((_b = process.env.GITHUB_WORKSPACE) !== null && _b !== void 0 ? _b : ''); + const isSupplied = pathValue !== repoRoot; + this.debug(`isFilePathSupplied(s file path=('${name}') -> '${isSupplied}'`); + return isSupplied; } -} -exports.Configuration = Configuration; -// Internal placeholder name for environment without a name -Configuration.unnamedEnvironmentName = 'unnamed'; -class PropertyEvaluator { - constructor(config, globalEnvs, tl) { - this.config = config; - this.globalEnvs = globalEnvs; - this.tl = tl; - // Matches the variable name in "${variable.name}". - this.varExp = new RegExp("\\$\{([^\{\}]+)\}", "g"); - this.localEnv = new Environment("", []); - this.createLocalVars(); + getDelimitedInput(name, delim, required) { + const input = core.getInput(name, { required: required }); + const inputs = input.split(delim); + this.debug(`getDelimitedInput(${name}, ${delim}, ${required}) -> '${inputs}'`); + return inputs; } - addToLocalEnv(name, value) { - this.localEnv.addVariable(new Variable(name, value)); + // Set an environment variable, re-usable in subsequent actions. + setVariable(name, value) { + core.exportVariable(name, value); } - createLocalVars() { - const settingsPath = this.config.cmakeSettingsJsonPath; - this.addToLocalEnv('name', this.config.name); - this.addToLocalEnv('generator', this.config.generator); - this.addToLocalEnv('workspaceRoot', this.config.workspaceRoot); - this.addToLocalEnv('thisFile', settingsPath); - this.addToLocalEnv('projectFile', path.join(path.dirname(settingsPath), 'CMakeLists.txt')); - this.addToLocalEnv('projectDir', path.dirname(settingsPath)); - this.addToLocalEnv('projectDirName', path.basename(path.dirname(settingsPath))); - this.addToLocalEnv('workspaceHash', crypto.createHash('md5') - .update(this.config.cmakeSettingsJsonPath) - .digest('hex')); + // Set the output of the action. + setOutput(name, value) { + core.setOutput(name, value); } - searchVariable(variable, env) { + getVariable(name) { var _a; - if (env != null) { - for (const v of env.variables) { - if (v.name === variable) { - return (_a = v.value) !== null && _a !== void 0 ? _a : ""; - } - } - } - return null; + //?? Is it really fine to return an empty string in case of undefined variable? + return (_a = process.env[name]) !== null && _a !== void 0 ? _a : ""; } - evaluateVariable(variable) { - this.tl.debug(`Searching ${variable.name} in environment ${this.localEnv} ...`); - let res = this.searchVariable(variable.name, this.localEnv); - if (res !== null) { - return res; - } - for (const localName of this.config.inheritEnvironments) { - const env = this.config.environments[localName]; - res = this.searchVariable(variable.name, env); - if (res !== null) { - return res; - } - } - let env = this.config.environments[Configuration.unnamedEnvironmentName]; - res = this.searchVariable(variable.name, env); - if (res !== null) { - return res; - } - for (const localName of this.config.inheritEnvironments) { - const env = this.globalEnvs[localName]; - res = this.searchVariable(variable.name, env); - if (res !== null) - return res; - } - env = this.globalEnvs[Configuration.unnamedEnvironmentName]; - res = this.searchVariable(variable.name, env); - if (res !== null) - return res; - // Try to match an environment variable. - if (variable.name.startsWith("env.")) { - const envVarName = variable.name.substring(4); - const value = process.env[envVarName]; - if (value) { - return value; - } - } - return null; + debug(message) { + core.debug(message); } - extractVariables(str) { - const variables = []; - while (true) { - const match = this.varExp.exec(str); - if (match === null) - break; - if (match.length > 1) { - const varname = match[1]; - const variable = new Variable(varname, ''); - variables.push(variable); - } - } - return variables; + error(message) { + core.error(message); + } + warning(message) { + core.warning(message); + } + info(message) { + core.info(message); + } + tool(name) { + return new ActionToolRunner(name); + } + exec(path, args, options) { + return __awaiter(this, void 0, void 0, function* () { + return yield exec(path, args, options); + }); + } + execSync(path, args, options) { + return __awaiter(this, void 0, void 0, function* () { + const exitCode = yield exec(path, args, options); + const result = { + code: exitCode, + stdout: "", + stderr: "" + }; + return Promise.resolve(result); + }); + } + which(name, required) { + return __awaiter(this, void 0, void 0, function* () { + core.debug(`"which(${name})<<`); + const filePath = yield io.which(name, required); + console.log(`tool: ${filePath}`); + core.debug(`"which(${name}) >> ${filePath}`); + return filePath; + }); + } + rmRF(path) { + return __awaiter(this, void 0, void 0, function* () { + yield io.rmRF(path); + }); + } + mkdirP(path) { + return __awaiter(this, void 0, void 0, function* () { + yield io.mkdirP(path); + }); + } + cd(path) { + process.chdir(path); } - evaluateExpression(expr) { - this.tl.debug(`evaluating expression: '${expr}' ...`); - let res = expr; - while (true) { - const variables = this.extractVariables(res); - if (variables !== null) { - let resolved; - resolved = false; - for (const variable of variables) { - const resv = this.evaluateVariable(variable); - if (resv !== null) { - res = res.replace('${' + variable.name + '}', resv); - this.tl.debug(`evaluated \$\{${variable.name}\} to '${resv}'`); - resolved = true; - } - else { - this.tl.debug(`Warning: could not evaluate '${variable.toString()}'`); - } - } - if (resolved === false) { - break; - } - } - } - this.tl.debug(`evalutated to: '${String(res)}'.`); - return res !== null && res !== void 0 ? res : ''; + writeFile(path, content) { + fs.writeFileSync(path, content); } -} -exports.PropertyEvaluator = PropertyEvaluator; -function parseEnvironments(envsJson) { - const environments = {}; - for (const env of envsJson) { - let namespace = 'env'; - let name = Configuration.unnamedEnvironmentName; - const variables = []; - for (const envi in env) { - if (envi === 'environment') { - name = env[envi]; - } - else if (envi === 'namespace') { - namespace = env[envi]; - } - else { - let variableName = envi; - const variableValue = env[envi]; - if (!variableName.includes('.')) { - if (namespace && namespace.length > 0) { - variableName = namespace + '.' + variableName; - } - } - variables.push(new Variable(variableName, variableValue)); - } - } - if (name in environments) { - // Append entries to existing environments' variables. - for (const variable of variables) { - environments[name].addVariable(variable); - } + resolve(apath) { + core.debug(`"resolve(${apath})<<`); + const resolvedPath = path.resolve(apath); + core.debug(`"resolve(${apath})>> '${resolvedPath})'`); + return resolvedPath; + } + stats(path) { + return fs.statSync(path); + } + exist(path) { + return ioutil.exists(path); + } + getBinDir() { + if (!process.env.GITHUB_WORKSPACE) { + throw new Error("GITHUB_WORKSPACE is not set."); } - else { - // Create a new environment. - const env = new Environment(name, variables); - environments[name] = env; + const binPath = utils.BaseUtilLib.normalizePath(path.join(process.env.GITHUB_WORKSPACE, "../b/")); + if (!fs.existsSync(binPath)) { + core.debug(`BinDir '${binPath}' does not exists, creating it...`); + fs.mkdirSync(binPath); } + return binPath; } - return environments; -} -exports.parseEnvironments = parseEnvironments; -function parseConfigurations(configurationsJson, cmakeSettingsJson, sourceDir) { - // Parse all configurations. - const configurations = []; - for (const configuration of configurationsJson) { - // Parse variables. - const vars = []; - if (configuration.variables) { - for (const variable of configuration.variables) { - const data = new CMakeVariable(variable.name, variable.value, variable.type); - vars.push(data); - } - ; + getSrcDir() { + if (!process.env.GITHUB_WORKSPACE) { + throw new Error("GITHUB_WORKSPACE env var is not set."); } - // Parse inherited environments. - const inheritedEnvs = []; - if (configuration.inheritEnvironments) { - for (const env of configuration.inheritEnvironments) { - inheritedEnvs.push(env); - } + const srcPath = utils.BaseUtilLib.normalizePath(process.env.GITHUB_WORKSPACE); + if (!fs.existsSync(srcPath)) { + throw new Error(`SourceDir '${srcPath}' does not exists.`); } - // Parse local environments. - let localEnvs = {}; - if (configuration.environments) { - localEnvs = parseEnvironments(configuration.environments); + return srcPath; + } + getArtifactsDir() { + if (!process.env.GITHUB_WORKSPACE) { + throw new Error("GITHUB_WORKSPACE is not set."); } - const newConfiguration = new Configuration(configuration.name, localEnvs, configuration.remoteMachineName ? configuration.remoteBuildRoot : configuration.buildRoot, configuration.cmakeCommandArgs, configuration.buildCommandArgs, configuration.generator, configuration.configurationType, - // Set the workspace with the provided source directory. - sourceDir, - // Set the Configuration.cmakeSettingsJsonPath field value with the one passed in. - cmakeSettingsJson, configuration.cmakeToolchain, vars, inheritedEnvs); - configurations.push(newConfiguration); - } //for - return configurations; -} -exports.parseConfigurations = parseConfigurations; -class CMakeSettingsJsonRunner { - constructor(baseLib, cmakeSettingsJson, configurationFilter, appendedCMakeArgs, workspaceRoot, vcpkgTriplet, useVcpkgToolchain, doBuild, ninjaPath, ninjaDownloadUrl, sourceScript, buildDir) { - this.baseLib = baseLib; - this.cmakeSettingsJson = cmakeSettingsJson; - this.configurationFilter = configurationFilter; - this.appendedCMakeArgs = appendedCMakeArgs; - this.workspaceRoot = workspaceRoot; - this.vcpkgTriplet = vcpkgTriplet; - this.useVcpkgToolchain = useVcpkgToolchain; - this.doBuild = doBuild; - this.ninjaPath = ninjaPath; - this.ninjaDownloadUrl = ninjaDownloadUrl; - this.sourceScript = sourceScript; - this.buildDir = buildDir; - this.baseLib.debug(`CMakeSettingsJsonRunner()<<`); - this.configurationFilter = configurationFilter; - this.baseUtils = new baseutillib.BaseUtilLib(this.baseLib); - this.cmakeUtils = new cmakeutil.CMakeUtils(this.baseUtils); - this.ninjaLib = new ninjalib.NinjaProvider(this.baseLib); - this.baseLib.debug(`buildDir=${buildDir}`); - this.buildDir = baseutillib.BaseUtilLib.normalizePath(buildDir); - this.baseLib.debug(`normalized buildDir=${this.buildDir}`); - if (!this.baseLib.exist(cmakeSettingsJson)) { - throw new Error(`File '${cmakeSettingsJson}' does not exist.`); + //?? HACK. How to get the value of '{{ runner.temp }}' in JS's action? + const artifactsPath = utils.BaseUtilLib.normalizePath(path.join(process.env.GITHUB_WORKSPACE, "../../_temp")); + if (!fs.existsSync(artifactsPath)) { + core.debug(`ArtifactsDir '${artifactsPath}' does not exists, creating it...`); + fs.mkdirSync(artifactsPath); } - this.baseLib.debug(`CMakeSettingsJsonRunner()>>`); + return artifactsPath; } - parseConfigurations(json) { - let configurations = []; - if (json.configurations) { - configurations = parseConfigurations(json.configurations, this.cmakeSettingsJson, this.baseLib.getSrcDir()); - } - this.baseLib.debug(`CMakeSettings.json parsed configurations: '${String(configurations)}'.`); - return configurations; + beginOperation(message) { + core.startGroup(message); } - static parseEnvironments(envsJson) { - return parseEnvironments(envsJson); + endOperation() { + core.endGroup(); } - parseGlobalEnvironments(json) { - // Parse global environments - let globalEnvs = {}; - if (json.environments != null) { - globalEnvs = CMakeSettingsJsonRunner.parseEnvironments(json.environments); - } - this.baseLib.debug("CMakeSettings.json parsed global environments."); - for (const envName in globalEnvs) { - this.baseLib.debug(`'${envName}'=${String(globalEnvs[envName])}`); + addMatcher(file) { + console.log(`::add-matcher::${file}`); + } + removeMatcher(file) { + console.log(`::remove-matcher::${file}`); + } +} +exports.ActionLib = ActionLib; +//# sourceMappingURL=action-lib.js.map + +/***/ }), + +/***/ 413: +/***/ (function(module) { + +module.exports = require("stream"); + +/***/ }), + +/***/ 417: +/***/ (function(module) { + +module.exports = require("crypto"); + +/***/ }), + +/***/ 418: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(622); +const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([*?|(){}[\]]|^!|[@+!](?=\())/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); +} +exports.makeAbsolute = makeAbsolute; +function escape(pattern) { + return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escape = escape; + + +/***/ }), + +/***/ 431: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const os = __importStar(__webpack_require__(87)); +const utils_1 = __webpack_require__(82); +/** + * Commands + * + * Command Format: + * ::name key=value,key=value::message + * + * Examples: + * ::warning::This is the message + * ::set-env name=MY_VAR::some value + */ +function issueCommand(command, properties, message) { + const cmd = new Command(command, properties, message); + process.stdout.write(cmd.toString() + os.EOL); +} +exports.issueCommand = issueCommand; +function issue(name, message = '') { + issueCommand(name, {}, message); +} +exports.issue = issue; +const CMD_STRING = '::'; +class Command { + constructor(command, properties, message) { + if (!command) { + command = 'missing.command'; } - return globalEnvs; + this.command = command; + this.properties = properties; + this.message = message; } - run() { - return __awaiter(this, void 0, void 0, function* () { - const [success, content] = this.baseUtils.readFile(this.cmakeSettingsJson); - if (!success) { - throw new Error(`Cannot read file: '${this.cmakeSettingsJson}'.`); - } - // Remove any potential BOM at the beginning. - const contentTrimmed = content.toString().trimLeft(); - this.baseLib.debug(`Content of file CMakeSettings.json: '${contentTrimmed}'.`); - // Strip any comment out of the JSON content. - const cmakeSettingsJson = JSON.parse(strip_json_comments_1.default(contentTrimmed)); - const configurations = this.parseConfigurations(cmakeSettingsJson); - const globalEnvs = this.parseGlobalEnvironments(cmakeSettingsJson); - const regex = new RegExp(this.configurationFilter); - const filteredConfigurations = configurations.filter(configuration => { - return regex.test(configuration.name); - }); - this.baseLib.debug(`CMakeSettings.json filtered configurations: '${String(filteredConfigurations)}'."`); - if (filteredConfigurations.length === 0) { - throw new Error(`No matching configuration for filter: '${this.configurationFilter}'.`); - } - // Store and restore the PATH env var for each configuration, to prevent side effects among configurations. - const originalPath = process.env.PATH; - for (const configuration of filteredConfigurations) { - const msg = `Process configuration: '${configuration.name}'.`; - try { - this.baseLib.beginOperation(msg); - console.log(msg); - let cmakeArgs = []; - // Search for CMake tool and run it - let cmake; - if (this.sourceScript) { - cmake = this.baseLib.tool(this.sourceScript); - cmakeArgs.push(yield this.baseLib.which('cmake', true)); - } - else { - cmake = this.baseLib.tool(yield this.baseLib.which('cmake', true)); - } - // Evaluate all variables in the configuration. - const evaluator = new PropertyEvaluator(configuration, globalEnvs, this.baseLib); - const evaledConf = configuration.evaluate(evaluator); - // Set all variable in the configuration in the process environment. - evaledConf.setEnvironment(globalEnvs); - // The build directory value specified in CMakeSettings.json is ignored. - // This is because: - // 1. you want to build targeting an empty binary directory; - // 2. the default location in CMakeSettings.json is under the source tree, whose content is not deleted upon each build run. - // Instead if users did not provided a specific path, let's force it to - // "$(Build.ArtifactStagingDirectory)/{name}" which should be empty. - console.log(`Note: run-cmake always ignores the 'buildRoot' value specified in the CMakeSettings.json (buildRoot=${configuration.buildDir}). User can override the default value by setting the '${globals.buildDirectory}' input.`); - const artifactsDir = yield this.baseLib.getArtifactsDir(); - if (baseutillib.BaseUtilLib.normalizePath(this.buildDir) === baseutillib.BaseUtilLib.normalizePath(artifactsDir)) { - // The build directory goes into the artifact directory in a subdir - // named with the configuration name. - evaledConf.buildDir = path.join(artifactsDir, configuration.name); - } - else { - // Append the configuration name to the user provided build directory. This is mandatory to have each - // build in a different directory. - evaledConf.buildDir = path.join(this.buildDir, configuration.name); - } - console.log(`Overriding build directory to: '${evaledConf.buildDir}'`); - cmakeArgs = cmakeArgs.concat(evaledConf.getGeneratorArgs().filter(this.notEmpty)); - if (this.baseUtils.isNinjaGenerator(cmakeArgs)) { - const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); - cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); - } - if (!this.isMultiConfigGenerator(evaledConf.generator)) { - cmakeArgs.push(`-DCMAKE_BUILD_TYPE=${evaledConf.type}`); - } - for (const variable of evaledConf.variables) { - cmakeArgs.push(variable.toString()); - } - if (evaledConf.cmakeToolchain) { - cmakeArgs.push(`-DCMAKE_TOOLCHAIN_FILE=${evaledConf.cmakeToolchain}`); - } - // Use vcpkg toolchain if requested. - if (this.useVcpkgToolchain === true) { - cmakeArgs = yield this.cmakeUtils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet, this.baseLib); - } - // Add the current args in the tool, add - // custom args, and reset the args. - for (const arg of cmakeArgs) { - cmake.arg(arg); - } - cmakeArgs = []; - // Add CMake args from CMakeSettings.json file. - cmake.line(evaledConf.cmakeArgs); - // Set the source directory. - cmake.arg(path.dirname(this.cmakeSettingsJson)); - // Run CNake with the given arguments. - if (!evaledConf.buildDir) { - throw new Error("Build directory is not specified."); - } - // Append user provided CMake arguments. - cmake.line(this.appendedCMakeArgs); - yield this.baseLib.mkdirP(evaledConf.buildDir); - const options = { - cwd: evaledConf.buildDir, - failOnStdErr: false, - errStream: process.stdout, - outStream: process.stdout, - ignoreReturnCode: true, - silent: false, - windowsVerbatimArguments: false, - env: process.env - }; - this.baseLib.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); - let code = -1; - yield using_statement_1.using(baseutillib.Matcher.createMatcher('cmake', this.baseLib, this.cmakeSettingsJson), (matcher) => __awaiter(this, void 0, void 0, function* () { - code = yield this.baseUtils.wrapOp("Generate project files with CMake", () => cmake.exec(options)); - })); - if (code !== 0) { - throw new Error(`"CMake failed with error code: '${code}'."`); - } - if (this.doBuild) { - yield using_statement_1.using(baseutillib.Matcher.createMatcher(cmakerunner.CMakeRunner.getBuildMatcher(this.buildDir, this.baseLib), this.baseLib), (matcher) => __awaiter(this, void 0, void 0, function* () { - yield this.baseUtils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { - return yield cmakerunner.CMakeRunner.build(this.baseLib, evaledConf.buildDir, - // CMakeSettings.json contains in buildCommandArgs the arguments to the make program - //only. They need to be put after '--', otherwise would be passed to directly to cmake. - ` ${evaledConf.getGeneratorBuildArgs()} -- ${evaledConf.makeArgs}`, options); - })); - })); + toString() { + let cmdStr = CMD_STRING + this.command; + if (this.properties && Object.keys(this.properties).length > 0) { + cmdStr += ' '; + let first = true; + for (const key in this.properties) { + if (this.properties.hasOwnProperty(key)) { + const val = this.properties[key]; + if (val) { + if (first) { + first = false; + } + else { + cmdStr += ','; + } + cmdStr += `${key}=${escapeProperty(val)}`; } - // Restore the original PATH environment variable. - process.env.PATH = originalPath; - } - finally { - this.baseLib.endOperation(); } } - }); + } + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; + return cmdStr; } - notEmpty(value) { - return value !== null && value !== undefined; +} +function escapeData(s) { + return utils_1.toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A'); +} +function escapeProperty(s) { + return utils_1.toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A') + .replace(/:/g, '%3A') + .replace(/,/g, '%2C'); +} +//# sourceMappingURL=command.js.map + +/***/ }), + +/***/ 435: +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +const fill = __webpack_require__(730); +const utils = __webpack_require__(225); + +const compile = (ast, options = {}) => { + let walk = (node, parent = {}) => { + let invalidBlock = utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let invalid = invalidBlock === true || invalidNode === true; + let prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; } - isMultiConfigGenerator(generatorName) { - return generatorName.includes("Visual Studio") || - generatorName.includes("Ninja Multi-Config"); + if (node.isClose === true) { + return prefix + node.value; } -} -exports.CMakeSettingsJsonRunner = CMakeSettingsJsonRunner; -//# sourceMappingURL=cmakesettings-runner.js.map + + if (node.type === 'open') { + return invalid ? (prefix + node.value) : '('; + } + + if (node.type === 'close') { + return invalid ? (prefix + node.value) : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + let range = fill(...args, { ...options, wrap: false, toRegex: true }); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (let child of node.nodes) { + output += walk(child, node); + } + } + return output; + }; + + return walk(ast); +}; + +module.exports = compile; + /***/ }), -/***/ 464: +/***/ 440: /***/ (function(module) { "use strict"; -module.exports = (...arguments_) => { - return [...new Set([].concat(...arguments_))]; -}; +function reusify (Constructor) { + var head = new Constructor() + var tail = head + function get () { + var current = head -/***/ }), + if (current.next) { + head = current.next + } else { + head = new Constructor() + tail = head + } -/***/ 466: -/***/ (function(module, __unusedexports, __webpack_require__) { + current.next = null -var Stream = __webpack_require__(413).Stream + return current + } -module.exports = legacy + function release (obj) { + tail.next = obj + tail = obj + } -function legacy (fs) { return { - ReadStream: ReadStream, - WriteStream: WriteStream + get: get, + release: release } +} - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); - - Stream.call(this); - - var self = this; +module.exports = reusify - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; +/***/ }), - options = options || {}; +/***/ 441: +/***/ (function(module, __unusedexports, __webpack_require__) { - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +"use strict"; - if (this.encoding) this.setEncoding(this.encoding); - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } +const fill = __webpack_require__(730); +const stringify = __webpack_require__(382); +const utils = __webpack_require__(225); - if (this.start > this.end) { - throw new Error('start must be <= end'); - } +const append = (queue = '', stash = '', enclose = false) => { + let result = []; - this.pos = this.start; - } + queue = [].concat(queue); + stash = [].concat(stash); - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; + } - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; + for (let item of queue) { + if (Array.isArray(item)) { + for (let value of item) { + result.push(append(value, stash, enclose)); } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); + } + } } + return utils.flatten(result); +}; - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; +const expand = (ast, options = {}) => { + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; + let walk = (node, parent = {}) => { + node.queue = []; - options = options || {}; + let p = parent; + let q = parent.queue; - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; } - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } - - this.pos = this.start; + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; } - this.busy = false; - this._queue = []; - - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; } - } -} - -/***/ }), + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); -/***/ 470: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } -"use strict"; + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } -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()); - }); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const command_1 = __webpack_require__(431); -const file_command_1 = __webpack_require__(102); -const utils_1 = __webpack_require__(82); -const os = __importStar(__webpack_require__(87)); -const path = __importStar(__webpack_require__(622)); -/** - * The code to exit an action - */ -var ExitCode; -(function (ExitCode) { - /** - * A code indicating that the action was successful - */ - ExitCode[ExitCode["Success"] = 0] = "Success"; - /** - * A code indicating that the action was a failure - */ - ExitCode[ExitCode["Failure"] = 1] = "Failure"; -})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); -//----------------------------------------------------------------------- -// Variables -//----------------------------------------------------------------------- -/** - * Sets env variable for this action and future actions in the job - * @param name the name of the variable to set - * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function exportVariable(name, val) { - const convertedVal = utils_1.toCommandValue(val); - process.env[name] = convertedVal; - const filePath = process.env['GITHUB_ENV'] || ''; - if (filePath) { - const delimiter = '_GitHubActionsFileCommandDelimeter_'; - const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; - file_command_1.issueCommand('ENV', commandValue); - } - else { - command_1.issueCommand('set-env', { name }, convertedVal); - } -} -exports.exportVariable = exportVariable; -/** - * Registers a secret which will get masked from logs - * @param secret value of the secret - */ -function setSecret(secret) { - command_1.issueCommand('add-mask', {}, secret); -} -exports.setSecret = setSecret; -/** - * Prepends inputPath to the PATH (for this action and future actions) - * @param inputPath - */ -function addPath(inputPath) { - const filePath = process.env['GITHUB_PATH'] || ''; - if (filePath) { - file_command_1.issueCommand('PATH', inputPath); + q.push(append(q.pop(), range)); + node.nodes = []; + return; } - else { - command_1.issueCommand('add-path', {}, inputPath); + + let enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; } - process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; -} -exports.addPath = addPath; -/** - * Gets the value of an input. The value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string - */ -function getInput(name, options) { - const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; - if (options && options.required && !val) { - throw new Error(`Input required and not supplied: ${name}`); + + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } } - return val.trim(); -} -exports.getInput = getInput; -/** - * Sets the value of an output. - * - * @param name name of the output to set - * @param value value to store. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function setOutput(name, value) { - command_1.issueCommand('set-output', { name }, value); -} -exports.setOutput = setOutput; -/** - * Enables or disables the echoing of commands into stdout for the rest of the step. - * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. - * - */ -function setCommandEcho(enabled) { - command_1.issue('echo', enabled ? 'on' : 'off'); -} -exports.setCommandEcho = setCommandEcho; -//----------------------------------------------------------------------- -// Results -//----------------------------------------------------------------------- -/** - * Sets the action status to failed. - * When the action exits it will be with an exit code of 1 - * @param message add error issue message - */ -function setFailed(message) { - process.exitCode = ExitCode.Failure; - error(message); -} -exports.setFailed = setFailed; -//----------------------------------------------------------------------- -// Logging Commands -//----------------------------------------------------------------------- -/** - * Gets whether Actions Step Debug is on or not - */ -function isDebug() { - return process.env['RUNNER_DEBUG'] === '1'; -} -exports.isDebug = isDebug; -/** - * Writes debug message to user log - * @param message debug message - */ -function debug(message) { - command_1.issueCommand('debug', {}, message); -} -exports.debug = debug; -/** - * Adds an error issue - * @param message error issue message. Errors will be converted to string via toString() - */ -function error(message) { - command_1.issue('error', message instanceof Error ? message.toString() : message); -} -exports.error = error; -/** - * Adds an warning issue - * @param message warning issue message. Errors will be converted to string via toString() - */ -function warning(message) { - command_1.issue('warning', message instanceof Error ? message.toString() : message); -} -exports.warning = warning; -/** - * Writes info to log with console.log. - * @param message info message - */ -function info(message) { - process.stdout.write(message + os.EOL); -} -exports.info = info; -/** - * Begin an output group. - * - * Output until the next `groupEnd` will be foldable in this group - * - * @param name The name of the output group - */ -function startGroup(name) { - command_1.issue('group', name); -} -exports.startGroup = startGroup; -/** - * End an output group. - */ -function endGroup() { - command_1.issue('endgroup'); -} -exports.endGroup = endGroup; -/** - * Wrap an asynchronous function call in a group. - * - * Returns the same type as the function itself. - * - * @param name The name of the group - * @param fn The function to wrap in the group - */ -function group(name, fn) { - return __awaiter(this, void 0, void 0, function* () { - startGroup(name); - let result; - try { - result = yield fn(); - } - finally { - endGroup(); - } - return result; - }); -} -exports.group = group; -//----------------------------------------------------------------------- -// Wrapper action state -//----------------------------------------------------------------------- -/** - * Saves state for current action, the state can only be retrieved by this action's post job execution. - * - * @param name name of the state to store - * @param value value to store. Non-string values will be converted to a string via JSON.stringify - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function saveState(name, value) { - command_1.issueCommand('save-state', { name }, value); -} -exports.saveState = saveState; -/** - * Gets the value of an state set by this action's main execution. - * - * @param name name of the state to get - * @returns string - */ -function getState(name) { - return process.env[`STATE_${name}`] || ''; -} -exports.getState = getState; -//# sourceMappingURL=core.js.map + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +module.exports = expand; + /***/ }), -/***/ 474: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 443: +/***/ (function(__unusedmodule, exports, __webpack_require__) { -module.exports = function (/*Buffer*/inbuf) { +"use strict"; - var zlib = __webpack_require__(761); - - var opts = {chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024}; - - return { - deflate: function () { - return zlib.deflateRawSync(inbuf, opts); - }, +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(666)); + + +/***/ }), + +/***/ 444: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; - deflateAsync: function (/*Function*/callback) { - var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0; - tmp.on('data', function (data) { - parts.push(data); - total += data.length; - }); - tmp.on('end', function () { - var buf = Buffer.alloc(total), written = 0; - buf.fill(0); - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - part.copy(buf, written); - written += part.length; - } - callback && callback(buf); - }); - tmp.end(inbuf); - } - } -}; +Object.defineProperty(exports, "__esModule", { value: true }); +const array = __webpack_require__(453); +exports.array = array; +const errno = __webpack_require__(115); +exports.errno = errno; +const fs = __webpack_require__(43); +exports.fs = fs; +const path = __webpack_require__(418); +exports.path = path; +const pattern = __webpack_require__(724); +exports.pattern = pattern; +const stream = __webpack_require__(42); +exports.stream = stream; + + +/***/ }), + +/***/ 453: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); +} +exports.flatten = flatten; /***/ }), -/***/ 478: +/***/ 454: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; +// Copyright (c) 2019-2020-2021 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; 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) { @@ -10580,596 +10177,999 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const os = __importStar(__webpack_require__(87)); -const events = __importStar(__webpack_require__(614)); -const child = __importStar(__webpack_require__(129)); +exports.CMakeSettingsJsonRunner = exports.parseConfigurations = exports.parseEnvironments = exports.PropertyEvaluator = exports.Configuration = exports.Environment = void 0; +const baseutillib = __importStar(__webpack_require__(758)); +const crypto = __importStar(__webpack_require__(417)); const path = __importStar(__webpack_require__(622)); -const io = __importStar(__webpack_require__(1)); -const ioUtil = __importStar(__webpack_require__(672)); -/* eslint-disable @typescript-eslint/unbound-method */ -const IS_WINDOWS = process.platform === 'win32'; -/* - * Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way. - */ -class ToolRunner extends events.EventEmitter { - constructor(toolPath, args, options) { - super(); - if (!toolPath) { - throw new Error("Parameter 'toolPath' cannot be null or empty."); +__webpack_require__(966); +const ninjalib = __importStar(__webpack_require__(72)); +const globals = __importStar(__webpack_require__(330)); +const cmakerunner = __importStar(__webpack_require__(214)); +const cmakeutil = __importStar(__webpack_require__(233)); +const using_statement_1 = __webpack_require__(443); +const strip_json_comments_1 = __importDefault(__webpack_require__(966)); +class CMakeGenerators { +} +CMakeGenerators.ARM64 = ["ARM64", "ARM64"]; +CMakeGenerators.ARM = ["ARM", "ARM"]; +CMakeGenerators.X64 = ["x64", "x64"]; +CMakeGenerators.WIN64 = ["Win64", "x64"]; +CMakeGenerators.WIN32 = ["Win32", "Win32"]; +class CMakeVariable { + constructor(name, value, type) { + this.name = name; + this.value = value; + this.type = type; + if (!type) { + this.type = 'string'; + } + console.log(`Defining CMake variable: [name:'${name}', value='${value}', type='${type}'].`); + } + toString() { + return `-D${this.name}:${this.type}=${this.value}`; + } +} +class Variable { + constructor(name, value) { + this.name = name; + this.value = value; + // Nothing to do here. + } + toString() { + return `{var: '${this.name}'='${this.value}'}`; + } + addToEnvironment() { + process.env[this.stripNamespace(this.name)] = this.value; + } + stripNamespace(varName) { + return varName.substring(varName.indexOf('.') + 1); + } +} +class Environment { + constructor(name, theVariables) { + this.name = name; + this.theVariables = theVariables; + // Nothing to do. + } + addVariable(variable) { + this.theVariables.push(variable); + } + get variables() { + return this.theVariables; + } + toString() { + let varsString = ""; + for (const variable of this.theVariables) { + varsString += String(variable) + ", "; + } + return `{env: '${this.name}', variables=${varsString}}`; + } +} +exports.Environment = Environment; +class Configuration { + constructor(name, environments, buildDir, cmakeArgs, makeArgs, generator, type, workspaceRoot, cmakeSettingsJsonPath, cmakeToolchain, variables, inheritEnvironments) { + this.name = name; + this.environments = environments; + this.buildDir = buildDir; + this.cmakeArgs = cmakeArgs; + this.makeArgs = makeArgs; + this.generator = generator; + this.type = type; + this.workspaceRoot = workspaceRoot; + this.cmakeSettingsJsonPath = cmakeSettingsJsonPath; + this.cmakeToolchain = cmakeToolchain; + this.variables = variables; + this.inheritEnvironments = inheritEnvironments; + baseutillib.BaseUtilLib.throwIfUndefined(name, "name"); + baseutillib.BaseUtilLib.throwIfUndefined(buildDir, "buildDir"); + baseutillib.BaseUtilLib.throwIfUndefined(cmakeSettingsJsonPath, "cmakeSettingsJsonPath"); + this.buildDir = path.normalize(buildDir); + } + /** + * Add to current process the environment variables defined in this configuration. + * + * @param {EnvironmentMap} globalEnvs The global environments (not defined in this configuration) + * @memberof Configuration + */ + setEnvironment(globalEnvs) { + // Set all 'env' and unnamed environments and inherited environments. + for (const envName in globalEnvs) { + const environment = globalEnvs[envName]; + const nameLowerCased = environment.name.toLowerCase(); + // Unnamed environments (i.e. with no 'environment' property specified), + // empty string named (e.g. {"environment": "", ...} ), or ones called 'env' + // are being set in the environment automatically. All others needs to be + // explicitly inherited. + if (!nameLowerCased || "env" === nameLowerCased || + Configuration.unnamedEnvironmentName === nameLowerCased) { + for (const variable of environment.variables) { + variable.addToEnvironment(); + } + } + } + // Set all inherited environments. + for (const envName of this.inheritEnvironments) { + const environment = globalEnvs[envName]; + if (environment) { + for (const variable of environment.variables) { + variable.addToEnvironment(); + } + } + } + // Set all 'env' and unnamed environments. + for (const env in this.environments) { + for (const variable of this.environments[env].variables) { + variable.addToEnvironment(); + } + } + } + evaluate(evaluator) { + const evaledVars = []; + for (const variable of this.variables) { + evaledVars.push(new CMakeVariable(variable.name, evaluator.evaluateExpression(variable.value), variable.type)); + } + const conf = new Configuration(this.name, this.environments, evaluator.evaluateExpression(this.buildDir), evaluator.evaluateExpression(this.cmakeArgs), evaluator.evaluateExpression(this.makeArgs), evaluator.evaluateExpression(this.generator), evaluator.evaluateExpression(this.type), this.workspaceRoot, this.cmakeSettingsJsonPath, evaluator.evaluateExpression(this.cmakeToolchain), evaledVars, this.inheritEnvironments); + return conf; + } + getGeneratorBuildArgs() { + let generatorBuildArgs = ""; + if (this.generator.includes("Visual Studio")) { + generatorBuildArgs = `--config ${this.type}`; + } + else if (this.generator.includes("Ninja Multi-Config")) { + generatorBuildArgs = `--config ${this.type}`; + } + return generatorBuildArgs; + } + getGeneratorArgs() { + let gen = this.generator; + let arch; + if (gen.includes("Visual Studio")) { + // for VS generators, add the -A value + let architectureParam = undefined; + const architectures = [ + CMakeGenerators.X64, + CMakeGenerators.WIN32, + CMakeGenerators.WIN64, + CMakeGenerators.ARM64, + CMakeGenerators.ARM + ]; + // Remove the platform + for (const architecture of architectures) { + if (gen.includes(architecture[0])) { + gen = gen.replace(architecture[0], ""); + architectureParam = architecture[1]; + } + } + gen = `-G${gen.trim()}`; + if (architectureParam) { + arch = `-A${architectureParam.trim()}`; + } + } + else { + // All non-VS generators are passed as is. + gen = `-G${gen.trim()}`; + } + return [gen, arch]; + } + toString() { + return `{conf: ${this.name}:${this.type}}`; + } +} +exports.Configuration = Configuration; +// Internal placeholder name for environment without a name +Configuration.unnamedEnvironmentName = 'unnamed'; +class PropertyEvaluator { + constructor(config, globalEnvs, tl) { + this.config = config; + this.globalEnvs = globalEnvs; + this.tl = tl; + // Matches the variable name in "${variable.name}". + this.varExp = new RegExp("\\$\{([^\{\}]+)\}", "g"); + this.localEnv = new Environment("", []); + this.createLocalVars(); + } + addToLocalEnv(name, value) { + this.localEnv.addVariable(new Variable(name, value)); + } + createLocalVars() { + const settingsPath = this.config.cmakeSettingsJsonPath; + this.addToLocalEnv('name', this.config.name); + this.addToLocalEnv('generator', this.config.generator); + this.addToLocalEnv('workspaceRoot', this.config.workspaceRoot); + this.addToLocalEnv('thisFile', settingsPath); + this.addToLocalEnv('projectFile', path.join(path.dirname(settingsPath), 'CMakeLists.txt')); + this.addToLocalEnv('projectDir', path.dirname(settingsPath)); + this.addToLocalEnv('projectDirName', path.basename(path.dirname(settingsPath))); + this.addToLocalEnv('workspaceHash', crypto.createHash('md5') + .update(this.config.cmakeSettingsJsonPath) + .digest('hex')); + } + searchVariable(variable, env) { + var _a; + if (env != null) { + for (const v of env.variables) { + if (v.name === variable) { + return (_a = v.value) !== null && _a !== void 0 ? _a : ""; + } + } } - this.toolPath = toolPath; - this.args = args || []; - this.options = options || {}; + return null; } - _debug(message) { - if (this.options.listeners && this.options.listeners.debug) { - this.options.listeners.debug(message); + evaluateVariable(variable) { + this.tl.debug(`Searching ${variable.name} in environment ${this.localEnv} ...`); + let res = this.searchVariable(variable.name, this.localEnv); + if (res !== null) { + return res; + } + for (const localName of this.config.inheritEnvironments) { + const env = this.config.environments[localName]; + res = this.searchVariable(variable.name, env); + if (res !== null) { + return res; + } + } + let env = this.config.environments[Configuration.unnamedEnvironmentName]; + res = this.searchVariable(variable.name, env); + if (res !== null) { + return res; + } + for (const localName of this.config.inheritEnvironments) { + const env = this.globalEnvs[localName]; + res = this.searchVariable(variable.name, env); + if (res !== null) + return res; + } + env = this.globalEnvs[Configuration.unnamedEnvironmentName]; + res = this.searchVariable(variable.name, env); + if (res !== null) + return res; + // Try to match an environment variable. + if (variable.name.startsWith("env.")) { + const envVarName = variable.name.substring(4); + const value = process.env[envVarName]; + if (value) { + return value; + } } + return null; } - _getCommandString(options, noPrefix) { - const toolPath = this._getSpawnFileName(); - const args = this._getSpawnArgs(options); - let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool - if (IS_WINDOWS) { - // Windows + cmd file - if (this._isCmdFile()) { - cmd += toolPath; - for (const a of args) { - cmd += ` ${a}`; - } + extractVariables(str) { + const variables = []; + while (true) { + const match = this.varExp.exec(str); + if (match === null) + break; + if (match.length > 1) { + const varname = match[1]; + const variable = new Variable(varname, ''); + variables.push(variable); } - // Windows + verbatim - else if (options.windowsVerbatimArguments) { - cmd += `"${toolPath}"`; - for (const a of args) { - cmd += ` ${a}`; + } + return variables; + } + evaluateExpression(expr) { + this.tl.debug(`evaluating expression: '${expr}' ...`); + let res = expr; + while (true) { + const variables = this.extractVariables(res); + if (variables !== null) { + let resolved; + resolved = false; + for (const variable of variables) { + const resv = this.evaluateVariable(variable); + if (resv !== null) { + res = res.replace('${' + variable.name + '}', resv); + this.tl.debug(`evaluated \$\{${variable.name}\} to '${resv}'`); + resolved = true; + } + else { + this.tl.debug(`Warning: could not evaluate '${variable.toString()}'`); + } } - } - // Windows (regular) - else { - cmd += this._windowsQuoteCmdArg(toolPath); - for (const a of args) { - cmd += ` ${this._windowsQuoteCmdArg(a)}`; + if (resolved === false) { + break; } } } - 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; - for (const a of args) { - cmd += ` ${a}`; + this.tl.debug(`evalutated to: '${String(res)}'.`); + return res !== null && res !== void 0 ? res : ''; + } +} +exports.PropertyEvaluator = PropertyEvaluator; +function parseEnvironments(envsJson) { + const environments = {}; + for (const env of envsJson) { + let namespace = 'env'; + let name = Configuration.unnamedEnvironmentName; + const variables = []; + for (const envi in env) { + if (envi === 'environment') { + name = env[envi]; + } + else if (envi === 'namespace') { + namespace = env[envi]; + } + else { + let variableName = envi; + const variableValue = env[envi]; + if (!variableName.includes('.')) { + if (namespace && namespace.length > 0) { + variableName = namespace + '.' + variableName; + } + } + variables.push(new Variable(variableName, variableValue)); } } - return cmd; - } - _processLineBuffer(data, strBuffer, onLine) { - try { - let s = strBuffer + data.toString(); - let n = s.indexOf(os.EOL); - while (n > -1) { - const line = s.substring(0, n); - onLine(line); - // the rest of the string ... - s = s.substring(n + os.EOL.length); - n = s.indexOf(os.EOL); + if (name in environments) { + // Append entries to existing environments' variables. + for (const variable of variables) { + environments[name].addVariable(variable); } - strBuffer = s; } - catch (err) { - // streaming lines to console is best effort. Don't fail a build. - this._debug(`error processing line. Failed with error ${err}`); + else { + // Create a new environment. + const env = new Environment(name, variables); + environments[name] = env; } } - _getSpawnFileName() { - if (IS_WINDOWS) { - if (this._isCmdFile()) { - return process.env['COMSPEC'] || 'cmd.exe'; + return environments; +} +exports.parseEnvironments = parseEnvironments; +function parseConfigurations(configurationsJson, cmakeSettingsJson, sourceDir) { + // Parse all configurations. + const configurations = []; + for (const configuration of configurationsJson) { + // Parse variables. + const vars = []; + if (configuration.variables) { + for (const variable of configuration.variables) { + const data = new CMakeVariable(variable.name, variable.value, variable.type); + vars.push(data); } + ; } - return this.toolPath; - } - _getSpawnArgs(options) { - if (IS_WINDOWS) { - if (this._isCmdFile()) { - let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; - for (const a of this.args) { - argline += ' '; - argline += options.windowsVerbatimArguments - ? a - : this._windowsQuoteCmdArg(a); - } - argline += '"'; - return [argline]; + // Parse inherited environments. + const inheritedEnvs = []; + if (configuration.inheritEnvironments) { + for (const env of configuration.inheritEnvironments) { + inheritedEnvs.push(env); } } - return this.args; + // Parse local environments. + let localEnvs = {}; + if (configuration.environments) { + localEnvs = parseEnvironments(configuration.environments); + } + const newConfiguration = new Configuration(configuration.name, localEnvs, configuration.remoteMachineName ? configuration.remoteBuildRoot : configuration.buildRoot, configuration.cmakeCommandArgs, configuration.buildCommandArgs, configuration.generator, configuration.configurationType, + // Set the workspace with the provided source directory. + sourceDir, + // Set the Configuration.cmakeSettingsJsonPath field value with the one passed in. + cmakeSettingsJson, configuration.cmakeToolchain, vars, inheritedEnvs); + configurations.push(newConfiguration); + } //for + return configurations; +} +exports.parseConfigurations = parseConfigurations; +class CMakeSettingsJsonRunner { + constructor(baseLib, cmakeSettingsJson, configurationFilter, appendedCMakeArgs, workspaceRoot, vcpkgTriplet, useVcpkgToolchain, doBuild, ninjaPath, ninjaDownloadUrl, sourceScript, buildDir) { + this.baseLib = baseLib; + this.cmakeSettingsJson = cmakeSettingsJson; + this.configurationFilter = configurationFilter; + this.appendedCMakeArgs = appendedCMakeArgs; + this.workspaceRoot = workspaceRoot; + this.vcpkgTriplet = vcpkgTriplet; + this.useVcpkgToolchain = useVcpkgToolchain; + this.doBuild = doBuild; + this.ninjaPath = ninjaPath; + this.ninjaDownloadUrl = ninjaDownloadUrl; + this.sourceScript = sourceScript; + this.buildDir = buildDir; + this.baseLib.debug(`CMakeSettingsJsonRunner()<<`); + this.configurationFilter = configurationFilter; + this.baseUtils = new baseutillib.BaseUtilLib(this.baseLib); + this.cmakeUtils = new cmakeutil.CMakeUtils(this.baseUtils); + this.ninjaLib = new ninjalib.NinjaProvider(this.baseLib); + this.baseLib.debug(`buildDir=${buildDir}`); + this.buildDir = baseutillib.BaseUtilLib.normalizePath(buildDir); + this.baseLib.debug(`normalized buildDir=${this.buildDir}`); + if (!this.baseLib.exist(cmakeSettingsJson)) { + throw new Error(`File '${cmakeSettingsJson}' does not exist.`); + } + this.baseLib.debug(`CMakeSettingsJsonRunner()>>`); } - _endsWith(str, end) { - return str.endsWith(end); + parseConfigurations(json) { + let configurations = []; + if (json.configurations) { + configurations = parseConfigurations(json.configurations, this.cmakeSettingsJson, this.baseLib.getSrcDir()); + } + this.baseLib.debug(`CMakeSettings.json parsed configurations: '${String(configurations)}'.`); + return configurations; } - _isCmdFile() { - const upperToolPath = this.toolPath.toUpperCase(); - return (this._endsWith(upperToolPath, '.CMD') || - this._endsWith(upperToolPath, '.BAT')); + static parseEnvironments(envsJson) { + return parseEnvironments(envsJson); } - _windowsQuoteCmdArg(arg) { - // for .exe, apply the normal quoting rules that libuv applies - if (!this._isCmdFile()) { - return this._uvQuoteCmdArg(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 - const cmdSpecialChars = [ - ' ', - '\t', - '&', - '(', - ')', - '[', - ']', - '{', - '}', - '^', - '=', - ';', - '!', - "'", - '+', - ',', - '`', - '~', - '|', - '<', - '>', - '"' - ]; - let needsQuotes = false; - for (const char of arg) { - if (cmdSpecialChars.some(x => x === char)) { - needsQuotes = true; - break; - } + parseGlobalEnvironments(json) { + // Parse global environments + let globalEnvs = {}; + if (json.environments != null) { + globalEnvs = CMakeSettingsJsonRunner.parseEnvironments(json.environments); } - // short-circuit if quotes not needed - if (!needsQuotes) { - return arg; + this.baseLib.debug("CMakeSettings.json parsed global environments."); + for (const envName in globalEnvs) { + this.baseLib.debug(`'${envName}'=${String(globalEnvs[envName])}`); } - // 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 precede 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. - let reverse = '"'; - let quoteHit = true; - for (let i = arg.length; i > 0; i--) { - // walk the string in reverse - reverse += arg[i - 1]; - if (quoteHit && arg[i - 1] === '\\') { - reverse += '\\'; // double the slash + return globalEnvs; + } + run() { + return __awaiter(this, void 0, void 0, function* () { + const [success, content] = this.baseUtils.readFile(this.cmakeSettingsJson); + if (!success) { + throw new Error(`Cannot read file: '${this.cmakeSettingsJson}'.`); } - else if (arg[i - 1] === '"') { - quoteHit = true; - reverse += '"'; // double the quote + // Remove any potential BOM at the beginning. + const contentTrimmed = content.toString().trimLeft(); + this.baseLib.debug(`Content of file CMakeSettings.json: '${contentTrimmed}'.`); + // Strip any comment out of the JSON content. + const cmakeSettingsJson = JSON.parse(strip_json_comments_1.default(contentTrimmed)); + const configurations = this.parseConfigurations(cmakeSettingsJson); + const globalEnvs = this.parseGlobalEnvironments(cmakeSettingsJson); + const regex = new RegExp(this.configurationFilter); + const filteredConfigurations = configurations.filter(configuration => { + return regex.test(configuration.name); + }); + this.baseLib.debug(`CMakeSettings.json filtered configurations: '${String(filteredConfigurations)}'."`); + if (filteredConfigurations.length === 0) { + throw new Error(`No matching configuration for filter: '${this.configurationFilter}'.`); } - else { - quoteHit = false; + // Store and restore the PATH env var for each configuration, to prevent side effects among configurations. + const originalPath = process.env.PATH; + for (const configuration of filteredConfigurations) { + const msg = `Process configuration: '${configuration.name}'.`; + try { + this.baseLib.beginOperation(msg); + console.log(msg); + let cmakeArgs = []; + // Search for CMake tool and run it + let cmake; + if (this.sourceScript) { + cmake = this.baseLib.tool(this.sourceScript); + cmakeArgs.push(yield this.baseLib.which('cmake', true)); + } + else { + cmake = this.baseLib.tool(yield this.baseLib.which('cmake', true)); + } + // Evaluate all variables in the configuration. + const evaluator = new PropertyEvaluator(configuration, globalEnvs, this.baseLib); + const evaledConf = configuration.evaluate(evaluator); + // Set all variable in the configuration in the process environment. + evaledConf.setEnvironment(globalEnvs); + // The build directory value specified in CMakeSettings.json is ignored. + // This is because: + // 1. you want to build targeting an empty binary directory; + // 2. the default location in CMakeSettings.json is under the source tree, whose content is not deleted upon each build run. + // Instead if users did not provided a specific path, let's force it to + // "$(Build.ArtifactStagingDirectory)/{name}" which should be empty. + console.log(`Note: run-cmake always ignores the 'buildRoot' value specified in the CMakeSettings.json (buildRoot=${configuration.buildDir}). User can override the default value by setting the '${globals.buildDirectory}' input.`); + const artifactsDir = yield this.baseLib.getArtifactsDir(); + if (baseutillib.BaseUtilLib.normalizePath(this.buildDir) === baseutillib.BaseUtilLib.normalizePath(artifactsDir)) { + // The build directory goes into the artifact directory in a subdir + // named with the configuration name. + evaledConf.buildDir = path.join(artifactsDir, configuration.name); + } + else { + // Append the configuration name to the user provided build directory. This is mandatory to have each + // build in a different directory. + evaledConf.buildDir = path.join(this.buildDir, configuration.name); + } + console.log(`Overriding build directory to: '${evaledConf.buildDir}'`); + cmakeArgs = cmakeArgs.concat(evaledConf.getGeneratorArgs().filter(this.notEmpty)); + if (this.baseUtils.isNinjaGenerator(cmakeArgs)) { + const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); + cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); + } + if (!this.isMultiConfigGenerator(evaledConf.generator)) { + cmakeArgs.push(`-DCMAKE_BUILD_TYPE=${evaledConf.type}`); + } + for (const variable of evaledConf.variables) { + cmakeArgs.push(variable.toString()); + } + if (evaledConf.cmakeToolchain) { + cmakeArgs.push(`-DCMAKE_TOOLCHAIN_FILE=${evaledConf.cmakeToolchain}`); + } + // Use vcpkg toolchain if requested. + if (this.useVcpkgToolchain === true) { + cmakeArgs = yield this.cmakeUtils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet, this.baseLib); + } + // Add the current args in the tool, add + // custom args, and reset the args. + for (const arg of cmakeArgs) { + cmake.arg(arg); + } + cmakeArgs = []; + // Add CMake args from CMakeSettings.json file. + cmake.line(evaledConf.cmakeArgs); + // Set the source directory. + cmake.arg(path.dirname(this.cmakeSettingsJson)); + // Run CNake with the given arguments. + if (!evaledConf.buildDir) { + throw new Error("Build directory is not specified."); + } + // Append user provided CMake arguments. + cmake.line(this.appendedCMakeArgs); + yield this.baseLib.mkdirP(evaledConf.buildDir); + const options = { + cwd: evaledConf.buildDir, + failOnStdErr: false, + errStream: process.stdout, + outStream: process.stdout, + ignoreReturnCode: true, + silent: false, + windowsVerbatimArguments: false, + env: process.env + }; + this.baseLib.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); + let code = -1; + yield using_statement_1.using(baseutillib.Matcher.createMatcher('cmake', this.baseLib, this.cmakeSettingsJson), (matcher) => __awaiter(this, void 0, void 0, function* () { + code = yield this.baseUtils.wrapOp("Generate project files with CMake", () => cmake.exec(options)); + })); + if (code !== 0) { + throw new Error(`"CMake failed with error code: '${code}'."`); + } + if (this.doBuild) { + yield using_statement_1.using(baseutillib.Matcher.createMatcher(cmakerunner.CMakeRunner.getBuildMatcher(this.buildDir, this.baseLib), this.baseLib), (matcher) => __awaiter(this, void 0, void 0, function* () { + yield this.baseUtils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { + return yield cmakerunner.CMakeRunner.build(this.baseLib, evaledConf.buildDir, + // CMakeSettings.json contains in buildCommandArgs the arguments to the make program + //only. They need to be put after '--', otherwise would be passed to directly to cmake. + ` ${evaledConf.getGeneratorBuildArgs()} -- ${evaledConf.makeArgs}`, options); + })); + })); + } + // Restore the original PATH environment variable. + process.env.PATH = originalPath; + } + finally { + this.baseLib.endOperation(); + } } - } - reverse += '"'; - return reverse - .split('') - .reverse() - .join(''); + }); } - _uvQuoteCmdArg(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.includes(' ') && !arg.includes('\t') && !arg.includes('"')) { - // No quotation needed - return arg; - } - if (!arg.includes('"') && !arg.includes('\\')) { - // 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\\" - let reverse = '"'; - let quoteHit = true; - for (let i = arg.length; i > 0; i--) { - // walk the string in reverse - reverse += arg[i - 1]; - if (quoteHit && arg[i - 1] === '\\') { - reverse += '\\'; - } - else if (arg[i - 1] === '"') { - quoteHit = true; - reverse += '\\'; - } - else { - quoteHit = false; - } - } - reverse += '"'; - return reverse - .split('') - .reverse() - .join(''); + notEmpty(value) { + return value !== null && value !== undefined; } - _cloneExecOptions(options) { - options = options || {}; - const result = { - cwd: options.cwd || process.cwd(), - env: options.env || process.env, - silent: options.silent || false, - windowsVerbatimArguments: options.windowsVerbatimArguments || false, - failOnStdErr: options.failOnStdErr || false, - ignoreReturnCode: options.ignoreReturnCode || false, - delay: options.delay || 10000 - }; - result.outStream = options.outStream || process.stdout; - result.errStream = options.errStream || process.stderr; - return result; + isMultiConfigGenerator(generatorName) { + return generatorName.includes("Visual Studio") || + generatorName.includes("Ninja Multi-Config"); } - _getSpawnOptions(options, toolPath) { - options = options || {}; - const result = {}; - result.cwd = options.cwd; - result.env = options.env; - result['windowsVerbatimArguments'] = - options.windowsVerbatimArguments || this._isCmdFile(); - if (options.windowsVerbatimArguments) { - result.argv0 = `"${toolPath}"`; - } - return result; +} +exports.CMakeSettingsJsonRunner = CMakeSettingsJsonRunner; +//# sourceMappingURL=cmakesettings-runner.js.map + +/***/ }), + +/***/ 464: +/***/ (function(module) { + +"use strict"; + + +module.exports = (...arguments_) => { + return [...new Set([].concat(...arguments_))]; +}; + + +/***/ }), + +/***/ 466: +/***/ (function(module, __unusedexports, __webpack_require__) { + +var Stream = __webpack_require__(413).Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); } + } +} + + +/***/ }), + +/***/ 470: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const command_1 = __webpack_require__(431); +const file_command_1 = __webpack_require__(102); +const utils_1 = __webpack_require__(82); +const os = __importStar(__webpack_require__(87)); +const path = __importStar(__webpack_require__(622)); +/** + * The code to exit an action + */ +var ExitCode; +(function (ExitCode) { /** - * 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 ExecOptions - * @returns number + * A code indicating that the action was successful */ - exec() { - return __awaiter(this, void 0, void 0, function* () { - // root the tool path if it is unrooted and contains relative pathing - if (!ioUtil.isRooted(this.toolPath) && - (this.toolPath.includes('/') || - (IS_WINDOWS && this.toolPath.includes('\\')))) { - // prefer options.cwd if it is specified, however options.cwd may also need to be rooted - this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); - } - // if the tool is only a file name, then resolve it from the PATH - // otherwise verify it exists (add extension on Windows if necessary) - this.toolPath = yield io.which(this.toolPath, true); - return new Promise((resolve, reject) => { - this._debug(`exec tool: ${this.toolPath}`); - this._debug('arguments:'); - for (const arg of this.args) { - this._debug(` ${arg}`); - } - const optionsNonNull = this._cloneExecOptions(this.options); - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); - } - const state = new ExecState(optionsNonNull, this.toolPath); - state.on('debug', (message) => { - this._debug(message); - }); - const fileName = this._getSpawnFileName(); - const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); - const stdbuffer = ''; - if (cp.stdout) { - cp.stdout.on('data', (data) => { - if (this.options.listeners && this.options.listeners.stdout) { - this.options.listeners.stdout(data); - } - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write(data); - } - this._processLineBuffer(data, stdbuffer, (line) => { - if (this.options.listeners && this.options.listeners.stdline) { - this.options.listeners.stdline(line); - } - }); - }); - } - const errbuffer = ''; - if (cp.stderr) { - cp.stderr.on('data', (data) => { - state.processStderr = true; - if (this.options.listeners && this.options.listeners.stderr) { - this.options.listeners.stderr(data); - } - if (!optionsNonNull.silent && - optionsNonNull.errStream && - optionsNonNull.outStream) { - const s = optionsNonNull.failOnStdErr - ? optionsNonNull.errStream - : optionsNonNull.outStream; - s.write(data); - } - this._processLineBuffer(data, errbuffer, (line) => { - if (this.options.listeners && this.options.listeners.errline) { - this.options.listeners.errline(line); - } - }); - }); - } - cp.on('error', (err) => { - state.processError = err.message; - state.processExited = true; - state.processClosed = true; - state.CheckComplete(); - }); - cp.on('exit', (code) => { - state.processExitCode = code; - state.processExited = true; - this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); - state.CheckComplete(); - }); - cp.on('close', (code) => { - state.processExitCode = code; - state.processExited = true; - state.processClosed = true; - this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); - state.CheckComplete(); - }); - state.on('done', (error, exitCode) => { - if (stdbuffer.length > 0) { - this.emit('stdline', stdbuffer); - } - if (errbuffer.length > 0) { - this.emit('errline', errbuffer); - } - cp.removeAllListeners(); - if (error) { - reject(error); - } - else { - resolve(exitCode); - } - }); - if (this.options.input) { - if (!cp.stdin) { - throw new Error('child process missing stdin'); - } - cp.stdin.end(this.options.input); - } - }); - }); + ExitCode[ExitCode["Success"] = 0] = "Success"; + /** + * A code indicating that the action was a failure + */ + ExitCode[ExitCode["Failure"] = 1] = "Failure"; +})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); +//----------------------------------------------------------------------- +// Variables +//----------------------------------------------------------------------- +/** + * Sets env variable for this action and future actions in the job + * @param name the name of the variable to set + * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function exportVariable(name, val) { + const convertedVal = utils_1.toCommandValue(val); + process.env[name] = convertedVal; + const filePath = process.env['GITHUB_ENV'] || ''; + if (filePath) { + const delimiter = '_GitHubActionsFileCommandDelimeter_'; + const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; + file_command_1.issueCommand('ENV', commandValue); + } + else { + command_1.issueCommand('set-env', { name }, convertedVal); + } +} +exports.exportVariable = exportVariable; +/** + * Registers a secret which will get masked from logs + * @param secret value of the secret + */ +function setSecret(secret) { + command_1.issueCommand('add-mask', {}, secret); +} +exports.setSecret = setSecret; +/** + * Prepends inputPath to the PATH (for this action and future actions) + * @param inputPath + */ +function addPath(inputPath) { + const filePath = process.env['GITHUB_PATH'] || ''; + if (filePath) { + file_command_1.issueCommand('PATH', inputPath); + } + else { + command_1.issueCommand('add-path', {}, inputPath); } + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; +} +exports.addPath = addPath; +/** + * Gets the value of an input. The value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string + */ +function getInput(name, options) { + const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; + if (options && options.required && !val) { + throw new Error(`Input required and not supplied: ${name}`); + } + return val.trim(); +} +exports.getInput = getInput; +/** + * Sets the value of an output. + * + * @param name name of the output to set + * @param value value to store. Non-string values will be converted to a string via JSON.stringify + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function setOutput(name, value) { + command_1.issueCommand('set-output', { name }, value); +} +exports.setOutput = setOutput; +/** + * Enables or disables the echoing of commands into stdout for the rest of the step. + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. + * + */ +function setCommandEcho(enabled) { + command_1.issue('echo', enabled ? 'on' : 'off'); +} +exports.setCommandEcho = setCommandEcho; +//----------------------------------------------------------------------- +// Results +//----------------------------------------------------------------------- +/** + * Sets the action status to failed. + * When the action exits it will be with an exit code of 1 + * @param message add error issue message + */ +function setFailed(message) { + process.exitCode = ExitCode.Failure; + error(message); } -exports.ToolRunner = ToolRunner; +exports.setFailed = setFailed; +//----------------------------------------------------------------------- +// Logging Commands +//----------------------------------------------------------------------- /** - * Convert an arg string to an array of args. Handles escaping + * Gets whether Actions Step Debug is on or not + */ +function isDebug() { + return process.env['RUNNER_DEBUG'] === '1'; +} +exports.isDebug = isDebug; +/** + * Writes debug message to user log + * @param message debug message + */ +function debug(message) { + command_1.issueCommand('debug', {}, message); +} +exports.debug = debug; +/** + * Adds an error issue + * @param message error issue message. Errors will be converted to string via toString() + */ +function error(message) { + command_1.issue('error', message instanceof Error ? message.toString() : message); +} +exports.error = error; +/** + * Adds an warning issue + * @param message warning issue message. Errors will be converted to string via toString() + */ +function warning(message) { + command_1.issue('warning', message instanceof Error ? message.toString() : message); +} +exports.warning = warning; +/** + * Writes info to log with console.log. + * @param message info message + */ +function info(message) { + process.stdout.write(message + os.EOL); +} +exports.info = info; +/** + * Begin an output group. * - * @param argString string of arguments - * @returns string[] array of arguments + * Output until the next `groupEnd` will be foldable in this group + * + * @param name The name of the output group */ -function argStringToArray(argString) { - const args = []; - let inQuotes = false; - let escaped = false; - let arg = ''; - function append(c) { - // we only escape double quotes. - if (escaped && c !== '"') { - arg += '\\'; - } - arg += c; - escaped = false; - } - for (let i = 0; i < argString.length; i++) { - const c = argString.charAt(i); - if (c === '"') { - if (!escaped) { - inQuotes = !inQuotes; - } - else { - append(c); - } - continue; - } - if (c === '\\' && escaped) { - append(c); - continue; - } - if (c === '\\' && inQuotes) { - escaped = true; - continue; - } - if (c === ' ' && !inQuotes) { - if (arg.length > 0) { - args.push(arg); - arg = ''; - } - continue; - } - append(c); - } - if (arg.length > 0) { - args.push(arg.trim()); - } - return args; +function startGroup(name) { + command_1.issue('group', name); } -exports.argStringToArray = argStringToArray; -class ExecState extends events.EventEmitter { - constructor(options, toolPath) { - super(); - this.processClosed = false; // tracks whether the process has exited and stdio is closed - this.processError = ''; - this.processExitCode = 0; - this.processExited = false; // tracks whether the process has exited - this.processStderr = false; // tracks whether stderr was written to - this.delay = 10000; // 10 seconds - this.done = false; - this.timeout = null; - if (!toolPath) { - throw new Error('toolPath must not be empty'); - } - this.options = options; - this.toolPath = toolPath; - if (options.delay) { - this.delay = options.delay; - } - } - CheckComplete() { - if (this.done) { - return; - } - if (this.processClosed) { - this._setResult(); - } - else if (this.processExited) { - this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this); - } - } - _debug(message) { - this.emit('debug', message); - } - _setResult() { - // determine whether there is an error - let error; - if (this.processExited) { - if (this.processError) { - error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); - } - else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { - error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); - } - else if (this.processStderr && this.options.failOnStdErr) { - error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); - } - } - // clear the timeout - if (this.timeout) { - clearTimeout(this.timeout); - this.timeout = null; - } - this.done = true; - this.emit('done', error, this.processExitCode); - } - static HandleTimeout(state) { - if (state.done) { - return; +exports.startGroup = startGroup; +/** + * End an output group. + */ +function endGroup() { + command_1.issue('endgroup'); +} +exports.endGroup = endGroup; +/** + * Wrap an asynchronous function call in a group. + * + * Returns the same type as the function itself. + * + * @param name The name of the group + * @param fn The function to wrap in the group + */ +function group(name, fn) { + return __awaiter(this, void 0, void 0, function* () { + startGroup(name); + let result; + try { + result = yield fn(); } - if (!state.processClosed && state.processExited) { - const message = `The STDIO streams did not close within ${state.delay / - 1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; - state._debug(message); + finally { + endGroup(); } - state._setResult(); - } + return result; + }); } -//# sourceMappingURL=toolrunner.js.map +exports.group = group; +//----------------------------------------------------------------------- +// Wrapper action state +//----------------------------------------------------------------------- +/** + * Saves state for current action, the state can only be retrieved by this action's post job execution. + * + * @param name name of the state to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function saveState(name, value) { + command_1.issueCommand('save-state', { name }, value); +} +exports.saveState = saveState; +/** + * Gets the value of an state set by this action's main execution. + * + * @param name name of the state to get + * @returns string + */ +function getState(name) { + return process.env[`STATE_${name}`] || ''; +} +exports.getState = getState; +//# sourceMappingURL=core.js.map + +/***/ }), + +/***/ 474: +/***/ (function(module, __unusedexports, __webpack_require__) { + +module.exports = function (/*Buffer*/inbuf) { + + var zlib = __webpack_require__(761); + + var opts = {chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024}; + + return { + deflate: function () { + return zlib.deflateRawSync(inbuf, opts); + }, + + deflateAsync: function (/*Function*/callback) { + var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0; + tmp.on('data', function (data) { + parts.push(data); + total += data.length; + }); + tmp.on('end', function () { + var buf = Buffer.alloc(total), written = 0; + buf.fill(0); + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + part.copy(buf, written); + written += part.length; + } + callback && callback(buf); + }); + tmp.end(inbuf); + } + } +}; + /***/ }), @@ -20003,7 +20003,7 @@ class LogFileCollector { this.regExps = []; this.bufferString = ""; for (const s of regExps) { - this.regExps.push(new RegExp(s, "m")); + this.regExps.push(new RegExp(s, "g")); } } appendBuffer(buffer) { @@ -20020,8 +20020,10 @@ class LogFileCollector { this.appendBuffer(buffer); let consumedUntil = -1; for (const re of this.regExps) { + re.lastIndex = 0; try { if (re.test(this.bufferString)) { + re.lastIndex = 0; const matches = re.exec(this.bufferString); if (matches) { consumedUntil = Math.max(consumedUntil, re.lastIndex); diff --git a/package-lock.json b/package-lock.json index 377f616..eadfc40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,10 +12,10 @@ "@actions/exec": "^1.0.3", "@actions/github": "^2.1.1", "@actions/io": "^1.0.2", - "@lukka/action-lib": "1.0.24", - "@lukka/base-lib": "1.0.24", - "@lukka/base-util-lib": "1.0.24", - "@lukka/run-cmake-lib": "1.0.24", + "@lukka/action-lib": "1.0.25", + "@lukka/base-lib": "1.0.25", + "@lukka/base-util-lib": "1.0.25", + "@lukka/run-cmake-lib": "1.0.25", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/jest": "^26.0.14", @@ -56,9 +56,9 @@ "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" }, "node_modules/@actions/exec": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz", - "integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", + "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", "dependencies": { "@actions/io": "^1.0.1" } @@ -1538,17 +1538,17 @@ } }, "node_modules/@lukka/action-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/1.0.24/f08764eb94fedd660f5eb513ee6183ebe7ef1c282d598cd9675e82f48c275dac", - "integrity": "sha512-Ydrqbdu5uRPdRy/XXYvql8EHukztfC7M/BBjSdRGUGNOMgBNkkH/y91qGe5Pm6bM6GVsS0OTvM39WoUr/cGpNA==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/1.0.25/1a5be60d1c4cc5ef06486f46363c16d5aa502e3feb493fe43708b44d3c54b851", + "integrity": "sha512-JfV7m5zuULssQ2FPVdY521r63VGTH7LFhyQnn3evk4JDv9NL9x9TtBHhBl+wecLup+/B98PsTzSbX4Jgt8hwPQ==", "license": "MIT", "dependencies": { "@actions/core": "^1.2.6", "@actions/exec": "^1.0.4", "@actions/github": "^4.0.0", "@actions/io": "^1.0.2", - "@lukka/base-lib": "^1.0.24", - "@lukka/base-util-lib": "^1.0.24", + "@lukka/base-lib": "^1.0.25", + "@lukka/base-util-lib": "^1.0.25", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/q": "^1.5.1", @@ -1563,14 +1563,6 @@ "using-statement": "^0.3.1" } }, - "node_modules/@lukka/action-lib/node_modules/@actions/exec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", - "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", - "dependencies": { - "@actions/io": "^1.0.1" - } - }, "node_modules/@lukka/action-lib/node_modules/@actions/github": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", @@ -1770,9 +1762,9 @@ } }, "node_modules/@lukka/base-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/1.0.24/942871bc3128f5d573c310214642b9c17a28f70c6e61e10792e61479168ea1d1", - "integrity": "sha512-uPvK1mQ01VfVRK++yRH6h0u66TKKvSF12ZsgwBGfynjPVrnpqzRng6VXn3SxtUDrrbiRkFxAs3NMR5lqj4+K1w==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/1.0.25/1900f2270feb488f0e972522abdf5fd3324d306e0e6fa3bece8e3b640919919c", + "integrity": "sha512-AqlF0T4EfrCrjClfGQ2IwDcYNPGNHW4kpzCZ/yxSrSzBOhQbwEBRMv3+YCB+G2jJaO4zFjj+6w9koaFCcBeCHA==", "license": "MIT", "dependencies": { "@types/adm-zip": "^0.4.32", @@ -1952,9 +1944,9 @@ } }, "node_modules/@lukka/base-util-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/1.0.24/91bfbe629e14bb4b8e677a315588218c193f3fade62133375bfbfde9b15fe55e", - "integrity": "sha512-JzDXOfd5J5yqCSU9bFKepkr08/fXGyEgCY/IM3lvMkvnQw3TZFCcVhbi2owqUFzldZGHyomlO4wD0KS/Y4atpA==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/1.0.25/9d58e27ce94c36271d092864f1a20f633d22ed055b2579861cc44850998cbe0c", + "integrity": "sha512-g36ZpD2O5VttIrINz2RKKXSIRKxVtQI/+7WyGFAbZT5nViHPhsqZsAr8Gi9IWwMlt+zxENLEY7Fvmrtvn2VADQ==", "license": "MIT", "dependencies": { "@types/adm-zip": "^0.4.32", @@ -2134,15 +2126,15 @@ } }, "node_modules/@lukka/run-cmake-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/run-cmake-lib/1.0.24/7961e3d6e391754ec531eb9c636c95033be966211a1a63bc5872fbc502a074db", - "integrity": "sha512-pg7tpsC0OihrN+Lff09CekUGD3KV5zbBW1i2pmTsjgAOquorNuYmt8zKNJlqWswCA3v87FmMAGKOUtB7jwgGLQ==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/run-cmake-lib/1.0.25/e82a527fe84a7ddb89f2d21f2914a4b2187a47be0e29357f5857cd43ba65a715", + "integrity": "sha512-9T+McwdPfWAoQWDfXFiTeGNWU5HCVSgE7ggKEf/+oO+EJ4NpKmUp3O1gBsEgZsITwjvC/24229tsbVuvwX+53A==", "license": "MIT", "dependencies": { - "@lukka/action-lib": "^1.0.24", - "@lukka/base-lib": "^1.0.24", - "@lukka/base-util-lib": "^1.0.24", - "@lukka/run-vcpkg-lib": "^1.0.24", + "@lukka/action-lib": "^1.0.25", + "@lukka/base-lib": "^1.0.25", + "@lukka/base-util-lib": "^1.0.25", + "@lukka/run-vcpkg-lib": "^1.0.25", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/q": "^1.5.1", @@ -2330,14 +2322,14 @@ } }, "node_modules/@lukka/run-vcpkg-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/run-vcpkg-lib/1.0.24/54a9fa53a6d2f6626d1c22fb2466b81ef3235de11204fae9007a3ce2f6c511d1", - "integrity": "sha512-L9q0gVYbTnxFyMF/rr0D+r1nTdERIWeHu0rK27aWGDsX7tm0xZ7OqidFd99EmJXYSrJ31jEI9T1V3TdElSosMA==", + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/run-vcpkg-lib/1.0.26/d672b43d3da4b33fc9c07449c2cad77cb0f935826dd81b8afa03b4691689b80c", + "integrity": "sha512-iTKxCe/Vfh7THiu/ArD7weYytHPi49COXsGoPtbu64n2qTY9WSF02GdRibx+m8Kc7jKkMRbYqbhwDajPfeTO3w==", "license": "MIT", "dependencies": { - "@lukka/action-lib": "^1.0.24", - "@lukka/base-lib": "^1.0.24", - "@lukka/base-util-lib": "^1.0.24", + "@lukka/action-lib": "^1.0.26", + "@lukka/base-lib": "^1.0.26", + "@lukka/base-util-lib": "^1.0.26", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/q": "^1.5.1", @@ -2353,6 +2345,114 @@ "using-statement": "^0.3.1" } }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@actions/github": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", + "integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==", + "dependencies": { + "@actions/http-client": "^1.0.8", + "@octokit/core": "^3.0.0", + "@octokit/plugin-paginate-rest": "^2.2.3", + "@octokit/plugin-rest-endpoint-methods": "^4.0.0" + } + }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@lukka/action-lib": { + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/1.0.26/e49301b793ada074285dbb310db833422b736b3c9b09309a47a581d6210bed1e", + "integrity": "sha512-fNoVOPIluuzeBik4o0yjZgyxb0aXTfFalWzx7XQ7RzWjmvfVHKuw0PO3v64zwyLNPrKew/W+rvrgQE8DIFZIKQ==", + "license": "MIT", + "dependencies": { + "@actions/core": "^1.2.6", + "@actions/exec": "^1.0.4", + "@actions/github": "^4.0.0", + "@actions/io": "^1.0.2", + "@lukka/base-lib": "^1.0.26", + "@lukka/base-util-lib": "^1.0.26", + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@lukka/base-lib": { + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/1.0.26/1aa5577d5d01c1007dfabedd6bea139e46ee4d8d1d568c40338a5cb0574ca26d", + "integrity": "sha512-j+K6Vc2fuVTYG9lFSfh73n+id3K9zeINxtxYrGjly/Qsa6H8G+910VxZp6TdDoL11h/mhHtQ2KS1N0BmdWJ0gw==", + "license": "MIT", + "dependencies": { + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@lukka/base-util-lib": { + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/1.0.26/1b29a6e8556eb3995a3aa21de1b586af828e3543e772e640a10dadcf47520ad5", + "integrity": "sha512-ulxbChJNV0CVY+LQIdW2uH6h2VbeX1Qf+b1JhkIzr9HSXjYL6S7XvSnjNSkOE4LeSoJ9o9j4WO9ZoTC09D8Q0g==", + "license": "MIT", + "dependencies": { + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@octokit/plugin-paginate-rest": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz", + "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==", + "dependencies": { + "@octokit/types": "^6.11.0" + }, + "peerDependencies": { + "@octokit/core": ">=2" + } + }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.15.1.tgz", + "integrity": "sha512-4gQg4ySoW7ktKB0Mf38fHzcSffVZd6mT5deJQtpqkuPuAqzlED5AJTeW8Uk7dPRn7KaOlWcXB0MedTFJU1j4qA==", + "dependencies": { + "@octokit/types": "^6.13.0", + "deprecation": "^2.3.1" + }, + "peerDependencies": { + "@octokit/core": ">=3" + } + }, + "node_modules/@lukka/run-vcpkg-lib/node_modules/@octokit/types": { + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.1.tgz", + "integrity": "sha512-UF/PL0y4SKGx/p1azFf7e6j9lB78tVwAFvnHtslzOJ6VipshYks74qm9jjTEDlCyaTmbhbk2h3Run5l0CtCF6A==", + "dependencies": { + "@octokit/openapi-types": "^6.0.0" + } + }, "node_modules/@lukka/run-vcpkg-lib/node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -2652,6 +2752,11 @@ "universal-user-agent": "^4.0.0" } }, + "node_modules/@octokit/openapi-types": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.1.0.tgz", + "integrity": "sha512-Z9fDZVbGj4dFLErEoXUSuZhk3wJ8KVGnbrUwoPijsQ9EyNwOeQ+U2jSqaHUz8WtgIWf0aeO59oJyhMpWCKaabg==" + }, "node_modules/@octokit/plugin-paginate-rest": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz", @@ -16408,9 +16513,9 @@ "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" }, "@actions/exec": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz", - "integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", + "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", "requires": { "@actions/io": "^1.0.1" } @@ -17676,16 +17781,16 @@ } }, "@lukka/action-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/1.0.24/f08764eb94fedd660f5eb513ee6183ebe7ef1c282d598cd9675e82f48c275dac", - "integrity": "sha512-Ydrqbdu5uRPdRy/XXYvql8EHukztfC7M/BBjSdRGUGNOMgBNkkH/y91qGe5Pm6bM6GVsS0OTvM39WoUr/cGpNA==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/1.0.25/1a5be60d1c4cc5ef06486f46363c16d5aa502e3feb493fe43708b44d3c54b851", + "integrity": "sha512-JfV7m5zuULssQ2FPVdY521r63VGTH7LFhyQnn3evk4JDv9NL9x9TtBHhBl+wecLup+/B98PsTzSbX4Jgt8hwPQ==", "requires": { "@actions/core": "^1.2.6", "@actions/exec": "^1.0.4", "@actions/github": "^4.0.0", "@actions/io": "^1.0.2", - "@lukka/base-lib": "^1.0.24", - "@lukka/base-util-lib": "^1.0.24", + "@lukka/base-lib": "^1.0.25", + "@lukka/base-util-lib": "^1.0.25", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/q": "^1.5.1", @@ -17700,14 +17805,6 @@ "using-statement": "^0.3.1" }, "dependencies": { - "@actions/exec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", - "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", - "requires": { - "@actions/io": "^1.0.1" - } - }, "@actions/github": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", @@ -17869,9 +17966,9 @@ } }, "@lukka/base-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/1.0.24/942871bc3128f5d573c310214642b9c17a28f70c6e61e10792e61479168ea1d1", - "integrity": "sha512-uPvK1mQ01VfVRK++yRH6h0u66TKKvSF12ZsgwBGfynjPVrnpqzRng6VXn3SxtUDrrbiRkFxAs3NMR5lqj4+K1w==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/1.0.25/1900f2270feb488f0e972522abdf5fd3324d306e0e6fa3bece8e3b640919919c", + "integrity": "sha512-AqlF0T4EfrCrjClfGQ2IwDcYNPGNHW4kpzCZ/yxSrSzBOhQbwEBRMv3+YCB+G2jJaO4zFjj+6w9koaFCcBeCHA==", "requires": { "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", @@ -18012,9 +18109,9 @@ } }, "@lukka/base-util-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/1.0.24/91bfbe629e14bb4b8e677a315588218c193f3fade62133375bfbfde9b15fe55e", - "integrity": "sha512-JzDXOfd5J5yqCSU9bFKepkr08/fXGyEgCY/IM3lvMkvnQw3TZFCcVhbi2owqUFzldZGHyomlO4wD0KS/Y4atpA==", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/1.0.25/9d58e27ce94c36271d092864f1a20f633d22ed055b2579861cc44850998cbe0c", + "integrity": "sha512-g36ZpD2O5VttIrINz2RKKXSIRKxVtQI/+7WyGFAbZT5nViHPhsqZsAr8Gi9IWwMlt+zxENLEY7Fvmrtvn2VADQ==", "requires": { "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", @@ -18155,14 +18252,14 @@ } }, "@lukka/run-cmake-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/run-cmake-lib/1.0.24/7961e3d6e391754ec531eb9c636c95033be966211a1a63bc5872fbc502a074db", - "integrity": "sha512-pg7tpsC0OihrN+Lff09CekUGD3KV5zbBW1i2pmTsjgAOquorNuYmt8zKNJlqWswCA3v87FmMAGKOUtB7jwgGLQ==", - "requires": { - "@lukka/action-lib": "^1.0.24", - "@lukka/base-lib": "^1.0.24", - "@lukka/base-util-lib": "^1.0.24", - "@lukka/run-vcpkg-lib": "^1.0.24", + "version": "1.0.25", + "resolved": "https://npm.pkg.github.com/download/@lukka/run-cmake-lib/1.0.25/e82a527fe84a7ddb89f2d21f2914a4b2187a47be0e29357f5857cd43ba65a715", + "integrity": "sha512-9T+McwdPfWAoQWDfXFiTeGNWU5HCVSgE7ggKEf/+oO+EJ4NpKmUp3O1gBsEgZsITwjvC/24229tsbVuvwX+53A==", + "requires": { + "@lukka/action-lib": "^1.0.25", + "@lukka/base-lib": "^1.0.25", + "@lukka/base-util-lib": "^1.0.25", + "@lukka/run-vcpkg-lib": "^1.0.25", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/q": "^1.5.1", @@ -18309,13 +18406,13 @@ } }, "@lukka/run-vcpkg-lib": { - "version": "1.0.24", - "resolved": "https://npm.pkg.github.com/download/@lukka/run-vcpkg-lib/1.0.24/54a9fa53a6d2f6626d1c22fb2466b81ef3235de11204fae9007a3ce2f6c511d1", - "integrity": "sha512-L9q0gVYbTnxFyMF/rr0D+r1nTdERIWeHu0rK27aWGDsX7tm0xZ7OqidFd99EmJXYSrJ31jEI9T1V3TdElSosMA==", + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/run-vcpkg-lib/1.0.26/d672b43d3da4b33fc9c07449c2cad77cb0f935826dd81b8afa03b4691689b80c", + "integrity": "sha512-iTKxCe/Vfh7THiu/ArD7weYytHPi49COXsGoPtbu64n2qTY9WSF02GdRibx+m8Kc7jKkMRbYqbhwDajPfeTO3w==", "requires": { - "@lukka/action-lib": "^1.0.24", - "@lukka/base-lib": "^1.0.24", - "@lukka/base-util-lib": "^1.0.24", + "@lukka/action-lib": "^1.0.26", + "@lukka/base-lib": "^1.0.26", + "@lukka/base-util-lib": "^1.0.26", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/q": "^1.5.1", @@ -18331,6 +18428,105 @@ "using-statement": "^0.3.1" }, "dependencies": { + "@actions/github": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", + "integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==", + "requires": { + "@actions/http-client": "^1.0.8", + "@octokit/core": "^3.0.0", + "@octokit/plugin-paginate-rest": "^2.2.3", + "@octokit/plugin-rest-endpoint-methods": "^4.0.0" + } + }, + "@lukka/action-lib": { + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/1.0.26/e49301b793ada074285dbb310db833422b736b3c9b09309a47a581d6210bed1e", + "integrity": "sha512-fNoVOPIluuzeBik4o0yjZgyxb0aXTfFalWzx7XQ7RzWjmvfVHKuw0PO3v64zwyLNPrKew/W+rvrgQE8DIFZIKQ==", + "requires": { + "@actions/core": "^1.2.6", + "@actions/exec": "^1.0.4", + "@actions/github": "^4.0.0", + "@actions/io": "^1.0.2", + "@lukka/base-lib": "^1.0.26", + "@lukka/base-util-lib": "^1.0.26", + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "@lukka/base-lib": { + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/1.0.26/1aa5577d5d01c1007dfabedd6bea139e46ee4d8d1d568c40338a5cb0574ca26d", + "integrity": "sha512-j+K6Vc2fuVTYG9lFSfh73n+id3K9zeINxtxYrGjly/Qsa6H8G+910VxZp6TdDoL11h/mhHtQ2KS1N0BmdWJ0gw==", + "requires": { + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "@lukka/base-util-lib": { + "version": "1.0.26", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/1.0.26/1b29a6e8556eb3995a3aa21de1b586af828e3543e772e640a10dadcf47520ad5", + "integrity": "sha512-ulxbChJNV0CVY+LQIdW2uH6h2VbeX1Qf+b1JhkIzr9HSXjYL6S7XvSnjNSkOE4LeSoJ9o9j4WO9ZoTC09D8Q0g==", + "requires": { + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "@octokit/plugin-paginate-rest": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz", + "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==", + "requires": { + "@octokit/types": "^6.11.0" + } + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.15.1.tgz", + "integrity": "sha512-4gQg4ySoW7ktKB0Mf38fHzcSffVZd6mT5deJQtpqkuPuAqzlED5AJTeW8Uk7dPRn7KaOlWcXB0MedTFJU1j4qA==", + "requires": { + "@octokit/types": "^6.13.0", + "deprecation": "^2.3.1" + } + }, + "@octokit/types": { + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.1.tgz", + "integrity": "sha512-UF/PL0y4SKGx/p1azFf7e6j9lB78tVwAFvnHtslzOJ6VipshYks74qm9jjTEDlCyaTmbhbk2h3Run5l0CtCF6A==", + "requires": { + "@octokit/openapi-types": "^6.0.0" + } + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -18579,6 +18775,11 @@ "universal-user-agent": "^4.0.0" } }, + "@octokit/openapi-types": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.1.0.tgz", + "integrity": "sha512-Z9fDZVbGj4dFLErEoXUSuZhk3wJ8KVGnbrUwoPijsQ9EyNwOeQ+U2jSqaHUz8WtgIWf0aeO59oJyhMpWCKaabg==" + }, "@octokit/plugin-paginate-rest": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz", diff --git a/package.json b/package.json index a6039a6..1aefa78 100644 --- a/package.json +++ b/package.json @@ -42,10 +42,10 @@ "@actions/exec": "^1.0.3", "@actions/github": "^2.1.1", "@actions/io": "^1.0.2", - "@lukka/action-lib": "1.0.24", - "@lukka/base-lib": "1.0.24", - "@lukka/base-util-lib": "1.0.24", - "@lukka/run-cmake-lib": "1.0.24", + "@lukka/action-lib": "1.0.25", + "@lukka/base-lib": "1.0.25", + "@lukka/base-util-lib": "1.0.25", + "@lukka/run-cmake-lib": "1.0.25", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/jest": "^26.0.14",