@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.umd.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
|
*
|
|
@@ -1142,6 +1142,8 @@
|
|
|
1142
1142
|
}
|
|
1143
1143
|
return pathname.slice(startIndex) || "/";
|
|
1144
1144
|
}
|
|
1145
|
+
const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1146
|
+
const isAbsoluteUrl = url => ABSOLUTE_URL_REGEX$1.test(url);
|
|
1145
1147
|
|
|
1146
1148
|
/**
|
|
1147
1149
|
* Returns a resolved path object relative to the given pathname.
|
|
@@ -1157,7 +1159,25 @@
|
|
|
1157
1159
|
search = "",
|
|
1158
1160
|
hash = ""
|
|
1159
1161
|
} = typeof to === "string" ? parsePath(to) : to;
|
|
1160
|
-
let pathname
|
|
1162
|
+
let pathname;
|
|
1163
|
+
if (toPathname) {
|
|
1164
|
+
if (isAbsoluteUrl(toPathname)) {
|
|
1165
|
+
pathname = toPathname;
|
|
1166
|
+
} else {
|
|
1167
|
+
if (toPathname.includes("//")) {
|
|
1168
|
+
let oldPathname = toPathname;
|
|
1169
|
+
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
1170
|
+
warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
|
|
1171
|
+
}
|
|
1172
|
+
if (toPathname.startsWith("/")) {
|
|
1173
|
+
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
1174
|
+
} else {
|
|
1175
|
+
pathname = resolvePathname(toPathname, fromPathname);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
} else {
|
|
1179
|
+
pathname = fromPathname;
|
|
1180
|
+
}
|
|
1161
1181
|
return {
|
|
1162
1182
|
pathname,
|
|
1163
1183
|
search: normalizeSearch(search),
|