@remix-run/router 0.0.0-experimental-cf9637ce → 0.0.0-experimental-e7e9ce6e
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 +14 -0
- package/dist/index.d.ts +2 -1
- package/dist/router.cjs.js +10 -8
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +10 -8
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +10 -8
- 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/index.ts +2 -1
- package/package.json +1 -1
- package/router.ts +11 -7
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-e7e9ce6e
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2508,9 +2508,10 @@ function createRouter(init) {
|
|
|
2508
2508
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an absolute external redirect that goes to a new origin
|
|
2509
2509
|
|
|
2510
2510
|
if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2511
|
-
let
|
|
2511
|
+
let url = init.history.createURL(redirect.location);
|
|
2512
|
+
let isDifferentBasename = stripBasename(url.pathname, init.basename || "/") == null;
|
|
2512
2513
|
|
|
2513
|
-
if (window.location.origin !==
|
|
2514
|
+
if (window.location.origin !== url.origin || isDifferentBasename) {
|
|
2514
2515
|
if (replace) {
|
|
2515
2516
|
window.location.replace(redirect.location);
|
|
2516
2517
|
} else {
|
|
@@ -3545,13 +3546,14 @@ async function callLoaderOrAction(type, request, match, matches, basename, isSta
|
|
|
3545
3546
|
|
|
3546
3547
|
location = createPath(resolvedLocation);
|
|
3547
3548
|
} else if (!isStaticRequest) {
|
|
3548
|
-
// Strip off the protocol+origin for same-origin absolute
|
|
3549
|
-
// If this is a static
|
|
3550
|
-
// as-is
|
|
3549
|
+
// Strip off the protocol+origin for same-origin + same-basename absolute
|
|
3550
|
+
// redirects. If this is a static request, we can let it go back to the
|
|
3551
|
+
// browser as-is
|
|
3551
3552
|
let currentUrl = new URL(request.url);
|
|
3552
3553
|
let url = location.startsWith("//") ? new URL(currentUrl.protocol + location) : new URL(location);
|
|
3554
|
+
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
3553
3555
|
|
|
3554
|
-
if (url.origin === currentUrl.origin) {
|
|
3556
|
+
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
3555
3557
|
location = url.pathname + url.search + url.hash;
|
|
3556
3558
|
}
|
|
3557
3559
|
} // Don't process redirects in the router during static requests requests.
|
|
@@ -4038,5 +4040,5 @@ function getTargetMatch(matches, location) {
|
|
|
4038
4040
|
return pathMatches[pathMatches.length - 1];
|
|
4039
4041
|
} //#endregion
|
|
4040
4042
|
|
|
4041
|
-
export { AbortedDeferredError, Action, ErrorResponse, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname,
|
|
4043
|
+
export { AbortedDeferredError, Action, ErrorResponse, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, invariant as UNSAFE_invariant, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, resolvePath, resolveTo, stripBasename, warning };
|
|
4042
4044
|
//# sourceMappingURL=router.js.map
|