rspress.config.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import * as path from 'node:path';
  6. import { pluginLlms } from '@rspress/plugin-llms';
  7. import { transformerCompatibleMetaHighlight } from '@rspress/core/shiki-transformers';
  8. import { defineConfig } from '@rspress/core';
  9. import { pluginLess } from '@rsbuild/plugin-less';
  10. export default defineConfig({
  11. root: path.join(__dirname, 'src'),
  12. base: '/',
  13. title: 'FlowGram.AI',
  14. globalStyles: path.join(__dirname, './global.less'),
  15. builderConfig: {
  16. performance: {
  17. buildCache: false,
  18. // 4MB log file size limit in Vercel platform
  19. printFileSize: {
  20. compressed: false,
  21. detail: false,
  22. total: true,
  23. },
  24. },
  25. source: {
  26. decorators: {
  27. version: 'legacy',
  28. },
  29. },
  30. plugins: [pluginLess()],
  31. tools: {
  32. rspack(options, { mergeConfig }) {
  33. return mergeConfig(options, {
  34. module: {
  35. rules: [
  36. {
  37. test: /\.mdc$/,
  38. type: 'asset/source',
  39. },
  40. ],
  41. },
  42. });
  43. },
  44. },
  45. },
  46. ssg: false,
  47. // locales 为一个对象数组
  48. locales: [
  49. {
  50. lang: 'en',
  51. // 导航栏切换语言的标签
  52. label: 'English',
  53. title: 'Rspress',
  54. description: 'Static Site Generator',
  55. },
  56. {
  57. lang: 'zh',
  58. label: '简体中文',
  59. title: 'Rspress',
  60. description: '静态网站生成器',
  61. },
  62. ],
  63. icon: '/logo.png',
  64. logo: {
  65. light: '/logo.png',
  66. dark: '/logo.png',
  67. },
  68. lang: 'zh',
  69. logoText: 'FlowGram.AI',
  70. markdown: {
  71. shiki: {
  72. transformers: [transformerCompatibleMetaHighlight()],
  73. },
  74. },
  75. plugins: [
  76. pluginLlms([
  77. {
  78. llmsTxt: {
  79. name: 'llms.txt',
  80. },
  81. llmsFullTxt: {
  82. name: 'llms-full.txt',
  83. },
  84. include: ({ page }) => page.lang === 'zh',
  85. },
  86. {
  87. llmsTxt: {
  88. name: 'en/llms.txt',
  89. },
  90. llmsFullTxt: {
  91. name: 'en/llms-full.txt',
  92. },
  93. include: ({ page }) => page.lang === 'en',
  94. },
  95. ]),
  96. ],
  97. themeConfig: {
  98. localeRedirect: 'auto',
  99. footer: {
  100. message: '© 2025 Bytedance Inc. All Rights Reserved.',
  101. },
  102. lastUpdated: true,
  103. locales: [
  104. {
  105. lang: 'en',
  106. label: 'en',
  107. outlineTitle: 'ON THIS Page',
  108. },
  109. {
  110. lang: 'zh',
  111. label: 'zh',
  112. outlineTitle: '大纲',
  113. searchNoResultsText: '未搜索到相关结果',
  114. searchPlaceholderText: '搜索文档',
  115. searchSuggestedQueryText: '可更换不同的关键字后重试',
  116. overview: {
  117. filterNameText: '过滤',
  118. filterPlaceholderText: '输入关键词',
  119. filterNoResultText: '未找到匹配的 API',
  120. },
  121. },
  122. ],
  123. socialLinks: [
  124. {
  125. icon: 'github',
  126. mode: 'link',
  127. content: 'https://github.com/bytedance/flowgram.ai',
  128. },
  129. {
  130. icon: 'discord',
  131. mode: 'link',
  132. content: 'https://discord.gg/SwDWdrgA9f',
  133. },
  134. {
  135. icon: 'X',
  136. mode: 'link',
  137. content: 'https://x.com/FlowGramAI',
  138. },
  139. ],
  140. },
  141. });