@remix-run/router 1.23.2 → 1.23.3
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 -0
- package/dist/router.cjs.js +77 -16
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +12 -16
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +77 -16
- 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/router.ts +2 -1
- package/utils.ts +6 -3
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.23.
|
|
2
|
+
* @remix-run/router v1.23.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -9,18 +9,13 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
function _extends() {
|
|
12
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
13
|
-
for (var
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
17
|
-
target[key] = source[key];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
12
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
13
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
14
|
+
var t = arguments[e];
|
|
15
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
20
16
|
}
|
|
21
|
-
return
|
|
22
|
-
};
|
|
23
|
-
return _extends.apply(this, arguments);
|
|
17
|
+
return n;
|
|
18
|
+
}, _extends.apply(null, arguments);
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
////////////////////////////////////////////////////////////////////////////////
|
|
@@ -529,6 +524,7 @@ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
|
529
524
|
let branches = flattenRoutes(routes);
|
|
530
525
|
rankRouteBranches(branches);
|
|
531
526
|
let matches = null;
|
|
527
|
+
let decoded = decodePath(pathname);
|
|
532
528
|
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
533
529
|
// Incoming pathnames are generally encoded from either window.location
|
|
534
530
|
// or from router.navigate, but we want to match against the unencoded
|
|
@@ -536,7 +532,6 @@ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
|
536
532
|
// encoded here but there also shouldn't be anything to decode so this
|
|
537
533
|
// should be a safe operation. This avoids needing matchRoutes to be
|
|
538
534
|
// history-aware.
|
|
539
|
-
let decoded = decodePath(pathname);
|
|
540
535
|
matches = matchRouteBranch(branches[i], decoded, allowPartial);
|
|
541
536
|
}
|
|
542
537
|
return matches;
|
|
@@ -909,7 +904,7 @@ function resolvePath(to, fromPathname) {
|
|
|
909
904
|
} else {
|
|
910
905
|
if (toPathname.includes("//")) {
|
|
911
906
|
let oldPathname = toPathname;
|
|
912
|
-
toPathname = toPathname
|
|
907
|
+
toPathname = removeDoubleSlashes(toPathname);
|
|
913
908
|
warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
|
|
914
909
|
}
|
|
915
910
|
if (toPathname.startsWith("/")) {
|
|
@@ -1044,10 +1039,11 @@ function getToPathname(to) {
|
|
|
1044
1039
|
// Empty strings should be treated the same as / paths
|
|
1045
1040
|
return to === "" || to.pathname === "" ? "/" : typeof to === "string" ? parsePath(to).pathname : to.pathname;
|
|
1046
1041
|
}
|
|
1042
|
+
const removeDoubleSlashes = path => path.replace(/\/\/+/g, "/");
|
|
1047
1043
|
/**
|
|
1048
1044
|
* @private
|
|
1049
1045
|
*/
|
|
1050
|
-
const joinPaths = paths => paths.join("/")
|
|
1046
|
+
const joinPaths = paths => removeDoubleSlashes(paths.join("/"));
|
|
1051
1047
|
/**
|
|
1052
1048
|
* @private
|
|
1053
1049
|
*/
|
|
@@ -4449,7 +4445,7 @@ function normalizeRedirectLocation(location, currentUrl, basename, historyInstan
|
|
|
4449
4445
|
}
|
|
4450
4446
|
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
4451
4447
|
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
4452
|
-
return url.pathname + url.search + url.hash;
|
|
4448
|
+
return removeDoubleSlashes(url.pathname) + url.search + url.hash;
|
|
4453
4449
|
}
|
|
4454
4450
|
}
|
|
4455
4451
|
try {
|