@rspress/core 2.0.20 → 2.0.22

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 (179) hide show
  1. package/dist/cli/index.js +12 -13
  2. package/dist/config/loadConfigFile.d.ts +3 -4
  3. package/dist/config/loadConfigFile.js +13 -17
  4. package/dist/{7748~0.js → d~0.js} +0 -2
  5. package/dist/eject-theme/components/Banner/index.tsx +50 -9
  6. package/dist/eject-theme/components/Callout/index.scss +6 -1
  7. package/dist/eject-theme/components/CodeBlock/index.scss +2 -0
  8. package/dist/eject-theme/components/DocContent/doc.scss +2 -2
  9. package/dist/eject-theme/components/Link/getHref.test.ts +33 -0
  10. package/dist/eject-theme/components/Link/getHref.ts +60 -0
  11. package/dist/eject-theme/components/Link/index.tsx +7 -6
  12. package/dist/eject-theme/components/Link/useLinkNavigate.ts +6 -51
  13. package/dist/eject-theme/components/Llms/LlmsHint.test.tsx +8 -0
  14. package/dist/eject-theme/components/Llms/LlmsHint.tsx +11 -3
  15. package/dist/eject-theme/components/Nav/NavMenu.scss +19 -3
  16. package/dist/eject-theme/components/Nav/NavMenu.tsx +20 -13
  17. package/dist/eject-theme/components/Nav/index.scss +3 -1
  18. package/dist/eject-theme/components/Nav/index.tsx +30 -4
  19. package/dist/eject-theme/components/NavHamburger/index.tsx +11 -3
  20. package/dist/eject-theme/components/NavList/context.ts +3 -0
  21. package/dist/eject-theme/components/NavList/index.tsx +24 -0
  22. package/dist/eject-theme/components/NavScreen/NavScreenMenu.test.tsx +59 -0
  23. package/dist/eject-theme/components/NavScreen/NavScreenMenu.tsx +43 -2
  24. package/dist/eject-theme/components/NavScreen/index.scss +0 -6
  25. package/dist/eject-theme/components/NavScreen/index.tsx +20 -3
  26. package/dist/eject-theme/components/Prompt/index.scss +2 -1
  27. package/dist/eject-theme/components/ReadPercent/useReadPercent.ts +1 -1
  28. package/dist/eject-theme/components/Search/SearchButton.scss +1 -0
  29. package/dist/eject-theme/components/Search/SearchPanel.scss +51 -12
  30. package/dist/eject-theme/components/Search/SearchPanel.tsx +54 -212
  31. package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +38 -16
  32. package/dist/eject-theme/components/Search/useSearchPanel.ts +216 -0
  33. package/dist/eject-theme/components/Steps/index.scss +1 -1
  34. package/dist/eject-theme/components/SwitchAppearance/getClipPath.test.ts +15 -0
  35. package/dist/eject-theme/components/SwitchAppearance/getClipPath.ts +26 -0
  36. package/dist/eject-theme/components/SwitchAppearance/global.scss +18 -0
  37. package/dist/eject-theme/components/SwitchAppearance/index.tsx +26 -35
  38. package/dist/eject-theme/components/Tabs/index.tsx +14 -14
  39. package/dist/index.js +1 -1
  40. package/dist/node/PluginDriver.d.ts +1 -1
  41. package/dist/node/PluginDriver.js +5 -9
  42. package/dist/node/auto-nav-sidebar/index.js +1 -1
  43. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  44. package/dist/node/auto-nav-sidebar/normalize.js +6 -6
  45. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  46. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  47. package/dist/node/build.d.ts +3 -2
  48. package/dist/node/build.js +9 -3
  49. package/dist/node/constants.js +1 -1
  50. package/dist/node/dev.d.ts +4 -4
  51. package/dist/node/dev.js +8 -6
  52. package/dist/node/eject.js +5 -5
  53. package/dist/node/initRsbuild.d.ts +2 -3
  54. package/dist/node/initRsbuild.js +9 -7
  55. package/dist/node/last-updated/index.js +2 -2
  56. package/dist/node/logger/hint.js +4 -4
  57. package/dist/node/mdx/options.js +1 -1
  58. package/dist/node/mdx/processor.js +3 -3
  59. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  60. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  61. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  62. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  63. package/dist/node/mdx/remarkPlugins/containerSyntax.js +6 -5
  64. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +5 -5
  65. package/dist/node/mdx/remarkPlugins/image.js +5 -5
  66. package/dist/node/mdx/remarkPlugins/link.js +5 -5
  67. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  68. package/dist/node/medium-zoom/index.js +1 -1
  69. package/dist/node/route/RoutePage.js +6 -4
  70. package/dist/node/route/RouteService.js +3 -3
  71. package/dist/node/route/extractPageData.js +20 -7
  72. package/dist/node/route/normalizeRoutePath.js +1 -1
  73. package/dist/node/runtimeModule/i18n.js +5 -5
  74. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  75. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  76. package/dist/node/runtimeModule/searchHooks.js +1 -1
  77. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  78. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  79. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  80. package/dist/node/serve.d.ts +3 -3
  81. package/dist/node/serve.js +10 -4
  82. package/dist/node/ssg/alternateLinks.js +1 -1
  83. package/dist/node/ssg/htmlFile.js +1 -1
  84. package/dist/node/ssg/renderHtmlTemplate.js +1 -1
  85. package/dist/node/ssg/renderPage.js +5 -5
  86. package/dist/node/ssg/renderPageWorker.js +2 -2
  87. package/dist/node/ssg/renderPages.js +6 -6
  88. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  89. package/dist/node/ssg/ssgEnv.js +1 -1
  90. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  91. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  92. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  93. package/dist/node/ssg-md/renderPage.js +5 -5
  94. package/dist/node/ssg-md/renderPages.js +6 -6
  95. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  96. package/dist/node/utils/checkLanguageParity.js +5 -7
  97. package/dist/node/utils/createHash.js +1 -1
  98. package/dist/node/utils/error.js +4 -4
  99. package/dist/node/utils/flattenMdxContent.js +2 -2
  100. package/dist/node/utils/fs.js +1 -1
  101. package/dist/node/utils/getPageKey.js +1 -1
  102. package/dist/node/utils/index.d.ts +1 -1
  103. package/dist/node/utils/reactAlias.js +5 -5
  104. package/dist/node/utils/slash.d.ts +1 -0
  105. package/dist/node/utils/slash.js +4 -0
  106. package/dist/{864~0.js → n~0.js} +41 -41
  107. package/dist/{2711~0.js → o~0.js} +90 -56
  108. package/dist/rslib-runtime~0.js +27 -35
  109. package/dist/theme/components/Banner/index.js +53 -9
  110. package/dist/theme/components/Callout/index.css +6 -1
  111. package/dist/theme/components/CodeBlock/index.css +2 -0
  112. package/dist/theme/components/DocContent/doc.css +2 -2
  113. package/dist/theme/components/Link/getHref.d.ts +8 -0
  114. package/dist/theme/components/Link/getHref.js +33 -0
  115. package/dist/theme/components/Link/index.js +7 -6
  116. package/dist/theme/components/Link/useLinkNavigate.d.ts +0 -7
  117. package/dist/theme/components/Link/useLinkNavigate.js +8 -32
  118. package/dist/theme/components/Llms/LlmsHint.js +23 -6
  119. package/dist/theme/components/Nav/NavMenu.css +18 -6
  120. package/dist/theme/components/Nav/NavMenu.d.ts +4 -2
  121. package/dist/theme/components/Nav/NavMenu.js +17 -9
  122. package/dist/theme/components/Nav/index.css +3 -1
  123. package/dist/theme/components/Nav/index.d.ts +7 -1
  124. package/dist/theme/components/Nav/index.js +13 -4
  125. package/dist/theme/components/NavHamburger/index.d.ts +2 -1
  126. package/dist/theme/components/NavHamburger/index.js +8 -2
  127. package/dist/theme/components/NavList/context.d.ts +1 -0
  128. package/dist/theme/components/NavList/context.js +3 -0
  129. package/dist/theme/components/NavList/index.d.ts +6 -0
  130. package/dist/theme/components/NavList/index.js +17 -0
  131. package/dist/theme/components/NavScreen/NavScreenMenu.d.ts +3 -2
  132. package/dist/theme/components/NavScreen/NavScreenMenu.js +42 -6
  133. package/dist/theme/components/NavScreen/index.css +0 -10
  134. package/dist/theme/components/NavScreen/index.d.ts +2 -1
  135. package/dist/theme/components/NavScreen/index.js +11 -3
  136. package/dist/theme/components/PackageManagerTabs/index.js +2 -2
  137. package/dist/theme/components/Prompt/index.css +2 -1
  138. package/dist/theme/components/ReadPercent/useReadPercent.js +1 -0
  139. package/dist/theme/components/Search/SearchButton.css +1 -0
  140. package/dist/theme/components/Search/SearchPanel.css +47 -9
  141. package/dist/theme/components/Search/SearchPanel.js +97 -205
  142. package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +1 -0
  143. package/dist/theme/components/Search/logic/providers/LocalProvider.js +23 -13
  144. package/dist/theme/components/Search/logic/search.js +1 -1
  145. package/dist/theme/components/Search/useSearchPanel.d.ts +23 -0
  146. package/dist/theme/components/Search/useSearchPanel.js +155 -0
  147. package/dist/theme/components/Steps/index.css +3 -3
  148. package/dist/theme/components/SwitchAppearance/getClipPath.d.ts +8 -0
  149. package/dist/theme/components/SwitchAppearance/getClipPath.js +13 -0
  150. package/dist/theme/components/SwitchAppearance/global.css +12 -0
  151. package/dist/theme/components/SwitchAppearance/index.js +11 -15
  152. package/dist/theme/components/Tabs/index.js +4 -4
  153. package/dist/theme/components/Tag/index.js +2 -2
  154. package/dist/theme/index.d.ts +1 -0
  155. package/dist/theme/index.js +1 -0
  156. package/dist/theme/layout/DocLayout/index.js +2 -2
  157. package/dist/theme/layout/Layout/index.js +12 -4
  158. package/dist/theme/logic/applyThemeToDOM.d.ts +2 -0
  159. package/dist/theme/logic/applyThemeToDOM.js +17 -0
  160. package/dist/theme/logic/useFullTextSearch.js +6 -1
  161. package/dist/theme/logic/useThemeState.d.ts +1 -2
  162. package/dist/theme/logic/useThemeState.js +1 -7
  163. package/dist/theme/styles/vars/shiki-vars.css +1 -1
  164. package/dist/tinypool~0.js +5 -3
  165. package/dist/{4538~0.js → t~0.js} +2 -2
  166. package/dist/{8472~0.js → v~0.js} +1 -1
  167. package/package.json +11 -12
  168. package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +0 -29
  169. package/dist/node/utils/normalizePath.d.ts +0 -3
  170. package/dist/node/utils/normalizePath.js +0 -10
  171. package/dist/theme/components/NavScreen/NavScreenMenuOthers.d.ts +0 -2
  172. package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +0 -30
  173. package/dist/theme/logic/useHandler.d.ts +0 -6
  174. package/dist/theme/logic/useHandler.js +0 -7
  175. /package/dist/{9857~0.js → 4~0.js} +0 -0
  176. /package/dist/{8016~0.js → i~0.js} +0 -0
  177. /package/dist/{5357~0.js → r~0.js} +0 -0
  178. /package/dist/{102~0.js → t2~0.js} +0 -0
  179. /package/dist/{9940~0.js → tx~0.js} +0 -0
@@ -1,10 +1,10 @@
1
- import { __webpack_require__ } from "../../../rslib-runtime~0.js";
2
- import "../../../4538~0.js";
3
- import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withSiteOrigin, MDX_OR_MD_REGEXP, withBase } from "../../../5357~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../../rslib-runtime~0.js";
2
+ import "../../../t~0.js";
3
+ import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withSiteOrigin, MDX_OR_MD_REGEXP, withBase } from "../../../r~0.js";
4
4
  import { hintRelativeMarkdownLink } from "../../logger/hint.js";
5
5
  import { createError } from "../../utils/error.js";
6
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
7
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
6
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
7
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
8
8
  function createExcluder(checkOption) {
9
9
  const excludes = 'object' == typeof checkOption ? checkOption.excludes : void 0;
10
10
  const excludesUrl = Array.isArray(excludes) ? new Set(excludes) : void 0;
@@ -1,4 +1,4 @@
1
- import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../7748~0.js";
1
+ import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../d~0.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 "../../8016~0.js";
1
+ import { node_path } from "../../i~0.js";
2
2
  import { PACKAGE_ROOT } from "../constants.js";
3
3
  function pluginMediumZoom(options = {}) {
4
4
  return {
@@ -1,7 +1,7 @@
1
- import { node_path } from "../../2711~0.js";
1
+ import { node_path } from "../../o~0.js";
2
2
  import { RouteService } from "./RouteService.js";
3
- import { normalizePath, slash } from "../utils/normalizePath.js";
4
3
  import { getPageKey } from "../utils/getPageKey.js";
4
+ import { slash } from "../utils/slash.js";
5
5
  class RoutePage {
6
6
  routeMeta;
7
7
  pageIndexInfo;
@@ -21,12 +21,13 @@ class RoutePage {
21
21
  }
22
22
  static generateRouteMeta(routePath, filepath, docDir) {
23
23
  const routeService = RouteService.getInstance();
24
+ const absolutePath = node_path.normalize(filepath);
24
25
  const { routePath: normalizedPath, lang, pureRoutePath, version } = routeService.normalizeRoutePath(routePath);
25
26
  return {
26
27
  routePath: normalizedPath,
27
28
  pureRoutePath,
28
- absolutePath: normalizePath(filepath),
29
- relativePath: absolutePathToRelativePath(filepath, docDir),
29
+ absolutePath,
30
+ relativePath: absolutePathToRelativePath(absolutePath, docDir),
30
31
  pageName: getPageKey(routePath),
31
32
  lang,
32
33
  version
@@ -37,6 +38,7 @@ function absolutePathToRelativePath(absolutePath, docsDir) {
37
38
  return slash(node_path.relative(docsDir, absolutePath));
38
39
  }
39
40
  function absolutePathToRouteMeta(absolutePath, docsDir, routeService = RouteService.getInstance()) {
41
+ absolutePath = node_path.normalize(absolutePath);
40
42
  const relativePath = absolutePathToRelativePath(absolutePath, docsDir);
41
43
  const { lang, pureRoutePath, routePath, version } = routeService.normalizeRoutePath(relativePath);
42
44
  return {
@@ -1,4 +1,4 @@
1
- import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../2711~0.js";
1
+ import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../o~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";
@@ -103,7 +103,7 @@ class RouteService {
103
103
  const { routeMeta: { routePath } } = routePage;
104
104
  if (this.routeData.has(routePath)) throw createError(`routePath ${routePath} has already been added`);
105
105
  this.routeData.set(routePath, routePage);
106
- this.#routeDataByFilePath.set(node_path.normalize(routePage.routeMeta.absolutePath), routePage);
106
+ this.#routeDataByFilePath.set(routePage.routeMeta.absolutePath, routePage);
107
107
  }
108
108
  getRoutes() {
109
109
  return Array.from(this.routeData.values()).map((i)=>i.routeMeta);
@@ -155,7 +155,7 @@ import React from 'react';
155
155
  import { lazyWithPreload } from "react-lazy-with-preload";
156
156
  ${routeMeta.map((route, index)=>{
157
157
  const chunkName = getRouteChunkName(route);
158
- return `const loadRoute${index} = () => import(/* webpackChunkName: "${chunkName}" */ '${route.absolutePath}')
158
+ return `const loadRoute${index} = () => import(/* webpackChunkName: "${chunkName}" */ ${JSON.stringify(route.absolutePath)})
159
159
  const Route${index} = lazyWithPreload(loadRoute${index})`;
160
160
  }).join('\n')}
161
161
  export const routes = [
@@ -1,4 +1,4 @@
1
- import { unified, node_path, promises, loadFrontMatter, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../2711~0.js";
1
+ import { unified, node_path, promises, loadFrontMatter, extractTextAndId, remark_gfm, remark_parse, MDX_OR_MD_REGEXP } from "../../o~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";
@@ -34,21 +34,30 @@ const SEARCH_BLOCK_TYPES = new Set([
34
34
  'listItem',
35
35
  'tableRow'
36
36
  ]);
37
- function extractSearchText(node, codeblocks) {
37
+ function extractSearchText(node, codeblocks, parentType) {
38
38
  const { type } = node;
39
39
  if (SEARCH_SKIP_TYPES.has(type)) return [];
40
40
  if ('code' === type && !codeblocks) return [];
41
41
  if ('break' === type) return [
42
42
  '\n'
43
43
  ];
44
- if ('text' === type || 'inlineCode' === type) return [
44
+ if ('inlineCode' === type) return [
45
45
  node.value
46
46
  ];
47
- if ('code' === type) return [
48
- `\n${node.value}\n`
49
- ];
47
+ if ('text' === type) {
48
+ const value = 'heading' === parentType ? extractTextAndId(node.value)[0] : node.value;
49
+ return [
50
+ stripSearchMarkdownMarkers(value)
51
+ ];
52
+ }
53
+ if ('code' === type) {
54
+ const value = stripSearchMarkdownMarkers(node.value);
55
+ return value ? [
56
+ `\n${value}\n`
57
+ ] : [];
58
+ }
50
59
  const result = [];
51
- if ('children' in node) for (const child of node.children)result.push(...extractSearchText(child, codeblocks));
60
+ if ('children' in node) for (const child of node.children)result.push(...extractSearchText(child, codeblocks, type));
52
61
  if (SEARCH_BLOCK_TYPES.has(type)) result.push('\n');
53
62
  if ('tableCell' === type) result.push('\t');
54
63
  return result;
@@ -96,6 +105,10 @@ const SKIP_NODE_TYPES = new Set([
96
105
  ]);
97
106
  const CONTAINER_DIRECTIVE_REGEX = /^\s*:::\s*(\w+)\s*(.*)?/;
98
107
  const CONTAINER_DIRECTIVE_END_REGEX = /^\s*:::\s*$/;
108
+ const GITHUB_ALERT_MARKER_REGEX = /^\s*\[!\w+\]\s*$/;
109
+ function stripSearchMarkdownMarkers(text) {
110
+ return text.split('\n').filter((line)=>!CONTAINER_DIRECTIVE_REGEX.test(line) && !CONTAINER_DIRECTIVE_END_REGEX.test(line) && !GITHUB_ALERT_MARKER_REGEX.test(line)).join('\n');
111
+ }
99
112
  function stripContainerDirectives(text) {
100
113
  const lines = text.split('\n');
101
114
  const result = [];
@@ -1,4 +1,4 @@
1
- import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../2711~0.js";
1
+ import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../o~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 [
@@ -1,11 +1,11 @@
1
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
2
- import "../../4538~0.js";
3
- import { createRequire, join, logger } from "../../2711~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
+ import "../../t~0.js";
3
+ import { createRequire, join, logger } from "../../o~0.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
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
7
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
9
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) {
@@ -1,4 +1,4 @@
1
- import { SEARCH_INDEX_NAME, groupBy } from "../../../2711~0.js";
1
+ import { SEARCH_INDEX_NAME, groupBy } from "../../../o~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 "../../../2711~0.js";
1
+ import { logger, pluginVirtualModule } from "../../../o~0.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 "../../2711~0.js";
1
+ import { node_path } from "../../o~0.js";
2
2
  const searchHookVMPlugin = (context)=>({
3
3
  ["virtual-search-hooks"]: ()=>{
4
4
  const { config } = context;
@@ -1,4 +1,4 @@
1
- import { getIconUrlPath } from "../../../2711~0.js";
1
+ import { getIconUrlPath } from "../../../o~0.js";
2
2
  import { normalizeThemeConfig } from "./normalizeThemeConfig.js";
3
3
  async function createSiteData(userConfig) {
4
4
  const tempSearchObj = Object.assign({}, userConfig.search);
@@ -1,4 +1,4 @@
1
- import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../2711~0.js";
1
+ import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../o~0.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 "../../../2711~0.js";
1
+ import { isProduction, logger } from "../../../o~0.js";
2
2
  import { modifyConfigWithAutoNavSide } from "../../auto-nav-sidebar/index.js";
3
3
  import { createSiteData } from "./createSiteData.js";
4
4
  const siteDataVMPlugin = (context)=>{
@@ -1,8 +1,8 @@
1
- import { type RsbuildInstance } from '@rsbuild/core';
1
+ import { type LoadConfigResult, type RsbuildInstance } from '@rsbuild/core';
2
2
  import type { UserConfig } from '@rspress/shared';
3
3
  interface ServeOptions {
4
- config: UserConfig;
5
- configFilePath: string;
4
+ config: UserConfig | LoadConfigResult<UserConfig>;
5
+ configFilePath?: string;
6
6
  port?: number;
7
7
  host?: string;
8
8
  }
@@ -1,9 +1,12 @@
1
- import { mergeRsbuildConfig } from "../2711~0.js";
1
+ import { mergeRsbuildConfig } from "../o~0.js";
2
+ import { normalizeConfigResult } from "../config/loadConfigFile.js";
2
3
  import { PluginDriver } from "./PluginDriver.js";
3
4
  import { initRsbuild } from "./initRsbuild.js";
4
5
  import { RouteService } from "./route/RouteService.js";
5
6
  async function serve(options) {
6
- const { config, port: userPort, host: userHost, configFilePath } = options;
7
+ const { port: userPort, host: userHost } = options;
8
+ const configResult = normalizeConfigResult(options.config, options.configFilePath);
9
+ const { content: config } = configResult;
7
10
  const envPort = process.env.PORT;
8
11
  const envHost = process.env.HOST;
9
12
  const { builderConfig = {} } = config;
@@ -15,9 +18,12 @@ async function serve(options) {
15
18
  host
16
19
  }
17
20
  });
18
- const pluginDriver = await PluginDriver.create(config, configFilePath, true);
21
+ const pluginDriver = await PluginDriver.create(configResult.content, true);
19
22
  const modifiedConfig = await pluginDriver.modifyConfig();
20
- const rsbuild = await initRsbuild(config.root, modifiedConfig, pluginDriver, await RouteService.createSimple(), false);
23
+ const rsbuild = await initRsbuild(config.root, {
24
+ ...configResult,
25
+ content: modifiedConfig
26
+ }, pluginDriver, await RouteService.createSimple(), false);
21
27
  return rsbuild.preview();
22
28
  }
23
29
  export { serve };
@@ -1,4 +1,4 @@
1
- import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../2711~0.js";
1
+ import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../o~0.js";
2
2
  function createAlternateLinksByRoute(routes, config) {
3
3
  const routeGroups = new Map();
4
4
  for (const route of routes){
@@ -1,4 +1,4 @@
1
- import { external_node_path_resolve, relative, isAbsolute } from "../../8472~0.js";
1
+ import { external_node_path_resolve, relative, isAbsolute } from "../../v~0.js";
2
2
  const routePath2HtmlFileName = (routePath)=>{
3
3
  let fileName = routePath;
4
4
  fileName = fileName.endsWith('/') ? `${routePath}index.html` : `${routePath}.html`;
@@ -1,4 +1,4 @@
1
- import { posix } from "../../8472~0.js";
1
+ import { posix } from "../../v~0.js";
2
2
  import { META_GENERATOR, RSPRESS_VERSION, APP_HTML_MARKER, HEAD_MARKER } from "../constants.js";
3
3
  import { routePath2HtmlFileName } from "./htmlFile.js";
4
4
  import { createError } from "../utils/error.js";
@@ -1,10 +1,10 @@
1
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
2
- import "../../4538~0.js";
3
- import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../8472~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
+ import "../../t~0.js";
3
+ import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../v~0.js";
4
4
  import { hintSSGFailed } from "../logger/hint.js";
5
5
  import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
6
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
7
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
6
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
7
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
8
8
  async function renderPage(route, htmlTemplate, configHead, ssrBundlePath, alternateLinks = [], routeChunkAssets) {
9
9
  let render;
10
10
  try {
@@ -1,7 +1,7 @@
1
- import { writeFile, mkdir, dirname, workerData } from "../../9857~0.js";
1
+ import { writeFile, mkdir, dirname, workerData } from "../../4~0.js";
2
2
  import { createError } from "../utils/error.js";
3
3
  import { resolveHtmlFilePath } from "./htmlFile.js";
4
- import { pMap } from "../../8472~0.js";
4
+ import { pMap } from "../../v~0.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,16 +1,16 @@
1
1
  /*! LICENSE: renderPages.js.LICENSE.txt */
2
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
3
- import "../../4538~0.js";
4
- import { node_path, fileURLToPath, logger, chunk } from "../../2711~0.js";
2
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
3
+ import "../../t~0.js";
4
+ import { node_path, fileURLToPath, logger, chunk } from "../../o~0.js";
5
5
  import { createAlternateLinksByRoute } from "./alternateLinks.js";
6
6
  import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
7
7
  import { routePath2HtmlFileName } from "./htmlFile.js";
8
- import { pMap } from "../../8472~0.js";
8
+ import { pMap } from "../../v~0.js";
9
9
  import { renderPage } from "./renderPage.js";
10
10
  import { hintSSGFailed } from "../logger/hint.js";
11
11
  import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
12
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
13
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
12
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
13
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
14
14
  async function renderPages(routeService, config, ssrBundlePath, htmlTemplate, emitAsset, workerOutputDistPath, routeChunkAssets) {
15
15
  const startTime = Date.now();
16
16
  const ssg = config.ssg ?? true;
@@ -1,4 +1,4 @@
1
- import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../2711~0.js";
1
+ import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../o~0.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, routeChunkAssets })=>({
@@ -1,5 +1,5 @@
1
1
  /*! LICENSE: ssgEnv.js.LICENSE.txt */
2
- import { node_os } from "../../2711~0.js";
2
+ import { node_os } from "../../o~0.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 "../../../2711~0.js";
1
+ import { matchPath, getSidebarDataGroup } from "../../../o~0.js";
2
2
  import { generateLlmsTxt, generateLlmsFullTxt } from "./llmsTxt.js";
3
3
  async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
4
4
  const base = config.base ?? '/';
@@ -1,4 +1,4 @@
1
- import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../2711~0.js";
1
+ import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../o~0.js";
2
2
  import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
3
3
  function routePathToMdPath(routePath, base, siteOrigin) {
4
4
  let url = routePath;
@@ -1,4 +1,4 @@
1
- import { unified, visit, remark_gfm, remark_mdx, remark_stringify } from "../../9940~0.js";
1
+ import { unified, visit, remark_gfm, remark_mdx, remark_stringify } from "../../tx~0.js";
2
2
  function remarkSplitMdx(options = {}) {
3
3
  return (tree)=>{
4
4
  const newChildren = [];
@@ -1,9 +1,9 @@
1
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
2
- import "../../4538~0.js";
3
- import { createHead, pathToFileURL, logger } from "../../2711~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
+ import "../../t~0.js";
3
+ import { createHead, pathToFileURL, logger } from "../../o~0.js";
4
4
  import { hintSSGFailed } from "../logger/hint.js";
5
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
6
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
5
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
6
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
7
7
  async function renderPage(route, ssrBundlePath) {
8
8
  let render;
9
9
  try {
@@ -1,11 +1,11 @@
1
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
2
- import "../../4538~0.js";
3
- import { logger } from "../../2711~0.js";
4
- import { pMap } from "../../8472~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
+ import "../../t~0.js";
3
+ import { logger } from "../../o~0.js";
4
+ import { pMap } from "../../v~0.js";
5
5
  import { renderPage } from "./renderPage.js";
6
6
  import { SSGConcurrency } from "../ssg/ssgEnv.js";
7
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
7
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
9
9
  const routePage2MdFilename = (routePath)=>{
10
10
  let fileName = routePath;
11
11
  fileName = fileName.endsWith('/') ? `${routePath}index.md` : `${routePath}.md`;
@@ -1,4 +1,4 @@
1
- import { writeFile, mkdir, rm, join, isDebugMode } from "../../2711~0.js";
1
+ import { writeFile, mkdir, rm, join, isDebugMode } from "../../o~0.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,8 +1,6 @@
1
- import { node_path, logger, promises } from "../../2711~0.js";
1
+ import { node_path, logger, promises } from "../../o~0.js";
2
+ import { slash } from "./slash.js";
2
3
  import { createError } from "./error.js";
3
- function normalizePath(filePath) {
4
- return filePath.split(node_path.sep).join('/');
5
- }
6
4
  async function getAllMarkdownFilesFrom(dirPath) {
7
5
  const files = await promises.readdir(dirPath, {
8
6
  withFileTypes: true
@@ -28,7 +26,7 @@ async function collectModuleFiles(contentPath, lang, includedDir, excludedDirs,
28
26
  if (!moduleDirStats.isDirectory()) return fileLangMap;
29
27
  const files = await getAllMarkdownFilesFrom(langModuleDir);
30
28
  for (const file of files){
31
- const relativePath = normalizePath(node_path.relative(langDirPath, file));
29
+ const relativePath = slash(node_path.relative(langDirPath, file));
32
30
  if (excludedDirs.some((excludedDir)=>{
33
31
  const isFilePath = /\.(md|mdx)$/.test(excludedDir);
34
32
  return relativePath.includes(excludedDir + (isFilePath ? '' : '/'));
@@ -39,7 +37,7 @@ async function collectModuleFiles(contentPath, lang, includedDir, excludedDirs,
39
37
  }
40
38
  } catch (e) {
41
39
  logger.error(e);
42
- throw createError(`Failed to access directory: ${normalizePath(langModuleDir)}`);
40
+ throw createError(`Failed to access directory: ${slash(langModuleDir)}`);
43
41
  }
44
42
  return fileLangMap;
45
43
  }
@@ -67,7 +65,7 @@ async function checkLanguageParity(config) {
67
65
  });
68
66
  }
69
67
  }
70
- if (missingLanguagesFile.length > 0) throw createError(`Check language parity failed! Missing content:\n${missingLanguagesFile.map((file)=>` - ${normalizePath(file)}`).join('\n')}`);
68
+ if (missingLanguagesFile.length > 0) throw createError(`Check language parity failed! Missing content:\n${missingLanguagesFile.map((file)=>` - ${slash(file)}`).join('\n')}`);
71
69
  logger.success('Language parity checked successfully.');
72
70
  } catch (err) {
73
71
  logger.error('Error during language parity check: \n', err);
@@ -1,4 +1,4 @@
1
- import { createHash as external_node_crypto_createHash } from "../../2711~0.js";
1
+ import { createHash as external_node_crypto_createHash } from "../../o~0.js";
2
2
  function createHash(str, length = 8) {
3
3
  return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, length);
4
4
  }
@@ -1,7 +1,7 @@
1
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
2
- import "../../4538~0.js";
3
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
4
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
1
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
+ import "../../t~0.js";
3
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
4
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
5
5
  function createError(message, maxStackLines = 5) {
6
6
  const error = new Error(message);
7
7
  if (error.stack) {
@@ -1,4 +1,4 @@
1
- import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../2711~0.js";
1
+ import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../o~0.js";
2
2
  import { createError } from "./error.js";
3
3
  import { importStatementRegex } from "../constants.js";
4
4
  const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
@@ -15,7 +15,7 @@ async function resolveDepPath(moduleSpecifier, importer, alias) {
15
15
  });
16
16
  const resolved = await resolver.async(importer, moduleSpecifier);
17
17
  if (resolved.path) return resolved.path;
18
- throw createError(`Empty result when resolving ${moduleSpecifier} from ${importer}`);
18
+ else throw createError(`Empty result when resolving ${moduleSpecifier} from ${importer}`);
19
19
  }
20
20
  async function flattenMdxContent(content, basePath, alias) {
21
21
  const deps = [];
@@ -1,4 +1,4 @@
1
- import { promises } from "../../4538~0.js";
1
+ import { promises } from "../../t~0.js";
2
2
  async function pathExists(path) {
3
3
  try {
4
4
  await promises.access(path);
@@ -1,4 +1,4 @@
1
- import { removeLeadingSlash } from "../../2711~0.js";
1
+ import { removeLeadingSlash } from "../../o~0.js";
2
2
  function getPageKey(route) {
3
3
  const cleanRoute = removeLeadingSlash(route);
4
4
  return cleanRoute.replace(/\//g, '_').replace(/\.[^.]+$/, '') || 'index';
@@ -6,5 +6,5 @@ export * from './flattenMdxContent.js';
6
6
  export * from './fs.js';
7
7
  export * from './getImportAstNode.js';
8
8
  export * from './getPageKey.js';
9
- export * from './normalizePath.js';
10
9
  export * from './reactAlias.js';
10
+ export * from './slash.js';
@@ -1,11 +1,11 @@
1
- import { __webpack_require__ } from "../../rslib-runtime~0.js";
2
- import "../../4538~0.js";
3
- import { node_path, core_rspack, logger } from "../../2711~0.js";
1
+ import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
2
+ import "../../t~0.js";
3
+ import { node_path, core_rspack, logger } from "../../o~0.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";
7
- const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
- var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
7
+ const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
+ var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
9
9
  const Resolver = core_rspack.experiments.resolver.ResolverFactory;
10
10
  async function detectPackageMajorVersion(name) {
11
11
  const cwd = process.cwd();
@@ -0,0 +1 @@
1
+ export declare function slash(p: string): string;
@@ -0,0 +1,4 @@
1
+ function slash(p) {
2
+ return p.replace(/\\/g, '/');
3
+ }
4
+ export { slash };