imagedimensions-cli
Advanced tools
+2
-2
| { | ||
| "name": "imagedimensions-cli", | ||
| "version": "0.1.0", | ||
| "description": "Audit the images on any web page from the command line — find oversized images (downloaded much larger than displayed) and fail CI on regressions. Powered by imagedimensions.com.", | ||
| "version": "0.1.1", | ||
| "description": "Audit the images on any web page from the command line \u2014 find oversized images (downloaded much larger than displayed) and fail CI on regressions. Powered by imagedimensions.com.", | ||
| "license": "MIT", | ||
@@ -6,0 +6,0 @@ "type": "module", |
+11
-2
@@ -38,3 +38,12 @@ // Pure analysis helpers shared by the MCP server and the research batch aggregator. | ||
| // Returns a normalized analysis of one scan's image list. | ||
| // `oversizedThreshold` is the area-overshoot ratio above which an image counts as oversized. | ||
| // `oversizedThreshold` is the area-overshoot ratio ABOVE WHICH an image counts as oversized. | ||
| // 4x area is exactly 2x per side — the textbook retina allowance — so the comparison is strictly | ||
| // greater than, not >=. Using >= counted a perfectly-served 2x retina image as oversized, which | ||
| // matters more here than anywhere else: `--max-oversized 0` is documented as a CI gate, so the bug | ||
| // could fail a build for doing the right thing. Corrected 2026-08-14, in step with the site and | ||
| // the MCP server. | ||
| // | ||
| // Caveat: this compares against rendered CSS pixels as reported by the scanner, which renders | ||
| // headless at devicePixelRatio 1, so a retina image still reads ~4x. Raise --threshold if you | ||
| // serve above 2x. | ||
| // 4 ≈ 2x in each dimension, which already exceeds a 2x-retina allowance. | ||
@@ -48,3 +57,3 @@ export function analyzeImages(images, { oversizedThreshold = 4 } = {}) { | ||
| const oversized = measurable | ||
| .filter((x) => x.ratio >= oversizedThreshold) | ||
| .filter((x) => x.ratio > oversizedThreshold) | ||
| .sort((a, b) => b.ratio - a.ratio) | ||
@@ -51,0 +60,0 @@ .map((x) => { |
+2
-1
@@ -12,3 +12,4 @@ #!/usr/bin/env node | ||
| Options: | ||
| --threshold <n> Area-overshoot ratio that counts as "oversized". Default 4 (≈2x per dimension). | ||
| --threshold <n> Count an image oversized ABOVE this area-overshoot ratio. Default 4, | ||
| which is exactly 2x per side, so correct retina serving is not counted. | ||
| --max-oversized <n> Exit with code 1 if any URL has more than n oversized images. Default: never fail. | ||
@@ -15,0 +16,0 @@ --top <n> Show at most n oversized images per URL in human output. Default 10. |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
16980
4.37%289
3.58%