@rspress/core 2.0.16 → 2.0.18

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 (134) hide show
  1. package/bin/rspress.js +6 -1
  2. package/dist/0~execa.js +1 -1
  3. package/dist/{9882.js → 102.js} +1 -1
  4. package/dist/{9958.js → 3553.js} +2 -2
  5. package/dist/{5580.js → 5871.js} +2455 -6
  6. package/dist/cli/index.d.ts +8 -1
  7. package/dist/cli/index.js +105 -102
  8. package/dist/config/loadConfigFile.js +1 -1
  9. package/dist/eject-theme/components/DocContent/docComponents/title.tsx +1 -1
  10. package/dist/eject-theme/components/HomeFeature/index.scss +1 -0
  11. package/dist/eject-theme/components/HomeFeature/index.tsx +1 -1
  12. package/dist/eject-theme/components/HoverGroup/index.scss +9 -0
  13. package/dist/eject-theme/components/Link/index.tsx +1 -1
  14. package/dist/eject-theme/components/Link/useLinkNavigate.ts +17 -4
  15. package/dist/eject-theme/components/Llms/LlmsHiddenHint.test.tsx +23 -0
  16. package/dist/eject-theme/components/Llms/LlmsHiddenHint.tsx +15 -0
  17. package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +51 -64
  18. package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +65 -51
  19. package/dist/eject-theme/components/Llms/index.tsx +6 -1
  20. package/dist/eject-theme/components/Outline/index.tsx +1 -1
  21. package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +48 -0
  22. package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +35 -20
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.js +2 -1
  25. package/dist/node/PluginDriver.js +1 -1
  26. package/dist/node/auto-nav-sidebar/index.js +1 -1
  27. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  28. package/dist/node/auto-nav-sidebar/normalize.js +2 -2
  29. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  30. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  31. package/dist/node/constants.js +1 -1
  32. package/dist/node/eject.js +2 -2
  33. package/dist/node/initRsbuild.js +19 -8
  34. package/dist/node/llms.d.ts +3 -0
  35. package/dist/node/llms.js +8 -0
  36. package/dist/node/logger/hint.js +1 -1
  37. package/dist/node/mdx/options.js +1 -1
  38. package/dist/node/mdx/processor.js +1 -1
  39. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  40. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  41. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  42. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  43. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +2 -2
  44. package/dist/node/mdx/remarkPlugins/image.js +2 -2
  45. package/dist/node/mdx/remarkPlugins/link.js +2 -2
  46. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  47. package/dist/node/medium-zoom/index.js +1 -1
  48. package/dist/node/route/RoutePage.js +5 -3
  49. package/dist/node/route/RouteService.js +8 -3
  50. package/dist/node/route/extractPageData.js +1 -1
  51. package/dist/node/route/normalizeRoutePath.js +1 -1
  52. package/dist/node/route/routeChunkAssets.d.ts +15 -0
  53. package/dist/node/route/routeChunkAssets.js +56 -0
  54. package/dist/node/runtimeModule/i18n.js +3 -3
  55. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  56. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  57. package/dist/node/runtimeModule/searchHooks.js +1 -1
  58. package/dist/node/runtimeModule/siteData/createSiteData.js +6 -2
  59. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  60. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  61. package/dist/node/serve.js +1 -1
  62. package/dist/node/ssg/alternateLinks.d.ts +7 -0
  63. package/dist/node/ssg/alternateLinks.js +40 -0
  64. package/dist/node/ssg/htmlFile.js +1 -1
  65. package/dist/node/ssg/renderHtmlTemplate.d.ts +3 -1
  66. package/dist/node/ssg/renderHtmlTemplate.js +25 -3
  67. package/dist/node/ssg/renderPage.d.ts +3 -1
  68. package/dist/node/ssg/renderPage.js +4 -4
  69. package/dist/node/ssg/renderPageWorker.js +5 -5
  70. package/dist/node/ssg/renderPages.d.ts +3 -2
  71. package/dist/node/ssg/renderPages.js +16 -11
  72. package/dist/node/ssg/rsbuildPluginCSR.d.ts +3 -1
  73. package/dist/node/ssg/rsbuildPluginCSR.js +2 -2
  74. package/dist/node/ssg/rsbuildPluginSSG.d.ts +3 -1
  75. package/dist/node/ssg/rsbuildPluginSSG.js +3 -3
  76. package/dist/node/ssg/ssgEnv.js +1 -1
  77. package/dist/node/ssg-md/llms/emitLlmsTxt.js +3 -3
  78. package/dist/node/ssg-md/llms/llmsTxt.d.ts +4 -4
  79. package/dist/node/ssg-md/llms/llmsTxt.js +54 -40
  80. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  81. package/dist/node/ssg-md/renderPage.js +2 -2
  82. package/dist/node/ssg-md/renderPages.js +3 -3
  83. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  84. package/dist/node/utils/checkLanguageParity.js +1 -1
  85. package/dist/node/utils/createHash.d.ts +1 -1
  86. package/dist/node/utils/createHash.js +3 -3
  87. package/dist/node/utils/error.js +1 -1
  88. package/dist/node/utils/flattenMdxContent.js +1 -1
  89. package/dist/node/utils/fs.js +1 -1
  90. package/dist/node/utils/getPageKey.js +1 -1
  91. package/dist/node/utils/normalizePath.js +1 -1
  92. package/dist/node/utils/reactAlias.js +2 -2
  93. package/dist/runtime/App.js +2 -0
  94. package/dist/runtime/ClientApp.js +3 -2
  95. package/dist/runtime/index.d.ts +1 -1
  96. package/dist/runtime/index.js +1 -1
  97. package/dist/runtime/route.js +2 -0
  98. package/dist/runtime/utils.d.ts +2 -1
  99. package/dist/runtime/utils.js +5 -2
  100. package/dist/theme/assets/anthropic.js +15 -0
  101. package/dist/theme/assets/open-in-chat.js +19 -0
  102. package/dist/theme/assets/openai.js +15 -0
  103. package/dist/theme/components/DocContent/docComponents/index.d.ts +25 -18
  104. package/dist/theme/components/DocContent/docComponents/title.js +1 -1
  105. package/dist/theme/components/HomeFeature/index.css +1 -0
  106. package/dist/theme/components/HomeFeature/index.js +32 -34
  107. package/dist/theme/components/HoverGroup/index.css +7 -0
  108. package/dist/theme/components/Link/index.d.ts +1 -1
  109. package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
  110. package/dist/theme/components/Link/useLinkNavigate.js +13 -5
  111. package/dist/theme/components/Llms/LlmsHiddenHint.d.ts +1 -0
  112. package/dist/theme/components/Llms/LlmsHiddenHint.js +18 -0
  113. package/dist/theme/components/Llms/LlmsOpenRow.js +31 -57
  114. package/dist/theme/components/Llms/LlmsViewOptions.d.ts +6 -4
  115. package/dist/theme/components/Llms/LlmsViewOptions.js +28 -45
  116. package/dist/theme/components/Llms/index.d.ts +2 -1
  117. package/dist/theme/components/Llms/index.js +1 -0
  118. package/dist/theme/components/Outline/index.js +1 -1
  119. package/dist/theme/components/Search/SearchPanel.js +8 -8
  120. package/dist/theme/components/SocialLinks/GithubStars.js +27 -17
  121. package/dist/theme/icons.d.ts +4 -1
  122. package/dist/theme/icons.js +8 -2
  123. package/dist/theme/index.d.ts +1 -1
  124. package/dist/theme/index.js +1 -1
  125. package/dist/theme/logic/getCopyableText.js +1 -0
  126. package/package.json +11 -11
  127. package/dist/6010.js +0 -2461
  128. package/dist/{0~8787.js → 0~8016.js} +0 -0
  129. package/dist/{7986.js → 4538.js} +0 -0
  130. package/dist/{3358.js → 5357.js} +0 -0
  131. package/dist/{5580.js.LICENSE.txt → 5871.js.LICENSE.txt} +0 -0
  132. package/dist/{8005.js → 7748.js} +2 -2
  133. /package/dist/{6646.js → 9857.js} +0 -0
  134. /package/dist/{9283.js → 9940.js} +0 -0
@@ -1,10 +1,10 @@
1
- import { type NavItemWithLink } from '@rspress/shared';
1
+ import { type LlmsTxtRenderer, type NavItemWithLink } from '@rspress/shared';
2
2
  import type { RouteService } from '../../route/RouteService.js';
3
- declare function routePathToMdPath(routePath: string, base: string): string;
3
+ declare function routePathToMdPath(routePath: string, base: string, siteOrigin?: string): string;
4
4
  declare function generateLlmsTxt(routeGroups: string[][], others: string[], navList: {
5
5
  text: string;
6
- }[], title: string | undefined, description: string | undefined, base: string, routeService: RouteService): Promise<string>;
6
+ }[], title: string | undefined, description: string | undefined, base: string, siteOrigin: string | undefined, routeService: RouteService, lang: string, version: string, renderLlmsTxt?: LlmsTxtRenderer): Promise<string>;
7
7
  declare function generateLlmsFullTxt(routeGroups: string[][], navList: (NavItemWithLink & {
8
8
  lang: string;
9
- })[], others: string[], base: string, mdContents: Map<string, string>): string;
9
+ })[], others: string[], base: string, siteOrigin: string | undefined, mdContents: Map<string, string>): string;
10
10
  export { generateLlmsFullTxt, generateLlmsTxt, routePathToMdPath };
@@ -1,64 +1,78 @@
1
- import { normalizeHref, logger, withBase } from "../../../6010.js";
1
+ import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../5871.js";
2
2
  import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
3
- function routePathToMdPath(routePath, base) {
3
+ function routePathToMdPath(routePath, base, siteOrigin) {
4
4
  let url = routePath;
5
5
  url = normalizeHref(url, false);
6
6
  url = url.replace(/\.html$/, '.md');
7
- return withBase(url, base);
7
+ return withSiteOrigin(withBase(url, base), siteOrigin);
8
8
  }
9
- async function generateLlmsTxt(routeGroups, others, navList, title, description, base, routeService) {
10
- const lines = [];
11
- if (!title) logger.warn('No `title` is configured in your Rspress setup. Please set `title` in rspress.config.ts so llms.txt can include an appropriate heading.');
12
- const summary = title ? `# ${title}${description ? `\n\n> ${description}` : ''}` : '';
13
- async function genH2Part(nav, routes) {
14
- const lines = [];
15
- const { text } = nav;
16
- if (0 === routes.length) return lines;
17
- const routeLines = (await Promise.all(routes.map(async (route)=>{
9
+ async function generateLlmsTxt(routeGroups, others, navList, title, description, base, siteOrigin, routeService, lang, version, renderLlmsTxt) {
10
+ async function generateSection(sectionTitle, routes) {
11
+ if (0 === routes.length) return;
12
+ const pages = (await Promise.all(routes.map(async (route)=>{
18
13
  const routePage = routeService.getRoutePageByRoutePath(route);
19
- const { lang, routePath, absolutePath } = routePage.routeMeta;
20
- if ('/' === routePath || routePath === `/${lang}/`) return;
14
+ const { lang: pageLang, routePath, pureRoutePath, absolutePath, version: pageVersion } = routePage.routeMeta;
15
+ if ('/' === pureRoutePath) return;
21
16
  const pageInfo = routePage.pageIndexInfo;
22
- let title;
23
- let description;
24
- if (pageInfo) {
25
- title = pageInfo.title;
26
- description = pageInfo.description;
27
- } else {
17
+ let title = pageInfo?.title;
18
+ let description = pageInfo?.description;
19
+ if (!title) {
28
20
  const info = await extractInfoFromFrontmatterWithAbsolutePath(absolutePath, routeService.getDocsDir());
29
21
  title = info.title;
30
- description = info.description;
22
+ description ??= info.description;
31
23
  }
32
- return `- [${title}](${routePathToMdPath(routePath, base)})${description ? `: ${description}` : ''}`;
33
- }))).filter((i)=>Boolean(i));
34
- if (routeLines.length > 0) {
35
- const title = text;
36
- lines.push(`\n## ${title}\n`);
37
- lines.push(...routeLines);
38
- }
39
- return lines;
24
+ return {
25
+ routePath,
26
+ link: routePathToMdPath(routePath, base, siteOrigin),
27
+ title,
28
+ description,
29
+ frontmatter: pageInfo?.frontmatter ?? {},
30
+ lang: pageLang,
31
+ version: pageVersion
32
+ };
33
+ }))).filter((page)=>Boolean(page));
34
+ if (0 === pages.length) return;
35
+ return {
36
+ title: sectionTitle,
37
+ pages
38
+ };
40
39
  }
41
- const h2Parts = await Promise.all(navList.map(async (nav, i)=>{
40
+ const navSections = await Promise.all(navList.map(async (nav, i)=>{
42
41
  const routes = routeGroups[i];
43
- const h2Part = await genH2Part(nav, routes);
44
- return h2Part;
42
+ return generateSection(nav.text, routes);
45
43
  }));
46
- lines.push(...h2Parts.flat());
47
- const otherLines = await genH2Part({
48
- text: 'Others'
49
- }, others);
50
- lines.push(...otherLines);
44
+ const otherSection = await generateSection('Others', others);
45
+ const sections = [
46
+ ...navSections,
47
+ otherSection
48
+ ].filter((section)=>Boolean(section));
49
+ if (renderLlmsTxt) return renderLlmsTxt({
50
+ title,
51
+ description,
52
+ lang,
53
+ version,
54
+ base,
55
+ siteOrigin,
56
+ sections
57
+ });
58
+ if (!title) logger.warn('No `title` is configured in your Rspress setup. Please set `title` in rspress.config.ts so llms.txt can include an appropriate heading.');
59
+ const summary = title ? `# ${title}${description ? `\n\n> ${description}` : ''}` : '';
60
+ const lines = [];
61
+ for (const section of sections){
62
+ lines.push(`\n## ${section.title}\n`);
63
+ lines.push(...section.pages.map((page)=>`- [${page.title}](${page.link})${page.description ? `: ${page.description}` : ''}`));
64
+ }
51
65
  let llmsTxt;
52
66
  llmsTxt = summary ? lines.length > 0 ? `${summary}\n${lines.join('\n')}` : summary : lines.join('\n').trimStart();
53
67
  return llmsTxt;
54
68
  }
55
- function generateLlmsFullTxt(routeGroups, navList, others, base, mdContents) {
69
+ function generateLlmsFullTxt(routeGroups, navList, others, base, siteOrigin, mdContents) {
56
70
  const lines = [];
57
71
  for(let i = 0; i < navList.length; i++){
58
72
  const routeGroup = routeGroups[i];
59
73
  if (0 !== routeGroup.length) for (const routePath of routeGroup){
60
74
  lines.push(`---
61
- url: ${routePathToMdPath(routePath, base)}
75
+ url: ${routePathToMdPath(routePath, base, siteOrigin)}
62
76
  ---
63
77
  `);
64
78
  lines.push(mdContents.get(routePath) ?? '');
@@ -67,7 +81,7 @@ url: ${routePathToMdPath(routePath, base)}
67
81
  }
68
82
  for (const routePath of others){
69
83
  lines.push(`---
70
- url: ${routePathToMdPath(routePath, base)}
84
+ url: ${routePathToMdPath(routePath, base, siteOrigin)}
71
85
  ---
72
86
  `);
73
87
  lines.push(mdContents.get(routePath) ?? '');
@@ -1,4 +1,4 @@
1
- import { unified, visit, remark_gfm, remark_mdx, remark_stringify } from "../../9283.js";
1
+ import { unified, visit, remark_gfm, remark_mdx, remark_stringify } from "../../9940.js";
2
2
  function remarkSplitMdx(options = {}) {
3
3
  return (tree)=>{
4
4
  const newChildren = [];
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../7986.js";
3
- import { createHead, pathToFileURL, logger } from "../../6010.js";
2
+ import "../../4538.js";
3
+ import { createHead, pathToFileURL, logger } from "../../5871.js";
4
4
  import { hintSSGFailed } from "../logger/hint.js";
5
5
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
6
6
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
@@ -1,7 +1,7 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../7986.js";
3
- import { logger } from "../../6010.js";
4
- import { pMap } from "../../9958.js";
2
+ import "../../4538.js";
3
+ import { logger } from "../../5871.js";
4
+ import { pMap } from "../../3553.js";
5
5
  import { renderPage } from "./renderPage.js";
6
6
  import { SSGConcurrency } from "../ssg/ssgEnv.js";
7
7
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
@@ -1,4 +1,4 @@
1
- import { writeFile, mkdir, rm, join, isDebugMode } from "../../6010.js";
1
+ import { writeFile, mkdir, rm, join, isDebugMode } from "../../5871.js";
2
2
  import { NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME } from "../constants.js";
3
3
  import { renderPages } from "./renderPages.js";
4
4
  import { emitLlmsTxt } from "./llms/emitLlmsTxt.js";
@@ -1,4 +1,4 @@
1
- import { node_path, logger, promises } from "../../6010.js";
1
+ import { node_path, logger, promises } from "../../5871.js";
2
2
  import { createError } from "./error.js";
3
3
  function normalizePath(filePath) {
4
4
  return filePath.split(node_path.sep).join('/');
@@ -1 +1 @@
1
- export declare function createHash(str: string): string;
1
+ export declare function createHash(str: string, length?: number): string;
@@ -1,5 +1,5 @@
1
- import { createHash as external_node_crypto_createHash } from "../../6010.js";
2
- function createHash(str) {
3
- return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
1
+ import { createHash as external_node_crypto_createHash } from "../../5871.js";
2
+ function createHash(str, length = 8) {
3
+ return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, length);
4
4
  }
5
5
  export { createHash };
@@ -1,5 +1,5 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../7986.js";
2
+ import "../../4538.js";
3
3
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
4
4
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
5
5
  function createError(message, maxStackLines = 5) {
@@ -1,4 +1,4 @@
1
- import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../6010.js";
1
+ import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../5871.js";
2
2
  import { createError } from "./error.js";
3
3
  import { importStatementRegex } from "../constants.js";
4
4
  const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
@@ -1,4 +1,4 @@
1
- import { promises } from "../../7986.js";
1
+ import { promises } from "../../4538.js";
2
2
  async function pathExists(path) {
3
3
  try {
4
4
  await promises.access(path);
@@ -1,4 +1,4 @@
1
- import { removeLeadingSlash } from "../../6010.js";
1
+ import { removeLeadingSlash } from "../../5871.js";
2
2
  function getPageKey(route) {
3
3
  const cleanRoute = removeLeadingSlash(route);
4
4
  return cleanRoute.replace(/\//g, '_').replace(/\.[^.]+$/, '') || 'index';
@@ -1,4 +1,4 @@
1
- import { node_os, node_path } from "../../8005.js";
1
+ import { node_os, node_path } from "../../7748.js";
2
2
  const isWindows = 'win32' === node_os.platform();
3
3
  function slash(p) {
4
4
  return p.replace(/\\/g, '/');
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../7986.js";
3
- import { node_path, core_rspack, logger } from "../../6010.js";
2
+ import "../../4538.js";
3
+ import { node_path, core_rspack, logger } from "../../5871.js";
4
4
  import { pathExists, readJson } from "./fs.js";
5
5
  import { PACKAGE_ROOT } from "../constants.js";
6
6
  import { hintReactVersion } from "../logger/hint.js";
@@ -1,6 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { PageContext, useLocation } from "@rspress/core/runtime";
3
3
  import { Layout, Root } from "@rspress/core/theme";
4
+ import { LlmsHiddenHint } from "@rspress/core/theme-original";
4
5
  import react, { useContext, useLayoutEffect } from "react";
5
6
  import virtual_global_components from "virtual-global-components";
6
7
  import { consumeCachedPageData, initPageData, setCurrentPageData } from "./initPageData.js";
@@ -34,6 +35,7 @@ function App() {
34
35
  });
35
36
  return /*#__PURE__*/ jsxs(Root, {
36
37
  children: [
38
+ import.meta.env.ENABLE_LLMS_HINT && /*#__PURE__*/ jsx(LlmsHiddenHint, {}),
37
39
  /*#__PURE__*/ jsx(Layout, {}),
38
40
  !hideGlobalUIComponents && virtual_global_components.map((componentInfo, index)=>{
39
41
  if (Array.isArray(componentInfo)) {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { BrowserRouter, PageContext, ThemeContext, removeTrailingSlash, withBase } from "@rspress/core/runtime";
2
+ import { BrowserRouter, PageContext, ThemeContext, removeTrailingSlash, useSite, withBase } from "@rspress/core/runtime";
3
3
  import { useThemeState } from "@rspress/core/theme";
4
4
  import { UnheadProvider, createHead } from "@unhead/react/client";
5
5
  import { useMemo, useState } from "react";
@@ -8,6 +8,7 @@ const head = createHead();
8
8
  function ClientApp({ initialPageData = null }) {
9
9
  const [data, setData] = useState(initialPageData);
10
10
  const [theme, setTheme] = useThemeState();
11
+ const { site } = useSite();
11
12
  return /*#__PURE__*/ jsx(ThemeContext.Provider, {
12
13
  value: useMemo(()=>({
13
14
  theme,
@@ -26,7 +27,7 @@ function ClientApp({ initialPageData = null }) {
26
27
  ]),
27
28
  children: /*#__PURE__*/ jsx(BrowserRouter, {
28
29
  basename: removeTrailingSlash(withBase('/')),
29
- useTransitions: true,
30
+ useTransitions: site.route.useTransitions,
30
31
  children: /*#__PURE__*/ jsx(UnheadProvider, {
31
32
  head: head,
32
33
  children: /*#__PURE__*/ jsx(App, {})
@@ -20,4 +20,4 @@ export { useWindowSize } from './hooks/useWindowSize.js';
20
20
  export { initPageData, warmPageData } from './initPageData.js';
21
21
  export { NoSSR } from './NoSSR.js';
22
22
  export { isActive, pathnameToRouteService, preloadLink } from './route.js';
23
- export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, } from './utils.js';
23
+ export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, withSiteOrigin, } from './utils.js';
@@ -20,4 +20,4 @@ export { useWindowSize } from "./hooks/useWindowSize.js";
20
20
  export { initPageData, warmPageData } from "./initPageData.js";
21
21
  export { NoSSR } from "./NoSSR.js";
22
22
  export { isActive, pathnameToRouteService, preloadLink } from "./route.js";
23
- export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase } from "./utils.js";
23
+ export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, withSiteOrigin } from "./utils.js";
@@ -1,5 +1,6 @@
1
1
  import { cleanUrl } from "@rspress/shared";
2
2
  import { routes } from "virtual-routes";
3
+ import virtual_site_data from "virtual-site-data";
3
4
  function normalizeRoutePath(routePath) {
4
5
  return cleanUrl(decodeURIComponent(routePath)).replace(/\.html$/, '').replace(/\/index$/, '/').toLowerCase();
5
6
  }
@@ -47,6 +48,7 @@ function isActive(itemLink, currentPathname) {
47
48
  return null !== linkMatched;
48
49
  }
49
50
  const preloadLink = (link)=>{
51
+ if (virtual_site_data?.route?.prefetchLink === false) return;
50
52
  const route = pathnameToRouteService(link);
51
53
  if (route) route.preload();
52
54
  };
@@ -1,5 +1,6 @@
1
1
  import { addLeadingSlash, addTrailingSlash, isProduction, removeTrailingSlash } from '@rspress/shared';
2
2
  declare function withBase(url?: string): string;
3
+ declare function withSiteOrigin(url: string): string;
3
4
  declare function removeBase(url: string): string;
4
5
  declare function isEqualPath(a: string, b: string): boolean;
5
6
  declare function normalizeHrefInRuntime(link: string): string;
@@ -9,4 +10,4 @@ declare function normalizeHrefInRuntime(link: string): string;
9
10
  declare function cleanUrlByConfig(link: string): string;
10
11
  declare function normalizeImagePath(imagePath: string): string;
11
12
  declare function routePathToMdPath(routePath: string): string;
12
- export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, };
13
+ export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, withSiteOrigin, };
@@ -1,8 +1,11 @@
1
- import { addLeadingSlash, addTrailingSlash, isDataUrl, isExternalUrl, isProduction, normalizeHref, removeBase, removeHash, removeTrailingSlash, withBase } from "@rspress/shared";
1
+ import { addLeadingSlash, addTrailingSlash, isDataUrl, isExternalUrl, isProduction, normalizeHref, removeBase, removeHash, removeTrailingSlash, withBase, withSiteOrigin } from "@rspress/shared";
2
2
  import virtual_site_data from "virtual-site-data";
3
3
  function utils_withBase(url = '/') {
4
4
  return withBase(url, virtual_site_data.base);
5
5
  }
6
+ function utils_withSiteOrigin(url) {
7
+ return withSiteOrigin(url, virtual_site_data.siteOrigin);
8
+ }
6
9
  function utils_removeBase(url) {
7
10
  return removeBase(url, virtual_site_data.base);
8
11
  }
@@ -31,4 +34,4 @@ function routePathToMdPath(routePath) {
31
34
  function isAbsoluteUrl(path) {
32
35
  return isExternalUrl(path) || isDataUrl(path) || path.startsWith('//');
33
36
  }
34
- export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeTrailingSlash, routePathToMdPath, utils_removeBase as removeBase, utils_withBase as withBase };
37
+ export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeTrailingSlash, routePathToMdPath, utils_removeBase as removeBase, utils_withBase as withBase, utils_withSiteOrigin as withSiteOrigin };
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgAnthropic = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 16,
6
+ height: 16,
7
+ fill: "currentColor",
8
+ viewBox: "0 0 24 24",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ d: "M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z"
12
+ })
13
+ });
14
+ var anthropic = SvgAnthropic;
15
+ export default anthropic;
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgOpenInChat = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 16,
6
+ height: 16,
7
+ fill: "none",
8
+ viewBox: "0 0 24 24",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ stroke: "currentColor",
12
+ strokeLinecap: "round",
13
+ strokeLinejoin: "round",
14
+ strokeWidth: 2,
15
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"
16
+ })
17
+ });
18
+ var open_in_chat = SvgOpenInChat;
19
+ export default open_in_chat;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgOpenai = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 16,
6
+ height: 16,
7
+ fill: "currentColor",
8
+ viewBox: "0 0 24 24",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ d: "M22.282 9.821a5.99 5.99 0 0 0-.516-4.91 6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.99 5.99 0 0 0-3.998 2.9 6.05 6.05 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.05 6.05 0 0 0 6.515 2.9A5.99 5.99 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206 6 6 0 0 0 3.997-2.9 6.06 6.06 0 0 0-.747-7.073zM13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023-.141-.085-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08-4.778 2.758a.8.8 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5Z"
12
+ })
13
+ });
14
+ var openai = SvgOpenai;
15
+ export default openai;
@@ -1,25 +1,32 @@
1
+ import { A } from './a.js';
1
2
  import { Code } from './code.js';
3
+ import { Hr } from './hr.js';
4
+ import { Img } from './img.js';
5
+ import { Li, Ol, Ul } from './list.js';
6
+ import { Blockquote, P, Strong } from './paragraph.js';
2
7
  import { ShikiPre } from './pre.js';
8
+ import { Td, Th, Tr } from './table.js';
9
+ import { H1, H2, H3, H4, H5, H6 } from './title.js';
3
10
  export declare function getCustomMDXComponent(): {
4
- h1: (props: React.ComponentProps<'h1'>) => import("react").JSX.Element;
5
- h2: (props: React.ComponentProps<'h2'>) => import("react").JSX.Element;
6
- h3: (props: React.ComponentProps<'h3'>) => import("react").JSX.Element;
7
- h4: (props: React.ComponentProps<'h4'>) => import("react").JSX.Element;
8
- h5: (props: React.ComponentProps<'h5'>) => import("react").JSX.Element;
9
- h6: (props: React.ComponentProps<'h6'>) => import("react").JSX.Element;
10
- ul: (props: import("react").ComponentProps<'ul'>) => import("react").JSX.Element;
11
- ol: (props: import("react").ComponentProps<'ol'>) => import("react").JSX.Element;
12
- li: (props: import("react").ComponentProps<'li'>) => import("react").JSX.Element;
11
+ h1: typeof H1;
12
+ h2: typeof H2;
13
+ h3: typeof H3;
14
+ h4: typeof H4;
15
+ h5: typeof H5;
16
+ h6: typeof H6;
17
+ ul: typeof Ul;
18
+ ol: typeof Ol;
19
+ li: typeof Li;
13
20
  table: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & import("react").RefAttributes<HTMLTableElement>>;
14
- td: (props: import("react").ComponentProps<'td'>) => import("react").JSX.Element;
15
- th: (props: import("react").ComponentProps<'th'>) => import("react").JSX.Element;
16
- tr: (props: import("react").ComponentProps<'tr'>) => import("react").JSX.Element;
17
- hr: (props: import("react").ComponentProps<'hr'>) => import("react").JSX.Element;
18
- p: (props: import("react").ComponentProps<'p'>) => import("react").JSX.Element;
19
- blockquote: (props: import("react").ComponentProps<'blockquote'>) => import("react").JSX.Element;
20
- strong: (props: import("react").ComponentProps<'strong'>) => import("react").JSX.Element;
21
- a: (props: import("react").ComponentProps<'a'>) => import("react").JSX.Element;
21
+ td: typeof Td;
22
+ th: typeof Th;
23
+ tr: typeof Tr;
24
+ hr: typeof Hr;
25
+ p: typeof P;
26
+ blockquote: typeof Blockquote;
27
+ strong: typeof Strong;
28
+ a: typeof A;
22
29
  code: typeof Code;
23
- img: (props: import("react").ComponentProps<'img'>) => import("react").JSX.Element;
30
+ img: typeof Img;
24
31
  pre: typeof ShikiPre;
25
32
  };
@@ -21,7 +21,7 @@ const H1 = (props)=>{
21
21
  })
22
22
  ]
23
23
  }),
24
- process.env.ENABLE_LLMS_UI && 'title' === placement && /*#__PURE__*/ jsxs(LlmsContainer, {
24
+ import.meta.env.ENABLE_LLMS_UI && 'title' === placement && /*#__PURE__*/ jsxs(LlmsContainer, {
25
25
  children: [
26
26
  /*#__PURE__*/ jsx(LlmsCopyButton, {}),
27
27
  /*#__PURE__*/ jsx(LlmsViewOptions, {})
@@ -57,6 +57,7 @@
57
57
  height: 100%;
58
58
  padding: 2rem;
59
59
  transition: all .3s;
60
+ overflow: hidden;
60
61
  }
61
62
 
62
63
  .rp-home-feature__card--clickable {
@@ -24,44 +24,42 @@ function HomeFeatureItem({ feature }) {
24
24
  const { icon, title, details, link } = feature;
25
25
  const { innerProps, outerProps, outerRef, shineDom } = useCardAnimation();
26
26
  const navigate = useLinkNavigate();
27
- return /*#__PURE__*/ jsxs("div", {
27
+ return /*#__PURE__*/ jsx("div", {
28
28
  ...outerProps,
29
29
  className: `rp-home-feature__item ${getGridClass(feature)}`,
30
30
  ref: outerRef,
31
- children: [
32
- /*#__PURE__*/ jsx("div", {
33
- className: "rp-home-feature__item-wrapper",
34
- ...innerProps,
35
- children: /*#__PURE__*/ jsxs("article", {
36
- className: `rp-home-feature__card ${link ? 'rp-home-feature__card--clickable' : ''}`,
37
- onClick: ()=>{
38
- if (link) navigate(link);
39
- },
40
- children: [
41
- /*#__PURE__*/ jsxs("div", {
42
- className: "rp-home-feature__title-wrapper",
43
- children: [
44
- icon ? /*#__PURE__*/ jsx("div", {
45
- className: "rp-home-feature__icon",
46
- children: /*#__PURE__*/ jsx(SvgWrapper, {
47
- icon: icon
48
- })
49
- }) : null,
50
- /*#__PURE__*/ jsx("h2", {
51
- className: "rp-home-feature__title",
52
- children: title
31
+ children: /*#__PURE__*/ jsx("div", {
32
+ className: "rp-home-feature__item-wrapper",
33
+ ...innerProps,
34
+ children: /*#__PURE__*/ jsxs("article", {
35
+ className: `rp-home-feature__card ${link ? 'rp-home-feature__card--clickable' : ''}`,
36
+ onClick: ()=>{
37
+ if (link) navigate(link);
38
+ },
39
+ children: [
40
+ /*#__PURE__*/ jsxs("div", {
41
+ className: "rp-home-feature__title-wrapper",
42
+ children: [
43
+ icon ? /*#__PURE__*/ jsx("div", {
44
+ className: "rp-home-feature__icon",
45
+ children: /*#__PURE__*/ jsx(SvgWrapper, {
46
+ icon: icon
53
47
  })
54
- ]
55
- }),
56
- /*#__PURE__*/ jsx("p", {
57
- className: "rp-home-feature__detail",
58
- ...renderHtmlOrText(details)
59
- })
60
- ]
61
- }, title)
62
- }),
63
- shineDom
64
- ]
48
+ }) : null,
49
+ /*#__PURE__*/ jsx("h2", {
50
+ className: "rp-home-feature__title",
51
+ children: title
52
+ })
53
+ ]
54
+ }),
55
+ /*#__PURE__*/ jsx("p", {
56
+ className: "rp-home-feature__detail",
57
+ ...renderHtmlOrText(details)
58
+ }),
59
+ shineDom
60
+ ]
61
+ }, title)
62
+ })
65
63
  }, title);
66
64
  }
67
65
  function HomeFeature({ features: featuresProp }) {
@@ -38,6 +38,13 @@
38
38
  transition: opacity .3s ease-in-out, visibility 0s linear .3s;
39
39
  }
40
40
 
41
+ .rp-nav-menu__item:hover > .rp-hover-group--hidden, .rp-nav-hamburger:hover > .rp-hover-group--hidden {
42
+ visibility: visible;
43
+ opacity: 1;
44
+ pointer-events: auto;
45
+ transition: opacity .3s ease-in-out;
46
+ }
47
+
41
48
  .rp-hover-group__item {
42
49
  white-space: nowrap;
43
50
  height: 32px;
@@ -29,7 +29,7 @@ export interface LinkProps extends ComponentProps<'a'> {
29
29
  * Link can tell whether it's in current site or external site.
30
30
  * 1. If external, open a new page and navigate to it.
31
31
  * 2. If inCurrentPage, scroll to anchor.
32
- * 3. If inCurrentSite, it will navigate and scroll to anchor, preload the asyncChunk onHover the link
32
+ * 3. If inCurrentSite, it will navigate and scroll to anchor, prefetch route resources when hovering over the link.
33
33
  * 4. Link is styled.
34
34
  */
35
35
  export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
@@ -9,7 +9,7 @@ export declare function getHref(href: string): {
9
9
  * For import { Link } from '@rspress/core/theme';
10
10
  * useNavigate with preload logic
11
11
  */
12
- export declare function useLinkNavigate({ startTransition }?: {
12
+ export declare function useLinkNavigate({ startTransition, }?: {
13
13
  startTransition?: TransitionStartFunction;
14
14
  }): (href: string) => Promise<void>;
15
15
  export {};