@rspress/shared 1.17.0 → 1.18.0
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 +92 -83
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
@@ -47,6 +47,89 @@ interface ZoomContainer {
|
|
47
47
|
left?: number
|
48
48
|
}
|
49
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
|
+
|
50
133
|
interface Config$1 {
|
51
134
|
/**
|
52
135
|
* Whether to enable dark mode.
|
@@ -215,6 +298,7 @@ interface SidebarGroup {
|
|
215
298
|
* For hmr usage in development
|
216
299
|
*/
|
217
300
|
_fileKey?: string;
|
301
|
+
overviewHeaders?: number[];
|
218
302
|
}
|
219
303
|
type SidebarItem = {
|
220
304
|
text: string;
|
@@ -224,6 +308,7 @@ type SidebarItem = {
|
|
224
308
|
* For hmr usage in development
|
225
309
|
*/
|
226
310
|
_fileKey?: string;
|
311
|
+
overviewHeaders?: number[];
|
227
312
|
};
|
228
313
|
type SidebarDivider = {
|
229
314
|
dividerType: 'dashed' | 'solid';
|
@@ -289,89 +374,6 @@ interface NormalizedConfig extends Omit<Config$1, 'locales' | 'sidebar'> {
|
|
289
374
|
sidebar: NormalizedSidebar;
|
290
375
|
}
|
291
376
|
|
292
|
-
/**
|
293
|
-
* There are two ways to define what addtion routes represent.
|
294
|
-
* 1. Define filepath, then the content will be read from the file.
|
295
|
-
* 2. Define content, then then content will be written to temp file and read from it.
|
296
|
-
*/
|
297
|
-
interface AdditionalPage {
|
298
|
-
routePath: string;
|
299
|
-
content?: string;
|
300
|
-
filepath?: string;
|
301
|
-
}
|
302
|
-
interface RspressPlugin {
|
303
|
-
/**
|
304
|
-
* Name of the plugin.
|
305
|
-
*/
|
306
|
-
name: string;
|
307
|
-
/**
|
308
|
-
* Global style
|
309
|
-
*/
|
310
|
-
globalStyles?: string;
|
311
|
-
/**
|
312
|
-
* Markdown options.
|
313
|
-
*/
|
314
|
-
markdown?: {
|
315
|
-
remarkPlugins?: PluggableList;
|
316
|
-
rehypePlugins?: PluggableList;
|
317
|
-
globalComponents?: string[];
|
318
|
-
};
|
319
|
-
/**
|
320
|
-
* Rsbuild config.
|
321
|
-
*/
|
322
|
-
builderConfig?: RsbuildConfig;
|
323
|
-
/**
|
324
|
-
* Inject global components.
|
325
|
-
*/
|
326
|
-
globalUIComponents?: (string | [string, object])[];
|
327
|
-
/**
|
328
|
-
* Modify doc config.
|
329
|
-
*/
|
330
|
-
config?: (config: UserConfig, utils: {
|
331
|
-
addPlugin: (plugin: RspressPlugin) => void;
|
332
|
-
removePlugin: (pluginName: string) => void;
|
333
|
-
}, isProd: boolean) => UserConfig | Promise<UserConfig>;
|
334
|
-
/**
|
335
|
-
* Callback before build
|
336
|
-
*/
|
337
|
-
beforeBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
|
338
|
-
/**
|
339
|
-
* Callback after build
|
340
|
-
*/
|
341
|
-
afterBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
|
342
|
-
/**
|
343
|
-
* Extend every page's data
|
344
|
-
*/
|
345
|
-
extendPageData?: (pageData: PageIndexInfo & {
|
346
|
-
[key: string]: unknown;
|
347
|
-
}, isProd: boolean) => void | Promise<void>;
|
348
|
-
/**
|
349
|
-
* Add custom route
|
350
|
-
*/
|
351
|
-
addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
|
352
|
-
/**
|
353
|
-
* Add runtime modules
|
354
|
-
*/
|
355
|
-
addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
|
356
|
-
/**
|
357
|
-
* Callback after route generated
|
358
|
-
*/
|
359
|
-
routeGenerated?: (routes: RouteMeta[], isProd: boolean) => Promise<void> | void;
|
360
|
-
/**
|
361
|
-
* Add addition ssg routes, for dynamic routes.
|
362
|
-
*/
|
363
|
-
addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
|
364
|
-
path: string;
|
365
|
-
}[] | Promise<{
|
366
|
-
path: string;
|
367
|
-
}[]>;
|
368
|
-
/**
|
369
|
-
* @private
|
370
|
-
* Modify search index data.
|
371
|
-
*/
|
372
|
-
modifySearchIndexData?: (data: PageIndexInfo[], isProd: boolean) => void | Promise<void>;
|
373
|
-
}
|
374
|
-
|
375
377
|
interface Route {
|
376
378
|
path: string;
|
377
379
|
element: React.ReactElement;
|
@@ -584,6 +586,12 @@ interface Hero {
|
|
584
586
|
image?: {
|
585
587
|
src: string;
|
586
588
|
alt: string;
|
589
|
+
/**
|
590
|
+
* `srcset` and `sizes` are attributes of `<img>` tag. Please refer to https://mdn.io/srcset for the usage.
|
591
|
+
* When the value is an array, rspress will join array members with commas.
|
592
|
+
**/
|
593
|
+
sizes?: string | string[];
|
594
|
+
srcset?: string | string[];
|
587
595
|
};
|
588
596
|
actions: {
|
589
597
|
text: string;
|
@@ -615,6 +623,7 @@ interface FrontMatterMeta {
|
|
615
623
|
sidebar?: boolean;
|
616
624
|
outline?: boolean;
|
617
625
|
lineNumbers?: boolean;
|
626
|
+
overviewHeaders?: number;
|
618
627
|
}
|
619
628
|
interface PageData {
|
620
629
|
siteData: SiteData<Config$1>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/shared",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.18.0",
|
4
4
|
"types": "./dist/index.d.ts",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.mjs",
|
@@ -11,34 +11,34 @@
|
|
11
11
|
},
|
12
12
|
"exports": {
|
13
13
|
".": {
|
14
|
+
"types": "./dist/index.d.ts",
|
14
15
|
"import": "./dist/index.mjs",
|
15
|
-
"require": "./dist/index.js"
|
16
|
-
"types": "./dist/index.d.ts"
|
16
|
+
"require": "./dist/index.js"
|
17
17
|
},
|
18
18
|
"./execa": {
|
19
|
+
"types": "./dist/execa.d.ts",
|
19
20
|
"import": "./dist/execa.mjs",
|
20
|
-
"require": "./dist/execa.js"
|
21
|
-
"types": "./dist/execa.d.ts"
|
21
|
+
"require": "./dist/execa.js"
|
22
22
|
},
|
23
23
|
"./chalk": {
|
24
|
+
"types": "./dist/chalk.d.ts",
|
24
25
|
"import": "./dist/chalk.mjs",
|
25
|
-
"require": "./dist/chalk.js"
|
26
|
-
"types": "./dist/chalk.d.ts"
|
26
|
+
"require": "./dist/chalk.js"
|
27
27
|
},
|
28
28
|
"./fs-extra": {
|
29
|
+
"types": "./dist/fs-extra.d.ts",
|
29
30
|
"import": "./dist/fs-extra.mjs",
|
30
|
-
"require": "./dist/fs-extra.js"
|
31
|
-
"types": "./dist/fs-extra.d.ts"
|
31
|
+
"require": "./dist/fs-extra.js"
|
32
32
|
},
|
33
33
|
"./logger": {
|
34
|
+
"types": "./dist/logger.d.ts",
|
34
35
|
"import": "./dist/logger.mjs",
|
35
|
-
"require": "./dist/logger.js"
|
36
|
-
"types": "./dist/logger.d.ts"
|
36
|
+
"require": "./dist/logger.js"
|
37
37
|
},
|
38
38
|
"./node-utils": {
|
39
|
+
"types": "./dist/node-utils.d.ts",
|
39
40
|
"import": "./dist/node-utils.mjs",
|
40
|
-
"require": "./dist/node-utils.js"
|
41
|
-
"types": "./dist/node-utils.d.ts"
|
41
|
+
"require": "./dist/node-utils.js"
|
42
42
|
}
|
43
43
|
},
|
44
44
|
"dependencies": {
|