@movk/nuxt-docs 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/app.config.ts CHANGED
@@ -107,8 +107,8 @@ export default defineAppConfig({
107
107
  clearChat: 'i-lucide-trash-2',
108
108
  streaming: 'i-lucide-chevron-down',
109
109
  providers: {
110
- mistral: 'i-simple-icons-mistralai',
111
- kwaipilot: 'i-lucide-wand'
110
+ deepseek: 'i-ri-deepseek-fill',
111
+ alibaba: 'i-simple-icons-alibabacloud'
112
112
  }
113
113
  }
114
114
  }
package/modules/config.ts CHANGED
@@ -17,7 +17,8 @@ export default defineNuxtModule({
17
17
  const url = inferSiteURL()
18
18
  const meta = await getPackageJsonMetadata(dir)
19
19
  const gitInfo = await getLocalGitInfo(dir) || getGitEnv()
20
- const siteName = meta.name || gitInfo?.name || ''
20
+
21
+ const siteName = nuxt.options?.site?.name || meta.name || gitInfo?.name || ''
21
22
 
22
23
  nuxt.options.site = defu(nuxt.options.site, {
23
24
  url,
package/nuxt.config.ts CHANGED
@@ -81,10 +81,13 @@ export default defineNuxtConfig({
81
81
 
82
82
  hooks: {
83
83
  'vite:extendConfig': async (config) => {
84
- // Rewrite optimizeDeps paths for layer architecture
85
- const include = config.optimizeDeps?.include
86
- if (!include) return
84
+ // Ensure optimizeDeps.include exists
85
+ const cfg = config as { optimizeDeps?: { include?: string[] } }
86
+ cfg.optimizeDeps ??= {}
87
+ cfg.optimizeDeps.include ??= []
88
+ const include = cfg.optimizeDeps.include
87
89
 
90
+ // Rewrite optimizeDeps paths for layer architecture
88
91
  const layerPkgs = /^(?:@nuxt\/content|@nuxtjs\/mdc|@nuxt\/a11y) > /
89
92
  include.forEach((id, i) => {
90
93
  if (layerPkgs.test(id)) include[i] = `@movk/nuxt-docs > ${id}`
@@ -92,7 +95,13 @@ export default defineNuxtConfig({
92
95
 
93
96
  include.push(
94
97
  '@movk/nuxt-docs > @nuxt/content > slugify',
95
- '@movk/nuxt-docs > @ai-sdk/gateway > @vercel/oidc'
98
+ '@movk/nuxt-docs > @ai-sdk/gateway > @vercel/oidc',
99
+ // Fix mermaid ESM compatibility issues
100
+ '@movk/nuxt-docs > mermaid',
101
+ '@movk/nuxt-docs > mermaid > dayjs',
102
+ '@movk/nuxt-docs > mermaid > @braintree/sanitize-url',
103
+ '@movk/nuxt-docs > mermaid > d3',
104
+ '@movk/nuxt-docs > mermaid > dompurify'
96
105
  )
97
106
 
98
107
  // WASM plugin support for Shiki
@@ -100,7 +109,7 @@ export default defineNuxtConfig({
100
109
  import('vite-plugin-wasm'),
101
110
  import('vite-plugin-top-level-await')
102
111
  ])
103
- config.plugins!.push(wasm.default(), topLevelAwait.default())
112
+ config.plugins!.push(wasm.default(), topLevelAwait.default() as any)
104
113
 
105
114
  const build = config.build || ((config as any).build = {})
106
115
  build.rollupOptions ??= {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@movk/nuxt-docs",
3
3
  "type": "module",
4
- "version": "1.11.0",
4
+ "version": "1.12.0",
5
5
  "private": false,
6
6
  "description": "Modern Nuxt 4 documentation theme with auto-generated component docs, AI chat assistant, MCP server, and complete developer experience optimization.",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
@@ -29,27 +29,27 @@
29
29
  "README.md"
30
30
  ],
31
31
  "dependencies": {
32
- "@ai-sdk/gateway": "^3.0.29",
33
- "@ai-sdk/mcp": "^1.0.16",
34
- "@ai-sdk/vue": "^3.0.64",
35
- "@iconify-json/lucide": "^1.2.87",
36
- "@iconify-json/simple-icons": "^1.2.68",
32
+ "@ai-sdk/gateway": "^3.0.39",
33
+ "@ai-sdk/mcp": "^1.0.19",
34
+ "@ai-sdk/vue": "^3.0.77",
35
+ "@iconify-json/lucide": "^1.2.89",
36
+ "@iconify-json/simple-icons": "^1.2.70",
37
37
  "@iconify-json/vscode-icons": "^1.2.40",
38
38
  "@movk/core": "^1.1.0",
39
39
  "@nuxt/a11y": "^1.0.0-alpha.1",
40
- "@nuxt/content": "^3.11.0",
40
+ "@nuxt/content": "^3.11.2",
41
41
  "@nuxt/image": "^2.0.0",
42
- "@nuxt/kit": "^4.3.0",
42
+ "@nuxt/kit": "^4.3.1",
43
43
  "@nuxt/ui": "^4.4.0",
44
- "@nuxtjs/mcp-toolkit": "^0.6.2",
45
- "@nuxtjs/mdc": "^0.20.0",
44
+ "@nuxtjs/mcp-toolkit": "^0.6.3",
45
+ "@nuxtjs/mdc": "^0.20.1",
46
46
  "@octokit/rest": "^22.0.1",
47
47
  "@openrouter/ai-sdk-provider": "^2.1.1",
48
48
  "@vercel/analytics": "^1.6.1",
49
49
  "@vercel/speed-insights": "^1.3.1",
50
50
  "@vueuse/core": "^14.2.0",
51
51
  "@vueuse/nuxt": "^14.2.0",
52
- "ai": "^6.0.64",
52
+ "ai": "^6.0.77",
53
53
  "defu": "^6.1.4",
54
54
  "dompurify": "^3.3.1",
55
55
  "exsolve": "^1.0.8",
@@ -57,7 +57,7 @@
57
57
  "mermaid": "^11.12.2",
58
58
  "minimark": "^0.2.0",
59
59
  "motion-v": "^1.10.2",
60
- "nuxt": "^4.3.0",
60
+ "nuxt": "^4.3.1",
61
61
  "nuxt-component-meta": "^0.17.1",
62
62
  "nuxt-llms": "^0.2.0",
63
63
  "nuxt-og-image": "^5.1.13",
package/README.md DELETED
@@ -1,301 +0,0 @@
1
- [![Movk Nuxt Docs](https://docs.mhaibaraai.cn/og-image.png)](https://docs.mhaibaraai.cn/)
2
-
3
- > 基于 Nuxt 4 的现代文档主题,集成组件自动化文档、AI 聊天助手、MCP Server 和完整的开发者体验优化
4
-
5
- [![Install MCP in Cursor](https://docs.mhaibaraai.cn/mcp/badge.svg)](https://docs.mhaibaraai.cn/mcp/deeplink)
6
- [![Install MCP in VS Code](https://docs.mhaibaraai.cn/mcp/badge.svg?ide=vscode)](https://docs.mhaibaraai.cn/mcp/deeplink?ide=vscode)
7
-
8
- [![npm version][npm-version-src]][npm-version-href]
9
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
10
- [![License][license-src]][license-href]
11
- [![Nuxt][nuxt-src]][nuxt-href]
12
-
13
- 使用此主题可以快速构建美观、专业、智能的文档网站,内置组件文档自动生成、AI 聊天助手、MCP Server 支持、SEO 优化、暗黑模式、全文搜索等功能。
14
-
15
- - 📖 [在线文档](https://docs.mhaibaraai.cn/)
16
-
17
- ## ✨ 特性
18
-
19
- 此主题集成了一系列旨在优化文档管理体验的强大功能:
20
-
21
- ### 🤖 AI 增强体验
22
-
23
- <div style="padding: 40px 0; display: flex; justify-content: center;">
24
- <img src="https://docs.mhaibaraai.cn/ai/AiChat.png" alt="AiChat" width="400">
25
- </div>
26
-
27
- - **AI 聊天助手** - 内置智能文档助手,基于 Vercel AI SDK 支持多种 LLM 模型(Mistral、Qwen、OpenRouter)
28
- - **MCP Server 支持** - 集成 Model Context Protocol 服务器,为 AI 助手提供结构化的文档访问能力
29
- - **LLM 优化** - 通过 `nuxt-llms` 模块自动生成 `llms.txt` 和 `llms-full.txt`,为 AI 工具提供优化的文档索引
30
- - **流式响应** - 支持 AI 响应流式输出和代码高亮,配合 `shiki-stream` 实现实时语法高亮渲染
31
-
32
- ### 🧩 自动化文档生成
33
-
34
- - **组件元数据自动提取** - 基于 `nuxt-component-meta` 自动提取 Vue 组件的 Props、Slots、Emits 定义
35
- - **交互式示例展示** - 通过 `ComponentExample` 组件自动加载和渲染组件示例,支持代码高亮和实时预览
36
- - **Git 提交历史集成** - 使用 `CommitChangelog` 和 `PageLastCommit` 组件自动展示文件的提交历史记录
37
- - **类型定义高亮** - 智能解析 TypeScript 类型定义,支持内联类型高亮和类型导航
38
-
39
- ### 🎨 开发者体验
40
-
41
- - ⚡ **基于 Nuxt 4** - 充分利用最新的 Nuxt 框架,实现卓越性能
42
- - 🎨 **采用 Nuxt UI** - 集成全面的 UI 组件库,开箱即用
43
- - 📝 **MDC 语法增强** - 支持 Markdown 与 Vue 组件的无缝集成
44
- - 📊 **Mermaid 图表** - 内置 Mermaid 支持,渲染流程图、时序图、类图等可视化图表,支持自动主题切换和全屏查看
45
- - 🔍 **全文搜索** - 基于 Nuxt Content 的 `ContentSearch` 组件,支持键盘快捷键(⌘K)
46
- - 🌙 **暗黑模式** - 支持亮色/暗色主题切换
47
- - 📱 **响应式设计** - 移动优先的响应式布局
48
- - 🚀 **SEO 优化** - 内置 SEO 优化功能
49
- - 🎯 **TypeScript 支持** - 完整的 TypeScript 类型支持
50
-
51
- ## 🚀 快速开始
52
-
53
- ### 使用模板创建项目
54
-
55
- 根据您的需求选择合适的模板:
56
-
57
- #### 📚 完整文档站点(推荐)
58
-
59
- 适合构建完整的文档网站,包含 ESLint、TypeScript 检查等开发工具。
60
-
61
- ```bash
62
- # 使用完整模板创建新项目
63
- npx nuxi init -t gh:mhaibaraai/movk-nuxt-docs/templates/default my-docs
64
- cd my-docs
65
- pnpm dev
66
- ```
67
-
68
- #### 📦 模块文档站点(精简)
69
-
70
- 适合为 npm 包或库快速创建文档,内置 Release 页面展示版本发布历史,无额外开发工具。
71
-
72
- ```bash
73
- # 使用模块模板创建新项目
74
- npx nuxi init -t gh:mhaibaraai/movk-nuxt-docs/templates/module my-module-docs
75
- cd my-module-docs
76
- pnpm dev
77
- ```
78
-
79
- 访问 `http://localhost:3000` 查看你的文档网站。
80
-
81
- ### 作为 Layer 使用
82
-
83
- 在现有 Nuxt 项目中使用 Movk Nuxt Docs 作为 layer:
84
-
85
- ```bash [Terminal]
86
- pnpm add @movk/nuxt-docs better-sqlite3 tailwindcss
87
- ```
88
-
89
- 在 `nuxt.config.ts` 中配置:
90
-
91
- ```ts [nuxt.config.ts]
92
- export default defineNuxtConfig({
93
- + extends: ['@movk/nuxt-docs']
94
- })
95
- ```
96
-
97
- ## 📁 项目结构
98
-
99
- ### 模板项目结构
100
-
101
- 使用模板创建的项目结构(以 `default` 模板为例):
102
-
103
- ```bash
104
- my-docs/
105
- ├── app/
106
- │ └── composables/ # 自定义 Composables
107
- ├── content/ # Markdown 内容
108
- │ ├── index.md # 首页
109
- │ └── docs/ # 文档页面
110
- ├── public/ # 静态资源
111
- ├── nuxt.config.ts # Nuxt 配置
112
- ├── tsconfig.json # TypeScript 配置
113
- ├── package.json # 依赖与脚本
114
- ├── .env.example # 环境变量示例
115
- └── pnpm-workspace.yaml # pnpm 工作区配置
116
- ```
117
-
118
- ### Monorepo 结构
119
-
120
- 本仓库采用 monorepo 结构:
121
-
122
- ```bash
123
- movk-nuxt-docs/
124
- ├── docs/ # 官方文档站点
125
- ├── layer/ # @movk/nuxt-docs layer 包
126
- ├── templates/
127
- │ ├── default/ # 完整文档站点模板
128
- │ └── module/ # 模块文档站点模板(精简)
129
- └── scripts/ # 构建脚本
130
- ```
131
-
132
- ## 📝 内容编写
133
-
134
- ### 基础 Markdown
135
-
136
- ```md [md]
137
- ---
138
- title: 页面标题
139
- description: 页面描述
140
- ---
141
-
142
- # 标题
143
-
144
- 这是一段普通的文本内容。
145
-
146
- ## 二级标题
147
-
148
- - 列表项 1
149
- - 列表项 2
150
- ```
151
-
152
- ### MDC 语法
153
-
154
- ```md [md]
155
- ::card
156
- ---
157
- title: 卡片标题
158
- icon: i-lucide-rocket
159
- ---
160
- 卡片内容
161
- ::
162
- ```
163
-
164
- 了解更多关于 MDC 语法,请查看 [Nuxt Content 文档](https://content.nuxt.com/docs/files/markdown#mdc-syntax)。
165
-
166
- ### Mermaid 图表
167
-
168
- 使用 ` ```mermaid ` 代码块渲染可视化图表,支持流程图、时序图、类图等多种图表类型:
169
-
170
- ````md [md]
171
- ```mermaid
172
- graph TD
173
- A[开始] --> B{是否有效?}
174
- B -->|是| C[处理数据]
175
- B -->|否| D[显示错误]
176
- C --> E[完成]
177
- D --> E
178
- ```
179
- ````
180
-
181
- **主要特性:**
182
- - 🎨 自动主题切换(深色/浅色模式)
183
- - 🔄 懒加载(仅在可见时渲染)
184
- - 📋 一键复制图表代码
185
- - 🖼️ 全屏查看功能
186
- - 🔒 安全渲染(DOMPurify 清理)
187
-
188
- **支持的图表类型:**
189
- - **流程图**(`flowchart`/`graph`):用于展示流程和决策
190
- ![Mermaid 流程图示例](https://docs.mhaibaraai.cn/mermaid/mermaid-flowchart.png)
191
- - **时序图**(`sequenceDiagram`):用于展示交互时序
192
- ![Mermaid 时序图示例](https://docs.mhaibaraai.cn/mermaid/mermaid-sequence.png)
193
- - **类图**(`classDiagram`):用于展示类关系
194
- - **状态图**(`stateDiagram`):用于展示状态转换
195
- - **甘特图**(`gantt`):用于展示项目时间线
196
- - **饼图**(`pie`):用于展示数据占比
197
- - **Git 图**(`gitGraph`):用于展示分支历史
198
- - 以及更多 [Mermaid 支持的图表类型](https://mermaid.js.org/intro/)
199
-
200
- **带文件名的图表:**
201
-
202
- ````md [md]
203
- ```mermaid [auth-flow.mmd]
204
- sequenceDiagram
205
- participant U as 用户
206
- participant A as 认证服务
207
- participant D as 数据库
208
- U->>A: 登录请求
209
- A->>D: 验证凭证
210
- D-->>A: 返回用户信息
211
- A-->>U: 返回 Token
212
- ```
213
- ````
214
-
215
- ## 🛠️ 开发
216
-
217
- ### 本地开发
218
-
219
- ```bash [Terminal]
220
- # 克隆项目
221
- git clone https://github.com/mhaibaraai/movk-nuxt-docs.git
222
- # 进入项目目录
223
- cd movk-nuxt-docs
224
- # 安装依赖
225
- pnpm install
226
- # 启动开发服务器
227
- pnpm dev
228
- ```
229
-
230
- 开发服务器将在 `http://localhost:3000` 启动。
231
-
232
- ### 构建生产版本
233
-
234
- ```bash [Terminal]
235
- # 构建应用
236
- pnpm build
237
- # 本地预览生产构建
238
- pnpm preview
239
- ```
240
-
241
- ### 发布
242
-
243
- ```bash [Terminal]
244
- # 发布 layer 到 npm
245
- pnpm release:layer
246
- # 发布完整项目
247
- pnpm release
248
- ```
249
-
250
- ## ⚡ 技术栈
251
-
252
- 本项目基于以下优秀的开源项目构建:
253
-
254
- ### 核心框架
255
-
256
- - [Nuxt 4](https://nuxt.com/) - Web 框架
257
- - [Nuxt Content](https://content.nuxt.com/) - 基于文件的 CMS
258
- - [Nuxt UI](https://ui.nuxt.com/) - UI 组件库
259
- - [Tailwind CSS 4](https://tailwindcss.com/) - CSS 框架
260
-
261
- ### AI 集成
262
-
263
- - [Vercel AI SDK](https://sdk.vercel.ai/) - AI 集成框架
264
- - [Nuxt LLMs](https://github.com/nuxt-content/nuxt-llms) - LLM 优化
265
- - [@nuxtjs/mcp-toolkit](https://github.com/nuxt-modules/mcp-toolkit) - MCP Server 支持
266
- - [Shiki](https://shiki.style/) - 代码语法高亮
267
- - [Shiki Stream](https://github.com/antfu/shiki-stream) - 流式代码高亮
268
-
269
- ### 功能增强
270
-
271
- - [Nuxt Component Meta](https://github.com/nuxt-content/nuxt-component-meta) - 组件元数据提取
272
- - [Nuxt Image](https://image.nuxt.com/) - 图片优化
273
- - [Nuxt SEO](https://nuxtseo.com/) - SEO 优化
274
- - [Octokit](https://github.com/octokit/rest.js) - GitHub API 集成
275
-
276
- ## 📖 文档
277
-
278
- 访问 [Movk Nuxt Docs 文档](https://docs.mhaibaraai.cn/) 了解详细的使用指南和 API 文档。
279
-
280
- ## 🙏 致谢
281
-
282
- 本项目基于以下优秀项目构建或受其启发:
283
-
284
- - [Docus](https://docus.dev/) - 由 Nuxt Content 团队开发的文档主题
285
- - [Nuxt UI Docs Template](https://docs-template.nuxt.dev/) - Nuxt UI 官方文档模板
286
-
287
- ## 📄 许可证
288
-
289
- [MIT](./LICENSE) License © 2024-PRESENT [YiXuan](https://github.com/mhaibaraai)
290
-
291
-
292
- <!-- Badges -->
293
-
294
- [npm-version-src]: https://img.shields.io/npm/v/@movk/nuxt-docs/latest.svg?style=flat&colorA=020420&colorB=00DC82
295
- [npm-version-href]: https://npmjs.com/package/@movk/nuxt-docs
296
- [npm-downloads-src]: https://img.shields.io/npm/dm/@movk/nuxt-docs.svg?style=flat&colorA=020420&colorB=00DC82
297
- [npm-downloads-href]: https://npm.chart.dev/@movk/nuxt-docs
298
- [license-src]: https://img.shields.io/badge/License-MIT-blue.svg
299
- [license-href]: https://npmjs.com/package/@movk/nuxt-docs
300
- [nuxt-src]: https://img.shields.io/badge/Nuxt-4-00DC82?logo=nuxt.js&logoColor=fff
301
- [nuxt-href]: https://nuxt.com