Skip to content
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

Update path-to-regexp from v2.4 to v3 #161

Merged
merged 1 commit into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- Update [path-to-regexp](https://github.com/pillarjs/path-to-regexp) from v2.4.0 to v3.0.0, see
[changelog](https://github.com/pillarjs/path-to-regexp/blob/4eee1e15ba72d93c996bac4ae649a846eb326562/History.md#300--2019-01-13)
(BREAKING CHANGE [#161](https://github.com/kriasoft/universal-router/pull/161))
- Add [TypeScript](https://www.typescriptlang.org/) typings
([#159](https://github.com/kriasoft/universal-router/pull/159))

Expand Down
40 changes: 16 additions & 24 deletions dist/universal-router.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/universal-router.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/universal-router.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/universal-router.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"esnext": "src/UniversalRouter.js",
"types": "src/UniversalRouter.d.ts",
"dependencies": {
"path-to-regexp": "^2.4.0"
"path-to-regexp": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
Expand Down
24 changes: 12 additions & 12 deletions test/matchPath.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ describe('matchPath(route, pathname)', () => {
})

it('should work following a partial capture group', () => {
const result1 = matchPath({ path: '/user(s)?/:user/:op' }, '/users/tj/edit', [], null)
const result2 = matchPath({ path: '/user(s)?/:user/:op' }, '/user/tj/edit', result1.keys, null)
expect(result1).toBeDefined()
expect(result1).toHaveProperty('keys')
expect(result1.keys).toBeInstanceOf(Array)
expect(result1.keys).toHaveLength(3)
expect(result1).toHaveProperty('params', { 0: 's', user: 'tj', op: 'edit' })
expect(result2).toBeDefined()
expect(result2).toHaveProperty('keys')
expect(result2.keys).toBeInstanceOf(Array)
expect(result2.keys).toHaveLength(6)
expect(result2).toHaveProperty('params', { 0: undefined, user: 'tj', op: 'edit' })
const res1 = matchPath({ path: '/(user|users)/:user/:op' }, '/users/tj/edit', [], null)
const res2 = matchPath({ path: '/(user|users)/:user/:op' }, '/user/tj/edit', res1.keys, null)
expect(res1).toBeDefined()
expect(res1).toHaveProperty('keys')
expect(res1.keys).toBeInstanceOf(Array)
expect(res1.keys).toHaveLength(3)
expect(res1).toHaveProperty('params', { 0: 'users', user: 'tj', op: 'edit' })
expect(res2).toBeDefined()
expect(res2).toHaveProperty('keys')
expect(res2.keys).toBeInstanceOf(Array)
expect(res2.keys).toHaveLength(6)
expect(res2).toHaveProperty('params', { 0: 'user', user: 'tj', op: 'edit' })
})

it('should match to an array of paths', () => {
Expand Down