@zaisma/cli 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chrome.mjs +4 -3
- package/package.json +1 -1
package/chrome.mjs
CHANGED
|
@@ -50,17 +50,18 @@ function playwrightChromes() {
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Headless Chrome at path with WebGL in software (SwiftShader, as on Zaisma's check and on machines without a GPU), or on the machine's
|
|
53
|
-
* own GPU with isGpu (scripts/city.mjs times and renders the city on it), and
|
|
53
|
+
* own GPU with isGpu (scripts/city.mjs times and renders the city on it), or with no GPU and no WebGL at all with isDrawingOnCpu (the
|
|
54
|
+
* layout check measures boxes, not pixels), and a DevTools connection to it: send(method, parameters,
|
|
54
55
|
* sessionId), listen(sessionId, onEvent) and close().
|
|
55
56
|
*/
|
|
56
|
-
export async function openChrome(path, profilePrefix, { isGpu = false } = {}) {
|
|
57
|
+
export async function openChrome(path, profilePrefix, { isGpu = false, isDrawingOnCpu = false } = {}) {
|
|
57
58
|
await sweepOrphans();
|
|
58
59
|
// A folder for each Chrome: OWNER_FILE, which says whose it is, and Chrome's profile inside, removed before the folder so a profile
|
|
59
60
|
// that can't be removed yet keeps its owner for the next sweep.
|
|
60
61
|
const folder = mkdtempSync(join(tmpdir(), profilePrefix));
|
|
61
62
|
const profile = join(folder, "profile");
|
|
62
63
|
mkdirSync(profile);
|
|
63
|
-
const webgl = isGpu ? ["--enable-gpu", "--ignore-gpu-blocklist", ...(process.platform === "darwin" ? ["--use-angle=metal"] : [])] : ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"];
|
|
64
|
+
const webgl = isDrawingOnCpu ? ["--disable-gpu"] : isGpu ? ["--enable-gpu", "--ignore-gpu-blocklist", ...(process.platform === "darwin" ? ["--use-angle=metal"] : [])] : ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"];
|
|
64
65
|
let child;
|
|
65
66
|
try {
|
|
66
67
|
child = spawn(path, ["--headless=new", "--remote-debugging-port=0", `--user-data-dir=${profile}`, "--no-first-run", "--no-default-browser-check", ...webgl, "--autoplay-policy=no-user-gesture-required", "--hide-scrollbars", "--disable-renderer-backgrounding", "--disable-background-timer-throttling", "--disable-backgrounding-occluded-windows", "about:blank"], { stdio: ["ignore", "ignore", "pipe"] });
|