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

@show-docs/docusaurus-theme-copy-button

v0.2.8

Published

页脚版权那一格右边加一颗按钮,点一下把当前页地址写进剪贴板

Readme

@show-docs/docusaurus-theme-copy-button

在页脚那一格加一颗复制按钮:点一下把此刻地址栏里的页面地址写进剪贴板,成败都给一条提示。 页脚原本的文案一个字都不改。

安装

theme/ 与 components/ 是随包发布的未编译 TS 源码,所以本层只有一条前提:编译那一条 在 peerDependencies 里点名 —— 坏在哪一格、由谁 认领,记在 plugin-compile-source 的 README,这里不抄第二份。 这一层不向 theme-component-page 交规则,缺了那一格它照常工作;层里引的都是官方那几把别名, 所以本包没有配置期要当场查的前提。两个包一起安装:

pnpm add @show-docs/docusaurus-plugin-compile-source @show-docs/docusaurus-theme-copy-button

使用

注册插件

// docusaurus.config.mjs
export default {
  plugins: [
    '@show-docs/docusaurus-plugin-compile-source',
    '@show-docs/docusaurus-theme-copy-button'
  ]
};

页脚要有内容

这一层覆盖的是页脚里的 Footer/Copyright 那一格,所以站点得给它东西渲染: themeConfig.footer.copyright 写过才看得见这一格,没写的站点里这一层等于不存在。

层栈

本层提供 theme/Footer/Copyright/index.tsx:它拿官方那一份 Footer/Copyright (@theme-init/Footer/Copyright;仓库里只有本层提供这一格,没有要串的链),把文案原样交下去, 只在它前面多摆一颗按钮。这一层不读 frontmatter,也没有插件选项。

层栈怎么推导、谁能盖住谁,是核心解析器那一格的事,见 plugin-prev-layer-resolver 的 README; 这一层自己只负责「挂在哪一格」。

工作方式

  • 按钮是 <button type="button">,图标是 styles/copy-button.css 里纯 CSS 画的一份形状, 不请求图标字体也不带图片;按钮上没有文字,读屏拿到的名字是 aria-label 那一句。
  • 复制走 navigator.clipboard.writeText(),提示条由 sonner 给(<Toaster position="bottom-right" richColors />,跟按钮一起挂在这一格里)。
  • 写进剪贴板的是 window.location.href 解码之后那一份,所以地址里带 ?path= 这类编码参数时, 复制出来的是看得懂的那一份。
  • styles/copy-button.css 由入口的 getClientModules() 交给站点的样式表管线; 提示条自己的样式由 sonner 在浏览器里注入,不经过这一格。
  • 主题层与 components/ 是未编译的 .tsx,随包发布、由用它们的站点编译; 本包只编译 src/index.mts 那一份入口(pnpm build → dist/)。

已知限制

  • 只在页脚有 Footer/Copyright 那一格时出现;页脚整块关掉(themeConfig.footer: null)的站点看不到它。
  • navigator.clipboard 只在安全上下文(https 或 localhost)里存在。用 http 打开的站点上, 点击只会给一条「复制失败」的提示,按钮本身照常可点。
  • 静态渲染出来的 HTML 里没有提示条:这一层是浏览器里的行为。
  • 提示文案(成功与失败各一句)写死在 components/copy-button.tsx,不跟站点语言切换。

相关文档