Skip to content

Releases: kriasoft/universal-router

4.1.0 - 2017-09-20

Choose a tag to compare

@frenzzy frenzzy released this 20 Sep 07:42
  • 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' }

4.0.0 - 2017-09-15

Choose a tag to compare

@frenzzy frenzzy released this 15 Sep 11:44
  • 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$/

3.2.0 - 2017-05-10

Choose a tag to compare

@frenzzy frenzzy released this 10 May 07:14
  • Add stringifyQueryParams option to generateUrls(router, options) to generate URL with query string from unknown route params (#93)

3.1.0 - 2017-04-20

Choose a tag to compare

@frenzzy frenzzy released this 20 Apr 13:30
  • Fix context.next() for multiple nested routes (#91)
  • Add pretty option for generateUrls(router, options) to prettier encoding of URI path segments (#88)
  • Add source maps for minified builds (#87)
  • Include UMD builds to the git repository

3.0.0 - 2017-03-25

Choose a tag to compare

@frenzzy frenzzy released this 25 Mar 19:09
  • 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
  • context.next() now iterates only child routes by default (BREAKING CHANGE)
    use context.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
    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 to resolve method
  • Add context property to Route not found error

2.0.0 - 2016-10-20

Choose a tag to compare

@frenzzy frenzzy released this 25 Mar 19:11
  • Preserve context.params values from the parent route (#57)
  • Throws an error if no route found (#62)
  • Remove obsolete context.end() method (#60)
  • Remove obsolete match alias for resolve function (#59)
  • Do not throw an error for malformed URI params (#54)
  • Handle null the same way as undefined (#51)
  • Return null instead of undefined to signal no match (#51)
  • Support context.next() across multiple routes (#49)
  • Sequential execution of asynchronous routes (#49)
  • Remove errors handler from core (#48)
  • Drop support of node.js v5 and below (#47)

1.2.2 - 2016-05-31

Choose a tag to compare

@frenzzy frenzzy released this 25 Mar 19:11
  • Update UMD build to include missing dependencies (#33)

1.2.1 - 2016-05-12

Choose a tag to compare

@frenzzy frenzzy released this 25 Mar 19:12
  • Rename src/browser.js to src/main.js

1.2.0 - 2016-05-12

Choose a tag to compare

@frenzzy frenzzy released this 26 Mar 20:48
  • Rename match() to resolve(). E.g. import { resovle } from 'universal-router'
  • Fix an issue when the router throws an exception when the top-level route doesn't have children property
  • Include CommonJS, Harmony Modules, ES5.1 and UMD builds into NPM package
  • Include source maps into NPM package

1.1.0-beta.4 - 2016-04-27

Choose a tag to compare

@frenzzy frenzzy released this 25 Mar 19:13
  • Fix optional parameters, e.g. /products/:id? (#27)