11import type { DefaultTheme , UserConfig } from 'vitepress'
2+ import process from 'node:process'
23import { defineConfig } from 'vitepress'
3- import { version } from '../../package.json'
4+ import {
5+ groupIconMdPlugin ,
6+ groupIconVitePlugin ,
7+ } from 'vitepress-plugin-group-icons'
8+ import llmstxt from 'vitepress-plugin-llms'
9+
10+ const prod = ! ! process . env . NETLIFY
411
512const vitepressConfig : UserConfig < DefaultTheme . Config > = defineConfig ( {
6- lang : 'zh-CN' ,
713 title : 'Mock-Dev-Server' ,
8- description : 'Mock-dev-server is injected into the Vite development environment to simulate API request and response data.' ,
914 lastUpdated : true ,
1015 cleanUrls : true ,
16+ metaChunk : true ,
17+
18+ rewrites : {
19+ 'en/:rest*' : ':rest*' ,
20+ } ,
21+
1122 markdown : {
1223 theme : { light : 'github-light' , dark : 'github-dark' } ,
1324 headers : { level : [ 2 , 3 ] } ,
25+ codeTransformers : [
26+ {
27+ postprocess ( code ) {
28+ return code . replace ( / \[ ! ! c o d e / g, '[!code' )
29+ } ,
30+ } ,
31+ ] ,
32+ config ( md ) {
33+ md . use ( groupIconMdPlugin )
34+ } ,
1435 } ,
1536 head : [
1637 [ 'link' , { rel : 'icon' , type : 'image/svg' , href : '/logo.svg' } ] ,
@@ -28,187 +49,18 @@ const vitepressConfig: UserConfig<DefaultTheme.Config> = defineConfig({
2849 ] ,
2950 search : { provider : 'local' } ,
3051 } ,
52+ vite : {
53+ plugins : [
54+ groupIconVitePlugin ( ) ,
55+ prod && llmstxt ( {
56+ workDir : 'en' ,
57+ ignoreFiles : [ 'index.md' ] ,
58+ } ) ,
59+ ] ,
60+ } ,
3161 locales : {
32- root : {
33- label : '简体中文' ,
34- lang : 'zh-CN' ,
35- themeConfig : {
36- editLink : {
37- pattern : 'https://github.com/pengzhanbo/vite-plugin-mock-dev-server/edit/main/docs/:path' ,
38- text : '在Github编辑此页' ,
39- } ,
40- footer : {
41- message : 'Released under the MIT License.' ,
42- copyright : 'Copyright © 2022-present pengzhanbo' ,
43- } ,
44- docFooter : {
45- prev : '上一页' ,
46- next : '下一页' ,
47- } ,
48- nav : [
49- {
50- text : '使用指南' ,
51- link : '/guide/introduce' ,
52- activeMatch : '/guide/' ,
53- } ,
54- {
55- text : '使用示例' ,
56- link : '/examples/basic' ,
57- activeMatch : '/examples/' ,
58- } ,
59- { text : `version ${ version } ` , link : '/' , activeMatch : '!' } ,
60- ] ,
61- sidebar : {
62- '/guide/' : [
63- {
64- text : '快速开始' ,
65- items : [
66- { text : '介绍' , link : '/guide/introduce' } ,
67- { text : '安装' , link : '/guide/install' } ,
68- { text : '使用' , link : '/guide/usage' } ,
69- ] ,
70- } ,
71- {
72- text : 'API' ,
73- items : [
74- { text : 'mockDevServerPlugin' , link : '/guide/mock-plugin' } ,
75- { text : 'defineMock' , link : '/guide/define-mock' } ,
76- { text : 'createDefineMock' , link : '/guide/create-define-mock' } ,
77- { text : 'defineMockData' , link : '/guide/define-mock-data' } ,
78- { text : 'createSSEStream' , link : '/guide/create-sse-stream' } ,
79- ] ,
80- } ,
81- {
82- text : '配置' ,
83- items : [
84- { text : 'pluginConfig' , link : '/guide/plugin-config' } ,
85- { text : 'mockConfig' , link : '/guide/mock-config' } ,
86- ] ,
87- } ,
88- {
89- text : '实践建议' ,
90- items : [
91- { text : '目录文件管理' , link : '/guide/file-management' } ,
92- { text : '共享内容' , link : '/guide/shared' } ,
93- { text : '共享可变数据' , link : '/guide/shared-data' } ,
94- { text : '文件上传' , link : '/guide/upload' } ,
95- { text : '团队协作' , link : '/guide/teamwork' } ,
96- { text : 'mock服务部署' , link : '/guide/mock-service' } ,
97- ] ,
98- } ,
99- ] ,
100- '/examples/' : [
101- { text : '基础示例' , link : '/examples/basic' } ,
102- { text : '类型格式' , link : '/examples/format-extension' } ,
103- { text : '自定义响应头' , link : '/examples/header' } ,
104- { text : 'cookies' , link : '/examples/cookies' } ,
105- { text : '自定义响应体' , link : '/examples/body' } ,
106- { text : '自定义响应内容' , link : '/examples/response' } ,
107- { text : '文件上传/下载' , link : '/examples/file' } ,
108- { text : '静态资源服务' , link : '/examples/static' } ,
109- { text : '请求验证器' , link : '/examples/validator' } ,
110- { text : '使用mockjs库' , link : '/examples/mockjs' } ,
111- { text : '使用faker-js库' , link : '/examples/faker' } ,
112- { text : 'Graphql' , link : '/examples/graphql' } ,
113- { text : 'Websocket' , link : '/examples/websocket' } ,
114- { text : 'EventSource' , link : '/examples/event-source' } ,
115- ] ,
116- } ,
117- } ,
118- } ,
119- en : {
120- label : 'English' ,
121- lang : 'en-US' ,
122- themeConfig : {
123- editLink : {
124- pattern : 'https://github.com/pengzhanbo/vite-plugin-mock-dev-server/edit/main/docs/:path' ,
125- text : 'Edit this page on Github' ,
126- } ,
127- footer : {
128- message : 'Released under the MIT License.' ,
129- copyright : 'Copyright © 2022-present pengzhanbo' ,
130- } ,
131- docFooter : {
132- prev : 'Prev Page' ,
133- next : 'Next Page' ,
134- } ,
135- nav : [
136- {
137- text : 'Guide' ,
138- link : '/en/guide/introduce' ,
139- activeMatch : '/en/guide/' ,
140- } ,
141- {
142- text : 'Examples' ,
143- link : '/en/examples/basic' ,
144- activeMatch : '/en/examples/' ,
145- } ,
146- { text : `version ${ version } ` , link : '/en/' , activeMatch : '!' } ,
147- ] ,
148- sidebar : {
149- '/en/guide/' : [
150- {
151- text : 'Quick Start' ,
152- items : [
153- { text : 'Introduce' , link : '/en/guide/introduce' } ,
154- { text : 'Install' , link : '/en/guide/install' } ,
155- { text : 'Usage' , link : '/en/guide/usage' } ,
156- ] ,
157- } ,
158- {
159- text : 'API' ,
160- items : [
161- { text : 'mockDevServerPlugin' , link : '/en/guide/mock-plugin' } ,
162- { text : 'defineMock' , link : '/en/guide/define-mock' } ,
163- { text : 'createDefineMock' , link : '/en/guide/create-define-mock' } ,
164- { text : 'defineMockData' , link : '/en/guide/define-mock-data' } ,
165- { text : 'createSSEStream' , link : '/en/guide/create-sse-stream' } ,
166- ] ,
167- } ,
168- {
169- text : 'Configuration' ,
170- items : [
171- { text : 'pluginConfig' , link : '/en/guide/plugin-config' } ,
172- { text : 'mockConfig' , link : '/en/guide/mock-config' } ,
173- ] ,
174- } ,
175- {
176- text : 'Practical suggestion' ,
177- items : [
178- {
179- text : 'Directory file management' ,
180- link : '/en/guide/file-management' ,
181- } ,
182- { text : 'Share Content' , link : '/en/guide/shared' } ,
183- { text : 'Shared' , link : '/en/guide/shared-data' } ,
184- { text : 'File Upload' , link : '/en/guide/upload' } ,
185- { text : 'Teamwork' , link : '/en/guide/teamwork' } ,
186- {
187- text : 'Mock Service Deployment' ,
188- link : '/en/guide/mock-service' ,
189- } ,
190- ] ,
191- } ,
192- ] ,
193- '/en/examples/' : [
194- { text : 'Basic example' , link : '/en/examples/basic' } ,
195- { text : 'Format extension' , link : '/en/examples/format-extension' } ,
196- { text : 'Custom header' , link : '/en/examples/header' } ,
197- { text : 'cookies' , link : '/en/examples/cookies' } ,
198- { text : 'Custom body' , link : '/en/examples/body' } ,
199- { text : 'Custom response' , link : '/en/examples/response' } ,
200- { text : 'File upload/download' , link : '/en/examples/file' } ,
201- { text : 'Static resources' , link : '/en/examples/static' } ,
202- { text : 'Request validator' , link : '/en/examples/validator' } ,
203- { text : 'Use mockjs' , link : '/en/examples/mockjs' } ,
204- { text : 'Use faker-js' , link : '/en/examples/faker' } ,
205- { text : 'Graphql' , link : '/en/examples/graphql' } ,
206- { text : 'Websocket' , link : '/en/examples/websocket' } ,
207- { text : 'EventSource' , link : '/en/examples/event-source' } ,
208- ] ,
209- } ,
210- } ,
211- } ,
62+ root : { label : 'English' } ,
63+ zh : { label : '简体中文' } ,
21264 } ,
21365} )
21466export default vitepressConfig
0 commit comments