mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 03:08:21 +08:00 
			
		
		
		
	Bump @babel/traverse from 7.15.4 to 7.23.2 (#870)
This commit is contained in:
		
							
								
								
									
										2
									
								
								.licenses/npm/signal-exit.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/signal-exit.dep.yml
									
									
									
										generated
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
name: signal-exit
 | 
			
		||||
version: 3.0.2
 | 
			
		||||
version: 3.0.7
 | 
			
		||||
type: npm
 | 
			
		||||
summary: when you want to fire an event no matter how a process exits.
 | 
			
		||||
homepage: https://github.com/tapjs/signal-exit
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										912
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										912
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							@@ -60332,86 +60332,90 @@ exports.debug = debug; // for test
 | 
			
		||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.run = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(2186));
 | 
			
		||||
const cache = __importStar(__nccwpck_require__(7799));
 | 
			
		||||
const constants_1 = __nccwpck_require__(9042);
 | 
			
		||||
const cache_utils_1 = __nccwpck_require__(1678);
 | 
			
		||||
// Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | 
			
		||||
// @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.
 | 
			
		||||
process.on('uncaughtException', e => {
 | 
			
		||||
    const warningPrefix = '[warning]';
 | 
			
		||||
    core.info(`${warningPrefix}${e.message}`);
 | 
			
		||||
});
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            const cacheLock = core.getState(constants_1.State.CachePackageManager);
 | 
			
		||||
            yield cachePackages(cacheLock);
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            core.setFailed(error.message);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.run = run;
 | 
			
		||||
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) || '[]');
 | 
			
		||||
    const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
 | 
			
		||||
    if (!packageManagerInfo) {
 | 
			
		||||
        core.debug(`Caching for '${packageManager}' is not supported`);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    if (!cachePaths.length) {
 | 
			
		||||
        // TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?)
 | 
			
		||||
        //       export declare function getInput(name: string, options?: InputOptions): string;
 | 
			
		||||
        const cacheDependencyPath = core.getInput('cache-dependency-path') || '';
 | 
			
		||||
        throw new Error(`Cache folder paths are not retrieved for ${packageManager} with cache-dependency-path = ${cacheDependencyPath}`);
 | 
			
		||||
    }
 | 
			
		||||
    if (primaryKey === state) {
 | 
			
		||||
        core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    const cacheId = yield cache.saveCache(cachePaths, primaryKey);
 | 
			
		||||
    if (cacheId == -1) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    core.info(`Cache saved with the key: ${primaryKey}`);
 | 
			
		||||
});
 | 
			
		||||
run();
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
			
		||||
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
			
		||||
      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(o, k2, desc);
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.run = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(2186));
 | 
			
		||||
const cache = __importStar(__nccwpck_require__(7799));
 | 
			
		||||
const constants_1 = __nccwpck_require__(9042);
 | 
			
		||||
const cache_utils_1 = __nccwpck_require__(1678);
 | 
			
		||||
// Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | 
			
		||||
// @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.
 | 
			
		||||
process.on('uncaughtException', e => {
 | 
			
		||||
    const warningPrefix = '[warning]';
 | 
			
		||||
    core.info(`${warningPrefix}${e.message}`);
 | 
			
		||||
});
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            const cacheLock = core.getState(constants_1.State.CachePackageManager);
 | 
			
		||||
            yield cachePackages(cacheLock);
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            core.setFailed(error.message);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.run = run;
 | 
			
		||||
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) || '[]');
 | 
			
		||||
    const packageManagerInfo = yield (0, cache_utils_1.getPackageManagerInfo)(packageManager);
 | 
			
		||||
    if (!packageManagerInfo) {
 | 
			
		||||
        core.debug(`Caching for '${packageManager}' is not supported`);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    if (!cachePaths.length) {
 | 
			
		||||
        // TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?)
 | 
			
		||||
        //       export declare function getInput(name: string, options?: InputOptions): string;
 | 
			
		||||
        const cacheDependencyPath = core.getInput('cache-dependency-path') || '';
 | 
			
		||||
        throw new Error(`Cache folder paths are not retrieved for ${packageManager} with cache-dependency-path = ${cacheDependencyPath}`);
 | 
			
		||||
    }
 | 
			
		||||
    if (primaryKey === state) {
 | 
			
		||||
        core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    const cacheId = yield cache.saveCache(cachePaths, primaryKey);
 | 
			
		||||
    if (cacheId == -1) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    core.info(`Cache saved with the key: ${primaryKey}`);
 | 
			
		||||
});
 | 
			
		||||
run();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
@@ -60420,254 +60424,258 @@ run();
 | 
			
		||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
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;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(2186));
 | 
			
		||||
const exec = __importStar(__nccwpck_require__(1514));
 | 
			
		||||
const cache = __importStar(__nccwpck_require__(7799));
 | 
			
		||||
const glob = __importStar(__nccwpck_require__(8090));
 | 
			
		||||
const path_1 = __importDefault(__nccwpck_require__(1017));
 | 
			
		||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
 | 
			
		||||
const util_1 = __nccwpck_require__(2629);
 | 
			
		||||
exports.supportedPackageManagers = {
 | 
			
		||||
    npm: {
 | 
			
		||||
        name: 'npm',
 | 
			
		||||
        lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
 | 
			
		||||
        getCacheFolderPath: () => exports.getCommandOutputNotEmpty('npm config get cache', 'Could not get npm cache folder path')
 | 
			
		||||
    },
 | 
			
		||||
    pnpm: {
 | 
			
		||||
        name: 'pnpm',
 | 
			
		||||
        lockFilePatterns: ['pnpm-lock.yaml'],
 | 
			
		||||
        getCacheFolderPath: () => exports.getCommandOutputNotEmpty('pnpm store path --silent', 'Could not get pnpm cache folder path')
 | 
			
		||||
    },
 | 
			
		||||
    yarn: {
 | 
			
		||||
        name: 'yarn',
 | 
			
		||||
        lockFilePatterns: ['yarn.lock'],
 | 
			
		||||
        getCacheFolderPath: (projectDir) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
            const yarnVersion = yield exports.getCommandOutputNotEmpty(`yarn --version`, 'Could not retrieve version of yarn', projectDir);
 | 
			
		||||
            core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`);
 | 
			
		||||
            const stdOut = yarnVersion.startsWith('1.')
 | 
			
		||||
                ? yield exports.getCommandOutput('yarn cache dir', projectDir)
 | 
			
		||||
                : yield exports.getCommandOutput('yarn config get cacheFolder', projectDir);
 | 
			
		||||
            if (!stdOut) {
 | 
			
		||||
                throw new Error(`Could not get yarn cache folder path for ${projectDir}`);
 | 
			
		||||
            }
 | 
			
		||||
            return stdOut;
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
const getCommandOutput = (toolCommand, cwd) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    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}`
 | 
			
		||||
            : stderr;
 | 
			
		||||
        throw new Error(stderr);
 | 
			
		||||
    }
 | 
			
		||||
    return stdout.trim();
 | 
			
		||||
});
 | 
			
		||||
exports.getCommandOutput = getCommandOutput;
 | 
			
		||||
const getCommandOutputNotEmpty = (toolCommand, error, cwd) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const stdOut = exports.getCommandOutput(toolCommand, cwd);
 | 
			
		||||
    if (!stdOut) {
 | 
			
		||||
        throw new Error(error);
 | 
			
		||||
    }
 | 
			
		||||
    return stdOut;
 | 
			
		||||
});
 | 
			
		||||
exports.getCommandOutputNotEmpty = getCommandOutputNotEmpty;
 | 
			
		||||
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    if (packageManager === 'npm') {
 | 
			
		||||
        return exports.supportedPackageManagers.npm;
 | 
			
		||||
    }
 | 
			
		||||
    else if (packageManager === 'pnpm') {
 | 
			
		||||
        return exports.supportedPackageManagers.pnpm;
 | 
			
		||||
    }
 | 
			
		||||
    else if (packageManager === 'yarn') {
 | 
			
		||||
        return exports.supportedPackageManagers.yarn;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
exports.getPackageManagerInfo = getPackageManagerInfo;
 | 
			
		||||
/**
 | 
			
		||||
 * getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
 | 
			
		||||
 *  - first through `getCacheDirectories`
 | 
			
		||||
 *  - second from `repoHasYarn3ManagedCache`
 | 
			
		||||
 *
 | 
			
		||||
 *  it contains expensive IO operation and thus should be memoized
 | 
			
		||||
 */
 | 
			
		||||
let projectDirectoriesMemoized = null;
 | 
			
		||||
/**
 | 
			
		||||
 * unit test must reset memoized variables
 | 
			
		||||
 */
 | 
			
		||||
const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
 | 
			
		||||
exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
 | 
			
		||||
/**
 | 
			
		||||
 * Expands (converts) the string input `cache-dependency-path` to list of directories that
 | 
			
		||||
 * may be project roots
 | 
			
		||||
 * @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 directories and possible
 | 
			
		||||
 */
 | 
			
		||||
const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    if (projectDirectoriesMemoized !== null) {
 | 
			
		||||
        return projectDirectoriesMemoized;
 | 
			
		||||
    }
 | 
			
		||||
    const globber = yield glob.create(cacheDependencyPath);
 | 
			
		||||
    const cacheDependenciesPaths = yield globber.glob();
 | 
			
		||||
    const existingDirectories = cacheDependenciesPaths
 | 
			
		||||
        .map(path_1.default.dirname)
 | 
			
		||||
        .filter(util_1.unique())
 | 
			
		||||
        .map(dirName => fs_1.default.realpathSync(dirName))
 | 
			
		||||
        .filter(directory => fs_1.default.lstatSync(directory).isDirectory());
 | 
			
		||||
    if (!existingDirectories.length)
 | 
			
		||||
        core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
 | 
			
		||||
    projectDirectoriesMemoized = existingDirectories;
 | 
			
		||||
    return existingDirectories;
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * 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
 | 
			
		||||
 * @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
 | 
			
		||||
 */
 | 
			
		||||
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const projectDirectories = yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
 | 
			
		||||
    const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
        const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
 | 
			
		||||
        core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
 | 
			
		||||
        return cacheFolderPath;
 | 
			
		||||
    })));
 | 
			
		||||
    // uniq in order to do not cache the same directories twice
 | 
			
		||||
    return cacheFoldersPaths.filter(util_1.unique());
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * Finds the cache directories configured for the repo ignoring cache-dependency-path
 | 
			
		||||
 * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
 | 
			
		||||
 * @return list of files on which the cache depends
 | 
			
		||||
 */
 | 
			
		||||
const getCacheDirectoriesForRootProject = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath();
 | 
			
		||||
    core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the root directory`);
 | 
			
		||||
    return [cacheFolderPath];
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * A function to find the cache directories configured for the repo
 | 
			
		||||
 * currently it handles only the case of PM=yarn && cacheDependencyPath is not empty
 | 
			
		||||
 * @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')`
 | 
			
		||||
 * @return list of files on which the cache depends
 | 
			
		||||
 */
 | 
			
		||||
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
 | 
			
		||||
    // folder satisfied by cacheDependencyPath https://github.com/actions/setup-node/issues/488
 | 
			
		||||
    if (packageManagerInfo.name === 'yarn' && cacheDependencyPath) {
 | 
			
		||||
        return getCacheDirectoriesFromCacheDependencyPath(packageManagerInfo, cacheDependencyPath);
 | 
			
		||||
    }
 | 
			
		||||
    return getCacheDirectoriesForRootProject(packageManagerInfo);
 | 
			
		||||
});
 | 
			
		||||
exports.getCacheDirectories = getCacheDirectories;
 | 
			
		||||
/**
 | 
			
		||||
 * A function to check if the directory is a yarn project configured to manage
 | 
			
		||||
 * obsolete dependencies in the local cache
 | 
			
		||||
 * @param directory - a path to the folder
 | 
			
		||||
 * @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
 | 
			
		||||
 *  - global cache is not managed by yarn @see https://yarnpkg.com/features/offline-cache, return false
 | 
			
		||||
 *  - if local cache is not explicitly enabled (not yarn3), return false
 | 
			
		||||
 *  - return true otherwise
 | 
			
		||||
 */
 | 
			
		||||
const projectHasYarnBerryManagedDependencies = (directory) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const workDir = directory || process.env.GITHUB_WORKSPACE || '.';
 | 
			
		||||
    core.debug(`check if "${workDir}" has locally managed yarn3 dependencies`);
 | 
			
		||||
    // if .yarn/cache directory exists the cache is managed by version control system
 | 
			
		||||
    const yarnCacheFile = path_1.default.join(workDir, '.yarn', 'cache');
 | 
			
		||||
    if (fs_1.default.existsSync(yarnCacheFile) &&
 | 
			
		||||
        fs_1.default.lstatSync(yarnCacheFile).isDirectory()) {
 | 
			
		||||
        core.debug(`"${workDir}" has .yarn/cache - dependencies are kept in the repository`);
 | 
			
		||||
        return Promise.resolve(false);
 | 
			
		||||
    }
 | 
			
		||||
    // NOTE: yarn1 returns 'undefined' with return code = 0
 | 
			
		||||
    const enableGlobalCache = yield exports.getCommandOutput('yarn config get enableGlobalCache', workDir);
 | 
			
		||||
    // only local cache is not managed by yarn
 | 
			
		||||
    const managed = enableGlobalCache.includes('false');
 | 
			
		||||
    if (managed) {
 | 
			
		||||
        core.debug(`"${workDir}" dependencies are managed by yarn 3 locally`);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`);
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * A function to report the repo contains Yarn managed projects
 | 
			
		||||
 * @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
 | 
			
		||||
 */
 | 
			
		||||
const repoHasYarnBerryManagedDependencies = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    if (packageManagerInfo.name !== 'yarn')
 | 
			
		||||
        return false;
 | 
			
		||||
    const yarnDirs = cacheDependencyPath
 | 
			
		||||
        ? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
 | 
			
		||||
        : [''];
 | 
			
		||||
    const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
 | 
			
		||||
    return isManagedList.every(Boolean);
 | 
			
		||||
});
 | 
			
		||||
exports.repoHasYarnBerryManagedDependencies = repoHasYarnBerryManagedDependencies;
 | 
			
		||||
function isGhes() {
 | 
			
		||||
    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
 | 
			
		||||
    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isCacheFeatureAvailable() {
 | 
			
		||||
    if (cache.isFeatureAvailable())
 | 
			
		||||
        return true;
 | 
			
		||||
    if (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.');
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    core.warning('The runner was not able to contact the cache service. Caching will be skipped');
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
			
		||||
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
			
		||||
      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(o, k2, desc);
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
			
		||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
			
		||||
};
 | 
			
		||||
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;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(2186));
 | 
			
		||||
const exec = __importStar(__nccwpck_require__(1514));
 | 
			
		||||
const cache = __importStar(__nccwpck_require__(7799));
 | 
			
		||||
const glob = __importStar(__nccwpck_require__(8090));
 | 
			
		||||
const path_1 = __importDefault(__nccwpck_require__(1017));
 | 
			
		||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
 | 
			
		||||
const util_1 = __nccwpck_require__(2629);
 | 
			
		||||
exports.supportedPackageManagers = {
 | 
			
		||||
    npm: {
 | 
			
		||||
        name: 'npm',
 | 
			
		||||
        lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
 | 
			
		||||
        getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('npm config get cache', 'Could not get npm cache folder path')
 | 
			
		||||
    },
 | 
			
		||||
    pnpm: {
 | 
			
		||||
        name: 'pnpm',
 | 
			
		||||
        lockFilePatterns: ['pnpm-lock.yaml'],
 | 
			
		||||
        getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('pnpm store path --silent', 'Could not get pnpm cache folder path')
 | 
			
		||||
    },
 | 
			
		||||
    yarn: {
 | 
			
		||||
        name: 'yarn',
 | 
			
		||||
        lockFilePatterns: ['yarn.lock'],
 | 
			
		||||
        getCacheFolderPath: (projectDir) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
            const yarnVersion = yield (0, exports.getCommandOutputNotEmpty)(`yarn --version`, 'Could not retrieve version of yarn', projectDir);
 | 
			
		||||
            core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`);
 | 
			
		||||
            const stdOut = yarnVersion.startsWith('1.')
 | 
			
		||||
                ? yield (0, exports.getCommandOutput)('yarn cache dir', projectDir)
 | 
			
		||||
                : yield (0, exports.getCommandOutput)('yarn config get cacheFolder', projectDir);
 | 
			
		||||
            if (!stdOut) {
 | 
			
		||||
                throw new Error(`Could not get yarn cache folder path for ${projectDir}`);
 | 
			
		||||
            }
 | 
			
		||||
            return stdOut;
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
const getCommandOutput = (toolCommand, cwd) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    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}`
 | 
			
		||||
            : stderr;
 | 
			
		||||
        throw new Error(stderr);
 | 
			
		||||
    }
 | 
			
		||||
    return stdout.trim();
 | 
			
		||||
});
 | 
			
		||||
exports.getCommandOutput = getCommandOutput;
 | 
			
		||||
const getCommandOutputNotEmpty = (toolCommand, error, cwd) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const stdOut = (0, exports.getCommandOutput)(toolCommand, cwd);
 | 
			
		||||
    if (!stdOut) {
 | 
			
		||||
        throw new Error(error);
 | 
			
		||||
    }
 | 
			
		||||
    return stdOut;
 | 
			
		||||
});
 | 
			
		||||
exports.getCommandOutputNotEmpty = getCommandOutputNotEmpty;
 | 
			
		||||
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    if (packageManager === 'npm') {
 | 
			
		||||
        return exports.supportedPackageManagers.npm;
 | 
			
		||||
    }
 | 
			
		||||
    else if (packageManager === 'pnpm') {
 | 
			
		||||
        return exports.supportedPackageManagers.pnpm;
 | 
			
		||||
    }
 | 
			
		||||
    else if (packageManager === 'yarn') {
 | 
			
		||||
        return exports.supportedPackageManagers.yarn;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
exports.getPackageManagerInfo = getPackageManagerInfo;
 | 
			
		||||
/**
 | 
			
		||||
 * getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
 | 
			
		||||
 *  - first through `getCacheDirectories`
 | 
			
		||||
 *  - second from `repoHasYarn3ManagedCache`
 | 
			
		||||
 *
 | 
			
		||||
 *  it contains expensive IO operation and thus should be memoized
 | 
			
		||||
 */
 | 
			
		||||
let projectDirectoriesMemoized = null;
 | 
			
		||||
/**
 | 
			
		||||
 * unit test must reset memoized variables
 | 
			
		||||
 */
 | 
			
		||||
const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
 | 
			
		||||
exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
 | 
			
		||||
/**
 | 
			
		||||
 * Expands (converts) the string input `cache-dependency-path` to list of directories that
 | 
			
		||||
 * may be project roots
 | 
			
		||||
 * @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 directories and possible
 | 
			
		||||
 */
 | 
			
		||||
const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    if (projectDirectoriesMemoized !== null) {
 | 
			
		||||
        return projectDirectoriesMemoized;
 | 
			
		||||
    }
 | 
			
		||||
    const globber = yield glob.create(cacheDependencyPath);
 | 
			
		||||
    const cacheDependenciesPaths = yield globber.glob();
 | 
			
		||||
    const existingDirectories = cacheDependenciesPaths
 | 
			
		||||
        .map(path_1.default.dirname)
 | 
			
		||||
        .filter((0, util_1.unique)())
 | 
			
		||||
        .map(dirName => fs_1.default.realpathSync(dirName))
 | 
			
		||||
        .filter(directory => fs_1.default.lstatSync(directory).isDirectory());
 | 
			
		||||
    if (!existingDirectories.length)
 | 
			
		||||
        core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
 | 
			
		||||
    projectDirectoriesMemoized = existingDirectories;
 | 
			
		||||
    return existingDirectories;
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * 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
 | 
			
		||||
 * @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
 | 
			
		||||
 */
 | 
			
		||||
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const projectDirectories = yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
 | 
			
		||||
    const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
        const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
 | 
			
		||||
        core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
 | 
			
		||||
        return cacheFolderPath;
 | 
			
		||||
    })));
 | 
			
		||||
    // uniq in order to do not cache the same directories twice
 | 
			
		||||
    return cacheFoldersPaths.filter((0, util_1.unique)());
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * Finds the cache directories configured for the repo ignoring cache-dependency-path
 | 
			
		||||
 * @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
 | 
			
		||||
 * @return list of files on which the cache depends
 | 
			
		||||
 */
 | 
			
		||||
const getCacheDirectoriesForRootProject = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath();
 | 
			
		||||
    core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the root directory`);
 | 
			
		||||
    return [cacheFolderPath];
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * A function to find the cache directories configured for the repo
 | 
			
		||||
 * currently it handles only the case of PM=yarn && cacheDependencyPath is not empty
 | 
			
		||||
 * @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')`
 | 
			
		||||
 * @return list of files on which the cache depends
 | 
			
		||||
 */
 | 
			
		||||
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
 | 
			
		||||
    // folder satisfied by cacheDependencyPath https://github.com/actions/setup-node/issues/488
 | 
			
		||||
    if (packageManagerInfo.name === 'yarn' && cacheDependencyPath) {
 | 
			
		||||
        return getCacheDirectoriesFromCacheDependencyPath(packageManagerInfo, cacheDependencyPath);
 | 
			
		||||
    }
 | 
			
		||||
    return getCacheDirectoriesForRootProject(packageManagerInfo);
 | 
			
		||||
});
 | 
			
		||||
exports.getCacheDirectories = getCacheDirectories;
 | 
			
		||||
/**
 | 
			
		||||
 * A function to check if the directory is a yarn project configured to manage
 | 
			
		||||
 * obsolete dependencies in the local cache
 | 
			
		||||
 * @param directory - a path to the folder
 | 
			
		||||
 * @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
 | 
			
		||||
 *  - global cache is not managed by yarn @see https://yarnpkg.com/features/offline-cache, return false
 | 
			
		||||
 *  - if local cache is not explicitly enabled (not yarn3), return false
 | 
			
		||||
 *  - return true otherwise
 | 
			
		||||
 */
 | 
			
		||||
const projectHasYarnBerryManagedDependencies = (directory) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    const workDir = directory || process.env.GITHUB_WORKSPACE || '.';
 | 
			
		||||
    core.debug(`check if "${workDir}" has locally managed yarn3 dependencies`);
 | 
			
		||||
    // if .yarn/cache directory exists the cache is managed by version control system
 | 
			
		||||
    const yarnCacheFile = path_1.default.join(workDir, '.yarn', 'cache');
 | 
			
		||||
    if (fs_1.default.existsSync(yarnCacheFile) &&
 | 
			
		||||
        fs_1.default.lstatSync(yarnCacheFile).isDirectory()) {
 | 
			
		||||
        core.debug(`"${workDir}" has .yarn/cache - dependencies are kept in the repository`);
 | 
			
		||||
        return Promise.resolve(false);
 | 
			
		||||
    }
 | 
			
		||||
    // NOTE: yarn1 returns 'undefined' with return code = 0
 | 
			
		||||
    const enableGlobalCache = yield (0, exports.getCommandOutput)('yarn config get enableGlobalCache', workDir);
 | 
			
		||||
    // only local cache is not managed by yarn
 | 
			
		||||
    const managed = enableGlobalCache.includes('false');
 | 
			
		||||
    if (managed) {
 | 
			
		||||
        core.debug(`"${workDir}" dependencies are managed by yarn 3 locally`);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`);
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
/**
 | 
			
		||||
 * A function to report the repo contains Yarn managed projects
 | 
			
		||||
 * @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
 | 
			
		||||
 */
 | 
			
		||||
const repoHasYarnBerryManagedDependencies = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
 | 
			
		||||
    if (packageManagerInfo.name !== 'yarn')
 | 
			
		||||
        return false;
 | 
			
		||||
    const yarnDirs = cacheDependencyPath
 | 
			
		||||
        ? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
 | 
			
		||||
        : [''];
 | 
			
		||||
    const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
 | 
			
		||||
    return isManagedList.every(Boolean);
 | 
			
		||||
});
 | 
			
		||||
exports.repoHasYarnBerryManagedDependencies = repoHasYarnBerryManagedDependencies;
 | 
			
		||||
function isGhes() {
 | 
			
		||||
    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
 | 
			
		||||
    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isCacheFeatureAvailable() {
 | 
			
		||||
    if (cache.isFeatureAvailable())
 | 
			
		||||
        return true;
 | 
			
		||||
    if (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.');
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    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) => {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.Outputs = exports.State = exports.LockType = void 0;
 | 
			
		||||
var LockType;
 | 
			
		||||
(function (LockType) {
 | 
			
		||||
    LockType["Npm"] = "npm";
 | 
			
		||||
    LockType["Pnpm"] = "pnpm";
 | 
			
		||||
    LockType["Yarn"] = "yarn";
 | 
			
		||||
})(LockType = exports.LockType || (exports.LockType = {}));
 | 
			
		||||
var State;
 | 
			
		||||
(function (State) {
 | 
			
		||||
    State["CachePackageManager"] = "SETUP_NODE_CACHE_PACKAGE_MANAGER";
 | 
			
		||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
			
		||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
			
		||||
    State["CachePaths"] = "CACHE_PATHS";
 | 
			
		||||
})(State = exports.State || (exports.State = {}));
 | 
			
		||||
var Outputs;
 | 
			
		||||
(function (Outputs) {
 | 
			
		||||
    Outputs["CacheHit"] = "cache-hit";
 | 
			
		||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.Outputs = exports.State = exports.LockType = void 0;
 | 
			
		||||
var LockType;
 | 
			
		||||
(function (LockType) {
 | 
			
		||||
    LockType["Npm"] = "npm";
 | 
			
		||||
    LockType["Pnpm"] = "pnpm";
 | 
			
		||||
    LockType["Yarn"] = "yarn";
 | 
			
		||||
})(LockType = exports.LockType || (exports.LockType = {}));
 | 
			
		||||
var State;
 | 
			
		||||
(function (State) {
 | 
			
		||||
    State["CachePackageManager"] = "SETUP_NODE_CACHE_PACKAGE_MANAGER";
 | 
			
		||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
			
		||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
			
		||||
    State["CachePaths"] = "CACHE_PATHS";
 | 
			
		||||
})(State = exports.State || (exports.State = {}));
 | 
			
		||||
var Outputs;
 | 
			
		||||
(function (Outputs) {
 | 
			
		||||
    Outputs["CacheHit"] = "cache-hit";
 | 
			
		||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
@@ -60704,108 +60712,112 @@ var Outputs;
 | 
			
		||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(2186));
 | 
			
		||||
const exec = __importStar(__nccwpck_require__(1514));
 | 
			
		||||
function parseNodeVersionFile(contents) {
 | 
			
		||||
    var _a, _b, _c;
 | 
			
		||||
    let nodeVersion;
 | 
			
		||||
    // Try parsing the file as an NPM `package.json` file.
 | 
			
		||||
    try {
 | 
			
		||||
        nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
 | 
			
		||||
        if (!nodeVersion)
 | 
			
		||||
            nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
 | 
			
		||||
    }
 | 
			
		||||
    catch (_d) {
 | 
			
		||||
        core.info('Node version file is not JSON file');
 | 
			
		||||
    }
 | 
			
		||||
    if (!nodeVersion) {
 | 
			
		||||
        const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
 | 
			
		||||
        nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
 | 
			
		||||
    }
 | 
			
		||||
    // In the case of an unknown format,
 | 
			
		||||
    // return as is and evaluate the version separately.
 | 
			
		||||
    if (!nodeVersion)
 | 
			
		||||
        nodeVersion = contents.trim();
 | 
			
		||||
    return nodeVersion;
 | 
			
		||||
}
 | 
			
		||||
exports.parseNodeVersionFile = parseNodeVersionFile;
 | 
			
		||||
function printEnvDetailsAndSetOutput() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        core.startGroup('Environment details');
 | 
			
		||||
        const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
            const output = yield getToolVersion(tool, ['--version']);
 | 
			
		||||
            return { tool, output };
 | 
			
		||||
        }));
 | 
			
		||||
        const tools = yield Promise.all(promises);
 | 
			
		||||
        tools.forEach(({ tool, output }) => {
 | 
			
		||||
            if (tool === 'node') {
 | 
			
		||||
                core.setOutput(`${tool}-version`, output);
 | 
			
		||||
            }
 | 
			
		||||
            core.info(`${tool}: ${output}`);
 | 
			
		||||
        });
 | 
			
		||||
        core.endGroup();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput;
 | 
			
		||||
function getToolVersion(tool, options) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            const { stdout, stderr, exitCode } = yield exec.getExecOutput(tool, options, {
 | 
			
		||||
                ignoreReturnCode: true,
 | 
			
		||||
                silent: true
 | 
			
		||||
            });
 | 
			
		||||
            if (exitCode > 0) {
 | 
			
		||||
                core.info(`[warning]${stderr}`);
 | 
			
		||||
                return '';
 | 
			
		||||
            }
 | 
			
		||||
            return stdout.trim();
 | 
			
		||||
        }
 | 
			
		||||
        catch (err) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
const unique = () => {
 | 
			
		||||
    const encountered = new Set();
 | 
			
		||||
    return (value) => {
 | 
			
		||||
        if (encountered.has(value))
 | 
			
		||||
            return false;
 | 
			
		||||
        encountered.add(value);
 | 
			
		||||
        return true;
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
exports.unique = unique;
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
			
		||||
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
			
		||||
      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(o, k2, desc);
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(2186));
 | 
			
		||||
const exec = __importStar(__nccwpck_require__(1514));
 | 
			
		||||
function parseNodeVersionFile(contents) {
 | 
			
		||||
    var _a, _b, _c;
 | 
			
		||||
    let nodeVersion;
 | 
			
		||||
    // Try parsing the file as an NPM `package.json` file.
 | 
			
		||||
    try {
 | 
			
		||||
        nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
 | 
			
		||||
        if (!nodeVersion)
 | 
			
		||||
            nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
 | 
			
		||||
    }
 | 
			
		||||
    catch (_d) {
 | 
			
		||||
        core.info('Node version file is not JSON file');
 | 
			
		||||
    }
 | 
			
		||||
    if (!nodeVersion) {
 | 
			
		||||
        const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
 | 
			
		||||
        nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
 | 
			
		||||
    }
 | 
			
		||||
    // In the case of an unknown format,
 | 
			
		||||
    // return as is and evaluate the version separately.
 | 
			
		||||
    if (!nodeVersion)
 | 
			
		||||
        nodeVersion = contents.trim();
 | 
			
		||||
    return nodeVersion;
 | 
			
		||||
}
 | 
			
		||||
exports.parseNodeVersionFile = parseNodeVersionFile;
 | 
			
		||||
function printEnvDetailsAndSetOutput() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        core.startGroup('Environment details');
 | 
			
		||||
        const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
            const output = yield getToolVersion(tool, ['--version']);
 | 
			
		||||
            return { tool, output };
 | 
			
		||||
        }));
 | 
			
		||||
        const tools = yield Promise.all(promises);
 | 
			
		||||
        tools.forEach(({ tool, output }) => {
 | 
			
		||||
            if (tool === 'node') {
 | 
			
		||||
                core.setOutput(`${tool}-version`, output);
 | 
			
		||||
            }
 | 
			
		||||
            core.info(`${tool}: ${output}`);
 | 
			
		||||
        });
 | 
			
		||||
        core.endGroup();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput;
 | 
			
		||||
function getToolVersion(tool, options) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            const { stdout, stderr, exitCode } = yield exec.getExecOutput(tool, options, {
 | 
			
		||||
                ignoreReturnCode: true,
 | 
			
		||||
                silent: true
 | 
			
		||||
            });
 | 
			
		||||
            if (exitCode > 0) {
 | 
			
		||||
                core.info(`[warning]${stderr}`);
 | 
			
		||||
                return '';
 | 
			
		||||
            }
 | 
			
		||||
            return stdout.trim();
 | 
			
		||||
        }
 | 
			
		||||
        catch (err) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
const unique = () => {
 | 
			
		||||
    const encountered = new Set();
 | 
			
		||||
    return (value) => {
 | 
			
		||||
        if (encountered.has(value))
 | 
			
		||||
            return false;
 | 
			
		||||
        encountered.add(value);
 | 
			
		||||
        return true;
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
exports.unique = unique;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3646
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3646
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										5406
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5406
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							@@ -37,22 +37,22 @@
 | 
			
		||||
    "uuid": "^9.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/jest": "^27.0.2",
 | 
			
		||||
    "@types/jest": "^29.5.6",
 | 
			
		||||
    "@types/node": "^16.11.25",
 | 
			
		||||
    "@types/semver": "^6.0.0",
 | 
			
		||||
    "@types/uuid": "^9.0.3",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^5.54.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^5.54.0",
 | 
			
		||||
    "@vercel/ncc": "^0.33.4",
 | 
			
		||||
    "@vercel/ncc": "^0.38.0",
 | 
			
		||||
    "eslint": "^8.35.0",
 | 
			
		||||
    "eslint-config-prettier": "^8.6.0",
 | 
			
		||||
    "eslint-plugin-jest": "^27.2.1",
 | 
			
		||||
    "eslint-plugin-node": "^11.1.0",
 | 
			
		||||
    "jest": "^27.2.5",
 | 
			
		||||
    "jest-circus": "^27.2.5",
 | 
			
		||||
    "jest-each": "^27.2.5",
 | 
			
		||||
    "jest": "^29.7.0",
 | 
			
		||||
    "jest-circus": "^29.7.0",
 | 
			
		||||
    "jest-each": "^29.7.0",
 | 
			
		||||
    "prettier": "^2.8.4",
 | 
			
		||||
    "ts-jest": "^27.0.5",
 | 
			
		||||
    "ts-jest": "^29.1.1",
 | 
			
		||||
    "typescript": "^4.2.3"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ export async function run() {
 | 
			
		||||
    const cacheLock = core.getState(State.CachePackageManager);
 | 
			
		||||
    await cachePackages(cacheLock);
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    core.setFailed(error.message);
 | 
			
		||||
    core.setFailed((error as Error).message);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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`
 | 
			
		||||
          );
 | 
			
		||||
        } 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');
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@@ -214,7 +214,7 @@ export default class OfficialBuilds extends BaseDistribution {
 | 
			
		||||
      return info?.resolvedVersion;
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
      core.info('Unable to resolve version from manifest...');
 | 
			
		||||
      core.debug(err.message);
 | 
			
		||||
      core.debug((err as Error).message);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ export async function run() {
 | 
			
		||||
      `##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
 | 
			
		||||
    );
 | 
			
		||||
  } catch (err) {
 | 
			
		||||
    core.setFailed(err.message);
 | 
			
		||||
    core.setFailed((err as Error).message);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user