@rspress/core 2.0.0-beta.6 → 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.
Files changed (2) hide show
  1. package/dist/index.js +14 -20
  2. package/package.json +18 -18
package/dist/index.js CHANGED
@@ -179,7 +179,7 @@ const pluginVirtualModule = (pluginOptions = {})=>({
179
179
  }
180
180
  }
181
181
  });
182
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.6"}');
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)();
@@ -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;
@@ -1322,7 +1315,8 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
1322
1315
  ...i18nVMPlugin(context),
1323
1316
  ...globalUIComponentsVMPlugin(context),
1324
1317
  ...globalStylesVMPlugin(context),
1325
- ...searchHookVMPlugin(context)
1318
+ ...searchHookVMPlugin(context),
1319
+ ...routeListVMPlugin(context)
1326
1320
  }
1327
1321
  }),
1328
1322
  ...enableSSG ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0-beta.6",
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.18",
48
+ "@rsbuild/core": "~1.3.21",
49
49
  "@rsbuild/plugin-react": "~1.3.1",
50
50
  "@rspress/mdx-rs": "0.6.6",
51
51
  "@types/unist": "^3.0.3",
52
- "@unhead/react": "^2.0.8",
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",
@@ -65,33 +65,33 @@
65
65
  "rehype-external-links": "^3.0.0",
66
66
  "remark": "^15.0.1",
67
67
  "remark-gfm": "^4.0.1",
68
- "rspack-plugin-virtual-module": "1.0.0",
69
- "tinyglobby": "^0.2.13",
68
+ "rspack-plugin-virtual-module": "1.0.1",
69
+ "tinyglobby": "^0.2.14",
70
70
  "unified": "^11.0.5",
71
71
  "unist-util-visit": "^5.0.0",
72
72
  "unist-util-visit-children": "^3.0.0",
73
- "@rspress/plugin-auto-nav-sidebar": "2.0.0-beta.6",
74
- "@rspress/plugin-container-syntax": "2.0.0-beta.6",
75
- "@rspress/plugin-last-updated": "2.0.0-beta.6",
76
- "@rspress/plugin-shiki": "2.0.0-beta.6",
77
- "@rspress/plugin-medium-zoom": "2.0.0-beta.6",
78
- "@rspress/theme-default": "2.0.0-beta.6",
79
- "@rspress/shared": "2.0.0-beta.6",
80
- "@rspress/runtime": "2.0.0-beta.6"
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"
81
81
  },
82
82
  "devDependencies": {
83
- "@microsoft/api-extractor": "^7.52.7",
84
- "@rslib/core": "0.6.9",
83
+ "@microsoft/api-extractor": "^7.52.8",
84
+ "@rslib/core": "0.8.0",
85
85
  "@rspress-dev/plugin-preview": "link:../plugin-preview",
86
86
  "@types/hast": "^3.0.4",
87
87
  "@types/html-to-text": "^9.0.4",
88
88
  "@types/jest": "~29.5.14",
89
89
  "@types/lodash-es": "^4.17.12",
90
90
  "@types/mdast": "^4.0.4",
91
- "@types/node": "^18.11.17",
92
- "@types/react": "^18.3.21",
91
+ "@types/node": "^22.8.1",
92
+ "@types/react": "^18.3.22",
93
93
  "@types/react-dom": "^18.3.7",
94
- "memfs": "^4.17.1",
94
+ "memfs": "^4.17.2",
95
95
  "postcss": "8.5.3",
96
96
  "rehype-stringify": "^10.0.1",
97
97
  "remark-mdx": "^3.1.0",