Updated some dependencies and package.json

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-20 17:11:23 +02:00
parent f1a98831fb
commit 45079cb4d9
545 changed files with 3390 additions and 63388 deletions

42
server/node_modules/express/lib/application.js generated vendored Executable file → Normal file
View File

@@ -1,5 +1,14 @@
/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module dependencies.
* @api private
*/
var finalhandler = require('finalhandler');
@@ -25,6 +34,13 @@ var slice = Array.prototype.slice;
var app = exports = module.exports = {};
/**
* Variable for trust proxy inheritance back-compat
* @api private
*/
var trustProxyDefaultSymbol = '@@symbol:trust_proxy_default';
/**
* Initialize the server.
*
@@ -58,10 +74,23 @@ app.defaultConfiguration = function(){
this.set('subdomain offset', 2);
this.set('trust proxy', false);
// trust proxy inherit back-compat
Object.defineProperty(this.settings, trustProxyDefaultSymbol, {
configurable: true,
value: true
});
debug('booting in %s mode', env);
// inherit protos
this.on('mount', function(parent){
this.on('mount', function onmount(parent) {
// inherit trust proxy
if (this.settings[trustProxyDefaultSymbol] === true
&& typeof parent.settings['trust proxy fn'] === 'function') {
delete this.settings['trust proxy'];
delete this.settings['trust proxy fn'];
}
// inherit protos
this.request.__proto__ = parent.request;
this.response.__proto__ = parent.response;
this.engines.__proto__ = parent.engines;
@@ -327,6 +356,13 @@ app.set = function(setting, val){
case 'trust proxy':
debug('compile trust proxy %s', val);
this.set('trust proxy fn', compileTrust(val));
// trust proxy inherit back-compat
Object.defineProperty(this.settings, trustProxyDefaultSymbol, {
configurable: true,
value: false
});
break;
}
@@ -563,7 +599,7 @@ app.listen = function(){
* Log error using console.error.
*
* @param {Error} err
* @api public
* @api private
*/
function logerror(err){

4
server/node_modules/express/lib/express.js generated vendored Executable file → Normal file
View File

@@ -28,8 +28,8 @@ function createApplication() {
app.handle(req, res, next);
};
mixin(app, proto);
mixin(app, EventEmitter.prototype);
mixin(app, EventEmitter.prototype, false);
mixin(app, proto, false);
app.request = { __proto__: req, app: app };
app.response = { __proto__: res, app: app };

2
server/node_modules/express/lib/middleware/init.js generated vendored Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/**
* Initialization middleware, exposing the
* request and response to eachother, as well
* request and response to each other, as well
* as defaulting the X-Powered-By header field.
*
* @param {Function} app

0
server/node_modules/express/lib/middleware/query.js generated vendored Executable file → Normal file
View File

23
server/node_modules/express/lib/request.js generated vendored Executable file → Normal file
View File

@@ -63,12 +63,12 @@ req.header = function(name){
* the best match when true, otherwise `undefined`, in which
* case you should respond with 406 "Not Acceptable".
*
* The `type` value may be a single mime type string
* such as "application/json", the extension name
* such as "json", a comma-delimted list such as "json, html, text/plain",
* The `type` value may be a single MIME type string
* such as "application/json", an extension name
* such as "json", a comma-delimited list such as "json, html, text/plain",
* an argument list such as `"json", "html", "text/plain"`,
* or an array `["json", "html", "text/plain"]`. When a list
* or array is given the _best_ match, if any is returned.
* or array is given, the _best_ match, if any is returned.
*
* Examples:
*
@@ -200,13 +200,20 @@ req.range = function(size){
* @api public
*/
req.param = function(name, defaultValue){
req.param = function param(name, defaultValue) {
var params = this.params || {};
var body = this.body || {};
var query = this.query || {};
var args = arguments.length === 1
? 'name'
: 'name, default';
deprecate('req.param(' + args + '): Use req.params, req.body, or req.query instead');
if (null != params[name] && params.hasOwnProperty(name)) return params[name];
if (null != body[name]) return body[name];
if (null != query[name]) return query[name];
return defaultValue;
};
@@ -261,7 +268,7 @@ defineGetter(req, 'protocol', function protocol(){
: 'http';
var trust = this.app.get('trust proxy fn');
if (!trust(this.connection.remoteAddress)) {
if (!trust(this.connection.remoteAddress, 0)) {
return proto;
}
@@ -371,7 +378,7 @@ defineGetter(req, 'hostname', function hostname(){
var trust = this.app.get('trust proxy fn');
var host = this.get('X-Forwarded-Host');
if (!host || !trust(this.connection.remoteAddress)) {
if (!host || !trust(this.connection.remoteAddress, 0)) {
host = this.get('Host');
}
@@ -412,7 +419,7 @@ defineGetter(req, 'fresh', function(){
// 2xx or 304 as per rfc2616 14.26
if ((s >= 200 && s < 300) || 304 == s) {
return fresh(this.headers, this.res._headers);
return fresh(this.headers, (this.res._headers || {}));
}
return false;

111
server/node_modules/express/lib/response.js generated vendored Executable file → Normal file
View File

@@ -1,5 +1,13 @@
/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module dependencies.
* @api private
*/
var contentDisposition = require('content-disposition');
@@ -159,15 +167,12 @@ res.send = function send(body) {
this.set('Content-Length', len);
}
// method check
var isHead = req.method === 'HEAD';
// ETag support
if (len !== undefined && (isHead || req.method === 'GET')) {
var etag = app.get('etag fn');
if (etag && !this.get('ETag')) {
etag = etag(chunk, encoding);
etag && this.set('ETag', etag);
// populate ETag
var etag;
var generateETag = len !== undefined && app.get('etag fn');
if (typeof generateETag === 'function' && !this.get('ETag')) {
if ((etag = generateETag(chunk, encoding))) {
this.set('ETag', etag);
}
}
@@ -182,14 +187,14 @@ res.send = function send(body) {
chunk = '';
}
// skip body for HEAD
if (isHead) {
if (req.method === 'HEAD') {
// skip body for HEAD
this.end();
} else {
// respond
this.end(chunk, encoding);
}
// respond
this.end(chunk, encoding);
return this;
};
@@ -398,8 +403,8 @@ res.sendFile = function sendFile(path, options, fn) {
if (fn) return fn(err);
if (err && err.code === 'EISDIR') return next();
// next() all but aborted errors
if (err && err.code !== 'ECONNABORT') {
// next() all but write errors
if (err && err.code !== 'ECONNABORTED' && err.syscall !== 'write') {
next(err);
}
});
@@ -467,8 +472,8 @@ res.sendfile = function(path, options, fn){
if (fn) return fn(err);
if (err && err.code === 'EISDIR') return next();
// next() all but aborted errors
if (err && err.code !== 'ECONNABORT') {
// next() all but write errors
if (err && err.code !== 'ECONNABORT' && err.syscall !== 'write') {
next(err);
}
});
@@ -636,6 +641,35 @@ res.attachment = function attachment(filename) {
return this;
};
/**
* Append additional header `field` with value `val`.
*
* Example:
*
* res.append('Link', ['<http://localhost/>', '<http://localhost:3000/>']);
* res.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly');
* res.append('Warning', '199 Miscellaneous warning');
*
* @param {String} field
* @param {String|Array} val
* @return {ServerResponse} for chaining
* @api public
*/
res.append = function append(field, val) {
var prev = this.get(field);
var value = val;
if (prev) {
// concat the new and prev vals
value = Array.isArray(prev) ? prev.concat(val)
: Array.isArray(val) ? [prev].concat(val)
: [prev, val];
}
return this.set(field, value);
};
/**
* Set header `field` to `val`, or pass
* an object of header fields.
@@ -841,9 +875,9 @@ res.redirect = function redirect(url) {
if (this.req.method === 'HEAD') {
this.end();
} else {
this.end(body);
}
this.end(body);
};
/**
@@ -907,6 +941,17 @@ res.render = function(view, options, fn){
// pipe the send file stream
function sendfile(res, file, options, callback) {
var done = false;
var streaming;
// request aborted
function onaborted() {
if (done) return;
done = true;
var err = new Error('Request aborted');
err.code = 'ECONNABORTED';
callback(err);
}
// directory
function ondirectory() {
@@ -932,25 +977,39 @@ function sendfile(res, file, options, callback) {
callback();
}
// file
function onfile() {
streaming = false;
}
// finished
function onfinish(err) {
if (err && err.code === 'ECONNRESET') return onaborted();
if (err) return onerror(err);
if (done) return;
setImmediate(function () {
if (streaming !== false && !done) {
onaborted();
return;
}
if (done) return;
done = true;
// response finished before end of file
var err = new Error('Request aborted');
err.code = 'ECONNABORT';
callback(err);
callback();
});
}
// streaming
function onstream() {
streaming = true;
}
file.on('directory', ondirectory);
file.on('end', onend);
file.on('error', onerror);
file.on('directory', ondirectory);
file.on('file', onfile);
file.on('stream', onstream);
onFinished(res, onfinish);
if (options.headers) {

204
server/node_modules/express/lib/router/index.js generated vendored Executable file → Normal file
View File

@@ -8,6 +8,7 @@ var Layer = require('./layer');
var methods = require('methods');
var mixin = require('utils-merge');
var debug = require('debug')('express:router');
var deprecate = require('depd')('express');
var parseUrl = require('parseurl');
var utils = require('../utils');
@@ -81,9 +82,10 @@ var proto = module.exports = function(options) {
* @api public
*/
proto.param = function(name, fn){
proto.param = function param(name, fn) {
// param logic
if ('function' == typeof name) {
if (typeof name === 'function') {
deprecate('router.param(fn): Refactor to use path params');
this._params.push(name);
return;
}
@@ -94,6 +96,7 @@ proto.param = function(name, fn){
var ret;
if (name[0] === ':') {
deprecate('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.substr(1)) + ', fn) instead');
name = name.substr(1);
}
@@ -152,9 +155,7 @@ proto.handle = function(req, res, done) {
if (req.method === 'OPTIONS') {
done = wrap(done, function(old, err) {
if (err || options.length === 0) return old(err);
var body = options.join(',');
return res.set('Allow', body).send(body);
sendOptionsResponse(res, options, old);
});
}
@@ -169,74 +170,104 @@ proto.handle = function(req, res, done) {
? null
: err;
var layer = stack[idx++];
// remove added slash
if (slashAdded) {
req.url = req.url.substr(1);
slashAdded = false;
}
// restore altered req.url
if (removed.length !== 0) {
req.baseUrl = parentUrl;
req.url = protohost + removed + req.url.substr(protohost.length);
removed = '';
}
if (!layer) {
// no more matching layers
if (idx >= stack.length) {
setImmediate(done, layerError);
return;
}
self.match_layer(layer, req, res, function (err, path) {
if (err || path === undefined) {
// get pathname of request
var path = getPathname(req);
if (path == null) {
return done(layerError);
}
// find next matching layer
var layer;
var match;
var route;
while (match !== true && idx < stack.length) {
layer = stack[idx++];
match = matchLayer(layer, path);
route = layer.route;
if (typeof match !== 'boolean') {
// hold on to layerError
layerError = layerError || match;
}
if (match !== true) {
continue;
}
if (!route) {
// process non-route handlers normally
continue;
}
if (layerError) {
// routes do not match with a pending error
match = false;
continue;
}
var method = req.method;
var has_method = route._handles_method(method);
// build up automatic options response
if (!has_method && method === 'OPTIONS') {
appendMethods(options, route._options());
}
// don't even bother matching route
if (!has_method && method !== 'HEAD') {
match = false;
continue;
}
}
// no match
if (match !== true) {
return done(layerError);
}
// store route for dispatch on change
if (route) {
req.route = route;
}
// Capture one-time layer values
req.params = self.mergeParams
? mergeParams(layer.params, parentParams)
: layer.params;
var layerPath = layer.path;
// this should be done for the layer
self.process_params(layer, paramcalled, req, res, function (err) {
if (err) {
return next(layerError || err);
}
// route object and not middleware
var route = layer.route;
// if final route, then we support options
if (route) {
// we don't run any routes with error first
if (layerError) {
return next(layerError);
}
var method = req.method;
var has_method = route._handles_method(method);
// build up automatic options response
if (!has_method && method === 'OPTIONS') {
options.push.apply(options, route._options());
}
// don't even bother
if (!has_method && method !== 'HEAD') {
return next();
}
// we can now dispatch to the route
req.route = route;
return layer.handle_request(req, res, next);
}
// Capture one-time layer values
req.params = self.mergeParams
? mergeParams(layer.params, parentParams)
: layer.params;
var layerPath = layer.path;
// this should be done for the layer
self.process_params(layer, paramcalled, req, res, function (err) {
if (err) {
return next(layerError || err);
}
if (route) {
return layer.handle_request(req, res, next);
}
trim_prefix(layer, layerError, layerPath, path);
});
trim_prefix(layer, layerError, layerPath, path);
});
}
@@ -273,29 +304,6 @@ proto.handle = function(req, res, done) {
}
};
/**
* Match request to a layer.
*
* @api private
*/
proto.match_layer = function match_layer(layer, req, res, done) {
var error = null;
var path;
try {
path = parseUrl(req).pathname;
if (!layer.match(path)) {
path = undefined;
}
} catch (err) {
error = err;
}
done(error, path);
};
/**
* Process any parameters for the layer.
*
@@ -492,6 +500,25 @@ methods.concat('all').forEach(function(method){
};
});
// append methods to a list of methods
function appendMethods(list, addition) {
for (var i = 0; i < addition.length; i++) {
var method = addition[i];
if (list.indexOf(method) === -1) {
list.push(method);
}
}
}
// get pathname of request
function getPathname(req) {
try {
return parseUrl(req).pathname;
} catch (err) {
return undefined;
}
}
// get type for error message
function gettype(obj) {
var type = typeof obj;
@@ -505,6 +532,22 @@ function gettype(obj) {
.replace(objectRegExp, '$1');
}
/**
* Match path to a layer.
*
* @param {Layer} layer
* @param {string} path
* @private
*/
function matchLayer(layer, path) {
try {
return layer.match(path);
} catch (err) {
return err;
}
}
// merge params with parent params
function mergeParams(params, parent) {
if (typeof parent !== 'object' || !parent) {
@@ -561,6 +604,17 @@ function restore(fn, obj) {
};
}
// send an OPTIONS response
function sendOptionsResponse(res, options, next) {
try {
var body = options.join(',');
res.set('Allow', body);
res.send(body);
} catch (err) {
next(err);
}
}
// wrap a function
function wrap(old, fn) {
return function proxy() {

0
server/node_modules/express/lib/router/layer.js generated vendored Executable file → Normal file
View File

18
server/node_modules/express/lib/router/route.js generated vendored Executable file → Normal file
View File

@@ -52,10 +52,20 @@ Route.prototype._handles_method = function _handles_method(method) {
* @api private
*/
Route.prototype._options = function(){
return Object.keys(this.methods).map(function(method) {
return method.toUpperCase();
});
Route.prototype._options = function _options() {
var methods = Object.keys(this.methods);
// append automatic head
if (this.methods.get && !this.methods.head) {
methods.push('head');
}
for (var i = 0; i < methods.length; i++) {
// make upper case
methods[i] = methods[i].toUpperCase();
}
return methods;
};
/**

22
server/node_modules/express/lib/utils.js generated vendored Executable file → Normal file
View File

@@ -1,8 +1,17 @@
/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module dependencies.
* @api private
*/
var contentDisposition = require('content-disposition');
var contentType = require('content-type');
var deprecate = require('depd')('express');
var mime = require('send').mime;
var basename = require('path').basename;
@@ -10,7 +19,6 @@ var etag = require('etag');
var proxyaddr = require('proxy-addr');
var qs = require('qs');
var querystring = require('querystring');
var typer = require('media-typer');
/**
* Return strong ETag for `body`.
@@ -258,21 +266,23 @@ exports.compileTrust = function(val) {
* @api private
*/
exports.setCharset = function(type, charset){
if (!type || !charset) return type;
exports.setCharset = function setCharset(type, charset) {
if (!type || !charset) {
return type;
}
// parse type
var parsed = typer.parse(type);
var parsed = contentType.parse(type);
// set charset
parsed.parameters.charset = charset;
// format type
return typer.format(parsed);
return contentType.format(parsed);
};
/**
* Return new empty objet.
* Return new empty object.
*
* @return {Object}
* @api private

0
server/node_modules/express/lib/view.js generated vendored Executable file → Normal file
View File