Skip to content

Commit bbe4ec5

Browse files
authored
Move invariant to UNSAFE_ export (#10066)
1 parent 5706fbd commit bbe4ec5

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed

.changeset/fluffy-forks-attack.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@remix-run/router": patch
3+
---
4+
5+
Change `invariant` to an `UNSAFE_` export since it's only intended for internal use

packages/react-router-dom/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
createRouter,
4141
createBrowserHistory,
4242
createHashHistory,
43-
invariant,
43+
UNSAFE_invariant as invariant,
4444
joinPaths,
4545
ErrorResponse,
4646
} from "@remix-run/router";

packages/react-router-dom/server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
IDLE_FETCHER,
1212
IDLE_NAVIGATION,
1313
Action,
14-
invariant,
14+
UNSAFE_invariant as invariant,
1515
isRouteErrorResponse,
1616
UNSAFE_convertRoutesToDataRoutes as convertRoutesToDataRoutes,
1717
} from "@remix-run/router";

packages/react-router/lib/components.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
Action as NavigationType,
1313
AbortedDeferredError,
1414
createMemoryHistory,
15-
invariant,
15+
UNSAFE_invariant as invariant,
1616
parsePath,
1717
stripBasename,
1818
warning,

packages/react-router/lib/hooks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {
1313
} from "@remix-run/router";
1414
import {
1515
Action as NavigationType,
16-
invariant,
16+
UNSAFE_invariant as invariant,
1717
isRouteErrorResponse,
1818
joinPaths,
1919
matchPath,

packages/router/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export {
6363
createPath,
6464
createHashHistory,
6565
createMemoryHistory,
66-
invariant,
6766
parsePath,
6867
} from "./history";
6968

@@ -82,3 +81,5 @@ export {
8281
convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes,
8382
getPathContributingMatches as UNSAFE_getPathContributingMatches,
8483
} from "./utils";
84+
85+
export { invariant as UNSAFE_invariant } from "./history";

0 commit comments

Comments
 (0)