@rspress/plugin-llms 2.0.0-beta.3 → 2.0.0-beta.4

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 -4
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -377,19 +377,29 @@ function pluginLlms(options = {}) {
377
377
  if (isProd) routes.push(..._routes);
378
378
  },
379
379
  beforeBuild (config) {
380
- const configSidebar = config?.themeConfig?.locales?.map((i)=>i.sidebar).reduce((prev, curr)=>{
380
+ const locales = config.themeConfig?.locales;
381
+ const isMultiLang = locales && locales.length > 0;
382
+ const sidebars = isMultiLang ? locales.map((i)=>i.sidebar) : [
383
+ config.themeConfig?.sidebar
384
+ ];
385
+ const configSidebar = sidebars.reduce((prev, curr)=>{
381
386
  Object.assign(prev, curr);
382
387
  return prev;
383
388
  }, {});
384
389
  Object.assign(sidebar, configSidebar);
385
- const configNav = config.themeConfig?.locales?.filter((i)=>Boolean(i.nav))?.map((i)=>({
390
+ const configNav = isMultiLang ? locales.filter((i)=>Boolean(i.nav)).map((i)=>({
386
391
  nav: i.nav,
387
392
  lang: i.lang
388
- }));
393
+ })) : [
394
+ {
395
+ nav: config.themeConfig?.nav,
396
+ lang: config.lang ?? ''
397
+ }
398
+ ];
389
399
  nav.push(...configNav);
390
400
  titleRef.current = config.title;
391
401
  descriptionRef.current = config.description;
392
- langRef.current = config.lang;
402
+ langRef.current = config.lang ?? '';
393
403
  baseRef.current = config.base ?? '/';
394
404
  docDirectoryRef.current = config.root ?? 'docs';
395
405
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-llms",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "A plugin for rspress to generate llms.txt, llms-full.txt, md files to let llm understand your website.",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -24,21 +24,21 @@
24
24
  "unified": "^11.0.5",
25
25
  "unist-util-visit": "^5.0.0",
26
26
  "unist-util-visit-children": "^3.0.0",
27
- "@rspress/shared": "2.0.0-beta.3"
27
+ "@rspress/shared": "2.0.0-beta.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@microsoft/api-extractor": "^7.52.5",
31
- "@rsbuild/core": "1.3.13",
32
- "@rslib/core": "0.6.7",
30
+ "@microsoft/api-extractor": "^7.52.7",
31
+ "@rsbuild/core": "1.3.16",
32
+ "@rslib/core": "0.6.8",
33
33
  "@types/hast": "^3.0.4",
34
34
  "@types/node": "^18.11.17",
35
35
  "typescript": "^5.8.2",
36
36
  "vfile": "^6.0.3",
37
- "@rspress/config": "1.0.0",
38
- "@rspress/runtime": "2.0.0-beta.3"
37
+ "@rspress/runtime": "2.0.0-beta.4",
38
+ "@rspress/config": "1.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@rspress/core": "^2.0.0-beta.3"
41
+ "@rspress/core": "^2.0.0-beta.4"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=18.0.0"