Comparing version 1.0.8 to 1.0.9-1
@@ -63,4 +63,4 @@ | ||
this.invoke(fns, { tty: tty, cmd: path }, callback); | ||
this.invoke(this.runlist(fns), { tty: tty, cmd: path }, callback); | ||
return true; | ||
}; |
@@ -1,2 +0,1 @@ | ||
var events = require('events'), | ||
@@ -77,3 +76,4 @@ qs = require('querystring'), | ||
var method = req.method === 'HEAD' ? 'get' : req.method.toLowerCase(), | ||
fns = this.traverse(method, req.url, this.routes, ''), | ||
url = req.url.split("?", 1)[0], | ||
fns = this.traverse(method, url, this.routes, ''), | ||
thisArg = { req: req, res: res }, | ||
@@ -113,20 +113,22 @@ self = this, | ||
if (!stream) { | ||
// | ||
// If there is no streaming required on any of the functions on the | ||
// way to `path`, then attempt to parse the fully buffered request stream | ||
// once it has emitted the `end` event. | ||
// | ||
if (req.readable) { | ||
process.nextTick(function () { | ||
// | ||
// If the `http.ServerRequest` is still readable, then await | ||
// the end event and then continue | ||
// If there is no streaming required on any of the functions on the | ||
// way to `path`, then attempt to parse the fully buffered request stream | ||
// once it has emitted the `end` event. | ||
// | ||
req.once('end', parseAndInvoke) | ||
} | ||
else { | ||
// | ||
// Otherwise, just parse the body now. | ||
// | ||
parseAndInvoke(); | ||
} | ||
if (req.readable) { | ||
// | ||
// If the `http.ServerRequest` is still readable, then await | ||
// the end event and then continue | ||
// | ||
req.once('end', parseAndInvoke) | ||
} | ||
else { | ||
// | ||
// Otherwise, just parse the body now. | ||
// | ||
parseAndInvoke(); | ||
} | ||
}); | ||
} | ||
@@ -133,0 +135,0 @@ else { |
@@ -83,5 +83,5 @@ /* | ||
} | ||
return mod === str | ||
? '([a-zA-Z0-9-]+)' | ||
? '([._a-zA-Z0-9-]+)' | ||
: mod; | ||
@@ -336,4 +336,7 @@ } | ||
if (this.async) { | ||
_asyncEverySeries(fns, function (fn, next) { | ||
if (typeof fn == 'function') { | ||
_asyncEverySeries(fns, function apply(fn, next) { | ||
if (Array.isArray(fn)) { | ||
return _asyncEverySeries(fn, apply, next); | ||
} | ||
else if (typeof fn == 'function') { | ||
fn.apply(thisArg, fns.captures.concat(next)); | ||
@@ -340,0 +343,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Nodejitsu Inc <info@nodejitsu.com>", | ||
"version": "1.0.8", | ||
"version": "1.0.9-1", | ||
"maintainers": [ "hij1nx <hij1nx@me.com>", "indexzero <charlie.robbins@gmail.com>" ], | ||
@@ -21,5 +21,4 @@ "contributors": [ | ||
"colors": "0.5.x", | ||
"eyes": "0.1.x", | ||
"uglify-js": "1.0.6", | ||
"request": "2.0.x", | ||
"request": "2.9.x", | ||
"vows": "0.6.x" | ||
@@ -33,2 +32,3 @@ }, | ||
} | ||
} | ||
} | ||
@@ -1,9 +0,19 @@ | ||
# Director [![Build Status](https://secure.travis-ci.org/flatiron/director.png)](http://travis-ci.org/flatiron/director) | ||
# Overview | ||
Director is a router. Routing is the process of determining what code to run when a URL is requested. Director works on the client and the server. Director is dependency free, on the client it does not require any other libraries (such as jQuery). | ||
<img src="https://github.com/flatiron/director/raw/master/img/director.png" /> | ||
# Synopsis | ||
Director is a router. Routing is the process of determining what code to run when a URL is requested. | ||
# Motivation | ||
A routing library that works in both the browser and node.js environments with as few differences as possible. Simplifies the development of Single Page Apps and Node.js applications. Dependency free (doesn't require jQuery or Express, etc). | ||
# Status | ||
[![Build Status](https://secure.travis-ci.org/flatiron/director.png)](http://travis-ci.org/flatiron/director) | ||
# Features | ||
* [Client-Side Routing](#client-side) | ||
* [Server-Side HTTP Routing](#http-routing) | ||
* [Server-Side CLI Routing](#cli-routing) | ||
# Usage | ||
* [API Documentation](#api-documentation) | ||
@@ -34,10 +44,13 @@ * [Frequently Asked Questions](#faq) | ||
var author = function () { /* ... */ }, | ||
books = function () { /* ... */ }; | ||
books = function () { /* ... */ }, | ||
viewBook = function(bookId) { /* bookId is populated. */ }; | ||
var routes = { | ||
'/author': showAuthorInfo, | ||
'/books': [showAuthorInfo, listBooks] | ||
'/author': author, | ||
'/books': [books, function() { /* An inline route handler. */ }], | ||
'/books/view/:bookId': viewBook | ||
}; | ||
var router = Router(routes); | ||
router.init(); | ||
@@ -91,2 +104,3 @@ </script> | ||
}); | ||
router.init(); | ||
@@ -102,3 +116,3 @@ </script> | ||
You can find a browser-specific build of `director` [here][0] which has all of the server code stripped away. | ||
You can find a browser-specific build of `director` [here][1] which has all of the server code stripped away. | ||
@@ -135,3 +149,3 @@ <a name="http-routing"></a> | ||
// | ||
// stup a server and when there is a request, dispatch the | ||
// setup a server and when there is a request, dispatch the | ||
// route that was requestd in the request object. | ||
@@ -178,4 +192,16 @@ // | ||
}); | ||
// You will need to dispatch the cli arguments yourself | ||
router.dispatch('on', process.argv.slice(2).join(' ')); | ||
``` | ||
Using the cli router, you can dispatch commands by passing them as a string. For example, if this example is in a file called `foo.js`: | ||
``` bash | ||
$ node foo.js create | ||
create something | ||
$ node foo.js destroy | ||
destroy something | ||
``` | ||
<a name="api-documentation"></a> | ||
@@ -656,2 +682,2 @@ # API Documentation | ||
[0]: http://github.com/flatiron/director | ||
[1]: https://github.com/flatiron/director/blob/master/build/director-1.0.7.min.js |
@@ -633,1 +633,16 @@ | ||
}); | ||
createTest('route should accept _ and . within parameters', { | ||
'/:a': { | ||
on: function root() { | ||
shared.fired.push(location.hash); | ||
} | ||
} | ||
}, function() { | ||
shared.fired = []; | ||
this.navigate('/a_complex_route.co.uk', function root() { | ||
deepEqual(shared.fired, ['#/a_complex_route.co.uk']); | ||
this.finish(); | ||
}); | ||
}); | ||
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -14,0 +13,0 @@ |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -40,2 +39,3 @@ | ||
} | ||
}).export(module); | ||
}).export(module); | ||
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -14,0 +13,0 @@ |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -76,3 +75,3 @@ | ||
assertRoute(foostar, ['foo', 'jitsu', 'then', 'now', 'on'], router.routes); | ||
assertRoute(foodog, ['foo', '([a-zA-Z0-9-]+)', 'on'], router.routes); | ||
assertRoute(foodog, ['foo', '([._a-zA-Z0-9-]+)', 'on'], router.routes); | ||
} | ||
@@ -79,0 +78,0 @@ } |
@@ -11,3 +11,2 @@ /* | ||
vows = require('vows'), | ||
eyes = require('eyes'), | ||
director = require('../../../lib/director'); | ||
@@ -39,3 +38,3 @@ | ||
assert.isObject(router.routes.regions); | ||
assert.isFunction(router.routes.regions['([a-zA-Z0-9-]+)'].on); | ||
assert.isFunction(router.routes.regions['([._a-zA-Z0-9-]+)'].on); | ||
}, | ||
@@ -42,0 +41,0 @@ "should dispatch the function correctly": function (router) { |
@@ -71,3 +71,4 @@ /* | ||
"a request to foo/update/bark": assertGet('foo/update/bark'), | ||
"a request to bar/bazz/bark": assertGet('bar/bazz/bark') | ||
"a request to bar/bazz/bark": assertGet('bar/bazz/bark'), | ||
"a request to foo/bar/bark?test=test": assertGet('foo/bar/bark?test=test') | ||
} | ||
@@ -74,0 +75,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
251518
5
35
3782
678
2