diff --git a/bower.json b/bower.json index 6ef27b5..cd0441c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-route-recognizer", - "version": "1.0.0-rc.1.0.0", + "version": "1.0.0-rc.1.0.1", "description": "A lightweight JavaScript library that matches paths against registered routes. It includes support for dynamic and star segments and nested handlers.", "keywords": [ "aurelia", diff --git a/dist/amd/aurelia-route-recognizer.js b/dist/amd/aurelia-route-recognizer.js index 99a909d..b2dcff4 100644 --- a/dist/amd/aurelia-route-recognizer.js +++ b/dist/amd/aurelia-route-recognizer.js @@ -258,13 +258,17 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) { }; RouteRecognizer.prototype.generate = function generate(name, params) { - var routeParams = Object.assign({}, params); - var route = this.names[name]; if (!route) { throw new Error('There is no route named ' + name); } + var handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + var routeParams = Object.assign({}, params); var segments = route.segments; var consumed = {}; var output = ''; diff --git a/dist/aurelia-route-recognizer.js b/dist/aurelia-route-recognizer.js index 3c2cc85..f677084 100644 --- a/dist/aurelia-route-recognizer.js +++ b/dist/aurelia-route-recognizer.js @@ -317,13 +317,17 @@ export class RouteRecognizer { * @returns The generated absolute path and query string. */ generate(name: string, params: Object): string { - let routeParams = Object.assign({}, params); - let route = this.names[name]; if (!route) { throw new Error(`There is no route named ${name}`); } + let handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + let routeParams = Object.assign({}, params); let segments = route.segments; let consumed = {}; let output = ''; diff --git a/dist/commonjs/aurelia-route-recognizer.js b/dist/commonjs/aurelia-route-recognizer.js index 258d82f..4adcef0 100644 --- a/dist/commonjs/aurelia-route-recognizer.js +++ b/dist/commonjs/aurelia-route-recognizer.js @@ -259,13 +259,17 @@ var RouteRecognizer = exports.RouteRecognizer = function () { }; RouteRecognizer.prototype.generate = function generate(name, params) { - var routeParams = Object.assign({}, params); - var route = this.names[name]; if (!route) { throw new Error('There is no route named ' + name); } + var handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + var routeParams = Object.assign({}, params); var segments = route.segments; var consumed = {}; var output = ''; diff --git a/dist/es2015/aurelia-route-recognizer.js b/dist/es2015/aurelia-route-recognizer.js index ee13b29..87a149e 100644 --- a/dist/es2015/aurelia-route-recognizer.js +++ b/dist/es2015/aurelia-route-recognizer.js @@ -209,13 +209,17 @@ export let RouteRecognizer = class RouteRecognizer { } generate(name, params) { - let routeParams = Object.assign({}, params); - let route = this.names[name]; if (!route) { throw new Error(`There is no route named ${ name }`); } + let handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + let routeParams = Object.assign({}, params); let segments = route.segments; let consumed = {}; let output = ''; diff --git a/dist/native-modules/aurelia-route-recognizer.js b/dist/native-modules/aurelia-route-recognizer.js index d682616..5e24a99 100644 --- a/dist/native-modules/aurelia-route-recognizer.js +++ b/dist/native-modules/aurelia-route-recognizer.js @@ -252,13 +252,17 @@ export var RouteRecognizer = function () { }; RouteRecognizer.prototype.generate = function generate(name, params) { - var routeParams = Object.assign({}, params); - var route = this.names[name]; if (!route) { throw new Error('There is no route named ' + name); } + var handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + var routeParams = Object.assign({}, params); var segments = route.segments; var consumed = {}; var output = ''; diff --git a/dist/system/aurelia-route-recognizer.js b/dist/system/aurelia-route-recognizer.js index f5af988..8daf5c7 100644 --- a/dist/system/aurelia-route-recognizer.js +++ b/dist/system/aurelia-route-recognizer.js @@ -375,13 +375,17 @@ System.register(['aurelia-path'], function (_export, _context) { }; RouteRecognizer.prototype.generate = function generate(name, params) { - var routeParams = Object.assign({}, params); - var route = this.names[name]; if (!route) { throw new Error('There is no route named ' + name); } + var handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + var routeParams = Object.assign({}, params); var segments = route.segments; var consumed = {}; var output = ''; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index e63e6bc..c6531f6 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,13 @@ + +# [1.0.0-rc.1.0.1](https://github.com/aurelia/route-recognizer/compare/1.0.0-rc.1.0.0...v1.0.0-rc.1.0.1) (2016-07-12) + + +### Bug Fixes + +* **route-recognizer:** respect explicit href during generation ([335f2a7](https://github.com/aurelia/route-recognizer/commit/335f2a7)) + + + # [1.0.0-rc.1.0.0](https://github.com/aurelia/route-recognizer/compare/1.0.0-beta.2.0.1...v1.0.0-rc.1.0.0) (2016-06-22) diff --git a/package.json b/package.json index be523dc..a44baea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-route-recognizer", - "version": "1.0.0-rc.1.0.0", + "version": "1.0.0-rc.1.0.1", "description": "A lightweight JavaScript library that matches paths against registered routes. It includes support for dynamic and star segments and nested handlers.", "keywords": [ "aurelia",