@rspress/shared 2.0.17 → 2.0.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.d.ts +100 -17
- package/dist/node-utils.d.ts +100 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { ComponentType } from 'react';
|
|
|
2
2
|
import type { loadConfig } from '@rsbuild/core';
|
|
3
3
|
import type { PluggableList } from 'unified';
|
|
4
4
|
import type { ReactElement } from 'react';
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
6
5
|
import type { RehypeShikiOptions } from '@shikijs/rehype';
|
|
7
6
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
8
7
|
|
|
@@ -208,18 +207,100 @@ export declare type LastUpdatedAuthor = boolean | ((info: {
|
|
|
208
207
|
filePath: string;
|
|
209
208
|
}) => string);
|
|
210
209
|
|
|
210
|
+
export declare interface LlmsTxtContext {
|
|
211
|
+
/**
|
|
212
|
+
* The site title.
|
|
213
|
+
*/
|
|
214
|
+
title: string | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* The site description.
|
|
217
|
+
*/
|
|
218
|
+
description: string | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* The language of the generated llms.txt.
|
|
221
|
+
*/
|
|
222
|
+
lang: string;
|
|
223
|
+
/**
|
|
224
|
+
* The version of the generated llms.txt.
|
|
225
|
+
*/
|
|
226
|
+
version: string;
|
|
227
|
+
/**
|
|
228
|
+
* The configured base path.
|
|
229
|
+
*/
|
|
230
|
+
base: string;
|
|
231
|
+
/**
|
|
232
|
+
* The configured site origin.
|
|
233
|
+
*/
|
|
234
|
+
siteOrigin: string | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Page sections in navigation order.
|
|
237
|
+
*/
|
|
238
|
+
sections: LlmsTxtSection[];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export declare interface LlmsTxtPage {
|
|
242
|
+
/**
|
|
243
|
+
* The route path of the page.
|
|
244
|
+
*/
|
|
245
|
+
routePath: string;
|
|
246
|
+
/**
|
|
247
|
+
* The URL of the generated Markdown file.
|
|
248
|
+
*/
|
|
249
|
+
link: string;
|
|
250
|
+
/**
|
|
251
|
+
* The title of the page.
|
|
252
|
+
*/
|
|
253
|
+
title: string;
|
|
254
|
+
/**
|
|
255
|
+
* The description of the page.
|
|
256
|
+
*/
|
|
257
|
+
description?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The frontmatter of the page.
|
|
260
|
+
*/
|
|
261
|
+
frontmatter: FrontMatterMeta;
|
|
262
|
+
/**
|
|
263
|
+
* The language of the page.
|
|
264
|
+
*/
|
|
265
|
+
lang: string;
|
|
266
|
+
/**
|
|
267
|
+
* The version of the page.
|
|
268
|
+
*/
|
|
269
|
+
version: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export declare type LlmsTxtRenderer = (context: LlmsTxtContext) => string | Promise<string>;
|
|
273
|
+
|
|
274
|
+
export declare interface LlmsTxtSection {
|
|
275
|
+
/**
|
|
276
|
+
* The title of the section, derived from navigation.
|
|
277
|
+
*/
|
|
278
|
+
title: string;
|
|
279
|
+
/**
|
|
280
|
+
* Pages in navigation and sidebar order.
|
|
281
|
+
*/
|
|
282
|
+
pages: LlmsTxtPage[];
|
|
283
|
+
}
|
|
284
|
+
|
|
211
285
|
/**
|
|
212
|
-
* Configuration for LLMS UI components displayed
|
|
213
|
-
* When enabled,
|
|
214
|
-
*
|
|
286
|
+
* Configuration for LLMS UI components displayed below H1 headers or in the
|
|
287
|
+
* outline sidebar. When enabled, the copy and view options UI will be added
|
|
288
|
+
* automatically without requiring custom getCustomMDXComponent.
|
|
215
289
|
* @default false
|
|
216
290
|
*/
|
|
217
291
|
export declare type LlmsUI = {
|
|
292
|
+
/**
|
|
293
|
+
* Whether to inject a hidden hint into SSG HTML pages that points LLMs
|
|
294
|
+
* to llms.txt and llms-full.txt.
|
|
295
|
+
* @default true
|
|
296
|
+
*/
|
|
297
|
+
injectLlmsHint?: boolean;
|
|
218
298
|
/**
|
|
219
299
|
* Options for LlmsViewOptions component dropdown menu.
|
|
300
|
+
* Set to `false` or an empty array to hide the view options UI.
|
|
220
301
|
* @default ['markdownLink', 'chatgpt', 'claude']
|
|
221
302
|
*/
|
|
222
|
-
viewOptions?: LlmsViewOption[];
|
|
303
|
+
viewOptions?: false | LlmsViewOption[];
|
|
223
304
|
/**
|
|
224
305
|
* Where to display the LLM UI components.
|
|
225
306
|
* - 'title': Show as buttons below the H1 title (default)
|
|
@@ -230,17 +311,10 @@ export declare type LlmsUI = {
|
|
|
230
311
|
} | boolean;
|
|
231
312
|
|
|
232
313
|
/**
|
|
233
|
-
*
|
|
314
|
+
* Built-in option item for LlmsViewOptions configured through
|
|
315
|
+
* `rspress.config.ts`.
|
|
234
316
|
*/
|
|
235
|
-
export declare type LlmsViewOption = 'markdownLink' | 'chatgpt' | 'claude'
|
|
236
|
-
title: string;
|
|
237
|
-
icon?: ReactNode;
|
|
238
|
-
onClick?: () => void;
|
|
239
|
-
} | {
|
|
240
|
-
title: string;
|
|
241
|
-
href: string;
|
|
242
|
-
icon?: ReactNode;
|
|
243
|
-
};
|
|
317
|
+
export declare type LlmsViewOption = 'markdownLink' | 'chatgpt' | 'claude';
|
|
244
318
|
|
|
245
319
|
export declare interface Locale {
|
|
246
320
|
lang: string;
|
|
@@ -596,6 +670,10 @@ export declare interface Route {
|
|
|
596
670
|
|
|
597
671
|
export declare interface RouteMeta {
|
|
598
672
|
routePath: string;
|
|
673
|
+
/**
|
|
674
|
+
* Route path without language and version prefixes.
|
|
675
|
+
*/
|
|
676
|
+
pureRoutePath: string;
|
|
599
677
|
absolutePath: string;
|
|
600
678
|
relativePath: string;
|
|
601
679
|
pageName: string;
|
|
@@ -904,8 +982,8 @@ declare type ThemeConfig = {
|
|
|
904
982
|
fallbackHeadingTitle?: boolean;
|
|
905
983
|
/**
|
|
906
984
|
* LLMS UI components configuration.
|
|
907
|
-
* When
|
|
908
|
-
*
|
|
985
|
+
* When enabled, LlmsCopyButton and LlmsViewOptions will be automatically
|
|
986
|
+
* added below H1 headers or to the outline sidebar.
|
|
909
987
|
*/
|
|
910
988
|
llmsUI?: LlmsUI;
|
|
911
989
|
};
|
|
@@ -1055,6 +1133,11 @@ export declare interface UserConfig {
|
|
|
1055
1133
|
* @experimental
|
|
1056
1134
|
*/
|
|
1057
1135
|
llms?: boolean | {
|
|
1136
|
+
/**
|
|
1137
|
+
* Customize the content of generated llms.txt files.
|
|
1138
|
+
* @experimental
|
|
1139
|
+
*/
|
|
1140
|
+
llmsTxt?: LlmsTxtRenderer;
|
|
1058
1141
|
/**
|
|
1059
1142
|
* @experimental
|
|
1060
1143
|
*/
|
package/dist/node-utils.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
|
|
|
4
4
|
import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
5
5
|
import type { MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
6
6
|
import type { PluggableList } from 'unified';
|
|
7
|
-
import type { ReactNode } from 'react';
|
|
8
7
|
import type { RehypeShikiOptions } from '@shikijs/rehype';
|
|
9
8
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
10
9
|
|
|
@@ -195,18 +194,100 @@ declare type LastUpdatedAuthor = boolean | ((info: {
|
|
|
195
194
|
filePath: string;
|
|
196
195
|
}) => string);
|
|
197
196
|
|
|
197
|
+
declare interface LlmsTxtContext {
|
|
198
|
+
/**
|
|
199
|
+
* The site title.
|
|
200
|
+
*/
|
|
201
|
+
title: string | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* The site description.
|
|
204
|
+
*/
|
|
205
|
+
description: string | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* The language of the generated llms.txt.
|
|
208
|
+
*/
|
|
209
|
+
lang: string;
|
|
210
|
+
/**
|
|
211
|
+
* The version of the generated llms.txt.
|
|
212
|
+
*/
|
|
213
|
+
version: string;
|
|
214
|
+
/**
|
|
215
|
+
* The configured base path.
|
|
216
|
+
*/
|
|
217
|
+
base: string;
|
|
218
|
+
/**
|
|
219
|
+
* The configured site origin.
|
|
220
|
+
*/
|
|
221
|
+
siteOrigin: string | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Page sections in navigation order.
|
|
224
|
+
*/
|
|
225
|
+
sections: LlmsTxtSection[];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare interface LlmsTxtPage {
|
|
229
|
+
/**
|
|
230
|
+
* The route path of the page.
|
|
231
|
+
*/
|
|
232
|
+
routePath: string;
|
|
233
|
+
/**
|
|
234
|
+
* The URL of the generated Markdown file.
|
|
235
|
+
*/
|
|
236
|
+
link: string;
|
|
237
|
+
/**
|
|
238
|
+
* The title of the page.
|
|
239
|
+
*/
|
|
240
|
+
title: string;
|
|
241
|
+
/**
|
|
242
|
+
* The description of the page.
|
|
243
|
+
*/
|
|
244
|
+
description?: string;
|
|
245
|
+
/**
|
|
246
|
+
* The frontmatter of the page.
|
|
247
|
+
*/
|
|
248
|
+
frontmatter: FrontMatterMeta;
|
|
249
|
+
/**
|
|
250
|
+
* The language of the page.
|
|
251
|
+
*/
|
|
252
|
+
lang: string;
|
|
253
|
+
/**
|
|
254
|
+
* The version of the page.
|
|
255
|
+
*/
|
|
256
|
+
version: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
declare type LlmsTxtRenderer = (context: LlmsTxtContext) => string | Promise<string>;
|
|
260
|
+
|
|
261
|
+
declare interface LlmsTxtSection {
|
|
262
|
+
/**
|
|
263
|
+
* The title of the section, derived from navigation.
|
|
264
|
+
*/
|
|
265
|
+
title: string;
|
|
266
|
+
/**
|
|
267
|
+
* Pages in navigation and sidebar order.
|
|
268
|
+
*/
|
|
269
|
+
pages: LlmsTxtPage[];
|
|
270
|
+
}
|
|
271
|
+
|
|
198
272
|
/**
|
|
199
|
-
* Configuration for LLMS UI components displayed
|
|
200
|
-
* When enabled,
|
|
201
|
-
*
|
|
273
|
+
* Configuration for LLMS UI components displayed below H1 headers or in the
|
|
274
|
+
* outline sidebar. When enabled, the copy and view options UI will be added
|
|
275
|
+
* automatically without requiring custom getCustomMDXComponent.
|
|
202
276
|
* @default false
|
|
203
277
|
*/
|
|
204
278
|
declare type LlmsUI = {
|
|
279
|
+
/**
|
|
280
|
+
* Whether to inject a hidden hint into SSG HTML pages that points LLMs
|
|
281
|
+
* to llms.txt and llms-full.txt.
|
|
282
|
+
* @default true
|
|
283
|
+
*/
|
|
284
|
+
injectLlmsHint?: boolean;
|
|
205
285
|
/**
|
|
206
286
|
* Options for LlmsViewOptions component dropdown menu.
|
|
287
|
+
* Set to `false` or an empty array to hide the view options UI.
|
|
207
288
|
* @default ['markdownLink', 'chatgpt', 'claude']
|
|
208
289
|
*/
|
|
209
|
-
viewOptions?: LlmsViewOption[];
|
|
290
|
+
viewOptions?: false | LlmsViewOption[];
|
|
210
291
|
/**
|
|
211
292
|
* Where to display the LLM UI components.
|
|
212
293
|
* - 'title': Show as buttons below the H1 title (default)
|
|
@@ -217,17 +298,10 @@ declare type LlmsUI = {
|
|
|
217
298
|
} | boolean;
|
|
218
299
|
|
|
219
300
|
/**
|
|
220
|
-
*
|
|
301
|
+
* Built-in option item for LlmsViewOptions configured through
|
|
302
|
+
* `rspress.config.ts`.
|
|
221
303
|
*/
|
|
222
|
-
declare type LlmsViewOption = 'markdownLink' | 'chatgpt' | 'claude'
|
|
223
|
-
title: string;
|
|
224
|
-
icon?: ReactNode;
|
|
225
|
-
onClick?: () => void;
|
|
226
|
-
} | {
|
|
227
|
-
title: string;
|
|
228
|
-
href: string;
|
|
229
|
-
icon?: ReactNode;
|
|
230
|
-
};
|
|
304
|
+
declare type LlmsViewOption = 'markdownLink' | 'chatgpt' | 'claude';
|
|
231
305
|
|
|
232
306
|
export declare function loadFrontMatter<TFrontmatter extends Record<string, unknown> = FrontMatterMeta>(source: string, filepath: string, root: string, outputWarning?: boolean): {
|
|
233
307
|
frontmatter: TFrontmatter;
|
|
@@ -470,6 +544,10 @@ declare interface ReplaceRule {
|
|
|
470
544
|
|
|
471
545
|
declare interface RouteMeta {
|
|
472
546
|
routePath: string;
|
|
547
|
+
/**
|
|
548
|
+
* Route path without language and version prefixes.
|
|
549
|
+
*/
|
|
550
|
+
pureRoutePath: string;
|
|
473
551
|
absolutePath: string;
|
|
474
552
|
relativePath: string;
|
|
475
553
|
pageName: string;
|
|
@@ -737,8 +815,8 @@ declare type ThemeConfig = {
|
|
|
737
815
|
fallbackHeadingTitle?: boolean;
|
|
738
816
|
/**
|
|
739
817
|
* LLMS UI components configuration.
|
|
740
|
-
* When
|
|
741
|
-
*
|
|
818
|
+
* When enabled, LlmsCopyButton and LlmsViewOptions will be automatically
|
|
819
|
+
* added below H1 headers or to the outline sidebar.
|
|
742
820
|
*/
|
|
743
821
|
llmsUI?: LlmsUI;
|
|
744
822
|
};
|
|
@@ -884,6 +962,11 @@ declare interface UserConfig {
|
|
|
884
962
|
* @experimental
|
|
885
963
|
*/
|
|
886
964
|
llms?: boolean | {
|
|
965
|
+
/**
|
|
966
|
+
* Customize the content of generated llms.txt files.
|
|
967
|
+
* @experimental
|
|
968
|
+
*/
|
|
969
|
+
llmsTxt?: LlmsTxtRenderer;
|
|
887
970
|
/**
|
|
888
971
|
* @experimental
|
|
889
972
|
*/
|