@remix-run/router 1.3.0-pre.2 → 1.3.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 +5 -13
- package/dist/router.cjs.js +13 -3
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +13 -3
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +13 -3
- 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/package.json +1 -1
- package/router.ts +13 -2
package/dist/router.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.3.0
|
|
2
|
+
* @remix-run/router v1.3.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2558,7 +2558,7 @@
|
|
|
2558
2558
|
} : {}));
|
|
2559
2559
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an external redirect that goes to a new origin
|
|
2560
2560
|
|
|
2561
|
-
if (typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2561
|
+
if (isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2562
2562
|
let newOrigin = init.history.createURL(redirect.location).origin;
|
|
2563
2563
|
|
|
2564
2564
|
if (window.location.origin !== newOrigin) {
|
|
@@ -3038,7 +3038,7 @@
|
|
|
3038
3038
|
let location = createLocation("", createPath(url), null, "default");
|
|
3039
3039
|
let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't
|
|
3040
3040
|
|
|
3041
|
-
if (!isValidMethod(method) && method !== "head") {
|
|
3041
|
+
if (!isValidMethod(method) && method !== "head" && method !== "options") {
|
|
3042
3042
|
throw getInternalRouterError(405, {
|
|
3043
3043
|
method
|
|
3044
3044
|
});
|
|
@@ -3554,6 +3554,16 @@
|
|
|
3554
3554
|
}
|
|
3555
3555
|
|
|
3556
3556
|
location = createPath(resolvedLocation);
|
|
3557
|
+
} else if (!isStaticRequest) {
|
|
3558
|
+
// Strip off the protocol+origin for same-origin absolute redirects.
|
|
3559
|
+
// If this is a static reques, we can let it go back to the browser
|
|
3560
|
+
// as-is
|
|
3561
|
+
let currentUrl = new URL(request.url);
|
|
3562
|
+
let url = location.startsWith("//") ? new URL(currentUrl.protocol + location) : new URL(location);
|
|
3563
|
+
|
|
3564
|
+
if (url.origin === currentUrl.origin) {
|
|
3565
|
+
location = url.pathname + url.search + url.hash;
|
|
3566
|
+
}
|
|
3557
3567
|
} // Don't process redirects in the router during static requests requests.
|
|
3558
3568
|
// Instead, throw the Response and let the server handle it with an HTTP
|
|
3559
3569
|
// redirect. We also update the Location header in place in this flow so
|