@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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
19
|
+
* Released under the MIT License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/*!
|
|
23
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
24
|
+
*
|
|
25
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
26
|
+
* Released under the MIT License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/*!
|
|
30
|
+
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
33
|
+
* Released under the MIT License.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*!
|
|
37
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
40
|
+
* Released under the MIT License.
|
|
41
|
+
*/
|
package/dist/cli/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../0~rslib-runtime.js";
|
|
2
|
+
import { node_path, logger, join, cac } from "../8857.js";
|
|
3
|
+
import { package_namespaceObject } from "../8006.js";
|
|
3
4
|
import { loadConfigFile, resolveDocRoot } from "../config/loadConfigFile.js";
|
|
4
5
|
import { dev } from "../node/dev.js";
|
|
5
6
|
import { PUBLIC_DIR } from "../node/constants.js";
|
|
6
7
|
import { build } from "../node/build.js";
|
|
7
8
|
import { serve } from "../node/serve.js";
|
|
8
9
|
import { listComponents, ejectComponent } from "../node/eject.js";
|
|
10
|
+
const chokidar = __webpack_require__("../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js");
|
|
11
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
12
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
9
13
|
const META_FILES = [
|
|
10
14
|
'_meta.json',
|
|
11
15
|
'_nav.json'
|
|
@@ -58,7 +62,7 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
|
|
|
58
62
|
if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && filepath === configFilePath) {
|
|
59
63
|
if (isRestarting) return;
|
|
60
64
|
isRestarting = true;
|
|
61
|
-
console.log(`\n✨ ${eventName} ${
|
|
65
|
+
console.log(`\n✨ ${eventName} ${picocolors_default().green(node_path.relative(cwd, filepath))}, dev server will restart...\n`);
|
|
62
66
|
await devServer.close();
|
|
63
67
|
await cliWatcher.close();
|
|
64
68
|
await startDevServer();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_fs, node_path, logger, DEFAULT_CONFIG_NAME, DEFAULT_CONFIG_EXTENSIONS } from "../
|
|
1
|
+
import { node_fs, node_path, logger, DEFAULT_CONFIG_NAME, DEFAULT_CONFIG_EXTENSIONS } from "../8857.js";
|
|
2
2
|
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
|
|
3
3
|
async function loadConfigFile(customConfigFile) {
|
|
4
4
|
const baseDir = process.cwd();
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cleanUrlByConfig,
|
|
3
|
+
initPageData,
|
|
3
4
|
isActive,
|
|
4
5
|
isExternalUrl,
|
|
5
6
|
pathnameToRouteService,
|
|
6
7
|
removeBase,
|
|
7
8
|
useLocation,
|
|
8
9
|
useNavigate as useNavigateInner,
|
|
10
|
+
warmPageData,
|
|
9
11
|
withBase,
|
|
10
12
|
} from '@rspress/core/runtime';
|
|
11
13
|
import nprogress from 'nprogress';
|
|
@@ -88,7 +90,8 @@ export function useLinkNavigate(
|
|
|
88
90
|
const timer = setTimeout(() => {
|
|
89
91
|
nprogress.start();
|
|
90
92
|
}, 200);
|
|
91
|
-
await
|
|
93
|
+
const data = await initPageData(removeBaseHref);
|
|
94
|
+
warmPageData(removeBaseHref, data);
|
|
92
95
|
clearTimeout(timer);
|
|
93
96
|
nprogress.done();
|
|
94
97
|
} else {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
&--success.rp-llms-copy-button {
|
|
12
|
-
color:
|
|
13
|
-
border-color:
|
|
12
|
+
color: #10b981;
|
|
13
|
+
border-color: #10b981;
|
|
14
14
|
background: var(--rp-c-bg-soft);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
position: absolute;
|
|
49
49
|
top: 50%;
|
|
50
50
|
left: 50%;
|
|
51
|
-
color:
|
|
51
|
+
color: #10b981;
|
|
52
52
|
|
|
53
53
|
visibility: hidden;
|
|
54
54
|
opacity: 0;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Tabs,
|
|
9
9
|
useLinkNavigate,
|
|
10
10
|
} from '@rspress/core/theme';
|
|
11
|
-
import { debounce } from 'lodash-es';
|
|
11
|
+
import { debounce } from '@rspress/shared/lodash-es';
|
|
12
12
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { createPortal } from 'react-dom';
|
|
14
14
|
import * as userSearchHooks from 'virtual-search-hooks';
|
|
@@ -1,35 +1,54 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--rp-steps-gap: 24px;
|
|
3
|
+
--rp-steps-size: 30px;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.rp-steps {
|
|
2
|
-
margin-left:
|
|
3
|
-
margin-bottom:
|
|
7
|
+
margin-left: 1rem;
|
|
8
|
+
margin-bottom: 2.5rem;
|
|
4
9
|
border-left: 1px solid var(--rp-c-text-3);
|
|
5
|
-
padding-left:
|
|
10
|
+
padding-left: var(--rp-steps-gap);
|
|
6
11
|
counter-reset: step;
|
|
7
12
|
|
|
8
13
|
h3 {
|
|
9
14
|
counter-increment: step;
|
|
10
|
-
margin-top:
|
|
15
|
+
margin-top: 0;
|
|
11
16
|
position: relative;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
min-height: 30px;
|
|
12
20
|
|
|
13
21
|
&::before {
|
|
22
|
+
// position
|
|
14
23
|
content: counter(step);
|
|
15
24
|
position: absolute;
|
|
16
|
-
left: -
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
left: calc(-1 * var(--rp-steps-gap));
|
|
26
|
+
transform: translate(-50%, 0);
|
|
27
|
+
|
|
28
|
+
// size
|
|
29
|
+
width: var(--rp-steps-size);
|
|
30
|
+
height: var(--rp-steps-size);
|
|
31
|
+
line-height: var(--rp-steps-size);
|
|
32
|
+
|
|
33
|
+
// text
|
|
19
34
|
display: flex;
|
|
20
35
|
align-items: center;
|
|
21
36
|
justify-content: center;
|
|
22
37
|
font-size: 1.1rem;
|
|
23
|
-
font-weight:
|
|
24
|
-
line-height: 30px;
|
|
38
|
+
font-weight: 500;
|
|
25
39
|
color: var(--rp-c-text-1);
|
|
26
|
-
|
|
40
|
+
|
|
41
|
+
// style
|
|
42
|
+
background-color: var(--rp-c-bg);
|
|
43
|
+
outline: 6px solid var(--rp-c-bg);
|
|
27
44
|
border: 1.5px solid var(--rp-c-text-3);
|
|
28
45
|
border-radius: 50%;
|
|
29
46
|
}
|
|
30
|
-
}
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
/* anchor link: move to the front and ensure it's clickable */
|
|
49
|
+
.rp-header-anchor {
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: calc(-1 * var(--rp-steps-gap) - var(--rp-steps-size) / 2);
|
|
52
|
+
}
|
|
34
53
|
}
|
|
35
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, addLeadingSlash } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, addLeadingSlash } from "../740.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 "../../740.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,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
import { extname, logger, external_node_path_relative, readdir, isExternalUrl, slash, promises_stat, join } from "../../740.js";
|
|
2
4
|
import { createError } from "../utils/error.js";
|
|
3
5
|
import { PUBLIC_DIR } from "../constants.js";
|
|
4
6
|
import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
|
|
5
7
|
import { absolutePathToRoutePath, addRoutePrefix } from "../route/RoutePage.js";
|
|
6
8
|
import { RouteService } from "../route/RouteService.js";
|
|
9
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
10
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
7
11
|
const AUTO_NAV_SIDEBAR_ERROR_PREFIX = '[auto-nav-sidebar] ';
|
|
8
12
|
function getFileKey(realPath, docsDir) {
|
|
9
|
-
return realPath ? slash(
|
|
13
|
+
return realPath ? slash(external_node_path_relative(docsDir, realPath).replace(extname(realPath), '')) : '';
|
|
10
14
|
}
|
|
11
15
|
async function fsDirToMetaItems(workDir, docsDir, extensions) {
|
|
12
16
|
let subItems;
|
|
@@ -19,7 +23,7 @@ async function fsDirToMetaItems(workDir, docsDir, extensions) {
|
|
|
19
23
|
});
|
|
20
24
|
} catch (e) {
|
|
21
25
|
const metaFilePath = join(workDir, '_meta.json');
|
|
22
|
-
throw createError(`${AUTO_NAV_SIDEBAR_ERROR_PREFIX}Failed to read directory: ${
|
|
26
|
+
throw createError(`${AUTO_NAV_SIDEBAR_ERROR_PREFIX}Failed to read directory: ${picocolors_default().yellow(workDir)}, maybe it does not exist. Please check it in ${picocolors_default().cyan(metaFilePath)}. (${e})`);
|
|
23
27
|
}
|
|
24
28
|
subItems = subItems.filter((item)=>{
|
|
25
29
|
const hasExtension = extensions.some((ext)=>item.endsWith(ext));
|
|
@@ -79,13 +83,13 @@ async function metaFileItemToSidebarItem(metaItemRaw, workDir, docsDir, extensio
|
|
|
79
83
|
} : metaItemRaw;
|
|
80
84
|
const { name, context, label, overviewHeaders, tag } = metaItem;
|
|
81
85
|
const metaFilePath = join(workDir, '_meta.json');
|
|
82
|
-
if ('string' != typeof name) throw createError(`${AUTO_NAV_SIDEBAR_ERROR_PREFIX}The file name "${name}" is not a string, please check it in ${
|
|
86
|
+
if ('string' != typeof name) throw createError(`${AUTO_NAV_SIDEBAR_ERROR_PREFIX}The file name "${name}" is not a string, please check it in ${picocolors_default().cyan(metaFilePath)}.`);
|
|
83
87
|
const absolutePath = join(workDir, name);
|
|
84
88
|
let absolutePathWithExt;
|
|
85
89
|
try {
|
|
86
90
|
absolutePathWithExt = await detectFilePath(absolutePath, extensions);
|
|
87
91
|
} catch {
|
|
88
|
-
throw createError(`${AUTO_NAV_SIDEBAR_ERROR_PREFIX}${
|
|
92
|
+
throw createError(`${AUTO_NAV_SIDEBAR_ERROR_PREFIX}${picocolors_default().white('Missing page file:')} ${picocolors_default().yellow(`"${absolutePath}"`)}\n${picocolors_default().white('Please check')} ${picocolors_default().cyan(join(workDir, '_meta.json'))}.`);
|
|
89
93
|
}
|
|
90
94
|
const link = absolutePathToRoutePath(absolutePathWithExt, docsDir);
|
|
91
95
|
const routeService = RouteService.getInstance();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../
|
|
1
|
+
import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../740.js";
|
|
2
|
+
import { createError } from "../utils/error.js";
|
|
2
3
|
async function pathExists(path) {
|
|
3
4
|
try {
|
|
4
5
|
await promises.access(path);
|
|
@@ -9,7 +10,12 @@ async function pathExists(path) {
|
|
|
9
10
|
}
|
|
10
11
|
async function readJson(path) {
|
|
11
12
|
const raw = await promises.readFile(path, 'utf8');
|
|
12
|
-
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(raw);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
const detail = error instanceof Error ? error.message : 'Unknown JSON parse error';
|
|
17
|
+
throw createError(`[auto-nav-sidebar] Failed to parse JSON file "${path}": ${detail}`);
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
async function extractInfoFromFrontmatterWithAbsolutePath(absolutePath, rootDir) {
|
|
15
21
|
const fileHandle = await promises.open(absolutePath, 'r');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { isExternalUrl, node_path, promises } from "../../
|
|
1
|
+
import { isExternalUrl, node_path, promises } from "../../740.js";
|
|
2
2
|
import { pathExists } from "../utils/fs.js";
|
|
3
3
|
import { readJson } from "./utils.js";
|
|
4
|
-
import { createError } from "../utils/error.js";
|
|
5
4
|
import { addRoutePrefix } from "../route/RoutePage.js";
|
|
6
5
|
import { hintNavJsonChangeThenPanic } from "../logger/hint.js";
|
|
7
6
|
import { scanSideMeta } from "./normalize.js";
|
|
@@ -11,12 +10,7 @@ async function scanNav(workDir, docsDir, metaFileSet) {
|
|
|
11
10
|
const isRootNavJsonExist = await pathExists(rootNavJson);
|
|
12
11
|
if (isRootNavJsonExist) {
|
|
13
12
|
metaFileSet.add(rootNavJson);
|
|
14
|
-
|
|
15
|
-
navConfig = await readJson(rootNavJson);
|
|
16
|
-
} catch (e) {
|
|
17
|
-
if (e instanceof Error) throw createError(`[auto-nav-sidebar] Generate nav meta error: ${rootNavJson} failed, original error is (${e.message})`);
|
|
18
|
-
throw e;
|
|
19
|
-
}
|
|
13
|
+
navConfig = await readJson(rootNavJson);
|
|
20
14
|
} else navConfig = [];
|
|
21
15
|
navConfig.forEach((navItem)=>{
|
|
22
16
|
if ('items' in navItem) navItem.items.forEach((item)=>{
|
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 "../8006.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';
|
package/dist/node/eject.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../0~rslib-runtime.js";
|
|
2
|
+
import "../8006.js";
|
|
3
|
+
import { node_path, logger, promises } from "../8857.js";
|
|
2
4
|
import { EJECTED_THEME } from "./constants.js";
|
|
5
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
3
7
|
let _themeComponentsPathOverride;
|
|
4
8
|
function getThemeComponentsPath() {
|
|
5
9
|
if (_themeComponentsPathOverride) return _themeComponentsPathOverride;
|
|
@@ -71,7 +75,7 @@ async function transformDirectory(dir) {
|
|
|
71
75
|
async function ejectComponent(componentName, cwd = process.cwd()) {
|
|
72
76
|
const exists = await componentExists(componentName);
|
|
73
77
|
if (!exists) {
|
|
74
|
-
logger.error(`Component ${
|
|
78
|
+
logger.error(`Component ${picocolors_default().cyan(componentName)} not found in theme.`);
|
|
75
79
|
const available = await getAvailableComponents();
|
|
76
80
|
logger.info(`\nAvailable components:\n${available.map((c)=>` - ${c}`).join('\n')}`);
|
|
77
81
|
process.exit(1);
|
|
@@ -82,7 +86,7 @@ async function ejectComponent(componentName, cwd = process.cwd()) {
|
|
|
82
86
|
const destComponentPath = node_path.join(destThemePath, componentName);
|
|
83
87
|
try {
|
|
84
88
|
await promises.access(destComponentPath);
|
|
85
|
-
logger.warn(`Component ${
|
|
89
|
+
logger.warn(`Component ${picocolors_default().cyan(componentName)} already exists in ${picocolors_default().yellow(node_path.relative(cwd, destComponentPath))}`);
|
|
86
90
|
logger.info('Overwriting existing component...');
|
|
87
91
|
} catch {}
|
|
88
92
|
try {
|
|
@@ -91,8 +95,8 @@ async function ejectComponent(componentName, cwd = process.cwd()) {
|
|
|
91
95
|
});
|
|
92
96
|
await copyDir(sourceComponentPath, destComponentPath);
|
|
93
97
|
await transformDirectory(destComponentPath);
|
|
94
|
-
logger.success(`✨ Component ${
|
|
95
|
-
logger.info(`Component files copied to: ${
|
|
98
|
+
logger.success(`✨ Component ${picocolors_default().cyan(componentName)} ejected successfully!`);
|
|
99
|
+
logger.info(`Component files copied to: ${picocolors_default().green(node_path.relative(cwd, destComponentPath))}\nYou can now customize the component. To use it in your theme, you'll need to:\n 1. Re-export it in your custom \`theme/index.tsx\` file\n 2. Edit it by yourself`);
|
|
96
100
|
} catch (error) {
|
|
97
101
|
logger.error(`Failed to eject component: ${error}`);
|
|
98
102
|
throw error;
|
|
@@ -102,9 +106,9 @@ async function listComponents() {
|
|
|
102
106
|
const components = await getAvailableComponents();
|
|
103
107
|
logger.info(`📦 Available components to eject:\n`);
|
|
104
108
|
components.forEach((component)=>{
|
|
105
|
-
logger.info(` ${
|
|
109
|
+
logger.info(` ${picocolors_default().cyan('•')} ${component}`);
|
|
106
110
|
});
|
|
107
|
-
logger.info(`💡 Usage: ${
|
|
111
|
+
logger.info(`💡 Usage: ${picocolors_default().dim('rspress eject <ComponentName>')}\n`);
|
|
108
112
|
}
|
|
109
113
|
var eject__setThemeComponentsPathForTesting = void 0;
|
|
110
114
|
var eject_getAvailableComponents = void 0;
|
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 "../740.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";
|
|
@@ -14,11 +14,11 @@ 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 "../8006.js";
|
|
18
18
|
function isPluginIncluded(config, pluginName) {
|
|
19
19
|
return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
|
|
20
20
|
}
|
|
21
|
-
const initRsbuild_require =
|
|
21
|
+
const initRsbuild_require = external_node_module_createRequire(import.meta.url);
|
|
22
22
|
async function getVirtualModulesFromPlugins(pluginDriver) {
|
|
23
23
|
const runtimeModule = {};
|
|
24
24
|
const modulesByPlugin = await pluginDriver.addRuntimeModules();
|
|
@@ -29,14 +29,14 @@ async function getVirtualModulesFromPlugins(pluginDriver) {
|
|
|
29
29
|
return runtimeModule;
|
|
30
30
|
}
|
|
31
31
|
async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
|
|
32
|
-
const CUSTOM_THEME_DIR = node_path.isAbsolute(config.themeDir) ? config.themeDir : node_path.join(
|
|
32
|
+
const CUSTOM_THEME_DIR = node_path.isAbsolute(config.themeDir) ? config.themeDir : node_path.join(external_node_process_cwd(), config.themeDir);
|
|
33
33
|
const outDir = config?.outDir ?? OUTPUT_DIR;
|
|
34
34
|
const base = config?.base ?? '/';
|
|
35
35
|
const assetPrefix = isProduction() ? addTrailingSlash(config?.builderConfig?.output?.assetPrefix ?? base) : '/';
|
|
36
36
|
const normalizeIcon = (icon)=>{
|
|
37
37
|
if (!icon) return;
|
|
38
38
|
icon = icon.toString();
|
|
39
|
-
if (icon.startsWith('file://')) icon =
|
|
39
|
+
if (icon.startsWith('file://')) icon = external_node_url_fileURLToPath(icon);
|
|
40
40
|
else if (node_path.isAbsolute(icon)) return node_path.join(userDocRoot, PUBLIC_DIR, icon);
|
|
41
41
|
return icon;
|
|
42
42
|
};
|
|
@@ -202,7 +202,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
202
202
|
chain.module.rule('MDX').type("javascript/auto").test(MDX_OR_MD_REGEXP).resolve.merge({
|
|
203
203
|
conditionNames: jsModuleRule.resolve.conditionNames.values(),
|
|
204
204
|
mainFields: jsModuleRule.resolve.mainFields.values()
|
|
205
|
-
}).end().oneOf('MDXCompile').use('builtin:swc-loader').loader('builtin:swc-loader').options(swcLoaderOptions).end().use('mdx-loader').loader(
|
|
205
|
+
}).end().oneOf('MDXCompile').use('builtin:swc-loader').loader('builtin:swc-loader').options(swcLoaderOptions).end().use('mdx-loader').loader(external_node_url_fileURLToPath(new URL('./mdx/loader.js', import.meta.url))).options({
|
|
206
206
|
config,
|
|
207
207
|
docDirectory: userDocRoot,
|
|
208
208
|
routeService,
|
package/dist/node/logger/hint.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import { relative, logger, join, readFile } from "../../8006.js";
|
|
2
3
|
import { pathExists } from "../utils/fs.js";
|
|
4
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
5
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
3
6
|
const THEME_DEFAULT_EXPORT_PATTERN = /export\s+default\s+\{/;
|
|
4
7
|
const THEME_OLD_IMPORT_0 = /from\s+['"]rspress\/theme['"]/;
|
|
5
8
|
const THEME_OLD_IMPORT_1 = /from\s+['"]@rspress\/core\/theme['"]/;
|
|
@@ -27,13 +30,13 @@ async function hintThemeBreakingChange(customThemeDir) {
|
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
|
-
if (useDefaultExportFilePath) logger.warn(`[Rspress v2] Breaking Change: The "theme/index.tsx" is now using named export from '@rspress/core/theme-original' instead of default export from 'rspress/theme', please update ${
|
|
33
|
+
if (useDefaultExportFilePath) logger.warn(`[Rspress v2] Breaking Change: The "theme/index.tsx" is now using named export from '@rspress/core/theme-original' instead of default export from 'rspress/theme', please update ${picocolors_default().greenBright(useDefaultExportFilePath)} (https://github.com/web-infra-dev/rspress/discussions/1891#discussioncomment-12422737).\n`, picocolors_default().redBright(`
|
|
31
34
|
- import Theme from 'rspress/theme';
|
|
32
35
|
- export default {
|
|
33
36
|
- ...Theme,
|
|
34
37
|
- Layout,
|
|
35
38
|
- };
|
|
36
|
-
- export * from 'rspress/theme';`) +
|
|
39
|
+
- export * from 'rspress/theme';`) + picocolors_default().greenBright(`
|
|
37
40
|
+ import { Layout } from '@rspress/core/theme-original';
|
|
38
41
|
|
|
39
42
|
+ export { Layout };
|
|
@@ -44,10 +47,10 @@ function hintBuilderPluginsBreakingChange(config) {
|
|
|
44
47
|
if ('builderPlugins' in config && Array.isArray(config.builderPlugins) && config.builderPlugins.length > 0) {
|
|
45
48
|
logger.error(`[Rspress v2] The "builderPlugins" option has been renamed to "builderConfig.plugins", please update your config accordingly (https://rspress.rs/api/config/config-build#builderconfigplugins).\n`, `
|
|
46
49
|
export default defineConfig({
|
|
47
|
-
${
|
|
50
|
+
${picocolors_default().redBright(` builderPlugins: [
|
|
48
51
|
pluginFoo()
|
|
49
52
|
],`)}
|
|
50
|
-
${
|
|
53
|
+
${picocolors_default().greenBright(` builderConfig: {
|
|
51
54
|
plugins: [
|
|
52
55
|
pluginFoo()
|
|
53
56
|
],
|
|
@@ -79,7 +82,7 @@ function hintNavJsonChangeThenPanic(metaJson, metaJsonDir, docsDir) {
|
|
|
79
82
|
const error = new Error('[Rspress v2] Detected that you are still using top level `_meta.json` to configure the nav, but it has been changed to `_nav.json` in Rspress v2. Please rename the top level `_meta.json` to `_nav.json` accordingly.');
|
|
80
83
|
logger.error(error);
|
|
81
84
|
const dir = relative(docsDir, metaJsonDir);
|
|
82
|
-
logger.info(`Please rename "${
|
|
85
|
+
logger.info(`Please rename "${picocolors_default().greenBright(join(dir, '_meta.json'))}" to "${picocolors_default().greenBright(join(dir, '_nav.json'))}".`);
|
|
83
86
|
process.exit(1);
|
|
84
87
|
}
|
|
85
88
|
}
|
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 "../../2240.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";
|
|
@@ -55,7 +55,18 @@ async function createMDXOptions(options) {
|
|
|
55
55
|
remarkLinkOptions
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
|
-
|
|
58
|
+
[
|
|
59
|
+
remarkImage,
|
|
60
|
+
isSsgMd ? {
|
|
61
|
+
docDirectory,
|
|
62
|
+
remarkImageOptions: {
|
|
63
|
+
checkDeadImages: false
|
|
64
|
+
}
|
|
65
|
+
} : {
|
|
66
|
+
docDirectory,
|
|
67
|
+
remarkImageOptions: config?.markdown?.image
|
|
68
|
+
}
|
|
69
|
+
],
|
|
59
70
|
isSsgMd && [
|
|
60
71
|
remarkSplitMdx,
|
|
61
72
|
'object' == typeof config?.llms ? config.llms.remarkSplitMdxOptions : void 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../
|
|
1
|
+
import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../2240.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 "../../../2240.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 "../../../2240.js";
|
|
2
2
|
const cssVariablesTheme = createCssVariablesTheme({
|
|
3
3
|
name: 'css-variables',
|
|
4
4
|
variablePrefix: '--shiki-',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path } from "../../../
|
|
1
|
+
import { node_path } from "../../../2240.js";
|
|
2
2
|
import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
|
|
3
3
|
const remarkBuiltin = ({ globalComponents })=>(tree)=>{
|
|
4
4
|
const demos = globalComponents.map((componentPath)=>{
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
+
import "../../../8006.js";
|
|
3
|
+
import { visit, node_path, logger, cwd, readFile } from "../../../3425.js";
|
|
2
4
|
import { createError } from "../../utils/error.js";
|
|
5
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
3
7
|
const ERROR_PREFIX = '[remarkFileCodeBlock]';
|
|
4
8
|
function parseFileFromMeta(meta) {
|
|
5
9
|
if (!meta) return '';
|
|
@@ -16,7 +20,7 @@ const remarkFileCodeBlock = ({ filepath, addDependency })=>async (tree)=>{
|
|
|
16
20
|
const { meta, value, lang } = node;
|
|
17
21
|
const file = parseFileFromMeta(meta ?? '');
|
|
18
22
|
if (!file) return;
|
|
19
|
-
const originalMetaForErrorInfo =
|
|
23
|
+
const originalMetaForErrorInfo = picocolors_default().cyan(`\`\`\`${lang} ${meta}`);
|
|
20
24
|
if (file.startsWith('./') || file.startsWith('../') || file.startsWith('<root>/')) {
|
|
21
25
|
let resolvedFilePath;
|
|
22
26
|
resolvedFilePath = file.startsWith('<root>/') ? node_path.join(cwd(), file.slice(7)) : node_path.join(node_path.dirname(filepath), file);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { type MarkdownOptions } from '@rspress/shared';
|
|
1
2
|
import type { Root } from 'mdast';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const remarkImage:
|
|
3
|
+
import type { VFile } from 'vfile';
|
|
4
|
+
export declare const remarkImage: ({ docDirectory, remarkImageOptions, lint, }: {
|
|
5
|
+
docDirectory: string;
|
|
6
|
+
remarkImageOptions?: MarkdownOptions["image"];
|
|
7
|
+
lint?: boolean;
|
|
8
|
+
}) => (tree: Root, file: VFile) => void;
|