canicode 0.8.6 → 0.8.7
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/index.js +20 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +20 -6
- package/dist/mcp/server.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -72,12 +72,26 @@ function resizePng(png, targetWidth, targetHeight) {
|
|
|
72
72
|
function compareScreenshots(path1, path2, diffOutputPath) {
|
|
73
73
|
const raw1 = PNG.sync.read(readFileSync(path1));
|
|
74
74
|
const raw2 = PNG.sync.read(readFileSync(path2));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
if (raw1.width !== raw2.width || raw1.height !== raw2.height) {
|
|
76
|
+
const width2 = Math.max(raw1.width, raw2.width);
|
|
77
|
+
const height2 = Math.max(raw1.height, raw2.height);
|
|
78
|
+
const img1 = resizePng(raw1, width2, height2);
|
|
79
|
+
const img2 = resizePng(raw2, width2, height2);
|
|
80
|
+
const diff2 = new PNG({ width: width2, height: height2 });
|
|
81
|
+
pixelmatch(img1.data, img2.data, diff2.data, width2, height2, { threshold: 0.1 });
|
|
82
|
+
mkdirSync(dirname(diffOutputPath), { recursive: true });
|
|
83
|
+
writeFileSync(diffOutputPath, PNG.sync.write(diff2));
|
|
84
|
+
return {
|
|
85
|
+
similarity: 0,
|
|
86
|
+
diffPixels: width2 * height2,
|
|
87
|
+
totalPixels: width2 * height2,
|
|
88
|
+
width: width2,
|
|
89
|
+
height: height2
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const { width, height } = raw1;
|
|
79
93
|
const diff = new PNG({ width, height });
|
|
80
|
-
const diffPixels = pixelmatch(
|
|
94
|
+
const diffPixels = pixelmatch(raw1.data, raw2.data, diff.data, width, height, {
|
|
81
95
|
threshold: 0.1
|
|
82
96
|
});
|
|
83
97
|
mkdirSync(dirname(diffOutputPath), { recursive: true });
|
|
@@ -1105,7 +1119,7 @@ async function loadFromApi(fileKey, nodeId, token) {
|
|
|
1105
1119
|
}
|
|
1106
1120
|
|
|
1107
1121
|
// package.json
|
|
1108
|
-
var version = "0.8.
|
|
1122
|
+
var version = "0.8.7";
|
|
1109
1123
|
var AnalysisNodeTypeSchema = z.enum([
|
|
1110
1124
|
"DOCUMENT",
|
|
1111
1125
|
"CANVAS",
|