universal-router v4.0.0 Release Notes

Release Date: 2017-09-15 // over 6 years ago
    • ๐Ÿ“‡ Rename router.resolve({ path }) to router.resolve({ pathname }) (BREAKING CHANGE #114)
    • ๐Ÿ“‡ Rename context.url to context.pathname (BREAKING CHANGE #114)
    • โœ‚ Remove pretty option from generateUrls(router, options) function in favor of new encode 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 ((.*))
    • โž• Add support for repeat parameters (#116)
    • โž• Add encode option to generateUrls(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 and queryParams 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, ... }) to router.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: '*' with path: '(.*)' if any
    • ๐Ÿ”ง If you are using webpack, change rule (loader) for .js files to include .mjs extension, i.e.
      • test: /\.js$/ => test: /\.m?js$/