@rspress/shared 1.37.4 → 1.39.0

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.
@@ -244,6 +244,11 @@ interface Config$1 {
244
244
  * @default 'auto'
245
245
  */
246
246
  localeRedirect?: 'auto' | 'never';
247
+ /**
248
+ * Whether to show the fallback heading title when the heading title is not presented but `frontmatter.title` exists
249
+ * @default true
250
+ */
251
+ fallbackHeadingTitle?: boolean;
247
252
  }
248
253
  /**
249
254
  * locale config
@@ -440,6 +445,7 @@ type SSGConfig = boolean | {
440
445
  interface UserConfig<ThemeConfig = Config$1> {
441
446
  /**
442
447
  * The root directory of the site.
448
+ * @default 'docs'
443
449
  */
444
450
  root?: string;
445
451
  /**
@@ -451,10 +457,12 @@ interface UserConfig<ThemeConfig = Config$1> {
451
457
  };
452
458
  /**
453
459
  * The text of the logo in nav bar.
460
+ * @default ''
454
461
  */
455
462
  logoText?: string;
456
463
  /**
457
464
  * Base path of the site.
465
+ * @default '/'
458
466
  */
459
467
  base?: string;
460
468
  /**
@@ -462,15 +470,17 @@ interface UserConfig<ThemeConfig = Config$1> {
462
470
  */
463
471
  icon?: string;
464
472
  /**
465
- * Language of the site.
473
+ * Default language of the site.
466
474
  */
467
475
  lang?: string;
468
476
  /**
469
477
  * Title of the site.
478
+ * @default 'Rspress'
470
479
  */
471
480
  title?: string;
472
481
  /**
473
482
  * Description of the site.
483
+ * @default ''
474
484
  */
475
485
  description?: string;
476
486
  /**
@@ -676,6 +686,7 @@ interface FrontMatterMeta {
676
686
  interface PageData {
677
687
  siteData: SiteData<Config$1>;
678
688
  page: BaseRuntimePageInfo & {
689
+ headingTitle?: string;
679
690
  pagePath: string;
680
691
  lastUpdatedTime?: string;
681
692
  description?: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AdditionalPage, B as BaseRuntimePageInfo, r as Config, C as DefaultThemeConfig, O as DocFooter, K as EditLink, F as Feature, t as FilterConfig, V as Footer, i as FrontMatterMeta, H as Header, f as Hero, I as Image, m as LocalSearchOptions, L as Locale, s as LocaleConfig, X as LocaleLink, W as LocaleLinks, q as MarkdownOptions, M as MdxRsOptions, u as Nav, v as NavItem, x as NavItemWithChildren, w as NavItemWithLink, y as NavItemWithLinkAndChildren, N as NormalizedConfig, N as NormalizedDefaultThemeConfig, _ as NormalizedLocales, Z as NormalizedSidebar, Y as NormalizedSidebarGroup, j as PageData, P as PageIndexInfo, g as PageModule, h as PageType, R as Plugin, e as RemotePageInfo, n as RemoteSearchIndexInfo, o as RemoteSearchOptions, c as ReplaceRule, a as Route, b as RouteMeta, k as RouteOptions, R as RspressPlugin, S as SSGConfig, l as SearchHooks, p as SearchOptions, z as Sidebar, G as SidebarDivider, D as SidebarGroup, E as SidebarItem, J as SidebarSectionHeader, d as SiteData, Q as SocialLink, T as SocialLinkIcon, U as UserConfig } from './index-37dfa72c.js';
1
+ export { A as AdditionalPage, B as BaseRuntimePageInfo, r as Config, C as DefaultThemeConfig, O as DocFooter, K as EditLink, F as Feature, t as FilterConfig, V as Footer, i as FrontMatterMeta, H as Header, f as Hero, I as Image, m as LocalSearchOptions, L as Locale, s as LocaleConfig, X as LocaleLink, W as LocaleLinks, q as MarkdownOptions, M as MdxRsOptions, u as Nav, v as NavItem, x as NavItemWithChildren, w as NavItemWithLink, y as NavItemWithLinkAndChildren, N as NormalizedConfig, N as NormalizedDefaultThemeConfig, _ as NormalizedLocales, Z as NormalizedSidebar, Y as NormalizedSidebarGroup, j as PageData, P as PageIndexInfo, g as PageModule, h as PageType, R as Plugin, e as RemotePageInfo, n as RemoteSearchIndexInfo, o as RemoteSearchOptions, c as ReplaceRule, a as Route, b as RouteMeta, k as RouteOptions, R as RspressPlugin, S as SSGConfig, l as SearchHooks, p as SearchOptions, z as Sidebar, G as SidebarDivider, D as SidebarGroup, E as SidebarItem, J as SidebarSectionHeader, d as SiteData, Q as SocialLink, T as SocialLinkIcon, U as UserConfig } from './index-0b471bb1.js';
2
2
  import '@rsbuild/core';
3
3
  import 'unified';
4
4
 
@@ -44,8 +44,8 @@ declare const parseUrl: (url: string) => {
44
44
  };
45
45
  declare function normalizeHref(url?: string, cleanUrls?: boolean): string;
46
46
  declare function withoutLang(path: string, langs: string[]): string;
47
- declare function withoutBase(path: string, base?: string): string;
48
- declare function withBase(url?: string, base?: string): string;
47
+ declare function withoutBase(path: string, base: string): string;
48
+ declare function withBase(url: string, base: string): string;
49
49
  declare function removeBase(url: string, base: string): string;
50
50
 
51
51
  export { APPEARANCE_KEY, DEFAULT_HIGHLIGHT_LANGUAGES, HASH_REGEXP, MDX_REGEXP, QUERY_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDataUrl, isDebugMode, isDevDebugMode, isExternalUrl, isProduction, isSCM, normalizeHref, normalizePosixPath, normalizeSlash, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutLang };
package/dist/index.js CHANGED
@@ -223,10 +223,10 @@ function withoutLang(path, langs) {
223
223
  const langRegexp = new RegExp(`^\\/(${langs.join("|")})`);
224
224
  return addLeadingSlash(path.replace(langRegexp, ""));
225
225
  }
226
- function withoutBase(path, base = "") {
226
+ function withoutBase(path, base) {
227
227
  return addLeadingSlash(path).replace(normalizeSlash(base), "");
228
228
  }
229
- function withBase(url = "/", base = "") {
229
+ function withBase(url, base) {
230
230
  const normalizedUrl = addLeadingSlash(url);
231
231
  const normalizedBase = normalizeSlash(base);
232
232
  return normalizedUrl.startsWith(normalizedBase) ? normalizedUrl : `${normalizedBase}${normalizedUrl}`;
package/dist/index.mjs CHANGED
@@ -167,10 +167,10 @@ function withoutLang(path, langs) {
167
167
  const langRegexp = new RegExp(`^\\/(${langs.join("|")})`);
168
168
  return addLeadingSlash(path.replace(langRegexp, ""));
169
169
  }
170
- function withoutBase(path, base = "") {
170
+ function withoutBase(path, base) {
171
171
  return addLeadingSlash(path).replace(normalizeSlash(base), "");
172
172
  }
173
- function withBase(url = "/", base = "") {
173
+ function withBase(url, base) {
174
174
  const normalizedUrl = addLeadingSlash(url);
175
175
  const normalizedBase = normalizeSlash(base);
176
176
  return normalizedUrl.startsWith(normalizedBase) ? normalizedUrl : `${normalizedBase}${normalizedUrl}`;
@@ -1,4 +1,4 @@
1
- import { U as UserConfig } from './index-37dfa72c.js';
1
+ import { U as UserConfig } from './index-0b471bb1.js';
2
2
  import '@rsbuild/core';
3
3
  import 'unified';
4
4
 
@@ -7,6 +7,6 @@ declare function loadFrontMatter<TFrontmatter extends Record<string, unknown> =
7
7
  content: string;
8
8
  };
9
9
 
10
- declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
10
+ declare const mergeDocConfig: (...configs: UserConfig[]) => Promise<UserConfig>;
11
11
 
12
12
  export { loadFrontMatter, mergeDocConfig };
@@ -61,18 +61,20 @@ function loadFrontMatter(source, filepath, root, outputWarning = false) {
61
61
  }
62
62
 
63
63
  // src/node-utils/merge.ts
64
- var import_lodash_es = require("lodash-es");
65
64
  var castArray = (value) => Array.isArray(value) ? value : [value];
66
- var mergeDocConfig = (...configs) => (0, import_lodash_es.mergeWith)({}, ...configs, (target, source) => {
67
- const pair = [target, source];
68
- if (pair.some((item) => item === void 0)) {
65
+ var mergeDocConfig = async (...configs) => {
66
+ const { mergeWith } = await import("lodash-es");
67
+ return mergeWith({}, ...configs, (target, source) => {
68
+ const pair = [target, source];
69
+ if (pair.some((item) => item === void 0)) {
70
+ return void 0;
71
+ }
72
+ if (pair.some((item) => Array.isArray(item))) {
73
+ return [...castArray(target), ...castArray(source)];
74
+ }
69
75
  return void 0;
70
- }
71
- if (pair.some((item) => Array.isArray(item))) {
72
- return [...castArray(target), ...castArray(source)];
73
- }
74
- return void 0;
75
- });
76
+ });
77
+ };
76
78
  // Annotate the CommonJS export names for ESM import in node:
77
79
  0 && (module.exports = {
78
80
  loadFrontMatter,
@@ -24,18 +24,20 @@ function loadFrontMatter(source, filepath, root, outputWarning = false) {
24
24
  }
25
25
 
26
26
  // src/node-utils/merge.ts
27
- import { mergeWith } from "lodash-es";
28
27
  var castArray = (value) => Array.isArray(value) ? value : [value];
29
- var mergeDocConfig = (...configs) => mergeWith({}, ...configs, (target, source) => {
30
- const pair = [target, source];
31
- if (pair.some((item) => item === void 0)) {
28
+ var mergeDocConfig = async (...configs) => {
29
+ const { mergeWith } = await import("lodash-es");
30
+ return mergeWith({}, ...configs, (target, source) => {
31
+ const pair = [target, source];
32
+ if (pair.some((item) => item === void 0)) {
33
+ return void 0;
34
+ }
35
+ if (pair.some((item) => Array.isArray(item))) {
36
+ return [...castArray(target), ...castArray(source)];
37
+ }
32
38
  return void 0;
33
- }
34
- if (pair.some((item) => Array.isArray(item))) {
35
- return [...castArray(target), ...castArray(source)];
36
- }
37
- return void 0;
38
- });
39
+ });
40
+ };
39
41
  export {
40
42
  loadFrontMatter,
41
43
  mergeDocConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "1.37.4",
3
+ "version": "1.39.0",
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": "~1.1.8",
46
- "chalk": "5.3.0",
45
+ "@rsbuild/core": "~1.1.12",
46
+ "chalk": "5.4.1",
47
47
  "execa": "5.1.1",
48
48
  "fs-extra": "11.2.0",
49
49
  "gray-matter": "4.0.3",
@@ -55,7 +55,7 @@
55
55
  "@types/jest": "~29.5.14",
56
56
  "@types/lodash-es": "^4.17.12",
57
57
  "@types/node": "^18.11.17",
58
- "@types/react": "^18.3.12",
58
+ "@types/react": "^18.3.18",
59
59
  "medium-zoom": "1.1.0",
60
60
  "rimraf": "^3.0.2",
61
61
  "typescript": "^5.5.3"