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-click-to-source

v0.1.5

Published

Astro integration for Alt+Click to open source files in your editor during development

Readme

astro-click-to-source

npm version License: MIT

Demo

An Astro integration that enables click-to-source functionality during development. Hold Alt (or another modifier) and click any element to instantly open its source file in your editor at the exact line and column.

Features

  • Alt+Click to open source - Jump directly to the component source in your editor
  • Visual highlighting - See which element you're about to open when holding the modifier key
  • Tooltip preview - Shows the file path and line number before you click
  • Clipboard mode - Copy the source path instead of opening the editor
  • Multi-editor support - Works with VS Code, Neovim, WebStorm, and more
  • HMR-aware - Maintains source mappings across hot module reloads
  • Zero config - Works out of the box with sensible defaults

Installation

npm install astro-click-to-source

Usage

Add the integration to your astro.config.mjs:

import { defineConfig } from 'astro/config';
import { clickToSource } from 'astro-click-to-source';

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

Then run your dev server and Alt+Click (or Option+Click on Mac) any element to open its source file.

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | modifier | 'alt' \| 'ctrl' \| 'meta' \| 'shift' | 'alt' | Modifier key to hold while clicking | | showHighlight | boolean | true | Show visual highlight on hover when modifier is held |

Example with options

import { clickToSource } from 'astro-click-to-source';

export default defineConfig({
  integrations: [
    clickToSource({
      modifier: 'ctrl',      // Use Ctrl+Click instead of Alt+Click
      showHighlight: false   // Disable visual highlighting
    })
  ]
});

Environment Variables

CLICK_TO_SOURCE

Set this environment variable to customize the behavior:

| Value | Behavior | |-------|----------| | code (default) | Open in VS Code | | cursor | Open in Cursor | | windsurf | Open in Windsurf | | antigravity | Open in Antigravity | | trae | Open in Trae | | nvim | Open in Neovim | | vim | Open in Vim | | webstorm | Open in WebStorm | | phpstorm | Open in PhpStorm | | idea | Open in IntelliJ IDEA | | sublime | Open in Sublime Text | | atom | Open in Atom | | clipboard | Copy path to clipboard instead of opening editor |

Any CLI command on your PATH that accepts a file:line:column argument will work — the value is forwarded to launch-editor. So if your editor ships a shell binary (e.g. the antigravity command installed by the Antigravity IDE), just set CLICK_TO_SOURCE to its name.

# Open in Neovim
CLICK_TO_SOURCE=nvim npm run dev

# Open in Antigravity IDE
CLICK_TO_SOURCE=antigravity npm run dev

# Copy to clipboard
CLICK_TO_SOURCE=clipboard npm run dev

How It Works

  1. Source Mapping: Astro adds data-astro-source-file and data-astro-source-loc attributes to elements in development mode
  2. Caching: The integration caches these mappings to survive HMR updates
  3. Click Handling: When you Alt+Click, it finds the nearest element with source info
  4. Editor Opening: Uses launch-editor to open your editor at the exact location

Editor Detection

The integration uses launch-editor which automatically detects your editor from:

  1. CLICK_TO_SOURCE environment variable
  2. LAUNCH_EDITOR environment variable
  3. EDITOR environment variable
  4. Running editor processes

Requirements

  • Astro 4.0.0 or higher
  • Node.js 18.17.0 or higher

License

MIT