Lines 1-36javascript
1// Screen Map — chrome: tiered, find-first, never-bundle browser strategy (PRD §6).
3// 1. Fast path — find a system Chrome/Chromium/Edge/Brave (env → known install
4// locations per-OS → `which`). Zero-dep, raw filesystem probing.
5// 2. Miss → print the exact missing thing + fix, then OPTIONALLY download-on-demand
6// via @puppeteer/browsers into ~/.cache/screen-map/, on first run, with a
7// visible progress bar — NEVER a hidden postinstall (Locked #5).
8// 3. Never bundle Chromium — version drift is irrelevant for screenshots, and a
9// bundle blows the Open VSX 256 MB cap.
11// The @puppeteer/browsers dependency is OPTIONAL and lazy-imported only for the
12// download fallback, so the common (system-Chrome) case stays truly zero-dep.
14import fs from "node:fs";
15import os from "node:os";
16import path from "node:path";
17import { execFileSync } from "node:child_process";
18
HighChild Process
Package source references child process execution.
src/chrome.mjsView on unpkg · L16 19export const CACHE_DIR = path.join(os.homedir(), ".cache", "screen-map");
21/** Known Chrome-family install locations by platform. */
22function knownPaths() {
23 const plt = process.platform;
24 if (plt === "darwin") {
26 "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
27 "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
28 "/Applications/Chromium.app/Contents/MacOS/Chromium",
29 "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
30 "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
31 "/Applications/Arc.app/Contents/MacOS/Arc",
34 if (plt === "win32") {
35 const pf = process.env["PROGRAMFILES"] || "C:\\Program Files";
36 const pf86 = process.env["PROGRAMFILES(X86)"] || "C:\\Program Files (x86)";
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
src/chrome.mjsView on unpkg · L16