@rspress/shared 0.0.0-next-20231108104528 → 0.0.0-next-20231113024827

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
@@ -672,6 +672,7 @@ declare const isProduction: () => boolean;
672
672
  declare const isDebugMode: () => boolean;
673
673
  declare const cleanUrl: (url: string) => string;
674
674
  declare function slash(str: string): string;
675
+ declare function removeHash(str: string): string;
675
676
  declare function normalizePosixPath(id: string): string;
676
677
  declare const inBrowser: () => boolean;
677
678
  declare function addLeadingSlash(url: string): string;
@@ -708,4 +709,4 @@ declare function removeBase(url: string, base: string): string;
708
709
  declare function withoutHash(url: string): string;
709
710
  declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
710
711
 
711
- export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarDivider, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
712
+ export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarDivider, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, 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
@@ -41,6 +41,7 @@ __export(src_exports, {
41
41
  omit: () => omit,
42
42
  parseUrl: () => parseUrl,
43
43
  removeBase: () => removeBase,
44
+ removeHash: () => removeHash,
44
45
  removeLeadingSlash: () => removeLeadingSlash,
45
46
  removeTrailingSlash: () => removeTrailingSlash,
46
47
  replaceLang: () => replaceLang,
@@ -1122,6 +1123,9 @@ var cleanUrl = (url) => url.replace(HASH_REGEXP, "").replace(QUERY_REGEXP, "");
1122
1123
  function slash(str) {
1123
1124
  return str.replace(/\\/g, "/");
1124
1125
  }
1126
+ function removeHash(str) {
1127
+ return str.replace(/#.*$/, "");
1128
+ }
1125
1129
  function normalizePosixPath(id) {
1126
1130
  const path = slash(id);
1127
1131
  const isAbsolutePath = path.startsWith("/");
@@ -1170,6 +1174,9 @@ function replaceLang(rawUrl, lang, version, base = "") {
1170
1174
  if (!url) {
1171
1175
  url = "/index.html";
1172
1176
  }
1177
+ if (url.endsWith("/")) {
1178
+ url += "index.html";
1179
+ }
1173
1180
  let versionPart = "";
1174
1181
  let langPart = "";
1175
1182
  let purePathPart = "";
@@ -1308,6 +1315,7 @@ var mergeDocConfig = (...configs) => mergeWith_default({}, ...configs, (target,
1308
1315
  omit,
1309
1316
  parseUrl,
1310
1317
  removeBase,
1318
+ removeHash,
1311
1319
  removeLeadingSlash,
1312
1320
  removeTrailingSlash,
1313
1321
  replaceLang,
package/dist/index.mjs CHANGED
@@ -1067,6 +1067,9 @@ var cleanUrl = (url) => url.replace(HASH_REGEXP, "").replace(QUERY_REGEXP, "");
1067
1067
  function slash(str) {
1068
1068
  return str.replace(/\\/g, "/");
1069
1069
  }
1070
+ function removeHash(str) {
1071
+ return str.replace(/#.*$/, "");
1072
+ }
1070
1073
  function normalizePosixPath(id) {
1071
1074
  const path = slash(id);
1072
1075
  const isAbsolutePath = path.startsWith("/");
@@ -1115,6 +1118,9 @@ function replaceLang(rawUrl, lang, version, base = "") {
1115
1118
  if (!url) {
1116
1119
  url = "/index.html";
1117
1120
  }
1121
+ if (url.endsWith("/")) {
1122
+ url += "index.html";
1123
+ }
1118
1124
  let versionPart = "";
1119
1125
  let langPart = "";
1120
1126
  let purePathPart = "";
@@ -1252,6 +1258,7 @@ export {
1252
1258
  omit,
1253
1259
  parseUrl,
1254
1260
  removeBase,
1261
+ removeHash,
1255
1262
  removeLeadingSlash,
1256
1263
  removeTrailingSlash,
1257
1264
  replaceLang,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "0.0.0-next-20231108104528",
3
+ "version": "0.0.0-next-20231113024827",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",