@rspress/core 2.0.11 → 2.0.13
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/{8857.js → 5580.js} +2 -2
- package/dist/{1688.js → 7275.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/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/useLinkNavigate.ts +2 -2
- 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 +17 -18
- package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -6
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -1
- 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 +49 -42
- 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.d.ts +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 +5 -8
- 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/rehypePlugins/transformers/add-title.js +3 -6
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/containerSyntax.d.ts +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +2 -2
- package/dist/node/mdx/remarkPlugins/image.d.ts +1 -1
- package/dist/node/mdx/remarkPlugins/image.js +4 -4
- package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
- 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 +147 -140
- 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.d.ts +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 +2 -2
- package/dist/node/ssg/renderPageWorker.js +2 -2
- package/dist/node/ssg/renderPages.js +3 -3
- 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 +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/CodeBlock/index.js +1 -1
- package/dist/theme/components/CodeButtonGroup/index.js +4 -2
- package/dist/theme/components/DocContent/docComponents/a.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/hr.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/img.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/index.d.ts +18 -18
- package/dist/theme/components/DocContent/docComponents/list.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/paragraph.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/table.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/title.d.ts +6 -6
- package/dist/theme/components/FallbackHeading/index.js +1 -1
- package/dist/theme/components/Link/useLinkNavigate.js +2 -2
- package/dist/theme/components/Nav/hooks.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 +18 -18
- package/dist/theme/components/Search/SearchPanel.js +1 -2
- package/dist/theme/components/Sidebar/SidebarItem.js +1 -0
- package/dist/theme/components/Steps/index.css +6 -4
- package/dist/theme/components/Tabs/index.d.ts +8 -4
- package/dist/theme/components/Tabs/index.js +20 -20
- package/dist/theme/layout/DocLayout/index.js +1 -1
- package/dist/theme/layout/HomeLayout/index.js +1 -1
- package/dist/theme/layout/Layout/index.js +1 -1
- package/package.json +9 -9
- package/dist/runtime/BrowserOnly.test.d.ts +0 -1
- /package/dist/{0~1402.js → 0~8787.js} +0 -0
- /package/dist/{5810.js → 2633.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/{9224.js → 559.js} +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
|
@@ -13,17 +13,25 @@ import {
|
|
|
13
13
|
import './index.scss';
|
|
14
14
|
|
|
15
15
|
type TabItem = {
|
|
16
|
-
label
|
|
16
|
+
label: ReactNode;
|
|
17
|
+
value: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type ResolvedTabItem = {
|
|
22
|
+
label?: ReactNode;
|
|
23
|
+
value?: string;
|
|
17
24
|
disabled?: boolean;
|
|
18
25
|
content?: ReactNode;
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
export interface TabsProps {
|
|
22
|
-
values?:
|
|
29
|
+
values?: ReadonlyArray<TabItem>;
|
|
23
30
|
/**
|
|
24
31
|
* @default 0
|
|
25
32
|
*/
|
|
26
33
|
defaultIndex?: number;
|
|
34
|
+
defaultValue?: string;
|
|
27
35
|
onChange?: (index: number) => void;
|
|
28
36
|
children: ReactNode;
|
|
29
37
|
/**
|
|
@@ -45,56 +53,41 @@ export interface TabsProps {
|
|
|
45
53
|
|
|
46
54
|
function getTabValuesFromChildren(
|
|
47
55
|
children: ReactElement<TabProps>[],
|
|
48
|
-
|
|
49
|
-
):
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// 1. values only contain label
|
|
57
|
-
// <Tabs values={['Tab1', 'Tab2']}><Tab label="Tab1"/></Tab><Tab label="Tab2"/></Tab></Tabs>
|
|
58
|
-
if (defaultValues && defaultValues.length > 0) {
|
|
59
|
-
return defaultValues.map((item, index) => {
|
|
60
|
-
if (isTabItem(item)) {
|
|
61
|
-
return item;
|
|
62
|
-
}
|
|
56
|
+
values: ReadonlyArray<TabItem> | undefined,
|
|
57
|
+
): ResolvedTabItem[] {
|
|
58
|
+
if (values && values.length > 0) {
|
|
59
|
+
return values.map((item, index) => {
|
|
60
|
+
const content =
|
|
61
|
+
children.find(child => child.props?.value === item.value) ??
|
|
62
|
+
children[index];
|
|
63
63
|
|
|
64
64
|
return {
|
|
65
|
-
|
|
66
|
-
content
|
|
67
|
-
} satisfies
|
|
65
|
+
...item,
|
|
66
|
+
content,
|
|
67
|
+
} satisfies ResolvedTabItem;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
// <Tabs><Tab label="Tab1"/></Tab><Tab label="Tab2"/></Tab></Tabs>
|
|
73
|
-
return Children.map<TabItem, ReactElement<TabProps>>(
|
|
71
|
+
return Children.map<ResolvedTabItem, ReactElement<TabProps>>(
|
|
74
72
|
children,
|
|
75
73
|
(child, index) => {
|
|
76
74
|
if (isValidElement(child)) {
|
|
77
75
|
return {
|
|
78
76
|
label: child.props?.label || undefined,
|
|
77
|
+
value: child.props?.value,
|
|
78
|
+
disabled: child.props?.disabled,
|
|
79
79
|
content: children[index],
|
|
80
|
-
} satisfies
|
|
80
|
+
} satisfies ResolvedTabItem;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return {
|
|
84
84
|
label: index,
|
|
85
85
|
content: children[index],
|
|
86
|
-
} satisfies
|
|
86
|
+
} satisfies ResolvedTabItem;
|
|
87
87
|
},
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function isTabItem(item: unknown): item is TabItem {
|
|
92
|
-
if (item && typeof item === 'object' && 'label' in item) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
91
|
const groupIdPrefix = 'rspress.tabs.';
|
|
99
92
|
|
|
100
93
|
export const Tabs = forwardRef(
|
|
@@ -102,6 +95,7 @@ export const Tabs = forwardRef(
|
|
|
102
95
|
const {
|
|
103
96
|
values,
|
|
104
97
|
defaultIndex,
|
|
98
|
+
defaultValue,
|
|
105
99
|
onChange,
|
|
106
100
|
children: rawChildren,
|
|
107
101
|
groupId,
|
|
@@ -118,11 +112,11 @@ export const Tabs = forwardRef(
|
|
|
118
112
|
isValidElement(child),
|
|
119
113
|
) as unknown as ReactElement<TabProps>[];
|
|
120
114
|
|
|
121
|
-
const tabValues:
|
|
115
|
+
const tabValues: ResolvedTabItem[] = useMemo(() => {
|
|
122
116
|
return getTabValuesFromChildren(children, values);
|
|
123
|
-
}, [
|
|
117
|
+
}, [children, values]);
|
|
124
118
|
|
|
125
|
-
if (
|
|
119
|
+
if (import.meta.env.SSG_MD) {
|
|
126
120
|
return (
|
|
127
121
|
<>
|
|
128
122
|
{tabValues.map(({ label, content }) => {
|
|
@@ -138,11 +132,18 @@ export const Tabs = forwardRef(
|
|
|
138
132
|
);
|
|
139
133
|
}
|
|
140
134
|
|
|
141
|
-
const
|
|
135
|
+
const defaultValueIndex =
|
|
136
|
+
defaultValue !== undefined
|
|
137
|
+
? tabValues.findIndex(item => item.value === defaultValue)
|
|
138
|
+
: -1;
|
|
139
|
+
const initialActiveIndex =
|
|
140
|
+
defaultValueIndex === -1 ? (defaultIndex ?? 0) : defaultValueIndex;
|
|
141
|
+
|
|
142
|
+
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
142
143
|
|
|
143
144
|
const [storageIndex, setStorageIndex] = useStorageValue<string>(
|
|
144
145
|
`${groupIdPrefix}${groupId}`,
|
|
145
|
-
|
|
146
|
+
initialActiveIndex.toString(),
|
|
146
147
|
);
|
|
147
148
|
|
|
148
149
|
const currentIndex: number = groupId ? Number(storageIndex) : activeIndex;
|
|
@@ -157,11 +158,11 @@ export const Tabs = forwardRef(
|
|
|
157
158
|
tabPosition === 'center' ? 'center' : 'flex-start',
|
|
158
159
|
}}
|
|
159
160
|
>
|
|
160
|
-
{tabValues.map(({ label }, index) => {
|
|
161
|
+
{tabValues.map(({ label, value, disabled }, index) => {
|
|
161
162
|
const isActive = index === currentIndex;
|
|
162
163
|
return (
|
|
163
164
|
<div
|
|
164
|
-
key={
|
|
165
|
+
key={value ?? index}
|
|
165
166
|
className={clsx(
|
|
166
167
|
'rp-tabs__label__item',
|
|
167
168
|
isActive
|
|
@@ -171,6 +172,9 @@ export const Tabs = forwardRef(
|
|
|
171
172
|
)}
|
|
172
173
|
data-index={index}
|
|
173
174
|
onClick={() => {
|
|
175
|
+
if (disabled) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
174
178
|
onChange?.(index);
|
|
175
179
|
if (groupId) {
|
|
176
180
|
setStorageIndex(index.toString());
|
|
@@ -186,7 +190,7 @@ export const Tabs = forwardRef(
|
|
|
186
190
|
</div>
|
|
187
191
|
) : null}
|
|
188
192
|
<div className="rp-tabs__content">
|
|
189
|
-
{tabValues.map(({
|
|
193
|
+
{tabValues.map(({ value, content }, index) => {
|
|
190
194
|
const isActive = index === currentIndex;
|
|
191
195
|
if (!keepDOM && !isActive) {
|
|
192
196
|
return null;
|
|
@@ -194,7 +198,7 @@ export const Tabs = forwardRef(
|
|
|
194
198
|
|
|
195
199
|
return (
|
|
196
200
|
<div
|
|
197
|
-
key={
|
|
201
|
+
key={value ?? index}
|
|
198
202
|
className={clsx(
|
|
199
203
|
'rp-tabs__content__item',
|
|
200
204
|
isActive
|
|
@@ -217,7 +221,10 @@ export const Tabs = forwardRef(
|
|
|
217
221
|
|
|
218
222
|
Tabs.displayName = 'Tabs';
|
|
219
223
|
|
|
220
|
-
export type TabProps =
|
|
224
|
+
export type TabProps = {
|
|
225
|
+
label?: ReactNode;
|
|
226
|
+
value?: string;
|
|
227
|
+
disabled?: boolean;
|
|
221
228
|
children: ReactNode;
|
|
222
229
|
};
|
|
223
230
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PluginDriver } from "./node/PluginDriver.js";
|
|
2
|
-
export { RSPRESS_TEMP_DIR, getIconUrlPath, getNodeAttribute, getSidebarDataGroup, logger, matchPath, mergeDocConfig, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./
|
|
2
|
+
export { RSPRESS_TEMP_DIR, getIconUrlPath, getNodeAttribute, getSidebarDataGroup, logger, matchPath, mergeDocConfig, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./9882.js";
|
|
3
3
|
export { RouteService } from "./node/route/RouteService.js";
|
|
4
4
|
export { build } from "./node/build.js";
|
|
5
5
|
export { defineConfig } from "./config/defineConfig.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, addLeadingSlash } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, addLeadingSlash } from "../2633.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
3
|
import { haveNavSidebarConfig as auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
|
|
4
4
|
class PluginDriver {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../
|
|
1
|
+
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../2633.js";
|
|
2
2
|
import { processLocales, combineWalkResult } from "./locales.js";
|
|
3
3
|
import { walk } from "./walk.js";
|
|
4
4
|
async function runAutoNavSide(config, metaFileSet, mdFileSet) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type SidebarDivider, type SidebarGroup, type SidebarItem, type SidebarSectionHeader } from '@rspress/shared';
|
|
2
|
-
declare function scanSideMeta(workDir: string, docsDir: string, extensions: string[], metaFileSet: Set<string>, mdFileSet: Set<string>): Promise<(
|
|
2
|
+
declare function scanSideMeta(workDir: string, docsDir: string, extensions: string[], metaFileSet: Set<string>, mdFileSet: Set<string>): Promise<(SidebarDivider | SidebarGroup | SidebarItem | SidebarSectionHeader)[]>;
|
|
3
3
|
export { scanSideMeta };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
3
|
-
import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../
|
|
2
|
+
import "../../7986.js";
|
|
3
|
+
import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../2633.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
|
5
|
-
import { PUBLIC_DIR } from "../constants.js";
|
|
6
5
|
import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
|
|
7
6
|
import { absolutePathToRoutePath, addRoutePrefix } from "../route/RoutePage.js";
|
|
8
7
|
import { RouteService } from "../route/RouteService.js";
|
|
@@ -37,7 +36,7 @@ async function fsDirToMetaItems(workDir, docsDir, extensions) {
|
|
|
37
36
|
if ('_meta.json' === item) return null;
|
|
38
37
|
const stat = await promises_stat(join(workDir, item));
|
|
39
38
|
if (stat.isDirectory()) {
|
|
40
|
-
if (
|
|
39
|
+
if ("public" === item && workDir === docsDir) return null;
|
|
41
40
|
return {
|
|
42
41
|
type: 'dir',
|
|
43
42
|
name: item
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../
|
|
1
|
+
import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../2633.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
3
|
async function pathExists(path) {
|
|
4
4
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, node_path, promises } from "../../
|
|
1
|
+
import { isExternalUrl, node_path, promises } from "../../2633.js";
|
|
2
2
|
import { pathExists } from "../utils/fs.js";
|
|
3
3
|
import { readJson } from "./utils.js";
|
|
4
4
|
import { addRoutePrefix } from "../route/RoutePage.js";
|
package/dist/node/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire, node_path, package_namespaceObject } from "../
|
|
1
|
+
import { createRequire, node_path, package_namespaceObject } from "../7275.js";
|
|
2
2
|
const constants_require = createRequire(import.meta.url);
|
|
3
3
|
const RSPRESS_VERSION = package_namespaceObject.rE;
|
|
4
4
|
const APPEARANCE_KEY = 'rspress-theme-appearance';
|
|
@@ -25,9 +25,9 @@ const APP_HTML_MARKER = '<!--<?- DOC_CONTENT ?>-->';
|
|
|
25
25
|
const HEAD_MARKER = '<!--<?- HEAD ?>-->';
|
|
26
26
|
const META_GENERATOR = '<!--<?- GENERATOR ?>-->';
|
|
27
27
|
const DEFAULT_TITLE = 'Rspress';
|
|
28
|
-
const PUBLIC_DIR = 'public';
|
|
29
28
|
const NODE_SSG_BUNDLE_FOLDER = '__ssg__';
|
|
30
29
|
const NODE_SSG_BUNDLE_NAME = 'rspress-ssg-entry.cjs';
|
|
31
30
|
const NODE_SSG_MD_BUNDLE_FOLDER = '__ssg_md__';
|
|
32
31
|
const NODE_SSG_MD_BUNDLE_NAME = 'rspress-ssg-md-entry.cjs';
|
|
33
|
-
|
|
32
|
+
var constants_PUBLIC_DIR = "public";
|
|
33
|
+
export { APP_HTML_MARKER, CSR_CLIENT_ENTRY, DEFAULT_THEME, DEFAULT_TITLE, EJECTED_THEME, HEAD_MARKER, META_GENERATOR, NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME, NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME, OUTPUT_DIR, PACKAGE_ROOT, RSPRESS_VERSION, SSG_MD_SERVER_ENTRY, SSR_CLIENT_ENTRY, SSR_SERVER_ENTRY, TEMPLATE_PATH, constants_PUBLIC_DIR as PUBLIC_DIR, importStatementRegex, inlineThemeScript, isProduction };
|
package/dist/node/eject.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../0~rslib-runtime.js";
|
|
2
|
-
import "../
|
|
3
|
-
import { node_path, logger, promises } from "../
|
|
2
|
+
import "../7986.js";
|
|
3
|
+
import { node_path, logger, promises } from "../5580.js";
|
|
4
4
|
import { EJECTED_THEME } from "./constants.js";
|
|
5
5
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
6
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { external_node_process_cwd, node_path, external_node_url_fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, external_node_module_createRequire, removeTrailingSlash, pluginVirtualModule, pluginReact, MDX_OR_MD_REGEXP } from "../
|
|
1
|
+
import { external_node_process_cwd, node_path, external_node_url_fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, external_node_module_createRequire, removeTrailingSlash, pluginVirtualModule, pluginReact, MDX_OR_MD_REGEXP } from "../2633.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
|
-
import {
|
|
3
|
+
import { 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";
|
|
5
5
|
import { resolveReactRouterDomAlias, resolveReactRenderToMarkdownAlias, resolveReactAlias } from "./utils/reactAlias.js";
|
|
6
6
|
import { rsbuildPluginDocVM } from "./runtimeModule/pageData/rsbuildPlugin.js";
|
|
@@ -14,7 +14,7 @@ import { siteDataVMPlugin } from "./runtimeModule/siteData/rsbuildPlugin.js";
|
|
|
14
14
|
import { rsbuildPluginSSG } from "./ssg/rsbuildPluginSSG.js";
|
|
15
15
|
import { rsbuildPluginCSR } from "./ssg/rsbuildPluginCSR.js";
|
|
16
16
|
import { rsbuildPluginSSGMD } from "./ssg-md/rsbuildPluginSSGMD.js";
|
|
17
|
-
import { package_namespaceObject } from "../
|
|
17
|
+
import { package_namespaceObject } from "../7275.js";
|
|
18
18
|
function isPluginIncluded(config, pluginName) {
|
|
19
19
|
return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
|
|
20
20
|
}
|
|
@@ -37,7 +37,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
37
37
|
if (!icon) return;
|
|
38
38
|
icon = icon.toString();
|
|
39
39
|
if (icon.startsWith('file://')) icon = external_node_url_fileURLToPath(icon);
|
|
40
|
-
else if (node_path.isAbsolute(icon)) return node_path.join(userDocRoot,
|
|
40
|
+
else if (node_path.isAbsolute(icon)) return node_path.join(userDocRoot, "public", icon);
|
|
41
41
|
return icon;
|
|
42
42
|
};
|
|
43
43
|
await hintThemeBreakingChange(CUSTOM_THEME_DIR);
|
|
@@ -92,7 +92,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
92
92
|
server: {
|
|
93
93
|
port: !isProduction() && process.env.PORT ? Number(process.env.PORT) : void 0,
|
|
94
94
|
publicDir: {
|
|
95
|
-
name: node_path.join(userDocRoot,
|
|
95
|
+
name: node_path.join(userDocRoot, "public")
|
|
96
96
|
},
|
|
97
97
|
...base.length > 0 ? {
|
|
98
98
|
base: removeTrailingSlash(base)
|
|
@@ -250,7 +250,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
250
250
|
define: {
|
|
251
251
|
'process.env.__SSR__': JSON.stringify(false),
|
|
252
252
|
'process.env.__SSR_MD__': JSON.stringify(false),
|
|
253
|
-
'import.meta.env.SSR': JSON.stringify(false),
|
|
254
253
|
'import.meta.env.SSG_MD': JSON.stringify(false)
|
|
255
254
|
}
|
|
256
255
|
},
|
|
@@ -284,7 +283,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
284
283
|
define: {
|
|
285
284
|
'process.env.__SSR__': JSON.stringify(true),
|
|
286
285
|
'process.env.__SSR_MD__': JSON.stringify(false),
|
|
287
|
-
'import.meta.env.SSR': JSON.stringify(true),
|
|
288
286
|
'import.meta.env.SSG_MD': JSON.stringify(false)
|
|
289
287
|
}
|
|
290
288
|
},
|
|
@@ -325,7 +323,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
325
323
|
define: {
|
|
326
324
|
'process.env.__SSR__': JSON.stringify(true),
|
|
327
325
|
'process.env.__SSR_MD__': JSON.stringify(true),
|
|
328
|
-
'import.meta.env.SSR': JSON.stringify(true),
|
|
329
326
|
'import.meta.env.SSG_MD': JSON.stringify(true)
|
|
330
327
|
}
|
|
331
328
|
},
|
package/dist/node/logger/hint.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import { relative, logger, join, readFile } from "../../
|
|
2
|
+
import { relative, logger, join, readFile } from "../../7986.js";
|
|
3
3
|
import { pathExists } from "../utils/fs.js";
|
|
4
4
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
5
5
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
package/dist/node/mdx/options.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, rehype_external_links, rehype_raw, remark_cjk_friendly, nodeTypes, remark_gfm, rehype, remark_cjk_friendly_gfm_strikethrough } from "../../
|
|
1
|
+
import { node_path, rehype_external_links, rehype_raw, remark_cjk_friendly, nodeTypes, remark_gfm, rehype, remark_cjk_friendly_gfm_strikethrough } from "../../9283.js";
|
|
2
2
|
import { remarkToc } from "./remarkPlugins/toc.js";
|
|
3
3
|
import { remarkContainerSyntax } from "./remarkPlugins/containerSyntax.js";
|
|
4
4
|
import { remarkFileCodeBlock } from "./remarkPlugins/fileCodeBlock.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../
|
|
1
|
+
import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../9283.js";
|
|
2
2
|
import { createMDXOptions } from "./options.js";
|
|
3
3
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
4
4
|
import { escapeMarkdownHeadingIds } from "../utils/escapeHeadingIds.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visit, extractTextAndId, github_slugger, headingRank } from "../../../
|
|
1
|
+
import { visit, extractTextAndId, github_slugger, headingRank } from "../../../9283.js";
|
|
2
2
|
const rehypeHeaderAnchor = ()=>{
|
|
3
3
|
const slugger = new github_slugger();
|
|
4
4
|
return (tree)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../
|
|
1
|
+
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9283.js";
|
|
2
2
|
const cssVariablesTheme = createCssVariablesTheme({
|
|
3
3
|
name: 'css-variables',
|
|
4
4
|
variablePrefix: '--shiki-',
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
const SHIKI_TRANSFORMER_ADD_TITLE = 'shiki-transformer:add-title';
|
|
2
|
+
const TITLE_META_REGEX = /(?:^|\s)title=(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\s]+))(?=\s|$)/;
|
|
2
3
|
function parseTitleFromMeta(meta) {
|
|
3
4
|
if (!meta) return '';
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const [k, v = ''] = item.split('=').filter(Boolean);
|
|
7
|
-
if ('title' === k && v.length > 0) return v.replace(/["'`]/g, '');
|
|
8
|
-
}
|
|
9
|
-
return '';
|
|
5
|
+
const matched = meta.match(TITLE_META_REGEX);
|
|
6
|
+
return matched?.slice(1).find(Boolean) ?? '';
|
|
10
7
|
}
|
|
11
8
|
function transformerAddTitle() {
|
|
12
9
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path } from "../../../
|
|
1
|
+
import { node_path } from "../../../9283.js";
|
|
2
2
|
import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
|
|
3
3
|
const remarkBuiltin = ({ globalComponents })=>(tree)=>{
|
|
4
4
|
const demos = globalComponents.map((componentPath)=>{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { Root } from 'mdast';
|
|
15
15
|
import type { Plugin } from 'unified';
|
|
16
|
-
export declare const DIRECTIVE_TYPES: readonly [
|
|
16
|
+
export declare const DIRECTIVE_TYPES: readonly ['tip', 'note', 'warning', 'caution', 'danger', 'info', 'details'];
|
|
17
17
|
export declare const REGEX_BEGIN: RegExp;
|
|
18
18
|
export declare const REGEX_END: RegExp;
|
|
19
19
|
export declare const REGEX_GH_BEGIN: RegExp;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { visit, node_path, logger, cwd, readFile } from "../../../
|
|
2
|
+
import "../../../7986.js";
|
|
3
|
+
import { visit, node_path, logger, cwd, readFile } from "../../../3358.js";
|
|
4
4
|
import { createError } from "../../utils/error.js";
|
|
5
5
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
6
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
@@ -3,6 +3,6 @@ import type { Root } from 'mdast';
|
|
|
3
3
|
import type { VFile } from 'vfile';
|
|
4
4
|
export declare const remarkImage: ({ docDirectory, remarkImageOptions, lint, }: {
|
|
5
5
|
docDirectory: string;
|
|
6
|
-
remarkImageOptions?: MarkdownOptions[
|
|
6
|
+
remarkImageOptions?: MarkdownOptions['image'];
|
|
7
7
|
lint?: boolean;
|
|
8
8
|
}) => (tree: Root, file: VFile) => void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../
|
|
2
|
+
import "../../../7986.js";
|
|
3
|
+
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../3358.js";
|
|
4
4
|
import { createError } from "../../utils/error.js";
|
|
5
|
-
import { PUBLIC_DIR } from "../../constants.js";
|
|
6
5
|
import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
|
|
7
6
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
7
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
@@ -41,7 +40,7 @@ function resolveImage(imageUrl, filePath, docDirectory, deadImages) {
|
|
|
41
40
|
if (isDataUrl(imageUrl)) return;
|
|
42
41
|
const { url } = parseUrl(imageUrl);
|
|
43
42
|
if (url.startsWith('/')) {
|
|
44
|
-
const resolvedPath = node_path.join(docDirectory,
|
|
43
|
+
const resolvedPath = node_path.join(docDirectory, "public", url);
|
|
45
44
|
if (!existsSync(resolvedPath)) deadImages.set(imageUrl, resolvedPath);
|
|
46
45
|
} else {
|
|
47
46
|
const resolvedPath = node_path.resolve(node_path.dirname(filePath), url);
|
|
@@ -79,6 +78,7 @@ const remarkImage = ({ docDirectory, remarkImageOptions, lint })=>(tree, file)=>
|
|
|
79
78
|
const { alt, url } = node;
|
|
80
79
|
if (!url) return;
|
|
81
80
|
if (shouldCheckDeadImages) resolveImage(url, file.path, docDirectory, deadImages);
|
|
81
|
+
if (lint) return;
|
|
82
82
|
const imagePath = normalizeImageUrl(url);
|
|
83
83
|
if (!imagePath) return;
|
|
84
84
|
const tempVariableName = `image${images.length}`;
|
|
@@ -10,7 +10,7 @@ import type { RouteService } from '../../route/RouteService.js';
|
|
|
10
10
|
export declare const remarkLink: ({ cleanUrls, routeService, remarkLinkOptions, lint, __base, }: {
|
|
11
11
|
cleanUrls: boolean | string;
|
|
12
12
|
routeService: RouteService | null;
|
|
13
|
-
remarkLinkOptions?: MarkdownOptions[
|
|
13
|
+
remarkLinkOptions?: MarkdownOptions['link'];
|
|
14
14
|
lint?: boolean;
|
|
15
15
|
__base?: string;
|
|
16
16
|
}) => (tree: Root, file: VFile) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withBase } from "../../../
|
|
2
|
+
import "../../../7986.js";
|
|
3
|
+
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withBase } from "../../../3358.js";
|
|
4
4
|
import { hintRelativeMarkdownLink } from "../../logger/hint.js";
|
|
5
5
|
import { createError } from "../../utils/error.js";
|
|
6
6
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { github_slugger, visitChildren, extractTextAndId } from "../../../
|
|
1
|
+
import { github_slugger, visitChildren, extractTextAndId } from "../../../8005.js";
|
|
2
2
|
const extractChildText = (child)=>{
|
|
3
3
|
if ('link' === child.type) return child.children?.map(extractChildText).join('') ?? '';
|
|
4
4
|
if ('strong' === child.type) return `**${child.children?.map(extractChildText).join('') ?? ''}**`;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../
|
|
2
|
-
import { PUBLIC_DIR } from "../constants.js";
|
|
1
|
+
import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../2633.js";
|
|
3
2
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
4
3
|
import { createError } from "../utils/error.js";
|
|
5
4
|
import { getRoutePathParts, normalizeRoutePath, splitRoutePathParts } from "./normalizeRoutePath.js";
|
|
@@ -73,7 +72,7 @@ class RouteService {
|
|
|
73
72
|
'**/node_modules/**',
|
|
74
73
|
'**/.eslintrc.js',
|
|
75
74
|
'**/.nx/**',
|
|
76
|
-
|
|
75
|
+
"./public/**",
|
|
77
76
|
'**/*.d.ts'
|
|
78
77
|
]
|
|
79
78
|
})).sort();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../
|
|
1
|
+
import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../2633.js";
|
|
2
2
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
3
3
|
import { flattenMdxContent } from "../utils/flattenMdxContent.js";
|
|
4
4
|
import { importStatementRegex } from "../constants.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../
|
|
1
|
+
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../2633.js";
|
|
2
2
|
const getRoutePathParts = (relativePath, lang, version, langs, versions)=>{
|
|
3
3
|
const [versionPart, langPart, purePath] = splitRoutePathParts(relativePath, lang, version, langs, versions);
|
|
4
4
|
return [
|