@rspress/plugin-client-redirects 1.37.3 → 1.37.4

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