From 9daa288b64d038698d39e8ae58f78a23bd3aacc3 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Wed, 9 Sep 2026 02:39:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#72706=20feat(pixel?= =?UTF-8?q?match):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 ++ types/jest-image-snapshot/package.json | 2 +- types/karma-image-snapshot/package.json | 2 +- types/pixelmatch/.npmignore | 5 -- types/pixelmatch/index.d.ts | 63 ------------------------- types/pixelmatch/package.json | 29 ------------ types/pixelmatch/pixelmatch-tests.ts | 33 ------------- types/pixelmatch/tsconfig.json | 19 -------- 8 files changed, 6 insertions(+), 151 deletions(-) delete mode 100644 types/pixelmatch/.npmignore delete mode 100644 types/pixelmatch/index.d.ts delete mode 100644 types/pixelmatch/package.json delete mode 100644 types/pixelmatch/pixelmatch-tests.ts delete mode 100644 types/pixelmatch/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index a84568670c4056..c7c8e8c41489a3 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -5495,6 +5495,10 @@ "libraryName": "pino-std-serializers", "asOfVersion": "4.0.0" }, + "pixelmatch": { + "libraryName": "pixelmatch", + "asOfVersion": "7.1.0" + }, "pixi-spine": { "libraryName": "pixi-spine", "asOfVersion": "1.4.2" diff --git a/types/jest-image-snapshot/package.json b/types/jest-image-snapshot/package.json index f069becaa9bf07..c79ef9979d0bd2 100644 --- a/types/jest-image-snapshot/package.json +++ b/types/jest-image-snapshot/package.json @@ -7,7 +7,7 @@ ], "dependencies": { "@types/jest": "*", - "@types/pixelmatch": "*", + "@types/pixelmatch": "<7", "ssim.js": "^3.1.1" }, "devDependencies": { diff --git a/types/karma-image-snapshot/package.json b/types/karma-image-snapshot/package.json index e69d73180ebb64..72f6dece5aa5f6 100644 --- a/types/karma-image-snapshot/package.json +++ b/types/karma-image-snapshot/package.json @@ -9,7 +9,7 @@ "@types/jasmine": "*", "@types/karma": "*", "@types/node": "*", - "@types/pixelmatch": "*", + "@types/pixelmatch": "<7", "ssim.js": "^3.1.1" }, "devDependencies": { diff --git a/types/pixelmatch/.npmignore b/types/pixelmatch/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/pixelmatch/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/pixelmatch/index.d.ts b/types/pixelmatch/index.d.ts deleted file mode 100644 index 7c3e0dae28b68e..00000000000000 --- a/types/pixelmatch/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/// - -declare function Pixelmatch( - /** Image data of the first image to compare. Note: image dimensions must be equal. */ - img1: Buffer | Uint8Array | Uint8ClampedArray, - /** Image data of the second image to compare. Note: image dimensions must be equal. */ - img2: Buffer | Uint8Array | Uint8ClampedArray, - /** Image data to write the diff to, or null if don't need a diff image. */ - output: Buffer | Uint8Array | Uint8ClampedArray | null, - /** Width of the images. Note that all three images need to have the same dimensions. */ - width: number, - /** Height of the images. Note that all three images need to have the same dimensions. */ - height: number, - /** Options. */ - options?: Pixelmatch.PixelmatchOptions, -): number; - -declare namespace Pixelmatch { - type RGBTuple = [number, number, number]; - - interface PixelmatchOptions { - /** - * Matching threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive. - * @default 0.1 - */ - readonly threshold?: number | undefined; - /** - * If true, disables detecting and ignoring anti-aliased pixels. - * @default false - */ - readonly includeAA?: boolean | undefined; - /** - * Blending factor of unchanged pixels in the diff output. - * Ranges from 0 for pure white to 1 for original brightness - * @default 0.1 - */ - alpha?: number | undefined; - /** - * The color of anti-aliased pixels in the diff output. - * @default [255, 255, 0] - */ - aaColor?: RGBTuple | undefined; - /** - * The color of differing pixels in the diff output. - * @default [255, 0, 0] - */ - diffColor?: RGBTuple | undefined; - /** - * An alternative color to use for dark on light differences to differentiate between "added" and "removed" parts. - * If not provided, all differing pixels use the color specified by `diffColor`. - * @default null - */ - diffColorAlt?: RGBTuple | undefined; - /** - * Draw the diff over a transparent background (a mask), rather than over the original image. - * Will not draw anti-aliased pixels (if detected) - * @default false - */ - diffMask?: boolean | undefined; - } -} - -export = Pixelmatch; diff --git a/types/pixelmatch/package.json b/types/pixelmatch/package.json deleted file mode 100644 index f5f378a090e45d..00000000000000 --- a/types/pixelmatch/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "private": true, - "name": "@types/pixelmatch", - "version": "5.2.9999", - "projects": [ - "https://github.com/mapbox/pixelmatch#readme" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/pixelmatch": "workspace:.", - "@types/pngjs": "*" - }, - "owners": [ - { - "name": "Oleg Repin", - "githubUsername": "iamolegga" - }, - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz" - }, - { - "name": "Damian Frizzi", - "githubUsername": "damianfrizzi" - } - ] -} diff --git a/types/pixelmatch/pixelmatch-tests.ts b/types/pixelmatch/pixelmatch-tests.ts deleted file mode 100644 index bd1f6b2faf2b86..00000000000000 --- a/types/pixelmatch/pixelmatch-tests.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This test code taken from pixelmatch example usage. - * https://github.com/mapbox/pixelmatch#example-usage - */ - -import * as fs from "fs"; -import pixelmatch = require("pixelmatch"); -import { PNG } from "pngjs"; - -const img1 = fs - .createReadStream("img1.png") - .pipe(new PNG()) - .on("parsed", doneReading); - -const img2 = fs - .createReadStream("img2.png") - .pipe(new PNG()) - .on("parsed", doneReading); - -let filesRead = 0; - -function doneReading() { - if (++filesRead < 2) return; - const diff = new PNG({ width: img1.width, height: img1.height }); - - pixelmatch(img1.data, img2.data, diff.data, img1.width, img1.height, { - threshold: 0.1, - diffMask: true, - diffColorAlt: [0, 255, 0], - }); - - diff.pack().pipe(fs.createWriteStream("diff.png")); -} diff --git a/types/pixelmatch/tsconfig.json b/types/pixelmatch/tsconfig.json deleted file mode 100644 index ca2829c8351528..00000000000000 --- a/types/pixelmatch/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "pixelmatch-tests.ts" - ] -}