@rspress/core 2.0.0-rc.2 → 2.0.0-rc.4

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.
Files changed (172) hide show
  1. package/dist/{0~7675.989ee664.js → 0~7675.723d12b2.js} +18 -15
  2. package/dist/{5313.6594aba0.js → 3521.9eb6b114.js} +12 -19
  3. package/dist/4669.69cb6b18.js +1 -0
  4. package/dist/{5485.2a0273cf.js → 5485.9fc7f63d.js} +5 -5
  5. package/dist/6289.29817fb4.js +4 -0
  6. package/dist/8813.4b28f4bb.js +1 -0
  7. package/dist/9643.2dff683e.js +4 -0
  8. package/dist/_private/react/render.js +17 -4
  9. package/dist/cli/config/loadConfigFile.js +2 -2
  10. package/dist/cli/index.44f3184c.js +2 -0
  11. package/dist/cli/index.js +3 -3
  12. package/dist/eject-theme/components/Badge/index.scss +1 -0
  13. package/dist/eject-theme/components/Banner/index.tsx +3 -1
  14. package/dist/eject-theme/components/Callout/index.tsx +8 -2
  15. package/dist/eject-theme/components/CodeBlock/index.scss +8 -6
  16. package/dist/eject-theme/components/CodeBlock/index.tsx +4 -0
  17. package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +50 -11
  18. package/dist/eject-theme/components/DocContent/doc.scss +1 -1
  19. package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +2 -1
  20. package/dist/eject-theme/components/DocContent/index.tsx +21 -4
  21. package/dist/eject-theme/components/DocFooter/index.tsx +1 -6
  22. package/dist/eject-theme/components/HoverGroup/index.scss +4 -3
  23. package/dist/eject-theme/components/HoverGroup/index.tsx +104 -22
  24. package/dist/eject-theme/components/LastUpdated/index.tsx +8 -1
  25. package/dist/eject-theme/components/Link/index.tsx +9 -2
  26. package/dist/eject-theme/components/Nav/NavMenu.scss +1 -1
  27. package/dist/eject-theme/components/Nav/NavMenu.tsx +50 -28
  28. package/dist/eject-theme/components/NavScreen/NavScreenLangs.scss +6 -0
  29. package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +23 -9
  30. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +26 -11
  31. package/dist/eject-theme/components/NavScreen/NavScreenVersions.scss +6 -0
  32. package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +22 -9
  33. package/dist/eject-theme/components/Overview/index.tsx +66 -6
  34. package/dist/eject-theme/components/{Overview/OverviewGroup.scss → OverviewGroup/index.scss} +66 -12
  35. package/dist/eject-theme/components/{Overview/OverviewGroup.tsx → OverviewGroup/index.tsx} +50 -3
  36. package/dist/eject-theme/components/Search/logic/util.test.ts +1 -1
  37. package/dist/eject-theme/components/Tabs/index.scss +12 -4
  38. package/dist/eject-theme/components/Tabs/index.tsx +16 -0
  39. package/dist/eject-theme/components/Tag/index.tsx +84 -5
  40. package/dist/index.js +7 -11
  41. package/dist/node/PluginDriver.js +5 -6
  42. package/dist/node/auto-nav-sidebar/index.js +3 -3
  43. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  44. package/dist/node/auto-nav-sidebar/normalize.js +12 -10
  45. package/dist/node/auto-nav-sidebar/utils.js +2 -2
  46. package/dist/node/auto-nav-sidebar/walk.js +13 -9
  47. package/dist/node/constants.d.ts +1 -0
  48. package/dist/node/constants.js +4 -3
  49. package/dist/node/eject.js +7 -10
  50. package/dist/node/initRsbuild.js +25 -11
  51. package/dist/node/last-updated/index.js +1 -1
  52. package/dist/node/logger/hint.js +1 -1
  53. package/dist/node/mdx/loader.7c249a26.js +12 -0
  54. package/dist/node/mdx/loader.js +2 -1
  55. package/dist/node/mdx/options.js +9 -6
  56. package/dist/node/mdx/processor.js +2 -2
  57. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  58. package/dist/node/mdx/rehypePlugins/headerAnchor.js +4 -4
  59. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  60. package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -5
  61. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  62. package/dist/node/mdx/remarkPlugins/containerSyntax.js +1 -1
  63. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +3 -3
  64. package/dist/node/mdx/remarkPlugins/image.js +3 -3
  65. package/dist/node/mdx/remarkPlugins/link.js +3 -3
  66. package/dist/node/mdx/remarkPlugins/toc.js +3 -3
  67. package/dist/node/medium-zoom/index.js +1 -1
  68. package/dist/node/route/RoutePage.js +1 -1
  69. package/dist/node/route/RouteService.js +3 -3
  70. package/dist/node/route/extractPageData.js +5 -5
  71. package/dist/node/route/normalizeRoutePath.js +2 -2
  72. package/dist/node/runtimeModule/i18n.js +2 -2
  73. package/dist/node/runtimeModule/pageData/createPageData.js +2 -2
  74. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  75. package/dist/node/runtimeModule/searchHooks.js +1 -1
  76. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  77. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  78. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  79. package/dist/node/serve.js +1 -1
  80. package/dist/node/ssg/renderPage.js +2 -2
  81. package/dist/node/ssg/renderPageWorker.165b5d46.js +1 -0
  82. package/dist/node/ssg/renderPageWorker.js +2 -2
  83. package/dist/node/ssg/renderPages.js +3 -3
  84. package/dist/node/ssg/rsbuildPluginSSG.js +2 -2
  85. package/dist/node/ssg/ssgEnv.js +1 -1
  86. package/dist/node/ssg-md/llms/emitLlmsTxt.js +9 -3
  87. package/dist/node/ssg-md/llms/llmsTxt.js +2 -2
  88. package/dist/node/ssg-md/remarkSplitMdx.js +141 -99
  89. package/dist/node/ssg-md/renderPage.js +2 -2
  90. package/dist/node/ssg-md/renderPages.js +2 -2
  91. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +2 -2
  92. package/dist/node/utils/checkLanguageParity.js +1 -1
  93. package/dist/node/utils/createHash.js +1 -1
  94. package/dist/node/utils/error.js +2 -1
  95. package/dist/node/utils/flattenMdxContent.js +5 -5
  96. package/dist/node/utils/fs.js +1 -1
  97. package/dist/node/utils/getPageKey.js +1 -1
  98. package/dist/node/utils/normalizePath.js +3 -3
  99. package/dist/node/utils/reactAlias.js +2 -2
  100. package/dist/runtime/App.js +4 -2
  101. package/dist/runtime/initPageData.js +1 -1
  102. package/dist/runtime.js +1 -2
  103. package/dist/shiki-transformers.js +2 -2
  104. package/dist/theme/assets/deprecated.js +18 -0
  105. package/dist/theme/assets/experimental.js +21 -0
  106. package/dist/theme/components/Badge/index.css +1 -0
  107. package/dist/theme/components/Banner/index.js +2 -2
  108. package/dist/theme/components/Callout/index.js +5 -2
  109. package/dist/theme/components/CodeBlock/index.css +7 -6
  110. package/dist/theme/components/CodeBlock/index.js +4 -1
  111. package/dist/theme/components/CodeBlockRuntime/index.d.ts +1 -1
  112. package/dist/theme/components/CodeBlockRuntime/index.js +38 -8
  113. package/dist/theme/components/DocContent/doc.css +1 -1
  114. package/dist/theme/components/DocContent/docComponents/pre.js +3 -1
  115. package/dist/theme/components/DocContent/index.d.ts +11 -2
  116. package/dist/theme/components/DocContent/index.js +6 -5
  117. package/dist/theme/components/DocFooter/index.js +1 -5
  118. package/dist/theme/components/HoverGroup/index.css +6 -5
  119. package/dist/theme/components/HoverGroup/index.js +88 -17
  120. package/dist/theme/components/LastUpdated/index.d.ts +1 -1
  121. package/dist/theme/components/LastUpdated/index.js +5 -1
  122. package/dist/theme/components/Link/index.d.ts +1 -1
  123. package/dist/theme/components/Link/index.js +8 -2
  124. package/dist/theme/components/Nav/NavMenu.css +1 -1
  125. package/dist/theme/components/Nav/NavMenu.d.ts +6 -1
  126. package/dist/theme/components/Nav/NavMenu.js +47 -45
  127. package/dist/theme/components/NavScreen/NavScreenLangs.css +6 -0
  128. package/dist/theme/components/NavScreen/NavScreenLangs.js +13 -3
  129. package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +1 -1
  130. package/dist/theme/components/NavScreen/NavScreenMenuItem.js +21 -11
  131. package/dist/theme/components/NavScreen/NavScreenVersions.css +6 -0
  132. package/dist/theme/components/NavScreen/NavScreenVersions.js +12 -3
  133. package/dist/theme/components/Overview/index.d.ts +0 -1
  134. package/dist/theme/components/Overview/index.js +46 -3
  135. package/dist/theme/components/{Overview/OverviewGroup.css → OverviewGroup/index.css} +60 -8
  136. package/dist/theme/components/{Overview/OverviewGroup.d.ts → OverviewGroup/index.d.ts} +1 -1
  137. package/dist/theme/components/OverviewGroup/index.js +88 -0
  138. package/dist/theme/components/Search/logic/util.test.js +1 -1
  139. package/dist/theme/components/Tabs/index.css +6 -5
  140. package/dist/theme/components/Tabs/index.js +9 -0
  141. package/dist/theme/components/Tag/index.d.ts +3 -0
  142. package/dist/theme/components/Tag/index.js +63 -8
  143. package/dist/theme/hooks/useActiveAnchor.js +1 -1
  144. package/dist/theme/icons.d.ts +26 -24
  145. package/dist/theme/icons.js +5 -1
  146. package/dist/theme/index.d.ts +3 -1
  147. package/dist/theme/index.js +4 -2
  148. package/dist/theme/layout/DocLayout/index.css +0 -2
  149. package/dist/theme/layout/DocLayout/index.js +10 -0
  150. package/dist/theme/layout/HomeLayout/index.js +40 -0
  151. package/dist/theme/layout/Layout/index.js +11 -8
  152. package/dist/theme/layout/NotFountLayout/index.js +1 -1
  153. package/dist/theme/logic/useAppearance.js +1 -1
  154. package/dist/theme/logic/useMediaQuery.js +1 -1
  155. package/dist/theme/logic/useStorageValue.js +6 -3
  156. package/dist/theme/styles/base.css +1 -0
  157. package/dist/theme/styles/shiki.css +9 -3
  158. package/dist/theme/styles/vars/base-vars.css +4 -4
  159. package/dist/theme/styles/vars/code-vars.css +2 -0
  160. package/nav-json-schema.json +2 -2
  161. package/package.json +15 -15
  162. package/dist/1218.3869bad6.js +0 -2
  163. package/dist/4669.12208c6a.js +0 -2
  164. package/dist/6289.c67fe0d5.js +0 -5
  165. package/dist/7805.cadab34e.js +0 -4
  166. package/dist/8813.9da1f210.js +0 -2
  167. package/dist/cli/index.cb89dbd1.js +0 -3
  168. package/dist/node/mdx/loader.e1578c62.js +0 -13
  169. package/dist/node/ssg/renderPageWorker.474f9f73.js +0 -2
  170. package/dist/theme/components/Overview/OverviewGroup.js +0 -57
  171. /package/dist/eject-theme/components/{Overview → OverviewGroup}/icons/plugin.svg +0 -0
  172. /package/dist/theme/components/{Overview → OverviewGroup}/icons/plugin.js +0 -0
@@ -1,18 +1,14 @@
1
- import { unified, remark_gfm, remark_mdx, remark_stringify } from "../mdx/loader.e1578c62.js";
1
+ import { unified, remark_gfm, remark_mdx, remark_stringify } from "../mdx/loader.7c249a26.js";
2
+ import { visit } from "../../8813.4b28f4bb.js";
2
3
  function remarkSplitMdx(options = {}) {
3
4
  return (tree)=>{
4
5
  const newChildren = [];
5
- const importMap = buildImportMap(tree);
6
+ const { importMap, importNodes } = buildImportMap(tree);
7
+ newChildren.push(...importNodes);
6
8
  for (const node of tree.children){
7
- if ('mdxjsEsm' === node.type) {
8
- newChildren.push(node);
9
- continue;
10
- }
9
+ if ('mdxjsEsm' === node.type) continue;
11
10
  if ('mdxJsxFlowElement' === node.type || 'mdxJsxTextElement' === node.type) {
12
- const componentName = node.name;
13
- const shouldKeep = shouldKeepJsxElement(componentName, importMap, options);
14
- if (shouldKeep) newChildren.push(node);
15
- else newChildren.push(buildMdxFlowExpressionFragment(node));
11
+ newChildren.push(processJsxElement(node, importMap, options));
16
12
  continue;
17
13
  }
18
14
  const hasJsxChildren = node.children?.some((child)=>'mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type);
@@ -24,25 +20,54 @@ function remarkSplitMdx(options = {}) {
24
20
  attributes: [],
25
21
  children: processedChildren
26
22
  });
27
- } else {
28
- const fragment = buildMdxFlowExpressionFragment(node);
29
- newChildren.push(fragment);
30
- }
23
+ } else newChildren.push(buildMdxFlowExpressionFragment(node));
31
24
  }
32
25
  tree.children = newChildren;
33
26
  };
34
27
  }
28
+ function processJsxElement(node, importMap, options) {
29
+ const processedNode = processJsxChildren(node, importMap, options);
30
+ const componentName = getComponentName(node.name);
31
+ const isMdxFragment = componentName && importMap.get(componentName)?.endsWith('.mdx');
32
+ if (isMdxFragment || shouldKeepJsxElement(node.name, importMap, options)) return processedNode;
33
+ return buildMdxFlowExpressionFragment(processedNode);
34
+ }
35
+ function processJsxChildren(node, importMap, options) {
36
+ if (!node.children || 0 === node.children.length) return node;
37
+ const processedChildren = [];
38
+ let textBuffer = [];
39
+ const flushTextBuffer = ()=>{
40
+ if (0 === textBuffer.length) return;
41
+ const combined = textBuffer.map((child)=>serializeNodeToMarkdown(child)).join('');
42
+ if (combined) processedChildren.push(createTextExpression(combined));
43
+ textBuffer = [];
44
+ };
45
+ for (const child of node.children)if ('mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type) {
46
+ flushTextBuffer();
47
+ processedChildren.push(processJsxElement(child, importMap, options));
48
+ } else textBuffer.push(child);
49
+ flushTextBuffer();
50
+ return {
51
+ ...node,
52
+ children: processedChildren
53
+ };
54
+ }
55
+ function getComponentName(name) {
56
+ if (!name) return null;
57
+ if ('string' == typeof name) {
58
+ const dotIndex = name.indexOf('.');
59
+ if (dotIndex > 0) return name.substring(0, dotIndex);
60
+ return name;
61
+ }
62
+ if ('object' == typeof name) {
63
+ if ('mdxJsxMemberExpression' === name.type || 'mdxJsxNamespacedName' === name.type) return getComponentName(name.object);
64
+ }
65
+ return null;
66
+ }
35
67
  function processMixedContent(parentNode, children, importMap, options) {
36
68
  const result = [];
37
69
  let textBuffer = [];
38
- const getPrefix = ()=>{
39
- if ('heading' === parentNode.type) {
40
- const depth = parentNode.depth || 1;
41
- return `${'#'.repeat(depth)} `;
42
- }
43
- return '';
44
- };
45
- const prefix = getPrefix();
70
+ const prefix = 'heading' === parentNode.type ? `${'#'.repeat(parentNode.depth || 1)} ` : '';
46
71
  let prefixAdded = false;
47
72
  const flushTextBuffer = ()=>{
48
73
  if (textBuffer.length > 0) {
@@ -51,65 +76,16 @@ function processMixedContent(parentNode, children, importMap, options) {
51
76
  combined = prefix + combined;
52
77
  prefixAdded = true;
53
78
  }
54
- if (combined) {
55
- const stringified = JSON.stringify(combined);
56
- result.push({
57
- type: 'mdxTextExpression',
58
- value: stringified,
59
- data: {
60
- estree: {
61
- type: 'Program',
62
- body: [
63
- {
64
- type: 'ExpressionStatement',
65
- expression: {
66
- type: 'Literal',
67
- value: combined,
68
- raw: stringified
69
- }
70
- }
71
- ],
72
- sourceType: 'module'
73
- }
74
- }
75
- });
76
- }
79
+ if (combined) result.push(createTextExpression(combined));
77
80
  textBuffer = [];
78
81
  } else if (!prefixAdded && prefix) {
79
- const trimmedPrefix = prefix.trimEnd();
80
- const stringified = JSON.stringify(trimmedPrefix);
81
- result.push({
82
- type: 'mdxTextExpression',
83
- value: stringified,
84
- data: {
85
- estree: {
86
- type: 'Program',
87
- body: [
88
- {
89
- type: 'ExpressionStatement',
90
- expression: {
91
- type: 'Literal',
92
- value: trimmedPrefix,
93
- raw: stringified
94
- }
95
- }
96
- ],
97
- sourceType: 'module'
98
- }
99
- }
100
- });
82
+ result.push(createTextExpression(prefix.trimEnd()));
101
83
  prefixAdded = true;
102
84
  }
103
85
  };
104
86
  for (const child of children)if ('mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type) {
105
87
  flushTextBuffer();
106
- const componentName = child.name;
107
- const shouldKeep = shouldKeepJsxElement(componentName, importMap, options);
108
- if (shouldKeep) result.push(child);
109
- else {
110
- const fragment = buildMdxFlowExpressionFragment(child);
111
- result.push(fragment);
112
- }
88
+ result.push(processJsxElement(child, importMap, options));
113
89
  } else if ('text' === child.type) textBuffer.push(child.value || '');
114
90
  else {
115
91
  const serialized = serializeNodeToMarkdown(child);
@@ -119,6 +95,9 @@ function processMixedContent(parentNode, children, importMap, options) {
119
95
  return result;
120
96
  }
121
97
  function buildMdxFlowExpressionFragment(node) {
98
+ const children = node.children;
99
+ const hasJsxChildren = children?.some((child)=>'mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type || 'mdxFlowExpression' === child.type || 'mdxTextExpression' === child.type);
100
+ if (hasJsxChildren && ('mdxJsxFlowElement' === node.type || 'mdxJsxTextElement' === node.type)) return buildMixedContentFragment(node, children);
122
101
  const textContent = serializeNodeToMarkdown(node);
123
102
  const stringified = JSON.stringify(textContent);
124
103
  const fragment = {
@@ -143,11 +122,76 @@ function buildMdxFlowExpressionFragment(node) {
143
122
  };
144
123
  return fragment;
145
124
  }
125
+ function buildMixedContentFragment(node, children) {
126
+ const result = [];
127
+ const openingTag = serializeOpeningTag(node);
128
+ if (openingTag) result.push(createTextExpression(openingTag));
129
+ for (const child of children){
130
+ const isJsxOrExpression = 'mdxJsxFlowElement' === child.type || 'mdxJsxTextElement' === child.type || 'mdxFlowExpression' === child.type || 'mdxTextExpression' === child.type;
131
+ if (isJsxOrExpression) result.push(child);
132
+ else {
133
+ const text = serializeNodeToMarkdown(child);
134
+ if (text) result.push(createTextExpression(text));
135
+ }
136
+ }
137
+ const closingTag = serializeClosingTag(node);
138
+ if (closingTag) result.push(createTextExpression(closingTag));
139
+ return {
140
+ type: 'mdxJsxFlowElement',
141
+ name: null,
142
+ attributes: [],
143
+ children: result
144
+ };
145
+ }
146
+ function createTextExpression(text) {
147
+ const stringified = JSON.stringify(text);
148
+ return {
149
+ type: 'mdxTextExpression',
150
+ value: stringified,
151
+ data: {
152
+ estree: {
153
+ type: 'Program',
154
+ body: [
155
+ {
156
+ type: 'ExpressionStatement',
157
+ expression: {
158
+ type: 'Literal',
159
+ value: text,
160
+ raw: stringified
161
+ }
162
+ }
163
+ ],
164
+ sourceType: 'module'
165
+ }
166
+ }
167
+ };
168
+ }
169
+ function serializeOpeningTag(node) {
170
+ const name = 'string' == typeof node.name ? node.name : '';
171
+ if (!name) return '';
172
+ const attrs = node.attributes?.map((attr)=>{
173
+ if ('mdxJsxAttribute' !== attr.type) return '';
174
+ const attrName = attr.name;
175
+ if (null === attr.value || void 0 === attr.value) return attrName;
176
+ if ('string' == typeof attr.value) return `${attrName}="${attr.value}"`;
177
+ if ('mdxJsxAttributeValueExpression' === attr.value.type) return `${attrName}={${attr.value.value || ''}}`;
178
+ return '';
179
+ }).filter(Boolean).join(' ');
180
+ return `<${name}${attrs ? ` ${attrs}` : ''}>`;
181
+ }
182
+ function serializeClosingTag(node) {
183
+ const name = 'string' == typeof node.name ? node.name : '';
184
+ if (!name) return '';
185
+ return `</${name}>`;
186
+ }
146
187
  const processor = unified().use(remark_mdx).use(remark_gfm).use(remark_stringify, {
147
188
  bullet: '-',
148
189
  emphasis: '_',
149
190
  fences: true,
150
- incrementListMarker: true
191
+ incrementListMarker: true,
192
+ handlers: {
193
+ mdxjsEsm: ()=>''
194
+ }
151
195
  });
152
196
  function serializeNodeToMarkdown(node) {
153
197
  const tempRoot = {
@@ -161,41 +205,39 @@ function serializeNodeToMarkdown(node) {
161
205
  }
162
206
  function buildImportMap(tree) {
163
207
  const importMap = new Map();
164
- for (const node of tree.children)if ('mdxjsEsm' === node.type && node.data?.estree) {
165
- const estree = node.data.estree;
166
- for (const statement of estree.body)if ('ImportDeclaration' === statement.type) {
208
+ const importNodes = new Set();
209
+ visit(tree, 'mdxjsEsm', (node)=>{
210
+ const estree = node.data?.estree;
211
+ if (!estree) return;
212
+ for (const statement of estree.body){
213
+ if ('ImportDeclaration' !== statement.type) continue;
167
214
  const source = statement.source.value;
168
215
  for (const specifier of statement.specifiers){
169
- let localName = null;
170
- if ('ImportDefaultSpecifier' === specifier.type) localName = specifier.local.name;
171
- else if ('ImportSpecifier' === specifier.type) localName = specifier.local.name;
172
- else if ('ImportNamespaceSpecifier' === specifier.type) localName = specifier.local.name;
173
- if (localName) importMap.set(localName, source);
216
+ const localName = specifier.local?.name;
217
+ if (localName) {
218
+ importMap.set(localName, source);
219
+ importNodes.add(node);
220
+ }
174
221
  }
175
222
  }
176
- }
177
- return importMap;
223
+ });
224
+ return {
225
+ importMap,
226
+ importNodes
227
+ };
178
228
  }
179
- function shouldKeepJsxElement(componentName, importMap, options) {
229
+ function shouldKeepJsxElement(nameField, importMap, options) {
230
+ const componentName = getComponentName(nameField);
180
231
  if (!componentName) return true;
181
232
  const { includes, excludes } = options;
182
- if (!includes && !excludes) return true;
183
233
  const importSource = importMap.get(componentName);
184
- if (importSource?.endsWith('.mdx')) return true;
234
+ if (!includes && !excludes) return true;
185
235
  if (excludes) {
186
- for (const [excludeSpecifiers, excludeSource] of excludes)if (excludeSpecifiers.includes(componentName)) {
187
- if (!importSource || importSource === excludeSource) return false;
188
- }
236
+ for (const [excludeSpecifiers, excludeSource] of excludes)if (excludeSpecifiers.includes(componentName) && (!importSource || importSource === excludeSource)) return false;
189
237
  }
190
238
  if (includes) {
191
- let matchesAnyRule = false;
192
- for (const [includeSpecifiers, includeSource] of includes)if (includeSpecifiers.includes(componentName)) {
193
- if (!importSource || importSource === includeSource) {
194
- matchesAnyRule = true;
195
- break;
196
- }
197
- }
198
- if (!matchesAnyRule) return false;
239
+ for (const [includeSpecifiers, includeSource] of includes)if (includeSpecifiers.includes(componentName) && (!importSource || importSource === includeSource)) return true;
240
+ return false;
199
241
  }
200
242
  return true;
201
243
  }
@@ -1,5 +1,5 @@
1
- import { pathToFileURL, createHead } from "../../5485.2a0273cf.js";
2
- import { logger, picocolors } from "../../6289.c67fe0d5.js";
1
+ import { pathToFileURL, createHead } from "../../5485.9fc7f63d.js";
2
+ import { logger, picocolors } from "../../6289.29817fb4.js";
3
3
  import { hintSSGFailed } from "../logger/hint.js";
4
4
  async function renderPage(route, ssrBundlePath) {
5
5
  let render;
@@ -1,5 +1,5 @@
1
- import { logger, picocolors } from "../../6289.c67fe0d5.js";
2
- import { pMap } from "../../5485.2a0273cf.js";
1
+ import { logger, picocolors } from "../../6289.29817fb4.js";
2
+ import { pMap } from "../../5485.9fc7f63d.js";
3
3
  import { renderPage } from "./renderPage.js";
4
4
  import { SSGConcurrency } from "../ssg/ssgEnv.js";
5
5
  const routePage2MdFilename = (routePath)=>{
@@ -1,5 +1,5 @@
1
- import { writeFile, mkdir, rm, join } from "../../6289.c67fe0d5.js";
2
- import { isDebugMode } from "../../4669.12208c6a.js";
1
+ import { writeFile, mkdir, rm, join } from "../../6289.29817fb4.js";
2
+ import { isDebugMode } from "../../4669.69cb6b18.js";
3
3
  import { NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME } from "../constants.js";
4
4
  import { renderPages } from "./renderPages.js";
5
5
  import { emitLlmsTxt } from "./llms/emitLlmsTxt.js";
@@ -1,4 +1,4 @@
1
- import { node_path, logger, promises } from "../../6289.c67fe0d5.js";
1
+ import { node_path, logger, promises } from "../../6289.29817fb4.js";
2
2
  import { createError } from "./error.js";
3
3
  function normalizePath(filePath) {
4
4
  return filePath.split(node_path.sep).join('/');
@@ -1,4 +1,4 @@
1
- import { createHash as external_node_crypto_createHash } from "../../5313.6594aba0.js";
1
+ import { createHash as external_node_crypto_createHash } from "../../3521.9eb6b114.js";
2
2
  function createHash(str) {
3
3
  return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
4
4
  }
@@ -1,8 +1,9 @@
1
+ import { picocolors } from "../../6289.29817fb4.js";
1
2
  function createError(message, maxStackLines = 5) {
2
3
  const error = new Error(message);
3
4
  if (error.stack) {
4
5
  const lines = error.stack.split('\n');
5
- if (lines.length > maxStackLines + 1) error.stack = `${lines.slice(0, maxStackLines + 1).join('\n')}\n ... (truncated)`;
6
+ if (lines.length > maxStackLines + 1) error.stack = `${lines.slice(0, maxStackLines + 1).map((line)=>picocolors.gray(line)).join('\n')}\n ${picocolors.gray('... (truncated)')}`;
6
7
  }
7
8
  return error;
8
9
  }
@@ -1,7 +1,7 @@
1
- import { node_fs, core_rspack } from "../../5313.6594aba0.js";
2
- import { node_path, logger } from "../../6289.c67fe0d5.js";
3
- import { createProcessor } from "../../7805.cadab34e.js";
4
- import { MDX_OR_MD_REGEXP } from "../../4669.12208c6a.js";
1
+ import { node_fs, core_rspack } from "../../3521.9eb6b114.js";
2
+ import { node_path, logger } from "../../6289.29817fb4.js";
3
+ import { createProcessor } from "../../9643.2dff683e.js";
4
+ import { MDX_OR_MD_REGEXP } from "../../4669.69cb6b18.js";
5
5
  import { createError } from "./error.js";
6
6
  import { importStatementRegex } from "../constants.js";
7
7
  const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
@@ -71,4 +71,4 @@ async function flattenMdxContent(content, basePath, alias) {
71
71
  deps
72
72
  };
73
73
  }
74
- export { flattenMdxContent, resolveDepPath };
74
+ export { flattenMdxContent };
@@ -1,4 +1,4 @@
1
- import { promises } from "../../6289.c67fe0d5.js";
1
+ import { promises } from "../../6289.29817fb4.js";
2
2
  async function pathExists(path) {
3
3
  try {
4
4
  await promises.access(path);
@@ -1,4 +1,4 @@
1
- import { removeLeadingSlash } from "../../4669.12208c6a.js";
1
+ import { removeLeadingSlash } from "../../4669.69cb6b18.js";
2
2
  function getPageKey(route) {
3
3
  const cleanRoute = removeLeadingSlash(route);
4
4
  return cleanRoute.replace(/\//g, '_').replace(/\.[^.]+$/, '') || 'index';
@@ -1,5 +1,5 @@
1
- import { node_os } from "../../7805.cadab34e.js";
2
- import { node_path } from "../../6289.c67fe0d5.js";
1
+ import { node_os } from "../../9643.2dff683e.js";
2
+ import { node_path } from "../../6289.29817fb4.js";
3
3
  const isWindows = 'win32' === node_os.platform();
4
4
  function slash(p) {
5
5
  return p.replace(/\\/g, '/');
@@ -7,4 +7,4 @@ function slash(p) {
7
7
  function normalizePath(id) {
8
8
  return node_path.posix.normalize(isWindows ? slash(id) : id);
9
9
  }
10
- export { isWindows, normalizePath, slash };
10
+ export { normalizePath, slash };
@@ -1,5 +1,5 @@
1
- import { node_path, logger, picocolors } from "../../6289.c67fe0d5.js";
2
- import { core_rspack } from "../../5313.6594aba0.js";
1
+ import { node_path, logger, picocolors } from "../../6289.29817fb4.js";
2
+ import { core_rspack } from "../../3521.9eb6b114.js";
3
3
  import { pathExists, readJson } from "./fs.js";
4
4
  import { PACKAGE_ROOT } from "../constants.js";
5
5
  import { hintReactVersion } from "../logger/hint.js";
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Content, PageContext, useLocation } from "@rspress/core/runtime";
2
+ import { PageContext, useLocation } from "@rspress/core/runtime";
3
3
  import { Layout, Root } from "@theme";
4
4
  import react, { useContext, useLayoutEffect } from "react";
5
5
  import virtual_global_components from "virtual-global-components";
@@ -26,7 +26,9 @@ function App() {
26
26
  const GLOBAL_COMPONENTS_KEY = 'globalUIComponents';
27
27
  const query = new URLSearchParams(search);
28
28
  const hideGlobalUIComponents = false === frontmatter[GLOBAL_COMPONENTS_KEY] || "0" === query.get(GLOBAL_COMPONENTS_KEY);
29
- if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Content, {});
29
+ if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Root, {
30
+ children: /*#__PURE__*/ jsx(Layout, {})
31
+ });
30
32
  return /*#__PURE__*/ jsxs(Root, {
31
33
  children: [
32
34
  /*#__PURE__*/ jsx(Layout, {}),
@@ -24,7 +24,7 @@ async function initPageData(routePath) {
24
24
  }
25
25
  let lang = virtual_site_data.lang || '';
26
26
  let version = virtual_site_data.multiVersion?.default || '';
27
- if (virtual_site_data.lang && 'undefined' != typeof window) {
27
+ if (virtual_site_data.lang && "u" > typeof window) {
28
28
  const path = window.location.pathname.replace(virtual_site_data.base, '').split('/').slice(0, 2);
29
29
  if (virtual_site_data.locales.length) {
30
30
  const result = virtual_site_data.locales.find(({ lang })=>path.includes(lang));
package/dist/runtime.js CHANGED
@@ -1,4 +1,3 @@
1
1
  import "./runtime.72d450ac.js";
2
- import "./4669.12208c6a.js";
3
2
  export * from "@rspress/runtime";
4
- export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "@rspress/shared";
3
+ export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "./4669.69cb6b18.js";
@@ -1,6 +1,6 @@
1
1
  import "./node/mdx/rehypePlugins/transformers/index.js";
2
+ export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./node/mdx/rehypePlugins/transformers/add-lang.js";
2
3
  export { SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, transformerAddLineNumbers } from "./node/mdx/rehypePlugins/transformers/add-line-numbers.js";
3
- export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./node/mdx/rehypePlugins/transformers/meta-highlight.js";
4
4
  export { SHIKI_TRANSFORMER_ADD_TITLE, transformerAddTitle } from "./node/mdx/rehypePlugins/transformers/add-title.js";
5
- export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./node/mdx/rehypePlugins/transformers/add-lang.js";
6
5
  export { SHIKI_TRANSFORMER_ADD_WRAP_CODE, transformerAddWrapCode } from "./node/mdx/rehypePlugins/transformers/add-wrap-code.js";
6
+ export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./node/mdx/rehypePlugins/transformers/meta-highlight.js";
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgDeprecated = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ strokeLinejoin: "round",
7
+ "aria-hidden": "true",
8
+ viewBox: "0 0 16 16",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fill: "currentColor",
12
+ fillRule: "evenodd",
13
+ d: "M6.75 2.75a1.25 1.25 0 1 1 2.5 0V3h-2.5zM5.25 3v-.25a2.75 2.75 0 0 1 5.5 0V3H15v1.5h-1.115l-.707 9.192A2.5 2.5 0 0 1 10.685 16h-5.37a2.5 2.5 0 0 1-2.493-2.308L2.115 4.5H1V3h4.25m-.932 10.577L3.62 4.5h8.76l-.698 9.077a1 1 0 0 1-.997.923h-5.37a1 1 0 0 1-.997-.923",
14
+ clipRule: "evenodd"
15
+ })
16
+ });
17
+ var deprecated = SvgDeprecated;
18
+ export { deprecated as default };
@@ -0,0 +1,21 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgExperimental = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ strokeLinejoin: "round",
7
+ "data-testid": "geist-icon",
8
+ style: {
9
+ color: "currentcolor"
10
+ },
11
+ viewBox: "0 0 16 16",
12
+ ...props,
13
+ children: /*#__PURE__*/ jsx("path", {
14
+ fill: "currentColor",
15
+ fillRule: "evenodd",
16
+ d: "M9 7.674V2.5H7v5.174l-.503.447L4.383 10h7.234L9.503 8.121zM5.5 2.5H4V1h8v1.5h-1.5V7l3.573 3.177A2.76 2.76 0 0 1 12.24 15H3.76a2.76 2.76 0 0 1-1.834-4.823L5.5 7zm-3 9.74c0-.268.085-.527.24-.74h10.52a1.26 1.26 0 0 1-1.02 2H3.76a1.26 1.26 0 0 1-1.26-1.26",
17
+ clipRule: "evenodd"
18
+ })
19
+ });
20
+ var experimental = SvgExperimental;
21
+ export { experimental as default };
@@ -1,5 +1,6 @@
1
1
  .rp-badge {
2
2
  border-radius: var(--rp-radius-small);
3
+ white-space: nowrap;
3
4
  justify-content: center;
4
5
  align-items: center;
5
6
  gap: .25rem;
@@ -7,11 +7,11 @@ const Banner = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
7
7
  const { href, message, display = true, className, storageKey = 'rp-banner-closed', storage = 'localStorage', customChildren } = props;
8
8
  const [height, setHeight] = useState(36);
9
9
  const ref = mergeRefs(forwardedRef, (element)=>{
10
- element?.offsetHeight && setHeight(element?.offsetHeight);
10
+ if (element?.offsetHeight) setHeight(element?.offsetHeight);
11
11
  });
12
12
  const [disable, setDisable] = useState(false);
13
13
  useEffect(()=>{
14
- if ('undefined' == typeof window || !storage || !storageKey) return;
14
+ if ("u" < typeof window || !storage || !storageKey) return;
15
15
  setDisable(Boolean(window[storage].getItem(storageKey)));
16
16
  }, []);
17
17
  if (!display || disable) return null;
@@ -1,5 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "./index.css";
3
+ function capitalize(type) {
4
+ return type.charAt(0).toUpperCase() + type.slice(1);
5
+ }
3
6
  function Callout({ type, title, children }) {
4
7
  const isDetails = 'details' === type;
5
8
  if (isDetails) return /*#__PURE__*/ jsxs("details", {
@@ -7,7 +10,7 @@ function Callout({ type, title, children }) {
7
10
  children: [
8
11
  /*#__PURE__*/ jsx("summary", {
9
12
  className: "rp-callout__title",
10
- children: title
13
+ children: title ?? capitalize(type)
11
14
  }),
12
15
  /*#__PURE__*/ jsx("div", {
13
16
  className: "rp-callout__content",
@@ -20,7 +23,7 @@ function Callout({ type, title, children }) {
20
23
  children: [
21
24
  /*#__PURE__*/ jsx("div", {
22
25
  className: "rp-callout__title",
23
- children: title
26
+ children: title ?? capitalize(type)
24
27
  }),
25
28
  /*#__PURE__*/ jsx("div", {
26
29
  className: "rp-callout__content",
@@ -1,7 +1,8 @@
1
1
  .rp-codeblock {
2
2
  border: var(--rp-code-block-border);
3
+ box-shadow: var(--rp-code-block-shadow);
3
4
  border-radius: var(--rp-radius);
4
- margin: 16px 0;
5
+ margin: 1rem 0;
5
6
  transition: none;
6
7
  position: relative;
7
8
  overflow-x: auto;
@@ -10,7 +11,7 @@
10
11
  @media (width <= 640px) {
11
12
  .rp-codeblock {
12
13
  contain: content;
13
- margin: 24px 0;
14
+ margin: 1.5rem 0;
14
15
  }
15
16
  }
16
17
 
@@ -19,7 +20,7 @@
19
20
  font-size: var(--rp-code-font-size);
20
21
  background-color: var(--rp-code-title-bg);
21
22
  border-bottom: var(--rp-code-block-border);
22
- padding: 12px 16px;
23
+ padding: .75rem 1rem;
23
24
  }
24
25
 
25
26
  .rp-codeblock__content {
@@ -52,7 +53,7 @@
52
53
  font-family: var(--rp-font-family-mono);
53
54
  width: fit-content;
54
55
  min-width: 100%;
55
- padding: 16px 0;
56
+ padding: 1rem 0;
56
57
  line-height: 1.7;
57
58
  display: inline-block;
58
59
  }
@@ -72,8 +73,8 @@
72
73
  counter-increment: step;
73
74
  text-align: right;
74
75
  color: #738a9466;
75
- width: 15px;
76
- margin-right: 15px;
76
+ width: 1rem;
77
+ margin-right: 1rem;
77
78
  display: inline-block;
78
79
  }
79
80
 
@@ -1,8 +1,11 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { CodeButtonGroup, useCodeButtonGroup } from "@theme";
3
3
  import clsx from "clsx";
4
4
  import "./index.css";
5
5
  function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: wrapCodeProp = false, lineNumbers: lineNumbersProp = false, codeButtonGroupProps, children }) {
6
+ if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
7
+ children: children
8
+ });
6
9
  const { codeWrap, toggleCodeWrap, copyElementRef } = useCodeButtonGroup(wrapCodeProp);
7
10
  return /*#__PURE__*/ jsxs("div", {
8
11
  className: clsx('rp-codeblock', `language-${lang}`, containerElementClassName),
@@ -11,4 +11,4 @@ export interface CodeBlockRuntimeProps extends CodeBlockProps {
11
11
  */
12
12
  onRendered?: () => void;
13
13
  }
14
- export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, ...otherProps }: CodeBlockRuntimeProps): ReactNode;
14
+ export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers, }: CodeBlockRuntimeProps): ReactNode;