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

astro-inspect-clip

v1.0.3

Published

Astro dev-toolbar app to inspect elements and copy source info + instructions to clipboard

Readme

🔍 astro-inspect-clip

Click any element. Get the source. Copy it wherever you want.

An Astro dev toolbar app that turns your browser into a source-aware inspector — grab file paths, line numbers, tag info, and HTML snippets with a single click, then copy everything straight to your clipboard.

npm version npm downloads license Astro


Why?

Ever clicked around your Astro site and wondered "where does this component come from?" — then opened DevTools, searched the DOM tree, and still couldn't find the source file?

astro-inspect-clip fixes that. It hooks into Astro's built-in source annotations (the ones Astro's own Audit toolbar removes) and keeps them alive, so you can:

  • 🔎 Inspect — hover to highlight, click to capture source file + line number
  • 📋 Copy — file path, element tag, classes, and HTML snippet land in your clipboard
  • 📝 Add instructions — write what you want changed, then paste the whole thing anywhere
  • Open in Editor — jump straight to the source line in VS Code (or your editor of choice)
  • 🏷️ Multi-select — select several elements and copy them grouped by file

Dev-only. Zero overhead in production. Nothing ships to your users.


Version 1.0.3

This patch makes inspect clicks more reliable when Astro's dev toolbar and the built-in Audit app touch source annotations at slightly different times.

  • Caches both data-astro-source-file and data-astro-source-loc, even when only one attribute is present on an element
  • Resolves the nearest source location while inheriting the file path from the matching ancestor when Astro splits that metadata across elements
  • Prevents page-level click handlers from racing the inspector click
  • Fixes the fallback panel markup shown when no source info is available

Install

npm install astro-inspect-clip

Setup

Add the integration to your astro.config.mjs:

import { defineConfig } from 'astro/config';
import astroInspectClip from 'astro-inspect-clip';

export default defineConfig({
  integrations: [
    astroInspectClip(),
  ],
});

That's it. Start your dev server:

npm run dev

Open the browser, click the Inspect & Clip icon in Astro's dev toolbar, and start clicking elements.


How it works

Astro adds data-astro-source-file and data-astro-source-loc attributes to elements during development. The built-in Audit toolbar removes them — this plugin captures both pieces of metadata before they disappear using a MutationObserver cache.

When you click an element, the plugin:

  1. Resolves the source file and line number, walking up the DOM if needed
  2. Shows a panel with file path, tag, classes, and HTML snippet
  3. Lets you write an optional instruction
  4. Copies everything to clipboard in a clean, structured format

What gets copied

File: src/components/Header.astro:42
Element: <nav>
Classes: main-nav, sticky
HTML: <nav class="main-nav sticky">...</nav>

Instruction:
Make the nav collapse into a hamburger menu on mobile

Multi-select

Toggle Multi mode to grab several elements at once. Hit Done, write your instruction, and copy everything grouped by file — perfect for multi-component changes.


Use cases

| Scenario | How it helps | |---|---| | "Where is this component?" | Click → see the exact file and line | | Working with an AI assistant | Click → add instruction → paste into ChatGPT, Cursor, Copilot, etc. | | Code review | Copy element source + context and drop it into a PR comment | | Debugging layout issues | Inspect the exact HTML output with source location | | Onboarding | New dev? Click around to learn the codebase structure | | Pair programming | Share element context without screen sharing |


Features at a glance

  • 🔍 Inspect mode — hover highlights, click captures
  • 📋 One-click copy — structured format ready to paste
  • 🏷️ Multi-select — group multiple elements by file
  • 🔗 Open in Editor — jump to source line in VS Code
  • 🧩 Astro-native — lives inside the built-in dev toolbar
  • 🚀 Zero production cost — only activates in dev mode
  • 🎯 Smart resolution — walks up the DOM to find source info
  • ⌨️ Keyboard friendly — press Escape to dismiss

Requirements

  • Astro 4.0+, 5.0+, or 6.0+
  • Node.js 18+

Configuration

No configuration needed. The plugin activates automatically when you run the dev server.


Comparison with Astro's built-in Audit toolbar

| | Astro Audit | astro-inspect-clip | |---|---|---| | See source file & line | ✅ | ✅ | | Copy element info | ❌ | ✅ | | Add custom instructions | ❌ | ✅ | | Multi-select | ❌ | ✅ | | Open in Editor | ❌ | ✅ | | Structured clipboard output | ❌ | ✅ |

Think of it as the Audit toolbar's more opinionated sibling — built for developers who want to do something with what they inspect.


License

MIT


Made with ☕ for the Astro community

Report a bug · Request a feature · npm