@rspress/core 2.0.16 → 2.0.17

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 (86) 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 → 7448.js} +1 -1
  5. package/dist/{5580.js → 8629.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/Link/index.tsx +1 -1
  10. package/dist/eject-theme/components/Link/useLinkNavigate.ts +17 -4
  11. package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +48 -0
  12. package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +35 -20
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +2 -1
  15. package/dist/node/PluginDriver.js +1 -1
  16. package/dist/node/auto-nav-sidebar/index.js +1 -1
  17. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  18. package/dist/node/auto-nav-sidebar/normalize.js +2 -2
  19. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  20. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  21. package/dist/node/constants.js +1 -1
  22. package/dist/node/eject.js +2 -2
  23. package/dist/node/initRsbuild.js +5 -5
  24. package/dist/node/logger/hint.js +1 -1
  25. package/dist/node/mdx/options.js +1 -1
  26. package/dist/node/mdx/processor.js +1 -1
  27. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  28. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  29. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  30. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  31. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +2 -2
  32. package/dist/node/mdx/remarkPlugins/image.js +2 -2
  33. package/dist/node/mdx/remarkPlugins/link.js +2 -2
  34. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  35. package/dist/node/medium-zoom/index.js +1 -1
  36. package/dist/node/route/RoutePage.js +1 -1
  37. package/dist/node/route/RouteService.js +1 -1
  38. package/dist/node/route/extractPageData.js +1 -1
  39. package/dist/node/route/normalizeRoutePath.js +1 -1
  40. package/dist/node/runtimeModule/i18n.js +3 -3
  41. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  42. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  43. package/dist/node/runtimeModule/searchHooks.js +1 -1
  44. package/dist/node/runtimeModule/siteData/createSiteData.js +6 -2
  45. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  46. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  47. package/dist/node/serve.js +1 -1
  48. package/dist/node/ssg/htmlFile.js +1 -1
  49. package/dist/node/ssg/renderPage.js +2 -2
  50. package/dist/node/ssg/renderPageWorker.js +2 -2
  51. package/dist/node/ssg/renderPages.js +3 -3
  52. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  53. package/dist/node/ssg/ssgEnv.js +1 -1
  54. package/dist/node/ssg-md/llms/emitLlmsTxt.js +3 -3
  55. package/dist/node/ssg-md/llms/llmsTxt.d.ts +3 -3
  56. package/dist/node/ssg-md/llms/llmsTxt.js +8 -8
  57. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  58. package/dist/node/ssg-md/renderPage.js +2 -2
  59. package/dist/node/ssg-md/renderPages.js +3 -3
  60. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  61. package/dist/node/utils/checkLanguageParity.js +1 -1
  62. package/dist/node/utils/createHash.js +1 -1
  63. package/dist/node/utils/error.js +1 -1
  64. package/dist/node/utils/flattenMdxContent.js +1 -1
  65. package/dist/node/utils/fs.js +1 -1
  66. package/dist/node/utils/getPageKey.js +1 -1
  67. package/dist/node/utils/normalizePath.js +1 -1
  68. package/dist/node/utils/reactAlias.js +2 -2
  69. package/dist/runtime/ClientApp.js +3 -2
  70. package/dist/runtime/route.js +2 -0
  71. package/dist/theme/components/DocContent/docComponents/index.d.ts +25 -18
  72. package/dist/theme/components/Link/index.d.ts +1 -1
  73. package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
  74. package/dist/theme/components/Link/useLinkNavigate.js +13 -5
  75. package/dist/theme/components/Search/SearchPanel.js +8 -8
  76. package/dist/theme/components/SocialLinks/GithubStars.js +27 -17
  77. package/dist/theme/logic/getCopyableText.js +1 -0
  78. package/package.json +9 -9
  79. package/dist/6010.js +0 -2461
  80. package/dist/{0~8787.js → 0~8016.js} +0 -0
  81. package/dist/{7986.js → 4538.js} +0 -0
  82. package/dist/{3358.js → 5357.js} +0 -0
  83. package/dist/{8005.js → 7748.js} +2 -2
  84. /package/dist/{5580.js.LICENSE.txt → 8629.js.LICENSE.txt} +0 -0
  85. /package/dist/{6646.js → 9857.js} +0 -0
  86. /package/dist/{9283.js → 9940.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9283.js";
1
+ import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9940.js";
2
2
  const cssVariablesTheme = createCssVariablesTheme({
3
3
  name: 'css-variables',
4
4
  variablePrefix: '--shiki-',
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../../9283.js";
1
+ import { node_path } from "../../../9940.js";
2
2
  import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
3
3
  const remarkBuiltin = ({ globalComponents })=>(tree)=>{
4
4
  const demos = globalComponents.map((componentPath)=>{
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../../0~rslib-runtime.js";
2
- import "../../../7986.js";
3
- import { visit, node_path, logger, cwd, readFile } from "../../../3358.js";
2
+ import "../../../4538.js";
3
+ import { visit, node_path, logger, cwd, readFile } from "../../../5357.js";
4
4
  import { createError } from "../../utils/error.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,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../../0~rslib-runtime.js";
2
- import "../../../7986.js";
3
- import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../3358.js";
2
+ import "../../../4538.js";
3
+ import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../5357.js";
4
4
  import { createError } from "../../utils/error.js";
5
5
  import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
6
6
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../../0~rslib-runtime.js";
2
- import "../../../7986.js";
3
- import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, MDX_OR_MD_REGEXP, withBase } from "../../../3358.js";
2
+ import "../../../4538.js";
3
+ import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, MDX_OR_MD_REGEXP, withBase } from "../../../5357.js";
4
4
  import { hintRelativeMarkdownLink } from "../../logger/hint.js";
5
5
  import { createError } from "../../utils/error.js";
6
6
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
@@ -1,4 +1,4 @@
1
- import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../8005.js";
1
+ import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../7748.js";
2
2
  const extractChildText = (child, preserveInlineMarkdown = true)=>{
3
3
  if ('link' === child.type) return child.children?.map((child)=>extractChildText(child, preserveInlineMarkdown)).join('') ?? '';
4
4
  if ('strong' === child.type) {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../0~8787.js";
1
+ import { node_path } from "../../0~8016.js";
2
2
  import { PACKAGE_ROOT } from "../constants.js";
3
3
  function pluginMediumZoom(options = {}) {
4
4
  return {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../6010.js";
1
+ import { node_path } from "../../8629.js";
2
2
  import { RouteService } from "./RouteService.js";
3
3
  import { normalizePath, slash } from "../utils/normalizePath.js";
4
4
  import { getPageKey } from "../utils/getPageKey.js";
@@ -1,4 +1,4 @@
1
- import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../6010.js";
1
+ import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../8629.js";
2
2
  import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
3
3
  import { createError } from "../utils/error.js";
4
4
  import { getRoutePathParts, normalizeRoutePath, splitRoutePathParts } from "./normalizeRoutePath.js";
@@ -1,4 +1,4 @@
1
- import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../6010.js";
1
+ import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../8629.js";
2
2
  import { applyReplaceRules } from "../utils/applyReplaceRules.js";
3
3
  import { flattenMdxContent } from "../utils/flattenMdxContent.js";
4
4
  import { importStatementRegex } from "../constants.js";
@@ -1,4 +1,4 @@
1
- import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../6010.js";
1
+ import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../8629.js";
2
2
  const getRoutePathParts = (relativePath, lang, version, langs, versions)=>{
3
3
  const [versionPart, langPart, purePath] = splitRoutePathParts(relativePath, lang, version, langs, versions);
4
4
  return [
@@ -1,12 +1,12 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../7986.js";
3
- import { external_node_module_createRequire, join, logger } from "../../6010.js";
2
+ import "../../4538.js";
3
+ import { createRequire, join, logger } from "../../8629.js";
4
4
  import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
5
5
  import { createError } from "../utils/error.js";
6
6
  import { pathExists } from "../utils/fs.js";
7
7
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
8
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
9
- const i18n_require = external_node_module_createRequire(import.meta.url);
9
+ const i18n_require = createRequire(import.meta.url);
10
10
  const DEFAULT_I18N_SOURCE_PATH = join(process.cwd(), 'i18n.json');
11
11
  function mergeI18nData(...sources) {
12
12
  const result = {};
@@ -1,4 +1,4 @@
1
- import { SEARCH_INDEX_NAME, groupBy } from "../../../6010.js";
1
+ import { SEARCH_INDEX_NAME, groupBy } from "../../../8629.js";
2
2
  import { extractPageData } from "../../route/extractPageData.js";
3
3
  import { createHash } from "../../utils/createHash.js";
4
4
  function deletePrivateField(obj) {
@@ -1,4 +1,4 @@
1
- import { logger, pluginVirtualModule } from "../../../6010.js";
1
+ import { logger, pluginVirtualModule } from "../../../8629.js";
2
2
  import { createPageData } from "./createPageData.js";
3
3
  const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
4
4
  const ref = {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../6010.js";
1
+ import { node_path } from "../../8629.js";
2
2
  const searchHookVMPlugin = (context)=>({
3
3
  ["virtual-search-hooks"]: ()=>{
4
4
  const { config } = context;
@@ -1,14 +1,18 @@
1
- import { getIconUrlPath } from "../../../6010.js";
1
+ import { getIconUrlPath } from "../../../8629.js";
2
2
  import { normalizeThemeConfig } from "./normalizeThemeConfig.js";
3
3
  async function createSiteData(userConfig) {
4
4
  const tempSearchObj = Object.assign({}, userConfig.search);
5
5
  if (tempSearchObj) tempSearchObj.searchHooks = void 0;
6
6
  const siteData = {
7
7
  base: userConfig.base ?? '/',
8
+ siteOrigin: userConfig.siteOrigin ?? '',
8
9
  title: userConfig?.title || '',
9
10
  description: userConfig?.description || '',
10
11
  icon: getIconUrlPath(userConfig?.icon) || '',
11
- route: userConfig?.route || {},
12
+ route: {
13
+ useTransitions: true,
14
+ ...userConfig?.route
15
+ },
12
16
  themeConfig: await normalizeThemeConfig(userConfig),
13
17
  lang: userConfig?.lang || '',
14
18
  locales: userConfig?.locales || userConfig.themeConfig?.locales || [],
@@ -1,4 +1,4 @@
1
- import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../6010.js";
1
+ import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../8629.js";
2
2
  import { getI18nData } from "../i18n.js";
3
3
  import { applyReplaceRules } from "../../utils/applyReplaceRules.js";
4
4
  async function normalizeThemeConfig(docConfig) {
@@ -1,4 +1,4 @@
1
- import { isProduction, logger } from "../../../6010.js";
1
+ import { isProduction, logger } from "../../../8629.js";
2
2
  import { modifyConfigWithAutoNavSide } from "../../auto-nav-sidebar/index.js";
3
3
  import { createSiteData } from "./createSiteData.js";
4
4
  const siteDataVMPlugin = (context)=>{
@@ -1,4 +1,4 @@
1
- import { mergeRsbuildConfig } from "../6010.js";
1
+ import { mergeRsbuildConfig } from "../8629.js";
2
2
  import { PluginDriver } from "./PluginDriver.js";
3
3
  import { initRsbuild } from "./initRsbuild.js";
4
4
  import { RouteService } from "./route/RouteService.js";
@@ -1,4 +1,4 @@
1
- import { external_node_path_resolve, relative, isAbsolute } from "../../9958.js";
1
+ import { external_node_path_resolve, relative, isAbsolute } from "../../7448.js";
2
2
  const routePath2HtmlFileName = (routePath)=>{
3
3
  let fileName = routePath;
4
4
  fileName = fileName.endsWith('/') ? `${routePath}index.html` : `${routePath}.html`;
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../7986.js";
3
- import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../9958.js";
2
+ import "../../4538.js";
3
+ import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../7448.js";
4
4
  import { hintSSGFailed } from "../logger/hint.js";
5
5
  import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
6
6
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
@@ -1,7 +1,7 @@
1
- import { writeFile, mkdir, dirname, workerData } from "../../6646.js";
1
+ import { writeFile, mkdir, dirname, workerData } from "../../9857.js";
2
2
  import { createError } from "../utils/error.js";
3
3
  import { resolveHtmlFilePath } from "./htmlFile.js";
4
- import { pMap } from "../../9958.js";
4
+ import { pMap } from "../../7448.js";
5
5
  import { renderPage } from "./renderPage.js";
6
6
  const params = workerData?.[1]?.params;
7
7
  if (!params) throw createError('SSG Worker Thread workerData params missing');
@@ -1,10 +1,10 @@
1
1
  /*! LICENSE: renderPages.js.LICENSE.txt */
2
2
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
3
- import "../../7986.js";
4
- import { chunk, logger } from "../../6010.js";
3
+ import "../../4538.js";
4
+ import { chunk, logger } from "../../8629.js";
5
5
  import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
6
6
  import { routePath2HtmlFileName } from "./htmlFile.js";
7
- import { pMap } from "../../9958.js";
7
+ import { pMap } from "../../7448.js";
8
8
  import { renderPage } from "./renderPage.js";
9
9
  import { hintSSGFailed } from "../logger/hint.js";
10
10
  import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
@@ -1,4 +1,4 @@
1
- import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../6010.js";
1
+ import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../8629.js";
2
2
  import { NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME } from "../constants.js";
3
3
  import { renderPages } from "./renderPages.js";
4
4
  const rsbuildPluginSSG = ({ routeService, config })=>({
@@ -1,5 +1,5 @@
1
1
  /*! LICENSE: ssgEnv.js.LICENSE.txt */
2
- import { node_os } from "../../6010.js";
2
+ import { node_os } from "../../8629.js";
3
3
  /**
4
4
  * these codes are copied from
5
5
  * @link https://github.com/facebook/docusaurus/blob/45065e8d2b5831117b8d69fec1be28f5520cf105/packages/docusaurus/src/ssg/ssgEnv.ts#L11
@@ -1,4 +1,4 @@
1
- import { matchPath, getSidebarDataGroup } from "../../../6010.js";
1
+ import { matchPath, getSidebarDataGroup } from "../../../8629.js";
2
2
  import { generateLlmsTxt, generateLlmsFullTxt } from "./llmsTxt.js";
3
3
  async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
4
4
  const base = config.base ?? '/';
@@ -56,8 +56,8 @@ async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
56
56
  others.push(routePath);
57
57
  });
58
58
  for (const routeGroup of routeGroups)organizeBySidebar(sidebar, routeGroup);
59
- const llmsTxtContent = await generateLlmsTxt(routeGroups, others, navList, config.title, config.description, config.base, routeService);
60
- const llmsFullTxtContent = generateLlmsFullTxt(routeGroups, navList, others, base, mdContents);
59
+ const llmsTxtContent = await generateLlmsTxt(routeGroups, others, navList, config.title, config.description, config.base, config.siteOrigin, routeService);
60
+ const llmsFullTxtContent = generateLlmsFullTxt(routeGroups, navList, others, base, config.siteOrigin, mdContents);
61
61
  const langPrefix = defaultLang === lang ? '' : `${lang}/`;
62
62
  const versionPrefix = isMultiVersion && version !== defaultVersion ? `${version}/` : '';
63
63
  const prefix = `${versionPrefix}${langPrefix}`;
@@ -1,10 +1,10 @@
1
1
  import { 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): 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,12 +1,12 @@
1
- import { normalizeHref, logger, withBase } from "../../../6010.js";
1
+ import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../8629.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) {
9
+ async function generateLlmsTxt(routeGroups, others, navList, title, description, base, siteOrigin, routeService) {
10
10
  const lines = [];
11
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
12
  const summary = title ? `# ${title}${description ? `\n\n> ${description}` : ''}` : '';
@@ -29,7 +29,7 @@ async function generateLlmsTxt(routeGroups, others, navList, title, description,
29
29
  title = info.title;
30
30
  description = info.description;
31
31
  }
32
- return `- [${title}](${routePathToMdPath(routePath, base)})${description ? `: ${description}` : ''}`;
32
+ return `- [${title}](${routePathToMdPath(routePath, base, siteOrigin)})${description ? `: ${description}` : ''}`;
33
33
  }))).filter((i)=>Boolean(i));
34
34
  if (routeLines.length > 0) {
35
35
  const title = text;
@@ -52,13 +52,13 @@ async function generateLlmsTxt(routeGroups, others, navList, title, description,
52
52
  llmsTxt = summary ? lines.length > 0 ? `${summary}\n${lines.join('\n')}` : summary : lines.join('\n').trimStart();
53
53
  return llmsTxt;
54
54
  }
55
- function generateLlmsFullTxt(routeGroups, navList, others, base, mdContents) {
55
+ function generateLlmsFullTxt(routeGroups, navList, others, base, siteOrigin, mdContents) {
56
56
  const lines = [];
57
57
  for(let i = 0; i < navList.length; i++){
58
58
  const routeGroup = routeGroups[i];
59
59
  if (0 !== routeGroup.length) for (const routePath of routeGroup){
60
60
  lines.push(`---
61
- url: ${routePathToMdPath(routePath, base)}
61
+ url: ${routePathToMdPath(routePath, base, siteOrigin)}
62
62
  ---
63
63
  `);
64
64
  lines.push(mdContents.get(routePath) ?? '');
@@ -67,7 +67,7 @@ url: ${routePathToMdPath(routePath, base)}
67
67
  }
68
68
  for (const routePath of others){
69
69
  lines.push(`---
70
- url: ${routePathToMdPath(routePath, base)}
70
+ url: ${routePathToMdPath(routePath, base, siteOrigin)}
71
71
  ---
72
72
  `);
73
73
  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 "../../8629.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 "../../8629.js";
4
+ import { pMap } from "../../7448.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 "../../8629.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 "../../8629.js";
2
2
  import { createError } from "./error.js";
3
3
  function normalizePath(filePath) {
4
4
  return filePath.split(node_path.sep).join('/');
@@ -1,4 +1,4 @@
1
- import { createHash as external_node_crypto_createHash } from "../../6010.js";
1
+ import { createHash as external_node_crypto_createHash } from "../../8629.js";
2
2
  function createHash(str) {
3
3
  return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
4
4
  }
@@ -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 "../../8629.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 "../../8629.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 "../../8629.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,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, {})
@@ -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,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
  };
@@ -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 {};
@@ -1,4 +1,4 @@
1
- import { cleanUrlByConfig, initPageData, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, warmPageData, withBase } from "@rspress/core/runtime";
1
+ import { cleanUrlByConfig, initPageData, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, useSite, warmPageData, withBase } from "@rspress/core/runtime";
2
2
  import nprogress from "nprogress";
3
3
  import { startTransition as external_react_startTransition, useCallback } from "react";
4
4
  nprogress.configure({
@@ -29,14 +29,17 @@ function getHref(href) {
29
29
  linkType
30
30
  };
31
31
  }
32
- function useLinkNavigate({ startTransition } = {
32
+ function useLinkNavigate({ startTransition = external_react_startTransition } = {
33
33
  startTransition: external_react_startTransition
34
34
  }) {
35
35
  const { pathname: currPagePathname } = useLocation();
36
36
  const navigate = useNavigate();
37
+ const { site } = useSite();
38
+ const useTransitions = site?.route?.useTransitions;
37
39
  return useCallback(async (href)=>{
38
40
  const { linkType, removeBaseHref, withBaseHref } = getHref(href);
39
41
  if ('external' === linkType || 'hashOnly' === linkType) return void window.location.assign(href);
42
+ const isTransitionable = !!(useTransitions && startTransition);
40
43
  const preloadChunkThenNavigate = async ()=>{
41
44
  const inCurrPage = isActive(removeBaseHref, currPagePathname);
42
45
  if (!import.meta.env.SSR && !inCurrPage) {
@@ -52,15 +55,20 @@ function useLinkNavigate({ startTransition } = {
52
55
  nprogress.done();
53
56
  }
54
57
  }
55
- await navigate(removeBaseHref, {
58
+ if (isTransitionable) startTransition(()=>navigate(removeBaseHref, {
59
+ replace: false
60
+ }));
61
+ else navigate(removeBaseHref, {
56
62
  replace: false
57
63
  });
58
64
  };
59
- if (startTransition) startTransition(preloadChunkThenNavigate);
65
+ if (isTransitionable) startTransition(preloadChunkThenNavigate);
60
66
  else preloadChunkThenNavigate();
61
67
  }, [
68
+ useTransitions,
62
69
  currPagePathname,
63
- navigate
70
+ navigate,
71
+ startTransition
64
72
  ]);
65
73
  }
66
74
  export { getHref, useLinkNavigate };