@rspress/shared 0.0.0-next-20240407073144 → 0.0.0-next-20240415093056

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 +93 -87
  2. package/package.json +15 -15
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.
@@ -201,7 +284,6 @@ type Image = string | {
201
284
  src: string;
202
285
  alt?: string;
203
286
  };
204
- type OverViewDepth = 'h1' | 'h2';
205
287
  interface Sidebar {
206
288
  [path: string]: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
207
289
  }
@@ -216,7 +298,7 @@ interface SidebarGroup {
216
298
  * For hmr usage in development
217
299
  */
218
300
  _fileKey?: string;
219
- overviewDepth?: OverViewDepth;
301
+ overviewHeaders?: number[];
220
302
  }
221
303
  type SidebarItem = {
222
304
  text: string;
@@ -226,7 +308,7 @@ type SidebarItem = {
226
308
  * For hmr usage in development
227
309
  */
228
310
  _fileKey?: string;
229
- overviewDepth?: OverViewDepth;
311
+ overviewHeaders?: number[];
230
312
  };
231
313
  type SidebarDivider = {
232
314
  dividerType: 'dashed' | 'solid';
@@ -292,89 +374,6 @@ interface NormalizedConfig extends Omit<Config$1, 'locales' | 'sidebar'> {
292
374
  sidebar: NormalizedSidebar;
293
375
  }
294
376
 
295
- /**
296
- * There are two ways to define what addtion routes represent.
297
- * 1. Define filepath, then the content will be read from the file.
298
- * 2. Define content, then then content will be written to temp file and read from it.
299
- */
300
- interface AdditionalPage {
301
- routePath: string;
302
- content?: string;
303
- filepath?: string;
304
- }
305
- interface RspressPlugin {
306
- /**
307
- * Name of the plugin.
308
- */
309
- name: string;
310
- /**
311
- * Global style
312
- */
313
- globalStyles?: string;
314
- /**
315
- * Markdown options.
316
- */
317
- markdown?: {
318
- remarkPlugins?: PluggableList;
319
- rehypePlugins?: PluggableList;
320
- globalComponents?: string[];
321
- };
322
- /**
323
- * Rsbuild config.
324
- */
325
- builderConfig?: RsbuildConfig;
326
- /**
327
- * Inject global components.
328
- */
329
- globalUIComponents?: (string | [string, object])[];
330
- /**
331
- * Modify doc config.
332
- */
333
- config?: (config: UserConfig, utils: {
334
- addPlugin: (plugin: RspressPlugin) => void;
335
- removePlugin: (pluginName: string) => void;
336
- }, isProd: boolean) => UserConfig | Promise<UserConfig>;
337
- /**
338
- * Callback before build
339
- */
340
- beforeBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
341
- /**
342
- * Callback after build
343
- */
344
- afterBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
345
- /**
346
- * Extend every page's data
347
- */
348
- extendPageData?: (pageData: PageIndexInfo & {
349
- [key: string]: unknown;
350
- }, isProd: boolean) => void | Promise<void>;
351
- /**
352
- * Add custom route
353
- */
354
- addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
355
- /**
356
- * Add runtime modules
357
- */
358
- addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
359
- /**
360
- * Callback after route generated
361
- */
362
- routeGenerated?: (routes: RouteMeta[], isProd: boolean) => Promise<void> | void;
363
- /**
364
- * Add addition ssg routes, for dynamic routes.
365
- */
366
- addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
367
- path: string;
368
- }[] | Promise<{
369
- path: string;
370
- }[]>;
371
- /**
372
- * @private
373
- * Modify search index data.
374
- */
375
- modifySearchIndexData?: (data: PageIndexInfo[], isProd: boolean) => void | Promise<void>;
376
- }
377
-
378
377
  interface Route {
379
378
  path: string;
380
379
  element: React.ReactElement;
@@ -587,6 +586,12 @@ interface Hero {
587
586
  image?: {
588
587
  src: string;
589
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[];
590
595
  };
591
596
  actions: {
592
597
  text: string;
@@ -618,6 +623,7 @@ interface FrontMatterMeta {
618
623
  sidebar?: boolean;
619
624
  outline?: boolean;
620
625
  lineNumbers?: boolean;
626
+ overviewHeaders?: number;
621
627
  }
622
628
  interface PageData {
623
629
  siteData: SiteData<Config$1>;
@@ -761,4 +767,4 @@ declare function removeBase(url: string, base: string): string;
761
767
  declare function withoutHash(url: string): string;
762
768
  declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
763
769
 
764
- export { APPEARANCE_KEY, type AdditionalPage, type BaseRuntimePageInfo, type Config, DEFAULT_HIGHLIGHT_LANGUAGES, type Config$1 as DefaultThemeConfig, type DocFooter, type EditLink, type Feature, type Footer, type FrontMatterMeta, HASH_REGEXP, type Header, type Hero, type Image, type LocalSearchOptions, type Locale, type LocaleConfig, type LocaleLink, type LocaleLinks, MDX_REGEXP, type MarkdownOptions, type MdxRsOptions, type Nav, type NavItem, type NavItemWithChildren, type NavItemWithLink, type NavItemWithLinkAndChildren, type NormalizedConfig, type NormalizedConfig as NormalizedDefaultThemeConfig, type NormalizedLocales, type NormalizedSidebar, type NormalizedSidebarGroup, type OverViewDepth, type PageData, type PageIndexInfo, type PageModule, type PageType, type RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, type RemotePageInfo, type RemoteSearchIndexInfo, type RemoteSearchOptions, type ReplaceRule, type Route, type RouteMeta, type RouteOptions, type RspressPlugin, SEARCH_INDEX_NAME, type SearchHooks, type SearchOptions, type Sidebar, type SidebarDivider, type SidebarGroup, type SidebarItem, type SidebarSectionHeader, type SiteData, type SocialLink, type SocialLinkIcon, type UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDataUrl, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
770
+ export { APPEARANCE_KEY, type AdditionalPage, type BaseRuntimePageInfo, type Config, DEFAULT_HIGHLIGHT_LANGUAGES, type Config$1 as DefaultThemeConfig, type DocFooter, type EditLink, type Feature, type Footer, type FrontMatterMeta, HASH_REGEXP, type Header, type Hero, type Image, type LocalSearchOptions, type Locale, type LocaleConfig, type LocaleLink, type LocaleLinks, MDX_REGEXP, type MarkdownOptions, type MdxRsOptions, type Nav, type NavItem, type NavItemWithChildren, type NavItemWithLink, type NavItemWithLinkAndChildren, type NormalizedConfig, type NormalizedConfig as NormalizedDefaultThemeConfig, type NormalizedLocales, type NormalizedSidebar, type NormalizedSidebarGroup, type PageData, type PageIndexInfo, type PageModule, type PageType, type RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, type RemotePageInfo, type RemoteSearchIndexInfo, type RemoteSearchOptions, type ReplaceRule, type Route, type RouteMeta, type RouteOptions, type RspressPlugin, SEARCH_INDEX_NAME, type SearchHooks, type SearchOptions, type Sidebar, type SidebarDivider, type SidebarGroup, type SidebarItem, type SidebarSectionHeader, type SiteData, type SocialLink, type SocialLinkIcon, type UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDataUrl, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "0.0.0-next-20240407073144",
3
+ "version": "0.0.0-next-20240415093056",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -11,38 +11,38 @@
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": {
45
- "@rsbuild/core": "0.5.1",
45
+ "@rsbuild/core": "0.6.1",
46
46
  "unified": "10.1.2",
47
47
  "chalk": "4.1.2",
48
48
  "execa": "5.1.1",
@@ -53,7 +53,7 @@
53
53
  "lodash-es": "^4.17.21",
54
54
  "@types/interpret": "^1.1.1",
55
55
  "@types/jest": "~29.2.4",
56
- "@types/lodash": "^4.14.197",
56
+ "@types/lodash": "^4.17.0",
57
57
  "@types/lodash-es": "^4.17.8",
58
58
  "@types/node": "~16.11.7",
59
59
  "@types/react": "~18.0.26",