@rspress/core 2.0.8 → 2.0.9
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~execa.js +8 -8
- package/dist/0~rslib-runtime.js +20 -0
- package/dist/0~tinypool.js +828 -0
- package/dist/{8311.js → 1688.js} +1 -7
- package/dist/{7397.js → 2240.js} +4 -2
- package/dist/{1361.js → 3294.js} +1 -1
- package/dist/{1965.js → 3425.js} +0 -1
- package/dist/740.js +2470 -0
- package/dist/8006.js +77 -0
- package/dist/8857.js +4827 -0
- package/dist/8857.js.LICENSE.txt +41 -0
- package/dist/cli/index.js +7 -3
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.scss +1 -1
- package/dist/eject-theme/components/CodeButtonGroup/index.scss +1 -1
- package/dist/eject-theme/components/DocContent/doc.scss +2 -0
- package/dist/eject-theme/components/FallbackHeading/index.tsx +1 -1
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +4 -1
- package/dist/eject-theme/components/Llms/LlmsCopyButton.scss +3 -3
- package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -1
- package/dist/eject-theme/components/Steps/index.scss +32 -13
- package/dist/node/PluginDriver.js +1 -1
- package/dist/node/auto-nav-sidebar/index.js +1 -1
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +9 -5
- package/dist/node/auto-nav-sidebar/utils.js +8 -2
- package/dist/node/auto-nav-sidebar/walk.js +2 -8
- package/dist/node/constants.js +1 -1
- package/dist/node/eject.js +11 -7
- package/dist/node/initRsbuild.js +6 -6
- package/dist/node/logger/hint.js +9 -6
- package/dist/node/mdx/options.js +13 -2
- package/dist/node/mdx/processor.js +1 -1
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +6 -2
- package/dist/node/mdx/remarkPlugins/image.d.ts +7 -2
- package/dist/node/mdx/remarkPlugins/image.js +51 -2
- package/dist/node/mdx/remarkPlugins/link.js +7 -3
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +75 -26
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +10 -6
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +1 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/renderPage.js +8 -4
- package/dist/node/ssg/renderPageWorker.js +1 -1
- package/dist/node/ssg/renderPages.js +9 -5
- package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
- package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
- package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
- package/dist/node/ssg-md/renderPage.js +8 -4
- package/dist/node/ssg-md/renderPages.js +7 -3
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/error.js +5 -2
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +1 -1
- package/dist/node/utils/reactAlias.js +7 -3
- package/dist/runtime/App.js +4 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/initPageData.d.ts +3 -0
- package/dist/runtime/initPageData.js +37 -2
- package/dist/runtime/ssrClientEntry.js +4 -2
- package/dist/theme/assets/success.js +1 -1
- package/dist/theme/assets/wrapped.js +1 -1
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.css +1 -1
- package/dist/theme/components/CodeButtonGroup/index.css +1 -1
- package/dist/theme/components/DocContent/doc.css +1 -0
- package/dist/theme/components/FallbackHeading/index.js +1 -1
- package/dist/theme/components/Link/useLinkNavigate.js +3 -2
- package/dist/theme/components/Llms/LlmsCopyButton.css +5 -5
- package/dist/theme/components/Search/SearchPanel.js +1 -1
- package/dist/theme/components/Steps/index.css +23 -12
- package/dist/theme/logic/useThemeState.js +1 -1
- package/package.json +12 -15
- package/dist/4454.js +0 -8
- package/dist/7319.js +0 -88
- package/dist/8885.js +0 -4
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
import { node_path, core_rspack, logger } from "../../740.js";
|
|
2
4
|
import { pathExists, readJson } from "./fs.js";
|
|
3
5
|
import { PACKAGE_ROOT } from "../constants.js";
|
|
4
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);
|
|
5
9
|
const Resolver = core_rspack.experiments.resolver.ResolverFactory;
|
|
6
10
|
async function detectPackageMajorVersion(name) {
|
|
7
11
|
const cwd = process.cwd();
|
|
@@ -77,7 +81,7 @@ async function resolveReactAlias(isSSR) {
|
|
|
77
81
|
alias[lib] = resolved.path;
|
|
78
82
|
} catch (e) {
|
|
79
83
|
if (e instanceof Error) {
|
|
80
|
-
logger.warn(`${lib} not found: \n ${
|
|
84
|
+
logger.warn(`${lib} not found: \n ${picocolors_default().gray(e.toString())}`);
|
|
81
85
|
hintReactVersion();
|
|
82
86
|
}
|
|
83
87
|
}
|
|
@@ -88,7 +92,7 @@ async function resolveReactRenderToMarkdownAlias() {
|
|
|
88
92
|
const hasInstalled = await detectPackageMajorVersion('react-render-to-markdown');
|
|
89
93
|
if (!hasInstalled) {
|
|
90
94
|
const reactMajorVersion = await detectPackageMajorVersion('react');
|
|
91
|
-
if (reactMajorVersion && reactMajorVersion < 19) logger.warn(`You are using React ${reactMajorVersion} with \`llms: true\`. Please install \`react-render-to-markdown\` to ensure compatibility.\n\nAdd the following to your ${
|
|
95
|
+
if (reactMajorVersion && reactMajorVersion < 19) logger.warn(`You are using React ${reactMajorVersion} with \`llms: true\`. Please install \`react-render-to-markdown\` to ensure compatibility.\n\nAdd the following to your ${picocolors_default().greenBright('package.json')}:\n\n` + picocolors_default().greenBright(` "dependencies": {\n "react": "^18.3.1",\n "react-dom": "^18.3.1",\n "react-render-to-markdown": "^18.3.1"\n }\n`));
|
|
92
96
|
return {};
|
|
93
97
|
}
|
|
94
98
|
const alias = {};
|
package/dist/runtime/App.js
CHANGED
|
@@ -3,14 +3,17 @@ import { PageContext, useLocation } from "@rspress/core/runtime";
|
|
|
3
3
|
import { Layout, Root } from "@theme";
|
|
4
4
|
import react, { useContext, useLayoutEffect } from "react";
|
|
5
5
|
import virtual_global_components from "virtual-global-components";
|
|
6
|
-
import { initPageData } from "./initPageData.js";
|
|
6
|
+
import { consumeCachedPageData, initPageData, setCurrentPageData } from "./initPageData.js";
|
|
7
7
|
function App() {
|
|
8
8
|
const { setData: setPageData, data } = useContext(PageContext);
|
|
9
9
|
const { pathname, search } = useLocation();
|
|
10
10
|
useLayoutEffect(()=>{
|
|
11
|
+
const cached = consumeCachedPageData(pathname);
|
|
12
|
+
if (cached) return void setPageData?.(cached);
|
|
11
13
|
async function refetchData() {
|
|
12
14
|
try {
|
|
13
15
|
const pageData = await initPageData(pathname);
|
|
16
|
+
setCurrentPageData(pathname, pageData);
|
|
14
17
|
setPageData?.(pageData);
|
|
15
18
|
} catch (e) {
|
|
16
19
|
console.log(e);
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref, } from '@rspress/shared';
|
|
2
|
-
export { Head } from '@unhead/react';
|
|
2
|
+
export { Head, useHead } from '@unhead/react';
|
|
3
3
|
export * from 'react-router-dom';
|
|
4
4
|
export { Content } from './Content.js';
|
|
5
5
|
export { useActiveMatcher } from './hooks/useActiveMatcher.js';
|
|
@@ -16,6 +16,7 @@ export { getSidebarDataGroup, useSidebar, useSidebarDynamic, } from './hooks/use
|
|
|
16
16
|
export { useSite } from './hooks/useSite.js';
|
|
17
17
|
export { useVersion } from './hooks/useVersion.js';
|
|
18
18
|
export { useWindowSize } from './hooks/useWindowSize.js';
|
|
19
|
+
export { initPageData, warmPageData } from './initPageData.js';
|
|
19
20
|
export { NoSSR } from './NoSSR.js';
|
|
20
21
|
export { isActive, pathnameToRouteService, preloadLink } from './route.js';
|
|
21
22
|
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, } from './utils.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "react-router-dom";
|
|
2
2
|
export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "@rspress/shared";
|
|
3
|
-
export { Head } from "@unhead/react";
|
|
3
|
+
export { Head, useHead } from "@unhead/react";
|
|
4
4
|
export { Content } from "./Content.js";
|
|
5
5
|
export { useActiveMatcher } from "./hooks/useActiveMatcher.js";
|
|
6
6
|
export { ThemeContext, useDark } from "./hooks/useDark.js";
|
|
@@ -16,6 +16,7 @@ export { getSidebarDataGroup, useSidebar, useSidebarDynamic } from "./hooks/useS
|
|
|
16
16
|
export { useSite } from "./hooks/useSite.js";
|
|
17
17
|
export { useVersion } from "./hooks/useVersion.js";
|
|
18
18
|
export { useWindowSize } from "./hooks/useWindowSize.js";
|
|
19
|
+
export { initPageData, warmPageData } from "./initPageData.js";
|
|
19
20
|
export { NoSSR } from "./NoSSR.js";
|
|
20
21
|
export { isActive, pathnameToRouteService, preloadLink } from "./route.js";
|
|
21
22
|
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase } from "./utils.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { type PageDataLegacy } from '@rspress/shared';
|
|
2
2
|
export type Page = PageDataLegacy['page'];
|
|
3
|
+
export declare function warmPageData(routePath: string, data: Page): void;
|
|
4
|
+
export declare function consumeCachedPageData(routePath: string): Page | undefined;
|
|
5
|
+
export declare function setCurrentPageData(routePath: string, data: Page): void;
|
|
3
6
|
export declare function initPageData(routePath: string): Promise<Page>;
|
|
@@ -1,7 +1,42 @@
|
|
|
1
|
-
import { isEqualPath, pathnameToRouteService } from "@rspress/core/runtime";
|
|
2
1
|
import { MDX_OR_MD_REGEXP, cleanUrl } from "@rspress/shared";
|
|
3
2
|
import { pageData } from "virtual-page-data";
|
|
4
3
|
import virtual_site_data from "virtual-site-data";
|
|
4
|
+
import { pathnameToRouteService } from "./route.js";
|
|
5
|
+
import { isEqualPath } from "./utils.js";
|
|
6
|
+
const slots = [
|
|
7
|
+
void 0,
|
|
8
|
+
void 0,
|
|
9
|
+
void 0
|
|
10
|
+
];
|
|
11
|
+
function warmPageData(routePath, data) {
|
|
12
|
+
slots[0] = {
|
|
13
|
+
routePath,
|
|
14
|
+
data
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function consumeCachedPageData(routePath) {
|
|
18
|
+
if (slots[0]?.routePath === routePath) {
|
|
19
|
+
const data = slots[0].data;
|
|
20
|
+
slots[2] = slots[1];
|
|
21
|
+
slots[1] = slots[0];
|
|
22
|
+
slots[0] = void 0;
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
if (slots[2]?.routePath === routePath) {
|
|
26
|
+
const data = slots[2].data;
|
|
27
|
+
slots[0] = slots[1];
|
|
28
|
+
slots[1] = slots[2];
|
|
29
|
+
slots[2] = void 0;
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function setCurrentPageData(routePath, data) {
|
|
34
|
+
slots[2] = slots[1];
|
|
35
|
+
slots[1] = {
|
|
36
|
+
routePath,
|
|
37
|
+
data
|
|
38
|
+
};
|
|
39
|
+
}
|
|
5
40
|
async function initPageData(routePath) {
|
|
6
41
|
const matchedRoute = pathnameToRouteService(routePath);
|
|
7
42
|
if (matchedRoute) {
|
|
@@ -48,4 +83,4 @@ async function initPageData(routePath) {
|
|
|
48
83
|
_relativePath: ''
|
|
49
84
|
};
|
|
50
85
|
}
|
|
51
|
-
export { initPageData };
|
|
86
|
+
export { consumeCachedPageData, initPageData, setCurrentPageData, warmPageData };
|
|
@@ -3,10 +3,12 @@ import { removeBase } from "@rspress/core/runtime";
|
|
|
3
3
|
import { startTransition } from "react";
|
|
4
4
|
import { hydrateRoot } from "react-dom/client";
|
|
5
5
|
import { ClientApp } from "./ClientApp.js";
|
|
6
|
-
import { initPageData } from "./initPageData.js";
|
|
6
|
+
import { initPageData, setCurrentPageData } from "./initPageData.js";
|
|
7
7
|
async function renderInBrowser() {
|
|
8
8
|
const container = document.getElementById('__rspress_root');
|
|
9
|
-
const
|
|
9
|
+
const pathname = removeBase(window.location.pathname);
|
|
10
|
+
const initialPageData = await initPageData(pathname);
|
|
11
|
+
setCurrentPageData(pathname, initialPageData);
|
|
10
12
|
startTransition(()=>{
|
|
11
13
|
hydrateRoot(container, /*#__PURE__*/ jsx(ClientApp, {
|
|
12
14
|
initialPageData: initialPageData
|
|
@@ -7,7 +7,7 @@ const SvgWrapped = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
|
7
7
|
viewBox: "0 0 24 24",
|
|
8
8
|
...props,
|
|
9
9
|
children: /*#__PURE__*/ jsx("path", {
|
|
10
|
-
fill: "
|
|
10
|
+
fill: "currentColor",
|
|
11
11
|
d: "M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"
|
|
12
12
|
})
|
|
13
13
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getCustomMDXComponent, renderInlineMarkdown } from "@rspress/core/theme";
|
|
3
|
-
import { slug } from "github-slugger";
|
|
3
|
+
import { slug } from "@rspress/shared/github-slugger";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
const getHeadingMap = ()=>{
|
|
6
6
|
const { h1, h2, h3, h4, h5, h6 } = getCustomMDXComponent();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cleanUrlByConfig, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, withBase } from "@rspress/core/runtime";
|
|
1
|
+
import { cleanUrlByConfig, initPageData, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, warmPageData, withBase } from "@rspress/core/runtime";
|
|
2
2
|
import nprogress from "nprogress";
|
|
3
3
|
import { startTransition as external_react_startTransition, useCallback } from "react";
|
|
4
4
|
nprogress.configure({
|
|
@@ -46,7 +46,8 @@ function useLinkNavigate({ startTransition } = {
|
|
|
46
46
|
const timer = setTimeout(()=>{
|
|
47
47
|
nprogress.start();
|
|
48
48
|
}, 200);
|
|
49
|
-
await
|
|
49
|
+
const data = await initPageData(removeBaseHref);
|
|
50
|
+
warmPageData(removeBaseHref, data);
|
|
50
51
|
clearTimeout(timer);
|
|
51
52
|
nprogress.done();
|
|
52
53
|
}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.rp-llms-copy-button--success.rp-llms-copy-button {
|
|
13
|
-
color:
|
|
14
|
-
border-color: var(--rp-c-green-1, #10b981);
|
|
13
|
+
color: #10b981;
|
|
15
14
|
background: var(--rp-c-bg-soft);
|
|
15
|
+
border-color: #10b981;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.rp-llms-copy-button--success .rp-llms-copy-button__icon-copy {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.rp-llms-copy-button__icon-success {
|
|
46
|
-
|
|
47
|
-
height: 16px;
|
|
48
|
-
color: var(--rp-c-green-1, #10b981);
|
|
46
|
+
color: #10b981;
|
|
49
47
|
visibility: hidden;
|
|
50
48
|
opacity: 0;
|
|
49
|
+
width: 16px;
|
|
50
|
+
height: 16px;
|
|
51
51
|
transition: all .2s cubic-bezier(.18, .89, .32, 1.28);
|
|
52
52
|
position: absolute;
|
|
53
53
|
top: 50%;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useI18n, usePageData } from "@rspress/core/runtime";
|
|
3
3
|
import { IconClose, IconLoading, IconSearch, SvgWrapper, Tab, Tabs, useLinkNavigate } from "@rspress/core/theme";
|
|
4
|
-
import { debounce } from "lodash-es";
|
|
4
|
+
import { debounce } from "@rspress/shared/lodash-es";
|
|
5
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
import * as __rspack_external_virtual_search_hooks_9d01d01f from "virtual-search-hooks";
|
|
@@ -1,36 +1,47 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--rp-steps-gap: 24px;
|
|
3
|
+
--rp-steps-size: 30px;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.rp-steps {
|
|
2
7
|
border-left: 1px solid var(--rp-c-text-3);
|
|
8
|
+
padding-left: var(--rp-steps-gap);
|
|
3
9
|
counter-reset: step;
|
|
4
|
-
margin-bottom:
|
|
5
|
-
margin-left:
|
|
6
|
-
padding-left: 24px;
|
|
10
|
+
margin-bottom: 2.5rem;
|
|
11
|
+
margin-left: 1rem;
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
.rp-steps h3 {
|
|
10
15
|
counter-increment: step;
|
|
11
|
-
|
|
16
|
+
align-items: center;
|
|
17
|
+
min-height: 30px;
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
display: flex;
|
|
12
20
|
position: relative;
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
.rp-steps h3:before {
|
|
16
24
|
content: counter(step);
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
left: calc(-1*var(--rp-steps-gap));
|
|
26
|
+
width: var(--rp-steps-size);
|
|
27
|
+
height: var(--rp-steps-size);
|
|
28
|
+
line-height: var(--rp-steps-size);
|
|
19
29
|
color: var(--rp-c-text-1);
|
|
20
|
-
background-color: var(--rp-
|
|
30
|
+
background-color: var(--rp-c-bg);
|
|
31
|
+
outline: 6px solid var(--rp-c-bg);
|
|
21
32
|
border: 1.5px solid var(--rp-c-text-3);
|
|
22
33
|
border-radius: 50%;
|
|
23
34
|
justify-content: center;
|
|
24
35
|
align-items: center;
|
|
25
36
|
font-size: 1.1rem;
|
|
26
|
-
font-weight:
|
|
27
|
-
line-height: 30px;
|
|
37
|
+
font-weight: 500;
|
|
28
38
|
display: flex;
|
|
29
39
|
position: absolute;
|
|
30
|
-
|
|
40
|
+
transform: translate(-50%);
|
|
31
41
|
}
|
|
32
42
|
|
|
33
|
-
.rp-steps
|
|
34
|
-
|
|
43
|
+
.rp-steps h3 .rp-header-anchor {
|
|
44
|
+
left: calc(-1*var(--rp-steps-gap) - var(--rp-steps-size)/2);
|
|
45
|
+
position: absolute;
|
|
35
46
|
}
|
|
36
47
|
|
|
@@ -5,7 +5,7 @@ import { useStorageValue } from "./useStorageValue.js";
|
|
|
5
5
|
const APPEARANCE_KEY = 'rspress-theme-appearance';
|
|
6
6
|
const MEDIA_QUERY = '(prefers-color-scheme: dark)';
|
|
7
7
|
const applyThemeToDOM = (theme)=>{
|
|
8
|
-
if (!document
|
|
8
|
+
if (!document?.documentElement) return;
|
|
9
9
|
const root = document.documentElement;
|
|
10
10
|
root.classList.toggle('dark', 'dark' === theme);
|
|
11
11
|
root.classList.toggle('rp-dark', 'dark' === theme);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -60,26 +60,21 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@mdx-js/mdx": "^3.1.1",
|
|
62
62
|
"@mdx-js/react": "^3.1.1",
|
|
63
|
-
"@rsbuild/core": "2.0.0-
|
|
63
|
+
"@rsbuild/core": "2.0.0-rc.1",
|
|
64
64
|
"@rsbuild/plugin-react": "~1.4.6",
|
|
65
65
|
"@shikijs/rehype": "^4.0.2",
|
|
66
66
|
"@types/unist": "^3.0.3",
|
|
67
|
-
"@unhead/react": "^2.1.
|
|
67
|
+
"@unhead/react": "^2.1.13",
|
|
68
68
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
69
|
-
"cac": "^7.0.0",
|
|
70
|
-
"chokidar": "^3.6.0",
|
|
71
69
|
"clsx": "2.1.1",
|
|
72
70
|
"copy-to-clipboard": "^3.3.3",
|
|
73
71
|
"flexsearch": "0.8.212",
|
|
74
|
-
"github-slugger": "^2.0.0",
|
|
75
72
|
"hast-util-heading-rank": "^3.0.0",
|
|
76
73
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
77
|
-
"lodash-es": "^4.17.23",
|
|
78
74
|
"mdast-util-mdx": "^3.0.0",
|
|
79
75
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
80
76
|
"medium-zoom": "1.1.0",
|
|
81
77
|
"nprogress": "^0.2.0",
|
|
82
|
-
"picocolors": "^1.1.1",
|
|
83
78
|
"react": "^19.2.4",
|
|
84
79
|
"react-dom": "^19.2.4",
|
|
85
80
|
"react-lazy-with-preload": "^2.2.1",
|
|
@@ -96,22 +91,19 @@
|
|
|
96
91
|
"remark-stringify": "^11.0.0",
|
|
97
92
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
98
93
|
"shiki": "^4.0.2",
|
|
99
|
-
"tinyglobby": "^0.2.15",
|
|
100
|
-
"tinypool": "^1.1.1",
|
|
101
94
|
"unified": "^11.0.5",
|
|
102
95
|
"unist-util-remove": "^4.0.0",
|
|
103
|
-
"unist-util-visit": "^5.
|
|
96
|
+
"unist-util-visit": "^5.1.0",
|
|
104
97
|
"unist-util-visit-children": "^3.0.0",
|
|
105
|
-
"@rspress/shared": "2.0.
|
|
98
|
+
"@rspress/shared": "2.0.9"
|
|
106
99
|
},
|
|
107
100
|
"devDependencies": {
|
|
108
101
|
"@microsoft/api-extractor": "^7.57.7",
|
|
109
102
|
"@rsbuild/plugin-sass": "~1.5.1",
|
|
110
103
|
"@rsbuild/plugin-svgr": "^1.3.1",
|
|
111
|
-
"@rslib/core": "0.
|
|
104
|
+
"@rslib/core": "0.21.0",
|
|
112
105
|
"@types/body-scroll-lock": "^3.1.2",
|
|
113
106
|
"@types/hast": "^3.0.4",
|
|
114
|
-
"@types/lodash-es": "^4.17.12",
|
|
115
107
|
"@types/mdast": "^4.0.4",
|
|
116
108
|
"@types/node": "^22.8.1",
|
|
117
109
|
"@types/nprogress": "^0.2.3",
|
|
@@ -119,17 +111,22 @@
|
|
|
119
111
|
"@types/react-dom": "^19.2.3",
|
|
120
112
|
"@types/react-reconciler": "^0.33.0",
|
|
121
113
|
"@types/web": "^0.0.345",
|
|
114
|
+
"cac": "^7.0.0",
|
|
115
|
+
"chokidar": "^3.6.0",
|
|
122
116
|
"execa": "8.0.1",
|
|
123
117
|
"mdast-util-directive": "^3.1.0",
|
|
124
118
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
125
119
|
"memfs": "^4.57.1",
|
|
126
120
|
"p-map": "^7.0.4",
|
|
121
|
+
"picocolors": "^1.1.1",
|
|
127
122
|
"postcss": "8.5.8",
|
|
128
123
|
"remark-directive": "^4.0.0",
|
|
129
124
|
"rsbuild-plugin-publint": "^0.3.4",
|
|
130
125
|
"rsbuild-plugin-virtual-module": "0.4.1",
|
|
131
126
|
"tailwindcss": "^3.4.19",
|
|
132
|
-
"
|
|
127
|
+
"tinyglobby": "^0.2.15",
|
|
128
|
+
"tinypool": "^1.1.1",
|
|
129
|
+
"ts-json-schema-generator": "^2.9.0",
|
|
133
130
|
"typescript": "^5.8.2",
|
|
134
131
|
"vfile": "^6.0.3",
|
|
135
132
|
"@rspress/config": "1.0.0"
|
package/dist/4454.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as node_path, join } from "node:path";
|
|
2
|
-
export { logger } from "@rspress/shared/logger";
|
|
3
|
-
export { cac } from "cac";
|
|
4
|
-
export { default as chokidar } from "chokidar";
|
|
5
|
-
export { default as picocolors } from "picocolors";
|
|
6
|
-
export { default as node_fs } from "node:fs";
|
|
7
|
-
export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
|
|
8
|
-
export { default as promises } from "node:fs/promises";
|
package/dist/7319.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import node_path, { extname, join, relative } from "node:path";
|
|
2
|
-
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
3
|
-
import { createRequire as __rspack_createRequire } from "node:module";
|
|
4
|
-
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
5
|
-
__webpack_require__.add({
|
|
6
|
-
child_process (module) {
|
|
7
|
-
module.exports = __rspack_createRequire_require("child_process");
|
|
8
|
-
},
|
|
9
|
-
fs (module) {
|
|
10
|
-
module.exports = __rspack_createRequire_require("fs");
|
|
11
|
-
},
|
|
12
|
-
path (module) {
|
|
13
|
-
module.exports = __rspack_createRequire_require("path");
|
|
14
|
-
},
|
|
15
|
-
stream (module) {
|
|
16
|
-
module.exports = __rspack_createRequire_require("stream");
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
|
|
20
|
-
const pluginVirtualModule = (pluginOptions = {})=>({
|
|
21
|
-
name: PLUGIN_VIRTUAL_MODULE_NAME,
|
|
22
|
-
async setup (api) {
|
|
23
|
-
const { virtualModules = {}, tempDir: virtualFolderName = '.rsbuild-virtual-module' } = pluginOptions;
|
|
24
|
-
const TEMP_DIR = join(api.context.rootPath, virtualFolderName);
|
|
25
|
-
const virtualFileAbsolutePaths = Object.keys(virtualModules).map((i)=>{
|
|
26
|
-
let absolutePath = join(TEMP_DIR, i);
|
|
27
|
-
if (!extname(absolutePath)) absolutePath = `${absolutePath}.js`;
|
|
28
|
-
return [
|
|
29
|
-
i,
|
|
30
|
-
absolutePath
|
|
31
|
-
];
|
|
32
|
-
});
|
|
33
|
-
api.modifyBundlerChain((chain, { rspack })=>{
|
|
34
|
-
const pluginId = 'RSBUILD_VIRTUAL_MODULE_PLUGIN';
|
|
35
|
-
const virtualModules = Object.fromEntries(virtualFileAbsolutePaths.map((i)=>[
|
|
36
|
-
i[1],
|
|
37
|
-
''
|
|
38
|
-
]));
|
|
39
|
-
if (chain.plugins.has(pluginId)) chain.plugin(pluginId).tap((options)=>{
|
|
40
|
-
const existingPaths = new Set(Object.keys(options[0] ?? {}));
|
|
41
|
-
const conflictPath = virtualFileAbsolutePaths.find(([, path])=>existingPaths.has(path));
|
|
42
|
-
if (conflictPath) throw new Error(`Virtual module name conflicted: ${conflictPath[0]}`);
|
|
43
|
-
return [
|
|
44
|
-
{
|
|
45
|
-
...options[0],
|
|
46
|
-
...virtualModules
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
});
|
|
50
|
-
else chain.plugin(pluginId).use(rspack.experiments.VirtualModulesPlugin, [
|
|
51
|
-
virtualModules
|
|
52
|
-
]);
|
|
53
|
-
chain.resolve.alias.merge(Object.fromEntries(virtualFileAbsolutePaths));
|
|
54
|
-
});
|
|
55
|
-
for (const [moduleName, absolutePath] of virtualFileAbsolutePaths){
|
|
56
|
-
const handler = virtualModules[moduleName];
|
|
57
|
-
if (handler) api.transform({
|
|
58
|
-
test: absolutePath
|
|
59
|
-
}, handler);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
export { DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
|
|
64
|
-
export { default as promises, mkdir, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
65
|
-
export { MDX_OR_MD_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getSidebarDataGroup, isDebugMode, isExternalUrl, normalizeHref, removeLeadingSlash, removeTrailingSlash, slash, withBase } from "@rspress/shared";
|
|
66
|
-
export { glob } from "tinyglobby";
|
|
67
|
-
export { logger } from "@rspress/shared/logger";
|
|
68
|
-
export { default as picocolors } from "picocolors";
|
|
69
|
-
export { extractTextAndId, getIconUrlPath, loadFrontMatter } from "@rspress/shared/node-utils";
|
|
70
|
-
export { createRequire } from "node:module";
|
|
71
|
-
export { cwd } from "node:process";
|
|
72
|
-
export { fileURLToPath, pathToFileURL } from "node:url";
|
|
73
|
-
export { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
|
|
74
|
-
export { chunk, groupBy } from "lodash-es";
|
|
75
|
-
export { default as remark_gfm } from "remark-gfm";
|
|
76
|
-
export { default as remark_parse } from "remark-parse";
|
|
77
|
-
export { default as remark_stringify } from "remark-stringify";
|
|
78
|
-
export { unified } from "unified";
|
|
79
|
-
export { remove } from "unist-util-remove";
|
|
80
|
-
export { visit } from "unist-util-visit";
|
|
81
|
-
export { default as node_fs } from "node:fs";
|
|
82
|
-
export { createProcessor } from "@mdx-js/mdx";
|
|
83
|
-
export { mergeRsbuildConfig, rspack as core_rspack } from "@rsbuild/core";
|
|
84
|
-
export { createHash } from "node:crypto";
|
|
85
|
-
export { default as node_os } from "node:os";
|
|
86
|
-
export { matchPath } from "react-router-dom";
|
|
87
|
-
export { createHead } from "@unhead/react/server";
|
|
88
|
-
export { extname, join, node_path, pluginVirtualModule, relative };
|
package/dist/8885.js
DELETED