rspress.config.ts 5.0 KB

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