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

starlight-share-actions

v0.1.3

Published

Starlight share plugin: a share menu under the page title (native share, X/Facebook/LINE/Weibo intents, copy link) plus a selection-to-image share card generator for WeChat Moments.

Readme

starlight-share-actions

Open-source Starlight plugin: a share menu under the page title and a selection-to-image share card generator, built for the WeChat Moments workflow (where link previews are unreliable and images with QR codes are the robust medium).

Born from the 显密文库 project — an aging-friendly Buddhist text library where readers share sutra passages to WeChat Moments — but this repository is a standalone, generic plugin: no site-specific content or configuration lives here.

Why

  • Link share: one button → native share sheet (navigator.share) when available; X / Facebook / LINE / WhatsApp / Telegram / Weibo intent links and copy-link as fallback items. The shared URL uses the page's rel=canonical link when present.
  • Share card: readers select a meaningful passage (or just tap the button) and get a ready-to-post PNG — quote, page title, site name and a QR code back to the page. Rendered 100% client-side (no server, works on static hosting), tuned for the platforms where link cards degrade to bare URLs.
  • Zero component overrides: the UI is injected by a client script next to .page-actions-bar (it coexists with starlight-ai-actions) or after main h1, so it never fights other plugins for Starlight component overrides.
  • WeChat-aware: inside the WeChat in-app browser (no navigator.share) the card modal presents the generated image with a long-press-to-save hint; elsewhere it offers download / Web Share with the image file.
  • Mobile-friendly selection: the selection pill is placed below the selection — mobile browsers draw their native copy/share toolbar in the browser UI layer (always above page content, attached above the selection), so the pill avoids that spot and coexists with it.
  • CJK vertical text: the built-in “Vertical” style uses writing-mode: vertical-rl — ancient-book typography that foreignObject-based capture engines (snapdom) render natively.
  • Lazy: snapdom + uqr are dynamically imported on first card generation; the per-page cost is a few KB.

Quick Start

npm install starlight-share-actions
// astro.config.mjs
import starlightShareActions from 'starlight-share-actions';

export default defineConfig({
  integrations: [
    starlight({
      plugins: [
        starlightShareActions({
          // show only on content pages (client-side path matching, same spirit as other plugins)
          where: { idPattern: '^docs/' },
          link: { platforms: ['x', 'facebook', 'line'] },
          card: {
            siteName: 'My Docs',
            // optional: custom styles (colors, font stack, orientation, size…)
            // styles: [{ id: 'night', name: 'Night', bg: '#111', fg: '#eee', accent: '#7aa', orientation: 'vertical' }],
          },
        }),
      ],
    }),
  ],
});

Configuration

| Option | Type | Default | Notes | | --- | --- | --- | --- | | link | { platforms } \| false | built-ins | false disables the share menu. platforms accepts built-in ids ('x' \| 'facebook' \| 'line' \| 'whatsapp' \| 'telegram' \| 'weibo') and/or { id, name, href } objects; href templates may use {url} / {title}. | | card | options | false | off unless configured | Requires siteName (printed on the card). Optional: styles, defaultStyleId, maxQuoteLength (160), minQuoteLength (6), width (1080), height (1440). | | where | { idPattern? } | show everywhere | RegExp tested against the page id (path minus base prefix), e.g. '^p\\d\\d/'. | | labels | Record<lang, Partial<Labels>> | en/zh-CN/zh-TW | Per-language UI strings; language is read from <html lang>. |

Card styles

A style is { id, name, orientation?, bg?, fg?, accent?, muted?, font? }. Defaults:

  • paper — Classic: horizontal, warm paper tone.
  • sutra — Vertical: CJK vertical text (right-to-left columns), dark tone.

Card fonts default to a system CJK serif stack — deliberately no webfonts: the capture pipeline serializes the card through an SVG image context where external font URLs cannot load.

Events

Every action dispatches a share-actions CustomEvent on document with detail.action ∈ card-open | card-generate | card-download | card-share-image | selection-share | copy | platform | system-share — handy for analytics and E2E assertions.

License

MIT.