简体中文
导出与兼容性
导出
| 入口 | 内容 |
|---|---|
vitepress-plugin-filelist | fileList:vitepress-tuck 插件(也是默认导出) |
vitepress-plugin-filelist/client | 组件 FileList、VPFileList;注册函数 enhanceAppWithFileList;文案工具 fileListLocales、formatLabel、resolveLabels;类型 FileListProps、FileListSource、FileListLabels、FileListLocale |
vitepress-plugin-filelist/style.css | 组件样式(普通写法需要手动引入) |
vuepress-plugin-filelist | fileListPlugin:VuePress 2 插件(也是默认导出),注册组件并引入样式;见在 VuePress 中使用 |
以上就是全部公开接口,1.0 之后按语义化版本维护:新增属性、文案 key 属于次版本,删除或改名属于主版本。其它内部模块(路径与格式化工具、目录树、OpenList 请求)随时可能调整,请不要从 dist 里直接引用。
兼容性
| 组合 | 支持 | 验证方式 |
|---|---|---|
VitePress 2(>=2.0.0-alpha.18)+ vitepress-tuck | ✅ | 文档站与浏览器测试(Chromium 桌面 / 手机、WebKit) |
| VitePress 2,普通写法 | ✅ | pnpm test:compat(2.0.0-alpha.21) |
| VitePress 1.6,普通写法 | ✅ | pnpm test:compat(1.6.4) |
| VitePress 1.6 + vitepress-tuck | ❌ | vitepress-tuck 本身需要 VitePress 2 |
| VitePress 1.5 及更早 | ❌ | 未测试,不在 peerDependencies 范围内 |
| VuePress 2(默认主题 / plume / hope) | ✅ | 使用 vuepress-plugin-filelist;pnpm test:compat:vuepress |
| 以上站点在 Node 20.19 上构建 | ✅ | CI 的 node20 任务(Node 22 构建插件,Node 20.19 构建并检查站点) |
VitePress 2 之后的大版本没有上限,发布时不需要改依赖范围。仓库每天检查 npm 上最新的 VitePress(latest 与 next),出了新版本就跑一遍兼容性测试,文档站也通过 Dependabot 跟进最新版本,新版本出问题时会第一时间发现。
pnpm test:compat 把打包后的插件装进全新的 VitePress 站点,构建后在浏览器里检查渲染、展开、预览、打包 ZIP,并确认开发时的公开提醒只在 vitepress dev 中出现。
| 依赖 | 范围 |
|---|---|
vitepress(可选 peer) | ^1.6.0 || >=2.0.0-alpha.18:VitePress 1.6 及以后的 1.x,以及 2.0.0-alpha.18 起的所有版本(含将来的 3.x、4.x 正式版)。VitePress 站点本来就装着它;标为可选,是为了 VuePress 站点不被顺带装上 |
vue(peer) | ^3.5.0 |
vitepress-tuck(可选 peer) | >=0.12.2(不设上限);只有用 vitepress-tuck 注册时才需要安装 |
| Node | ^20.19.0 || >=22.12.0 |
vuepress-plugin-filelist 另外需要 vuepress(peer,>=2.0.0-rc.20)和 @vuepress/bundler-vite,并依赖同版本的 vitepress-plugin-filelist。
在 Node 22 下针对 VitePress 2.0.0-alpha.21 本地实测包管理器:
| 包管理器 | 安装 | 构建 |
|---|---|---|
| npm 10 | ✅ | ✅ |
| pnpm 11.25 | ✅ | ✅ |
| yarn 1.22(classic) | ✅ | ✅ |
| bun 1.4 | ✅ | ✅ |
| deno 2.9 | ✅ deno install | ❌ Vite/rolldown 加载配置时失败 |
Deno 可以安装 npm 依赖,但目前用 Deno 构建 VitePress 会在 rolldown 里报 stream did not contain valid UTF-8;构建请使用 Node。