Skip to content

Commit

Permalink
feat!: remove @remix-run/router package
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-ebey committed Mar 27, 2024
1 parent e977d54 commit a98826b
Show file tree
Hide file tree
Showing 82 changed files with 158 additions and 1,116 deletions.
8 changes: 8 additions & 0 deletions .changeset/remove-router-pkg.md
@@ -0,0 +1,8 @@
---
"react-router-dom-v5-compat": major
"react-router-native": major
"react-router-dom": major
"react-router": major
---

remove @remix-run/router package
11 changes: 4 additions & 7 deletions package.json
Expand Up @@ -109,20 +109,17 @@
"node": ">=14.0.0"
},
"filesize": {
"packages/router/dist/router.umd.min.js": {
"none": "52.4 kB"
},
"packages/react-router/dist/react-router.production.min.js": {
"none": "14.8 kB"
"none": "61.2 kB"
},
"packages/react-router/dist/umd/react-router.production.min.js": {
"none": "17.2 kB"
"none": "63.2 kB"
},
"packages/react-router-dom/dist/react-router-dom.production.min.js": {
"none": "17.1 kB"
"none": "17.4 kB"
},
"packages/react-router-dom/dist/umd/react-router-dom.production.min.js": {
"none": "23.5 kB"
"none": "24.9 kB"
}
},
"pnpm": {
Expand Down
1 change: 0 additions & 1 deletion packages/react-router-dom-v5-compat/package.json
Expand Up @@ -23,7 +23,6 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"@remix-run/router": "workspace:*",
"history": "^5.3.0",
"react-router": "workspace:*"
},
Expand Down
Expand Up @@ -18,7 +18,7 @@ import {
waitFor,
} from "@testing-library/react";
import { JSDOM } from "jsdom";
import { createDeferred } from "../../router/__tests__/utils/utils";
import { createDeferred } from "react-router/router/__tests__/utils/utils";
import getHtml from "react-router/__tests__/utils/getHtml";

describe("Handles concurrent mode features during navigations", () => {
Expand Down
@@ -1,4 +1,4 @@
import type { ErrorResponse, Fetcher } from "@remix-run/router";
import type { ErrorResponse, Fetcher } from "react-router";
import "@testing-library/jest-dom";
import {
act,
Expand Down Expand Up @@ -37,7 +37,7 @@ import {
} from "react-router-dom";

import getHtml from "../../react-router/__tests__/utils/getHtml";
import { createDeferred } from "../../router/__tests__/utils/utils";
import { createDeferred } from "../../react-router/router/__tests__/utils/utils";

testDomRouter("<DataBrowserRouter>", createBrowserRouter, (url) =>
getWindowImpl(url, false)
Expand Down
Expand Up @@ -4,11 +4,11 @@

import * as React from "react";
import * as ReactDOMServer from "react-dom/server";
import { json } from "@remix-run/router";
import {
Form,
Link,
Outlet,
json,
useLoaderData,
useLocation,
useMatches,
Expand Down
Expand Up @@ -14,7 +14,7 @@ import {
} from "react-router-dom";

import getHtml from "../../react-router/__tests__/utils/getHtml";
import { createDeferred, tick } from "../../router/__tests__/utils/utils";
import { createDeferred, tick } from "../../react-router/router/__tests__/utils/utils";

let didAssertMissingHydrateFallback = false;

Expand Down
4 changes: 2 additions & 2 deletions packages/react-router-dom/dom.ts
Expand Up @@ -2,8 +2,8 @@ import type {
FormEncType,
HTMLFormMethod,
RelativeRoutingType,
} from "@remix-run/router";
import { stripBasename, UNSAFE_warning as warning } from "@remix-run/router";
} from "react-router";
import { stripBasename, UNSAFE_warning as warning } from "react-router";

export const defaultMethod: HTMLFormMethod = "get";
const defaultEncType: FormEncType = "application/x-www-form-urlencoded";
Expand Down
26 changes: 21 additions & 5 deletions packages/react-router-dom/index.tsx
Expand Up @@ -48,12 +48,12 @@ import type {
History,
HTMLFormMethod,
HydrationState,
Router as RemixRouter,
RemixRouter,
V7_FormMethod,
RouterState,
RouterSubscriber,
BlockerFunction,
} from "@remix-run/router";
} from "react-router";
import {
createRouter,
createBrowserHistory,
Expand All @@ -65,7 +65,7 @@ import {
UNSAFE_warning as warning,
matchPath,
IDLE_FETCHER,
} from "@remix-run/router";
} from "react-router";

import type {
SubmitOptions,
Expand Down Expand Up @@ -93,11 +93,12 @@ export type {
FormMethod,
GetScrollRestorationKeyFunction,
ParamKeyValuePair,
RouterProviderProps,
SubmitOptions,
URLSearchParamsInit,
V7_FormMethod,
};
export { createSearchParams, ErrorResponseImpl as UNSAFE_ErrorResponseImpl };
export { createSearchParams };

// Note: Keep in sync with react-router exports!
export type {
Expand Down Expand Up @@ -142,7 +143,6 @@ export type {
RouteObject,
RouteProps,
RouterProps,
RouterProviderProps,
RoutesProps,
Search,
ShouldRevalidateFunction,
Expand All @@ -152,6 +152,7 @@ export type {
unstable_HandlerResult,
} from "react-router";
export {
Action,
AbortedDeferredError,
Await,
MemoryRouter,
Expand All @@ -161,13 +162,22 @@ export {
Route,
Router,
Routes,
createBrowserHistory,
createHashHistory,
createMemoryHistory,
createMemoryRouter,
createPath,
createRouter,
createRoutesFromChildren,
createRoutesFromElements,
createStaticHandler,
defer,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
isRouteErrorResponse,
generatePath,
joinPaths,
json,
matchPath,
matchRoutes,
Expand All @@ -176,6 +186,12 @@ export {
redirectDocument,
renderMatches,
resolvePath,
resolveTo,
stripBasename,
UNSAFE_convertRoutesToDataRoutes,
UNSAFE_ErrorResponseImpl,
UNSAFE_invariant,
UNSAFE_warning,
useActionData,
useAsyncError,
useAsyncValue,
Expand Down
1 change: 0 additions & 1 deletion packages/react-router-dom/package.json
Expand Up @@ -23,7 +23,6 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"@remix-run/router": "workspace:*",
"react-router": "workspace:*"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-router-dom/server.tsx
Expand Up @@ -2,13 +2,13 @@ import * as React from "react";
import type {
Path,
RevalidationState,
Router as RemixRouter,
RemixRouter,
StaticHandlerContext,
CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions,
UNSAFE_RouteManifest as RouteManifest,
RouterState,
FutureConfig as RouterFutureConfig,
} from "@remix-run/router";
} from "react-router";
import {
IDLE_BLOCKER,
IDLE_FETCHER,
Expand All @@ -18,7 +18,7 @@ import {
isRouteErrorResponse,
createStaticHandler as routerCreateStaticHandler,
UNSAFE_convertRoutesToDataRoutes as convertRoutesToDataRoutes,
} from "@remix-run/router";
} from "react-router";
import {
UNSAFE_mapRouteProperties as mapRouteProperties,
UNSAFE_useRoutesImpl as useRoutesImpl,
Expand Down
21 changes: 17 additions & 4 deletions packages/react-router-native/index.tsx
Expand Up @@ -27,9 +27,6 @@ export type {
BlockerFunction,
DataRouteMatch,
DataRouteObject,
unstable_DataStrategyFunction,
unstable_DataStrategyFunctionArgs,
unstable_DataStrategyMatch,
ErrorResponse,
Fetcher,
FutureConfig,
Expand Down Expand Up @@ -74,6 +71,7 @@ export type {
unstable_HandlerResult,
} from "react-router";
export {
Action,
AbortedDeferredError,
Await,
MemoryRouter,
Expand All @@ -82,15 +80,23 @@ export {
Outlet,
Route,
Router,
RouterProvider,
Routes,
createBrowserHistory,
createHashHistory,
createMemoryHistory,
createMemoryRouter,
createPath,
createRouter,
createRoutesFromChildren,
createRoutesFromElements,
createStaticHandler,
defer,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
isRouteErrorResponse,
generatePath,
joinPaths,
json,
matchPath,
matchRoutes,
Expand All @@ -99,6 +105,13 @@ export {
redirectDocument,
renderMatches,
resolvePath,
resolveTo,
RouterProvider,
stripBasename,
UNSAFE_convertRoutesToDataRoutes,
UNSAFE_ErrorResponseImpl,
UNSAFE_invariant,
UNSAFE_warning,
useActionData,
useAsyncError,
useAsyncValue,
Expand Down
6 changes: 3 additions & 3 deletions packages/react-router/__tests__/data-memory-router-test.tsx
@@ -1,4 +1,3 @@
import type { ErrorResponse } from "@remix-run/router";
import "@testing-library/jest-dom";
import {
fireEvent,
Expand Down Expand Up @@ -29,9 +28,10 @@ import {
useRouteError,
useRouteLoaderData,
} from "react-router";
import type { ErrorResponse } from "react-router";

import urlDataStrategy from "../../router/__tests__/utils/urlDataStrategy";
import { createDeferred } from "../../router/__tests__/utils/utils";
import urlDataStrategy from "../router/__tests__/utils/urlDataStrategy";
import { createDeferred } from "../router/__tests__/utils/utils";
import MemoryNavigate from "./utils/MemoryNavigate";
import getHtml from "./utils/getHtml";

Expand Down
@@ -1,7 +1,7 @@
import * as React from "react";
import * as TestRenderer from "react-test-renderer";
import { MemoryRouter, Outlet, Routes, Route, useParams } from "react-router";
import type { InitialEntry } from "@remix-run/router";
import type { InitialEntry } from "react-router";

describe("Descendant <Routes> splat matching", () => {
describe("when the parent route path ends with /*", () => {
Expand Down
5 changes: 2 additions & 3 deletions packages/react-router/__tests__/utils/MemoryNavigate.tsx
@@ -1,7 +1,6 @@
import type { FormMethod } from "@remix-run/router";
import { joinPaths } from "@remix-run/router";
import * as React from "react";
import { UNSAFE_DataRouterContext } from "react-router";
import { joinPaths, UNSAFE_DataRouterContext } from "react-router";
import type { FormMethod } from "react-router";

export default function MemoryNavigate({
to,
Expand Down

0 comments on commit a98826b

Please sign in to comment.