@rspress/core 2.0.12 → 2.0.14
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 +1 -1
- package/dist/0~rslib-runtime.js +9 -5
- package/dist/{2235.js → 4942.js} +12 -9
- package/dist/{8857.js → 5580.js} +3 -3
- package/dist/6646.js +3 -0
- package/dist/{1688.js → 7261.js} +6 -1
- package/dist/{8006.js → 7986.js} +1 -6
- package/dist/cli/index.js +4 -4
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/Banner/index.scss +11 -0
- package/dist/eject-theme/components/Banner/index.tsx +5 -1
- package/dist/eject-theme/components/CodeBlock/index.test.tsx +49 -0
- package/dist/eject-theme/components/CodeBlock/index.tsx +1 -1
- package/dist/eject-theme/components/CodeButtonGroup/index.tsx +5 -2
- package/dist/eject-theme/components/FallbackHeading/index.test.tsx +45 -0
- package/dist/eject-theme/components/FallbackHeading/index.tsx +1 -1
- package/dist/eject-theme/components/Link/index.tsx +6 -0
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +2 -2
- package/dist/eject-theme/components/Outline/index.tsx +0 -6
- package/dist/eject-theme/components/Overview/index.test.tsx +57 -0
- package/dist/eject-theme/components/Overview/index.tsx +1 -1
- package/dist/eject-theme/components/OverviewGroup/index.test.tsx +61 -0
- package/dist/eject-theme/components/OverviewGroup/index.tsx +1 -1
- package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +54 -0
- package/dist/eject-theme/components/PackageManagerTabs/index.tsx +1 -1
- package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -0
- package/dist/eject-theme/components/Search/logic/search.ts +15 -16
- package/dist/eject-theme/components/SidebarMenu/index.tsx +10 -3
- package/dist/eject-theme/components/SidebarMenu/useSidebarMenu.tsx +12 -3
- package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +120 -0
- package/dist/eject-theme/components/SocialLinks/SocialLink.tsx +5 -0
- package/dist/eject-theme/components/SocialLinks/index.scss +17 -0
- package/dist/eject-theme/components/Steps/index.scss +6 -4
- package/dist/eject-theme/components/Tabs/index.test.tsx +51 -0
- package/dist/eject-theme/components/Tabs/index.tsx +1 -1
- package/dist/eject-theme/components/Tag/index.test.tsx +55 -0
- package/dist/eject-theme/components/Tag/index.tsx +19 -5
- package/dist/index.js +1 -1
- 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 +3 -4
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/constants.js +3 -3
- package/dist/node/eject.js +2 -2
- package/dist/node/initRsbuild.js +20 -14
- package/dist/node/logger/hint.js +1 -1
- package/dist/node/mdx/options.js +1 -1
- 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 +2 -2
- package/dist/node/mdx/remarkPlugins/image.js +3 -4
- package/dist/node/mdx/remarkPlugins/link.js +2 -2
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +2 -3
- package/dist/node/route/extractPageData.js +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +119 -112
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +7 -0
- package/dist/node/runtimeModule/i18n.js +2 -2
- 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 +33 -9
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/htmlFile.d.ts +2 -0
- package/dist/node/ssg/htmlFile.js +14 -0
- package/dist/node/ssg/renderPage.js +2 -2
- package/dist/node/ssg/renderPageWorker.d.ts +3 -6
- package/dist/node/ssg/renderPageWorker.js +24 -4
- package/dist/node/ssg/renderPages.d.ts +1 -1
- package/dist/node/ssg/renderPages.js +19 -18
- package/dist/node/ssg/rsbuildPluginSSG.js +2 -2
- 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 +2 -2
- package/dist/node/ssg-md/renderPages.js +3 -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 +1 -1
- 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 +2 -2
- package/dist/runtime/App.js +1 -1
- package/dist/theme/components/Banner/index.css +11 -0
- package/dist/theme/components/Banner/index.js +1 -0
- package/dist/theme/components/CodeBlock/index.js +1 -1
- package/dist/theme/components/CodeButtonGroup/index.js +4 -2
- package/dist/theme/components/FallbackHeading/index.js +1 -1
- package/dist/theme/components/Link/index.js +6 -0
- package/dist/theme/components/Link/useLinkNavigate.js +2 -2
- package/dist/theme/components/Outline/index.js +1 -3
- package/dist/theme/components/Overview/index.js +1 -1
- package/dist/theme/components/OverviewGroup/index.js +1 -1
- package/dist/theme/components/PackageManagerTabs/index.js +1 -1
- package/dist/theme/components/Search/SearchPanel.js +1 -0
- package/dist/theme/components/Search/logic/search.js +12 -7
- package/dist/theme/components/SidebarMenu/index.d.ts +3 -0
- package/dist/theme/components/SidebarMenu/index.js +4 -3
- package/dist/theme/components/SidebarMenu/useSidebarMenu.d.ts +2 -1
- package/dist/theme/components/SidebarMenu/useSidebarMenu.js +7 -3
- package/dist/theme/components/SocialLinks/GithubStars.d.ts +7 -0
- package/dist/theme/components/SocialLinks/GithubStars.js +85 -0
- package/dist/theme/components/SocialLinks/SocialLink.js +5 -0
- package/dist/theme/components/SocialLinks/index.css +19 -0
- package/dist/theme/components/Steps/index.css +6 -4
- package/dist/theme/components/Tabs/index.js +1 -1
- package/dist/theme/components/Tag/index.js +9 -5
- package/dist/theme/layout/DocLayout/index.js +2 -2
- package/dist/theme/layout/HomeLayout/index.js +1 -1
- package/dist/theme/layout/Layout/index.js +1 -1
- package/package.json +13 -14
- package/dist/9224.js +0 -1
- package/dist/runtime/BrowserOnly.test.d.ts +0 -1
- /package/dist/{0~1402.js → 0~8787.js} +0 -0
- /package/dist/{3323.js → 3358.js} +0 -0
- /package/dist/{8857.js.LICENSE.txt → 5580.js.LICENSE.txt} +0 -0
- /package/dist/{3294.js → 8005.js} +0 -0
- /package/dist/{6162.js → 9283.js} +0 -0
- /package/dist/{8474.js → 9882.js} +0 -0
|
@@ -4,12 +4,13 @@ import { IconArrowRight, IconMenu, ReadPercent, SvgWrapper, renderInlineMarkdown
|
|
|
4
4
|
import { forwardRef, useEffect, useRef } from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import "./index.css";
|
|
7
|
-
const SidebarMenu = /*#__PURE__*/ forwardRef(({ isSidebarOpen, onIsSidebarOpenChange, isOutlineOpen, onIsOutlineOpenChange }, forwardedRef)=>{
|
|
7
|
+
const SidebarMenu = /*#__PURE__*/ forwardRef(({ isSidebarOpen, onIsSidebarOpenChange, isOutlineOpen, onIsOutlineOpenChange, beforeOutline, afterOutline }, forwardedRef)=>{
|
|
8
8
|
const sidebarMenuRef = useRef(null);
|
|
9
9
|
const t = useI18n();
|
|
10
10
|
const { pathname, hash } = useLocation();
|
|
11
11
|
const headers = useDynamicToc();
|
|
12
12
|
const { scrolledHeader } = useActiveAnchor(headers);
|
|
13
|
+
const outlineDisabled = !beforeOutline && !afterOutline && 0 === headers.length;
|
|
13
14
|
const { frontmatter: { sidebar: sidebarConfig = true, outline: showOutline = true } } = useFrontmatter();
|
|
14
15
|
const showSidebar = true === sidebarConfig;
|
|
15
16
|
function openSidebar() {
|
|
@@ -61,7 +62,7 @@ const SidebarMenu = /*#__PURE__*/ forwardRef(({ isSidebarOpen, onIsSidebarOpenCh
|
|
|
61
62
|
}),
|
|
62
63
|
showOutline ? /*#__PURE__*/ jsxs("button", {
|
|
63
64
|
type: "button",
|
|
64
|
-
disabled:
|
|
65
|
+
disabled: outlineDisabled,
|
|
65
66
|
onClick: (e)=>{
|
|
66
67
|
e.preventDefault();
|
|
67
68
|
e.stopPropagation();
|
|
@@ -80,7 +81,7 @@ const SidebarMenu = /*#__PURE__*/ forwardRef(({ isSidebarOpen, onIsSidebarOpenCh
|
|
|
80
81
|
size: 14,
|
|
81
82
|
strokeWidth: 2
|
|
82
83
|
}),
|
|
83
|
-
|
|
84
|
+
!outlineDisabled && /*#__PURE__*/ jsx(SvgWrapper, {
|
|
84
85
|
icon: IconArrowRight,
|
|
85
86
|
className: "rp-sidebar-menu__right__icon",
|
|
86
87
|
style: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
declare function useSidebarMenu(beforeOutline?: ReactNode, afterOutline?: ReactNode): {
|
|
2
3
|
sidebarMenu: import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
isOutlineOpen: boolean;
|
|
4
5
|
isSidebarOpen: boolean;
|
|
@@ -3,7 +3,7 @@ import { clearAllBodyScrollLocks, disableBodyScroll } from "body-scroll-lock";
|
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { SidebarMenu } from "./index.js";
|
|
5
5
|
import { useClickOutside } from "./useClickOutside.js";
|
|
6
|
-
function useSidebarMenu() {
|
|
6
|
+
function useSidebarMenu(beforeOutline, afterOutline) {
|
|
7
7
|
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
|
|
8
8
|
const [isOutlineOpen, setIsOutlineOpen] = useState(false);
|
|
9
9
|
const sidebarMenuRef = useRef(null);
|
|
@@ -37,12 +37,16 @@ function useSidebarMenu() {
|
|
|
37
37
|
onIsSidebarOpenChange: setIsSidebarOpen,
|
|
38
38
|
isOutlineOpen: isOutlineOpen,
|
|
39
39
|
onIsOutlineOpenChange: setIsOutlineOpen,
|
|
40
|
-
ref: sidebarMenuRef
|
|
40
|
+
ref: sidebarMenuRef,
|
|
41
|
+
beforeOutline: beforeOutline,
|
|
42
|
+
afterOutline: afterOutline
|
|
41
43
|
}), [
|
|
42
44
|
isOutlineOpen,
|
|
43
45
|
isSidebarOpen,
|
|
44
46
|
setIsOutlineOpen,
|
|
45
|
-
setIsSidebarOpen
|
|
47
|
+
setIsSidebarOpen,
|
|
48
|
+
beforeOutline,
|
|
49
|
+
afterOutline
|
|
46
50
|
]);
|
|
47
51
|
return {
|
|
48
52
|
sidebarMenu,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
const TTL_MS = 3600000;
|
|
4
|
+
function storageKey(repo) {
|
|
5
|
+
return `rp-github-stars:${repo}`;
|
|
6
|
+
}
|
|
7
|
+
function parseRepo(content) {
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(content);
|
|
10
|
+
const host = url.hostname.replace(/^www\./, '');
|
|
11
|
+
if ('github.com' !== host) return null;
|
|
12
|
+
const match = url.pathname.match(/^\/([^/]+)\/([^/]+)/);
|
|
13
|
+
if (!match) return null;
|
|
14
|
+
return `${match[1]}/${match[2].replace(/\.git$/, '')}`;
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function readCache(repo) {
|
|
20
|
+
if ("u" < typeof localStorage) return null;
|
|
21
|
+
try {
|
|
22
|
+
const raw = localStorage.getItem(storageKey(repo));
|
|
23
|
+
if (!raw) return null;
|
|
24
|
+
const parsed = JSON.parse(raw);
|
|
25
|
+
if ('number' != typeof parsed?.count || 'number' != typeof parsed?.fetchedAt) return null;
|
|
26
|
+
return parsed;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function writeCache(repo, count) {
|
|
32
|
+
if ("u" < typeof localStorage) return;
|
|
33
|
+
try {
|
|
34
|
+
localStorage.setItem(storageKey(repo), JSON.stringify({
|
|
35
|
+
count,
|
|
36
|
+
fetchedAt: Date.now()
|
|
37
|
+
}));
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
function formatCount(count) {
|
|
41
|
+
if (count >= 1000000) return `${(count / 1000000).toFixed(1)}M`;
|
|
42
|
+
if (count >= 1000) return `${(count / 1000).toFixed(1)}K`;
|
|
43
|
+
return String(count);
|
|
44
|
+
}
|
|
45
|
+
const GithubStars = (props)=>{
|
|
46
|
+
const { content, icon } = props;
|
|
47
|
+
const repo = parseRepo(content);
|
|
48
|
+
const [count, setCount] = useState(()=>repo ? readCache(repo)?.count ?? null : null);
|
|
49
|
+
useEffect(()=>{
|
|
50
|
+
if (!repo) return;
|
|
51
|
+
const cached = readCache(repo);
|
|
52
|
+
if (cached && Date.now() - cached.fetchedAt < TTL_MS) return;
|
|
53
|
+
let cancelled = false;
|
|
54
|
+
fetch(`https://api.github.com/repos/${repo}`).then((res)=>res.ok ? res.json() : Promise.reject(res.status)).then((data)=>{
|
|
55
|
+
if (cancelled) return;
|
|
56
|
+
if ('number' == typeof data?.stargazers_count) {
|
|
57
|
+
setCount(data.stargazers_count);
|
|
58
|
+
writeCache(repo, data.stargazers_count);
|
|
59
|
+
}
|
|
60
|
+
}).catch(()=>{});
|
|
61
|
+
return ()=>{
|
|
62
|
+
cancelled = true;
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
repo
|
|
66
|
+
]);
|
|
67
|
+
return /*#__PURE__*/ jsxs("a", {
|
|
68
|
+
href: content,
|
|
69
|
+
target: "_blank",
|
|
70
|
+
rel: "noopener noreferrer",
|
|
71
|
+
className: "rp-social-links__item rp-social-links__github-stars",
|
|
72
|
+
"aria-label": null == count ? 'GitHub repository' : `GitHub repository, ${count.toLocaleString()} stars`,
|
|
73
|
+
children: [
|
|
74
|
+
/*#__PURE__*/ jsx("div", {
|
|
75
|
+
className: "rp-social-links__icon",
|
|
76
|
+
children: icon
|
|
77
|
+
}),
|
|
78
|
+
null != count && /*#__PURE__*/ jsx("span", {
|
|
79
|
+
className: "rp-social-links__github-stars-count",
|
|
80
|
+
children: formatCount(count)
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
export { GithubStars };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import virtual_social_links from "virtual-social-links";
|
|
3
3
|
import "./index.css";
|
|
4
|
+
import { GithubStars } from "./GithubStars.js";
|
|
4
5
|
import { useHoverGroup } from "../HoverGroup/useHoverGroup.js";
|
|
5
6
|
const SocialLink = (props)=>{
|
|
6
7
|
const { link, hoverGroupPosition = 'center' } = props;
|
|
@@ -42,6 +43,10 @@ const SocialLink = (props)=>{
|
|
|
42
43
|
children: IconComp
|
|
43
44
|
})
|
|
44
45
|
}, content);
|
|
46
|
+
if ('github-stars' === mode) return /*#__PURE__*/ jsx(GithubStars, {
|
|
47
|
+
content: content,
|
|
48
|
+
icon: IconComp
|
|
49
|
+
});
|
|
45
50
|
if ('text' === mode) return /*#__PURE__*/ jsxs("div", {
|
|
46
51
|
className: "rp-social-links__item",
|
|
47
52
|
onMouseEnter: handleMouseEnter,
|
|
@@ -42,3 +42,22 @@
|
|
|
42
42
|
display: flex;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
.rp-social-links__github-stars {
|
|
46
|
+
color: var(--rp-c-text-2);
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
gap: 6px;
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
transition: color .2s;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.rp-social-links__github-stars:hover {
|
|
54
|
+
color: var(--rp-c-text-1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rp-social-links__github-stars-count {
|
|
58
|
+
font-variant-numeric: tabular-nums;
|
|
59
|
+
font-size: 13px;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
line-height: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--rp-steps-gap: 24px;
|
|
3
3
|
--rp-steps-size: 30px;
|
|
4
|
+
--rp-steps-offset-y: 4px;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
.rp-steps {
|
|
@@ -13,15 +14,14 @@
|
|
|
13
14
|
|
|
14
15
|
.rp-steps h3 {
|
|
15
16
|
counter-increment: step;
|
|
16
|
-
|
|
17
|
-
min-height: 30px;
|
|
17
|
+
min-height: var(--rp-steps-size);
|
|
18
18
|
margin-top: 0;
|
|
19
|
-
display: flex;
|
|
20
19
|
position: relative;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
.rp-steps h3:before {
|
|
24
23
|
content: counter(step);
|
|
24
|
+
top: calc(var(--rp-steps-size)/2 + var(--rp-steps-offset-y));
|
|
25
25
|
left: calc(-1*var(--rp-steps-gap));
|
|
26
26
|
width: var(--rp-steps-size);
|
|
27
27
|
height: var(--rp-steps-size);
|
|
@@ -37,11 +37,13 @@
|
|
|
37
37
|
font-weight: 500;
|
|
38
38
|
display: flex;
|
|
39
39
|
position: absolute;
|
|
40
|
-
transform: translate(-50%);
|
|
40
|
+
transform: translate(-50%, -50%);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.rp-steps h3 .rp-header-anchor {
|
|
44
|
+
top: calc(var(--rp-steps-size)/2 + var(--rp-steps-offset-y));
|
|
44
45
|
left: calc(-1*var(--rp-steps-gap) - var(--rp-steps-size)/2);
|
|
45
46
|
position: absolute;
|
|
47
|
+
transform: translate(0, -50%);
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -32,7 +32,7 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
32
32
|
children,
|
|
33
33
|
values
|
|
34
34
|
]);
|
|
35
|
-
if (
|
|
35
|
+
if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(Fragment, {
|
|
36
36
|
children: tabValues.map(({ label, content })=>/*#__PURE__*/ jsxs(Fragment, {
|
|
37
37
|
children: [
|
|
38
38
|
`\n**${label}**\n\n`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isDataUrl, isExternalUrl } from "@rspress/core/runtime";
|
|
2
|
+
import { isDataUrl, isExternalUrl, normalizeImagePath } from "@rspress/core/runtime";
|
|
3
3
|
import { Badge, IconDeprecated, IconExperimental, SvgWrapper, Tag } from "@rspress/core/theme";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
const BADGE_TAGS = {
|
|
@@ -8,15 +8,19 @@ const BADGE_TAGS = {
|
|
|
8
8
|
warning: 'warning',
|
|
9
9
|
danger: 'danger'
|
|
10
10
|
};
|
|
11
|
+
const IMAGE_EXT_REGEXP = /\.(?:avif|gif|ico|jpe?g|png|svg|webp)(?:[?#].*)?$/i;
|
|
11
12
|
function parseCommonTagsArrayStr(tagStr) {
|
|
12
13
|
const tags = tagStr.split(',').map((tag)=>tag.trim()).filter((tag)=>tag.length > 0);
|
|
13
14
|
return tags;
|
|
14
15
|
}
|
|
16
|
+
function isPublicFolderPath(tag) {
|
|
17
|
+
return tag.startsWith('/');
|
|
18
|
+
}
|
|
15
19
|
const getTagType = (tag)=>{
|
|
16
20
|
const normalizedTag = tag.trim();
|
|
17
21
|
const isSvgTagString = normalizedTag.startsWith('<svg');
|
|
18
|
-
const isPic = isExternalUrl(normalizedTag) || isDataUrl(normalizedTag);
|
|
19
|
-
const tagsArray = parseCommonTagsArrayStr(normalizedTag);
|
|
22
|
+
const isPic = isExternalUrl(normalizedTag) || isDataUrl(normalizedTag) || isPublicFolderPath(normalizedTag) && IMAGE_EXT_REGEXP.test(normalizedTag);
|
|
23
|
+
const tagsArray = isSvgTagString || isPic ? null : parseCommonTagsArrayStr(normalizedTag);
|
|
20
24
|
return {
|
|
21
25
|
isSvgTagString,
|
|
22
26
|
isPic,
|
|
@@ -37,7 +41,7 @@ const Tag_Tag = ({ tag })=>{
|
|
|
37
41
|
});
|
|
38
42
|
if (isSvgTagString) return /*#__PURE__*/ jsx("div", {
|
|
39
43
|
dangerouslySetInnerHTML: {
|
|
40
|
-
__html:
|
|
44
|
+
__html: normalizedTag
|
|
41
45
|
},
|
|
42
46
|
style: {
|
|
43
47
|
width: 20,
|
|
@@ -45,7 +49,7 @@ const Tag_Tag = ({ tag })=>{
|
|
|
45
49
|
}
|
|
46
50
|
});
|
|
47
51
|
if (isPic) return /*#__PURE__*/ jsx("img", {
|
|
48
|
-
src:
|
|
52
|
+
src: normalizeImagePath(normalizedTag)
|
|
49
53
|
});
|
|
50
54
|
if ('experimental' === normalizedTag) return /*#__PURE__*/ jsxs(Badge, {
|
|
51
55
|
type: "warning",
|
|
@@ -14,7 +14,7 @@ function DocLayout(props) {
|
|
|
14
14
|
const isLegacyPlaceholder = 'placeholder' === sidebar;
|
|
15
15
|
const { outline: showOutline = true, footer: showDocFooter = true, pageType } = frontmatter;
|
|
16
16
|
const showSidebarMenu = showSidebar || !isOverviewPage && showOutline;
|
|
17
|
-
if (
|
|
17
|
+
if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(Fragment, {
|
|
18
18
|
children: isOverviewPage ? /*#__PURE__*/ jsx(Overview, {
|
|
19
19
|
content: /*#__PURE__*/ jsx(DocContent, {
|
|
20
20
|
components: components,
|
|
@@ -25,7 +25,7 @@ function DocLayout(props) {
|
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
27
|
const isDocWide = 'doc-wide' === pageType;
|
|
28
|
-
const { isOutlineOpen, isSidebarOpen, sidebarMenu, asideLayoutRef, sidebarLayoutRef } = useSidebarMenu();
|
|
28
|
+
const { isOutlineOpen, isSidebarOpen, sidebarMenu, asideLayoutRef, sidebarLayoutRef } = useSidebarMenu(beforeOutline, afterOutline);
|
|
29
29
|
const { rspressDocRef } = useWatchToc();
|
|
30
30
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
31
31
|
children: [
|
|
@@ -40,7 +40,7 @@ function HomeLayoutMarkdown() {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function HomeLayout(props) {
|
|
43
|
-
if (
|
|
43
|
+
if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(HomeLayoutMarkdown, {});
|
|
44
44
|
const { beforeHero, afterHero, beforeFeatures, afterFeatures, beforeHeroActions, afterHeroActions } = props;
|
|
45
45
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
46
46
|
children: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@mdx-js/mdx": "^3.1.1",
|
|
62
62
|
"@mdx-js/react": "^3.1.1",
|
|
63
|
-
"@rsbuild/core": "^2.0.
|
|
64
|
-
"@rsbuild/plugin-react": "~2.0.
|
|
63
|
+
"@rsbuild/core": "^2.0.9",
|
|
64
|
+
"@rsbuild/plugin-react": "~2.0.1",
|
|
65
65
|
"@shikijs/rehype": "^4.0.2",
|
|
66
66
|
"@types/unist": "^3.0.3",
|
|
67
67
|
"@unhead/react": "^2.1.15",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"react-dom": "^19.2.6",
|
|
80
80
|
"react-lazy-with-preload": "^2.2.1",
|
|
81
81
|
"react-reconciler": "0.33.0",
|
|
82
|
-
"react-render-to-markdown": "19.0
|
|
82
|
+
"react-render-to-markdown": "19.1.0",
|
|
83
83
|
"react-router-dom": "^7.15.1",
|
|
84
84
|
"rehype-external-links": "^3.0.0",
|
|
85
85
|
"rehype-raw": "^7.0.0",
|
|
@@ -95,19 +95,19 @@
|
|
|
95
95
|
"unist-util-remove": "^4.0.0",
|
|
96
96
|
"unist-util-visit": "^5.1.0",
|
|
97
97
|
"unist-util-visit-children": "^3.0.0",
|
|
98
|
-
"@rspress/shared": "2.0.
|
|
98
|
+
"@rspress/shared": "2.0.14"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@microsoft/api-extractor": "^7.57.7",
|
|
102
|
-
"@rsbuild/plugin-sass": "~1.5.
|
|
103
|
-
"@rsbuild/plugin-svgr": "^2.0.
|
|
104
|
-
"@rslib/core": "0.
|
|
102
|
+
"@rsbuild/plugin-sass": "~1.5.3",
|
|
103
|
+
"@rsbuild/plugin-svgr": "^2.0.3",
|
|
104
|
+
"@rslib/core": "0.22.0",
|
|
105
105
|
"@types/body-scroll-lock": "^3.1.2",
|
|
106
106
|
"@types/hast": "^3.0.4",
|
|
107
107
|
"@types/mdast": "^4.0.4",
|
|
108
108
|
"@types/node": "^22.8.1",
|
|
109
109
|
"@types/nprogress": "^0.2.3",
|
|
110
|
-
"@types/react": "^19.2.
|
|
110
|
+
"@types/react": "^19.2.15",
|
|
111
111
|
"@types/react-dom": "^19.2.3",
|
|
112
112
|
"@types/react-reconciler": "^0.33.0",
|
|
113
113
|
"@types/web": "^0.0.349",
|
|
@@ -116,15 +116,14 @@
|
|
|
116
116
|
"execa": "8.0.1",
|
|
117
117
|
"mdast-util-directive": "^3.1.0",
|
|
118
118
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
119
|
-
"memfs": "^4.57.
|
|
119
|
+
"memfs": "^4.57.3",
|
|
120
120
|
"p-map": "^7.0.4",
|
|
121
121
|
"picocolors": "^1.1.1",
|
|
122
|
-
"postcss": "8.5.
|
|
122
|
+
"postcss": "8.5.15",
|
|
123
123
|
"remark-directive": "^4.0.0",
|
|
124
124
|
"rsbuild-plugin-publint": "^0.3.4",
|
|
125
|
-
"rsbuild-plugin-virtual-module": "0.4.
|
|
126
|
-
"
|
|
127
|
-
"tinyglobby": "^0.2.16",
|
|
125
|
+
"rsbuild-plugin-virtual-module": "0.4.3",
|
|
126
|
+
"tinyglobby": "^0.2.17",
|
|
128
127
|
"tinypool": "^1.1.1",
|
|
129
128
|
"ts-json-schema-generator": "^2.9.0",
|
|
130
129
|
"typescript": "^6.0.3",
|
package/dist/9224.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { workerData } from "node:worker_threads";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|