@rspress/core 2.0.0-rc.0 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/bin/rspress.js +1 -1
  2. package/dist/0~7675.989ee664.js +1791 -0
  3. package/dist/1218.3869bad6.js +2 -0
  4. package/dist/4669.12208c6a.js +2 -0
  5. package/dist/5313.6594aba0.js +63 -0
  6. package/dist/5485.2a0273cf.js +98 -0
  7. package/dist/6289.c67fe0d5.js +5 -0
  8. package/dist/7805.cadab34e.js +4 -0
  9. package/dist/8813.9da1f210.js +2 -0
  10. package/dist/cli/config/index.js +4 -0
  11. package/dist/cli/config/loadConfigFile.js +30 -0
  12. package/dist/cli/index.cb89dbd1.js +3 -0
  13. package/dist/cli/index.js +122 -0
  14. package/dist/eject-theme/components/Banner/index.tsx +3 -4
  15. package/dist/eject-theme/components/Button/index.scss +1 -6
  16. package/dist/eject-theme/components/Callout/index.scss +0 -2
  17. package/dist/eject-theme/components/CodeBlock/index.scss +4 -12
  18. package/dist/eject-theme/components/CodeBlock/index.tsx +6 -1
  19. package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -3
  20. package/dist/eject-theme/components/CodeButtonGroup/index.scss +5 -1
  21. package/dist/eject-theme/components/CodeButtonGroup/index.tsx +1 -3
  22. package/dist/eject-theme/components/DocContent/doc.scss +30 -9
  23. package/dist/eject-theme/components/DocContent/docComponents/table.tsx +10 -4
  24. package/dist/eject-theme/components/DocContent/index.tsx +5 -2
  25. package/dist/eject-theme/components/{DocContent/FallbackHeading.tsx → FallbackHeading/index.tsx} +20 -11
  26. package/dist/eject-theme/components/HoverGroup/index.scss +5 -1
  27. package/dist/eject-theme/components/HoverGroup/index.tsx +5 -1
  28. package/dist/eject-theme/components/Link/index.tsx +43 -9
  29. package/dist/eject-theme/components/Link/useLinkNavigate.ts +32 -16
  30. package/dist/eject-theme/components/Nav/NavMenu.scss +1 -0
  31. package/dist/eject-theme/components/Nav/NavMenu.tsx +2 -3
  32. package/dist/eject-theme/components/Nav/NavTitle.scss +11 -0
  33. package/dist/eject-theme/components/Nav/NavTitle.tsx +1 -0
  34. package/dist/eject-theme/components/Nav/index.scss +0 -8
  35. package/dist/eject-theme/components/NavHamburger/index.tsx +3 -4
  36. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +14 -0
  37. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +2 -3
  38. package/dist/eject-theme/components/Outline/index.scss +0 -1
  39. package/dist/eject-theme/components/Overview/OverviewGroup.tsx +1 -2
  40. package/dist/eject-theme/components/Overview/index.tsx +6 -2
  41. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +12 -0
  42. package/dist/eject-theme/components/PrevNextPage/index.tsx +6 -3
  43. package/dist/eject-theme/components/Root/index.tsx +58 -0
  44. package/dist/eject-theme/components/Search/NoSearchResult.tsx +2 -3
  45. package/dist/eject-theme/components/Search/SearchButton.tsx +3 -4
  46. package/dist/eject-theme/components/Search/SearchPanel.tsx +14 -9
  47. package/dist/eject-theme/components/Search/SuggestItem.tsx +15 -12
  48. package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +2 -3
  49. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +12 -8
  50. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +6 -4
  51. package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +1 -1
  52. package/dist/eject-theme/components/SidebarMenu/index.tsx +4 -4
  53. package/dist/eject-theme/components/SocialLinks/index.tsx +2 -3
  54. package/dist/eject-theme/components/SourceCode/index.scss +2 -1
  55. package/dist/eject-theme/components/SourceCode/index.tsx +6 -4
  56. package/dist/eject-theme/components/SwitchAppearance/index.tsx +3 -5
  57. package/dist/eject-theme/components/Tabs/index.scss +19 -22
  58. package/dist/eject-theme/components/Toc/TocItem.scss +8 -4
  59. package/dist/eject-theme/components/Toc/TocItem.tsx +1 -0
  60. package/dist/index.d.ts +6 -6
  61. package/dist/index.js +16 -3134
  62. package/dist/node/PluginDriver.d.ts +1 -1
  63. package/dist/node/PluginDriver.js +143 -0
  64. package/dist/node/auto-nav-sidebar/index.js +44 -0
  65. package/dist/node/auto-nav-sidebar/locales.js +26 -0
  66. package/dist/node/auto-nav-sidebar/normalize.js +228 -0
  67. package/dist/node/auto-nav-sidebar/utils.js +68 -0
  68. package/dist/node/auto-nav-sidebar/walk.js +67 -0
  69. package/dist/node/build.js +31 -0
  70. package/dist/node/constants.d.ts +1 -0
  71. package/dist/node/constants.js +33 -0
  72. package/dist/node/dev.js +32 -0
  73. package/dist/node/eject.js +111 -0
  74. package/dist/node/index.d.ts +5 -5
  75. package/dist/node/initRsbuild.d.ts +2 -2
  76. package/dist/node/initRsbuild.js +338 -0
  77. package/dist/node/last-updated/index.js +28 -0
  78. package/dist/node/logger/hint.d.ts +1 -1
  79. package/dist/node/logger/hint.js +85 -0
  80. package/dist/node/mdx/loader.d.ts +1 -1
  81. package/dist/node/mdx/loader.e1578c62.js +13 -0
  82. package/dist/{loader.js → node/mdx/loader.js} +2 -2
  83. package/dist/node/mdx/options.d.ts +2 -2
  84. package/dist/node/mdx/options.js +100 -0
  85. package/dist/node/mdx/processor.d.ts +2 -2
  86. package/dist/node/mdx/processor.js +71 -0
  87. package/dist/node/mdx/rehypePlugins/codeMeta.js +10 -0
  88. package/dist/node/mdx/rehypePlugins/headerAnchor.js +53 -0
  89. package/dist/node/mdx/rehypePlugins/shiki.js +34 -0
  90. package/dist/node/mdx/rehypePlugins/transformers/add-lang.js +15 -0
  91. package/dist/node/mdx/rehypePlugins/transformers/add-line-numbers.js +22 -0
  92. package/dist/node/mdx/rehypePlugins/transformers/add-title.js +24 -0
  93. package/dist/node/mdx/rehypePlugins/transformers/add-wrap-code.js +22 -0
  94. package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +5 -5
  95. package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -0
  96. package/dist/node/mdx/rehypePlugins/transformers/meta-highlight.js +41 -0
  97. package/dist/node/mdx/remarkPlugins/builtin.js +11 -0
  98. package/dist/node/mdx/remarkPlugins/containerSyntax.js +190 -0
  99. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +66 -0
  100. package/dist/node/mdx/remarkPlugins/image.js +67 -0
  101. package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
  102. package/dist/node/mdx/remarkPlugins/link.js +99 -0
  103. package/dist/node/mdx/remarkPlugins/toc.js +50 -0
  104. package/dist/node/mdx/types.d.ts +3 -3
  105. package/dist/node/medium-zoom/index.d.ts +1 -1
  106. package/dist/node/medium-zoom/index.js +14 -0
  107. package/dist/node/route/RoutePage.d.ts +1 -1
  108. package/dist/node/route/RoutePage.js +61 -0
  109. package/dist/node/route/RouteService.d.ts +1 -1
  110. package/dist/node/route/RouteService.js +177 -0
  111. package/dist/node/route/extractPageData.d.ts +1 -1
  112. package/dist/node/route/extractPageData.js +112 -0
  113. package/dist/node/route/normalizeRoutePath.js +54 -0
  114. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +21 -0
  115. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +150 -0
  116. package/dist/node/runtimeModule/globalStyles.d.ts +1 -1
  117. package/dist/node/runtimeModule/globalStyles.js +12 -0
  118. package/dist/node/runtimeModule/globalUIComponents.d.ts +1 -1
  119. package/dist/node/runtimeModule/globalUIComponents.js +25 -0
  120. package/dist/node/runtimeModule/i18n.d.ts +2 -2
  121. package/dist/node/runtimeModule/i18n.js +83 -0
  122. package/dist/node/runtimeModule/pageData/createPageData.d.ts +1 -1
  123. package/dist/node/runtimeModule/pageData/createPageData.js +64 -0
  124. package/dist/node/runtimeModule/pageData/rsbuildPlugin.d.ts +1 -1
  125. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +51 -0
  126. package/dist/node/runtimeModule/routeList.d.ts +1 -1
  127. package/dist/node/runtimeModule/routeList.js +7 -0
  128. package/dist/node/runtimeModule/searchHooks.d.ts +1 -1
  129. package/dist/node/runtimeModule/searchHooks.js +11 -0
  130. package/dist/node/runtimeModule/siteData/createSiteData.js +34 -0
  131. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +94 -0
  132. package/dist/node/runtimeModule/siteData/rsbuildPlugin.d.ts +1 -1
  133. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +24 -0
  134. package/dist/node/runtimeModule/socialLinks.d.ts +1 -1
  135. package/dist/node/runtimeModule/socialLinks.js +8 -0
  136. package/dist/node/runtimeModule/types.d.ts +2 -2
  137. package/dist/node/serve.js +23 -0
  138. package/dist/node/ssg/renderHtmlTemplate.js +33 -0
  139. package/dist/node/ssg/renderPage.js +34 -0
  140. package/dist/node/ssg/renderPageWorker.474f9f73.js +2 -0
  141. package/dist/node/ssg/renderPageWorker.js +15 -0
  142. package/dist/node/ssg/renderPages.d.ts +1 -1
  143. package/dist/node/ssg/renderPages.js +105 -0
  144. package/dist/node/ssg/renderPages.js.LICENSE.txt +4 -0
  145. package/dist/node/ssg/rsbuildPluginCSR.d.ts +1 -1
  146. package/dist/node/ssg/rsbuildPluginCSR.js +27 -0
  147. package/dist/node/ssg/rsbuildPluginSSG.d.ts +1 -1
  148. package/dist/node/ssg/rsbuildPluginSSG.js +72 -0
  149. package/dist/node/ssg/ssgEnv.js +33 -0
  150. package/dist/node/ssg/ssgEnv.js.LICENSE.txt +5 -0
  151. package/dist/node/ssg-md/llms/emitLlmsTxt.d.ts +1 -1
  152. package/dist/node/ssg-md/llms/emitLlmsTxt.js +80 -0
  153. package/dist/node/ssg-md/llms/llmsTxt.d.ts +1 -1
  154. package/dist/node/ssg-md/llms/llmsTxt.js +66 -0
  155. package/dist/node/ssg-md/react/index.d.ts +1 -1
  156. package/dist/node/ssg-md/remarkSplitMdx.js +202 -0
  157. package/dist/node/ssg-md/renderPage.js +31 -0
  158. package/dist/node/ssg-md/renderPages.d.ts +1 -1
  159. package/dist/node/ssg-md/renderPages.js +27 -0
  160. package/dist/node/ssg-md/rsbuildPluginSSGMD.d.ts +1 -1
  161. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +47 -0
  162. package/dist/node/utils/applyReplaceRules.js +6 -0
  163. package/dist/node/utils/checkLanguageParity.js +77 -0
  164. package/dist/node/utils/createHash.js +5 -0
  165. package/dist/node/utils/error.d.ts +9 -0
  166. package/dist/node/utils/error.js +9 -0
  167. package/dist/node/utils/escapeHeadingIds.js +5 -0
  168. package/dist/node/utils/flattenMdxContent.js +74 -0
  169. package/dist/node/utils/fs.js +14 -0
  170. package/dist/node/utils/getImportAstNode.js +63 -0
  171. package/dist/node/utils/getPageKey.js +6 -0
  172. package/dist/node/utils/getSocialIcons.js +32 -0
  173. package/dist/node/utils/index.d.ts +10 -9
  174. package/dist/node/utils/normalizePath.js +10 -0
  175. package/dist/node/utils/reactAlias.d.ts +2 -0
  176. package/dist/node/utils/reactAlias.js +83 -0
  177. package/dist/rslib-runtime.99091bf6.js +18 -0
  178. package/dist/runtime/App.js +2 -2
  179. package/dist/runtime/ClientApp.d.ts +1 -1
  180. package/dist/runtime/ClientApp.js +0 -4
  181. package/dist/runtime/ssrMdServerEntry.js +1 -1
  182. package/dist/runtime/ssrServerEntry.js +2 -1
  183. package/dist/runtime.72d450ac.js +1 -0
  184. package/dist/runtime.js +3 -2
  185. package/dist/shiki-transformers.d.ts +1 -1
  186. package/dist/shiki-transformers.js +6 -120
  187. package/dist/theme/assets/moon.js +9 -26
  188. package/dist/theme/components/Banner/index.d.ts +1 -1
  189. package/dist/theme/components/Banner/index.js +2 -3
  190. package/dist/theme/components/Button/index.css +1 -1
  191. package/dist/theme/components/Callout/index.css +0 -2
  192. package/dist/theme/components/CodeBlock/index.css +4 -15
  193. package/dist/theme/components/CodeBlock/index.js +1 -0
  194. package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +3 -5
  195. package/dist/theme/components/CodeButtonGroup/index.css +5 -1
  196. package/dist/theme/components/CodeButtonGroup/index.js +3 -5
  197. package/dist/theme/components/DocContent/doc.css +30 -8
  198. package/dist/theme/components/DocContent/docComponents/index.d.ts +3 -3
  199. package/dist/theme/components/DocContent/docComponents/table.d.ts +2 -2
  200. package/dist/theme/components/DocContent/docComponents/table.js +8 -3
  201. package/dist/theme/components/DocContent/index.js +3 -2
  202. package/dist/theme/components/{DocContent/FallbackHeading.js → FallbackHeading/index.js} +19 -11
  203. package/dist/theme/components/HoverGroup/index.css +5 -1
  204. package/dist/theme/components/HoverGroup/index.js +1 -0
  205. package/dist/theme/components/HoverGroup/useHoverGroup.d.ts +1 -1
  206. package/dist/theme/components/Link/index.d.ts +18 -1
  207. package/dist/theme/components/Link/index.js +14 -8
  208. package/dist/theme/components/Link/useLinkNavigate.d.ts +4 -1
  209. package/dist/theme/components/Link/useLinkNavigate.js +23 -17
  210. package/dist/theme/components/Nav/NavMenu.css +1 -0
  211. package/dist/theme/components/Nav/NavMenu.js +2 -3
  212. package/dist/theme/components/Nav/NavTitle.css +12 -0
  213. package/dist/theme/components/Nav/NavTitle.d.ts +1 -0
  214. package/dist/theme/components/Nav/NavTitle.js +1 -0
  215. package/dist/theme/components/Nav/index.css +0 -8
  216. package/dist/theme/components/NavHamburger/index.js +3 -4
  217. package/dist/theme/components/NavScreen/NavScreenMenuItem.css +9 -0
  218. package/dist/theme/components/NavScreen/NavScreenMenuItem.js +2 -3
  219. package/dist/theme/components/Outline/index.css +0 -1
  220. package/dist/theme/components/Overview/OverviewGroup.js +1 -2
  221. package/dist/theme/components/Overview/index.js +1 -2
  222. package/dist/theme/components/PackageManagerTabs/index.d.ts +1 -1
  223. package/dist/theme/components/PackageManagerTabs/index.js +4 -0
  224. package/dist/theme/components/PrevNextPage/index.js +3 -4
  225. package/dist/theme/components/Root/index.d.ts +54 -0
  226. package/dist/theme/components/Root/index.js +7 -0
  227. package/dist/theme/components/Search/NoSearchResult.js +2 -3
  228. package/dist/theme/components/Search/SearchButton.js +3 -4
  229. package/dist/theme/components/Search/SearchPanel.js +13 -16
  230. package/dist/theme/components/Search/SuggestItem.d.ts +1 -1
  231. package/dist/theme/components/Search/SuggestItem.js +7 -11
  232. package/dist/theme/components/Search/logic/Provider.d.ts +1 -1
  233. package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +2 -2
  234. package/dist/theme/components/Search/logic/search.d.ts +1 -1
  235. package/dist/theme/components/Sidebar/SidebarGroup.js +2 -3
  236. package/dist/theme/components/Sidebar/SidebarItem.css +11 -3
  237. package/dist/theme/components/Sidebar/SidebarItem.js +6 -3
  238. package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -1
  239. package/dist/theme/components/SidebarMenu/index.js +3 -5
  240. package/dist/theme/components/SocialLinks/index.js +2 -3
  241. package/dist/theme/components/SourceCode/index.css +5 -0
  242. package/dist/theme/components/SourceCode/index.js +2 -4
  243. package/dist/theme/components/SwitchAppearance/index.js +3 -5
  244. package/dist/theme/components/Tabs/index.css +13 -22
  245. package/dist/theme/components/Toc/TocItem.css +7 -4
  246. package/dist/theme/components/Toc/TocItem.js +1 -0
  247. package/dist/theme/icons.d.ts +25 -0
  248. package/dist/theme/icons.js +47 -0
  249. package/dist/theme/index.d.ts +62 -59
  250. package/dist/theme/index.js +5 -2
  251. package/dist/theme/layout/DocLayout/index.css +2 -2
  252. package/dist/theme/layout/DocLayout/index.js +1 -4
  253. package/dist/theme/layout/Layout/index.d.ts +1 -1
  254. package/dist/theme/layout/Layout/index.js +3 -3
  255. package/dist/theme/logic/useFullTextSearch.d.ts +1 -1
  256. package/dist/theme/logic/useScrollAfterNav.d.ts +5 -0
  257. package/dist/theme/logic/{sideEffects.js → useScrollAfterNav.js} +5 -6
  258. package/dist/theme/logic/useScrollReset.d.ts +5 -0
  259. package/dist/theme/logic/useScrollReset.js +12 -0
  260. package/dist/theme/logic/useSetup.js +2 -0
  261. package/dist/theme/styles/base.css +1 -10
  262. package/dist/theme/styles/index.d.ts +1 -1
  263. package/dist/theme/styles/index.js +1 -1
  264. package/dist/theme/styles/scrollbar.css +1 -0
  265. package/dist/theme/styles/vars/base-vars.css +5 -3
  266. package/dist/theme/styles/vars/home-vars.css +4 -2
  267. package/package.json +19 -20
  268. package/dist/3~101.js +0 -1786
  269. package/dist/3~335.js +0 -26
  270. package/dist/3~395.js +0 -74
  271. package/dist/cli.js +0 -259
  272. package/dist/index.js.LICENSE.txt +0 -10
  273. package/dist/node/auto-nav-sidebar/fixtures/docs/guide/c.d.ts +0 -2
  274. package/dist/node/auto-nav-sidebar/fixtures/docs-locales/en/guide/c.d.ts +0 -2
  275. package/dist/node/auto-nav-sidebar/fixtures/docs-locales/zh/guide/c.d.ts +0 -2
  276. package/dist/node/auto-nav-sidebar/locales.test.d.ts +0 -1
  277. package/dist/node/auto-nav-sidebar/walk.test.d.ts +0 -1
  278. package/dist/node/mdx/rehypePlugins/headerAnchor.test.d.ts +0 -1
  279. package/dist/node/mdx/remarkPlugins/containerSyntax.test.d.ts +0 -1
  280. package/dist/node/mdx/remarkPlugins/fileCodeBlock.test.d.ts +0 -1
  281. package/dist/node/mdx/remarkPlugins/image.test.d.ts +0 -1
  282. package/dist/node/mdx/remarkPlugins/link.test.d.ts +0 -1
  283. package/dist/node/route/RouteService.test.d.ts +0 -1
  284. package/dist/node/route/extractPageData.test.d.ts +0 -1
  285. package/dist/node/route/fixtures/basic/guide/c.d.ts +0 -2
  286. package/dist/node/route/normalizeRoutePath.test.d.ts +0 -1
  287. package/dist/node/runtimeModule/i18n.test.d.ts +0 -1
  288. package/dist/node/ssg-md/remarkSplitMdx.test.d.ts +0 -4
  289. package/dist/node/utils/checkLanguageParity.test.d.ts +0 -1
  290. package/dist/node/utils/detectCustomIcon.d.ts +0 -1
  291. package/dist/node/utils/detectReactVersion.d.ts +0 -3
  292. package/dist/processor.js +0 -4539
  293. package/dist/renderPageWorker.js +0 -196
  294. package/dist/theme/components/Search/logic/util.test.d.ts +0 -1
  295. /package/dist/cli/{config.d.ts → config/index.d.ts} +0 -0
  296. /package/dist/{shiki-transformers.js.LICENSE.txt → node/mdx/rehypePlugins/transformers/meta-highlight.js.LICENSE.txt} +0 -0
  297. /package/dist/theme/components/{DocContent/FallbackHeading.d.ts → FallbackHeading/index.d.ts} +0 -0
  298. /package/dist/theme/logic/{sideEffects.d.ts → useSetup.d.ts} +0 -0
@@ -0,0 +1,74 @@
1
+ import { node_fs, core_rspack } from "../../5313.6594aba0.js";
2
+ import { node_path, logger } from "../../6289.c67fe0d5.js";
3
+ import { createProcessor } from "../../7805.cadab34e.js";
4
+ import { MDX_OR_MD_REGEXP } from "../../4669.12208c6a.js";
5
+ import { createError } from "./error.js";
6
+ import { importStatementRegex } from "../constants.js";
7
+ const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
8
+ let startFlatten = false;
9
+ let resolver;
10
+ const processor = createProcessor();
11
+ async function resolveDepPath(moduleSpecifier, importer, alias) {
12
+ if (!resolver) resolver = new RspackResolveFactory({
13
+ extensions: [
14
+ '.mdx',
15
+ '.md'
16
+ ],
17
+ alias
18
+ });
19
+ const resolved = await resolver.async(importer, moduleSpecifier);
20
+ if (resolved.path) return resolved.path;
21
+ throw createError(`Empty result when resolving ${moduleSpecifier} from ${importer}`);
22
+ }
23
+ async function flattenMdxContent(content, basePath, alias) {
24
+ const deps = [];
25
+ const regex = new RegExp(importStatementRegex);
26
+ if (!regex.test(content)) return {
27
+ flattenContent: content,
28
+ deps
29
+ };
30
+ if (!startFlatten) {
31
+ resolver = new RspackResolveFactory({
32
+ extensions: [
33
+ '.mdx',
34
+ '.md',
35
+ '.js'
36
+ ],
37
+ alias
38
+ });
39
+ startFlatten = true;
40
+ }
41
+ let ast;
42
+ let result = content;
43
+ try {
44
+ ast = processor.parse(content);
45
+ } catch (e) {
46
+ logger.debug('flattenMdxContent parse failed: \n', e);
47
+ return {
48
+ flattenContent: content,
49
+ deps
50
+ };
51
+ }
52
+ const importNodes = ast.children.filter((node)=>'mdxjsEsm' === node.type).flatMap((node)=>node.data?.estree?.body || []).filter((node)=>'ImportDeclaration' === node.type);
53
+ for (const importNode of importNodes){
54
+ const id = importNode.specifiers[0].local.name;
55
+ const importPath = importNode.source.value;
56
+ let absoluteImportPath;
57
+ try {
58
+ absoluteImportPath = await resolveDepPath(importPath, node_path.dirname(basePath), alias);
59
+ } catch (_e) {
60
+ continue;
61
+ }
62
+ if (MDX_OR_MD_REGEXP.test(absoluteImportPath)) {
63
+ const importedContent = node_fs.readFileSync(absoluteImportPath, 'utf-8');
64
+ const { flattenContent: replacedValue, deps: subDeps } = await flattenMdxContent(importedContent, absoluteImportPath, alias);
65
+ result = result.replace(new RegExp(`import\\s+${id}\\s+from\\s+['"](${importPath})['"];?`), '').replace(new RegExp(`<${id}\\s*/>`, 'g'), ()=>replacedValue);
66
+ deps.push(...subDeps, absoluteImportPath);
67
+ }
68
+ }
69
+ return {
70
+ flattenContent: result,
71
+ deps
72
+ };
73
+ }
74
+ export { flattenMdxContent, resolveDepPath };
@@ -0,0 +1,14 @@
1
+ import { promises } from "../../6289.c67fe0d5.js";
2
+ async function pathExists(path) {
3
+ try {
4
+ await promises.access(path);
5
+ return true;
6
+ } catch {
7
+ return false;
8
+ }
9
+ }
10
+ async function readJson(path) {
11
+ const raw = await promises.readFile(path, 'utf8');
12
+ return JSON.parse(raw);
13
+ }
14
+ export { pathExists, readJson };
@@ -0,0 +1,63 @@
1
+ const getDefaultImportAstNode = (name, from)=>({
2
+ type: 'mdxjsEsm',
3
+ value: `import ${name} from ${JSON.stringify(from)}`,
4
+ data: {
5
+ estree: {
6
+ type: 'Program',
7
+ sourceType: 'module',
8
+ body: [
9
+ {
10
+ type: 'ImportDeclaration',
11
+ specifiers: [
12
+ {
13
+ type: 'ImportDefaultSpecifier',
14
+ local: {
15
+ type: 'Identifier',
16
+ name
17
+ }
18
+ }
19
+ ],
20
+ source: {
21
+ type: 'Literal',
22
+ value: from,
23
+ raw: `${JSON.stringify(from)}`
24
+ }
25
+ }
26
+ ]
27
+ }
28
+ }
29
+ });
30
+ const getNamedImportAstNode = (name, alias, from)=>({
31
+ type: 'mdxjsEsm',
32
+ value: `import { ${name} as ${alias} } from ${JSON.stringify(from)}`,
33
+ data: {
34
+ estree: {
35
+ type: 'Program',
36
+ sourceType: 'module',
37
+ body: [
38
+ {
39
+ type: 'ImportDeclaration',
40
+ specifiers: [
41
+ {
42
+ type: 'ImportSpecifier',
43
+ imported: {
44
+ type: 'Identifier',
45
+ name
46
+ },
47
+ local: {
48
+ type: 'Identifier',
49
+ name: alias
50
+ }
51
+ }
52
+ ],
53
+ source: {
54
+ type: 'Literal',
55
+ value: from,
56
+ raw: `${JSON.stringify(from)}`
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ });
63
+ export { getDefaultImportAstNode, getNamedImportAstNode };
@@ -0,0 +1,6 @@
1
+ import { removeLeadingSlash } from "../../4669.12208c6a.js";
2
+ function getPageKey(route) {
3
+ const cleanRoute = removeLeadingSlash(route);
4
+ return cleanRoute.replace(/\//g, '_').replace(/\.[^.]+$/, '') || 'index';
5
+ }
6
+ export { getPageKey };
@@ -0,0 +1,32 @@
1
+ import { createError } from "./error.js";
2
+ const presetIcons = {
3
+ discord: '<path fill="currentColor" d="M20.317 4.37a19.8 19.8 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.3 18.3 0 0 0-5.487 0a13 13 0 0 0-.617-1.25a.08.08 0 0 0-.079-.037A19.7 19.7 0 0 0 3.677 4.37a.1.1 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.08.08 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.08.08 0 0 0 .084-.028a14 14 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13 13 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10 10 0 0 0 .372-.292a.07.07 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.07.07 0 0 1 .078.01q.181.149.373.292a.077.077 0 0 1-.006.127a12.3 12.3 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.08.08 0 0 0 .084.028a19.8 19.8 0 0 0 6.002-3.03a.08.08 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.06.06 0 0 0-.031-.03M8.02 15.33c-1.182 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418m7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418"/>',
4
+ facebook: '<path fill="currentColor" d="M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978c.401 0 .955.042 1.468.103a9 9 0 0 1 1.141.195v3.325a9 9 0 0 0-.653-.036a27 27 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.7 1.7 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103l-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647"/>',
5
+ github: '<path fill="currentColor" d="M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>',
6
+ gitlab: '<path fill="currentColor" d="m23.6 9.593l-.033-.086L20.3.98a.85.85 0 0 0-.336-.405a.875.875 0 0 0-1 .054a.9.9 0 0 0-.29.44L16.47 7.818H7.537L5.333 1.07a.86.86 0 0 0-.29-.441a.875.875 0 0 0-1-.054a.86.86 0 0 0-.336.405L.433 9.502l-.032.086a6.066 6.066 0 0 0 2.012 7.01l.01.009l.03.021l4.977 3.727l2.462 1.863l1.5 1.132a1.01 1.01 0 0 0 1.22 0l1.499-1.132l2.461-1.863l5.006-3.75l.013-.01a6.07 6.07 0 0 0 2.01-7.002"/>',
7
+ instagram: '<path fill="currentColor" d="M7.03.084c-1.277.06-2.149.264-2.91.563a5.9 5.9 0 0 0-2.124 1.388a5.9 5.9 0 0 0-1.38 2.127C.321 4.926.12 5.8.064 7.076s-.069 1.688-.063 4.947s.021 3.667.083 4.947c.061 1.277.264 2.149.563 2.911c.308.789.72 1.457 1.388 2.123a5.9 5.9 0 0 0 2.129 1.38c.763.295 1.636.496 2.913.552c1.278.056 1.689.069 4.947.063s3.668-.021 4.947-.082c1.28-.06 2.147-.265 2.91-.563a5.9 5.9 0 0 0 2.123-1.388a5.9 5.9 0 0 0 1.38-2.129c.295-.763.496-1.636.551-2.912c.056-1.28.07-1.69.063-4.948c-.006-3.258-.02-3.667-.081-4.947c-.06-1.28-.264-2.148-.564-2.911a5.9 5.9 0 0 0-1.387-2.123a5.9 5.9 0 0 0-2.128-1.38c-.764-.294-1.636-.496-2.914-.55C15.647.009 15.236-.006 11.977 0S8.31.021 7.03.084m.14 21.693c-1.17-.05-1.805-.245-2.228-.408a3.7 3.7 0 0 1-1.382-.895a3.7 3.7 0 0 1-.9-1.378c-.165-.423-.363-1.058-.417-2.228c-.06-1.264-.072-1.644-.08-4.848c-.006-3.204.006-3.583.061-4.848c.05-1.169.246-1.805.408-2.228c.216-.561.477-.96.895-1.382a3.7 3.7 0 0 1 1.379-.9c.423-.165 1.057-.361 2.227-.417c1.265-.06 1.644-.072 4.848-.08c3.203-.006 3.583.006 4.85.062c1.168.05 1.804.244 2.227.408c.56.216.96.475 1.382.895s.681.817.9 1.378c.165.422.362 1.056.417 2.227c.06 1.265.074 1.645.08 4.848c.005 3.203-.006 3.583-.061 4.848c-.051 1.17-.245 1.805-.408 2.23c-.216.56-.477.96-.896 1.38a3.7 3.7 0 0 1-1.378.9c-.422.165-1.058.362-2.226.418c-1.266.06-1.645.072-4.85.079s-3.582-.006-4.848-.06m9.783-16.192a1.44 1.44 0 1 0 1.437-1.442a1.44 1.44 0 0 0-1.437 1.442M5.839 12.012a6.161 6.161 0 1 0 12.323-.024a6.162 6.162 0 0 0-12.323.024M8 12.008A4 4 0 1 1 12.008 16A4 4 0 0 1 8 12.008"/>',
8
+ linkedin: '<path fill="currentColor" d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037c-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85c3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.06 2.06 0 0 1-2.063-2.065a2.064 2.064 0 1 1 2.063 2.065m1.782 13.019H3.555V9h3.564zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0z"/>',
9
+ slack: '<path fill="currentColor" d="M5.042 15.165a2.53 2.53 0 0 1-2.52 2.523A2.53 2.53 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52a2.527 2.527 0 0 1 2.521 2.52v6.313A2.53 2.53 0 0 1 8.834 24a2.53 2.53 0 0 1-2.521-2.522zM8.834 5.042a2.53 2.53 0 0 1-2.521-2.52A2.53 2.53 0 0 1 8.834 0a2.53 2.53 0 0 1 2.521 2.522v2.52zm0 1.271a2.53 2.53 0 0 1 2.521 2.521a2.53 2.53 0 0 1-2.521 2.521H2.522A2.53 2.53 0 0 1 0 8.834a2.53 2.53 0 0 1 2.522-2.521zm10.122 2.521a2.53 2.53 0 0 1 2.522-2.521A2.53 2.53 0 0 1 24 8.834a2.53 2.53 0 0 1-2.522 2.521h-2.522zm-1.268 0a2.53 2.53 0 0 1-2.523 2.521a2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.53 2.53 0 0 1 2.523 2.522zm-2.523 10.122a2.53 2.53 0 0 1 2.523 2.522A2.53 2.53 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522zm0-1.268a2.527 2.527 0 0 1-2.52-2.523a2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.53 2.53 0 0 1-2.522 2.523z"/>',
10
+ youtube: '<path fill="currentColor" d="M23.498 6.186a3.02 3.02 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.02 3.02 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.02 3.02 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.02 3.02 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814M9.545 15.568V8.432L15.818 12z"/>',
11
+ juejin: '<path fill="currentColor" d="m12 14.316l7.454-5.88l-2.022-1.625L12 11.1l-.004.003l-5.432-4.288l-2.02 1.624l7.452 5.88Zm0-7.247l2.89-2.298L12 2.453l-.004-.005l-2.884 2.318l2.884 2.3Zm0 11.266l-.005.002l-9.975-7.87L0 12.088l.194.156l11.803 9.308l7.463-5.885L24 12.085l-2.023-1.624Z"/>',
12
+ qq: '<path fill="currentColor" d="M21.395 15.035a40 40 0 0 0-.803-2.264l-1.079-2.695c.001-.032.014-.562.014-.836C19.526 4.632 17.351 0 12 0S4.474 4.632 4.474 9.241c0 .274.013.804.014.836l-1.08 2.695a39 39 0 0 0-.802 2.264c-1.021 3.283-.69 4.643-.438 4.673c.54.065 2.103-2.472 2.103-2.472c0 1.469.756 3.387 2.394 4.771c-.612.188-1.363.479-1.845.835c-.434.32-.379.646-.301.778c.343.578 5.883.369 7.482.189c1.6.18 7.14.389 7.483-.189c.078-.132.132-.458-.301-.778c-.483-.356-1.233-.646-1.846-.836c1.637-1.384 2.393-3.302 2.393-4.771c0 0 1.563 2.537 2.103 2.472c.251-.03.581-1.39-.438-4.673"/>',
13
+ wechat: '<path fill="currentColor" d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213c0 .163.13.295.29.295a.33.33 0 0 0 .167-.054l1.903-1.114a.86.86 0 0 1 .717-.098a10.2 10.2 0 0 0 2.837.403c.276 0 .543-.027.811-.05c-.857-2.578.157-4.972 1.932-6.446c1.703-1.415 3.882-1.98 5.853-1.838c-.576-3.583-4.196-6.348-8.596-6.348M5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178a1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18m5.34 2.867c-1.797-.052-3.746.512-5.28 1.786c-1.72 1.428-2.687 3.72-1.78 6.22c.942 2.453 3.666 4.229 6.884 4.229c.826 0 1.622-.12 2.361-.336a.72.72 0 0 1 .598.082l1.584.926a.3.3 0 0 0 .14.047c.134 0 .24-.111.24-.247c0-.06-.023-.12-.038-.177l-.327-1.233a.6.6 0 0 1-.023-.156a.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983a.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983a.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982"/>',
14
+ weibo: '<path fill="currentColor" d="M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"/>',
15
+ zhihu: '<path fill="currentColor" d="M5.721 0C2.251 0 0 2.25 0 5.719V18.28C0 21.751 2.252 24 5.721 24h12.56C21.751 24 24 21.75 24 18.281V5.72C24 2.249 21.75 0 18.281 0zm1.964 4.078q-.408 1.096-.68 2.11h4.587c.545-.006.445 1.168.445 1.171H9.384a58 58 0 0 1-.112 3.797h2.712c.388.023.393 1.251.393 1.266H9.183a9.2 9.2 0 0 1-.408 2.102l.757-.604c.452.456 1.512 1.712 1.906 2.177c.473.681.063 2.081.063 2.081l-2.794-3.382c-.653 2.518-1.845 3.607-1.845 3.607c-.523.468-1.58.82-2.64.516c2.218-1.73 3.44-3.917 3.667-6.497H4.491c0-.015.197-1.243.806-1.266h2.71c.024-.32.086-3.254.086-3.797H6.598c-.136.406-.158.447-.268.753c-.594 1.095-1.603 1.122-1.907 1.155c.906-1.821 1.416-3.6 1.591-4.064c.425-1.124 1.671-1.125 1.671-1.125M13.078 6h6.377v11.33h-2.573l-2.184 1.373l-.401-1.373h-1.219zm1.313 1.219v8.86h.623l.263.937l1.455-.938h1.456v-8.86z"/>',
16
+ bilibili: '<path fill="currentColor" d="M17.813 4.653h.854q2.266.08 3.773 1.574Q23.946 7.72 24 9.987v7.36q-.054 2.266-1.56 3.773c-1.506 1.507-2.262 1.524-3.773 1.56H5.333q-2.266-.054-3.773-1.56C.053 19.614.036 18.858 0 17.347v-7.36q.054-2.267 1.56-3.76t3.773-1.574h.774l-1.174-1.12a1.23 1.23 0 0 1-.373-.906q0-.534.373-.907l.027-.027q.4-.373.92-.373t.92.373L9.653 4.44q.107.106.187.213h4.267a.8.8 0 0 1 .16-.213l2.853-2.747q.4-.373.92-.373c.347 0 .662.151.929.4s.391.551.391.907q0 .532-.373.906zM5.333 7.24q-1.12.027-1.88.773q-.76.748-.786 1.894v7.52q.026 1.146.786 1.893t1.88.773h13.334q1.12-.026 1.88-.773t.786-1.893v-7.52q-.026-1.147-.786-1.894t-1.88-.773zM8 11.107q.56 0 .933.373q.375.374.4.96v1.173q-.025.586-.4.96q-.373.375-.933.374c-.56-.001-.684-.125-.933-.374q-.375-.373-.4-.96V12.44q0-.56.386-.947q.387-.386.947-.386m8 0q.56 0 .933.373q.375.374.4.96v1.173q-.025.586-.4.96q-.373.375-.933.374c-.56-.001-.684-.125-.933-.374q-.375-.373-.4-.96V12.44q.025-.586.4-.96q.373-.373.933-.373"/>',
17
+ lark: '<path d="M6.14 3.8a28.88 28.88 0 0 1 6.6 7.63l1.7-1.67a8.37 8.37 0 0 1 2.82-1.83 12.23 12.23 0 0 0-2.32-4.28.67.67 0 0 0-.53-.25H6.28c-.21 0-.3.27-.14.4Z" fill="currentColor"></path><path d="m20.57 14.2.01-.02.04-.07-.05.08Z" fill="currentColor"></path><path d="M11.04 14.56c1.23.52 2.34.97 3.65 1.32a4.75 4.75 0 0 0 5.63-2.4l1.32-2.63c.3-.64.67-1.23 1.12-1.78a6.2 6.2 0 0 0-2.3-.44c-1.9 0-3.7.73-5.06 2.06l-2.02 2c-.72.7-1.5 1.33-2.34 1.87Z" fill="currentColor"></path><path d="M20.8 13.78v-.02l.01-.01s0 .02-.02.03Z" fill="currentColor"></path><path d="M1.63 9.75a.23.23 0 0 0-.4.16v7.96c0 .23.12.44.3.56a12.95 12.95 0 0 0 14.08.2c.78-.5 1.39-.92 2.04-1.55-1.05.3-2.2.33-3.37.01A28.99 28.99 0 0 1 1.63 9.75Z" fill="currentColor"></path>',
18
+ x: '<path fill="currentColor" d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584l-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/>',
19
+ bluesky: '<path fill="currentColor" d="M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565C.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479c.815 2.736 3.713 3.66 6.383 3.364q.204-.03.415-.056q-.207.033-.415.056c-3.912.58-7.387 2.005-2.83 7.078c5.013 5.19 6.87-1.113 7.823-4.308c.953 3.195 2.05 9.271 7.733 4.308c4.267-4.308 1.172-6.498-2.74-7.078a9 9 0 0 1-.415-.056q.21.026.415.056c2.67.297 5.568-.628 6.383-3.364c.246-.828.624-5.79.624-6.478c0-.69-.139-1.861-.902-2.206c-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8"/>',
20
+ npm: '<path fill="currentColor" d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019l-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/>'
21
+ };
22
+ const formatIconName = (icon)=>icon.toLowerCase();
23
+ function getSocialIcons(socialLinks = []) {
24
+ const icons = {};
25
+ for (const link of socialLinks)if ('string' == typeof link.icon) {
26
+ const pathContent = presetIcons[formatIconName(link.icon)];
27
+ if (!pathContent) throw createError(`Icon "${link.icon}" not found in preset icons.`);
28
+ icons[link.icon] = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 24 24">${pathContent}</svg>`;
29
+ }
30
+ return icons;
31
+ }
32
+ export { getSocialIcons };
@@ -1,9 +1,10 @@
1
- export * from './applyReplaceRules';
2
- export * from './createHash';
3
- export * from './detectReactVersion';
4
- export * from './escapeHeadingIds';
5
- export * from './flattenMdxContent';
6
- export * from './fs';
7
- export * from './getImportAstNode';
8
- export * from './getPageKey';
9
- export * from './normalizePath';
1
+ export * from './applyReplaceRules.js';
2
+ export * from './createHash.js';
3
+ export * from './error.js';
4
+ export * from './escapeHeadingIds.js';
5
+ export * from './flattenMdxContent.js';
6
+ export * from './fs.js';
7
+ export * from './getImportAstNode.js';
8
+ export * from './getPageKey.js';
9
+ export * from './normalizePath.js';
10
+ export * from './reactAlias.js';
@@ -0,0 +1,10 @@
1
+ import { node_os } from "../../7805.cadab34e.js";
2
+ import { node_path } from "../../6289.c67fe0d5.js";
3
+ const isWindows = 'win32' === node_os.platform();
4
+ function slash(p) {
5
+ return p.replace(/\\/g, '/');
6
+ }
7
+ function normalizePath(id) {
8
+ return node_path.posix.normalize(isWindows ? slash(id) : id);
9
+ }
10
+ export { isWindows, normalizePath, slash };
@@ -0,0 +1,2 @@
1
+ export declare function resolveReactRouterDomAlias(): Promise<Record<string, string>>;
2
+ export declare function resolveReactAlias(isSSR: boolean): Promise<Record<string, string>>;
@@ -0,0 +1,83 @@
1
+ import { node_path, logger, picocolors } from "../../6289.c67fe0d5.js";
2
+ import { core_rspack } from "../../5313.6594aba0.js";
3
+ import { pathExists, readJson } from "./fs.js";
4
+ import { PACKAGE_ROOT } from "../constants.js";
5
+ import { hintReactVersion } from "../logger/hint.js";
6
+ const Resolver = core_rspack.experiments.resolver.ResolverFactory;
7
+ async function detectPackageMajorVersion(name) {
8
+ const cwd = process.cwd();
9
+ const pkgPath = node_path.join(cwd, 'node_modules', name);
10
+ if (await pathExists(pkgPath)) {
11
+ const pkgJson = await readJson(node_path.join(pkgPath, 'package.json'));
12
+ const version = Number(pkgJson.version?.split('.')[0]);
13
+ return version;
14
+ }
15
+ }
16
+ async function resolveReactRouterDomAlias() {
17
+ const hasInstalled = await detectPackageMajorVersion('react-router-dom');
18
+ const basedir = hasInstalled ? process.cwd() : PACKAGE_ROOT;
19
+ const alias = {};
20
+ const resolver = new Resolver({
21
+ mainFields: [
22
+ 'browser',
23
+ 'module',
24
+ 'main'
25
+ ],
26
+ extensions: [
27
+ '.js'
28
+ ],
29
+ alias
30
+ });
31
+ try {
32
+ const resolved = await resolver.async(basedir, 'react-router-dom/package.json');
33
+ if (resolved.error) throw Error(resolved.error);
34
+ if (!resolved.path) throw Error("'react-router-dom' resolved to empty path");
35
+ return {
36
+ 'react-router-dom': node_path.dirname(resolved.path)
37
+ };
38
+ } catch (e) {
39
+ logger.warn('react-router-dom not found: \n', e);
40
+ }
41
+ return {};
42
+ }
43
+ async function resolveReactAlias(isSSR) {
44
+ const hasInstalled = await detectPackageMajorVersion('react');
45
+ const basedir = hasInstalled ? process.cwd() : PACKAGE_ROOT;
46
+ const libPaths = [
47
+ 'react',
48
+ 'react/jsx-runtime',
49
+ 'react/jsx-dev-runtime',
50
+ 'react/package.json',
51
+ 'react-dom',
52
+ 'react-dom/client',
53
+ 'react-dom/server',
54
+ 'react-dom/package.json'
55
+ ];
56
+ const alias = {};
57
+ const resolver = new Resolver({
58
+ extensions: [
59
+ '.js'
60
+ ],
61
+ alias,
62
+ conditionNames: isSSR ? [
63
+ '...'
64
+ ] : [
65
+ 'browser',
66
+ '...'
67
+ ]
68
+ });
69
+ await Promise.all(libPaths.map(async (lib)=>{
70
+ try {
71
+ const resolved = await resolver.async(basedir, lib);
72
+ if (resolved.error || !resolved.path) throw Error(resolved.error);
73
+ alias[lib] = resolved.path;
74
+ } catch (e) {
75
+ if (e instanceof Error) {
76
+ logger.warn(`${lib} not found: \n ${picocolors.gray(e.toString())}`);
77
+ hintReactVersion();
78
+ }
79
+ }
80
+ }));
81
+ return alias;
82
+ }
83
+ export { resolveReactAlias, resolveReactRouterDomAlias };
@@ -0,0 +1,18 @@
1
+ var __webpack_modules__ = {};
2
+ var __webpack_module_cache__ = {};
3
+ function __webpack_require__(moduleId) {
4
+ var cachedModule = __webpack_module_cache__[moduleId];
5
+ if (void 0 !== cachedModule) return cachedModule.exports;
6
+ var module = __webpack_module_cache__[moduleId] = {
7
+ exports: {}
8
+ };
9
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
+ return module.exports;
11
+ }
12
+ __webpack_require__.m = __webpack_modules__;
13
+ (()=>{
14
+ __webpack_require__.add = function(modules) {
15
+ Object.assign(__webpack_require__.m, modules);
16
+ };
17
+ })();
18
+ export { __webpack_require__ };
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Content, PageContext, useLocation } from "@rspress/core/runtime";
3
- import { Layout } from "@theme";
3
+ import { Layout, Root } from "@theme";
4
4
  import react, { useContext, useLayoutEffect } from "react";
5
5
  import virtual_global_components from "virtual-global-components";
6
6
  import { initPageData } from "./initPageData.js";
@@ -27,7 +27,7 @@ function App() {
27
27
  const query = new URLSearchParams(search);
28
28
  const hideGlobalUIComponents = false === frontmatter[GLOBAL_COMPONENTS_KEY] || "0" === query.get(GLOBAL_COMPONENTS_KEY);
29
29
  if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Content, {});
30
- return /*#__PURE__*/ jsxs(Fragment, {
30
+ return /*#__PURE__*/ jsxs(Root, {
31
31
  children: [
32
32
  /*#__PURE__*/ jsx(Layout, {}),
33
33
  !hideGlobalUIComponents && virtual_global_components.map((componentInfo, index)=>{
@@ -1,4 +1,4 @@
1
- import type { Page } from './initPageData';
1
+ import type { Page } from './initPageData.js';
2
2
  export declare function ClientApp({ initialPageData, }: {
3
3
  initialPageData?: Page;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -25,10 +25,6 @@ function ClientApp({ initialPageData = null }) {
25
25
  setData
26
26
  ]),
27
27
  children: /*#__PURE__*/ jsx(BrowserRouter, {
28
- future: {
29
- v7_relativeSplatPath: true,
30
- v7_startTransition: true
31
- },
32
28
  basename: removeTrailingSlash(withBase('/')),
33
29
  children: /*#__PURE__*/ jsx(UnheadProvider, {
34
30
  head: head,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { renderToMarkdownString } from "@rspress/core/_private/react";
3
3
  import { PageContext, ThemeContext, pathnameToRouteService, removeTrailingSlash, withBase } from "@rspress/runtime";
4
- import { StaticRouter } from "@rspress/runtime/server";
5
4
  import { UnheadProvider } from "@unhead/react/server";
5
+ import { StaticRouter } from "react-router-dom";
6
6
  import { App } from "./App.js";
7
7
  import { initPageData } from "./initPageData.js";
8
8
  import { routes } from "virtual-routes";
@@ -2,9 +2,9 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { text as consumers_text } from "node:stream/consumers";
4
4
  import { PageContext, ThemeContext, pathnameToRouteService, removeTrailingSlash, withBase } from "@rspress/core/runtime";
5
- import { StaticRouter } from "@rspress/runtime/server";
6
5
  import { UnheadProvider } from "@unhead/react/server";
7
6
  import { renderToPipeableStream } from "react-dom/server";
7
+ import { StaticRouter } from "react-router-dom";
8
8
  import { App } from "./App.js";
9
9
  import { initPageData } from "./initPageData.js";
10
10
  import { routes } from "virtual-routes";
@@ -17,6 +17,7 @@ function renderToHtml(app) {
17
17
  return new Promise((resolve, reject)=>{
18
18
  const passThrough = new PassThrough();
19
19
  const { pipe } = renderToPipeableStream(app, {
20
+ progressiveChunkSize: 1 / 0,
20
21
  onError (error) {
21
22
  reject(error);
22
23
  },
@@ -0,0 +1 @@
1
+ import "@rspress/runtime";
package/dist/runtime.js CHANGED
@@ -1,3 +1,4 @@
1
- import { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "@rspress/shared";
1
+ import "./runtime.72d450ac.js";
2
+ import "./4669.12208c6a.js";
2
3
  export * from "@rspress/runtime";
3
- export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref };
4
+ export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "@rspress/shared";
@@ -1 +1 @@
1
- export * from './node/mdx/rehypePlugins/transformers/index';
1
+ export * from './node/mdx/rehypePlugins/transformers/index.js';
@@ -1,120 +1,6 @@
1
- /*! For license information please see shiki-transformers.js.LICENSE.txt */
2
- const SHIKI_TRANSFORMER_ADD_LANG = 'shiki-transformer:add-lang';
3
- function transformerAddLang() {
4
- return {
5
- name: SHIKI_TRANSFORMER_ADD_LANG,
6
- pre (pre) {
7
- const lang = this.options.lang;
8
- if (lang.length > 0) pre.properties = {
9
- ...pre.properties,
10
- lang
11
- };
12
- return pre;
13
- }
14
- };
15
- }
16
- const SHIKI_TRANSFORMER_ADD_LINE_NUMBERS = 'shiki-transformer:add-line-numbers';
17
- function hasLineNumbersInMeta(meta) {
18
- if (!meta) return;
19
- const kvList = meta.split(' ').filter(Boolean);
20
- return kvList.includes('lineNumbers');
21
- }
22
- function transformerAddLineNumbers(options = {}) {
23
- const { defaultShowLineNumbers = false } = options;
24
- return {
25
- name: SHIKI_TRANSFORMER_ADD_LINE_NUMBERS,
26
- pre (pre) {
27
- const metaHasLineNumbers = hasLineNumbersInMeta(this.options.meta?.__raw);
28
- const shouldShowLineNumbers = metaHasLineNumbers ?? defaultShowLineNumbers;
29
- if (shouldShowLineNumbers) pre.properties = {
30
- ...pre.properties,
31
- lineNumbers: shouldShowLineNumbers
32
- };
33
- return pre;
34
- }
35
- };
36
- }
37
- const SHIKI_TRANSFORMER_ADD_TITLE = 'shiki-transformer:add-title';
38
- function parseTitleFromMeta(meta) {
39
- if (!meta) return '';
40
- const kvList = meta.split(' ').filter(Boolean);
41
- for (const item of kvList){
42
- const [k, v = ''] = item.split('=').filter(Boolean);
43
- if ('title' === k && v.length > 0) return v.replace(/["'`]/g, '');
44
- }
45
- return '';
46
- }
47
- function transformerAddTitle() {
48
- return {
49
- name: SHIKI_TRANSFORMER_ADD_TITLE,
50
- pre (pre) {
51
- const title = parseTitleFromMeta(this.options.meta?.__raw);
52
- if (title.length > 0) pre.properties = {
53
- ...pre.properties,
54
- title
55
- };
56
- return pre;
57
- }
58
- };
59
- }
60
- const SHIKI_TRANSFORMER_ADD_WRAP_CODE = 'shiki-transformer:wrap-code';
61
- function hasWrapCodeInMeta(meta) {
62
- if (!meta) return;
63
- const kvList = meta.split(' ').filter(Boolean);
64
- return kvList.includes('wrapCode');
65
- }
66
- function transformerAddWrapCode(options = {}) {
67
- const { defaultWrapCode = false } = options;
68
- return {
69
- name: SHIKI_TRANSFORMER_ADD_WRAP_CODE,
70
- pre (pre) {
71
- const metaHasWrapCode = hasWrapCodeInMeta(this.options.meta?.__raw);
72
- const shouldWrapCode = metaHasWrapCode ?? defaultWrapCode;
73
- if (shouldWrapCode) pre.properties = {
74
- ...pre.properties,
75
- wrapCode: true
76
- };
77
- return pre;
78
- }
79
- };
80
- }
81
- /**
82
- * these codes are copied from @shiki/transformers, transformerMetaHighlight
83
- * @source https://github.com/shikijs/shiki/blob/f5cf06f55a0b4643d7b02f15ee2c5033be6f1245/packages/transformers/src/transformers/meta-highlight.ts#L56
84
- * @license MIT
85
- */ function parseMetaHighlightString(meta) {
86
- if (!meta) return null;
87
- const match = meta.match(/\{([\d,-]+)\}/);
88
- if (!match) return null;
89
- const lines = match[1].split(',').flatMap((v)=>{
90
- const num = v.split('-').map((v)=>Number.parseInt(v, 10));
91
- if (1 === num.length) return [
92
- num[0]
93
- ];
94
- return Array.from({
95
- length: num[1] - num[0] + 1
96
- }, (_, i)=>i + num[0]);
97
- });
98
- return lines;
99
- }
100
- const symbol = Symbol('highlighted-lines');
101
- const SHIKI_TRANSFORMER_META_HIGHLIGHT = 'shiki-transformer:compatible-meta-highlight';
102
- function transformerCompatibleMetaHighlight(options = {}) {
103
- const { classActiveLine = 'highlighted', classActivePre = 'has-highlighted' } = options;
104
- return {
105
- name: '@shikijs/transformers:meta-highlight',
106
- line (node, line) {
107
- if (!this.options.meta?.__raw) return;
108
- const meta = this.meta;
109
- meta[symbol] ??= parseMetaHighlightString(this.options.meta.__raw);
110
- const lines = meta[symbol] ?? [];
111
- if (lines.includes(line)) this.addClassToHast(node, classActiveLine);
112
- return node;
113
- },
114
- pre (hast) {
115
- this.addClassToHast(hast, classActivePre);
116
- return hast;
117
- }
118
- };
119
- }
120
- export { SHIKI_TRANSFORMER_ADD_LANG, SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, SHIKI_TRANSFORMER_ADD_TITLE, SHIKI_TRANSFORMER_ADD_WRAP_CODE, SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddWrapCode, transformerCompatibleMetaHighlight };
1
+ import "./node/mdx/rehypePlugins/transformers/index.js";
2
+ export { SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, transformerAddLineNumbers } from "./node/mdx/rehypePlugins/transformers/add-line-numbers.js";
3
+ export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./node/mdx/rehypePlugins/transformers/meta-highlight.js";
4
+ export { SHIKI_TRANSFORMER_ADD_TITLE, transformerAddTitle } from "./node/mdx/rehypePlugins/transformers/add-title.js";
5
+ export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./node/mdx/rehypePlugins/transformers/add-lang.js";
6
+ export { SHIKI_TRANSFORMER_ADD_WRAP_CODE, transformerAddWrapCode } from "./node/mdx/rehypePlugins/transformers/add-wrap-code.js";
@@ -1,33 +1,16 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
- const SvgMoon = (props)=>/*#__PURE__*/ jsxs("svg", {
3
+ const SvgMoon = (props)=>/*#__PURE__*/ jsx("svg", {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
- width: 20,
6
- height: 20,
5
+ width: 19,
6
+ height: 19,
7
7
  fill: "none",
8
- viewBox: "0 0 20 20",
8
+ viewBox: "0 0 19 19",
9
9
  ...props,
10
- children: [
11
- /*#__PURE__*/ jsx("g", {
12
- clipPath: "url(#moon_svg__a)",
13
- children: /*#__PURE__*/ jsx("path", {
14
- fill: "currentColor",
15
- stroke: "currentColor",
16
- strokeLinejoin: "round",
17
- strokeWidth: 1.667,
18
- d: "M11.688 1.838a5.303 5.303 0 1 0 6.474 6.474q.169.82.17 1.688a8.333 8.333 0 1 1-6.644-8.162Z"
19
- })
20
- }),
21
- /*#__PURE__*/ jsx("defs", {
22
- children: /*#__PURE__*/ jsx("clipPath", {
23
- id: "moon_svg__a",
24
- children: /*#__PURE__*/ jsx("path", {
25
- fill: "currentColor",
26
- d: "M0 0h20v20H0z"
27
- })
28
- })
29
- })
30
- ]
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fill: "currentColor",
12
+ d: "M9.166 0a9.2 9.2 0 0 1 1.857.188.834.834 0 0 1 .042 1.623 4.47 4.47 0 1 0 5.457 5.457l.048-.135a.834.834 0 0 1 1.575.177q.186.902.188 1.856A9.168 9.168 0 1 1 9.166 0"
13
+ })
31
14
  });
32
15
  var moon = SvgMoon;
33
16
  export { moon as default };
@@ -23,7 +23,7 @@ export type BannerProps = {
23
23
  /**
24
24
  * @example
25
25
  * // theme/index.tsx
26
- * import { Layout as BasicLayout, Banner } from '@rspress/core/theme';
26
+ * import { Layout as BasicLayout, Banner } from '@rspress/core/theme-original';
27
27
  * import { useLang } from '@rspress/core/runtime';
28
28
  * const Layout = () => {
29
29
  const lang = useLang();
@@ -1,6 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Link, SvgWrapper, mergeRefs } from "@theme";
3
- import _theme_assets_close from "@theme-assets/close";
2
+ import { IconClose, Link, SvgWrapper, mergeRefs } from "@theme";
4
3
  import clsx from "clsx";
5
4
  import { forwardRef, useEffect, useState } from "react";
6
5
  import "./index.css";
@@ -29,7 +28,7 @@ const Banner = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
29
28
  children: message
30
29
  }),
31
30
  /*#__PURE__*/ jsx(SvgWrapper, {
32
- icon: _theme_assets_close,
31
+ icon: IconClose,
33
32
  onClick: ()=>{
34
33
  setDisable(true);
35
34
  if (storage) window[storage].setItem(storageKey, 'true');
@@ -35,7 +35,7 @@
35
35
  .rp-button--brand {
36
36
  opacity: 1;
37
37
  color: #fff;
38
- background: linear-gradient(90deg, var(--rp-c-brand-dark) 0%, var(--rp-c-brand-dark) 30%, #a673ff 100%);
38
+ background: var(--rp-home-hero-title-bg);
39
39
  transition: all .3s;
40
40
  }
41
41