@rspress/plugin-llms 2.0.5 → 2.0.6

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 +4 -5
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -270,12 +270,11 @@ function organizeBySidebar(sidebar, pages) {
270
270
  const currSidebar = getSidebarDataGroup(sidebar, pageItem.routePath);
271
271
  if (0 === currSidebar.length) return;
272
272
  const orderList = flatSidebar(currSidebar);
273
+ const normalizeLink = (p)=>p.replace(/\.html$/, '').replace(/\/index$/, '/');
273
274
  pages.sort((a, b)=>{
274
- let aIndex = orderList.findIndex((order)=>matchPath(order, a.routePath));
275
- if (-1 === aIndex) aIndex = Number.MAX_SAFE_INTEGER;
276
- let bIndex = orderList.findIndex((order)=>matchPath(order, b.routePath));
277
- if (-1 === bIndex) bIndex = Number.MAX_SAFE_INTEGER;
278
- return aIndex - bIndex;
275
+ const aIndex = orderList.findIndex((order)=>matchPath(normalizeLink(order), a.routePath));
276
+ const bIndex = orderList.findIndex((order)=>matchPath(normalizeLink(order), b.routePath));
277
+ return (-1 === aIndex ? Number.MAX_SAFE_INTEGER : aIndex) - (-1 === bIndex ? Number.MAX_SAFE_INTEGER : bIndex);
279
278
  });
280
279
  }
281
280
  function getDefaultOptions(lang, langs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-llms",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
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": {
@@ -35,10 +35,10 @@
35
35
  "unist-util-visit": "^5.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@microsoft/api-extractor": "^7.57.6",
38
+ "@microsoft/api-extractor": "^7.57.7",
39
39
  "@rsbuild/core": "2.0.0-beta.6",
40
40
  "@rsbuild/plugin-react": "~1.4.5",
41
- "@rslib/core": "0.19.6",
41
+ "@rslib/core": "0.20.0",
42
42
  "@types/hast": "^3.0.4",
43
43
  "@types/node": "^22.8.1",
44
44
  "@types/react": "^19.2.14",
@@ -49,7 +49,7 @@
49
49
  "@rspress/config": "1.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@rspress/core": "^2.0.5"
52
+ "@rspress/core": "^2.0.6"
53
53
  },
54
54
  "engines": {
55
55
  "node": "^20.19.0 || >=22.12.0"