@rspress/shared 0.0.0-next-20240620083724 → 0.0.0-next-20241029080927

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 CHANGED
@@ -179,7 +179,7 @@ interface Config$1 {
179
179
  docFooter?: DocFooter;
180
180
  /**
181
181
  * The social links to be displayed at the end of the nav bar. Perfect for
182
- * placing links to social services such as GitHub, Twitter, Facebook, etc.
182
+ * placing links to social services such as GitHub, X, Facebook, etc.
183
183
  */
184
184
  socialLinks?: SocialLink[];
185
185
  /**
@@ -218,14 +218,22 @@ interface Config$1 {
218
218
  * The text of suggested query text when no search result
219
219
  */
220
220
  searchSuggestedQueryText?: string;
221
+ /**
222
+ * The text of overview filter
223
+ */
224
+ overview?: FilterConfig;
221
225
  /**
222
226
  * The behavior of hiding navbar
223
227
  */
224
228
  hideNavbar?: 'always' | 'auto' | 'never';
225
229
  /**
226
- * Whether to enable the animation for translation pages
230
+ * Whether to enable view transition animation for pages switching
227
231
  */
228
232
  enableContentAnimation?: boolean;
233
+ /**
234
+ * Whether to enable view transition animation for the theme
235
+ */
236
+ enableAppearanceAnimation?: boolean;
229
237
  /**
230
238
  * Enable scroll to top button on documentation
231
239
  * @default false
@@ -264,6 +272,15 @@ interface LocaleConfig {
264
272
  searchPlaceholderText?: string;
265
273
  searchNoResultsText?: string;
266
274
  searchSuggestedQueryText?: string;
275
+ overview?: FilterConfig;
276
+ }
277
+ /**
278
+ * The config of filter component
279
+ */
280
+ interface FilterConfig {
281
+ filterNameText?: string;
282
+ filterPlaceholderText?: string;
283
+ filterNoResultText?: string;
267
284
  }
268
285
  type Nav = NavItem[] | {
269
286
  [key: string]: NavItem[];
@@ -356,7 +373,7 @@ interface SocialLink {
356
373
  mode: 'link' | 'text' | 'img' | 'dom';
357
374
  content: string;
358
375
  }
359
- type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'twitter' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | {
376
+ type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | {
360
377
  svg: string;
361
378
  };
362
379
  interface Footer {
@@ -417,6 +434,9 @@ interface Locale {
417
434
  title?: string;
418
435
  description?: string;
419
436
  }
437
+ type SSGConfig = boolean | {
438
+ strict?: boolean;
439
+ };
420
440
  interface UserConfig<ThemeConfig = Config$1> {
421
441
  /**
422
442
  * The root directory of the site.
@@ -512,7 +532,7 @@ interface UserConfig<ThemeConfig = Config$1> {
512
532
  /**
513
533
  * Whether to enable ssg, default is true
514
534
  */
515
- ssg?: boolean;
535
+ ssg?: SSGConfig;
516
536
  /**
517
537
  * Whether to enable medium-zoom, default is true
518
538
  */
@@ -538,7 +558,10 @@ interface UserConfig<ThemeConfig = Config$1> {
538
558
  versions: string[];
539
559
  };
540
560
  }
541
- type BaseRuntimePageInfo = Omit<PageIndexInfo, 'id' | 'content' | 'domain'>;
561
+ type RemoveUnderscoreProps<T> = {
562
+ [K in keyof T as K extends `_${string}` ? never : K]: T[K];
563
+ };
564
+ type BaseRuntimePageInfo = Omit<RemoveUnderscoreProps<PageIndexInfo>, 'id' | 'content' | 'domain'>;
542
565
  interface SiteData<ThemeConfig = NormalizedConfig> {
543
566
  root: string;
544
567
  base: string;
@@ -570,12 +593,18 @@ interface SiteData<ThemeConfig = NormalizedConfig> {
570
593
  versions: string[];
571
594
  };
572
595
  }
596
+ /**
597
+ * @description search-index.json file
598
+ * "_foo" is the private field that won't be written to search-index.json file
599
+ * and should not be used in the runtime (usePageData).
600
+ */
573
601
  type PageIndexInfo = {
574
602
  id: number;
575
603
  title: string;
576
604
  routePath: string;
577
605
  toc: Header[];
578
606
  content: string;
607
+ _html: string;
579
608
  frontmatter: Record<string, unknown>;
580
609
  lang: string;
581
610
  version: string;
@@ -651,7 +680,6 @@ interface PageData {
651
680
  lastUpdatedTime?: string;
652
681
  description?: string;
653
682
  pageType: PageType;
654
- _relativePath: string;
655
683
  [key: string]: unknown;
656
684
  };
657
685
  }
@@ -791,4 +819,4 @@ declare function removeBase(url: string, base: string): string;
791
819
  declare function withoutHash(url: string): string;
792
820
  declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
793
821
 
794
- 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 };
822
+ export { APPEARANCE_KEY, type AdditionalPage, type BaseRuntimePageInfo, type Config, DEFAULT_HIGHLIGHT_LANGUAGES, type Config$1 as DefaultThemeConfig, type DocFooter, type EditLink, type Feature, type FilterConfig, 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 SSGConfig, 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/dist/index.js CHANGED
@@ -1128,7 +1128,13 @@ var DEFAULT_HIGHLIGHT_LANGUAGES = [
1128
1128
  ];
1129
1129
  var isSCM = () => Boolean(process.env.BUILD_VERSION);
1130
1130
  var isProduction = () => process.env.NODE_ENV === "production";
1131
- var isDebugMode = () => Boolean(process.env.DOC_DEBUG);
1131
+ var isDebugMode = () => {
1132
+ if (!process.env.DEBUG) {
1133
+ return false;
1134
+ }
1135
+ const values = process.env.DEBUG?.toLocaleLowerCase().split(",") ?? [];
1136
+ return ["rsbuild", "builder", "*"].some((key) => values.includes(key));
1137
+ };
1132
1138
  var cleanUrl = (url) => url.replace(HASH_REGEXP, "").replace(QUERY_REGEXP, "");
1133
1139
  function slash(str) {
1134
1140
  return str.replace(/\\/g, "/");
package/dist/index.mjs CHANGED
@@ -1070,7 +1070,13 @@ var DEFAULT_HIGHLIGHT_LANGUAGES = [
1070
1070
  ];
1071
1071
  var isSCM = () => Boolean(process.env.BUILD_VERSION);
1072
1072
  var isProduction = () => process.env.NODE_ENV === "production";
1073
- var isDebugMode = () => Boolean(process.env.DOC_DEBUG);
1073
+ var isDebugMode = () => {
1074
+ if (!process.env.DEBUG) {
1075
+ return false;
1076
+ }
1077
+ const values = process.env.DEBUG?.toLocaleLowerCase().split(",") ?? [];
1078
+ return ["rsbuild", "builder", "*"].some((key) => values.includes(key));
1079
+ };
1074
1080
  var cleanUrl = (url) => url.replace(HASH_REGEXP, "").replace(QUERY_REGEXP, "");
1075
1081
  function slash(str) {
1076
1082
  return str.replace(/\\/g, "/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "0.0.0-next-20240620083724",
3
+ "version": "0.0.0-next-20241029080927",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -42,8 +42,8 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@rsbuild/core": "0.7.8",
46
- "chalk": "4.1.2",
45
+ "@rsbuild/core": "~1.0.18",
46
+ "chalk": "5.3.0",
47
47
  "execa": "5.1.1",
48
48
  "fs-extra": "11.2.0",
49
49
  "gray-matter": "4.0.3",
@@ -51,18 +51,18 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/fs-extra": "11.0.4",
54
- "@types/interpret": "^1.1.1",
55
- "@types/jest": "~29.5.12",
56
- "@types/lodash": "^4.17.0",
57
- "@types/lodash-es": "^4.17.8",
54
+ "@types/interpret": "^1.1.3",
55
+ "@types/jest": "~29.5.14",
56
+ "@types/lodash": "^4.17.12",
57
+ "@types/lodash-es": "^4.17.12",
58
58
  "@types/node": "^18.11.17",
59
- "@types/react": "^18",
60
- "@types/rechoir": "^0.6.1",
59
+ "@types/react": "^18.3.12",
60
+ "@types/rechoir": "^0.6.4",
61
61
  "lodash-es": "^4.17.21",
62
62
  "medium-zoom": "1.1.0",
63
63
  "rimraf": "^3.0.2",
64
- "ts-node": "^10.9.1",
65
- "typescript": "^5"
64
+ "ts-node": "^10.9.2",
65
+ "typescript": "^5.5.3"
66
66
  },
67
67
  "sideEffects": [],
68
68
  "publishConfig": {