fix
This commit is contained in:
parent
1bd97816d2
commit
5bd333e498
@ -1,6 +1,6 @@
|
|||||||
import { compareVersions, satisfies, validate } from "compare-versions";
|
import { compareVersions, satisfies, validate } from "compare-versions";
|
||||||
import { Input } from "./action";
|
import { Input } from "./action";
|
||||||
import { getArchitecture, getPlatform, request } from "./utils";
|
import { getArchitecture, getAvx2, getPlatform, request } from "./utils";
|
||||||
|
|
||||||
export async function getDownloadUrl(options: Input): Promise<string> {
|
export async function getDownloadUrl(options: Input): Promise<string> {
|
||||||
const { customUrl } = options;
|
const { customUrl } = options;
|
||||||
@ -50,8 +50,14 @@ async function getSemverDownloadUrl(options: Input): Promise<string> {
|
|||||||
|
|
||||||
const eversion = encodeURIComponent(tag ?? version);
|
const eversion = encodeURIComponent(tag ?? version);
|
||||||
const eos = encodeURIComponent(os ?? getPlatform());
|
const eos = encodeURIComponent(os ?? getPlatform());
|
||||||
const earch = encodeURIComponent(arch ?? getArchitecture());
|
const earch = encodeURIComponent(
|
||||||
const eavx2 = encodeURIComponent(avx2 === false ? "-baseline" : "");
|
arch ?? getArchitecture(os ?? process.platform, arch ?? process.arch),
|
||||||
|
);
|
||||||
|
const eavx2 = encodeURIComponent(
|
||||||
|
getAvx2(os ?? process.platform, arch ?? process.arch, avx2) === false
|
||||||
|
? "-baseline"
|
||||||
|
: "",
|
||||||
|
);
|
||||||
const eprofile = encodeURIComponent(profile === true ? "-profile" : "");
|
const eprofile = encodeURIComponent(profile === true ? "-profile" : "");
|
||||||
|
|
||||||
const { href } = new URL(
|
const { href } = new URL(
|
||||||
|
|||||||
26
src/utils.ts
26
src/utils.ts
@ -42,13 +42,33 @@ export function getPlatform(): string {
|
|||||||
return platform;
|
return platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getArchitecture(): string {
|
export function getArchitecture(os: string, arch: string): string {
|
||||||
const arch = process.arch;
|
if (os == "windows" && arch === "arm64") {
|
||||||
if (arch === "arm64") return "aarch64";
|
warning(
|
||||||
|
[
|
||||||
|
"⚠️ Bun does not provide native arm64 builds for Windows.",
|
||||||
|
"Using x64-baseline build which will run through Microsoft's x64 emulation layer.",
|
||||||
|
"This may result in reduced performance and potential compatibility issues.",
|
||||||
|
"💡 For best performance, consider using x64 Windows runners or other platforms with native support.",
|
||||||
|
].join("\n"),
|
||||||
|
);
|
||||||
|
|
||||||
|
return "x64";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arch === "arm64") return "aarch64";
|
||||||
return arch;
|
return arch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAvx2(os: string, arch: string, avx2?: boolean): boolean {
|
||||||
|
// Temporary workaround for absence of arm64 builds on Windows (#130)
|
||||||
|
if (os === "win32" && (arch === "aarch64" || arch === "arm64")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return avx2 ?? true;
|
||||||
|
}
|
||||||
|
|
||||||
const FILE_VERSION_READERS = {
|
const FILE_VERSION_READERS = {
|
||||||
"package.json": (content: string) => {
|
"package.json": (content: string) => {
|
||||||
const pkg = JSON.parse(content);
|
const pkg = JSON.parse(content);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user