@rspress/shared 1.9.0 → 1.9.2
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 +10 -4
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -635,6 +635,12 @@ type RemoteSearchOptions = SearchHooks & {
|
|
635
635
|
searchIndexes?: RemoteSearchIndexInfo[];
|
636
636
|
};
|
637
637
|
type SearchOptions = LocalSearchOptions | RemoteSearchOptions | false;
|
638
|
+
interface MdxRsOptions {
|
639
|
+
/**
|
640
|
+
* Determine whether the file use mdxRs compiler
|
641
|
+
*/
|
642
|
+
include?: (filepath: string) => boolean;
|
643
|
+
}
|
638
644
|
interface MarkdownOptions {
|
639
645
|
remarkPlugins?: PluggableList;
|
640
646
|
rehypePlugins?: PluggableList;
|
@@ -662,7 +668,7 @@ interface MarkdownOptions {
|
|
662
668
|
/**
|
663
669
|
* Whether to enable mdx-rs, default is true
|
664
670
|
*/
|
665
|
-
mdxRs?: boolean;
|
671
|
+
mdxRs?: boolean | MdxRsOptions;
|
666
672
|
/**
|
667
673
|
* @deprecated, use `mdxRs` instead
|
668
674
|
*/
|
@@ -699,12 +705,12 @@ declare function replaceLang(rawUrl: string, lang: {
|
|
699
705
|
}, version: {
|
700
706
|
current: string;
|
701
707
|
default: string;
|
702
|
-
}, base?: string): string;
|
708
|
+
}, base?: string, cleanUrls?: boolean): string;
|
703
709
|
declare function replaceVersion(rawUrl: string, version: {
|
704
710
|
current: string;
|
705
711
|
target: string;
|
706
712
|
default: string;
|
707
|
-
}, base?: string): string;
|
713
|
+
}, base?: string, cleanUrls?: boolean): string;
|
708
714
|
declare const omit: (obj: Record<string, unknown>, keys: string[]) => {
|
709
715
|
[x: string]: unknown;
|
710
716
|
};
|
@@ -720,4 +726,4 @@ declare function removeBase(url: string, base: string): string;
|
|
720
726
|
declare function withoutHash(url: string): string;
|
721
727
|
declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
|
722
728
|
|
723
|
-
export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, DEFAULT_HIGHLIGHT_LANGUAGES, 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, isDataUrl, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
|
729
|
+
export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, DEFAULT_HIGHLIGHT_LANGUAGES, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, MdxRsOptions, 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, 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
@@ -1190,13 +1190,13 @@ function isExternalUrl(url = "") {
|
|
1190
1190
|
function isDataUrl(url = "") {
|
1191
1191
|
return /^\s*data:/i.test(url);
|
1192
1192
|
}
|
1193
|
-
function replaceLang(rawUrl, lang, version, base = "") {
|
1193
|
+
function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
|
1194
1194
|
let url = removeBase(rawUrl, base);
|
1195
1195
|
if (!url) {
|
1196
|
-
url = "/index.html";
|
1196
|
+
url = cleanUrls ? "/index" : "/index.html";
|
1197
1197
|
}
|
1198
1198
|
if (url.endsWith("/")) {
|
1199
|
-
url += "index.html";
|
1199
|
+
url += cleanUrls ? "/index" : "/index.html";
|
1200
1200
|
}
|
1201
1201
|
let versionPart = "";
|
1202
1202
|
let langPart = "";
|
@@ -1215,7 +1215,7 @@ function replaceLang(rawUrl, lang, version, base = "") {
|
|
1215
1215
|
}
|
1216
1216
|
purePathPart = parts.join("/") || "";
|
1217
1217
|
if ((versionPart || langPart) && !purePathPart) {
|
1218
|
-
purePathPart = "index.html";
|
1218
|
+
purePathPart = cleanUrls ? "index" : "index.html";
|
1219
1219
|
}
|
1220
1220
|
return withBase(
|
1221
1221
|
addLeadingSlash(
|
@@ -1224,10 +1224,10 @@ function replaceLang(rawUrl, lang, version, base = "") {
|
|
1224
1224
|
base
|
1225
1225
|
);
|
1226
1226
|
}
|
1227
|
-
function replaceVersion(rawUrl, version, base = "") {
|
1227
|
+
function replaceVersion(rawUrl, version, base = "", cleanUrls = false) {
|
1228
1228
|
let url = removeBase(rawUrl, base);
|
1229
1229
|
if (!url) {
|
1230
|
-
url = "/index.html";
|
1230
|
+
url = cleanUrls ? "/index" : "/index.html";
|
1231
1231
|
}
|
1232
1232
|
let versionPart = "";
|
1233
1233
|
const parts = url.split("/").filter(Boolean);
|
@@ -1241,7 +1241,7 @@ function replaceVersion(rawUrl, version, base = "") {
|
|
1241
1241
|
}
|
1242
1242
|
let restPart = parts.join("/") || "";
|
1243
1243
|
if (versionPart && !restPart) {
|
1244
|
-
restPart = "index.html";
|
1244
|
+
restPart = cleanUrls ? "index" : "index.html";
|
1245
1245
|
}
|
1246
1246
|
return withBase(
|
1247
1247
|
addLeadingSlash([versionPart, restPart].filter(Boolean).join("/")),
|
package/dist/index.mjs
CHANGED
@@ -1132,13 +1132,13 @@ function isExternalUrl(url = "") {
|
|
1132
1132
|
function isDataUrl(url = "") {
|
1133
1133
|
return /^\s*data:/i.test(url);
|
1134
1134
|
}
|
1135
|
-
function replaceLang(rawUrl, lang, version, base = "") {
|
1135
|
+
function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
|
1136
1136
|
let url = removeBase(rawUrl, base);
|
1137
1137
|
if (!url) {
|
1138
|
-
url = "/index.html";
|
1138
|
+
url = cleanUrls ? "/index" : "/index.html";
|
1139
1139
|
}
|
1140
1140
|
if (url.endsWith("/")) {
|
1141
|
-
url += "index.html";
|
1141
|
+
url += cleanUrls ? "/index" : "/index.html";
|
1142
1142
|
}
|
1143
1143
|
let versionPart = "";
|
1144
1144
|
let langPart = "";
|
@@ -1157,7 +1157,7 @@ function replaceLang(rawUrl, lang, version, base = "") {
|
|
1157
1157
|
}
|
1158
1158
|
purePathPart = parts.join("/") || "";
|
1159
1159
|
if ((versionPart || langPart) && !purePathPart) {
|
1160
|
-
purePathPart = "index.html";
|
1160
|
+
purePathPart = cleanUrls ? "index" : "index.html";
|
1161
1161
|
}
|
1162
1162
|
return withBase(
|
1163
1163
|
addLeadingSlash(
|
@@ -1166,10 +1166,10 @@ function replaceLang(rawUrl, lang, version, base = "") {
|
|
1166
1166
|
base
|
1167
1167
|
);
|
1168
1168
|
}
|
1169
|
-
function replaceVersion(rawUrl, version, base = "") {
|
1169
|
+
function replaceVersion(rawUrl, version, base = "", cleanUrls = false) {
|
1170
1170
|
let url = removeBase(rawUrl, base);
|
1171
1171
|
if (!url) {
|
1172
|
-
url = "/index.html";
|
1172
|
+
url = cleanUrls ? "/index" : "/index.html";
|
1173
1173
|
}
|
1174
1174
|
let versionPart = "";
|
1175
1175
|
const parts = url.split("/").filter(Boolean);
|
@@ -1183,7 +1183,7 @@ function replaceVersion(rawUrl, version, base = "") {
|
|
1183
1183
|
}
|
1184
1184
|
let restPart = parts.join("/") || "";
|
1185
1185
|
if (versionPart && !restPart) {
|
1186
|
-
restPart = "index.html";
|
1186
|
+
restPart = cleanUrls ? "index" : "index.html";
|
1187
1187
|
}
|
1188
1188
|
return withBase(
|
1189
1189
|
addLeadingSlash([versionPart, restPart].filter(Boolean).join("/")),
|