All Versions
29
Latest Version
Avg Release Cycle
82 days
Latest Release
1009 days ago
Changelog History
Page 2
Changelog History
Page 2
-
v5.1.0 Changes
January 16, 2018- ๐ Allow any string to be a valid route name (#145)
-
v5.0.0 Changes
October 30, 2017- Skip nested routes when a middleware route returns
null
(BREAKING CHANGE #140)
Migration from v4 to v5:
- If you are using
resolveRoute
option for custom route handling logic then you need to returnundefined
instead ofnull
in cases when a route should not match - ๐ Make sure that your middleware routes which return
null
are working as you expect, child routes are no longer executed in this case, useundefined
instead if necessary
- Skip nested routes when a middleware route returns
-
v4.3.0 Changes
October 22, 2017- โก๏ธ Update path-to-regexp from v2.0.0 to v2.1.0, see changelog (#137)
-
v4.2.1 Changes
October 06, 2017- ๐ Fix order of
context.keys
when they preserved from parent routes (i.e. keys order is the same as they appear in a url) (#129)
- ๐ Fix order of
-
v4.2.0 Changes
September 20, 2017- Correctly handle trailing slashes in paths of routes
(#124)
If you are using trailing slashes in your paths, then the router will match urls only with trailing slashes:
js const routes = [ { path: '/posts', ... }, // matches both "/posts" and "/posts/" { path: '/posts/', ... }, // matches only "/posts/" ]
- Generate url from first path for routes with an array of paths
(#124)
js const router = new UniversalRouter({ name: 'page', path: ['/one', '/two', /RegExp/], // only first path is used for url generation }) const url = generateUrls(router) url('page') // => /one
- Correctly handle trailing slashes in paths of routes
(#124)
If you are using trailing slashes in your paths, then the router will match urls only with trailing slashes:
-
v4.1.0 Changes
September 20, 2017- ๐ Support for using the same param name in array of paths (#122)
const router = new UniversalRouter({ path: ['/one/:parameter', '/two/:parameter'], action: context => context.params, }) router.resolve('/one/a') // => { parameter: 'a' } router.resolve('/two/b') // => { parameter: 'b' }
-
v4.0.0 Changes
September 15, 2017- ๐ Rename
router.resolve({ path })
torouter.resolve({ pathname })
(BREAKING CHANGE #114) - ๐ Rename
context.url
tocontext.pathname
(BREAKING CHANGE #114) - โ Remove
pretty
option fromgenerateUrls(router, options)
function in favor of newencode
option (BREAKING CHANGE #111) - โก๏ธ Update path-to-regexp to v2.0.0, see
changelog
(BREAKING CHANGE #111)
- Explicitly handle trailing delimiters (e.g.
/test/
is now treated as/test/
instead of/test
when matching) - No wildcard asterisk (
*
) - use parameters instead ((.*)
)
- Explicitly handle trailing delimiters (e.g.
- โ Add support for repeat parameters (#116)
- โ Add
encode
option togenerateUrls(router, options)
function for pretty encoding (e.g. pass your own implementation) (#111) - Preserve
context.keys
values from the parent route (#111) - Inherit
context.params
andqueryParams
from Object (e.g.params.hasOwnProperty()
won't throw an exception anymore) (#111) - ๐ฆ Include the source code of the router in the npm package (#110)
Migration from v3 to v4:
- ๐ Change
router.resolve({ path, ... })
torouter.resolve({ pathname, ... })
- โ Remove trailing slashes from all paths of your routes, i.e.
path: '/posts/:uri/'
=>path: '/posts/:uri'
path: '/posts/'
=>path: '/posts'
path: '/'
=>path: ''
- etc.
- Replace
path: '*'
withpath: '(.*)'
if any - ๐ง If you are using webpack, change rule (loader)
for
.js
files to include.mjs
extension, i.e.test: /\.js$/
=>test: /\.m?js$/
- ๐ Rename
-
v3.2.0 Changes
May 10, 2017- โ Add
stringifyQueryParams
option togenerateUrls(router, options)
to generate URL with query string from unknown route params (#93)
- โ Add
-
v3.1.0 Changes
April 20, 2017 -
v3.0.0 Changes
March 25, 2017- โก๏ธ Update Router API (BREAKING CHANGE)
import Router from 'universal-router' const router = new Router(routes, options) router.resolve({ path, ...context }) // => Promise<any> // previously import { resolve } from 'universal-router' resolve(routes, { path, ...context }) // => Promise<any>
See #83 for more info and examples
- 0๏ธโฃ
context.next()
now iterates only child routes by default (BREAKING CHANGE) usecontext.next(true)
to iterate through the all remaining routes - โ Remove
babel-runtime
dependency to decrease library size (BREAKING CHANGE) Now you need to care about these polyfills yourself: - โ Add support for URL Generation
js import generateUrls from 'universal-router/generate-urls' const url = generateUrls(router) url(routeName, params) // => String
- โ Add support for Dynamic Breadcrumbs, use
context.route.parent
to iterate - โ Add support for Declarative Routes,
new Router(routes, { resolveRoute: customResolveRouteFn })
- โ Add support for Base URL option,
new Router(routes, { baseUrl: '/base' })
- โ Add ability to specify custom context properties once,
new Router(routes, { context: { ... } })
- Rewrite
matchRoute
function without usage of generators to decrease amount of necessary polyfills - โ Remove usage of String.prototype.startsWith()
- โ Add
context.url
with the original url passed toresolve
method - โ Add
context
property toRoute not found
error