stitch2 0.22.0 → 0.22.1
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/dist/check.js +10 -3
- package/dist/report.js +10 -3
- package/package.json +1 -1
package/dist/check.js
CHANGED
|
@@ -47,12 +47,19 @@ const auditOpts = { comfortable: config.comfortableTarget, durations: (() => { t
|
|
|
47
47
|
const server = await startServer(0);
|
|
48
48
|
/** The tallest render, in CSS px: a long landing page is shot whole (the canvas draws frames up to the same height). */
|
|
49
49
|
const MAX_RENDER_HEIGHT = 20000;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let browser = await chromium.launch();
|
|
51
|
+
let page = await browser.newPage({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2 });
|
|
52
52
|
const results = {};
|
|
53
53
|
const components = {};
|
|
54
54
|
const stateRows = {};
|
|
55
|
-
for (const s of screens) {
|
|
55
|
+
for (const [i, s] of screens.entries()) {
|
|
56
|
+
if (i > 0 && i % 50 === 0) {
|
|
57
|
+
// Chromium gets fragile after hundreds of page loads in one browser; a fresh one keeps long runs alive.
|
|
58
|
+
await page.close().catch(() => { });
|
|
59
|
+
await browser.close().catch(() => { });
|
|
60
|
+
browser = await chromium.launch();
|
|
61
|
+
page = await browser.newPage({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2 });
|
|
62
|
+
}
|
|
56
63
|
await page.setViewportSize({ width: s.width, height: 844 });
|
|
57
64
|
await page
|
|
58
65
|
.goto(`http://127.0.0.1:${server.port}/${s.path}`, { waitUntil: 'networkidle', timeout: 30_000 })
|
package/dist/report.js
CHANGED
|
@@ -22,11 +22,18 @@ const esc = (s) => String(s ?? '')
|
|
|
22
22
|
.replaceAll('>', '>')
|
|
23
23
|
.replaceAll('"', '"');
|
|
24
24
|
const server = await startServer(0);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let browser = await chromium.launch();
|
|
26
|
+
let page = await browser.newPage({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2 });
|
|
27
27
|
const known = {};
|
|
28
28
|
const crops = {}; // kind -> path -> image files
|
|
29
|
-
for (const s of screens) {
|
|
29
|
+
for (const [i, s] of screens.entries()) {
|
|
30
|
+
if (i > 0 && i % 50 === 0) {
|
|
31
|
+
// Chromium gets fragile after hundreds of page loads in one browser; a fresh one keeps long runs alive.
|
|
32
|
+
await page.close().catch(() => { });
|
|
33
|
+
await browser.close().catch(() => { });
|
|
34
|
+
browser = await chromium.launch();
|
|
35
|
+
page = await browser.newPage({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2 });
|
|
36
|
+
}
|
|
30
37
|
await page.setViewportSize({ width: s.width, height: 844 });
|
|
31
38
|
await page
|
|
32
39
|
.goto(`http://127.0.0.1:${server.port}/${s.path}`, { waitUntil: 'networkidle', timeout: 30_000 })
|
package/package.json
CHANGED