@rspress/core 2.0.6 → 2.0.8
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 +25 -34
- package/dist/{675.js → 7319.js} +17 -0
- package/dist/7397.js +1 -1
- package/dist/8311.js +1 -1
- package/dist/eject-theme/components/Banner/index.tsx +1 -1
- package/dist/eject-theme/components/Button/index.tsx +1 -1
- package/dist/eject-theme/components/CodeBlock/index.scss +58 -1
- package/dist/eject-theme/components/CodeBlock/index.tsx +85 -7
- package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +12 -2
- package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -1
- package/dist/eject-theme/components/CodeButtonGroup/index.tsx +15 -15
- package/dist/eject-theme/components/DocContent/docComponents/a.tsx +1 -1
- package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +5 -1
- package/dist/eject-theme/components/DocContent/docComponents/title.tsx +6 -1
- package/dist/eject-theme/components/DocContent/index.tsx +1 -1
- package/dist/eject-theme/components/DocFooter/index.tsx +1 -1
- package/dist/eject-theme/components/EditLink/index.tsx +1 -1
- package/dist/eject-theme/components/FallbackHeading/index.tsx +4 -1
- package/dist/eject-theme/components/HomeFeature/index.tsx +5 -1
- package/dist/eject-theme/components/HomeFooter/index.tsx +1 -1
- package/dist/eject-theme/components/HomeHero/index.tsx +1 -1
- package/dist/eject-theme/components/HoverGroup/index.tsx +4 -1
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +1 -1
- package/dist/eject-theme/components/Llms/LlmsCopyButton.tsx +1 -1
- package/dist/eject-theme/components/Llms/LlmsCopyRow.tsx +1 -1
- package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +1 -1
- package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +1 -1
- package/dist/eject-theme/components/Nav/NavMenu.tsx +9 -2
- package/dist/eject-theme/components/Nav/index.tsx +1 -1
- package/dist/eject-theme/components/NavHamburger/index.tsx +6 -1
- package/dist/eject-theme/components/NavScreen/NavScreenAppearance.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +5 -1
- package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/index.tsx +1 -1
- package/dist/eject-theme/components/NavTitle/index.tsx +1 -1
- package/dist/eject-theme/components/Outline/ScrollToTop.tsx +5 -1
- package/dist/eject-theme/components/Outline/index.tsx +1 -1
- package/dist/eject-theme/components/Overview/index.tsx +1 -1
- package/dist/eject-theme/components/OverviewGroup/index.tsx +2 -2
- package/dist/eject-theme/components/PackageManagerTabs/index.tsx +1 -1
- package/dist/eject-theme/components/PrevNextPage/index.tsx +1 -1
- package/dist/eject-theme/components/Root/index.tsx +1 -1
- package/dist/eject-theme/components/Search/NoSearchResult.tsx +1 -1
- package/dist/eject-theme/components/Search/SearchButton.tsx +1 -1
- package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -1
- package/dist/eject-theme/components/Search/SuggestItem.tsx +1 -1
- package/dist/eject-theme/components/Search/index.tsx +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +5 -1
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.tsx +1 -1
- package/dist/eject-theme/components/SidebarMenu/index.tsx +1 -1
- package/dist/eject-theme/components/SocialLinks/index.tsx +1 -1
- package/dist/eject-theme/components/SourceCode/index.tsx +1 -1
- package/dist/eject-theme/components/SvgWrapper/index.tsx +1 -1
- package/dist/eject-theme/components/SwitchAppearance/index.tsx +1 -1
- package/dist/eject-theme/components/Tabs/index.tsx +1 -1
- package/dist/eject-theme/components/Tag/index.tsx +1 -1
- package/dist/eject-theme/components/Toc/TocItem.tsx +5 -1
- package/dist/eject-theme/components/Toc/index.tsx +1 -1
- package/dist/node/PluginDriver.js +2 -2
- package/dist/node/auto-nav-sidebar/index.js +2 -2
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +1 -1
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/eject.js +3 -1
- package/dist/node/initRsbuild.js +1 -1
- package/dist/node/mdx/options.js +2 -2
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +2 -1
- package/dist/node/mdx/rehypePlugins/shiki.d.ts +4 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +5 -2
- package/dist/node/mdx/rehypePlugins/transformers/add-fold.d.ts +12 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-fold.js +55 -0
- package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +1 -0
- package/dist/node/mdx/rehypePlugins/transformers/index.js +6 -5
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +7 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +3 -2
- package/dist/node/route/normalizeRoutePath.js +1 -1
- 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 +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/renderPages.js +1 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +20 -7
- 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 +3 -2
- package/dist/node/ssg-md/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +1 -1
- 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/flattenMdxContent.js +3 -2
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +2 -1
- package/dist/node/utils/reactAlias.js +1 -1
- package/dist/runtime/hooks/useWindowSize.test.js +10 -10
- package/dist/shiki-transformers.js +1 -0
- package/dist/theme/components/Banner/index.js +1 -1
- package/dist/theme/components/Button/index.js +1 -1
- package/dist/theme/components/CodeBlock/index.css +53 -1
- package/dist/theme/components/CodeBlock/index.d.ts +8 -3
- package/dist/theme/components/CodeBlock/index.js +56 -6
- package/dist/theme/components/CodeBlockRuntime/index.d.ts +2 -2
- package/dist/theme/components/CodeBlockRuntime/index.js +10 -2
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.css +2 -2
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +1 -1
- package/dist/theme/components/CodeButtonGroup/index.css +2 -2
- package/dist/theme/components/CodeButtonGroup/index.d.ts +6 -6
- package/dist/theme/components/CodeButtonGroup/index.js +10 -10
- package/dist/theme/components/DocContent/docComponents/a.js +1 -1
- package/dist/theme/components/DocContent/docComponents/pre.d.ts +2 -2
- package/dist/theme/components/DocContent/docComponents/pre.js +4 -2
- package/dist/theme/components/DocContent/docComponents/title.js +1 -1
- package/dist/theme/components/DocContent/index.js +1 -1
- package/dist/theme/components/DocFooter/index.js +1 -1
- package/dist/theme/components/EditLink/index.js +1 -1
- package/dist/theme/components/FallbackHeading/index.js +1 -1
- package/dist/theme/components/HomeFeature/index.js +1 -1
- package/dist/theme/components/HomeFooter/index.js +1 -1
- package/dist/theme/components/HomeHero/index.js +1 -1
- package/dist/theme/components/HoverGroup/index.js +4 -1
- package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
- package/dist/theme/components/Llms/LlmsCopyButton.css +4 -4
- package/dist/theme/components/Llms/LlmsCopyButton.js +1 -1
- package/dist/theme/components/Llms/LlmsCopyRow.js +1 -1
- package/dist/theme/components/Llms/LlmsOpenRow.js +1 -1
- package/dist/theme/components/Llms/LlmsViewOptions.css +2 -2
- package/dist/theme/components/Llms/LlmsViewOptions.js +1 -1
- package/dist/theme/components/Nav/NavMenu.d.ts +1 -1
- package/dist/theme/components/Nav/NavMenu.js +2 -1
- package/dist/theme/components/Nav/index.js +1 -1
- package/dist/theme/components/NavHamburger/index.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenAppearance.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenLangs.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +2 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +4 -2
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenVersions.js +1 -1
- package/dist/theme/components/NavScreen/index.js +1 -1
- package/dist/theme/components/NavTitle/index.js +1 -1
- package/dist/theme/components/Outline/ScrollToTop.js +1 -1
- package/dist/theme/components/Outline/index.js +1 -1
- package/dist/theme/components/Overview/index.d.ts +1 -1
- 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/PrevNextPage/index.js +1 -1
- package/dist/theme/components/Root/index.d.ts +1 -1
- package/dist/theme/components/Search/NoSearchResult.js +1 -1
- package/dist/theme/components/Search/SearchButton.js +1 -1
- package/dist/theme/components/Search/SearchPanel.js +1 -1
- package/dist/theme/components/Search/SuggestItem.js +1 -1
- package/dist/theme/components/Search/index.js +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.js +1 -1
- package/dist/theme/components/Sidebar/SidebarItem.js +1 -1
- package/dist/theme/components/Sidebar/SidebarSectionHeader.js +1 -1
- package/dist/theme/components/SidebarMenu/index.js +1 -1
- package/dist/theme/components/SocialLinks/index.js +1 -1
- package/dist/theme/components/SourceCode/index.js +1 -1
- package/dist/theme/components/SvgWrapper/index.js +1 -1
- package/dist/theme/components/SwitchAppearance/index.js +1 -1
- package/dist/theme/components/Tabs/index.js +1 -1
- package/dist/theme/components/Tag/index.js +1 -1
- package/dist/theme/components/Toc/TocItem.js +1 -1
- package/dist/theme/components/Toc/index.js +1 -1
- package/dist/theme/layout/DocLayout/index.js +1 -1
- package/dist/theme/layout/HomeLayout/index.js +1 -1
- package/dist/theme/layout/Layout/index.d.ts +2 -2
- package/dist/theme/layout/Layout/index.js +2 -2
- package/dist/theme/layout/NotFountLayout/index.js +1 -1
- package/dist/theme/styles/base.css +1 -1
- package/nav-json-schema.json +3 -0
- package/package.json +12 -12
- /package/dist/{rslib-runtime.js → 0~rslib-runtime.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useI18n, useSite } from '@rspress/core/runtime';
|
|
2
|
-
import { IconExternalLink, SvgWrapper } from '@theme';
|
|
2
|
+
import { IconExternalLink, SvgWrapper } from '@rspress/core/theme';
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import './LlmsOpenRow.scss';
|
|
5
5
|
import './LlmsViewOptions.scss';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
import { useI18n, useSite } from '@rspress/core/runtime';
|
|
7
|
-
import { IconDown, IconExternalLink, IconLink } from '@theme';
|
|
7
|
+
import { IconDown, IconExternalLink, IconLink } from '@rspress/core/theme';
|
|
8
8
|
import type React from 'react';
|
|
9
9
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
10
|
import { SvgWrapper } from '../SvgWrapper';
|
|
@@ -5,8 +5,14 @@ import type {
|
|
|
5
5
|
NavItemWithLinkAndChildren,
|
|
6
6
|
} from '@rspress/core';
|
|
7
7
|
import { matchNavbar, useLocation } from '@rspress/core/runtime';
|
|
8
|
-
import type { HoverGroupProps } from '@theme';
|
|
9
|
-
import {
|
|
8
|
+
import type { HoverGroupProps } from '@rspress/core/theme';
|
|
9
|
+
import {
|
|
10
|
+
IconArrowDown,
|
|
11
|
+
Link,
|
|
12
|
+
SvgWrapper,
|
|
13
|
+
Tag,
|
|
14
|
+
useHoverGroup,
|
|
15
|
+
} from '@rspress/core/theme';
|
|
10
16
|
import cls from 'clsx';
|
|
11
17
|
import { type ReactNode, useMemo } from 'react';
|
|
12
18
|
import { useLangsMenu, useVersionsMenu } from './hooks';
|
|
@@ -29,6 +35,7 @@ export function NavMenuItemInner({
|
|
|
29
35
|
{'link' in menuItem && typeof menuItem.link === 'string' ? (
|
|
30
36
|
<Link
|
|
31
37
|
href={menuItem.link}
|
|
38
|
+
download={menuItem.download}
|
|
32
39
|
className="rp-nav-menu__item__container"
|
|
33
40
|
hrefLang={menuItem.lang}
|
|
34
41
|
lang={menuItem.lang}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IconSmallMenu,
|
|
3
|
+
SocialLinks,
|
|
4
|
+
SvgWrapper,
|
|
5
|
+
useHoverGroup,
|
|
6
|
+
} from '@rspress/core/theme';
|
|
2
7
|
import clsx from 'clsx';
|
|
3
8
|
import { createPortal } from 'react-dom';
|
|
4
9
|
import { NavVersions } from '../Nav/NavMenu';
|
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import { useLangsMenu } from '../Nav/hooks';
|
|
3
3
|
import './NavScreenLangs.scss';
|
|
4
4
|
import { useI18n } from '@rspress/core/runtime';
|
|
5
|
-
import { Link } from '@theme';
|
|
5
|
+
import { Link } from '@rspress/core/theme';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { SvgDown } from './NavScreenMenuItem';
|
|
8
8
|
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
NavItemWithLinkAndChildren,
|
|
6
6
|
} from '@rspress/core';
|
|
7
7
|
import { matchNavbar, useLocation } from '@rspress/core/runtime';
|
|
8
|
-
import { IconArrowDown, Link, SvgWrapper, Tag } from '@theme';
|
|
8
|
+
import { IconArrowDown, Link, SvgWrapper, Tag } from '@rspress/core/theme';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import type React from 'react';
|
|
11
11
|
import { useMemo, useState } from 'react';
|
|
@@ -26,6 +26,7 @@ export function NavScreenMenuItemRaw({
|
|
|
26
26
|
isActive,
|
|
27
27
|
onClick,
|
|
28
28
|
href,
|
|
29
|
+
download,
|
|
29
30
|
}: {
|
|
30
31
|
left: React.ReactNode;
|
|
31
32
|
right: React.ReactNode;
|
|
@@ -33,6 +34,7 @@ export function NavScreenMenuItemRaw({
|
|
|
33
34
|
isActive?: boolean;
|
|
34
35
|
onClick?: () => void;
|
|
35
36
|
href?: string;
|
|
37
|
+
download?: boolean;
|
|
36
38
|
}) {
|
|
37
39
|
if (href) {
|
|
38
40
|
return (
|
|
@@ -44,6 +46,7 @@ export function NavScreenMenuItemRaw({
|
|
|
44
46
|
isActive && 'rp-nav-screen-menu-item--active',
|
|
45
47
|
)}
|
|
46
48
|
onClick={onClick}
|
|
49
|
+
download={download}
|
|
47
50
|
>
|
|
48
51
|
<div className="rp-nav-screen-menu-item__left">{left}</div>
|
|
49
52
|
<div className="rp-nav-screen-menu-item__right">{right}</div>
|
|
@@ -84,6 +87,7 @@ export function NavScreenMenuItemWithLink({
|
|
|
84
87
|
}
|
|
85
88
|
right={null}
|
|
86
89
|
href={menuItem.link}
|
|
90
|
+
download={menuItem.download}
|
|
87
91
|
isActive={isActive}
|
|
88
92
|
/>
|
|
89
93
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NoSSR, useSite } from '@rspress/core/runtime';
|
|
2
|
-
import { SocialLinks, SwitchAppearance } from '@theme';
|
|
2
|
+
import { SocialLinks, SwitchAppearance } from '@rspress/core/theme';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
import { NavScreenLangs } from './NavScreenLangs';
|
|
5
5
|
import { NavScreenVersions } from './NavScreenVersions';
|
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import { useVersionsMenu } from '../Nav/hooks';
|
|
3
3
|
import './NavScreenVersions.scss';
|
|
4
4
|
import { useI18n } from '@rspress/core/runtime';
|
|
5
|
-
import { Link } from '@theme';
|
|
5
|
+
import { Link } from '@rspress/core/theme';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { SvgDown } from './NavScreenMenuItem';
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useNav } from '@rspress/core/runtime';
|
|
2
|
-
import { SocialLinks } from '@theme';
|
|
2
|
+
import { SocialLinks } from '@rspress/core/theme';
|
|
3
3
|
import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useI18n } from '@rspress/core/runtime';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
IconScrollToTop,
|
|
4
|
+
SvgWrapper,
|
|
5
|
+
useReadPercent,
|
|
6
|
+
} from '@rspress/core/theme';
|
|
3
7
|
|
|
4
8
|
export function ScrollToTop() {
|
|
5
9
|
const scrollToTop = () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Link, renderInlineMarkdown } from '@theme';
|
|
1
|
+
import { Link, renderInlineMarkdown } from '@rspress/core/theme';
|
|
2
2
|
import './index.scss';
|
|
3
3
|
import type { Header } from '@rspress/core';
|
|
4
4
|
import { routePathToMdPath } from '@rspress/core/runtime';
|
|
5
|
-
import { FallbackHeading, SvgWrapper } from '@theme';
|
|
5
|
+
import { FallbackHeading, SvgWrapper } from '@rspress/core/theme';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
import IconPlugin from './icons/plugin.svg';
|
|
8
8
|
|
|
@@ -5,7 +5,11 @@ import type {
|
|
|
5
5
|
SidebarSectionHeader as SidebarSectionHeaderType,
|
|
6
6
|
} from '@rspress/core';
|
|
7
7
|
import { useActiveMatcher } from '@rspress/core/runtime';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
IconArrowRight,
|
|
10
|
+
SvgWrapper,
|
|
11
|
+
useLinkNavigate,
|
|
12
|
+
} from '@rspress/core/theme';
|
|
9
13
|
import clsx from 'clsx';
|
|
10
14
|
import type React from 'react';
|
|
11
15
|
import { SidebarDivider } from './SidebarDivider';
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
SidebarItem as SidebarItemType,
|
|
4
4
|
} from '@rspress/core';
|
|
5
5
|
import { useActiveMatcher } from '@rspress/core/runtime';
|
|
6
|
-
import { Link, renderInlineMarkdown, Tag } from '@theme';
|
|
6
|
+
import { Link, renderInlineMarkdown, Tag } from '@rspress/core/theme';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import type React from 'react';
|
|
9
9
|
import { useEffect, useRef, useTransition } from 'react';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SocialLink } from '@rspress/core';
|
|
2
2
|
import { useSite } from '@rspress/core/runtime';
|
|
3
|
-
import { IconArrowDown, SvgWrapper } from '@theme';
|
|
3
|
+
import { IconArrowDown, SvgWrapper } from '@rspress/core/theme';
|
|
4
4
|
import './index.scss';
|
|
5
5
|
import { useHoverGroup } from '../HoverGroup/useHoverGroup';
|
|
6
6
|
import { SocialLink as SocialLinkComp } from './SocialLink';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ThemeContext, useSite } from '@rspress/core/runtime';
|
|
2
|
-
import { IconMoon, IconSun, SvgWrapper } from '@theme';
|
|
2
|
+
import { IconMoon, IconSun, SvgWrapper } from '@rspress/core/theme';
|
|
3
3
|
import { type MouseEvent, useContext } from 'react';
|
|
4
4
|
import './global.scss';
|
|
5
5
|
import './index.scss';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Header } from '@rspress/core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Link,
|
|
4
|
+
parseInlineMarkdownText,
|
|
5
|
+
renderInlineMarkdown,
|
|
6
|
+
} from '@rspress/core/theme';
|
|
3
7
|
import clsx from 'clsx';
|
|
4
8
|
import './TocItem.scss';
|
|
5
9
|
import { useEffect, useRef } from 'react';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, addLeadingSlash } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, addLeadingSlash } from "../7319.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
|
-
import { auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
|
|
3
|
+
import { haveNavSidebarConfig as auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
|
|
4
4
|
class PluginDriver {
|
|
5
5
|
#config;
|
|
6
6
|
#configFilePath;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../
|
|
1
|
+
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../7319.js";
|
|
2
2
|
import { processLocales, combineWalkResult } from "./locales.js";
|
|
3
3
|
import { walk } from "./walk.js";
|
|
4
4
|
async function runAutoNavSide(config, metaFileSet, mdFileSet) {
|
|
@@ -40,4 +40,4 @@ async function modifyConfigWithAutoNavSide(config, metaFileSet = new Set(), mdFi
|
|
|
40
40
|
config.themeConfig.nav = autoNavSide.nav;
|
|
41
41
|
config.themeConfig.sidebar = autoNavSide.sidebar;
|
|
42
42
|
}
|
|
43
|
-
export { auto_nav_sidebar_haveNavSidebarConfig, modifyConfigWithAutoNavSide };
|
|
43
|
+
export { auto_nav_sidebar_haveNavSidebarConfig as haveNavSidebarConfig, modifyConfigWithAutoNavSide };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extname, stat as promises_stat, logger, picocolors, readdir, isExternalUrl, relative, slash, join } from "../../
|
|
1
|
+
import { extname, stat as promises_stat, logger, picocolors, readdir, isExternalUrl, relative, slash, join } from "../../7319.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
3
|
import { PUBLIC_DIR } from "../constants.js";
|
|
4
4
|
import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, node_path, promises } from "../../
|
|
1
|
+
import { isExternalUrl, node_path, promises } from "../../7319.js";
|
|
2
2
|
import { pathExists } from "../utils/fs.js";
|
|
3
3
|
import { readJson } from "./utils.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
package/dist/node/eject.js
CHANGED
|
@@ -106,4 +106,6 @@ async function listComponents() {
|
|
|
106
106
|
});
|
|
107
107
|
logger.info(`💡 Usage: ${picocolors.dim('rspress eject <ComponentName>')}\n`);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
var eject__setThemeComponentsPathForTesting = void 0;
|
|
110
|
+
var eject_getAvailableComponents = void 0;
|
|
111
|
+
export { ejectComponent, eject__setThemeComponentsPathForTesting as __setThemeComponentsPathForTesting, eject_getAvailableComponents as getAvailableComponents, listComponents };
|
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, fileURLToPath, cwd, PLUGIN_REACT_NAME, removeTrailingSlash, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, fileURLToPath, cwd, PLUGIN_REACT_NAME, removeTrailingSlash, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../7319.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
3
|
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";
|
|
4
4
|
import { hintBuilderPluginsBreakingChange, hintThemeBreakingChange } from "./logger/hint.js";
|
package/dist/node/mdx/options.js
CHANGED
|
@@ -13,7 +13,7 @@ async function createMDXOptions(options) {
|
|
|
13
13
|
const { docDirectory, config, routeService, filepath, pluginDriver, addDependency, isSsgMd = false } = options;
|
|
14
14
|
const remarkLinkOptions = config?.markdown?.link;
|
|
15
15
|
const format = node_path.extname(filepath).slice(1);
|
|
16
|
-
const { remarkPlugins: remarkPluginsFromConfig = [], rehypePlugins: rehypePluginsFromConfig = [], globalComponents: globalComponentsFromConfig = [], showLineNumbers = false, defaultWrapCode = false, shiki, cjkFriendlyEmphasis = true } = config?.markdown || {};
|
|
16
|
+
const { remarkPlugins: remarkPluginsFromConfig = [], rehypePlugins: rehypePluginsFromConfig = [], globalComponents: globalComponentsFromConfig = [], showLineNumbers = false, defaultWrapCode = false, defaultCodeOverflow, shiki, cjkFriendlyEmphasis = true } = config?.markdown || {};
|
|
17
17
|
const rspressPlugins = pluginDriver?.getPlugins() ?? [];
|
|
18
18
|
const remarkPluginsFromPlugins = rspressPlugins.flatMap((plugin)=>plugin.markdown?.remarkPlugins || []);
|
|
19
19
|
const rehypePluginsFromPlugins = rspressPlugins.flatMap((plugin)=>plugin.markdown?.rehypePlugins || []);
|
|
@@ -85,7 +85,7 @@ async function createMDXOptions(options) {
|
|
|
85
85
|
] : [],
|
|
86
86
|
[
|
|
87
87
|
rehype,
|
|
88
|
-
createRehypeShikiOptions(showLineNumbers, defaultWrapCode, shiki)
|
|
88
|
+
createRehypeShikiOptions(showLineNumbers, defaultWrapCode, defaultCodeOverflow, shiki)
|
|
89
89
|
],
|
|
90
90
|
[
|
|
91
91
|
rehype_external_links,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { RehypeShikiOptions } from '@shikijs/rehype';
|
|
2
2
|
import rehypeShiki from '@shikijs/rehype';
|
|
3
|
-
declare function createRehypeShikiOptions(showLineNumbers: boolean, defaultWrapCode: boolean,
|
|
3
|
+
declare function createRehypeShikiOptions(showLineNumbers: boolean, defaultWrapCode: boolean, defaultCodeOverflow?: {
|
|
4
|
+
height?: number;
|
|
5
|
+
behavior?: 'fold' | 'scroll';
|
|
6
|
+
}, options?: Partial<RehypeShikiOptions>): RehypeShikiOptions;
|
|
4
7
|
export { createRehypeShikiOptions, rehypeShiki };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, createCssVariablesTheme, transformerAddWrapCode } from "../../../7397.js";
|
|
1
|
+
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../7397.js";
|
|
2
2
|
const cssVariablesTheme = createCssVariablesTheme({
|
|
3
3
|
name: 'css-variables',
|
|
4
4
|
variablePrefix: '--shiki-',
|
|
5
5
|
variableDefaults: {},
|
|
6
6
|
fontStyle: true
|
|
7
7
|
});
|
|
8
|
-
function createRehypeShikiOptions(showLineNumbers, defaultWrapCode, options) {
|
|
8
|
+
function createRehypeShikiOptions(showLineNumbers, defaultWrapCode, defaultCodeOverflow, options) {
|
|
9
9
|
const { transformers = [], ...restOptions } = options || {};
|
|
10
10
|
const newTransformers = [
|
|
11
11
|
transformerAddTitle(),
|
|
@@ -16,6 +16,9 @@ function createRehypeShikiOptions(showLineNumbers, defaultWrapCode, options) {
|
|
|
16
16
|
transformerAddWrapCode({
|
|
17
17
|
defaultWrapCode
|
|
18
18
|
}),
|
|
19
|
+
transformerAddFold({
|
|
20
|
+
defaultCodeOverflow
|
|
21
|
+
}),
|
|
19
22
|
...transformers
|
|
20
23
|
];
|
|
21
24
|
return {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ShikiTransformer } from 'shiki';
|
|
2
|
+
export declare const SHIKI_TRANSFORMER_ADD_FOLD = "shiki-transformer:add-fold";
|
|
3
|
+
export interface ITransformerAddFoldOptions {
|
|
4
|
+
defaultCodeOverflow?: {
|
|
5
|
+
height?: number;
|
|
6
|
+
behavior?: 'fold' | 'scroll';
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @private compile-time only
|
|
11
|
+
*/
|
|
12
|
+
export declare function transformerAddFold(options?: ITransformerAddFoldOptions): ShikiTransformer;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const SHIKI_TRANSFORMER_ADD_FOLD = 'shiki-transformer:add-fold';
|
|
2
|
+
const DEFAULT_FOLD_HEIGHT = 300;
|
|
3
|
+
function hasFoldInMeta(meta) {
|
|
4
|
+
if (!meta) return;
|
|
5
|
+
const kvList = meta.split(' ').filter(Boolean);
|
|
6
|
+
if (kvList.includes('fold=false')) return false;
|
|
7
|
+
if (kvList.includes('fold') || kvList.includes('fold=true')) return true;
|
|
8
|
+
}
|
|
9
|
+
function parseHeightFromMeta(meta) {
|
|
10
|
+
if (!meta) return;
|
|
11
|
+
const kvList = meta.split(' ').filter(Boolean);
|
|
12
|
+
for (const item of kvList){
|
|
13
|
+
const [k, v = ''] = item.split('=').filter(Boolean);
|
|
14
|
+
if ('height' === k && v.length > 0) {
|
|
15
|
+
const num = Number(v.replace(/["'`]/g, ''));
|
|
16
|
+
if (!Number.isNaN(num) && num > 0) return num;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function transformerAddFold(options = {}) {
|
|
21
|
+
const { defaultCodeOverflow } = options;
|
|
22
|
+
return {
|
|
23
|
+
name: SHIKI_TRANSFORMER_ADD_FOLD,
|
|
24
|
+
pre (pre) {
|
|
25
|
+
const meta = this.options.meta?.__raw;
|
|
26
|
+
const metaFold = hasFoldInMeta(meta);
|
|
27
|
+
const metaHeight = parseHeightFromMeta(meta);
|
|
28
|
+
const hasExplicitMeta = void 0 !== metaFold || void 0 !== metaHeight;
|
|
29
|
+
if (hasExplicitMeta) {
|
|
30
|
+
if (metaFold) pre.properties = {
|
|
31
|
+
...pre.properties,
|
|
32
|
+
fold: true,
|
|
33
|
+
height: metaHeight ?? DEFAULT_FOLD_HEIGHT
|
|
34
|
+
};
|
|
35
|
+
else if (void 0 !== metaHeight) pre.properties = {
|
|
36
|
+
...pre.properties,
|
|
37
|
+
height: metaHeight
|
|
38
|
+
};
|
|
39
|
+
} else if (defaultCodeOverflow?.height !== void 0) {
|
|
40
|
+
const behavior = defaultCodeOverflow.behavior ?? 'scroll';
|
|
41
|
+
if ('fold' === behavior) pre.properties = {
|
|
42
|
+
...pre.properties,
|
|
43
|
+
fold: true,
|
|
44
|
+
height: defaultCodeOverflow.height
|
|
45
|
+
};
|
|
46
|
+
else pre.properties = {
|
|
47
|
+
...pre.properties,
|
|
48
|
+
height: defaultCodeOverflow.height
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return pre;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export { SHIKI_TRANSFORMER_ADD_FOLD, transformerAddFold };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { SHIKI_TRANSFORMER_ADD_FOLD, transformerAddFold, } from './add-fold.js';
|
|
1
2
|
export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from './add-lang.js';
|
|
2
3
|
export { SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, transformerAddLineNumbers, } from './add-line-numbers.js';
|
|
3
4
|
export { SHIKI_TRANSFORMER_ADD_TITLE, transformerAddTitle } from './add-title.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export { SHIKI_TRANSFORMER_ADD_FOLD, transformerAddFold } from "./add-fold.js";
|
|
2
|
+
export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./add-lang.js";
|
|
3
|
+
export { SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, transformerAddLineNumbers } from "./add-line-numbers.js";
|
|
4
|
+
export { SHIKI_TRANSFORMER_ADD_TITLE, transformerAddTitle } from "./add-title.js";
|
|
5
|
+
export { SHIKI_TRANSFORMER_ADD_WRAP_CODE, transformerAddWrapCode } from "./add-wrap-code.js";
|
|
6
|
+
export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./meta-highlight.js";
|
|
@@ -187,4 +187,10 @@ const remarkContainerSyntax = ()=>{
|
|
|
187
187
|
tree.children.unshift(getNamedImportAstNode('Callout', CALLOUT_COMPONENT, '@theme'));
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
var containerSyntax_DIRECTIVE_TYPES = void 0;
|
|
191
|
+
var containerSyntax_REGEX_BEGIN = void 0;
|
|
192
|
+
var containerSyntax_REGEX_END = void 0;
|
|
193
|
+
var containerSyntax_REGEX_GH_BEGIN = void 0;
|
|
194
|
+
var containerSyntax_TITLE_REGEX_IN_MD = void 0;
|
|
195
|
+
var containerSyntax_TITLE_REGEX_IN_MDX = void 0;
|
|
196
|
+
export { containerSyntax_DIRECTIVE_TYPES as DIRECTIVE_TYPES, containerSyntax_REGEX_BEGIN as REGEX_BEGIN, containerSyntax_REGEX_END as REGEX_END, containerSyntax_REGEX_GH_BEGIN as REGEX_GH_BEGIN, containerSyntax_TITLE_REGEX_IN_MD as TITLE_REGEX_IN_MD, containerSyntax_TITLE_REGEX_IN_MDX as TITLE_REGEX_IN_MDX, remarkContainerSyntax };
|