Support for GHES (#95)
This commit is contained in:
parent
9f521e1bf4
commit
4dda7a3aa1
8243
dist/index.js
vendored
8243
dist/index.js
vendored
@ -34,7 +34,7 @@ module.exports =
|
|||||||
/******/ // the startup function
|
/******/ // the startup function
|
||||||
/******/ function startup() {
|
/******/ function startup() {
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(344);
|
/******/ return __webpack_require__(175);
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/
|
/******/
|
||||||
/******/ // run startup
|
/******/ // run startup
|
||||||
@ -43,6 +43,303 @@ module.exports =
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ({
|
/******/ ({
|
||||||
|
|
||||||
|
/***/ 1:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const childProcess = __webpack_require__(129);
|
||||||
|
const path = __webpack_require__(622);
|
||||||
|
const util_1 = __webpack_require__(669);
|
||||||
|
const ioUtil = __webpack_require__(672);
|
||||||
|
const exec = util_1.promisify(childProcess.exec);
|
||||||
|
/**
|
||||||
|
* Copies a file or folder.
|
||||||
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
|
*
|
||||||
|
* @param source source path
|
||||||
|
* @param dest destination path
|
||||||
|
* @param options optional. See CopyOptions.
|
||||||
|
*/
|
||||||
|
function cp(source, dest, options = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const { force, recursive } = readCopyOptions(options);
|
||||||
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||||
|
// Dest is an existing file, but not forcing
|
||||||
|
if (destStat && destStat.isFile() && !force) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If dest is an existing directory, should copy inside.
|
||||||
|
const newDest = destStat && destStat.isDirectory()
|
||||||
|
? path.join(dest, path.basename(source))
|
||||||
|
: dest;
|
||||||
|
if (!(yield ioUtil.exists(source))) {
|
||||||
|
throw new Error(`no such file or directory: ${source}`);
|
||||||
|
}
|
||||||
|
const sourceStat = yield ioUtil.stat(source);
|
||||||
|
if (sourceStat.isDirectory()) {
|
||||||
|
if (!recursive) {
|
||||||
|
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield cpDirRecursive(source, newDest, 0, force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (path.relative(source, newDest) === '') {
|
||||||
|
// a file cannot be copied to itself
|
||||||
|
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
||||||
|
}
|
||||||
|
yield copyFile(source, newDest, force);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cp = cp;
|
||||||
|
/**
|
||||||
|
* Moves a path.
|
||||||
|
*
|
||||||
|
* @param source source path
|
||||||
|
* @param dest destination path
|
||||||
|
* @param options optional. See MoveOptions.
|
||||||
|
*/
|
||||||
|
function mv(source, dest, options = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (yield ioUtil.exists(dest)) {
|
||||||
|
let destExists = true;
|
||||||
|
if (yield ioUtil.isDirectory(dest)) {
|
||||||
|
// If dest is directory copy src into dest
|
||||||
|
dest = path.join(dest, path.basename(source));
|
||||||
|
destExists = yield ioUtil.exists(dest);
|
||||||
|
}
|
||||||
|
if (destExists) {
|
||||||
|
if (options.force == null || options.force) {
|
||||||
|
yield rmRF(dest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('Destination already exists');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yield mkdirP(path.dirname(dest));
|
||||||
|
yield ioUtil.rename(source, dest);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.mv = mv;
|
||||||
|
/**
|
||||||
|
* Remove a path recursively with force
|
||||||
|
*
|
||||||
|
* @param inputPath path to remove
|
||||||
|
*/
|
||||||
|
function rmRF(inputPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (ioUtil.IS_WINDOWS) {
|
||||||
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||||
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||||
|
try {
|
||||||
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||||
|
yield exec(`rd /s /q "${inputPath}"`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield exec(`del /f /a "${inputPath}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT')
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||||
|
try {
|
||||||
|
yield ioUtil.unlink(inputPath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT')
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let isDir = false;
|
||||||
|
try {
|
||||||
|
isDir = yield ioUtil.isDirectory(inputPath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT')
|
||||||
|
throw err;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isDir) {
|
||||||
|
yield exec(`rm -rf "${inputPath}"`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield ioUtil.unlink(inputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.rmRF = rmRF;
|
||||||
|
/**
|
||||||
|
* Make a directory. Creates the full path with folders in between
|
||||||
|
* Will throw if it fails
|
||||||
|
*
|
||||||
|
* @param fsPath path to create
|
||||||
|
* @returns Promise<void>
|
||||||
|
*/
|
||||||
|
function mkdirP(fsPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
yield ioUtil.mkdirP(fsPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.mkdirP = mkdirP;
|
||||||
|
/**
|
||||||
|
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||||
|
* If you check and the tool does not exist, it will throw.
|
||||||
|
*
|
||||||
|
* @param tool name of the tool
|
||||||
|
* @param check whether to check if tool exists
|
||||||
|
* @returns Promise<string> path to tool
|
||||||
|
*/
|
||||||
|
function which(tool, check) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!tool) {
|
||||||
|
throw new Error("parameter 'tool' is required");
|
||||||
|
}
|
||||||
|
// recursive when check=true
|
||||||
|
if (check) {
|
||||||
|
const result = yield which(tool, false);
|
||||||
|
if (!result) {
|
||||||
|
if (ioUtil.IS_WINDOWS) {
|
||||||
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// build the list of extensions to try
|
||||||
|
const extensions = [];
|
||||||
|
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
||||||
|
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
||||||
|
if (extension) {
|
||||||
|
extensions.push(extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if it's rooted, return it if exists. otherwise return empty.
|
||||||
|
if (ioUtil.isRooted(tool)) {
|
||||||
|
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||||
|
if (filePath) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
// if any path separators, return empty
|
||||||
|
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
// build the list of directories
|
||||||
|
//
|
||||||
|
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
|
||||||
|
// it feels like we should not do this. Checking the current directory seems like more of a use
|
||||||
|
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
|
||||||
|
// across platforms.
|
||||||
|
const directories = [];
|
||||||
|
if (process.env.PATH) {
|
||||||
|
for (const p of process.env.PATH.split(path.delimiter)) {
|
||||||
|
if (p) {
|
||||||
|
directories.push(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// return the first match
|
||||||
|
for (const directory of directories) {
|
||||||
|
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
||||||
|
if (filePath) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw new Error(`which failed with message ${err.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.which = which;
|
||||||
|
function readCopyOptions(options) {
|
||||||
|
const force = options.force == null ? true : options.force;
|
||||||
|
const recursive = Boolean(options.recursive);
|
||||||
|
return { force, recursive };
|
||||||
|
}
|
||||||
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Ensure there is not a run away recursive copy
|
||||||
|
if (currentDepth >= 255)
|
||||||
|
return;
|
||||||
|
currentDepth++;
|
||||||
|
yield mkdirP(destDir);
|
||||||
|
const files = yield ioUtil.readdir(sourceDir);
|
||||||
|
for (const fileName of files) {
|
||||||
|
const srcFile = `${sourceDir}/${fileName}`;
|
||||||
|
const destFile = `${destDir}/${fileName}`;
|
||||||
|
const srcFileStat = yield ioUtil.lstat(srcFile);
|
||||||
|
if (srcFileStat.isDirectory()) {
|
||||||
|
// Recurse
|
||||||
|
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield copyFile(srcFile, destFile, force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Change the mode for the newly created directory
|
||||||
|
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Buffered file copy
|
||||||
|
function copyFile(srcFile, destFile, force) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
||||||
|
// unlink/re-link it
|
||||||
|
try {
|
||||||
|
yield ioUtil.lstat(destFile);
|
||||||
|
yield ioUtil.unlink(destFile);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
// Try to override file permission
|
||||||
|
if (e.code === 'EPERM') {
|
||||||
|
yield ioUtil.chmod(destFile, '0666');
|
||||||
|
yield ioUtil.unlink(destFile);
|
||||||
|
}
|
||||||
|
// other errors = it doesn't exist, no work to do
|
||||||
|
}
|
||||||
|
// Copy over symlink
|
||||||
|
const symlinkFull = yield ioUtil.readlink(srcFile);
|
||||||
|
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
||||||
|
}
|
||||||
|
else if (!(yield ioUtil.exists(destFile)) || force) {
|
||||||
|
yield ioUtil.copyFile(srcFile, destFile);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=io.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 9:
|
/***/ 9:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
@ -65,275 +362,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(696));
|
const os = __importStar(__webpack_require__(87));
|
||||||
/**
|
const events = __importStar(__webpack_require__(614));
|
||||||
* Internal class for retries
|
const child = __importStar(__webpack_require__(129));
|
||||||
*/
|
const path = __importStar(__webpack_require__(622));
|
||||||
class RetryHelper {
|
const io = __importStar(__webpack_require__(1));
|
||||||
constructor(maxAttempts, minSeconds, maxSeconds) {
|
const ioUtil = __importStar(__webpack_require__(672));
|
||||||
if (maxAttempts < 1) {
|
|
||||||
throw new Error('max attempts should be greater than or equal to 1');
|
|
||||||
}
|
|
||||||
this.maxAttempts = maxAttempts;
|
|
||||||
this.minSeconds = Math.floor(minSeconds);
|
|
||||||
this.maxSeconds = Math.floor(maxSeconds);
|
|
||||||
if (this.minSeconds > this.maxSeconds) {
|
|
||||||
throw new Error('min seconds should be less than or equal to max seconds');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
execute(action, isRetryable) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let attempt = 1;
|
|
||||||
while (attempt < this.maxAttempts) {
|
|
||||||
// Try
|
|
||||||
try {
|
|
||||||
return yield action();
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (isRetryable && !isRetryable(err)) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
core.info(err.message);
|
|
||||||
}
|
|
||||||
// Sleep
|
|
||||||
const seconds = this.getSleepAmount();
|
|
||||||
core.info(`Waiting ${seconds} seconds before trying again`);
|
|
||||||
yield this.sleep(seconds);
|
|
||||||
attempt++;
|
|
||||||
}
|
|
||||||
// Last attempt
|
|
||||||
return yield action();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getSleepAmount() {
|
|
||||||
return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
|
|
||||||
this.minSeconds);
|
|
||||||
}
|
|
||||||
sleep(seconds) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.RetryHelper = RetryHelper;
|
|
||||||
//# sourceMappingURL=retry-helper.js.map
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 10:
|
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(486)
|
|
||||||
const debug = __webpack_require__(396)
|
|
||||||
exports = module.exports = {}
|
|
||||||
|
|
||||||
// The actual regexps go on exports.re
|
|
||||||
const re = exports.re = []
|
|
||||||
const src = exports.src = []
|
|
||||||
const t = exports.t = {}
|
|
||||||
let R = 0
|
|
||||||
|
|
||||||
const createToken = (name, value, isGlobal) => {
|
|
||||||
const index = R++
|
|
||||||
debug(index, value)
|
|
||||||
t[name] = index
|
|
||||||
src[index] = value
|
|
||||||
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following Regular Expressions can be used for tokenizing,
|
|
||||||
// validating, and parsing SemVer version strings.
|
|
||||||
|
|
||||||
// ## Numeric Identifier
|
|
||||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
||||||
|
|
||||||
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
|
|
||||||
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
|
|
||||||
|
|
||||||
// ## Non-numeric Identifier
|
|
||||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
||||||
// more letters, digits, or hyphens.
|
|
||||||
|
|
||||||
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
|
|
||||||
|
|
||||||
// ## Main Version
|
|
||||||
// Three dot-separated numeric identifiers.
|
|
||||||
|
|
||||||
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
||||||
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
||||||
`(${src[t.NUMERICIDENTIFIER]})`)
|
|
||||||
|
|
||||||
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
||||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
||||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
|
||||||
|
|
||||||
// ## Pre-release Version Identifier
|
|
||||||
// A numeric identifier, or a non-numeric identifier.
|
|
||||||
|
|
||||||
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
|
|
||||||
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
|
||||||
|
|
||||||
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
|
|
||||||
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
|
||||||
|
|
||||||
// ## Pre-release Version
|
|
||||||
// Hyphen, followed by one or more dot-separated pre-release version
|
|
||||||
// identifiers.
|
|
||||||
|
|
||||||
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
|
||||||
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
|
|
||||||
|
|
||||||
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
|
||||||
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
|
|
||||||
|
|
||||||
// ## Build Metadata Identifier
|
|
||||||
// Any combination of digits, letters, or hyphens.
|
|
||||||
|
|
||||||
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
|
|
||||||
|
|
||||||
// ## Build Metadata
|
|
||||||
// Plus sign, followed by one or more period-separated build metadata
|
|
||||||
// identifiers.
|
|
||||||
|
|
||||||
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
|
||||||
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
|
|
||||||
|
|
||||||
// ## Full Version String
|
|
||||||
// A main version, followed optionally by a pre-release version and
|
|
||||||
// build metadata.
|
|
||||||
|
|
||||||
// Note that the only major, minor, patch, and pre-release sections of
|
|
||||||
// the version string are capturing groups. The build metadata is not a
|
|
||||||
// capturing group, because it should not ever be used in version
|
|
||||||
// comparison.
|
|
||||||
|
|
||||||
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
|
||||||
}${src[t.PRERELEASE]}?${
|
|
||||||
src[t.BUILD]}?`)
|
|
||||||
|
|
||||||
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
|
|
||||||
|
|
||||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
||||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
||||||
// common in the npm registry.
|
|
||||||
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
|
||||||
}${src[t.PRERELEASELOOSE]}?${
|
|
||||||
src[t.BUILD]}?`)
|
|
||||||
|
|
||||||
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
|
||||||
|
|
||||||
createToken('GTLT', '((?:<|>)?=?)')
|
|
||||||
|
|
||||||
// Something like "2.*" or "1.2.x".
|
|
||||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
||||||
// Only the first item is strictly required.
|
|
||||||
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
|
||||||
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
|
||||||
|
|
||||||
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
|
||||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
||||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
||||||
`(?:${src[t.PRERELEASE]})?${
|
|
||||||
src[t.BUILD]}?` +
|
|
||||||
`)?)?`)
|
|
||||||
|
|
||||||
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
||||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
||||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
||||||
`(?:${src[t.PRERELEASELOOSE]})?${
|
|
||||||
src[t.BUILD]}?` +
|
|
||||||
`)?)?`)
|
|
||||||
|
|
||||||
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
|
|
||||||
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
|
||||||
|
|
||||||
// Coercion.
|
|
||||||
// Extract anything that could conceivably be a part of a valid semver
|
|
||||||
createToken('COERCE', `${'(^|[^\\d])' +
|
|
||||||
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
|
||||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
||||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
||||||
`(?:$|[^\\d])`)
|
|
||||||
createToken('COERCERTL', src[t.COERCE], true)
|
|
||||||
|
|
||||||
// Tilde ranges.
|
|
||||||
// Meaning is "reasonably at or greater than"
|
|
||||||
createToken('LONETILDE', '(?:~>?)')
|
|
||||||
|
|
||||||
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
|
|
||||||
exports.tildeTrimReplace = '$1~'
|
|
||||||
|
|
||||||
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
|
|
||||||
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
|
|
||||||
|
|
||||||
// Caret ranges.
|
|
||||||
// Meaning is "at least and backwards compatible with"
|
|
||||||
createToken('LONECARET', '(?:\\^)')
|
|
||||||
|
|
||||||
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
|
|
||||||
exports.caretTrimReplace = '$1^'
|
|
||||||
|
|
||||||
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
|
|
||||||
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
|
|
||||||
|
|
||||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
||||||
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
|
|
||||||
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
|
|
||||||
|
|
||||||
// An expression to strip any whitespace between the gtlt and the thing
|
|
||||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
||||||
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
||||||
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
|
|
||||||
exports.comparatorTrimReplace = '$1$2$3'
|
|
||||||
|
|
||||||
// Something like `1.2.3 - 1.2.4`
|
|
||||||
// Note that these all use the loose form, because they'll be
|
|
||||||
// checked against either the strict or loose comparator form
|
|
||||||
// later.
|
|
||||||
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
|
||||||
`\\s+-\\s+` +
|
|
||||||
`(${src[t.XRANGEPLAIN]})` +
|
|
||||||
`\\s*$`)
|
|
||||||
|
|
||||||
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
|
||||||
`\\s+-\\s+` +
|
|
||||||
`(${src[t.XRANGEPLAINLOOSE]})` +
|
|
||||||
`\\s*$`)
|
|
||||||
|
|
||||||
// Star ranges basically just allow anything at all.
|
|
||||||
createToken('STAR', '(<|>)?=?\\s*\\*')
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 16:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("tls");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 29:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const os = __webpack_require__(87);
|
|
||||||
const events = __webpack_require__(614);
|
|
||||||
const child = __webpack_require__(129);
|
|
||||||
const path = __webpack_require__(622);
|
|
||||||
const io = __webpack_require__(788);
|
|
||||||
const ioUtil = __webpack_require__(60);
|
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
/*
|
/*
|
||||||
@ -777,6 +811,12 @@ class ToolRunner extends events.EventEmitter {
|
|||||||
resolve(exitCode);
|
resolve(exitCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (this.options.input) {
|
||||||
|
if (!cp.stdin) {
|
||||||
|
throw new Error('child process missing stdin');
|
||||||
|
}
|
||||||
|
cp.stdin.end(this.options.input);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -907,7 +947,1767 @@ class ExecState extends events.EventEmitter {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 60:
|
/***/ 16:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const compareBuild = (a, b, loose) => {
|
||||||
|
const versionA = new SemVer(a, loose)
|
||||||
|
const versionB = new SemVer(b, loose)
|
||||||
|
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
||||||
|
}
|
||||||
|
module.exports = compareBuild
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 31:
|
||||||
|
/***/ (function(module, 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 semver = __importStar(__webpack_require__(550));
|
||||||
|
const core_1 = __webpack_require__(470);
|
||||||
|
// needs to be require for core node modules to be mocked
|
||||||
|
/* eslint @typescript-eslint/no-require-imports: 0 */
|
||||||
|
const os = __webpack_require__(87);
|
||||||
|
const cp = __webpack_require__(129);
|
||||||
|
const fs = __webpack_require__(747);
|
||||||
|
function _findMatch(versionSpec, stable, candidates, archFilter) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const platFilter = os.platform();
|
||||||
|
let result;
|
||||||
|
let match;
|
||||||
|
let file;
|
||||||
|
for (const candidate of candidates) {
|
||||||
|
const version = candidate.version;
|
||||||
|
core_1.debug(`check ${version} satisfies ${versionSpec}`);
|
||||||
|
if (semver.satisfies(version, versionSpec) &&
|
||||||
|
(!stable || candidate.stable === stable)) {
|
||||||
|
file = candidate.files.find(item => {
|
||||||
|
core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
|
||||||
|
let chk = item.arch === archFilter && item.platform === platFilter;
|
||||||
|
if (chk && item.platform_version) {
|
||||||
|
const osVersion = module.exports._getOsVersion();
|
||||||
|
if (osVersion === item.platform_version) {
|
||||||
|
chk = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
chk = semver.satisfies(osVersion, item.platform_version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chk;
|
||||||
|
});
|
||||||
|
if (file) {
|
||||||
|
core_1.debug(`matched ${candidate.version}`);
|
||||||
|
match = candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (match && file) {
|
||||||
|
// clone since we're mutating the file list to be only the file that matches
|
||||||
|
result = Object.assign({}, match);
|
||||||
|
result.files = [file];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports._findMatch = _findMatch;
|
||||||
|
function _getOsVersion() {
|
||||||
|
// TODO: add windows and other linux, arm variants
|
||||||
|
// right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python)
|
||||||
|
const plat = os.platform();
|
||||||
|
let version = '';
|
||||||
|
if (plat === 'darwin') {
|
||||||
|
version = cp.execSync('sw_vers -productVersion').toString();
|
||||||
|
}
|
||||||
|
else if (plat === 'linux') {
|
||||||
|
// lsb_release process not in some containers, readfile
|
||||||
|
// Run cat /etc/lsb-release
|
||||||
|
// DISTRIB_ID=Ubuntu
|
||||||
|
// DISTRIB_RELEASE=18.04
|
||||||
|
// DISTRIB_CODENAME=bionic
|
||||||
|
// DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
|
||||||
|
const lsbContents = module.exports._readLinuxVersionFile();
|
||||||
|
if (lsbContents) {
|
||||||
|
const lines = lsbContents.split('\n');
|
||||||
|
for (const line of lines) {
|
||||||
|
const parts = line.split('=');
|
||||||
|
if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') {
|
||||||
|
version = parts[1].trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
exports._getOsVersion = _getOsVersion;
|
||||||
|
function _readLinuxVersionFile() {
|
||||||
|
const lsbFile = '/etc/lsb-release';
|
||||||
|
let contents = '';
|
||||||
|
if (fs.existsSync(lsbFile)) {
|
||||||
|
contents = fs.readFileSync(lsbFile).toString();
|
||||||
|
}
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
exports._readLinuxVersionFile = _readLinuxVersionFile;
|
||||||
|
//# sourceMappingURL=manifest.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 65:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const debug = __webpack_require__(548)
|
||||||
|
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(181)
|
||||||
|
const { re, t } = __webpack_require__(976)
|
||||||
|
|
||||||
|
const { compareIdentifiers } = __webpack_require__(760)
|
||||||
|
class SemVer {
|
||||||
|
constructor (version, options) {
|
||||||
|
if (!options || typeof options !== 'object') {
|
||||||
|
options = {
|
||||||
|
loose: !!options,
|
||||||
|
includePrerelease: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version instanceof SemVer) {
|
||||||
|
if (version.loose === !!options.loose &&
|
||||||
|
version.includePrerelease === !!options.includePrerelease) {
|
||||||
|
return version
|
||||||
|
} else {
|
||||||
|
version = version.version
|
||||||
|
}
|
||||||
|
} else if (typeof version !== 'string') {
|
||||||
|
throw new TypeError(`Invalid Version: ${version}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version.length > MAX_LENGTH) {
|
||||||
|
throw new TypeError(
|
||||||
|
`version is longer than ${MAX_LENGTH} characters`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('SemVer', version, options)
|
||||||
|
this.options = options
|
||||||
|
this.loose = !!options.loose
|
||||||
|
// this isn't actually relevant for versions, but keep it so that we
|
||||||
|
// don't run into trouble passing this.options around.
|
||||||
|
this.includePrerelease = !!options.includePrerelease
|
||||||
|
|
||||||
|
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||||
|
|
||||||
|
if (!m) {
|
||||||
|
throw new TypeError(`Invalid Version: ${version}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.raw = version
|
||||||
|
|
||||||
|
// these are actually numbers
|
||||||
|
this.major = +m[1]
|
||||||
|
this.minor = +m[2]
|
||||||
|
this.patch = +m[3]
|
||||||
|
|
||||||
|
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||||
|
throw new TypeError('Invalid major version')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||||
|
throw new TypeError('Invalid minor version')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||||
|
throw new TypeError('Invalid patch version')
|
||||||
|
}
|
||||||
|
|
||||||
|
// numberify any prerelease numeric ids
|
||||||
|
if (!m[4]) {
|
||||||
|
this.prerelease = []
|
||||||
|
} else {
|
||||||
|
this.prerelease = m[4].split('.').map((id) => {
|
||||||
|
if (/^[0-9]+$/.test(id)) {
|
||||||
|
const num = +id
|
||||||
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||||
|
return num
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.build = m[5] ? m[5].split('.') : []
|
||||||
|
this.format()
|
||||||
|
}
|
||||||
|
|
||||||
|
format () {
|
||||||
|
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||||
|
if (this.prerelease.length) {
|
||||||
|
this.version += `-${this.prerelease.join('.')}`
|
||||||
|
}
|
||||||
|
return this.version
|
||||||
|
}
|
||||||
|
|
||||||
|
toString () {
|
||||||
|
return this.version
|
||||||
|
}
|
||||||
|
|
||||||
|
compare (other) {
|
||||||
|
debug('SemVer.compare', this.version, this.options, other)
|
||||||
|
if (!(other instanceof SemVer)) {
|
||||||
|
if (typeof other === 'string' && other === this.version) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
other = new SemVer(other, this.options)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (other.version === this.version) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.compareMain(other) || this.comparePre(other)
|
||||||
|
}
|
||||||
|
|
||||||
|
compareMain (other) {
|
||||||
|
if (!(other instanceof SemVer)) {
|
||||||
|
other = new SemVer(other, this.options)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
compareIdentifiers(this.major, other.major) ||
|
||||||
|
compareIdentifiers(this.minor, other.minor) ||
|
||||||
|
compareIdentifiers(this.patch, other.patch)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
comparePre (other) {
|
||||||
|
if (!(other instanceof SemVer)) {
|
||||||
|
other = new SemVer(other, this.options)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOT having a prerelease is > having one
|
||||||
|
if (this.prerelease.length && !other.prerelease.length) {
|
||||||
|
return -1
|
||||||
|
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||||
|
return 1
|
||||||
|
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
let i = 0
|
||||||
|
do {
|
||||||
|
const a = this.prerelease[i]
|
||||||
|
const b = other.prerelease[i]
|
||||||
|
debug('prerelease compare', i, a, b)
|
||||||
|
if (a === undefined && b === undefined) {
|
||||||
|
return 0
|
||||||
|
} else if (b === undefined) {
|
||||||
|
return 1
|
||||||
|
} else if (a === undefined) {
|
||||||
|
return -1
|
||||||
|
} else if (a === b) {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
return compareIdentifiers(a, b)
|
||||||
|
}
|
||||||
|
} while (++i)
|
||||||
|
}
|
||||||
|
|
||||||
|
compareBuild (other) {
|
||||||
|
if (!(other instanceof SemVer)) {
|
||||||
|
other = new SemVer(other, this.options)
|
||||||
|
}
|
||||||
|
|
||||||
|
let i = 0
|
||||||
|
do {
|
||||||
|
const a = this.build[i]
|
||||||
|
const b = other.build[i]
|
||||||
|
debug('prerelease compare', i, a, b)
|
||||||
|
if (a === undefined && b === undefined) {
|
||||||
|
return 0
|
||||||
|
} else if (b === undefined) {
|
||||||
|
return 1
|
||||||
|
} else if (a === undefined) {
|
||||||
|
return -1
|
||||||
|
} else if (a === b) {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
return compareIdentifiers(a, b)
|
||||||
|
}
|
||||||
|
} while (++i)
|
||||||
|
}
|
||||||
|
|
||||||
|
// preminor will bump the version up to the next minor release, and immediately
|
||||||
|
// down to pre-release. premajor and prepatch work the same way.
|
||||||
|
inc (release, identifier) {
|
||||||
|
switch (release) {
|
||||||
|
case 'premajor':
|
||||||
|
this.prerelease.length = 0
|
||||||
|
this.patch = 0
|
||||||
|
this.minor = 0
|
||||||
|
this.major++
|
||||||
|
this.inc('pre', identifier)
|
||||||
|
break
|
||||||
|
case 'preminor':
|
||||||
|
this.prerelease.length = 0
|
||||||
|
this.patch = 0
|
||||||
|
this.minor++
|
||||||
|
this.inc('pre', identifier)
|
||||||
|
break
|
||||||
|
case 'prepatch':
|
||||||
|
// If this is already a prerelease, it will bump to the next version
|
||||||
|
// drop any prereleases that might already exist, since they are not
|
||||||
|
// relevant at this point.
|
||||||
|
this.prerelease.length = 0
|
||||||
|
this.inc('patch', identifier)
|
||||||
|
this.inc('pre', identifier)
|
||||||
|
break
|
||||||
|
// If the input is a non-prerelease version, this acts the same as
|
||||||
|
// prepatch.
|
||||||
|
case 'prerelease':
|
||||||
|
if (this.prerelease.length === 0) {
|
||||||
|
this.inc('patch', identifier)
|
||||||
|
}
|
||||||
|
this.inc('pre', identifier)
|
||||||
|
break
|
||||||
|
|
||||||
|
case 'major':
|
||||||
|
// If this is a pre-major version, bump up to the same major version.
|
||||||
|
// Otherwise increment major.
|
||||||
|
// 1.0.0-5 bumps to 1.0.0
|
||||||
|
// 1.1.0 bumps to 2.0.0
|
||||||
|
if (
|
||||||
|
this.minor !== 0 ||
|
||||||
|
this.patch !== 0 ||
|
||||||
|
this.prerelease.length === 0
|
||||||
|
) {
|
||||||
|
this.major++
|
||||||
|
}
|
||||||
|
this.minor = 0
|
||||||
|
this.patch = 0
|
||||||
|
this.prerelease = []
|
||||||
|
break
|
||||||
|
case 'minor':
|
||||||
|
// If this is a pre-minor version, bump up to the same minor version.
|
||||||
|
// Otherwise increment minor.
|
||||||
|
// 1.2.0-5 bumps to 1.2.0
|
||||||
|
// 1.2.1 bumps to 1.3.0
|
||||||
|
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||||
|
this.minor++
|
||||||
|
}
|
||||||
|
this.patch = 0
|
||||||
|
this.prerelease = []
|
||||||
|
break
|
||||||
|
case 'patch':
|
||||||
|
// If this is not a pre-release version, it will increment the patch.
|
||||||
|
// If it is a pre-release it will bump up to the same patch version.
|
||||||
|
// 1.2.0-5 patches to 1.2.0
|
||||||
|
// 1.2.0 patches to 1.2.1
|
||||||
|
if (this.prerelease.length === 0) {
|
||||||
|
this.patch++
|
||||||
|
}
|
||||||
|
this.prerelease = []
|
||||||
|
break
|
||||||
|
// This probably shouldn't be used publicly.
|
||||||
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||||
|
case 'pre':
|
||||||
|
if (this.prerelease.length === 0) {
|
||||||
|
this.prerelease = [0]
|
||||||
|
} else {
|
||||||
|
let i = this.prerelease.length
|
||||||
|
while (--i >= 0) {
|
||||||
|
if (typeof this.prerelease[i] === 'number') {
|
||||||
|
this.prerelease[i]++
|
||||||
|
i = -2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i === -1) {
|
||||||
|
// didn't increment anything
|
||||||
|
this.prerelease.push(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (identifier) {
|
||||||
|
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||||
|
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||||
|
if (this.prerelease[0] === identifier) {
|
||||||
|
if (isNaN(this.prerelease[1])) {
|
||||||
|
this.prerelease = [identifier, 0]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.prerelease = [identifier, 0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`invalid increment argument: ${release}`)
|
||||||
|
}
|
||||||
|
this.format()
|
||||||
|
this.raw = this.version
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = SemVer
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 87:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("os");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 120:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compareBuild = __webpack_require__(16)
|
||||||
|
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
|
||||||
|
module.exports = sort
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 124:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
// hoisted class for cyclic dependency
|
||||||
|
class Range {
|
||||||
|
constructor (range, options) {
|
||||||
|
if (!options || typeof options !== 'object') {
|
||||||
|
options = {
|
||||||
|
loose: !!options,
|
||||||
|
includePrerelease: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (range instanceof Range) {
|
||||||
|
if (
|
||||||
|
range.loose === !!options.loose &&
|
||||||
|
range.includePrerelease === !!options.includePrerelease
|
||||||
|
) {
|
||||||
|
return range
|
||||||
|
} else {
|
||||||
|
return new Range(range.raw, options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (range instanceof Comparator) {
|
||||||
|
// just put it in the set and return
|
||||||
|
this.raw = range.value
|
||||||
|
this.set = [[range]]
|
||||||
|
this.format()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
this.options = options
|
||||||
|
this.loose = !!options.loose
|
||||||
|
this.includePrerelease = !!options.includePrerelease
|
||||||
|
|
||||||
|
// First, split based on boolean or ||
|
||||||
|
this.raw = range
|
||||||
|
this.set = range
|
||||||
|
.split(/\s*\|\|\s*/)
|
||||||
|
// map the range to a 2d array of comparators
|
||||||
|
.map(range => this.parseRange(range.trim()))
|
||||||
|
// throw out any comparator lists that are empty
|
||||||
|
// this generally means that it was not a valid range, which is allowed
|
||||||
|
// in loose mode, but will still throw if the WHOLE range is invalid.
|
||||||
|
.filter(c => c.length)
|
||||||
|
|
||||||
|
if (!this.set.length) {
|
||||||
|
throw new TypeError(`Invalid SemVer Range: ${range}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.format()
|
||||||
|
}
|
||||||
|
|
||||||
|
format () {
|
||||||
|
this.range = this.set
|
||||||
|
.map((comps) => {
|
||||||
|
return comps.join(' ').trim()
|
||||||
|
})
|
||||||
|
.join('||')
|
||||||
|
.trim()
|
||||||
|
return this.range
|
||||||
|
}
|
||||||
|
|
||||||
|
toString () {
|
||||||
|
return this.range
|
||||||
|
}
|
||||||
|
|
||||||
|
parseRange (range) {
|
||||||
|
const loose = this.options.loose
|
||||||
|
range = range.trim()
|
||||||
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||||
|
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||||
|
range = range.replace(hr, hyphenReplace)
|
||||||
|
debug('hyphen replace', range)
|
||||||
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||||
|
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||||
|
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||||
|
|
||||||
|
// `~ 1.2.3` => `~1.2.3`
|
||||||
|
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||||
|
|
||||||
|
// `^ 1.2.3` => `^1.2.3`
|
||||||
|
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||||
|
|
||||||
|
// normalize spaces
|
||||||
|
range = range.split(/\s+/).join(' ')
|
||||||
|
|
||||||
|
// At this point, the range is completely trimmed and
|
||||||
|
// ready to be split into comparators.
|
||||||
|
|
||||||
|
const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||||
|
return range
|
||||||
|
.split(' ')
|
||||||
|
.map(comp => parseComparator(comp, this.options))
|
||||||
|
.join(' ')
|
||||||
|
.split(/\s+/)
|
||||||
|
// in loose mode, throw out any that are not valid comparators
|
||||||
|
.filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
|
||||||
|
.map(comp => new Comparator(comp, this.options))
|
||||||
|
}
|
||||||
|
|
||||||
|
intersects (range, options) {
|
||||||
|
if (!(range instanceof Range)) {
|
||||||
|
throw new TypeError('a Range is required')
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.set.some((thisComparators) => {
|
||||||
|
return (
|
||||||
|
isSatisfiable(thisComparators, options) &&
|
||||||
|
range.set.some((rangeComparators) => {
|
||||||
|
return (
|
||||||
|
isSatisfiable(rangeComparators, options) &&
|
||||||
|
thisComparators.every((thisComparator) => {
|
||||||
|
return rangeComparators.every((rangeComparator) => {
|
||||||
|
return thisComparator.intersects(rangeComparator, options)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ANY of the sets match ALL of its comparators, then pass
|
||||||
|
test (version) {
|
||||||
|
if (!version) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof version === 'string') {
|
||||||
|
try {
|
||||||
|
version = new SemVer(version, this.options)
|
||||||
|
} catch (er) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this.set.length; i++) {
|
||||||
|
if (testSet(this.set[i], version, this.options)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = Range
|
||||||
|
|
||||||
|
const Comparator = __webpack_require__(174)
|
||||||
|
const debug = __webpack_require__(548)
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const {
|
||||||
|
re,
|
||||||
|
t,
|
||||||
|
comparatorTrimReplace,
|
||||||
|
tildeTrimReplace,
|
||||||
|
caretTrimReplace
|
||||||
|
} = __webpack_require__(976)
|
||||||
|
|
||||||
|
// take a set of comparators and determine whether there
|
||||||
|
// exists a version which can satisfy it
|
||||||
|
const isSatisfiable = (comparators, options) => {
|
||||||
|
let result = true
|
||||||
|
const remainingComparators = comparators.slice()
|
||||||
|
let testComparator = remainingComparators.pop()
|
||||||
|
|
||||||
|
while (result && remainingComparators.length) {
|
||||||
|
result = remainingComparators.every((otherComparator) => {
|
||||||
|
return testComparator.intersects(otherComparator, options)
|
||||||
|
})
|
||||||
|
|
||||||
|
testComparator = remainingComparators.pop()
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||||
|
// already replaced the hyphen ranges
|
||||||
|
// turn into a set of JUST comparators.
|
||||||
|
const parseComparator = (comp, options) => {
|
||||||
|
debug('comp', comp, options)
|
||||||
|
comp = replaceCarets(comp, options)
|
||||||
|
debug('caret', comp)
|
||||||
|
comp = replaceTildes(comp, options)
|
||||||
|
debug('tildes', comp)
|
||||||
|
comp = replaceXRanges(comp, options)
|
||||||
|
debug('xrange', comp)
|
||||||
|
comp = replaceStars(comp, options)
|
||||||
|
debug('stars', comp)
|
||||||
|
return comp
|
||||||
|
}
|
||||||
|
|
||||||
|
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
||||||
|
|
||||||
|
// ~, ~> --> * (any, kinda silly)
|
||||||
|
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
||||||
|
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
||||||
|
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
||||||
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
||||||
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
||||||
|
const replaceTildes = (comp, options) =>
|
||||||
|
comp.trim().split(/\s+/).map((comp) => {
|
||||||
|
return replaceTilde(comp, options)
|
||||||
|
}).join(' ')
|
||||||
|
|
||||||
|
const replaceTilde = (comp, options) => {
|
||||||
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||||
|
return comp.replace(r, (_, M, m, p, pr) => {
|
||||||
|
debug('tilde', comp, _, M, m, p, pr)
|
||||||
|
let ret
|
||||||
|
|
||||||
|
if (isX(M)) {
|
||||||
|
ret = ''
|
||||||
|
} else if (isX(m)) {
|
||||||
|
ret = `>=${M}.0.0 <${+M + 1}.0.0`
|
||||||
|
} else if (isX(p)) {
|
||||||
|
// ~1.2 == >=1.2.0 <1.3.0
|
||||||
|
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0`
|
||||||
|
} else if (pr) {
|
||||||
|
debug('replaceTilde pr', pr)
|
||||||
|
ret = `>=${M}.${m}.${p}-${pr
|
||||||
|
} <${M}.${+m + 1}.0`
|
||||||
|
} else {
|
||||||
|
// ~1.2.3 == >=1.2.3 <1.3.0
|
||||||
|
ret = `>=${M}.${m}.${p
|
||||||
|
} <${M}.${+m + 1}.0`
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('tilde return', ret)
|
||||||
|
return ret
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ^ --> * (any, kinda silly)
|
||||||
|
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
||||||
|
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
||||||
|
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
||||||
|
// ^1.2.3 --> >=1.2.3 <2.0.0
|
||||||
|
// ^1.2.0 --> >=1.2.0 <2.0.0
|
||||||
|
const replaceCarets = (comp, options) =>
|
||||||
|
comp.trim().split(/\s+/).map((comp) => {
|
||||||
|
return replaceCaret(comp, options)
|
||||||
|
}).join(' ')
|
||||||
|
|
||||||
|
const replaceCaret = (comp, options) => {
|
||||||
|
debug('caret', comp, options)
|
||||||
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||||
|
return comp.replace(r, (_, M, m, p, pr) => {
|
||||||
|
debug('caret', comp, _, M, m, p, pr)
|
||||||
|
let ret
|
||||||
|
|
||||||
|
if (isX(M)) {
|
||||||
|
ret = ''
|
||||||
|
} else if (isX(m)) {
|
||||||
|
ret = `>=${M}.0.0 <${+M + 1}.0.0`
|
||||||
|
} else if (isX(p)) {
|
||||||
|
if (M === '0') {
|
||||||
|
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0`
|
||||||
|
} else {
|
||||||
|
ret = `>=${M}.${m}.0 <${+M + 1}.0.0`
|
||||||
|
}
|
||||||
|
} else if (pr) {
|
||||||
|
debug('replaceCaret pr', pr)
|
||||||
|
if (M === '0') {
|
||||||
|
if (m === '0') {
|
||||||
|
ret = `>=${M}.${m}.${p}-${pr
|
||||||
|
} <${M}.${m}.${+p + 1}`
|
||||||
|
} else {
|
||||||
|
ret = `>=${M}.${m}.${p}-${pr
|
||||||
|
} <${M}.${+m + 1}.0`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = `>=${M}.${m}.${p}-${pr
|
||||||
|
} <${+M + 1}.0.0`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
debug('no pr')
|
||||||
|
if (M === '0') {
|
||||||
|
if (m === '0') {
|
||||||
|
ret = `>=${M}.${m}.${p
|
||||||
|
} <${M}.${m}.${+p + 1}`
|
||||||
|
} else {
|
||||||
|
ret = `>=${M}.${m}.${p
|
||||||
|
} <${M}.${+m + 1}.0`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = `>=${M}.${m}.${p
|
||||||
|
} <${+M + 1}.0.0`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('caret return', ret)
|
||||||
|
return ret
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const replaceXRanges = (comp, options) => {
|
||||||
|
debug('replaceXRanges', comp, options)
|
||||||
|
return comp.split(/\s+/).map((comp) => {
|
||||||
|
return replaceXRange(comp, options)
|
||||||
|
}).join(' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
const replaceXRange = (comp, options) => {
|
||||||
|
comp = comp.trim()
|
||||||
|
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||||
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
||||||
|
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||||
|
const xM = isX(M)
|
||||||
|
const xm = xM || isX(m)
|
||||||
|
const xp = xm || isX(p)
|
||||||
|
const anyX = xp
|
||||||
|
|
||||||
|
if (gtlt === '=' && anyX) {
|
||||||
|
gtlt = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're including prereleases in the match, then we need
|
||||||
|
// to fix this to -0, the lowest possible prerelease value
|
||||||
|
pr = options.includePrerelease ? '-0' : ''
|
||||||
|
|
||||||
|
if (xM) {
|
||||||
|
if (gtlt === '>' || gtlt === '<') {
|
||||||
|
// nothing is allowed
|
||||||
|
ret = '<0.0.0-0'
|
||||||
|
} else {
|
||||||
|
// nothing is forbidden
|
||||||
|
ret = '*'
|
||||||
|
}
|
||||||
|
} else if (gtlt && anyX) {
|
||||||
|
// we know patch is an x, because we have any x at all.
|
||||||
|
// replace X with 0
|
||||||
|
if (xm) {
|
||||||
|
m = 0
|
||||||
|
}
|
||||||
|
p = 0
|
||||||
|
|
||||||
|
if (gtlt === '>') {
|
||||||
|
// >1 => >=2.0.0
|
||||||
|
// >1.2 => >=1.3.0
|
||||||
|
gtlt = '>='
|
||||||
|
if (xm) {
|
||||||
|
M = +M + 1
|
||||||
|
m = 0
|
||||||
|
p = 0
|
||||||
|
} else {
|
||||||
|
m = +m + 1
|
||||||
|
p = 0
|
||||||
|
}
|
||||||
|
} else if (gtlt === '<=') {
|
||||||
|
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||||
|
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||||
|
gtlt = '<'
|
||||||
|
if (xm) {
|
||||||
|
M = +M + 1
|
||||||
|
} else {
|
||||||
|
m = +m + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = `${gtlt + M}.${m}.${p}${pr}`
|
||||||
|
} else if (xm) {
|
||||||
|
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0${pr}`
|
||||||
|
} else if (xp) {
|
||||||
|
ret = `>=${M}.${m}.0${pr
|
||||||
|
} <${M}.${+m + 1}.0${pr}`
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('xRange return', ret)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Because * is AND-ed with everything else in the comparator,
|
||||||
|
// and '' means "any version", just remove the *s entirely.
|
||||||
|
const replaceStars = (comp, options) => {
|
||||||
|
debug('replaceStars', comp, options)
|
||||||
|
// Looseness is ignored here. star is always as loose as it gets!
|
||||||
|
return comp.trim().replace(re[t.STAR], '')
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||||
|
// M, m, patch, prerelease, build
|
||||||
|
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||||
|
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
||||||
|
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
||||||
|
const hyphenReplace = ($0,
|
||||||
|
from, fM, fm, fp, fpr, fb,
|
||||||
|
to, tM, tm, tp, tpr, tb) => {
|
||||||
|
if (isX(fM)) {
|
||||||
|
from = ''
|
||||||
|
} else if (isX(fm)) {
|
||||||
|
from = `>=${fM}.0.0`
|
||||||
|
} else if (isX(fp)) {
|
||||||
|
from = `>=${fM}.${fm}.0`
|
||||||
|
} else {
|
||||||
|
from = `>=${from}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isX(tM)) {
|
||||||
|
to = ''
|
||||||
|
} else if (isX(tm)) {
|
||||||
|
to = `<${+tM + 1}.0.0`
|
||||||
|
} else if (isX(tp)) {
|
||||||
|
to = `<${tM}.${+tm + 1}.0`
|
||||||
|
} else if (tpr) {
|
||||||
|
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
||||||
|
} else {
|
||||||
|
to = `<=${to}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return (`${from} ${to}`).trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
const testSet = (set, version, options) => {
|
||||||
|
for (let i = 0; i < set.length; i++) {
|
||||||
|
if (!set[i].test(version)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version.prerelease.length && !options.includePrerelease) {
|
||||||
|
// Find the set of versions that are allowed to have prereleases
|
||||||
|
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||||
|
// That should allow `1.2.3-pr.2` to pass.
|
||||||
|
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
||||||
|
// even though it's within the range set by the comparators.
|
||||||
|
for (let i = 0; i < set.length; i++) {
|
||||||
|
debug(set[i].semver)
|
||||||
|
if (set[i].semver === Comparator.ANY) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set[i].semver.prerelease.length > 0) {
|
||||||
|
const allowed = set[i].semver
|
||||||
|
if (allowed.major === version.major &&
|
||||||
|
allowed.minor === version.minor &&
|
||||||
|
allowed.patch === version.patch) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version has a -pre, but it's not one of the ones we like.
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 129:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("child_process");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 139:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
// Unique ID creation requires a high quality random # generator. In node.js
|
||||||
|
// this is pretty straight-forward - we use the crypto API.
|
||||||
|
|
||||||
|
var crypto = __webpack_require__(417);
|
||||||
|
|
||||||
|
module.exports = function nodeRNG() {
|
||||||
|
return crypto.randomBytes(16);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 141:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
|
var net = __webpack_require__(631);
|
||||||
|
var tls = __webpack_require__(818);
|
||||||
|
var http = __webpack_require__(605);
|
||||||
|
var https = __webpack_require__(211);
|
||||||
|
var events = __webpack_require__(614);
|
||||||
|
var assert = __webpack_require__(357);
|
||||||
|
var util = __webpack_require__(669);
|
||||||
|
|
||||||
|
|
||||||
|
exports.httpOverHttp = httpOverHttp;
|
||||||
|
exports.httpsOverHttp = httpsOverHttp;
|
||||||
|
exports.httpOverHttps = httpOverHttps;
|
||||||
|
exports.httpsOverHttps = httpsOverHttps;
|
||||||
|
|
||||||
|
|
||||||
|
function httpOverHttp(options) {
|
||||||
|
var agent = new TunnelingAgent(options);
|
||||||
|
agent.request = http.request;
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
function httpsOverHttp(options) {
|
||||||
|
var agent = new TunnelingAgent(options);
|
||||||
|
agent.request = http.request;
|
||||||
|
agent.createSocket = createSecureSocket;
|
||||||
|
agent.defaultPort = 443;
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
function httpOverHttps(options) {
|
||||||
|
var agent = new TunnelingAgent(options);
|
||||||
|
agent.request = https.request;
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
function httpsOverHttps(options) {
|
||||||
|
var agent = new TunnelingAgent(options);
|
||||||
|
agent.request = https.request;
|
||||||
|
agent.createSocket = createSecureSocket;
|
||||||
|
agent.defaultPort = 443;
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function TunnelingAgent(options) {
|
||||||
|
var self = this;
|
||||||
|
self.options = options || {};
|
||||||
|
self.proxyOptions = self.options.proxy || {};
|
||||||
|
self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
|
||||||
|
self.requests = [];
|
||||||
|
self.sockets = [];
|
||||||
|
|
||||||
|
self.on('free', function onFree(socket, host, port, localAddress) {
|
||||||
|
var options = toOptions(host, port, localAddress);
|
||||||
|
for (var i = 0, len = self.requests.length; i < len; ++i) {
|
||||||
|
var pending = self.requests[i];
|
||||||
|
if (pending.host === options.host && pending.port === options.port) {
|
||||||
|
// Detect the request to connect same origin server,
|
||||||
|
// reuse the connection.
|
||||||
|
self.requests.splice(i, 1);
|
||||||
|
pending.request.onSocket(socket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.destroy();
|
||||||
|
self.removeSocket(socket);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
util.inherits(TunnelingAgent, events.EventEmitter);
|
||||||
|
|
||||||
|
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
|
||||||
|
var self = this;
|
||||||
|
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
|
||||||
|
|
||||||
|
if (self.sockets.length >= this.maxSockets) {
|
||||||
|
// We are over limit so we'll add it to the queue.
|
||||||
|
self.requests.push(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are under maxSockets create a new one.
|
||||||
|
self.createSocket(options, function(socket) {
|
||||||
|
socket.on('free', onFree);
|
||||||
|
socket.on('close', onCloseOrRemove);
|
||||||
|
socket.on('agentRemove', onCloseOrRemove);
|
||||||
|
req.onSocket(socket);
|
||||||
|
|
||||||
|
function onFree() {
|
||||||
|
self.emit('free', socket, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onCloseOrRemove(err) {
|
||||||
|
self.removeSocket(socket);
|
||||||
|
socket.removeListener('free', onFree);
|
||||||
|
socket.removeListener('close', onCloseOrRemove);
|
||||||
|
socket.removeListener('agentRemove', onCloseOrRemove);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
|
||||||
|
var self = this;
|
||||||
|
var placeholder = {};
|
||||||
|
self.sockets.push(placeholder);
|
||||||
|
|
||||||
|
var connectOptions = mergeOptions({}, self.proxyOptions, {
|
||||||
|
method: 'CONNECT',
|
||||||
|
path: options.host + ':' + options.port,
|
||||||
|
agent: false,
|
||||||
|
headers: {
|
||||||
|
host: options.host + ':' + options.port
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (options.localAddress) {
|
||||||
|
connectOptions.localAddress = options.localAddress;
|
||||||
|
}
|
||||||
|
if (connectOptions.proxyAuth) {
|
||||||
|
connectOptions.headers = connectOptions.headers || {};
|
||||||
|
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
|
||||||
|
new Buffer(connectOptions.proxyAuth).toString('base64');
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('making CONNECT request');
|
||||||
|
var connectReq = self.request(connectOptions);
|
||||||
|
connectReq.useChunkedEncodingByDefault = false; // for v0.6
|
||||||
|
connectReq.once('response', onResponse); // for v0.6
|
||||||
|
connectReq.once('upgrade', onUpgrade); // for v0.6
|
||||||
|
connectReq.once('connect', onConnect); // for v0.7 or later
|
||||||
|
connectReq.once('error', onError);
|
||||||
|
connectReq.end();
|
||||||
|
|
||||||
|
function onResponse(res) {
|
||||||
|
// Very hacky. This is necessary to avoid http-parser leaks.
|
||||||
|
res.upgrade = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onUpgrade(res, socket, head) {
|
||||||
|
// Hacky.
|
||||||
|
process.nextTick(function() {
|
||||||
|
onConnect(res, socket, head);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onConnect(res, socket, head) {
|
||||||
|
connectReq.removeAllListeners();
|
||||||
|
socket.removeAllListeners();
|
||||||
|
|
||||||
|
if (res.statusCode !== 200) {
|
||||||
|
debug('tunneling socket could not be established, statusCode=%d',
|
||||||
|
res.statusCode);
|
||||||
|
socket.destroy();
|
||||||
|
var error = new Error('tunneling socket could not be established, ' +
|
||||||
|
'statusCode=' + res.statusCode);
|
||||||
|
error.code = 'ECONNRESET';
|
||||||
|
options.request.emit('error', error);
|
||||||
|
self.removeSocket(placeholder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (head.length > 0) {
|
||||||
|
debug('got illegal response body from proxy');
|
||||||
|
socket.destroy();
|
||||||
|
var error = new Error('got illegal response body from proxy');
|
||||||
|
error.code = 'ECONNRESET';
|
||||||
|
options.request.emit('error', error);
|
||||||
|
self.removeSocket(placeholder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
debug('tunneling connection has established');
|
||||||
|
self.sockets[self.sockets.indexOf(placeholder)] = socket;
|
||||||
|
return cb(socket);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onError(cause) {
|
||||||
|
connectReq.removeAllListeners();
|
||||||
|
|
||||||
|
debug('tunneling socket could not be established, cause=%s\n',
|
||||||
|
cause.message, cause.stack);
|
||||||
|
var error = new Error('tunneling socket could not be established, ' +
|
||||||
|
'cause=' + cause.message);
|
||||||
|
error.code = 'ECONNRESET';
|
||||||
|
options.request.emit('error', error);
|
||||||
|
self.removeSocket(placeholder);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
|
||||||
|
var pos = this.sockets.indexOf(socket)
|
||||||
|
if (pos === -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.sockets.splice(pos, 1);
|
||||||
|
|
||||||
|
var pending = this.requests.shift();
|
||||||
|
if (pending) {
|
||||||
|
// If we have pending requests and a socket gets closed a new one
|
||||||
|
// needs to be created to take over in the pool for the one that closed.
|
||||||
|
this.createSocket(pending, function(socket) {
|
||||||
|
pending.request.onSocket(socket);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function createSecureSocket(options, cb) {
|
||||||
|
var self = this;
|
||||||
|
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
|
||||||
|
var hostHeader = options.request.getHeader('host');
|
||||||
|
var tlsOptions = mergeOptions({}, self.options, {
|
||||||
|
socket: socket,
|
||||||
|
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
|
||||||
|
});
|
||||||
|
|
||||||
|
// 0 is dummy port for v0.6
|
||||||
|
var secureSocket = tls.connect(0, tlsOptions);
|
||||||
|
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
|
||||||
|
cb(secureSocket);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function toOptions(host, port, localAddress) {
|
||||||
|
if (typeof host === 'string') { // since v0.10
|
||||||
|
return {
|
||||||
|
host: host,
|
||||||
|
port: port,
|
||||||
|
localAddress: localAddress
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return host; // for v0.11 or later
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeOptions(target) {
|
||||||
|
for (var i = 1, len = arguments.length; i < len; ++i) {
|
||||||
|
var overrides = arguments[i];
|
||||||
|
if (typeof overrides === 'object') {
|
||||||
|
var keys = Object.keys(overrides);
|
||||||
|
for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
|
||||||
|
var k = keys[j];
|
||||||
|
if (overrides[k] !== undefined) {
|
||||||
|
target[k] = overrides[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var debug;
|
||||||
|
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
||||||
|
debug = function() {
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
if (typeof args[0] === 'string') {
|
||||||
|
args[0] = 'TUNNEL: ' + args[0];
|
||||||
|
} else {
|
||||||
|
args.unshift('TUNNEL:');
|
||||||
|
}
|
||||||
|
console.error.apply(console, args);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
debug = function() {};
|
||||||
|
}
|
||||||
|
exports.debug = debug; // for test
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 164:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
const gt = __webpack_require__(486)
|
||||||
|
|
||||||
|
const minVersion = (range, loose) => {
|
||||||
|
range = new Range(range, loose)
|
||||||
|
|
||||||
|
let minver = new SemVer('0.0.0')
|
||||||
|
if (range.test(minver)) {
|
||||||
|
return minver
|
||||||
|
}
|
||||||
|
|
||||||
|
minver = new SemVer('0.0.0-0')
|
||||||
|
if (range.test(minver)) {
|
||||||
|
return minver
|
||||||
|
}
|
||||||
|
|
||||||
|
minver = null
|
||||||
|
for (let i = 0; i < range.set.length; ++i) {
|
||||||
|
const comparators = range.set[i]
|
||||||
|
|
||||||
|
comparators.forEach((comparator) => {
|
||||||
|
// Clone to avoid manipulating the comparator's semver object.
|
||||||
|
const compver = new SemVer(comparator.semver.version)
|
||||||
|
switch (comparator.operator) {
|
||||||
|
case '>':
|
||||||
|
if (compver.prerelease.length === 0) {
|
||||||
|
compver.patch++
|
||||||
|
} else {
|
||||||
|
compver.prerelease.push(0)
|
||||||
|
}
|
||||||
|
compver.raw = compver.format()
|
||||||
|
/* fallthrough */
|
||||||
|
case '':
|
||||||
|
case '>=':
|
||||||
|
if (!minver || gt(minver, compver)) {
|
||||||
|
minver = compver
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case '<':
|
||||||
|
case '<=':
|
||||||
|
/* Ignore maximum versions */
|
||||||
|
break
|
||||||
|
/* istanbul ignore next */
|
||||||
|
default:
|
||||||
|
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minver && range.test(minver)) {
|
||||||
|
return minver
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
module.exports = minVersion
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 167:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const gte = (a, b, loose) => compare(a, b, loose) >= 0
|
||||||
|
module.exports = gte
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 174:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const ANY = Symbol('SemVer ANY')
|
||||||
|
// hoisted class for cyclic dependency
|
||||||
|
class Comparator {
|
||||||
|
static get ANY () {
|
||||||
|
return ANY
|
||||||
|
}
|
||||||
|
constructor (comp, options) {
|
||||||
|
if (!options || typeof options !== 'object') {
|
||||||
|
options = {
|
||||||
|
loose: !!options,
|
||||||
|
includePrerelease: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (comp instanceof Comparator) {
|
||||||
|
if (comp.loose === !!options.loose) {
|
||||||
|
return comp
|
||||||
|
} else {
|
||||||
|
comp = comp.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('comparator', comp, options)
|
||||||
|
this.options = options
|
||||||
|
this.loose = !!options.loose
|
||||||
|
this.parse(comp)
|
||||||
|
|
||||||
|
if (this.semver === ANY) {
|
||||||
|
this.value = ''
|
||||||
|
} else {
|
||||||
|
this.value = this.operator + this.semver.version
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('comp', this)
|
||||||
|
}
|
||||||
|
|
||||||
|
parse (comp) {
|
||||||
|
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||||
|
const m = comp.match(r)
|
||||||
|
|
||||||
|
if (!m) {
|
||||||
|
throw new TypeError(`Invalid comparator: ${comp}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.operator = m[1] !== undefined ? m[1] : ''
|
||||||
|
if (this.operator === '=') {
|
||||||
|
this.operator = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it literally is just '>' or '' then allow anything.
|
||||||
|
if (!m[2]) {
|
||||||
|
this.semver = ANY
|
||||||
|
} else {
|
||||||
|
this.semver = new SemVer(m[2], this.options.loose)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toString () {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
|
||||||
|
test (version) {
|
||||||
|
debug('Comparator.test', version, this.options.loose)
|
||||||
|
|
||||||
|
if (this.semver === ANY || version === ANY) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof version === 'string') {
|
||||||
|
try {
|
||||||
|
version = new SemVer(version, this.options)
|
||||||
|
} catch (er) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmp(version, this.operator, this.semver, this.options)
|
||||||
|
}
|
||||||
|
|
||||||
|
intersects (comp, options) {
|
||||||
|
if (!(comp instanceof Comparator)) {
|
||||||
|
throw new TypeError('a Comparator is required')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || typeof options !== 'object') {
|
||||||
|
options = {
|
||||||
|
loose: !!options,
|
||||||
|
includePrerelease: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.operator === '') {
|
||||||
|
if (this.value === '') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return new Range(comp.value, options).test(this.value)
|
||||||
|
} else if (comp.operator === '') {
|
||||||
|
if (comp.value === '') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return new Range(this.value, options).test(comp.semver)
|
||||||
|
}
|
||||||
|
|
||||||
|
const sameDirectionIncreasing =
|
||||||
|
(this.operator === '>=' || this.operator === '>') &&
|
||||||
|
(comp.operator === '>=' || comp.operator === '>')
|
||||||
|
const sameDirectionDecreasing =
|
||||||
|
(this.operator === '<=' || this.operator === '<') &&
|
||||||
|
(comp.operator === '<=' || comp.operator === '<')
|
||||||
|
const sameSemVer = this.semver.version === comp.semver.version
|
||||||
|
const differentDirectionsInclusive =
|
||||||
|
(this.operator === '>=' || this.operator === '<=') &&
|
||||||
|
(comp.operator === '>=' || comp.operator === '<=')
|
||||||
|
const oppositeDirectionsLessThan =
|
||||||
|
cmp(this.semver, '<', comp.semver, options) &&
|
||||||
|
(this.operator === '>=' || this.operator === '>') &&
|
||||||
|
(comp.operator === '<=' || comp.operator === '<')
|
||||||
|
const oppositeDirectionsGreaterThan =
|
||||||
|
cmp(this.semver, '>', comp.semver, options) &&
|
||||||
|
(this.operator === '<=' || this.operator === '<') &&
|
||||||
|
(comp.operator === '>=' || comp.operator === '>')
|
||||||
|
|
||||||
|
return (
|
||||||
|
sameDirectionIncreasing ||
|
||||||
|
sameDirectionDecreasing ||
|
||||||
|
(sameSemVer && differentDirectionsInclusive) ||
|
||||||
|
oppositeDirectionsLessThan ||
|
||||||
|
oppositeDirectionsGreaterThan
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Comparator
|
||||||
|
|
||||||
|
const {re, t} = __webpack_require__(976)
|
||||||
|
const cmp = __webpack_require__(752)
|
||||||
|
const debug = __webpack_require__(548)
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 175:
|
||||||
|
/***/ (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 core = __importStar(__webpack_require__(470));
|
||||||
|
const finder = __importStar(__webpack_require__(927));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
function run() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
let version = core.getInput('python-version');
|
||||||
|
if (version) {
|
||||||
|
const arch = core.getInput('architecture') || os.arch();
|
||||||
|
const installed = yield finder.findPythonVersion(version, arch);
|
||||||
|
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
|
||||||
|
}
|
||||||
|
const matchersPath = path.join(__dirname, '..', '.github');
|
||||||
|
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.setFailed(err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
run();
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 181:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
// Note: this is the semver.org version of the spec that it implements
|
||||||
|
// Not necessarily the package version of this code.
|
||||||
|
const SEMVER_SPEC_VERSION = '2.0.0'
|
||||||
|
|
||||||
|
const MAX_LENGTH = 256
|
||||||
|
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||||
|
/* istanbul ignore next */ 9007199254740991
|
||||||
|
|
||||||
|
// Max safe segment length for coercion.
|
||||||
|
const MAX_SAFE_COMPONENT_LENGTH = 16
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
SEMVER_SPEC_VERSION,
|
||||||
|
MAX_LENGTH,
|
||||||
|
MAX_SAFE_INTEGER,
|
||||||
|
MAX_SAFE_COMPONENT_LENGTH
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 211:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("https");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 219:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
|
||||||
|
// Mostly just for testing and legacy API reasons
|
||||||
|
const toComparators = (range, options) =>
|
||||||
|
new Range(range, options).set
|
||||||
|
.map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
|
||||||
|
|
||||||
|
module.exports = toComparators
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 259:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
const intersects = (r1, r2, options) => {
|
||||||
|
r1 = new Range(r1, options)
|
||||||
|
r2 = new Range(r2, options)
|
||||||
|
return r1.intersects(r2)
|
||||||
|
}
|
||||||
|
module.exports = intersects
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 283:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const compareLoose = (a, b) => compare(a, b, true)
|
||||||
|
module.exports = compareLoose
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 298:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
||||||
|
module.exports = eq
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 310:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
const satisfies = (version, range, options) => {
|
||||||
|
try {
|
||||||
|
range = new Range(range, options)
|
||||||
|
} catch (er) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return range.test(version)
|
||||||
|
}
|
||||||
|
module.exports = satisfies
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 323:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const outside = __webpack_require__(462)
|
||||||
|
// Determine if version is less than all the versions possible in the range
|
||||||
|
const ltr = (version, range, options) => outside(version, range, '<', options)
|
||||||
|
module.exports = ltr
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 357:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("assert");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 413:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
module.exports = __webpack_require__(141);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 417:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("crypto");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 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));
|
||||||
|
/**
|
||||||
|
* 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 (s || '')
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A');
|
||||||
|
}
|
||||||
|
function escapeProperty(s) {
|
||||||
|
return (s || '')
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A')
|
||||||
|
.replace(/:/g, '%3A')
|
||||||
|
.replace(/,/g, '%2C');
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=command.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 462:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const Comparator = __webpack_require__(174)
|
||||||
|
const {ANY} = Comparator
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
const satisfies = __webpack_require__(310)
|
||||||
|
const gt = __webpack_require__(486)
|
||||||
|
const lt = __webpack_require__(586)
|
||||||
|
const lte = __webpack_require__(898)
|
||||||
|
const gte = __webpack_require__(167)
|
||||||
|
|
||||||
|
const outside = (version, range, hilo, options) => {
|
||||||
|
version = new SemVer(version, options)
|
||||||
|
range = new Range(range, options)
|
||||||
|
|
||||||
|
let gtfn, ltefn, ltfn, comp, ecomp
|
||||||
|
switch (hilo) {
|
||||||
|
case '>':
|
||||||
|
gtfn = gt
|
||||||
|
ltefn = lte
|
||||||
|
ltfn = lt
|
||||||
|
comp = '>'
|
||||||
|
ecomp = '>='
|
||||||
|
break
|
||||||
|
case '<':
|
||||||
|
gtfn = lt
|
||||||
|
ltefn = gte
|
||||||
|
ltfn = gt
|
||||||
|
comp = '<'
|
||||||
|
ecomp = '<='
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it satisifes the range it is not outside
|
||||||
|
if (satisfies(version, range, options)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// From now on, variable terms are as if we're in "gtr" mode.
|
||||||
|
// but note that everything is flipped for the "ltr" function.
|
||||||
|
|
||||||
|
for (let i = 0; i < range.set.length; ++i) {
|
||||||
|
const comparators = range.set[i]
|
||||||
|
|
||||||
|
let high = null
|
||||||
|
let low = null
|
||||||
|
|
||||||
|
comparators.forEach((comparator) => {
|
||||||
|
if (comparator.semver === ANY) {
|
||||||
|
comparator = new Comparator('>=0.0.0')
|
||||||
|
}
|
||||||
|
high = high || comparator
|
||||||
|
low = low || comparator
|
||||||
|
if (gtfn(comparator.semver, high.semver, options)) {
|
||||||
|
high = comparator
|
||||||
|
} else if (ltfn(comparator.semver, low.semver, options)) {
|
||||||
|
low = comparator
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// If the edge version comparator has a operator then our version
|
||||||
|
// isn't outside it
|
||||||
|
if (high.operator === comp || high.operator === ecomp) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the lowest version comparator has an operator and our version
|
||||||
|
// is less than it then it isn't higher than the range
|
||||||
|
if ((!low.operator || low.operator === comp) &&
|
||||||
|
ltefn(version, low.semver)) {
|
||||||
|
return false
|
||||||
|
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = outside
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 470:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -921,234 +2721,904 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var _a;
|
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 });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const assert_1 = __webpack_require__(357);
|
const command_1 = __webpack_require__(431);
|
||||||
const fs = __webpack_require__(747);
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __webpack_require__(622);
|
const path = __importStar(__webpack_require__(622));
|
||||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
|
||||||
function exists(fsPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
yield exports.stat(fsPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (err.code === 'ENOENT') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.exists = exists;
|
|
||||||
function isDirectory(fsPath, useStat = false) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
|
||||||
return stats.isDirectory();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.isDirectory = isDirectory;
|
|
||||||
/**
|
/**
|
||||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
* The code to exit an action
|
||||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
|
||||||
*/
|
*/
|
||||||
function isRooted(p) {
|
var ExitCode;
|
||||||
p = normalizeSeparators(p);
|
(function (ExitCode) {
|
||||||
if (!p) {
|
/**
|
||||||
throw new Error('isRooted() parameter "p" cannot be empty');
|
* A code indicating that the action was successful
|
||||||
}
|
*/
|
||||||
if (exports.IS_WINDOWS) {
|
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||||
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
/**
|
||||||
); // e.g. C: or C:\hello
|
* A code indicating that the action was a failure
|
||||||
}
|
*/
|
||||||
return p.startsWith('/');
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||||
}
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||||
exports.isRooted = isRooted;
|
//-----------------------------------------------------------------------
|
||||||
|
// Variables
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Recursively create a directory at `fsPath`.
|
* 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
|
||||||
|
*/
|
||||||
|
function exportVariable(name, val) {
|
||||||
|
process.env[name] = val;
|
||||||
|
command_1.issueCommand('set-env', { name }, val);
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
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.
|
||||||
*
|
*
|
||||||
* This implementation is optimistic, meaning it attempts to create the full
|
* @param name name of the input to get
|
||||||
* path first, and backs up the path stack from there.
|
* @param options optional. See InputOptions.
|
||||||
*
|
* @returns string
|
||||||
* @param fsPath The path to create
|
|
||||||
* @param maxDepth The maximum recursion depth
|
|
||||||
* @param depth The current recursion depth
|
|
||||||
*/
|
*/
|
||||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
function getInput(name, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
if (options && options.required && !val) {
|
||||||
fsPath = path.resolve(fsPath);
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
if (depth >= maxDepth)
|
|
||||||
return exports.mkdir(fsPath);
|
|
||||||
try {
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
switch (err.code) {
|
|
||||||
case 'ENOENT': {
|
|
||||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
let stats;
|
|
||||||
try {
|
|
||||||
stats = yield exports.stat(fsPath);
|
|
||||||
}
|
|
||||||
catch (err2) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
if (!stats.isDirectory())
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mkdirP = mkdirP;
|
|
||||||
/**
|
|
||||||
* Best effort attempt to determine whether a file exists and is executable.
|
|
||||||
* @param filePath file path to check
|
|
||||||
* @param extensions additional file extensions to try
|
|
||||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
|
||||||
*/
|
|
||||||
function tryGetExecutablePath(filePath, extensions) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let stats = undefined;
|
|
||||||
try {
|
|
||||||
// test file exists
|
|
||||||
stats = yield exports.stat(filePath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (err.code !== 'ENOENT') {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stats && stats.isFile()) {
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
// on Windows, test for valid extension
|
|
||||||
const upperExt = path.extname(filePath).toUpperCase();
|
|
||||||
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (isUnixExecutable(stats)) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// try each extension
|
|
||||||
const originalFilePath = filePath;
|
|
||||||
for (const extension of extensions) {
|
|
||||||
filePath = originalFilePath + extension;
|
|
||||||
stats = undefined;
|
|
||||||
try {
|
|
||||||
stats = yield exports.stat(filePath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
if (err.code !== 'ENOENT') {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stats && stats.isFile()) {
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
// preserve the case of the actual file (since an extension was appended)
|
|
||||||
try {
|
|
||||||
const directory = path.dirname(filePath);
|
|
||||||
const upperName = path.basename(filePath).toUpperCase();
|
|
||||||
for (const actualName of yield exports.readdir(directory)) {
|
|
||||||
if (upperName === actualName.toUpperCase()) {
|
|
||||||
filePath = path.join(directory, actualName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
|
||||||
}
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (isUnixExecutable(stats)) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.tryGetExecutablePath = tryGetExecutablePath;
|
|
||||||
function normalizeSeparators(p) {
|
|
||||||
p = p || '';
|
|
||||||
if (exports.IS_WINDOWS) {
|
|
||||||
// convert slashes on Windows
|
|
||||||
p = p.replace(/\//g, '\\');
|
|
||||||
// remove redundant slashes
|
|
||||||
return p.replace(/\\\\+/g, '\\');
|
|
||||||
}
|
}
|
||||||
// remove redundant slashes
|
return val.trim();
|
||||||
return p.replace(/\/\/+/g, '/');
|
|
||||||
}
|
}
|
||||||
// on Mac/Linux, test the execute bit
|
exports.getInput = getInput;
|
||||||
// R W X R W X R W X
|
/**
|
||||||
// 256 128 64 32 16 8 4 2 1
|
* Sets the value of an output.
|
||||||
function isUnixExecutable(stats) {
|
*
|
||||||
return ((stats.mode & 1) > 0 ||
|
* @param name name of the output to set
|
||||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
* @param value value to store
|
||||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
*/
|
||||||
|
function setOutput(name, value) {
|
||||||
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=io-util.js.map
|
exports.setOutput = setOutput;
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// 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
|
||||||
|
*/
|
||||||
|
function error(message) {
|
||||||
|
command_1.issue('error', message);
|
||||||
|
}
|
||||||
|
exports.error = error;
|
||||||
|
/**
|
||||||
|
* Adds an warning issue
|
||||||
|
* @param message warning issue message
|
||||||
|
*/
|
||||||
|
function warning(message) {
|
||||||
|
command_1.issue('warning', 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
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 87:
|
/***/ 480:
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("os");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 88:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
const Range = __webpack_require__(124)
|
||||||
const Range = __webpack_require__(583)
|
const validRange = (range, options) => {
|
||||||
|
|
||||||
const maxSatisfying = (versions, range, options) => {
|
|
||||||
let max = null
|
|
||||||
let maxSV = null
|
|
||||||
let rangeObj = null
|
|
||||||
try {
|
try {
|
||||||
rangeObj = new Range(range, options)
|
// Return '*' instead of '' so that truthiness works.
|
||||||
|
// This will throw if it's invalid anyway
|
||||||
|
return new Range(range, options).range || '*'
|
||||||
} catch (er) {
|
} catch (er) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
versions.forEach((v) => {
|
|
||||||
if (rangeObj.test(v)) {
|
|
||||||
// satisfies(v, range, options)
|
|
||||||
if (!max || maxSV.compare(v) === -1) {
|
|
||||||
// compare(max, v, true)
|
|
||||||
max = v
|
|
||||||
maxSV = new SemVer(max, options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return max
|
|
||||||
}
|
}
|
||||||
module.exports = maxSatisfying
|
module.exports = validRange
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 112:
|
/***/ 486:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const gt = (a, b, loose) => compare(a, b, loose) > 0
|
||||||
|
module.exports = gt
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 489:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const patch = (a, loose) => new SemVer(a, loose).patch
|
||||||
|
module.exports = patch
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 499:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const parse = __webpack_require__(830)
|
||||||
|
const {re, t} = __webpack_require__(976)
|
||||||
|
|
||||||
|
const coerce = (version, options) => {
|
||||||
|
if (version instanceof SemVer) {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof version === 'number') {
|
||||||
|
version = String(version)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof version !== 'string') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
options = options || {}
|
||||||
|
|
||||||
|
let match = null
|
||||||
|
if (!options.rtl) {
|
||||||
|
match = version.match(re[t.COERCE])
|
||||||
|
} else {
|
||||||
|
// Find the right-most coercible string that does not share
|
||||||
|
// a terminus with a more left-ward coercible string.
|
||||||
|
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
||||||
|
//
|
||||||
|
// Walk through the string checking with a /g regexp
|
||||||
|
// Manually set the index so as to pick up overlapping matches.
|
||||||
|
// Stop when we get a match that ends at the string end, since no
|
||||||
|
// coercible string can be more right-ward without the same terminus.
|
||||||
|
let next
|
||||||
|
while ((next = re[t.COERCERTL].exec(version)) &&
|
||||||
|
(!match || match.index + match[0].length !== version.length)
|
||||||
|
) {
|
||||||
|
if (!match ||
|
||||||
|
next.index + next[0].length !== match.index + match[0].length) {
|
||||||
|
match = next
|
||||||
|
}
|
||||||
|
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||||
|
}
|
||||||
|
// leave it in a clean state
|
||||||
|
re[t.COERCERTL].lastIndex = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match === null)
|
||||||
|
return null
|
||||||
|
|
||||||
|
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
|
||||||
|
}
|
||||||
|
module.exports = coerce
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 503:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const parse = __webpack_require__(830)
|
||||||
|
const clean = (version, options) => {
|
||||||
|
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
||||||
|
return s ? s.version : null
|
||||||
|
}
|
||||||
|
module.exports = clean
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 531:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
// Determine if version is greater than all the versions possible in the range.
|
||||||
|
const outside = __webpack_require__(462)
|
||||||
|
const gtr = (version, range, options) => outside(version, range, '>', options)
|
||||||
|
module.exports = gtr
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 533:
|
||||||
|
/***/ (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;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
const io = __importStar(__webpack_require__(1));
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const mm = __importStar(__webpack_require__(31));
|
||||||
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
|
const httpm = __importStar(__webpack_require__(539));
|
||||||
|
const semver = __importStar(__webpack_require__(550));
|
||||||
|
const stream = __importStar(__webpack_require__(794));
|
||||||
|
const util = __importStar(__webpack_require__(669));
|
||||||
|
const v4_1 = __importDefault(__webpack_require__(826));
|
||||||
|
const exec_1 = __webpack_require__(986);
|
||||||
|
const assert_1 = __webpack_require__(357);
|
||||||
|
const retry_helper_1 = __webpack_require__(979);
|
||||||
|
class HTTPError extends Error {
|
||||||
|
constructor(httpStatusCode) {
|
||||||
|
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
||||||
|
this.httpStatusCode = httpStatusCode;
|
||||||
|
Object.setPrototypeOf(this, new.target.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HTTPError = HTTPError;
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
const userAgent = 'actions/tool-cache';
|
||||||
|
/**
|
||||||
|
* Download a tool from an url and stream it into a file
|
||||||
|
*
|
||||||
|
* @param url url of tool to download
|
||||||
|
* @param dest path to download tool
|
||||||
|
* @param auth authorization header
|
||||||
|
* @returns path to downloaded tool
|
||||||
|
*/
|
||||||
|
function downloadTool(url, dest, auth) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
||||||
|
yield io.mkdirP(path.dirname(dest));
|
||||||
|
core.debug(`Downloading ${url}`);
|
||||||
|
core.debug(`Destination ${dest}`);
|
||||||
|
const maxAttempts = 3;
|
||||||
|
const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10);
|
||||||
|
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
||||||
|
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
||||||
|
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return yield downloadToolAttempt(url, dest || '', auth);
|
||||||
|
}), (err) => {
|
||||||
|
if (err instanceof HTTPError && err.httpStatusCode) {
|
||||||
|
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
||||||
|
if (err.httpStatusCode < 500 &&
|
||||||
|
err.httpStatusCode !== 408 &&
|
||||||
|
err.httpStatusCode !== 429) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Otherwise retry
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.downloadTool = downloadTool;
|
||||||
|
function downloadToolAttempt(url, dest, auth) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (fs.existsSync(dest)) {
|
||||||
|
throw new Error(`Destination file path ${dest} already exists`);
|
||||||
|
}
|
||||||
|
// Get the response headers
|
||||||
|
const http = new httpm.HttpClient(userAgent, [], {
|
||||||
|
allowRetries: false
|
||||||
|
});
|
||||||
|
let headers;
|
||||||
|
if (auth) {
|
||||||
|
core.debug('set auth');
|
||||||
|
headers = {
|
||||||
|
authorization: auth
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const response = yield http.get(url, headers);
|
||||||
|
if (response.message.statusCode !== 200) {
|
||||||
|
const err = new HTTPError(response.message.statusCode);
|
||||||
|
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
// Download the response body
|
||||||
|
const pipeline = util.promisify(stream.pipeline);
|
||||||
|
const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message);
|
||||||
|
const readStream = responseMessageFactory();
|
||||||
|
let succeeded = false;
|
||||||
|
try {
|
||||||
|
yield pipeline(readStream, fs.createWriteStream(dest));
|
||||||
|
core.debug('download complete');
|
||||||
|
succeeded = true;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
// Error, delete dest before retry
|
||||||
|
if (!succeeded) {
|
||||||
|
core.debug('download failed');
|
||||||
|
try {
|
||||||
|
yield io.rmRF(dest);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`Failed to delete '${dest}'. ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Extract a .7z file
|
||||||
|
*
|
||||||
|
* @param file path to the .7z file
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||||
|
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||||
|
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||||
|
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||||
|
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||||
|
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||||
|
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||||
|
* to 7zr.exe can be pass to this function.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
function extract7z(file, dest, _7zPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
||||||
|
assert_1.ok(file, 'parameter "file" is required');
|
||||||
|
dest = yield _createExtractFolder(dest);
|
||||||
|
const originalCwd = process.cwd();
|
||||||
|
process.chdir(dest);
|
||||||
|
if (_7zPath) {
|
||||||
|
try {
|
||||||
|
const logLevel = core.isDebug() ? '-bb1' : '-bb0';
|
||||||
|
const args = [
|
||||||
|
'x',
|
||||||
|
logLevel,
|
||||||
|
'-bd',
|
||||||
|
'-sccUTF-8',
|
||||||
|
file
|
||||||
|
];
|
||||||
|
const options = {
|
||||||
|
silent: true
|
||||||
|
};
|
||||||
|
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
process.chdir(originalCwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const escapedScript = path
|
||||||
|
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
||||||
|
.replace(/'/g, "''")
|
||||||
|
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
|
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
|
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
||||||
|
const args = [
|
||||||
|
'-NoLogo',
|
||||||
|
'-Sta',
|
||||||
|
'-NoProfile',
|
||||||
|
'-NonInteractive',
|
||||||
|
'-ExecutionPolicy',
|
||||||
|
'Unrestricted',
|
||||||
|
'-Command',
|
||||||
|
command
|
||||||
|
];
|
||||||
|
const options = {
|
||||||
|
silent: true
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const powershellPath = yield io.which('powershell', true);
|
||||||
|
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
process.chdir(originalCwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.extract7z = extract7z;
|
||||||
|
/**
|
||||||
|
* Extract a compressed tar archive
|
||||||
|
*
|
||||||
|
* @param file path to the tar
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @param flags flags for the tar command to use for extraction. Defaults to 'xz' (extracting gzipped tars). Optional.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
function extractTar(file, dest, flags = 'xz') {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!file) {
|
||||||
|
throw new Error("parameter 'file' is required");
|
||||||
|
}
|
||||||
|
// Create dest
|
||||||
|
dest = yield _createExtractFolder(dest);
|
||||||
|
// Determine whether GNU tar
|
||||||
|
core.debug('Checking tar --version');
|
||||||
|
let versionOutput = '';
|
||||||
|
yield exec_1.exec('tar --version', [], {
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => (versionOutput += data.toString()),
|
||||||
|
stderr: (data) => (versionOutput += data.toString())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
core.debug(versionOutput.trim());
|
||||||
|
const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
|
||||||
|
// Initialize args
|
||||||
|
let args;
|
||||||
|
if (flags instanceof Array) {
|
||||||
|
args = flags;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
args = [flags];
|
||||||
|
}
|
||||||
|
if (core.isDebug() && !flags.includes('v')) {
|
||||||
|
args.push('-v');
|
||||||
|
}
|
||||||
|
let destArg = dest;
|
||||||
|
let fileArg = file;
|
||||||
|
if (IS_WINDOWS && isGnuTar) {
|
||||||
|
args.push('--force-local');
|
||||||
|
destArg = dest.replace(/\\/g, '/');
|
||||||
|
// Technically only the dest needs to have `/` but for aesthetic consistency
|
||||||
|
// convert slashes in the file arg too.
|
||||||
|
fileArg = file.replace(/\\/g, '/');
|
||||||
|
}
|
||||||
|
if (isGnuTar) {
|
||||||
|
// Suppress warnings when using GNU tar to extract archives created by BSD tar
|
||||||
|
args.push('--warning=no-unknown-keyword');
|
||||||
|
}
|
||||||
|
args.push('-C', destArg, '-f', fileArg);
|
||||||
|
yield exec_1.exec(`tar`, args);
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.extractTar = extractTar;
|
||||||
|
/**
|
||||||
|
* Extract a zip
|
||||||
|
*
|
||||||
|
* @param file path to the zip
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
function extractZip(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!file) {
|
||||||
|
throw new Error("parameter 'file' is required");
|
||||||
|
}
|
||||||
|
dest = yield _createExtractFolder(dest);
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
yield extractZipWin(file, dest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield extractZipNix(file, dest);
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.extractZip = extractZip;
|
||||||
|
function extractZipWin(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// build the powershell command
|
||||||
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
|
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
|
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||||
|
// run powershell
|
||||||
|
const powershellPath = yield io.which('powershell', true);
|
||||||
|
const args = [
|
||||||
|
'-NoLogo',
|
||||||
|
'-Sta',
|
||||||
|
'-NoProfile',
|
||||||
|
'-NonInteractive',
|
||||||
|
'-ExecutionPolicy',
|
||||||
|
'Unrestricted',
|
||||||
|
'-Command',
|
||||||
|
command
|
||||||
|
];
|
||||||
|
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractZipNix(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const unzipPath = yield io.which('unzip', true);
|
||||||
|
const args = [file];
|
||||||
|
if (!core.isDebug()) {
|
||||||
|
args.unshift('-q');
|
||||||
|
}
|
||||||
|
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Caches a directory and installs it into the tool cacheDir
|
||||||
|
*
|
||||||
|
* @param sourceDir the directory to cache into tools
|
||||||
|
* @param tool tool name
|
||||||
|
* @param version version of the tool. semver format
|
||||||
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
|
*/
|
||||||
|
function cacheDir(sourceDir, tool, version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
version = semver.clean(version) || version;
|
||||||
|
arch = arch || os.arch();
|
||||||
|
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||||
|
core.debug(`source dir: ${sourceDir}`);
|
||||||
|
if (!fs.statSync(sourceDir).isDirectory()) {
|
||||||
|
throw new Error('sourceDir is not a directory');
|
||||||
|
}
|
||||||
|
// Create the tool dir
|
||||||
|
const destPath = yield _createToolPath(tool, version, arch);
|
||||||
|
// copy each child item. do not move. move can fail on Windows
|
||||||
|
// due to anti-virus software having an open handle on a file.
|
||||||
|
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||||
|
const s = path.join(sourceDir, itemName);
|
||||||
|
yield io.cp(s, destPath, { recursive: true });
|
||||||
|
}
|
||||||
|
// write .complete
|
||||||
|
_completeToolPath(tool, version, arch);
|
||||||
|
return destPath;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cacheDir = cacheDir;
|
||||||
|
/**
|
||||||
|
* Caches a downloaded file (GUID) and installs it
|
||||||
|
* into the tool cache with a given targetName
|
||||||
|
*
|
||||||
|
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||||
|
* @param targetFile the name of the file name in the tools directory
|
||||||
|
* @param tool tool name
|
||||||
|
* @param version version of the tool. semver format
|
||||||
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
|
*/
|
||||||
|
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
version = semver.clean(version) || version;
|
||||||
|
arch = arch || os.arch();
|
||||||
|
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||||
|
core.debug(`source file: ${sourceFile}`);
|
||||||
|
if (!fs.statSync(sourceFile).isFile()) {
|
||||||
|
throw new Error('sourceFile is not a file');
|
||||||
|
}
|
||||||
|
// create the tool dir
|
||||||
|
const destFolder = yield _createToolPath(tool, version, arch);
|
||||||
|
// copy instead of move. move can fail on Windows due to
|
||||||
|
// anti-virus software having an open handle on a file.
|
||||||
|
const destPath = path.join(destFolder, targetFile);
|
||||||
|
core.debug(`destination file ${destPath}`);
|
||||||
|
yield io.cp(sourceFile, destPath);
|
||||||
|
// write .complete
|
||||||
|
_completeToolPath(tool, version, arch);
|
||||||
|
return destFolder;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cacheFile = cacheFile;
|
||||||
|
/**
|
||||||
|
* Finds the path to a tool version in the local installed tool cache
|
||||||
|
*
|
||||||
|
* @param toolName name of the tool
|
||||||
|
* @param versionSpec version of the tool
|
||||||
|
* @param arch optional arch. defaults to arch of computer
|
||||||
|
*/
|
||||||
|
function find(toolName, versionSpec, arch) {
|
||||||
|
if (!toolName) {
|
||||||
|
throw new Error('toolName parameter is required');
|
||||||
|
}
|
||||||
|
if (!versionSpec) {
|
||||||
|
throw new Error('versionSpec parameter is required');
|
||||||
|
}
|
||||||
|
arch = arch || os.arch();
|
||||||
|
// attempt to resolve an explicit version
|
||||||
|
if (!_isExplicitVersion(versionSpec)) {
|
||||||
|
const localVersions = findAllVersions(toolName, arch);
|
||||||
|
const match = _evaluateVersions(localVersions, versionSpec);
|
||||||
|
versionSpec = match;
|
||||||
|
}
|
||||||
|
// check for the explicit version in the cache
|
||||||
|
let toolPath = '';
|
||||||
|
if (versionSpec) {
|
||||||
|
versionSpec = semver.clean(versionSpec) || '';
|
||||||
|
const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch);
|
||||||
|
core.debug(`checking cache: ${cachePath}`);
|
||||||
|
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
||||||
|
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
||||||
|
toolPath = cachePath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug('not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toolPath;
|
||||||
|
}
|
||||||
|
exports.find = find;
|
||||||
|
/**
|
||||||
|
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||||
|
*
|
||||||
|
* @param toolName name of the tool
|
||||||
|
* @param arch optional arch. defaults to arch of computer
|
||||||
|
*/
|
||||||
|
function findAllVersions(toolName, arch) {
|
||||||
|
const versions = [];
|
||||||
|
arch = arch || os.arch();
|
||||||
|
const toolPath = path.join(_getCacheDirectory(), toolName);
|
||||||
|
if (fs.existsSync(toolPath)) {
|
||||||
|
const children = fs.readdirSync(toolPath);
|
||||||
|
for (const child of children) {
|
||||||
|
if (_isExplicitVersion(child)) {
|
||||||
|
const fullPath = path.join(toolPath, child, arch || '');
|
||||||
|
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||||
|
versions.push(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return versions;
|
||||||
|
}
|
||||||
|
exports.findAllVersions = findAllVersions;
|
||||||
|
function getManifestFromRepo(owner, repo, auth, branch = 'master') {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let releases = [];
|
||||||
|
const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`;
|
||||||
|
const http = new httpm.HttpClient('tool-cache');
|
||||||
|
const headers = {};
|
||||||
|
if (auth) {
|
||||||
|
core.debug('set auth');
|
||||||
|
headers.authorization = auth;
|
||||||
|
}
|
||||||
|
const response = yield http.getJson(treeUrl, headers);
|
||||||
|
if (!response.result) {
|
||||||
|
return releases;
|
||||||
|
}
|
||||||
|
let manifestUrl = '';
|
||||||
|
for (const item of response.result.tree) {
|
||||||
|
if (item.path === 'versions-manifest.json') {
|
||||||
|
manifestUrl = item.url;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
||||||
|
let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
|
||||||
|
if (versionsRaw) {
|
||||||
|
// shouldn't be needed but protects against invalid json saved with BOM
|
||||||
|
versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
|
||||||
|
try {
|
||||||
|
releases = JSON.parse(versionsRaw);
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
core.debug('Invalid json');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return releases;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getManifestFromRepo = getManifestFromRepo;
|
||||||
|
function findFromManifest(versionSpec, stable, manifest, archFilter = os.arch()) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// wrap the internal impl
|
||||||
|
const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.findFromManifest = findFromManifest;
|
||||||
|
function _createExtractFolder(dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!dest) {
|
||||||
|
// create a temp dir
|
||||||
|
dest = path.join(_getTempDirectory(), v4_1.default());
|
||||||
|
}
|
||||||
|
yield io.mkdirP(dest);
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function _createToolPath(tool, version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
|
||||||
|
core.debug(`destination ${folderPath}`);
|
||||||
|
const markerPath = `${folderPath}.complete`;
|
||||||
|
yield io.rmRF(folderPath);
|
||||||
|
yield io.rmRF(markerPath);
|
||||||
|
yield io.mkdirP(folderPath);
|
||||||
|
return folderPath;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function _completeToolPath(tool, version, arch) {
|
||||||
|
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
|
||||||
|
const markerPath = `${folderPath}.complete`;
|
||||||
|
fs.writeFileSync(markerPath, '');
|
||||||
|
core.debug('finished caching tool');
|
||||||
|
}
|
||||||
|
function _isExplicitVersion(versionSpec) {
|
||||||
|
const c = semver.clean(versionSpec) || '';
|
||||||
|
core.debug(`isExplicit: ${c}`);
|
||||||
|
const valid = semver.valid(c) != null;
|
||||||
|
core.debug(`explicit? ${valid}`);
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
function _evaluateVersions(versions, versionSpec) {
|
||||||
|
let version = '';
|
||||||
|
core.debug(`evaluating ${versions.length} versions`);
|
||||||
|
versions = versions.sort((a, b) => {
|
||||||
|
if (semver.gt(a, b)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
|
const potential = versions[i];
|
||||||
|
const satisfied = semver.satisfies(potential, versionSpec);
|
||||||
|
if (satisfied) {
|
||||||
|
version = potential;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version) {
|
||||||
|
core.debug(`matched: ${version}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug('match not found');
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets RUNNER_TOOL_CACHE
|
||||||
|
*/
|
||||||
|
function _getCacheDirectory() {
|
||||||
|
const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||||
|
assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
|
||||||
|
return cacheDirectory;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets RUNNER_TEMP
|
||||||
|
*/
|
||||||
|
function _getTempDirectory() {
|
||||||
|
const tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||||
|
assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
|
||||||
|
return tempDirectory;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets a global variable
|
||||||
|
*/
|
||||||
|
function _getGlobal(key, defaultValue) {
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const value = global[key];
|
||||||
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
||||||
|
return value !== undefined ? value : defaultValue;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=tool-cache.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 539:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -1157,7 +3627,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const url = __webpack_require__(835);
|
const url = __webpack_require__(835);
|
||||||
const http = __webpack_require__(605);
|
const http = __webpack_require__(605);
|
||||||
const https = __webpack_require__(211);
|
const https = __webpack_require__(211);
|
||||||
const pm = __webpack_require__(324);
|
const pm = __webpack_require__(950);
|
||||||
let tunnel;
|
let tunnel;
|
||||||
var HttpCodes;
|
var HttpCodes;
|
||||||
(function (HttpCodes) {
|
(function (HttpCodes) {
|
||||||
@ -1567,7 +4037,7 @@ class HttpClient {
|
|||||||
if (useProxy) {
|
if (useProxy) {
|
||||||
// If using proxy, need tunnel
|
// If using proxy, need tunnel
|
||||||
if (!tunnel) {
|
if (!tunnel) {
|
||||||
tunnel = __webpack_require__(826);
|
tunnel = __webpack_require__(413);
|
||||||
}
|
}
|
||||||
const agentOptions = {
|
const agentOptions = {
|
||||||
maxSockets: maxSockets,
|
maxSockets: maxSockets,
|
||||||
@ -1687,874 +4157,7 @@ exports.HttpClient = HttpClient;
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 114:
|
/***/ 548:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const Comparator = __webpack_require__(668)
|
|
||||||
const {ANY} = Comparator
|
|
||||||
const Range = __webpack_require__(583)
|
|
||||||
const satisfies = __webpack_require__(638)
|
|
||||||
const gt = __webpack_require__(589)
|
|
||||||
const lt = __webpack_require__(548)
|
|
||||||
const lte = __webpack_require__(369)
|
|
||||||
const gte = __webpack_require__(116)
|
|
||||||
|
|
||||||
const outside = (version, range, hilo, options) => {
|
|
||||||
version = new SemVer(version, options)
|
|
||||||
range = new Range(range, options)
|
|
||||||
|
|
||||||
let gtfn, ltefn, ltfn, comp, ecomp
|
|
||||||
switch (hilo) {
|
|
||||||
case '>':
|
|
||||||
gtfn = gt
|
|
||||||
ltefn = lte
|
|
||||||
ltfn = lt
|
|
||||||
comp = '>'
|
|
||||||
ecomp = '>='
|
|
||||||
break
|
|
||||||
case '<':
|
|
||||||
gtfn = lt
|
|
||||||
ltefn = gte
|
|
||||||
ltfn = gt
|
|
||||||
comp = '<'
|
|
||||||
ecomp = '<='
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it satisifes the range it is not outside
|
|
||||||
if (satisfies(version, range, options)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// From now on, variable terms are as if we're in "gtr" mode.
|
|
||||||
// but note that everything is flipped for the "ltr" function.
|
|
||||||
|
|
||||||
for (let i = 0; i < range.set.length; ++i) {
|
|
||||||
const comparators = range.set[i]
|
|
||||||
|
|
||||||
let high = null
|
|
||||||
let low = null
|
|
||||||
|
|
||||||
comparators.forEach((comparator) => {
|
|
||||||
if (comparator.semver === ANY) {
|
|
||||||
comparator = new Comparator('>=0.0.0')
|
|
||||||
}
|
|
||||||
high = high || comparator
|
|
||||||
low = low || comparator
|
|
||||||
if (gtfn(comparator.semver, high.semver, options)) {
|
|
||||||
high = comparator
|
|
||||||
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
||||||
low = comparator
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// If the edge version comparator has a operator then our version
|
|
||||||
// isn't outside it
|
|
||||||
if (high.operator === comp || high.operator === ecomp) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the lowest version comparator has an operator and our version
|
|
||||||
// is less than it then it isn't higher than the range
|
|
||||||
if ((!low.operator || low.operator === comp) &&
|
|
||||||
ltefn(version, low.semver)) {
|
|
||||||
return false
|
|
||||||
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = outside
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 116:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const gte = (a, b, loose) => compare(a, b, loose) >= 0
|
|
||||||
module.exports = gte
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 129:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("child_process");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 131:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const parse = __webpack_require__(752)
|
|
||||||
const {re, t} = __webpack_require__(10)
|
|
||||||
|
|
||||||
const coerce = (version, options) => {
|
|
||||||
if (version instanceof SemVer) {
|
|
||||||
return version
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof version === 'number') {
|
|
||||||
version = String(version)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof version !== 'string') {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
options = options || {}
|
|
||||||
|
|
||||||
let match = null
|
|
||||||
if (!options.rtl) {
|
|
||||||
match = version.match(re[t.COERCE])
|
|
||||||
} else {
|
|
||||||
// Find the right-most coercible string that does not share
|
|
||||||
// a terminus with a more left-ward coercible string.
|
|
||||||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
|
||||||
//
|
|
||||||
// Walk through the string checking with a /g regexp
|
|
||||||
// Manually set the index so as to pick up overlapping matches.
|
|
||||||
// Stop when we get a match that ends at the string end, since no
|
|
||||||
// coercible string can be more right-ward without the same terminus.
|
|
||||||
let next
|
|
||||||
while ((next = re[t.COERCERTL].exec(version)) &&
|
|
||||||
(!match || match.index + match[0].length !== version.length)
|
|
||||||
) {
|
|
||||||
if (!match ||
|
|
||||||
next.index + next[0].length !== match.index + match[0].length) {
|
|
||||||
match = next
|
|
||||||
}
|
|
||||||
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
|
||||||
}
|
|
||||||
// leave it in a clean state
|
|
||||||
re[t.COERCERTL].lastIndex = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match === null)
|
|
||||||
return null
|
|
||||||
|
|
||||||
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
|
|
||||||
}
|
|
||||||
module.exports = coerce
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 140:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const Range = __webpack_require__(583)
|
|
||||||
const validRange = (range, options) => {
|
|
||||||
try {
|
|
||||||
// Return '*' instead of '' so that truthiness works.
|
|
||||||
// This will throw if it's invalid anyway
|
|
||||||
return new Range(range, options).range || '*'
|
|
||||||
} catch (er) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = validRange
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 156:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
// Unique ID creation requires a high quality random # generator. In node.js
|
|
||||||
// this is pretty straight-forward - we use the crypto API.
|
|
||||||
|
|
||||||
var crypto = __webpack_require__(417);
|
|
||||||
|
|
||||||
module.exports = function nodeRNG() {
|
|
||||||
return crypto.randomBytes(16);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 171:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
var net = __webpack_require__(631);
|
|
||||||
var tls = __webpack_require__(16);
|
|
||||||
var http = __webpack_require__(605);
|
|
||||||
var https = __webpack_require__(211);
|
|
||||||
var events = __webpack_require__(614);
|
|
||||||
var assert = __webpack_require__(357);
|
|
||||||
var util = __webpack_require__(669);
|
|
||||||
|
|
||||||
|
|
||||||
exports.httpOverHttp = httpOverHttp;
|
|
||||||
exports.httpsOverHttp = httpsOverHttp;
|
|
||||||
exports.httpOverHttps = httpOverHttps;
|
|
||||||
exports.httpsOverHttps = httpsOverHttps;
|
|
||||||
|
|
||||||
|
|
||||||
function httpOverHttp(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = http.request;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpsOverHttp(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = http.request;
|
|
||||||
agent.createSocket = createSecureSocket;
|
|
||||||
agent.defaultPort = 443;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpOverHttps(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = https.request;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpsOverHttps(options) {
|
|
||||||
var agent = new TunnelingAgent(options);
|
|
||||||
agent.request = https.request;
|
|
||||||
agent.createSocket = createSecureSocket;
|
|
||||||
agent.defaultPort = 443;
|
|
||||||
return agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function TunnelingAgent(options) {
|
|
||||||
var self = this;
|
|
||||||
self.options = options || {};
|
|
||||||
self.proxyOptions = self.options.proxy || {};
|
|
||||||
self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
|
|
||||||
self.requests = [];
|
|
||||||
self.sockets = [];
|
|
||||||
|
|
||||||
self.on('free', function onFree(socket, host, port, localAddress) {
|
|
||||||
var options = toOptions(host, port, localAddress);
|
|
||||||
for (var i = 0, len = self.requests.length; i < len; ++i) {
|
|
||||||
var pending = self.requests[i];
|
|
||||||
if (pending.host === options.host && pending.port === options.port) {
|
|
||||||
// Detect the request to connect same origin server,
|
|
||||||
// reuse the connection.
|
|
||||||
self.requests.splice(i, 1);
|
|
||||||
pending.request.onSocket(socket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
socket.destroy();
|
|
||||||
self.removeSocket(socket);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
util.inherits(TunnelingAgent, events.EventEmitter);
|
|
||||||
|
|
||||||
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
|
|
||||||
var self = this;
|
|
||||||
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
|
|
||||||
|
|
||||||
if (self.sockets.length >= this.maxSockets) {
|
|
||||||
// We are over limit so we'll add it to the queue.
|
|
||||||
self.requests.push(options);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we are under maxSockets create a new one.
|
|
||||||
self.createSocket(options, function(socket) {
|
|
||||||
socket.on('free', onFree);
|
|
||||||
socket.on('close', onCloseOrRemove);
|
|
||||||
socket.on('agentRemove', onCloseOrRemove);
|
|
||||||
req.onSocket(socket);
|
|
||||||
|
|
||||||
function onFree() {
|
|
||||||
self.emit('free', socket, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onCloseOrRemove(err) {
|
|
||||||
self.removeSocket(socket);
|
|
||||||
socket.removeListener('free', onFree);
|
|
||||||
socket.removeListener('close', onCloseOrRemove);
|
|
||||||
socket.removeListener('agentRemove', onCloseOrRemove);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
|
|
||||||
var self = this;
|
|
||||||
var placeholder = {};
|
|
||||||
self.sockets.push(placeholder);
|
|
||||||
|
|
||||||
var connectOptions = mergeOptions({}, self.proxyOptions, {
|
|
||||||
method: 'CONNECT',
|
|
||||||
path: options.host + ':' + options.port,
|
|
||||||
agent: false,
|
|
||||||
headers: {
|
|
||||||
host: options.host + ':' + options.port
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (options.localAddress) {
|
|
||||||
connectOptions.localAddress = options.localAddress;
|
|
||||||
}
|
|
||||||
if (connectOptions.proxyAuth) {
|
|
||||||
connectOptions.headers = connectOptions.headers || {};
|
|
||||||
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
|
|
||||||
new Buffer(connectOptions.proxyAuth).toString('base64');
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('making CONNECT request');
|
|
||||||
var connectReq = self.request(connectOptions);
|
|
||||||
connectReq.useChunkedEncodingByDefault = false; // for v0.6
|
|
||||||
connectReq.once('response', onResponse); // for v0.6
|
|
||||||
connectReq.once('upgrade', onUpgrade); // for v0.6
|
|
||||||
connectReq.once('connect', onConnect); // for v0.7 or later
|
|
||||||
connectReq.once('error', onError);
|
|
||||||
connectReq.end();
|
|
||||||
|
|
||||||
function onResponse(res) {
|
|
||||||
// Very hacky. This is necessary to avoid http-parser leaks.
|
|
||||||
res.upgrade = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onUpgrade(res, socket, head) {
|
|
||||||
// Hacky.
|
|
||||||
process.nextTick(function() {
|
|
||||||
onConnect(res, socket, head);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onConnect(res, socket, head) {
|
|
||||||
connectReq.removeAllListeners();
|
|
||||||
socket.removeAllListeners();
|
|
||||||
|
|
||||||
if (res.statusCode !== 200) {
|
|
||||||
debug('tunneling socket could not be established, statusCode=%d',
|
|
||||||
res.statusCode);
|
|
||||||
socket.destroy();
|
|
||||||
var error = new Error('tunneling socket could not be established, ' +
|
|
||||||
'statusCode=' + res.statusCode);
|
|
||||||
error.code = 'ECONNRESET';
|
|
||||||
options.request.emit('error', error);
|
|
||||||
self.removeSocket(placeholder);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (head.length > 0) {
|
|
||||||
debug('got illegal response body from proxy');
|
|
||||||
socket.destroy();
|
|
||||||
var error = new Error('got illegal response body from proxy');
|
|
||||||
error.code = 'ECONNRESET';
|
|
||||||
options.request.emit('error', error);
|
|
||||||
self.removeSocket(placeholder);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
debug('tunneling connection has established');
|
|
||||||
self.sockets[self.sockets.indexOf(placeholder)] = socket;
|
|
||||||
return cb(socket);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onError(cause) {
|
|
||||||
connectReq.removeAllListeners();
|
|
||||||
|
|
||||||
debug('tunneling socket could not be established, cause=%s\n',
|
|
||||||
cause.message, cause.stack);
|
|
||||||
var error = new Error('tunneling socket could not be established, ' +
|
|
||||||
'cause=' + cause.message);
|
|
||||||
error.code = 'ECONNRESET';
|
|
||||||
options.request.emit('error', error);
|
|
||||||
self.removeSocket(placeholder);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
|
|
||||||
var pos = this.sockets.indexOf(socket)
|
|
||||||
if (pos === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.sockets.splice(pos, 1);
|
|
||||||
|
|
||||||
var pending = this.requests.shift();
|
|
||||||
if (pending) {
|
|
||||||
// If we have pending requests and a socket gets closed a new one
|
|
||||||
// needs to be created to take over in the pool for the one that closed.
|
|
||||||
this.createSocket(pending, function(socket) {
|
|
||||||
pending.request.onSocket(socket);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function createSecureSocket(options, cb) {
|
|
||||||
var self = this;
|
|
||||||
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
|
|
||||||
var hostHeader = options.request.getHeader('host');
|
|
||||||
var tlsOptions = mergeOptions({}, self.options, {
|
|
||||||
socket: socket,
|
|
||||||
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
|
|
||||||
});
|
|
||||||
|
|
||||||
// 0 is dummy port for v0.6
|
|
||||||
var secureSocket = tls.connect(0, tlsOptions);
|
|
||||||
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
|
|
||||||
cb(secureSocket);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toOptions(host, port, localAddress) {
|
|
||||||
if (typeof host === 'string') { // since v0.10
|
|
||||||
return {
|
|
||||||
host: host,
|
|
||||||
port: port,
|
|
||||||
localAddress: localAddress
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return host; // for v0.11 or later
|
|
||||||
}
|
|
||||||
|
|
||||||
function mergeOptions(target) {
|
|
||||||
for (var i = 1, len = arguments.length; i < len; ++i) {
|
|
||||||
var overrides = arguments[i];
|
|
||||||
if (typeof overrides === 'object') {
|
|
||||||
var keys = Object.keys(overrides);
|
|
||||||
for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
|
|
||||||
var k = keys[j];
|
|
||||||
if (overrides[k] !== undefined) {
|
|
||||||
target[k] = overrides[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var debug;
|
|
||||||
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|
||||||
debug = function() {
|
|
||||||
var args = Array.prototype.slice.call(arguments);
|
|
||||||
if (typeof args[0] === 'string') {
|
|
||||||
args[0] = 'TUNNEL: ' + args[0];
|
|
||||||
} else {
|
|
||||||
args.unshift('TUNNEL:');
|
|
||||||
}
|
|
||||||
console.error.apply(console, args);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug = function() {};
|
|
||||||
}
|
|
||||||
exports.debug = debug; // for test
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 196:
|
|
||||||
/***/ (function(module, 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 semver = __importStar(__webpack_require__(761));
|
|
||||||
const core_1 = __webpack_require__(696);
|
|
||||||
// needs to be require for core node modules to be mocked
|
|
||||||
/* eslint @typescript-eslint/no-require-imports: 0 */
|
|
||||||
const os = __webpack_require__(87);
|
|
||||||
const cp = __webpack_require__(129);
|
|
||||||
const fs = __webpack_require__(747);
|
|
||||||
function _findMatch(versionSpec, stable, candidates, archFilter) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const platFilter = os.platform();
|
|
||||||
let result;
|
|
||||||
let match;
|
|
||||||
let file;
|
|
||||||
for (const candidate of candidates) {
|
|
||||||
const version = candidate.version;
|
|
||||||
core_1.debug(`check ${version} satisfies ${versionSpec}`);
|
|
||||||
if (semver.satisfies(version, versionSpec) &&
|
|
||||||
(!stable || candidate.stable === stable)) {
|
|
||||||
file = candidate.files.find(item => {
|
|
||||||
core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
|
|
||||||
let chk = item.arch === archFilter && item.platform === platFilter;
|
|
||||||
if (chk && item.platform_version) {
|
|
||||||
const osVersion = module.exports._getOsVersion();
|
|
||||||
if (osVersion === item.platform_version) {
|
|
||||||
chk = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
chk = semver.satisfies(osVersion, item.platform_version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return chk;
|
|
||||||
});
|
|
||||||
if (file) {
|
|
||||||
core_1.debug(`matched ${candidate.version}`);
|
|
||||||
match = candidate;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (match && file) {
|
|
||||||
// clone since we're mutating the file list to be only the file that matches
|
|
||||||
result = Object.assign({}, match);
|
|
||||||
result.files = [file];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports._findMatch = _findMatch;
|
|
||||||
function _getOsVersion() {
|
|
||||||
// TODO: add windows and other linux, arm variants
|
|
||||||
// right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python)
|
|
||||||
const plat = os.platform();
|
|
||||||
let version = '';
|
|
||||||
if (plat === 'darwin') {
|
|
||||||
version = cp.execSync('sw_vers -productVersion').toString();
|
|
||||||
}
|
|
||||||
else if (plat === 'linux') {
|
|
||||||
// lsb_release process not in some containers, readfile
|
|
||||||
// Run cat /etc/lsb-release
|
|
||||||
// DISTRIB_ID=Ubuntu
|
|
||||||
// DISTRIB_RELEASE=18.04
|
|
||||||
// DISTRIB_CODENAME=bionic
|
|
||||||
// DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
|
|
||||||
const lsbContents = module.exports._readLinuxVersionFile();
|
|
||||||
if (lsbContents) {
|
|
||||||
const lines = lsbContents.split('\n');
|
|
||||||
for (const line of lines) {
|
|
||||||
const parts = line.split('=');
|
|
||||||
if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') {
|
|
||||||
version = parts[1].trim();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
exports._getOsVersion = _getOsVersion;
|
|
||||||
function _readLinuxVersionFile() {
|
|
||||||
const lsbFile = '/etc/lsb-release';
|
|
||||||
let contents = '';
|
|
||||||
if (fs.existsSync(lsbFile)) {
|
|
||||||
contents = fs.readFileSync(lsbFile).toString();
|
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
exports._readLinuxVersionFile = _readLinuxVersionFile;
|
|
||||||
//# sourceMappingURL=manifest.js.map
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 201:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const parse = __webpack_require__(752)
|
|
||||||
const eq = __webpack_require__(265)
|
|
||||||
|
|
||||||
const diff = (version1, version2) => {
|
|
||||||
if (eq(version1, version2)) {
|
|
||||||
return null
|
|
||||||
} else {
|
|
||||||
const v1 = parse(version1)
|
|
||||||
const v2 = parse(version2)
|
|
||||||
const hasPre = v1.prerelease.length || v2.prerelease.length
|
|
||||||
const prefix = hasPre ? 'pre' : ''
|
|
||||||
const defaultResult = hasPre ? 'prerelease' : ''
|
|
||||||
for (const key in v1) {
|
|
||||||
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
||||||
if (v1[key] !== v2[key]) {
|
|
||||||
return prefix + key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return defaultResult // may be undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = diff
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 206:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const compareLoose = (a, b) => compare(a, b, true)
|
|
||||||
module.exports = compareLoose
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 211:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("https");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 216:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compareBuild = __webpack_require__(370)
|
|
||||||
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
|
|
||||||
module.exports = rsort
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 237:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
// Determine if version is greater than all the versions possible in the range.
|
|
||||||
const outside = __webpack_require__(114)
|
|
||||||
const gtr = (version, range, options) => outside(version, range, '>', options)
|
|
||||||
module.exports = gtr
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 265:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
|
||||||
module.exports = eq
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 270:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const outside = __webpack_require__(114)
|
|
||||||
// Determine if version is less than all the versions possible in the range
|
|
||||||
const ltr = (version, range, options) => outside(version, range, '<', options)
|
|
||||||
module.exports = ltr
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 305:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
// just pre-load all the stuff that index.js lazily exports
|
|
||||||
const internalRe = __webpack_require__(10)
|
|
||||||
module.exports = {
|
|
||||||
re: internalRe.re,
|
|
||||||
src: internalRe.src,
|
|
||||||
tokens: internalRe.t,
|
|
||||||
SEMVER_SPEC_VERSION: __webpack_require__(486).SEMVER_SPEC_VERSION,
|
|
||||||
SemVer: __webpack_require__(445),
|
|
||||||
compareIdentifiers: __webpack_require__(457).compareIdentifiers,
|
|
||||||
rcompareIdentifiers: __webpack_require__(457).rcompareIdentifiers,
|
|
||||||
parse: __webpack_require__(752),
|
|
||||||
valid: __webpack_require__(751),
|
|
||||||
clean: __webpack_require__(662),
|
|
||||||
inc: __webpack_require__(532),
|
|
||||||
diff: __webpack_require__(201),
|
|
||||||
major: __webpack_require__(934),
|
|
||||||
minor: __webpack_require__(422),
|
|
||||||
patch: __webpack_require__(853),
|
|
||||||
prerelease: __webpack_require__(735),
|
|
||||||
compare: __webpack_require__(499),
|
|
||||||
rcompare: __webpack_require__(493),
|
|
||||||
compareLoose: __webpack_require__(206),
|
|
||||||
compareBuild: __webpack_require__(370),
|
|
||||||
sort: __webpack_require__(418),
|
|
||||||
rsort: __webpack_require__(216),
|
|
||||||
gt: __webpack_require__(589),
|
|
||||||
lt: __webpack_require__(548),
|
|
||||||
eq: __webpack_require__(265),
|
|
||||||
neq: __webpack_require__(404),
|
|
||||||
gte: __webpack_require__(116),
|
|
||||||
lte: __webpack_require__(369),
|
|
||||||
cmp: __webpack_require__(876),
|
|
||||||
coerce: __webpack_require__(131),
|
|
||||||
Comparator: __webpack_require__(668),
|
|
||||||
Range: __webpack_require__(583),
|
|
||||||
satisfies: __webpack_require__(638),
|
|
||||||
toComparators: __webpack_require__(845),
|
|
||||||
maxSatisfying: __webpack_require__(88),
|
|
||||||
minSatisfying: __webpack_require__(882),
|
|
||||||
minVersion: __webpack_require__(813),
|
|
||||||
validRange: __webpack_require__(140),
|
|
||||||
outside: __webpack_require__(114),
|
|
||||||
gtr: __webpack_require__(237),
|
|
||||||
ltr: __webpack_require__(270),
|
|
||||||
intersects: __webpack_require__(597),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 324:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const url = __webpack_require__(835);
|
|
||||||
function getProxyUrl(reqUrl) {
|
|
||||||
let usingSsl = reqUrl.protocol === 'https:';
|
|
||||||
let proxyUrl;
|
|
||||||
if (checkBypass(reqUrl)) {
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
|
||||||
let proxyVar;
|
|
||||||
if (usingSsl) {
|
|
||||||
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
|
||||||
}
|
|
||||||
if (proxyVar) {
|
|
||||||
proxyUrl = url.parse(proxyVar);
|
|
||||||
}
|
|
||||||
return proxyUrl;
|
|
||||||
}
|
|
||||||
exports.getProxyUrl = getProxyUrl;
|
|
||||||
function checkBypass(reqUrl) {
|
|
||||||
if (!reqUrl.hostname) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
|
||||||
if (!noProxy) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Determine the request port
|
|
||||||
let reqPort;
|
|
||||||
if (reqUrl.port) {
|
|
||||||
reqPort = Number(reqUrl.port);
|
|
||||||
}
|
|
||||||
else if (reqUrl.protocol === 'http:') {
|
|
||||||
reqPort = 80;
|
|
||||||
}
|
|
||||||
else if (reqUrl.protocol === 'https:') {
|
|
||||||
reqPort = 443;
|
|
||||||
}
|
|
||||||
// Format the request hostname and hostname with port
|
|
||||||
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
|
||||||
if (typeof reqPort === 'number') {
|
|
||||||
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
|
||||||
}
|
|
||||||
// Compare request host against noproxy
|
|
||||||
for (let upperNoProxyItem of noProxy
|
|
||||||
.split(',')
|
|
||||||
.map(x => x.trim().toUpperCase())
|
|
||||||
.filter(x => x)) {
|
|
||||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
exports.checkBypass = checkBypass;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 344:
|
|
||||||
/***/ (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 core = __importStar(__webpack_require__(696));
|
|
||||||
const finder = __importStar(__webpack_require__(507));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
|
||||||
const os = __importStar(__webpack_require__(87));
|
|
||||||
function run() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
let version = core.getInput('python-version');
|
|
||||||
if (version) {
|
|
||||||
const arch = core.getInput('architecture') || os.arch();
|
|
||||||
const installed = yield finder.findPythonVersion(version, arch);
|
|
||||||
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
|
|
||||||
}
|
|
||||||
const matchersPath = path.join(__dirname, '..', '.github');
|
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core.setFailed(err.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
run();
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 357:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("assert");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 369:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const lte = (a, b, loose) => compare(a, b, loose) <= 0
|
|
||||||
module.exports = lte
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 370:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const compareBuild = (a, b, loose) => {
|
|
||||||
const versionA = new SemVer(a, loose)
|
|
||||||
const versionB = new SemVer(b, loose)
|
|
||||||
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
|
||||||
}
|
|
||||||
module.exports = compareBuild
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 396:
|
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
const debug = (
|
const debug = (
|
||||||
@ -2570,2271 +4173,7 @@ module.exports = debug
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 400:
|
/***/ 550:
|
||||||
/***/ (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 path = __importStar(__webpack_require__(622));
|
|
||||||
const core = __importStar(__webpack_require__(696));
|
|
||||||
const tc = __importStar(__webpack_require__(475));
|
|
||||||
const exec = __importStar(__webpack_require__(838));
|
|
||||||
const AUTH_TOKEN = core.getInput('token');
|
|
||||||
const MANIFEST_REPO_OWNER = 'actions';
|
|
||||||
const MANIFEST_REPO_NAME = 'python-versions';
|
|
||||||
exports.MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/master/versions-manifest.json`;
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
function findReleaseFromManifest(semanticVersionSpec, architecture) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const manifest = yield tc.getManifestFromRepo(MANIFEST_REPO_OWNER, MANIFEST_REPO_NAME, AUTH_TOKEN);
|
|
||||||
return yield tc.findFromManifest(semanticVersionSpec, true, manifest, architecture);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.findReleaseFromManifest = findReleaseFromManifest;
|
|
||||||
function installPython(workingDirectory) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const options = {
|
|
||||||
cwd: workingDirectory,
|
|
||||||
silent: true,
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
core.debug(data.toString().trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
yield exec.exec('powershell', ['./setup.ps1'], options);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield exec.exec('bash', ['./setup.sh'], options);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function installCpythonFromRelease(release) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const downloadUrl = release.files[0].download_url;
|
|
||||||
core.info(`Download from "${downloadUrl}"`);
|
|
||||||
const pythonPath = yield tc.downloadTool(downloadUrl, undefined, AUTH_TOKEN);
|
|
||||||
const fileName = path.basename(pythonPath, '.zip');
|
|
||||||
core.info('Extract downloaded archive');
|
|
||||||
let pythonExtractedFolder;
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
pythonExtractedFolder = yield tc.extractZip(pythonPath, `./${fileName}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pythonExtractedFolder = yield tc.extractTar(pythonPath, `./${fileName}`);
|
|
||||||
}
|
|
||||||
core.info('Execute installation script');
|
|
||||||
yield installPython(pythonExtractedFolder);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.installCpythonFromRelease = installCpythonFromRelease;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 404:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
|
||||||
module.exports = neq
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 413:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("stream");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 417:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("crypto");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 418:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compareBuild = __webpack_require__(370)
|
|
||||||
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
|
|
||||||
module.exports = sort
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 422:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const minor = (a, loose) => new SemVer(a, loose).minor
|
|
||||||
module.exports = minor
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 445:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const debug = __webpack_require__(396)
|
|
||||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(486)
|
|
||||||
const { re, t } = __webpack_require__(10)
|
|
||||||
|
|
||||||
const { compareIdentifiers } = __webpack_require__(457)
|
|
||||||
class SemVer {
|
|
||||||
constructor (version, options) {
|
|
||||||
if (!options || typeof options !== 'object') {
|
|
||||||
options = {
|
|
||||||
loose: !!options,
|
|
||||||
includePrerelease: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (version instanceof SemVer) {
|
|
||||||
if (version.loose === !!options.loose &&
|
|
||||||
version.includePrerelease === !!options.includePrerelease) {
|
|
||||||
return version
|
|
||||||
} else {
|
|
||||||
version = version.version
|
|
||||||
}
|
|
||||||
} else if (typeof version !== 'string') {
|
|
||||||
throw new TypeError(`Invalid Version: ${version}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version.length > MAX_LENGTH) {
|
|
||||||
throw new TypeError(
|
|
||||||
`version is longer than ${MAX_LENGTH} characters`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('SemVer', version, options)
|
|
||||||
this.options = options
|
|
||||||
this.loose = !!options.loose
|
|
||||||
// this isn't actually relevant for versions, but keep it so that we
|
|
||||||
// don't run into trouble passing this.options around.
|
|
||||||
this.includePrerelease = !!options.includePrerelease
|
|
||||||
|
|
||||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
|
||||||
|
|
||||||
if (!m) {
|
|
||||||
throw new TypeError(`Invalid Version: ${version}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.raw = version
|
|
||||||
|
|
||||||
// these are actually numbers
|
|
||||||
this.major = +m[1]
|
|
||||||
this.minor = +m[2]
|
|
||||||
this.patch = +m[3]
|
|
||||||
|
|
||||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
||||||
throw new TypeError('Invalid major version')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
||||||
throw new TypeError('Invalid minor version')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
||||||
throw new TypeError('Invalid patch version')
|
|
||||||
}
|
|
||||||
|
|
||||||
// numberify any prerelease numeric ids
|
|
||||||
if (!m[4]) {
|
|
||||||
this.prerelease = []
|
|
||||||
} else {
|
|
||||||
this.prerelease = m[4].split('.').map((id) => {
|
|
||||||
if (/^[0-9]+$/.test(id)) {
|
|
||||||
const num = +id
|
|
||||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
||||||
return num
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.build = m[5] ? m[5].split('.') : []
|
|
||||||
this.format()
|
|
||||||
}
|
|
||||||
|
|
||||||
format () {
|
|
||||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
|
||||||
if (this.prerelease.length) {
|
|
||||||
this.version += `-${this.prerelease.join('.')}`
|
|
||||||
}
|
|
||||||
return this.version
|
|
||||||
}
|
|
||||||
|
|
||||||
toString () {
|
|
||||||
return this.version
|
|
||||||
}
|
|
||||||
|
|
||||||
compare (other) {
|
|
||||||
debug('SemVer.compare', this.version, this.options, other)
|
|
||||||
if (!(other instanceof SemVer)) {
|
|
||||||
if (typeof other === 'string' && other === this.version) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
other = new SemVer(other, this.options)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (other.version === this.version) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.compareMain(other) || this.comparePre(other)
|
|
||||||
}
|
|
||||||
|
|
||||||
compareMain (other) {
|
|
||||||
if (!(other instanceof SemVer)) {
|
|
||||||
other = new SemVer(other, this.options)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
compareIdentifiers(this.major, other.major) ||
|
|
||||||
compareIdentifiers(this.minor, other.minor) ||
|
|
||||||
compareIdentifiers(this.patch, other.patch)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
comparePre (other) {
|
|
||||||
if (!(other instanceof SemVer)) {
|
|
||||||
other = new SemVer(other, this.options)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT having a prerelease is > having one
|
|
||||||
if (this.prerelease.length && !other.prerelease.length) {
|
|
||||||
return -1
|
|
||||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
||||||
return 1
|
|
||||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
let i = 0
|
|
||||||
do {
|
|
||||||
const a = this.prerelease[i]
|
|
||||||
const b = other.prerelease[i]
|
|
||||||
debug('prerelease compare', i, a, b)
|
|
||||||
if (a === undefined && b === undefined) {
|
|
||||||
return 0
|
|
||||||
} else if (b === undefined) {
|
|
||||||
return 1
|
|
||||||
} else if (a === undefined) {
|
|
||||||
return -1
|
|
||||||
} else if (a === b) {
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
return compareIdentifiers(a, b)
|
|
||||||
}
|
|
||||||
} while (++i)
|
|
||||||
}
|
|
||||||
|
|
||||||
compareBuild (other) {
|
|
||||||
if (!(other instanceof SemVer)) {
|
|
||||||
other = new SemVer(other, this.options)
|
|
||||||
}
|
|
||||||
|
|
||||||
let i = 0
|
|
||||||
do {
|
|
||||||
const a = this.build[i]
|
|
||||||
const b = other.build[i]
|
|
||||||
debug('prerelease compare', i, a, b)
|
|
||||||
if (a === undefined && b === undefined) {
|
|
||||||
return 0
|
|
||||||
} else if (b === undefined) {
|
|
||||||
return 1
|
|
||||||
} else if (a === undefined) {
|
|
||||||
return -1
|
|
||||||
} else if (a === b) {
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
return compareIdentifiers(a, b)
|
|
||||||
}
|
|
||||||
} while (++i)
|
|
||||||
}
|
|
||||||
|
|
||||||
// preminor will bump the version up to the next minor release, and immediately
|
|
||||||
// down to pre-release. premajor and prepatch work the same way.
|
|
||||||
inc (release, identifier) {
|
|
||||||
switch (release) {
|
|
||||||
case 'premajor':
|
|
||||||
this.prerelease.length = 0
|
|
||||||
this.patch = 0
|
|
||||||
this.minor = 0
|
|
||||||
this.major++
|
|
||||||
this.inc('pre', identifier)
|
|
||||||
break
|
|
||||||
case 'preminor':
|
|
||||||
this.prerelease.length = 0
|
|
||||||
this.patch = 0
|
|
||||||
this.minor++
|
|
||||||
this.inc('pre', identifier)
|
|
||||||
break
|
|
||||||
case 'prepatch':
|
|
||||||
// If this is already a prerelease, it will bump to the next version
|
|
||||||
// drop any prereleases that might already exist, since they are not
|
|
||||||
// relevant at this point.
|
|
||||||
this.prerelease.length = 0
|
|
||||||
this.inc('patch', identifier)
|
|
||||||
this.inc('pre', identifier)
|
|
||||||
break
|
|
||||||
// If the input is a non-prerelease version, this acts the same as
|
|
||||||
// prepatch.
|
|
||||||
case 'prerelease':
|
|
||||||
if (this.prerelease.length === 0) {
|
|
||||||
this.inc('patch', identifier)
|
|
||||||
}
|
|
||||||
this.inc('pre', identifier)
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'major':
|
|
||||||
// If this is a pre-major version, bump up to the same major version.
|
|
||||||
// Otherwise increment major.
|
|
||||||
// 1.0.0-5 bumps to 1.0.0
|
|
||||||
// 1.1.0 bumps to 2.0.0
|
|
||||||
if (
|
|
||||||
this.minor !== 0 ||
|
|
||||||
this.patch !== 0 ||
|
|
||||||
this.prerelease.length === 0
|
|
||||||
) {
|
|
||||||
this.major++
|
|
||||||
}
|
|
||||||
this.minor = 0
|
|
||||||
this.patch = 0
|
|
||||||
this.prerelease = []
|
|
||||||
break
|
|
||||||
case 'minor':
|
|
||||||
// If this is a pre-minor version, bump up to the same minor version.
|
|
||||||
// Otherwise increment minor.
|
|
||||||
// 1.2.0-5 bumps to 1.2.0
|
|
||||||
// 1.2.1 bumps to 1.3.0
|
|
||||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
||||||
this.minor++
|
|
||||||
}
|
|
||||||
this.patch = 0
|
|
||||||
this.prerelease = []
|
|
||||||
break
|
|
||||||
case 'patch':
|
|
||||||
// If this is not a pre-release version, it will increment the patch.
|
|
||||||
// If it is a pre-release it will bump up to the same patch version.
|
|
||||||
// 1.2.0-5 patches to 1.2.0
|
|
||||||
// 1.2.0 patches to 1.2.1
|
|
||||||
if (this.prerelease.length === 0) {
|
|
||||||
this.patch++
|
|
||||||
}
|
|
||||||
this.prerelease = []
|
|
||||||
break
|
|
||||||
// This probably shouldn't be used publicly.
|
|
||||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
||||||
case 'pre':
|
|
||||||
if (this.prerelease.length === 0) {
|
|
||||||
this.prerelease = [0]
|
|
||||||
} else {
|
|
||||||
let i = this.prerelease.length
|
|
||||||
while (--i >= 0) {
|
|
||||||
if (typeof this.prerelease[i] === 'number') {
|
|
||||||
this.prerelease[i]++
|
|
||||||
i = -2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i === -1) {
|
|
||||||
// didn't increment anything
|
|
||||||
this.prerelease.push(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (identifier) {
|
|
||||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
||||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
||||||
if (this.prerelease[0] === identifier) {
|
|
||||||
if (isNaN(this.prerelease[1])) {
|
|
||||||
this.prerelease = [identifier, 0]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.prerelease = [identifier, 0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Error(`invalid increment argument: ${release}`)
|
|
||||||
}
|
|
||||||
this.format()
|
|
||||||
this.raw = this.version
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = SemVer
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 457:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
const numeric = /^[0-9]+$/
|
|
||||||
const compareIdentifiers = (a, b) => {
|
|
||||||
const anum = numeric.test(a)
|
|
||||||
const bnum = numeric.test(b)
|
|
||||||
|
|
||||||
if (anum && bnum) {
|
|
||||||
a = +a
|
|
||||||
b = +b
|
|
||||||
}
|
|
||||||
|
|
||||||
return a === b ? 0
|
|
||||||
: (anum && !bnum) ? -1
|
|
||||||
: (bnum && !anum) ? 1
|
|
||||||
: a < b ? -1
|
|
||||||
: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
compareIdentifiers,
|
|
||||||
rcompareIdentifiers
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 475:
|
|
||||||
/***/ (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;
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const core = __importStar(__webpack_require__(696));
|
|
||||||
const io = __importStar(__webpack_require__(788));
|
|
||||||
const fs = __importStar(__webpack_require__(747));
|
|
||||||
const mm = __importStar(__webpack_require__(196));
|
|
||||||
const os = __importStar(__webpack_require__(87));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
|
||||||
const httpm = __importStar(__webpack_require__(112));
|
|
||||||
const semver = __importStar(__webpack_require__(761));
|
|
||||||
const stream = __importStar(__webpack_require__(413));
|
|
||||||
const util = __importStar(__webpack_require__(669));
|
|
||||||
const v4_1 = __importDefault(__webpack_require__(851));
|
|
||||||
const exec_1 = __webpack_require__(838);
|
|
||||||
const assert_1 = __webpack_require__(357);
|
|
||||||
const retry_helper_1 = __webpack_require__(9);
|
|
||||||
class HTTPError extends Error {
|
|
||||||
constructor(httpStatusCode) {
|
|
||||||
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
|
||||||
this.httpStatusCode = httpStatusCode;
|
|
||||||
Object.setPrototypeOf(this, new.target.prototype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.HTTPError = HTTPError;
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
const userAgent = 'actions/tool-cache';
|
|
||||||
/**
|
|
||||||
* Download a tool from an url and stream it into a file
|
|
||||||
*
|
|
||||||
* @param url url of tool to download
|
|
||||||
* @param dest path to download tool
|
|
||||||
* @returns path to downloaded tool
|
|
||||||
*/
|
|
||||||
function downloadTool(url, dest, token) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
|
||||||
yield io.mkdirP(path.dirname(dest));
|
|
||||||
core.debug(`Downloading ${url}`);
|
|
||||||
core.debug(`Destination ${dest}`);
|
|
||||||
const maxAttempts = 3;
|
|
||||||
const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10);
|
|
||||||
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
|
||||||
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
|
||||||
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
return yield downloadToolAttempt(url, dest || '', token);
|
|
||||||
}), (err) => {
|
|
||||||
if (err instanceof HTTPError && err.httpStatusCode) {
|
|
||||||
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
|
||||||
if (err.httpStatusCode < 500 &&
|
|
||||||
err.httpStatusCode !== 408 &&
|
|
||||||
err.httpStatusCode !== 429) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Otherwise retry
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.downloadTool = downloadTool;
|
|
||||||
function downloadToolAttempt(url, dest, token) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (fs.existsSync(dest)) {
|
|
||||||
throw new Error(`Destination file path ${dest} already exists`);
|
|
||||||
}
|
|
||||||
// Get the response headers
|
|
||||||
const http = new httpm.HttpClient(userAgent, [], {
|
|
||||||
allowRetries: false
|
|
||||||
});
|
|
||||||
let headers;
|
|
||||||
if (token) {
|
|
||||||
headers = {
|
|
||||||
authorization: `token ${token}`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const response = yield http.get(url, headers);
|
|
||||||
if (response.message.statusCode !== 200) {
|
|
||||||
const err = new HTTPError(response.message.statusCode);
|
|
||||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
// Download the response body
|
|
||||||
const pipeline = util.promisify(stream.pipeline);
|
|
||||||
const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message);
|
|
||||||
const readStream = responseMessageFactory();
|
|
||||||
let succeeded = false;
|
|
||||||
try {
|
|
||||||
yield pipeline(readStream, fs.createWriteStream(dest));
|
|
||||||
core.debug('download complete');
|
|
||||||
succeeded = true;
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
// Error, delete dest before retry
|
|
||||||
if (!succeeded) {
|
|
||||||
core.debug('download failed');
|
|
||||||
try {
|
|
||||||
yield io.rmRF(dest);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core.debug(`Failed to delete '${dest}'. ${err.message}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Extract a .7z file
|
|
||||||
*
|
|
||||||
* @param file path to the .7z file
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
|
||||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
|
||||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
|
||||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
|
||||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
|
||||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
|
||||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
|
||||||
* to 7zr.exe can be pass to this function.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
function extract7z(file, dest, _7zPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
|
||||||
assert_1.ok(file, 'parameter "file" is required');
|
|
||||||
dest = yield _createExtractFolder(dest);
|
|
||||||
const originalCwd = process.cwd();
|
|
||||||
process.chdir(dest);
|
|
||||||
if (_7zPath) {
|
|
||||||
try {
|
|
||||||
const args = [
|
|
||||||
'x',
|
|
||||||
'-bb1',
|
|
||||||
'-bd',
|
|
||||||
'-sccUTF-8',
|
|
||||||
file
|
|
||||||
];
|
|
||||||
const options = {
|
|
||||||
silent: true
|
|
||||||
};
|
|
||||||
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
process.chdir(originalCwd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const escapedScript = path
|
|
||||||
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
|
||||||
.replace(/'/g, "''")
|
|
||||||
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
||||||
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
||||||
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
|
||||||
const args = [
|
|
||||||
'-NoLogo',
|
|
||||||
'-Sta',
|
|
||||||
'-NoProfile',
|
|
||||||
'-NonInteractive',
|
|
||||||
'-ExecutionPolicy',
|
|
||||||
'Unrestricted',
|
|
||||||
'-Command',
|
|
||||||
command
|
|
||||||
];
|
|
||||||
const options = {
|
|
||||||
silent: true
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
const powershellPath = yield io.which('powershell', true);
|
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
process.chdir(originalCwd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extract7z = extract7z;
|
|
||||||
/**
|
|
||||||
* Extract a compressed tar archive
|
|
||||||
*
|
|
||||||
* @param file path to the tar
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @param flags flags for the tar command to use for extraction. Defaults to 'xz' (extracting gzipped tars). Optional.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
function extractTar(file, dest, flags = 'xz') {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!file) {
|
|
||||||
throw new Error("parameter 'file' is required");
|
|
||||||
}
|
|
||||||
// Create dest
|
|
||||||
dest = yield _createExtractFolder(dest);
|
|
||||||
// Determine whether GNU tar
|
|
||||||
core.debug('Checking tar --version');
|
|
||||||
let versionOutput = '';
|
|
||||||
yield exec_1.exec('tar --version', [], {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true,
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => (versionOutput += data.toString()),
|
|
||||||
stderr: (data) => (versionOutput += data.toString())
|
|
||||||
}
|
|
||||||
});
|
|
||||||
core.debug(versionOutput.trim());
|
|
||||||
const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
|
|
||||||
// Initialize args
|
|
||||||
const args = [flags];
|
|
||||||
let destArg = dest;
|
|
||||||
let fileArg = file;
|
|
||||||
if (IS_WINDOWS && isGnuTar) {
|
|
||||||
args.push('--force-local');
|
|
||||||
destArg = dest.replace(/\\/g, '/');
|
|
||||||
// Technically only the dest needs to have `/` but for aesthetic consistency
|
|
||||||
// convert slashes in the file arg too.
|
|
||||||
fileArg = file.replace(/\\/g, '/');
|
|
||||||
}
|
|
||||||
if (isGnuTar) {
|
|
||||||
// Suppress warnings when using GNU tar to extract archives created by BSD tar
|
|
||||||
args.push('--warning=no-unknown-keyword');
|
|
||||||
}
|
|
||||||
args.push('-C', destArg, '-f', fileArg);
|
|
||||||
yield exec_1.exec(`tar`, args);
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extractTar = extractTar;
|
|
||||||
/**
|
|
||||||
* Extract a zip
|
|
||||||
*
|
|
||||||
* @param file path to the zip
|
|
||||||
* @param dest destination directory. Optional.
|
|
||||||
* @returns path to the destination directory
|
|
||||||
*/
|
|
||||||
function extractZip(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!file) {
|
|
||||||
throw new Error("parameter 'file' is required");
|
|
||||||
}
|
|
||||||
dest = yield _createExtractFolder(dest);
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
yield extractZipWin(file, dest);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield extractZipNix(file, dest);
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extractZip = extractZip;
|
|
||||||
function extractZipWin(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// build the powershell command
|
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
|
||||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
||||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
|
||||||
// run powershell
|
|
||||||
const powershellPath = yield io.which('powershell');
|
|
||||||
const args = [
|
|
||||||
'-NoLogo',
|
|
||||||
'-Sta',
|
|
||||||
'-NoProfile',
|
|
||||||
'-NonInteractive',
|
|
||||||
'-ExecutionPolicy',
|
|
||||||
'Unrestricted',
|
|
||||||
'-Command',
|
|
||||||
command
|
|
||||||
];
|
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function extractZipNix(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const unzipPath = yield io.which('unzip');
|
|
||||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Caches a directory and installs it into the tool cacheDir
|
|
||||||
*
|
|
||||||
* @param sourceDir the directory to cache into tools
|
|
||||||
* @param tool tool name
|
|
||||||
* @param version version of the tool. semver format
|
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
|
||||||
*/
|
|
||||||
function cacheDir(sourceDir, tool, version, arch) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
version = semver.clean(version) || version;
|
|
||||||
arch = arch || os.arch();
|
|
||||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
|
||||||
core.debug(`source dir: ${sourceDir}`);
|
|
||||||
if (!fs.statSync(sourceDir).isDirectory()) {
|
|
||||||
throw new Error('sourceDir is not a directory');
|
|
||||||
}
|
|
||||||
// Create the tool dir
|
|
||||||
const destPath = yield _createToolPath(tool, version, arch);
|
|
||||||
// copy each child item. do not move. move can fail on Windows
|
|
||||||
// due to anti-virus software having an open handle on a file.
|
|
||||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
|
||||||
const s = path.join(sourceDir, itemName);
|
|
||||||
yield io.cp(s, destPath, { recursive: true });
|
|
||||||
}
|
|
||||||
// write .complete
|
|
||||||
_completeToolPath(tool, version, arch);
|
|
||||||
return destPath;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.cacheDir = cacheDir;
|
|
||||||
/**
|
|
||||||
* Caches a downloaded file (GUID) and installs it
|
|
||||||
* into the tool cache with a given targetName
|
|
||||||
*
|
|
||||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
|
||||||
* @param targetFile the name of the file name in the tools directory
|
|
||||||
* @param tool tool name
|
|
||||||
* @param version version of the tool. semver format
|
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
|
||||||
*/
|
|
||||||
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
version = semver.clean(version) || version;
|
|
||||||
arch = arch || os.arch();
|
|
||||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
|
||||||
core.debug(`source file: ${sourceFile}`);
|
|
||||||
if (!fs.statSync(sourceFile).isFile()) {
|
|
||||||
throw new Error('sourceFile is not a file');
|
|
||||||
}
|
|
||||||
// create the tool dir
|
|
||||||
const destFolder = yield _createToolPath(tool, version, arch);
|
|
||||||
// copy instead of move. move can fail on Windows due to
|
|
||||||
// anti-virus software having an open handle on a file.
|
|
||||||
const destPath = path.join(destFolder, targetFile);
|
|
||||||
core.debug(`destination file ${destPath}`);
|
|
||||||
yield io.cp(sourceFile, destPath);
|
|
||||||
// write .complete
|
|
||||||
_completeToolPath(tool, version, arch);
|
|
||||||
return destFolder;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.cacheFile = cacheFile;
|
|
||||||
/**
|
|
||||||
* Finds the path to a tool version in the local installed tool cache
|
|
||||||
*
|
|
||||||
* @param toolName name of the tool
|
|
||||||
* @param versionSpec version of the tool
|
|
||||||
* @param arch optional arch. defaults to arch of computer
|
|
||||||
*/
|
|
||||||
function find(toolName, versionSpec, arch) {
|
|
||||||
if (!toolName) {
|
|
||||||
throw new Error('toolName parameter is required');
|
|
||||||
}
|
|
||||||
if (!versionSpec) {
|
|
||||||
throw new Error('versionSpec parameter is required');
|
|
||||||
}
|
|
||||||
arch = arch || os.arch();
|
|
||||||
// attempt to resolve an explicit version
|
|
||||||
if (!_isExplicitVersion(versionSpec)) {
|
|
||||||
const localVersions = findAllVersions(toolName, arch);
|
|
||||||
const match = _evaluateVersions(localVersions, versionSpec);
|
|
||||||
versionSpec = match;
|
|
||||||
}
|
|
||||||
// check for the explicit version in the cache
|
|
||||||
let toolPath = '';
|
|
||||||
if (versionSpec) {
|
|
||||||
versionSpec = semver.clean(versionSpec) || '';
|
|
||||||
const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch);
|
|
||||||
core.debug(`checking cache: ${cachePath}`);
|
|
||||||
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
|
||||||
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
|
||||||
toolPath = cachePath;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug('not found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toolPath;
|
|
||||||
}
|
|
||||||
exports.find = find;
|
|
||||||
/**
|
|
||||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
|
||||||
*
|
|
||||||
* @param toolName name of the tool
|
|
||||||
* @param arch optional arch. defaults to arch of computer
|
|
||||||
*/
|
|
||||||
function findAllVersions(toolName, arch) {
|
|
||||||
const versions = [];
|
|
||||||
arch = arch || os.arch();
|
|
||||||
const toolPath = path.join(_getCacheDirectory(), toolName);
|
|
||||||
if (fs.existsSync(toolPath)) {
|
|
||||||
const children = fs.readdirSync(toolPath);
|
|
||||||
for (const child of children) {
|
|
||||||
if (_isExplicitVersion(child)) {
|
|
||||||
const fullPath = path.join(toolPath, child, arch || '');
|
|
||||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
|
||||||
versions.push(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return versions;
|
|
||||||
}
|
|
||||||
exports.findAllVersions = findAllVersions;
|
|
||||||
function getManifestFromRepo(owner, repo, token, branch = 'master') {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let releases = [];
|
|
||||||
const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`;
|
|
||||||
const http = new httpm.HttpClient('tool-cache');
|
|
||||||
const headers = {
|
|
||||||
authorization: `token ${token}`
|
|
||||||
};
|
|
||||||
const response = yield http.getJson(treeUrl, headers);
|
|
||||||
if (!response.result) {
|
|
||||||
return releases;
|
|
||||||
}
|
|
||||||
let manifestUrl = '';
|
|
||||||
for (const item of response.result.tree) {
|
|
||||||
if (item.path === 'versions-manifest.json') {
|
|
||||||
manifestUrl = item.url;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
|
||||||
let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
|
|
||||||
if (versionsRaw) {
|
|
||||||
// shouldn't be needed but protects against invalid json saved with BOM
|
|
||||||
versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
|
|
||||||
try {
|
|
||||||
releases = JSON.parse(versionsRaw);
|
|
||||||
}
|
|
||||||
catch (_a) {
|
|
||||||
core.debug('Invalid json');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return releases;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getManifestFromRepo = getManifestFromRepo;
|
|
||||||
function findFromManifest(versionSpec, stable, manifest, archFilter = os.arch()) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// wrap the internal impl
|
|
||||||
const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
|
|
||||||
return match;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.findFromManifest = findFromManifest;
|
|
||||||
function _createExtractFolder(dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!dest) {
|
|
||||||
// create a temp dir
|
|
||||||
dest = path.join(_getTempDirectory(), v4_1.default());
|
|
||||||
}
|
|
||||||
yield io.mkdirP(dest);
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function _createToolPath(tool, version, arch) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
|
|
||||||
core.debug(`destination ${folderPath}`);
|
|
||||||
const markerPath = `${folderPath}.complete`;
|
|
||||||
yield io.rmRF(folderPath);
|
|
||||||
yield io.rmRF(markerPath);
|
|
||||||
yield io.mkdirP(folderPath);
|
|
||||||
return folderPath;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function _completeToolPath(tool, version, arch) {
|
|
||||||
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || '');
|
|
||||||
const markerPath = `${folderPath}.complete`;
|
|
||||||
fs.writeFileSync(markerPath, '');
|
|
||||||
core.debug('finished caching tool');
|
|
||||||
}
|
|
||||||
function _isExplicitVersion(versionSpec) {
|
|
||||||
const c = semver.clean(versionSpec) || '';
|
|
||||||
core.debug(`isExplicit: ${c}`);
|
|
||||||
const valid = semver.valid(c) != null;
|
|
||||||
core.debug(`explicit? ${valid}`);
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
function _evaluateVersions(versions, versionSpec) {
|
|
||||||
let version = '';
|
|
||||||
core.debug(`evaluating ${versions.length} versions`);
|
|
||||||
versions = versions.sort((a, b) => {
|
|
||||||
if (semver.gt(a, b)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
|
||||||
const potential = versions[i];
|
|
||||||
const satisfied = semver.satisfies(potential, versionSpec);
|
|
||||||
if (satisfied) {
|
|
||||||
version = potential;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (version) {
|
|
||||||
core.debug(`matched: ${version}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug('match not found');
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets RUNNER_TOOL_CACHE
|
|
||||||
*/
|
|
||||||
function _getCacheDirectory() {
|
|
||||||
const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
|
|
||||||
assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
|
|
||||||
return cacheDirectory;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets RUNNER_TEMP
|
|
||||||
*/
|
|
||||||
function _getTempDirectory() {
|
|
||||||
const tempDirectory = process.env['RUNNER_TEMP'] || '';
|
|
||||||
assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
|
|
||||||
return tempDirectory;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets a global variable
|
|
||||||
*/
|
|
||||||
function _getGlobal(key, defaultValue) {
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
const value = global[key];
|
|
||||||
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
||||||
return value !== undefined ? value : defaultValue;
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=tool-cache.js.map
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 486:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
// Note: this is the semver.org version of the spec that it implements
|
|
||||||
// Not necessarily the package version of this code.
|
|
||||||
const SEMVER_SPEC_VERSION = '2.0.0'
|
|
||||||
|
|
||||||
const MAX_LENGTH = 256
|
|
||||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|
||||||
/* istanbul ignore next */ 9007199254740991
|
|
||||||
|
|
||||||
// Max safe segment length for coercion.
|
|
||||||
const MAX_SAFE_COMPONENT_LENGTH = 16
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
SEMVER_SPEC_VERSION,
|
|
||||||
MAX_LENGTH,
|
|
||||||
MAX_SAFE_INTEGER,
|
|
||||||
MAX_SAFE_COMPONENT_LENGTH
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 493:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const rcompare = (a, b, loose) => compare(b, a, loose)
|
|
||||||
module.exports = rcompare
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 499:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const compare = (a, b, loose) =>
|
|
||||||
new SemVer(a, loose).compare(new SemVer(b, loose))
|
|
||||||
|
|
||||||
module.exports = compare
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 507:
|
|
||||||
/***/ (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 os = __importStar(__webpack_require__(87));
|
|
||||||
const path = __importStar(__webpack_require__(622));
|
|
||||||
const semver = __importStar(__webpack_require__(305));
|
|
||||||
const installer = __importStar(__webpack_require__(400));
|
|
||||||
const core = __importStar(__webpack_require__(696));
|
|
||||||
const tc = __importStar(__webpack_require__(475));
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
|
|
||||||
// This is where pip is, along with anything that pip installs.
|
|
||||||
// There is a seperate directory for `pip install --user`.
|
|
||||||
//
|
|
||||||
// For reference, these directories are as follows:
|
|
||||||
// macOS / Linux:
|
|
||||||
// <sys.prefix>/bin (by default /usr/local/bin, but not on hosted agents -- see the `else`)
|
|
||||||
// (--user) ~/.local/bin
|
|
||||||
// Windows:
|
|
||||||
// <Python installation dir>\Scripts
|
|
||||||
// (--user) %APPDATA%\Python\PythonXY\Scripts
|
|
||||||
// See https://docs.python.org/3/library/sysconfig.html
|
|
||||||
function binDir(installDir) {
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
return path.join(installDir, 'Scripts');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return path.join(installDir, 'bin');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Note on the tool cache layout for PyPy:
|
|
||||||
// PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
|
|
||||||
// A particular version of PyPy may contain one or more versions of the Python interpreter.
|
|
||||||
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
|
|
||||||
// We only care about the Python version, so we don't use the PyPy version for the tool cache.
|
|
||||||
function usePyPy(majorVersion, architecture) {
|
|
||||||
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString());
|
|
||||||
let installDir = findPyPy(architecture);
|
|
||||||
if (!installDir && IS_WINDOWS) {
|
|
||||||
// PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
|
|
||||||
// On our Windows virtual environments, we only install an x86 version.
|
|
||||||
// Fall back to x86.
|
|
||||||
installDir = findPyPy('x86');
|
|
||||||
}
|
|
||||||
if (!installDir) {
|
|
||||||
// PyPy not installed in $(Agent.ToolsDirectory)
|
|
||||||
throw new Error(`PyPy ${majorVersion} not found`);
|
|
||||||
}
|
|
||||||
// For PyPy, Windows uses 'bin', not 'Scripts'.
|
|
||||||
const _binDir = path.join(installDir, 'bin');
|
|
||||||
// On Linux and macOS, the Python interpreter is in 'bin'.
|
|
||||||
// On Windows, it is in the installation root.
|
|
||||||
const pythonLocation = IS_WINDOWS ? installDir : _binDir;
|
|
||||||
core.exportVariable('pythonLocation', pythonLocation);
|
|
||||||
core.addPath(installDir);
|
|
||||||
core.addPath(_binDir);
|
|
||||||
const impl = 'pypy' + majorVersion.toString();
|
|
||||||
core.setOutput('python-version', impl);
|
|
||||||
return { impl: impl, version: versionFromPath(installDir) };
|
|
||||||
}
|
|
||||||
function useCpythonVersion(version, architecture) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const desugaredVersionSpec = desugarDevVersion(version);
|
|
||||||
const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
|
|
||||||
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
|
||||||
let installDir = tc.find('Python', semanticVersionSpec, architecture);
|
|
||||||
if (!installDir) {
|
|
||||||
core.info(`Version ${semanticVersionSpec} was not found in the local cache`);
|
|
||||||
const foundRelease = yield installer.findReleaseFromManifest(semanticVersionSpec, architecture);
|
|
||||||
if (foundRelease && foundRelease.files && foundRelease.files.length > 0) {
|
|
||||||
core.info(`Version ${semanticVersionSpec} is available for downloading`);
|
|
||||||
yield installer.installCpythonFromRelease(foundRelease);
|
|
||||||
installDir = tc.find('Python', semanticVersionSpec, architecture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!installDir) {
|
|
||||||
throw new Error([
|
|
||||||
`Version ${version} with arch ${architecture} not found`,
|
|
||||||
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
|
|
||||||
].join(os.EOL));
|
|
||||||
}
|
|
||||||
core.exportVariable('pythonLocation', installDir);
|
|
||||||
core.addPath(installDir);
|
|
||||||
core.addPath(binDir(installDir));
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
// Add --user directory
|
|
||||||
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
|
|
||||||
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
|
|
||||||
const version = path.basename(path.dirname(installDir));
|
|
||||||
const major = semver.major(version);
|
|
||||||
const minor = semver.minor(version);
|
|
||||||
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
|
||||||
core.addPath(userScriptsDir);
|
|
||||||
}
|
|
||||||
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
|
||||||
const installed = versionFromPath(installDir);
|
|
||||||
core.setOutput('python-version', installed);
|
|
||||||
return { impl: 'CPython', version: installed };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/** Convert versions like `3.8-dev` to a version like `>= 3.8.0-a0`. */
|
|
||||||
function desugarDevVersion(versionSpec) {
|
|
||||||
if (versionSpec.endsWith('-dev')) {
|
|
||||||
const versionRoot = versionSpec.slice(0, -'-dev'.length);
|
|
||||||
return `>= ${versionRoot}.0-a0`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return versionSpec;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** Extracts python version from install path from hosted tool cache as described in README.md */
|
|
||||||
function versionFromPath(installDir) {
|
|
||||||
const parts = installDir.split(path.sep);
|
|
||||||
const idx = parts.findIndex(part => part === 'PyPy' || part === 'Python');
|
|
||||||
return parts[idx + 1] || '';
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Python's prelease versions look like `3.7.0b2`.
|
|
||||||
* This is the one part of Python versioning that does not look like semantic versioning, which specifies `3.7.0-b2`.
|
|
||||||
* If the version spec contains prerelease versions, we need to convert them to the semantic version equivalent.
|
|
||||||
*/
|
|
||||||
function pythonVersionToSemantic(versionSpec) {
|
|
||||||
const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g;
|
|
||||||
return versionSpec.replace(prereleaseVersion, '$1-$2');
|
|
||||||
}
|
|
||||||
exports.pythonVersionToSemantic = pythonVersionToSemantic;
|
|
||||||
function findPythonVersion(version, architecture) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
switch (version.toUpperCase()) {
|
|
||||||
case 'PYPY2':
|
|
||||||
return usePyPy(2, architecture);
|
|
||||||
case 'PYPY3':
|
|
||||||
return usePyPy(3, architecture);
|
|
||||||
default:
|
|
||||||
return yield useCpythonVersion(version, architecture);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.findPythonVersion = findPythonVersion;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 532:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
|
|
||||||
const inc = (version, release, options, identifier) => {
|
|
||||||
if (typeof (options) === 'string') {
|
|
||||||
identifier = options
|
|
||||||
options = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return new SemVer(version, options).inc(release, identifier).version
|
|
||||||
} catch (er) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = inc
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 548:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const lt = (a, b, loose) => compare(a, b, loose) < 0
|
|
||||||
module.exports = lt
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 583:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
// hoisted class for cyclic dependency
|
|
||||||
class Range {
|
|
||||||
constructor (range, options) {
|
|
||||||
if (!options || typeof options !== 'object') {
|
|
||||||
options = {
|
|
||||||
loose: !!options,
|
|
||||||
includePrerelease: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (range instanceof Range) {
|
|
||||||
if (
|
|
||||||
range.loose === !!options.loose &&
|
|
||||||
range.includePrerelease === !!options.includePrerelease
|
|
||||||
) {
|
|
||||||
return range
|
|
||||||
} else {
|
|
||||||
return new Range(range.raw, options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (range instanceof Comparator) {
|
|
||||||
// just put it in the set and return
|
|
||||||
this.raw = range.value
|
|
||||||
this.set = [[range]]
|
|
||||||
this.format()
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
this.options = options
|
|
||||||
this.loose = !!options.loose
|
|
||||||
this.includePrerelease = !!options.includePrerelease
|
|
||||||
|
|
||||||
// First, split based on boolean or ||
|
|
||||||
this.raw = range
|
|
||||||
this.set = range
|
|
||||||
.split(/\s*\|\|\s*/)
|
|
||||||
// map the range to a 2d array of comparators
|
|
||||||
.map(range => this.parseRange(range.trim()))
|
|
||||||
// throw out any comparator lists that are empty
|
|
||||||
// this generally means that it was not a valid range, which is allowed
|
|
||||||
// in loose mode, but will still throw if the WHOLE range is invalid.
|
|
||||||
.filter(c => c.length)
|
|
||||||
|
|
||||||
if (!this.set.length) {
|
|
||||||
throw new TypeError(`Invalid SemVer Range: ${range}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.format()
|
|
||||||
}
|
|
||||||
|
|
||||||
format () {
|
|
||||||
this.range = this.set
|
|
||||||
.map((comps) => {
|
|
||||||
return comps.join(' ').trim()
|
|
||||||
})
|
|
||||||
.join('||')
|
|
||||||
.trim()
|
|
||||||
return this.range
|
|
||||||
}
|
|
||||||
|
|
||||||
toString () {
|
|
||||||
return this.range
|
|
||||||
}
|
|
||||||
|
|
||||||
parseRange (range) {
|
|
||||||
const loose = this.options.loose
|
|
||||||
range = range.trim()
|
|
||||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
||||||
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
|
||||||
range = range.replace(hr, hyphenReplace)
|
|
||||||
debug('hyphen replace', range)
|
|
||||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
||||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
|
||||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
|
||||||
|
|
||||||
// `~ 1.2.3` => `~1.2.3`
|
|
||||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
|
||||||
|
|
||||||
// `^ 1.2.3` => `^1.2.3`
|
|
||||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
|
||||||
|
|
||||||
// normalize spaces
|
|
||||||
range = range.split(/\s+/).join(' ')
|
|
||||||
|
|
||||||
// At this point, the range is completely trimmed and
|
|
||||||
// ready to be split into comparators.
|
|
||||||
|
|
||||||
const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
|
||||||
return range
|
|
||||||
.split(' ')
|
|
||||||
.map(comp => parseComparator(comp, this.options))
|
|
||||||
.join(' ')
|
|
||||||
.split(/\s+/)
|
|
||||||
// in loose mode, throw out any that are not valid comparators
|
|
||||||
.filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
|
|
||||||
.map(comp => new Comparator(comp, this.options))
|
|
||||||
}
|
|
||||||
|
|
||||||
intersects (range, options) {
|
|
||||||
if (!(range instanceof Range)) {
|
|
||||||
throw new TypeError('a Range is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.set.some((thisComparators) => {
|
|
||||||
return (
|
|
||||||
isSatisfiable(thisComparators, options) &&
|
|
||||||
range.set.some((rangeComparators) => {
|
|
||||||
return (
|
|
||||||
isSatisfiable(rangeComparators, options) &&
|
|
||||||
thisComparators.every((thisComparator) => {
|
|
||||||
return rangeComparators.every((rangeComparator) => {
|
|
||||||
return thisComparator.intersects(rangeComparator, options)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// if ANY of the sets match ALL of its comparators, then pass
|
|
||||||
test (version) {
|
|
||||||
if (!version) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof version === 'string') {
|
|
||||||
try {
|
|
||||||
version = new SemVer(version, this.options)
|
|
||||||
} catch (er) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < this.set.length; i++) {
|
|
||||||
if (testSet(this.set[i], version, this.options)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = Range
|
|
||||||
|
|
||||||
const Comparator = __webpack_require__(668)
|
|
||||||
const debug = __webpack_require__(396)
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const {
|
|
||||||
re,
|
|
||||||
t,
|
|
||||||
comparatorTrimReplace,
|
|
||||||
tildeTrimReplace,
|
|
||||||
caretTrimReplace
|
|
||||||
} = __webpack_require__(10)
|
|
||||||
|
|
||||||
// take a set of comparators and determine whether there
|
|
||||||
// exists a version which can satisfy it
|
|
||||||
const isSatisfiable = (comparators, options) => {
|
|
||||||
let result = true
|
|
||||||
const remainingComparators = comparators.slice()
|
|
||||||
let testComparator = remainingComparators.pop()
|
|
||||||
|
|
||||||
while (result && remainingComparators.length) {
|
|
||||||
result = remainingComparators.every((otherComparator) => {
|
|
||||||
return testComparator.intersects(otherComparator, options)
|
|
||||||
})
|
|
||||||
|
|
||||||
testComparator = remainingComparators.pop()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
||||||
// already replaced the hyphen ranges
|
|
||||||
// turn into a set of JUST comparators.
|
|
||||||
const parseComparator = (comp, options) => {
|
|
||||||
debug('comp', comp, options)
|
|
||||||
comp = replaceCarets(comp, options)
|
|
||||||
debug('caret', comp)
|
|
||||||
comp = replaceTildes(comp, options)
|
|
||||||
debug('tildes', comp)
|
|
||||||
comp = replaceXRanges(comp, options)
|
|
||||||
debug('xrange', comp)
|
|
||||||
comp = replaceStars(comp, options)
|
|
||||||
debug('stars', comp)
|
|
||||||
return comp
|
|
||||||
}
|
|
||||||
|
|
||||||
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
|
||||||
|
|
||||||
// ~, ~> --> * (any, kinda silly)
|
|
||||||
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
|
||||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
|
||||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
|
||||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
||||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
||||||
const replaceTildes = (comp, options) =>
|
|
||||||
comp.trim().split(/\s+/).map((comp) => {
|
|
||||||
return replaceTilde(comp, options)
|
|
||||||
}).join(' ')
|
|
||||||
|
|
||||||
const replaceTilde = (comp, options) => {
|
|
||||||
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
|
||||||
return comp.replace(r, (_, M, m, p, pr) => {
|
|
||||||
debug('tilde', comp, _, M, m, p, pr)
|
|
||||||
let ret
|
|
||||||
|
|
||||||
if (isX(M)) {
|
|
||||||
ret = ''
|
|
||||||
} else if (isX(m)) {
|
|
||||||
ret = `>=${M}.0.0 <${+M + 1}.0.0`
|
|
||||||
} else if (isX(p)) {
|
|
||||||
// ~1.2 == >=1.2.0 <1.3.0
|
|
||||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0`
|
|
||||||
} else if (pr) {
|
|
||||||
debug('replaceTilde pr', pr)
|
|
||||||
ret = `>=${M}.${m}.${p}-${pr
|
|
||||||
} <${M}.${+m + 1}.0`
|
|
||||||
} else {
|
|
||||||
// ~1.2.3 == >=1.2.3 <1.3.0
|
|
||||||
ret = `>=${M}.${m}.${p
|
|
||||||
} <${M}.${+m + 1}.0`
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('tilde return', ret)
|
|
||||||
return ret
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ^ --> * (any, kinda silly)
|
|
||||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
|
||||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
|
||||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
|
||||||
// ^1.2.3 --> >=1.2.3 <2.0.0
|
|
||||||
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
||||||
const replaceCarets = (comp, options) =>
|
|
||||||
comp.trim().split(/\s+/).map((comp) => {
|
|
||||||
return replaceCaret(comp, options)
|
|
||||||
}).join(' ')
|
|
||||||
|
|
||||||
const replaceCaret = (comp, options) => {
|
|
||||||
debug('caret', comp, options)
|
|
||||||
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
|
||||||
return comp.replace(r, (_, M, m, p, pr) => {
|
|
||||||
debug('caret', comp, _, M, m, p, pr)
|
|
||||||
let ret
|
|
||||||
|
|
||||||
if (isX(M)) {
|
|
||||||
ret = ''
|
|
||||||
} else if (isX(m)) {
|
|
||||||
ret = `>=${M}.0.0 <${+M + 1}.0.0`
|
|
||||||
} else if (isX(p)) {
|
|
||||||
if (M === '0') {
|
|
||||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0`
|
|
||||||
} else {
|
|
||||||
ret = `>=${M}.${m}.0 <${+M + 1}.0.0`
|
|
||||||
}
|
|
||||||
} else if (pr) {
|
|
||||||
debug('replaceCaret pr', pr)
|
|
||||||
if (M === '0') {
|
|
||||||
if (m === '0') {
|
|
||||||
ret = `>=${M}.${m}.${p}-${pr
|
|
||||||
} <${M}.${m}.${+p + 1}`
|
|
||||||
} else {
|
|
||||||
ret = `>=${M}.${m}.${p}-${pr
|
|
||||||
} <${M}.${+m + 1}.0`
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ret = `>=${M}.${m}.${p}-${pr
|
|
||||||
} <${+M + 1}.0.0`
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug('no pr')
|
|
||||||
if (M === '0') {
|
|
||||||
if (m === '0') {
|
|
||||||
ret = `>=${M}.${m}.${p
|
|
||||||
} <${M}.${m}.${+p + 1}`
|
|
||||||
} else {
|
|
||||||
ret = `>=${M}.${m}.${p
|
|
||||||
} <${M}.${+m + 1}.0`
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ret = `>=${M}.${m}.${p
|
|
||||||
} <${+M + 1}.0.0`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('caret return', ret)
|
|
||||||
return ret
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const replaceXRanges = (comp, options) => {
|
|
||||||
debug('replaceXRanges', comp, options)
|
|
||||||
return comp.split(/\s+/).map((comp) => {
|
|
||||||
return replaceXRange(comp, options)
|
|
||||||
}).join(' ')
|
|
||||||
}
|
|
||||||
|
|
||||||
const replaceXRange = (comp, options) => {
|
|
||||||
comp = comp.trim()
|
|
||||||
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
|
||||||
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
||||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
|
||||||
const xM = isX(M)
|
|
||||||
const xm = xM || isX(m)
|
|
||||||
const xp = xm || isX(p)
|
|
||||||
const anyX = xp
|
|
||||||
|
|
||||||
if (gtlt === '=' && anyX) {
|
|
||||||
gtlt = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we're including prereleases in the match, then we need
|
|
||||||
// to fix this to -0, the lowest possible prerelease value
|
|
||||||
pr = options.includePrerelease ? '-0' : ''
|
|
||||||
|
|
||||||
if (xM) {
|
|
||||||
if (gtlt === '>' || gtlt === '<') {
|
|
||||||
// nothing is allowed
|
|
||||||
ret = '<0.0.0-0'
|
|
||||||
} else {
|
|
||||||
// nothing is forbidden
|
|
||||||
ret = '*'
|
|
||||||
}
|
|
||||||
} else if (gtlt && anyX) {
|
|
||||||
// we know patch is an x, because we have any x at all.
|
|
||||||
// replace X with 0
|
|
||||||
if (xm) {
|
|
||||||
m = 0
|
|
||||||
}
|
|
||||||
p = 0
|
|
||||||
|
|
||||||
if (gtlt === '>') {
|
|
||||||
// >1 => >=2.0.0
|
|
||||||
// >1.2 => >=1.3.0
|
|
||||||
gtlt = '>='
|
|
||||||
if (xm) {
|
|
||||||
M = +M + 1
|
|
||||||
m = 0
|
|
||||||
p = 0
|
|
||||||
} else {
|
|
||||||
m = +m + 1
|
|
||||||
p = 0
|
|
||||||
}
|
|
||||||
} else if (gtlt === '<=') {
|
|
||||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
||||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
||||||
gtlt = '<'
|
|
||||||
if (xm) {
|
|
||||||
M = +M + 1
|
|
||||||
} else {
|
|
||||||
m = +m + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = `${gtlt + M}.${m}.${p}${pr}`
|
|
||||||
} else if (xm) {
|
|
||||||
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0${pr}`
|
|
||||||
} else if (xp) {
|
|
||||||
ret = `>=${M}.${m}.0${pr
|
|
||||||
} <${M}.${+m + 1}.0${pr}`
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('xRange return', ret)
|
|
||||||
|
|
||||||
return ret
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Because * is AND-ed with everything else in the comparator,
|
|
||||||
// and '' means "any version", just remove the *s entirely.
|
|
||||||
const replaceStars = (comp, options) => {
|
|
||||||
debug('replaceStars', comp, options)
|
|
||||||
// Looseness is ignored here. star is always as loose as it gets!
|
|
||||||
return comp.trim().replace(re[t.STAR], '')
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
||||||
// M, m, patch, prerelease, build
|
|
||||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
||||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
|
||||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
|
||||||
const hyphenReplace = ($0,
|
|
||||||
from, fM, fm, fp, fpr, fb,
|
|
||||||
to, tM, tm, tp, tpr, tb) => {
|
|
||||||
if (isX(fM)) {
|
|
||||||
from = ''
|
|
||||||
} else if (isX(fm)) {
|
|
||||||
from = `>=${fM}.0.0`
|
|
||||||
} else if (isX(fp)) {
|
|
||||||
from = `>=${fM}.${fm}.0`
|
|
||||||
} else {
|
|
||||||
from = `>=${from}`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isX(tM)) {
|
|
||||||
to = ''
|
|
||||||
} else if (isX(tm)) {
|
|
||||||
to = `<${+tM + 1}.0.0`
|
|
||||||
} else if (isX(tp)) {
|
|
||||||
to = `<${tM}.${+tm + 1}.0`
|
|
||||||
} else if (tpr) {
|
|
||||||
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
|
||||||
} else {
|
|
||||||
to = `<=${to}`
|
|
||||||
}
|
|
||||||
|
|
||||||
return (`${from} ${to}`).trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
const testSet = (set, version, options) => {
|
|
||||||
for (let i = 0; i < set.length; i++) {
|
|
||||||
if (!set[i].test(version)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version.prerelease.length && !options.includePrerelease) {
|
|
||||||
// Find the set of versions that are allowed to have prereleases
|
|
||||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
||||||
// That should allow `1.2.3-pr.2` to pass.
|
|
||||||
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
||||||
// even though it's within the range set by the comparators.
|
|
||||||
for (let i = 0; i < set.length; i++) {
|
|
||||||
debug(set[i].semver)
|
|
||||||
if (set[i].semver === Comparator.ANY) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if (set[i].semver.prerelease.length > 0) {
|
|
||||||
const allowed = set[i].semver
|
|
||||||
if (allowed.major === version.major &&
|
|
||||||
allowed.minor === version.minor &&
|
|
||||||
allowed.patch === version.patch) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Version has a -pre, but it's not one of the ones we like.
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 589:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const compare = __webpack_require__(499)
|
|
||||||
const gt = (a, b, loose) => compare(a, b, loose) > 0
|
|
||||||
module.exports = gt
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 597:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const Range = __webpack_require__(583)
|
|
||||||
const intersects = (r1, r2, options) => {
|
|
||||||
r1 = new Range(r1, options)
|
|
||||||
r2 = new Range(r2, options)
|
|
||||||
return r1.intersects(r2)
|
|
||||||
}
|
|
||||||
module.exports = intersects
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 605:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("http");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 614:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("events");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 622:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("path");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 631:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("net");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 638:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const Range = __webpack_require__(583)
|
|
||||||
const satisfies = (version, range, options) => {
|
|
||||||
try {
|
|
||||||
range = new Range(range, options)
|
|
||||||
} catch (er) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return range.test(version)
|
|
||||||
}
|
|
||||||
module.exports = satisfies
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 662:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const parse = __webpack_require__(752)
|
|
||||||
const clean = (version, options) => {
|
|
||||||
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
|
||||||
return s ? s.version : null
|
|
||||||
}
|
|
||||||
module.exports = clean
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 668:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const ANY = Symbol('SemVer ANY')
|
|
||||||
// hoisted class for cyclic dependency
|
|
||||||
class Comparator {
|
|
||||||
static get ANY () {
|
|
||||||
return ANY
|
|
||||||
}
|
|
||||||
constructor (comp, options) {
|
|
||||||
if (!options || typeof options !== 'object') {
|
|
||||||
options = {
|
|
||||||
loose: !!options,
|
|
||||||
includePrerelease: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comp instanceof Comparator) {
|
|
||||||
if (comp.loose === !!options.loose) {
|
|
||||||
return comp
|
|
||||||
} else {
|
|
||||||
comp = comp.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('comparator', comp, options)
|
|
||||||
this.options = options
|
|
||||||
this.loose = !!options.loose
|
|
||||||
this.parse(comp)
|
|
||||||
|
|
||||||
if (this.semver === ANY) {
|
|
||||||
this.value = ''
|
|
||||||
} else {
|
|
||||||
this.value = this.operator + this.semver.version
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('comp', this)
|
|
||||||
}
|
|
||||||
|
|
||||||
parse (comp) {
|
|
||||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
|
||||||
const m = comp.match(r)
|
|
||||||
|
|
||||||
if (!m) {
|
|
||||||
throw new TypeError(`Invalid comparator: ${comp}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.operator = m[1] !== undefined ? m[1] : ''
|
|
||||||
if (this.operator === '=') {
|
|
||||||
this.operator = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it literally is just '>' or '' then allow anything.
|
|
||||||
if (!m[2]) {
|
|
||||||
this.semver = ANY
|
|
||||||
} else {
|
|
||||||
this.semver = new SemVer(m[2], this.options.loose)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
toString () {
|
|
||||||
return this.value
|
|
||||||
}
|
|
||||||
|
|
||||||
test (version) {
|
|
||||||
debug('Comparator.test', version, this.options.loose)
|
|
||||||
|
|
||||||
if (this.semver === ANY || version === ANY) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof version === 'string') {
|
|
||||||
try {
|
|
||||||
version = new SemVer(version, this.options)
|
|
||||||
} catch (er) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmp(version, this.operator, this.semver, this.options)
|
|
||||||
}
|
|
||||||
|
|
||||||
intersects (comp, options) {
|
|
||||||
if (!(comp instanceof Comparator)) {
|
|
||||||
throw new TypeError('a Comparator is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options || typeof options !== 'object') {
|
|
||||||
options = {
|
|
||||||
loose: !!options,
|
|
||||||
includePrerelease: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.operator === '') {
|
|
||||||
if (this.value === '') {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return new Range(comp.value, options).test(this.value)
|
|
||||||
} else if (comp.operator === '') {
|
|
||||||
if (comp.value === '') {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return new Range(this.value, options).test(comp.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
const sameDirectionIncreasing =
|
|
||||||
(this.operator === '>=' || this.operator === '>') &&
|
|
||||||
(comp.operator === '>=' || comp.operator === '>')
|
|
||||||
const sameDirectionDecreasing =
|
|
||||||
(this.operator === '<=' || this.operator === '<') &&
|
|
||||||
(comp.operator === '<=' || comp.operator === '<')
|
|
||||||
const sameSemVer = this.semver.version === comp.semver.version
|
|
||||||
const differentDirectionsInclusive =
|
|
||||||
(this.operator === '>=' || this.operator === '<=') &&
|
|
||||||
(comp.operator === '>=' || comp.operator === '<=')
|
|
||||||
const oppositeDirectionsLessThan =
|
|
||||||
cmp(this.semver, '<', comp.semver, options) &&
|
|
||||||
(this.operator === '>=' || this.operator === '>') &&
|
|
||||||
(comp.operator === '<=' || comp.operator === '<')
|
|
||||||
const oppositeDirectionsGreaterThan =
|
|
||||||
cmp(this.semver, '>', comp.semver, options) &&
|
|
||||||
(this.operator === '<=' || this.operator === '<') &&
|
|
||||||
(comp.operator === '>=' || comp.operator === '>')
|
|
||||||
|
|
||||||
return (
|
|
||||||
sameDirectionIncreasing ||
|
|
||||||
sameDirectionDecreasing ||
|
|
||||||
(sameSemVer && differentDirectionsInclusive) ||
|
|
||||||
oppositeDirectionsLessThan ||
|
|
||||||
oppositeDirectionsGreaterThan
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Comparator
|
|
||||||
|
|
||||||
const {re, t} = __webpack_require__(10)
|
|
||||||
const cmp = __webpack_require__(876)
|
|
||||||
const debug = __webpack_require__(396)
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
const Range = __webpack_require__(583)
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 669:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("util");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 696:
|
|
||||||
/***/ (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__(955);
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
function exportVariable(name, val) {
|
|
||||||
process.env[name] = val;
|
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
|
||||||
}
|
|
||||||
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) {
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
function setOutput(name, value) {
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
|
||||||
}
|
|
||||||
exports.setOutput = setOutput;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// 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
|
|
||||||
*/
|
|
||||||
function error(message) {
|
|
||||||
command_1.issue('error', message);
|
|
||||||
}
|
|
||||||
exports.error = error;
|
|
||||||
/**
|
|
||||||
* Adds an warning issue
|
|
||||||
* @param message warning issue message
|
|
||||||
*/
|
|
||||||
function warning(message) {
|
|
||||||
command_1.issue('warning', 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
|
|
||||||
*/
|
|
||||||
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
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 735:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const parse = __webpack_require__(752)
|
|
||||||
const prerelease = (version, options) => {
|
|
||||||
const parsed = parse(version, options)
|
|
||||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
|
||||||
}
|
|
||||||
module.exports = prerelease
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 747:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("fs");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 748:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert array of 16 byte values to UUID string format of the form:
|
|
||||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
||||||
*/
|
|
||||||
var byteToHex = [];
|
|
||||||
for (var i = 0; i < 256; ++i) {
|
|
||||||
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function bytesToUuid(buf, offset) {
|
|
||||||
var i = offset || 0;
|
|
||||||
var bth = byteToHex;
|
|
||||||
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
||||||
return ([
|
|
||||||
bth[buf[i++]], bth[buf[i++]],
|
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
|
||||||
bth[buf[i++]], bth[buf[i++]],
|
|
||||||
bth[buf[i++]], bth[buf[i++]],
|
|
||||||
bth[buf[i++]], bth[buf[i++]]
|
|
||||||
]).join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = bytesToUuid;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 751:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const parse = __webpack_require__(752)
|
|
||||||
const valid = (version, options) => {
|
|
||||||
const v = parse(version, options)
|
|
||||||
return v ? v.version : null
|
|
||||||
}
|
|
||||||
module.exports = valid
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 752:
|
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const {MAX_LENGTH} = __webpack_require__(486)
|
|
||||||
const { re, t } = __webpack_require__(10)
|
|
||||||
const SemVer = __webpack_require__(445)
|
|
||||||
|
|
||||||
const parse = (version, options) => {
|
|
||||||
if (!options || typeof options !== 'object') {
|
|
||||||
options = {
|
|
||||||
loose: !!options,
|
|
||||||
includePrerelease: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version instanceof SemVer) {
|
|
||||||
return version
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof version !== 'string') {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version.length > MAX_LENGTH) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
|
||||||
if (!r.test(version)) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return new SemVer(version, options)
|
|
||||||
} catch (er) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = parse
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 761:
|
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
exports = module.exports = SemVer
|
exports = module.exports = SemVer
|
||||||
@ -6437,7 +5776,72 @@ function coerce (version, options) {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 788:
|
/***/ 586:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const lt = (a, b, loose) => compare(a, b, loose) < 0
|
||||||
|
module.exports = lt
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 593:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compareBuild = __webpack_require__(16)
|
||||||
|
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
|
||||||
|
module.exports = rsort
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 605:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("http");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 614:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("events");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 622:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("path");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 630:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const rcompare = (a, b, loose) => compare(b, a, loose)
|
||||||
|
module.exports = rcompare
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 631:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("net");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 669:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("util");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 672:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -6451,482 +5855,297 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var _a;
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const childProcess = __webpack_require__(129);
|
const assert_1 = __webpack_require__(357);
|
||||||
|
const fs = __webpack_require__(747);
|
||||||
const path = __webpack_require__(622);
|
const path = __webpack_require__(622);
|
||||||
const util_1 = __webpack_require__(669);
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||||
const ioUtil = __webpack_require__(60);
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
const exec = util_1.promisify(childProcess.exec);
|
function exists(fsPath) {
|
||||||
/**
|
|
||||||
* Copies a file or folder.
|
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See CopyOptions.
|
|
||||||
*/
|
|
||||||
function cp(source, dest, options = {}) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { force, recursive } = readCopyOptions(options);
|
try {
|
||||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
yield exports.stat(fsPath);
|
||||||
// Dest is an existing file, but not forcing
|
}
|
||||||
if (destStat && destStat.isFile() && !force) {
|
catch (err) {
|
||||||
|
if (err.code === 'ENOENT') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.exists = exists;
|
||||||
|
function isDirectory(fsPath, useStat = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
||||||
|
return stats.isDirectory();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.isDirectory = isDirectory;
|
||||||
|
/**
|
||||||
|
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||||
|
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||||
|
*/
|
||||||
|
function isRooted(p) {
|
||||||
|
p = normalizeSeparators(p);
|
||||||
|
if (!p) {
|
||||||
|
throw new Error('isRooted() parameter "p" cannot be empty');
|
||||||
|
}
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
|
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
||||||
|
); // e.g. C: or C:\hello
|
||||||
|
}
|
||||||
|
return p.startsWith('/');
|
||||||
|
}
|
||||||
|
exports.isRooted = isRooted;
|
||||||
|
/**
|
||||||
|
* Recursively create a directory at `fsPath`.
|
||||||
|
*
|
||||||
|
* This implementation is optimistic, meaning it attempts to create the full
|
||||||
|
* path first, and backs up the path stack from there.
|
||||||
|
*
|
||||||
|
* @param fsPath The path to create
|
||||||
|
* @param maxDepth The maximum recursion depth
|
||||||
|
* @param depth The current recursion depth
|
||||||
|
*/
|
||||||
|
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||||
|
fsPath = path.resolve(fsPath);
|
||||||
|
if (depth >= maxDepth)
|
||||||
|
return exports.mkdir(fsPath);
|
||||||
|
try {
|
||||||
|
yield exports.mkdir(fsPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If dest is an existing directory, should copy inside.
|
catch (err) {
|
||||||
const newDest = destStat && destStat.isDirectory()
|
switch (err.code) {
|
||||||
? path.join(dest, path.basename(source))
|
case 'ENOENT': {
|
||||||
: dest;
|
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||||
if (!(yield ioUtil.exists(source))) {
|
yield exports.mkdir(fsPath);
|
||||||
throw new Error(`no such file or directory: ${source}`);
|
return;
|
||||||
}
|
|
||||||
const sourceStat = yield ioUtil.stat(source);
|
|
||||||
if (sourceStat.isDirectory()) {
|
|
||||||
if (!recursive) {
|
|
||||||
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield cpDirRecursive(source, newDest, 0, force);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (path.relative(source, newDest) === '') {
|
|
||||||
// a file cannot be copied to itself
|
|
||||||
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
|
||||||
}
|
|
||||||
yield copyFile(source, newDest, force);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.cp = cp;
|
|
||||||
/**
|
|
||||||
* Moves a path.
|
|
||||||
*
|
|
||||||
* @param source source path
|
|
||||||
* @param dest destination path
|
|
||||||
* @param options optional. See MoveOptions.
|
|
||||||
*/
|
|
||||||
function mv(source, dest, options = {}) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (yield ioUtil.exists(dest)) {
|
|
||||||
let destExists = true;
|
|
||||||
if (yield ioUtil.isDirectory(dest)) {
|
|
||||||
// If dest is directory copy src into dest
|
|
||||||
dest = path.join(dest, path.basename(source));
|
|
||||||
destExists = yield ioUtil.exists(dest);
|
|
||||||
}
|
|
||||||
if (destExists) {
|
|
||||||
if (options.force == null || options.force) {
|
|
||||||
yield rmRF(dest);
|
|
||||||
}
|
}
|
||||||
else {
|
default: {
|
||||||
throw new Error('Destination already exists');
|
let stats;
|
||||||
|
try {
|
||||||
|
stats = yield exports.stat(fsPath);
|
||||||
|
}
|
||||||
|
catch (err2) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
if (!stats.isDirectory())
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yield mkdirP(path.dirname(dest));
|
|
||||||
yield ioUtil.rename(source, dest);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mv = mv;
|
|
||||||
/**
|
|
||||||
* Remove a path recursively with force
|
|
||||||
*
|
|
||||||
* @param inputPath path to remove
|
|
||||||
*/
|
|
||||||
function rmRF(inputPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (ioUtil.IS_WINDOWS) {
|
|
||||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
||||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
||||||
try {
|
|
||||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
||||||
yield exec(`rd /s /q "${inputPath}"`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield exec(`del /f /a "${inputPath}"`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
|
||||||
try {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let isDir = false;
|
|
||||||
try {
|
|
||||||
isDir = yield ioUtil.isDirectory(inputPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isDir) {
|
|
||||||
yield exec(`rm -rf "${inputPath}"`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.rmRF = rmRF;
|
|
||||||
/**
|
|
||||||
* Make a directory. Creates the full path with folders in between
|
|
||||||
* Will throw if it fails
|
|
||||||
*
|
|
||||||
* @param fsPath path to create
|
|
||||||
* @returns Promise<void>
|
|
||||||
*/
|
|
||||||
function mkdirP(fsPath) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
yield ioUtil.mkdirP(fsPath);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.mkdirP = mkdirP;
|
exports.mkdirP = mkdirP;
|
||||||
/**
|
/**
|
||||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
* Best effort attempt to determine whether a file exists and is executable.
|
||||||
* If you check and the tool does not exist, it will throw.
|
* @param filePath file path to check
|
||||||
*
|
* @param extensions additional file extensions to try
|
||||||
* @param tool name of the tool
|
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||||
* @param check whether to check if tool exists
|
|
||||||
* @returns Promise<string> path to tool
|
|
||||||
*/
|
*/
|
||||||
function which(tool, check) {
|
function tryGetExecutablePath(filePath, extensions) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!tool) {
|
let stats = undefined;
|
||||||
throw new Error("parameter 'tool' is required");
|
|
||||||
}
|
|
||||||
// recursive when check=true
|
|
||||||
if (check) {
|
|
||||||
const result = yield which(tool, false);
|
|
||||||
if (!result) {
|
|
||||||
if (ioUtil.IS_WINDOWS) {
|
|
||||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
// build the list of extensions to try
|
// test file exists
|
||||||
const extensions = [];
|
stats = yield exports.stat(filePath);
|
||||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
|
||||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
|
||||||
if (extension) {
|
|
||||||
extensions.push(extension);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if it's rooted, return it if exists. otherwise return empty.
|
|
||||||
if (ioUtil.isRooted(tool)) {
|
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
|
||||||
if (filePath) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// if any path separators, return empty
|
|
||||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// build the list of directories
|
|
||||||
//
|
|
||||||
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
|
|
||||||
// it feels like we should not do this. Checking the current directory seems like more of a use
|
|
||||||
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
|
|
||||||
// across platforms.
|
|
||||||
const directories = [];
|
|
||||||
if (process.env.PATH) {
|
|
||||||
for (const p of process.env.PATH.split(path.delimiter)) {
|
|
||||||
if (p) {
|
|
||||||
directories.push(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// return the first match
|
|
||||||
for (const directory of directories) {
|
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
|
||||||
if (filePath) {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
throw new Error(`which failed with message ${err.message}`);
|
if (err.code !== 'ENOENT') {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
if (stats && stats.isFile()) {
|
||||||
}
|
if (exports.IS_WINDOWS) {
|
||||||
exports.which = which;
|
// on Windows, test for valid extension
|
||||||
function readCopyOptions(options) {
|
const upperExt = path.extname(filePath).toUpperCase();
|
||||||
const force = options.force == null ? true : options.force;
|
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
||||||
const recursive = Boolean(options.recursive);
|
return filePath;
|
||||||
return { force, recursive };
|
}
|
||||||
}
|
|
||||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// Ensure there is not a run away recursive copy
|
|
||||||
if (currentDepth >= 255)
|
|
||||||
return;
|
|
||||||
currentDepth++;
|
|
||||||
yield mkdirP(destDir);
|
|
||||||
const files = yield ioUtil.readdir(sourceDir);
|
|
||||||
for (const fileName of files) {
|
|
||||||
const srcFile = `${sourceDir}/${fileName}`;
|
|
||||||
const destFile = `${destDir}/${fileName}`;
|
|
||||||
const srcFileStat = yield ioUtil.lstat(srcFile);
|
|
||||||
if (srcFileStat.isDirectory()) {
|
|
||||||
// Recurse
|
|
||||||
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield copyFile(srcFile, destFile, force);
|
if (isUnixExecutable(stats)) {
|
||||||
}
|
return filePath;
|
||||||
}
|
|
||||||
// Change the mode for the newly created directory
|
|
||||||
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Buffered file copy
|
|
||||||
function copyFile(srcFile, destFile, force) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
|
||||||
// unlink/re-link it
|
|
||||||
try {
|
|
||||||
yield ioUtil.lstat(destFile);
|
|
||||||
yield ioUtil.unlink(destFile);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
// Try to override file permission
|
|
||||||
if (e.code === 'EPERM') {
|
|
||||||
yield ioUtil.chmod(destFile, '0666');
|
|
||||||
yield ioUtil.unlink(destFile);
|
|
||||||
}
|
}
|
||||||
// other errors = it doesn't exist, no work to do
|
|
||||||
}
|
}
|
||||||
// Copy over symlink
|
|
||||||
const symlinkFull = yield ioUtil.readlink(srcFile);
|
|
||||||
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
|
||||||
}
|
}
|
||||||
else if (!(yield ioUtil.exists(destFile)) || force) {
|
// try each extension
|
||||||
yield ioUtil.copyFile(srcFile, destFile);
|
const originalFilePath = filePath;
|
||||||
|
for (const extension of extensions) {
|
||||||
|
filePath = originalFilePath + extension;
|
||||||
|
stats = undefined;
|
||||||
|
try {
|
||||||
|
stats = yield exports.stat(filePath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (err.code !== 'ENOENT') {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stats && stats.isFile()) {
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
|
// preserve the case of the actual file (since an extension was appended)
|
||||||
|
try {
|
||||||
|
const directory = path.dirname(filePath);
|
||||||
|
const upperName = path.basename(filePath).toUpperCase();
|
||||||
|
for (const actualName of yield exports.readdir(directory)) {
|
||||||
|
if (upperName === actualName.toUpperCase()) {
|
||||||
|
filePath = path.join(directory, actualName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
||||||
|
}
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isUnixExecutable(stats)) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=io.js.map
|
exports.tryGetExecutablePath = tryGetExecutablePath;
|
||||||
|
function normalizeSeparators(p) {
|
||||||
/***/ }),
|
p = p || '';
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
/***/ 813:
|
// convert slashes on Windows
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
p = p.replace(/\//g, '\\');
|
||||||
|
// remove redundant slashes
|
||||||
const SemVer = __webpack_require__(445)
|
return p.replace(/\\\\+/g, '\\');
|
||||||
const Range = __webpack_require__(583)
|
}
|
||||||
const gt = __webpack_require__(589)
|
// remove redundant slashes
|
||||||
|
return p.replace(/\/\/+/g, '/');
|
||||||
const minVersion = (range, loose) => {
|
|
||||||
range = new Range(range, loose)
|
|
||||||
|
|
||||||
let minver = new SemVer('0.0.0')
|
|
||||||
if (range.test(minver)) {
|
|
||||||
return minver
|
|
||||||
}
|
|
||||||
|
|
||||||
minver = new SemVer('0.0.0-0')
|
|
||||||
if (range.test(minver)) {
|
|
||||||
return minver
|
|
||||||
}
|
|
||||||
|
|
||||||
minver = null
|
|
||||||
for (let i = 0; i < range.set.length; ++i) {
|
|
||||||
const comparators = range.set[i]
|
|
||||||
|
|
||||||
comparators.forEach((comparator) => {
|
|
||||||
// Clone to avoid manipulating the comparator's semver object.
|
|
||||||
const compver = new SemVer(comparator.semver.version)
|
|
||||||
switch (comparator.operator) {
|
|
||||||
case '>':
|
|
||||||
if (compver.prerelease.length === 0) {
|
|
||||||
compver.patch++
|
|
||||||
} else {
|
|
||||||
compver.prerelease.push(0)
|
|
||||||
}
|
|
||||||
compver.raw = compver.format()
|
|
||||||
/* fallthrough */
|
|
||||||
case '':
|
|
||||||
case '>=':
|
|
||||||
if (!minver || gt(minver, compver)) {
|
|
||||||
minver = compver
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case '<':
|
|
||||||
case '<=':
|
|
||||||
/* Ignore maximum versions */
|
|
||||||
break
|
|
||||||
/* istanbul ignore next */
|
|
||||||
default:
|
|
||||||
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minver && range.test(minver)) {
|
|
||||||
return minver
|
|
||||||
}
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
module.exports = minVersion
|
// on Mac/Linux, test the execute bit
|
||||||
|
// R W X R W X R W X
|
||||||
|
// 256 128 64 32 16 8 4 2 1
|
||||||
|
function isUnixExecutable(stats) {
|
||||||
|
return ((stats.mode & 1) > 0 ||
|
||||||
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||||
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=io-util.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 826:
|
/***/ 714:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
module.exports = __webpack_require__(171);
|
const parse = __webpack_require__(830)
|
||||||
|
const valid = (version, options) => {
|
||||||
|
const v = parse(version, options)
|
||||||
|
return v ? v.version : null
|
||||||
|
}
|
||||||
|
module.exports = valid
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 835:
|
/***/ 722:
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
module.exports = require("url");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 838:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const tr = __webpack_require__(29);
|
|
||||||
/**
|
/**
|
||||||
* Exec a command.
|
* Convert array of 16 byte values to UUID string format of the form:
|
||||||
* Output will be streamed to the live console.
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
*/
|
||||||
function exec(commandLine, args, options) {
|
var byteToHex = [];
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
for (var i = 0; i < 256; ++i) {
|
||||||
const commandArgs = tr.argStringToArray(commandLine);
|
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
||||||
if (commandArgs.length === 0) {
|
|
||||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
|
||||||
}
|
|
||||||
// Path to tool to execute should be first arg
|
|
||||||
const toolPath = commandArgs[0];
|
|
||||||
args = commandArgs.slice(1).concat(args || []);
|
|
||||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
|
||||||
return runner.exec();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.exec = exec;
|
|
||||||
//# sourceMappingURL=exec.js.map
|
|
||||||
|
|
||||||
/***/ }),
|
function bytesToUuid(buf, offset) {
|
||||||
|
var i = offset || 0;
|
||||||
|
var bth = byteToHex;
|
||||||
|
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
||||||
|
return ([
|
||||||
|
bth[buf[i++]], bth[buf[i++]],
|
||||||
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
|
bth[buf[i++]], bth[buf[i++]],
|
||||||
|
bth[buf[i++]], bth[buf[i++]],
|
||||||
|
bth[buf[i++]], bth[buf[i++]]
|
||||||
|
]).join('');
|
||||||
|
}
|
||||||
|
|
||||||
/***/ 845:
|
module.exports = bytesToUuid;
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const Range = __webpack_require__(583)
|
|
||||||
|
|
||||||
// Mostly just for testing and legacy API reasons
|
|
||||||
const toComparators = (range, options) =>
|
|
||||||
new Range(range, options).set
|
|
||||||
.map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
|
|
||||||
|
|
||||||
module.exports = toComparators
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 851:
|
/***/ 740:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
var rng = __webpack_require__(156);
|
const SemVer = __webpack_require__(65)
|
||||||
var bytesToUuid = __webpack_require__(748);
|
const Range = __webpack_require__(124)
|
||||||
|
const minSatisfying = (versions, range, options) => {
|
||||||
function v4(options, buf, offset) {
|
let min = null
|
||||||
var i = buf && offset || 0;
|
let minSV = null
|
||||||
|
let rangeObj = null
|
||||||
if (typeof(options) == 'string') {
|
try {
|
||||||
buf = options === 'binary' ? new Array(16) : null;
|
rangeObj = new Range(range, options)
|
||||||
options = null;
|
} catch (er) {
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
options = options || {};
|
versions.forEach((v) => {
|
||||||
|
if (rangeObj.test(v)) {
|
||||||
var rnds = options.random || (options.rng || rng)();
|
// satisfies(v, range, options)
|
||||||
|
if (!min || minSV.compare(v) === 1) {
|
||||||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
// compare(min, v, true)
|
||||||
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
min = v
|
||||||
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
minSV = new SemVer(min, options)
|
||||||
|
}
|
||||||
// Copy bytes to buffer, if provided
|
|
||||||
if (buf) {
|
|
||||||
for (var ii = 0; ii < 16; ++ii) {
|
|
||||||
buf[i + ii] = rnds[ii];
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
return min
|
||||||
return buf || bytesToUuid(rnds);
|
|
||||||
}
|
}
|
||||||
|
module.exports = minSatisfying
|
||||||
module.exports = v4;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 853:
|
/***/ 744:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
const SemVer = __webpack_require__(65)
|
||||||
const patch = (a, loose) => new SemVer(a, loose).patch
|
const major = (a, loose) => new SemVer(a, loose).major
|
||||||
module.exports = patch
|
module.exports = major
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 876:
|
/***/ 747:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("fs");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 752:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
const eq = __webpack_require__(265)
|
const eq = __webpack_require__(298)
|
||||||
const neq = __webpack_require__(404)
|
const neq = __webpack_require__(873)
|
||||||
const gt = __webpack_require__(589)
|
const gt = __webpack_require__(486)
|
||||||
const gte = __webpack_require__(116)
|
const gte = __webpack_require__(167)
|
||||||
const lt = __webpack_require__(548)
|
const lt = __webpack_require__(586)
|
||||||
const lte = __webpack_require__(369)
|
const lte = __webpack_require__(898)
|
||||||
|
|
||||||
const cmp = (a, op, b, loose) => {
|
const cmp = (a, op, b, loose) => {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
@ -6973,14 +6192,62 @@ module.exports = cmp
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 882:
|
/***/ 760:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
const numeric = /^[0-9]+$/
|
||||||
|
const compareIdentifiers = (a, b) => {
|
||||||
|
const anum = numeric.test(a)
|
||||||
|
const bnum = numeric.test(b)
|
||||||
|
|
||||||
|
if (anum && bnum) {
|
||||||
|
a = +a
|
||||||
|
b = +b
|
||||||
|
}
|
||||||
|
|
||||||
|
return a === b ? 0
|
||||||
|
: (anum && !bnum) ? -1
|
||||||
|
: (bnum && !anum) ? 1
|
||||||
|
: a < b ? -1
|
||||||
|
: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
compareIdentifiers,
|
||||||
|
rcompareIdentifiers
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 794:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("stream");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 803:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
const SemVer = __webpack_require__(65)
|
||||||
const Range = __webpack_require__(583)
|
const minor = (a, loose) => new SemVer(a, loose).minor
|
||||||
const minSatisfying = (versions, range, options) => {
|
module.exports = minor
|
||||||
let min = null
|
|
||||||
let minSV = null
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 811:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const Range = __webpack_require__(124)
|
||||||
|
|
||||||
|
const maxSatisfying = (versions, range, options) => {
|
||||||
|
let max = null
|
||||||
|
let maxSV = null
|
||||||
let rangeObj = null
|
let rangeObj = null
|
||||||
try {
|
try {
|
||||||
rangeObj = new Range(range, options)
|
rangeObj = new Range(range, options)
|
||||||
@ -6990,35 +6257,777 @@ const minSatisfying = (versions, range, options) => {
|
|||||||
versions.forEach((v) => {
|
versions.forEach((v) => {
|
||||||
if (rangeObj.test(v)) {
|
if (rangeObj.test(v)) {
|
||||||
// satisfies(v, range, options)
|
// satisfies(v, range, options)
|
||||||
if (!min || minSV.compare(v) === 1) {
|
if (!max || maxSV.compare(v) === -1) {
|
||||||
// compare(min, v, true)
|
// compare(max, v, true)
|
||||||
min = v
|
max = v
|
||||||
minSV = new SemVer(min, options)
|
maxSV = new SemVer(max, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return min
|
return max
|
||||||
}
|
}
|
||||||
module.exports = minSatisfying
|
module.exports = maxSatisfying
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 934:
|
/***/ 818:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("tls");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 822:
|
||||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
const SemVer = __webpack_require__(445)
|
const parse = __webpack_require__(830)
|
||||||
const major = (a, loose) => new SemVer(a, loose).major
|
const eq = __webpack_require__(298)
|
||||||
module.exports = major
|
|
||||||
|
const diff = (version1, version2) => {
|
||||||
|
if (eq(version1, version2)) {
|
||||||
|
return null
|
||||||
|
} else {
|
||||||
|
const v1 = parse(version1)
|
||||||
|
const v2 = parse(version2)
|
||||||
|
const hasPre = v1.prerelease.length || v2.prerelease.length
|
||||||
|
const prefix = hasPre ? 'pre' : ''
|
||||||
|
const defaultResult = hasPre ? 'prerelease' : ''
|
||||||
|
for (const key in v1) {
|
||||||
|
if (key === 'major' || key === 'minor' || key === 'patch') {
|
||||||
|
if (v1[key] !== v2[key]) {
|
||||||
|
return prefix + key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultResult // may be undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = diff
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 955:
|
/***/ 824:
|
||||||
|
/***/ (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 path = __importStar(__webpack_require__(622));
|
||||||
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
const tc = __importStar(__webpack_require__(533));
|
||||||
|
const exec = __importStar(__webpack_require__(986));
|
||||||
|
const TOKEN = core.getInput('token');
|
||||||
|
const AUTH = !TOKEN || isGhes() ? undefined : `token ${TOKEN}`;
|
||||||
|
const MANIFEST_REPO_OWNER = 'actions';
|
||||||
|
const MANIFEST_REPO_NAME = 'python-versions';
|
||||||
|
exports.MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/master/versions-manifest.json`;
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
function findReleaseFromManifest(semanticVersionSpec, architecture) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const manifest = yield tc.getManifestFromRepo(MANIFEST_REPO_OWNER, MANIFEST_REPO_NAME, AUTH);
|
||||||
|
return yield tc.findFromManifest(semanticVersionSpec, true, manifest, architecture);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.findReleaseFromManifest = findReleaseFromManifest;
|
||||||
|
function installPython(workingDirectory) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const options = {
|
||||||
|
cwd: workingDirectory,
|
||||||
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
core.debug(data.toString().trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
yield exec.exec('powershell', ['./setup.ps1'], options);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield exec.exec('bash', ['./setup.sh'], options);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function installCpythonFromRelease(release) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const downloadUrl = release.files[0].download_url;
|
||||||
|
core.info(`Download from "${downloadUrl}"`);
|
||||||
|
const pythonPath = yield tc.downloadTool(downloadUrl, undefined, AUTH);
|
||||||
|
const fileName = path.basename(pythonPath, '.zip');
|
||||||
|
core.info('Extract downloaded archive');
|
||||||
|
let pythonExtractedFolder;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
pythonExtractedFolder = yield tc.extractZip(pythonPath, `./${fileName}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pythonExtractedFolder = yield tc.extractTar(pythonPath, `./${fileName}`);
|
||||||
|
}
|
||||||
|
core.info('Execute installation script');
|
||||||
|
yield installPython(pythonExtractedFolder);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.installCpythonFromRelease = installCpythonFromRelease;
|
||||||
|
function isGhes() {
|
||||||
|
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||||
|
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 826:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
var rng = __webpack_require__(139);
|
||||||
|
var bytesToUuid = __webpack_require__(722);
|
||||||
|
|
||||||
|
function v4(options, buf, offset) {
|
||||||
|
var i = buf && offset || 0;
|
||||||
|
|
||||||
|
if (typeof(options) == 'string') {
|
||||||
|
buf = options === 'binary' ? new Array(16) : null;
|
||||||
|
options = null;
|
||||||
|
}
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
var rnds = options.random || (options.rng || rng)();
|
||||||
|
|
||||||
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||||
|
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
||||||
|
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
||||||
|
|
||||||
|
// Copy bytes to buffer, if provided
|
||||||
|
if (buf) {
|
||||||
|
for (var ii = 0; ii < 16; ++ii) {
|
||||||
|
buf[i + ii] = rnds[ii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf || bytesToUuid(rnds);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = v4;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 830:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const {MAX_LENGTH} = __webpack_require__(181)
|
||||||
|
const { re, t } = __webpack_require__(976)
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
|
||||||
|
const parse = (version, options) => {
|
||||||
|
if (!options || typeof options !== 'object') {
|
||||||
|
options = {
|
||||||
|
loose: !!options,
|
||||||
|
includePrerelease: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version instanceof SemVer) {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof version !== 'string') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version.length > MAX_LENGTH) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||||
|
if (!r.test(version)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new SemVer(version, options)
|
||||||
|
} catch (er) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = parse
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 835:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("url");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 873:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
||||||
|
module.exports = neq
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 874:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
const compare = (a, b, loose) =>
|
||||||
|
new SemVer(a, loose).compare(new SemVer(b, loose))
|
||||||
|
|
||||||
|
module.exports = compare
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 876:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
// just pre-load all the stuff that index.js lazily exports
|
||||||
|
const internalRe = __webpack_require__(976)
|
||||||
|
module.exports = {
|
||||||
|
re: internalRe.re,
|
||||||
|
src: internalRe.src,
|
||||||
|
tokens: internalRe.t,
|
||||||
|
SEMVER_SPEC_VERSION: __webpack_require__(181).SEMVER_SPEC_VERSION,
|
||||||
|
SemVer: __webpack_require__(65),
|
||||||
|
compareIdentifiers: __webpack_require__(760).compareIdentifiers,
|
||||||
|
rcompareIdentifiers: __webpack_require__(760).rcompareIdentifiers,
|
||||||
|
parse: __webpack_require__(830),
|
||||||
|
valid: __webpack_require__(714),
|
||||||
|
clean: __webpack_require__(503),
|
||||||
|
inc: __webpack_require__(928),
|
||||||
|
diff: __webpack_require__(822),
|
||||||
|
major: __webpack_require__(744),
|
||||||
|
minor: __webpack_require__(803),
|
||||||
|
patch: __webpack_require__(489),
|
||||||
|
prerelease: __webpack_require__(968),
|
||||||
|
compare: __webpack_require__(874),
|
||||||
|
rcompare: __webpack_require__(630),
|
||||||
|
compareLoose: __webpack_require__(283),
|
||||||
|
compareBuild: __webpack_require__(16),
|
||||||
|
sort: __webpack_require__(120),
|
||||||
|
rsort: __webpack_require__(593),
|
||||||
|
gt: __webpack_require__(486),
|
||||||
|
lt: __webpack_require__(586),
|
||||||
|
eq: __webpack_require__(298),
|
||||||
|
neq: __webpack_require__(873),
|
||||||
|
gte: __webpack_require__(167),
|
||||||
|
lte: __webpack_require__(898),
|
||||||
|
cmp: __webpack_require__(752),
|
||||||
|
coerce: __webpack_require__(499),
|
||||||
|
Comparator: __webpack_require__(174),
|
||||||
|
Range: __webpack_require__(124),
|
||||||
|
satisfies: __webpack_require__(310),
|
||||||
|
toComparators: __webpack_require__(219),
|
||||||
|
maxSatisfying: __webpack_require__(811),
|
||||||
|
minSatisfying: __webpack_require__(740),
|
||||||
|
minVersion: __webpack_require__(164),
|
||||||
|
validRange: __webpack_require__(480),
|
||||||
|
outside: __webpack_require__(462),
|
||||||
|
gtr: __webpack_require__(531),
|
||||||
|
ltr: __webpack_require__(323),
|
||||||
|
intersects: __webpack_require__(259),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 898:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const compare = __webpack_require__(874)
|
||||||
|
const lte = (a, b, loose) => compare(a, b, loose) <= 0
|
||||||
|
module.exports = lte
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 927:
|
||||||
|
/***/ (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 os = __importStar(__webpack_require__(87));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
|
const semver = __importStar(__webpack_require__(876));
|
||||||
|
const installer = __importStar(__webpack_require__(824));
|
||||||
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
const tc = __importStar(__webpack_require__(533));
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
|
||||||
|
// This is where pip is, along with anything that pip installs.
|
||||||
|
// There is a seperate directory for `pip install --user`.
|
||||||
|
//
|
||||||
|
// For reference, these directories are as follows:
|
||||||
|
// macOS / Linux:
|
||||||
|
// <sys.prefix>/bin (by default /usr/local/bin, but not on hosted agents -- see the `else`)
|
||||||
|
// (--user) ~/.local/bin
|
||||||
|
// Windows:
|
||||||
|
// <Python installation dir>\Scripts
|
||||||
|
// (--user) %APPDATA%\Python\PythonXY\Scripts
|
||||||
|
// See https://docs.python.org/3/library/sysconfig.html
|
||||||
|
function binDir(installDir) {
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
return path.join(installDir, 'Scripts');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return path.join(installDir, 'bin');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Note on the tool cache layout for PyPy:
|
||||||
|
// PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
|
||||||
|
// A particular version of PyPy may contain one or more versions of the Python interpreter.
|
||||||
|
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
|
||||||
|
// We only care about the Python version, so we don't use the PyPy version for the tool cache.
|
||||||
|
function usePyPy(majorVersion, architecture) {
|
||||||
|
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString());
|
||||||
|
let installDir = findPyPy(architecture);
|
||||||
|
if (!installDir && IS_WINDOWS) {
|
||||||
|
// PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
|
||||||
|
// On our Windows virtual environments, we only install an x86 version.
|
||||||
|
// Fall back to x86.
|
||||||
|
installDir = findPyPy('x86');
|
||||||
|
}
|
||||||
|
if (!installDir) {
|
||||||
|
// PyPy not installed in $(Agent.ToolsDirectory)
|
||||||
|
throw new Error(`PyPy ${majorVersion} not found`);
|
||||||
|
}
|
||||||
|
// For PyPy, Windows uses 'bin', not 'Scripts'.
|
||||||
|
const _binDir = path.join(installDir, 'bin');
|
||||||
|
// On Linux and macOS, the Python interpreter is in 'bin'.
|
||||||
|
// On Windows, it is in the installation root.
|
||||||
|
const pythonLocation = IS_WINDOWS ? installDir : _binDir;
|
||||||
|
core.exportVariable('pythonLocation', pythonLocation);
|
||||||
|
core.addPath(installDir);
|
||||||
|
core.addPath(_binDir);
|
||||||
|
const impl = 'pypy' + majorVersion.toString();
|
||||||
|
core.setOutput('python-version', impl);
|
||||||
|
return { impl: impl, version: versionFromPath(installDir) };
|
||||||
|
}
|
||||||
|
function useCpythonVersion(version, architecture) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const desugaredVersionSpec = desugarDevVersion(version);
|
||||||
|
const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
|
||||||
|
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
||||||
|
let installDir = tc.find('Python', semanticVersionSpec, architecture);
|
||||||
|
if (!installDir) {
|
||||||
|
core.info(`Version ${semanticVersionSpec} was not found in the local cache`);
|
||||||
|
const foundRelease = yield installer.findReleaseFromManifest(semanticVersionSpec, architecture);
|
||||||
|
if (foundRelease && foundRelease.files && foundRelease.files.length > 0) {
|
||||||
|
core.info(`Version ${semanticVersionSpec} is available for downloading`);
|
||||||
|
yield installer.installCpythonFromRelease(foundRelease);
|
||||||
|
installDir = tc.find('Python', semanticVersionSpec, architecture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!installDir) {
|
||||||
|
throw new Error([
|
||||||
|
`Version ${version} with arch ${architecture} not found`,
|
||||||
|
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
|
||||||
|
].join(os.EOL));
|
||||||
|
}
|
||||||
|
core.exportVariable('pythonLocation', installDir);
|
||||||
|
core.addPath(installDir);
|
||||||
|
core.addPath(binDir(installDir));
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
// Add --user directory
|
||||||
|
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
|
||||||
|
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
|
||||||
|
const version = path.basename(path.dirname(installDir));
|
||||||
|
const major = semver.major(version);
|
||||||
|
const minor = semver.minor(version);
|
||||||
|
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
||||||
|
core.addPath(userScriptsDir);
|
||||||
|
}
|
||||||
|
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
||||||
|
const installed = versionFromPath(installDir);
|
||||||
|
core.setOutput('python-version', installed);
|
||||||
|
return { impl: 'CPython', version: installed };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** Convert versions like `3.8-dev` to a version like `>= 3.8.0-a0`. */
|
||||||
|
function desugarDevVersion(versionSpec) {
|
||||||
|
if (versionSpec.endsWith('-dev')) {
|
||||||
|
const versionRoot = versionSpec.slice(0, -'-dev'.length);
|
||||||
|
return `>= ${versionRoot}.0-a0`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return versionSpec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** Extracts python version from install path from hosted tool cache as described in README.md */
|
||||||
|
function versionFromPath(installDir) {
|
||||||
|
const parts = installDir.split(path.sep);
|
||||||
|
const idx = parts.findIndex(part => part === 'PyPy' || part === 'Python');
|
||||||
|
return parts[idx + 1] || '';
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Python's prelease versions look like `3.7.0b2`.
|
||||||
|
* This is the one part of Python versioning that does not look like semantic versioning, which specifies `3.7.0-b2`.
|
||||||
|
* If the version spec contains prerelease versions, we need to convert them to the semantic version equivalent.
|
||||||
|
*/
|
||||||
|
function pythonVersionToSemantic(versionSpec) {
|
||||||
|
const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g;
|
||||||
|
return versionSpec.replace(prereleaseVersion, '$1-$2');
|
||||||
|
}
|
||||||
|
exports.pythonVersionToSemantic = pythonVersionToSemantic;
|
||||||
|
function findPythonVersion(version, architecture) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
switch (version.toUpperCase()) {
|
||||||
|
case 'PYPY2':
|
||||||
|
return usePyPy(2, architecture);
|
||||||
|
case 'PYPY3':
|
||||||
|
return usePyPy(3, architecture);
|
||||||
|
default:
|
||||||
|
return yield useCpythonVersion(version, architecture);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.findPythonVersion = findPythonVersion;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 928:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const SemVer = __webpack_require__(65)
|
||||||
|
|
||||||
|
const inc = (version, release, options, identifier) => {
|
||||||
|
if (typeof (options) === 'string') {
|
||||||
|
identifier = options
|
||||||
|
options = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new SemVer(version, options).inc(release, identifier).version
|
||||||
|
} catch (er) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = inc
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 950:
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const url = __webpack_require__(835);
|
||||||
|
function getProxyUrl(reqUrl) {
|
||||||
|
let usingSsl = reqUrl.protocol === 'https:';
|
||||||
|
let proxyUrl;
|
||||||
|
if (checkBypass(reqUrl)) {
|
||||||
|
return proxyUrl;
|
||||||
|
}
|
||||||
|
let proxyVar;
|
||||||
|
if (usingSsl) {
|
||||||
|
proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||||
|
}
|
||||||
|
if (proxyVar) {
|
||||||
|
proxyUrl = url.parse(proxyVar);
|
||||||
|
}
|
||||||
|
return proxyUrl;
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
function checkBypass(reqUrl) {
|
||||||
|
if (!reqUrl.hostname) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||||
|
if (!noProxy) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Determine the request port
|
||||||
|
let reqPort;
|
||||||
|
if (reqUrl.port) {
|
||||||
|
reqPort = Number(reqUrl.port);
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'http:') {
|
||||||
|
reqPort = 80;
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'https:') {
|
||||||
|
reqPort = 443;
|
||||||
|
}
|
||||||
|
// Format the request hostname and hostname with port
|
||||||
|
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||||
|
if (typeof reqPort === 'number') {
|
||||||
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||||
|
}
|
||||||
|
// Compare request host against noproxy
|
||||||
|
for (let upperNoProxyItem of noProxy
|
||||||
|
.split(',')
|
||||||
|
.map(x => x.trim().toUpperCase())
|
||||||
|
.filter(x => x)) {
|
||||||
|
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exports.checkBypass = checkBypass;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 968:
|
||||||
|
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
|
const parse = __webpack_require__(830)
|
||||||
|
const prerelease = (version, options) => {
|
||||||
|
const parsed = parse(version, options)
|
||||||
|
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
||||||
|
}
|
||||||
|
module.exports = prerelease
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 976:
|
||||||
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(181)
|
||||||
|
const debug = __webpack_require__(548)
|
||||||
|
exports = module.exports = {}
|
||||||
|
|
||||||
|
// The actual regexps go on exports.re
|
||||||
|
const re = exports.re = []
|
||||||
|
const src = exports.src = []
|
||||||
|
const t = exports.t = {}
|
||||||
|
let R = 0
|
||||||
|
|
||||||
|
const createToken = (name, value, isGlobal) => {
|
||||||
|
const index = R++
|
||||||
|
debug(index, value)
|
||||||
|
t[name] = index
|
||||||
|
src[index] = value
|
||||||
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following Regular Expressions can be used for tokenizing,
|
||||||
|
// validating, and parsing SemVer version strings.
|
||||||
|
|
||||||
|
// ## Numeric Identifier
|
||||||
|
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||||
|
|
||||||
|
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
|
||||||
|
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
|
||||||
|
|
||||||
|
// ## Non-numeric Identifier
|
||||||
|
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||||
|
// more letters, digits, or hyphens.
|
||||||
|
|
||||||
|
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
|
||||||
|
|
||||||
|
// ## Main Version
|
||||||
|
// Three dot-separated numeric identifiers.
|
||||||
|
|
||||||
|
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||||
|
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||||
|
`(${src[t.NUMERICIDENTIFIER]})`)
|
||||||
|
|
||||||
|
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||||
|
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||||
|
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
||||||
|
|
||||||
|
// ## Pre-release Version Identifier
|
||||||
|
// A numeric identifier, or a non-numeric identifier.
|
||||||
|
|
||||||
|
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
|
||||||
|
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
||||||
|
|
||||||
|
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
|
||||||
|
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
||||||
|
|
||||||
|
// ## Pre-release Version
|
||||||
|
// Hyphen, followed by one or more dot-separated pre-release version
|
||||||
|
// identifiers.
|
||||||
|
|
||||||
|
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
||||||
|
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
|
||||||
|
|
||||||
|
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
||||||
|
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
|
||||||
|
|
||||||
|
// ## Build Metadata Identifier
|
||||||
|
// Any combination of digits, letters, or hyphens.
|
||||||
|
|
||||||
|
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
|
||||||
|
|
||||||
|
// ## Build Metadata
|
||||||
|
// Plus sign, followed by one or more period-separated build metadata
|
||||||
|
// identifiers.
|
||||||
|
|
||||||
|
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
||||||
|
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
|
||||||
|
|
||||||
|
// ## Full Version String
|
||||||
|
// A main version, followed optionally by a pre-release version and
|
||||||
|
// build metadata.
|
||||||
|
|
||||||
|
// Note that the only major, minor, patch, and pre-release sections of
|
||||||
|
// the version string are capturing groups. The build metadata is not a
|
||||||
|
// capturing group, because it should not ever be used in version
|
||||||
|
// comparison.
|
||||||
|
|
||||||
|
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
||||||
|
}${src[t.PRERELEASE]}?${
|
||||||
|
src[t.BUILD]}?`)
|
||||||
|
|
||||||
|
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
|
||||||
|
|
||||||
|
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||||
|
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||||
|
// common in the npm registry.
|
||||||
|
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
||||||
|
}${src[t.PRERELEASELOOSE]}?${
|
||||||
|
src[t.BUILD]}?`)
|
||||||
|
|
||||||
|
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
||||||
|
|
||||||
|
createToken('GTLT', '((?:<|>)?=?)')
|
||||||
|
|
||||||
|
// Something like "2.*" or "1.2.x".
|
||||||
|
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||||
|
// Only the first item is strictly required.
|
||||||
|
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
||||||
|
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
||||||
|
|
||||||
|
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
||||||
|
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||||
|
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||||
|
`(?:${src[t.PRERELEASE]})?${
|
||||||
|
src[t.BUILD]}?` +
|
||||||
|
`)?)?`)
|
||||||
|
|
||||||
|
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||||
|
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||||
|
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||||
|
`(?:${src[t.PRERELEASELOOSE]})?${
|
||||||
|
src[t.BUILD]}?` +
|
||||||
|
`)?)?`)
|
||||||
|
|
||||||
|
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
|
||||||
|
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
||||||
|
|
||||||
|
// Coercion.
|
||||||
|
// Extract anything that could conceivably be a part of a valid semver
|
||||||
|
createToken('COERCE', `${'(^|[^\\d])' +
|
||||||
|
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
||||||
|
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
||||||
|
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
||||||
|
`(?:$|[^\\d])`)
|
||||||
|
createToken('COERCERTL', src[t.COERCE], true)
|
||||||
|
|
||||||
|
// Tilde ranges.
|
||||||
|
// Meaning is "reasonably at or greater than"
|
||||||
|
createToken('LONETILDE', '(?:~>?)')
|
||||||
|
|
||||||
|
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
|
||||||
|
exports.tildeTrimReplace = '$1~'
|
||||||
|
|
||||||
|
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
|
||||||
|
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||||
|
|
||||||
|
// Caret ranges.
|
||||||
|
// Meaning is "at least and backwards compatible with"
|
||||||
|
createToken('LONECARET', '(?:\\^)')
|
||||||
|
|
||||||
|
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
|
||||||
|
exports.caretTrimReplace = '$1^'
|
||||||
|
|
||||||
|
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
|
||||||
|
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||||
|
|
||||||
|
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||||
|
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
|
||||||
|
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
|
||||||
|
|
||||||
|
// An expression to strip any whitespace between the gtlt and the thing
|
||||||
|
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||||
|
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
||||||
|
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
|
||||||
|
exports.comparatorTrimReplace = '$1$2$3'
|
||||||
|
|
||||||
|
// Something like `1.2.3 - 1.2.4`
|
||||||
|
// Note that these all use the loose form, because they'll be
|
||||||
|
// checked against either the strict or loose comparator form
|
||||||
|
// later.
|
||||||
|
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
||||||
|
`\\s+-\\s+` +
|
||||||
|
`(${src[t.XRANGEPLAIN]})` +
|
||||||
|
`\\s*$`)
|
||||||
|
|
||||||
|
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
||||||
|
`\\s+-\\s+` +
|
||||||
|
`(${src[t.XRANGEPLAINLOOSE]})` +
|
||||||
|
`\\s*$`)
|
||||||
|
|
||||||
|
// Star ranges basically just allow anything at all.
|
||||||
|
createToken('STAR', '(<|>)?=?\\s*\\*')
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 979:
|
||||||
|
/***/ (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) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@ -7027,75 +7036,109 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(__webpack_require__(87));
|
const core = __importStar(__webpack_require__(470));
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Internal class for retries
|
||||||
*
|
|
||||||
* 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) {
|
class RetryHelper {
|
||||||
const cmd = new Command(command, properties, message);
|
constructor(maxAttempts, minSeconds, maxSeconds) {
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
if (maxAttempts < 1) {
|
||||||
}
|
throw new Error('max attempts should be greater than or equal to 1');
|
||||||
exports.issueCommand = issueCommand;
|
}
|
||||||
function issue(name, message = '') {
|
this.maxAttempts = maxAttempts;
|
||||||
issueCommand(name, {}, message);
|
this.minSeconds = Math.floor(minSeconds);
|
||||||
}
|
this.maxSeconds = Math.floor(maxSeconds);
|
||||||
exports.issue = issue;
|
if (this.minSeconds > this.maxSeconds) {
|
||||||
const CMD_STRING = '::';
|
throw new Error('min seconds should be less than or equal to max seconds');
|
||||||
class Command {
|
|
||||||
constructor(command, properties, message) {
|
|
||||||
if (!command) {
|
|
||||||
command = 'missing.command';
|
|
||||||
}
|
}
|
||||||
this.command = command;
|
|
||||||
this.properties = properties;
|
|
||||||
this.message = message;
|
|
||||||
}
|
}
|
||||||
toString() {
|
execute(action, isRetryable) {
|
||||||
let cmdStr = CMD_STRING + this.command;
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
let attempt = 1;
|
||||||
cmdStr += ' ';
|
while (attempt < this.maxAttempts) {
|
||||||
let first = true;
|
// Try
|
||||||
for (const key in this.properties) {
|
try {
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
return yield action();
|
||||||
const val = this.properties[key];
|
|
||||||
if (val) {
|
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cmdStr += ',';
|
|
||||||
}
|
|
||||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (isRetryable && !isRetryable(err)) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
core.info(err.message);
|
||||||
|
}
|
||||||
|
// Sleep
|
||||||
|
const seconds = this.getSleepAmount();
|
||||||
|
core.info(`Waiting ${seconds} seconds before trying again`);
|
||||||
|
yield this.sleep(seconds);
|
||||||
|
attempt++;
|
||||||
}
|
}
|
||||||
}
|
// Last attempt
|
||||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
return yield action();
|
||||||
return cmdStr;
|
});
|
||||||
|
}
|
||||||
|
getSleepAmount() {
|
||||||
|
return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) +
|
||||||
|
this.minSeconds);
|
||||||
|
}
|
||||||
|
sleep(seconds) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function escapeData(s) {
|
exports.RetryHelper = RetryHelper;
|
||||||
return (s || '')
|
//# sourceMappingURL=retry-helper.js.map
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
/***/ }),
|
||||||
.replace(/\n/g, '%0A');
|
|
||||||
|
/***/ 986:
|
||||||
|
/***/ (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 tr = __importStar(__webpack_require__(9));
|
||||||
|
/**
|
||||||
|
* Exec a command.
|
||||||
|
* Output will be streamed to the live console.
|
||||||
|
* Returns promise with return code
|
||||||
|
*
|
||||||
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||||
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||||
|
* @param options optional exec options. See ExecOptions
|
||||||
|
* @returns Promise<number> exit code
|
||||||
|
*/
|
||||||
|
function exec(commandLine, args, options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const commandArgs = tr.argStringToArray(commandLine);
|
||||||
|
if (commandArgs.length === 0) {
|
||||||
|
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||||
|
}
|
||||||
|
// Path to tool to execute should be first arg
|
||||||
|
const toolPath = commandArgs[0];
|
||||||
|
args = commandArgs.slice(1).concat(args || []);
|
||||||
|
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||||
|
return runner.exec();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function escapeProperty(s) {
|
exports.exec = exec;
|
||||||
return (s || '')
|
//# sourceMappingURL=exec.js.map
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A')
|
|
||||||
.replace(/:/g, '%3A')
|
|
||||||
.replace(/,/g, '%2C');
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=command.js.map
|
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@ -10,9 +10,9 @@
|
|||||||
"integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
|
"integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz",
|
||||||
"integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==",
|
"integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/io": "^1.0.1"
|
"@actions/io": "^1.0.1"
|
||||||
@ -34,12 +34,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@actions/tool-cache": {
|
"@actions/tool-cache": {
|
||||||
"version": "1.5.2",
|
"version": "1.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.5.5.tgz",
|
||||||
"integrity": "sha512-40A1St0GEo+QvHV1YRjStEoQcKKMaip+zNXPgGHcjYXCdZ7cl1LGlwOpsVVqwk+6ue/shFTS76KC1A02mVVCQA==",
|
"integrity": "sha512-y/YO37BOaXzOEHpvoGZDLCwvg6XZWQ7Ala4Np4xzrKD1r48mff+K/GAmzXMejnApU7kgqC6lL/aCKTZDCrhdmw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.2.0",
|
"@actions/core": "^1.2.3",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.0.0",
|
||||||
"@actions/http-client": "^1.0.8",
|
"@actions/http-client": "^1.0.8",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.1",
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.5.2",
|
"@actions/tool-cache": "^1.5.5",
|
||||||
"@types/jest": "^25.1.4",
|
"@types/jest": "^25.1.4",
|
||||||
"@types/node": "^12.12.31",
|
"@types/node": "^12.12.31",
|
||||||
"@types/semver": "^7.1.0",
|
"@types/semver": "^7.1.0",
|
||||||
|
|||||||
@ -4,7 +4,8 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import {ExecOptions} from '@actions/exec/lib/interfaces';
|
import {ExecOptions} from '@actions/exec/lib/interfaces';
|
||||||
|
|
||||||
const AUTH_TOKEN = core.getInput('token');
|
const TOKEN = core.getInput('token');
|
||||||
|
const AUTH = !TOKEN || isGhes() ? undefined : `token ${TOKEN}`;
|
||||||
const MANIFEST_REPO_OWNER = 'actions';
|
const MANIFEST_REPO_OWNER = 'actions';
|
||||||
const MANIFEST_REPO_NAME = 'python-versions';
|
const MANIFEST_REPO_NAME = 'python-versions';
|
||||||
export const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/master/versions-manifest.json`;
|
export const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/master/versions-manifest.json`;
|
||||||
@ -18,7 +19,7 @@ export async function findReleaseFromManifest(
|
|||||||
const manifest: tc.IToolRelease[] = await tc.getManifestFromRepo(
|
const manifest: tc.IToolRelease[] = await tc.getManifestFromRepo(
|
||||||
MANIFEST_REPO_OWNER,
|
MANIFEST_REPO_OWNER,
|
||||||
MANIFEST_REPO_NAME,
|
MANIFEST_REPO_NAME,
|
||||||
AUTH_TOKEN
|
AUTH
|
||||||
);
|
);
|
||||||
return await tc.findFromManifest(
|
return await tc.findFromManifest(
|
||||||
semanticVersionSpec,
|
semanticVersionSpec,
|
||||||
@ -50,7 +51,7 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) {
|
|||||||
const downloadUrl = release.files[0].download_url;
|
const downloadUrl = release.files[0].download_url;
|
||||||
|
|
||||||
core.info(`Download from "${downloadUrl}"`);
|
core.info(`Download from "${downloadUrl}"`);
|
||||||
const pythonPath = await tc.downloadTool(downloadUrl, undefined, AUTH_TOKEN);
|
const pythonPath = await tc.downloadTool(downloadUrl, undefined, AUTH);
|
||||||
const fileName = path.basename(pythonPath, '.zip');
|
const fileName = path.basename(pythonPath, '.zip');
|
||||||
core.info('Extract downloaded archive');
|
core.info('Extract downloaded archive');
|
||||||
let pythonExtractedFolder;
|
let pythonExtractedFolder;
|
||||||
@ -63,3 +64,10 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) {
|
|||||||
core.info('Execute installation script');
|
core.info('Execute installation script');
|
||||||
await installPython(pythonExtractedFolder);
|
await installPython(pythonExtractedFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isGhes(): boolean {
|
||||||
|
const ghUrl = new URL(
|
||||||
|
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||||
|
);
|
||||||
|
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user