config.mts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import consola from 'consola'
  2. import { REPO_BRANCH, REPO_PATH } from '@element-plus/build-constants'
  3. import { docsDirName } from '@element-plus/build-utils'
  4. import { languages } from './utils/lang'
  5. import { features, head, mdPlugin, nav, sidebars } from './config'
  6. import type { UserConfig } from 'vitepress'
  7. const buildTransformers = () => {
  8. const transformer = () => {
  9. return {
  10. props: [],
  11. needRuntime: true,
  12. }
  13. }
  14. const transformers = {}
  15. const directives = [
  16. 'infinite-scroll',
  17. 'loading',
  18. 'popover',
  19. 'click-outside',
  20. 'repeat-click',
  21. 'trap-focus',
  22. 'mousewheel',
  23. 'resize',
  24. ]
  25. directives.forEach((k) => {
  26. transformers[k] = transformer
  27. })
  28. return transformers
  29. }
  30. consola.debug(`DOC_ENV: ${process.env.DOC_ENV}`)
  31. const locales = {}
  32. languages.forEach((lang) => {
  33. locales[`/${lang}`] = {
  34. label: lang,
  35. lang,
  36. }
  37. })
  38. export const config: UserConfig = {
  39. title: 'Element Plus',
  40. description: 'a Vue 3 based component library for designers and developers',
  41. lastUpdated: true,
  42. head,
  43. themeConfig: {
  44. repo: REPO_PATH,
  45. docsBranch: REPO_BRANCH,
  46. docsDir: docsDirName,
  47. editLinks: true,
  48. editLinkText: 'Edit this page on GitHub',
  49. lastUpdated: 'Last Updated',
  50. logo: '/images/element-plus-logo.svg',
  51. logoSmall: '/images/element-plus-logo-small.svg',
  52. sidebars,
  53. nav,
  54. agolia: {
  55. apiKey: '377f2b647a96d9b1d62e4780f2344da2',
  56. appId: 'BH4D9OD16A',
  57. },
  58. features,
  59. langs: languages,
  60. },
  61. locales,
  62. markdown: {
  63. config: (md) => mdPlugin(md),
  64. },
  65. vue: {
  66. template: {
  67. ssr: true,
  68. compilerOptions: {
  69. directiveTransforms: buildTransformers(),
  70. },
  71. },
  72. },
  73. }
  74. export default config