Run 'npm run build'

This commit is contained in:
mannie.exe 2022-05-06 09:31:23 -07:00 committed by Manpreet Singh
parent 7d279e1d70
commit 57edf6c8ba
2 changed files with 33 additions and 21 deletions

24
dist/setup/index.js vendored
View file

@ -71768,15 +71768,25 @@ function translateArchToDistUrl(arch) {
}
}
function parseNodeVersionFile(contents) {
var _a;
var _a, _b;
let nodeVersion;
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
const nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version;
if (nodeVersion) {
return nodeVersion;
nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version;
if (!nodeVersion) {
try {
// Try parsing the file as an NPM `package.json`
// file.
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
if (!nodeVersion)
throw new Error();
}
catch (err) {
// In the case of an unknown format,
// return as is and evaluate the version separately.
nodeVersion = contents.trim();
}
}
// In the case of an unknown format,
// return as is and evaluate the version separately.
return contents.trim();
return nodeVersion;
}
exports.parseNodeVersionFile = parseNodeVersionFile;
function isLatestSyntax(versionSpec) {

View file

@ -495,24 +495,26 @@ function translateArchToDistUrl(arch: string): string {
}
export function parseNodeVersionFile(contents: string): string {
// In the case of an unknown format,
// return as is and evaluate the version separately.
let nodeVersion = contents.trim();
let nodeVersion: string | undefined;
try {
// Assume all content parseable as JSON is a valid,
// NPM `package.json` file
const packageJson = JSON.parse(contents);
nodeVersion = packageJson.engines.node || nodeVersion;
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version;
if (!nodeVersion) throw
} catch (err) {
// If not, assume it is a node version file
const found = nodeVersion.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version || nodeVersion;
if (!nodeVersion) {
try {
// Try parsing the file as an NPM `package.json`
// file.
nodeVersion = JSON.parse(contents).engines?.node;
if (!nodeVersion) throw new Error();
} catch (err) {
// In the case of an unknown format,
// return as is and evaluate the version separately.
nodeVersion = contents.trim();
}
}
return nodeVersion;
return nodeVersion as string;
}
function isLatestSyntax(versionSpec): boolean {