@decocms/parity 0.33.33 → 0.33.34
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/cli.js +7 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -62694,12 +62694,12 @@ import { writeFile } from "node:fs/promises";
|
|
|
62694
62694
|
|
|
62695
62695
|
// src/engine/capture-utils.ts
|
|
62696
62696
|
import { PNG as PNG3 } from "pngjs";
|
|
62697
|
-
function cropPngBuffer(srcBuffer, box) {
|
|
62697
|
+
function cropPngBuffer(srcBuffer, box, scale = 1) {
|
|
62698
62698
|
const src = PNG3.sync.read(srcBuffer);
|
|
62699
|
-
const x = Math.max(0, Math.floor(box.x));
|
|
62700
|
-
const y = Math.max(0, Math.floor(box.y));
|
|
62701
|
-
const w = Math.max(0, Math.min(Math.ceil(box.width), src.width - x));
|
|
62702
|
-
const h = Math.max(0, Math.min(Math.ceil(box.height), src.height - y));
|
|
62699
|
+
const x = Math.max(0, Math.floor(box.x * scale));
|
|
62700
|
+
const y = Math.max(0, Math.floor(box.y * scale));
|
|
62701
|
+
const w = Math.max(0, Math.min(Math.ceil(box.width * scale), src.width - x));
|
|
62702
|
+
const h = Math.max(0, Math.min(Math.ceil(box.height * scale), src.height - y));
|
|
62703
62703
|
if (w === 0 || h === 0) {
|
|
62704
62704
|
throw new Error(`cropPngBuffer: bounding box has zero area after clamp (box=${JSON.stringify(box)} src=${src.width}x${src.height})`);
|
|
62705
62705
|
}
|
|
@@ -62917,7 +62917,8 @@ async function captureSectionScreenshot(page, selector, outPath, preCapturedFull
|
|
|
62917
62917
|
if (!box || box.width <= 0 || box.height <= 0) {
|
|
62918
62918
|
return `seletor '${selector}' não tem boundingBox visível`;
|
|
62919
62919
|
}
|
|
62920
|
-
const
|
|
62920
|
+
const dpr = await page.evaluate(() => window.devicePixelRatio).catch(() => 1);
|
|
62921
|
+
const cropped = cropPngBuffer(fullPng, box, dpr);
|
|
62921
62922
|
await writeFile(outPath, cropped);
|
|
62922
62923
|
return null;
|
|
62923
62924
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.34",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|