@rspress/shared 0.0.0-nightly-20240101160215 → 0.0.0-nightly-20240102160236
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 +2 -2
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -705,12 +705,12 @@ declare function replaceLang(rawUrl: string, lang: {
|
|
705
705
|
}, version: {
|
706
706
|
current: string;
|
707
707
|
default: string;
|
708
|
-
}, base?: string): string;
|
708
|
+
}, base?: string, cleanUrls?: boolean): string;
|
709
709
|
declare function replaceVersion(rawUrl: string, version: {
|
710
710
|
current: string;
|
711
711
|
target: string;
|
712
712
|
default: string;
|
713
|
-
}, base?: string): string;
|
713
|
+
}, base?: string, cleanUrls?: boolean): string;
|
714
714
|
declare const omit: (obj: Record<string, unknown>, keys: string[]) => {
|
715
715
|
[x: string]: unknown;
|
716
716
|
};
|
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("/")),
|