-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Cleanup imports/exports in consolidated react-router package #11840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c453333
Update react-router-dom to be a direct re-export of react-router
brophdawg11 25ad643
Remove router index and adjust react-router exports approach
brophdawg11 279839a
changeset and cleanup
brophdawg11 a6e98fd
Fix typecheck
brophdawg11 c99d5f9
Align internal HistoryAction -> NavigationType
brophdawg11 55c6d1c
Add comment for future rename
brophdawg11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
"react-router": major | ||
--- | ||
|
||
Imports/Exports cleanup | ||
|
||
- Removed the following exports that were previously public API from `@remix-run/router` | ||
- types | ||
- `AgnosticDataIndexRouteObject` | ||
- `AgnosticDataNonIndexRouteObject` | ||
- `AgnosticDataRouteMatch` | ||
- `AgnosticDataRouteObject` | ||
- `AgnosticIndexRouteObject` | ||
- `AgnosticNonIndexRouteObject` | ||
- `AgnosticRouteMatch` | ||
- `AgnosticRouteObject` | ||
- `TrackedPromise` | ||
- `unstable_AgnosticPatchRoutesOnMissFunction` | ||
- `Action` -> exported as `NavigationType` via `react-router` | ||
- `Router` exported as `RemixRouter` to differentiate from RR's `<Router>` | ||
- API | ||
- `getToPathname` (`@private`) | ||
- `joinPaths` (`@private`) | ||
- `normalizePathname` (`@private`) | ||
- `resolveTo` (`@private`) | ||
- `stripBasename` (`@private`) | ||
- `createBrowserHistory` -> in favor of `createBrowserRouter` | ||
- `createHashHistory` -> in favor of `createHashRouter` | ||
- `createMemoryHistory` -> in favor of `createMemoryRouter` | ||
- `createRouter` | ||
- `createStaticHandler` -> in favor of wrapper `createStaticHandler` in RR Dom | ||
- `getStaticContextFromError` | ||
- Removed the following exports that were previously public API from `react-router` | ||
- `Hash` | ||
- `Pathname` | ||
- `Search` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,231 +1,2 @@ | ||
let alreadyWarned = false; | ||
|
||
if (!alreadyWarned && typeof console !== "undefined") { | ||
alreadyWarned = true; | ||
console.warn( | ||
"The `react-router-dom` package is deprecated in v7, you can change all " + | ||
"of your imports to load directly from the `react-router` package." | ||
); | ||
} | ||
|
||
export type { | ||
ActionFunction, | ||
ActionFunctionArgs, | ||
AwaitProps, | ||
DataRouteMatch, | ||
DataRouteObject, | ||
unstable_DataStrategyFunction, | ||
unstable_DataStrategyFunctionArgs, | ||
unstable_DataStrategyMatch, | ||
ErrorResponse, | ||
Fetcher, | ||
Hash, | ||
IndexRouteObject, | ||
IndexRouteProps, | ||
JsonFunction, | ||
LayoutRouteProps, | ||
LazyRouteFunction, | ||
LoaderFunction, | ||
LoaderFunctionArgs, | ||
Location, | ||
MemoryRouterProps, | ||
NavigateFunction, | ||
NavigateOptions, | ||
NavigateProps, | ||
Navigation, | ||
Navigator, | ||
NonIndexRouteObject, | ||
OutletProps, | ||
ParamParseKey, | ||
Params, | ||
Path, | ||
PathMatch, | ||
PathParam, | ||
PathPattern, | ||
PathRouteProps, | ||
Pathname, | ||
RedirectFunction, | ||
RelativeRoutingType, | ||
RouteMatch, | ||
RouteObject, | ||
RouteProps, | ||
RouterProps, | ||
RouterProviderProps, | ||
RoutesProps, | ||
Search, | ||
ShouldRevalidateFunction, | ||
ShouldRevalidateFunctionArgs, | ||
To, | ||
UIMatch, | ||
Blocker, | ||
BlockerFunction, | ||
unstable_HandlerResult, | ||
AgnosticDataIndexRouteObject, | ||
AgnosticDataNonIndexRouteObject, | ||
AgnosticDataRouteMatch, | ||
AgnosticDataRouteObject, | ||
AgnosticIndexRouteObject, | ||
AgnosticNonIndexRouteObject, | ||
AgnosticRouteMatch, | ||
AgnosticRouteObject, | ||
HydrationState, | ||
InitialEntry, | ||
StaticHandler, | ||
TrackedPromise, | ||
FormEncType, | ||
FormMethod, | ||
GetScrollRestorationKeyFunction, | ||
StaticHandlerContext, | ||
BrowserRouterProps, | ||
HashRouterProps, | ||
HistoryRouterProps, | ||
LinkProps, | ||
NavLinkProps, | ||
FetcherFormProps, | ||
FormProps, | ||
ScrollRestorationProps, | ||
SetURLSearchParams, | ||
SubmitFunction, | ||
FetcherSubmitFunction, | ||
FetcherWithComponents, | ||
ParamKeyValuePair, | ||
SubmitOptions, | ||
URLSearchParamsInit, | ||
StaticRouterProps, | ||
StaticRouterProviderProps, | ||
HtmlLinkDescriptor, | ||
ClientActionFunction, | ||
ClientActionFunctionArgs, | ||
ClientLoaderFunction, | ||
ClientLoaderFunctionArgs, | ||
MetaArgs, | ||
MetaDescriptor, | ||
MetaFunction, | ||
ServerRouterProps, | ||
RoutesTestStubProps, | ||
} from "react-router"; | ||
|
||
export { | ||
Await, | ||
MemoryRouter, | ||
Navigate, | ||
NavigationType, | ||
Outlet, | ||
Route, | ||
Router, | ||
RouterProvider, | ||
Routes, | ||
createMemoryRouter, | ||
createPath, | ||
createRoutesFromChildren, | ||
createRoutesFromChildren as createRoutesFromElements, | ||
generatePath, | ||
isRouteErrorResponse, | ||
json, | ||
matchPath, | ||
matchRoutes, | ||
parsePath, | ||
redirect, | ||
redirectDocument, | ||
renderMatches, | ||
resolvePath, | ||
useBlocker, | ||
useActionData, | ||
useAsyncError, | ||
useAsyncValue, | ||
useHref, | ||
useInRouterContext, | ||
useLoaderData, | ||
useLocation, | ||
useMatch, | ||
useMatches, | ||
useNavigate, | ||
useNavigation, | ||
useNavigationType, | ||
useOutlet, | ||
useOutletContext, | ||
useParams, | ||
useResolvedPath, | ||
useRevalidator, | ||
useRouteError, | ||
useRouteLoaderData, | ||
useRoutes, | ||
getStaticContextFromError, | ||
stripBasename, | ||
UNSAFE_convertRoutesToDataRoutes, | ||
createBrowserRouter, | ||
createHashRouter, | ||
BrowserRouter, | ||
HashRouter, | ||
Link, | ||
UNSAFE_ViewTransitionContext, | ||
UNSAFE_FetchersContext, | ||
unstable_HistoryRouter, | ||
NavLink, | ||
Form, | ||
ScrollRestoration, | ||
useLinkClickHandler, | ||
useSearchParams, | ||
useSubmit, | ||
useFormAction, | ||
useFetcher, | ||
useFetchers, | ||
UNSAFE_useScrollRestoration, | ||
useBeforeUnload, | ||
unstable_usePrompt, | ||
unstable_useViewTransitionState, | ||
createSearchParams, | ||
createStaticHandler, | ||
createStaticRouter, | ||
StaticRouter, | ||
StaticRouterProvider, | ||
HydratedRouter, | ||
Meta, | ||
Links, | ||
Scripts, | ||
PrefetchPageLinks, | ||
ServerRouter, | ||
createRoutesStub, | ||
} from "react-router"; | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// DANGER! PLEASE READ ME! | ||
// We provide these exports as an escape hatch in the event that you need any | ||
// routing data that we don't provide an explicit API for. With that said, we | ||
// want to cover your use case if we can, so if you feel the need to use these | ||
// we want to hear from you. Let us know what you're building and we'll do our | ||
// best to make sure we can support you! | ||
// | ||
// We consider these exports an implementation detail and do not guarantee | ||
// against any breaking changes, regardless of the semver release. Use with | ||
// extreme caution and only if you understand the consequences. Godspeed. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** @internal */ | ||
export type { | ||
UNSAFE_RouteModules, | ||
UNSAFE_FutureConfig, | ||
UNSAFE_AssetsManifest, | ||
UNSAFE_FrameworkContextObject, | ||
UNSAFE_EntryRoute, | ||
UNSAFE_RouteManifest, | ||
UNSAFE_SingleFetchRedirectResult, | ||
UNSAFE_SingleFetchResult, | ||
UNSAFE_SingleFetchResults, | ||
} from "react-router"; | ||
|
||
/** @internal */ | ||
export { | ||
UNSAFE_DataRouterContext, | ||
UNSAFE_DataRouterStateContext, | ||
UNSAFE_LocationContext, | ||
UNSAFE_NavigationContext, | ||
UNSAFE_RouteContext, | ||
UNSAFE_mapRouteProperties, | ||
UNSAFE_useRouteId, | ||
UNSAFE_useRoutesImpl, | ||
UNSAFE_ErrorResponseImpl, | ||
UNSAFE_FrameworkContext as UNSAFE_RemixContext, | ||
UNSAFE_decodeViaTurboStream, | ||
UNSAFE_SingleFetchRedirectSymbol, | ||
} from "react-router"; | ||
export type * from "react-router"; | ||
export * from "react-router"; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,10 @@ | |
|
||
import { JSDOM } from "jsdom"; | ||
|
||
import type { BrowserHistory } from "../../lib/router"; | ||
import { createBrowserHistory } from "../../lib/router"; | ||
import { | ||
type BrowserHistory, | ||
createBrowserHistory, | ||
} from "../../lib/router/history"; | ||
Comment on lines
+5
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All router imports come from the source files, no more |
||
|
||
import InitialLocationDefaultKey from "./TestSequences/InitialLocationDefaultKey"; | ||
import Listen from "./TestSequences/Listen"; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
packages/react-router/__tests__/router/lazy-discovery-test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't export individually - just export everything from
react-router