Files
hyperframes/packages/engine/src/services/chromeHostCeiling.ts
T
Miguel Ángel 0cde884330 fix(cli): macOS 12 users get Chrome 150 automatically and can render (#4185)
* fix(cli): pick a macOS 12 capable Chrome on macOS 12 instead of the pinned build

* test(engine): stop building subprocess eval scripts from strings
2026-09-19 18:08:29 -04:00

21 lines
904 B
TypeScript

import { release } from "node:os";
/** Chrome 151 dropped macOS 12 and older (Darwin < 22); 150 is the last major that launches there. */
const MACOS_12_LAST_CHROME_MAJOR = 150;
/** Newest Chrome major this host can run, or undefined when it has no ceiling. */
export function chromeMajorCeiling(
hostPlatform: string = process.platform,
hostRelease: string = release(),
): number | undefined {
if (hostPlatform !== "darwin") return undefined;
return Number.parseInt(hostRelease, 10) < 22 ? MACOS_12_LAST_CHROME_MAJOR : undefined;
}
/** True when a cache dir name (`mac-152.0.1.2`) or build id (`152.0.1.2`) is newer than the ceiling. */
export function exceedsChromeCeiling(versionName: string, ceiling: number | undefined): boolean {
if (ceiling === undefined) return false;
const major = Number.parseInt(versionName.slice(versionName.indexOf("-") + 1), 10);
return major > ceiling;
}