rspress.config.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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: {
  47. experimentalExcludeRoutePaths: [
  48. /\/auto-docs\//,
  49. // these pages do not support SSR
  50. // document is not defined
  51. '/en/examples/node-form/basic',
  52. '/en/examples/node-form/array',
  53. '/en/examples/node-form/dynamic',
  54. '/en/guide/getting-started/create-fixed-layout-simple',
  55. '/en/guide/getting-started/create-free-layout-simple',
  56. '/en/examples/node-form/effect',
  57. '/en/guide/advanced/fixed-layout/composite-nodes',
  58. '/en/examples/playground',
  59. '/en/examples/fixed-layout/fixed-composite-nodes',
  60. '/en/examples/fixed-layout/fixed-layout-simple',
  61. '/en/examples/free-layout/free-layout-simple',
  62. '/en/examples/fixed-layout/fixed-feature-overview',
  63. '/en/examples/free-layout/free-feature-overview',
  64. '/examples/node-form/basic',
  65. '/examples/node-form/array',
  66. '/examples/node-form/dynamic',
  67. '/guide/getting-started/create-fixed-layout-simple',
  68. '/guide/getting-started/create-free-layout-simple',
  69. '/examples/node-form/effect',
  70. '/guide/advanced/fixed-layout/composite-nodes',
  71. '/examples/playground',
  72. '/examples/fixed-layout/fixed-composite-nodes',
  73. '/examples/fixed-layout/fixed-layout-simple',
  74. '/examples/free-layout/free-layout-simple',
  75. '/examples/fixed-layout/fixed-feature-overview',
  76. '/examples/free-layout/free-feature-overview',
  77. ],
  78. },
  79. // locales 为一个对象数组
  80. locales: [
  81. {
  82. lang: 'en',
  83. // 导航栏切换语言的标签
  84. label: 'English',
  85. title: 'Rspress',
  86. description: 'Static Site Generator',
  87. },
  88. {
  89. lang: 'zh',
  90. label: '简体中文',
  91. title: 'Rspress',
  92. description: '静态网站生成器',
  93. },
  94. ],
  95. icon: '/logo.png',
  96. logo: {
  97. light: '/logo.png',
  98. dark: '/logo.png',
  99. },
  100. lang: 'zh',
  101. logoText: 'FlowGram.AI',
  102. markdown: {
  103. shiki: {
  104. transformers: [transformerCompatibleMetaHighlight()],
  105. },
  106. },
  107. plugins: [
  108. pluginLlms([
  109. {
  110. llmsTxt: {
  111. name: 'llms.txt',
  112. },
  113. llmsFullTxt: {
  114. name: 'llms-full.txt',
  115. },
  116. include: ({ page }) => page.lang === 'zh',
  117. },
  118. {
  119. llmsTxt: {
  120. name: 'en/llms.txt',
  121. },
  122. llmsFullTxt: {
  123. name: 'en/llms-full.txt',
  124. },
  125. include: ({ page }) => page.lang === 'en',
  126. },
  127. ]),
  128. ],
  129. themeConfig: {
  130. localeRedirect: 'auto',
  131. footer: {
  132. message: '© 2025 Bytedance Inc. All Rights Reserved.',
  133. },
  134. lastUpdated: true,
  135. locales: [
  136. {
  137. lang: 'en',
  138. label: 'en',
  139. outlineTitle: 'ON THIS Page',
  140. },
  141. {
  142. lang: 'zh',
  143. label: 'zh',
  144. outlineTitle: '大纲',
  145. searchNoResultsText: '未搜索到相关结果',
  146. searchPlaceholderText: '搜索文档',
  147. searchSuggestedQueryText: '可更换不同的关键字后重试',
  148. overview: {
  149. filterNameText: '过滤',
  150. filterPlaceholderText: '输入关键词',
  151. filterNoResultText: '未找到匹配的 API',
  152. },
  153. },
  154. ],
  155. socialLinks: [
  156. {
  157. icon: 'github',
  158. mode: 'link',
  159. content: 'https://github.com/bytedance/flowgram.ai',
  160. },
  161. {
  162. icon: 'discord',
  163. mode: 'link',
  164. content: 'https://discord.gg/SwDWdrgA9f',
  165. },
  166. {
  167. icon: 'X',
  168. mode: 'link',
  169. content: 'https://x.com/FlowGramAI',
  170. },
  171. ],
  172. },
  173. });