@@ -60441,6 +60441,7 @@ const cache = __importStar(__nccwpck_require__(7799));
60441
60441
const glob = __importStar(__nccwpck_require__(8090));
60442
60442
const path_1 = __importDefault(__nccwpck_require__(1017));
60443
60443
const fs_1 = __importDefault(__nccwpck_require__(7147));
60444
+ const util_1 = __nccwpck_require__(2629);
60444
60445
exports.supportedPackageManagers = {
60445
60446
npm: {
60446
60447
name: 'npm',
@@ -60528,9 +60529,10 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
60528
60529
}
60529
60530
const existingDirectories = cacheDependenciesPaths
60530
60531
.map(path_1.default.dirname)
60531
- // uniq in order to do not traverse the same directories during the further processing
60532
- .filter((item, i, src) => item != null && src.indexOf(item) === i)
60533
- .filter(directory => fs_1.default.existsSync(directory) && fs_1.default.lstatSync(directory).isDirectory());
60532
+ .filter(path => path != null)
60533
+ .filter(util_1.unique())
60534
+ .filter(fs_1.default.existsSync)
60535
+ .filter(directory => fs_1.default.lstatSync(directory).isDirectory());
60534
60536
// if user explicitly pointed out some file, but it does not exist it is definitely
60535
60537
// not he wanted, thus we should throw an error not trying to workaround with unexpected
60536
60538
// result to the whole build
@@ -60554,7 +60556,7 @@ const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDep
60554
60556
return cacheFolderPath;
60555
60557
})));
60556
60558
// uniq in order to do not cache the same directories twice
60557
- return cacheFoldersPaths.filter((item, i, src) => src.indexOf(item) === i );
60559
+ return cacheFoldersPaths.filter(util_1.unique() );
60558
60560
});
60559
60561
/**
60560
60562
* Finds the cache directories configured for the repo ignoring cache-dependency-path
@@ -60627,6 +60629,116 @@ var Outputs;
60627
60629
})(Outputs = exports.Outputs || (exports.Outputs = {}));
60628
60630
60629
60631
60632
+ /***/ }),
60633
+
60634
+ /***/ 2629:
60635
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
60636
+
60637
+ "use strict";
60638
+
60639
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
60640
+ if (k2 === undefined) k2 = k;
60641
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
60642
+ }) : (function(o, m, k, k2) {
60643
+ if (k2 === undefined) k2 = k;
60644
+ o[k2] = m[k];
60645
+ }));
60646
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
60647
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
60648
+ }) : function(o, v) {
60649
+ o["default"] = v;
60650
+ });
60651
+ var __importStar = (this && this.__importStar) || function (mod) {
60652
+ if (mod && mod.__esModule) return mod;
60653
+ var result = {};
60654
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
60655
+ __setModuleDefault(result, mod);
60656
+ return result;
60657
+ };
60658
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
60659
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60660
+ return new (P || (P = Promise))(function (resolve, reject) {
60661
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
60662
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
60663
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
60664
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
60665
+ });
60666
+ };
60667
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
60668
+ exports.unique = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
60669
+ const core = __importStar(__nccwpck_require__(2186));
60670
+ const exec = __importStar(__nccwpck_require__(1514));
60671
+ function parseNodeVersionFile(contents) {
60672
+ var _a, _b, _c;
60673
+ let nodeVersion;
60674
+ // Try parsing the file as an NPM `package.json` file.
60675
+ try {
60676
+ nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
60677
+ if (!nodeVersion)
60678
+ nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
60679
+ }
60680
+ catch (_d) {
60681
+ core.info('Node version file is not JSON file');
60682
+ }
60683
+ if (!nodeVersion) {
60684
+ const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
60685
+ nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
60686
+ }
60687
+ // In the case of an unknown format,
60688
+ // return as is and evaluate the version separately.
60689
+ if (!nodeVersion)
60690
+ nodeVersion = contents.trim();
60691
+ return nodeVersion;
60692
+ }
60693
+ exports.parseNodeVersionFile = parseNodeVersionFile;
60694
+ function printEnvDetailsAndSetOutput() {
60695
+ return __awaiter(this, void 0, void 0, function* () {
60696
+ core.startGroup('Environment details');
60697
+ const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
60698
+ const output = yield getToolVersion(tool, ['--version']);
60699
+ return { tool, output };
60700
+ }));
60701
+ const tools = yield Promise.all(promises);
60702
+ tools.forEach(({ tool, output }) => {
60703
+ if (tool === 'node') {
60704
+ core.setOutput(`${tool}-version`, output);
60705
+ }
60706
+ core.info(`${tool}: ${output}`);
60707
+ });
60708
+ core.endGroup();
60709
+ });
60710
+ }
60711
+ exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput;
60712
+ function getToolVersion(tool, options) {
60713
+ return __awaiter(this, void 0, void 0, function* () {
60714
+ try {
60715
+ const { stdout, stderr, exitCode } = yield exec.getExecOutput(tool, options, {
60716
+ ignoreReturnCode: true,
60717
+ silent: true
60718
+ });
60719
+ if (exitCode > 0) {
60720
+ core.info(`[warning]${stderr}`);
60721
+ return '';
60722
+ }
60723
+ return stdout.trim();
60724
+ }
60725
+ catch (err) {
60726
+ return '';
60727
+ }
60728
+ });
60729
+ }
60730
+ const unique = () => {
60731
+ const encountered = new Set();
60732
+ return (value) => {
60733
+ if (encountered.has(value))
60734
+ return false;
60735
+ encountered.add(value);
60736
+ return true;
60737
+ };
60738
+ };
60739
+ exports.unique = unique;
60740
+
60741
+
60630
60742
/***/ }),
60631
60743
60632
60744
/***/ 2877:
0 commit comments