@rspress/core 2.0.0-alpha.0 → 2.0.0-alpha.2
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.d.ts +2 -1
- package/dist/index.js +2 -16
- package/dist/loader.js +3 -4
- package/package.json +10 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mergeDocConfig } from '@rspress/shared/node-utils';
|
|
2
2
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
3
|
+
import { RsbuildInstance } from '@rsbuild/core';
|
|
3
4
|
import { UserConfig } from '@rspress/shared';
|
|
4
5
|
|
|
5
6
|
export declare function build(options: BuildOptions): Promise<void>;
|
|
@@ -21,7 +22,7 @@ declare interface DevOptions {
|
|
|
21
22
|
|
|
22
23
|
export { mergeDocConfig }
|
|
23
24
|
|
|
24
|
-
export declare function serve(options: ServeOptions): Promise<
|
|
25
|
+
export declare function serve(options: ServeOptions): Promise<ReturnType<RsbuildInstance['preview']>>;
|
|
25
26
|
|
|
26
27
|
declare interface ServeOptions {
|
|
27
28
|
config: UserConfig;
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__rspress_plugin_container_syntax_12d3c700_
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_less_4c557a99__ from "@rsbuild/plugin-less";
|
|
8
7
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__ from "@rsbuild/plugin-react";
|
|
9
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_sass_b13a7d33__ from "@rsbuild/plugin-sass";
|
|
10
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
11
9
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
12
10
|
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
@@ -531,12 +529,6 @@ async function initRouteService(options) {
|
|
|
531
529
|
async function globalStylesVMPlugin(context) {
|
|
532
530
|
const { config, pluginDriver } = context;
|
|
533
531
|
const globalStylesByPlugins = pluginDriver.globalStyles();
|
|
534
|
-
if (config.globalStyles) {
|
|
535
|
-
const source = config.globalStyles;
|
|
536
|
-
const styleContent = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(source, 'utf-8');
|
|
537
|
-
const patchedStyleContent = styleContent.replace(/--modern-/g, '--rp-').replace(/\.modern-doc/g, '.rspress').replace(/\.modern-/g, '.rspress-');
|
|
538
|
-
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(source, patchedStyleContent, 'utf-8');
|
|
539
|
-
}
|
|
540
532
|
const moduleContent = (await Promise.all([
|
|
541
533
|
(null == config ? void 0 : config.globalStyles) || '',
|
|
542
534
|
...globalStylesByPlugins
|
|
@@ -1261,12 +1253,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
1261
1253
|
...isPluginIncluded(config, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__.PLUGIN_REACT_NAME) ? [] : [
|
|
1262
1254
|
(0, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__.pluginReact)()
|
|
1263
1255
|
],
|
|
1264
|
-
...isPluginIncluded(config, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_sass_b13a7d33__.PLUGIN_SASS_NAME) ? [] : [
|
|
1265
|
-
(0, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_sass_b13a7d33__.pluginSass)()
|
|
1266
|
-
],
|
|
1267
|
-
...isPluginIncluded(config, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_less_4c557a99__.PLUGIN_LESS_NAME) ? [] : [
|
|
1268
|
-
(0, __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_less_4c557a99__.pluginLess)()
|
|
1269
|
-
],
|
|
1270
1256
|
rsbuildPluginDocVM({
|
|
1271
1257
|
userDocRoot,
|
|
1272
1258
|
config,
|
|
@@ -1567,7 +1553,7 @@ async function dev(options) {
|
|
|
1567
1553
|
await checkLanguageParity(modifiedConfig);
|
|
1568
1554
|
}
|
|
1569
1555
|
}
|
|
1570
|
-
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-alpha.
|
|
1556
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-alpha.2"}');
|
|
1571
1557
|
async function renderFrontmatterHead(route) {
|
|
1572
1558
|
if (!isRouteMeta(route)) return '';
|
|
1573
1559
|
const content = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(route.absolutePath, {
|
|
@@ -1730,7 +1716,7 @@ async function serve(options) {
|
|
|
1730
1716
|
await pluginDriver.init();
|
|
1731
1717
|
const modifiedConfig = await pluginDriver.modifyConfig();
|
|
1732
1718
|
const builder = await initRsbuild(config.root, modifiedConfig, pluginDriver, false);
|
|
1733
|
-
|
|
1719
|
+
return builder.preview();
|
|
1734
1720
|
}
|
|
1735
1721
|
var __webpack_exports__mergeDocConfig = __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.mergeDocConfig;
|
|
1736
1722
|
export { build, dev, serve, __webpack_exports__mergeDocConfig as mergeDocConfig };
|
package/dist/loader.js
CHANGED
|
@@ -242,7 +242,7 @@ function checkLinks(links, filepath, root, routeService) {
|
|
|
242
242
|
const errorInfos = [];
|
|
243
243
|
links.filter((link)=>!IGNORE_REGEXP.test(link)).map((link)=>normalizePath(link)).forEach((link)=>{
|
|
244
244
|
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, filepath);
|
|
245
|
-
if (!routeService.isExistRoute((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.cleanUrl)(link))) errorInfos.push(`Internal link to ${link} is dead, check it in ${relativePath}`);
|
|
245
|
+
if (!routeService.isExistRoute((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.cleanUrl)(link))) errorInfos.push(`Internal link to "${link}" is dead, check it in "${relativePath}"`);
|
|
246
246
|
});
|
|
247
247
|
if (errorInfos.length > 0) {
|
|
248
248
|
null == errorInfos || errorInfos.forEach((err)=>{
|
|
@@ -267,7 +267,7 @@ const remarkCheckDeadLinks = (checkLink)=>{
|
|
|
267
267
|
checkLinks(Array.from(internalLinks), vfile.path, root, routeService);
|
|
268
268
|
};
|
|
269
269
|
};
|
|
270
|
-
const remarkPluginNormalizeLink = ({
|
|
270
|
+
const remarkPluginNormalizeLink = ({ root, cleanUrls })=>(tree, file)=>{
|
|
271
271
|
const images = [];
|
|
272
272
|
(0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'link', (node)=>{
|
|
273
273
|
if (!node.url) return;
|
|
@@ -286,7 +286,7 @@ const remarkPluginNormalizeLink = ({ base, root, cleanUrls })=>(tree, file)=>{
|
|
|
286
286
|
if (url.startsWith('.')) url = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.slash)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(relativePath)), url);
|
|
287
287
|
url = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeHref)(url, cleanUrls);
|
|
288
288
|
if (hash) url += `#${hash}`;
|
|
289
|
-
node.url =
|
|
289
|
+
node.url = url;
|
|
290
290
|
});
|
|
291
291
|
const normalizeImageUrl = (imageUrl)=>{
|
|
292
292
|
if ((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isExternalUrl)(imageUrl) || imageUrl.startsWith('/')) return '';
|
|
@@ -437,7 +437,6 @@ async function createMDXOptions(docDirectory, config, checkDeadLinks, routeServi
|
|
|
437
437
|
[
|
|
438
438
|
remarkPluginNormalizeLink,
|
|
439
439
|
{
|
|
440
|
-
base: (null == config ? void 0 : config.base) || '',
|
|
441
440
|
cleanUrls,
|
|
442
441
|
defaultLang,
|
|
443
442
|
root: docDirectory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -45,10 +45,8 @@
|
|
|
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.1",
|
|
48
|
+
"@rsbuild/core": "1.2.16",
|
|
50
49
|
"@rsbuild/plugin-react": "~1.1.1",
|
|
51
|
-
"@rsbuild/plugin-sass": "~1.2.2",
|
|
52
50
|
"@rspress/mdx-rs": "0.6.6",
|
|
53
51
|
"enhanced-resolve": "5.18.1",
|
|
54
52
|
"github-slugger": "^2.0.0",
|
|
@@ -58,7 +56,6 @@
|
|
|
58
56
|
"htmr": "^1.0.2",
|
|
59
57
|
"lodash-es": "^4.17.21",
|
|
60
58
|
"mdast-util-mdxjs-esm": "^1.3.1",
|
|
61
|
-
"memfs": "^4.17.0",
|
|
62
59
|
"picocolors": "^1.1.1",
|
|
63
60
|
"react": "^18.3.1",
|
|
64
61
|
"react-dom": "^18.3.1",
|
|
@@ -73,13 +70,13 @@
|
|
|
73
70
|
"unified": "^10.1.2",
|
|
74
71
|
"unist-util-visit": "^4.1.2",
|
|
75
72
|
"unist-util-visit-children": "^2.0.2",
|
|
76
|
-
"@rspress/plugin-auto-nav-sidebar": "2.0.0-alpha.
|
|
77
|
-
"@rspress/plugin-container-syntax": "2.0.0-alpha.
|
|
78
|
-
"@rspress/plugin-last-updated": "2.0.0-alpha.
|
|
79
|
-
"@rspress/plugin-medium-zoom": "2.0.0-alpha.
|
|
80
|
-
"@rspress/
|
|
81
|
-
"@rspress/
|
|
82
|
-
"@rspress/
|
|
73
|
+
"@rspress/plugin-auto-nav-sidebar": "2.0.0-alpha.2",
|
|
74
|
+
"@rspress/plugin-container-syntax": "2.0.0-alpha.2",
|
|
75
|
+
"@rspress/plugin-last-updated": "2.0.0-alpha.2",
|
|
76
|
+
"@rspress/plugin-medium-zoom": "2.0.0-alpha.2",
|
|
77
|
+
"@rspress/runtime": "2.0.0-alpha.2",
|
|
78
|
+
"@rspress/theme-default": "2.0.0-alpha.2",
|
|
79
|
+
"@rspress/shared": "2.0.0-alpha.2"
|
|
83
80
|
},
|
|
84
81
|
"devDependencies": {
|
|
85
82
|
"@microsoft/api-extractor": "^7.51.1",
|
|
@@ -93,6 +90,7 @@
|
|
|
93
90
|
"@types/node": "^18.11.17",
|
|
94
91
|
"@types/react": "^18.3.18",
|
|
95
92
|
"@types/react-dom": "^18.3.5",
|
|
93
|
+
"memfs": "^4.17.0",
|
|
96
94
|
"postcss": "8.5.3",
|
|
97
95
|
"rehype-stringify": "^9.0.4",
|
|
98
96
|
"remark-parse": "^10.0.2",
|