@rspress/shared 1.37.2 → 1.37.3
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-37dfa72c.d.ts +772 -0
- package/dist/index.d.ts +4 -776
- package/dist/index.js +2 -1096
- package/dist/index.mjs +2 -1093
- package/dist/node-utils.d.ts +7 -1
- package/dist/node-utils.js +18 -2
- package/dist/node-utils.mjs +16 -1
- package/package.json +2 -6
@@ -0,0 +1,772 @@
|
|
1
|
+
import { RsbuildConfig, RsbuildPlugin } from '@rsbuild/core';
|
2
|
+
import { PluggableList } from 'unified';
|
3
|
+
|
4
|
+
interface ZoomOptions {
|
5
|
+
/**
|
6
|
+
* The space outside the zoomed image.
|
7
|
+
*
|
8
|
+
* @default 0
|
9
|
+
*/
|
10
|
+
margin?: number
|
11
|
+
|
12
|
+
/**
|
13
|
+
* The background of the overlay.
|
14
|
+
*
|
15
|
+
* @default '#fff'
|
16
|
+
*/
|
17
|
+
background?: string
|
18
|
+
|
19
|
+
/**
|
20
|
+
* The number of pixels to scroll to close the zoom.
|
21
|
+
*
|
22
|
+
* @default 40
|
23
|
+
*/
|
24
|
+
scrollOffset?: number
|
25
|
+
|
26
|
+
/**
|
27
|
+
* The viewport to render the zoom in.
|
28
|
+
*
|
29
|
+
* @default null
|
30
|
+
*/
|
31
|
+
container?: string | HTMLElement | ZoomContainer
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The template element to display on zoom.
|
35
|
+
*
|
36
|
+
* @default null
|
37
|
+
*/
|
38
|
+
template?: string | HTMLTemplateElement
|
39
|
+
}
|
40
|
+
|
41
|
+
interface ZoomContainer {
|
42
|
+
width?: number
|
43
|
+
height?: number
|
44
|
+
top?: number
|
45
|
+
bottom?: number
|
46
|
+
right?: number
|
47
|
+
left?: number
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* There are two ways to define what addtion routes represent.
|
52
|
+
* 1. Define filepath, then the content will be read from the file.
|
53
|
+
* 2. Define content, then then content will be written to temp file and read from it.
|
54
|
+
*/
|
55
|
+
interface AdditionalPage {
|
56
|
+
routePath: string;
|
57
|
+
content?: string;
|
58
|
+
filepath?: string;
|
59
|
+
}
|
60
|
+
interface RspressPlugin {
|
61
|
+
/**
|
62
|
+
* Name of the plugin.
|
63
|
+
*/
|
64
|
+
name: string;
|
65
|
+
/**
|
66
|
+
* Global style
|
67
|
+
*/
|
68
|
+
globalStyles?: string;
|
69
|
+
/**
|
70
|
+
* Markdown options.
|
71
|
+
*/
|
72
|
+
markdown?: {
|
73
|
+
remarkPlugins?: PluggableList;
|
74
|
+
rehypePlugins?: PluggableList;
|
75
|
+
globalComponents?: string[];
|
76
|
+
};
|
77
|
+
/**
|
78
|
+
* Rsbuild config.
|
79
|
+
*/
|
80
|
+
builderConfig?: RsbuildConfig;
|
81
|
+
/**
|
82
|
+
* Inject global components.
|
83
|
+
*/
|
84
|
+
globalUIComponents?: (string | [string, object])[];
|
85
|
+
/**
|
86
|
+
* Modify doc config.
|
87
|
+
*/
|
88
|
+
config?: (config: UserConfig, utils: {
|
89
|
+
addPlugin: (plugin: RspressPlugin) => void;
|
90
|
+
removePlugin: (pluginName: string) => void;
|
91
|
+
}, isProd: boolean) => UserConfig | Promise<UserConfig>;
|
92
|
+
/**
|
93
|
+
* Callback before build
|
94
|
+
*/
|
95
|
+
beforeBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
|
96
|
+
/**
|
97
|
+
* Callback after build
|
98
|
+
*/
|
99
|
+
afterBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
|
100
|
+
/**
|
101
|
+
* Extend every page's data
|
102
|
+
*/
|
103
|
+
extendPageData?: (pageData: PageIndexInfo & {
|
104
|
+
[key: string]: unknown;
|
105
|
+
}, isProd: boolean) => void | Promise<void>;
|
106
|
+
/**
|
107
|
+
* Add custom route
|
108
|
+
*/
|
109
|
+
addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
|
110
|
+
/**
|
111
|
+
* Add runtime modules
|
112
|
+
*/
|
113
|
+
addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
|
114
|
+
/**
|
115
|
+
* Callback after route generated
|
116
|
+
*/
|
117
|
+
routeGenerated?: (routes: RouteMeta[], isProd: boolean) => Promise<void> | void;
|
118
|
+
/**
|
119
|
+
* Add addition ssg routes, for dynamic routes.
|
120
|
+
*/
|
121
|
+
addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
|
122
|
+
path: string;
|
123
|
+
}[] | Promise<{
|
124
|
+
path: string;
|
125
|
+
}[]>;
|
126
|
+
/**
|
127
|
+
* @private
|
128
|
+
* Modify search index data.
|
129
|
+
*/
|
130
|
+
modifySearchIndexData?: (data: PageIndexInfo[], isProd: boolean) => void | Promise<void>;
|
131
|
+
}
|
132
|
+
|
133
|
+
interface Config$1 {
|
134
|
+
/**
|
135
|
+
* Whether to enable dark mode.
|
136
|
+
* @default true
|
137
|
+
*/
|
138
|
+
darkMode?: boolean;
|
139
|
+
/**
|
140
|
+
* Custom outline title in the aside component.
|
141
|
+
*
|
142
|
+
* @default 'ON THIS PAGE'
|
143
|
+
*/
|
144
|
+
outlineTitle?: string;
|
145
|
+
/**
|
146
|
+
* Whether to show the sidebar in right position.
|
147
|
+
*/
|
148
|
+
outline?: boolean;
|
149
|
+
/**
|
150
|
+
* The nav items. When it's an object, the key is the version of current doc.
|
151
|
+
*/
|
152
|
+
nav?: NavItem[] | {
|
153
|
+
[key: string]: NavItem[];
|
154
|
+
};
|
155
|
+
/**
|
156
|
+
* The sidebar items.
|
157
|
+
*/
|
158
|
+
sidebar?: Sidebar;
|
159
|
+
/**
|
160
|
+
* Info for the edit link. If it's undefined, the edit link feature will
|
161
|
+
* be disabled.
|
162
|
+
*/
|
163
|
+
editLink?: EditLink;
|
164
|
+
/**
|
165
|
+
* Set custom last updated text.
|
166
|
+
*
|
167
|
+
* @default 'Last updated'
|
168
|
+
*/
|
169
|
+
lastUpdatedText?: string;
|
170
|
+
/**
|
171
|
+
* Set custom last updated text.
|
172
|
+
*
|
173
|
+
* @default false
|
174
|
+
*/
|
175
|
+
lastUpdated?: boolean;
|
176
|
+
/**
|
177
|
+
* Set custom prev/next labels.
|
178
|
+
*/
|
179
|
+
docFooter?: DocFooter;
|
180
|
+
/**
|
181
|
+
* The social links to be displayed at the end of the nav bar. Perfect for
|
182
|
+
* placing links to social services such as GitHub, X, Facebook, etc.
|
183
|
+
*/
|
184
|
+
socialLinks?: SocialLink[];
|
185
|
+
/**
|
186
|
+
* The footer configuration.
|
187
|
+
*/
|
188
|
+
footer?: Footer;
|
189
|
+
/**
|
190
|
+
* The prev page text.
|
191
|
+
*/
|
192
|
+
prevPageText?: string;
|
193
|
+
/**
|
194
|
+
* The next page text.
|
195
|
+
*/
|
196
|
+
nextPageText?: string;
|
197
|
+
/**
|
198
|
+
* The source code text.
|
199
|
+
*/
|
200
|
+
sourceCodeText?: string;
|
201
|
+
/**
|
202
|
+
* Locale config
|
203
|
+
*/
|
204
|
+
locales?: LocaleConfig[];
|
205
|
+
/**
|
206
|
+
* Whether to open the full text search
|
207
|
+
*/
|
208
|
+
search?: boolean;
|
209
|
+
/**
|
210
|
+
* The placeholder of search input
|
211
|
+
*/
|
212
|
+
searchPlaceholderText?: string;
|
213
|
+
/**
|
214
|
+
* The text of no search result
|
215
|
+
*/
|
216
|
+
searchNoResultsText?: string;
|
217
|
+
/**
|
218
|
+
* The text of suggested query text when no search result
|
219
|
+
*/
|
220
|
+
searchSuggestedQueryText?: string;
|
221
|
+
/**
|
222
|
+
* The text of overview filter
|
223
|
+
*/
|
224
|
+
overview?: FilterConfig;
|
225
|
+
/**
|
226
|
+
* The behavior of hiding navbar
|
227
|
+
*/
|
228
|
+
hideNavbar?: 'always' | 'auto' | 'never';
|
229
|
+
/**
|
230
|
+
* Whether to enable view transition animation for pages switching
|
231
|
+
*/
|
232
|
+
enableContentAnimation?: boolean;
|
233
|
+
/**
|
234
|
+
* Whether to enable view transition animation for the theme
|
235
|
+
*/
|
236
|
+
enableAppearanceAnimation?: boolean;
|
237
|
+
/**
|
238
|
+
* Enable scroll to top button on documentation
|
239
|
+
* @default false
|
240
|
+
*/
|
241
|
+
enableScrollToTop?: boolean;
|
242
|
+
/**
|
243
|
+
* Whether to redirect to the closest locale when the user visits the site
|
244
|
+
* @default 'auto'
|
245
|
+
*/
|
246
|
+
localeRedirect?: 'auto' | 'never';
|
247
|
+
}
|
248
|
+
/**
|
249
|
+
* locale config
|
250
|
+
*/
|
251
|
+
interface LocaleConfig {
|
252
|
+
/**
|
253
|
+
* Site i18n config, which will recover the locales config in the site level.
|
254
|
+
*/
|
255
|
+
lang: string;
|
256
|
+
title?: string;
|
257
|
+
description?: string;
|
258
|
+
label: string;
|
259
|
+
/**
|
260
|
+
* Theme i18n config
|
261
|
+
*/
|
262
|
+
nav?: Nav;
|
263
|
+
sidebar?: Sidebar;
|
264
|
+
outlineTitle?: string;
|
265
|
+
lastUpdatedText?: string;
|
266
|
+
lastUpdated?: boolean;
|
267
|
+
editLink?: EditLink;
|
268
|
+
prevPageText?: string;
|
269
|
+
nextPageText?: string;
|
270
|
+
sourceCodeText?: string;
|
271
|
+
langRoutePrefix?: string;
|
272
|
+
searchPlaceholderText?: string;
|
273
|
+
searchNoResultsText?: string;
|
274
|
+
searchSuggestedQueryText?: string;
|
275
|
+
overview?: FilterConfig;
|
276
|
+
}
|
277
|
+
/**
|
278
|
+
* The config of filter component
|
279
|
+
*/
|
280
|
+
interface FilterConfig {
|
281
|
+
filterNameText?: string;
|
282
|
+
filterPlaceholderText?: string;
|
283
|
+
filterNoResultText?: string;
|
284
|
+
}
|
285
|
+
type Nav = NavItem[] | {
|
286
|
+
[key: string]: NavItem[];
|
287
|
+
};
|
288
|
+
type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAndChildren;
|
289
|
+
type NavItemWithLink = {
|
290
|
+
text: string;
|
291
|
+
link: string;
|
292
|
+
tag?: string;
|
293
|
+
activeMatch?: string;
|
294
|
+
position?: 'left' | 'right';
|
295
|
+
};
|
296
|
+
interface NavItemWithChildren {
|
297
|
+
text?: string;
|
298
|
+
tag?: string;
|
299
|
+
items: NavItemWithLink[];
|
300
|
+
position?: 'left' | 'right';
|
301
|
+
}
|
302
|
+
interface NavItemWithLinkAndChildren {
|
303
|
+
text: string;
|
304
|
+
link: string;
|
305
|
+
items: NavItemWithLink[];
|
306
|
+
tag?: string;
|
307
|
+
activeMatch?: string;
|
308
|
+
position?: 'left' | 'right';
|
309
|
+
}
|
310
|
+
type Image = string | {
|
311
|
+
src: string;
|
312
|
+
alt?: string;
|
313
|
+
};
|
314
|
+
interface Sidebar {
|
315
|
+
[path: string]: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
|
316
|
+
}
|
317
|
+
interface SidebarGroup {
|
318
|
+
text: string;
|
319
|
+
link?: string;
|
320
|
+
tag?: string;
|
321
|
+
items: (SidebarItem | SidebarDivider | SidebarGroup | string)[];
|
322
|
+
collapsible?: boolean;
|
323
|
+
collapsed?: boolean;
|
324
|
+
/**
|
325
|
+
* For hmr usage in development
|
326
|
+
*/
|
327
|
+
_fileKey?: string;
|
328
|
+
overviewHeaders?: number[];
|
329
|
+
context?: string;
|
330
|
+
}
|
331
|
+
type SidebarItem = {
|
332
|
+
text: string;
|
333
|
+
link: string;
|
334
|
+
tag?: string;
|
335
|
+
/**
|
336
|
+
* For hmr usage in development
|
337
|
+
*/
|
338
|
+
_fileKey?: string;
|
339
|
+
overviewHeaders?: number[];
|
340
|
+
context?: string;
|
341
|
+
};
|
342
|
+
type SidebarDivider = {
|
343
|
+
dividerType: 'dashed' | 'solid';
|
344
|
+
};
|
345
|
+
type SidebarSectionHeader = {
|
346
|
+
sectionHeaderText: string;
|
347
|
+
tag?: string;
|
348
|
+
};
|
349
|
+
interface EditLink {
|
350
|
+
/**
|
351
|
+
* Custom repository url for edit link.
|
352
|
+
*/
|
353
|
+
docRepoBaseUrl: string;
|
354
|
+
/**
|
355
|
+
* Custom text for edit link.
|
356
|
+
*
|
357
|
+
* @default 'Edit this page'
|
358
|
+
*/
|
359
|
+
text?: string;
|
360
|
+
}
|
361
|
+
interface DocFooter {
|
362
|
+
/**
|
363
|
+
* Custom label for previous page button.
|
364
|
+
*/
|
365
|
+
prev?: SidebarItem;
|
366
|
+
/**
|
367
|
+
* Custom label for next page button.
|
368
|
+
*/
|
369
|
+
next?: SidebarItem;
|
370
|
+
}
|
371
|
+
interface SocialLink {
|
372
|
+
icon: SocialLinkIcon;
|
373
|
+
mode: 'link' | 'text' | 'img' | 'dom';
|
374
|
+
content: string;
|
375
|
+
}
|
376
|
+
type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | {
|
377
|
+
svg: string;
|
378
|
+
};
|
379
|
+
interface Footer {
|
380
|
+
message?: string;
|
381
|
+
}
|
382
|
+
interface LocaleLinks {
|
383
|
+
text: string;
|
384
|
+
items: LocaleLink[];
|
385
|
+
}
|
386
|
+
interface LocaleLink {
|
387
|
+
text: string;
|
388
|
+
link: string;
|
389
|
+
}
|
390
|
+
interface NormalizedSidebarGroup extends Omit<SidebarGroup, 'items'> {
|
391
|
+
items: (SidebarDivider | SidebarItem | NormalizedSidebarGroup)[];
|
392
|
+
collapsible: boolean;
|
393
|
+
collapsed: boolean;
|
394
|
+
}
|
395
|
+
interface NormalizedSidebar {
|
396
|
+
[path: string]: (NormalizedSidebarGroup | SidebarItem | SidebarDivider)[];
|
397
|
+
}
|
398
|
+
interface NormalizedLocales extends Omit<LocaleConfig, 'sidebar'> {
|
399
|
+
sidebar: NormalizedSidebar;
|
400
|
+
}
|
401
|
+
interface NormalizedConfig extends Omit<Config$1, 'locales' | 'sidebar'> {
|
402
|
+
locales: NormalizedLocales[];
|
403
|
+
sidebar: NormalizedSidebar;
|
404
|
+
}
|
405
|
+
|
406
|
+
interface Route {
|
407
|
+
path: string;
|
408
|
+
element: React.ReactElement;
|
409
|
+
filePath: string;
|
410
|
+
preload: () => Promise<PageModule<React.ComponentType<unknown>>>;
|
411
|
+
lang: string;
|
412
|
+
}
|
413
|
+
interface RouteMeta {
|
414
|
+
routePath: string;
|
415
|
+
absolutePath: string;
|
416
|
+
relativePath: string;
|
417
|
+
pageName: string;
|
418
|
+
lang: string;
|
419
|
+
version: string;
|
420
|
+
}
|
421
|
+
interface ReplaceRule {
|
422
|
+
search: string | RegExp;
|
423
|
+
replace: string;
|
424
|
+
}
|
425
|
+
interface Header {
|
426
|
+
id: string;
|
427
|
+
text: string;
|
428
|
+
depth: number;
|
429
|
+
charIndex: number;
|
430
|
+
}
|
431
|
+
interface Locale {
|
432
|
+
lang: string;
|
433
|
+
label: string;
|
434
|
+
title?: string;
|
435
|
+
description?: string;
|
436
|
+
}
|
437
|
+
type SSGConfig = boolean | {
|
438
|
+
strict?: boolean;
|
439
|
+
};
|
440
|
+
interface UserConfig<ThemeConfig = Config$1> {
|
441
|
+
/**
|
442
|
+
* The root directory of the site.
|
443
|
+
*/
|
444
|
+
root?: string;
|
445
|
+
/**
|
446
|
+
* Path to the logo file in nav bar.
|
447
|
+
*/
|
448
|
+
logo?: string | {
|
449
|
+
dark: string;
|
450
|
+
light: string;
|
451
|
+
};
|
452
|
+
/**
|
453
|
+
* The text of the logo in nav bar.
|
454
|
+
*/
|
455
|
+
logoText?: string;
|
456
|
+
/**
|
457
|
+
* Base path of the site.
|
458
|
+
*/
|
459
|
+
base?: string;
|
460
|
+
/**
|
461
|
+
* Path to html icon file.
|
462
|
+
*/
|
463
|
+
icon?: string;
|
464
|
+
/**
|
465
|
+
* Language of the site.
|
466
|
+
*/
|
467
|
+
lang?: string;
|
468
|
+
/**
|
469
|
+
* Title of the site.
|
470
|
+
*/
|
471
|
+
title?: string;
|
472
|
+
/**
|
473
|
+
* Description of the site.
|
474
|
+
*/
|
475
|
+
description?: string;
|
476
|
+
/**
|
477
|
+
* Head tags.
|
478
|
+
*/
|
479
|
+
head?: (string | [string, Record<string, string>] | ((route: RouteMeta) => string | [string, Record<string, string>] | undefined))[];
|
480
|
+
/**
|
481
|
+
* I18n config of the site.
|
482
|
+
*/
|
483
|
+
locales?: Locale[];
|
484
|
+
/**
|
485
|
+
* The i18n text data source path. Default is `i18n.json` in cwd.
|
486
|
+
*/
|
487
|
+
i18nSourcePath?: string;
|
488
|
+
/**
|
489
|
+
* Theme config.
|
490
|
+
*/
|
491
|
+
themeConfig?: ThemeConfig;
|
492
|
+
/**
|
493
|
+
* Rsbuild Configuration
|
494
|
+
*/
|
495
|
+
builderConfig?: RsbuildConfig;
|
496
|
+
/**
|
497
|
+
* The custom config of vite-plugin-route
|
498
|
+
*/
|
499
|
+
route?: RouteOptions;
|
500
|
+
/**
|
501
|
+
* The custom config of markdown compile
|
502
|
+
*/
|
503
|
+
markdown?: MarkdownOptions;
|
504
|
+
/**
|
505
|
+
* Doc plugins
|
506
|
+
*/
|
507
|
+
plugins?: RspressPlugin[];
|
508
|
+
/**
|
509
|
+
* Replace rule, will replace the content of the page.
|
510
|
+
*/
|
511
|
+
replaceRules?: ReplaceRule[];
|
512
|
+
/**
|
513
|
+
* Output directory
|
514
|
+
*/
|
515
|
+
outDir?: string;
|
516
|
+
/**
|
517
|
+
* Custom theme directory
|
518
|
+
*/
|
519
|
+
themeDir?: string;
|
520
|
+
/**
|
521
|
+
* Global components
|
522
|
+
*/
|
523
|
+
globalUIComponents?: (string | [string, object])[];
|
524
|
+
/**
|
525
|
+
* Global styles, is a Absolute path
|
526
|
+
*/
|
527
|
+
globalStyles?: string;
|
528
|
+
/**
|
529
|
+
* Search options
|
530
|
+
*/
|
531
|
+
search?: SearchOptions;
|
532
|
+
/**
|
533
|
+
* Whether to enable ssg, default is true
|
534
|
+
*/
|
535
|
+
ssg?: SSGConfig;
|
536
|
+
/**
|
537
|
+
* Whether to enable medium-zoom, default is true
|
538
|
+
*/
|
539
|
+
mediumZoom?: boolean | {
|
540
|
+
selector?: string;
|
541
|
+
options?: ZoomOptions;
|
542
|
+
};
|
543
|
+
/**
|
544
|
+
* Add some extra builder plugins
|
545
|
+
*/
|
546
|
+
builderPlugins?: RsbuildPlugin[];
|
547
|
+
/**
|
548
|
+
* Multi version config
|
549
|
+
*/
|
550
|
+
multiVersion?: {
|
551
|
+
/**
|
552
|
+
* The default version
|
553
|
+
*/
|
554
|
+
default?: string;
|
555
|
+
/**
|
556
|
+
* The version list, such as ['v1', 'v2']
|
557
|
+
*/
|
558
|
+
versions: string[];
|
559
|
+
};
|
560
|
+
}
|
561
|
+
type RemoveUnderscoreProps<T> = {
|
562
|
+
[K in keyof T as K extends `_${string}` ? never : K]: T[K];
|
563
|
+
};
|
564
|
+
type BaseRuntimePageInfo = Omit<RemoveUnderscoreProps<PageIndexInfo>, 'id' | 'content' | 'domain'>;
|
565
|
+
interface SiteData<ThemeConfig = NormalizedConfig> {
|
566
|
+
root: string;
|
567
|
+
base: string;
|
568
|
+
lang: string;
|
569
|
+
route: RouteOptions;
|
570
|
+
locales: {
|
571
|
+
lang: string;
|
572
|
+
label: string;
|
573
|
+
}[];
|
574
|
+
title: string;
|
575
|
+
description: string;
|
576
|
+
icon: string;
|
577
|
+
themeConfig: ThemeConfig;
|
578
|
+
logo: string | {
|
579
|
+
dark: string;
|
580
|
+
light: string;
|
581
|
+
};
|
582
|
+
logoText: string;
|
583
|
+
pages: BaseRuntimePageInfo[];
|
584
|
+
search: SearchOptions;
|
585
|
+
ssg: boolean;
|
586
|
+
markdown: {
|
587
|
+
showLineNumbers: boolean;
|
588
|
+
defaultWrapCode: boolean;
|
589
|
+
codeHighlighter: 'prism' | 'shiki';
|
590
|
+
};
|
591
|
+
multiVersion: {
|
592
|
+
default: string;
|
593
|
+
versions: string[];
|
594
|
+
};
|
595
|
+
}
|
596
|
+
/**
|
597
|
+
* @description search-index.json file
|
598
|
+
* "_foo" is the private field that won't be written to search-index.json file
|
599
|
+
* and should not be used in the runtime (usePageData).
|
600
|
+
*/
|
601
|
+
type PageIndexInfo = {
|
602
|
+
id: number;
|
603
|
+
title: string;
|
604
|
+
routePath: string;
|
605
|
+
toc: Header[];
|
606
|
+
content: string;
|
607
|
+
_html: string;
|
608
|
+
frontmatter: Record<string, unknown>;
|
609
|
+
lang: string;
|
610
|
+
version: string;
|
611
|
+
domain: string;
|
612
|
+
_filepath: string;
|
613
|
+
_relativePath: string;
|
614
|
+
};
|
615
|
+
type RemotePageInfo = PageIndexInfo & {
|
616
|
+
_matchesPosition: {
|
617
|
+
content: {
|
618
|
+
start: number;
|
619
|
+
length: number;
|
620
|
+
}[];
|
621
|
+
};
|
622
|
+
};
|
623
|
+
interface Hero {
|
624
|
+
name: string;
|
625
|
+
text: string;
|
626
|
+
tagline: string;
|
627
|
+
image?: {
|
628
|
+
src: string | {
|
629
|
+
dark: string;
|
630
|
+
light: string;
|
631
|
+
};
|
632
|
+
alt: string;
|
633
|
+
/**
|
634
|
+
* `srcset` and `sizes` are attributes of `<img>` tag. Please refer to https://mdn.io/srcset for the usage.
|
635
|
+
* When the value is an array, rspress will join array members with commas.
|
636
|
+
**/
|
637
|
+
sizes?: string | string[];
|
638
|
+
srcset?: string | string[];
|
639
|
+
};
|
640
|
+
actions: {
|
641
|
+
text: string;
|
642
|
+
link: string;
|
643
|
+
theme: 'brand' | 'alt';
|
644
|
+
}[];
|
645
|
+
}
|
646
|
+
interface Feature {
|
647
|
+
icon: string;
|
648
|
+
title: string;
|
649
|
+
details: string;
|
650
|
+
span?: number;
|
651
|
+
link?: string;
|
652
|
+
}
|
653
|
+
interface PageModule<T extends React.ComponentType<unknown>> {
|
654
|
+
default: T;
|
655
|
+
frontmatter?: FrontMatterMeta;
|
656
|
+
content?: string;
|
657
|
+
[key: string]: unknown;
|
658
|
+
}
|
659
|
+
type PageType = 'home' | 'doc' | 'custom' | '404' | 'blank';
|
660
|
+
interface FrontMatterMeta {
|
661
|
+
title?: string;
|
662
|
+
description?: string;
|
663
|
+
overview?: boolean;
|
664
|
+
pageType?: PageType;
|
665
|
+
features?: Feature[];
|
666
|
+
hero?: Hero;
|
667
|
+
sidebar?: boolean;
|
668
|
+
outline?: boolean;
|
669
|
+
lineNumbers?: boolean;
|
670
|
+
overviewHeaders?: number;
|
671
|
+
titleSuffix?: string;
|
672
|
+
head?: [string, Record<string, string>][];
|
673
|
+
context?: string;
|
674
|
+
[key: string]: unknown;
|
675
|
+
}
|
676
|
+
interface PageData {
|
677
|
+
siteData: SiteData<Config$1>;
|
678
|
+
page: BaseRuntimePageInfo & {
|
679
|
+
pagePath: string;
|
680
|
+
lastUpdatedTime?: string;
|
681
|
+
description?: string;
|
682
|
+
pageType: PageType;
|
683
|
+
[key: string]: unknown;
|
684
|
+
};
|
685
|
+
}
|
686
|
+
interface RouteOptions {
|
687
|
+
/**
|
688
|
+
* The extension name of the filepath that will be converted to a route
|
689
|
+
* @default ['js','jsx','ts','tsx','md','mdx']
|
690
|
+
*/
|
691
|
+
extensions?: string[];
|
692
|
+
/**
|
693
|
+
* Include extra files from being converted to routes
|
694
|
+
*/
|
695
|
+
include?: string[];
|
696
|
+
/**
|
697
|
+
* Exclude files from being converted to routes
|
698
|
+
*/
|
699
|
+
exclude?: string[];
|
700
|
+
/**
|
701
|
+
* use links without .html files
|
702
|
+
*/
|
703
|
+
cleanUrls?: boolean;
|
704
|
+
}
|
705
|
+
interface SearchHooks {
|
706
|
+
/**
|
707
|
+
* The search hook function path. The corresponding file should export a function named `onSearch`.
|
708
|
+
*/
|
709
|
+
searchHooks?: string;
|
710
|
+
}
|
711
|
+
type LocalSearchOptions = SearchHooks & {
|
712
|
+
mode?: 'local';
|
713
|
+
/**
|
714
|
+
* Whether to generate separate search index for each version
|
715
|
+
*/
|
716
|
+
versioned?: boolean;
|
717
|
+
};
|
718
|
+
type RemoteSearchIndexInfo = string | {
|
719
|
+
value: string;
|
720
|
+
label: string;
|
721
|
+
};
|
722
|
+
type RemoteSearchOptions = SearchHooks & {
|
723
|
+
mode: 'remote';
|
724
|
+
apiUrl: string;
|
725
|
+
domain?: string;
|
726
|
+
indexName: string;
|
727
|
+
searchIndexes?: RemoteSearchIndexInfo[];
|
728
|
+
searchLoading?: boolean;
|
729
|
+
};
|
730
|
+
type SearchOptions = LocalSearchOptions | RemoteSearchOptions | false;
|
731
|
+
interface MdxRsOptions {
|
732
|
+
/**
|
733
|
+
* Determine whether the file use mdxRs compiler
|
734
|
+
*/
|
735
|
+
include?: (filepath: string) => boolean;
|
736
|
+
}
|
737
|
+
interface MarkdownOptions {
|
738
|
+
remarkPlugins?: PluggableList;
|
739
|
+
rehypePlugins?: PluggableList;
|
740
|
+
/**
|
741
|
+
* Whether to enable check dead links, default is false
|
742
|
+
*/
|
743
|
+
checkDeadLinks?: boolean;
|
744
|
+
showLineNumbers?: boolean;
|
745
|
+
/**
|
746
|
+
* Whether to wrap code by default, default is false
|
747
|
+
*/
|
748
|
+
defaultWrapCode?: boolean;
|
749
|
+
/**
|
750
|
+
* Register global components in mdx files
|
751
|
+
*/
|
752
|
+
globalComponents?: string[];
|
753
|
+
/**
|
754
|
+
* Code highlighter, default is prism for performance reason
|
755
|
+
*/
|
756
|
+
codeHighlighter?: 'prism' | 'shiki';
|
757
|
+
/**
|
758
|
+
* Register prism languages
|
759
|
+
*/
|
760
|
+
highlightLanguages?: (string | [string, string])[];
|
761
|
+
/**
|
762
|
+
* Whether to enable mdx-rs, default is true
|
763
|
+
*/
|
764
|
+
mdxRs?: boolean | MdxRsOptions;
|
765
|
+
/**
|
766
|
+
* @deprecated, use `mdxRs` instead
|
767
|
+
*/
|
768
|
+
experimentalMdxRs?: boolean;
|
769
|
+
}
|
770
|
+
type Config = UserConfig | Promise<UserConfig> | ((env: any) => UserConfig | Promise<UserConfig>);
|
771
|
+
|
772
|
+
export type { AdditionalPage as A, BaseRuntimePageInfo as B, Config$1 as C, SidebarGroup as D, SidebarItem as E, Feature as F, SidebarDivider as G, Header as H, Image as I, SidebarSectionHeader as J, EditLink as K, Locale as L, MdxRsOptions as M, NormalizedConfig as N, DocFooter as O, PageIndexInfo as P, SocialLink as Q, RspressPlugin as R, SSGConfig as S, SocialLinkIcon as T, UserConfig as U, Footer as V, LocaleLinks as W, LocaleLink as X, NormalizedSidebarGroup as Y, NormalizedSidebar as Z, NormalizedLocales as _, Route as a, RouteMeta as b, ReplaceRule as c, SiteData as d, RemotePageInfo as e, Hero as f, PageModule as g, PageType as h, FrontMatterMeta as i, PageData as j, RouteOptions as k, SearchHooks as l, LocalSearchOptions as m, RemoteSearchIndexInfo as n, RemoteSearchOptions as o, SearchOptions as p, MarkdownOptions as q, Config as r, LocaleConfig as s, FilterConfig as t, Nav as u, NavItem as v, NavItemWithLink as w, NavItemWithChildren as x, NavItemWithLinkAndChildren as y, Sidebar as z };
|