@remix-run/router 1.23.0-pre-v6.0 → 1.23.1-pre-v6.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.
- package/CHANGELOG.md +7 -1
- package/dist/router.cjs.js +22 -2
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +22 -2
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +22 -2
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
- package/utils.ts +26 -5
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.23.
|
|
2
|
+
* @remix-run/router v1.23.1-pre-v6.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -886,6 +886,8 @@ function stripBasename(pathname, basename) {
|
|
|
886
886
|
}
|
|
887
887
|
return pathname.slice(startIndex) || "/";
|
|
888
888
|
}
|
|
889
|
+
const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
890
|
+
const isAbsoluteUrl = url => ABSOLUTE_URL_REGEX$1.test(url);
|
|
889
891
|
/**
|
|
890
892
|
* Returns a resolved path object relative to the given pathname.
|
|
891
893
|
*
|
|
@@ -900,7 +902,25 @@ function resolvePath(to, fromPathname) {
|
|
|
900
902
|
search = "",
|
|
901
903
|
hash = ""
|
|
902
904
|
} = typeof to === "string" ? parsePath(to) : to;
|
|
903
|
-
let pathname
|
|
905
|
+
let pathname;
|
|
906
|
+
if (toPathname) {
|
|
907
|
+
if (isAbsoluteUrl(toPathname)) {
|
|
908
|
+
pathname = toPathname;
|
|
909
|
+
} else {
|
|
910
|
+
if (toPathname.includes("//")) {
|
|
911
|
+
let oldPathname = toPathname;
|
|
912
|
+
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
913
|
+
warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
|
|
914
|
+
}
|
|
915
|
+
if (toPathname.startsWith("/")) {
|
|
916
|
+
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
917
|
+
} else {
|
|
918
|
+
pathname = resolvePathname(toPathname, fromPathname);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
} else {
|
|
922
|
+
pathname = fromPathname;
|
|
923
|
+
}
|
|
904
924
|
return {
|
|
905
925
|
pathname,
|
|
906
926
|
search: normalizeSearch(search),
|