New:Socket for Asana Is Now Available.Learn more
Sign In

imagedimensions-cli

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagedimensions-cli - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+2
-2
package.json
{
"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",

@@ -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) => {

@@ -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.