@rspress/core 2.1.4 → 2.1.5
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/bb~0.js +1 -0
- package/dist/b~0.js +3026 -1
- package/dist/cli/index.js +1 -1
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/HomeFeature/index.scss +12 -0
- package/dist/eject-theme/components/Sidebar/SidebarGroup.scss +14 -0
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +6 -1
- package/dist/eject-theme/components/Sidebar/SidebarItem.scss +0 -10
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +2 -2
- 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 +1 -1
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/eject.js +1 -1
- package/dist/node/initRsbuild.js +1 -1
- package/dist/node/mdx/options.js +1 -1
- package/dist/node/mdx/processor.js +1 -1
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/remarkPlugins/builtin.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 +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n/getI18nData.js +1 -1
- package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +1 -1
- 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/sitemap.js +1 -1
- package/dist/node/ssg/alternateLinks.js +1 -1
- package/dist/node/ssg/renderPages.js +1 -1
- 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.d.ts +0 -4
- package/dist/node/ssg-md/remarkSplitMdx.js +266 -163
- package/dist/node/ssg-md/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +1 -1
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/reactAlias.js +1 -1
- package/dist/{tx~0.js → q~0.js} +3 -3
- package/dist/shiki-transformers.js +1 -1
- package/dist/theme/components/HomeFeature/index.css +10 -0
- package/dist/theme/components/Sidebar/SidebarGroup.css +14 -0
- package/dist/theme/components/Sidebar/SidebarGroup.js +29 -22
- package/dist/theme/components/Sidebar/SidebarItem.css +0 -10
- package/dist/theme/components/Sidebar/SidebarItem.js +2 -2
- package/dist/y~0.js +1 -1
- package/package.json +10 -7
- package/skills/rspress-best-practices/SKILL.md +82 -0
- package/skills/rspress-custom-theme/SKILL.md +242 -0
- package/skills/rspress-custom-theme/references/css-variables.md +177 -0
- package/skills/rspress-custom-theme/references/eject-components.md +154 -0
- package/skills/rspress-custom-theme/references/layout-slots.md +153 -0
- package/skills/rspress-description-generator/SKILL.md +118 -0
- package/skills/rspress-docs-generator/SKILL.md +60 -0
- package/skills/rspress-docs-generator/references/create-new-docs.md +73 -0
- package/skills/rspress-docs-generator/references/doc-structure-conventions.md +117 -0
- package/skills/rspress-docs-generator/references/maintain-docs-for-prs.md +31 -0
- package/skills/rspress-docs-generator/references/rspress-version-guard.md +13 -0
- package/dist/8~0.js +0 -3033
|
@@ -1,157 +1,250 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gfmToMarkdown, toMarkdown, mdxToMarkdown } from "../../q~0.js";
|
|
2
2
|
function remarkSplitMdx(options = {}) {
|
|
3
3
|
return (tree)=>{
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const context = {
|
|
5
|
+
...prepareTree(tree),
|
|
6
|
+
options
|
|
7
|
+
};
|
|
8
|
+
const writer = new MarkdownWriter(context);
|
|
9
|
+
writer.flow(tree.children);
|
|
10
|
+
tree.children = [
|
|
11
|
+
...context.esmNodes,
|
|
12
|
+
{
|
|
13
|
+
type: 'mdxJsxFlowElement',
|
|
14
|
+
name: null,
|
|
15
|
+
attributes: [],
|
|
16
|
+
children: writer.finish()
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
newChildren.push(processJsxElement(node, importMap, options));
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
const hasJsxChildren = node.children?.some((child)=>'mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type || 'mdxFlowExpression' === child.type || 'mdxTextExpression' === child.type);
|
|
18
|
-
if (hasJsxChildren) {
|
|
19
|
-
const processedChildren = processMixedContent(node, node.children || [], importMap, options);
|
|
20
|
-
newChildren.push({
|
|
21
|
-
type: 'mdxJsxFlowElement',
|
|
22
|
-
name: null,
|
|
23
|
-
attributes: [],
|
|
24
|
-
children: processedChildren
|
|
25
|
-
});
|
|
26
|
-
} else newChildren.push(buildMdxFlowExpressionFragment(node));
|
|
27
|
-
}
|
|
28
|
-
tree.children = newChildren;
|
|
18
|
+
];
|
|
29
19
|
};
|
|
30
20
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let textBuffer = [];
|
|
42
|
-
const flushTextBuffer = ()=>{
|
|
43
|
-
if (0 === textBuffer.length) return;
|
|
44
|
-
const combined = textBuffer.map((child)=>serializeNodeToMarkdown(child)).join('');
|
|
45
|
-
if (combined) processedChildren.push(createTextExpression(combined));
|
|
46
|
-
textBuffer = [];
|
|
47
|
-
};
|
|
48
|
-
for (const child of node.children)if ('mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type) {
|
|
49
|
-
flushTextBuffer();
|
|
50
|
-
processedChildren.push(processJsxElement(child, importMap, options));
|
|
51
|
-
} else if ('mdxFlowExpression' === child.type || 'mdxTextExpression' === child.type) {
|
|
52
|
-
flushTextBuffer();
|
|
53
|
-
processedChildren.push(child);
|
|
54
|
-
} else textBuffer.push(child);
|
|
55
|
-
flushTextBuffer();
|
|
56
|
-
return {
|
|
57
|
-
...node,
|
|
58
|
-
children: processedChildren
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function getComponentName(name) {
|
|
62
|
-
if (!name) return null;
|
|
63
|
-
if ('string' == typeof name) {
|
|
64
|
-
const dotIndex = name.indexOf('.');
|
|
65
|
-
if (dotIndex > 0) return name.substring(0, dotIndex);
|
|
66
|
-
return name;
|
|
21
|
+
class MarkdownWriter {
|
|
22
|
+
text = '';
|
|
23
|
+
output = [];
|
|
24
|
+
lineStart = true;
|
|
25
|
+
prefix = '';
|
|
26
|
+
inTable = false;
|
|
27
|
+
isLiteralText = false;
|
|
28
|
+
context;
|
|
29
|
+
constructor(context){
|
|
30
|
+
this.context = context;
|
|
67
31
|
}
|
|
68
|
-
|
|
69
|
-
if (
|
|
32
|
+
write(value) {
|
|
33
|
+
if (!value) return;
|
|
34
|
+
if (this.inTable) value = value.replace(/(?<!\\)\|/g, '\\|');
|
|
35
|
+
if (!this.prefix) {
|
|
36
|
+
this.text += value;
|
|
37
|
+
this.lineStart = value.endsWith('\n');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
for (const line of value.split(/(?<=\n)/)){
|
|
41
|
+
if (!line) continue;
|
|
42
|
+
const prefix = '\n' === line ? this.prefix.includes('>') ? this.prefix.trimEnd() : '' : this.prefix;
|
|
43
|
+
this.text += (this.lineStart ? prefix : '') + line;
|
|
44
|
+
this.lineStart = line.endsWith('\n');
|
|
45
|
+
}
|
|
70
46
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let textBuffer = [];
|
|
76
|
-
const prefix = 'heading' === parentNode.type ? `${'#'.repeat(parentNode.depth || 1)} ` : '';
|
|
77
|
-
let prefixAdded = false;
|
|
78
|
-
const flushTextBuffer = ()=>{
|
|
79
|
-
if (textBuffer.length > 0) {
|
|
80
|
-
let combined = textBuffer.join('');
|
|
81
|
-
if (!prefixAdded && prefix) {
|
|
82
|
-
combined = prefix + combined;
|
|
83
|
-
prefixAdded = true;
|
|
84
|
-
}
|
|
85
|
-
if (combined) result.push(createTextExpression(combined));
|
|
86
|
-
textBuffer = [];
|
|
87
|
-
} else if (!prefixAdded && prefix) {
|
|
88
|
-
result.push(createTextExpression(prefix.trimEnd()));
|
|
89
|
-
prefixAdded = true;
|
|
47
|
+
emit(node) {
|
|
48
|
+
if (this.lineStart) {
|
|
49
|
+
this.text += this.prefix;
|
|
50
|
+
this.lineStart = false;
|
|
90
51
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const stringified = JSON.stringify(textContent);
|
|
112
|
-
const fragment = {
|
|
113
|
-
type: 'mdxFlowExpression',
|
|
114
|
-
value: stringified,
|
|
115
|
-
data: {
|
|
116
|
-
estree: {
|
|
117
|
-
type: 'Program',
|
|
118
|
-
body: [
|
|
119
|
-
{
|
|
120
|
-
type: 'ExpressionStatement',
|
|
121
|
-
expression: {
|
|
122
|
-
type: 'Literal',
|
|
123
|
-
value: textContent,
|
|
124
|
-
raw: stringified
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
],
|
|
128
|
-
sourceType: 'module'
|
|
52
|
+
if (this.text) {
|
|
53
|
+
this.output.push(createTextExpression(this.text));
|
|
54
|
+
this.text = '';
|
|
55
|
+
}
|
|
56
|
+
this.output.push(node);
|
|
57
|
+
}
|
|
58
|
+
finish() {
|
|
59
|
+
if (this.text) this.output.push(createTextExpression(this.text));
|
|
60
|
+
return this.output;
|
|
61
|
+
}
|
|
62
|
+
flow(children) {
|
|
63
|
+
if (this.isLiteralText) return void this.phrasing(children);
|
|
64
|
+
let markdown = [];
|
|
65
|
+
let afterMdx = false;
|
|
66
|
+
const flush = (beforeMdx = false)=>{
|
|
67
|
+
if (!markdown.length) return;
|
|
68
|
+
if (markdown.every((node)=>!this.context.mixedNodes.has(node))) this.write(stringifyMarkdown(markdown));
|
|
69
|
+
else {
|
|
70
|
+
this.blocks(markdown);
|
|
71
|
+
this.write('\n');
|
|
129
72
|
}
|
|
73
|
+
if (beforeMdx) this.write('\n');
|
|
74
|
+
markdown = [];
|
|
75
|
+
};
|
|
76
|
+
for (const node of children)if ('mdxjsEsm' !== node.type) {
|
|
77
|
+
if (afterMdx) this.write('\n');
|
|
78
|
+
afterMdx = isMdxNode(node);
|
|
79
|
+
if (afterMdx) {
|
|
80
|
+
flush(true);
|
|
81
|
+
this.node(node);
|
|
82
|
+
} else markdown.push(node);
|
|
130
83
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
84
|
+
flush();
|
|
85
|
+
}
|
|
86
|
+
blocks(children, separator = '\n\n') {
|
|
87
|
+
children.forEach((node, index)=>{
|
|
88
|
+
if (index) this.write(separator);
|
|
89
|
+
this.node(node, isMdxNode(node));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
phrasing(children) {
|
|
93
|
+
for (const child of children)this.node(child, true);
|
|
94
|
+
}
|
|
95
|
+
indented(prefix, action) {
|
|
96
|
+
const previous = this.prefix;
|
|
97
|
+
this.prefix += prefix;
|
|
98
|
+
action();
|
|
99
|
+
this.prefix = previous;
|
|
100
|
+
}
|
|
101
|
+
jsx(node) {
|
|
102
|
+
if (!shouldKeepJsxElement(node.name, this.context.importMap, this.context.options)) {
|
|
103
|
+
if (node.children.length) {
|
|
104
|
+
this.write(serializeOpeningTag(node));
|
|
105
|
+
if ('mdxJsxTextElement' === node.type) this.phrasing(node.children);
|
|
106
|
+
else this.flow(node.children);
|
|
107
|
+
this.write(serializeClosingTag(node));
|
|
108
|
+
} else this.write(stringifyMarkdown([
|
|
109
|
+
node
|
|
110
|
+
]).replace(/\n$/, ''));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!node.children.length) return node;
|
|
114
|
+
const writer = new MarkdownWriter(this.context);
|
|
115
|
+
writer.inTable = this.inTable;
|
|
116
|
+
writer.isLiteralText = this.isLiteralText || 'code' === node.name || 'pre' === node.name;
|
|
117
|
+
if ('mdxJsxTextElement' === node.type) writer.phrasing(node.children);
|
|
118
|
+
else writer.flow(node.children);
|
|
119
|
+
return {
|
|
120
|
+
...node,
|
|
121
|
+
children: writer.finish()
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
node(node, inline = false) {
|
|
125
|
+
if (isMdxNode(node)) {
|
|
126
|
+
const processed = isJsxNode(node) ? this.jsx(node) : node;
|
|
127
|
+
if (!processed) return;
|
|
128
|
+
this.emit(inline || 'mdxJsxTextElement' === node.type || 'mdxTextExpression' === node.type ? inlineNode(processed) : processed);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if ((inline || this.isLiteralText) && 'text' === node.type) return void this.write(this.isLiteralText ? node.value : node.value.replace(/[\\`*_[\]<>~]/g, '\\$&'));
|
|
132
|
+
if (this.isLiteralText && 'paragraph' === node.type) return void this.phrasing(node.children);
|
|
133
|
+
if (!this.context.mixedNodes.has(node)) return void this.write(stringifyMarkdown([
|
|
134
|
+
node
|
|
135
|
+
]).replace(/\n$/, ''));
|
|
136
|
+
switch(node.type){
|
|
137
|
+
case 'paragraph':
|
|
138
|
+
this.phrasing(node.children);
|
|
139
|
+
break;
|
|
140
|
+
case 'heading':
|
|
141
|
+
this.write('#'.repeat(node.depth) + ' ');
|
|
142
|
+
this.phrasing(node.children);
|
|
143
|
+
break;
|
|
144
|
+
case 'emphasis':
|
|
145
|
+
this.wrap('_', node.children);
|
|
146
|
+
break;
|
|
147
|
+
case 'strong':
|
|
148
|
+
this.wrap('**', node.children);
|
|
149
|
+
break;
|
|
150
|
+
case 'delete':
|
|
151
|
+
this.wrap('~~', node.children);
|
|
152
|
+
break;
|
|
153
|
+
case 'link':
|
|
154
|
+
{
|
|
155
|
+
this.write('[');
|
|
156
|
+
this.phrasing(node.children);
|
|
157
|
+
const link = stringifyMarkdown([
|
|
158
|
+
{
|
|
159
|
+
...node,
|
|
160
|
+
children: [
|
|
161
|
+
{
|
|
162
|
+
type: 'text',
|
|
163
|
+
value: 'label'
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
]);
|
|
168
|
+
this.write(link.slice(link.indexOf(']')).replace(/\n$/, ''));
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case 'linkReference':
|
|
172
|
+
this.write('[');
|
|
173
|
+
this.phrasing(node.children);
|
|
174
|
+
this.write(']' + ('full' === node.referenceType ? '[' + escapeLabel(node.label ?? node.identifier) + ']' : 'collapsed' === node.referenceType ? '[]' : ''));
|
|
175
|
+
break;
|
|
176
|
+
case 'blockquote':
|
|
177
|
+
this.indented('> ', ()=>this.blocks(node.children));
|
|
178
|
+
break;
|
|
179
|
+
case 'list':
|
|
180
|
+
this.list(node);
|
|
181
|
+
break;
|
|
182
|
+
case 'footnoteDefinition':
|
|
183
|
+
this.write('[^' + escapeLabel(node.label ?? node.identifier) + ']: ');
|
|
184
|
+
this.indented(' ', ()=>this.blocks(node.children));
|
|
185
|
+
break;
|
|
186
|
+
case 'table':
|
|
187
|
+
this.table(node);
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
throw new Error('[SSG-MD] Unsupported mixed Markdown node: ' + node.type);
|
|
144
191
|
}
|
|
145
192
|
}
|
|
146
|
-
|
|
147
|
-
|
|
193
|
+
wrap(marker, children) {
|
|
194
|
+
this.write(marker);
|
|
195
|
+
this.phrasing(children);
|
|
196
|
+
this.write(marker);
|
|
197
|
+
}
|
|
198
|
+
list(node) {
|
|
199
|
+
node.children.forEach((item, index)=>{
|
|
200
|
+
if (index) this.write(node.spread ? '\n\n' : '\n');
|
|
201
|
+
const marker = node.ordered ? `${(node.start ?? 1) + index}. ` : '- ';
|
|
202
|
+
this.write(marker);
|
|
203
|
+
this.indented(' '.repeat(marker.length), ()=>{
|
|
204
|
+
if ('boolean' == typeof item.checked) this.write(item.checked ? '[x] ' : '[ ] ');
|
|
205
|
+
this.blocks(item.children, item.spread ? '\n\n' : '\n');
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
table(node) {
|
|
210
|
+
node.children.forEach((row, index)=>{
|
|
211
|
+
if (index) this.write('\n');
|
|
212
|
+
this.write('| ');
|
|
213
|
+
row.children.forEach((cell, column)=>{
|
|
214
|
+
if (column) this.write(' | ');
|
|
215
|
+
this.inTable = true;
|
|
216
|
+
this.phrasing(cell.children);
|
|
217
|
+
this.inTable = false;
|
|
218
|
+
});
|
|
219
|
+
this.write(' |');
|
|
220
|
+
if (!index) {
|
|
221
|
+
const alignments = node.align ?? row.children.map(()=>null);
|
|
222
|
+
this.write('\n| ' + alignments.map((align)=>'center' === align ? ':---:' : 'left' === align ? ':---' : 'right' === align ? '---:' : '---').join(' | ') + ' |');
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function inlineNode(node) {
|
|
148
228
|
return {
|
|
149
|
-
type: '
|
|
150
|
-
name:
|
|
229
|
+
type: 'mdxJsxTextElement',
|
|
230
|
+
name: 'span',
|
|
151
231
|
attributes: [],
|
|
152
|
-
|
|
232
|
+
data: {
|
|
233
|
+
_mdxExplicitJsx: true
|
|
234
|
+
},
|
|
235
|
+
children: [
|
|
236
|
+
node
|
|
237
|
+
]
|
|
153
238
|
};
|
|
154
239
|
}
|
|
240
|
+
function escapeLabel(value) {
|
|
241
|
+
return value.replace(/[\\[\]]/g, '\\$&');
|
|
242
|
+
}
|
|
243
|
+
function getComponentName(name) {
|
|
244
|
+
if (!name) return null;
|
|
245
|
+
const dot = name.indexOf('.');
|
|
246
|
+
return -1 === dot ? name : name.slice(0, dot);
|
|
247
|
+
}
|
|
155
248
|
function createTextExpression(text) {
|
|
156
249
|
const stringified = JSON.stringify(text);
|
|
157
250
|
return {
|
|
@@ -193,49 +286,59 @@ function serializeClosingTag(node) {
|
|
|
193
286
|
if (!name) return '';
|
|
194
287
|
return `</${name}>`;
|
|
195
288
|
}
|
|
196
|
-
const
|
|
289
|
+
const mdxExtension = mdxToMarkdown();
|
|
290
|
+
const markdownOptions = {
|
|
197
291
|
bullet: '-',
|
|
198
292
|
emphasis: '_',
|
|
199
293
|
fences: true,
|
|
200
294
|
incrementListMarker: true,
|
|
295
|
+
extensions: [
|
|
296
|
+
mdxExtension,
|
|
297
|
+
gfmToMarkdown()
|
|
298
|
+
],
|
|
201
299
|
handlers: {
|
|
202
300
|
mdxjsEsm: ()=>''
|
|
203
301
|
}
|
|
204
|
-
}
|
|
205
|
-
function
|
|
206
|
-
|
|
302
|
+
};
|
|
303
|
+
function stringifyMarkdown(children) {
|
|
304
|
+
return toMarkdown({
|
|
207
305
|
type: 'root',
|
|
208
|
-
children
|
|
209
|
-
|
|
210
|
-
]
|
|
211
|
-
};
|
|
212
|
-
const result = processor.stringify(tempRoot);
|
|
213
|
-
return result;
|
|
306
|
+
children
|
|
307
|
+
}, markdownOptions);
|
|
214
308
|
}
|
|
215
|
-
function
|
|
309
|
+
function prepareTree(tree) {
|
|
216
310
|
const importMap = new Map();
|
|
217
311
|
const esmNodes = new Set();
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const source = statement.source.value;
|
|
225
|
-
for (const specifier of statement.specifiers){
|
|
226
|
-
const localName = specifier.local?.name;
|
|
227
|
-
if (localName) importMap.set(localName, source);
|
|
228
|
-
}
|
|
312
|
+
const mixedNodes = new WeakSet();
|
|
313
|
+
const scan = (node)=>{
|
|
314
|
+
if ('mdxjsEsm' === node.type) {
|
|
315
|
+
esmNodes.add(node);
|
|
316
|
+
for (const statement of node.data?.estree?.body ?? [])if ('ImportDeclaration' === statement.type) for (const specifier of statement.specifiers)importMap.set(specifier.local.name, String(statement.source.value));
|
|
317
|
+
return false;
|
|
229
318
|
}
|
|
230
|
-
|
|
319
|
+
let mixed = isMdxNode(node);
|
|
320
|
+
if ('children' in node) {
|
|
321
|
+
for (const child of node.children)if (scan(child)) mixed = true;
|
|
322
|
+
}
|
|
323
|
+
if (mixed && 'root' !== node.type) mixedNodes.add(node);
|
|
324
|
+
return mixed;
|
|
325
|
+
};
|
|
326
|
+
scan(tree);
|
|
231
327
|
return {
|
|
232
328
|
importMap,
|
|
233
|
-
esmNodes
|
|
329
|
+
esmNodes,
|
|
330
|
+
mixedNodes
|
|
234
331
|
};
|
|
235
332
|
}
|
|
333
|
+
function isJsxNode(node) {
|
|
334
|
+
return 'mdxJsxFlowElement' === node.type || 'mdxJsxTextElement' === node.type;
|
|
335
|
+
}
|
|
336
|
+
function isMdxNode(node) {
|
|
337
|
+
return isJsxNode(node) || 'mdxFlowExpression' === node.type || 'mdxTextExpression' === node.type;
|
|
338
|
+
}
|
|
236
339
|
function shouldKeepJsxElement(nameField, importMap, options) {
|
|
237
340
|
const componentName = getComponentName(nameField);
|
|
238
|
-
if (!componentName) return true;
|
|
341
|
+
if (!componentName || importMap.get(componentName)?.endsWith('.mdx')) return true;
|
|
239
342
|
const { includes, excludes } = options;
|
|
240
343
|
const importSource = importMap.get(componentName);
|
|
241
344
|
if (!includes && !excludes) return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { createHead, pathToFileURL, logger } from "../../
|
|
3
|
+
import { createHead, pathToFileURL, logger } from "../../b~0.js";
|
|
4
4
|
import { hintSSGMDFailed } from "../logger/hint.js";
|
|
5
5
|
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
6
|
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { logger } from "../../
|
|
3
|
+
import { logger } from "../../b~0.js";
|
|
4
4
|
import { pMap } from "../../y~0.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
import { SSGConcurrency } from "../ssg/ssgEnv.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { writeFile, mkdir, rm, join, isDebugMode } from "../../b~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,4 +1,4 @@
|
|
|
1
|
-
import { createHash as external_node_crypto_createHash } from "../../
|
|
1
|
+
import { createHash as external_node_crypto_createHash } from "../../b~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
|
}
|
|
@@ -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 "../../b~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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { node_path, core_rspack, logger } from "../../
|
|
3
|
+
import { node_path, core_rspack, logger } from "../../b~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";
|
package/dist/{tx~0.js → q~0.js}
RENAMED
|
@@ -7,9 +7,9 @@ export { default as rehype_raw } from "rehype-raw";
|
|
|
7
7
|
export { default as remark_cjk_friendly } from "remark-cjk-friendly";
|
|
8
8
|
export { default as remark_cjk_friendly_gfm_strikethrough } from "remark-cjk-friendly-gfm-strikethrough";
|
|
9
9
|
export { default as remark_gfm } from "remark-gfm";
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
10
|
+
export { gfmToMarkdown } from "mdast-util-gfm";
|
|
11
|
+
export { toMarkdown } from "mdast-util-to-markdown";
|
|
12
|
+
export { mdxToMarkdown } from "mdast-util-mdx";
|
|
13
13
|
export { visit } from "unist-util-visit";
|
|
14
14
|
export { default as github_slugger } from "@rspress/shared/github-slugger";
|
|
15
15
|
export { headingRank } from "hast-util-heading-rank";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transformerNotationDiff, transformerNotationWordHighlight, transformerNotationFocus, transformerNotationErrorLevel, transformerRemoveNotationEscape, transformerNotationHighlight } from "./
|
|
1
|
+
import { transformerNotationDiff, transformerNotationWordHighlight, transformerNotationFocus, transformerNotationErrorLevel, transformerRemoveNotationEscape, transformerNotationHighlight } from "./bb~0.js";
|
|
2
2
|
import "./node/mdx/rehypePlugins/transformers/index.js";
|
|
3
3
|
export * from "@shikijs/transformers";
|
|
4
4
|
function getShikiTransformers(transformers = []) {
|
|
@@ -49,6 +49,16 @@
|
|
|
49
49
|
position: relative;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
@media (prefers-reduced-motion: reduce) {
|
|
53
|
+
.rp-home-feature__item, .rp-home-feature__item-wrapper {
|
|
54
|
+
transform: none !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rp-home-feature__item__shine {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
.rp-home-feature__card {
|
|
53
63
|
border: 1px solid var(--rp-c-divider-light);
|
|
54
64
|
background: var(--rp-home-feature-bg);
|
|
@@ -2,3 +2,17 @@
|
|
|
2
2
|
color: var(--rp-c-text-1);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.rp-sidebar-group__items {
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rp-sidebar-group__line {
|
|
11
|
+
background-color: var(--rp-c-divider-light);
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
width: 1px;
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -70,28 +70,35 @@ function SidebarGroup(props) {
|
|
|
70
70
|
gridTemplateRows: collapsed ? '0fr' : '1fr',
|
|
71
71
|
transition: 'grid-template-rows 0.2s ease-out'
|
|
72
72
|
},
|
|
73
|
-
children: /*#__PURE__*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
73
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
74
|
+
className: "rp-sidebar-group__items",
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ jsx("span", {
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
className: "rp-sidebar-group__line",
|
|
79
|
+
style: {
|
|
80
|
+
left: (depth + 1) * 20 - 7
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
item.items?.map((item, index)=>isSidebarGroup(item) ? /*#__PURE__*/ jsx(SidebarGroup, {
|
|
84
|
+
id: `${id}-${index}`,
|
|
85
|
+
depth: depth + 1,
|
|
86
|
+
item: item,
|
|
87
|
+
setSidebarData: setSidebarData,
|
|
88
|
+
className: "rp-sidebar-item--group-item"
|
|
89
|
+
}, `${id}-${index}`) : isSidebarDivider(item) ? /*#__PURE__*/ jsx(SidebarDivider, {
|
|
90
|
+
depth: depth + 1,
|
|
91
|
+
dividerType: item.dividerType
|
|
92
|
+
}, index) : isSidebarSectionHeader(item) ? /*#__PURE__*/ jsx(SidebarSectionHeader, {
|
|
93
|
+
icon: item.icon,
|
|
94
|
+
sectionHeaderText: item.sectionHeaderText,
|
|
95
|
+
tag: item.tag
|
|
96
|
+
}, index) : /*#__PURE__*/ jsx(SidebarItem, {
|
|
97
|
+
item: item,
|
|
98
|
+
depth: depth + 1,
|
|
99
|
+
className: "rp-sidebar-item--group-item"
|
|
100
|
+
}, index))
|
|
101
|
+
]
|
|
95
102
|
})
|
|
96
103
|
})
|
|
97
104
|
]
|