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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yemreak/chrome-cdp

v0.1.1

Published

Chrome DevTools Protocol CLI - automation/testing/debugging

Readme

@yemreak/chrome-cdp

Usage

# Install
bun install -g @yemreak/chrome-cdp

# Start Chrome in debug mode
chrome-cdp start
→ Chrome starting (port 9222)

# List tabs
chrome-cdp tabs
→ [{"id":"...","type":"page","title":"Google",...}]

# Execute JavaScript
chrome-cdp eval "document.title"
→ "Google"

chrome-cdp eval "document.querySelector('h1').textContent"
→ "Welcome"

# Take screenshot
chrome-cdp screenshot page.png
→ page.png

# Save HTML snapshot
chrome-cdp snapshot page.html
→ page.html

# Console logs
chrome-cdp console
→ [{"type":"log","args":["Hello"],"ts":1234567890}]

chrome-cdp console clear
→ []

# Network monitoring
chrome-cdp network 10
→ [{"url":"...","method":"GET","status":200}]

# Performance emulation
chrome-cdp emulate cpu 4
→ CPU throttling: 4x slowdown

chrome-cdp emulate network 3g
→ Network: 3g (↓750kb/s ↑250kb/s RTT:100ms)

chrome-cdp emulate device 375 667
→ Viewport: 375x667 @2x

# Performance trace
chrome-cdp trace 5 performance.json
→ Performance trace started (5s)...
→ performance.json

# Reset emulation
chrome-cdp reset
→ Emulation reset: cpu=1x, network=normal, viewport=default

What This Does

Control Chrome via DevTools Protocol. Automation, testing, debugging - no Selenium, no Puppeteer.

Pattern:

  • Chrome runs in debug mode (port 9222)
  • CDP commands via WebSocket
  • Direct browser control (eval JS, screenshot, network, performance)

Why it works:

  • Native Chrome protocol (no third-party wrapper)
  • WebSocket commands (instant response)
  • Works with existing Chrome instance (no headless launch)
  • Perfect for automation/testing/debugging

Example flow:

# Start debug Chrome
chrome-cdp start

# Open page manually or automate
chrome-cdp eval "window.location = 'https://example.com'"

# Wait for load
chrome-cdp eval "await new Promise(r => setTimeout(r, 2000))"

# Extract data
chrome-cdp eval "Array.from(document.querySelectorAll('a')).map(a => a.href)"

# Screenshot
chrome-cdp screenshot result.png

How to Build

// Chrome DevTools Protocol
// Start Chrome: chrome --remote-debugging-port=9222

// List tabs
const response = await fetch('http://127.0.0.1:9222/json')
const tabs = await response.json()

// Connect via WebSocket
const ws = new WebSocket(tabs[0].webSocketDebuggerUrl)

// Execute command
ws.send(JSON.stringify({
  id: 1,
  method: 'Runtime.evaluate',
  params: {
    expression: 'document.title',
    returnByValue: true
  }
}))

// Receive result
ws.onmessage = (event) => {
  const { result } = JSON.parse(event.data)
  console.log(result.value)
}

API Docs: https://chromedevtools.github.io/devtools-protocol/

Environment:

  • CHROME_TAB_ID - Target specific tab
  • CHROME_CDP_PORT - Custom port (default: 9222)
  • CHROME_EVAL_TIMEOUT - Timeout ms (default: 30000)

License: Apache-2.0