rspress.config.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 mermaid from 'rspress-plugin-mermaid';
  7. import { pluginLlms } from '@rspress/plugin-llms';
  8. import { transformerCompatibleMetaHighlight } from '@rspress/core/shiki-transformers';
  9. import { defineConfig, RspressPlugin } from '@rspress/core';
  10. import { pluginLess } from '@rsbuild/plugin-less';
  11. export default defineConfig({
  12. root: path.join(__dirname, 'src'),
  13. base: '/',
  14. title: 'FlowGram.AI',
  15. description: 'FlowGram.AI',
  16. globalStyles: path.join(__dirname, './global.less'),
  17. head: ['<meta name="keywords" content="FlowGram, flowgram">'],
  18. builderConfig: {
  19. performance: {
  20. buildCache: false,
  21. // 4MB log file size limit in Vercel platform
  22. printFileSize: {
  23. compressed: false,
  24. detail: false,
  25. total: true,
  26. },
  27. },
  28. source: {
  29. decorators: {
  30. version: 'legacy',
  31. },
  32. },
  33. plugins: [pluginLess()],
  34. tools: {
  35. rspack(options, { mergeConfig }) {
  36. return mergeConfig(options, {
  37. module: {
  38. rules: [
  39. {
  40. test: /\.mdc$/,
  41. type: 'asset/source',
  42. },
  43. ],
  44. },
  45. /**
  46. * ignore warnings from @coze-editor/editor/language-typescript
  47. */
  48. ignoreWarnings: [/Critical dependency: the request of a dependency is an expression/],
  49. });
  50. },
  51. },
  52. },
  53. ssg: {
  54. experimentalExcludeRoutePaths: [
  55. /\/auto-docs\//,
  56. // these pages do not support SSR
  57. // document is not defined
  58. '/en/examples/node-form/basic',
  59. '/en/examples/node-form/array',
  60. '/en/examples/node-form/dynamic',
  61. '/en/guide/getting-started/create-fixed-layout-simple',
  62. '/en/guide/getting-started/create-free-layout-simple',
  63. '/en/examples/node-form/effect',
  64. '/en/guide/fixed-layout/composite-nodes',
  65. '/en/examples/playground',
  66. '/en/examples/fixed-layout/fixed-composite-nodes',
  67. '/en/examples/fixed-layout/fixed-layout-simple',
  68. '/en/examples/free-layout/free-layout-simple',
  69. '/en/examples/fixed-layout/fixed-feature-overview',
  70. '/en/examples/free-layout/free-feature-overview',
  71. /\/en\/materials\/.*\/.*/,
  72. /\/materials\/.*\/.*/,
  73. '/examples/node-form/basic',
  74. '/examples/node-form/array',
  75. '/examples/node-form/dynamic',
  76. '/guide/getting-started/create-fixed-layout-simple',
  77. '/guide/getting-started/create-free-layout-simple',
  78. '/examples/node-form/effect',
  79. '/guide/fixed-layout/composite-nodes',
  80. '/examples/playground',
  81. '/examples/fixed-layout/fixed-composite-nodes',
  82. '/examples/fixed-layout/fixed-layout-simple',
  83. '/examples/free-layout/free-layout-simple',
  84. '/examples/fixed-layout/fixed-feature-overview',
  85. '/examples/free-layout/free-feature-overview',
  86. ],
  87. },
  88. // locales 为一个对象数组
  89. locales: [
  90. {
  91. lang: 'en',
  92. // 导航栏切换语言的标签
  93. label: 'English',
  94. title: 'Rspress',
  95. description: 'Static Site Generator',
  96. },
  97. {
  98. lang: 'zh',
  99. label: '简体中文',
  100. title: 'Rspress',
  101. description: '静态网站生成器',
  102. },
  103. ],
  104. icon: '/logo.png',
  105. logo: {
  106. light: '/logo.png',
  107. dark: '/logo.png',
  108. },
  109. lang: 'zh',
  110. logoText: 'FlowGram.AI',
  111. markdown: {
  112. shiki: {
  113. transformers: [transformerCompatibleMetaHighlight()],
  114. },
  115. },
  116. plugins: [
  117. pluginLlms([
  118. {
  119. llmsTxt: {
  120. name: 'llms.txt',
  121. },
  122. llmsFullTxt: {
  123. name: 'llms-full.txt',
  124. },
  125. include: ({ page }) => page.lang === 'zh',
  126. },
  127. {
  128. llmsTxt: {
  129. name: 'en/llms.txt',
  130. },
  131. llmsFullTxt: {
  132. name: 'en/llms-full.txt',
  133. },
  134. include: ({ page }) => page.lang === 'en',
  135. },
  136. ]),
  137. mermaid() as RspressPlugin,
  138. ],
  139. themeConfig: {
  140. localeRedirect: 'auto',
  141. footer: {
  142. message: '© 2025 Bytedance Inc. All Rights Reserved.',
  143. },
  144. lastUpdated: true,
  145. locales: [
  146. {
  147. lang: 'en',
  148. label: 'en',
  149. outlineTitle: 'ON THIS Page',
  150. },
  151. {
  152. lang: 'zh',
  153. label: 'zh',
  154. outlineTitle: '大纲',
  155. searchNoResultsText: '未搜索到相关结果',
  156. searchPlaceholderText: '搜索文档',
  157. searchSuggestedQueryText: '可更换不同的关键字后重试',
  158. overview: {
  159. filterNameText: '过滤',
  160. filterPlaceholderText: '输入关键词',
  161. filterNoResultText: '未找到匹配的 API',
  162. },
  163. },
  164. ],
  165. socialLinks: [
  166. {
  167. icon: 'github',
  168. mode: 'link',
  169. content: 'https://github.com/bytedance/flowgram.ai',
  170. },
  171. {
  172. icon: 'discord',
  173. mode: 'link',
  174. content: 'https://discord.gg/SwDWdrgA9f',
  175. },
  176. {
  177. icon: 'X',
  178. mode: 'link',
  179. content: 'https://x.com/FlowGramAI',
  180. },
  181. ],
  182. },
  183. });