@rspress/core 2.0.20 → 2.0.22
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/cli/index.js +12 -13
- package/dist/config/loadConfigFile.d.ts +3 -4
- package/dist/config/loadConfigFile.js +13 -17
- package/dist/{7748~0.js → d~0.js} +0 -2
- package/dist/eject-theme/components/Banner/index.tsx +50 -9
- package/dist/eject-theme/components/Callout/index.scss +6 -1
- package/dist/eject-theme/components/CodeBlock/index.scss +2 -0
- package/dist/eject-theme/components/DocContent/doc.scss +2 -2
- package/dist/eject-theme/components/Link/getHref.test.ts +33 -0
- package/dist/eject-theme/components/Link/getHref.ts +60 -0
- package/dist/eject-theme/components/Link/index.tsx +7 -6
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +6 -51
- package/dist/eject-theme/components/Llms/LlmsHint.test.tsx +8 -0
- package/dist/eject-theme/components/Llms/LlmsHint.tsx +11 -3
- package/dist/eject-theme/components/Nav/NavMenu.scss +19 -3
- package/dist/eject-theme/components/Nav/NavMenu.tsx +20 -13
- package/dist/eject-theme/components/Nav/index.scss +3 -1
- package/dist/eject-theme/components/Nav/index.tsx +30 -4
- package/dist/eject-theme/components/NavHamburger/index.tsx +11 -3
- package/dist/eject-theme/components/NavList/context.ts +3 -0
- package/dist/eject-theme/components/NavList/index.tsx +24 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenu.test.tsx +59 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenu.tsx +43 -2
- package/dist/eject-theme/components/NavScreen/index.scss +0 -6
- package/dist/eject-theme/components/NavScreen/index.tsx +20 -3
- package/dist/eject-theme/components/Prompt/index.scss +2 -1
- package/dist/eject-theme/components/ReadPercent/useReadPercent.ts +1 -1
- package/dist/eject-theme/components/Search/SearchButton.scss +1 -0
- package/dist/eject-theme/components/Search/SearchPanel.scss +51 -12
- package/dist/eject-theme/components/Search/SearchPanel.tsx +54 -212
- package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +38 -16
- package/dist/eject-theme/components/Search/useSearchPanel.ts +216 -0
- package/dist/eject-theme/components/Steps/index.scss +1 -1
- package/dist/eject-theme/components/SwitchAppearance/getClipPath.test.ts +15 -0
- package/dist/eject-theme/components/SwitchAppearance/getClipPath.ts +26 -0
- package/dist/eject-theme/components/SwitchAppearance/global.scss +18 -0
- package/dist/eject-theme/components/SwitchAppearance/index.tsx +26 -35
- package/dist/eject-theme/components/Tabs/index.tsx +14 -14
- package/dist/index.js +1 -1
- package/dist/node/PluginDriver.d.ts +1 -1
- package/dist/node/PluginDriver.js +5 -9
- 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 +6 -6
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/build.d.ts +3 -2
- package/dist/node/build.js +9 -3
- package/dist/node/constants.js +1 -1
- package/dist/node/dev.d.ts +4 -4
- package/dist/node/dev.js +8 -6
- package/dist/node/eject.js +5 -5
- package/dist/node/initRsbuild.d.ts +2 -3
- package/dist/node/initRsbuild.js +9 -7
- package/dist/node/last-updated/index.js +2 -2
- package/dist/node/logger/hint.js +4 -4
- package/dist/node/mdx/options.js +1 -1
- package/dist/node/mdx/processor.js +3 -3
- 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/containerSyntax.js +6 -5
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +5 -5
- package/dist/node/mdx/remarkPlugins/image.js +5 -5
- package/dist/node/mdx/remarkPlugins/link.js +5 -5
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +6 -4
- package/dist/node/route/RouteService.js +3 -3
- package/dist/node/route/extractPageData.js +20 -7
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +5 -5
- 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.d.ts +3 -3
- package/dist/node/serve.js +10 -4
- package/dist/node/ssg/alternateLinks.js +1 -1
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderHtmlTemplate.js +1 -1
- package/dist/node/ssg/renderPage.js +5 -5
- package/dist/node/ssg/renderPageWorker.js +2 -2
- package/dist/node/ssg/renderPages.js +6 -6
- 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 +5 -5
- package/dist/node/ssg-md/renderPages.js +6 -6
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +5 -7
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/error.js +4 -4
- package/dist/node/utils/flattenMdxContent.js +2 -2
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/index.d.ts +1 -1
- package/dist/node/utils/reactAlias.js +5 -5
- package/dist/node/utils/slash.d.ts +1 -0
- package/dist/node/utils/slash.js +4 -0
- package/dist/{864~0.js → n~0.js} +41 -41
- package/dist/{2711~0.js → o~0.js} +90 -56
- package/dist/rslib-runtime~0.js +27 -35
- package/dist/theme/components/Banner/index.js +53 -9
- package/dist/theme/components/Callout/index.css +6 -1
- package/dist/theme/components/CodeBlock/index.css +2 -0
- package/dist/theme/components/DocContent/doc.css +2 -2
- package/dist/theme/components/Link/getHref.d.ts +8 -0
- package/dist/theme/components/Link/getHref.js +33 -0
- package/dist/theme/components/Link/index.js +7 -6
- package/dist/theme/components/Link/useLinkNavigate.d.ts +0 -7
- package/dist/theme/components/Link/useLinkNavigate.js +8 -32
- package/dist/theme/components/Llms/LlmsHint.js +23 -6
- package/dist/theme/components/Nav/NavMenu.css +18 -6
- package/dist/theme/components/Nav/NavMenu.d.ts +4 -2
- package/dist/theme/components/Nav/NavMenu.js +17 -9
- package/dist/theme/components/Nav/index.css +3 -1
- package/dist/theme/components/Nav/index.d.ts +7 -1
- package/dist/theme/components/Nav/index.js +13 -4
- package/dist/theme/components/NavHamburger/index.d.ts +2 -1
- package/dist/theme/components/NavHamburger/index.js +8 -2
- package/dist/theme/components/NavList/context.d.ts +1 -0
- package/dist/theme/components/NavList/context.js +3 -0
- package/dist/theme/components/NavList/index.d.ts +6 -0
- package/dist/theme/components/NavList/index.js +17 -0
- package/dist/theme/components/NavScreen/NavScreenMenu.d.ts +3 -2
- package/dist/theme/components/NavScreen/NavScreenMenu.js +42 -6
- package/dist/theme/components/NavScreen/index.css +0 -10
- package/dist/theme/components/NavScreen/index.d.ts +2 -1
- package/dist/theme/components/NavScreen/index.js +11 -3
- package/dist/theme/components/PackageManagerTabs/index.js +2 -2
- package/dist/theme/components/Prompt/index.css +2 -1
- package/dist/theme/components/ReadPercent/useReadPercent.js +1 -0
- package/dist/theme/components/Search/SearchButton.css +1 -0
- package/dist/theme/components/Search/SearchPanel.css +47 -9
- package/dist/theme/components/Search/SearchPanel.js +97 -205
- package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +1 -0
- package/dist/theme/components/Search/logic/providers/LocalProvider.js +23 -13
- package/dist/theme/components/Search/logic/search.js +1 -1
- package/dist/theme/components/Search/useSearchPanel.d.ts +23 -0
- package/dist/theme/components/Search/useSearchPanel.js +155 -0
- package/dist/theme/components/Steps/index.css +3 -3
- package/dist/theme/components/SwitchAppearance/getClipPath.d.ts +8 -0
- package/dist/theme/components/SwitchAppearance/getClipPath.js +13 -0
- package/dist/theme/components/SwitchAppearance/global.css +12 -0
- package/dist/theme/components/SwitchAppearance/index.js +11 -15
- package/dist/theme/components/Tabs/index.js +4 -4
- package/dist/theme/components/Tag/index.js +2 -2
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/layout/DocLayout/index.js +2 -2
- package/dist/theme/layout/Layout/index.js +12 -4
- package/dist/theme/logic/applyThemeToDOM.d.ts +2 -0
- package/dist/theme/logic/applyThemeToDOM.js +17 -0
- package/dist/theme/logic/useFullTextSearch.js +6 -1
- package/dist/theme/logic/useThemeState.d.ts +1 -2
- package/dist/theme/logic/useThemeState.js +1 -7
- package/dist/theme/styles/vars/shiki-vars.css +1 -1
- package/dist/tinypool~0.js +5 -3
- package/dist/{4538~0.js → t~0.js} +2 -2
- package/dist/{8472~0.js → v~0.js} +1 -1
- package/package.json +11 -12
- package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +0 -29
- package/dist/node/utils/normalizePath.d.ts +0 -3
- package/dist/node/utils/normalizePath.js +0 -10
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.d.ts +0 -2
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +0 -30
- package/dist/theme/logic/useHandler.d.ts +0 -6
- package/dist/theme/logic/useHandler.js +0 -7
- /package/dist/{9857~0.js → 4~0.js} +0 -0
- /package/dist/{8016~0.js → i~0.js} +0 -0
- /package/dist/{5357~0.js → r~0.js} +0 -0
- /package/dist/{102~0.js → t2~0.js} +0 -0
- /package/dist/{9940~0.js → tx~0.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../../
|
|
3
|
-
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withSiteOrigin, MDX_OR_MD_REGEXP, withBase } from "../../../
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../../rslib-runtime~0.js";
|
|
2
|
+
import "../../../t~0.js";
|
|
3
|
+
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withSiteOrigin, MDX_OR_MD_REGEXP, withBase } from "../../../r~0.js";
|
|
4
4
|
import { hintRelativeMarkdownLink } from "../../logger/hint.js";
|
|
5
5
|
import { createError } from "../../utils/error.js";
|
|
6
|
-
const picocolors =
|
|
7
|
-
var picocolors_default = /*#__PURE__*/
|
|
6
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
7
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
8
8
|
function createExcluder(checkOption) {
|
|
9
9
|
const excludes = 'object' == typeof checkOption ? checkOption.excludes : void 0;
|
|
10
10
|
const excludesUrl = Array.isArray(excludes) ? new Set(excludes) : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../
|
|
1
|
+
import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../d~0.js";
|
|
2
2
|
const extractChildText = (child, preserveInlineMarkdown = true)=>{
|
|
3
3
|
if ('link' === child.type) return child.children?.map((child)=>extractChildText(child, preserveInlineMarkdown)).join('') ?? '';
|
|
4
4
|
if ('strong' === child.type) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { node_path } from "../../
|
|
1
|
+
import { node_path } from "../../o~0.js";
|
|
2
2
|
import { RouteService } from "./RouteService.js";
|
|
3
|
-
import { normalizePath, slash } from "../utils/normalizePath.js";
|
|
4
3
|
import { getPageKey } from "../utils/getPageKey.js";
|
|
4
|
+
import { slash } from "../utils/slash.js";
|
|
5
5
|
class RoutePage {
|
|
6
6
|
routeMeta;
|
|
7
7
|
pageIndexInfo;
|
|
@@ -21,12 +21,13 @@ class RoutePage {
|
|
|
21
21
|
}
|
|
22
22
|
static generateRouteMeta(routePath, filepath, docDir) {
|
|
23
23
|
const routeService = RouteService.getInstance();
|
|
24
|
+
const absolutePath = node_path.normalize(filepath);
|
|
24
25
|
const { routePath: normalizedPath, lang, pureRoutePath, version } = routeService.normalizeRoutePath(routePath);
|
|
25
26
|
return {
|
|
26
27
|
routePath: normalizedPath,
|
|
27
28
|
pureRoutePath,
|
|
28
|
-
absolutePath
|
|
29
|
-
relativePath: absolutePathToRelativePath(
|
|
29
|
+
absolutePath,
|
|
30
|
+
relativePath: absolutePathToRelativePath(absolutePath, docDir),
|
|
30
31
|
pageName: getPageKey(routePath),
|
|
31
32
|
lang,
|
|
32
33
|
version
|
|
@@ -37,6 +38,7 @@ function absolutePathToRelativePath(absolutePath, docsDir) {
|
|
|
37
38
|
return slash(node_path.relative(docsDir, absolutePath));
|
|
38
39
|
}
|
|
39
40
|
function absolutePathToRouteMeta(absolutePath, docsDir, routeService = RouteService.getInstance()) {
|
|
41
|
+
absolutePath = node_path.normalize(absolutePath);
|
|
40
42
|
const relativePath = absolutePathToRelativePath(absolutePath, docsDir);
|
|
41
43
|
const { lang, pureRoutePath, routePath, version } = routeService.normalizeRoutePath(relativePath);
|
|
42
44
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../
|
|
1
|
+
import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../o~0.js";
|
|
2
2
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
3
3
|
import { createError } from "../utils/error.js";
|
|
4
4
|
import { getRouteChunkName } from "./routeChunkAssets.js";
|
|
@@ -103,7 +103,7 @@ class RouteService {
|
|
|
103
103
|
const { routeMeta: { routePath } } = routePage;
|
|
104
104
|
if (this.routeData.has(routePath)) throw createError(`routePath ${routePath} has already been added`);
|
|
105
105
|
this.routeData.set(routePath, routePage);
|
|
106
|
-
this.#routeDataByFilePath.set(
|
|
106
|
+
this.#routeDataByFilePath.set(routePage.routeMeta.absolutePath, routePage);
|
|
107
107
|
}
|
|
108
108
|
getRoutes() {
|
|
109
109
|
return Array.from(this.routeData.values()).map((i)=>i.routeMeta);
|
|
@@ -155,7 +155,7 @@ import React from 'react';
|
|
|
155
155
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
156
156
|
${routeMeta.map((route, index)=>{
|
|
157
157
|
const chunkName = getRouteChunkName(route);
|
|
158
|
-
return `const loadRoute${index} = () => import(/* webpackChunkName: "${chunkName}" */
|
|
158
|
+
return `const loadRoute${index} = () => import(/* webpackChunkName: "${chunkName}" */ ${JSON.stringify(route.absolutePath)})
|
|
159
159
|
const Route${index} = lazyWithPreload(loadRoute${index})`;
|
|
160
160
|
}).join('\n')}
|
|
161
161
|
export const routes = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path, promises, loadFrontMatter,
|
|
1
|
+
import { unified, node_path, promises, loadFrontMatter, extractTextAndId, remark_gfm, remark_parse, MDX_OR_MD_REGEXP } from "../../o~0.js";
|
|
2
2
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
3
3
|
import { flattenMdxContent } from "../utils/flattenMdxContent.js";
|
|
4
4
|
import { importStatementRegex } from "../constants.js";
|
|
@@ -34,21 +34,30 @@ const SEARCH_BLOCK_TYPES = new Set([
|
|
|
34
34
|
'listItem',
|
|
35
35
|
'tableRow'
|
|
36
36
|
]);
|
|
37
|
-
function extractSearchText(node, codeblocks) {
|
|
37
|
+
function extractSearchText(node, codeblocks, parentType) {
|
|
38
38
|
const { type } = node;
|
|
39
39
|
if (SEARCH_SKIP_TYPES.has(type)) return [];
|
|
40
40
|
if ('code' === type && !codeblocks) return [];
|
|
41
41
|
if ('break' === type) return [
|
|
42
42
|
'\n'
|
|
43
43
|
];
|
|
44
|
-
if ('
|
|
44
|
+
if ('inlineCode' === type) return [
|
|
45
45
|
node.value
|
|
46
46
|
];
|
|
47
|
-
if ('
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
if ('text' === type) {
|
|
48
|
+
const value = 'heading' === parentType ? extractTextAndId(node.value)[0] : node.value;
|
|
49
|
+
return [
|
|
50
|
+
stripSearchMarkdownMarkers(value)
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
if ('code' === type) {
|
|
54
|
+
const value = stripSearchMarkdownMarkers(node.value);
|
|
55
|
+
return value ? [
|
|
56
|
+
`\n${value}\n`
|
|
57
|
+
] : [];
|
|
58
|
+
}
|
|
50
59
|
const result = [];
|
|
51
|
-
if ('children' in node) for (const child of node.children)result.push(...extractSearchText(child, codeblocks));
|
|
60
|
+
if ('children' in node) for (const child of node.children)result.push(...extractSearchText(child, codeblocks, type));
|
|
52
61
|
if (SEARCH_BLOCK_TYPES.has(type)) result.push('\n');
|
|
53
62
|
if ('tableCell' === type) result.push('\t');
|
|
54
63
|
return result;
|
|
@@ -96,6 +105,10 @@ const SKIP_NODE_TYPES = new Set([
|
|
|
96
105
|
]);
|
|
97
106
|
const CONTAINER_DIRECTIVE_REGEX = /^\s*:::\s*(\w+)\s*(.*)?/;
|
|
98
107
|
const CONTAINER_DIRECTIVE_END_REGEX = /^\s*:::\s*$/;
|
|
108
|
+
const GITHUB_ALERT_MARKER_REGEX = /^\s*\[!\w+\]\s*$/;
|
|
109
|
+
function stripSearchMarkdownMarkers(text) {
|
|
110
|
+
return text.split('\n').filter((line)=>!CONTAINER_DIRECTIVE_REGEX.test(line) && !CONTAINER_DIRECTIVE_END_REGEX.test(line) && !GITHUB_ALERT_MARKER_REGEX.test(line)).join('\n');
|
|
111
|
+
}
|
|
99
112
|
function stripContainerDirectives(text) {
|
|
100
113
|
const lines = text.split('\n');
|
|
101
114
|
const result = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../
|
|
1
|
+
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../o~0.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 [
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
import { createRequire, join, logger } from "../../
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../t~0.js";
|
|
3
|
+
import { createRequire, join, logger } from "../../o~0.js";
|
|
4
4
|
import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
|
|
5
5
|
import { createError } from "../utils/error.js";
|
|
6
6
|
import { pathExists } from "../utils/fs.js";
|
|
7
|
-
const picocolors =
|
|
8
|
-
var picocolors_default = /*#__PURE__*/
|
|
7
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
9
9
|
const i18n_require = createRequire(import.meta.url);
|
|
10
10
|
const DEFAULT_I18N_SOURCE_PATH = join(process.cwd(), 'i18n.json');
|
|
11
11
|
function mergeI18nData(...sources) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SEARCH_INDEX_NAME, groupBy } from "../../../
|
|
1
|
+
import { SEARCH_INDEX_NAME, groupBy } from "../../../o~0.js";
|
|
2
2
|
import { extractPageData } from "../../route/extractPageData.js";
|
|
3
3
|
import { createHash } from "../../utils/createHash.js";
|
|
4
4
|
function deletePrivateField(obj) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, pluginVirtualModule } from "../../../
|
|
1
|
+
import { logger, pluginVirtualModule } from "../../../o~0.js";
|
|
2
2
|
import { createPageData } from "./createPageData.js";
|
|
3
3
|
const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
|
|
4
4
|
const ref = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getIconUrlPath } from "../../../
|
|
1
|
+
import { getIconUrlPath } from "../../../o~0.js";
|
|
2
2
|
import { normalizeThemeConfig } from "./normalizeThemeConfig.js";
|
|
3
3
|
async function createSiteData(userConfig) {
|
|
4
4
|
const tempSearchObj = Object.assign({}, userConfig.search);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../
|
|
1
|
+
import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../o~0.js";
|
|
2
2
|
import { getI18nData } from "../i18n.js";
|
|
3
3
|
import { applyReplaceRules } from "../../utils/applyReplaceRules.js";
|
|
4
4
|
async function normalizeThemeConfig(docConfig) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isProduction, logger } from "../../../
|
|
1
|
+
import { isProduction, logger } from "../../../o~0.js";
|
|
2
2
|
import { modifyConfigWithAutoNavSide } from "../../auto-nav-sidebar/index.js";
|
|
3
3
|
import { createSiteData } from "./createSiteData.js";
|
|
4
4
|
const siteDataVMPlugin = (context)=>{
|
package/dist/node/serve.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type RsbuildInstance } from '@rsbuild/core';
|
|
1
|
+
import { type LoadConfigResult, type RsbuildInstance } from '@rsbuild/core';
|
|
2
2
|
import type { UserConfig } from '@rspress/shared';
|
|
3
3
|
interface ServeOptions {
|
|
4
|
-
config: UserConfig
|
|
5
|
-
configFilePath
|
|
4
|
+
config: UserConfig | LoadConfigResult<UserConfig>;
|
|
5
|
+
configFilePath?: string;
|
|
6
6
|
port?: number;
|
|
7
7
|
host?: string;
|
|
8
8
|
}
|
package/dist/node/serve.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { mergeRsbuildConfig } from "../
|
|
1
|
+
import { mergeRsbuildConfig } from "../o~0.js";
|
|
2
|
+
import { normalizeConfigResult } from "../config/loadConfigFile.js";
|
|
2
3
|
import { PluginDriver } from "./PluginDriver.js";
|
|
3
4
|
import { initRsbuild } from "./initRsbuild.js";
|
|
4
5
|
import { RouteService } from "./route/RouteService.js";
|
|
5
6
|
async function serve(options) {
|
|
6
|
-
const {
|
|
7
|
+
const { port: userPort, host: userHost } = options;
|
|
8
|
+
const configResult = normalizeConfigResult(options.config, options.configFilePath);
|
|
9
|
+
const { content: config } = configResult;
|
|
7
10
|
const envPort = process.env.PORT;
|
|
8
11
|
const envHost = process.env.HOST;
|
|
9
12
|
const { builderConfig = {} } = config;
|
|
@@ -15,9 +18,12 @@ async function serve(options) {
|
|
|
15
18
|
host
|
|
16
19
|
}
|
|
17
20
|
});
|
|
18
|
-
const pluginDriver = await PluginDriver.create(
|
|
21
|
+
const pluginDriver = await PluginDriver.create(configResult.content, true);
|
|
19
22
|
const modifiedConfig = await pluginDriver.modifyConfig();
|
|
20
|
-
const rsbuild = await initRsbuild(config.root,
|
|
23
|
+
const rsbuild = await initRsbuild(config.root, {
|
|
24
|
+
...configResult,
|
|
25
|
+
content: modifiedConfig
|
|
26
|
+
}, pluginDriver, await RouteService.createSimple(), false);
|
|
21
27
|
return rsbuild.preview();
|
|
22
28
|
}
|
|
23
29
|
export { serve };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../
|
|
1
|
+
import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../o~0.js";
|
|
2
2
|
function createAlternateLinksByRoute(routes, config) {
|
|
3
3
|
const routeGroups = new Map();
|
|
4
4
|
for (const route of routes){
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { external_node_path_resolve, relative, isAbsolute } from "../../
|
|
1
|
+
import { external_node_path_resolve, relative, isAbsolute } from "../../v~0.js";
|
|
2
2
|
const routePath2HtmlFileName = (routePath)=>{
|
|
3
3
|
let fileName = routePath;
|
|
4
4
|
fileName = fileName.endsWith('/') ? `${routePath}index.html` : `${routePath}.html`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { posix } from "../../
|
|
1
|
+
import { posix } from "../../v~0.js";
|
|
2
2
|
import { META_GENERATOR, RSPRESS_VERSION, APP_HTML_MARKER, HEAD_MARKER } from "../constants.js";
|
|
3
3
|
import { routePath2HtmlFileName } from "./htmlFile.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../t~0.js";
|
|
3
|
+
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../v~0.js";
|
|
4
4
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
5
5
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
6
|
-
const picocolors =
|
|
7
|
-
var picocolors_default = /*#__PURE__*/
|
|
6
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
7
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
8
8
|
async function renderPage(route, htmlTemplate, configHead, ssrBundlePath, alternateLinks = [], routeChunkAssets) {
|
|
9
9
|
let render;
|
|
10
10
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { writeFile, mkdir, dirname, workerData } from "../../
|
|
1
|
+
import { writeFile, mkdir, dirname, workerData } from "../../4~0.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
3
|
import { resolveHtmlFilePath } from "./htmlFile.js";
|
|
4
|
-
import { pMap } from "../../
|
|
4
|
+
import { pMap } from "../../v~0.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
const params = workerData?.[1]?.params;
|
|
7
7
|
if (!params) throw createError('SSG Worker Thread workerData params missing');
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*! LICENSE: renderPages.js.LICENSE.txt */
|
|
2
|
-
import {
|
|
3
|
-
import "../../
|
|
4
|
-
import { node_path, fileURLToPath, logger, chunk } from "../../
|
|
2
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
3
|
+
import "../../t~0.js";
|
|
4
|
+
import { node_path, fileURLToPath, logger, chunk } from "../../o~0.js";
|
|
5
5
|
import { createAlternateLinksByRoute } from "./alternateLinks.js";
|
|
6
6
|
import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
|
|
7
7
|
import { routePath2HtmlFileName } from "./htmlFile.js";
|
|
8
|
-
import { pMap } from "../../
|
|
8
|
+
import { pMap } from "../../v~0.js";
|
|
9
9
|
import { renderPage } from "./renderPage.js";
|
|
10
10
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
11
11
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
12
|
-
const picocolors =
|
|
13
|
-
var picocolors_default = /*#__PURE__*/
|
|
12
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
13
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
14
14
|
async function renderPages(routeService, config, ssrBundlePath, htmlTemplate, emitAsset, workerOutputDistPath, routeChunkAssets) {
|
|
15
15
|
const startTime = Date.now();
|
|
16
16
|
const ssg = config.ssg ?? true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../o~0.js";
|
|
2
2
|
import { NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME } from "../constants.js";
|
|
3
3
|
import { renderPages } from "./renderPages.js";
|
|
4
4
|
const rsbuildPluginSSG = ({ routeService, config, routeChunkAssets })=>({
|
package/dist/node/ssg/ssgEnv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! LICENSE: ssgEnv.js.LICENSE.txt */
|
|
2
|
-
import { node_os } from "../../
|
|
2
|
+
import { node_os } from "../../o~0.js";
|
|
3
3
|
/**
|
|
4
4
|
* these codes are copied from
|
|
5
5
|
* @link https://github.com/facebook/docusaurus/blob/45065e8d2b5831117b8d69fec1be28f5520cf105/packages/docusaurus/src/ssg/ssgEnv.ts#L11
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { matchPath, getSidebarDataGroup } from "../../../
|
|
1
|
+
import { matchPath, getSidebarDataGroup } from "../../../o~0.js";
|
|
2
2
|
import { generateLlmsTxt, generateLlmsFullTxt } from "./llmsTxt.js";
|
|
3
3
|
async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
|
|
4
4
|
const base = config.base ?? '/';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../
|
|
1
|
+
import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../o~0.js";
|
|
2
2
|
import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
|
|
3
3
|
function routePathToMdPath(routePath, base, siteOrigin) {
|
|
4
4
|
let url = routePath;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
import { createHead, pathToFileURL, logger } from "../../
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../t~0.js";
|
|
3
|
+
import { createHead, pathToFileURL, logger } from "../../o~0.js";
|
|
4
4
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
5
|
-
const picocolors =
|
|
6
|
-
var picocolors_default = /*#__PURE__*/
|
|
5
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
7
7
|
async function renderPage(route, ssrBundlePath) {
|
|
8
8
|
let render;
|
|
9
9
|
try {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
import { logger } from "../../
|
|
4
|
-
import { pMap } from "../../
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../t~0.js";
|
|
3
|
+
import { logger } from "../../o~0.js";
|
|
4
|
+
import { pMap } from "../../v~0.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
import { SSGConcurrency } from "../ssg/ssgEnv.js";
|
|
7
|
-
const picocolors =
|
|
8
|
-
var picocolors_default = /*#__PURE__*/
|
|
7
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
9
9
|
const routePage2MdFilename = (routePath)=>{
|
|
10
10
|
let fileName = routePath;
|
|
11
11
|
fileName = fileName.endsWith('/') ? `${routePath}index.md` : `${routePath}.md`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { writeFile, mkdir, rm, join, isDebugMode } from "../../o~0.js";
|
|
2
2
|
import { NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME } from "../constants.js";
|
|
3
3
|
import { renderPages } from "./renderPages.js";
|
|
4
4
|
import { emitLlmsTxt } from "./llms/emitLlmsTxt.js";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { node_path, logger, promises } from "../../
|
|
1
|
+
import { node_path, logger, promises } from "../../o~0.js";
|
|
2
|
+
import { slash } from "./slash.js";
|
|
2
3
|
import { createError } from "./error.js";
|
|
3
|
-
function normalizePath(filePath) {
|
|
4
|
-
return filePath.split(node_path.sep).join('/');
|
|
5
|
-
}
|
|
6
4
|
async function getAllMarkdownFilesFrom(dirPath) {
|
|
7
5
|
const files = await promises.readdir(dirPath, {
|
|
8
6
|
withFileTypes: true
|
|
@@ -28,7 +26,7 @@ async function collectModuleFiles(contentPath, lang, includedDir, excludedDirs,
|
|
|
28
26
|
if (!moduleDirStats.isDirectory()) return fileLangMap;
|
|
29
27
|
const files = await getAllMarkdownFilesFrom(langModuleDir);
|
|
30
28
|
for (const file of files){
|
|
31
|
-
const relativePath =
|
|
29
|
+
const relativePath = slash(node_path.relative(langDirPath, file));
|
|
32
30
|
if (excludedDirs.some((excludedDir)=>{
|
|
33
31
|
const isFilePath = /\.(md|mdx)$/.test(excludedDir);
|
|
34
32
|
return relativePath.includes(excludedDir + (isFilePath ? '' : '/'));
|
|
@@ -39,7 +37,7 @@ async function collectModuleFiles(contentPath, lang, includedDir, excludedDirs,
|
|
|
39
37
|
}
|
|
40
38
|
} catch (e) {
|
|
41
39
|
logger.error(e);
|
|
42
|
-
throw createError(`Failed to access directory: ${
|
|
40
|
+
throw createError(`Failed to access directory: ${slash(langModuleDir)}`);
|
|
43
41
|
}
|
|
44
42
|
return fileLangMap;
|
|
45
43
|
}
|
|
@@ -67,7 +65,7 @@ async function checkLanguageParity(config) {
|
|
|
67
65
|
});
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
if (missingLanguagesFile.length > 0) throw createError(`Check language parity failed! Missing content:\n${missingLanguagesFile.map((file)=>` - ${
|
|
68
|
+
if (missingLanguagesFile.length > 0) throw createError(`Check language parity failed! Missing content:\n${missingLanguagesFile.map((file)=>` - ${slash(file)}`).join('\n')}`);
|
|
71
69
|
logger.success('Language parity checked successfully.');
|
|
72
70
|
} catch (err) {
|
|
73
71
|
logger.error('Error during language parity check: \n', err);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHash as external_node_crypto_createHash } from "../../
|
|
1
|
+
import { createHash as external_node_crypto_createHash } from "../../o~0.js";
|
|
2
2
|
function createHash(str, length = 8) {
|
|
3
3
|
return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, length);
|
|
4
4
|
}
|
package/dist/node/utils/error.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
const picocolors =
|
|
4
|
-
var picocolors_default = /*#__PURE__*/
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../t~0.js";
|
|
3
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
4
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
5
5
|
function createError(message, maxStackLines = 5) {
|
|
6
6
|
const error = new Error(message);
|
|
7
7
|
if (error.stack) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../
|
|
1
|
+
import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../o~0.js";
|
|
2
2
|
import { createError } from "./error.js";
|
|
3
3
|
import { importStatementRegex } from "../constants.js";
|
|
4
4
|
const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
|
|
@@ -15,7 +15,7 @@ async function resolveDepPath(moduleSpecifier, importer, alias) {
|
|
|
15
15
|
});
|
|
16
16
|
const resolved = await resolver.async(importer, moduleSpecifier);
|
|
17
17
|
if (resolved.path) return resolved.path;
|
|
18
|
-
throw createError(`Empty result when resolving ${moduleSpecifier} from ${importer}`);
|
|
18
|
+
else throw createError(`Empty result when resolving ${moduleSpecifier} from ${importer}`);
|
|
19
19
|
}
|
|
20
20
|
async function flattenMdxContent(content, basePath, alias) {
|
|
21
21
|
const deps = [];
|
package/dist/node/utils/fs.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
3
|
-
import { node_path, core_rspack, logger } from "../../
|
|
1
|
+
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../t~0.js";
|
|
3
|
+
import { node_path, core_rspack, logger } from "../../o~0.js";
|
|
4
4
|
import { pathExists, readJson } from "./fs.js";
|
|
5
5
|
import { PACKAGE_ROOT } from "../constants.js";
|
|
6
6
|
import { hintReactVersion } from "../logger/hint.js";
|
|
7
|
-
const picocolors =
|
|
8
|
-
var picocolors_default = /*#__PURE__*/
|
|
7
|
+
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
|
+
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
9
9
|
const Resolver = core_rspack.experiments.resolver.ResolverFactory;
|
|
10
10
|
async function detectPackageMajorVersion(name) {
|
|
11
11
|
const cwd = process.cwd();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function slash(p: string): string;
|