@rspress/core 1.43.0 → 2.0.0-alpha.0
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 +46 -17
- package/dist/runtime/App.js +1 -1
- package/dist/runtime/clientEntry.js +3 -7
- package/package.json +19 -19
- package/theme.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_less_4c557a99__ from "@rsb
|
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__ from "@rsbuild/plugin-react";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_sass_b13a7d33__ from "@rsbuild/plugin-sass";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
11
13
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
|
|
12
14
|
import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
|
|
13
15
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
@@ -22,9 +24,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
|
22
24
|
import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
|
|
23
25
|
import * as __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__ from "enhanced-resolve";
|
|
24
26
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
25
|
-
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
26
27
|
import * as __WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__ from "react-helmet-async";
|
|
27
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
28
28
|
export * from "@rspress/shared";
|
|
29
29
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
30
30
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -208,6 +208,48 @@ const BODY_START_TAG = '<body';
|
|
|
208
208
|
const DEFAULT_TITLE = 'Rspress';
|
|
209
209
|
const PUBLIC_DIR = 'public';
|
|
210
210
|
const TEMP_DIR = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR);
|
|
211
|
+
async function pathExists(path) {
|
|
212
|
+
try {
|
|
213
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].access(path);
|
|
214
|
+
return true;
|
|
215
|
+
} catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async function readJson(path) {
|
|
220
|
+
const raw = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(path, 'utf8');
|
|
221
|
+
return JSON.parse(raw);
|
|
222
|
+
}
|
|
223
|
+
const THEME_DEFAULT_EXPORT_PATTERN = /export default \{(.*?)\}/m;
|
|
224
|
+
async function hintThemeBreakingChange(customThemeDir) {
|
|
225
|
+
const fileList = [
|
|
226
|
+
'index.ts',
|
|
227
|
+
'index.tsx',
|
|
228
|
+
'index.js',
|
|
229
|
+
'index.mjs'
|
|
230
|
+
];
|
|
231
|
+
let useDefaultExportFilePath = null;
|
|
232
|
+
for (const file of fileList){
|
|
233
|
+
const filePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(customThemeDir, file);
|
|
234
|
+
if (await pathExists(filePath)) {
|
|
235
|
+
const content = await (0, __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__.readFile)(filePath, {
|
|
236
|
+
encoding: 'utf-8'
|
|
237
|
+
});
|
|
238
|
+
if (THEME_DEFAULT_EXPORT_PATTERN.test(content)) useDefaultExportFilePath = filePath;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (useDefaultExportFilePath) __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.warn(`[Rspress] Theme breaking change: The theme/index is now using namedExports instead of defaultExports, please update your config file in ${useDefaultExportFilePath}`, __WEBPACK_EXTERNAL_MODULE_picocolors__["default"].red(`
|
|
242
|
+
- import Theme from '@rspress/theme-default';
|
|
243
|
+
- export default {
|
|
244
|
+
- ...Theme,
|
|
245
|
+
- Layout,
|
|
246
|
+
- };
|
|
247
|
+
- export * from 'rspress/theme';`) + __WEBPACK_EXTERNAL_MODULE_picocolors__["default"].green(`+ import { Layout } from '@rspress/theme-default';
|
|
248
|
+
|
|
249
|
+
+ export { Layout };
|
|
250
|
+
+ export * from 'rspress/theme';
|
|
251
|
+
`));
|
|
252
|
+
}
|
|
211
253
|
const isWindows = 'win32' === __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__["default"].platform();
|
|
212
254
|
function slash(p) {
|
|
213
255
|
return p.replace(/\\/g, '/');
|
|
@@ -1093,18 +1135,6 @@ function serveSearchIndexMiddleware(config) {
|
|
|
1093
1135
|
} else null == next || next();
|
|
1094
1136
|
};
|
|
1095
1137
|
}
|
|
1096
|
-
async function pathExists(path) {
|
|
1097
|
-
try {
|
|
1098
|
-
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].access(path);
|
|
1099
|
-
return true;
|
|
1100
|
-
} catch {
|
|
1101
|
-
return false;
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
async function readJson(path) {
|
|
1105
|
-
const raw = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(path, 'utf8');
|
|
1106
|
-
return JSON.parse(raw);
|
|
1107
|
-
}
|
|
1108
1138
|
const { CachedInputFileSystem: detectReactVersion_CachedInputFileSystem, ResolverFactory: detectReactVersion_ResolverFactory } = __WEBPACK_EXTERNAL_MODULE_enhanced_resolve_bf4706da__["default"];
|
|
1109
1139
|
const DEFAULT_REACT_VERSION = 18;
|
|
1110
1140
|
async function detectReactVersion() {
|
|
@@ -1220,6 +1250,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1220
1250
|
if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(icon)) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(userDocRoot, PUBLIC_DIR, icon);
|
|
1221
1251
|
return icon;
|
|
1222
1252
|
};
|
|
1253
|
+
await hintThemeBreakingChange(CUSTOM_THEME_DIR);
|
|
1223
1254
|
const [detectCustomIconAlias, reactCSRAlias, reactSSRAlias] = await Promise.all([
|
|
1224
1255
|
detectCustomIcon(CUSTOM_THEME_DIR),
|
|
1225
1256
|
resolveReactAlias(reactVersion, false),
|
|
@@ -1536,9 +1567,7 @@ async function dev(options) {
|
|
|
1536
1567
|
await checkLanguageParity(modifiedConfig);
|
|
1537
1568
|
}
|
|
1538
1569
|
}
|
|
1539
|
-
var package_namespaceObject = {
|
|
1540
|
-
i8: "1.43.0"
|
|
1541
|
-
};
|
|
1570
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-alpha.0"}');
|
|
1542
1571
|
async function renderFrontmatterHead(route) {
|
|
1543
1572
|
if (!isRouteMeta(route)) return '';
|
|
1544
1573
|
const content = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(route.absolutePath, {
|
package/dist/runtime/App.js
CHANGED
|
@@ -92,7 +92,7 @@ function App({ helmetContext }) {
|
|
|
92
92
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__.HelmetProvider, {
|
|
93
93
|
context: helmetContext,
|
|
94
94
|
children: [
|
|
95
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__
|
|
95
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__.Layout, {}),
|
|
96
96
|
!hideGlobalUIComponents && __WEBPACK_EXTERNAL_MODULE_virtual_global_components_43dbb356__["default"].map((componentInfo, index)=>{
|
|
97
97
|
if (Array.isArray(componentInfo)) {
|
|
98
98
|
const [component, props] = componentInfo;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
|
|
2
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__ from "react-dom";
|
|
3
2
|
import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__ from "react-dom/client";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
5
4
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__ from "virtual-site-data";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__App_js_3638e61b__ from "./App.js";
|
|
10
10
|
var __webpack_modules__ = {
|
|
11
|
-
"@theme": function(module) {
|
|
12
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__theme_75e53063__;
|
|
13
|
-
},
|
|
14
11
|
"react-dom": function(module) {
|
|
15
12
|
module.exports = __WEBPACK_EXTERNAL_MODULE_react_dom_7136dc57__;
|
|
16
13
|
},
|
|
@@ -29,14 +26,13 @@ function __webpack_require__(moduleId) {
|
|
|
29
26
|
return module.exports;
|
|
30
27
|
}
|
|
31
28
|
const enableSSG = __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].ssg;
|
|
32
|
-
const { default: Theme, useThemeState } = __webpack_require__("@theme");
|
|
33
29
|
async function renderInBrowser() {
|
|
34
30
|
const container = document.getElementById('root');
|
|
35
31
|
const enhancedApp = async ()=>{
|
|
36
32
|
const initialPageData = await (0, __WEBPACK_EXTERNAL_MODULE__App_js_3638e61b__.initPageData)(window.location.pathname);
|
|
37
33
|
return function() {
|
|
38
34
|
const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(initialPageData);
|
|
39
|
-
const [theme, setTheme] = useThemeState();
|
|
35
|
+
const [theme, setTheme] = (0, __WEBPACK_EXTERNAL_MODULE__theme_75e53063__.useThemeState)();
|
|
40
36
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.ThemeContext.Provider, {
|
|
41
37
|
value: (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
|
|
42
38
|
theme,
|
|
@@ -72,6 +68,6 @@ async function renderInBrowser() {
|
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
70
|
renderInBrowser().then(()=>{
|
|
75
|
-
|
|
71
|
+
(0, __WEBPACK_EXTERNAL_MODULE__theme_75e53063__.setup)();
|
|
76
72
|
});
|
|
77
73
|
export { renderInBrowser };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"main": "./dist/index.js",
|
|
36
|
-
"module": "./dist/
|
|
36
|
+
"module": "./dist/index.js",
|
|
37
37
|
"types": "./dist/index.d.ts",
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@mdx-js/loader": "2.3.0",
|
|
46
46
|
"@mdx-js/mdx": "2.3.0",
|
|
47
47
|
"@mdx-js/react": "2.3.0",
|
|
48
|
-
"@rsbuild/core": "1.2.
|
|
49
|
-
"@rsbuild/plugin-less": "~1.1.
|
|
50
|
-
"@rsbuild/plugin-react": "~1.1.
|
|
51
|
-
"@rsbuild/plugin-sass": "~1.2.
|
|
48
|
+
"@rsbuild/core": "1.2.15",
|
|
49
|
+
"@rsbuild/plugin-less": "~1.1.1",
|
|
50
|
+
"@rsbuild/plugin-react": "~1.1.1",
|
|
51
|
+
"@rsbuild/plugin-sass": "~1.2.2",
|
|
52
52
|
"@rspress/mdx-rs": "0.6.6",
|
|
53
|
-
"enhanced-resolve": "5.18.
|
|
53
|
+
"enhanced-resolve": "5.18.1",
|
|
54
54
|
"github-slugger": "^2.0.0",
|
|
55
55
|
"hast-util-from-html": "^2.0.3",
|
|
56
56
|
"hast-util-heading-rank": "^2.1.1",
|
|
@@ -69,21 +69,21 @@
|
|
|
69
69
|
"remark": "^14.0.3",
|
|
70
70
|
"remark-gfm": "3.0.1",
|
|
71
71
|
"rspack-plugin-virtual-module": "0.1.13",
|
|
72
|
-
"tinyglobby": "^0.2.
|
|
72
|
+
"tinyglobby": "^0.2.12",
|
|
73
73
|
"unified": "^10.1.2",
|
|
74
74
|
"unist-util-visit": "^4.1.2",
|
|
75
75
|
"unist-util-visit-children": "^2.0.2",
|
|
76
|
-
"@rspress/plugin-auto-nav-sidebar": "
|
|
77
|
-
"@rspress/plugin-
|
|
78
|
-
"@rspress/plugin-
|
|
79
|
-
"@rspress/
|
|
80
|
-
"@rspress/shared": "
|
|
81
|
-
"@rspress/
|
|
82
|
-
"@rspress/
|
|
76
|
+
"@rspress/plugin-auto-nav-sidebar": "2.0.0-alpha.0",
|
|
77
|
+
"@rspress/plugin-container-syntax": "2.0.0-alpha.0",
|
|
78
|
+
"@rspress/plugin-last-updated": "2.0.0-alpha.0",
|
|
79
|
+
"@rspress/plugin-medium-zoom": "2.0.0-alpha.0",
|
|
80
|
+
"@rspress/shared": "2.0.0-alpha.0",
|
|
81
|
+
"@rspress/runtime": "2.0.0-alpha.0",
|
|
82
|
+
"@rspress/theme-default": "2.0.0-alpha.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@microsoft/api-extractor": "^7.
|
|
86
|
-
"@rslib/core": "0.5.
|
|
85
|
+
"@microsoft/api-extractor": "^7.51.1",
|
|
86
|
+
"@rslib/core": "0.5.3",
|
|
87
87
|
"@rspress-dev/plugin-preview": "link:../plugin-preview",
|
|
88
88
|
"@types/hast": "^2.3.10",
|
|
89
89
|
"@types/html-to-text": "^9.0.4",
|
|
@@ -93,11 +93,11 @@
|
|
|
93
93
|
"@types/node": "^18.11.17",
|
|
94
94
|
"@types/react": "^18.3.18",
|
|
95
95
|
"@types/react-dom": "^18.3.5",
|
|
96
|
-
"postcss": "8.5.
|
|
96
|
+
"postcss": "8.5.3",
|
|
97
97
|
"rehype-stringify": "^9.0.4",
|
|
98
98
|
"remark-parse": "^10.0.2",
|
|
99
99
|
"remark-rehype": "^10.1.0",
|
|
100
|
-
"rimraf": "^
|
|
100
|
+
"rimraf": "^6.0.1",
|
|
101
101
|
"tailwindcss": "^3.4.17",
|
|
102
102
|
"typescript": "^5.5.3",
|
|
103
103
|
"@rspress/config": "1.0.0"
|
package/theme.ts
CHANGED