Remove call to getManifestURL unless needed in utils.parseVersion

This commit is contained in:
Shivam Mathur 2023-01-29 21:50:51 +05:30
parent 755bbb1cc0
commit f42145a164
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 4 additions and 4 deletions

3
dist/index.js vendored
View File

@ -1072,10 +1072,9 @@ async function getManifestURL() {
} }
exports.getManifestURL = getManifestURL; exports.getManifestURL = getManifestURL;
async function parseVersion(version) { async function parseVersion(version) {
const manifest = await getManifestURL();
switch (true) { switch (true) {
case /^(latest|nightly|\d+\.x)$/.test(version): case /^(latest|nightly|\d+\.x)$/.test(version):
return JSON.parse((await fetch.fetch(manifest))['data'])[version]; return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[version];
default: default:
switch (true) { switch (true) {
case version.length > 1: case version.length > 1:

View File

@ -58,10 +58,11 @@ export async function getManifestURL(): Promise<string> {
* @param version * @param version
*/ */
export async function parseVersion(version: string): Promise<string> { export async function parseVersion(version: string): Promise<string> {
const manifest = await getManifestURL();
switch (true) { switch (true) {
case /^(latest|nightly|\d+\.x)$/.test(version): case /^(latest|nightly|\d+\.x)$/.test(version):
return JSON.parse((await fetch.fetch(manifest))['data'])[version]; return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[
version
];
default: default:
switch (true) { switch (true) {
case version.length > 1: case version.length > 1: