rspress.config.ts 4.9 KB

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