shop-wx/doc/wot-design-uni/docs/.vitepress/config.mts

134 lines
6.3 KiB
TypeScript
Raw Normal View History

/*
* @Author: weisheng
* @Date: 2023-07-27 10:26:09
* @LastEditTime: 2025-09-23 10:35:39
* @LastEditors: weisheng
* @Description:
* @FilePath: /wot-design-uni/docs/.vitepress/config.mts
*
*/
import { defineConfig } from 'vitepress';
import viteCompression from 'vite-plugin-compression'
import { fileURLToPath, URL } from 'node:url'
import { MarkdownTransform } from './plugins/markdown-transform'
import { VersionBadgePlugin } from './plugins/version-badge'
import llmstxt from 'vitepress-plugin-llms'
import enUS from './locales/en-US'
import zhCN from './locales/zh-CN'
export default defineConfig({
vite: {
plugins: [
llmstxt({
ignoreFiles: ['reward/*', 'index.md', 'README.md', 'en-US/*.md', 'en-US/**/*.md', 'ads/*', 'guide/cases.md', 'guide/changelog.md', 'guide/join-group.md', 'guide/typography.md'],
domain: 'https://wot-ui.cn',
}),
MarkdownTransform(),
VersionBadgePlugin(),
viteCompression({
verbose: true,
disable: false,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz',
}),
],
ssr: { noExternal: ['element-plus'] },
resolve: {
alias: [
{
find: /^.*\/VPSidebar\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPSidebar.vue', import.meta.url)
)
},
{
find: /^.*\/VPContent\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPContent.vue', import.meta.url)
)
},
{
find: /^.*\/VPDoc\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPDoc.vue', import.meta.url)
)
},
{
find: /^.*\/VPLocalNav\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPLocalNav.vue', import.meta.url)
)
},
{
find: /^.*\/VPNavBar\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPNavBar.vue', import.meta.url)
)
},
{
find: /^.*\/VPSidebarItem\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPSidebarItem.vue', import.meta.url)
)
}
]
}
},
title: `Wot UI`,
description: '一个参照wot-design打造的uni-app组件库',
locales: {
root: {
label: '简体中文',
lang: 'zh-CN',
...zhCN
},
'en-US': {
label: 'English',
lang: 'en-US',
...enUS,
}
},
head: [
['link', { rel: 'icon', href: '/favicon.ico' }],
['script', {}, `
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c77588a5308ea5813c1d46bdd849338b";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
`]
],
themeConfig: {
logo: '/logo.png',
lastUpdated: {
text: '最后更新'
},
editLink: {
pattern: 'https://github.com/Moonofweisheng/wot-design-uni/edit/master/docs/:path',
text: '为此页提供修改建议',
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/Moonofweisheng/wot-design-uni' },
{ icon: { svg: '<svg t="1692699544299" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4184" width="200" height="200"><path d="M512 1024C230.4 1024 0 793.6 0 512S230.4 0 512 0s512 230.4 512 512-230.4 512-512 512z m259.2-569.6H480c-12.8 0-25.6 12.8-25.6 25.6v64c0 12.8 12.8 25.6 25.6 25.6h176c12.8 0 25.6 12.8 25.6 25.6v12.8c0 41.6-35.2 76.8-76.8 76.8h-240c-12.8 0-25.6-12.8-25.6-25.6V416c0-41.6 35.2-76.8 76.8-76.8h355.2c12.8 0 25.6-12.8 25.6-25.6v-64c0-12.8-12.8-25.6-25.6-25.6H416c-105.6 0-188.8 86.4-188.8 188.8V768c0 12.8 12.8 25.6 25.6 25.6h374.4c92.8 0 169.6-76.8 169.6-169.6v-144c0-12.8-12.8-25.6-25.6-25.6z" fill="#6D6D72" p-id="4185"></path></svg>' }, link: "https://gitee.com/wot-design-uni/wot-design-uni", ariaLabel: 'Gitee' },
{ icon: { svg: '<svg t="1694688365239" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4048" width="200" height="200"><path d="M980.79827 694.105946c-21.144216-122.796973-109.844757-203.250162-109.844757-203.250162 12.647784-111.477622-33.792-131.26573-33.792-131.26573C827.392 14.668108 530.985514 20.67373 524.730811 20.839784 518.476108 20.67373 222.01427 14.668108 212.300108 359.590054c0 0-46.467459 19.788108-33.819676 131.26573 0 0-88.700541 80.453189-109.817081 203.250162 0 0-11.291676 207.484541 101.403676 25.40627 0 0 25.350919 69.161514 71.790703 131.26573 0 0-83.082378 28.256865-75.997405 101.625081 0 0-2.87827 81.836973 177.401081 76.218811 0 0 126.699243-9.852541 164.753297-63.515676l16.605405 0 0.276757 0 16.633081 0c38.026378 53.635459 164.725622 63.515676 164.725622 63.515676 180.224 5.618162 177.401081-76.218811 177.401081-76.218811 7.029622-73.368216-75.997405-101.625081-75.997405-101.625081 46.439784-62.104216 71.790703-131.26573 71.790703-131.26573C992.034595 901.590486 980.79827 694.105946 980.79827 694.105946z" p-id="4049" fill="#6D6D72"></path></svg>' }, link: "/guide/join-group", ariaLabel: 'QQ' },
{ icon: { svg: '<svg t="1758594913114" class="icon" viewBox="0 0 1316 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5329" width="200" height="200"><path d="M643.181714 247.698286l154.916572-123.172572L643.181714 0.256 643.072 0l-154.660571 124.269714 154.660571 123.245715 0.109714 0.182857z m0 388.461714h0.109715l399.579428-315.245714-108.361143-87.04-291.218285 229.888h-0.146286l-0.109714 0.146285L351.817143 234.093714l-108.251429 87.04 399.433143 315.136 0.146286-0.146285z m-0.146285 215.552l0.146285-0.146286 534.893715-422.034285 108.397714 87.04-243.309714 192L643.145143 1024 10.422857 525.056 0 516.754286l108.251429-86.893715L643.035429 851.748571z" fill="#1E80FF" p-id="5330"></path></svg>' }, link: 'https://juejin.cn/user/26044011388510/posts' },
],
search: {
provider: 'algolia',
options: {
appId: 'A74X2RFXSU',
apiKey: '6961856d63f5181bf71cb4fa3e4398d2',
indexName: 'wot-design-uni2',
},
},
footer: {
message: `Released under the MIT License.`,
copyright: 'Copyright © 2023-present weisheng',
},
},
})