feat: force baseline for win32 arm fallback to x64

This commit is contained in:
Jozef Steinhübl 2025-07-10 20:42:50 +02:00
parent e006d01d6a
commit 6edb297001
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F

View file

@ -161,7 +161,7 @@ function getEffectiveArch(os: string, arch: string): string {
warning(
[
"⚠️ Bun does not provide native arm64 builds for Windows.",
"Using x64 build which will run through Microsoft's x64 emulation layer.",
"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"),
@ -173,6 +173,15 @@ function getEffectiveArch(os: string, arch: string): string {
return arch;
}
function getEffectiveAvx2(os: string, arch: string, avx2?: boolean): boolean {
// Temporary workaround for absence of arm64 builds on Windows (#130)
if (os === "win32" && arch === "arm64") {
return false;
}
return avx2 ?? true;
}
function getDownloadUrl(options: Input): string {
const { customUrl } = options;
if (customUrl) {
@ -184,7 +193,9 @@ function getDownloadUrl(options: Input): string {
const earch = encodeURIComponent(
getEffectiveArch(os ?? process.platform, arch ?? process.arch),
);
const eavx2 = encodeURIComponent(avx2 ?? true);
const eavx2 = encodeURIComponent(
getEffectiveAvx2(os ?? process.platform, arch ?? process.arch, avx2),
);
const eprofile = encodeURIComponent(profile ?? false);
const { href } = new URL(
`${eversion}/${eos}/${earch}?avx2=${eavx2}&profile=${eprofile}`,
@ -217,9 +228,6 @@ async function getRevision(exe: string): Promise<string | undefined> {
const revision = await getExecOutput(exe, ["--revision"], {
ignoreReturnCode: true,
});
console.log(revision.stdout);
console.log(revision.stderr);
console.log(revision.exitCode);
if (revision.exitCode === 0 && /^\d+\.\d+\.\d+/.test(revision.stdout)) {
return revision.stdout.trim();
}