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

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.24"}');
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.24"}');
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);
@@ -1924,11 +1924,12 @@ function getSocialIcons(socialLinks = []) {
1924
1924
  function isPluginIncluded(config, pluginName) {
1925
1925
  return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
1926
1926
  }
1927
+ const initRsbuild_require = createRequire(import.meta.url);
1927
1928
  async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
1928
1929
  const cwd = process.cwd();
1929
1930
  const CUSTOM_THEME_DIR = config?.themeDir ?? external_node_path_["default"].join(process.cwd(), 'theme');
1930
1931
  const outDir = config?.outDir ?? OUTPUT_DIR;
1931
- const DEFAULT_THEME = require.resolve('@rspress/theme-default');
1932
+ const DEFAULT_THEME = initRsbuild_require.resolve('@rspress/theme-default');
1932
1933
  const base = config?.base ?? '';
1933
1934
  const assetPrefix = isProduction() ? (0, shared_.removeTrailingSlash)(config?.builderConfig?.output?.assetPrefix ?? base) : '';
1934
1935
  const reactVersion = await detectReactVersion();
@@ -2017,13 +2018,13 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2017
2018
  resolve: {
2018
2019
  alias: {
2019
2020
  ...detectCustomIconAlias,
2020
- '@mdx-js/react': require.resolve('@mdx-js/react'),
2021
+ '@mdx-js/react': initRsbuild_require.resolve('@mdx-js/react'),
2021
2022
  '@theme': [
2022
2023
  CUSTOM_THEME_DIR,
2023
2024
  DEFAULT_THEME
2024
2025
  ],
2025
2026
  '@theme-assets': external_node_path_["default"].join(DEFAULT_THEME, '../assets'),
2026
- 'react-lazy-with-preload': require.resolve('react-lazy-with-preload')
2027
+ 'react-lazy-with-preload': initRsbuild_require.resolve('react-lazy-with-preload')
2027
2028
  }
2028
2029
  },
2029
2030
  source: {
@@ -2040,6 +2041,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2040
2041
  ...'false' !== process.env.RSPRESS_PERSISTENT_CACHE ? {
2041
2042
  buildCache: {
2042
2043
  buildDependencies: [
2044
+ (0, external_node_url_.fileURLToPath)(import.meta.url),
2043
2045
  pluginDriver.getConfigFilePath()
2044
2046
  ],
2045
2047
  cacheDigest: [
@@ -2050,11 +2052,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2050
2052
  })) ?? {
2051
2053
  nav: config.themeConfig?.nav,
2052
2054
  sidebar: config.themeConfig?.sidebar
2053
- }),
2054
- JSON.stringify({
2055
- base: config.base,
2056
- ssg: config.ssg,
2057
- pluginLength: config.plugins?.length ?? 0
2058
2055
  })
2059
2056
  ]
2060
2057
  }
@@ -2081,7 +2078,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
2081
2078
  chain.module.rule('MDX').type("javascript/auto").test(shared_.MDX_OR_MD_REGEXP).resolve.merge({
2082
2079
  conditionNames: jsModuleRule.resolve.conditionNames.values(),
2083
2080
  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({
2081
+ }).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
2082
  config,
2086
2083
  docDirectory: userDocRoot,
2087
2084
  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.24"}');
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.24",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -54,7 +54,7 @@
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.12",
58
58
  "@rsbuild/plugin-react": "~1.3.4",
59
59
  "@rspress/mdx-rs": "0.6.6",
60
60
  "@shikijs/rehype": "^3.8.1",
@@ -86,9 +86,9 @@
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/shared": "2.0.0-beta.24",
90
+ "@rspress/runtime": "2.0.0-beta.24",
91
+ "@rspress/theme-default": "2.0.0-beta.24"
92
92
  },
93
93
  "devDependencies": {
94
94
  "@microsoft/api-extractor": "^7.52.9",