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

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/208.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
1
  export const __webpack_ids__ = [
4
2
  "208"
5
3
  ];
package/dist/309.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
1
  export const __webpack_ids__ = [
4
2
  "309"
5
3
  ];
package/dist/94.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
1
  export const __webpack_ids__ = [
4
2
  "94"
5
3
  ];
package/dist/cli.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
1
  import node_path from "node:path";
4
2
  import { logger } from "@rspress/shared/logger";
5
3
  import { cac } from "cac";
@@ -8,7 +6,7 @@ import picocolors from "picocolors";
8
6
  import { build, dev, serve } from "./index.js";
9
7
  import node_fs from "node:fs";
10
8
  import { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
11
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.23"}');
9
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.25"}');
12
10
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
13
11
  async function loadConfigFile(customConfigFile) {
14
12
  const baseDir = process.cwd();
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- import __rslib_shim_module__ from 'module';
3
- const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
4
2
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
5
3
  import * as __WEBPACK_EXTERNAL_MODULE_child_process__ from "child_process";
6
4
  import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
@@ -19,6 +17,7 @@ import { matchPath } from "@rspress/runtime/server";
19
17
  import { logger } from "@rspress/shared/logger";
20
18
  import { extractTextAndId, getIconUrlPath, getNodeAttribute, loadFrontMatter, mergeDocConfig } from "@rspress/shared/node-utils";
21
19
  import node_fs_promises, { mkdir, readFile, readdir, rm, stat as promises_stat, writeFile } from "node:fs/promises";
20
+ import { createRequire } from "node:module";
22
21
  import { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
23
22
  import { DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
24
23
  import picocolors from "picocolors";
@@ -152,7 +151,7 @@ function defineConfig(config) {
152
151
  }
153
152
  var external_node_path_ = __webpack_require__("node:path");
154
153
  var external_node_url_ = __webpack_require__("node:url");
155
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.23"}');
154
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.25"}');
156
155
  const RSPRESS_VERSION = package_namespaceObject.i8;
157
156
  const isProduction = ()=>'production' === process.env.NODE_ENV;
158
157
  const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
@@ -1106,12 +1105,13 @@ var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
1106
1105
  RuntimeModuleID["RuntimeConfig"] = "virtual-runtime-config";
1107
1106
  return RuntimeModuleID;
1108
1107
  }({});
1108
+ const i18n_require = createRequire(import.meta.url);
1109
1109
  const DEFAULT_I18N_SOURCE = (0, external_node_path_.join)(process.cwd(), 'i18n.json');
1110
1110
  function getI18nData(docConfig) {
1111
1111
  const { i18nSourcePath = DEFAULT_I18N_SOURCE } = docConfig;
1112
1112
  try {
1113
- delete require.cache[i18nSourcePath];
1114
- const i18nSource = require(i18nSourcePath);
1113
+ delete i18n_require.cache[i18nSourcePath];
1114
+ const i18nSource = i18n_require(i18nSourcePath);
1115
1115
  return i18nSource;
1116
1116
  } catch (e) {
1117
1117
  logger.debug('getI18nData Failed: \n', e);
@@ -1910,7 +1910,8 @@ const presetIcons = {
1910
1910
  lark: `<path d="M8.813 5.477c1.038.836 2.286 2.045 3.3 3.495.171.23.377.576.457.71l.034.056a8.803 8.803 0 0 0-.922 1.3l-.271-.494C9.655 7.53 6.3 5.477 6.137 5.377a.447.447 0 0 1-.006-.004l-.666-.393-.107-.086a.499.499 0 0 1 .306-.885L6.084 4h7.997c.159.006.318.037.47.092.174.064.317.174.458.308.134.143.272.296.403.448.622.675 1.324 1.688 1.324 1.688-.573.193-1.349.736-1.349.736a5.095 5.095 0 0 0-.348-.54 20.665 20.665 0 0 0-1.037-1.255H8.813Z" fill="currentColor"/>
1911
1911
  <path d="M18.482 7.507a5.42 5.42 0 0 1 4.04.717c.248.168.788.635.242 1.233-1.7 1.67-2.194 3.225-2.63 4.599-.278.873-.541 1.697-1.066 2.424-1.813 2.508-4.114 4-6.837 4.434-.561.089-1.132.131-1.7.131-3.958 0-7.498-2.035-8.75-2.844h.003l-.161-.107c-.534-.378-.61-.723-.623-.989V7.055a.486.486 0 0 1 .827-.317l.482.589c5.082 6.201 9.126 8.063 11.626 8.53 2.246.424 3.631-.165 4.022-.37.333-.51.534-1.143.764-1.865l.006-.021c.406-1.276.898-2.821 2.322-4.477a3.93 3.93 0 0 0-2.28-.168c-1.761.394-3.403 1.96-4.89 4.643a8.27 8.27 0 0 0-.341.671c-.724-.107-1.334-.65-1.334-.65.128-.269.22-.455.345-.672 1.718-3.125 3.714-4.962 5.933-5.441ZM2.477 16.889c1.145.744 5.341 3.232 9.532 2.563 1.56-.247 2.963-.915 4.196-1.99-2.771.254-7.557-.753-13.728-7.666v7.093Z" fill="currentColor"/>`,
1912
1912
  x: '<path fill="currentColor" d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584l-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/>',
1913
- bluesky: '<path fill="currentColor" d="M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565C.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479c.815 2.736 3.713 3.66 6.383 3.364q.204-.03.415-.056q-.207.033-.415.056c-3.912.58-7.387 2.005-2.83 7.078c5.013 5.19 6.87-1.113 7.823-4.308c.953 3.195 2.05 9.271 7.733 4.308c4.267-4.308 1.172-6.498-2.74-7.078a9 9 0 0 1-.415-.056q.21.026.415.056c2.67.297 5.568-.628 6.383-3.364c.246-.828.624-5.79.624-6.478c0-.69-.139-1.861-.902-2.206c-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8"/>'
1913
+ bluesky: '<path fill="currentColor" d="M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565C.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479c.815 2.736 3.713 3.66 6.383 3.364q.204-.03.415-.056q-.207.033-.415.056c-3.912.58-7.387 2.005-2.83 7.078c5.013 5.19 6.87-1.113 7.823-4.308c.953 3.195 2.05 9.271 7.733 4.308c4.267-4.308 1.172-6.498-2.74-7.078a9 9 0 0 1-.415-.056q.21.026.415.056c2.67.297 5.568-.628 6.383-3.364c.246-.828.624-5.79.624-6.478c0-.69-.139-1.861-.902-2.206c-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8"/>',
1914
+ npm: '<path fill="currentColor" d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019l-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/>'
1914
1915
  };
1915
1916
  const formatIconName = (icon)=>icon.toLowerCase();
1916
1917
  function getSocialIcons(socialLinks = []) {
@@ -1924,11 +1925,12 @@ function getSocialIcons(socialLinks = []) {
1924
1925
  function isPluginIncluded(config, pluginName) {
1925
1926
  return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
1926
1927
  }
1928
+ const initRsbuild_require = createRequire(import.meta.url);
1927
1929
  async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
1928
1930
  const cwd = process.cwd();
1929
1931
  const CUSTOM_THEME_DIR = config?.themeDir ?? external_node_path_["default"].join(process.cwd(), 'theme');
1930
1932
  const outDir = config?.outDir ?? OUTPUT_DIR;
1931
- const DEFAULT_THEME = require.resolve('@rspress/theme-default');
1933
+ const DEFAULT_THEME = initRsbuild_require.resolve('@rspress/theme-default');
1932
1934
  const base = config?.base ?? '';
1933
1935
  const assetPrefix = isProduction() ? (0, shared_.removeTrailingSlash)(config?.builderConfig?.output?.assetPrefix ?? base) : '';
1934
1936
  const reactVersion = await detectReactVersion();
@@ -2017,13 +2019,13 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2017
2019
  resolve: {
2018
2020
  alias: {
2019
2021
  ...detectCustomIconAlias,
2020
- '@mdx-js/react': require.resolve('@mdx-js/react'),
2022
+ '@mdx-js/react': initRsbuild_require.resolve('@mdx-js/react'),
2021
2023
  '@theme': [
2022
2024
  CUSTOM_THEME_DIR,
2023
2025
  DEFAULT_THEME
2024
2026
  ],
2025
2027
  '@theme-assets': external_node_path_["default"].join(DEFAULT_THEME, '../assets'),
2026
- 'react-lazy-with-preload': require.resolve('react-lazy-with-preload')
2028
+ 'react-lazy-with-preload': initRsbuild_require.resolve('react-lazy-with-preload')
2027
2029
  }
2028
2030
  },
2029
2031
  source: {
@@ -2040,6 +2042,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2040
2042
  ...'false' !== process.env.RSPRESS_PERSISTENT_CACHE ? {
2041
2043
  buildCache: {
2042
2044
  buildDependencies: [
2045
+ (0, external_node_url_.fileURLToPath)(import.meta.url),
2043
2046
  pluginDriver.getConfigFilePath()
2044
2047
  ],
2045
2048
  cacheDigest: [
@@ -2050,11 +2053,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2050
2053
  })) ?? {
2051
2054
  nav: config.themeConfig?.nav,
2052
2055
  sidebar: config.themeConfig?.sidebar
2053
- }),
2054
- JSON.stringify({
2055
- base: config.base,
2056
- ssg: config.ssg,
2057
- pluginLength: config.plugins?.length ?? 0
2058
2056
  })
2059
2057
  ]
2060
2058
  }
@@ -2081,7 +2079,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2081
2079
  chain.module.rule('MDX').type("javascript/auto").test(shared_.MDX_OR_MD_REGEXP).resolve.merge({
2082
2080
  conditionNames: jsModuleRule.resolve.conditionNames.values(),
2083
2081
  mainFields: jsModuleRule.resolve.mainFields.values()
2084
- }).end().oneOf('MDXCompile').use('builtin:swc-loader').loader('builtin:swc-loader').options(swcLoaderOptions).end().use('mdx-loader').loader(require.resolve('./loader.js')).options({
2082
+ }).end().oneOf('MDXCompile').use('builtin:swc-loader').loader('builtin:swc-loader').options(swcLoaderOptions).end().use('mdx-loader').loader(initRsbuild_require.resolve('./loader.js')).options({
2085
2083
  config,
2086
2084
  docDirectory: userDocRoot,
2087
2085
  routeService,
package/dist/loader.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
1
  import { logger } from "@rsbuild/core";
4
2
  import { compile, compileWithCrossCompilerCache } from "./processor.js";
5
3
  async function mdxLoader(source) {
package/dist/processor.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
1
  import node_path from "node:path";
4
2
  import { createProcessor, nodeTypes } from "@mdx-js/mdx";
5
3
  import { extractTextAndId, getNodeAttribute, loadFrontMatter } from "@rspress/shared/node-utils";
@@ -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.23"}');
105
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.25"}');
106
106
  const RSPRESS_VERSION = package_namespaceObject.i8;
107
107
  `{
108
108
  const saved = localStorage.getItem('${APPEARANCE_KEY}')
package/dist/runtime.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { isExternalUrl } from '@rspress/shared';
2
+ import { normalizeHref } from '@rspress/shared';
2
3
 
3
4
  export { isExternalUrl }
4
5
 
6
+ export { normalizeHref }
7
+
5
8
 
6
9
  export * from "@rspress/runtime";
7
10
 
package/dist/runtime.js CHANGED
@@ -1,3 +1,3 @@
1
- import { isExternalUrl } from "@rspress/shared";
1
+ import { isExternalUrl, normalizeHref } from "@rspress/shared";
2
2
  export * from "@rspress/runtime";
3
- export { isExternalUrl };
3
+ export { isExternalUrl, normalizeHref };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0-beta.23",
3
+ "version": "2.0.0-beta.25",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -54,12 +54,12 @@
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.11",
57
+ "@rsbuild/core": "~1.4.13",
58
58
  "@rsbuild/plugin-react": "~1.3.4",
59
59
  "@rspress/mdx-rs": "0.6.6",
60
60
  "@shikijs/rehype": "^3.8.1",
61
61
  "@types/unist": "^3.0.3",
62
- "@unhead/react": "^2.0.12",
62
+ "@unhead/react": "^2.0.13",
63
63
  "cac": "^6.7.14",
64
64
  "chokidar": "^3.6.0",
65
65
  "enhanced-resolve": "5.18.2",
@@ -71,8 +71,8 @@
71
71
  "mdast-util-mdxjs-esm": "^2.0.1",
72
72
  "medium-zoom": "1.1.0",
73
73
  "picocolors": "^1.1.1",
74
- "react": "^19.1.0",
75
- "react-dom": "^19.1.0",
74
+ "react": "^19.1.1",
75
+ "react-dom": "^19.1.1",
76
76
  "react-lazy-with-preload": "^2.2.1",
77
77
  "react-router-dom": "^6.29.0",
78
78
  "rehype-external-links": "^3.0.0",
@@ -86,25 +86,25 @@
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.23",
90
- "@rspress/shared": "2.0.0-beta.23",
91
- "@rspress/theme-default": "2.0.0-beta.23"
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"
92
92
  },
93
93
  "devDependencies": {
94
- "@microsoft/api-extractor": "^7.52.9",
95
- "@rslib/core": "0.11.0",
94
+ "@microsoft/api-extractor": "^7.52.10",
95
+ "@rslib/core": "0.11.1",
96
96
  "@types/hast": "^3.0.4",
97
97
  "@types/html-to-text": "^9.0.4",
98
98
  "@types/jest": "~29.5.14",
99
99
  "@types/lodash-es": "^4.17.12",
100
100
  "@types/mdast": "^4.0.4",
101
101
  "@types/node": "^22.8.1",
102
- "@types/react": "^19.1.8",
103
- "@types/react-dom": "^19.1.6",
102
+ "@types/react": "^19.1.9",
103
+ "@types/react-dom": "^19.1.7",
104
104
  "execa": "8.0.1",
105
105
  "mdast-util-directive": "^3.1.0",
106
106
  "mdast-util-mdx-expression": "^2.0.1",
107
- "memfs": "^4.17.2",
107
+ "memfs": "^4.36.0",
108
108
  "p-map": "^7.0.3",
109
109
  "postcss": "8.5.6",
110
110
  "rehype-stringify": "^10.0.1",
@@ -127,7 +127,6 @@
127
127
  },
128
128
  "publishConfig": {
129
129
  "access": "public",
130
- "provenance": true,
131
130
  "registry": "https://registry.npmjs.org/"
132
131
  },
133
132
  "scripts": {