@@ -62339,20 +62339,24 @@ const tc = __importStar(__webpack_require__(533));
62339
62339
const path = __importStar(__webpack_require__(622));
62340
62340
const semver = __importStar(__webpack_require__(280));
62341
62341
const fs = __webpack_require__(747);
62342
- const installer = __importStar(__webpack_require__(923));
62343
62342
function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
62344
62343
return __awaiter(this, void 0, void 0, function* () {
62345
62344
// Store manifest data to avoid multiple calls
62346
62345
let manifest;
62346
+ let distManifest;
62347
62347
let osPlat = os.platform();
62348
62348
let osArch = translateArchToDistUrl(arch);
62349
- let latestVersionResolved = false;
62350
62349
if (isLtsAlias(versionSpec)) {
62351
62350
core.info('Attempt to resolve LTS alias from manifest...');
62352
62351
// No try-catch since it's not possible to resolve LTS alias without manifest
62353
62352
manifest = yield getManifest(auth);
62354
62353
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
62355
62354
}
62355
+ if (isLatestSyntax(versionSpec)) {
62356
+ distManifest = yield getVersionsFromDist();
62357
+ versionSpec = yield queryDistForMatch(versionSpec, arch, distManifest);
62358
+ core.info(`getting latest node version...`);
62359
+ }
62356
62360
if (checkLatest) {
62357
62361
core.info('Attempt to resolve the latest version from manifest...');
62358
62362
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth, osArch, manifest);
@@ -62364,11 +62368,6 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
62364
62368
core.info(`Failed to resolve version ${versionSpec} from manifest`);
62365
62369
}
62366
62370
}
62367
- if (isLatestSyntax(versionSpec)) {
62368
- versionSpec = yield queryDistForMatch(versionSpec, arch);
62369
- latestVersionResolved = true;
62370
- core.info(`getting latest node version...`);
62371
- }
62372
62371
// check cache
62373
62372
let toolPath;
62374
62373
toolPath = tc.find('node', versionSpec, osArch);
@@ -62409,7 +62408,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
62409
62408
// Download from nodejs.org
62410
62409
//
62411
62410
if (!downloadPath) {
62412
- info = yield getInfoFromDist(versionSpec, arch, latestVersionResolved );
62411
+ info = yield getInfoFromDist(versionSpec, arch, distManifest );
62413
62412
if (!info) {
62414
62413
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
62415
62414
}
@@ -62509,13 +62508,11 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
62509
62508
return info;
62510
62509
});
62511
62510
}
62512
- function getInfoFromDist(versionSpec, arch = os.arch(), latestVersionResolved ) {
62511
+ function getInfoFromDist(versionSpec, arch = os.arch(), distManifest ) {
62513
62512
return __awaiter(this, void 0, void 0, function* () {
62514
62513
let osPlat = os.platform();
62515
62514
let osArch = translateArchToDistUrl(arch);
62516
- let version = latestVersionResolved
62517
- ? versionSpec
62518
- : yield queryDistForMatch(versionSpec, arch);
62515
+ let version = yield queryDistForMatch(versionSpec, arch, distManifest);
62519
62516
if (!version) {
62520
62517
return null;
62521
62518
}
@@ -62574,7 +62571,7 @@ function evaluateVersions(versions, versionSpec) {
62574
62571
}
62575
62572
return version;
62576
62573
}
62577
- function queryDistForMatch(versionSpec, arch = os.arch()) {
62574
+ function queryDistForMatch(versionSpec, arch = os.arch(), distManifest ) {
62578
62575
return __awaiter(this, void 0, void 0, function* () {
62579
62576
let osPlat = os.platform();
62580
62577
let osArch = translateArchToDistUrl(arch);
@@ -62593,13 +62590,16 @@ function queryDistForMatch(versionSpec, arch = os.arch()) {
62593
62590
default:
62594
62591
throw new Error(`Unexpected OS '${osPlat}'`);
62595
62592
}
62593
+ if (!distManifest) {
62594
+ core.debug('No dist manifest cached');
62595
+ distManifest = yield getVersionsFromDist();
62596
+ }
62596
62597
let versions = [];
62597
- let nodeVersions = yield installer.getVersionsFromDist();
62598
62598
if (isLatestSyntax(versionSpec)) {
62599
62599
core.info(`getting latest node version...`);
62600
- return nodeVersions [0].version;
62600
+ return distManifest [0].version;
62601
62601
}
62602
- nodeVersions .forEach((nodeVersion) => {
62602
+ distManifest .forEach((nodeVersion) => {
62603
62603
// ensure this version supports your os and platform
62604
62604
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
62605
62605
versions.push(nodeVersion.version);
0 commit comments