@rspress/core 2.0.23 → 2.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/cli/index.js +2 -2
  2. package/dist/{common-Qw-RoVFD.js → common-Bo3KCGim.js} +4 -1
  3. package/dist/config/loadConfigFile.js +1 -1
  4. package/dist/eject-theme/components/CdnTabs/index.test.tsx +71 -0
  5. package/dist/eject-theme/components/CdnTabs/index.tsx +175 -0
  6. package/dist/eject-theme/components/DocContent/index.tsx +0 -3
  7. package/dist/eject-theme/components/FallbackHeading/index.tsx +6 -1
  8. package/dist/eject-theme/components/Link/getHref.ts +1 -0
  9. package/dist/eject-theme/components/Link/index.tsx +9 -21
  10. package/dist/eject-theme/components/Link/useLinkNavigate.ts +43 -54
  11. package/dist/eject-theme/components/NavTitle/index.test.tsx +78 -0
  12. package/dist/eject-theme/components/NavTitle/index.tsx +9 -5
  13. package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +79 -1
  14. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +25 -12
  15. package/dist/eject-theme/components/Search/NoSearchResult.scss +1 -2
  16. package/dist/eject-theme/components/Search/SearchPanel.scss +75 -63
  17. package/dist/eject-theme/components/Search/SuggestItem.scss +28 -41
  18. package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +4 -1
  19. package/dist/eject-theme/components/Search/useSearchPanel.ts +103 -36
  20. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +8 -0
  21. package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +3 -0
  22. package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +4 -1
  23. package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +1 -1
  24. package/dist/entry/worker.js +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/node/PluginDriver.d.ts +5 -0
  27. package/dist/node/PluginDriver.js +17 -2
  28. package/dist/node/auto-nav-sidebar/index.js +1 -1
  29. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  30. package/dist/node/auto-nav-sidebar/normalize.js +1 -1
  31. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  32. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  33. package/dist/node/constants.js +1 -1
  34. package/dist/node/eject.js +1 -1
  35. package/dist/node/initRsbuild.js +19 -7
  36. package/dist/node/llms.d.ts +1 -1
  37. package/dist/node/llms.js +2 -2
  38. package/dist/node/logger/hint.d.ts +1 -0
  39. package/dist/node/logger/hint.js +8 -2
  40. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -0
  41. package/dist/node/mdx/remarkPlugins/link.js +1 -1
  42. package/dist/node/route/RoutePage.js +1 -1
  43. package/dist/node/route/RouteService.js +1 -1
  44. package/dist/node/route/extractPageData.js +1 -1
  45. package/dist/node/route/normalizeRoutePath.js +1 -1
  46. package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.d.ts → i18n/DEFAULT_I18N_TEXT.d.ts} +28 -0
  47. package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.js → i18n/DEFAULT_I18N_TEXT.js} +28 -0
  48. package/dist/node/runtimeModule/i18n/getI18nData.d.ts +11 -0
  49. package/dist/node/runtimeModule/{i18n.js → i18n/getI18nData.js} +35 -22
  50. package/dist/node/runtimeModule/i18n/rsbuildPlugin.d.ts +5 -0
  51. package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +21 -0
  52. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  53. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  54. package/dist/node/runtimeModule/searchHooks.js +2 -2
  55. package/dist/node/runtimeModule/siteData/createSiteData.d.ts +2 -1
  56. package/dist/node/runtimeModule/siteData/createSiteData.js +3 -3
  57. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.d.ts +2 -1
  58. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +3 -4
  59. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +2 -2
  60. package/dist/node/serve.js +1 -1
  61. package/dist/node/sitemap.d.ts +7 -0
  62. package/dist/node/sitemap.js +86 -0
  63. package/dist/node/ssg/alternateLinks.js +1 -1
  64. package/dist/node/ssg/htmlFile.js +1 -1
  65. package/dist/node/ssg/renderHtmlTemplate.js +1 -1
  66. package/dist/node/ssg/renderPage.js +1 -1
  67. package/dist/node/ssg/renderPageWorker.js +1 -1
  68. package/dist/node/ssg/renderPages.js +2 -2
  69. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  70. package/dist/node/ssg/ssgEnv.js +1 -1
  71. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  72. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  73. package/dist/node/ssg-md/renderPage.js +5 -4
  74. package/dist/node/ssg-md/renderPages.js +2 -2
  75. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  76. package/dist/node/utils/checkLanguageParity.js +1 -1
  77. package/dist/node/utils/createHash.js +1 -1
  78. package/dist/node/utils/flattenMdxContent.js +1 -1
  79. package/dist/node/utils/getPageKey.js +1 -1
  80. package/dist/node/utils/reactAlias.js +6 -3
  81. package/dist/{a~0.js → p~0.js} +23 -18
  82. package/dist/runtime/App.js +20 -29
  83. package/dist/runtime/BrowserOnly.d.ts +1 -1
  84. package/dist/runtime/BrowserOnly.js +53 -20
  85. package/dist/runtime/ClientApp.d.ts +3 -2
  86. package/dist/runtime/ClientApp.js +31 -21
  87. package/dist/runtime/ErrorRoute.d.ts +1 -0
  88. package/dist/runtime/ErrorRoute.js +30 -0
  89. package/dist/runtime/NoSSR.d.ts +7 -3
  90. package/dist/runtime/NoSSR.js +30 -9
  91. package/dist/runtime/PageRoute.d.ts +2 -0
  92. package/dist/runtime/PageRoute.js +70 -0
  93. package/dist/runtime/createServerRouter.d.ts +4 -0
  94. package/dist/runtime/createServerRouter.js +17 -0
  95. package/dist/runtime/csrClientEntry.js +5 -2
  96. package/dist/runtime/hooks/useWebMcp.d.ts +36 -0
  97. package/dist/runtime/hooks/useWebMcp.js +80 -0
  98. package/dist/runtime/index.d.ts +6 -3
  99. package/dist/runtime/index.js +6 -5
  100. package/dist/runtime/initPageData.d.ts +0 -3
  101. package/dist/runtime/initPageData.js +9 -45
  102. package/dist/runtime/pageDataLoader.d.ts +11 -0
  103. package/dist/runtime/pageDataLoader.js +7 -0
  104. package/dist/runtime/react.d.ts +5 -0
  105. package/dist/runtime/react.js +4 -0
  106. package/dist/runtime/reactDom.d.ts +6 -0
  107. package/dist/runtime/reactDom.js +2 -1
  108. package/dist/runtime/socialLinks.d.ts +1 -0
  109. package/dist/runtime/socialLinks.js +3 -0
  110. package/dist/runtime/ssrClientEntry.js +14 -6
  111. package/dist/runtime/ssrMdServerEntry.js +10 -21
  112. package/dist/runtime/ssrServerEntry.js +10 -21
  113. package/dist/static/assets/package.json +58 -0
  114. package/dist/theme/assets/bun.js +101 -0
  115. package/dist/theme/assets/deno.js +15 -0
  116. package/dist/theme/assets/jsdelivr.js +53 -0
  117. package/dist/theme/{components/PackageManagerTabs/icons/Npm.js → assets/npm.js} +4 -4
  118. package/dist/theme/{components/PackageManagerTabs/icons/Pnpm.js → assets/pnpm.js} +4 -4
  119. package/dist/theme/assets/unpkg.js +15 -0
  120. package/dist/theme/assets/yarn.js +22 -0
  121. package/dist/theme/components/CdnTabs/index.d.ts +10 -0
  122. package/dist/theme/components/CdnTabs/index.js +146 -0
  123. package/dist/theme/components/DocContent/index.js +1 -2
  124. package/dist/theme/components/FallbackHeading/index.js +1 -0
  125. package/dist/theme/components/Link/index.js +4 -17
  126. package/dist/theme/components/Link/useLinkNavigate.d.ts +2 -2
  127. package/dist/theme/components/Link/useLinkNavigate.js +22 -36
  128. package/dist/theme/components/NavTitle/index.js +10 -5
  129. package/dist/theme/components/PackageManagerTabs/index.d.ts +2 -0
  130. package/dist/theme/components/PackageManagerTabs/index.js +22 -12
  131. package/dist/theme/components/Search/NoSearchResult.css +1 -2
  132. package/dist/theme/components/Search/SearchPanel.css +72 -51
  133. package/dist/theme/components/Search/SuggestItem.css +21 -34
  134. package/dist/theme/components/Search/logic/providers/LocalProvider.js +4 -1
  135. package/dist/theme/components/Search/useSearchPanel.js +74 -26
  136. package/dist/theme/components/Sidebar/SidebarItem.css +5 -0
  137. package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -0
  138. package/dist/theme/components/SocialLinks/GithubStars.js +1 -1
  139. package/dist/theme/hooks/useDynamicToc.js +27 -34
  140. package/dist/theme/hooks/useWebMcpNavigation.d.ts +6 -0
  141. package/dist/theme/hooks/useWebMcpNavigation.js +123 -0
  142. package/dist/theme/hooks/useWebMcpPageList.d.ts +6 -0
  143. package/dist/theme/hooks/useWebMcpPageList.js +25 -0
  144. package/dist/theme/hooks/useWebMcpPageReading.d.ts +7 -0
  145. package/dist/theme/hooks/useWebMcpPageReading.js +23 -0
  146. package/dist/theme/hooks/useWebMcpSiteInfo.d.ts +6 -0
  147. package/dist/theme/hooks/useWebMcpSiteInfo.js +22 -0
  148. package/dist/theme/icons.d.ts +7 -0
  149. package/dist/theme/icons.js +15 -1
  150. package/dist/theme/index.d.ts +6 -2
  151. package/dist/theme/index.js +6 -2
  152. package/dist/theme/layout/ErrorLayout/index.css +52 -0
  153. package/dist/theme/layout/ErrorLayout/index.d.ts +8 -0
  154. package/dist/theme/layout/ErrorLayout/index.js +76 -0
  155. package/dist/theme/layout/Layout/index.js +1 -2
  156. package/dist/theme/webMcp/tools.d.ts +56 -0
  157. package/dist/theme/webMcp/tools.js +122 -0
  158. package/dist/theme/webMcp/types.d.ts +35 -0
  159. package/dist/theme/webMcp/types.js +0 -0
  160. package/dist/tinypool~0.js +19 -49
  161. package/dist/y~0.js +166 -0
  162. package/package.json +18 -18
  163. package/dist/b~0.js +0 -106
  164. package/dist/eject-theme/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  165. package/dist/eject-theme/components/PackageManagerTabs/icons/Deno.tsx +0 -18
  166. package/dist/eject-theme/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  167. package/dist/eject-theme/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  168. package/dist/eject-theme/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  169. package/dist/node/runtimeModule/i18n.d.ts +0 -8
  170. package/dist/theme/components/PackageManagerTabs/icons/Bun.d.ts +0 -2
  171. package/dist/theme/components/PackageManagerTabs/icons/Bun.js +0 -137
  172. package/dist/theme/components/PackageManagerTabs/icons/Deno.d.ts +0 -2
  173. package/dist/theme/components/PackageManagerTabs/icons/Deno.js +0 -15
  174. package/dist/theme/components/PackageManagerTabs/icons/Npm.d.ts +0 -2
  175. package/dist/theme/components/PackageManagerTabs/icons/Pnpm.d.ts +0 -2
  176. package/dist/theme/components/PackageManagerTabs/icons/Yarn.d.ts +0 -2
  177. package/dist/theme/components/PackageManagerTabs/icons/Yarn.js +0 -22
  178. package/dist/theme/logic/useScrollAfterNav.d.ts +0 -5
  179. package/dist/theme/logic/useScrollAfterNav.js +0 -35
  180. package/dist/theme/logic/useScrollReset.d.ts +0 -5
  181. package/dist/theme/logic/useScrollReset.js +0 -12
@@ -74,6 +74,14 @@
74
74
  display: flex;
75
75
  align-items: center;
76
76
  gap: 4px;
77
+ // Long unbroken labels can make scrollIntoView on the active entry shift
78
+ // and clip its group: https://github.com/web-infra-dev/rspress/pull/3777
79
+ overflow-wrap: anywhere;
80
+
81
+ > .rp-doc code {
82
+ // Override inline code's own wrapping rule, also when nested in bold text.
83
+ overflow-wrap: anywhere;
84
+ }
77
85
  }
78
86
 
79
87
  &__icon {
@@ -16,6 +16,9 @@
16
16
  font-size: 14px;
17
17
  color: var(--rp-c-text-1);
18
18
  font-weight: 600;
19
+ // Wrap long section headers, including inline code, beside icons and tags.
20
+ // https://github.com/web-infra-dev/rspress/pull/3777
21
+ overflow-wrap: anywhere;
19
22
  }
20
23
 
21
24
  &__icon {
@@ -1,7 +1,10 @@
1
- import { afterEach, describe, expect, it } from '@rstest/core';
1
+ import { afterEach, describe, expect, it, rs } from '@rstest/core';
2
2
  import { renderToStaticMarkup } from 'react-dom/server';
3
+ import { useStorageValue } from '../../logic/useStorageValue';
3
4
  import { GithubStars } from './GithubStars';
4
5
 
6
+ rs.mock('@rspress/core/theme', () => ({ useStorageValue }));
7
+
5
8
  const originalLocalStorage = Object.getOwnPropertyDescriptor(
6
9
  globalThis,
7
10
  'localStorage',
@@ -1,5 +1,5 @@
1
+ import { useStorageValue } from '@rspress/core/theme';
1
2
  import { type ReactNode, useEffect, useState } from 'react';
2
- import { useStorageValue } from '../../logic/useStorageValue';
3
3
 
4
4
  const TTL_MS = 60 * 60 * 1000;
5
5
 
@@ -1,4 +1,4 @@
1
- import { isMovable, kRequestCountField, kResponseCountField, kTransferable, kValue } from "../common-Qw-RoVFD.js";
1
+ import { isMovable, kRequestCountField, kResponseCountField, kTransferable, kValue } from "../common-Bo3KCGim.js";
2
2
  import { stderr, stdout } from "../utils-De75vAgL.js";
3
3
  import { getHandler, throwInNextTick } from "../utils-B--2TaWv.js";
4
4
  import { parentPort, receiveMessageOnPort, workerData } from "node:worker_threads";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { DarkMode, EditLink, Feature, FrontMatterMeta, Header, Hero, I18nText, LlmsTxtContext, LlmsTxtPage, LlmsTxtRenderer, LlmsTxtSection, LocalSearchOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedSidebarGroup, PageIndexInfo, RemotePageInfo, RouteMeta, RspressPlugin, Sidebar, SidebarData, SidebarDivider, SidebarGroup, SidebarItem, SidebarSectionHeader, SocialLink, UserConfig, } from '@rspress/shared';
1
+ export type { DarkMode, EditLink, Feature, FrontMatterMeta, Header, Hero, I18nText, LlmsTxtContext, LlmsTxtPage, LlmsTxtRenderer, LlmsTxtSection, LocalSearchOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedSidebarGroup, PageIndexInfo, RemotePageInfo, RouteMeta, RspressPlugin, Sidebar, SidebarData, SidebarDivider, SidebarGroup, SidebarItem, SidebarSectionHeader, SitemapOptions, SocialLink, UserConfig, } from '@rspress/shared';
2
2
  export { getSidebarDataGroup, normalizeHref, normalizePosixPath, RSPRESS_TEMP_DIR, removeTrailingSlash, withBase, withSiteOrigin, } from '@rspress/shared';
3
3
  export { logger } from '@rspress/shared/logger';
4
4
  export { getIconUrlPath, getNodeAttribute, mergeDocConfig, } from '@rspress/shared/node-utils';
@@ -1,3 +1,4 @@
1
+ import type { TransformContext } from '@rsbuild/core';
1
2
  import { type PageIndexInfo, type RouteMeta, type RspressPlugin, type UserConfig } from '@rspress/shared';
2
3
  import type { RouteService } from './route/RouteService.js';
3
4
  type RspressPluginHookKeys = 'beforeBuild' | 'config' | 'afterBuild' | 'addPages' | 'addRuntimeModules' | 'routeGenerated' | 'routeServiceGenerated' | 'extendPageData' | 'modifySearchIndexData' | 'i18nSource';
@@ -14,6 +15,10 @@ export declare class PluginDriver {
14
15
  removePlugin(pluginName: string): void;
15
16
  private normalizeConfig;
16
17
  modifyConfig(): Promise<UserConfig>;
18
+ getI18nData(context?: Pick<TransformContext, 'addDependency' | 'addMissingDependency'>): Promise<{
19
+ [x: string]: Record<string, string>;
20
+ }>;
21
+ invalidateI18nData(): void;
17
22
  beforeBuild(): Promise<void[]>;
18
23
  afterBuild(): Promise<void[]>;
19
24
  modifySearchIndexData(pages: PageIndexInfo[]): Promise<void[]>;
@@ -1,10 +1,12 @@
1
- import { addTrailingSlash, node_path, addLeadingSlash } from "../a~0.js";
1
+ import { addTrailingSlash, node_path, addLeadingSlash } from "../p~0.js";
2
+ import { createI18nDataLoader } from "./runtimeModule/i18n/getI18nData.js";
2
3
  import { createError } from "./utils/error.js";
3
4
  import { haveNavSidebarConfig as auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
4
5
  class PluginDriver {
5
6
  #config;
6
7
  #plugins;
7
8
  #isProd;
9
+ #i18nData;
8
10
  haveNavSidebarConfig = false;
9
11
  static async create(config, configFilePathOrIsProd, isProd = false) {
10
12
  if ('boolean' == typeof configFilePathOrIsProd) isProd = configFilePathOrIsProd;
@@ -16,6 +18,7 @@ class PluginDriver {
16
18
  this.#config = config;
17
19
  this.#isProd = isProd;
18
20
  this.#plugins = [];
21
+ this.#i18nData = createI18nDataLoader(()=>this.#config, this);
19
22
  }
20
23
  async init() {
21
24
  this.clearPlugins();
@@ -53,18 +56,24 @@ class PluginDriver {
53
56
  async normalizeConfig() {
54
57
  this.#config.root ??= 'docs';
55
58
  this.#config.ssg ??= true;
56
- this.#config.llms ??= false;
59
+ this.#config.llms ??= true;
60
+ this.#config.webMcp ??= true;
61
+ this.#config.sitemap ??= true;
62
+ this.#config.route ??= {};
63
+ this.#config.route.cleanUrls ??= true;
57
64
  this.#config.base = addTrailingSlash(addLeadingSlash(this.#config.base ?? '/'));
58
65
  this.#config.lang ??= 'en';
59
66
  this.#config.themeDir ??= node_path.join(process.cwd(), 'theme');
60
67
  }
61
68
  async modifyConfig() {
69
+ this.invalidateI18nData();
62
70
  this.normalizeConfig();
63
71
  let config = this.#config;
64
72
  for(let i = 0; i < this.#plugins.length; i++){
65
73
  const plugin = this.#plugins[i];
66
74
  if ('function' == typeof plugin.config) config = await plugin.config(config || {}, {
67
75
  addPlugin: this.addPlugin.bind(this),
76
+ getI18nData: this.getI18nData.bind(this),
68
77
  removePlugin: (pluginName)=>{
69
78
  const index = this.#plugins.findIndex((item)=>item.name === pluginName);
70
79
  this.removePlugin(pluginName);
@@ -76,6 +85,12 @@ class PluginDriver {
76
85
  this.haveNavSidebarConfig = auto_nav_sidebar_haveNavSidebarConfig(config);
77
86
  return this.#config;
78
87
  }
88
+ getI18nData(context) {
89
+ return this.#i18nData.get(context);
90
+ }
91
+ invalidateI18nData() {
92
+ this.#i18nData.invalidate();
93
+ }
79
94
  async beforeBuild() {
80
95
  return this._runParallelAsyncHook('beforeBuild', this.#config || {}, this.#isProd);
81
96
  }
@@ -1,4 +1,4 @@
1
- import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../a~0.js";
1
+ import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../p~0.js";
2
2
  import { processLocales, combineWalkResult } from "./locales.js";
3
3
  import { walk } from "./walk.js";
4
4
  async function runAutoNavSide(config, metaFileSet, mdFileSet) {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../a~0.js";
1
+ import { node_path } from "../../p~0.js";
2
2
  import { walk } from "./walk.js";
3
3
  function combineWalkResult(walks, versions) {
4
4
  return walks.reduce((acc, cur, curIndex)=>({
@@ -1,6 +1,6 @@
1
1
  import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
2
  import "../../t~0.js";
3
- import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../a~0.js";
3
+ import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../p~0.js";
4
4
  import { createError } from "../utils/error.js";
5
5
  import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
6
6
  import { absolutePathToRoutePath, addRoutePrefix } from "../route/RoutePage.js";
@@ -1,4 +1,4 @@
1
- import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../a~0.js";
1
+ import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../p~0.js";
2
2
  import { createError } from "../utils/error.js";
3
3
  async function pathExists(path) {
4
4
  try {
@@ -1,4 +1,4 @@
1
- import { isExternalUrl, node_path, promises } from "../../a~0.js";
1
+ import { isExternalUrl, node_path, promises } from "../../p~0.js";
2
2
  import { pathExists } from "../utils/fs.js";
3
3
  import { readJson } from "./utils.js";
4
4
  import { addRoutePrefix } from "../route/RoutePage.js";
@@ -1,4 +1,4 @@
1
- import { isDarkModeSwitchEnabled, node_path, package_namespaceObject, getDefaultDarkModeValue, createRequire } from "../b~0.js";
1
+ import { isDarkModeSwitchEnabled, node_path, package_namespaceObject, getDefaultDarkModeValue, createRequire } from "../y~0.js";
2
2
  const constants_require = createRequire(import.meta.url);
3
3
  const RSPRESS_VERSION = package_namespaceObject.rE;
4
4
  const APPEARANCE_KEY = 'rspress-theme-appearance';
@@ -1,6 +1,6 @@
1
1
  import { rspackRequire, compatGetDefaultExport } from "../rslib-runtime~0.js";
2
2
  import "../t~0.js";
3
- import { node_path, logger, promises } from "../a~0.js";
3
+ import { node_path, logger, promises } from "../p~0.js";
4
4
  import { EJECTED_THEME } from "./constants.js";
5
5
  const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
6
6
  var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
@@ -1,22 +1,23 @@
1
- import { external_node_process_cwd, node_path, fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, removeTrailingSlash, normalizeDarkMode, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../a~0.js";
1
+ import { external_node_process_cwd, node_path, fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, removeTrailingSlash, normalizeDarkMode, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../p~0.js";
2
2
  import { createError } from "./utils/error.js";
3
3
  import { CSR_CLIENT_ENTRY, SSR_CLIENT_ENTRY, OUTPUT_DIR, SSG_MD_SERVER_ENTRY, NODE_SSG_BUNDLE_FOLDER, getInlineLocaleRedirectScript, isProduction, PACKAGE_ROOT, SSR_SERVER_ENTRY, TEMPLATE_PATH, NODE_SSG_MD_BUNDLE_FOLDER, DEFAULT_THEME, NODE_SSG_MD_BUNDLE_NAME, getInlineThemeScript, DEFAULT_TITLE, NODE_SSG_BUNDLE_NAME } from "./constants.js";
4
4
  import { isLlmsUIEnabled, isLlmsHintEnabled } from "./llms.js";
5
5
  import { RouteChunkAssetsPlugin } from "./route/routeChunkAssets.js";
6
6
  import { hintBuilderPluginsBreakingChange, hintThemeBreakingChange } from "./logger/hint.js";
7
7
  import { resolveReactRouterDomAlias, resolveReactRenderToMarkdownAlias, resolveReactAlias } from "./utils/reactAlias.js";
8
+ import { rsbuildPluginI18n } from "./runtimeModule/i18n/rsbuildPlugin.js";
8
9
  import { rsbuildPluginDocVM } from "./runtimeModule/pageData/rsbuildPlugin.js";
9
10
  import { socialLinksVMPlugin } from "./runtimeModule/socialLinks.js";
10
- import { i18nVMPlugin } from "./runtimeModule/i18n.js";
11
11
  import { globalUIComponentsVMPlugin } from "./runtimeModule/globalUIComponents.js";
12
12
  import { globalStylesVMPlugin } from "./runtimeModule/globalStyles.js";
13
13
  import { searchHookVMPlugin } from "./runtimeModule/searchHooks.js";
14
14
  import { routeListVMPlugin } from "./runtimeModule/routeList.js";
15
15
  import { siteDataVMPlugin } from "./runtimeModule/siteData/rsbuildPlugin.js";
16
+ import { rsbuildPluginSitemap } from "./sitemap.js";
16
17
  import { rsbuildPluginSSG } from "./ssg/rsbuildPluginSSG.js";
17
18
  import { rsbuildPluginCSR } from "./ssg/rsbuildPluginCSR.js";
18
19
  import { rsbuildPluginSSGMD } from "./ssg-md/rsbuildPluginSSGMD.js";
19
- import { package_namespaceObject } from "../b~0.js";
20
+ import { package_namespaceObject } from "../y~0.js";
20
21
  function isPluginIncluded(config, pluginName) {
21
22
  return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
22
23
  }
@@ -71,6 +72,9 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
71
72
  ...isPluginIncluded(config, PLUGIN_REACT_NAME) ? [] : [
72
73
  pluginReact()
73
74
  ],
75
+ rsbuildPluginI18n({
76
+ pluginDriver
77
+ }),
74
78
  rsbuildPluginDocVM({
75
79
  config,
76
80
  pluginDriver,
@@ -81,7 +85,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
81
85
  tempDir: '.rspress/runtime',
82
86
  virtualModules: {
83
87
  ...socialLinksVMPlugin(context),
84
- ...i18nVMPlugin(context),
85
88
  ...globalUIComponentsVMPlugin(context),
86
89
  ...globalStylesVMPlugin(context),
87
90
  ...searchHookVMPlugin(context),
@@ -90,6 +93,10 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
90
93
  ...siteDataVMPlugin(context)
91
94
  }
92
95
  }),
96
+ config.sitemap ? rsbuildPluginSitemap({
97
+ config,
98
+ routeService
99
+ }) : null,
93
100
  enableSSG && config.ssg ? rsbuildPluginSSG({
94
101
  routeService,
95
102
  config,
@@ -186,12 +193,16 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
186
193
  PACKAGE_ROOT
187
194
  ],
188
195
  define: {
196
+ 'import.meta.env.ENABLE_WEBMCP': JSON.stringify(false !== config.webMcp),
197
+ 'import.meta.env.WEBMCP_EXPOSED_TO': JSON.stringify('object' == typeof config.webMcp ? config.webMcp.exposedTo ?? [] : []),
189
198
  'import.meta.env.ENABLE_LLMS_UI': JSON.stringify(enableLlmsUI),
190
- 'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(enableLlmsHint)
199
+ 'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(enableLlmsHint),
200
+ 'import.meta.env.ENABLE_SSG_MD': JSON.stringify(Boolean(enableSSG && config.llms))
191
201
  }
192
202
  },
193
203
  performance: {
194
204
  printFileSize: {
205
+ detail: false,
195
206
  compressed: true
196
207
  },
197
208
  ...'false' !== process.env.RSPRESS_PERSISTENT_CACHE ? {
@@ -283,7 +294,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
283
294
  },
284
295
  source: {
285
296
  entry: {
286
- index: enableSSG && isProduction() ? SSR_CLIENT_ENTRY : CSR_CLIENT_ENTRY
297
+ index: enableSSG && config.ssg && isProduction() ? SSR_CLIENT_ENTRY : CSR_CLIENT_ENTRY
287
298
  },
288
299
  define: {
289
300
  'process.env.__SSR__': JSON.stringify(false),
@@ -361,7 +372,8 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
361
372
  define: {
362
373
  'process.env.__SSR__': JSON.stringify(true),
363
374
  'process.env.__SSR_MD__': JSON.stringify(true),
364
- 'import.meta.env.SSG_MD': JSON.stringify(true)
375
+ 'import.meta.env.SSG_MD': JSON.stringify(true),
376
+ 'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(isLlmsHintEnabled(config, enableSSG, 'markdown'))
365
377
  }
366
378
  },
367
379
  output: {
@@ -1,3 +1,3 @@
1
1
  import type { UserConfig } from '@rspress/shared';
2
2
  export declare function isLlmsUIEnabled(config: UserConfig): boolean;
3
- export declare function isLlmsHintEnabled(config: UserConfig, enableSSG: boolean): boolean;
3
+ export declare function isLlmsHintEnabled(config: UserConfig, enableSSG: boolean, output?: 'html' | 'markdown'): boolean;
package/dist/node/llms.js CHANGED
@@ -1,8 +1,8 @@
1
1
  function isLlmsUIEnabled(config) {
2
2
  return Boolean(config.themeConfig?.llmsUI ?? config.llms);
3
3
  }
4
- function isLlmsHintEnabled(config, enableSSG) {
4
+ function isLlmsHintEnabled(config, enableSSG, output = 'html') {
5
5
  const llmsUI = config.themeConfig?.llmsUI;
6
- return enableSSG && false !== config.ssg && isLlmsUIEnabled(config) && ('object' != typeof llmsUI || false !== llmsUI.injectLlmsHint);
6
+ return enableSSG && ('markdown' === output ? Boolean(config.llms) : false !== config.ssg) && isLlmsUIEnabled(config) && ('object' != typeof llmsUI || false !== llmsUI.injectLlmsHint);
7
7
  }
8
8
  export { isLlmsHintEnabled, isLlmsUIEnabled };
@@ -7,6 +7,7 @@ import type { NavJson } from '../auto-nav-sidebar/type.js';
7
7
  export declare function hintThemeBreakingChange(customThemeDir: string): Promise<void>;
8
8
  export declare function hintBuilderPluginsBreakingChange(config: UserConfig): void;
9
9
  export declare function hintSSGFailed(): void;
10
+ export declare function hintSSGMDFailed(): void;
10
11
  /**
11
12
  * Print "ssg: false" explicitly to give users a clear perception.
12
13
  */
@@ -63,7 +63,13 @@ let isSSGFailedLogged = false;
63
63
  function hintSSGFailed() {
64
64
  if (isSSGFailedLogged) return;
65
65
  isSSGFailedLogged = true;
66
- logger.info("[Rspress v2] `ssg: true` requires the source code to support SSR. If the code is not compatible to SSR, the build process will fail. You can try:\n 1. Fix code to make it SSR-compatible.\n 2. Set `ssg: false` if the code in node_modules may be difficult to fix, but the SSG feature will be lost.");
66
+ logger.info("[Rspress v2] SSG requires the source code to support SSR. If the code is not compatible with SSR, the build process will fail. You can try:\n 1. Fix code to make it SSR-compatible.\n 2. Set `ssg: false` to disable SSG if the code is difficult to fix.");
67
+ }
68
+ let isSSGMDFailedLogged = false;
69
+ function hintSSGMDFailed() {
70
+ if (isSSGMDFailedLogged) return;
71
+ isSSGMDFailedLogged = true;
72
+ logger.info("[Rspress v2] SSG-MD requires the source code to support SSR. If the code is not compatible with SSR, Markdown rendering will fail. You can try:\n 1. Fix code to make it SSR-compatible.\n 2. Set `llms: false` and use @rspress/plugin-llms to generate Markdown, llms.txt, and llms-full.txt without SSR: https://rspress.rs/plugin/official-plugins/llms");
67
73
  }
68
74
  function hintSSGFalse() {
69
75
  logger.info('`ssg: false` detected, SSG will be disabled.');
@@ -92,4 +98,4 @@ function hintRelativeMarkdownLink() {
92
98
  isLogged = true;
93
99
  logger.info('[Rspress v2] Markdown links without "./" prefix are now relative links, e.g: [](guide/getting-started) is equal to [](./guide/getting-started). You can rewrite it to [](/guide/getting-started) to always use absolute links, or use [](./getting-started.md)');
94
100
  }
95
- export { hintBuilderPluginsBreakingChange, hintNavJsonChangeThenPanic, hintReactVersion, hintRelativeMarkdownLink, hintSSGFailed, hintSSGFalse, hintThemeBreakingChange };
101
+ export { hintBuilderPluginsBreakingChange, hintNavJsonChangeThenPanic, hintReactVersion, hintRelativeMarkdownLink, hintSSGFailed, hintSSGFalse, hintSSGMDFailed, hintThemeBreakingChange };
@@ -42,6 +42,7 @@ function create(node) {
42
42
  properties: {
43
43
  class: 'rp-header-anchor',
44
44
  ariaHidden: 'true',
45
+ tabIndex: -1,
45
46
  href: `#${node.properties.id}`
46
47
  },
47
48
  children: [
@@ -156,7 +156,7 @@ function normalizeLink(nodeUrl, routeService, filePath, cleanUrls, autoPrefix, d
156
156
  };
157
157
  }
158
158
  const remarkLink = ({ cleanUrls, routeService, remarkLinkOptions, lint, __base, __siteOrigin })=>(tree, file)=>{
159
- const { checkAnchors: shouldCheckAnchors = false, checkDeadLinks: shouldCheckDeadLinks = true, autoPrefix = true } = remarkLinkOptions ?? {};
159
+ const { checkAnchors: shouldCheckAnchors = true, checkDeadLinks: shouldCheckDeadLinks = true, autoPrefix = true } = remarkLinkOptions ?? {};
160
160
  const deadLinks = new Map();
161
161
  const anchorLinks = new Map();
162
162
  visit(tree, 'link', (node)=>{
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../a~0.js";
1
+ import { node_path } from "../../p~0.js";
2
2
  import { RouteService } from "./RouteService.js";
3
3
  import { getPageKey } from "../utils/getPageKey.js";
4
4
  import { slash } from "../utils/slash.js";
@@ -1,4 +1,4 @@
1
- import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../a~0.js";
1
+ import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../p~0.js";
2
2
  import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
3
3
  import { createError } from "../utils/error.js";
4
4
  import { getRouteChunkName } from "./routeChunkAssets.js";
@@ -1,4 +1,4 @@
1
- import { unified, node_path, promises, loadFrontMatter, extractTextAndId, remark_gfm, remark_parse, MDX_OR_MD_REGEXP } from "../../a~0.js";
1
+ import { unified, node_path, promises, loadFrontMatter, extractTextAndId, remark_gfm, remark_parse, MDX_OR_MD_REGEXP } from "../../p~0.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 "../../a~0.js";
1
+ import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../p~0.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 [
@@ -181,6 +181,34 @@ export declare const DEFAULT_I18N_TEXT: {
181
181
  readonly ko: '홈으로 이동';
182
182
  readonly ru: 'Вернуться на главную';
183
183
  };
184
+ readonly errorTitleText: {
185
+ readonly en: 'Something went wrong';
186
+ readonly zh: '页面出了点问题';
187
+ readonly ja: 'エラーが発生しました';
188
+ readonly ko: '문제가 발생했습니다';
189
+ readonly ru: 'Что-то пошло не так';
190
+ };
191
+ readonly errorDescriptionText: {
192
+ readonly en: 'This page could not be loaded. Try reloading it or return to the home page.';
193
+ readonly zh: '页面未能正常加载,请尝试重新加载,或返回首页。';
194
+ readonly ja: 'ページを読み込めませんでした。再読み込みするか、ホームに戻ってください。';
195
+ readonly ko: '페이지를 불러올 수 없습니다. 새로고침하거나 홈으로 돌아가세요.';
196
+ readonly ru: 'Не удалось загрузить страницу. Попробуйте обновить её или вернуться на главную.';
197
+ };
198
+ readonly reloadPageText: {
199
+ readonly en: 'Reload page';
200
+ readonly zh: '重新加载';
201
+ readonly ja: '再読み込み';
202
+ readonly ko: '새로고침';
203
+ readonly ru: 'Обновить страницу';
204
+ };
205
+ readonly errorDetailsText: {
206
+ readonly en: 'Error details';
207
+ readonly zh: '错误详情';
208
+ readonly ja: 'エラーの詳細';
209
+ readonly ko: '오류 세부 정보';
210
+ readonly ru: 'Подробности ошибки';
211
+ };
184
212
  readonly promptCopyText: {
185
213
  readonly en: 'Copy Prompt';
186
214
  readonly zh: '复制 Prompt';
@@ -181,6 +181,34 @@ const DEFAULT_I18N_TEXT = {
181
181
  ko: '홈으로 이동',
182
182
  ru: 'Вернуться на главную'
183
183
  },
184
+ errorTitleText: {
185
+ en: 'Something went wrong',
186
+ zh: '页面出了点问题',
187
+ ja: 'エラーが発生しました',
188
+ ko: '문제가 발생했습니다',
189
+ ru: 'Что-то пошло не так'
190
+ },
191
+ errorDescriptionText: {
192
+ en: 'This page could not be loaded. Try reloading it or return to the home page.',
193
+ zh: '页面未能正常加载,请尝试重新加载,或返回首页。',
194
+ ja: 'ページを読み込めませんでした。再読み込みするか、ホームに戻ってください。',
195
+ ko: '페이지를 불러올 수 없습니다. 새로고침하거나 홈으로 돌아가세요.',
196
+ ru: 'Не удалось загрузить страницу. Попробуйте обновить её или вернуться на главную.'
197
+ },
198
+ reloadPageText: {
199
+ en: 'Reload page',
200
+ zh: '重新加载',
201
+ ja: '再読み込み',
202
+ ko: '새로고침',
203
+ ru: 'Обновить страницу'
204
+ },
205
+ errorDetailsText: {
206
+ en: 'Error details',
207
+ zh: '错误详情',
208
+ ja: 'エラーの詳細',
209
+ ko: '오류 세부 정보',
210
+ ru: 'Подробности ошибки'
211
+ },
184
212
  promptCopyText: {
185
213
  en: 'Copy Prompt',
186
214
  zh: '复制 Prompt',
@@ -0,0 +1,11 @@
1
+ import type { TransformContext } from '@rsbuild/core';
2
+ import type { UserConfig } from '@rspress/shared';
3
+ import type { PluginDriver } from '../../PluginDriver.js';
4
+ type I18nData = Record<string, Record<string, string>>;
5
+ type I18nDependencyContext = Pick<TransformContext, 'addDependency' | 'addMissingDependency'>;
6
+ export declare function createI18nDataLoader(getConfig: () => UserConfig, pluginDriver: PluginDriver): {
7
+ get(context?: I18nDependencyContext): Promise<I18nData>;
8
+ invalidate(): void;
9
+ };
10
+ export declare function getI18nData(docConfig: UserConfig, pluginDriver?: PluginDriver): Promise<I18nData>;
11
+ export {};
@@ -1,13 +1,38 @@
1
- import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
- import "../../t~0.js";
3
- import { createRequire, join, logger } from "../../a~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../../rslib-runtime~0.js";
2
+ import "../../../t~0.js";
3
+ import { logger, join, readFile } from "../../../p~0.js";
4
+ import { pathExists } from "../../utils/fs.js";
4
5
  import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
5
- import { createError } from "../utils/error.js";
6
- import { pathExists } from "../utils/fs.js";
6
+ import { createError } from "../../utils/error.js";
7
7
  const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
8
  var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
9
- const i18n_require = createRequire(import.meta.url);
10
9
  const DEFAULT_I18N_SOURCE_PATH = join(process.cwd(), 'i18n.json');
10
+ function createI18nDataLoader(getConfig, pluginDriver) {
11
+ let snapshotPromise;
12
+ const load = async ()=>{
13
+ const config = getConfig();
14
+ const sourcePath = config.i18nSourcePath ?? DEFAULT_I18N_SOURCE_PATH;
15
+ const sourceExists = await pathExists(sourcePath);
16
+ const data = getI18nData(config, pluginDriver);
17
+ return {
18
+ data,
19
+ sourcePath,
20
+ sourceExists
21
+ };
22
+ };
23
+ return {
24
+ async get (context) {
25
+ snapshotPromise ??= load();
26
+ const snapshot = await snapshotPromise;
27
+ if (context) if (snapshot.sourceExists) context.addDependency(snapshot.sourcePath);
28
+ else context.addMissingDependency(snapshot.sourcePath);
29
+ return snapshot.data;
30
+ },
31
+ invalidate () {
32
+ snapshotPromise = void 0;
33
+ }
34
+ };
35
+ }
11
36
  function mergeI18nData(...sources) {
12
37
  const result = {};
13
38
  for (const source of sources)for(const key in source){
@@ -30,8 +55,8 @@ async function getI18nData(docConfig, pluginDriver) {
30
55
  if (i18nSourceFromPlugin) i18nSourceFull = i18nSourceFromPlugin;
31
56
  let i18nSourceFromJson = {};
32
57
  try {
33
- delete i18n_require.cache[i18nSourcePath];
34
- i18nSourceFromJson = i18n_require(i18nSourcePath);
58
+ const content = await readFile(i18nSourcePath, 'utf8');
59
+ i18nSourceFromJson = JSON.parse(content.replace(/^\uFEFF/, ''));
35
60
  } catch (e) {
36
61
  logger.debug('getI18nData from i18n.json Failed: \n', e instanceof Error ? e.message : '');
37
62
  }
@@ -71,17 +96,5 @@ async function getI18nData(docConfig, pluginDriver) {
71
96
  }
72
97
  return filteredI18nSource;
73
98
  }
74
- const i18nVMPlugin = (context)=>{
75
- const { config, pluginDriver } = context;
76
- return {
77
- ["virtual-i18n-text"]: async ({ addDependency, addMissingDependency })=>{
78
- const configPath = config.i18nSourcePath || DEFAULT_I18N_SOURCE_PATH;
79
- const isExist = await pathExists(configPath);
80
- if (isExist) addDependency(configPath);
81
- else addMissingDependency(configPath);
82
- const i18nData = await getI18nData(config, pluginDriver);
83
- return `export default ${JSON.stringify(i18nData, null, 2)}`;
84
- }
85
- };
86
- };
87
- export { getI18nData, i18nVMPlugin };
99
+ var getI18nData_getI18nData = void 0;
100
+ export { createI18nDataLoader, getI18nData_getI18nData as getI18nData };
@@ -0,0 +1,5 @@
1
+ import type { RsbuildPlugin } from '@rsbuild/core';
2
+ import type { PluginDriver } from '../../PluginDriver.js';
3
+ export declare const rsbuildPluginI18n: ({ pluginDriver, }: {
4
+ pluginDriver: PluginDriver;
5
+ }) => RsbuildPlugin[];
@@ -0,0 +1,21 @@
1
+ import { pluginVirtualModule } from "../../../p~0.js";
2
+ const rsbuildPluginI18n = ({ pluginDriver })=>[
3
+ {
4
+ name: 'rspress:i18n',
5
+ setup (api) {
6
+ api.onBeforeDevCompile(({ isFirstCompile })=>{
7
+ if (!isFirstCompile) pluginDriver.invalidateI18nData();
8
+ });
9
+ }
10
+ },
11
+ pluginVirtualModule({
12
+ tempDir: '.rspress/runtime',
13
+ virtualModules: {
14
+ ["virtual-i18n-text"]: async (context)=>{
15
+ const data = await pluginDriver.getI18nData(context);
16
+ return `export default ${JSON.stringify(data, null, 2)}`;
17
+ }
18
+ }
19
+ })
20
+ ];
21
+ export { rsbuildPluginI18n };
@@ -1,4 +1,4 @@
1
- import { SEARCH_INDEX_NAME, groupBy } from "../../../a~0.js";
1
+ import { SEARCH_INDEX_NAME, groupBy } from "../../../p~0.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 "../../../a~0.js";
1
+ import { logger, pluginVirtualModule } from "../../../p~0.js";
2
2
  import { createPageData } from "./createPageData.js";
3
3
  const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
4
4
  const ref = {
@@ -1,8 +1,8 @@
1
- import { node_path } from "../../a~0.js";
1
+ import { node_path } from "../../p~0.js";
2
2
  const searchHookVMPlugin = (context)=>({
3
3
  ["virtual-search-hooks"]: ()=>{
4
4
  const { config } = context;
5
- let content = 'export const onSearch = () => {};';
5
+ let content = 'export {};';
6
6
  const searchHooks = 'object' == typeof config.search && config.search?.searchHooks;
7
7
  if (searchHooks) content = `export * from ${JSON.stringify(node_path.posix.normalize(searchHooks))}`;
8
8
  return content;
@@ -1,4 +1,5 @@
1
1
  import type { SiteData, UserConfig } from '@rspress/shared';
2
- export declare function createSiteData(userConfig: UserConfig): Promise<{
2
+ import type { PluginDriver } from '../../PluginDriver.js';
3
+ export declare function createSiteData(userConfig: UserConfig, pluginDriver: PluginDriver): Promise<{
3
4
  siteData: Omit<SiteData, 'root' | 'pages'>;
4
5
  }>;