@remix-run/router 1.23.0 → 1.23.1
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 +6 -0
- 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/CHANGELOG.md
CHANGED
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.23.
|
|
2
|
+
* @remix-run/router v1.23.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1140,6 +1140,8 @@ function stripBasename(pathname, basename) {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
return pathname.slice(startIndex) || "/";
|
|
1142
1142
|
}
|
|
1143
|
+
const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1144
|
+
const isAbsoluteUrl = url => ABSOLUTE_URL_REGEX$1.test(url);
|
|
1143
1145
|
|
|
1144
1146
|
/**
|
|
1145
1147
|
* Returns a resolved path object relative to the given pathname.
|
|
@@ -1155,7 +1157,25 @@ function resolvePath(to, fromPathname) {
|
|
|
1155
1157
|
search = "",
|
|
1156
1158
|
hash = ""
|
|
1157
1159
|
} = typeof to === "string" ? parsePath(to) : to;
|
|
1158
|
-
let pathname
|
|
1160
|
+
let pathname;
|
|
1161
|
+
if (toPathname) {
|
|
1162
|
+
if (isAbsoluteUrl(toPathname)) {
|
|
1163
|
+
pathname = toPathname;
|
|
1164
|
+
} else {
|
|
1165
|
+
if (toPathname.includes("//")) {
|
|
1166
|
+
let oldPathname = toPathname;
|
|
1167
|
+
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
1168
|
+
warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
|
|
1169
|
+
}
|
|
1170
|
+
if (toPathname.startsWith("/")) {
|
|
1171
|
+
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
1172
|
+
} else {
|
|
1173
|
+
pathname = resolvePathname(toPathname, fromPathname);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
} else {
|
|
1177
|
+
pathname = fromPathname;
|
|
1178
|
+
}
|
|
1159
1179
|
return {
|
|
1160
1180
|
pathname,
|
|
1161
1181
|
search: normalizeSearch(search),
|