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

vite-plugin-vitepress-bar

v0.0.3

Published

为 vitepress 自动生成 nav 和 sidebar

Readme

vite-plugin-vitepress-bar

vitepress 自动生成 navsidebar

特性

  • [X] 自动生成 navsidebar
  • [X] 支持路径过滤
  • [X] 支持 dev 模式自动更新
  • [ ] 支持自定义排序 (enableMdContent)
  • [ ] 支持自定义标题 (enableMdContent)
  • [ ] 自动排除空文件夹
  • [ ] nav 优化 (层级问题, 没有 index.md 问题)

使用

npm i vite-plugin-vitepress-bar -D
import vitepressBar from 'vite-plugin-vitepress-sidebar'
import { defineConfig } from 'vitepress'

export default defineConfig({
  plugins: [
    vitepressBar(),
  ],
})

API

filter

  • 说明
    • 文件过滤器,用于精确控制文件在 navsidebar 中显示
    • 继承自 srcDir 配置项,既只有能被 vitepress 读取到才会被读取
    • 如果是个空文件夹,将不会显示
    • 支持相对路径路径(相对 srcDir)、正则、fast-glob、自定义函数
  • 类型
    • string
    • string[]
    • RegExp
    • RegExp[]
    • (fileInfo: FileInfo) => MaybePromise<boolean>

complete

  • 说明
    • bar 生成后的回调
    • 如果传入该配置项,则会将该函数的返回值作为 navsidebar 覆盖原有的配置
    • 如果不传入该配置项,则会将生成的 bar 覆盖原有的 navsidebar
  • 类型
    • (bar: Bar) => { sidebar: DefaultTheme.Sidebar, nav: DefaultTheme.NavItem[] }

类型说明

FileInfo

interface FileInfoSlim {
  path: string
  name: string
}

interface FileInfoSlimWithStats extends FileInfoSlim {
  stats: fs.Stats
}

interface FileInfo extends FileInfoSlimWithStats {
  files: string[]
  parent: FileInfo | null | undefined
}

MaybePromise

type MaybePromise<T> = T | Promise<T>

Bar

import type { DefaultTheme } from 'vitepress'

type NavItem = DefaultTheme.NavItemChildren | DefaultTheme.NavItemWithLink

interface SidebarMulti {
  [key: string]: DefaultTheme.SidebarItem[]
}

interface Bar {
  sidebar: SidebarMulti
  nav: NavItem[]
}