npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@alexberriman/visual-dom-auditor

v0.1.8

Published

CLI tool for detecting critical layout issues on webpages using a headless browser

Downloads

17

Readme

A CLI tool for detecting layout issues on websites by analyzing the DOM using Playwright.

License: MIT npm version TypeScript

npx @alexberriman/visual-dom-auditor --url https://example.com

📖 Table of Contents


✨ Why Visual DOM Auditor?

Your CSS looks perfect. Your code validates. But your site still breaks visually. Visual DOM Auditor catches what other tools miss — the real layout issues that frustrate users.


🔥 Features


⚡ Installation

# Use directly (recommended)
npx @alexberriman/visual-dom-auditor --url https://example.com

# Or install globally
npm install -g @alexberriman/visual-dom-auditor

🎯 Quick Examples

Basic Usage

# Analyze a single page
npx @alexberriman/visual-dom-auditor --url https://example.com

# Test mobile layout
npx @alexberriman/visual-dom-auditor --url https://example.com --viewport mobile

# Save results
npx @alexberriman/visual-dom-auditor --url https://example.com --save report.json

Advanced Usage

# Test multiple pages with custom viewport
npx @alexberriman/visual-dom-auditor \
  --urls https://example.com https://example.com/about \
  --viewport 1366x768 \
  --save results.json

# Crawl entire site
npx @alexberriman/visual-dom-auditor \
  --url https://example.com \
  --crawl \
  --max-pages 50 \
  --max-threads 5

# Run specific detectors only
npx @alexberriman/visual-dom-auditor \
  --url https://example.com \
  --detectors "overlap,console-error"

🛠️ Command Reference

Core Options

| Option | Description | Default | |:-------|:------------|:--------| | --url | Single URL to analyze | - | | --urls | Multiple URLs to analyze | - | | --viewport | desktop, tablet, mobile, or WIDTHxHEIGHT | desktop | | --save | Save results to file | - | | --format | Output format | json | | --verbose | Show detailed logs | false | | --exit-early | Stop on first critical error | false |

Detector Options

| Option | Description | Default | |:-------|:------------|:--------| | --detectors | Comma-separated list of detectors | All enabled |

Crawling Options

| Option | Description | Default | |:-------|:------------|:--------| | --crawl | Enable site crawling | false | | --max-depth | Maximum crawl depth (1-10) | 3 | | --max-pages | Maximum pages to crawl (1-1000) | 50 | | --max-threads | Concurrent threads (1-10) | 3 |


🧪 Detectors

🎯 Enabled by Default

{
  "type": "overlap",
  "severity": "critical",
  "elements": [
    {"selector": ".header-logo", "description": "Header logo"},
    {"selector": ".nav-menu", "description": "Navigation menu"}
  ],
  "overlapPercentage": 65
}
{
  "type": "padding",
  "severity": "major",
  "element": {"selector": ".submit-btn", "description": "Submit button"},
  "insufficientSides": ["top", "bottom"]
}
{
  "type": "spacing",
  "severity": "minor",
  "spacing": 2,
  "recommendedSpacing": 8
}
{
  "type": "container-overflow",
  "severity": "major",
  "overflowDirection": "right",
  "overflowAmount": 15
}
{
  "type": "scrollbar",
  "severity": "critical",
  "overflowAmount": 320
}
{
  "type": "flex-grid",
  "severity": "major",
  "issue": "overflow"
}
{
  "type": "console-error",
  "severity": "critical",
  "level": "error",
  "message": "TypeError: Cannot read property 'foo' of undefined"
}

🔵 Disabled by Default

  • Centering Detector — Enable with --detectors centering

🕷️ Site Crawling

Automatically discover and analyze your entire website.

# Basic crawl
npx @alexberriman/visual-dom-auditor --url https://example.com --crawl

# Advanced crawl with limits
npx @alexberriman/visual-dom-auditor \
  --url https://example.com \
  --crawl \
  --max-depth 5 \
  --max-pages 100 \
  --max-threads 5 \
  --save crawl-report.json

How It Works

  1. 🚀 Starts from your URL
  2. 🔍 Discovers internal links
  3. 🧹 Filters external/asset links
  4. ⚡ Analyzes pages concurrently
  5. 📊 Reports aggregated results

📊 Output Formats

Single URL

{
  "url": "https://example.com",
  "timestamp": "2023-05-20T10:15:30Z",
  "issues": [...],
  "metadata": {
    "totalIssuesFound": 3,
    "criticalIssues": 1,
    "issuesByType": {...}
  }
}

Multiple URLs / Crawl

{
  "timestamp": "2023-05-20T10:15:30Z",
  "results": [...],
  "summary": {
    "totalUrls": 15,
    "urlsWithIssues": 8,
    "totalIssuesFound": 23
  },
  "crawlMetadata": {
    "startUrl": "https://example.com",
    "pagesSkipped": 32,
    "crawlDuration": 45000
  }
}

🔄 CI/CD Integration

GitHub Actions

name: Visual Audit
on: [push, pull_request]

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install Playwright
        run: npx playwright install chromium
      - name: Run Visual Audit
        run: |
          npx @alexberriman/visual-dom-auditor \
            --url https://staging.example.com \
            --crawl \
            --exit-early \
            --save report.json
      - uses: actions/upload-artifact@v3
        with:
          name: audit-report
          path: report.json

Quick CI Commands

# Fail fast on critical issues
npx @alexberriman/visual-dom-auditor --url $STAGING_URL --exit-early

# Full site audit
npx @alexberriman/visual-dom-auditor --url $STAGING_URL --crawl --max-pages 25

🎨 Advanced Usage

Pipe to Other Tools

# Pretty print with jq
npx @alexberriman/visual-dom-auditor --url https://example.com | jq '.'

# Extract critical issues
npx @alexberriman/visual-dom-auditor --url https://example.com | \
  jq '.issues[] | select(.severity == "critical")'

# Count issues by type
npx @alexberriman/visual-dom-auditor --url https://example.com | \
  jq '.metadata.issuesByType'

Programmatic Usage

import { analyzePage } from "@alexberriman/visual-dom-auditor/core/analyzer";
import { allDetectors } from "@alexberriman/visual-dom-auditor/core/detectors";

// Custom analysis
const result = await analyzePage(page, config, allDetectors);

🤝 Contributing

We love contributions! Check out our contributing guide to get started.

# Fork and clone
git clone https://github.com/YOUR_USERNAME/visual-dom-auditor
cd visual-dom-auditor

# Install dependencies
npm install

# Make your changes
# ...

# Test
npm test

# Submit PR

📜 License

MIT © Alex Berriman