@rspress/core 1.43.12 → 1.44.0

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.js CHANGED
@@ -64,9 +64,9 @@ class PluginDriver {
64
64
  this.clearPlugins();
65
65
  const config = _class_private_field_get(this, _config);
66
66
  const themeConfig = (null == config ? void 0 : config.themeConfig) || {};
67
- const enableLastUpdated = (null == themeConfig ? void 0 : themeConfig.lastUpdated) || (null == themeConfig ? void 0 : null === (_themeConfig_locales = themeConfig.locales) || void 0 === _themeConfig_locales ? void 0 : _themeConfig_locales.some((locale)=>locale.lastUpdated));
67
+ const enableLastUpdated = (null == themeConfig ? void 0 : themeConfig.lastUpdated) || (null == themeConfig ? void 0 : null == (_themeConfig_locales = themeConfig.locales) ? void 0 : _themeConfig_locales.some((locale)=>locale.lastUpdated));
68
68
  const mediumZoomConfig = (null == config ? void 0 : config.mediumZoom) ?? true;
69
- const haveNavSidebarConfig = themeConfig.nav || themeConfig.sidebar || (null === (_themeConfig_locales1 = themeConfig.locales) || void 0 === _themeConfig_locales1 ? void 0 : null === (_themeConfig_locales_ = _themeConfig_locales1[0]) || void 0 === _themeConfig_locales_ ? void 0 : _themeConfig_locales_.nav) || (null === (_themeConfig_locales2 = themeConfig.locales) || void 0 === _themeConfig_locales2 ? void 0 : null === (_themeConfig_locales_1 = _themeConfig_locales2[0]) || void 0 === _themeConfig_locales_1 ? void 0 : _themeConfig_locales_1.sidebar);
69
+ const haveNavSidebarConfig = themeConfig.nav || themeConfig.sidebar || (null == (_themeConfig_locales1 = themeConfig.locales) ? void 0 : null == (_themeConfig_locales_ = _themeConfig_locales1[0]) ? void 0 : _themeConfig_locales_.nav) || (null == (_themeConfig_locales2 = themeConfig.locales) ? void 0 : null == (_themeConfig_locales_1 = _themeConfig_locales2[0]) ? void 0 : _themeConfig_locales_1.sidebar);
70
70
  if (enableLastUpdated) {
71
71
  const { pluginLastUpdated } = await import("@rspress/plugin-last-updated");
72
72
  this.addPlugin(pluginLastUpdated());
@@ -465,7 +465,7 @@ ${routeMeta.map((route, index)=>{
465
465
  RouteService_class_private_field_set(this, _include, routeOptions.include || []);
466
466
  RouteService_class_private_field_set(this, _exclude, routeOptions.exclude || []);
467
467
  RouteService_class_private_field_set(this, _defaultLang, (null == userConfig ? void 0 : userConfig.lang) || '');
468
- RouteService_class_private_field_set(this, _langs, ((null == userConfig ? void 0 : userConfig.locales) ?? (null == userConfig ? void 0 : null === (_userConfig_themeConfig = userConfig.themeConfig) || void 0 === _userConfig_themeConfig ? void 0 : _userConfig_themeConfig.locales) ?? []).map((item)=>item.lang));
468
+ RouteService_class_private_field_set(this, _langs, ((null == userConfig ? void 0 : userConfig.locales) ?? (null == userConfig ? void 0 : null == (_userConfig_themeConfig = userConfig.themeConfig) ? void 0 : _userConfig_themeConfig.locales) ?? []).map((item)=>item.lang));
469
469
  RouteService_class_private_field_set(this, _base, (null == userConfig ? void 0 : userConfig.base) || '');
470
470
  RouteService_class_private_field_set(this, _tempDir, tempDir);
471
471
  RouteService_class_private_field_set(this, _pluginDriver, pluginDriver);
@@ -641,7 +641,7 @@ async function flattenMdxContent(content, basePath, alias) {
641
641
  }
642
642
  const importNodes = ast.children.filter((node)=>'mdxjsEsm' === node.type).flatMap((node)=>{
643
643
  var _node_data_estree, _node_data;
644
- return (null === (_node_data = node.data) || void 0 === _node_data ? void 0 : null === (_node_data_estree = _node_data.estree) || void 0 === _node_data_estree ? void 0 : _node_data_estree.body) || [];
644
+ return (null == (_node_data = node.data) ? void 0 : null == (_node_data_estree = _node_data.estree) ? void 0 : _node_data_estree.body) || [];
645
645
  }).filter((node)=>'ImportDeclaration' === node.type);
646
646
  for (const importNode of importNodes){
647
647
  const id = importNode.specifiers[0].local.name;
@@ -826,7 +826,7 @@ function normalizeThemeConfig(docConfig, pages = []) {
826
826
  };
827
827
  const getI18nText = (key = '', currentLang = '')=>{
828
828
  var _i18nTextData_key;
829
- const text = null === (_i18nTextData_key = i18nTextData[key]) || void 0 === _i18nTextData_key ? void 0 : _i18nTextData_key[currentLang];
829
+ const text = null == (_i18nTextData_key = i18nTextData[key]) ? void 0 : _i18nTextData_key[currentLang];
830
830
  return text || key;
831
831
  };
832
832
  const normalizeSidebar = (sidebar, currentLang = '')=>{
@@ -900,7 +900,7 @@ function normalizeThemeConfig(docConfig, pages = []) {
900
900
  };
901
901
  if (locales.length) themeConfig.locales = locales.map(({ lang: currentLang, label })=>{
902
902
  var _themeConfig_locales;
903
- const localeInThemeConfig = null === (_themeConfig_locales = themeConfig.locales) || void 0 === _themeConfig_locales ? void 0 : _themeConfig_locales.find((locale)=>locale.lang === currentLang);
903
+ const localeInThemeConfig = null == (_themeConfig_locales = themeConfig.locales) ? void 0 : _themeConfig_locales.find((locale)=>locale.lang === currentLang);
904
904
  return {
905
905
  lang: currentLang,
906
906
  label,
@@ -939,7 +939,7 @@ async function siteDataVMPlugin(context) {
939
939
  const versioned = userConfig.search && 'remote' !== userConfig.search.mode && userConfig.search.versioned;
940
940
  const groupedPages = (0, __WEBPACK_EXTERNAL_MODULE_lodash_es_18c59938__.groupBy)(pages, (page)=>{
941
941
  var _page_frontmatter;
942
- if ((null === (_page_frontmatter = page.frontmatter) || void 0 === _page_frontmatter ? void 0 : _page_frontmatter.pageType) === 'home') return 'noindex';
942
+ if ((null == (_page_frontmatter = page.frontmatter) ? void 0 : _page_frontmatter.pageType) === 'home') return 'noindex';
943
943
  const version = versioned ? page.version : '';
944
944
  const lang = page.lang || '';
945
945
  return `${version}###${lang}`;
@@ -967,13 +967,13 @@ async function siteDataVMPlugin(context) {
967
967
  themeConfig: normalizeThemeConfig(userConfig, pages),
968
968
  base: (null == userConfig ? void 0 : userConfig.base) || '/',
969
969
  lang: (null == userConfig ? void 0 : userConfig.lang) || '',
970
- locales: (null == userConfig ? void 0 : userConfig.locales) || (null === (_userConfig_themeConfig = userConfig.themeConfig) || void 0 === _userConfig_themeConfig ? void 0 : _userConfig_themeConfig.locales) || [],
970
+ locales: (null == userConfig ? void 0 : userConfig.locales) || (null == (_userConfig_themeConfig = userConfig.themeConfig) ? void 0 : _userConfig_themeConfig.locales) || [],
971
971
  logo: (null == userConfig ? void 0 : userConfig.logo) || '',
972
972
  logoText: (null == userConfig ? void 0 : userConfig.logoText) || '',
973
973
  ssg: Boolean((null == userConfig ? void 0 : userConfig.ssg) ?? true),
974
974
  multiVersion: {
975
- default: (null == userConfig ? void 0 : null === (_userConfig_multiVersion = userConfig.multiVersion) || void 0 === _userConfig_multiVersion ? void 0 : _userConfig_multiVersion.default) || '',
976
- versions: (null == userConfig ? void 0 : null === (_userConfig_multiVersion1 = userConfig.multiVersion) || void 0 === _userConfig_multiVersion1 ? void 0 : _userConfig_multiVersion1.versions) || []
975
+ default: (null == userConfig ? void 0 : null == (_userConfig_multiVersion = userConfig.multiVersion) ? void 0 : _userConfig_multiVersion.default) || '',
976
+ versions: (null == userConfig ? void 0 : null == (_userConfig_multiVersion1 = userConfig.multiVersion) ? void 0 : _userConfig_multiVersion1.versions) || []
977
977
  },
978
978
  search: tempSearchObj ?? {
979
979
  mode: 'local'
@@ -986,13 +986,13 @@ async function siteDataVMPlugin(context) {
986
986
  };
987
987
  }),
988
988
  markdown: {
989
- showLineNumbers: (null == userConfig ? void 0 : null === (_userConfig_markdown = userConfig.markdown) || void 0 === _userConfig_markdown ? void 0 : _userConfig_markdown.showLineNumbers) ?? false,
990
- defaultWrapCode: (null == userConfig ? void 0 : null === (_userConfig_markdown1 = userConfig.markdown) || void 0 === _userConfig_markdown1 ? void 0 : _userConfig_markdown1.defaultWrapCode) ?? false,
991
- codeHighlighter: (null == userConfig ? void 0 : null === (_userConfig_markdown2 = userConfig.markdown) || void 0 === _userConfig_markdown2 ? void 0 : _userConfig_markdown2.codeHighlighter) || 'prism'
989
+ showLineNumbers: (null == userConfig ? void 0 : null == (_userConfig_markdown = userConfig.markdown) ? void 0 : _userConfig_markdown.showLineNumbers) ?? false,
990
+ defaultWrapCode: (null == userConfig ? void 0 : null == (_userConfig_markdown1 = userConfig.markdown) ? void 0 : _userConfig_markdown1.defaultWrapCode) ?? false,
991
+ codeHighlighter: (null == userConfig ? void 0 : null == (_userConfig_markdown2 = userConfig.markdown) ? void 0 : _userConfig_markdown2.codeHighlighter) || 'prism'
992
992
  }
993
993
  };
994
994
  const { highlightLanguages: defaultLanguages = [] } = config.markdown || {};
995
- if (Array.isArray(null === (_siteData_pages_ = siteData.pages[0]) || void 0 === _siteData_pages_ ? void 0 : _siteData_pages_.extraHighlightLanguages)) siteData.pages[0].extraHighlightLanguages.forEach((lang)=>highlightLanguages.add(lang));
995
+ if (Array.isArray(null == (_siteData_pages_ = siteData.pages[0]) ? void 0 : _siteData_pages_.extraHighlightLanguages)) siteData.pages[0].extraHighlightLanguages.forEach((lang)=>highlightLanguages.add(lang));
996
996
  const aliases = handleHighlightLanguages(highlightLanguages, defaultLanguages);
997
997
  const sortedAliases = Object.fromEntries(Object.entries(aliases).sort());
998
998
  const sortedHighlightLanguages = Array.from(highlightLanguages).sort();
@@ -1075,7 +1075,7 @@ async function writeSearchIndex(config) {
1075
1075
  await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].rename(source, target);
1076
1076
  scanning = true;
1077
1077
  }
1078
- if (isProduction() && (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isSCM)() && (null == config ? void 0 : null === (_config_search = config.search) || void 0 === _config_search ? void 0 : _config_search.mode) === 'remote') {
1078
+ if (isProduction() && (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isSCM)() && (null == config ? void 0 : null == (_config_search = config.search) ? void 0 : _config_search.mode) === 'remote') {
1079
1079
  const { apiUrl, indexName } = config.search;
1080
1080
  try {
1081
1081
  await fetch(`${apiUrl}?index=${indexName}`, {
@@ -1095,7 +1095,7 @@ function serveSearchIndexMiddleware(config) {
1095
1095
  return (req, res, next)=>{
1096
1096
  var _req_url;
1097
1097
  const searchIndexRequestMatch = `/${__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.SEARCH_INDEX_NAME}.`;
1098
- if (null === (_req_url = req.url) || void 0 === _req_url ? void 0 : _req_url.includes(searchIndexRequestMatch)) {
1098
+ if (null == (_req_url = req.url) ? void 0 : _req_url.includes(searchIndexRequestMatch)) {
1099
1099
  res.setHeader('Content-Type', 'application/json');
1100
1100
  const outDir = (null == config ? void 0 : config.outDir) ?? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), OUTPUT_DIR);
1101
1101
  const searchIndexFile = req.url.split('/').pop();
@@ -1125,7 +1125,7 @@ async function detectReactVersion() {
1125
1125
  if (await pathExists(reactPath)) {
1126
1126
  var _reactPkg_version;
1127
1127
  const reactPkg = await readJson(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(reactPath, 'package.json'));
1128
- const version = Number(null === (_reactPkg_version = reactPkg.version) || void 0 === _reactPkg_version ? void 0 : _reactPkg_version.split('.')[0]);
1128
+ const version = Number(null == (_reactPkg_version = reactPkg.version) ? void 0 : _reactPkg_version.split('.')[0]);
1129
1129
  return version;
1130
1130
  }
1131
1131
  return DEFAULT_REACT_VERSION;
@@ -1214,7 +1214,7 @@ function getSocialIcons(socialLinks = []) {
1214
1214
  }
1215
1215
  function isPluginIncluded(config, pluginName) {
1216
1216
  var _config_builderPlugins, _config_builderConfig_plugins, _config_builderConfig;
1217
- return Boolean((null === (_config_builderPlugins = config.builderPlugins) || void 0 === _config_builderPlugins ? void 0 : _config_builderPlugins.some((plugin)=>plugin.name === pluginName)) || (null === (_config_builderConfig = config.builderConfig) || void 0 === _config_builderConfig ? void 0 : null === (_config_builderConfig_plugins = _config_builderConfig.plugins) || void 0 === _config_builderConfig_plugins ? void 0 : _config_builderConfig_plugins.some((plugin)=>plugin && plugin.name === pluginName)));
1217
+ return Boolean((null == (_config_builderPlugins = config.builderPlugins) ? void 0 : _config_builderPlugins.some((plugin)=>plugin.name === pluginName)) || (null == (_config_builderConfig = config.builderConfig) ? void 0 : null == (_config_builderConfig_plugins = _config_builderConfig.plugins) ? void 0 : _config_builderConfig_plugins.some((plugin)=>plugin && plugin.name === pluginName)));
1218
1218
  }
1219
1219
  async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver, runtimeTempDir) {
1220
1220
  var _config_builderConfig_output, _config_builderConfig, _config_themeConfig, _config_themeConfig1;
@@ -1225,7 +1225,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1225
1225
  const ssrOutDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(baseOutDir, 'ssr');
1226
1226
  const DEFAULT_THEME = require.resolve('@rspress/theme-default');
1227
1227
  const base = (null == config ? void 0 : config.base) ?? '';
1228
- const assetPrefix = isProduction() ? (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.removeTrailingSlash)((null == config ? void 0 : null === (_config_builderConfig = config.builderConfig) || void 0 === _config_builderConfig ? void 0 : null === (_config_builderConfig_output = _config_builderConfig.output) || void 0 === _config_builderConfig_output ? void 0 : _config_builderConfig_output.assetPrefix) ?? base) : '';
1228
+ const assetPrefix = isProduction() ? (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.removeTrailingSlash)((null == config ? void 0 : null == (_config_builderConfig = config.builderConfig) ? void 0 : null == (_config_builderConfig_output = _config_builderConfig.output) ? void 0 : _config_builderConfig_output.assetPrefix) ?? base) : '';
1229
1229
  const reactVersion = await detectReactVersion();
1230
1230
  const normalizeIcon = (icon)=>{
1231
1231
  if (!icon) return;
@@ -1279,7 +1279,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1279
1279
  favicon: normalizeIcon(null == config ? void 0 : config.icon),
1280
1280
  template: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'index.html'),
1281
1281
  tags: [
1282
- (null === (_config_themeConfig = config.themeConfig) || void 0 === _config_themeConfig ? void 0 : _config_themeConfig.darkMode) !== false ? {
1282
+ (null == (_config_themeConfig = config.themeConfig) ? void 0 : _config_themeConfig.darkMode) !== false ? {
1283
1283
  tag: "script",
1284
1284
  children: inlineThemeScript,
1285
1285
  append: false
@@ -1314,7 +1314,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1314
1314
  define: {
1315
1315
  'process.env.__REACT_GTE_18__': JSON.stringify(reactVersion >= 18),
1316
1316
  'process.env.TEST': JSON.stringify(process.env.TEST),
1317
- 'process.env.RSPRESS_SOCIAL_ICONS': JSON.stringify(getSocialIcons(null === (_config_themeConfig1 = config.themeConfig) || void 0 === _config_themeConfig1 ? void 0 : _config_themeConfig1.socialLinks))
1317
+ 'process.env.RSPRESS_SOCIAL_ICONS': JSON.stringify(getSocialIcons(null == (_config_themeConfig1 = config.themeConfig) ? void 0 : _config_themeConfig1.socialLinks))
1318
1318
  }
1319
1319
  },
1320
1320
  performance: {
@@ -1338,7 +1338,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1338
1338
  const isServer = 'node' === target;
1339
1339
  const jsModuleRule = chain.module.rule(CHAIN_ID.RULE.JS);
1340
1340
  const swcLoaderOptions = jsModuleRule.use(CHAIN_ID.USE.SWC).get('options');
1341
- const checkDeadLinks = ((null == config ? void 0 : null === (_config_markdown = config.markdown) || void 0 === _config_markdown ? void 0 : _config_markdown.checkDeadLinks) && !isServer) ?? false;
1341
+ const checkDeadLinks = ((null == config ? void 0 : null == (_config_markdown = config.markdown) ? void 0 : _config_markdown.checkDeadLinks) && !isServer) ?? false;
1342
1342
  chain.module.rule('MDX').type("javascript/auto").test(__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP).resolve.merge({
1343
1343
  conditionNames: jsModuleRule.resolve.conditionNames.values(),
1344
1344
  mainFields: jsModuleRule.resolve.mainFields.values()
@@ -1444,7 +1444,8 @@ async function initRsbuild(rootDir, config, pluginDriver, enableSSG, extraRsbuil
1444
1444
  const { createRsbuild, mergeRsbuildConfig } = await import("@rsbuild/core");
1445
1445
  const internalRsbuildConfig = await createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver, runtimeTempDir);
1446
1446
  const rsbuild = await createRsbuild({
1447
- rsbuildConfig: mergeRsbuildConfig(internalRsbuildConfig, ...(null === (_pluginDriver_getPlugins = pluginDriver.getPlugins()) || void 0 === _pluginDriver_getPlugins ? void 0 : _pluginDriver_getPlugins.map((plugin)=>plugin.builderConfig ?? {})) || [], (null == config ? void 0 : config.builderConfig) || {}, extraRsbuildConfig || {})
1447
+ callerName: 'rspress',
1448
+ rsbuildConfig: mergeRsbuildConfig(internalRsbuildConfig, ...(null == (_pluginDriver_getPlugins = pluginDriver.getPlugins()) ? void 0 : _pluginDriver_getPlugins.map((plugin)=>plugin.builderConfig ?? {})) || [], (null == config ? void 0 : config.builderConfig) || {}, extraRsbuildConfig || {})
1448
1449
  });
1449
1450
  rsbuild.addPlugins(builderPlugins);
1450
1451
  return rsbuild;
@@ -1497,15 +1498,12 @@ async function checkLanguageParity(config) {
1497
1498
  if (!(null == config ? void 0 : config.languageParity) || false === config.languageParity.enabled) return;
1498
1499
  __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('Checking language parity...');
1499
1500
  const contentPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(config.root);
1500
- const includedDirs = (null === (_config_languageParity_include = config.languageParity.include) || void 0 === _config_languageParity_include ? void 0 : _config_languageParity_include.length) ? config.languageParity.include : [
1501
+ const includedDirs = (null == (_config_languageParity_include = config.languageParity.include) ? void 0 : _config_languageParity_include.length) ? config.languageParity.include : [
1501
1502
  ''
1502
1503
  ];
1503
1504
  const excludedDirs = config.languageParity.exclude ?? [];
1504
- const supportedLanguages = (null === (_this = config.locales ?? (null === (_config_themeConfig = config.themeConfig) || void 0 === _config_themeConfig ? void 0 : _config_themeConfig.locales)) || void 0 === _this ? void 0 : _this.map((locale)=>locale.lang)) || [];
1505
- if (!supportedLanguages.length) {
1506
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error('No supported languages found in the configuration.');
1507
- return;
1508
- }
1505
+ const supportedLanguages = (null == (_this = config.locales ?? (null == (_config_themeConfig = config.themeConfig) ? void 0 : _config_themeConfig.locales)) ? void 0 : _this.map((locale)=>locale.lang)) || [];
1506
+ if (!supportedLanguages.length) return void __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.error('No supported languages found in the configuration.');
1509
1507
  const missingLanguagesFile = [];
1510
1508
  try {
1511
1509
  for (const includedDir of includedDirs){
@@ -1549,7 +1547,7 @@ async function dev(options) {
1549
1547
  }
1550
1548
  }
1551
1549
  var package_namespaceObject = {
1552
- i8: "1.43.12"
1550
+ i8: "1.44.0"
1553
1551
  };
1554
1552
  async function renderFrontmatterHead(route) {
1555
1553
  if (!isRouteMeta(route)) return '';
@@ -1657,11 +1655,11 @@ async function renderPages(appDirectory, config, pluginDriver, ssgConfig) {
1657
1655
  ].join(''));
1658
1656
  if (helmet.htmlAttributes) {
1659
1657
  var _helmet_htmlAttributes;
1660
- html = html.replace(HTML_START_TAG, `${HTML_START_TAG} ${null === (_helmet_htmlAttributes = helmet.htmlAttributes) || void 0 === _helmet_htmlAttributes ? void 0 : _helmet_htmlAttributes.toString()}`);
1658
+ html = html.replace(HTML_START_TAG, `${HTML_START_TAG} ${null == (_helmet_htmlAttributes = helmet.htmlAttributes) ? void 0 : _helmet_htmlAttributes.toString()}`);
1661
1659
  }
1662
1660
  if (helmet.bodyAttributes) {
1663
1661
  var _helmet_bodyAttributes;
1664
- html = html.replace(BODY_START_TAG, `${BODY_START_TAG} ${null === (_helmet_bodyAttributes = helmet.bodyAttributes) || void 0 === _helmet_bodyAttributes ? void 0 : _helmet_bodyAttributes.toString()}`);
1662
+ html = html.replace(BODY_START_TAG, `${BODY_START_TAG} ${null == (_helmet_bodyAttributes = helmet.bodyAttributes) ? void 0 : _helmet_bodyAttributes.toString()}`);
1665
1663
  }
1666
1664
  const normalizeHtmlFilePath = (path)=>{
1667
1665
  const normalizedBase = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizeSlash)((null == config ? void 0 : config.base) || '/');
@@ -1701,8 +1699,8 @@ async function serve(options) {
1701
1699
  const envPort = process.env.PORT;
1702
1700
  const envHost = process.env.HOST;
1703
1701
  const { builderConfig } = config;
1704
- const port = Number(envPort || userPort || (null == builderConfig ? void 0 : null === (_builderConfig_server = builderConfig.server) || void 0 === _builderConfig_server ? void 0 : _builderConfig_server.port) || 4173);
1705
- const host = envHost || userHost || (null == builderConfig ? void 0 : null === (_builderConfig_server1 = builderConfig.server) || void 0 === _builderConfig_server1 ? void 0 : _builderConfig_server1.host) || 'localhost';
1702
+ const port = Number(envPort || userPort || (null == builderConfig ? void 0 : null == (_builderConfig_server = builderConfig.server) ? void 0 : _builderConfig_server.port) || 4173);
1703
+ const host = envHost || userHost || (null == builderConfig ? void 0 : null == (_builderConfig_server1 = builderConfig.server) ? void 0 : _builderConfig_server1.host) || 'localhost';
1706
1704
  config.builderConfig = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(builderConfig, {
1707
1705
  server: {
1708
1706
  port,
package/dist/loader.js CHANGED
@@ -100,7 +100,7 @@ async function flattenMdxContent(content, basePath, alias) {
100
100
  }
101
101
  const importNodes = ast.children.filter((node)=>'mdxjsEsm' === node.type).flatMap((node)=>{
102
102
  var _node_data_estree, _node_data;
103
- return (null === (_node_data = node.data) || void 0 === _node_data ? void 0 : null === (_node_data_estree = _node_data.estree) || void 0 === _node_data_estree ? void 0 : _node_data_estree.body) || [];
103
+ return (null == (_node_data = node.data) ? void 0 : null == (_node_data_estree = _node_data.estree) ? void 0 : _node_data_estree.body) || [];
104
104
  }).filter((node)=>'ImportDeclaration' === node.type);
105
105
  for (const importNode of importNodes){
106
106
  const id = importNode.specifiers[0].local.name;
@@ -142,11 +142,11 @@ function normalizePath(id) {
142
142
  const rehypePluginCodeMeta = ()=>(tree)=>{
143
143
  (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'element', (node)=>{
144
144
  var _node_children_;
145
- if ('pre' === node.tagName && (null === (_node_children_ = node.children[0]) || void 0 === _node_children_ ? void 0 : _node_children_.type) === 'element' && 'code' === node.children[0].tagName) {
145
+ if ('pre' === node.tagName && (null == (_node_children_ = node.children[0]) ? void 0 : _node_children_.type) === 'element' && 'code' === node.children[0].tagName) {
146
146
  var _codeNode_data;
147
147
  const codeNode = node.children[0];
148
148
  codeNode.properties ??= {};
149
- codeNode.properties.meta = null === (_codeNode_data = codeNode.data) || void 0 === _codeNode_data ? void 0 : _codeNode_data.meta;
149
+ codeNode.properties.meta = null == (_codeNode_data = codeNode.data) ? void 0 : _codeNode_data.meta;
150
150
  }
151
151
  });
152
152
  };
@@ -156,7 +156,7 @@ const rehypeHeaderAnchor = ()=>{
156
156
  (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'element', (node)=>{
157
157
  var _node_properties;
158
158
  if (!(0, __WEBPACK_EXTERNAL_MODULE_hast_util_heading_rank_cff646ba__.headingRank)(node)) return;
159
- if (!(null === (_node_properties = node.properties) || void 0 === _node_properties ? void 0 : _node_properties.id)) {
159
+ if (!(null == (_node_properties = node.properties) ? void 0 : _node_properties.id)) {
160
160
  const [text, customId] = collectHeaderText(node);
161
161
  node.properties ??= {};
162
162
  node.properties.id = customId || slugger.slug(text);
@@ -261,7 +261,7 @@ const remarkCheckDeadLinks = (checkLink)=>{
261
261
  if (internalLinks.has(url)) return;
262
262
  if (!url.startsWith('http') && !url.startsWith('https')) {
263
263
  var _url_split_join;
264
- const { routePath: normalizeUrl } = routeService.normalizeRoutePath(null === (_url_split_join = url.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep).join('/')) || void 0 === _url_split_join ? void 0 : _url_split_join.split('#')[0]);
264
+ const { routePath: normalizeUrl } = routeService.normalizeRoutePath(null == (_url_split_join = url.split(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep).join('/')) ? void 0 : _url_split_join.split('#')[0]);
265
265
  internalLinks.add(normalizeUrl);
266
266
  }
267
267
  });
@@ -367,19 +367,19 @@ const parseToc = (tree)=>{
367
367
  const text = node.children.map((child)=>{
368
368
  if ('link' === child.type) {
369
369
  var _child_children;
370
- return null === (_child_children = child.children) || void 0 === _child_children ? void 0 : _child_children.map((item)=>item.value).join('');
370
+ return null == (_child_children = child.children) ? void 0 : _child_children.map((item)=>item.value).join('');
371
371
  }
372
372
  if ('strong' === child.type) {
373
373
  var _child_children1;
374
- return `**${null === (_child_children1 = child.children) || void 0 === _child_children1 ? void 0 : _child_children1.map((item)=>item.value).join('')}**`;
374
+ return `**${null == (_child_children1 = child.children) ? void 0 : _child_children1.map((item)=>item.value).join('')}**`;
375
375
  }
376
376
  if ('emphasis' === child.type) {
377
377
  var _child_children2;
378
- return `*${null === (_child_children2 = child.children) || void 0 === _child_children2 ? void 0 : _child_children2.map((item)=>item.value).join('')}*`;
378
+ return `*${null == (_child_children2 = child.children) ? void 0 : _child_children2.map((item)=>item.value).join('')}*`;
379
379
  }
380
380
  if ('delete' === child.type) {
381
381
  var _child_children3;
382
- return `~~${null === (_child_children3 = child.children) || void 0 === _child_children3 ? void 0 : _child_children3.map((item)=>item.value).join('')}~~`;
382
+ return `~~${null == (_child_children3 = child.children) ? void 0 : _child_children3.map((item)=>item.value).join('')}~~`;
383
383
  }
384
384
  if ('text' === child.type) {
385
385
  const [textPart, idPart] = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.extractTextAndId)(child.value);
@@ -417,21 +417,21 @@ const remarkPluginToc = function() {
417
417
  };
418
418
  async function createMDXOptions(docDirectory, config, checkDeadLinks, routeService, filepath, pluginDriver) {
419
419
  var _config_route;
420
- const cleanUrls = (null == config ? void 0 : null === (_config_route = config.route) || void 0 === _config_route ? void 0 : _config_route.cleanUrls) ?? false;
420
+ const cleanUrls = (null == config ? void 0 : null == (_config_route = config.route) ? void 0 : _config_route.cleanUrls) ?? false;
421
421
  const { remarkPlugins: remarkPluginsFromConfig = [], rehypePlugins: rehypePluginsFromConfig = [], globalComponents: globalComponentsFromConfig = [] } = (null == config ? void 0 : config.markdown) || {};
422
422
  const rspressPlugins = pluginDriver.getPlugins();
423
423
  const remarkPluginsFromPlugins = rspressPlugins.flatMap((plugin)=>{
424
424
  var _plugin_markdown;
425
- return (null === (_plugin_markdown = plugin.markdown) || void 0 === _plugin_markdown ? void 0 : _plugin_markdown.remarkPlugins) || [];
425
+ return (null == (_plugin_markdown = plugin.markdown) ? void 0 : _plugin_markdown.remarkPlugins) || [];
426
426
  });
427
427
  const rehypePluginsFromPlugins = rspressPlugins.flatMap((plugin)=>{
428
428
  var _plugin_markdown;
429
- return (null === (_plugin_markdown = plugin.markdown) || void 0 === _plugin_markdown ? void 0 : _plugin_markdown.rehypePlugins) || [];
429
+ return (null == (_plugin_markdown = plugin.markdown) ? void 0 : _plugin_markdown.rehypePlugins) || [];
430
430
  });
431
431
  const globalComponents = [
432
432
  ...rspressPlugins.flatMap((plugin)=>{
433
433
  var _plugin_markdown;
434
- return (null === (_plugin_markdown = plugin.markdown) || void 0 === _plugin_markdown ? void 0 : _plugin_markdown.globalComponents) || [];
434
+ return (null == (_plugin_markdown = plugin.markdown) ? void 0 : _plugin_markdown.globalComponents) || [];
435
435
  }),
436
436
  ...globalComponentsFromConfig
437
437
  ];
@@ -521,7 +521,7 @@ async function mdxLoader(source) {
521
521
  const replacedContent = applyReplaceRules(flattenContent, config.replaceRules);
522
522
  const preprocessedContent = escapeMarkdownHeadingIds(replacedContent);
523
523
  let enableMdxRs;
524
- const mdxRs = (null == config ? void 0 : null === (_config_markdown = config.markdown) || void 0 === _config_markdown ? void 0 : _config_markdown.mdxRs) ?? true;
524
+ const mdxRs = (null == config ? void 0 : null == (_config_markdown = config.markdown) ? void 0 : _config_markdown.mdxRs) ?? true;
525
525
  enableMdxRs = 'object' == typeof mdxRs ? 'function' == typeof (null == mdxRs ? void 0 : mdxRs.include) ? mdxRs.include(filepath) : true : mdxRs;
526
526
  try {
527
527
  let compileResult;
@@ -7,7 +7,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_helmet_async_048d06c6__ from "react-
7
7
  import * as __WEBPACK_EXTERNAL_MODULE_virtual_global_components_43dbb356__ from "virtual-global-components";
8
8
  import * as __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__ from "virtual-site-data";
9
9
  import "virtual-global-styles";
10
- var App_rslib_entry_QueryStatus = /*#__PURE__*/ function(QueryStatus) {
10
+ var App_QueryStatus = /*#__PURE__*/ function(QueryStatus) {
11
11
  QueryStatus["Show"] = "1";
12
12
  QueryStatus["Hide"] = "0";
13
13
  return QueryStatus;
@@ -24,7 +24,7 @@ async function initPageData(routePath) {
24
24
  return (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.isEqualPath)(normalize(page.routePath), normalize(matchedRoute.path));
25
25
  });
26
26
  const encodedPagePath = encodeURIComponent(pagePath);
27
- const meta = (null === (_mod_default___RSPRESS_PAGE_META = mod.default.__RSPRESS_PAGE_META) || void 0 === _mod_default___RSPRESS_PAGE_META ? void 0 : _mod_default___RSPRESS_PAGE_META[encodedPagePath]) || {};
27
+ const meta = (null == (_mod_default___RSPRESS_PAGE_META = mod.default.__RSPRESS_PAGE_META) ? void 0 : _mod_default___RSPRESS_PAGE_META[encodedPagePath]) || {};
28
28
  const { toc = [], title = '', frontmatter = {}, ...rest } = __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.MDX_OR_MD_REGEXP.test(matchedRoute.filePath) ? meta : mod;
29
29
  return {
30
30
  siteData: __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"],
@@ -40,7 +40,7 @@ async function initPageData(routePath) {
40
40
  };
41
41
  }
42
42
  let lang = __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].lang || '';
43
- let version = (null === (_siteData_multiVersion = __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].multiVersion) || void 0 === _siteData_multiVersion ? void 0 : _siteData_multiVersion.default) || '';
43
+ let version = (null == (_siteData_multiVersion = __WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].multiVersion) ? void 0 : _siteData_multiVersion.default) || '';
44
44
  if (__WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].lang && 'undefined' != typeof window) {
45
45
  const path = location.pathname.replace(__WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].base, '').split('/').slice(0, 2);
46
46
  if (__WEBPACK_EXTERNAL_MODULE_virtual_site_data_fa42d4c0__["default"].locales.length) {
@@ -108,4 +108,4 @@ function App({ helmetContext }) {
108
108
  ]
109
109
  });
110
110
  }
111
- export { App, App_rslib_entry_QueryStatus as QueryStatus, initPageData };
111
+ export { App, App_QueryStatus as QueryStatus, initPageData };
@@ -1,4 +1,4 @@
1
- var tsconfig_rslib_entry_namespaceObject = JSON.parse('{"compilerOptions":{"rootDir":".","baseUrl":".","skipLibCheck":true,"jsx":"react-jsx","esModuleInterop":true},"include":["./**/*"]}');
2
- var __webpack_exports__compilerOptions = tsconfig_rslib_entry_namespaceObject.compilerOptions;
3
- var __webpack_exports__include = tsconfig_rslib_entry_namespaceObject.include;
1
+ var tsconfig_namespaceObject = JSON.parse('{"compilerOptions":{"rootDir":".","baseUrl":".","skipLibCheck":true,"jsx":"react-jsx","esModuleInterop":true},"include":["./**/*"]}');
2
+ var __webpack_exports__compilerOptions = tsconfig_namespaceObject.compilerOptions;
3
+ var __webpack_exports__include = tsconfig_namespaceObject.include;
4
4
  export { __webpack_exports__compilerOptions as compilerOptions, __webpack_exports__include as include };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "1.43.12",
3
+ "version": "1.44.0",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -42,13 +42,13 @@
42
42
  "theme.ts"
43
43
  ],
44
44
  "dependencies": {
45
- "@mdx-js/loader": "2.3.0",
46
- "@mdx-js/mdx": "2.3.0",
47
- "@mdx-js/react": "2.3.0",
48
- "@rsbuild/core": "1.2.3",
49
- "@rsbuild/plugin-less": "~1.1.0",
50
- "@rsbuild/plugin-react": "~1.1.0",
51
- "@rsbuild/plugin-sass": "~1.2.0",
45
+ "@mdx-js/loader": "^2.3.0",
46
+ "@mdx-js/mdx": "^2.3.0",
47
+ "@mdx-js/react": "^2.3.0",
48
+ "@rsbuild/core": "~1.3.18",
49
+ "@rsbuild/plugin-less": "~1.2.4",
50
+ "@rsbuild/plugin-react": "~1.3.1",
51
+ "@rsbuild/plugin-sass": "~1.3.0",
52
52
  "@rspress/mdx-rs": "0.6.6",
53
53
  "enhanced-resolve": "5.18.0",
54
54
  "github-slugger": "^2.0.0",
@@ -73,17 +73,17 @@
73
73
  "unified": "^10.1.2",
74
74
  "unist-util-visit": "^4.1.2",
75
75
  "unist-util-visit-children": "^2.0.2",
76
- "@rspress/plugin-auto-nav-sidebar": "1.43.12",
77
- "@rspress/plugin-last-updated": "1.43.12",
78
- "@rspress/plugin-medium-zoom": "1.43.12",
79
- "@rspress/plugin-container-syntax": "1.43.12",
80
- "@rspress/shared": "1.43.12",
81
- "@rspress/runtime": "1.43.12",
82
- "@rspress/theme-default": "1.43.12"
76
+ "@rspress/plugin-auto-nav-sidebar": "1.44.0",
77
+ "@rspress/plugin-last-updated": "1.44.0",
78
+ "@rspress/plugin-container-syntax": "1.44.0",
79
+ "@rspress/runtime": "1.44.0",
80
+ "@rspress/plugin-medium-zoom": "1.44.0",
81
+ "@rspress/shared": "1.44.0",
82
+ "@rspress/theme-default": "1.44.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@microsoft/api-extractor": "^7.49.2",
86
- "@rslib/core": "0.5.2",
86
+ "@rslib/core": "~0.6.9",
87
87
  "@rspress-dev/plugin-preview": "link:../plugin-preview",
88
88
  "@types/hast": "^2.3.10",
89
89
  "@types/html-to-text": "^9.0.4",