@rspress/core 2.0.0-beta.25 → 2.0.0-beta.27

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/cli.js CHANGED
@@ -6,7 +6,7 @@ import picocolors from "picocolors";
6
6
  import { build, dev, serve } from "./index.js";
7
7
  import node_fs from "node:fs";
8
8
  import { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
9
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.25"}');
9
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.27"}');
10
10
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
11
11
  async function loadConfigFile(customConfigFile) {
12
12
  const baseDir = process.cwd();
package/dist/index.js CHANGED
@@ -151,7 +151,7 @@ function defineConfig(config) {
151
151
  }
152
152
  var external_node_path_ = __webpack_require__("node:path");
153
153
  var external_node_url_ = __webpack_require__("node:url");
154
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.25"}');
154
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.27"}');
155
155
  const RSPRESS_VERSION = package_namespaceObject.i8;
156
156
  const isProduction = ()=>'production' === process.env.NODE_ENV;
157
157
  const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
@@ -821,6 +821,15 @@ async function walk(workDir, docsDir, extensions) {
821
821
  const metaConfig = await utils_readJson(rootMetaJson);
822
822
  hintNavJsonChangeThenPanic(metaConfig, workDir, docsDir);
823
823
  }
824
+ if (isRootMetaJsonExist && isRootNavJsonExist) {
825
+ const navConfig = await scanNav(workDir, docsDir);
826
+ return {
827
+ nav: navConfig,
828
+ sidebar: {
829
+ '/': await scanSideMeta(workDir, docsDir, extensions)
830
+ }
831
+ };
832
+ }
824
833
  if (isRootNavJsonExist) {
825
834
  const navConfig = await scanNav(workDir, docsDir);
826
835
  const subDirs = (await Promise.all((await node_fs_promises.readdir(workDir)).map((v)=>node_fs_promises.stat(external_node_path_["default"].join(workDir, v)).then((s)=>{
@@ -832,10 +841,6 @@ async function walk(workDir, docsDir, extensions) {
832
841
  const sidebarGroupKey = addRoutePrefix(workDir, docsDir, subDir);
833
842
  sidebarConfig[sidebarGroupKey] = await scanSideMeta(external_node_path_["default"].join(workDir, subDir), docsDir, extensions);
834
843
  }));
835
- if (isRootMetaJsonExist) {
836
- const rootMetaConfig = await scanSideMeta(workDir, docsDir, extensions);
837
- sidebarConfig['/'] = rootMetaConfig;
838
- }
839
844
  return {
840
845
  nav: navConfig,
841
846
  sidebar: sidebarConfig
@@ -1926,6 +1931,8 @@ function isPluginIncluded(config, pluginName) {
1926
1931
  return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
1927
1932
  }
1928
1933
  const initRsbuild_require = createRequire(import.meta.url);
1934
+ const initRsbuild_filename = (0, external_node_url_.fileURLToPath)(import.meta.url);
1935
+ const initRsbuild_dirname = external_node_path_["default"].dirname(initRsbuild_filename);
1929
1936
  async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
1930
1937
  const cwd = process.cwd();
1931
1938
  const CUSTOM_THEME_DIR = config?.themeDir ?? external_node_path_["default"].join(process.cwd(), 'theme');
@@ -2025,7 +2032,10 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2025
2032
  DEFAULT_THEME
2026
2033
  ],
2027
2034
  '@theme-assets': external_node_path_["default"].join(DEFAULT_THEME, '../assets'),
2028
- 'react-lazy-with-preload': initRsbuild_require.resolve('react-lazy-with-preload')
2035
+ 'react-lazy-with-preload': initRsbuild_require.resolve('react-lazy-with-preload'),
2036
+ '@rspress/core/theme': external_node_path_["default"].join(initRsbuild_dirname, 'theme.js'),
2037
+ '@rspress/core/runtime': external_node_path_["default"].join(initRsbuild_dirname, 'runtime.js'),
2038
+ '@rspress/core/shiki-transformers': external_node_path_["default"].join(initRsbuild_dirname, 'shiki-transformers.js')
2029
2039
  }
2030
2040
  },
2031
2041
  source: {
@@ -2042,7 +2052,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2042
2052
  ...'false' !== process.env.RSPRESS_PERSISTENT_CACHE ? {
2043
2053
  buildCache: {
2044
2054
  buildDependencies: [
2045
- (0, external_node_url_.fileURLToPath)(import.meta.url),
2055
+ initRsbuild_filename,
2046
2056
  pluginDriver.getConfigFilePath()
2047
2057
  ],
2048
2058
  cacheDigest: [
package/dist/processor.js CHANGED
@@ -754,10 +754,9 @@ async function compile(options) {
754
754
  headingTitle,
755
755
  frontmatter
756
756
  };
757
- const result = `const frontmatter = ${JSON.stringify(frontmatter)};
758
- ${compileResult}
759
- MDXContent.__RSPRESS_PAGE_META = {};
757
+ const result = `${compileResult}
760
758
 
759
+ MDXContent.__RSPRESS_PAGE_META = {};
761
760
  MDXContent.__RSPRESS_PAGE_META["${encodeURIComponent(normalizePath(node_path.relative(docDirectory, filepath)))}"] = ${JSON.stringify(pageMeta)};
762
761
  `;
763
762
  return result;
@@ -102,7 +102,7 @@ function hintSSGFailed() {
102
102
  1. Fix code to make it SSR-compatible.
103
103
  2. Set \`ssg: false\` if the code in node_modules may be difficult to fix, but the SSG feature will be lost.`);
104
104
  }
105
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.25"}');
105
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.27"}');
106
106
  const RSPRESS_VERSION = package_namespaceObject.i8;
107
107
  `{
108
108
  const saved = localStorage.getItem('${APPEARANCE_KEY}')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0-beta.25",
3
+ "version": "2.0.0-beta.27",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -54,15 +54,15 @@
54
54
  "@mdx-js/loader": "^3.1.0",
55
55
  "@mdx-js/mdx": "^3.1.0",
56
56
  "@mdx-js/react": "^3.1.0",
57
- "@rsbuild/core": "~1.4.13",
58
- "@rsbuild/plugin-react": "~1.3.4",
57
+ "@rsbuild/core": "~1.4.15",
58
+ "@rsbuild/plugin-react": "~1.3.5",
59
59
  "@rspress/mdx-rs": "0.6.6",
60
- "@shikijs/rehype": "^3.8.1",
60
+ "@shikijs/rehype": "^3.9.2",
61
61
  "@types/unist": "^3.0.3",
62
- "@unhead/react": "^2.0.13",
62
+ "@unhead/react": "^2.0.14",
63
63
  "cac": "^6.7.14",
64
64
  "chokidar": "^3.6.0",
65
- "enhanced-resolve": "5.18.2",
65
+ "enhanced-resolve": "5.18.3",
66
66
  "github-slugger": "^2.0.0",
67
67
  "hast-util-from-html": "^2.0.3",
68
68
  "hast-util-heading-rank": "^3.0.0",
@@ -74,25 +74,25 @@
74
74
  "react": "^19.1.1",
75
75
  "react-dom": "^19.1.1",
76
76
  "react-lazy-with-preload": "^2.2.1",
77
- "react-router-dom": "^6.29.0",
77
+ "react-router-dom": "^6.30.1",
78
78
  "rehype-external-links": "^3.0.0",
79
79
  "rehype-raw": "^7.0.0",
80
80
  "remark": "^15.0.1",
81
81
  "remark-gfm": "^4.0.1",
82
82
  "rspack-plugin-virtual-module": "1.0.1",
83
- "shiki": "^3.8.1",
83
+ "shiki": "^3.9.2",
84
84
  "tinyglobby": "^0.2.14",
85
85
  "tinypool": "^1.1.1",
86
86
  "unified": "^11.0.5",
87
87
  "unist-util-visit": "^5.0.0",
88
88
  "unist-util-visit-children": "^3.0.0",
89
- "@rspress/runtime": "2.0.0-beta.25",
90
- "@rspress/shared": "2.0.0-beta.25",
91
- "@rspress/theme-default": "2.0.0-beta.25"
89
+ "@rspress/runtime": "2.0.0-beta.27",
90
+ "@rspress/shared": "2.0.0-beta.27",
91
+ "@rspress/theme-default": "2.0.0-beta.27"
92
92
  },
93
93
  "devDependencies": {
94
94
  "@microsoft/api-extractor": "^7.52.10",
95
- "@rslib/core": "0.11.1",
95
+ "@rslib/core": "0.11.2",
96
96
  "@types/hast": "^3.0.4",
97
97
  "@types/html-to-text": "^9.0.4",
98
98
  "@types/jest": "~29.5.14",
@@ -114,8 +114,8 @@
114
114
  "remark-rehype": "^11.1.2",
115
115
  "remark-stringify": "^11.0.0",
116
116
  "rimraf": "^6.0.1",
117
- "rsbuild-plugin-publint": "^0.3.2",
118
- "rsbuild-plugin-virtual-module": "0.3.0",
117
+ "rsbuild-plugin-publint": "^0.3.3",
118
+ "rsbuild-plugin-virtual-module": "0.3.1",
119
119
  "tailwindcss": "^3.4.17",
120
120
  "ts-json-schema-generator": "^2.4.0",
121
121
  "typescript": "^5.8.2",