Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed May 10, 2016
1 parent 586cdc8 commit 2c89fa3
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 192 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.2.0",
"version": "1.0.0-beta.1.2.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",
Expand Down
3 changes: 2 additions & 1 deletion dist/amd/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module 'aurelia-route-recognizer' {
export interface ConfigurableRoute {
path: string;
handler: RouteHandler;
caseSensitive: boolean;
}
export interface HandlerEntry {
handler: RouteHandler;
Expand Down Expand Up @@ -67,7 +68,7 @@ declare module 'aurelia-route-recognizer' {
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
constructor(string: string, caseSensitive: boolean);
eachChar(callback: ((spec: CharSpec) => void)): void;
regex(): string;
generate(): string;
Expand Down
13 changes: 7 additions & 6 deletions dist/amd/aurelia-route-recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,18 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');

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

this.string = string;
this.caseSensitive = caseSensitive;
}

StaticSegment.prototype.eachChar = function eachChar(callback) {
var s = this.string;
for (var i = 0, ii = s.length; i < ii; ++i) {
var ch = s[i];
callback({ validChars: ch });
callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
}
};

Expand Down Expand Up @@ -204,7 +205,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
var names = [];
var routeName = route.handler.name;
var isEmpty = true;
var segments = parse(route.path, names, types);
var segments = parse(route.path, names, types, route.caseSensitive);

for (var i = 0, ii = segments.length; i < ii; i++) {
var segment = segments[i];
Expand Down Expand Up @@ -239,7 +240,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
}

currentState.handlers = handlers;
currentState.regex = new RegExp(regex + '$');
currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
currentState.types = types;

return currentState;
Expand Down Expand Up @@ -364,7 +365,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
this.queryParams = queryParams || {};
};

function parse(route, names, types) {
function parse(route, names, types, caseSensitive) {
var normalizedRoute = route;
if (route.charAt(0) === '/') {
normalizedRoute = route.substr(1);
Expand All @@ -391,7 +392,7 @@ define(['exports', 'aurelia-path'], function (exports, _aureliaPath) {
} else if (segment === '') {
results.push(new EpsilonSegment());
} else {
results.push(new StaticSegment(segment));
results.push(new StaticSegment(segment, caseSensitive));
types.statics++;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dist/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module 'aurelia-route-recognizer' {
export interface ConfigurableRoute {
path: string;
handler: RouteHandler;
caseSensitive: boolean;
}
export interface HandlerEntry {
handler: RouteHandler;
Expand Down Expand Up @@ -67,7 +68,7 @@ declare module 'aurelia-route-recognizer' {
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
constructor(string: string, caseSensitive: boolean);
eachChar(callback: ((spec: CharSpec) => void)): void;
regex(): string;
generate(): string;
Expand Down
14 changes: 8 additions & 6 deletions dist/aurelia-route-recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,16 @@ const escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
// * `repeat`: true if the character specification can repeat

export class StaticSegment {
constructor(string: string) {
constructor(string: string, caseSensitive: boolean) {
this.string = string;
this.caseSensitive = caseSensitive;
}

eachChar(callback: (spec: CharSpec) => void): void {
let s = this.string;
for (let i = 0, ii = s.length; i < ii; ++i) {
let ch = s[i];
callback({ validChars: ch });
callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
}
}

Expand Down Expand Up @@ -188,6 +189,7 @@ interface RouteHandler {
interface ConfigurableRoute {
path: string;
handler: RouteHandler;
caseSensitive: boolean;
}

interface HandlerEntry {
Expand Down Expand Up @@ -236,7 +238,7 @@ export class RouteRecognizer {
let names = [];
let routeName = route.handler.name;
let isEmpty = true;
let segments = parse(route.path, names, types);
let segments = parse(route.path, names, types, route.caseSensitive);

for (let i = 0, ii = segments.length; i < ii; i++) {
let segment = segments[i];
Expand Down Expand Up @@ -273,7 +275,7 @@ export class RouteRecognizer {
}

currentState.handlers = handlers;
currentState.regex = new RegExp(regex + '$');
currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
currentState.types = types;

return currentState;
Expand Down Expand Up @@ -427,7 +429,7 @@ class RecognizeResults {
}
}

function parse(route, names, types) {
function parse(route, names, types, caseSensitive) {
// normalize route as not starting with a '/'. Recognition will
// also normalize.
let normalizedRoute = route;
Expand Down Expand Up @@ -456,7 +458,7 @@ function parse(route, names, types) {
} else if (segment === '') {
results.push(new EpsilonSegment());
} else {
results.push(new StaticSegment(segment));
results.push(new StaticSegment(segment, caseSensitive));
types.statics++;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dist/commonjs/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module 'aurelia-route-recognizer' {
export interface ConfigurableRoute {
path: string;
handler: RouteHandler;
caseSensitive: boolean;
}
export interface HandlerEntry {
handler: RouteHandler;
Expand Down Expand Up @@ -67,7 +68,7 @@ declare module 'aurelia-route-recognizer' {
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
constructor(string: string, caseSensitive: boolean);
eachChar(callback: ((spec: CharSpec) => void)): void;
regex(): string;
generate(): string;
Expand Down
13 changes: 7 additions & 6 deletions dist/commonjs/aurelia-route-recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'
var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');

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

this.string = string;
this.caseSensitive = caseSensitive;
}

StaticSegment.prototype.eachChar = function eachChar(callback) {
var s = this.string;
for (var i = 0, ii = s.length; i < ii; ++i) {
var ch = s[i];
callback({ validChars: ch });
callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
}
};

Expand Down Expand Up @@ -201,7 +202,7 @@ var RouteRecognizer = exports.RouteRecognizer = function () {
var names = [];
var routeName = route.handler.name;
var isEmpty = true;
var segments = parse(route.path, names, types);
var segments = parse(route.path, names, types, route.caseSensitive);

for (var i = 0, ii = segments.length; i < ii; i++) {
var segment = segments[i];
Expand Down Expand Up @@ -236,7 +237,7 @@ var RouteRecognizer = exports.RouteRecognizer = function () {
}

currentState.handlers = handlers;
currentState.regex = new RegExp(regex + '$');
currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
currentState.types = types;

return currentState;
Expand Down Expand Up @@ -361,7 +362,7 @@ var RecognizeResults = function RecognizeResults(queryParams) {
this.queryParams = queryParams || {};
};

function parse(route, names, types) {
function parse(route, names, types, caseSensitive) {
var normalizedRoute = route;
if (route.charAt(0) === '/') {
normalizedRoute = route.substr(1);
Expand All @@ -388,7 +389,7 @@ function parse(route, names, types) {
} else if (segment === '') {
results.push(new EpsilonSegment());
} else {
results.push(new StaticSegment(segment));
results.push(new StaticSegment(segment, caseSensitive));
types.statics++;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dist/es2015/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module 'aurelia-route-recognizer' {
export interface ConfigurableRoute {
path: string;
handler: RouteHandler;
caseSensitive: boolean;
}
export interface HandlerEntry {
handler: RouteHandler;
Expand Down Expand Up @@ -67,7 +68,7 @@ declare module 'aurelia-route-recognizer' {
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
constructor(string: string, caseSensitive: boolean);
eachChar(callback: ((spec: CharSpec) => void)): void;
regex(): string;
generate(): string;
Expand Down
13 changes: 7 additions & 6 deletions dist/es2015/aurelia-route-recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ const specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\
const escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');

export let StaticSegment = class StaticSegment {
constructor(string) {
constructor(string, caseSensitive) {
this.string = string;
this.caseSensitive = caseSensitive;
}

eachChar(callback) {
let s = this.string;
for (let i = 0, ii = s.length; i < ii; ++i) {
let ch = s[i];
callback({ validChars: ch });
callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
}
}

Expand Down Expand Up @@ -151,7 +152,7 @@ export let RouteRecognizer = class RouteRecognizer {
let names = [];
let routeName = route.handler.name;
let isEmpty = true;
let segments = parse(route.path, names, types);
let segments = parse(route.path, names, types, route.caseSensitive);

for (let i = 0, ii = segments.length; i < ii; i++) {
let segment = segments[i];
Expand Down Expand Up @@ -186,7 +187,7 @@ export let RouteRecognizer = class RouteRecognizer {
}

currentState.handlers = handlers;
currentState.regex = new RegExp(regex + '$');
currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
currentState.types = types;

return currentState;
Expand Down Expand Up @@ -310,7 +311,7 @@ let RecognizeResults = class RecognizeResults {
};


function parse(route, names, types) {
function parse(route, names, types, caseSensitive) {
let normalizedRoute = route;
if (route.charAt(0) === '/') {
normalizedRoute = route.substr(1);
Expand All @@ -337,7 +338,7 @@ function parse(route, names, types) {
} else if (segment === '') {
results.push(new EpsilonSegment());
} else {
results.push(new StaticSegment(segment));
results.push(new StaticSegment(segment, caseSensitive));
types.statics++;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dist/system/aurelia-route-recognizer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module 'aurelia-route-recognizer' {
export interface ConfigurableRoute {
path: string;
handler: RouteHandler;
caseSensitive: boolean;
}
export interface HandlerEntry {
handler: RouteHandler;
Expand Down Expand Up @@ -67,7 +68,7 @@ declare module 'aurelia-route-recognizer' {
// * `invalidChars`: a String with a list of all invalid characters
// * `repeat`: true if the character specification can repeat
export class StaticSegment {
constructor(string: string);
constructor(string: string, caseSensitive: boolean);
eachChar(callback: ((spec: CharSpec) => void)): void;
regex(): string;
generate(): string;
Expand Down
13 changes: 7 additions & 6 deletions dist/system/aurelia-route-recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ System.register(['aurelia-path'], function (_export, _context) {
}
}

function parse(route, names, types) {
function parse(route, names, types, caseSensitive) {
var normalizedRoute = route;
if (route.charAt(0) === '/') {
normalizedRoute = route.substr(1);
Expand All @@ -36,7 +36,7 @@ System.register(['aurelia-path'], function (_export, _context) {
} else if (segment === '') {
results.push(new EpsilonSegment());
} else {
results.push(new StaticSegment(segment));
results.push(new StaticSegment(segment, caseSensitive));
types.statics++;
}
}
Expand Down Expand Up @@ -198,17 +198,18 @@ System.register(['aurelia-path'], function (_export, _context) {
escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');

_export('StaticSegment', StaticSegment = function () {
function StaticSegment(string) {
function StaticSegment(string, caseSensitive) {
_classCallCheck(this, StaticSegment);

this.string = string;
this.caseSensitive = caseSensitive;
}

StaticSegment.prototype.eachChar = function eachChar(callback) {
var s = this.string;
for (var i = 0, ii = s.length; i < ii; ++i) {
var ch = s[i];
callback({ validChars: ch });
callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
}
};

Expand Down Expand Up @@ -319,7 +320,7 @@ System.register(['aurelia-path'], function (_export, _context) {
var names = [];
var routeName = route.handler.name;
var isEmpty = true;
var segments = parse(route.path, names, types);
var segments = parse(route.path, names, types, route.caseSensitive);

for (var i = 0, ii = segments.length; i < ii; i++) {
var segment = segments[i];
Expand Down Expand Up @@ -354,7 +355,7 @@ System.register(['aurelia-path'], function (_export, _context) {
}

currentState.handlers = handlers;
currentState.regex = new RegExp(regex + '$');
currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
currentState.types = types;

return currentState;
Expand Down
8 changes: 8 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 1.0.0-beta.1.2.1 (2016-05-10)


#### Bug Fixes

* **route-recognizer:** route recognizer is case insensitive by default ([d89cde4c](http://github.com/aurelia/route-recognizer/commit/d89cde4c8abd104f8c8dcbdc4aed799be3b78555))


### 1.0.0-beta.1.2.0 (2016-03-22)

* Update to Babel 6
Expand Down
Loading

0 comments on commit 2c89fa3

Please sign in to comment.