@rspress/shared 1.19.0 → 1.19.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 CHANGED
@@ -751,12 +751,12 @@ declare function replaceLang(rawUrl: string, lang: {
751
751
  }, version: {
752
752
  current: string;
753
753
  default: string;
754
- }, base?: string, cleanUrls?: boolean): string;
754
+ }, base?: string, cleanUrls?: boolean, isPageNotFound?: boolean): string;
755
755
  declare function replaceVersion(rawUrl: string, version: {
756
756
  current: string;
757
757
  target: string;
758
758
  default: string;
759
- }, base?: string, cleanUrls?: boolean): string;
759
+ }, base?: string, cleanUrls?: boolean, isPageNotFound?: boolean): string;
760
760
  declare const omit: (obj: Record<string, unknown>, keys: string[]) => {
761
761
  [x: string]: unknown;
762
762
  };
package/dist/index.js CHANGED
@@ -1189,9 +1189,9 @@ function isExternalUrl(url = "") {
1189
1189
  function isDataUrl(url = "") {
1190
1190
  return /^\s*data:/i.test(url);
1191
1191
  }
1192
- function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
1192
+ function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false, isPageNotFound = false) {
1193
1193
  let url = removeBase(rawUrl, base);
1194
- if (!url) {
1194
+ if (!url || isPageNotFound) {
1195
1195
  url = cleanUrls ? "/index" : "/index.html";
1196
1196
  }
1197
1197
  if (url.endsWith("/")) {
@@ -1223,9 +1223,9 @@ function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
1223
1223
  base
1224
1224
  );
1225
1225
  }
1226
- function replaceVersion(rawUrl, version, base = "", cleanUrls = false) {
1226
+ function replaceVersion(rawUrl, version, base = "", cleanUrls = false, isPageNotFound = false) {
1227
1227
  let url = removeBase(rawUrl, base);
1228
- if (!url) {
1228
+ if (!url || isPageNotFound) {
1229
1229
  url = cleanUrls ? "/index" : "/index.html";
1230
1230
  }
1231
1231
  let versionPart = "";
package/dist/index.mjs CHANGED
@@ -1131,9 +1131,9 @@ function isExternalUrl(url = "") {
1131
1131
  function isDataUrl(url = "") {
1132
1132
  return /^\s*data:/i.test(url);
1133
1133
  }
1134
- function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
1134
+ function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false, isPageNotFound = false) {
1135
1135
  let url = removeBase(rawUrl, base);
1136
- if (!url) {
1136
+ if (!url || isPageNotFound) {
1137
1137
  url = cleanUrls ? "/index" : "/index.html";
1138
1138
  }
1139
1139
  if (url.endsWith("/")) {
@@ -1165,9 +1165,9 @@ function replaceLang(rawUrl, lang, version, base = "", cleanUrls = false) {
1165
1165
  base
1166
1166
  );
1167
1167
  }
1168
- function replaceVersion(rawUrl, version, base = "", cleanUrls = false) {
1168
+ function replaceVersion(rawUrl, version, base = "", cleanUrls = false, isPageNotFound = false) {
1169
1169
  let url = removeBase(rawUrl, base);
1170
- if (!url) {
1170
+ if (!url || isPageNotFound) {
1171
1171
  url = cleanUrls ? "/index" : "/index.html";
1172
1172
  }
1173
1173
  let versionPart = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "1.19.0",
3
+ "version": "1.19.2",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@rsbuild/core": "0.6.1",
45
+ "@rsbuild/core": "0.6.7",
46
46
  "unified": "^10.1.2",
47
47
  "chalk": "4.1.2",
48
48
  "execa": "5.1.1",