@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
|
@@ -1,10 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
+
import "../../../8006.js";
|
|
3
|
+
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../2240.js";
|
|
4
|
+
import { createError } from "../../utils/error.js";
|
|
5
|
+
import { PUBLIC_DIR } from "../../constants.js";
|
|
2
6
|
import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
|
|
7
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
3
9
|
const normalizeImageUrl = (imageUrl)=>{
|
|
4
10
|
if (isExternalUrl(imageUrl) || imageUrl.startsWith('/')) return '';
|
|
5
11
|
return imageUrl;
|
|
6
12
|
};
|
|
7
|
-
|
|
13
|
+
function image_checkDeadImages(checkDeadImages, deadImages, file, lint) {
|
|
14
|
+
const errorInfos = [];
|
|
15
|
+
const excludes = 'object' == typeof checkDeadImages ? checkDeadImages.excludes : void 0;
|
|
16
|
+
const excludesUrl = Array.isArray(excludes) ? new Set(excludes) : void 0;
|
|
17
|
+
const excludesFn = 'function' == typeof excludes ? excludes : void 0;
|
|
18
|
+
[
|
|
19
|
+
...deadImages.entries()
|
|
20
|
+
].forEach(([imageUrl, resolvedPath])=>{
|
|
21
|
+
if (excludesUrl?.has(imageUrl)) return;
|
|
22
|
+
if (excludesFn?.(imageUrl)) return;
|
|
23
|
+
errorInfos.push([
|
|
24
|
+
imageUrl,
|
|
25
|
+
resolvedPath
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
if (errorInfos.length > 0) {
|
|
29
|
+
const message = `Dead images found${lint ? '' : ` in ${picocolors_default().cyan(file.path)}`}:
|
|
30
|
+
${errorInfos.map(([imageUrl, resolved])=>` ${picocolors_default().green(`""`)} ${picocolors_default().gray(resolved)}`).join('\n')}`;
|
|
31
|
+
if (lint) file.message(message);
|
|
32
|
+
else {
|
|
33
|
+
logger.error(message);
|
|
34
|
+
if (isProduction()) throw createError('Dead image found');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function resolveImage(imageUrl, filePath, docDirectory, deadImages) {
|
|
39
|
+
if (!imageUrl) return;
|
|
40
|
+
if (isExternalUrl(imageUrl)) return;
|
|
41
|
+
if (isDataUrl(imageUrl)) return;
|
|
42
|
+
const { url } = parseUrl(imageUrl);
|
|
43
|
+
if (url.startsWith('/')) {
|
|
44
|
+
const resolvedPath = node_path.join(docDirectory, PUBLIC_DIR, url);
|
|
45
|
+
if (!existsSync(resolvedPath)) deadImages.set(imageUrl, resolvedPath);
|
|
46
|
+
} else {
|
|
47
|
+
const resolvedPath = node_path.resolve(node_path.dirname(filePath), url);
|
|
48
|
+
if (!existsSync(resolvedPath)) deadImages.set(imageUrl, resolvedPath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const remarkImage = ({ docDirectory, remarkImageOptions, lint })=>(tree, file)=>{
|
|
52
|
+
const { checkDeadImages: shouldCheckDeadImages = true } = remarkImageOptions ?? {};
|
|
53
|
+
const deadImages = new Map();
|
|
8
54
|
const images = [];
|
|
9
55
|
const getMdxSrcAttribute = (tempVar)=>({
|
|
10
56
|
type: 'mdxJsxAttribute',
|
|
@@ -32,6 +78,7 @@ const remarkImage = ()=>(tree, _file)=>{
|
|
|
32
78
|
visit(tree, 'image', (node)=>{
|
|
33
79
|
const { alt, url } = node;
|
|
34
80
|
if (!url) return;
|
|
81
|
+
if (shouldCheckDeadImages) resolveImage(url, file.path, docDirectory, deadImages);
|
|
35
82
|
const imagePath = normalizeImageUrl(url);
|
|
36
83
|
if (!imagePath) return;
|
|
37
84
|
const tempVariableName = `image${images.length}`;
|
|
@@ -54,6 +101,7 @@ const remarkImage = ()=>(tree, _file)=>{
|
|
|
54
101
|
if ('mdxJsxFlowElement' !== node.type && 'mdxJsxTextElement' !== node.type || 'img' !== node.name) return;
|
|
55
102
|
const srcAttr = getNodeAttribute(node, 'src', true);
|
|
56
103
|
if ('string' != typeof srcAttr?.value) return;
|
|
104
|
+
if (shouldCheckDeadImages) resolveImage(srcAttr.value, file.path, docDirectory, deadImages);
|
|
57
105
|
const imagePath = normalizeImageUrl(srcAttr.value);
|
|
58
106
|
if (!imagePath) return;
|
|
59
107
|
const tempVariableName = `image${images.length}`;
|
|
@@ -61,5 +109,6 @@ const remarkImage = ()=>(tree, _file)=>{
|
|
|
61
109
|
images.push(getDefaultImportAstNode(tempVariableName, imagePath));
|
|
62
110
|
});
|
|
63
111
|
tree.children.unshift(...images);
|
|
112
|
+
if (shouldCheckDeadImages) image_checkDeadImages(shouldCheckDeadImages, deadImages, file, lint);
|
|
64
113
|
};
|
|
65
114
|
export { remarkImage };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
+
import "../../../8006.js";
|
|
3
|
+
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withBase } from "../../../3425.js";
|
|
2
4
|
import { hintRelativeMarkdownLink } from "../../logger/hint.js";
|
|
3
5
|
import { createError } from "../../utils/error.js";
|
|
6
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
7
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
4
8
|
function link_checkDeadLinks(checkDeadLinks, internalLinks, file, lint) {
|
|
5
9
|
const errorInfos = [];
|
|
6
10
|
const excludes = 'object' == typeof checkDeadLinks ? checkDeadLinks.excludes : void 0;
|
|
@@ -20,8 +24,8 @@ function link_checkDeadLinks(checkDeadLinks, internalLinks, file, lint) {
|
|
|
20
24
|
});
|
|
21
25
|
if (errorInfos.length > 0) {
|
|
22
26
|
if (possibleBreakingChange) hintRelativeMarkdownLink();
|
|
23
|
-
const message = `Dead links found${lint ? '' : ` in ${
|
|
24
|
-
${errorInfos.map(([nodeUrl, link])=>` ${
|
|
27
|
+
const message = `Dead links found${lint ? '' : ` in ${picocolors_default().cyan(file.path)}`}:
|
|
28
|
+
${errorInfos.map(([nodeUrl, link])=>` ${picocolors_default().green(`"[..](${nodeUrl})"`)} ${picocolors_default().gray(link)}`).join('\n')}`;
|
|
25
29
|
if (lint) file.message(message);
|
|
26
30
|
else {
|
|
27
31
|
logger.error(message);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { github_slugger, visitChildren, extractTextAndId } from "../../../
|
|
1
|
+
import { github_slugger, visitChildren, extractTextAndId } from "../../../3294.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,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 "../../740.js";
|
|
2
2
|
import { PUBLIC_DIR } from "../constants.js";
|
|
3
3
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path,
|
|
1
|
+
import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../740.js";
|
|
2
2
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
3
3
|
import { flattenMdxContent } from "../utils/flattenMdxContent.js";
|
|
4
4
|
import { importStatementRegex } from "../constants.js";
|
|
@@ -14,17 +14,9 @@ const remarkRemoveCodeBlocks = ()=>(tree)=>{
|
|
|
14
14
|
const remarkRemoveImages = ()=>(tree)=>{
|
|
15
15
|
remove(tree, 'image');
|
|
16
16
|
};
|
|
17
|
-
const
|
|
18
|
-
visit(tree, 'link', (node)=>{
|
|
19
|
-
node.url = '';
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
const createProcessor = (searchCodeBlocks)=>unified().use(remark_parse).use(remark_gfm).use(remarkRemoveImages).use(remarkStripLinkUrls).use(searchCodeBlocks ? [] : [
|
|
17
|
+
const createProcessor = (searchCodeBlocks)=>unified().use(remark_parse).use(remark_gfm).use(remarkRemoveImages).use(searchCodeBlocks ? [] : [
|
|
23
18
|
remarkRemoveCodeBlocks
|
|
24
|
-
])
|
|
25
|
-
bullet: '-',
|
|
26
|
-
listItemIndent: 'one'
|
|
27
|
-
});
|
|
19
|
+
]);
|
|
28
20
|
const processorWithCode = createProcessor(true);
|
|
29
21
|
const processorWithoutCode = createProcessor(false);
|
|
30
22
|
function extractTextFromNode(node) {
|
|
@@ -32,6 +24,77 @@ function extractTextFromNode(node) {
|
|
|
32
24
|
if ('children' in node && Array.isArray(node.children)) return node.children.map(extractTextFromNode).join('');
|
|
33
25
|
return '';
|
|
34
26
|
}
|
|
27
|
+
const SEARCH_SKIP_TYPES = new Set([
|
|
28
|
+
'image',
|
|
29
|
+
'imageReference',
|
|
30
|
+
'definition',
|
|
31
|
+
'footnoteDefinition',
|
|
32
|
+
'footnoteReference',
|
|
33
|
+
'html',
|
|
34
|
+
'thematicBreak',
|
|
35
|
+
'mdxJsxFlowElement',
|
|
36
|
+
'mdxJsxTextElement',
|
|
37
|
+
'mdxFlowExpression',
|
|
38
|
+
'mdxTextExpression',
|
|
39
|
+
'mdxjsEsm'
|
|
40
|
+
]);
|
|
41
|
+
const SEARCH_BLOCK_TYPES = new Set([
|
|
42
|
+
'paragraph',
|
|
43
|
+
'heading',
|
|
44
|
+
'listItem',
|
|
45
|
+
'tableRow'
|
|
46
|
+
]);
|
|
47
|
+
function extractSearchText(node, codeblocks) {
|
|
48
|
+
const { type } = node;
|
|
49
|
+
if (SEARCH_SKIP_TYPES.has(type)) return [];
|
|
50
|
+
if ('code' === type && !codeblocks) return [];
|
|
51
|
+
if ('break' === type) return [
|
|
52
|
+
'\n'
|
|
53
|
+
];
|
|
54
|
+
if ('text' === type || 'inlineCode' === type) return [
|
|
55
|
+
node.value
|
|
56
|
+
];
|
|
57
|
+
if ('code' === type) return [
|
|
58
|
+
`\n${node.value}\n`
|
|
59
|
+
];
|
|
60
|
+
const result = [];
|
|
61
|
+
if ('children' in node) for (const child of node.children)result.push(...extractSearchText(child, codeblocks));
|
|
62
|
+
if (SEARCH_BLOCK_TYPES.has(type)) result.push('\n');
|
|
63
|
+
if ('tableCell' === type) result.push('\t');
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
function buildSearchContent(tree, rawToc, codeblocks) {
|
|
67
|
+
const parts = [];
|
|
68
|
+
const headingCharIndexes = [];
|
|
69
|
+
let tocIndex = 0;
|
|
70
|
+
let contentLength = 0;
|
|
71
|
+
let skippedFirstH1 = false;
|
|
72
|
+
for (const node of tree.children){
|
|
73
|
+
if ('heading' === node.type && 1 === node.depth && !skippedFirstH1) {
|
|
74
|
+
skippedFirstH1 = true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const text = extractSearchText(node, codeblocks).join('').replaceAll('\t\n', '\n').trim();
|
|
78
|
+
if (text) {
|
|
79
|
+
if (parts.length > 0) contentLength += 2;
|
|
80
|
+
if ('heading' === node.type && node.depth >= 2 && node.depth < 5) {
|
|
81
|
+
if (tocIndex < rawToc.length) {
|
|
82
|
+
headingCharIndexes.push(contentLength);
|
|
83
|
+
tocIndex++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
contentLength += text.length;
|
|
87
|
+
parts.push(text);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
content: parts.join('\n\n'),
|
|
92
|
+
toc: rawToc.map((item, index)=>({
|
|
93
|
+
...item,
|
|
94
|
+
charIndex: index < headingCharIndexes.length ? headingCharIndexes[index] : -1
|
|
95
|
+
}))
|
|
96
|
+
};
|
|
97
|
+
}
|
|
35
98
|
const SKIP_NODE_TYPES = new Set([
|
|
36
99
|
'code',
|
|
37
100
|
'html',
|
|
@@ -121,21 +184,7 @@ async function getPageIndexInfoByRoute(route, options) {
|
|
|
121
184
|
}
|
|
122
185
|
};
|
|
123
186
|
const processedTree = await processor.run(tree);
|
|
124
|
-
|
|
125
|
-
if (processedContent.startsWith(`# ${title}`)) processedContent = processedContent.slice(`# ${title}`.length).trimStart();
|
|
126
|
-
const toc = rawToc.map((item)=>{
|
|
127
|
-
const match = item.id.match(/-(\d+)$/);
|
|
128
|
-
const headingPrefix = '#'.repeat(item.depth);
|
|
129
|
-
let position = -1;
|
|
130
|
-
if (match) for(let i = 0; i < Number(match[1]); i++){
|
|
131
|
-
position = processedContent.indexOf(`${headingPrefix} ${item.text}`, position + 1);
|
|
132
|
-
if (-1 === position) break;
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
...item,
|
|
136
|
-
charIndex: processedContent.indexOf(`${headingPrefix} ${item.text}`, position + 1)
|
|
137
|
-
};
|
|
138
|
-
});
|
|
187
|
+
const { content: processedContent, toc } = buildSearchContent(processedTree, rawToc, searchCodeBlocks);
|
|
139
188
|
return {
|
|
140
189
|
...defaultIndexInfo,
|
|
141
190
|
title: frontmatter.title || title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../
|
|
1
|
+
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../740.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,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
import { external_node_module_createRequire, join, logger } from "../../740.js";
|
|
2
4
|
import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
|
|
3
5
|
import { createError } from "../utils/error.js";
|
|
4
6
|
import { pathExists } from "../utils/fs.js";
|
|
5
|
-
const
|
|
7
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
9
|
+
const i18n_require = external_node_module_createRequire(import.meta.url);
|
|
6
10
|
const DEFAULT_I18N_SOURCE_PATH = join(process.cwd(), 'i18n.json');
|
|
7
11
|
function mergeI18nData(...sources) {
|
|
8
12
|
const result = {};
|
|
@@ -39,7 +43,7 @@ async function getI18nData(docConfig, pluginDriver) {
|
|
|
39
43
|
throw e;
|
|
40
44
|
}
|
|
41
45
|
else i18nSourceFull = mergeI18nData(i18nSourceFull, i18nSource);
|
|
42
|
-
const cyan =
|
|
46
|
+
const cyan = picocolors_default().cyan;
|
|
43
47
|
const filteredI18nSource = {};
|
|
44
48
|
for(const key in i18nSourceFull){
|
|
45
49
|
filteredI18nSource[key] = {};
|
|
@@ -50,19 +54,19 @@ async function getI18nData(docConfig, pluginDriver) {
|
|
|
50
54
|
if (enText) filteredI18nSource[key][lang] = enText;
|
|
51
55
|
else {
|
|
52
56
|
logger.error(`${logPrefix} i18n key ${cyan(key)} has no text for lang ${cyan(lang)}, and no fallback ${cyan('en')} text either.`);
|
|
53
|
-
throw createError(`i18n text missing for ${
|
|
57
|
+
throw createError(`i18n text missing for ${picocolors_default().cyan(key)}`);
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
if (logKeys.size > 0 && !logged) {
|
|
58
62
|
logger.warn(`${logPrefix} The following i18n keys are missing for some languages and have fallen back to 'en':
|
|
59
|
-
${
|
|
63
|
+
${picocolors_default().gray(JSON.stringify(Object.fromEntries([
|
|
60
64
|
...logKeys.keys()
|
|
61
65
|
].map((i)=>[
|
|
62
66
|
i,
|
|
63
67
|
'...'
|
|
64
68
|
])), null, 2))}
|
|
65
|
-
You can provide translations via ${
|
|
69
|
+
You can provide translations via ${picocolors_default().cyan('i18n.json')} file or ${picocolors_default().cyan('i18nSource')} config in rspress.config.ts`);
|
|
66
70
|
logged = true;
|
|
67
71
|
}
|
|
68
72
|
return filteredI18nSource;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SEARCH_INDEX_NAME, groupBy } from "../../../
|
|
1
|
+
import { SEARCH_INDEX_NAME, groupBy } from "../../../740.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 "../../../740.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 "../../../740.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 "../../../740.js";
|
|
2
2
|
import { getI18nData } from "../i18n.js";
|
|
3
3
|
import { applyReplaceRules } from "../../utils/applyReplaceRules.js";
|
|
4
4
|
async function normalizeThemeConfig(docConfig) {
|
package/dist/node/serve.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../1688.js";
|
|
2
4
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
3
5
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
6
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
7
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
4
8
|
async function renderPage(route, htmlTemplate, configHead, ssrBundlePath) {
|
|
5
9
|
let render;
|
|
6
10
|
try {
|
|
@@ -9,7 +13,7 @@ async function renderPage(route, htmlTemplate, configHead, ssrBundlePath) {
|
|
|
9
13
|
render = ssrExports.render;
|
|
10
14
|
} catch (e) {
|
|
11
15
|
if (e instanceof Error) {
|
|
12
|
-
logger.error(`Failed to load SSG bundle: ${
|
|
16
|
+
logger.error(`Failed to load SSG bundle: ${picocolors_default().yellow(ssrBundlePath)}: ${e.message}`);
|
|
13
17
|
logger.debug(e);
|
|
14
18
|
hintSSGFailed();
|
|
15
19
|
}
|
|
@@ -22,8 +26,8 @@ async function renderPage(route, htmlTemplate, configHead, ssrBundlePath) {
|
|
|
22
26
|
({ appHtml } = await render(routePath, head));
|
|
23
27
|
} catch (e) {
|
|
24
28
|
if (e instanceof Error) {
|
|
25
|
-
logger.error(`Page "${
|
|
26
|
-
${absolutePath ?
|
|
29
|
+
logger.error(`Page "${picocolors_default().yellow(routePath)}" SSG rendering failed.
|
|
30
|
+
${absolutePath ? picocolors_default().gray(` File: ${absolutePath}\n`) : ''} ${picocolors_default().gray(e.toString())}`);
|
|
27
31
|
throw e;
|
|
28
32
|
}
|
|
29
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { workerData } from "../../9224.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
|
-
import { pMap } from "../../
|
|
3
|
+
import { pMap } from "../../1688.js";
|
|
4
4
|
import { renderPage } from "./renderPage.js";
|
|
5
5
|
const params = workerData?.[1]?.params;
|
|
6
6
|
if (!params) throw createError('SSG Worker Thread workerData params missing');
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/*! LICENSE: renderPages.js.LICENSE.txt */
|
|
2
|
-
import {
|
|
2
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
3
|
+
import "../../8006.js";
|
|
4
|
+
import { chunk, logger } from "../../740.js";
|
|
3
5
|
import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
|
|
4
|
-
import { pMap } from "../../
|
|
6
|
+
import { pMap } from "../../1688.js";
|
|
5
7
|
import { renderPage } from "./renderPage.js";
|
|
6
8
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
7
9
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
10
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
11
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
8
12
|
const routePath2HtmlFileName = (routePath)=>{
|
|
9
13
|
let fileName = routePath;
|
|
10
14
|
fileName = fileName.endsWith('/') ? `${routePath}index.html` : `${routePath}.html`;
|
|
@@ -36,7 +40,7 @@ async function renderPages(routeService, config, ssrBundlePath, htmlTemplate, em
|
|
|
36
40
|
const MAX_DISPLAY_ROUTES = 10;
|
|
37
41
|
const displayedRoutes = csrRoutePaths.slice(0, MAX_DISPLAY_ROUTES);
|
|
38
42
|
const remainingCount = csrRoutePaths.length - MAX_DISPLAY_ROUTES;
|
|
39
|
-
logger.info(`Some routes (${
|
|
43
|
+
logger.info(`Some routes (${picocolors_default().yellow(csrRoutePaths.length)} total) are ignored in SSG and fallback to CSR via \`ssg.experimentalExcludeRoutePaths\`: ${picocolors_default().yellow(displayedRoutes.join(', '))}${remainingCount > 0 ? picocolors_default().dim(` ... and ${remainingCount} more`) : ''}`);
|
|
40
44
|
await Promise.all(promiseList);
|
|
41
45
|
routes.length = 0;
|
|
42
46
|
routes.push(...ssgRoutes);
|
|
@@ -44,7 +48,7 @@ async function renderPages(routeService, config, ssrBundlePath, htmlTemplate, em
|
|
|
44
48
|
}
|
|
45
49
|
if ('object' == typeof ssg && ssg?.experimentalWorker) {
|
|
46
50
|
const numberOfThreads = getNumberOfThreads(routes.length);
|
|
47
|
-
const Tinypool = await import("tinypool").then((m)=>m.default);
|
|
51
|
+
const Tinypool = await import("../../0~tinypool.js").then((m)=>m.default);
|
|
48
52
|
const pool = new Tinypool({
|
|
49
53
|
filename: new URL('./renderPageWorker.js', import.meta.url).href,
|
|
50
54
|
concurrentTasksPerWorker: 1,
|
|
@@ -83,7 +87,7 @@ async function renderPages(routeService, config, ssrBundlePath, htmlTemplate, em
|
|
|
83
87
|
concurrency: SSGConcurrency()
|
|
84
88
|
});
|
|
85
89
|
const totalTime = Date.now() - startTime;
|
|
86
|
-
logger.success(`Pages rendered in ${
|
|
90
|
+
logger.success(`Pages rendered in ${picocolors_default().yellow(totalTime)} ms.`);
|
|
87
91
|
} catch (e) {
|
|
88
92
|
if (e instanceof Error) {
|
|
89
93
|
logger.error(`Pages render error: ${e.message}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../740.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 })=>({
|
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 "../../740.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 "../../../740.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, logger, withBase } from "../../../
|
|
1
|
+
import { normalizeHref, logger, withBase } from "../../../740.js";
|
|
2
2
|
import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
|
|
3
3
|
function routePathToMdPath(routePath, base) {
|
|
4
4
|
let url = routePath;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
import { createHead, pathToFileURL, logger } from "../../740.js";
|
|
2
4
|
import { hintSSGFailed } from "../logger/hint.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
|
async function renderPage(route, ssrBundlePath) {
|
|
4
8
|
let render;
|
|
5
9
|
try {
|
|
@@ -8,7 +12,7 @@ async function renderPage(route, ssrBundlePath) {
|
|
|
8
12
|
render = ssrExports.render;
|
|
9
13
|
} catch (e) {
|
|
10
14
|
if (e instanceof Error) {
|
|
11
|
-
logger.error(`Failed to load SSG bundle: ${
|
|
15
|
+
logger.error(`Failed to load SSG bundle: ${picocolors_default().yellow(ssrBundlePath)}: ${e.message}`);
|
|
12
16
|
logger.debug(e);
|
|
13
17
|
hintSSGFailed();
|
|
14
18
|
}
|
|
@@ -21,8 +25,8 @@ async function renderPage(route, ssrBundlePath) {
|
|
|
21
25
|
({ appMd } = await render(routePath, head));
|
|
22
26
|
} catch (e) {
|
|
23
27
|
if (e instanceof Error) {
|
|
24
|
-
logger.error(`Page "${
|
|
25
|
-
${absolutePath ?
|
|
28
|
+
logger.error(`Page "${picocolors_default().yellow(routePath)}" SSG-MD rendering failed.
|
|
29
|
+
${absolutePath ? picocolors_default().gray(` File: ${absolutePath}\n`) : ''} ${picocolors_default().gray(e.toString())}`);
|
|
26
30
|
throw e;
|
|
27
31
|
}
|
|
28
32
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
import { logger } from "../../740.js";
|
|
4
|
+
import { pMap } from "../../1688.js";
|
|
3
5
|
import { renderPage } from "./renderPage.js";
|
|
4
6
|
import { SSGConcurrency } from "../ssg/ssgEnv.js";
|
|
7
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
5
9
|
const routePage2MdFilename = (routePath)=>{
|
|
6
10
|
let fileName = routePath;
|
|
7
11
|
fileName = fileName.endsWith('/') ? `${routePath}index.md` : `${routePath}.md`;
|
|
@@ -21,7 +25,7 @@ async function renderPages(routeService, ssrBundlePath, emitAsset) {
|
|
|
21
25
|
concurrency: SSGConcurrency()
|
|
22
26
|
});
|
|
23
27
|
const totalTime = Date.now() - startTime;
|
|
24
|
-
logger.success(`Markdown rendered in ${
|
|
28
|
+
logger.success(`Markdown rendered in ${picocolors_default().yellow(totalTime)} ms.`);
|
|
25
29
|
return result;
|
|
26
30
|
}
|
|
27
31
|
export { renderPages };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { writeFile, mkdir, rm, join, isDebugMode } from "../../740.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,4 +1,4 @@
|
|
|
1
|
-
import { createHash as external_node_crypto_createHash } from "../../
|
|
1
|
+
import { createHash as external_node_crypto_createHash } from "../../740.js";
|
|
2
2
|
function createHash(str) {
|
|
3
3
|
return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
|
|
4
4
|
}
|
package/dist/node/utils/error.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
+
import "../../8006.js";
|
|
3
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
4
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
2
5
|
function createError(message, maxStackLines = 5) {
|
|
3
6
|
const error = new Error(message);
|
|
4
7
|
if (error.stack) {
|
|
5
8
|
const lines = error.stack.split('\n');
|
|
6
|
-
if (lines.length > maxStackLines + 1) error.stack = `${lines.slice(0, maxStackLines + 1).map((line)=>
|
|
9
|
+
if (lines.length > maxStackLines + 1) error.stack = `${lines.slice(0, maxStackLines + 1).map((line)=>picocolors_default().gray(line)).join('\n')}\n ${picocolors_default().gray('... (truncated)')}`;
|
|
7
10
|
}
|
|
8
11
|
return error;
|
|
9
12
|
}
|
|
@@ -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 "../../740.js";
|
|
2
2
|
import { createError } from "./error.js";
|
|
3
3
|
import { importStatementRegex } from "../constants.js";
|
|
4
4
|
const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
|
package/dist/node/utils/fs.js
CHANGED