@rspress/core 2.0.0-beta.3 → 2.0.0-beta.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.
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ 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
23
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
24
|
-
import * as
|
|
24
|
+
import * as __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__ from "@unhead/react/server";
|
|
25
25
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
26
26
|
import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
|
|
27
27
|
export * from "@rspress/shared";
|
|
@@ -177,7 +177,7 @@ const pluginVirtualModule = (pluginOptions = {})=>({
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.
|
|
180
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.4"}');
|
|
181
181
|
const RSPRESS_VERSION = package_namespaceObject.i8;
|
|
182
182
|
const isProduction = ()=>'production' === process.env.NODE_ENV;
|
|
183
183
|
const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
|
|
@@ -199,8 +199,6 @@ const OUTPUT_DIR = 'doc_build';
|
|
|
199
199
|
const APP_HTML_MARKER = '<!--<?- DOC_CONTENT ?>-->';
|
|
200
200
|
const HEAD_MARKER = '<!--<?- HEAD ?>-->';
|
|
201
201
|
const META_GENERATOR = '<!--<?- GENERATOR ?>-->';
|
|
202
|
-
const HTML_START_TAG = '<html';
|
|
203
|
-
const BODY_START_TAG = '<body';
|
|
204
202
|
const DEFAULT_TITLE = 'Rspress';
|
|
205
203
|
const PUBLIC_DIR = 'public';
|
|
206
204
|
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);
|
|
@@ -1114,28 +1112,21 @@ async function renderPages(routeService, config, pluginDriver, ssrBundlePath, ht
|
|
|
1114
1112
|
routePath: '/404'
|
|
1115
1113
|
});
|
|
1116
1114
|
await Promise.all(allRoutes.filter((route)=>!route.routePath.includes(':')).map(async (route)=>{
|
|
1117
|
-
const
|
|
1115
|
+
const head = (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.createHead)();
|
|
1118
1116
|
const { routePath } = route;
|
|
1119
1117
|
let appHtml = '';
|
|
1120
1118
|
if (render) try {
|
|
1121
|
-
({ appHtml } = await render(routePath,
|
|
1119
|
+
({ appHtml } = await render(routePath, head));
|
|
1122
1120
|
} catch (e) {
|
|
1123
1121
|
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error(`Page "${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].yellow(routePath)}" SSG rendering failed.`);
|
|
1124
1122
|
__WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.debug(e);
|
|
1125
1123
|
throw e;
|
|
1126
1124
|
}
|
|
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, [
|
|
1125
|
+
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
1126
|
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
1127
|
await renderFrontmatterHead(route)
|
|
1136
1128
|
].join(''));
|
|
1137
|
-
|
|
1138
|
-
if (helmet.bodyAttributes) html = html.replace(BODY_START_TAG, `${BODY_START_TAG} ${helmet.bodyAttributes?.toString()}`);
|
|
1129
|
+
const html = await (0, __WEBPACK_EXTERNAL_MODULE__unhead_react_server_7e85c952__.transformHtmlTemplate)(head, replacedHtmlTemplate);
|
|
1139
1130
|
const normalizeHtmlFilePath = (path)=>{
|
|
1140
1131
|
const normalizedBase = `${(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeSlash)(config?.base || '/')}/`;
|
|
1141
1132
|
if (path.endsWith('/')) return `${path}index.html`.replace(normalizedBase, '');
|
|
@@ -1396,6 +1387,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1396
1387
|
}
|
|
1397
1388
|
},
|
|
1398
1389
|
dev: {
|
|
1390
|
+
lazyCompilation: 'false' !== process.env.RSPRESS_LAZY_COMPILATION,
|
|
1399
1391
|
progressBar: false,
|
|
1400
1392
|
setupMiddlewares: [
|
|
1401
1393
|
(middlewares)=>{
|
|
@@ -1493,12 +1485,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1493
1485
|
sideEffects: true
|
|
1494
1486
|
});
|
|
1495
1487
|
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
1488
|
}
|
|
1503
1489
|
},
|
|
1504
1490
|
environments: {
|
package/dist/runtime/App.d.ts
CHANGED
package/dist/runtime/App.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE__dr_pogodin_react_helmet_ecf718aa__ from "@dr.pogodin/react-helmet";
|
|
3
2
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
|
|
5
4
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE_virtual_global_components_43dbb356__ from "virtual-global-components";
|
|
7
6
|
import "virtual-global-styles";
|
|
8
7
|
import * as __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__ from "./initPageData.js";
|
|
9
|
-
function App(
|
|
8
|
+
function App() {
|
|
10
9
|
const { setData: setPageData, data } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.DataContext);
|
|
11
10
|
const { pathname, search } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.useLocation)();
|
|
12
11
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
@@ -28,8 +27,7 @@ function App({ helmetContext }) {
|
|
|
28
27
|
const GLOBAL_COMPONENTS_KEY = 'globalUIComponents';
|
|
29
28
|
const query = new URLSearchParams(search);
|
|
30
29
|
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,
|
|
30
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
33
31
|
children: [
|
|
34
32
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__.Layout, {}),
|
|
35
33
|
!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,5 +1,6 @@
|
|
|
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
|
}>;
|
|
@@ -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
8
|
import * as __WEBPACK_EXTERNAL_MODULE_virtual_routes_ssr_f802e6e5__ from "virtual-routes-ssr";
|
|
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
|
})
|
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.4",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -42,13 +42,14 @@
|
|
|
42
42
|
"theme.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@dr.pogodin/react-helmet": "2.0.4",
|
|
46
45
|
"@mdx-js/loader": "^3.1.0",
|
|
47
46
|
"@mdx-js/mdx": "^3.1.0",
|
|
48
47
|
"@mdx-js/react": "^3.1.0",
|
|
49
|
-
"@rsbuild/core": "1.3.
|
|
50
|
-
"@rsbuild/plugin-react": "~1.
|
|
48
|
+
"@rsbuild/core": "1.3.16",
|
|
49
|
+
"@rsbuild/plugin-react": "~1.3.0",
|
|
51
50
|
"@rspress/mdx-rs": "0.6.6",
|
|
51
|
+
"@types/unist": "^3.0.0",
|
|
52
|
+
"@unhead/react": "^2.0.0",
|
|
52
53
|
"enhanced-resolve": "5.18.1",
|
|
53
54
|
"github-slugger": "^2.0.0",
|
|
54
55
|
"hast-util-from-html": "^2.0.3",
|
|
@@ -70,17 +71,17 @@
|
|
|
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/
|
|
77
|
-
"@rspress/
|
|
78
|
-
"@rspress/theme-default": "2.0.0-beta.
|
|
79
|
-
"@rspress/
|
|
74
|
+
"@rspress/plugin-container-syntax": "2.0.0-beta.4",
|
|
75
|
+
"@rspress/plugin-last-updated": "2.0.0-beta.4",
|
|
76
|
+
"@rspress/plugin-medium-zoom": "2.0.0-beta.4",
|
|
77
|
+
"@rspress/runtime": "2.0.0-beta.4",
|
|
78
|
+
"@rspress/shared": "2.0.0-beta.4",
|
|
79
|
+
"@rspress/theme-default": "2.0.0-beta.4",
|
|
80
|
+
"@rspress/plugin-auto-nav-sidebar": "2.0.0-beta.4"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@microsoft/api-extractor": "^7.52.
|
|
83
|
-
"@rslib/core": "0.6.
|
|
83
|
+
"@microsoft/api-extractor": "^7.52.7",
|
|
84
|
+
"@rslib/core": "0.6.8",
|
|
84
85
|
"@rspress-dev/plugin-preview": "link:../plugin-preview",
|
|
85
86
|
"@types/hast": "^3.0.4",
|
|
86
87
|
"@types/html-to-text": "^9.0.4",
|
|
@@ -88,9 +89,9 @@
|
|
|
88
89
|
"@types/lodash-es": "^4.17.12",
|
|
89
90
|
"@types/mdast": "^4.0.4",
|
|
90
91
|
"@types/node": "^18.11.17",
|
|
91
|
-
"@types/react": "^18.3.
|
|
92
|
-
"@types/react-dom": "^18.3.
|
|
93
|
-
"memfs": "^4.17.
|
|
92
|
+
"@types/react": "^18.3.21",
|
|
93
|
+
"@types/react-dom": "^18.3.7",
|
|
94
|
+
"memfs": "^4.17.1",
|
|
94
95
|
"postcss": "8.5.3",
|
|
95
96
|
"rehype-stringify": "^10.0.1",
|
|
96
97
|
"remark-mdx": "^3.1.0",
|
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 };
|