rebuild dist

This commit is contained in:
Dmitry Shibanov 2022-05-30 10:51:45 +02:00
parent dfb8fe134b
commit 8438b85c71

27
dist/setup/index.js vendored
View file

@ -70619,6 +70619,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// Store manifest data to avoid multiple calls // Store manifest data to avoid multiple calls
let manifest; let manifest;
let nodeVersions;
let osPlat = os.platform(); let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
if (isLtsAlias(versionSpec)) { if (isLtsAlias(versionSpec)) {
@ -70627,6 +70628,11 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
manifest = yield getManifest(auth); manifest = yield getManifest(auth);
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest); versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
} }
if (isLatestSyntax(versionSpec)) {
nodeVersions = yield getVersionsFromDist();
versionSpec = yield queryDistForMatch(versionSpec, arch, nodeVersions);
core.info(`getting latest node version...`);
}
if (checkLatest) { if (checkLatest) {
core.info('Attempt to resolve the latest version from manifest...'); core.info('Attempt to resolve the latest version from manifest...');
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth, osArch, manifest); const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth, osArch, manifest);
@ -70678,7 +70684,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
// Download from nodejs.org // Download from nodejs.org
// //
if (!downloadPath) { if (!downloadPath) {
info = yield getInfoFromDist(versionSpec, arch); info = yield getInfoFromDist(versionSpec, arch, nodeVersions);
if (!info) { if (!info) {
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`); throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
} }
@ -70778,12 +70784,11 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
return info; return info;
}); });
} }
function getInfoFromDist(versionSpec, arch = os.arch()) { function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform(); let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
let version; let version = yield queryDistForMatch(versionSpec, arch, nodeVersions);
version = yield queryDistForMatch(versionSpec, arch);
if (!version) { if (!version) {
return null; return null;
} }
@ -70842,7 +70847,7 @@ function evaluateVersions(versions, versionSpec) {
} }
return version; return version;
} }
function queryDistForMatch(versionSpec, arch = os.arch()) { function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform(); let osPlat = os.platform();
let osArch = translateArchToDistUrl(arch); let osArch = translateArchToDistUrl(arch);
@ -70861,8 +70866,15 @@ function queryDistForMatch(versionSpec, arch = os.arch()) {
default: default:
throw new Error(`Unexpected OS '${osPlat}'`); throw new Error(`Unexpected OS '${osPlat}'`);
} }
if (!nodeVersions) {
core.debug('No dist manifest cached');
nodeVersions = yield getVersionsFromDist();
}
let versions = []; let versions = [];
let nodeVersions = yield getVersionsFromDist(); if (isLatestSyntax(versionSpec)) {
core.info(`getting latest node version...`);
return nodeVersions[0].version;
}
nodeVersions.forEach((nodeVersion) => { nodeVersions.forEach((nodeVersion) => {
// ensure this version supports your os and platform // ensure this version supports your os and platform
if (nodeVersion.files.indexOf(dataFileName) >= 0) { if (nodeVersion.files.indexOf(dataFileName) >= 0) {
@ -70958,6 +70970,9 @@ function parseNodeVersionFile(contents) {
return nodeVersion; return nodeVersion;
} }
exports.parseNodeVersionFile = parseNodeVersionFile; exports.parseNodeVersionFile = parseNodeVersionFile;
function isLatestSyntax(versionSpec) {
return ['current', 'latest', 'node'].includes(versionSpec);
}
/***/ }), /***/ }),