diff --git a/.changeset/fluffy-forks-attack.md b/.changeset/fluffy-forks-attack.md new file mode 100644 index 0000000000..52df984834 --- /dev/null +++ b/.changeset/fluffy-forks-attack.md @@ -0,0 +1,5 @@ +--- +"@remix-run/router": patch +--- + +Change `invariant` to an `UNSAFE_` export since it's only intended for internal use diff --git a/packages/react-router-dom/index.tsx b/packages/react-router-dom/index.tsx index 882159e6cc..560c85a483 100644 --- a/packages/react-router-dom/index.tsx +++ b/packages/react-router-dom/index.tsx @@ -40,7 +40,7 @@ import { createRouter, createBrowserHistory, createHashHistory, - invariant, + UNSAFE_invariant as invariant, joinPaths, ErrorResponse, } from "@remix-run/router"; diff --git a/packages/react-router-dom/server.tsx b/packages/react-router-dom/server.tsx index 47c18dd700..b8c1cee667 100644 --- a/packages/react-router-dom/server.tsx +++ b/packages/react-router-dom/server.tsx @@ -11,7 +11,7 @@ import { IDLE_FETCHER, IDLE_NAVIGATION, Action, - invariant, + UNSAFE_invariant as invariant, isRouteErrorResponse, UNSAFE_convertRoutesToDataRoutes as convertRoutesToDataRoutes, } from "@remix-run/router"; diff --git a/packages/react-router/lib/components.tsx b/packages/react-router/lib/components.tsx index b76e5781e8..1b5daa76f1 100644 --- a/packages/react-router/lib/components.tsx +++ b/packages/react-router/lib/components.tsx @@ -12,7 +12,7 @@ import { Action as NavigationType, AbortedDeferredError, createMemoryHistory, - invariant, + UNSAFE_invariant as invariant, parsePath, stripBasename, warning, diff --git a/packages/react-router/lib/hooks.tsx b/packages/react-router/lib/hooks.tsx index f766c26e83..951b434670 100644 --- a/packages/react-router/lib/hooks.tsx +++ b/packages/react-router/lib/hooks.tsx @@ -13,7 +13,7 @@ import type { } from "@remix-run/router"; import { Action as NavigationType, - invariant, + UNSAFE_invariant as invariant, isRouteErrorResponse, joinPaths, matchPath, diff --git a/packages/router/index.ts b/packages/router/index.ts index 21670631d3..323f02ca68 100644 --- a/packages/router/index.ts +++ b/packages/router/index.ts @@ -63,7 +63,6 @@ export { createPath, createHashHistory, createMemoryHistory, - invariant, parsePath, } from "./history"; @@ -82,3 +81,5 @@ export { convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, } from "./utils"; + +export { invariant as UNSAFE_invariant } from "./history";