@rspress/plugin-llms 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 +16 -4
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -210,13 +210,14 @@ function mdxToMd(content, filepath, docDirectory, routeService) {
210
210
  path: filepath
211
211
  });
212
212
  }
213
- const rsbuildPluginLlms = ({ pageDataList, routes, titleRef, descriptionRef, langRef, sidebar, baseRef, docDirectoryRef, routeServiceRef, nav, rspressPluginOptions })=>({
213
+ const rsbuildPluginLlms = ({ disableSSGRef, pageDataList, routes, titleRef, descriptionRef, langRef, sidebar, baseRef, 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
218
  const base = baseRef.current;
219
219
  const docDirectory = docDirectoryRef.current;
220
+ const disableSSG = disableSSGRef.current;
220
221
  const newPageDataList = mergeRouteMetaWithPageData(routes, pageDataList, langRef.current, include, exclude);
221
222
  const navList = Array.isArray(nav) ? nav.map((i)=>{
222
223
  const nav = i.nav.default;
@@ -241,7 +242,9 @@ const rsbuildPluginLlms = ({ pageDataList, routes, titleRef, descriptionRef, lan
241
242
  if (llmsTxt) {
242
243
  const llmsTxtContent = generateLlmsTxt(pageArray, navList, others, rspressPluginOptions.llmsTxt ?? {}, titleRef.current, descriptionRef.current);
243
244
  api.processAssets({
244
- targets: [
245
+ targets: disableSSG ? [
246
+ 'web'
247
+ ] : [
245
248
  'node'
246
249
  ],
247
250
  stage: 'additional'
@@ -271,7 +274,9 @@ const rsbuildPluginLlms = ({ pageDataList, routes, titleRef, descriptionRef, lan
271
274
  mdContents[outFilePath] = mdContent.toString();
272
275
  }) ?? []);
273
276
  if (mdFiles) api.processAssets({
274
- targets: [
277
+ targets: disableSSG ? [
278
+ 'web'
279
+ ] : [
275
280
  'node'
276
281
  ],
277
282
  stage: 'additional'
@@ -284,7 +289,9 @@ const rsbuildPluginLlms = ({ pageDataList, routes, titleRef, descriptionRef, lan
284
289
  if (llmsFullTxt) {
285
290
  const llmsFullTxtContent = generateLlmsFullTxt(pageArray, navList, others);
286
291
  api.processAssets({
287
- targets: [
292
+ targets: disableSSG ? [
293
+ 'web'
294
+ ] : [
288
295
  'node'
289
296
  ],
290
297
  stage: 'additional'
@@ -361,6 +368,9 @@ function pluginLlms(options = {}) {
361
368
  const pageDataList = [];
362
369
  const routes = [];
363
370
  const sidebar = {};
371
+ const disableSSGRef = {
372
+ current: false
373
+ };
364
374
  const nav = [];
365
375
  const routeServiceRef = {
366
376
  current: void 0
@@ -377,6 +387,7 @@ function pluginLlms(options = {}) {
377
387
  if (isProd) routes.push(..._routes);
378
388
  },
379
389
  beforeBuild (config) {
390
+ disableSSGRef.current = false === config.ssg;
380
391
  const locales = config.themeConfig?.locales;
381
392
  const isMultiLang = locales && locales.length > 0;
382
393
  const sidebars = isMultiLang ? locales.map((i)=>i.sidebar) : [
@@ -417,6 +428,7 @@ function pluginLlms(options = {}) {
417
428
  routeServiceRef,
418
429
  nav,
419
430
  baseRef,
431
+ disableSSGRef,
420
432
  rspressPluginOptions: options
421
433
  })
422
434
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-llms",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.7",
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.6"
27
+ "@rspress/shared": "2.0.0-beta.7"
28
28
  },
29
29
  "devDependencies": {
30
- "@microsoft/api-extractor": "^7.52.7",
31
- "@rsbuild/core": "~1.3.18",
32
- "@rslib/core": "0.6.9",
30
+ "@microsoft/api-extractor": "^7.52.8",
31
+ "@rsbuild/core": "~1.3.21",
32
+ "@rslib/core": "0.8.0",
33
33
  "@types/hast": "^3.0.4",
34
- "@types/node": "^18.11.17",
34
+ "@types/node": "^22.8.1",
35
35
  "typescript": "^5.8.2",
36
36
  "vfile": "^6.0.3",
37
37
  "@rspress/config": "1.0.0",
38
- "@rspress/runtime": "2.0.0-beta.6"
38
+ "@rspress/runtime": "2.0.0-beta.7"
39
39
  },
40
40
  "peerDependencies": {
41
- "@rspress/core": "^2.0.0-beta.6"
41
+ "@rspress/core": "^2.0.0-beta.7"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=18.0.0"