Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 22, 2016
1 parent 49392c5 commit 5c94f7e
Show file tree
Hide file tree
Showing 13 changed files with 348 additions and 507 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-route-recognizer",
"version": "1.0.0-beta.1.1.3",
"version": "1.0.0-beta.1.2.0",
"description": "A lightweight JavaScript library that matches paths against registered routes. It includes support for dynamic and star segments and nested handlers.",
"keywords": [
"aurelia",
Expand Down
80 changes: 43 additions & 37 deletions dist/amd/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
declare module 'aurelia-route-recognizer' {
import { buildQueryString, parseQueryString } from 'aurelia-path';
import {
buildQueryString,
parseQueryString
} from 'aurelia-path';
export interface RouteHandler {
name: string;
}
Expand All @@ -22,47 +25,47 @@ declare module 'aurelia-route-recognizer' {
repeat?: boolean;
}

// A State has a character specification and (`charSpec`) and a list of possible
// subsequent states (`nextStates`).
//
// If a State is an accepting state, it will also have several additional
// properties:
//
// * `regex`: A regular expression that is used to extract parameters from paths
// that reached this accepting state.
// * `handlers`: Information on how to convert the list of captures into calls
// to registered handlers with the specified parameters.
// * `types`: How many static, dynamic, or star segments in this route. Used to
// decide which route to use if multiple registered routes match a path.
//
// Currently, State is implemented naively by looping over `nextStates` and
// comparing a character specification against a character. A more efficient
// implementation would use a hash of keys pointing at one or more next states.
// A State has a character specification and (`charSpec`) and a list of possible
// subsequent states (`nextStates`).
//
// If a State is an accepting state, it will also have several additional
// properties:
//
// * `regex`: A regular expression that is used to extract parameters from paths
// that reached this accepting state.
// * `handlers`: Information on how to convert the list of captures into calls
// to registered handlers with the specified parameters.
// * `types`: How many static, dynamic, or star segments in this route. Used to
// decide which route to use if multiple registered routes match a path.
//
// Currently, State is implemented naively by looping over `nextStates` and
// comparing a character specification against a character. A more efficient
// implementation would use a hash of keys pointing at one or more next states.
export class State {
constructor(charSpec: CharSpec);
get(charSpec: CharSpec): State;
put(charSpec: CharSpec): State;

// Find a list of child states matching the next character
// Find a list of child states matching the next character
match(ch: string): State[];
}

// A Segment represents a segment in the original route description.
// Each Segment type provides an `eachChar` and `regex` method.
//
// The `eachChar` method invokes the callback with one or more character
// specifications. A character specification consumes one or more input
// characters.
//
// The `regex` method returns a regex fragment for the segment. If the
// segment is a dynamic or star segment, the regex fragment also includes
// a capture.
//
// A character specification contains:
//
// * `validChars`: a String with a list of all valid characters, or
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
// A Segment represents a segment in the original route description.
// Each Segment type provides an `eachChar` and `regex` method.
//
// The `eachChar` method invokes the callback with one or more character
// specifications. A character specification consumes one or more input
// characters.
//
// The `regex` method returns a regex fragment for the segment. If the
// segment is a dynamic or star segment, the regex fragment also includes
// a capture.
//
// A character specification contains:
//
// * `validChars`: a String with a list of all valid characters, or
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
eachChar(callback: ((spec: CharSpec) => void)): void;
Expand All @@ -87,6 +90,12 @@ declare module 'aurelia-route-recognizer' {
generate(): string;
}

/**
* Class that parses route patterns and matches path strings.
*
* @class RouteRecognizer
* @constructor
*/
/**
* Class that parses route patterns and matches path strings.
*
Expand Down Expand Up @@ -139,7 +148,4 @@ declare module 'aurelia-route-recognizer' {
*/
recognize(path: string): RecognizedRoute[];
}
class RecognizeResults {
constructor(queryParams: Object);
}
}
63 changes: 29 additions & 34 deletions dist/amd/aurelia-route-recognizer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
'use strict';

exports.__esModule = true;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RouteRecognizer = exports.EpsilonSegment = exports.StarSegment = exports.DynamicSegment = exports.StaticSegment = exports.State = undefined;

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}

var State = (function () {
var State = exports.State = function () {
function State(charSpec) {
_classCallCheck(this, State);

Expand Down Expand Up @@ -77,15 +84,13 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
};

return State;
})();

exports.State = State;
}();

var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];

var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');

var StaticSegment = (function () {
var StaticSegment = exports.StaticSegment = function () {
function StaticSegment(string) {
_classCallCheck(this, StaticSegment);

Expand All @@ -109,11 +114,9 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
};

return StaticSegment;
})();

exports.StaticSegment = StaticSegment;
}();

var DynamicSegment = (function () {
var DynamicSegment = exports.DynamicSegment = function () {
function DynamicSegment(name) {
_classCallCheck(this, DynamicSegment);

Expand All @@ -134,11 +137,9 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
};

return DynamicSegment;
})();
}();

exports.DynamicSegment = DynamicSegment;

var StarSegment = (function () {
var StarSegment = exports.StarSegment = function () {
function StarSegment(name) {
_classCallCheck(this, StarSegment);

Expand All @@ -159,11 +160,9 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
};

return StarSegment;
})();

exports.StarSegment = StarSegment;
}();

var EpsilonSegment = (function () {
var EpsilonSegment = exports.EpsilonSegment = function () {
function EpsilonSegment() {
_classCallCheck(this, EpsilonSegment);
}
Expand All @@ -179,11 +178,9 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
};

return EpsilonSegment;
})();
}();

exports.EpsilonSegment = EpsilonSegment;

var RouteRecognizer = (function () {
var RouteRecognizer = exports.RouteRecognizer = function () {
function RouteRecognizer() {
_classCallCheck(this, RouteRecognizer);

Expand Down Expand Up @@ -233,8 +230,8 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {

if (routeName) {
var routeNames = Array.isArray(routeName) ? routeName : [routeName];
for (var i = 0; i < routeNames.length; i++) {
this.names[routeNames[i]] = {
for (var _i2 = 0; _i2 < routeNames.length; _i2++) {
this.names[routeNames[_i2]] = {
segments: segments,
handlers: handlers
};
Expand Down Expand Up @@ -297,7 +294,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
delete routeParams[param];
}

var queryString = _aureliaPath.buildQueryString(routeParams);
var queryString = (0, _aureliaPath.buildQueryString)(routeParams);
output += queryString ? '?' + queryString : '';

return output;
Expand All @@ -313,7 +310,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
if (queryStart !== -1) {
var queryString = normalizedPath.substr(queryStart + 1, normalizedPath.length);
normalizedPath = normalizedPath.substr(0, queryStart);
queryParams = _aureliaPath.parseQueryString(queryString);
queryParams = (0, _aureliaPath.parseQueryString)(queryString);
}

normalizedPath = decodeURI(normalizedPath);
Expand All @@ -336,9 +333,9 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
}

var solutions = [];
for (var i = 0, l = states.length; i < l; i++) {
if (states[i].handlers) {
solutions.push(states[i]);
for (var _i3 = 0, _l = states.length; _i3 < _l; _i3++) {
if (states[_i3].handlers) {
solutions.push(states[_i3]);
}
}

Expand All @@ -355,9 +352,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
};

return RouteRecognizer;
})();

exports.RouteRecognizer = RouteRecognizer;
}();

var RecognizeResults = function RecognizeResults(queryParams) {
_classCallCheck(this, RecognizeResults);
Expand Down
80 changes: 43 additions & 37 deletions dist/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
declare module 'aurelia-route-recognizer' {
import { buildQueryString, parseQueryString } from 'aurelia-path';
import {
buildQueryString,
parseQueryString
} from 'aurelia-path';
export interface RouteHandler {
name: string;
}
Expand All @@ -22,47 +25,47 @@ declare module 'aurelia-route-recognizer' {
repeat?: boolean;
}

// A State has a character specification and (`charSpec`) and a list of possible
// subsequent states (`nextStates`).
//
// If a State is an accepting state, it will also have several additional
// properties:
//
// * `regex`: A regular expression that is used to extract parameters from paths
// that reached this accepting state.
// * `handlers`: Information on how to convert the list of captures into calls
// to registered handlers with the specified parameters.
// * `types`: How many static, dynamic, or star segments in this route. Used to
// decide which route to use if multiple registered routes match a path.
//
// Currently, State is implemented naively by looping over `nextStates` and
// comparing a character specification against a character. A more efficient
// implementation would use a hash of keys pointing at one or more next states.
// A State has a character specification and (`charSpec`) and a list of possible
// subsequent states (`nextStates`).
//
// If a State is an accepting state, it will also have several additional
// properties:
//
// * `regex`: A regular expression that is used to extract parameters from paths
// that reached this accepting state.
// * `handlers`: Information on how to convert the list of captures into calls
// to registered handlers with the specified parameters.
// * `types`: How many static, dynamic, or star segments in this route. Used to
// decide which route to use if multiple registered routes match a path.
//
// Currently, State is implemented naively by looping over `nextStates` and
// comparing a character specification against a character. A more efficient
// implementation would use a hash of keys pointing at one or more next states.
export class State {
constructor(charSpec: CharSpec);
get(charSpec: CharSpec): State;
put(charSpec: CharSpec): State;

// Find a list of child states matching the next character
// Find a list of child states matching the next character
match(ch: string): State[];
}

// A Segment represents a segment in the original route description.
// Each Segment type provides an `eachChar` and `regex` method.
//
// The `eachChar` method invokes the callback with one or more character
// specifications. A character specification consumes one or more input
// characters.
//
// The `regex` method returns a regex fragment for the segment. If the
// segment is a dynamic or star segment, the regex fragment also includes
// a capture.
//
// A character specification contains:
//
// * `validChars`: a String with a list of all valid characters, or
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
// A Segment represents a segment in the original route description.
// Each Segment type provides an `eachChar` and `regex` method.
//
// The `eachChar` method invokes the callback with one or more character
// specifications. A character specification consumes one or more input
// characters.
//
// The `regex` method returns a regex fragment for the segment. If the
// segment is a dynamic or star segment, the regex fragment also includes
// a capture.
//
// A character specification contains:
//
// * `validChars`: a String with a list of all valid characters, or
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
eachChar(callback: ((spec: CharSpec) => void)): void;
Expand All @@ -87,6 +90,12 @@ declare module 'aurelia-route-recognizer' {
generate(): string;
}

/**
* Class that parses route patterns and matches path strings.
*
* @class RouteRecognizer
* @constructor
*/
/**
* Class that parses route patterns and matches path strings.
*
Expand Down Expand Up @@ -139,7 +148,4 @@ declare module 'aurelia-route-recognizer' {
*/
recognize(path: string): RecognizedRoute[];
}
class RecognizeResults {
constructor(queryParams: Object);
}
}
Loading

0 comments on commit 5c94f7e

Please sign in to comment.