react-router-dom-v5-compat 6.15.0 → 6.16.0-pre.1
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 +22 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router-dom/index.d.ts +1 -1
- package/dist/umd/react-router-dom-v5-compat.development.js +12 -8
- package/dist/umd/react-router-dom-v5-compat.development.js.map +1 -1
- package/dist/umd/react-router-dom-v5-compat.production.min.js +2 -2
- package/dist/umd/react-router-dom-v5-compat.production.min.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# `react-router-dom-v5-compat`
|
|
2
2
|
|
|
3
|
+
## 6.16.0-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- `react-router-dom@6.16.0-pre.1`
|
|
9
|
+
- `react-router@6.16.0-pre.1`
|
|
10
|
+
|
|
11
|
+
## 6.16.0-pre.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Removed internal API only required for the Remix v1 back-compat layer and no longer needed in Remix v2 (`_isFetchActionRedirect`, `_hasFetcherDoneAnything`) ([#10715](https://github.com/remix-run/react-router/pull/10715))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Move the `@private` class export `ErrorResponse` to an `UNSAFE_ErrorResponseImpl` export since it is an implementation detail and there should be no construction of `ErrorResponse` instances in userland. This frees us up to export a `type ErrorResponse` which correlates to an instance of the class via `InstanceType`. Userland code should only ever be using `ErrorResponse` as a type and should be type-narrowing via `isRouteErrorResponse`. ([#10811](https://github.com/remix-run/react-router/pull/10811))
|
|
20
|
+
- Export `ShouldRevalidateFunctionArgs` interface ([#10797](https://github.com/remix-run/react-router/pull/10797))
|
|
21
|
+
- Updated dependencies:
|
|
22
|
+
- `react-router-dom@6.16.0-pre.0`
|
|
23
|
+
- `react-router@6.16.0-pre.0`
|
|
24
|
+
|
|
3
25
|
## 6.15.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* would break. We could stop doing two bundles in v6 "react-router-dom" and
|
|
47
47
|
* deprecate the deep require if we wanted to avoid the duplication here.
|
|
48
48
|
*/
|
|
49
|
-
export type { BrowserRouterProps,
|
|
50
|
-
export { BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router,
|
|
49
|
+
export type { ActionFunction, ActionFunctionArgs, AwaitProps, BrowserRouterProps, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FetcherWithComponents, FormEncType, FormMethod, FormProps, GetScrollRestorationKeyFunction, Hash, HashRouterProps, HistoryRouterProps, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LinkProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavLinkProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamKeyValuePair, ParamParseKey, Params, Path, PathMatch, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, ScrollRestorationProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, SubmitFunction, SubmitOptions, To, URLSearchParamsInit, UIMatch, unstable_Blocker, unstable_BlockerFunction, } from "./react-router-dom";
|
|
50
|
+
export { AbortedDeferredError, Await, BrowserRouter, Form, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, UNSAFE_useScrollRestoration, createBrowserRouter, createHashRouter, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, createSearchParams, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, unstable_HistoryRouter, unstable_useBlocker, unstable_usePrompt, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, } from "./react-router-dom";
|
|
51
51
|
export type { StaticRouterProps } from "./lib/components";
|
|
52
|
-
export {
|
|
52
|
+
export { CompatRoute, CompatRouter, StaticRouter } from "./lib/components";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v5 Compat v6.
|
|
2
|
+
* React Router DOM v5 Compat v6.16.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { UNSAFE_mapRouteProperties, Router, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, UNSAFE_DataRouterStateContext, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, unstable_useBlocker, UNSAFE_DataRouterContext, Routes, Route } from 'react-router';
|
|
13
13
|
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, unstable_useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
|
|
14
|
-
import { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory,
|
|
14
|
+
import { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory, UNSAFE_ErrorResponseImpl, UNSAFE_invariant, joinPaths } from '@remix-run/router';
|
|
15
15
|
import { parsePath, Action, createPath as createPath$1 } from 'history';
|
|
16
16
|
import { Route as Route$1, useHistory } from 'react-router-dom';
|
|
17
17
|
|
|
@@ -257,7 +257,7 @@ function deserializeErrors(errors) {
|
|
|
257
257
|
// Hey you! If you change this, please change the corresponding logic in
|
|
258
258
|
// serializeErrors in react-router-dom/server.tsx :)
|
|
259
259
|
if (val && val.__type === "RouteErrorResponse") {
|
|
260
|
-
serialized[key] = new
|
|
260
|
+
serialized[key] = new UNSAFE_ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);
|
|
261
261
|
} else if (val && val.__type === "Error") {
|
|
262
262
|
// Attempt to reconstruct the right type of Error (i.e., ReferenceError)
|
|
263
263
|
if (val.__subType) {
|
|
@@ -426,7 +426,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
426
426
|
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
427
427
|
}
|
|
428
428
|
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
429
|
-
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
429
|
+
const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
430
430
|
/**
|
|
431
431
|
* The public API for rendering a history-aware <a>.
|
|
432
432
|
*/
|
|
@@ -448,7 +448,7 @@ const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref4, ref) {
|
|
|
448
448
|
// Rendered into <a href> for absolute URLs
|
|
449
449
|
let absoluteHref;
|
|
450
450
|
let isExternal = false;
|
|
451
|
-
if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
|
|
451
|
+
if (typeof to === "string" && ABSOLUTE_URL_REGEX$1.test(to)) {
|
|
452
452
|
// Render the absolute href server- and client-side
|
|
453
453
|
absoluteHref = to;
|
|
454
454
|
// Only check for external origins client-side
|
|
@@ -859,6 +859,7 @@ function createFetcherForm(fetcherKey, routeId) {
|
|
|
859
859
|
return FetcherForm;
|
|
860
860
|
}
|
|
861
861
|
let fetcherId = 0;
|
|
862
|
+
// TODO: (v7) Change the useFetcher generic default from `any` to `unknown`
|
|
862
863
|
/**
|
|
863
864
|
* Interacts with route loaders and actions without causing a navigation. Great
|
|
864
865
|
* for any interaction that stays on the same page.
|
|
@@ -1123,6 +1124,7 @@ function CompatRouter(_ref) {
|
|
|
1123
1124
|
element: children
|
|
1124
1125
|
})));
|
|
1125
1126
|
}
|
|
1127
|
+
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1126
1128
|
/**
|
|
1127
1129
|
* A <Router> that may not navigate to any other location. This is useful
|
|
1128
1130
|
* on the server where there is no stateful UI.
|
|
@@ -1149,11 +1151,12 @@ function StaticRouter(_ref2) {
|
|
|
1149
1151
|
return typeof to === "string" ? to : createPath$1(to);
|
|
1150
1152
|
},
|
|
1151
1153
|
encodeLocation(to) {
|
|
1152
|
-
let
|
|
1154
|
+
let href = typeof to === "string" ? to : createPath$1(to);
|
|
1155
|
+
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1153
1156
|
return {
|
|
1154
|
-
pathname:
|
|
1155
|
-
search:
|
|
1156
|
-
hash:
|
|
1157
|
+
pathname: encoded.pathname,
|
|
1158
|
+
search: encoded.search,
|
|
1159
|
+
hash: encoded.hash
|
|
1157
1160
|
};
|
|
1158
1161
|
},
|
|
1159
1162
|
push(to) {
|