@rspress/core 2.0.0-rc.8 → 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.
- package/dist/{0~7675.efbf8813.js → 0~7675.ad8fe23f.js} +2 -2
- package/dist/{5485.8150163d.js → 5485.d1bd4aec.js} +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/DocContent/doc.scss +1 -1
- package/dist/eject-theme/components/HomeBackground/index.tsx +5 -1
- package/dist/eject-theme/components/HomeFeature/index.scss +2 -1
- package/dist/eject-theme/components/Nav/index.tsx +4 -2
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +8 -0
- package/dist/index.js +1 -1
- package/dist/node/auto-nav-sidebar/index.js +1 -1
- package/dist/node/constants.js +1 -1
- package/dist/node/initRsbuild.js +13 -15
- package/dist/node/last-updated/index.js +1 -1
- package/dist/node/route/RouteService.d.ts +2 -0
- package/dist/node/route/RouteService.js +7 -1
- package/dist/node/route/extractPageData.js +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +1 -1
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/renderPage.js +4 -3
- package/dist/node/ssg/renderPageWorker.js +1 -1
- package/dist/node/ssg/renderPages.js +2 -2
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +37 -25
- package/dist/node/ssg-md/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/reactAlias.js +1 -1
- package/dist/theme/components/DocContent/doc.css +1 -1
- package/dist/theme/components/HomeBackground/index.js +2 -1
- package/dist/theme/components/HomeFeature/index.css +2 -2
- package/dist/theme/components/Nav/index.js +4 -2
- package/dist/theme/components/Sidebar/SidebarItem.js +7 -1
- package/dist/theme/logic/useScrollAfterNav.js +2 -1
- package/package.json +14 -14
- /package/dist/{9446.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.
|
|
13
|
-
import { createWriteStream, createReadStream, readFileSync } from "./
|
|
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");
|
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.
|
|
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 "../
|
|
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
|
|
14
|
+
<div
|
|
15
|
+
className={clsx('rp-home-background', className)}
|
|
16
|
+
{...otherProps}
|
|
17
|
+
></div>
|
|
14
18
|
</>
|
|
15
19
|
);
|
|
16
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.rp-home-feature {
|
|
2
|
-
--rp-home-feature-gap:
|
|
2
|
+
--rp-home-feature-gap: 15px;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
margin: auto;
|
|
5
5
|
display: flex;
|
|
@@ -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%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useNav } from '@rspress/core/runtime';
|
|
1
|
+
import { useNav, useSite } from '@rspress/core/runtime';
|
|
2
2
|
import {
|
|
3
3
|
NavHamburger,
|
|
4
4
|
NavTitle,
|
|
@@ -27,6 +27,8 @@ export function Nav(props: NavProps) {
|
|
|
27
27
|
navTitle,
|
|
28
28
|
} = props;
|
|
29
29
|
const navList = useNav();
|
|
30
|
+
const { site } = useSite();
|
|
31
|
+
const hasAppearanceSwitch = site.themeConfig.darkMode !== false;
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
34
|
<header className="rp-nav">
|
|
@@ -48,7 +50,7 @@ export function Nav(props: NavProps) {
|
|
|
48
50
|
<NavMenuDivider />
|
|
49
51
|
<NavLangs />
|
|
50
52
|
<NavVersions />
|
|
51
|
-
<SwitchAppearance />
|
|
53
|
+
{hasAppearanceSwitch && <SwitchAppearance />}
|
|
52
54
|
<SocialLinks />
|
|
53
55
|
</div>
|
|
54
56
|
|
|
@@ -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 "./
|
|
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 "../../
|
|
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) {
|
package/dist/node/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire, package_namespaceObject } from "../5485.
|
|
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;
|
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createRequire, fileURLToPath, package_namespaceObject } from "../5485.
|
|
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 "../
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
},
|
|
@@ -200,7 +198,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
200
198
|
bundlerChain (chain, { CHAIN_ID, environment }) {
|
|
201
199
|
const isSsg = 'node' === environment.name;
|
|
202
200
|
const isSsgMd = 'node_md' === environment.name;
|
|
203
|
-
const jsModuleRule = chain.module.rule(CHAIN_ID.RULE.JS);
|
|
201
|
+
const jsModuleRule = chain.module.rule(CHAIN_ID.RULE.JS).oneOfs.get(CHAIN_ID.ONE_OF.JS_MAIN);
|
|
204
202
|
const swcLoaderOptions = jsModuleRule.use(CHAIN_ID.USE.SWC).get('options');
|
|
205
203
|
chain.module.rule('MDX').type("javascript/auto").test(MDX_OR_MD_REGEXP).resolve.merge({
|
|
206
204
|
conditionNames: jsModuleRule.resolve.conditionNames.values(),
|
|
@@ -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 "../../
|
|
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 "../../
|
|
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 "../../
|
|
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.
|
|
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 "../../../
|
|
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 "../../../
|
|
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 = {
|
package/dist/node/serve.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeRsbuildConfig } from "../
|
|
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.
|
|
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
|
-
|
|
9
|
-
|
|
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.
|
|
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 "../../
|
|
3
|
+
import { chunk } from "../../6576.421b464f.js";
|
|
4
4
|
import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
|
|
5
|
-
import { pMap } from "../../5485.
|
|
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 "../../../
|
|
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
|
|
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
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
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.
|
|
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.
|
|
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 "../../
|
|
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 "../../
|
|
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 "../../
|
|
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,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:
|
|
11
|
+
className: clsx('rp-home-background', className),
|
|
11
12
|
...otherProps
|
|
12
13
|
})
|
|
13
14
|
]
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useNav } from "@rspress/core/runtime";
|
|
2
|
+
import { useNav, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import { NavHamburger, NavTitle, Search, SocialLinks, SwitchAppearance } from "@theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { NavLangs, NavMenu, NavMenuDivider, NavVersions } from "./NavMenu.js";
|
|
6
6
|
function Nav(props) {
|
|
7
7
|
const { beforeNavTitle, afterNavTitle, beforeNavMenu, afterNavMenu, navTitle } = props;
|
|
8
8
|
const navList = useNav();
|
|
9
|
+
const { site } = useSite();
|
|
10
|
+
const hasAppearanceSwitch = false !== site.themeConfig.darkMode;
|
|
9
11
|
return /*#__PURE__*/ jsxs("header", {
|
|
10
12
|
className: "rp-nav",
|
|
11
13
|
children: [
|
|
@@ -36,7 +38,7 @@ function Nav(props) {
|
|
|
36
38
|
/*#__PURE__*/ jsx(NavMenuDivider, {}),
|
|
37
39
|
/*#__PURE__*/ jsx(NavLangs, {}),
|
|
38
40
|
/*#__PURE__*/ jsx(NavVersions, {}),
|
|
39
|
-
/*#__PURE__*/ jsx(SwitchAppearance, {}),
|
|
41
|
+
hasAppearanceSwitch && /*#__PURE__*/ jsx(SwitchAppearance, {}),
|
|
40
42
|
/*#__PURE__*/ jsx(SocialLinks, {})
|
|
41
43
|
]
|
|
42
44
|
}),
|
|
@@ -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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.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-
|
|
67
|
-
"@rsbuild/plugin-react": "~1.4.
|
|
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",
|
|
@@ -77,14 +77,14 @@
|
|
|
77
77
|
"github-slugger": "^2.0.0",
|
|
78
78
|
"hast-util-heading-rank": "^3.0.0",
|
|
79
79
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
80
|
-
"lodash-es": "^4.17.
|
|
80
|
+
"lodash-es": "^4.17.23",
|
|
81
81
|
"mdast-util-mdx": "^3.0.0",
|
|
82
82
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
83
83
|
"medium-zoom": "1.1.0",
|
|
84
84
|
"nprogress": "^0.2.0",
|
|
85
85
|
"picocolors": "^1.1.1",
|
|
86
|
-
"react": "^19.2.
|
|
87
|
-
"react-dom": "^19.2.
|
|
86
|
+
"react": "^19.2.4",
|
|
87
|
+
"react-dom": "^19.2.4",
|
|
88
88
|
"react-lazy-with-preload": "^2.2.1",
|
|
89
89
|
"react-reconciler": "0.33.0",
|
|
90
90
|
"react-router-dom": "^7.12.0",
|
|
@@ -102,23 +102,23 @@
|
|
|
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.
|
|
105
|
+
"@rspress/shared": "2.0.1"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
108
|
"@microsoft/api-extractor": "^7.55.2",
|
|
109
|
-
"@rsbuild/plugin-sass": "~1.
|
|
110
|
-
"@rsbuild/plugin-svgr": "^1.
|
|
111
|
-
"@rslib/core": "0.19.
|
|
109
|
+
"@rsbuild/plugin-sass": "~1.5.0",
|
|
110
|
+
"@rsbuild/plugin-svgr": "^1.3.0",
|
|
111
|
+
"@rslib/core": "0.19.3",
|
|
112
112
|
"@types/body-scroll-lock": "^3.1.2",
|
|
113
113
|
"@types/hast": "^3.0.4",
|
|
114
114
|
"@types/lodash-es": "^4.17.12",
|
|
115
115
|
"@types/mdast": "^4.0.4",
|
|
116
116
|
"@types/node": "^22.8.1",
|
|
117
117
|
"@types/nprogress": "^0.2.3",
|
|
118
|
-
"@types/react": "^19.2.
|
|
118
|
+
"@types/react": "^19.2.10",
|
|
119
119
|
"@types/react-dom": "^19.2.3",
|
|
120
120
|
"@types/react-reconciler": "^0.32.3",
|
|
121
|
-
"@types/web": "^0.0.
|
|
121
|
+
"@types/web": "^0.0.323",
|
|
122
122
|
"execa": "8.0.1",
|
|
123
123
|
"mdast-util-directive": "^3.1.0",
|
|
124
124
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"p-map": "^7.0.4",
|
|
127
127
|
"postcss": "8.5.6",
|
|
128
128
|
"remark-directive": "^4.0.0",
|
|
129
|
-
"rsbuild-plugin-publint": "^0.3.
|
|
129
|
+
"rsbuild-plugin-publint": "^0.3.4",
|
|
130
130
|
"rsbuild-plugin-virtual-module": "0.4.1",
|
|
131
131
|
"tailwindcss": "^3.4.19",
|
|
132
132
|
"ts-json-schema-generator": "^2.4.0",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@rspress/config": "1.0.0"
|
|
136
136
|
},
|
|
137
137
|
"engines": {
|
|
138
|
-
"node": "
|
|
138
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
139
139
|
},
|
|
140
140
|
"publishConfig": {
|
|
141
141
|
"access": "public",
|
|
File without changes
|