@rspress/shared 0.0.0-nightly-20240408160236 → 0.0.0-nightly-20240410160228
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 +89 -83
- package/package.json +1 -1
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.
|
@@ -291,89 +374,6 @@ interface NormalizedConfig extends Omit<Config$1, 'locales' | 'sidebar'> {
|
|
291
374
|
sidebar: NormalizedSidebar;
|
292
375
|
}
|
293
376
|
|
294
|
-
/**
|
295
|
-
* There are two ways to define what addtion routes represent.
|
296
|
-
* 1. Define filepath, then the content will be read from the file.
|
297
|
-
* 2. Define content, then then content will be written to temp file and read from it.
|
298
|
-
*/
|
299
|
-
interface AdditionalPage {
|
300
|
-
routePath: string;
|
301
|
-
content?: string;
|
302
|
-
filepath?: string;
|
303
|
-
}
|
304
|
-
interface RspressPlugin {
|
305
|
-
/**
|
306
|
-
* Name of the plugin.
|
307
|
-
*/
|
308
|
-
name: string;
|
309
|
-
/**
|
310
|
-
* Global style
|
311
|
-
*/
|
312
|
-
globalStyles?: string;
|
313
|
-
/**
|
314
|
-
* Markdown options.
|
315
|
-
*/
|
316
|
-
markdown?: {
|
317
|
-
remarkPlugins?: PluggableList;
|
318
|
-
rehypePlugins?: PluggableList;
|
319
|
-
globalComponents?: string[];
|
320
|
-
};
|
321
|
-
/**
|
322
|
-
* Rsbuild config.
|
323
|
-
*/
|
324
|
-
builderConfig?: RsbuildConfig;
|
325
|
-
/**
|
326
|
-
* Inject global components.
|
327
|
-
*/
|
328
|
-
globalUIComponents?: (string | [string, object])[];
|
329
|
-
/**
|
330
|
-
* Modify doc config.
|
331
|
-
*/
|
332
|
-
config?: (config: UserConfig, utils: {
|
333
|
-
addPlugin: (plugin: RspressPlugin) => void;
|
334
|
-
removePlugin: (pluginName: string) => void;
|
335
|
-
}, isProd: boolean) => UserConfig | Promise<UserConfig>;
|
336
|
-
/**
|
337
|
-
* Callback before build
|
338
|
-
*/
|
339
|
-
beforeBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
|
340
|
-
/**
|
341
|
-
* Callback after build
|
342
|
-
*/
|
343
|
-
afterBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
|
344
|
-
/**
|
345
|
-
* Extend every page's data
|
346
|
-
*/
|
347
|
-
extendPageData?: (pageData: PageIndexInfo & {
|
348
|
-
[key: string]: unknown;
|
349
|
-
}, isProd: boolean) => void | Promise<void>;
|
350
|
-
/**
|
351
|
-
* Add custom route
|
352
|
-
*/
|
353
|
-
addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
|
354
|
-
/**
|
355
|
-
* Add runtime modules
|
356
|
-
*/
|
357
|
-
addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
|
358
|
-
/**
|
359
|
-
* Callback after route generated
|
360
|
-
*/
|
361
|
-
routeGenerated?: (routes: RouteMeta[], isProd: boolean) => Promise<void> | void;
|
362
|
-
/**
|
363
|
-
* Add addition ssg routes, for dynamic routes.
|
364
|
-
*/
|
365
|
-
addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
|
366
|
-
path: string;
|
367
|
-
}[] | Promise<{
|
368
|
-
path: string;
|
369
|
-
}[]>;
|
370
|
-
/**
|
371
|
-
* @private
|
372
|
-
* Modify search index data.
|
373
|
-
*/
|
374
|
-
modifySearchIndexData?: (data: PageIndexInfo[], isProd: boolean) => void | Promise<void>;
|
375
|
-
}
|
376
|
-
|
377
377
|
interface Route {
|
378
378
|
path: string;
|
379
379
|
element: React.ReactElement;
|
@@ -586,6 +586,12 @@ interface Hero {
|
|
586
586
|
image?: {
|
587
587
|
src: string;
|
588
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[];
|
589
595
|
};
|
590
596
|
actions: {
|
591
597
|
text: string;
|