@rspress/core 2.0.0 → 2.0.1

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 (37) hide show
  1. package/dist/{0~7675.58d06f93.js → 0~7675.ad8fe23f.js} +2 -2
  2. package/dist/{5485.c50a566c.js → 5485.d1bd4aec.js} +1 -1
  3. package/dist/cli/index.js +1 -1
  4. package/dist/config/loadConfigFile.js +1 -1
  5. package/dist/eject-theme/components/DocContent/doc.scss +1 -1
  6. package/dist/eject-theme/components/HomeBackground/index.tsx +5 -1
  7. package/dist/eject-theme/components/HomeFeature/index.scss +1 -0
  8. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +8 -0
  9. package/dist/index.js +1 -1
  10. package/dist/node/auto-nav-sidebar/index.js +1 -1
  11. package/dist/node/constants.js +1 -1
  12. package/dist/node/initRsbuild.js +12 -14
  13. package/dist/node/last-updated/index.js +1 -1
  14. package/dist/node/route/RouteService.d.ts +2 -0
  15. package/dist/node/route/RouteService.js +7 -1
  16. package/dist/node/route/extractPageData.js +1 -1
  17. package/dist/node/route/normalizeRoutePath.js +1 -1
  18. package/dist/node/runtimeModule/i18n.js +1 -1
  19. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  20. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  21. package/dist/node/serve.js +1 -1
  22. package/dist/node/ssg/renderPage.js +4 -3
  23. package/dist/node/ssg/renderPageWorker.js +1 -1
  24. package/dist/node/ssg/renderPages.js +2 -2
  25. package/dist/node/ssg-md/llms/emitLlmsTxt.js +37 -25
  26. package/dist/node/ssg-md/renderPage.js +1 -1
  27. package/dist/node/ssg-md/renderPages.js +1 -1
  28. package/dist/node/utils/createHash.js +1 -1
  29. package/dist/node/utils/flattenMdxContent.js +1 -1
  30. package/dist/node/utils/reactAlias.js +1 -1
  31. package/dist/theme/components/DocContent/doc.css +1 -1
  32. package/dist/theme/components/HomeBackground/index.js +2 -1
  33. package/dist/theme/components/HomeFeature/index.css +1 -1
  34. package/dist/theme/components/Sidebar/SidebarItem.js +7 -1
  35. package/dist/theme/logic/useScrollAfterNav.js +2 -1
  36. package/package.json +5 -5
  37. /package/dist/{2016.421b464f.js → 6576.421b464f.js} +0 -0
@@ -9,8 +9,8 @@ import { setTimeout as promises_setTimeout } from "node:timers/promises";
9
9
  import { debuglog } from "node:util";
10
10
  import { node_process, node_os, constants } from "./9348.1beb3e25.js";
11
11
  import { node_path } from "./6289.29817fb4.js";
12
- import { node_url } from "./5485.c50a566c.js";
13
- import { createWriteStream, createReadStream, readFileSync } from "./2016.421b464f.js";
12
+ import { node_url } from "./5485.d1bd4aec.js";
13
+ import { createWriteStream, createReadStream, readFileSync } from "./6576.421b464f.js";
14
14
  __webpack_require__.add({
15
15
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
16
16
  const cp = __webpack_require__("child_process");
@@ -1,5 +1,5 @@
1
1
  var package_namespaceObject = {
2
- rE: "2.0.0"
2
+ rE: "2.0.1"
3
3
  };
4
4
  async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true, signal } = {}) {
5
5
  return new Promise((resolve_, reject_)=>{
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { node_path, logger, join, picocolors } from "../6289.29817fb4.js";
2
2
  import { chokidar, cac } from "./index.44f3184c.js";
3
- import { package_namespaceObject } from "../5485.c50a566c.js";
3
+ import { package_namespaceObject } from "../5485.d1bd4aec.js";
4
4
  import { loadConfigFile, resolveDocRoot } from "../config/loadConfigFile.js";
5
5
  import { dev } from "../node/dev.js";
6
6
  import { PUBLIC_DIR } from "../node/constants.js";
@@ -1,4 +1,4 @@
1
- import { node_fs, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "../2016.421b464f.js";
1
+ import { node_fs, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "../6576.421b464f.js";
2
2
  import { node_path, logger } from "../6289.29817fb4.js";
3
3
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
4
4
  async function loadConfigFile(customConfigFile) {
@@ -5,7 +5,7 @@
5
5
  /* why ":where"? For css priority, <<equal to className priority>>, to be easy to overrides by className */
6
6
  /* paragraph */
7
7
  /* #region */
8
- &:where(p) {
8
+ &:where(p):not(:where(li p)) {
9
9
  margin-top: 1.25rem; /* 20px */
10
10
  margin-bottom: 1.25rem; /* 20px */
11
11
  line-height: 1.75rem; /* 28px */
@@ -1,5 +1,6 @@
1
1
  import { useNavTransparent } from './useNavTransparent';
2
2
  import './index.scss';
3
+ import clsx from 'clsx';
3
4
 
4
5
  function HomeBackground({
5
6
  className,
@@ -10,7 +11,10 @@ function HomeBackground({
10
11
  return (
11
12
  <>
12
13
  {styleDom}
13
- <div className={`rp-home-background ${className}`} {...otherProps}></div>
14
+ <div
15
+ className={clsx('rp-home-background', className)}
16
+ {...otherProps}
17
+ ></div>
14
18
  </>
15
19
  );
16
20
  }
@@ -7,6 +7,7 @@
7
7
  max-width: 72rem;
8
8
  gap: var(--rp-home-feature-gap);
9
9
  padding: 10px;
10
+ margin-bottom: 2rem;
10
11
 
11
12
  &__item {
12
13
  width: 100%;
@@ -41,6 +41,14 @@ export function SidebarItemRaw({
41
41
  if (active && ref.current) {
42
42
  scrollIntoView(ref.current, {
43
43
  scrollMode: 'if-needed',
44
+ block: 'center',
45
+ inline: 'center',
46
+ boundary: element => {
47
+ const isBoundary =
48
+ element.classList.contains('rp-doc-layout__sidebar') ||
49
+ element.classList.contains('rspress-doc');
50
+ return !isBoundary;
51
+ },
44
52
  });
45
53
  }
46
54
  }, [active]);
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ export { build } from "./node/build.js";
5
5
  export { defineConfig } from "./config/defineConfig.js";
6
6
  export { dev } from "./node/dev.js";
7
7
  export { logger } from "./6289.29817fb4.js";
8
- export { matchPath } from "./2016.421b464f.js";
8
+ export { matchPath } from "./6576.421b464f.js";
9
9
  export { remarkFileCodeBlock } from "./node/mdx/remarkPlugins/fileCodeBlock.js";
10
10
  export { remarkLink } from "./node/mdx/remarkPlugins/link.js";
11
11
  export { serve } from "./node/serve.js";
@@ -1,5 +1,5 @@
1
1
  import { node_path } from "../../6289.29817fb4.js";
2
- import { DEFAULT_PAGE_EXTENSIONS } from "../../2016.421b464f.js";
2
+ import { DEFAULT_PAGE_EXTENSIONS } from "../../6576.421b464f.js";
3
3
  import { processLocales, combineWalkResult } from "./locales.js";
4
4
  import { walk } from "./walk.js";
5
5
  async function runAutoNavSide(config, metaFileSet, mdFileSet) {
@@ -1,4 +1,4 @@
1
- import { createRequire, package_namespaceObject } from "../5485.c50a566c.js";
1
+ import { createRequire, package_namespaceObject } from "../5485.d1bd4aec.js";
2
2
  import { node_path } from "../6289.29817fb4.js";
3
3
  const constants_require = createRequire(import.meta.url);
4
4
  const RSPRESS_VERSION = package_namespaceObject.rE;
@@ -1,7 +1,7 @@
1
- import { createRequire, fileURLToPath, package_namespaceObject } from "../5485.c50a566c.js";
1
+ import { createRequire, fileURLToPath, package_namespaceObject } from "../5485.d1bd4aec.js";
2
2
  import { node_path } from "../6289.29817fb4.js";
3
3
  import { removeTrailingSlash, MDX_OR_MD_REGEXP, cwd } from "../9348.1beb3e25.js";
4
- import { PLUGIN_REACT_NAME, pluginReact, pluginVirtualModule } from "../2016.421b464f.js";
4
+ import { PLUGIN_REACT_NAME, pluginReact, pluginVirtualModule } from "../6576.421b464f.js";
5
5
  import { createError } from "./utils/error.js";
6
6
  import { PUBLIC_DIR, CSR_CLIENT_ENTRY, SSR_CLIENT_ENTRY, OUTPUT_DIR, SSG_MD_SERVER_ENTRY, inlineThemeScript, NODE_SSG_BUNDLE_FOLDER, isProduction, PACKAGE_ROOT, SSR_SERVER_ENTRY, TEMPLATE_PATH, NODE_SSG_MD_BUNDLE_FOLDER, DEFAULT_THEME, NODE_SSG_MD_BUNDLE_NAME, DEFAULT_TITLE, NODE_SSG_BUNDLE_NAME } from "./constants.js";
7
7
  import { hintBuilderPluginsBreakingChange, hintThemeBreakingChange } from "./logger/hint.js";
@@ -174,18 +174,16 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
174
174
  package_namespaceObject.rE
175
175
  ]
176
176
  }
177
- } : {},
178
- chunkSplit: {
179
- override: {
180
- cacheGroups: {
181
- styles: {
182
- name: 'styles',
183
- minSize: 0,
184
- chunks: 'all',
185
- test: /\.(?:css|less|sass|scss)$/,
186
- priority: 99
187
- }
188
- }
177
+ } : {}
178
+ },
179
+ splitChunks: {
180
+ cacheGroups: {
181
+ styles: {
182
+ name: 'styles',
183
+ minSize: 0,
184
+ chunks: 'all',
185
+ test: /\.(?:css|less|sass|scss)$/,
186
+ priority: 99
189
187
  }
190
188
  }
191
189
  },
@@ -1,4 +1,4 @@
1
- import { execa } from "../../0~7675.58d06f93.js";
1
+ import { execa } from "../../0~7675.ad8fe23f.js";
2
2
  function transform(timestamp, lang) {
3
3
  return new Date(timestamp).toLocaleString(lang || 'zh');
4
4
  }
@@ -48,5 +48,7 @@ export declare class RouteService {
48
48
  getDocsDir(): string;
49
49
  getLangs(): string[];
50
50
  getDefaultLang(): string;
51
+ getVersions(): string[];
52
+ getDefaultVersion(): string;
51
53
  }
52
54
  export {};
@@ -1,6 +1,6 @@
1
1
  import { node_path, promises } from "../../6289.29817fb4.js";
2
2
  import { RSPRESS_TEMP_DIR, removeTrailingSlash, addTrailingSlash } from "../../9348.1beb3e25.js";
3
- import { DEFAULT_PAGE_EXTENSIONS, glob } from "../../2016.421b464f.js";
3
+ import { DEFAULT_PAGE_EXTENSIONS, glob } from "../../6576.421b464f.js";
4
4
  import { PUBLIC_DIR } from "../constants.js";
5
5
  import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
6
6
  import { createError } from "../utils/error.js";
@@ -173,5 +173,11 @@ ${routeMeta.map((route, index)=>{
173
173
  getDefaultLang() {
174
174
  return this.#defaultLang;
175
175
  }
176
+ getVersions() {
177
+ return this.#versions;
178
+ }
179
+ getDefaultVersion() {
180
+ return this.#defaultVersion;
181
+ }
176
182
  }
177
183
  export { RouteService };
@@ -1,6 +1,6 @@
1
1
  import { node_path, promises } from "../../6289.29817fb4.js";
2
2
  import { unified, visit, remark_gfm, loadFrontMatter, remark_stringify, MDX_OR_MD_REGEXP } from "../../9348.1beb3e25.js";
3
- import { remove, remark_parse } from "../../2016.421b464f.js";
3
+ import { remove, remark_parse } from "../../6576.421b464f.js";
4
4
  import { applyReplaceRules } from "../utils/applyReplaceRules.js";
5
5
  import { flattenMdxContent } from "../utils/flattenMdxContent.js";
6
6
  import { importStatementRegex } from "../constants.js";
@@ -1,5 +1,5 @@
1
1
  import { addTrailingSlash, addLeadingSlash } from "../../9348.1beb3e25.js";
2
- import { DEFAULT_PAGE_EXTENSIONS } from "../../2016.421b464f.js";
2
+ import { DEFAULT_PAGE_EXTENSIONS } from "../../6576.421b464f.js";
3
3
  const getRoutePathParts = (relativePath, lang, version, langs, versions)=>{
4
4
  const [versionPart, langPart, purePath] = splitRoutePathParts(relativePath, lang, version, langs, versions);
5
5
  return [
@@ -1,4 +1,4 @@
1
- import { createRequire } from "../../5485.c50a566c.js";
1
+ import { createRequire } from "../../5485.d1bd4aec.js";
2
2
  import { picocolors, join, logger } from "../../6289.29817fb4.js";
3
3
  import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
4
4
  import { createError } from "../utils/error.js";
@@ -1,5 +1,5 @@
1
1
  import { SEARCH_INDEX_NAME } from "../../../9348.1beb3e25.js";
2
- import { groupBy } from "../../../2016.421b464f.js";
2
+ import { groupBy } from "../../../6576.421b464f.js";
3
3
  import { extractPageData } from "../../route/extractPageData.js";
4
4
  import { createHash } from "../../utils/createHash.js";
5
5
  function deletePrivateField(obj) {
@@ -1,5 +1,5 @@
1
1
  import { logger } from "../../../6289.29817fb4.js";
2
- import { pluginVirtualModule } from "../../../2016.421b464f.js";
2
+ import { pluginVirtualModule } from "../../../6576.421b464f.js";
3
3
  import { createPageData } from "./createPageData.js";
4
4
  const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
5
5
  const ref = {
@@ -1,4 +1,4 @@
1
- import { mergeRsbuildConfig } from "../2016.421b464f.js";
1
+ import { mergeRsbuildConfig } from "../6576.421b464f.js";
2
2
  import { PluginDriver } from "./PluginDriver.js";
3
3
  import { initRsbuild } from "./initRsbuild.js";
4
4
  import { RouteService } from "./route/RouteService.js";
@@ -1,12 +1,13 @@
1
- import { transformHtmlTemplate, pathToFileURL, createHead } from "../../5485.c50a566c.js";
1
+ import { transformHtmlTemplate, pathToFileURL, createHead } from "../../5485.d1bd4aec.js";
2
2
  import { logger, picocolors } from "../../6289.29817fb4.js";
3
3
  import { hintSSGFailed } from "../logger/hint.js";
4
4
  import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
5
5
  async function renderPage(route, htmlTemplate, configHead, ssrBundlePath) {
6
6
  let render;
7
7
  try {
8
- const { default: ssrExports } = await import(pathToFileURL(ssrBundlePath).toString());
9
- render = await ssrExports.render;
8
+ let { default: ssrExports } = await import(pathToFileURL(ssrBundlePath).toString());
9
+ if (ssrExports instanceof Promise) ssrExports = await ssrExports;
10
+ render = ssrExports.render;
10
11
  } catch (e) {
11
12
  if (e instanceof Error) {
12
13
  logger.error(`Failed to load SSG bundle: ${picocolors.yellow(ssrBundlePath)}: ${e.message}`);
@@ -1,6 +1,6 @@
1
1
  import { workerData } from "./renderPageWorker.165b5d46.js";
2
2
  import { createError } from "../utils/error.js";
3
- import { pMap } from "../../5485.c50a566c.js";
3
+ import { pMap } from "../../5485.d1bd4aec.js";
4
4
  import { renderPage } from "./renderPage.js";
5
5
  const params = workerData?.[1]?.params;
6
6
  if (!params) throw createError('SSG Worker Thread workerData params missing');
@@ -1,8 +1,8 @@
1
1
  /*! For license information please see renderPages.js.LICENSE.txt */
2
2
  import { logger, picocolors } from "../../6289.29817fb4.js";
3
- import { chunk } from "../../2016.421b464f.js";
3
+ import { chunk } from "../../6576.421b464f.js";
4
4
  import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
5
- import { pMap } from "../../5485.c50a566c.js";
5
+ import { pMap } from "../../5485.d1bd4aec.js";
6
6
  import { renderPage } from "./renderPage.js";
7
7
  import { hintSSGFailed } from "../logger/hint.js";
8
8
  import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
@@ -1,19 +1,29 @@
1
1
  import { getSidebarDataGroup } from "../../../9348.1beb3e25.js";
2
- import { matchPath } from "../../../2016.421b464f.js";
2
+ import { matchPath } from "../../../6576.421b464f.js";
3
3
  import { generateLlmsTxt, generateLlmsFullTxt } from "./llmsTxt.js";
4
4
  async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
5
5
  const base = config.base ?? '/';
6
6
  const locales = config.themeConfig?.locales;
7
7
  const isMultiLang = locales && locales.length > 0;
8
- const nav = isMultiLang ? locales.filter((i)=>Boolean(i.nav)).map((i)=>({
8
+ const defaultLang = routeService.getDefaultLang();
9
+ const langs = [
10
+ ...new Set([
11
+ defaultLang,
12
+ ...routeService.getLangs()
13
+ ])
14
+ ];
15
+ const defaultVersion = routeService.getDefaultVersion();
16
+ const versions = routeService.getVersions();
17
+ const isMultiVersion = versions.length > 0;
18
+ const rawNavConfigs = isMultiLang ? locales.filter((i)=>Boolean(i.nav)).map((i)=>({
9
19
  nav: i.nav,
10
20
  lang: i.lang
11
- })) : [
21
+ })) : config.themeConfig?.nav ? [
12
22
  {
13
- nav: config.themeConfig?.nav,
23
+ nav: config.themeConfig.nav,
14
24
  lang: config.lang ?? ''
15
25
  }
16
- ];
26
+ ] : [];
17
27
  const sidebars = isMultiLang ? locales.map((i)=>i.sidebar) : [
18
28
  config.themeConfig?.sidebar
19
29
  ];
@@ -21,42 +31,44 @@ async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
21
31
  Object.assign(prev, curr);
22
32
  return prev;
23
33
  }, {});
24
- const noVersionNav = Array.isArray(nav) ? nav.map((i)=>{
25
- const nav = i.nav.default || i.nav;
26
- const lang = i.lang;
27
- return nav.map((i)=>({
28
- ...i,
29
- lang
30
- }));
31
- }).flat().filter((i)=>i.activeMatch || i.link) : [];
32
- const defaultLang = routeService.getDefaultLang();
33
- const langs = [
34
- ...new Set([
35
- defaultLang,
36
- ...routeService.getLangs()
37
- ])
38
- ];
39
- await Promise.all(langs.map(async (lang)=>{
40
- const navList = noVersionNav.filter((i)=>i.lang === lang);
34
+ function resolveNavForVersion(version) {
35
+ return rawNavConfigs.flatMap(({ nav, lang })=>{
36
+ let navArray;
37
+ navArray = Array.isArray(nav) ? nav : nav[version] ?? nav[defaultVersion] ?? nav.default ?? [];
38
+ return navArray.map((item)=>({
39
+ ...item,
40
+ lang
41
+ }));
42
+ }).filter((i)=>i.activeMatch || i.link);
43
+ }
44
+ async function generateForLangVersion(lang, version) {
45
+ const navList = resolveNavForVersion(version).filter((i)=>i.lang === lang);
41
46
  const routeGroups = new Array(navList.length).fill(0).map(()=>[]);
42
47
  const others = [];
43
48
  routeService.getRoutes().forEach((routeMeta)=>{
44
49
  if (routeMeta.lang !== lang) return;
50
+ if (isMultiVersion && routeMeta.version !== version) return;
45
51
  const { routePath } = routeMeta;
46
52
  for(let i = 0; i < routeGroups.length; i++){
47
53
  const routeGroup = routeGroups[i];
48
54
  const navItem = navList[i];
49
- if (lang === navItem.lang && new RegExp(navItem.activeMatch ?? navItem.link).test(routePath)) return void routeGroup.push(routePath);
55
+ if (lang === navItem.lang && new RegExp((navItem.activeMatch ?? navItem.link).replace(/\.html$/, '')).test(routePath)) return void routeGroup.push(routePath);
50
56
  }
51
57
  others.push(routePath);
52
58
  });
53
59
  for (const routeGroup of routeGroups)organizeBySidebar(sidebar, routeGroup);
54
60
  const llmsTxtContent = await generateLlmsTxt(routeGroups, others, navList, config.title, config.description, config.base, routeService);
55
61
  const llmsFullTxtContent = generateLlmsFullTxt(routeGroups, navList, others, base, mdContents);
56
- const prefix = defaultLang === lang ? '' : `${lang}/`;
62
+ const langPrefix = defaultLang === lang ? '' : `${lang}/`;
63
+ const versionPrefix = isMultiVersion && version !== defaultVersion ? `${version}/` : '';
64
+ const prefix = `${versionPrefix}${langPrefix}`;
57
65
  emitAsset(`${prefix}llms.txt`, llmsTxtContent);
58
66
  emitAsset(`${prefix}llms-full.txt`, llmsFullTxtContent);
59
- }));
67
+ }
68
+ const versionList = isMultiVersion ? versions : [
69
+ ''
70
+ ];
71
+ await Promise.all(versionList.flatMap((version)=>langs.map((lang)=>generateForLangVersion(lang, version))));
60
72
  }
61
73
  function flatSidebar(sidebar) {
62
74
  if (!sidebar) return [];
@@ -1,4 +1,4 @@
1
- import { pathToFileURL, createHead } from "../../5485.c50a566c.js";
1
+ import { pathToFileURL, createHead } from "../../5485.d1bd4aec.js";
2
2
  import { logger, picocolors } from "../../6289.29817fb4.js";
3
3
  import { hintSSGFailed } from "../logger/hint.js";
4
4
  async function renderPage(route, ssrBundlePath) {
@@ -1,5 +1,5 @@
1
1
  import { logger, picocolors } from "../../6289.29817fb4.js";
2
- import { pMap } from "../../5485.c50a566c.js";
2
+ import { pMap } from "../../5485.d1bd4aec.js";
3
3
  import { renderPage } from "./renderPage.js";
4
4
  import { SSGConcurrency } from "../ssg/ssgEnv.js";
5
5
  const routePage2MdFilename = (routePath)=>{
@@ -1,4 +1,4 @@
1
- import { createHash as external_node_crypto_createHash } from "../../2016.421b464f.js";
1
+ import { createHash as external_node_crypto_createHash } from "../../6576.421b464f.js";
2
2
  function createHash(str) {
3
3
  return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { node_fs, core_rspack } from "../../2016.421b464f.js";
1
+ import { node_fs, core_rspack } from "../../6576.421b464f.js";
2
2
  import { node_path, logger } from "../../6289.29817fb4.js";
3
3
  import { createProcessor, MDX_OR_MD_REGEXP } from "../../9348.1beb3e25.js";
4
4
  import { createError } from "./error.js";
@@ -1,5 +1,5 @@
1
1
  import { node_path, logger, picocolors } from "../../6289.29817fb4.js";
2
- import { core_rspack } from "../../2016.421b464f.js";
2
+ import { core_rspack } from "../../6576.421b464f.js";
3
3
  import { pathExists, readJson } from "./fs.js";
4
4
  import { PACKAGE_ROOT } from "../constants.js";
5
5
  import { hintReactVersion } from "../logger/hint.js";
@@ -1,4 +1,4 @@
1
- .rp-doc :not(:where(.rp-not-doc, .rp-not-doc *)):where(p) {
1
+ .rp-doc :not(:where(.rp-not-doc, .rp-not-doc *)):where(p):not(:where(li p)) {
2
2
  margin-top: 1.25rem;
3
3
  margin-bottom: 1.25rem;
4
4
  line-height: 1.75rem;
@@ -1,13 +1,14 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useNavTransparent } from "./useNavTransparent.js";
3
3
  import "./index.css";
4
+ import clsx from "clsx";
4
5
  function HomeBackground({ className, ...otherProps }) {
5
6
  const styleDom = useNavTransparent();
6
7
  return /*#__PURE__*/ jsxs(Fragment, {
7
8
  children: [
8
9
  styleDom,
9
10
  /*#__PURE__*/ jsx("div", {
10
- className: `rp-home-background ${className}`,
11
+ className: clsx('rp-home-background', className),
11
12
  ...otherProps
12
13
  })
13
14
  ]
@@ -3,7 +3,7 @@
3
3
  gap: var(--rp-home-feature-gap);
4
4
  flex-wrap: wrap;
5
5
  max-width: 72rem;
6
- margin: auto;
6
+ margin: auto auto 2rem;
7
7
  padding: 10px;
8
8
  display: flex;
9
9
  overflow: hidden;
@@ -10,7 +10,13 @@ function SidebarItemRaw({ active, text, tag, link, context, className, left, rig
10
10
  const [isPending, startTransition] = useTransition();
11
11
  useEffect(()=>{
12
12
  if (active && ref.current) scroll_into_view_if_needed(ref.current, {
13
- scrollMode: 'if-needed'
13
+ scrollMode: 'if-needed',
14
+ block: 'center',
15
+ inline: 'center',
16
+ boundary: (element)=>{
17
+ const isBoundary = element.classList.contains('rp-doc-layout__sidebar') || element.classList.contains('rspress-doc');
18
+ return !isBoundary;
19
+ }
14
20
  });
15
21
  }, [
16
22
  active
@@ -28,7 +28,8 @@ function useScrollAfterNav() {
28
28
  if (target) scrollToTarget(target);
29
29
  }
30
30
  }, [
31
- location
31
+ location,
32
+ location.pathname
32
33
  ]);
33
34
  }
34
35
  export { useScrollAfterNav };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -63,8 +63,8 @@
63
63
  "dependencies": {
64
64
  "@mdx-js/mdx": "^3.1.1",
65
65
  "@mdx-js/react": "^3.1.1",
66
- "@rsbuild/core": "2.0.0-alpha.4",
67
- "@rsbuild/plugin-react": "~1.4.3",
66
+ "@rsbuild/core": "2.0.0-beta.0",
67
+ "@rsbuild/plugin-react": "~1.4.4",
68
68
  "@shikijs/rehype": "^3.21.0",
69
69
  "@types/unist": "^3.0.3",
70
70
  "@unhead/react": "^2.1.2",
@@ -102,7 +102,7 @@
102
102
  "unist-util-remove": "^4.0.0",
103
103
  "unist-util-visit": "^5.0.0",
104
104
  "unist-util-visit-children": "^3.0.0",
105
- "@rspress/shared": "2.0.0"
105
+ "@rspress/shared": "2.0.1"
106
106
  },
107
107
  "devDependencies": {
108
108
  "@microsoft/api-extractor": "^7.55.2",
@@ -135,7 +135,7 @@
135
135
  "@rspress/config": "1.0.0"
136
136
  },
137
137
  "engines": {
138
- "node": ">=20.9.0"
138
+ "node": "^20.19.0 || >=22.12.0"
139
139
  },
140
140
  "publishConfig": {
141
141
  "access": "public",
File without changes