Skip to content

Commit 90f9bfd

Browse files
dosentmattertimdorr
authored andcommitted
Change path-to-regexp references to ^1.7.0 (#6117)
The most recent `path-to-regexp` versions are backward incompatible: https://github.com/pillarjs/path-to-regexp#compatibility-with-express--4x https://github.com/pillarjs/path-to-regexp/blob/master/History.md#200--2017-08-23
1 parent 233e6c5 commit 90f9bfd

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/react-router/docs/api/Redirect.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Route, Redirect } from 'react-router'
1616

1717
## to: string
1818

19-
The URL to redirect to. Any valid URL path that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regexp) understands.
19+
The URL to redirect to. Any valid URL path that [`path-to-regexp@^1.7.0`](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0) understands.
2020
All URL parameters that are used in `to` must be covered by `from`.
2121

2222
```jsx
@@ -25,7 +25,7 @@ All URL parameters that are used in `to` must be covered by `from`.
2525

2626
## to: object
2727

28-
A location to redirect to. `pathname` can be any valid URL path that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regexp) understands.
28+
A location to redirect to. `pathname` can be any valid URL path that [`path-to-regexp@^1.7.0`](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0) understands.
2929

3030
```jsx
3131
<Redirect to={{
@@ -47,8 +47,8 @@ When `true`, redirecting will push a new entry onto the history instead of repla
4747

4848
## from: string
4949

50-
A pathname to redirect from. Any valid URL path that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regexp) understands.
51-
All matched URL parameters are provided to the pattern in `to`. Must contain all parameters that are used in `to`. Additional parameters not used by `to` are ignored.
50+
A pathname to redirect from. Any valid URL path that [`path-to-regexp@^1.7.0`](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0) understands.
51+
All matched URL parameters are provided to the pattern in `to`. Must contain all parameters that are used in `to`. Additional parameters not used by `to` are ignored.
5252

5353
This can only be used to match a location when rendering a `<Redirect>` inside of a `<Switch>`. See [`<Switch children>`](./Switch.md#children-node) for more details.
5454

packages/react-router/docs/api/Route.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ This could also be useful for animations:
132132

133133
## path: string
134134

135-
Any valid URL path that [`path-to-regexp`](https://www.npmjs.com/package/path-to-regexp) understands.
135+
Any valid URL path that [`path-to-regexp@^1.7.0`](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0) understands.
136136

137137
```jsx
138138
<Route path="/users/:id" component={User}/>

packages/react-router/docs/guides/migrating.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ In v4, you must re-pass these properties to the `to` prop:
198198
## PatternUtils
199199

200200
### matchPattern(pattern, pathname)
201-
In v3, you could use the same matching code used internally to check if a path matched a pattern. In v4 this has been replaced by [matchPath](/packages/react-router/docs/api/matchPath.md) which is powered by the [path-to-regexp](https://github.com/pillarjs/path-to-regexp) library.
201+
In v3, you could use the same matching code used internally to check if a path matched a pattern. In v4 this has been replaced by [matchPath](/packages/react-router/docs/api/matchPath.md) which is powered by the [`path-to-regexp@^1.7.0`](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0) library.
202202

203203
### formatPattern(pattern, params)
204204
In v3, you could use PatternUtils.formatPattern to generate a valid path from a path pattern (perhaps in a constant or in your central routing config) and an object containing the names parameters:
@@ -210,7 +210,7 @@ const THING_PATH = '/thing/:id';
210210
<Link to={PatternUtils.formatPattern(THING_PATH, {id: 1})}>A thing</Link>
211211
```
212212

213-
In v4, you can achieve the same functionality using the [compile](https://github.com/pillarjs/path-to-regexp#compile-reverse-path-to-regexp) function in [path-to-regexp](https://github.com/pillarjs/path-to-regexp).
213+
In v4, you can achieve the same functionality using the [compile](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0#compile-reverse-path-to-regexp) function in [`path-to-regexp@^1.7.0`](https://github.com/pillarjs/path-to-regexp/tree/v1.7.0).
214214

215215
```jsx
216216
// v4

0 commit comments

Comments
 (0)