@rspress/core 2.0.0-alpha.1 → 2.0.0-alpha.3

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 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<void>;
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
@@ -963,7 +955,7 @@ async function siteDataVMPlugin(context) {
963
955
  const replaceRules = (null == userConfig ? void 0 : userConfig.replaceRules) || [];
964
956
  const searchConfig = (null == userConfig ? void 0 : userConfig.search) || {};
965
957
  const domain = (null == searchConfig ? void 0 : searchConfig.mode) === 'remote' ? searchConfig.domain ?? '' : '';
966
- const searchCodeBlocks = 'codeBlocks' in searchConfig ? Boolean(searchConfig.codeBlocks) : false;
958
+ const searchCodeBlocks = 'codeBlocks' in searchConfig ? Boolean(searchConfig.codeBlocks) : true;
967
959
  const pages = await extractPageData(replaceRules, alias, domain, userDocRoot, routeService, highlightLanguages, searchCodeBlocks);
968
960
  await pluginDriver.modifySearchIndexData(pages);
969
961
  const versioned = userConfig.search && 'remote' !== userConfig.search.mode && userConfig.search.versioned;
@@ -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.1"}');
1556
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-alpha.3"}');
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, {
@@ -1650,7 +1636,7 @@ async function renderPages(appDirectory, config, pluginDriver, ssgConfig) {
1650
1636
  routePath: '/404'
1651
1637
  });
1652
1638
  await Promise.all(allRoutes.filter((route)=>!route.routePath.includes(':')).map(async (route)=>{
1653
- const helmetContext = new __WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__.HelmetData({});
1639
+ const helmetContext = new __WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__["default"].HelmetData({});
1654
1640
  const { routePath } = route;
1655
1641
  let appHtml = '';
1656
1642
  if (render) try {
@@ -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
- await builder.preview();
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 = ({ base, root, cleanUrls })=>(tree, file)=>{
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 = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(base, 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.1",
3
+ "version": "2.0.0-alpha.3",
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.16",
49
- "@rsbuild/plugin-less": "~1.1.1",
48
+ "@rsbuild/core": "1.2.19",
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,11 +56,10 @@
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",
65
- "react-helmet-async": "^1.3.0",
62
+ "react-helmet-async": "^2.0.5",
66
63
  "react-lazy-with-preload": "^2.2.1",
67
64
  "react-syntax-highlighter": "^15.6.1",
68
65
  "rehype-external-links": "^3.0.0",
@@ -73,17 +70,17 @@
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.1",
77
- "@rspress/plugin-container-syntax": "2.0.0-alpha.1",
78
- "@rspress/plugin-last-updated": "2.0.0-alpha.1",
79
- "@rspress/plugin-medium-zoom": "2.0.0-alpha.1",
80
- "@rspress/runtime": "2.0.0-alpha.1",
81
- "@rspress/shared": "2.0.0-alpha.1",
82
- "@rspress/theme-default": "2.0.0-alpha.1"
73
+ "@rspress/plugin-container-syntax": "2.0.0-alpha.3",
74
+ "@rspress/plugin-last-updated": "2.0.0-alpha.3",
75
+ "@rspress/plugin-medium-zoom": "2.0.0-alpha.3",
76
+ "@rspress/plugin-auto-nav-sidebar": "2.0.0-alpha.3",
77
+ "@rspress/shared": "2.0.0-alpha.3",
78
+ "@rspress/runtime": "2.0.0-alpha.3",
79
+ "@rspress/theme-default": "2.0.0-alpha.3"
83
80
  },
84
81
  "devDependencies": {
85
- "@microsoft/api-extractor": "^7.51.1",
86
- "@rslib/core": "0.5.3",
82
+ "@microsoft/api-extractor": "^7.52.1",
83
+ "@rslib/core": "0.5.4",
87
84
  "@rspress-dev/plugin-preview": "link:../plugin-preview",
88
85
  "@types/hast": "^2.3.10",
89
86
  "@types/html-to-text": "^9.0.4",
@@ -93,13 +90,14 @@
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",
99
97
  "remark-rehype": "^10.1.0",
100
98
  "rimraf": "^6.0.1",
101
99
  "tailwindcss": "^3.4.17",
102
- "typescript": "^5.5.3",
100
+ "typescript": "^5.8.2",
103
101
  "@rspress/config": "1.0.0"
104
102
  },
105
103
  "engines": {