Bump @babel/traverse from 7.15.4 to 7.23.2 (#870)

releases/v3
dependabot[bot] 2023-10-19 10:40:59 +02:00 committed by GitHub
parent 2a017f350d
commit 7da2a7eb0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 4895 additions and 5093 deletions

View File

@ -1,6 +1,6 @@
--- ---
name: signal-exit name: signal-exit
version: 3.0.2 version: 3.0.7
type: npm type: npm
summary: when you want to fire an event no matter how a process exits. summary: when you want to fire an event no matter how a process exits.
homepage: https://github.com/tapjs/signal-exit homepage: https://github.com/tapjs/signal-exit

View File

@ -60332,86 +60332,90 @@ exports.debug = debug; // for test
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
}) : (function(o, m, k, k2) { if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
if (k2 === undefined) k2 = k; desc = { enumerable: true, get: function() { return m[k]; } };
o[k2] = m[k]; }
})); Object.defineProperty(o, k2, desc);
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { }) : (function(o, m, k, k2) {
Object.defineProperty(o, "default", { enumerable: true, value: v }); if (k2 === undefined) k2 = k;
}) : function(o, v) { o[k2] = m[k];
o["default"] = v; }));
}); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(o, "default", { enumerable: true, value: v });
if (mod && mod.__esModule) return mod; }) : function(o, v) {
var result = {}; o["default"] = v;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); });
__setModuleDefault(result, mod); var __importStar = (this && this.__importStar) || function (mod) {
return result; if (mod && mod.__esModule) return mod;
}; var result = {};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } __setModuleDefault(result, mod);
return new (P || (P = Promise))(function (resolve, reject) { return result;
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } };
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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); } }
Object.defineProperty(exports, "__esModule", ({ value: true })); function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
exports.run = void 0; step((generator = generator.apply(thisArg, _arguments || [])).next());
const core = __importStar(__nccwpck_require__(2186)); });
const cache = __importStar(__nccwpck_require__(7799)); };
const constants_1 = __nccwpck_require__(9042); Object.defineProperty(exports, "__esModule", ({ value: true }));
const cache_utils_1 = __nccwpck_require__(1678); exports.run = void 0;
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in const core = __importStar(__nccwpck_require__(2186));
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to const cache = __importStar(__nccwpck_require__(7799));
// throw an uncaught exception. Instead of failing this action, just warn. const constants_1 = __nccwpck_require__(9042);
process.on('uncaughtException', e => { const cache_utils_1 = __nccwpck_require__(1678);
const warningPrefix = '[warning]'; // Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
core.info(`${warningPrefix}${e.message}`); // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
}); // throw an uncaught exception. Instead of failing this action, just warn.
function run() { process.on('uncaughtException', e => {
return __awaiter(this, void 0, void 0, function* () { const warningPrefix = '[warning]';
try { core.info(`${warningPrefix}${e.message}`);
const cacheLock = core.getState(constants_1.State.CachePackageManager); });
yield cachePackages(cacheLock); function run() {
} return __awaiter(this, void 0, void 0, function* () {
catch (error) { try {
core.setFailed(error.message); const cacheLock = core.getState(constants_1.State.CachePackageManager);
} yield cachePackages(cacheLock);
}); }
} catch (error) {
exports.run = run; core.setFailed(error.message);
const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () { }
const state = core.getState(constants_1.State.CacheMatchedKey); });
const primaryKey = core.getState(constants_1.State.CachePrimaryKey); }
const cachePaths = JSON.parse(core.getState(constants_1.State.CachePaths) || '[]'); exports.run = run;
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager); const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
if (!packageManagerInfo) { const state = core.getState(constants_1.State.CacheMatchedKey);
core.debug(`Caching for '${packageManager}' is not supported`); const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
return; const cachePaths = JSON.parse(core.getState(constants_1.State.CachePaths) || '[]');
} const packageManagerInfo = yield (0, cache_utils_1.getPackageManagerInfo)(packageManager);
if (!cachePaths.length) { if (!packageManagerInfo) {
// TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?) core.debug(`Caching for '${packageManager}' is not supported`);
// export declare function getInput(name: string, options?: InputOptions): string; return;
const cacheDependencyPath = core.getInput('cache-dependency-path') || ''; }
throw new Error(`Cache folder paths are not retrieved for ${packageManager} with cache-dependency-path = ${cacheDependencyPath}`); if (!cachePaths.length) {
} // TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?)
if (primaryKey === state) { // export declare function getInput(name: string, options?: InputOptions): string;
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); const cacheDependencyPath = core.getInput('cache-dependency-path') || '';
return; throw new Error(`Cache folder paths are not retrieved for ${packageManager} with cache-dependency-path = ${cacheDependencyPath}`);
} }
const cacheId = yield cache.saveCache(cachePaths, primaryKey); if (primaryKey === state) {
if (cacheId == -1) { core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
return; return;
} }
core.info(`Cache saved with the key: ${primaryKey}`); const cacheId = yield cache.saveCache(cachePaths, primaryKey);
}); if (cacheId == -1) {
run(); return;
}
core.info(`Cache saved with the key: ${primaryKey}`);
});
run();
/***/ }), /***/ }),
@ -60420,254 +60424,258 @@ run();
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
}) : (function(o, m, k, k2) { if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
if (k2 === undefined) k2 = k; desc = { enumerable: true, get: function() { return m[k]; } };
o[k2] = m[k]; }
})); Object.defineProperty(o, k2, desc);
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { }) : (function(o, m, k, k2) {
Object.defineProperty(o, "default", { enumerable: true, value: v }); if (k2 === undefined) k2 = k;
}) : function(o, v) { o[k2] = m[k];
o["default"] = v; }));
}); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(o, "default", { enumerable: true, value: v });
if (mod && mod.__esModule) return mod; }) : function(o, v) {
var result = {}; o["default"] = v;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); });
__setModuleDefault(result, mod); var __importStar = (this && this.__importStar) || function (mod) {
return result; if (mod && mod.__esModule) return mod;
}; var result = {};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } __setModuleDefault(result, mod);
return new (P || (P = Promise))(function (resolve, reject) { return result;
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } };
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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); } }
var __importDefault = (this && this.__importDefault) || function (mod) { function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
return (mod && mod.__esModule) ? mod : { "default": mod }; step((generator = generator.apply(thisArg, _arguments || [])).next());
}; });
Object.defineProperty(exports, "__esModule", ({ value: true })); };
exports.isCacheFeatureAvailable = exports.isGhes = exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.resetProjectDirectoriesMemoized = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0; var __importDefault = (this && this.__importDefault) || function (mod) {
const core = __importStar(__nccwpck_require__(2186)); return (mod && mod.__esModule) ? mod : { "default": mod };
const exec = __importStar(__nccwpck_require__(1514)); };
const cache = __importStar(__nccwpck_require__(7799)); Object.defineProperty(exports, "__esModule", ({ value: true }));
const glob = __importStar(__nccwpck_require__(8090)); exports.isCacheFeatureAvailable = exports.isGhes = exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.resetProjectDirectoriesMemoized = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
const path_1 = __importDefault(__nccwpck_require__(1017)); const core = __importStar(__nccwpck_require__(2186));
const fs_1 = __importDefault(__nccwpck_require__(7147)); const exec = __importStar(__nccwpck_require__(1514));
const util_1 = __nccwpck_require__(2629); const cache = __importStar(__nccwpck_require__(7799));
exports.supportedPackageManagers = { const glob = __importStar(__nccwpck_require__(8090));
npm: { const path_1 = __importDefault(__nccwpck_require__(1017));
name: 'npm', const fs_1 = __importDefault(__nccwpck_require__(7147));
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'], const util_1 = __nccwpck_require__(2629);
getCacheFolderPath: () => exports.getCommandOutputNotEmpty('npm config get cache', 'Could not get npm cache folder path') exports.supportedPackageManagers = {
}, npm: {
pnpm: { name: 'npm',
name: 'pnpm', lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
lockFilePatterns: ['pnpm-lock.yaml'], getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('npm config get cache', 'Could not get npm cache folder path')
getCacheFolderPath: () => exports.getCommandOutputNotEmpty('pnpm store path --silent', 'Could not get pnpm cache folder path') },
}, pnpm: {
yarn: { name: 'pnpm',
name: 'yarn', lockFilePatterns: ['pnpm-lock.yaml'],
lockFilePatterns: ['yarn.lock'], getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('pnpm store path --silent', 'Could not get pnpm cache folder path')
getCacheFolderPath: (projectDir) => __awaiter(void 0, void 0, void 0, function* () { },
const yarnVersion = yield exports.getCommandOutputNotEmpty(`yarn --version`, 'Could not retrieve version of yarn', projectDir); yarn: {
core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`); name: 'yarn',
const stdOut = yarnVersion.startsWith('1.') lockFilePatterns: ['yarn.lock'],
? yield exports.getCommandOutput('yarn cache dir', projectDir) getCacheFolderPath: (projectDir) => __awaiter(void 0, void 0, void 0, function* () {
: yield exports.getCommandOutput('yarn config get cacheFolder', projectDir); const yarnVersion = yield (0, exports.getCommandOutputNotEmpty)(`yarn --version`, 'Could not retrieve version of yarn', projectDir);
if (!stdOut) { core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`);
throw new Error(`Could not get yarn cache folder path for ${projectDir}`); const stdOut = yarnVersion.startsWith('1.')
} ? yield (0, exports.getCommandOutput)('yarn cache dir', projectDir)
return stdOut; : yield (0, exports.getCommandOutput)('yarn config get cacheFolder', projectDir);
}) if (!stdOut) {
} throw new Error(`Could not get yarn cache folder path for ${projectDir}`);
}; }
const getCommandOutput = (toolCommand, cwd) => __awaiter(void 0, void 0, void 0, function* () { return stdOut;
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, Object.assign({ ignoreReturnCode: true }, (cwd && { cwd }))); })
if (exitCode) { }
stderr = !stderr.trim() };
? `The '${toolCommand}' command failed with exit code: ${exitCode}` const getCommandOutput = (toolCommand, cwd) => __awaiter(void 0, void 0, void 0, function* () {
: stderr; let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, Object.assign({ ignoreReturnCode: true }, (cwd && { cwd })));
throw new Error(stderr); if (exitCode) {
} stderr = !stderr.trim()
return stdout.trim(); ? `The '${toolCommand}' command failed with exit code: ${exitCode}`
}); : stderr;
exports.getCommandOutput = getCommandOutput; throw new Error(stderr);
const getCommandOutputNotEmpty = (toolCommand, error, cwd) => __awaiter(void 0, void 0, void 0, function* () { }
const stdOut = exports.getCommandOutput(toolCommand, cwd); return stdout.trim();
if (!stdOut) { });
throw new Error(error); exports.getCommandOutput = getCommandOutput;
} const getCommandOutputNotEmpty = (toolCommand, error, cwd) => __awaiter(void 0, void 0, void 0, function* () {
return stdOut; const stdOut = (0, exports.getCommandOutput)(toolCommand, cwd);
}); if (!stdOut) {
exports.getCommandOutputNotEmpty = getCommandOutputNotEmpty; throw new Error(error);
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () { }
if (packageManager === 'npm') { return stdOut;
return exports.supportedPackageManagers.npm; });
} exports.getCommandOutputNotEmpty = getCommandOutputNotEmpty;
else if (packageManager === 'pnpm') { const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
return exports.supportedPackageManagers.pnpm; if (packageManager === 'npm') {
} return exports.supportedPackageManagers.npm;
else if (packageManager === 'yarn') { }
return exports.supportedPackageManagers.yarn; else if (packageManager === 'pnpm') {
} return exports.supportedPackageManagers.pnpm;
else { }
return null; else if (packageManager === 'yarn') {
} return exports.supportedPackageManagers.yarn;
}); }
exports.getPackageManagerInfo = getPackageManagerInfo; else {
/** return null;
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache` }
* - first through `getCacheDirectories` });
* - second from `repoHasYarn3ManagedCache` exports.getPackageManagerInfo = getPackageManagerInfo;
* /**
* it contains expensive IO operation and thus should be memoized * getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
*/ * - first through `getCacheDirectories`
let projectDirectoriesMemoized = null; * - second from `repoHasYarn3ManagedCache`
/** *
* unit test must reset memoized variables * it contains expensive IO operation and thus should be memoized
*/ */
const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null); let projectDirectoriesMemoized = null;
exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized; /**
/** * unit test must reset memoized variables
* Expands (converts) the string input `cache-dependency-path` to list of directories that */
* may be project roots const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
* expected to be the result of `core.getInput('cache-dependency-path')` /**
* @return list of directories and possible * Expands (converts) the string input `cache-dependency-path` to list of directories that
*/ * may be project roots
const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
if (projectDirectoriesMemoized !== null) { * expected to be the result of `core.getInput('cache-dependency-path')`
return projectDirectoriesMemoized; * @return list of directories and possible
} */
const globber = yield glob.create(cacheDependencyPath); const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
const cacheDependenciesPaths = yield globber.glob(); if (projectDirectoriesMemoized !== null) {
const existingDirectories = cacheDependenciesPaths return projectDirectoriesMemoized;
.map(path_1.default.dirname) }
.filter(util_1.unique()) const globber = yield glob.create(cacheDependencyPath);
.map(dirName => fs_1.default.realpathSync(dirName)) const cacheDependenciesPaths = yield globber.glob();
.filter(directory => fs_1.default.lstatSync(directory).isDirectory()); const existingDirectories = cacheDependenciesPaths
if (!existingDirectories.length) .map(path_1.default.dirname)
core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`); .filter((0, util_1.unique)())
projectDirectoriesMemoized = existingDirectories; .map(dirName => fs_1.default.realpathSync(dirName))
return existingDirectories; .filter(directory => fs_1.default.lstatSync(directory).isDirectory());
}); if (!existingDirectories.length)
/** core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
* Finds the cache directories configured for the repo if cache-dependency-path is not empty projectDirectoriesMemoized = existingDirectories;
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM return existingDirectories;
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns });
* expected to be the result of `core.getInput('cache-dependency-path')` /**
* @return list of files on which the cache depends * Finds the cache directories configured for the repo if cache-dependency-path is not empty
*/ * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
const projectDirectories = yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath); * expected to be the result of `core.getInput('cache-dependency-path')`
const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () { * @return list of files on which the cache depends
const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory); */
core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`); const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
return cacheFolderPath; const projectDirectories = yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
}))); const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
// uniq in order to do not cache the same directories twice const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
return cacheFoldersPaths.filter(util_1.unique()); core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
}); return cacheFolderPath;
/** })));
* Finds the cache directories configured for the repo ignoring cache-dependency-path // uniq in order to do not cache the same directories twice
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM return cacheFoldersPaths.filter((0, util_1.unique)());
* @return list of files on which the cache depends });
*/ /**
const getCacheDirectoriesForRootProject = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () { * Finds the cache directories configured for the repo ignoring cache-dependency-path
const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(); * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the root directory`); * @return list of files on which the cache depends
return [cacheFolderPath]; */
}); const getCacheDirectoriesForRootProject = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
/** const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath();
* A function to find the cache directories configured for the repo core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the root directory`);
* currently it handles only the case of PM=yarn && cacheDependencyPath is not empty return [cacheFolderPath];
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM });
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns /**
* expected to be the result of `core.getInput('cache-dependency-path')` * A function to find the cache directories configured for the repo
* @return list of files on which the cache depends * currently it handles only the case of PM=yarn && cacheDependencyPath is not empty
*/ * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
const getCacheDirectories = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
// For yarn, if cacheDependencyPath is set, ask information about cache folders in each project * expected to be the result of `core.getInput('cache-dependency-path')`
// folder satisfied by cacheDependencyPath https://github.com/actions/setup-node/issues/488 * @return list of files on which the cache depends
if (packageManagerInfo.name === 'yarn' && cacheDependencyPath) { */
return getCacheDirectoriesFromCacheDependencyPath(packageManagerInfo, cacheDependencyPath); const getCacheDirectories = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
} // For yarn, if cacheDependencyPath is set, ask information about cache folders in each project
return getCacheDirectoriesForRootProject(packageManagerInfo); // folder satisfied by cacheDependencyPath https://github.com/actions/setup-node/issues/488
}); if (packageManagerInfo.name === 'yarn' && cacheDependencyPath) {
exports.getCacheDirectories = getCacheDirectories; return getCacheDirectoriesFromCacheDependencyPath(packageManagerInfo, cacheDependencyPath);
/** }
* A function to check if the directory is a yarn project configured to manage return getCacheDirectoriesForRootProject(packageManagerInfo);
* obsolete dependencies in the local cache });
* @param directory - a path to the folder exports.getCacheDirectories = getCacheDirectories;
* @return - true if the directory's project is yarn managed /**
* - if there's .yarn/cache folder do not mess with the dependencies kept in the repo, return false * A function to check if the directory is a yarn project configured to manage
* - global cache is not managed by yarn @see https://yarnpkg.com/features/offline-cache, return false * obsolete dependencies in the local cache
* - if local cache is not explicitly enabled (not yarn3), return false * @param directory - a path to the folder
* - return true otherwise * @return - true if the directory's project is yarn managed
*/ * - if there's .yarn/cache folder do not mess with the dependencies kept in the repo, return false
const projectHasYarnBerryManagedDependencies = (directory) => __awaiter(void 0, void 0, void 0, function* () { * - global cache is not managed by yarn @see https://yarnpkg.com/features/offline-cache, return false
const workDir = directory || process.env.GITHUB_WORKSPACE || '.'; * - if local cache is not explicitly enabled (not yarn3), return false
core.debug(`check if "${workDir}" has locally managed yarn3 dependencies`); * - return true otherwise
// if .yarn/cache directory exists the cache is managed by version control system */
const yarnCacheFile = path_1.default.join(workDir, '.yarn', 'cache'); const projectHasYarnBerryManagedDependencies = (directory) => __awaiter(void 0, void 0, void 0, function* () {
if (fs_1.default.existsSync(yarnCacheFile) && const workDir = directory || process.env.GITHUB_WORKSPACE || '.';
fs_1.default.lstatSync(yarnCacheFile).isDirectory()) { core.debug(`check if "${workDir}" has locally managed yarn3 dependencies`);
core.debug(`"${workDir}" has .yarn/cache - dependencies are kept in the repository`); // if .yarn/cache directory exists the cache is managed by version control system
return Promise.resolve(false); const yarnCacheFile = path_1.default.join(workDir, '.yarn', 'cache');
} if (fs_1.default.existsSync(yarnCacheFile) &&
// NOTE: yarn1 returns 'undefined' with return code = 0 fs_1.default.lstatSync(yarnCacheFile).isDirectory()) {
const enableGlobalCache = yield exports.getCommandOutput('yarn config get enableGlobalCache', workDir); core.debug(`"${workDir}" has .yarn/cache - dependencies are kept in the repository`);
// only local cache is not managed by yarn return Promise.resolve(false);
const managed = enableGlobalCache.includes('false'); }
if (managed) { // NOTE: yarn1 returns 'undefined' with return code = 0
core.debug(`"${workDir}" dependencies are managed by yarn 3 locally`); const enableGlobalCache = yield (0, exports.getCommandOutput)('yarn config get enableGlobalCache', workDir);
return true; // only local cache is not managed by yarn
} const managed = enableGlobalCache.includes('false');
else { if (managed) {
core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`); core.debug(`"${workDir}" dependencies are managed by yarn 3 locally`);
return false; return true;
} }
}); else {
/** core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`);
* A function to report the repo contains Yarn managed projects return false;
* @param packageManagerInfo - used to make sure current package manager is yarn }
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns });
* expected to be the result of `core.getInput('cache-dependency-path')` /**
* @return - true if all project directories configured to be Yarn managed * A function to report the repo contains Yarn managed projects
*/ * @param packageManagerInfo - used to make sure current package manager is yarn
const repoHasYarnBerryManagedDependencies = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { * @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
if (packageManagerInfo.name !== 'yarn') * expected to be the result of `core.getInput('cache-dependency-path')`
return false; * @return - true if all project directories configured to be Yarn managed
const yarnDirs = cacheDependencyPath */
? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath) const repoHasYarnBerryManagedDependencies = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
: ['']; if (packageManagerInfo.name !== 'yarn')
const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies)); return false;
return isManagedList.every(Boolean); const yarnDirs = cacheDependencyPath
}); ? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
exports.repoHasYarnBerryManagedDependencies = repoHasYarnBerryManagedDependencies; : [''];
function isGhes() { const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); return isManagedList.every(Boolean);
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; });
} exports.repoHasYarnBerryManagedDependencies = repoHasYarnBerryManagedDependencies;
exports.isGhes = isGhes; function isGhes() {
function isCacheFeatureAvailable() { const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
if (cache.isFeatureAvailable()) return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
return true; }
if (isGhes()) { exports.isGhes = isGhes;
core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); function isCacheFeatureAvailable() {
return false; if (cache.isFeatureAvailable())
} return true;
core.warning('The runner was not able to contact the cache service. Caching will be skipped'); if (isGhes()) {
return false; core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
} return false;
exports.isCacheFeatureAvailable = isCacheFeatureAvailable; }
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
return false;
}
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
/***/ }), /***/ }),
@ -60676,26 +60684,26 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Outputs = exports.State = exports.LockType = void 0; exports.Outputs = exports.State = exports.LockType = void 0;
var LockType; var LockType;
(function (LockType) { (function (LockType) {
LockType["Npm"] = "npm"; LockType["Npm"] = "npm";
LockType["Pnpm"] = "pnpm"; LockType["Pnpm"] = "pnpm";
LockType["Yarn"] = "yarn"; LockType["Yarn"] = "yarn";
})(LockType = exports.LockType || (exports.LockType = {})); })(LockType = exports.LockType || (exports.LockType = {}));
var State; var State;
(function (State) { (function (State) {
State["CachePackageManager"] = "SETUP_NODE_CACHE_PACKAGE_MANAGER"; State["CachePackageManager"] = "SETUP_NODE_CACHE_PACKAGE_MANAGER";
State["CachePrimaryKey"] = "CACHE_KEY"; State["CachePrimaryKey"] = "CACHE_KEY";
State["CacheMatchedKey"] = "CACHE_RESULT"; State["CacheMatchedKey"] = "CACHE_RESULT";
State["CachePaths"] = "CACHE_PATHS"; State["CachePaths"] = "CACHE_PATHS";
})(State = exports.State || (exports.State = {})); })(State = exports.State || (exports.State = {}));
var Outputs; var Outputs;
(function (Outputs) { (function (Outputs) {
Outputs["CacheHit"] = "cache-hit"; Outputs["CacheHit"] = "cache-hit";
})(Outputs = exports.Outputs || (exports.Outputs = {})); })(Outputs = exports.Outputs || (exports.Outputs = {}));
/***/ }), /***/ }),
@ -60704,108 +60712,112 @@ var Outputs;
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
}) : (function(o, m, k, k2) { if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
if (k2 === undefined) k2 = k; desc = { enumerable: true, get: function() { return m[k]; } };
o[k2] = m[k]; }
})); Object.defineProperty(o, k2, desc);
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { }) : (function(o, m, k, k2) {
Object.defineProperty(o, "default", { enumerable: true, value: v }); if (k2 === undefined) k2 = k;
}) : function(o, v) { o[k2] = m[k];
o["default"] = v; }));
}); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(o, "default", { enumerable: true, value: v });
if (mod && mod.__esModule) return mod; }) : function(o, v) {
var result = {}; o["default"] = v;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); });
__setModuleDefault(result, mod); var __importStar = (this && this.__importStar) || function (mod) {
return result; if (mod && mod.__esModule) return mod;
}; var result = {};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } __setModuleDefault(result, mod);
return new (P || (P = Promise))(function (resolve, reject) { return result;
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } };
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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); } }
Object.defineProperty(exports, "__esModule", ({ value: true })); function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
exports.unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0; step((generator = generator.apply(thisArg, _arguments || [])).next());
const core = __importStar(__nccwpck_require__(2186)); });
const exec = __importStar(__nccwpck_require__(1514)); };
function parseNodeVersionFile(contents) { Object.defineProperty(exports, "__esModule", ({ value: true }));
var _a, _b, _c; exports.unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
let nodeVersion; const core = __importStar(__nccwpck_require__(2186));
// Try parsing the file as an NPM `package.json` file. const exec = __importStar(__nccwpck_require__(1514));
try { function parseNodeVersionFile(contents) {
nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node; var _a, _b, _c;
if (!nodeVersion) let nodeVersion;
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node; // Try parsing the file as an NPM `package.json` file.
} try {
catch (_d) { nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
core.info('Node version file is not JSON file'); if (!nodeVersion)
} nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
if (!nodeVersion) { }
const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m); catch (_d) {
nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version; core.info('Node version file is not JSON file');
} }
// In the case of an unknown format, if (!nodeVersion) {
// return as is and evaluate the version separately. const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
if (!nodeVersion) nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
nodeVersion = contents.trim(); }
return nodeVersion; // In the case of an unknown format,
} // return as is and evaluate the version separately.
exports.parseNodeVersionFile = parseNodeVersionFile; if (!nodeVersion)
function printEnvDetailsAndSetOutput() { nodeVersion = contents.trim();
return __awaiter(this, void 0, void 0, function* () { return nodeVersion;
core.startGroup('Environment details'); }
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () { exports.parseNodeVersionFile = parseNodeVersionFile;
const output = yield getToolVersion(tool, ['--version']); function printEnvDetailsAndSetOutput() {
return { tool, output }; return __awaiter(this, void 0, void 0, function* () {
})); core.startGroup('Environment details');
const tools = yield Promise.all(promises); const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
tools.forEach(({ tool, output }) => { const output = yield getToolVersion(tool, ['--version']);
if (tool === 'node') { return { tool, output };
core.setOutput(`${tool}-version`, output); }));
} const tools = yield Promise.all(promises);
core.info(`${tool}: ${output}`); tools.forEach(({ tool, output }) => {
}); if (tool === 'node') {
core.endGroup(); core.setOutput(`${tool}-version`, output);
}); }
} core.info(`${tool}: ${output}`);
exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput; });
function getToolVersion(tool, options) { core.endGroup();
return __awaiter(this, void 0, void 0, function* () { });
try { }
const { stdout, stderr, exitCode } = yield exec.getExecOutput(tool, options, { exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput;
ignoreReturnCode: true, function getToolVersion(tool, options) {
silent: true return __awaiter(this, void 0, void 0, function* () {
}); try {
if (exitCode > 0) { const { stdout, stderr, exitCode } = yield exec.getExecOutput(tool, options, {
core.info(`[warning]${stderr}`); ignoreReturnCode: true,
return ''; silent: true
} });
return stdout.trim(); if (exitCode > 0) {
} core.info(`[warning]${stderr}`);
catch (err) { return '';
return ''; }
} return stdout.trim();
}); }
} catch (err) {
const unique = () => { return '';
const encountered = new Set(); }
return (value) => { });
if (encountered.has(value)) }
return false; const unique = () => {
encountered.add(value); const encountered = new Set();
return true; return (value) => {
}; if (encountered.has(value))
}; return false;
exports.unique = unique; encountered.add(value);
return true;
};
};
exports.unique = unique;
/***/ }), /***/ }),

3646
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

5406
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -37,22 +37,22 @@
"uuid": "^9.0.0" "uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^29.5.6",
"@types/node": "^16.11.25", "@types/node": "^16.11.25",
"@types/semver": "^6.0.0", "@types/semver": "^6.0.0",
"@types/uuid": "^9.0.3", "@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0", "@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.33.4", "@vercel/ncc": "^0.38.0",
"eslint": "^8.35.0", "eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.2.1", "eslint-plugin-jest": "^27.2.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^27.2.5", "jest": "^29.7.0",
"jest-circus": "^27.2.5", "jest-circus": "^29.7.0",
"jest-each": "^27.2.5", "jest-each": "^29.7.0",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"ts-jest": "^27.0.5", "ts-jest": "^29.1.1",
"typescript": "^4.2.3" "typescript": "^4.2.3"
} }
} }

View File

@ -17,7 +17,7 @@ export async function run() {
const cacheLock = core.getState(State.CachePackageManager); const cacheLock = core.getState(State.CachePackageManager);
await cachePackages(cacheLock); await cachePackages(cacheLock);
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed((error as Error).message);
} }
} }

View File

@ -100,9 +100,9 @@ export default class OfficialBuilds extends BaseDistribution {
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded` `Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
); );
} else { } else {
core.info(err.message); core.info((err as Error).message);
} }
core.debug(err.stack); core.debug((err as Error).stack ?? 'empty stack');
core.info('Falling back to download directly from Node'); core.info('Falling back to download directly from Node');
} }
@ -214,7 +214,7 @@ export default class OfficialBuilds extends BaseDistribution {
return info?.resolvedVersion; return info?.resolvedVersion;
} catch (err) { } catch (err) {
core.info('Unable to resolve version from manifest...'); core.info('Unable to resolve version from manifest...');
core.debug(err.message); core.debug((err as Error).message);
} }
} }

View File

@ -75,7 +75,7 @@ export async function run() {
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}` `##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
); );
} catch (err) { } catch (err) {
core.setFailed(err.message); core.setFailed((err as Error).message);
} }
} }