@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.3.3-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Correctly perform a "hard" redirect for same-origin absolute URLs outside of the router basename ([#10076](https://github.com/remix-run/react-router/pull/10076))
|
|
8
|
+
|
|
9
|
+
## 1.3.3-pre.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Change `invariant` to an `UNSAFE_` export since it's only intended for internal use ([#10066](https://github.com/remix-run/react-router/pull/10066))
|
|
14
|
+
- Ensure status code and headers are maintained for `defer` loader responses in `createStaticHandler`'s `query()` method ([#10077](https://github.com/remix-run/react-router/pull/10077))
|
|
15
|
+
- Add internal API for custom HMR implementations ([#9996](https://github.com/remix-run/react-router/pull/9996))
|
|
16
|
+
|
|
3
17
|
## 1.3.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, TrackedPromise, FormEncType, FormMethod, JsonFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathPattern, RedirectFunction, ShouldRevalidateFunction, Submission, } from "./utils";
|
|
2
2
|
export { AbortedDeferredError, ErrorResponse, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, resolvePath, resolveTo, stripBasename, warning, } from "./utils";
|
|
3
3
|
export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";
|
|
4
|
-
export { Action, createBrowserHistory, createPath, createHashHistory, createMemoryHistory,
|
|
4
|
+
export { Action, createBrowserHistory, createPath, createHashHistory, createMemoryHistory, parsePath, } from "./history";
|
|
5
5
|
export * from "./router";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export { DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, } from "./utils";
|
|
8
|
+
export { invariant as UNSAFE_invariant } from "./history";
|
package/dist/router.cjs.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
|
*
|
|
@@ -2557,9 +2557,10 @@ function createRouter(init) {
|
|
|
2557
2557
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an absolute external redirect that goes to a new origin
|
|
2558
2558
|
|
|
2559
2559
|
if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2560
|
-
let
|
|
2560
|
+
let url = init.history.createURL(redirect.location);
|
|
2561
|
+
let isDifferentBasename = stripBasename(url.pathname, init.basename || "/") == null;
|
|
2561
2562
|
|
|
2562
|
-
if (window.location.origin !==
|
|
2563
|
+
if (window.location.origin !== url.origin || isDifferentBasename) {
|
|
2563
2564
|
if (replace) {
|
|
2564
2565
|
window.location.replace(redirect.location);
|
|
2565
2566
|
} else {
|
|
@@ -3594,13 +3595,14 @@ async function callLoaderOrAction(type, request, match, matches, basename, isSta
|
|
|
3594
3595
|
|
|
3595
3596
|
location = createPath(resolvedLocation);
|
|
3596
3597
|
} else if (!isStaticRequest) {
|
|
3597
|
-
// Strip off the protocol+origin for same-origin absolute
|
|
3598
|
-
// If this is a static
|
|
3599
|
-
// as-is
|
|
3598
|
+
// Strip off the protocol+origin for same-origin + same-basename absolute
|
|
3599
|
+
// redirects. If this is a static request, we can let it go back to the
|
|
3600
|
+
// browser as-is
|
|
3600
3601
|
let currentUrl = new URL(request.url);
|
|
3601
3602
|
let url = location.startsWith("//") ? new URL(currentUrl.protocol + location) : new URL(location);
|
|
3603
|
+
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
3602
3604
|
|
|
3603
|
-
if (url.origin === currentUrl.origin) {
|
|
3605
|
+
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
3604
3606
|
location = url.pathname + url.search + url.hash;
|
|
3605
3607
|
}
|
|
3606
3608
|
} // Don't process redirects in the router during static requests requests.
|
|
@@ -4096,6 +4098,7 @@ exports.UNSAFE_DEFERRED_SYMBOL = UNSAFE_DEFERRED_SYMBOL;
|
|
|
4096
4098
|
exports.UNSAFE_DeferredData = DeferredData;
|
|
4097
4099
|
exports.UNSAFE_convertRoutesToDataRoutes = convertRoutesToDataRoutes;
|
|
4098
4100
|
exports.UNSAFE_getPathContributingMatches = getPathContributingMatches;
|
|
4101
|
+
exports.UNSAFE_invariant = invariant;
|
|
4099
4102
|
exports.createBrowserHistory = createBrowserHistory;
|
|
4100
4103
|
exports.createHashHistory = createHashHistory;
|
|
4101
4104
|
exports.createMemoryHistory = createMemoryHistory;
|
|
@@ -4106,7 +4109,6 @@ exports.defer = defer;
|
|
|
4106
4109
|
exports.generatePath = generatePath;
|
|
4107
4110
|
exports.getStaticContextFromError = getStaticContextFromError;
|
|
4108
4111
|
exports.getToPathname = getToPathname;
|
|
4109
|
-
exports.invariant = invariant;
|
|
4110
4112
|
exports.isRouteErrorResponse = isRouteErrorResponse;
|
|
4111
4113
|
exports.joinPaths = joinPaths;
|
|
4112
4114
|
exports.json = json;
|