1// Flag oversized assets under public/. Pure fs.stat — no parsing, no LLM.2// 500 KB threshold is where bandwidth/first-paint start to bite (Vercel3// Doctor's 4 KB triggers on favicons).45import { readdir, stat } from 'node:fs/promises';6import { join, relative, extname } from 'node:path';78const THRESHOLD_BYTES = 500_000;9const TOP_N = 20;1011const
21 'Static assets in `public/` over 500 KB ship as-is from the CDN. Whether the cost is meaningful depends on traffic, but the candidate is binary — the file is either needed at that size or it can be optimized (compressed image, video transcode, or moved off the critical path).',
22 fix:
23 'Verify the asset is reachable on the customer-facing hot path. Then choose: (a) compress (convert PNG → AVIF/WebP; transcode MP4 to lower bitrate); (b) host externally (Vercel Blob, S3, or a media CDN with per-asset signed URLs); (c) lazy-load (defer to client-side fetch instead of bundling into initial HTML).',