@rspress/core 2.0.0-beta.1 → 2.0.0-beta.10
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/README.md +1 -1
- package/dist/index.js +59 -121
- package/dist/loader.d.ts +0 -4
- package/dist/loader.js +31 -156
- package/dist/runtime/App.d.ts +1 -4
- package/dist/runtime/App.js +2 -5
- package/dist/runtime/ClientApp.js +6 -1
- package/dist/runtime/csrClientEntry.js +3 -11
- package/dist/runtime/initPageData.d.ts +0 -1
- package/dist/runtime/initPageData.js +0 -1
- package/dist/runtime/ssrClientEntry.js +4 -11
- package/dist/runtime/ssrServerEntry.d.ts +3 -2
- package/dist/runtime/ssrServerEntry.js +7 -5
- package/package.json +24 -22
- package/dist/runtime/tsconfig.js +0 -4
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import __rslib_shim_module__ from 'module';
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_plugin_container_syntax_12d3c700__ from "@rspress/plugin-container-syntax";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
5
4
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__ from "@rsbuild/plugin-react";
|
|
8
6
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__ from "@rsbuild/plugin-react";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__ from "@rspress/shared/logger";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
11
11
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
|
|
12
12
|
import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__ from "rspack-plugin-virtual-module";
|
|
15
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
|
|
15
16
|
import * as __WEBPACK_EXTERNAL_MODULE_lodash_es_18c59938__ from "lodash-es";
|
|
16
17
|
import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
|
|
17
18
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_mdx_rs_d2f3021f__ from "@rspress/mdx-rs";
|
|
18
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
|
|
19
19
|
import * as __WEBPACK_EXTERNAL_MODULE_html_to_text_2c51ed38__ from "html-to-text";
|
|
20
20
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
21
21
|
import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
|
|
22
22
|
import * as __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__ from "enhanced-resolve";
|
|
23
|
-
import * as
|
|
24
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__ from "react-helmet-async";
|
|
23
|
+
import * as __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__ from "@unhead/react/server";
|
|
25
24
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
26
25
|
import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
|
|
27
26
|
export * from "@rspress/shared";
|
|
@@ -37,6 +36,7 @@ class PluginDriver {
|
|
|
37
36
|
async init() {
|
|
38
37
|
this.clearPlugins();
|
|
39
38
|
const config = this.#config;
|
|
39
|
+
const markdownConfig = config.markdown || {};
|
|
40
40
|
const themeConfig = config?.themeConfig || {};
|
|
41
41
|
const enableLastUpdated = themeConfig?.lastUpdated || themeConfig?.locales?.some((locale)=>locale.lastUpdated);
|
|
42
42
|
const mediumZoomConfig = config?.mediumZoom ?? true;
|
|
@@ -50,13 +50,11 @@ class PluginDriver {
|
|
|
50
50
|
this.addPlugin(pluginMediumZoom('object' == typeof mediumZoomConfig ? mediumZoomConfig : void 0));
|
|
51
51
|
}
|
|
52
52
|
this.addPlugin((0, __WEBPACK_EXTERNAL_MODULE__rspress_plugin_container_syntax_12d3c700__.pluginContainerSyntax)());
|
|
53
|
-
|
|
54
|
-
const SourceBuildPlugin = await import("@rspress/theme-default/node/source-build-plugin.js").then((r)=>r.SourceBuildPlugin, ()=>null);
|
|
55
|
-
if (SourceBuildPlugin) this.addPlugin(SourceBuildPlugin());
|
|
56
|
-
}
|
|
53
|
+
const { pluginShiki } = await import("@rspress/plugin-shiki");
|
|
57
54
|
(config.plugins || []).forEach((plugin)=>{
|
|
58
55
|
this.addPlugin(plugin);
|
|
59
56
|
});
|
|
57
|
+
this.addPlugin(pluginShiki(markdownConfig.shiki));
|
|
60
58
|
if (!haveNavSidebarConfig) {
|
|
61
59
|
const { pluginAutoNavSidebar } = await import("@rspress/plugin-auto-nav-sidebar");
|
|
62
60
|
this.addPlugin(pluginAutoNavSidebar());
|
|
@@ -150,8 +148,8 @@ const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
|
|
|
150
148
|
const pluginVirtualModule = (pluginOptions = {})=>({
|
|
151
149
|
name: PLUGIN_VIRTUAL_MODULE_NAME,
|
|
152
150
|
async setup (api) {
|
|
153
|
-
const
|
|
154
|
-
const
|
|
151
|
+
const { virtualModules = {}, tempDir: virtualFolderName = '.rsbuild-virtual-module' } = pluginOptions;
|
|
152
|
+
const TEMP_DIR = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(api.context.rootPath, 'node_modules', virtualFolderName);
|
|
155
153
|
const virtualFileAbsolutePaths = Object.keys(virtualModules).map((i)=>{
|
|
156
154
|
let absolutePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(TEMP_DIR, i);
|
|
157
155
|
if (!(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(absolutePath)) absolutePath = `${absolutePath}.js`;
|
|
@@ -160,6 +158,13 @@ const pluginVirtualModule = (pluginOptions = {})=>({
|
|
|
160
158
|
absolutePath
|
|
161
159
|
];
|
|
162
160
|
});
|
|
161
|
+
api.modifyRsbuildConfig((config)=>{
|
|
162
|
+
if (!config.source) config.source = {};
|
|
163
|
+
config.source.include = [
|
|
164
|
+
...config.source.include || [],
|
|
165
|
+
TEMP_DIR
|
|
166
|
+
];
|
|
167
|
+
});
|
|
163
168
|
api.onBeforeCreateCompiler(async ()=>{
|
|
164
169
|
await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.mkdir)(TEMP_DIR, {
|
|
165
170
|
recursive: true
|
|
@@ -177,7 +182,7 @@ const pluginVirtualModule = (pluginOptions = {})=>({
|
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
184
|
});
|
|
180
|
-
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.
|
|
185
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.10"}');
|
|
181
186
|
const RSPRESS_VERSION = package_namespaceObject.i8;
|
|
182
187
|
const isProduction = ()=>'production' === process.env.NODE_ENV;
|
|
183
188
|
const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
|
|
@@ -199,8 +204,6 @@ const OUTPUT_DIR = 'doc_build';
|
|
|
199
204
|
const APP_HTML_MARKER = '<!--<?- DOC_CONTENT ?>-->';
|
|
200
205
|
const HEAD_MARKER = '<!--<?- HEAD ?>-->';
|
|
201
206
|
const META_GENERATOR = '<!--<?- GENERATOR ?>-->';
|
|
202
|
-
const HTML_START_TAG = '<html';
|
|
203
|
-
const BODY_START_TAG = '<body';
|
|
204
207
|
const DEFAULT_TITLE = 'Rspress';
|
|
205
208
|
const PUBLIC_DIR = 'public';
|
|
206
209
|
const constants_TEMP_DIR = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR);
|
|
@@ -461,32 +464,19 @@ async function initRouteService(options) {
|
|
|
461
464
|
await pluginDriver.routeServiceGenerated(init_routeService);
|
|
462
465
|
return init_routeService;
|
|
463
466
|
}
|
|
467
|
+
function createHash(str) {
|
|
468
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)('sha256').update(str).digest('hex').slice(0, 8);
|
|
469
|
+
}
|
|
464
470
|
var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
|
|
465
471
|
RuntimeModuleID["GlobalStyles"] = "virtual-global-styles";
|
|
466
472
|
RuntimeModuleID["GlobalComponents"] = "virtual-global-components";
|
|
467
|
-
RuntimeModuleID["
|
|
468
|
-
RuntimeModuleID["RouteForSSR"] = "virtual-routes-ssr";
|
|
473
|
+
RuntimeModuleID["Routes"] = "virtual-routes";
|
|
469
474
|
RuntimeModuleID["SiteData"] = "virtual-site-data";
|
|
470
475
|
RuntimeModuleID["SearchIndexHash"] = "virtual-search-index-hash";
|
|
471
476
|
RuntimeModuleID["I18nText"] = "virtual-i18n-text";
|
|
472
477
|
RuntimeModuleID["SearchHooks"] = "virtual-search-hooks";
|
|
473
|
-
RuntimeModuleID["PrismLanguages"] = "virtual-prism-languages";
|
|
474
478
|
return RuntimeModuleID;
|
|
475
479
|
}({});
|
|
476
|
-
async function routeVMPlugin(context) {
|
|
477
|
-
const { routeService, isSSR } = context;
|
|
478
|
-
if (!isSSR) return {
|
|
479
|
-
[types_RuntimeModuleID.RouteForClient]: routeService.generateRoutesCode(false),
|
|
480
|
-
[types_RuntimeModuleID.RouteForSSR]: ''
|
|
481
|
-
};
|
|
482
|
-
return {
|
|
483
|
-
[types_RuntimeModuleID.RouteForClient]: routeService.generateRoutesCode(false),
|
|
484
|
-
[types_RuntimeModuleID.RouteForSSR]: routeService.generateRoutesCode(true)
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
function createHash(str) {
|
|
488
|
-
return (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)('sha256').update(str).digest('hex').slice(0, 8);
|
|
489
|
-
}
|
|
490
480
|
let flattenMdxContent_resolver;
|
|
491
481
|
let startFlatten = false;
|
|
492
482
|
const processor = (0, __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__.createProcessor)();
|
|
@@ -674,45 +664,6 @@ async function extractPageData(replaceRules, alias, domain, root, routeService,
|
|
|
674
664
|
}));
|
|
675
665
|
return pageData.filter(Boolean);
|
|
676
666
|
}
|
|
677
|
-
const highlightLanguages_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
678
|
-
let highlightLanguages_supportedLanguages;
|
|
679
|
-
function handleHighlightLanguages(highlightLanguages, defaultLanguages) {
|
|
680
|
-
const aliases = {};
|
|
681
|
-
if (highlightLanguages.size) {
|
|
682
|
-
if (!highlightLanguages_supportedLanguages) {
|
|
683
|
-
const langs = highlightLanguages_require('react-syntax-highlighter/dist/cjs/languages/prism/supported-languages').default;
|
|
684
|
-
highlightLanguages_supportedLanguages = new Set(langs);
|
|
685
|
-
}
|
|
686
|
-
let useDeprecatedTypeWarning = true;
|
|
687
|
-
const names = {};
|
|
688
|
-
[
|
|
689
|
-
...__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.DEFAULT_HIGHLIGHT_LANGUAGES,
|
|
690
|
-
...defaultLanguages
|
|
691
|
-
].forEach((lang)=>{
|
|
692
|
-
if (Array.isArray(lang)) {
|
|
693
|
-
const [alias, name] = lang;
|
|
694
|
-
names[alias] = name;
|
|
695
|
-
} else if (useDeprecatedTypeWarning) {
|
|
696
|
-
console.log(`${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellowBright('warning')} Automatic import is supported. \`highlightLanguages\` is now used only as alias, and string types will be ignored. \n`);
|
|
697
|
-
useDeprecatedTypeWarning = false;
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
[
|
|
701
|
-
...highlightLanguages.values()
|
|
702
|
-
].forEach((lang)=>{
|
|
703
|
-
const name = names[lang];
|
|
704
|
-
if (name && highlightLanguages_supportedLanguages.has(name)) {
|
|
705
|
-
const temp = aliases[name] || (aliases[name] = []);
|
|
706
|
-
if (!temp.includes(lang)) temp.push(lang);
|
|
707
|
-
highlightLanguages.delete(lang);
|
|
708
|
-
highlightLanguages.add(name);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
if (!highlightLanguages_supportedLanguages.has(lang)) highlightLanguages.delete(lang);
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
return aliases;
|
|
715
|
-
}
|
|
716
667
|
const DEFAULT_I18N_SOURCE = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), 'i18n.json');
|
|
717
668
|
function getI18nData(docConfig) {
|
|
718
669
|
const { i18nSourcePath = DEFAULT_I18N_SOURCE } = docConfig;
|
|
@@ -883,7 +834,7 @@ async function siteDataVMPlugin(context) {
|
|
|
883
834
|
const siteData = {
|
|
884
835
|
title: userConfig?.title || '',
|
|
885
836
|
description: userConfig?.description || '',
|
|
886
|
-
icon: userConfig?.icon || '',
|
|
837
|
+
icon: (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getIconUrlPath)(userConfig?.icon) || '',
|
|
887
838
|
route: userConfig?.route || {},
|
|
888
839
|
themeConfig: normalizeThemeConfig(userConfig, pages),
|
|
889
840
|
base: userConfig?.base || '/',
|
|
@@ -909,27 +860,16 @@ async function siteDataVMPlugin(context) {
|
|
|
909
860
|
markdown: {
|
|
910
861
|
showLineNumbers: userConfig?.markdown?.showLineNumbers ?? false,
|
|
911
862
|
defaultWrapCode: userConfig?.markdown?.defaultWrapCode ?? false,
|
|
912
|
-
|
|
863
|
+
shiki: {}
|
|
913
864
|
}
|
|
914
865
|
};
|
|
915
|
-
const { highlightLanguages: defaultLanguages = [] } = config.markdown || {};
|
|
916
866
|
if (Array.isArray(siteData.pages[0]?.extraHighlightLanguages)) siteData.pages[0].extraHighlightLanguages.forEach((lang)=>highlightLanguages.add(lang));
|
|
917
|
-
const aliases = handleHighlightLanguages(highlightLanguages, defaultLanguages);
|
|
918
|
-
const sortedAliases = Object.fromEntries(Object.entries(aliases).sort());
|
|
919
|
-
const sortedHighlightLanguages = Array.from(highlightLanguages).sort();
|
|
920
867
|
return {
|
|
921
868
|
[`${types_RuntimeModuleID.SiteData}.mjs`]: `export default ${JSON.stringify(siteData, null, 2)}`,
|
|
922
|
-
[types_RuntimeModuleID.SearchIndexHash]: `export default ${JSON.stringify(indexHashByGroup, null, 2)}
|
|
923
|
-
[types_RuntimeModuleID.PrismLanguages]: `export const aliases = ${JSON.stringify(sortedAliases, null, 2)};
|
|
924
|
-
export const languages = {
|
|
925
|
-
${sortedHighlightLanguages.map((lang)=>`"${lang}": require(
|
|
926
|
-
"react-syntax-highlighter/dist/cjs/languages/prism/${lang}"
|
|
927
|
-
).default`)}
|
|
928
|
-
}`
|
|
869
|
+
[types_RuntimeModuleID.SearchIndexHash]: `export default ${JSON.stringify(indexHashByGroup, null, 2)}`
|
|
929
870
|
};
|
|
930
871
|
}
|
|
931
872
|
const runtimeModuleFactory = [
|
|
932
|
-
routeVMPlugin,
|
|
933
873
|
siteDataVMPlugin
|
|
934
874
|
];
|
|
935
875
|
function rsbuildPluginDocVM(factoryContext) {
|
|
@@ -937,14 +877,12 @@ function rsbuildPluginDocVM(factoryContext) {
|
|
|
937
877
|
return {
|
|
938
878
|
name: 'rsbuild-plugin-doc-vm',
|
|
939
879
|
setup (api) {
|
|
940
|
-
api.modifyBundlerChain(async (bundlerChain
|
|
941
|
-
const isServer = 'node' === target;
|
|
880
|
+
api.modifyBundlerChain(async (bundlerChain)=>{
|
|
942
881
|
const alias = bundlerChain.resolve.alias.entries();
|
|
943
882
|
const runtimeModule = {};
|
|
944
883
|
for (const factory of runtimeModuleFactory){
|
|
945
884
|
const moduleResult = await factory({
|
|
946
885
|
...factoryContext,
|
|
947
|
-
isSSR: isServer,
|
|
948
886
|
alias: alias
|
|
949
887
|
});
|
|
950
888
|
Object.assign(runtimeModule, moduleResult);
|
|
@@ -954,7 +892,7 @@ function rsbuildPluginDocVM(factoryContext) {
|
|
|
954
892
|
if (runtimeModule[key]) throw new Error(`The runtime module ${key} is duplicated, please check your plugin`);
|
|
955
893
|
runtimeModule[key] = modulesByPlugin[key];
|
|
956
894
|
});
|
|
957
|
-
bundlerChain.plugin('rspress-runtime-module').use(new __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__.RspackVirtualModulePlugin(runtimeModule
|
|
895
|
+
bundlerChain.plugin('rspress-runtime-module').use(new __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__.RspackVirtualModulePlugin(runtimeModule));
|
|
958
896
|
});
|
|
959
897
|
}
|
|
960
898
|
};
|
|
@@ -994,6 +932,12 @@ const Props_${index++} = ${JSON.stringify(source[1])};\n`;
|
|
|
994
932
|
return moduleContent;
|
|
995
933
|
}
|
|
996
934
|
});
|
|
935
|
+
const routeListVMPlugin = (context)=>{
|
|
936
|
+
const { routeService } = context;
|
|
937
|
+
return {
|
|
938
|
+
[types_RuntimeModuleID.Routes]: ({ environment })=>'node' === environment.name ? routeService.generateRoutesCode(true) : routeService.generateRoutesCode(false)
|
|
939
|
+
};
|
|
940
|
+
};
|
|
997
941
|
const searchHookVMPlugin = (context)=>({
|
|
998
942
|
[`${types_RuntimeModuleID.SearchHooks}`]: ()=>{
|
|
999
943
|
const { config } = context;
|
|
@@ -1114,28 +1058,22 @@ async function renderPages(routeService, config, pluginDriver, ssrBundlePath, ht
|
|
|
1114
1058
|
routePath: '/404'
|
|
1115
1059
|
});
|
|
1116
1060
|
await Promise.all(allRoutes.filter((route)=>!route.routePath.includes(':')).map(async (route)=>{
|
|
1117
|
-
const
|
|
1061
|
+
const head = (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.createHead)();
|
|
1118
1062
|
const { routePath } = route;
|
|
1119
1063
|
let appHtml = '';
|
|
1120
1064
|
if (render) try {
|
|
1121
|
-
({ appHtml } = await render(routePath,
|
|
1065
|
+
({ appHtml } = await render(routePath, head));
|
|
1122
1066
|
} catch (e) {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1067
|
+
if (e instanceof Error) {
|
|
1068
|
+
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(`Page "${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellow(routePath)}" SSG rendering failed.\n ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].gray(e.toString())}`);
|
|
1069
|
+
throw e;
|
|
1070
|
+
}
|
|
1126
1071
|
}
|
|
1127
|
-
const
|
|
1128
|
-
let html = htmlTemplate.replace(/<title>(.*?)<\/title>/gi, '').replace(APP_HTML_MARKER, ()=>appHtml).replace(META_GENERATOR, ()=>`<meta name="generator" content="Rspress v${RSPRESS_VERSION}">`).replace(HEAD_MARKER, [
|
|
1072
|
+
const replacedHtmlTemplate = htmlTemplate.replace(/<title>(.*?)<\/title>/gi, '').replace(APP_HTML_MARKER, ()=>appHtml).replace(META_GENERATOR, ()=>`<meta name="generator" content="Rspress v${RSPRESS_VERSION}">`).replace(HEAD_MARKER, [
|
|
1129
1073
|
await renderConfigHead(config, route),
|
|
1130
|
-
helmet.title.toString(),
|
|
1131
|
-
helmet.meta.toString(),
|
|
1132
|
-
helmet.link.toString(),
|
|
1133
|
-
helmet.style.toString(),
|
|
1134
|
-
helmet.script.toString(),
|
|
1135
1074
|
await renderFrontmatterHead(route)
|
|
1136
1075
|
].join(''));
|
|
1137
|
-
|
|
1138
|
-
if (helmet.bodyAttributes) html = html.replace(BODY_START_TAG, `${BODY_START_TAG} ${helmet.bodyAttributes?.toString()}`);
|
|
1076
|
+
const html = await (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.transformHtmlTemplate)(head, replacedHtmlTemplate);
|
|
1139
1077
|
const normalizeHtmlFilePath = (path)=>{
|
|
1140
1078
|
const normalizedBase = `${(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeSlash)(config?.base || '/')}/`;
|
|
1141
1079
|
if (path.endsWith('/')) return `${path}index.html`.replace(normalizedBase, '');
|
|
@@ -1261,9 +1199,9 @@ async function resolveReactAlias(reactVersion, isSSR) {
|
|
|
1261
1199
|
'react/jsx-runtime',
|
|
1262
1200
|
'react/jsx-dev-runtime',
|
|
1263
1201
|
'react-dom',
|
|
1202
|
+
'react-dom/client',
|
|
1264
1203
|
'react-dom/server'
|
|
1265
1204
|
];
|
|
1266
|
-
if (reactVersion >= 18) libPaths.push('react-dom/client');
|
|
1267
1205
|
const alias = {};
|
|
1268
1206
|
const resolver = detectReactVersion_ResolverFactory.createResolver({
|
|
1269
1207
|
fileSystem: new detectReactVersion_CachedInputFileSystem(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"], 0),
|
|
@@ -1339,7 +1277,7 @@ function getSocialIcons(socialLinks = []) {
|
|
|
1339
1277
|
function isPluginIncluded(config, pluginName) {
|
|
1340
1278
|
return Boolean(config.builderPlugins?.some((plugin)=>plugin.name === pluginName) || config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
|
|
1341
1279
|
}
|
|
1342
|
-
async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver
|
|
1280
|
+
async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
|
|
1343
1281
|
const cwd = process.cwd();
|
|
1344
1282
|
const CUSTOM_THEME_DIR = config?.themeDir ?? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'theme');
|
|
1345
1283
|
const outDir = config?.outDir ?? OUTPUT_DIR;
|
|
@@ -1349,7 +1287,9 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1349
1287
|
const reactVersion = await detectReactVersion();
|
|
1350
1288
|
const normalizeIcon = (icon)=>{
|
|
1351
1289
|
if (!icon) return;
|
|
1352
|
-
|
|
1290
|
+
icon = icon.toString();
|
|
1291
|
+
if (icon.startsWith('file://')) icon = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(icon);
|
|
1292
|
+
else if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(icon)) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(userDocRoot, PUBLIC_DIR, icon);
|
|
1353
1293
|
return icon;
|
|
1354
1294
|
};
|
|
1355
1295
|
await hintThemeBreakingChange(CUSTOM_THEME_DIR);
|
|
@@ -1362,7 +1302,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1362
1302
|
const context = {
|
|
1363
1303
|
userDocRoot,
|
|
1364
1304
|
config,
|
|
1365
|
-
runtimeTempDir,
|
|
1366
1305
|
routeService,
|
|
1367
1306
|
pluginDriver
|
|
1368
1307
|
};
|
|
@@ -1373,11 +1312,13 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1373
1312
|
],
|
|
1374
1313
|
rsbuildPluginDocVM(context),
|
|
1375
1314
|
pluginVirtualModule({
|
|
1315
|
+
tempDir: '.rspress/runtime',
|
|
1376
1316
|
virtualModules: {
|
|
1377
1317
|
...i18nVMPlugin(context),
|
|
1378
1318
|
...globalUIComponentsVMPlugin(context),
|
|
1379
1319
|
...globalStylesVMPlugin(context),
|
|
1380
|
-
...searchHookVMPlugin(context)
|
|
1320
|
+
...searchHookVMPlugin(context),
|
|
1321
|
+
...routeListVMPlugin(context)
|
|
1381
1322
|
}
|
|
1382
1323
|
}),
|
|
1383
1324
|
...enableSSG ? [
|
|
@@ -1396,6 +1337,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1396
1337
|
}
|
|
1397
1338
|
},
|
|
1398
1339
|
dev: {
|
|
1340
|
+
lazyCompilation: 'false' !== process.env.RSPRESS_LAZY_COMPILATION,
|
|
1399
1341
|
progressBar: false,
|
|
1400
1342
|
setupMiddlewares: [
|
|
1401
1343
|
(middlewares)=>{
|
|
@@ -1434,8 +1376,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1434
1376
|
],
|
|
1435
1377
|
'@theme-assets': __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(DEFAULT_THEME, '../assets'),
|
|
1436
1378
|
'@rspress/core': PACKAGE_ROOT,
|
|
1437
|
-
'react-lazy-with-preload': require.resolve('react-lazy-with-preload')
|
|
1438
|
-
'react-syntax-highlighter': __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(require.resolve('react-syntax-highlighter/package.json'))
|
|
1379
|
+
'react-lazy-with-preload': require.resolve('react-lazy-with-preload')
|
|
1439
1380
|
}
|
|
1440
1381
|
},
|
|
1441
1382
|
source: {
|
|
@@ -1444,7 +1385,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1444
1385
|
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR)
|
|
1445
1386
|
],
|
|
1446
1387
|
define: {
|
|
1447
|
-
'process.env.__REACT_GTE_18__': JSON.stringify(reactVersion >= 18),
|
|
1448
1388
|
'process.env.TEST': JSON.stringify(process.env.TEST),
|
|
1449
1389
|
'process.env.RSPRESS_SOCIAL_ICONS': JSON.stringify(getSocialIcons(config.themeConfig?.socialLinks))
|
|
1450
1390
|
}
|
|
@@ -1493,12 +1433,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1493
1433
|
sideEffects: true
|
|
1494
1434
|
});
|
|
1495
1435
|
if (isServer) chain.output.filename(NODE_SSR_BUNDLE_NAME);
|
|
1496
|
-
const enableIncremental = !isProduction() && !process.env.DISABLE_RSPACK_INCREMENTAL;
|
|
1497
|
-
if (enableIncremental) chain.merge({
|
|
1498
|
-
experiments: {
|
|
1499
|
-
incremental: true
|
|
1500
|
-
}
|
|
1501
|
-
});
|
|
1502
1436
|
}
|
|
1503
1437
|
},
|
|
1504
1438
|
environments: {
|
|
@@ -1506,8 +1440,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1506
1440
|
resolve: {
|
|
1507
1441
|
alias: {
|
|
1508
1442
|
...reactCSRAlias,
|
|
1509
|
-
...reactRouterDomAlias
|
|
1510
|
-
__VIRTUAL_ROUTES__: 'virtual-routes'
|
|
1443
|
+
...reactRouterDomAlias
|
|
1511
1444
|
}
|
|
1512
1445
|
},
|
|
1513
1446
|
source: {
|
|
@@ -1530,8 +1463,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1530
1463
|
resolve: {
|
|
1531
1464
|
alias: {
|
|
1532
1465
|
...reactSSRAlias,
|
|
1533
|
-
...reactRouterDomAlias
|
|
1534
|
-
__VIRTUAL_ROUTES__: 'virtual-routes-ssr'
|
|
1466
|
+
...reactRouterDomAlias
|
|
1535
1467
|
}
|
|
1536
1468
|
},
|
|
1537
1469
|
tools: {
|
|
@@ -1580,8 +1512,9 @@ async function initRsbuild(rootDir, config, pluginDriver, enableSSG, extraRsbuil
|
|
|
1580
1512
|
pluginDriver
|
|
1581
1513
|
});
|
|
1582
1514
|
const { createRsbuild, mergeRsbuildConfig } = await import("@rsbuild/core");
|
|
1583
|
-
const internalRsbuildConfig = await createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver
|
|
1515
|
+
const internalRsbuildConfig = await createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver);
|
|
1584
1516
|
const rsbuild = await createRsbuild({
|
|
1517
|
+
callerName: 'rspress',
|
|
1585
1518
|
rsbuildConfig: mergeRsbuildConfig(internalRsbuildConfig, ...pluginDriver.getPlugins()?.map((plugin)=>plugin.builderConfig ?? {}) || [], config?.builderConfig || {}, extraRsbuildConfig || {})
|
|
1586
1519
|
});
|
|
1587
1520
|
rsbuild.addPlugins(builderPlugins);
|
|
@@ -1791,6 +1724,11 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
|
|
|
1791
1724
|
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
|
|
1792
1725
|
node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
|
|
1793
1726
|
});
|
|
1727
|
+
(0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'definition', (node)=>{
|
|
1728
|
+
const { url: nodeUrl } = node;
|
|
1729
|
+
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
|
|
1730
|
+
node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
|
|
1731
|
+
});
|
|
1794
1732
|
const getMdxSrcAttribute = (tempVar)=>({
|
|
1795
1733
|
type: 'mdxJsxAttribute',
|
|
1796
1734
|
name: 'src',
|
package/dist/loader.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ import type { Rspack as Rspack_2 } from '@rsbuild/core';
|
|
|
7
7
|
import type { RspressPlugin } from '@rspress/shared';
|
|
8
8
|
import type { UserConfig } from '@rspress/shared';
|
|
9
9
|
|
|
10
|
-
export declare function createCheckPageMetaUpdateFn(): (modulePath: string, pageMeta: PageMeta) => void;
|
|
11
|
-
|
|
12
10
|
declare interface LoaderOptions {
|
|
13
11
|
config: UserConfig;
|
|
14
12
|
docDirectory: string;
|
|
@@ -84,6 +82,4 @@ declare interface TocItem {
|
|
|
84
82
|
depth: number;
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
export declare function updateSiteDataRuntimeModule(modulePath: string, pageMeta: PageMeta): Promise<void>;
|
|
88
|
-
|
|
89
85
|
export { }
|
package/dist/loader.js
CHANGED
|
@@ -1,127 +1,19 @@
|
|
|
1
1
|
import __rslib_shim_module__ from 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
6
4
|
import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
8
5
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__ from "@rspress/shared/logger";
|
|
9
6
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
|
|
10
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
11
|
-
import * as __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__ from "enhanced-resolve";
|
|
12
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
13
8
|
import * as __WEBPACK_EXTERNAL_MODULE_rehype_external_links_09bed11a__ from "rehype-external-links";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_rehype_raw_434f4cf9__ from "rehype-raw";
|
|
14
10
|
import * as __WEBPACK_EXTERNAL_MODULE_remark_gfm_073acf21__ from "remark-gfm";
|
|
15
|
-
import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
|
|
16
11
|
import * as __WEBPACK_EXTERNAL_MODULE_github_slugger_8e9a17cb__ from "github-slugger";
|
|
17
12
|
import * as __WEBPACK_EXTERNAL_MODULE_hast_util_heading_rank_cff646ba__ from "hast-util-heading-rank";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
18
15
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
|
|
19
16
|
import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_children_71921007__ from "unist-util-visit-children";
|
|
20
|
-
const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
|
|
21
|
-
`{
|
|
22
|
-
const saved = localStorage.getItem('${__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.APPEARANCE_KEY}')
|
|
23
|
-
const preferDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
24
|
-
const isDark = !saved || saved === 'auto' ? preferDark : saved === 'dark'
|
|
25
|
-
document.documentElement.classList.toggle('dark', isDark)
|
|
26
|
-
document.documentElement.classList.toggle('rp-dark', isDark)
|
|
27
|
-
document.documentElement.style.colorScheme = isDark ? 'dark' : 'light'
|
|
28
|
-
}`.replace(/\n/g, ';').replace(/\s{2,}/g, '');
|
|
29
|
-
const dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(new URL(import.meta.url)));
|
|
30
|
-
const PACKAGE_ROOT = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dirname, '..');
|
|
31
|
-
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'index.html');
|
|
32
|
-
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'csrClientEntry.js');
|
|
33
|
-
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrClientEntry.js');
|
|
34
|
-
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrServerEntry.js');
|
|
35
|
-
const TEMP_DIR = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR);
|
|
36
|
-
var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
|
|
37
|
-
RuntimeModuleID["GlobalStyles"] = "virtual-global-styles";
|
|
38
|
-
RuntimeModuleID["GlobalComponents"] = "virtual-global-components";
|
|
39
|
-
RuntimeModuleID["RouteForClient"] = "virtual-routes";
|
|
40
|
-
RuntimeModuleID["RouteForSSR"] = "virtual-routes-ssr";
|
|
41
|
-
RuntimeModuleID["SiteData"] = "virtual-site-data";
|
|
42
|
-
RuntimeModuleID["SearchIndexHash"] = "virtual-search-index-hash";
|
|
43
|
-
RuntimeModuleID["I18nText"] = "virtual-i18n-text";
|
|
44
|
-
RuntimeModuleID["SearchHooks"] = "virtual-search-hooks";
|
|
45
|
-
RuntimeModuleID["PrismLanguages"] = "virtual-prism-languages";
|
|
46
|
-
return RuntimeModuleID;
|
|
47
|
-
}({});
|
|
48
|
-
let resolver;
|
|
49
|
-
let startFlatten = false;
|
|
50
|
-
const processor = (0, __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__.createProcessor)();
|
|
51
|
-
const { CachedInputFileSystem, ResolverFactory } = __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__["default"];
|
|
52
|
-
const fileSystem = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"];
|
|
53
|
-
async function resolveDepPath(importPath, importer, alias) {
|
|
54
|
-
if (!resolver) resolver = ResolverFactory.createResolver({
|
|
55
|
-
fileSystem: new CachedInputFileSystem(fileSystem, 0),
|
|
56
|
-
extensions: [
|
|
57
|
-
'.mdx',
|
|
58
|
-
'.md'
|
|
59
|
-
],
|
|
60
|
-
alias
|
|
61
|
-
});
|
|
62
|
-
const resolveResult = await new Promise((resolve, reject)=>{
|
|
63
|
-
resolver.resolve({
|
|
64
|
-
importer
|
|
65
|
-
}, importer, importPath, {}, (err, filePath)=>{
|
|
66
|
-
if (err) return reject(err);
|
|
67
|
-
if (!filePath) return reject(new Error(`Empty result when resolving ${importPath} from ${importer}`));
|
|
68
|
-
return resolve(filePath);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
return resolveResult;
|
|
72
|
-
}
|
|
73
|
-
async function flattenMdxContent(content, basePath, alias) {
|
|
74
|
-
const deps = [];
|
|
75
|
-
const regex = new RegExp(importStatementRegex);
|
|
76
|
-
if (!regex.test(content)) return {
|
|
77
|
-
flattenContent: content,
|
|
78
|
-
deps
|
|
79
|
-
};
|
|
80
|
-
if (!startFlatten) {
|
|
81
|
-
resolver = ResolverFactory.createResolver({
|
|
82
|
-
fileSystem: new CachedInputFileSystem(fileSystem, 0),
|
|
83
|
-
extensions: [
|
|
84
|
-
'.mdx',
|
|
85
|
-
'.md',
|
|
86
|
-
'.js'
|
|
87
|
-
],
|
|
88
|
-
alias
|
|
89
|
-
});
|
|
90
|
-
startFlatten = true;
|
|
91
|
-
}
|
|
92
|
-
let ast;
|
|
93
|
-
let result = content;
|
|
94
|
-
try {
|
|
95
|
-
ast = processor.parse(content);
|
|
96
|
-
} catch (e) {
|
|
97
|
-
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.debug('flattenMdxContent parse failed: \n', e);
|
|
98
|
-
return {
|
|
99
|
-
flattenContent: content,
|
|
100
|
-
deps
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
const importNodes = ast.children.filter((node)=>'mdxjsEsm' === node.type).flatMap((node)=>node.data?.estree?.body || []).filter((node)=>'ImportDeclaration' === node.type);
|
|
104
|
-
for (const importNode of importNodes){
|
|
105
|
-
const id = importNode.specifiers[0].local.name;
|
|
106
|
-
const importPath = importNode.source.value;
|
|
107
|
-
let absoluteImportPath;
|
|
108
|
-
try {
|
|
109
|
-
absoluteImportPath = await resolveDepPath(importPath, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(basePath), alias);
|
|
110
|
-
} catch (_e) {
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
if (__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP.test(absoluteImportPath)) {
|
|
114
|
-
const importedContent = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(absoluteImportPath, 'utf-8');
|
|
115
|
-
const { flattenContent: replacedValue, deps: subDeps } = await flattenMdxContent(importedContent, absoluteImportPath, alias);
|
|
116
|
-
result = result.replace(new RegExp(`import\\s+${id}\\s+from\\s+['"](${importPath})['"];?`), '').replace(new RegExp(`<${id}\\s*/>`, 'g'), ()=>replacedValue);
|
|
117
|
-
deps.push(...subDeps, absoluteImportPath);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
flattenContent: result,
|
|
122
|
-
deps
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
17
|
function applyReplaceRules(code = '', replaceRules = []) {
|
|
126
18
|
let result = code;
|
|
127
19
|
for (const rule of replaceRules)result = result.replace(rule.search, rule.replace);
|
|
@@ -138,15 +30,6 @@ function slash(p) {
|
|
|
138
30
|
function normalizePath(id) {
|
|
139
31
|
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.normalize(isWindows ? slash(id) : id);
|
|
140
32
|
}
|
|
141
|
-
const rehypePluginCodeMeta = ()=>(tree)=>{
|
|
142
|
-
(0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'element', (node)=>{
|
|
143
|
-
if ('pre' === node.tagName && node.children[0]?.type === 'element' && 'code' === node.children[0].tagName) {
|
|
144
|
-
const codeNode = node.children[0];
|
|
145
|
-
codeNode.properties ??= {};
|
|
146
|
-
codeNode.properties.meta = codeNode.data?.meta;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
33
|
const rehypeHeaderAnchor = ()=>{
|
|
151
34
|
const slugger = new __WEBPACK_EXTERNAL_MODULE_github_slugger_8e9a17cb__["default"]();
|
|
152
35
|
return (tree)=>{
|
|
@@ -296,6 +179,11 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
|
|
|
296
179
|
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
|
|
297
180
|
node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
|
|
298
181
|
});
|
|
182
|
+
(0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'definition', (node)=>{
|
|
183
|
+
const { url: nodeUrl } = node;
|
|
184
|
+
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
|
|
185
|
+
node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
|
|
186
|
+
});
|
|
299
187
|
const getMdxSrcAttribute = (tempVar)=>({
|
|
300
188
|
type: 'mdxJsxAttribute',
|
|
301
189
|
name: 'src',
|
|
@@ -399,7 +287,16 @@ const remarkPluginToc = function() {
|
|
|
399
287
|
if (title) data.pageMeta.title = title;
|
|
400
288
|
};
|
|
401
289
|
};
|
|
290
|
+
const rehypeCodeMeta = ()=>(tree)=>{
|
|
291
|
+
(0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'element', (node)=>{
|
|
292
|
+
if ('pre' === node.tagName && node.children[0]?.type === 'element' && 'code' === node.children[0].tagName) {
|
|
293
|
+
const codeNode = node.children[0];
|
|
294
|
+
codeNode.properties.metastring = codeNode.data?.meta;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
};
|
|
402
298
|
async function createMDXOptions(docDirectory, config, checkDeadLinks, routeService, filepath, pluginDriver) {
|
|
299
|
+
const format = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(filepath).slice(1);
|
|
403
300
|
const cleanUrls = config?.route?.cleanUrls ?? false;
|
|
404
301
|
const { remarkPlugins: remarkPluginsFromConfig = [], rehypePlugins: rehypePluginsFromConfig = [], globalComponents: globalComponentsFromConfig = [] } = config?.markdown || {};
|
|
405
302
|
const rspressPlugins = pluginDriver.getPlugins();
|
|
@@ -411,7 +308,7 @@ async function createMDXOptions(docDirectory, config, checkDeadLinks, routeServi
|
|
|
411
308
|
];
|
|
412
309
|
return {
|
|
413
310
|
providerImportSource: '@mdx-js/react',
|
|
414
|
-
format
|
|
311
|
+
format,
|
|
415
312
|
remarkPlugins: [
|
|
416
313
|
__WEBPACK_EXTERNAL_MODULE_remark_gfm_073acf21__["default"],
|
|
417
314
|
remarkPluginToc,
|
|
@@ -442,7 +339,15 @@ async function createMDXOptions(docDirectory, config, checkDeadLinks, routeServi
|
|
|
442
339
|
].filter(Boolean),
|
|
443
340
|
rehypePlugins: [
|
|
444
341
|
rehypeHeaderAnchor,
|
|
445
|
-
|
|
342
|
+
...'md' === format ? [
|
|
343
|
+
rehypeCodeMeta,
|
|
344
|
+
[
|
|
345
|
+
__WEBPACK_EXTERNAL_MODULE_rehype_raw_434f4cf9__["default"],
|
|
346
|
+
{
|
|
347
|
+
passThrough: __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__.nodeTypes
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
] : [],
|
|
446
351
|
[
|
|
447
352
|
__WEBPACK_EXTERNAL_MODULE_rehype_external_links_09bed11a__["default"],
|
|
448
353
|
{
|
|
@@ -455,44 +360,15 @@ async function createMDXOptions(docDirectory, config, checkDeadLinks, routeServi
|
|
|
455
360
|
]
|
|
456
361
|
};
|
|
457
362
|
}
|
|
458
|
-
async function updateSiteDataRuntimeModule(modulePath, pageMeta) {
|
|
459
|
-
const siteDataModulePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(TEMP_DIR, 'runtime', `${types_RuntimeModuleID.SiteData}.mjs`);
|
|
460
|
-
const { default: siteData } = await import((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(siteDataModulePath).href);
|
|
461
|
-
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(siteDataModulePath, `export default ${JSON.stringify({
|
|
462
|
-
...siteData,
|
|
463
|
-
timestamp: Date.now().toString(),
|
|
464
|
-
pages: siteData.pages.map((page)=>page._filepath === modulePath ? {
|
|
465
|
-
...page,
|
|
466
|
-
...pageMeta
|
|
467
|
-
} : page)
|
|
468
|
-
}, null, 2)}`);
|
|
469
|
-
}
|
|
470
|
-
function createCheckPageMetaUpdateFn() {
|
|
471
|
-
const pageMetaMap = new Map();
|
|
472
|
-
return (modulePath, pageMeta)=>{
|
|
473
|
-
const prevMeta = pageMetaMap.get(modulePath);
|
|
474
|
-
const deserializedMeta = JSON.stringify(pageMeta);
|
|
475
|
-
pageMetaMap.set(modulePath, deserializedMeta);
|
|
476
|
-
if (!prevMeta) return;
|
|
477
|
-
if (prevMeta !== deserializedMeta) setTimeout(async ()=>{
|
|
478
|
-
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('Page metadata changed, page reloading...');
|
|
479
|
-
await updateSiteDataRuntimeModule(modulePath, pageMeta);
|
|
480
|
-
});
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
const checkPageMetaUpdate = createCheckPageMetaUpdateFn();
|
|
484
363
|
async function mdxLoader(source) {
|
|
485
364
|
this.cacheable(true);
|
|
486
365
|
const callback = this.async();
|
|
487
366
|
const options = this.getOptions();
|
|
488
367
|
const filepath = this.resourcePath;
|
|
489
|
-
const { alias } = this._compiler.options.resolve;
|
|
490
368
|
const { config, docDirectory, checkDeadLinks, routeService, pluginDriver } = options;
|
|
491
|
-
const { frontmatter,
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
const replacedContent = applyReplaceRules(flattenContent, config.replaceRules);
|
|
495
|
-
const preprocessedContent = escapeMarkdownHeadingIds(replacedContent);
|
|
369
|
+
const { frontmatter, emptyLinesSource } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.loadFrontMatter)(source, filepath, docDirectory, true);
|
|
370
|
+
const replacedSource = applyReplaceRules(emptyLinesSource, config.replaceRules);
|
|
371
|
+
const preprocessedContent = escapeMarkdownHeadingIds(replacedSource);
|
|
496
372
|
try {
|
|
497
373
|
let pageMeta = {
|
|
498
374
|
title: '',
|
|
@@ -519,7 +395,6 @@ async function mdxLoader(source) {
|
|
|
519
395
|
headingTitle,
|
|
520
396
|
frontmatter
|
|
521
397
|
};
|
|
522
|
-
if (!(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isProduction)()) checkPageMetaUpdate(filepath, pageMeta);
|
|
523
398
|
const result = `const frontmatter = ${JSON.stringify(frontmatter)};
|
|
524
399
|
${compileResult}
|
|
525
400
|
MDXContent.__RSPRESS_PAGE_META = {};
|
|
@@ -538,4 +413,4 @@ MDXContent.__RSPRESS_PAGE_META["${encodeURIComponent(normalizePath(__WEBPACK_EXT
|
|
|
538
413
|
}
|
|
539
414
|
}
|
|
540
415
|
}
|
|
541
|
-
export {
|
|
416
|
+
export { mdxLoader as default };
|
package/dist/runtime/App.d.ts
CHANGED
package/dist/runtime/App.js
CHANGED
|
@@ -2,11 +2,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/j
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__ from "react-helmet-async";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE_virtual_global_components_43dbb356__ from "virtual-global-components";
|
|
7
|
-
import "virtual-global-styles";
|
|
8
6
|
import * as __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__ from "./initPageData.js";
|
|
9
|
-
function App(
|
|
7
|
+
function App() {
|
|
10
8
|
const { setData: setPageData, data } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.DataContext);
|
|
11
9
|
const { pathname, search } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.useLocation)();
|
|
12
10
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
@@ -28,8 +26,7 @@ function App({ helmetContext }) {
|
|
|
28
26
|
const GLOBAL_COMPONENTS_KEY = 'globalUIComponents';
|
|
29
27
|
const query = new URLSearchParams(search);
|
|
30
28
|
const hideGlobalUIComponents = false === frontmatter[GLOBAL_COMPONENTS_KEY] || "0" === query.get(GLOBAL_COMPONENTS_KEY);
|
|
31
|
-
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(
|
|
32
|
-
context: helmetContext,
|
|
29
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
33
30
|
children: [
|
|
34
31
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__.Layout, {}),
|
|
35
32
|
!hideGlobalUIComponents && __WEBPACK_EXTERNAL_MODULE_virtual_global_components_43dbb356__["default"].map((componentInfo, index)=>{
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__unhead_react_client_2b506c0d__ from "@unhead/react/client";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE__App_js_3638e61b__ from "./App.js";
|
|
7
|
+
const head = (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_client_2b506c0d__.createHead)();
|
|
6
8
|
function ClientApp({ initialPageData = null }) {
|
|
7
9
|
const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(initialPageData);
|
|
8
10
|
const [theme, setTheme] = (0, __WEBPACK_EXTERNAL_MODULE__theme_75e53063__.useThemeState)();
|
|
@@ -23,7 +25,10 @@ function ClientApp({ initialPageData = null }) {
|
|
|
23
25
|
setData
|
|
24
26
|
]),
|
|
25
27
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.BrowserRouter, {
|
|
26
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
|
|
28
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__unhead_react_client_2b506c0d__.UnheadProvider, {
|
|
29
|
+
head: head,
|
|
30
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__App_js_3638e61b__.App, {})
|
|
31
|
+
})
|
|
27
32
|
})
|
|
28
33
|
})
|
|
29
34
|
});
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__ from "react-dom/client";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__ from "./ClientApp.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (process.env.__REACT_GTE_18__) {
|
|
6
|
-
const { createRoot } = await import("react-dom/client");
|
|
7
|
-
createRoot(container).render(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {}));
|
|
8
|
-
} else {
|
|
9
|
-
const ReactDOM = await import("react-dom");
|
|
10
|
-
ReactDOM.render(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {}), container);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
renderInBrowser();
|
|
4
|
+
const container = document.getElementById('root');
|
|
5
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__.createRoot)(container).render(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
3
|
-
import "virtual-global-styles";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__ from "virtual-site-data";
|
|
5
4
|
async function initPageData(routePath) {
|
|
6
5
|
const matchedRoute = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.pathnameToRouteService)(routePath);
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__ from "react-dom/client";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__ from "./ClientApp.js";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__ from "./initPageData.js";
|
|
4
5
|
async function renderInBrowser() {
|
|
5
6
|
const container = document.getElementById('root');
|
|
6
7
|
const initialPageData = await (0, __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__.initPageData)(window.location.pathname);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
initialPageData: initialPageData
|
|
11
|
-
}));
|
|
12
|
-
} else {
|
|
13
|
-
const ReactDOM = await import("react-dom");
|
|
14
|
-
ReactDOM.hydrate(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {
|
|
15
|
-
initialPageData: initialPageData
|
|
16
|
-
}), container);
|
|
17
|
-
}
|
|
8
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__.hydrateRoot)(container, /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {
|
|
9
|
+
initialPageData: initialPageData
|
|
10
|
+
}));
|
|
18
11
|
}
|
|
19
12
|
renderInBrowser();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PageData } from '@rspress/shared';
|
|
2
|
-
|
|
2
|
+
import { type Unhead } from '@unhead/react/server';
|
|
3
|
+
export declare function render(pagePath: string, head: Unhead): Promise<{
|
|
3
4
|
appHtml: string;
|
|
4
5
|
pageData: PageData;
|
|
5
6
|
}>;
|
|
6
|
-
export { routes } from 'virtual-routes
|
|
7
|
+
export { routes } from 'virtual-routes';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_server_673c713a__ from "@rspress/runtime/server";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__ from "@unhead/react/server";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE_react_dom_server_98c38d5c__ from "react-dom/server";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE__App_js_3638e61b__ from "./App.js";
|
|
6
7
|
import * as __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__ from "./initPageData.js";
|
|
7
|
-
import * as
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_virtual_routes_98776429__ from "virtual-routes";
|
|
8
9
|
const DEFAULT_THEME = 'light';
|
|
9
|
-
async function render(pagePath,
|
|
10
|
+
async function render(pagePath, head) {
|
|
10
11
|
const initialPageData = await (0, __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__.initPageData)(pagePath);
|
|
11
12
|
const appHtml = (0, __WEBPACK_EXTERNAL_MODULE_react_dom_server_98c38d5c__.renderToString)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.ThemeContext.Provider, {
|
|
12
13
|
value: {
|
|
@@ -18,8 +19,9 @@ async function render(pagePath, helmetContext) {
|
|
|
18
19
|
},
|
|
19
20
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__rspress_runtime_server_673c713a__.StaticRouter, {
|
|
20
21
|
location: pagePath,
|
|
21
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
|
|
22
|
-
|
|
22
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.UnheadProvider, {
|
|
23
|
+
value: head,
|
|
24
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__App_js_3638e61b__.App, {})
|
|
23
25
|
})
|
|
24
26
|
})
|
|
25
27
|
})
|
|
@@ -29,5 +31,5 @@ async function render(pagePath, helmetContext) {
|
|
|
29
31
|
pageData: initialPageData
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
|
-
var __webpack_exports__routes =
|
|
34
|
+
var __webpack_exports__routes = __WEBPACK_EXTERNAL_MODULE_virtual_routes_98776429__.routes;
|
|
33
35
|
export { render, __webpack_exports__routes as routes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -45,9 +45,11 @@
|
|
|
45
45
|
"@mdx-js/loader": "^3.1.0",
|
|
46
46
|
"@mdx-js/mdx": "^3.1.0",
|
|
47
47
|
"@mdx-js/react": "^3.1.0",
|
|
48
|
-
"@rsbuild/core": "1.3.
|
|
49
|
-
"@rsbuild/plugin-react": "~1.
|
|
48
|
+
"@rsbuild/core": "~1.3.21",
|
|
49
|
+
"@rsbuild/plugin-react": "~1.3.1",
|
|
50
50
|
"@rspress/mdx-rs": "0.6.6",
|
|
51
|
+
"@types/unist": "^3.0.3",
|
|
52
|
+
"@unhead/react": "^2.0.10",
|
|
51
53
|
"enhanced-resolve": "5.18.1",
|
|
52
54
|
"github-slugger": "^2.0.0",
|
|
53
55
|
"hast-util-from-html": "^2.0.3",
|
|
@@ -58,39 +60,39 @@
|
|
|
58
60
|
"picocolors": "^1.1.1",
|
|
59
61
|
"react": "^19.1.0",
|
|
60
62
|
"react-dom": "^19.1.0",
|
|
61
|
-
"react-helmet-async": "^2.0.5",
|
|
62
63
|
"react-lazy-with-preload": "^2.2.1",
|
|
63
64
|
"react-router-dom": "^6.29.0",
|
|
64
|
-
"react-syntax-highlighter": "^15.6.1",
|
|
65
65
|
"rehype-external-links": "^3.0.0",
|
|
66
|
+
"rehype-raw": "^7.0.0",
|
|
66
67
|
"remark": "^15.0.1",
|
|
67
68
|
"remark-gfm": "^4.0.1",
|
|
68
|
-
"rspack-plugin-virtual-module": "0.1
|
|
69
|
-
"tinyglobby": "^0.2.
|
|
69
|
+
"rspack-plugin-virtual-module": "1.0.1",
|
|
70
|
+
"tinyglobby": "^0.2.14",
|
|
70
71
|
"unified": "^11.0.5",
|
|
71
72
|
"unist-util-visit": "^5.0.0",
|
|
72
73
|
"unist-util-visit-children": "^3.0.0",
|
|
73
|
-
"@rspress/plugin-
|
|
74
|
-
"@rspress/plugin-
|
|
75
|
-
"@rspress/plugin-
|
|
76
|
-
"@rspress/plugin-
|
|
77
|
-
"@rspress/
|
|
78
|
-
"@rspress/
|
|
79
|
-
"@rspress/
|
|
74
|
+
"@rspress/plugin-container-syntax": "2.0.0-beta.10",
|
|
75
|
+
"@rspress/plugin-last-updated": "2.0.0-beta.10",
|
|
76
|
+
"@rspress/plugin-medium-zoom": "2.0.0-beta.10",
|
|
77
|
+
"@rspress/plugin-shiki": "2.0.0-beta.10",
|
|
78
|
+
"@rspress/runtime": "2.0.0-beta.10",
|
|
79
|
+
"@rspress/theme-default": "2.0.0-beta.10",
|
|
80
|
+
"@rspress/shared": "2.0.0-beta.10",
|
|
81
|
+
"@rspress/plugin-auto-nav-sidebar": "2.0.0-beta.10"
|
|
80
82
|
},
|
|
81
83
|
"devDependencies": {
|
|
82
|
-
"@microsoft/api-extractor": "^7.52.
|
|
83
|
-
"@rslib/core": "0.
|
|
84
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
85
|
+
"@rslib/core": "0.8.0",
|
|
84
86
|
"@rspress-dev/plugin-preview": "link:../plugin-preview",
|
|
85
87
|
"@types/hast": "^3.0.4",
|
|
86
88
|
"@types/html-to-text": "^9.0.4",
|
|
87
89
|
"@types/jest": "~29.5.14",
|
|
88
90
|
"@types/lodash-es": "^4.17.12",
|
|
89
91
|
"@types/mdast": "^4.0.4",
|
|
90
|
-
"@types/node": "^
|
|
91
|
-
"@types/react": "^18.3.
|
|
92
|
-
"@types/react-dom": "^18.3.
|
|
93
|
-
"memfs": "^4.17.
|
|
92
|
+
"@types/node": "^22.8.1",
|
|
93
|
+
"@types/react": "^18.3.22",
|
|
94
|
+
"@types/react-dom": "^18.3.7",
|
|
95
|
+
"memfs": "^4.17.2",
|
|
94
96
|
"postcss": "8.5.3",
|
|
95
97
|
"rehype-stringify": "^10.0.1",
|
|
96
98
|
"remark-mdx": "^3.1.0",
|
|
@@ -98,8 +100,8 @@
|
|
|
98
100
|
"remark-rehype": "^11.1.2",
|
|
99
101
|
"remark-stringify": "^11.0.0",
|
|
100
102
|
"rimraf": "^6.0.1",
|
|
101
|
-
"rsbuild-plugin-publint": "^0.3.
|
|
102
|
-
"rsbuild-plugin-virtual-module": "0.
|
|
103
|
+
"rsbuild-plugin-publint": "^0.3.2",
|
|
104
|
+
"rsbuild-plugin-virtual-module": "0.2.0",
|
|
103
105
|
"tailwindcss": "^3.4.17",
|
|
104
106
|
"typescript": "^5.8.2",
|
|
105
107
|
"vfile": "^6.0.3",
|
package/dist/runtime/tsconfig.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var tsconfig_namespaceObject = JSON.parse('{"compilerOptions":{"rootDir":".","baseUrl":".","skipLibCheck":true,"jsx":"react-jsx","esModuleInterop":true},"include":["./**/*"]}');
|
|
2
|
-
var __webpack_exports__compilerOptions = tsconfig_namespaceObject.compilerOptions;
|
|
3
|
-
var __webpack_exports__include = tsconfig_namespaceObject.include;
|
|
4
|
-
export { __webpack_exports__compilerOptions as compilerOptions, __webpack_exports__include as include };
|