@rspress/core 2.0.0-rc.3 → 2.0.0-rc.4

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 (99) hide show
  1. package/dist/0~7675.723d12b2.js +4 -4
  2. package/dist/{3521.56e42d70.js → 3521.9eb6b114.js} +12 -12
  3. package/dist/4669.69cb6b18.js +1 -0
  4. package/dist/{5485.077f14ff.js → 5485.9fc7f63d.js} +5 -5
  5. package/dist/6289.29817fb4.js +4 -0
  6. package/dist/8813.4b28f4bb.js +1 -0
  7. package/dist/9643.2dff683e.js +4 -0
  8. package/dist/cli/config/loadConfigFile.js +2 -2
  9. package/dist/cli/index.44f3184c.js +2 -0
  10. package/dist/cli/index.js +3 -3
  11. package/dist/eject-theme/components/HoverGroup/index.scss +3 -2
  12. package/dist/eject-theme/components/HoverGroup/index.tsx +104 -22
  13. package/dist/eject-theme/components/Nav/NavMenu.scss +1 -1
  14. package/dist/eject-theme/components/Nav/NavMenu.tsx +50 -28
  15. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +26 -11
  16. package/dist/eject-theme/components/Overview/index.tsx +65 -0
  17. package/dist/index.js +7 -11
  18. package/dist/node/PluginDriver.js +3 -3
  19. package/dist/node/auto-nav-sidebar/index.js +3 -3
  20. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  21. package/dist/node/auto-nav-sidebar/normalize.js +2 -2
  22. package/dist/node/auto-nav-sidebar/utils.js +2 -2
  23. package/dist/node/auto-nav-sidebar/walk.js +13 -9
  24. package/dist/node/constants.js +2 -2
  25. package/dist/node/eject.js +2 -5
  26. package/dist/node/initRsbuild.js +14 -8
  27. package/dist/node/logger/hint.js +1 -1
  28. package/dist/node/mdx/loader.7c249a26.js +12 -0
  29. package/dist/node/mdx/options.js +3 -3
  30. package/dist/node/mdx/processor.js +2 -2
  31. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  32. package/dist/node/mdx/rehypePlugins/headerAnchor.js +4 -4
  33. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  34. package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -5
  35. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  36. package/dist/node/mdx/remarkPlugins/containerSyntax.js +1 -1
  37. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +3 -3
  38. package/dist/node/mdx/remarkPlugins/image.js +3 -3
  39. package/dist/node/mdx/remarkPlugins/link.js +3 -3
  40. package/dist/node/mdx/remarkPlugins/toc.js +3 -3
  41. package/dist/node/medium-zoom/index.js +1 -1
  42. package/dist/node/route/RoutePage.js +1 -1
  43. package/dist/node/route/RouteService.js +3 -3
  44. package/dist/node/route/extractPageData.js +5 -5
  45. package/dist/node/route/normalizeRoutePath.js +2 -2
  46. package/dist/node/runtimeModule/i18n.js +2 -2
  47. package/dist/node/runtimeModule/pageData/createPageData.js +2 -2
  48. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  49. package/dist/node/runtimeModule/searchHooks.js +1 -1
  50. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  51. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  52. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  53. package/dist/node/serve.js +1 -1
  54. package/dist/node/ssg/renderPage.js +2 -2
  55. package/dist/node/ssg/renderPageWorker.165b5d46.js +1 -0
  56. package/dist/node/ssg/renderPageWorker.js +2 -2
  57. package/dist/node/ssg/renderPages.js +3 -3
  58. package/dist/node/ssg/rsbuildPluginSSG.js +2 -2
  59. package/dist/node/ssg/ssgEnv.js +1 -1
  60. package/dist/node/ssg-md/llms/emitLlmsTxt.js +9 -7
  61. package/dist/node/ssg-md/llms/llmsTxt.js +2 -2
  62. package/dist/node/ssg-md/remarkSplitMdx.js +2 -2
  63. package/dist/node/ssg-md/renderPage.js +2 -2
  64. package/dist/node/ssg-md/renderPages.js +2 -2
  65. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +2 -2
  66. package/dist/node/utils/checkLanguageParity.js +1 -1
  67. package/dist/node/utils/createHash.js +1 -1
  68. package/dist/node/utils/error.js +1 -1
  69. package/dist/node/utils/flattenMdxContent.js +5 -5
  70. package/dist/node/utils/fs.js +1 -1
  71. package/dist/node/utils/getPageKey.js +1 -1
  72. package/dist/node/utils/normalizePath.js +3 -3
  73. package/dist/node/utils/reactAlias.js +2 -2
  74. package/dist/runtime/App.js +4 -2
  75. package/dist/runtime.js +1 -2
  76. package/dist/shiki-transformers.js +2 -2
  77. package/dist/theme/components/HoverGroup/index.css +3 -2
  78. package/dist/theme/components/HoverGroup/index.js +88 -17
  79. package/dist/theme/components/Nav/NavMenu.css +1 -1
  80. package/dist/theme/components/Nav/NavMenu.d.ts +6 -1
  81. package/dist/theme/components/Nav/NavMenu.js +47 -45
  82. package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +1 -1
  83. package/dist/theme/components/NavScreen/NavScreenMenuItem.js +21 -11
  84. package/dist/theme/components/Overview/index.js +45 -2
  85. package/dist/theme/layout/DocLayout/index.js +10 -0
  86. package/dist/theme/layout/HomeLayout/index.js +40 -0
  87. package/dist/theme/layout/Layout/index.js +10 -6
  88. package/dist/theme/logic/useStorageValue.js +6 -3
  89. package/dist/theme/styles/vars/base-vars.css +2 -2
  90. package/dist/theme/styles/vars/code-vars.css +2 -2
  91. package/nav-json-schema.json +2 -2
  92. package/package.json +6 -6
  93. package/dist/4669.12208c6a.js +0 -2
  94. package/dist/6289.c67fe0d5.js +0 -5
  95. package/dist/8813.9da1f210.js +0 -2
  96. package/dist/9643.f109822d.js +0 -5
  97. package/dist/cli/index.cb89dbd1.js +0 -3
  98. package/dist/node/mdx/loader.e1578c62.js +0 -13
  99. package/dist/node/ssg/renderPageWorker.474f9f73.js +0 -2
@@ -7,10 +7,10 @@ import { Buffer } from "node:buffer";
7
7
  import node_child_process, { ChildProcess } from "node:child_process";
8
8
  import { setTimeout as promises_setTimeout } from "node:timers/promises";
9
9
  import { debuglog } from "node:util";
10
- import { node_process, node_os, constants } from "./9643.f109822d.js";
11
- import { node_path } from "./6289.c67fe0d5.js";
12
- import { node_url } from "./5485.077f14ff.js";
13
- import { createWriteStream, createReadStream, readFileSync } from "./3521.56e42d70.js";
10
+ import { node_process, node_os, constants } from "./9643.2dff683e.js";
11
+ import { node_path } from "./6289.29817fb4.js";
12
+ import { node_url } from "./5485.9fc7f63d.js";
13
+ import { createWriteStream, createReadStream, readFileSync } from "./3521.9eb6b114.js";
14
14
  __webpack_require__.add({
15
15
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
16
16
  const cp = __webpack_require__("child_process");
@@ -1,14 +1,4 @@
1
- import { matchPath } from "react-router-dom";
2
- import { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
3
- import { glob } from "tinyglobby";
4
- import { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
5
- import { chunk, groupBy } from "lodash-es";
6
- import { compile } from "@rspress/mdx-rs";
7
- import { htmlToText } from "html-to-text";
8
- import node_fs, { createReadStream, createWriteStream, readFileSync } from "node:fs";
9
- import { mergeRsbuildConfig, rspack as core_rspack } from "@rsbuild/core";
10
- import { createHash } from "node:crypto";
11
- import { extname, join } from "./6289.c67fe0d5.js";
1
+ import { extname, join } from "./6289.29817fb4.js";
12
2
  const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
13
3
  const pluginVirtualModule = (pluginOptions = {})=>({
14
4
  name: PLUGIN_VIRTUAL_MODULE_NAME,
@@ -53,4 +43,14 @@ const pluginVirtualModule = (pluginOptions = {})=>({
53
43
  }
54
44
  }
55
45
  });
56
- export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DEFAULT_PAGE_EXTENSIONS, PLUGIN_REACT_NAME, chunk, compile, core_rspack, createHash, createReadStream, createWriteStream, glob, groupBy, htmlToText, matchPath, mergeRsbuildConfig, node_fs, pluginReact, pluginVirtualModule, readFileSync };
46
+ export { matchPath } from "react-router-dom";
47
+ export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
48
+ export { glob } from "tinyglobby";
49
+ export { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
50
+ export { chunk, groupBy } from "lodash-es";
51
+ export { compile } from "@rspress/mdx-rs";
52
+ export { htmlToText } from "html-to-text";
53
+ export { createReadStream, createWriteStream, default as node_fs, readFileSync } from "node:fs";
54
+ export { mergeRsbuildConfig, rspack as core_rspack } from "@rsbuild/core";
55
+ export { createHash } from "node:crypto";
56
+ export { pluginVirtualModule };
@@ -0,0 +1 @@
1
+ export { MDX_OR_MD_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getSidebarDataGroup, isDataUrl, isDebugMode, isExternalUrl, isProduction, matchNavbar, matchSidebar, normalizeHref, normalizePosixPath, parseUrl, removeLeadingSlash, removeTrailingSlash, slash, withBase } from "@rspress/shared";
@@ -1,8 +1,5 @@
1
- import { createRequire } from "node:module";
2
- import node_url, { fileURLToPath, pathToFileURL } from "node:url";
3
- import { createHead, transformHtmlTemplate } from "@unhead/react/server";
4
1
  var package_namespaceObject = {
5
- rE: "2.0.0-rc.3"
2
+ rE: "2.0.0-rc.4"
6
3
  };
7
4
  async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true, signal } = {}) {
8
5
  return new Promise((resolve_, reject_)=>{
@@ -95,4 +92,7 @@ async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true,
95
92
  });
96
93
  }
97
94
  const pMapSkip = Symbol('skip');
98
- export { createHead, createRequire, fileURLToPath, node_url, pMap, package_namespaceObject, pathToFileURL, transformHtmlTemplate };
95
+ export { createRequire } from "node:module";
96
+ export { default as node_url, fileURLToPath, pathToFileURL } from "node:url";
97
+ export { createHead, transformHtmlTemplate } from "@unhead/react/server";
98
+ export { pMap, package_namespaceObject };
@@ -0,0 +1,4 @@
1
+ export { logger } from "@rspress/shared/logger";
2
+ export { default as node_path, extname, join, relative } from "node:path";
3
+ export { default as promises, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
4
+ export { default as picocolors } from "picocolors";
@@ -0,0 +1 @@
1
+ export { visit } from "unist-util-visit";
@@ -0,0 +1,4 @@
1
+ export { extractTextAndId, getIconUrlPath, getNodeAttribute, loadFrontMatter, mergeDocConfig } from "@rspress/shared/node-utils";
2
+ export { constants, default as node_os } from "node:os";
3
+ export { cwd, default as node_process } from "node:process";
4
+ export { createProcessor, nodeTypes } from "@mdx-js/mdx";
@@ -1,5 +1,5 @@
1
- import { node_fs, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "../../3521.56e42d70.js";
2
- import { node_path, logger } from "../../6289.c67fe0d5.js";
1
+ import { node_fs, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "../../3521.9eb6b114.js";
2
+ import { node_path, logger } from "../../6289.29817fb4.js";
3
3
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
4
4
  async function loadConfigFile(customConfigFile) {
5
5
  const baseDir = process.cwd();
@@ -0,0 +1,2 @@
1
+ export { cac } from "cac";
2
+ export { default as chokidar } from "chokidar";
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { node_path, logger, join, picocolors } from "../6289.c67fe0d5.js";
2
- import { chokidar, cac } from "./index.cb89dbd1.js";
3
- import { package_namespaceObject } from "../5485.077f14ff.js";
1
+ import { node_path, logger, join, picocolors } from "../6289.29817fb4.js";
2
+ import { chokidar, cac } from "./index.44f3184c.js";
3
+ import { package_namespaceObject } from "../5485.9fc7f63d.js";
4
4
  import { loadConfigFile, resolveDocRoot } from "./config/loadConfigFile.js";
5
5
  import { dev } from "../node/dev.js";
6
6
  import { PUBLIC_DIR } from "../node/constants.js";
@@ -49,7 +49,6 @@
49
49
  display: block;
50
50
  white-space: nowrap;
51
51
 
52
- padding-left: 8px;
53
52
  padding-right: 8px;
54
53
 
55
54
  // style
@@ -64,8 +63,10 @@
64
63
  line-height: 32px;
65
64
 
66
65
  &__link {
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 2px;
67
69
  // For click area
68
- display: block;
69
70
  height: 100%;
70
71
  }
71
72
 
@@ -1,6 +1,8 @@
1
1
  import type { NavItemWithChildren } from '@rspress/core';
2
- import { Link } from '@theme';
2
+ import { matchNavbar, useLocation } from '@rspress/core/runtime';
3
+ import { Link, Tag } from '@theme';
3
4
  import cls from 'clsx';
5
+
4
6
  import './index.scss';
5
7
 
6
8
  type Items = NavItemWithChildren['items'];
@@ -17,6 +19,100 @@ interface HoverGroupProps {
17
19
  activeMatcher?: (item: Items[number]) => boolean;
18
20
  }
19
21
 
22
+ function HoverGroupItem({
23
+ item,
24
+ activeMatcher,
25
+ depth = 0,
26
+ }: {
27
+ item: Items[number];
28
+ activeMatcher?: (item: Items[number]) => boolean;
29
+ depth?: number;
30
+ }) {
31
+ const { pathname } = useLocation();
32
+
33
+ if ('items' in item && item.items && item.items.length > 0) {
34
+ const hasLink = 'link' in item && item.link;
35
+
36
+ return (
37
+ <>
38
+ {hasLink && (
39
+ <li
40
+ key={item.text}
41
+ className="rp-hover-group__item"
42
+ style={{ paddingLeft: `${8 + depth * 12}px` }}
43
+ data-depth={depth}
44
+ >
45
+ <Link
46
+ href={item.link}
47
+ aria-label={item.text}
48
+ className="rp-hover-group__item__link"
49
+ >
50
+ {item.text}
51
+ {'tag' in item && item.tag && <Tag tag={item.tag} />}
52
+ </Link>
53
+ </li>
54
+ )}
55
+ {item.items.map(subItem => (
56
+ <HoverGroupItem
57
+ key={subItem.text}
58
+ item={subItem}
59
+ activeMatcher={activeMatcher}
60
+ depth={depth + 1}
61
+ />
62
+ ))}
63
+ </>
64
+ );
65
+ }
66
+
67
+ if ('link' in item) {
68
+ const { text, link } = item;
69
+ const isActiveItem = activeMatcher
70
+ ? activeMatcher(item)
71
+ : matchNavbar(item, pathname);
72
+
73
+ return (
74
+ <li
75
+ key={text + link}
76
+ className={cls('rp-hover-group__item', {
77
+ 'rp-hover-group__item--active': isActiveItem,
78
+ })}
79
+ style={{ paddingLeft: `${8 + depth * 12}px` }}
80
+ data-depth={depth}
81
+ >
82
+ {link ? (
83
+ <Link
84
+ href={link}
85
+ aria-label={text}
86
+ className="rp-hover-group__item__link"
87
+ >
88
+ {text}
89
+ {'tag' in item && item.tag && <Tag tag={item.tag} />}
90
+ </Link>
91
+ ) : (
92
+ <div className="rp-hover-group__item__link">
93
+ {text}
94
+ {'tag' in item && item.tag && <Tag tag={item.tag} />}
95
+ </div>
96
+ )}
97
+ </li>
98
+ );
99
+ }
100
+
101
+ return (
102
+ <li
103
+ key={item.text}
104
+ className="rp-hover-group__item"
105
+ style={{ paddingLeft: `${8 + depth * 12}px` }}
106
+ data-depth={depth}
107
+ >
108
+ <div className="rp-hover-group__item__link">
109
+ {item.text}
110
+ {'tag' in item && item.tag && <Tag tag={item.tag} />}
111
+ </div>
112
+ </li>
113
+ );
114
+ }
115
+
20
116
  function HoverGroup({
21
117
  items,
22
118
  customChildren,
@@ -34,27 +130,13 @@ function HoverGroup({
34
130
  })}
35
131
  >
36
132
  {customChildren ??
37
- items?.map(item => {
38
- const { text, link } = item;
39
- const isActiveItem = activeMatcher ? activeMatcher(item) : false;
40
-
41
- return (
42
- <li
43
- key={text + link}
44
- className={cls('rp-hover-group__item', {
45
- 'rp-hover-group__item--active': isActiveItem,
46
- })}
47
- >
48
- <Link
49
- href={link}
50
- aria-label={text}
51
- className="rp-hover-group__item__link"
52
- >
53
- {text}
54
- </Link>
55
- </li>
56
- );
57
- })}
133
+ items?.map(item => (
134
+ <HoverGroupItem
135
+ key={item.text}
136
+ item={item}
137
+ activeMatcher={activeMatcher}
138
+ />
139
+ ))}
58
140
  </ul>
59
141
  );
60
142
  }
@@ -25,7 +25,7 @@
25
25
  justify-content: center;
26
26
  align-items: center;
27
27
  height: 100%;
28
- gap: 6px;
28
+ gap: 2px;
29
29
 
30
30
  // text
31
31
  text-align: center;
@@ -8,7 +8,7 @@ import { matchNavbar, useLocation } from '@rspress/core/runtime';
8
8
  import type { HoverGroupProps } from '@theme';
9
9
  import { IconArrowDown, Link, SvgWrapper, Tag, useHoverGroup } from '@theme';
10
10
  import cls from 'clsx';
11
- import { useMemo } from 'react';
11
+ import { type ReactNode, useMemo } from 'react';
12
12
  import { useLangsMenu, useVersionsMenu } from './hooks';
13
13
  import './NavMenu.scss';
14
14
  import clsx from 'clsx';
@@ -17,6 +17,32 @@ export const SvgDown = (props: React.SVGProps<SVGSVGElement>) => {
17
17
  return <SvgWrapper icon={IconArrowDown} {...props} />;
18
18
  };
19
19
 
20
+ export function NavMenuItemInner({
21
+ menuItem,
22
+ children,
23
+ }: {
24
+ menuItem: Partial<NavItemWithLink>;
25
+ children?: ReactNode;
26
+ }) {
27
+ return (
28
+ <>
29
+ {'link' in menuItem && typeof menuItem.link === 'string' ? (
30
+ <Link href={menuItem.link} className="rp-nav-menu__item__container">
31
+ {menuItem.text}
32
+ {menuItem.tag && <Tag tag={menuItem.tag} />}
33
+ {children}
34
+ </Link>
35
+ ) : (
36
+ <div className="rp-nav-menu__item__container">
37
+ {menuItem.text}
38
+ {menuItem.tag && <Tag tag={menuItem.tag} />}
39
+ {children}
40
+ </div>
41
+ )}
42
+ </>
43
+ );
44
+ }
45
+
20
46
  export function NavMenuItemWithChildren({
21
47
  menuItem,
22
48
  activeMatcher,
@@ -29,33 +55,20 @@ export function NavMenuItemWithChildren({
29
55
  activeMatcher,
30
56
  });
31
57
 
32
- const inner =
33
- 'link' in menuItem && typeof menuItem.link === 'string' ? (
34
- <Link href={menuItem.link} className="rp-nav-menu__item__container">
35
- {menuItem.text}
36
- {menuItem.tag && <Tag tag={menuItem.tag} />}
37
- <SvgDown className="rp-nav-menu__item__icon" />
38
- </Link>
39
- ) : (
40
- <div className="rp-nav-menu__item__container">
41
- {menuItem.text}
42
- {menuItem.tag && <Tag tag={menuItem.tag} />}
43
- <SvgDown className="rp-nav-menu__item__icon" />
44
- </div>
45
- );
46
-
47
- return menuItem.items.length > 0 ? (
58
+ const hasItems = menuItem.items.length > 0;
59
+
60
+ return (
48
61
  <li
49
62
  className="rp-nav-menu__item"
50
63
  onMouseEnter={handleMouseEnter}
51
64
  onMouseLeave={handleMouseLeave}
52
65
  onClick={handleMouseEnter}
53
66
  >
54
- {inner}
67
+ <NavMenuItemInner menuItem={menuItem}>
68
+ {hasItems && <SvgDown className="rp-nav-menu__item__icon" />}
69
+ </NavMenuItemInner>
55
70
  {hoverGroup}
56
71
  </li>
57
- ) : (
58
- <li className="rp-nav-menu__item">{inner}</li>
59
72
  );
60
73
  }
61
74
 
@@ -80,20 +93,29 @@ export function NavMenuItemWithLink({
80
93
  isActive ? 'rspress-nav-menu-item-active' : '',
81
94
  )}
82
95
  >
83
- <Link href={menuItem.link} className="rp-nav-menu__item__container">
84
- {menuItem.text}
85
- {menuItem.tag && <Tag tag={menuItem.tag} />}
86
- </Link>
96
+ <NavMenuItemInner menuItem={menuItem} />
87
97
  </li>
88
98
  );
89
99
  }
90
100
 
91
- export function NavMenuItem({ menuItem: item }: { menuItem: NavItem }) {
92
- if ('items' in item && Array.isArray(item.items) && item.items.length > 0) {
93
- return <NavMenuItemWithChildren menuItem={item} />;
101
+ export function NavMenuItem({ menuItem }: { menuItem: NavItem }) {
102
+ if (
103
+ 'items' in menuItem &&
104
+ Array.isArray(menuItem.items) &&
105
+ menuItem.items.length > 0
106
+ ) {
107
+ return <NavMenuItemWithChildren menuItem={menuItem} />;
108
+ }
109
+
110
+ if ('link' in menuItem && menuItem.link.length > 0) {
111
+ return <NavMenuItemWithLink menuItem={menuItem as NavItemWithLink} />;
94
112
  }
95
113
 
96
- return <NavMenuItemWithLink menuItem={item as NavItemWithLink} />;
114
+ return (
115
+ <li className="rp-nav-menu__item">
116
+ <NavMenuItemInner menuItem={menuItem} />
117
+ </li>
118
+ );
97
119
  }
98
120
 
99
121
  export function NavMenuDivider() {
@@ -40,6 +40,7 @@ export function NavScreenMenuItemRaw({
40
40
  href={href}
41
41
  className={clsx(
42
42
  'rp-nav-screen-menu-item',
43
+ isOpen && 'rp-nav-screen-menu-item--open',
43
44
  isActive && 'rp-nav-screen-menu-item--active',
44
45
  )}
45
46
  onClick={onClick}
@@ -97,7 +98,7 @@ export function NavScreenMenuItemWithChildren({
97
98
  }: NavScreenMenuItemWithChildrenProps) {
98
99
  const [isOpen, setIsOpen] = useState(false);
99
100
 
100
- return menuItem.items?.length > 0 ? (
101
+ return (
101
102
  <>
102
103
  <NavScreenMenuItemRaw
103
104
  left={
@@ -109,6 +110,7 @@ export function NavScreenMenuItemWithChildren({
109
110
  right={<SvgDown className="rp-nav-screen-menu-item__icon" />}
110
111
  isOpen={isOpen}
111
112
  onClick={() => setIsOpen(!isOpen)}
113
+ href={'link' in menuItem ? menuItem.link : undefined}
112
114
  />
113
115
 
114
116
  <div
@@ -122,16 +124,11 @@ export function NavScreenMenuItemWithChildren({
122
124
  >
123
125
  <div className="rp-nav-screen-menu-item__group-inner">
124
126
  {menuItem.items.map(item => (
125
- <NavScreenMenuItemWithChildren
126
- key={item.text}
127
- menuItem={item as any}
128
- />
127
+ <NavScreenMenuItem key={item.text} menuItem={item} />
129
128
  ))}
130
129
  </div>
131
130
  </div>
132
131
  </>
133
- ) : (
134
- <NavScreenMenuItemWithLink menuItem={menuItem as NavItemWithLink} />
135
132
  );
136
133
  }
137
134
 
@@ -139,10 +136,28 @@ interface NavScreenMenuItemProps {
139
136
  menuItem: NavItem;
140
137
  }
141
138
 
142
- export function NavScreenMenuItem({ menuItem: item }: NavScreenMenuItemProps) {
143
- if ('items' in item && Array.isArray(item.items) && item.items.length > 0) {
144
- return <NavScreenMenuItemWithChildren menuItem={item} />;
139
+ export function NavScreenMenuItem({ menuItem }: NavScreenMenuItemProps) {
140
+ if (
141
+ 'items' in menuItem &&
142
+ Array.isArray(menuItem.items) &&
143
+ menuItem.items.length > 0
144
+ ) {
145
+ return <NavScreenMenuItemWithChildren menuItem={menuItem} />;
146
+ }
147
+
148
+ if ('link' in menuItem && typeof menuItem.link === 'string') {
149
+ return <NavScreenMenuItemWithLink menuItem={menuItem as NavItemWithLink} />;
145
150
  }
146
151
 
147
- return <NavScreenMenuItemWithLink menuItem={item as NavItemWithLink} />;
152
+ return (
153
+ <NavScreenMenuItemRaw
154
+ left={
155
+ <>
156
+ {menuItem.text}
157
+ {menuItem.tag && <Tag tag={menuItem.tag} />}
158
+ </>
159
+ }
160
+ right={null}
161
+ />
162
+ );
148
163
  }
@@ -6,9 +6,11 @@ import type {
6
6
  } from '@rspress/core';
7
7
  import {
8
8
  isEqualPath,
9
+ normalizeHref,
9
10
  useI18n,
10
11
  usePageData,
11
12
  useSidebar,
13
+ withBase,
12
14
  } from '@rspress/core/runtime';
13
15
  import {
14
16
  FallbackHeading,
@@ -25,6 +27,65 @@ import {
25
27
  import './index.scss';
26
28
  import { findItemByRoutePath } from './utils';
27
29
 
30
+ function routePathToMdPath(routePath: string): string {
31
+ let url: string = routePath;
32
+ url = normalizeHref(url, false);
33
+ url = url.replace(/\.html$/, '.md');
34
+ return withBase(url);
35
+ }
36
+
37
+ function OverviewMarkdown({
38
+ title,
39
+ groups,
40
+ }: {
41
+ title: string;
42
+ groups: Group[];
43
+ }) {
44
+ const lines: string[] = [];
45
+
46
+ lines.push(`# ${title}`);
47
+ lines.push('');
48
+
49
+ for (const group of groups) {
50
+ if (group.name) {
51
+ lines.push(`## ${group.name}`);
52
+ lines.push('');
53
+ }
54
+
55
+ for (const item of group.items) {
56
+ const itemTitle = item.link
57
+ ? `[${item.text}](${routePathToMdPath(item.link)})`
58
+ : `**${item.text}**`;
59
+ lines.push(`### ${itemTitle}`);
60
+ lines.push('');
61
+
62
+ // Render headers as a list
63
+ if (item.headers && item.headers.length > 0) {
64
+ for (const header of item.headers) {
65
+ const headerLink = item.link
66
+ ? `[${header.text}](${routePathToMdPath(item.link)}#${header.id})`
67
+ : header.text;
68
+ lines.push(`- ${headerLink}`);
69
+ }
70
+ lines.push('');
71
+ }
72
+
73
+ // Render custom items as a list
74
+ if (item.items && item.items.length > 0) {
75
+ for (const subItem of item.items) {
76
+ const subItemLink = subItem.link
77
+ ? `[${subItem.text}](${routePathToMdPath(subItem.link)})`
78
+ : subItem.text;
79
+ lines.push(`- ${subItemLink}`);
80
+ }
81
+ lines.push('');
82
+ }
83
+ }
84
+ }
85
+
86
+ return <>{lines.join('\n')}</>;
87
+ }
88
+
28
89
  // Utility function to normalize text for search
29
90
  const normalizeText = (s: string) => s.toLowerCase().replace(/-/g, ' ');
30
91
 
@@ -240,6 +301,10 @@ export function Overview(props: {
240
301
 
241
302
  const overviewTitle = title || 'Overview';
242
303
 
304
+ if (process.env.__SSR_MD__) {
305
+ return <OverviewMarkdown title={overviewTitle} groups={groups} />;
306
+ }
307
+
243
308
  return (
244
309
  <div className="rspress-doc rp-doc rspress-overview rp-overview">
245
310
  <FallbackHeading level={1} title={overviewTitle} />
package/dist/index.js CHANGED
@@ -1,16 +1,12 @@
1
- import "./4669.12208c6a.js";
2
- import "./6289.c67fe0d5.js";
3
- import "./9643.f109822d.js";
4
- import "./3521.56e42d70.js";
5
- export { RSPRESS_TEMP_DIR, getSidebarDataGroup, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "@rspress/shared";
6
- export { logger } from "@rspress/shared/logger";
7
- export { getIconUrlPath, getNodeAttribute, mergeDocConfig } from "@rspress/shared/node-utils";
8
- export { matchPath } from "react-router-dom";
9
- export { defineConfig } from "./cli/config/index.js";
1
+ export { PluginDriver } from "./node/PluginDriver.js";
2
+ export { RSPRESS_TEMP_DIR, getSidebarDataGroup, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./4669.69cb6b18.js";
3
+ export { RouteService } from "./node/route/RouteService.js";
10
4
  export { build } from "./node/build.js";
5
+ export { defineConfig } from "./cli/config/index.js";
11
6
  export { dev } from "./node/dev.js";
7
+ export { getIconUrlPath, getNodeAttribute, mergeDocConfig } from "./9643.2dff683e.js";
8
+ export { logger } from "./6289.29817fb4.js";
9
+ export { matchPath } from "./3521.9eb6b114.js";
12
10
  export { remarkFileCodeBlock } from "./node/mdx/remarkPlugins/fileCodeBlock.js";
13
11
  export { remarkLink } from "./node/mdx/remarkPlugins/link.js";
14
12
  export { serve } from "./node/serve.js";
15
- export { PluginDriver } from "./node/PluginDriver.js";
16
- export { RouteService } from "./node/route/RouteService.js";
@@ -1,7 +1,7 @@
1
- import { node_path } from "../6289.c67fe0d5.js";
2
- import { addTrailingSlash, addLeadingSlash } from "../4669.12208c6a.js";
1
+ import { node_path } from "../6289.29817fb4.js";
2
+ import { addTrailingSlash, addLeadingSlash } from "../4669.69cb6b18.js";
3
3
  import { createError } from "./utils/error.js";
4
- import { haveNavSidebarConfig as auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
4
+ import { auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
5
5
  class PluginDriver {
6
6
  #config;
7
7
  #configFilePath;
@@ -1,5 +1,5 @@
1
- import { node_path } from "../../6289.c67fe0d5.js";
2
- import { DEFAULT_PAGE_EXTENSIONS } from "../../3521.56e42d70.js";
1
+ import { node_path } from "../../6289.29817fb4.js";
2
+ import { DEFAULT_PAGE_EXTENSIONS } from "../../3521.9eb6b114.js";
3
3
  import { processLocales, combineWalkResult } from "./locales.js";
4
4
  import { walk } from "./walk.js";
5
5
  async function runAutoNavSide(config, metaFileSet, mdFileSet) {
@@ -41,4 +41,4 @@ async function modifyConfigWithAutoNavSide(config, metaFileSet = new Set(), mdFi
41
41
  config.themeConfig.nav = autoNavSide.nav;
42
42
  config.themeConfig.sidebar = autoNavSide.sidebar;
43
43
  }
44
- export { auto_nav_sidebar_haveNavSidebarConfig as haveNavSidebarConfig, modifyConfigWithAutoNavSide };
44
+ export { auto_nav_sidebar_haveNavSidebarConfig, modifyConfigWithAutoNavSide };
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../6289.c67fe0d5.js";
1
+ import { node_path } from "../../6289.29817fb4.js";
2
2
  import { walk } from "./walk.js";
3
3
  function combineWalkResult(walks, versions) {
4
4
  return walks.reduce((acc, cur, curIndex)=>({
@@ -1,5 +1,5 @@
1
- import { readdir, extname, stat as promises_stat, relative, logger, join, picocolors } from "../../6289.c67fe0d5.js";
2
- import { isExternalUrl, slash } from "../../4669.12208c6a.js";
1
+ import { readdir, extname, stat as promises_stat, relative, logger, join, picocolors } from "../../6289.29817fb4.js";
2
+ import { isExternalUrl, slash } from "../../4669.69cb6b18.js";
3
3
  import { createError } from "../utils/error.js";
4
4
  import { PUBLIC_DIR } from "../constants.js";
5
5
  import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
@@ -1,5 +1,5 @@
1
- import { node_path, promises } from "../../6289.c67fe0d5.js";
2
- import { loadFrontMatter, extractTextAndId } from "../../9643.f109822d.js";
1
+ import { node_path, promises } from "../../6289.29817fb4.js";
2
+ import { loadFrontMatter, extractTextAndId } from "../../9643.2dff683e.js";
3
3
  async function pathExists(path) {
4
4
  try {
5
5
  await promises.access(path);