@rspress/shared 2.0.0-beta.3 → 2.0.0-beta.30
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 +72 -66
- package/dist/index.js +41 -60
- package/dist/logger.js +2 -3
- package/dist/node-utils.d.ts +68 -46
- package/dist/node-utils.js +30 -12
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { loadConfig } from '@rsbuild/core';
|
|
2
2
|
import type { PluggableList } from 'unified';
|
|
3
|
+
import type { RehypeShikiOptions } from '@shikijs/rehype';
|
|
3
4
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
4
|
-
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* There are two ways to define what addition routes represent.
|
|
@@ -28,8 +28,6 @@ export declare const cleanUrl: (url: string) => string;
|
|
|
28
28
|
|
|
29
29
|
export declare type Config = UserConfig | Promise<UserConfig> | ((...args: Parameters<typeof loadConfig>) => UserConfig | Promise<UserConfig>);
|
|
30
30
|
|
|
31
|
-
export declare const DEFAULT_HIGHLIGHT_LANGUAGES: string[][];
|
|
32
|
-
|
|
33
31
|
export declare interface DefaultThemeConfig {
|
|
34
32
|
/**
|
|
35
33
|
* Whether to enable dark mode.
|
|
@@ -132,6 +130,7 @@ export declare interface DefaultThemeConfig {
|
|
|
132
130
|
enableContentAnimation?: boolean;
|
|
133
131
|
/**
|
|
134
132
|
* Whether to enable view transition animation for the theme
|
|
133
|
+
* @default false
|
|
135
134
|
*/
|
|
136
135
|
enableAppearanceAnimation?: boolean;
|
|
137
136
|
/**
|
|
@@ -143,7 +142,7 @@ export declare interface DefaultThemeConfig {
|
|
|
143
142
|
* Whether to redirect to the closest locale when the user visits the site
|
|
144
143
|
* @default 'auto'
|
|
145
144
|
*/
|
|
146
|
-
localeRedirect?: 'auto' | 'never';
|
|
145
|
+
localeRedirect?: 'auto' | 'never' | 'only-default-lang';
|
|
147
146
|
/**
|
|
148
147
|
* Whether to show the fallback heading title when the heading title is not presented but `frontmatter.title` exists
|
|
149
148
|
* @default true
|
|
@@ -220,7 +219,7 @@ export declare interface FrontMatterMeta {
|
|
|
220
219
|
* @param currentPathname
|
|
221
220
|
* @returns
|
|
222
221
|
*/
|
|
223
|
-
export declare const getSidebarDataGroup: (sidebar: NormalizedSidebar, currentPathname: string
|
|
222
|
+
export declare const getSidebarDataGroup: (sidebar: NormalizedSidebar, currentPathname: string) => NormalizedSidebar[string];
|
|
224
223
|
|
|
225
224
|
export declare const HASH_REGEXP: RegExp;
|
|
226
225
|
|
|
@@ -273,8 +272,6 @@ export declare function isExternalUrl(url?: string): boolean;
|
|
|
273
272
|
|
|
274
273
|
export declare const isProduction: () => boolean;
|
|
275
274
|
|
|
276
|
-
export declare const isSCM: () => boolean;
|
|
277
|
-
|
|
278
275
|
export declare interface Locale {
|
|
279
276
|
lang: string;
|
|
280
277
|
label: string;
|
|
@@ -330,7 +327,7 @@ export declare type LocalSearchOptions = SearchHooks & {
|
|
|
330
327
|
versioned?: boolean;
|
|
331
328
|
/**
|
|
332
329
|
* If enabled, the search index will include code block content, which allows users to search code blocks.
|
|
333
|
-
* @default
|
|
330
|
+
* @default true
|
|
334
331
|
*/
|
|
335
332
|
codeBlocks?: boolean;
|
|
336
333
|
};
|
|
@@ -338,13 +335,11 @@ export declare type LocalSearchOptions = SearchHooks & {
|
|
|
338
335
|
export declare interface MarkdownOptions {
|
|
339
336
|
remarkPlugins?: PluggableList;
|
|
340
337
|
rehypePlugins?: PluggableList;
|
|
341
|
-
|
|
342
|
-
* Whether to enable check dead links, default is false
|
|
343
|
-
*/
|
|
344
|
-
checkDeadLinks?: boolean;
|
|
338
|
+
link?: RemarkLinkOptions;
|
|
345
339
|
showLineNumbers?: boolean;
|
|
346
340
|
/**
|
|
347
|
-
* Whether to wrap code by default
|
|
341
|
+
* Whether to wrap code by default
|
|
342
|
+
* @default false
|
|
348
343
|
*/
|
|
349
344
|
defaultWrapCode?: boolean;
|
|
350
345
|
/**
|
|
@@ -352,23 +347,24 @@ export declare interface MarkdownOptions {
|
|
|
352
347
|
*/
|
|
353
348
|
globalComponents?: string[];
|
|
354
349
|
/**
|
|
355
|
-
*
|
|
350
|
+
* @type import('@shikijs/rehype').RehypeShikiOptions
|
|
356
351
|
*/
|
|
357
|
-
|
|
352
|
+
shiki?: Partial<RehypeShikiOptions>;
|
|
358
353
|
/**
|
|
359
|
-
*
|
|
354
|
+
* Speed up build time by caching mdx parsing result in `rspress build`
|
|
355
|
+
* @default true
|
|
360
356
|
*/
|
|
361
|
-
|
|
357
|
+
crossCompilerCache?: boolean;
|
|
362
358
|
}
|
|
363
359
|
|
|
364
|
-
export declare const matchNavbar: (item: NavItemWithLink, currentPathname: string
|
|
360
|
+
export declare const matchNavbar: (item: NavItemWithLink, currentPathname: string) => boolean;
|
|
365
361
|
|
|
366
362
|
/**
|
|
367
363
|
* match the sidebar key in user config
|
|
368
364
|
* @param pattern /zh/guide
|
|
369
365
|
* @param currentPathname /base/zh/guide/getting-started
|
|
370
366
|
*/
|
|
371
|
-
export declare const matchSidebar: (pattern: string, currentPathname: string
|
|
367
|
+
export declare const matchSidebar: (pattern: string, currentPathname: string) => boolean;
|
|
372
368
|
|
|
373
369
|
export declare const MDX_OR_MD_REGEXP: RegExp;
|
|
374
370
|
|
|
@@ -418,19 +414,23 @@ export declare interface NormalizedSidebar {
|
|
|
418
414
|
}
|
|
419
415
|
|
|
420
416
|
export declare interface NormalizedSidebarGroup extends Omit<SidebarGroup, 'items'> {
|
|
421
|
-
items:
|
|
417
|
+
items: SidebarData;
|
|
422
418
|
collapsible: boolean;
|
|
423
419
|
collapsed: boolean;
|
|
424
420
|
}
|
|
425
421
|
|
|
426
|
-
export declare function normalizeHref(url?: string, cleanUrls?: boolean): string;
|
|
422
|
+
export declare function normalizeHref(url?: string, cleanUrls?: boolean, assetExtensions?: string[]): string;
|
|
427
423
|
|
|
428
424
|
export declare function normalizePosixPath(id: string): string;
|
|
429
425
|
|
|
430
|
-
export declare function normalizeSlash(url: string): string;
|
|
431
|
-
|
|
432
426
|
export declare interface PageData {
|
|
433
|
-
|
|
427
|
+
pages: BaseRuntimePageInfo[];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export declare interface PageDataLegacy {
|
|
431
|
+
siteData: SiteData<DefaultThemeConfig> & {
|
|
432
|
+
pages: BaseRuntimePageInfo[];
|
|
433
|
+
};
|
|
434
434
|
page: BaseRuntimePageInfo & {
|
|
435
435
|
headingTitle?: string;
|
|
436
436
|
pagePath: string;
|
|
@@ -447,9 +447,8 @@ export declare interface PageData {
|
|
|
447
447
|
* and should not be used in the runtime (usePageData).
|
|
448
448
|
*/
|
|
449
449
|
export declare interface PageIndexInfo {
|
|
450
|
-
id: number;
|
|
451
|
-
title: string;
|
|
452
450
|
routePath: string;
|
|
451
|
+
title: string;
|
|
453
452
|
toc: Header[];
|
|
454
453
|
content: string;
|
|
455
454
|
_flattenContent?: string;
|
|
@@ -457,7 +456,6 @@ export declare interface PageIndexInfo {
|
|
|
457
456
|
frontmatter: FrontMatterMeta;
|
|
458
457
|
lang: string;
|
|
459
458
|
version: string;
|
|
460
|
-
domain: string;
|
|
461
459
|
_filepath: string;
|
|
462
460
|
_relativePath: string;
|
|
463
461
|
}
|
|
@@ -478,6 +476,21 @@ export declare const parseUrl: (url: string) => {
|
|
|
478
476
|
|
|
479
477
|
export declare const QUERY_REGEXP: RegExp;
|
|
480
478
|
|
|
479
|
+
export declare type RemarkLinkOptions = {
|
|
480
|
+
/**
|
|
481
|
+
* Whether to enable check dead links
|
|
482
|
+
* @default true
|
|
483
|
+
*/
|
|
484
|
+
checkDeadLinks?: boolean | {
|
|
485
|
+
excludes: string[] | ((url: string) => boolean);
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* [](/v3/zh/guide) [](/zh/guide) [](/guide) will be regarded as the same [](/v3/zh/guide) according to the directory.
|
|
489
|
+
* @default true
|
|
490
|
+
*/
|
|
491
|
+
autoPrefix?: boolean;
|
|
492
|
+
};
|
|
493
|
+
|
|
481
494
|
export declare type RemotePageInfo = PageIndexInfo & {
|
|
482
495
|
_matchesPosition: {
|
|
483
496
|
content: {
|
|
@@ -487,20 +500,6 @@ export declare type RemotePageInfo = PageIndexInfo & {
|
|
|
487
500
|
};
|
|
488
501
|
};
|
|
489
502
|
|
|
490
|
-
export declare type RemoteSearchIndexInfo = string | {
|
|
491
|
-
value: string;
|
|
492
|
-
label: string;
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
export declare type RemoteSearchOptions = SearchHooks & {
|
|
496
|
-
mode: 'remote';
|
|
497
|
-
apiUrl: string;
|
|
498
|
-
domain?: string;
|
|
499
|
-
indexName: string;
|
|
500
|
-
searchIndexes?: RemoteSearchIndexInfo[];
|
|
501
|
-
searchLoading?: boolean;
|
|
502
|
-
};
|
|
503
|
-
|
|
504
503
|
export declare function removeBase(url: string, base: string): string;
|
|
505
504
|
|
|
506
505
|
export declare function removeHash(str: string): string;
|
|
@@ -558,14 +557,22 @@ export declare interface RouteOptions {
|
|
|
558
557
|
extensions?: string[];
|
|
559
558
|
/**
|
|
560
559
|
* Include extra files from being converted to routes
|
|
560
|
+
* @default []
|
|
561
561
|
*/
|
|
562
562
|
include?: string[];
|
|
563
563
|
/**
|
|
564
564
|
* Exclude files from being converted to routes
|
|
565
|
+
* @default []
|
|
565
566
|
*/
|
|
566
567
|
exclude?: string[];
|
|
568
|
+
/**
|
|
569
|
+
* Exclude convention files from being converted to routes
|
|
570
|
+
* @default ['**\/_[^_]*']
|
|
571
|
+
*/
|
|
572
|
+
excludeConvention?: string[];
|
|
567
573
|
/**
|
|
568
574
|
* use links without .html files
|
|
575
|
+
* @default false
|
|
569
576
|
*/
|
|
570
577
|
cleanUrls?: boolean;
|
|
571
578
|
}
|
|
@@ -622,6 +629,7 @@ declare interface RspressPlugin {
|
|
|
622
629
|
addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
|
|
623
630
|
/**
|
|
624
631
|
* Add runtime modules
|
|
632
|
+
* @deprecated use [rsbuild-plugin-virtual-module](https://github.com/rspack-contrib/rsbuild-plugin-virtual-module) instead.
|
|
625
633
|
*/
|
|
626
634
|
addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
|
|
627
635
|
/**
|
|
@@ -632,14 +640,6 @@ declare interface RspressPlugin {
|
|
|
632
640
|
* Callback after routeService generated
|
|
633
641
|
*/
|
|
634
642
|
routeServiceGenerated?: (routeService: any, isProd: boolean) => Promise<void> | void;
|
|
635
|
-
/**
|
|
636
|
-
* Add addition ssg routes, for dynamic routes.
|
|
637
|
-
*/
|
|
638
|
-
addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
|
|
639
|
-
path: string;
|
|
640
|
-
}[] | Promise<{
|
|
641
|
-
path: string;
|
|
642
|
-
}[]>;
|
|
643
643
|
/**
|
|
644
644
|
* @private
|
|
645
645
|
* Modify search index data.
|
|
@@ -658,12 +658,14 @@ export declare interface SearchHooks {
|
|
|
658
658
|
searchHooks?: string;
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
export declare type SearchOptions = LocalSearchOptions |
|
|
661
|
+
export declare type SearchOptions = LocalSearchOptions | false;
|
|
662
662
|
|
|
663
663
|
export declare interface Sidebar {
|
|
664
664
|
[path: string]: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
+
export declare type SidebarData = (SidebarDivider | SidebarItem | SidebarSectionHeader | NormalizedSidebarGroup)[];
|
|
668
|
+
|
|
667
669
|
export declare type SidebarDivider = {
|
|
668
670
|
dividerType: 'dashed' | 'solid';
|
|
669
671
|
};
|
|
@@ -672,7 +674,7 @@ export declare interface SidebarGroup {
|
|
|
672
674
|
text: string;
|
|
673
675
|
link?: string;
|
|
674
676
|
tag?: string;
|
|
675
|
-
items: (
|
|
677
|
+
items: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
|
|
676
678
|
collapsible?: boolean;
|
|
677
679
|
collapsed?: boolean;
|
|
678
680
|
/**
|
|
@@ -701,7 +703,6 @@ export declare type SidebarSectionHeader = {
|
|
|
701
703
|
};
|
|
702
704
|
|
|
703
705
|
export declare interface SiteData<ThemeConfig = NormalizedConfig> {
|
|
704
|
-
root: string;
|
|
705
706
|
base: string;
|
|
706
707
|
lang: string;
|
|
707
708
|
route: RouteOptions;
|
|
@@ -718,13 +719,11 @@ export declare interface SiteData<ThemeConfig = NormalizedConfig> {
|
|
|
718
719
|
light: string;
|
|
719
720
|
};
|
|
720
721
|
logoText: string;
|
|
721
|
-
pages: BaseRuntimePageInfo[];
|
|
722
722
|
search: SearchOptions;
|
|
723
|
-
ssg: boolean;
|
|
724
723
|
markdown: {
|
|
725
724
|
showLineNumbers: boolean;
|
|
726
725
|
defaultWrapCode: boolean;
|
|
727
|
-
|
|
726
|
+
shiki: Partial<RehypeShikiOptions>;
|
|
728
727
|
};
|
|
729
728
|
multiVersion: {
|
|
730
729
|
default: string;
|
|
@@ -740,7 +739,7 @@ export declare interface SocialLink {
|
|
|
740
739
|
content: string;
|
|
741
740
|
}
|
|
742
741
|
|
|
743
|
-
export declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | {
|
|
742
|
+
export declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | 'npm' | {
|
|
744
743
|
svg: string;
|
|
745
744
|
};
|
|
746
745
|
|
|
@@ -770,7 +769,7 @@ export declare interface UserConfig<ThemeConfig = DefaultThemeConfig> {
|
|
|
770
769
|
/**
|
|
771
770
|
* Path to html icon file.
|
|
772
771
|
*/
|
|
773
|
-
icon?: string;
|
|
772
|
+
icon?: string | URL;
|
|
774
773
|
/**
|
|
775
774
|
* Default language of the site.
|
|
776
775
|
*/
|
|
@@ -842,20 +841,29 @@ export declare interface UserConfig<ThemeConfig = DefaultThemeConfig> {
|
|
|
842
841
|
*/
|
|
843
842
|
search?: SearchOptions;
|
|
844
843
|
/**
|
|
845
|
-
* Whether to enable ssg
|
|
844
|
+
* Whether to enable ssg
|
|
845
|
+
* @default true
|
|
846
846
|
*/
|
|
847
|
-
ssg?: boolean
|
|
847
|
+
ssg?: boolean | {
|
|
848
|
+
/**
|
|
849
|
+
* After enabled, you can use worker to accelerate the SSG process and reduce memory usage. It is suitable for large document sites and is based on [tinypool](https://github.com/tinylibs/tinypool).
|
|
850
|
+
* @default false
|
|
851
|
+
*/
|
|
852
|
+
experimentalWorker?: boolean;
|
|
853
|
+
/**
|
|
854
|
+
* After enabled, some pages will not be rendered by SSG, and they will directly use html under CSR. This is suitable for SSG errors in large document sites bypassing a small number of pages. It is not recommended to enable this option actively.
|
|
855
|
+
* @default []
|
|
856
|
+
*/
|
|
857
|
+
experimentalExcludeRoutePaths?: (string | RegExp)[];
|
|
858
|
+
};
|
|
848
859
|
/**
|
|
849
|
-
* Whether to enable medium-zoom
|
|
860
|
+
* Whether to enable medium-zoom
|
|
861
|
+
* @default true
|
|
850
862
|
*/
|
|
851
863
|
mediumZoom?: boolean | {
|
|
852
864
|
selector?: string;
|
|
853
865
|
options?: ZoomOptions;
|
|
854
866
|
};
|
|
855
|
-
/**
|
|
856
|
-
* Add some extra builder plugins
|
|
857
|
-
*/
|
|
858
|
-
builderPlugins?: RsbuildPlugin[];
|
|
859
867
|
/**
|
|
860
868
|
* Multi version config
|
|
861
869
|
*/
|
|
@@ -890,8 +898,6 @@ export declare interface UserConfig<ThemeConfig = DefaultThemeConfig> {
|
|
|
890
898
|
|
|
891
899
|
export declare function withBase(url: string, base: string): string;
|
|
892
900
|
|
|
893
|
-
export declare function withoutBase(path: string, base: string): string;
|
|
894
|
-
|
|
895
901
|
export declare function withoutLang(path: string, langs: string[]): string;
|
|
896
902
|
|
|
897
903
|
declare interface ZoomContainer {
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,24 @@
|
|
|
1
|
+
const matchSidebar = (pattern, currentPathname)=>{
|
|
2
|
+
if (pattern === currentPathname) return true;
|
|
3
|
+
if (currentPathname.startsWith(pattern)) return true;
|
|
4
|
+
const prefixWithDot = `${pattern}.`;
|
|
5
|
+
return currentPathname.startsWith(prefixWithDot);
|
|
6
|
+
};
|
|
7
|
+
const getSidebarDataGroup = (sidebar, currentPathname)=>{
|
|
8
|
+
const navRoutes = Object.keys(sidebar).sort((a, b)=>b.length - a.length);
|
|
9
|
+
for (const name of navRoutes)if (matchSidebar(name, currentPathname)) {
|
|
10
|
+
const sidebarGroup = sidebar[name];
|
|
11
|
+
return sidebarGroup;
|
|
12
|
+
}
|
|
13
|
+
return [];
|
|
14
|
+
};
|
|
15
|
+
const matchNavbar = (item, currentPathname)=>new RegExp(item.activeMatch || item.link).test(currentPathname);
|
|
1
16
|
const QUERY_REGEXP = /\?.*$/s;
|
|
2
17
|
const HASH_REGEXP = /#.*$/s;
|
|
3
18
|
const MDX_OR_MD_REGEXP = /\.mdx?$/;
|
|
4
19
|
const APPEARANCE_KEY = 'rspress-theme-appearance';
|
|
5
20
|
const SEARCH_INDEX_NAME = 'search_index';
|
|
6
21
|
const RSPRESS_TEMP_DIR = '.rspress';
|
|
7
|
-
const DEFAULT_HIGHLIGHT_LANGUAGES = [
|
|
8
|
-
[
|
|
9
|
-
'js',
|
|
10
|
-
"javascript"
|
|
11
|
-
],
|
|
12
|
-
[
|
|
13
|
-
'ts',
|
|
14
|
-
"typescript"
|
|
15
|
-
],
|
|
16
|
-
[
|
|
17
|
-
'jsx',
|
|
18
|
-
'tsx'
|
|
19
|
-
],
|
|
20
|
-
[
|
|
21
|
-
'xml',
|
|
22
|
-
'xml-doc'
|
|
23
|
-
],
|
|
24
|
-
[
|
|
25
|
-
'md',
|
|
26
|
-
'markdown'
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
'mdx',
|
|
30
|
-
'tsx'
|
|
31
|
-
]
|
|
32
|
-
];
|
|
33
|
-
const isSCM = ()=>Boolean(process.env.BUILD_VERSION);
|
|
34
22
|
const isProduction = ()=>'production' === process.env.NODE_ENV;
|
|
35
23
|
const isDebugMode = ()=>{
|
|
36
24
|
if (!process.env.DEBUG) return false;
|
|
@@ -76,9 +64,6 @@ function addTrailingSlash(url) {
|
|
|
76
64
|
function removeTrailingSlash(url) {
|
|
77
65
|
return '/' === url.charAt(url.length - 1) ? url.slice(0, -1) : url;
|
|
78
66
|
}
|
|
79
|
-
function normalizeSlash(url) {
|
|
80
|
-
return removeTrailingSlash(addLeadingSlash(normalizePosixPath(url)));
|
|
81
|
-
}
|
|
82
67
|
function isExternalUrl(url = '') {
|
|
83
68
|
return url.startsWith('http://') || url.startsWith('https://') || url.startsWith('mailto:') || url.startsWith('tel:');
|
|
84
69
|
}
|
|
@@ -100,11 +85,11 @@ function replaceLang(rawUrl, lang, version, base = '', cleanUrls = false, isPage
|
|
|
100
85
|
} else parts.shift();
|
|
101
86
|
purePathPart = parts.join('/') || '';
|
|
102
87
|
if ((versionPart || langPart) && !purePathPart) purePathPart = cleanUrls ? 'index' : 'index.html';
|
|
103
|
-
return
|
|
88
|
+
return addLeadingSlash([
|
|
104
89
|
versionPart,
|
|
105
90
|
langPart,
|
|
106
91
|
purePathPart
|
|
107
|
-
].filter(Boolean).join('/'))
|
|
92
|
+
].filter(Boolean).join('/'));
|
|
108
93
|
}
|
|
109
94
|
function replaceVersion(rawUrl, version, base = '', cleanUrls = false, isPageNotFound = false) {
|
|
110
95
|
let url = removeBase(rawUrl, base);
|
|
@@ -117,10 +102,10 @@ function replaceVersion(rawUrl, version, base = '', cleanUrls = false, isPageNot
|
|
|
117
102
|
} else parts.shift();
|
|
118
103
|
let restPart = parts.join('/') || '';
|
|
119
104
|
if (versionPart && !restPart) restPart = cleanUrls ? 'index' : 'index.html';
|
|
120
|
-
return
|
|
105
|
+
return addLeadingSlash([
|
|
121
106
|
versionPart,
|
|
122
107
|
restPart
|
|
123
|
-
].filter(Boolean).join('/'))
|
|
108
|
+
].filter(Boolean).join('/'));
|
|
124
109
|
}
|
|
125
110
|
const parseUrl = (url)=>{
|
|
126
111
|
const [withoutHash, hash = ''] = url.split('#');
|
|
@@ -129,48 +114,44 @@ const parseUrl = (url)=>{
|
|
|
129
114
|
hash
|
|
130
115
|
};
|
|
131
116
|
};
|
|
132
|
-
function normalizeHref(url, cleanUrls = false) {
|
|
117
|
+
function normalizeHref(url, cleanUrls = false, assetExtensions = []) {
|
|
133
118
|
if (!url) return '/';
|
|
134
119
|
if (isExternalUrl(url)) return url;
|
|
135
120
|
if (url.startsWith('#')) return url;
|
|
121
|
+
if (!url.startsWith('/')) return url;
|
|
136
122
|
let { url: cleanUrl, hash } = parseUrl(decodeURIComponent(url));
|
|
137
123
|
if (cleanUrls) {
|
|
138
124
|
if (cleanUrl.endsWith('.html')) cleanUrl = cleanUrl.replace(/\.html$/, '');
|
|
139
125
|
if (cleanUrls && cleanUrl.endsWith('/index')) cleanUrl = cleanUrl.replace(/\/index$/, '/');
|
|
140
|
-
} else
|
|
141
|
-
|
|
126
|
+
} else {
|
|
127
|
+
const hasExt = cleanUrl.endsWith('.html') || assetExtensions.some((i)=>cleanUrl.endsWith(i));
|
|
128
|
+
if (!hasExt) if (cleanUrl.endsWith('/')) cleanUrl += 'index.html';
|
|
129
|
+
else cleanUrl += '.html';
|
|
130
|
+
}
|
|
142
131
|
return addLeadingSlash(hash ? `${cleanUrl}#${hash}` : cleanUrl);
|
|
143
132
|
}
|
|
144
133
|
function withoutLang(path, langs) {
|
|
145
134
|
const langRegexp = new RegExp(`^\\/(${langs.join('|')})`);
|
|
146
135
|
return addLeadingSlash(path.replace(langRegexp, ''));
|
|
147
136
|
}
|
|
148
|
-
function
|
|
149
|
-
return addLeadingSlash(
|
|
137
|
+
function normalizeSlash(url) {
|
|
138
|
+
return removeTrailingSlash(addLeadingSlash(normalizePosixPath(url)));
|
|
150
139
|
}
|
|
151
140
|
function withBase(url, base) {
|
|
152
141
|
const normalizedUrl = addLeadingSlash(url);
|
|
153
142
|
const normalizedBase = normalizeSlash(base);
|
|
154
|
-
|
|
143
|
+
const hasBase = normalizedUrl.startsWith(normalizedBase);
|
|
144
|
+
if (hasBase) {
|
|
145
|
+
if (normalizedUrl + '/' === base) return base;
|
|
146
|
+
return normalizedUrl;
|
|
147
|
+
}
|
|
148
|
+
return `${normalizedBase}${normalizedUrl}`;
|
|
155
149
|
}
|
|
156
150
|
function removeBase(url, base) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const prefixWithDot = `${prefix}.`;
|
|
165
|
-
return currentPathname.startsWith(prefixWithDot);
|
|
166
|
-
};
|
|
167
|
-
const getSidebarDataGroup = (sidebar, currentPathname, base)=>{
|
|
168
|
-
const navRoutes = Object.keys(sidebar).sort((a, b)=>b.length - a.length);
|
|
169
|
-
for (const name of navRoutes)if (matchSidebar(name, currentPathname, base)) {
|
|
170
|
-
const sidebarGroup = sidebar[name];
|
|
171
|
-
return sidebarGroup;
|
|
172
|
-
}
|
|
173
|
-
return [];
|
|
174
|
-
};
|
|
175
|
-
const matchNavbar = (item, currentPathname, base)=>new RegExp(item.activeMatch || item.link).test(withoutBase(currentPathname, base));
|
|
176
|
-
export { APPEARANCE_KEY, DEFAULT_HIGHLIGHT_LANGUAGES, HASH_REGEXP, MDX_OR_MD_REGEXP, QUERY_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, utils_cleanUrl as cleanUrl, getSidebarDataGroup, inBrowser, isDataUrl, isDebugMode, isDevDebugMode, isExternalUrl, isProduction, isSCM, matchNavbar, matchSidebar, normalizeHref, normalizePosixPath, normalizeSlash, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutLang };
|
|
151
|
+
const normalizedUrl = addLeadingSlash(url);
|
|
152
|
+
const normalizedBase = normalizeSlash(base);
|
|
153
|
+
const removedBaseUrl = normalizedUrl.replace(new RegExp(`^${normalizedBase}`), '');
|
|
154
|
+
if ('' === removedBaseUrl) return '/';
|
|
155
|
+
return removedBaseUrl;
|
|
156
|
+
}
|
|
157
|
+
export { APPEARANCE_KEY, HASH_REGEXP, MDX_OR_MD_REGEXP, QUERY_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, utils_cleanUrl as cleanUrl, getSidebarDataGroup, inBrowser, isDataUrl, isDebugMode, isDevDebugMode, isExternalUrl, isProduction, matchNavbar, matchSidebar, normalizeHref, normalizePosixPath, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutLang };
|
package/dist/logger.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export { __webpack_exports__logger as logger };
|
|
1
|
+
import { logger } from "@rsbuild/core";
|
|
2
|
+
export { logger };
|
package/dist/node-utils.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ 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 { RehypeShikiOptions } from '@shikijs/rehype';
|
|
7
8
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
8
|
-
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* There are two ways to define what addition routes represent.
|
|
@@ -120,6 +120,7 @@ declare interface Config {
|
|
|
120
120
|
enableContentAnimation?: boolean;
|
|
121
121
|
/**
|
|
122
122
|
* Whether to enable view transition animation for the theme
|
|
123
|
+
* @default false
|
|
123
124
|
*/
|
|
124
125
|
enableAppearanceAnimation?: boolean;
|
|
125
126
|
/**
|
|
@@ -131,7 +132,7 @@ declare interface Config {
|
|
|
131
132
|
* Whether to redirect to the closest locale when the user visits the site
|
|
132
133
|
* @default 'auto'
|
|
133
134
|
*/
|
|
134
|
-
localeRedirect?: 'auto' | 'never';
|
|
135
|
+
localeRedirect?: 'auto' | 'never' | 'only-default-lang';
|
|
135
136
|
/**
|
|
136
137
|
* Whether to show the fallback heading title when the heading title is not presented but `frontmatter.title` exists
|
|
137
138
|
* @default true
|
|
@@ -207,6 +208,18 @@ declare interface FrontMatterMeta {
|
|
|
207
208
|
[key: string]: unknown;
|
|
208
209
|
}
|
|
209
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Transform `config.icon` into final url path in the web app
|
|
213
|
+
*
|
|
214
|
+
* @param icon original icon in config
|
|
215
|
+
* @returns final url path in the web app
|
|
216
|
+
*/
|
|
217
|
+
export declare function getIconUrlPath(icon: '' | undefined): undefined;
|
|
218
|
+
|
|
219
|
+
export declare function getIconUrlPath(icon: string | URL): string;
|
|
220
|
+
|
|
221
|
+
export declare function getIconUrlPath(icon: string | URL | undefined): string | undefined;
|
|
222
|
+
|
|
210
223
|
export declare function getNodeAttribute(node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string, attribute?: false): string | MdxJsxAttributeValueExpression | null | undefined;
|
|
211
224
|
|
|
212
225
|
export declare function getNodeAttribute(node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string, attribute: true): MdxJsxAttribute | MdxJsxExpressionAttribute | undefined;
|
|
@@ -245,6 +258,7 @@ declare interface Hero {
|
|
|
245
258
|
export declare function loadFrontMatter<TFrontmatter extends Record<string, unknown> = FrontMatterMeta>(source: string, filepath: string, root: string, outputWarning?: boolean): {
|
|
246
259
|
frontmatter: TFrontmatter;
|
|
247
260
|
content: string;
|
|
261
|
+
emptyLinesSource: string;
|
|
248
262
|
};
|
|
249
263
|
|
|
250
264
|
declare interface Locale {
|
|
@@ -292,7 +306,7 @@ declare type LocalSearchOptions = SearchHooks & {
|
|
|
292
306
|
versioned?: boolean;
|
|
293
307
|
/**
|
|
294
308
|
* If enabled, the search index will include code block content, which allows users to search code blocks.
|
|
295
|
-
* @default
|
|
309
|
+
* @default true
|
|
296
310
|
*/
|
|
297
311
|
codeBlocks?: boolean;
|
|
298
312
|
};
|
|
@@ -300,13 +314,11 @@ declare type LocalSearchOptions = SearchHooks & {
|
|
|
300
314
|
declare interface MarkdownOptions {
|
|
301
315
|
remarkPlugins?: PluggableList;
|
|
302
316
|
rehypePlugins?: PluggableList;
|
|
303
|
-
|
|
304
|
-
* Whether to enable check dead links, default is false
|
|
305
|
-
*/
|
|
306
|
-
checkDeadLinks?: boolean;
|
|
317
|
+
link?: RemarkLinkOptions;
|
|
307
318
|
showLineNumbers?: boolean;
|
|
308
319
|
/**
|
|
309
|
-
* Whether to wrap code by default
|
|
320
|
+
* Whether to wrap code by default
|
|
321
|
+
* @default false
|
|
310
322
|
*/
|
|
311
323
|
defaultWrapCode?: boolean;
|
|
312
324
|
/**
|
|
@@ -314,13 +326,14 @@ declare interface MarkdownOptions {
|
|
|
314
326
|
*/
|
|
315
327
|
globalComponents?: string[];
|
|
316
328
|
/**
|
|
317
|
-
*
|
|
329
|
+
* @type import('@shikijs/rehype').RehypeShikiOptions
|
|
318
330
|
*/
|
|
319
|
-
|
|
331
|
+
shiki?: Partial<RehypeShikiOptions>;
|
|
320
332
|
/**
|
|
321
|
-
*
|
|
333
|
+
* Speed up build time by caching mdx parsing result in `rspress build`
|
|
334
|
+
* @default true
|
|
322
335
|
*/
|
|
323
|
-
|
|
336
|
+
crossCompilerCache?: boolean;
|
|
324
337
|
}
|
|
325
338
|
|
|
326
339
|
export declare const mergeDocConfig: (...configs: UserConfig[]) => Promise<UserConfig>;
|
|
@@ -361,9 +374,8 @@ declare interface NavItemWithLinkAndChildren {
|
|
|
361
374
|
* and should not be used in the runtime (usePageData).
|
|
362
375
|
*/
|
|
363
376
|
declare interface PageIndexInfo {
|
|
364
|
-
id: number;
|
|
365
|
-
title: string;
|
|
366
377
|
routePath: string;
|
|
378
|
+
title: string;
|
|
367
379
|
toc: Header[];
|
|
368
380
|
content: string;
|
|
369
381
|
_flattenContent?: string;
|
|
@@ -371,25 +383,25 @@ declare interface PageIndexInfo {
|
|
|
371
383
|
frontmatter: FrontMatterMeta;
|
|
372
384
|
lang: string;
|
|
373
385
|
version: string;
|
|
374
|
-
domain: string;
|
|
375
386
|
_filepath: string;
|
|
376
387
|
_relativePath: string;
|
|
377
388
|
}
|
|
378
389
|
|
|
379
390
|
declare type PageType = 'home' | 'doc' | 'custom' | '404' | 'blank';
|
|
380
391
|
|
|
381
|
-
declare type
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
declare type RemarkLinkOptions = {
|
|
393
|
+
/**
|
|
394
|
+
* Whether to enable check dead links
|
|
395
|
+
* @default true
|
|
396
|
+
*/
|
|
397
|
+
checkDeadLinks?: boolean | {
|
|
398
|
+
excludes: string[] | ((url: string) => boolean);
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* [](/v3/zh/guide) [](/zh/guide) [](/guide) will be regarded as the same [](/v3/zh/guide) according to the directory.
|
|
402
|
+
* @default true
|
|
403
|
+
*/
|
|
404
|
+
autoPrefix?: boolean;
|
|
393
405
|
};
|
|
394
406
|
|
|
395
407
|
declare interface ReplaceRule {
|
|
@@ -414,14 +426,22 @@ declare interface RouteOptions {
|
|
|
414
426
|
extensions?: string[];
|
|
415
427
|
/**
|
|
416
428
|
* Include extra files from being converted to routes
|
|
429
|
+
* @default []
|
|
417
430
|
*/
|
|
418
431
|
include?: string[];
|
|
419
432
|
/**
|
|
420
433
|
* Exclude files from being converted to routes
|
|
434
|
+
* @default []
|
|
421
435
|
*/
|
|
422
436
|
exclude?: string[];
|
|
437
|
+
/**
|
|
438
|
+
* Exclude convention files from being converted to routes
|
|
439
|
+
* @default ['**\/_[^_]*']
|
|
440
|
+
*/
|
|
441
|
+
excludeConvention?: string[];
|
|
423
442
|
/**
|
|
424
443
|
* use links without .html files
|
|
444
|
+
* @default false
|
|
425
445
|
*/
|
|
426
446
|
cleanUrls?: boolean;
|
|
427
447
|
}
|
|
@@ -476,6 +496,7 @@ declare interface RspressPlugin {
|
|
|
476
496
|
addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
|
|
477
497
|
/**
|
|
478
498
|
* Add runtime modules
|
|
499
|
+
* @deprecated use [rsbuild-plugin-virtual-module](https://github.com/rspack-contrib/rsbuild-plugin-virtual-module) instead.
|
|
479
500
|
*/
|
|
480
501
|
addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
|
|
481
502
|
/**
|
|
@@ -486,14 +507,6 @@ declare interface RspressPlugin {
|
|
|
486
507
|
* Callback after routeService generated
|
|
487
508
|
*/
|
|
488
509
|
routeServiceGenerated?: (routeService: any, isProd: boolean) => Promise<void> | void;
|
|
489
|
-
/**
|
|
490
|
-
* Add addition ssg routes, for dynamic routes.
|
|
491
|
-
*/
|
|
492
|
-
addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
|
|
493
|
-
path: string;
|
|
494
|
-
}[] | Promise<{
|
|
495
|
-
path: string;
|
|
496
|
-
}[]>;
|
|
497
510
|
/**
|
|
498
511
|
* @private
|
|
499
512
|
* Modify search index data.
|
|
@@ -508,7 +521,7 @@ declare interface SearchHooks {
|
|
|
508
521
|
searchHooks?: string;
|
|
509
522
|
}
|
|
510
523
|
|
|
511
|
-
declare type SearchOptions = LocalSearchOptions |
|
|
524
|
+
declare type SearchOptions = LocalSearchOptions | false;
|
|
512
525
|
|
|
513
526
|
declare interface Sidebar {
|
|
514
527
|
[path: string]: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
|
|
@@ -522,7 +535,7 @@ declare interface SidebarGroup {
|
|
|
522
535
|
text: string;
|
|
523
536
|
link?: string;
|
|
524
537
|
tag?: string;
|
|
525
|
-
items: (
|
|
538
|
+
items: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
|
|
526
539
|
collapsible?: boolean;
|
|
527
540
|
collapsed?: boolean;
|
|
528
541
|
/**
|
|
@@ -556,7 +569,7 @@ declare interface SocialLink {
|
|
|
556
569
|
content: string;
|
|
557
570
|
}
|
|
558
571
|
|
|
559
|
-
declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | {
|
|
572
|
+
declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | 'npm' | {
|
|
560
573
|
svg: string;
|
|
561
574
|
};
|
|
562
575
|
|
|
@@ -586,7 +599,7 @@ declare interface UserConfig<ThemeConfig = Config> {
|
|
|
586
599
|
/**
|
|
587
600
|
* Path to html icon file.
|
|
588
601
|
*/
|
|
589
|
-
icon?: string;
|
|
602
|
+
icon?: string | URL;
|
|
590
603
|
/**
|
|
591
604
|
* Default language of the site.
|
|
592
605
|
*/
|
|
@@ -658,20 +671,29 @@ declare interface UserConfig<ThemeConfig = Config> {
|
|
|
658
671
|
*/
|
|
659
672
|
search?: SearchOptions;
|
|
660
673
|
/**
|
|
661
|
-
* Whether to enable ssg
|
|
674
|
+
* Whether to enable ssg
|
|
675
|
+
* @default true
|
|
662
676
|
*/
|
|
663
|
-
ssg?: boolean
|
|
677
|
+
ssg?: boolean | {
|
|
678
|
+
/**
|
|
679
|
+
* After enabled, you can use worker to accelerate the SSG process and reduce memory usage. It is suitable for large document sites and is based on [tinypool](https://github.com/tinylibs/tinypool).
|
|
680
|
+
* @default false
|
|
681
|
+
*/
|
|
682
|
+
experimentalWorker?: boolean;
|
|
683
|
+
/**
|
|
684
|
+
* After enabled, some pages will not be rendered by SSG, and they will directly use html under CSR. This is suitable for SSG errors in large document sites bypassing a small number of pages. It is not recommended to enable this option actively.
|
|
685
|
+
* @default []
|
|
686
|
+
*/
|
|
687
|
+
experimentalExcludeRoutePaths?: (string | RegExp)[];
|
|
688
|
+
};
|
|
664
689
|
/**
|
|
665
|
-
* Whether to enable medium-zoom
|
|
690
|
+
* Whether to enable medium-zoom
|
|
691
|
+
* @default true
|
|
666
692
|
*/
|
|
667
693
|
mediumZoom?: boolean | {
|
|
668
694
|
selector?: string;
|
|
669
695
|
options?: ZoomOptions;
|
|
670
696
|
};
|
|
671
|
-
/**
|
|
672
|
-
* Add some extra builder plugins
|
|
673
|
-
*/
|
|
674
|
-
builderPlugins?: RsbuildPlugin[];
|
|
675
697
|
/**
|
|
676
698
|
* Multi version config
|
|
677
699
|
*/
|
package/dist/node-utils.js
CHANGED
|
@@ -1,36 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import gray_matter from "gray-matter";
|
|
4
|
+
import { logger } from "@rsbuild/core";
|
|
4
5
|
const extractTextAndId = (title)=>{
|
|
5
6
|
if (!title) return [
|
|
6
7
|
'',
|
|
7
8
|
''
|
|
8
9
|
];
|
|
9
10
|
const customIdReg = /\\?{#.*}/;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
if (customIdReg.test(title)) {
|
|
12
|
+
const text = title.replace(customIdReg, '').trimEnd();
|
|
13
|
+
const customId = title.match(customIdReg)?.[0]?.slice(2, -1) || '';
|
|
14
|
+
return [
|
|
15
|
+
text,
|
|
16
|
+
customId
|
|
17
|
+
];
|
|
18
|
+
}
|
|
12
19
|
return [
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
title,
|
|
21
|
+
''
|
|
15
22
|
];
|
|
16
23
|
};
|
|
24
|
+
function getIconUrlPath(icon) {
|
|
25
|
+
if (!icon) return;
|
|
26
|
+
icon = icon.toString();
|
|
27
|
+
if (icon.startsWith('file://')) icon = fileURLToPath(icon);
|
|
28
|
+
if (!node_path.isAbsolute(icon)) return icon;
|
|
29
|
+
return `/${node_path.basename(icon)}`;
|
|
30
|
+
}
|
|
17
31
|
function getNodeAttribute(node, attrName, attribute) {
|
|
18
32
|
const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
|
|
19
33
|
return attribute ? found : found?.value;
|
|
20
34
|
}
|
|
21
35
|
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
|
22
36
|
try {
|
|
23
|
-
const { content, data } = (
|
|
37
|
+
const { content, data } = gray_matter(source);
|
|
38
|
+
const rawFrontMatter = source.slice(0, source.length - content.length);
|
|
39
|
+
const emptyLinesSource = rawFrontMatter.length ? `${rawFrontMatter.replace(/[^\n]/g, '')}${content}` : content;
|
|
24
40
|
return {
|
|
25
41
|
content,
|
|
26
|
-
frontmatter: data
|
|
42
|
+
frontmatter: data,
|
|
43
|
+
emptyLinesSource
|
|
27
44
|
};
|
|
28
45
|
} catch (e) {
|
|
29
|
-
if (outputWarning)
|
|
46
|
+
if (outputWarning) logger.warn(`Parse frontmatter error in ${node_path.relative(root, filepath)}: \n`, e);
|
|
30
47
|
}
|
|
31
48
|
return {
|
|
32
49
|
content: '',
|
|
33
|
-
frontmatter: {}
|
|
50
|
+
frontmatter: {},
|
|
51
|
+
emptyLinesSource: source
|
|
34
52
|
};
|
|
35
53
|
}
|
|
36
54
|
const castArray = (value)=>Array.isArray(value) ? value : [
|
|
@@ -50,4 +68,4 @@ const mergeDocConfig = async (...configs)=>{
|
|
|
50
68
|
];
|
|
51
69
|
});
|
|
52
70
|
};
|
|
53
|
-
export { extractTextAndId, getNodeAttribute, loadFrontMatter, mergeDocConfig };
|
|
71
|
+
export { extractTextAndId, getIconUrlPath, getNodeAttribute, loadFrontMatter, mergeDocConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/shared",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.30",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/web-infra-dev/rspress.git",
|
|
@@ -32,31 +32,32 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rsbuild/core": "1.3
|
|
35
|
+
"@rsbuild/core": "~1.5.3",
|
|
36
|
+
"@shikijs/rehype": "^3.12.0",
|
|
36
37
|
"gray-matter": "4.0.3",
|
|
37
38
|
"lodash-es": "^4.17.21",
|
|
38
39
|
"unified": "^11.0.5"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@rslib/core": "0.
|
|
42
|
+
"@rslib/core": "0.12.4",
|
|
42
43
|
"@types/jest": "~29.5.14",
|
|
43
44
|
"@types/lodash-es": "^4.17.12",
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"@types/react": "^
|
|
45
|
+
"@types/node": "^22.8.1",
|
|
46
|
+
"@types/react": "^19.1.12",
|
|
46
47
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
47
48
|
"medium-zoom": "1.1.0",
|
|
48
49
|
"rimraf": "^6.0.1",
|
|
49
|
-
"rsbuild-plugin-publint": "^0.3.
|
|
50
|
+
"rsbuild-plugin-publint": "^0.3.3",
|
|
50
51
|
"typescript": "^5.8.2"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public",
|
|
54
|
-
"provenance": true,
|
|
55
55
|
"registry": "https://registry.npmjs.org/"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "rslib build",
|
|
59
59
|
"build:watch": "rslib build -w",
|
|
60
|
+
"dev": "rslib build -w",
|
|
60
61
|
"reset": "rimraf ./**/node_modules"
|
|
61
62
|
}
|
|
62
63
|
}
|