@rspress/plugin-llms 2.0.0-beta.16 → 2.0.0-beta.18
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 +6 -7
- package/package.json +7 -7
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
2
2
|
import node_path from "node:path";
|
3
|
-
import { getSidebarDataGroup, normalizeHref
|
3
|
+
import { getSidebarDataGroup, normalizeHref } from "@rspress/shared";
|
4
4
|
import { logger } from "@rspress/shared/logger";
|
5
5
|
import { remarkPluginNormalizeLink } from "@rspress/core";
|
6
6
|
import remark_mdx from "remark-mdx";
|
@@ -210,12 +210,11 @@ function mdxToMd(content, filepath, docDirectory, routeService) {
|
|
210
210
|
path: filepath
|
211
211
|
});
|
212
212
|
}
|
213
|
-
const rsbuildPluginLlms = ({ disableSSGRef, pageDataList, routes, titleRef, descriptionRef, langRef, sidebar,
|
213
|
+
const rsbuildPluginLlms = ({ disableSSGRef, pageDataList, routes, titleRef, descriptionRef, langRef, sidebar, docDirectoryRef, routeServiceRef, nav, rspressPluginOptions })=>({
|
214
214
|
name: 'rsbuild-plugin-llms',
|
215
215
|
async setup (api) {
|
216
216
|
const { llmsTxt = true, mdFiles = true, llmsFullTxt = true, include, exclude } = rspressPluginOptions;
|
217
217
|
api.onBeforeBuild(async ()=>{
|
218
|
-
const base = baseRef.current;
|
219
218
|
const docDirectory = docDirectoryRef.current;
|
220
219
|
const disableSSG = disableSSGRef.current;
|
221
220
|
const newPageDataList = mergeRouteMetaWithPageData(routes, pageDataList, langRef.current, include, exclude);
|
@@ -234,11 +233,11 @@ const rsbuildPluginLlms = ({ disableSSGRef, pageDataList, routes, titleRef, desc
|
|
234
233
|
for(let i = 0; i < pageArray.length; i++){
|
235
234
|
const pageArrayItem = pageArray[i];
|
236
235
|
const navItem = navList[i];
|
237
|
-
if (lang === navItem.lang && new RegExp(navItem.activeMatch ?? navItem.link).test(
|
236
|
+
if (lang === navItem.lang && new RegExp(navItem.activeMatch ?? navItem.link).test(routePath)) return void pageArrayItem.push(pageData);
|
238
237
|
}
|
239
238
|
others.push(pageData);
|
240
239
|
});
|
241
|
-
for (const array of pageArray)organizeBySidebar(sidebar, array
|
240
|
+
for (const array of pageArray)organizeBySidebar(sidebar, array);
|
242
241
|
if (llmsTxt) {
|
243
242
|
const llmsTxtContent = generateLlmsTxt(pageArray, navList, others, rspressPluginOptions.llmsTxt ?? {}, titleRef.current, descriptionRef.current);
|
244
243
|
api.processAssets({
|
@@ -337,10 +336,10 @@ function flatSidebar(sidebar) {
|
|
337
336
|
if ('items' in i && Array.isArray(i.items)) return flatSidebar(i.items);
|
338
337
|
}).filter(Boolean);
|
339
338
|
}
|
340
|
-
function organizeBySidebar(sidebar, pages
|
339
|
+
function organizeBySidebar(sidebar, pages) {
|
341
340
|
if (0 === pages.length) return;
|
342
341
|
const pageItem = pages[0];
|
343
|
-
const currSidebar = getSidebarDataGroup(sidebar, pageItem.routePath
|
342
|
+
const currSidebar = getSidebarDataGroup(sidebar, pageItem.routePath);
|
344
343
|
if (0 === currSidebar.length) return;
|
345
344
|
const orderList = flatSidebar(currSidebar);
|
346
345
|
pages.sort((a, b)=>{
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/plugin-llms",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.18",
|
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.
|
27
|
+
"@rspress/shared": "2.0.0-beta.18"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
30
|
"@microsoft/api-extractor": "^7.52.8",
|
31
|
-
"@rsbuild/core": "~1.
|
32
|
-
"@rslib/core": "0.10.
|
31
|
+
"@rsbuild/core": "~1.4.0",
|
32
|
+
"@rslib/core": "0.10.3",
|
33
33
|
"@types/hast": "^3.0.4",
|
34
34
|
"@types/node": "^22.8.1",
|
35
35
|
"typescript": "^5.8.2",
|
36
36
|
"vfile": "^6.0.3",
|
37
|
-
"@rspress/
|
38
|
-
"@rspress/
|
37
|
+
"@rspress/runtime": "2.0.0-beta.18",
|
38
|
+
"@rspress/config": "1.0.0"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
|
-
"@rspress/core": "^2.0.0-beta.
|
41
|
+
"@rspress/core": "^2.0.0-beta.18"
|
42
42
|
},
|
43
43
|
"engines": {
|
44
44
|
"node": ">=18.0.0"
|