@rspress/core 2.0.0-beta.5 → 2.0.0-beta.7

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
@@ -4,18 +4,18 @@ 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_react_7b149ee4__ from "@rsbuild/plugin-react";
8
7
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
8
+ import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_react_7b149ee4__ from "@rsbuild/plugin-react";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__ from "@rspress/shared/logger";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
12
12
  import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
13
13
  import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
14
14
  import * as __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__ from "rspack-plugin-virtual-module";
15
+ import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
15
16
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_es_18c59938__ from "lodash-es";
16
17
  import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
17
18
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_mdx_rs_d2f3021f__ from "@rspress/mdx-rs";
18
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
19
19
  import * as __WEBPACK_EXTERNAL_MODULE_html_to_text_2c51ed38__ from "html-to-text";
20
20
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
21
21
  import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
@@ -179,7 +179,7 @@ const pluginVirtualModule = (pluginOptions = {})=>({
179
179
  }
180
180
  }
181
181
  });
182
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.5"}');
182
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.7"}');
183
183
  const RSPRESS_VERSION = package_namespaceObject.i8;
184
184
  const isProduction = ()=>'production' === process.env.NODE_ENV;
185
185
  const importStatementRegex = /import\s+(.*?)\s+from\s+(['"])(.*?)(?:"|');?/gm;
@@ -461,6 +461,9 @@ async function initRouteService(options) {
461
461
  await pluginDriver.routeServiceGenerated(init_routeService);
462
462
  return init_routeService;
463
463
  }
464
+ function createHash(str) {
465
+ return (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)('sha256').update(str).digest('hex').slice(0, 8);
466
+ }
464
467
  var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
465
468
  RuntimeModuleID["GlobalStyles"] = "virtual-global-styles";
466
469
  RuntimeModuleID["GlobalComponents"] = "virtual-global-components";
@@ -472,20 +475,6 @@ var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
472
475
  RuntimeModuleID["SearchHooks"] = "virtual-search-hooks";
473
476
  return RuntimeModuleID;
474
477
  }({});
475
- async function routeVMPlugin(context) {
476
- const { routeService, isSSR } = context;
477
- if (!isSSR) return {
478
- [types_RuntimeModuleID.RouteForClient]: routeService.generateRoutesCode(false),
479
- [types_RuntimeModuleID.RouteForSSR]: ''
480
- };
481
- return {
482
- [types_RuntimeModuleID.RouteForClient]: routeService.generateRoutesCode(false),
483
- [types_RuntimeModuleID.RouteForSSR]: routeService.generateRoutesCode(true)
484
- };
485
- }
486
- function createHash(str) {
487
- return (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)('sha256').update(str).digest('hex').slice(0, 8);
488
- }
489
478
  let flattenMdxContent_resolver;
490
479
  let startFlatten = false;
491
480
  const processor = (0, __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__.createProcessor)();
@@ -843,7 +832,7 @@ async function siteDataVMPlugin(context) {
843
832
  const siteData = {
844
833
  title: userConfig?.title || '',
845
834
  description: userConfig?.description || '',
846
- icon: userConfig?.icon || '',
835
+ icon: (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getIconUrlPath)(userConfig?.icon) || '',
847
836
  route: userConfig?.route || {},
848
837
  themeConfig: normalizeThemeConfig(userConfig, pages),
849
838
  base: userConfig?.base || '/',
@@ -879,7 +868,6 @@ async function siteDataVMPlugin(context) {
879
868
  };
880
869
  }
881
870
  const runtimeModuleFactory = [
882
- routeVMPlugin,
883
871
  siteDataVMPlugin
884
872
  ];
885
873
  function rsbuildPluginDocVM(factoryContext) {
@@ -887,14 +875,12 @@ function rsbuildPluginDocVM(factoryContext) {
887
875
  return {
888
876
  name: 'rsbuild-plugin-doc-vm',
889
877
  setup (api) {
890
- api.modifyBundlerChain(async (bundlerChain, { target })=>{
891
- const isServer = 'node' === target;
878
+ api.modifyBundlerChain(async (bundlerChain)=>{
892
879
  const alias = bundlerChain.resolve.alias.entries();
893
880
  const runtimeModule = {};
894
881
  for (const factory of runtimeModuleFactory){
895
882
  const moduleResult = await factory({
896
883
  ...factoryContext,
897
- isSSR: isServer,
898
884
  alias: alias
899
885
  });
900
886
  Object.assign(runtimeModule, moduleResult);
@@ -944,6 +930,13 @@ const Props_${index++} = ${JSON.stringify(source[1])};\n`;
944
930
  return moduleContent;
945
931
  }
946
932
  });
933
+ const routeListVMPlugin = (context)=>{
934
+ const { routeService } = context;
935
+ return {
936
+ [types_RuntimeModuleID.RouteForClient]: ()=>routeService.generateRoutesCode(false),
937
+ [types_RuntimeModuleID.RouteForSSR]: ({ environment })=>'node' === environment.name ? routeService.generateRoutesCode(true) : ''
938
+ };
939
+ };
947
940
  const searchHookVMPlugin = (context)=>({
948
941
  [`${types_RuntimeModuleID.SearchHooks}`]: ()=>{
949
942
  const { config } = context;
@@ -1204,9 +1197,9 @@ async function resolveReactAlias(reactVersion, isSSR) {
1204
1197
  'react/jsx-runtime',
1205
1198
  'react/jsx-dev-runtime',
1206
1199
  'react-dom',
1200
+ 'react-dom/client',
1207
1201
  'react-dom/server'
1208
1202
  ];
1209
- if (reactVersion >= 18) libPaths.push('react-dom/client');
1210
1203
  const alias = {};
1211
1204
  const resolver = detectReactVersion_ResolverFactory.createResolver({
1212
1205
  fileSystem: new detectReactVersion_CachedInputFileSystem(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"], 0),
@@ -1292,7 +1285,9 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1292
1285
  const reactVersion = await detectReactVersion();
1293
1286
  const normalizeIcon = (icon)=>{
1294
1287
  if (!icon) return;
1295
- if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(icon)) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(userDocRoot, PUBLIC_DIR, icon);
1288
+ icon = icon.toString();
1289
+ if (icon.startsWith('file://')) icon = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(icon);
1290
+ else if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(icon)) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(userDocRoot, PUBLIC_DIR, icon);
1296
1291
  return icon;
1297
1292
  };
1298
1293
  await hintThemeBreakingChange(CUSTOM_THEME_DIR);
@@ -1320,7 +1315,8 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1320
1315
  ...i18nVMPlugin(context),
1321
1316
  ...globalUIComponentsVMPlugin(context),
1322
1317
  ...globalStylesVMPlugin(context),
1323
- ...searchHookVMPlugin(context)
1318
+ ...searchHookVMPlugin(context),
1319
+ ...routeListVMPlugin(context)
1324
1320
  }
1325
1321
  }),
1326
1322
  ...enableSSG ? [
@@ -1378,8 +1374,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1378
1374
  ],
1379
1375
  '@theme-assets': __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(DEFAULT_THEME, '../assets'),
1380
1376
  '@rspress/core': PACKAGE_ROOT,
1381
- 'react-lazy-with-preload': require.resolve('react-lazy-with-preload'),
1382
- 'react-syntax-highlighter': __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(require.resolve('react-syntax-highlighter/package.json'))
1377
+ 'react-lazy-with-preload': require.resolve('react-lazy-with-preload')
1383
1378
  }
1384
1379
  },
1385
1380
  source: {
@@ -1388,7 +1383,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1388
1383
  __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR)
1389
1384
  ],
1390
1385
  define: {
1391
- 'process.env.__REACT_GTE_18__': JSON.stringify(reactVersion >= 18),
1392
1386
  'process.env.TEST': JSON.stringify(process.env.TEST),
1393
1387
  'process.env.RSPRESS_SOCIAL_ICONS': JSON.stringify(getSocialIcons(config.themeConfig?.socialLinks))
1394
1388
  }
@@ -1520,6 +1514,7 @@ async function initRsbuild(rootDir, config, pluginDriver, enableSSG, extraRsbuil
1520
1514
  const { createRsbuild, mergeRsbuildConfig } = await import("@rsbuild/core");
1521
1515
  const internalRsbuildConfig = await createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver, runtimeTempDir);
1522
1516
  const rsbuild = await createRsbuild({
1517
+ callerName: 'rspress',
1523
1518
  rsbuildConfig: mergeRsbuildConfig(internalRsbuildConfig, ...pluginDriver.getPlugins()?.map((plugin)=>plugin.builderConfig ?? {}) || [], config?.builderConfig || {}, extraRsbuildConfig || {})
1524
1519
  });
1525
1520
  rsbuild.addPlugins(builderPlugins);
@@ -1729,6 +1724,11 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
1729
1724
  const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
1730
1725
  node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
1731
1726
  });
1727
+ (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'definition', (node)=>{
1728
+ const { url: nodeUrl } = node;
1729
+ const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
1730
+ node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
1731
+ });
1732
1732
  const getMdxSrcAttribute = (tempVar)=>({
1733
1733
  type: 'mdxJsxAttribute',
1734
1734
  name: 'src',
package/dist/loader.d.ts CHANGED
@@ -7,8 +7,6 @@ import type { Rspack as Rspack_2 } from '@rsbuild/core';
7
7
  import type { RspressPlugin } from '@rspress/shared';
8
8
  import type { UserConfig } from '@rspress/shared';
9
9
 
10
- export declare function createCheckPageMetaUpdateFn(): (modulePath: string, pageMeta: PageMeta) => void;
11
-
12
10
  declare interface LoaderOptions {
13
11
  config: UserConfig;
14
12
  docDirectory: string;
@@ -84,6 +82,4 @@ declare interface TocItem {
84
82
  depth: number;
85
83
  }
86
84
 
87
- export declare function updateSiteDataRuntimeModule(modulePath: string, pageMeta: PageMeta): Promise<void>;
88
-
89
85
  export { }
package/dist/loader.js CHANGED
@@ -1,10 +1,7 @@
1
1
  import __rslib_shim_module__ from 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
4
3
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
5
- import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
6
4
  import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_mdx_b904bd09__ from "@mdx-js/mdx";
7
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
8
5
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__ from "@rspress/shared/logger";
9
6
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
10
7
  import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
@@ -13,34 +10,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_remark_gfm_073acf21__ from "remark-gfm";
13
10
  import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__ from "unist-util-visit";
14
11
  import * as __WEBPACK_EXTERNAL_MODULE_github_slugger_8e9a17cb__ from "github-slugger";
15
12
  import * as __WEBPACK_EXTERNAL_MODULE_hast_util_heading_rank_cff646ba__ from "hast-util-heading-rank";
13
+ import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
16
14
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
17
15
  import * as __WEBPACK_EXTERNAL_MODULE_unist_util_visit_children_71921007__ from "unist-util-visit-children";
18
- `{
19
- const saved = localStorage.getItem('${__WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.APPEARANCE_KEY}')
20
- const preferDark = window.matchMedia('(prefers-color-scheme: dark)').matches
21
- const isDark = !saved || saved === 'auto' ? preferDark : saved === 'dark'
22
- document.documentElement.classList.toggle('dark', isDark)
23
- document.documentElement.classList.toggle('rp-dark', isDark)
24
- document.documentElement.style.colorScheme = isDark ? 'dark' : 'light'
25
- }`.replace(/\n/g, ';').replace(/\s{2,}/g, '');
26
- const dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(new URL(import.meta.url)));
27
- const PACKAGE_ROOT = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dirname, '..');
28
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'index.html');
29
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'csrClientEntry.js');
30
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrClientEntry.js');
31
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(PACKAGE_ROOT, 'dist', 'runtime', 'ssrServerEntry.js');
32
- const TEMP_DIR = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR);
33
- var types_RuntimeModuleID = /*#__PURE__*/ function(RuntimeModuleID) {
34
- RuntimeModuleID["GlobalStyles"] = "virtual-global-styles";
35
- RuntimeModuleID["GlobalComponents"] = "virtual-global-components";
36
- RuntimeModuleID["RouteForClient"] = "virtual-routes";
37
- RuntimeModuleID["RouteForSSR"] = "virtual-routes-ssr";
38
- RuntimeModuleID["SiteData"] = "virtual-site-data";
39
- RuntimeModuleID["SearchIndexHash"] = "virtual-search-index-hash";
40
- RuntimeModuleID["I18nText"] = "virtual-i18n-text";
41
- RuntimeModuleID["SearchHooks"] = "virtual-search-hooks";
42
- return RuntimeModuleID;
43
- }({});
44
16
  function applyReplaceRules(code = '', replaceRules = []) {
45
17
  let result = code;
46
18
  for (const rule of replaceRules)result = result.replace(rule.search, rule.replace);
@@ -215,6 +187,11 @@ const remarkPluginNormalizeLink = ({ root, cleanUrls, routeService })=>(tree, fi
215
187
  const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
216
188
  node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
217
189
  });
190
+ (0, __WEBPACK_EXTERNAL_MODULE_unist_util_visit_555e002a__.visit)(tree, 'definition', (node)=>{
191
+ const { url: nodeUrl } = node;
192
+ const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file.path);
193
+ node.url = normalizeLink(nodeUrl, routeService, relativePath, cleanUrls);
194
+ });
218
195
  const getMdxSrcAttribute = (tempVar)=>({
219
196
  type: 'mdxJsxAttribute',
220
197
  name: 'src',
@@ -374,41 +351,15 @@ async function createMDXOptions(docDirectory, config, checkDeadLinks, routeServi
374
351
  ]
375
352
  };
376
353
  }
377
- async function updateSiteDataRuntimeModule(modulePath, pageMeta) {
378
- const siteDataModulePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(TEMP_DIR, 'runtime', `${types_RuntimeModuleID.SiteData}.mjs`);
379
- const { default: siteData } = await import((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(siteDataModulePath).href);
380
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].writeFile(siteDataModulePath, `export default ${JSON.stringify({
381
- ...siteData,
382
- timestamp: Date.now().toString(),
383
- pages: siteData.pages.map((page)=>page._filepath === modulePath ? {
384
- ...page,
385
- ...pageMeta
386
- } : page)
387
- }, null, 2)}`);
388
- }
389
- function createCheckPageMetaUpdateFn() {
390
- const pageMetaMap = new Map();
391
- return (modulePath, pageMeta)=>{
392
- const prevMeta = pageMetaMap.get(modulePath);
393
- const deserializedMeta = JSON.stringify(pageMeta);
394
- pageMetaMap.set(modulePath, deserializedMeta);
395
- if (!prevMeta) return;
396
- if (prevMeta !== deserializedMeta) setTimeout(async ()=>{
397
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.info('Page metadata changed, page reloading...');
398
- await updateSiteDataRuntimeModule(modulePath, pageMeta);
399
- });
400
- };
401
- }
402
- const checkPageMetaUpdate = createCheckPageMetaUpdateFn();
403
354
  async function mdxLoader(source) {
404
355
  this.cacheable(true);
405
356
  const callback = this.async();
406
357
  const options = this.getOptions();
407
358
  const filepath = this.resourcePath;
408
359
  const { config, docDirectory, checkDeadLinks, routeService, pluginDriver } = options;
409
- const { frontmatter, content } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.loadFrontMatter)(source, filepath, docDirectory, true);
410
- const replacedContent = applyReplaceRules(content, config.replaceRules);
411
- const preprocessedContent = escapeMarkdownHeadingIds(replacedContent);
360
+ const { frontmatter, emptyLinesSource } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.loadFrontMatter)(source, filepath, docDirectory, true);
361
+ const replacedSource = applyReplaceRules(emptyLinesSource, config.replaceRules);
362
+ const preprocessedContent = escapeMarkdownHeadingIds(replacedSource);
412
363
  try {
413
364
  let pageMeta = {
414
365
  title: '',
@@ -435,7 +386,6 @@ async function mdxLoader(source) {
435
386
  headingTitle,
436
387
  frontmatter
437
388
  };
438
- if (!(0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isProduction)()) checkPageMetaUpdate(filepath, pageMeta);
439
389
  const result = `const frontmatter = ${JSON.stringify(frontmatter)};
440
390
  ${compileResult}
441
391
  MDXContent.__RSPRESS_PAGE_META = {};
@@ -454,4 +404,4 @@ MDXContent.__RSPRESS_PAGE_META["${encodeURIComponent(normalizePath(__WEBPACK_EXT
454
404
  }
455
405
  }
456
406
  }
457
- export { createCheckPageMetaUpdateFn, mdxLoader as default, updateSiteDataRuntimeModule };
407
+ export { mdxLoader as default };
@@ -1,13 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__ from "react-dom/client";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__ from "./ClientApp.js";
3
- async function renderInBrowser() {
4
- const container = document.getElementById('root');
5
- if (process.env.__REACT_GTE_18__) {
6
- const { createRoot } = await import("react-dom/client");
7
- createRoot(container).render(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {}));
8
- } else {
9
- const ReactDOM = await import("react-dom");
10
- ReactDOM.render(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {}), container);
11
- }
12
- }
13
- renderInBrowser();
4
+ const container = document.getElementById('root');
5
+ (0, __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__.createRoot)(container).render(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {}));
@@ -1,19 +1,12 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__ from "react-dom/client";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__ from "./ClientApp.js";
3
4
  import * as __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__ from "./initPageData.js";
4
5
  async function renderInBrowser() {
5
6
  const container = document.getElementById('root');
6
7
  const initialPageData = await (0, __WEBPACK_EXTERNAL_MODULE__initPageData_js_731596b5__.initPageData)(window.location.pathname);
7
- if (process.env.__REACT_GTE_18__) {
8
- const { hydrateRoot } = await import("react-dom/client");
9
- hydrateRoot(container, /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {
10
- initialPageData: initialPageData
11
- }));
12
- } else {
13
- const ReactDOM = await import("react-dom");
14
- ReactDOM.hydrate(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {
15
- initialPageData: initialPageData
16
- }), container);
17
- }
8
+ (0, __WEBPACK_EXTERNAL_MODULE_react_dom_client_76b1397c__.hydrateRoot)(container, /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ClientApp_js_4935dbba__.ClientApp, {
9
+ initialPageData: initialPageData
10
+ }));
18
11
  }
19
12
  renderInBrowser();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -45,11 +45,11 @@
45
45
  "@mdx-js/loader": "^3.1.0",
46
46
  "@mdx-js/mdx": "^3.1.0",
47
47
  "@mdx-js/react": "^3.1.0",
48
- "@rsbuild/core": "1.3.17",
49
- "@rsbuild/plugin-react": "~1.3.0",
48
+ "@rsbuild/core": "~1.3.21",
49
+ "@rsbuild/plugin-react": "~1.3.1",
50
50
  "@rspress/mdx-rs": "0.6.6",
51
- "@types/unist": "^3.0.0",
52
- "@unhead/react": "^2.0.0",
51
+ "@types/unist": "^3.0.3",
52
+ "@unhead/react": "^2.0.10",
53
53
  "enhanced-resolve": "5.18.1",
54
54
  "github-slugger": "^2.0.0",
55
55
  "hast-util-from-html": "^2.0.3",
@@ -62,37 +62,36 @@
62
62
  "react-dom": "^19.1.0",
63
63
  "react-lazy-with-preload": "^2.2.1",
64
64
  "react-router-dom": "^6.29.0",
65
- "react-syntax-highlighter": "^15.6.1",
66
65
  "rehype-external-links": "^3.0.0",
67
66
  "remark": "^15.0.1",
68
67
  "remark-gfm": "^4.0.1",
69
- "rspack-plugin-virtual-module": "0.1.13",
70
- "tinyglobby": "^0.2.13",
68
+ "rspack-plugin-virtual-module": "1.0.1",
69
+ "tinyglobby": "^0.2.14",
71
70
  "unified": "^11.0.5",
72
71
  "unist-util-visit": "^5.0.0",
73
72
  "unist-util-visit-children": "^3.0.0",
74
- "@rspress/plugin-container-syntax": "2.0.0-beta.5",
75
- "@rspress/plugin-last-updated": "2.0.0-beta.5",
76
- "@rspress/plugin-auto-nav-sidebar": "2.0.0-beta.5",
77
- "@rspress/plugin-medium-zoom": "2.0.0-beta.5",
78
- "@rspress/runtime": "2.0.0-beta.5",
79
- "@rspress/plugin-shiki": "2.0.0-beta.5",
80
- "@rspress/shared": "2.0.0-beta.5",
81
- "@rspress/theme-default": "2.0.0-beta.5"
73
+ "@rspress/plugin-auto-nav-sidebar": "2.0.0-beta.7",
74
+ "@rspress/plugin-container-syntax": "2.0.0-beta.7",
75
+ "@rspress/plugin-medium-zoom": "2.0.0-beta.7",
76
+ "@rspress/runtime": "2.0.0-beta.7",
77
+ "@rspress/shared": "2.0.0-beta.7",
78
+ "@rspress/theme-default": "2.0.0-beta.7",
79
+ "@rspress/plugin-shiki": "2.0.0-beta.7",
80
+ "@rspress/plugin-last-updated": "2.0.0-beta.7"
82
81
  },
83
82
  "devDependencies": {
84
- "@microsoft/api-extractor": "^7.52.7",
85
- "@rslib/core": "0.6.8",
83
+ "@microsoft/api-extractor": "^7.52.8",
84
+ "@rslib/core": "0.8.0",
86
85
  "@rspress-dev/plugin-preview": "link:../plugin-preview",
87
86
  "@types/hast": "^3.0.4",
88
87
  "@types/html-to-text": "^9.0.4",
89
88
  "@types/jest": "~29.5.14",
90
89
  "@types/lodash-es": "^4.17.12",
91
90
  "@types/mdast": "^4.0.4",
92
- "@types/node": "^18.11.17",
93
- "@types/react": "^18.3.21",
91
+ "@types/node": "^22.8.1",
92
+ "@types/react": "^18.3.22",
94
93
  "@types/react-dom": "^18.3.7",
95
- "memfs": "^4.17.1",
94
+ "memfs": "^4.17.2",
96
95
  "postcss": "8.5.3",
97
96
  "rehype-stringify": "^10.0.1",
98
97
  "remark-mdx": "^3.1.0",
@@ -100,7 +99,7 @@
100
99
  "remark-rehype": "^11.1.2",
101
100
  "remark-stringify": "^11.0.0",
102
101
  "rimraf": "^6.0.1",
103
- "rsbuild-plugin-publint": "^0.3.1",
102
+ "rsbuild-plugin-publint": "^0.3.2",
104
103
  "rsbuild-plugin-virtual-module": "0.1.1",
105
104
  "tailwindcss": "^3.4.17",
106
105
  "typescript": "^5.8.2",