From 3f6bc1b312c47eed40fa5a22b76738696f502e0a Mon Sep 17 00:00:00 2001 From: Kutner JS Date: Mon, 28 Feb 2022 16:25:32 +0200 Subject: [PATCH] feat: forward `parsePath` and `createPath` from history (#8278) --- contributors.yml | 1 + packages/react-router-dom/index.tsx | 11 +++++++++-- packages/react-router-native/index.tsx | 7 +++++++ packages/react-router/index.tsx | 10 +++++++--- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/contributors.yml b/contributors.yml index dc6610e349..c0102e494a 100644 --- a/contributors.yml +++ b/contributors.yml @@ -24,3 +24,4 @@ - timdorr - turansky - vijaypushkin +- KutnerUri diff --git a/packages/react-router-dom/index.tsx b/packages/react-router-dom/index.tsx index de38f8774f..297134f9f9 100644 --- a/packages/react-router-dom/index.tsx +++ b/packages/react-router-dom/index.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import type { BrowserHistory, HashHistory, History } from "history"; -import { createBrowserHistory, createHashHistory, createPath } from "history"; +import { createBrowserHistory, createHashHistory } from "history"; import { MemoryRouter, Navigate, @@ -12,6 +12,8 @@ import { generatePath, matchRoutes, matchPath, + createPath, + parsePath, resolvePath, renderMatches, useHref, @@ -61,6 +63,8 @@ export { generatePath, matchRoutes, matchPath, + createPath, + parsePath, renderMatches, resolvePath, useHref, @@ -78,6 +82,7 @@ export { export { NavigationType } from "react-router"; export type { + Hash, Location, Path, To, @@ -96,7 +101,9 @@ export type { LayoutRouteProps, IndexRouteProps, RouterProps, - RoutesProps, + Pathname, + Search, + RoutesProps } from "react-router"; /////////////////////////////////////////////////////////////////////////////// diff --git a/packages/react-router-native/index.tsx b/packages/react-router-native/index.tsx index 05b1329d8a..aacd2b402f 100644 --- a/packages/react-router-native/index.tsx +++ b/packages/react-router-native/index.tsx @@ -19,6 +19,8 @@ import { generatePath, matchRoutes, matchPath, + createPath, + parsePath, resolvePath, renderMatches, useHref, @@ -53,6 +55,8 @@ export { generatePath, matchRoutes, matchPath, + createPath, + parsePath, resolvePath, renderMatches, useHref, @@ -70,6 +74,7 @@ export { export { NavigationType } from "react-router"; export type { + Hash, IndexRouteProps, LayoutRouteProps, Location, @@ -88,6 +93,8 @@ export type { RouteProps, RouterProps, RoutesProps, + Pathname, + Search, To, } from "react-router"; diff --git a/packages/react-router/index.tsx b/packages/react-router/index.tsx index e7da3a5b7a..9daf08f179 100644 --- a/packages/react-router/index.tsx +++ b/packages/react-router/index.tsx @@ -1,20 +1,24 @@ import * as React from "react"; import type { + Hash, History, InitialEntry, Location, MemoryHistory, Path, - To, + Pathname, + Search, + To } from "history"; import { Action as NavigationType, createMemoryHistory, parsePath, + createPath } from "history"; -export { NavigationType }; -export type { Location, Path, To }; +export { parsePath, createPath, NavigationType }; +export type { Hash, Location, Path, Pathname, Search, To }; function invariant(cond: any, message: string): asserts cond { if (!cond) throw new Error(message);