express
Advanced tools
Comparing version 5.0.0-alpha.3 to 5.0.0-alpha.4
@@ -28,2 +28,3 @@ /*! | ||
var Router = require('router'); | ||
var setPrototyeOf = require('setprototypeof') | ||
var slice = Array.prototype.slice; | ||
@@ -113,6 +114,6 @@ | ||
// inherit protos | ||
this.request.__proto__ = parent.request; | ||
this.response.__proto__ = parent.response; | ||
this.engines.__proto__ = parent.engines; | ||
this.settings.__proto__ = parent.settings; | ||
setPrototyeOf(this.request, parent.request) | ||
setPrototyeOf(this.response, parent.response) | ||
setPrototyeOf(this.engines, parent.engines) | ||
setPrototyeOf(this.settings, parent.settings) | ||
}); | ||
@@ -165,4 +166,4 @@ | ||
// alter the prototypes | ||
req.__proto__ = this.request; | ||
res.__proto__ = this.response; | ||
setPrototyeOf(req, this.request) | ||
setPrototyeOf(res, this.response) | ||
@@ -230,4 +231,4 @@ // setup locals | ||
fn.handle(req, res, function (err) { | ||
req.__proto__ = orig.request; | ||
res.__proto__ = orig.response; | ||
setPrototyeOf(req, orig.request) | ||
setPrototyeOf(res, orig.response) | ||
next(err); | ||
@@ -234,0 +235,0 @@ }); |
@@ -43,4 +43,12 @@ /*! | ||
app.request = { __proto__: req, app: app }; | ||
app.response = { __proto__: res, app: app }; | ||
// expose the prototype that will get set on requests | ||
app.request = Object.create(req, { | ||
app: { configurable: true, enumerable: true, writable: true, value: app } | ||
}) | ||
// expose the prototype that will get set on responses | ||
app.response = Object.create(res, { | ||
app: { configurable: true, enumerable: true, writable: true, value: app } | ||
}) | ||
app.init(); | ||
@@ -70,35 +78,1 @@ return app; | ||
exports.static = require('serve-static'); | ||
/** | ||
* Replace removed middleware with an appropriate error message. | ||
*/ | ||
[ | ||
'json', | ||
'urlencoded', | ||
'bodyParser', | ||
'compress', | ||
'cookieSession', | ||
'session', | ||
'logger', | ||
'cookieParser', | ||
'favicon', | ||
'responseTime', | ||
'errorHandler', | ||
'timeout', | ||
'methodOverride', | ||
'vhost', | ||
'csrf', | ||
'directory', | ||
'limit', | ||
'multipart', | ||
'staticCache', | ||
'query', | ||
].forEach(function (name) { | ||
Object.defineProperty(exports, name, { | ||
get: function () { | ||
throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.'); | ||
}, | ||
configurable: true | ||
}); | ||
}); |
@@ -27,9 +27,15 @@ /*! | ||
* Request prototype. | ||
* @public | ||
*/ | ||
var req = exports = module.exports = { | ||
__proto__: http.IncomingMessage.prototype | ||
}; | ||
var req = Object.create(http.IncomingMessage.prototype) | ||
/** | ||
* Module exports. | ||
* @public | ||
*/ | ||
module.exports = req | ||
/** | ||
* Return request header. | ||
@@ -339,3 +345,8 @@ * | ||
var addrs = proxyaddr.all(this, trust); | ||
return addrs.slice(1).reverse(); | ||
// reverse the order (to farthest -> closest) | ||
// and remove socket address | ||
addrs.reverse().pop() | ||
return addrs | ||
}); | ||
@@ -442,3 +453,4 @@ | ||
var method = this.method; | ||
var s = this.res.statusCode; | ||
var res = this.res | ||
var status = res.statusCode | ||
@@ -449,4 +461,7 @@ // GET or HEAD for weak freshness validation only | ||
// 2xx or 304 as per rfc2616 14.26 | ||
if ((s >= 200 && s < 300) || 304 === s) { | ||
return fresh(this.headers, (this.res._headers || {})); | ||
if ((status >= 200 && status < 300) || 304 === status) { | ||
return fresh(this.headers, { | ||
'etag': res.get('ETag'), | ||
'last-modified': res.get('Last-Modified') | ||
}) | ||
} | ||
@@ -496,2 +511,2 @@ | ||
}); | ||
}; | ||
} |
@@ -23,2 +23,3 @@ /*! | ||
var pathIsAbsolute = require('path-is-absolute'); | ||
var statuses = require('statuses') | ||
var merge = require('utils-merge'); | ||
@@ -29,3 +30,2 @@ var sign = require('cookie-signature').sign; | ||
var setCharset = require('./utils').setCharset; | ||
var statusCodes = http.STATUS_CODES; | ||
var cookie = require('cookie'); | ||
@@ -40,9 +40,15 @@ var send = require('send'); | ||
* Response prototype. | ||
* @public | ||
*/ | ||
var res = module.exports = { | ||
__proto__: http.ServerResponse.prototype | ||
}; | ||
var res = Object.create(http.ServerResponse.prototype) | ||
/** | ||
* Module exports. | ||
* @public | ||
*/ | ||
module.exports = res | ||
/** | ||
* Module variables. | ||
@@ -292,3 +298,3 @@ * @private | ||
res.sendStatus = function sendStatus(statusCode) { | ||
var body = statusCodes[statusCode] || String(statusCode); | ||
var body = statuses[statusCode] || String(statusCode) | ||
@@ -763,3 +769,3 @@ this.statusCode = statusCode; | ||
text: function(){ | ||
body = statusCodes[status] + '. Redirecting to ' + address; | ||
body = statuses[status] + '. Redirecting to ' + address | ||
}, | ||
@@ -769,3 +775,3 @@ | ||
var u = escapeHtml(address); | ||
body = '<p>' + statusCodes[status] + '. Redirecting to <a href="' + u + '">' + u + '</a></p>'; | ||
body = '<p>' + statuses[status] + '. Redirecting to <a href="' + u + '">' + u + '</a></p>' | ||
}, | ||
@@ -772,0 +778,0 @@ |
@@ -78,3 +78,5 @@ /*! | ||
// load engine | ||
opts.engines[this.ext] = require(this.ext.substr(1)).__express; | ||
var mod = this.ext.substr(1) | ||
debug('require "%s"', mod) | ||
opts.engines[this.ext] = require(mod).__express | ||
} | ||
@@ -81,0 +83,0 @@ |
{ | ||
"name": "express", | ||
"description": "Fast, unopinionated, minimalist web framework", | ||
"version": "5.0.0-alpha.3", | ||
"version": "5.0.0-alpha.4", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -36,9 +36,9 @@ "contributors": [ | ||
"cookie-signature": "1.0.6", | ||
"debug": "~2.2.0", | ||
"debug": "2.6.1", | ||
"depd": "~1.1.0", | ||
"encodeurl": "~1.0.1", | ||
"escape-html": "~1.0.3", | ||
"etag": "~1.7.0", | ||
"finalhandler": "0.5.1", | ||
"fresh": "0.3.0", | ||
"etag": "~1.8.0", | ||
"finalhandler": "~1.0.0", | ||
"fresh": "0.5.0", | ||
"merge-descriptors": "1.0.1", | ||
@@ -51,7 +51,9 @@ "methods": "~1.1.2", | ||
"proxy-addr": "~1.1.3", | ||
"qs": "6.2.0", | ||
"qs": "6.3.1", | ||
"range-parser": "~1.2.0", | ||
"router": "~1.1.5", | ||
"send": "0.14.2", | ||
"serve-static": "~1.11.2", | ||
"router": "~1.3.0", | ||
"send": "0.15.0", | ||
"serve-static": "1.12.0", | ||
"setprototypeof": "1.0.3", | ||
"statuses": "~1.3.1", | ||
"type-is": "~1.6.14", | ||
@@ -63,12 +65,13 @@ "utils-merge": "1.0.0", | ||
"after": "0.8.2", | ||
"body-parser": "1.16.0", | ||
"body-parser": "1.17.0", | ||
"cookie-parser": "~1.4.3", | ||
"ejs": "2.5.5", | ||
"express-session": "1.15.0", | ||
"ejs": "2.5.6", | ||
"express-session": "1.15.1", | ||
"istanbul": "0.4.5", | ||
"marked": "0.3.6", | ||
"method-override": "~2.3.6", | ||
"method-override": "2.3.7", | ||
"mocha": "3.2.0", | ||
"morgan": "~1.7.0", | ||
"morgan": "1.8.1", | ||
"multiparty": "4.1.3", | ||
"pbkdf2-password": "1.2.1", | ||
"should": "11.2.0", | ||
@@ -75,0 +78,0 @@ "supertest": "1.2.0", |
@@ -40,3 +40,3 @@ [![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/) | ||
* [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/strongloop/expressjs.com)] | ||
* [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)] | ||
* [#express](https://webchat.freenode.net/?channels=express) on freenode IRC | ||
@@ -43,0 +43,0 @@ * [Github Organization](https://github.com/expressjs) for Official Middleware & Modules |
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
169882
30
18
2208
+ Addedsetprototypeof@1.0.3
+ Addedstatuses@~1.3.1
+ Addedarray-flatten@3.0.0(transitive)
+ Addeddebug@2.6.12.6.9(transitive)
+ Addedetag@1.8.1(transitive)
+ Addedfinalhandler@1.0.6(transitive)
+ Addedfresh@0.5.0(transitive)
+ Addedhttp-errors@1.6.3(transitive)
+ Addedms@2.0.0(transitive)
+ Addedqs@6.3.1(transitive)
+ Addedrouter@1.3.8(transitive)
+ Addedsend@0.15.0(transitive)
+ Addedserve-static@1.12.0(transitive)
+ Addedsetprototypeof@1.0.31.1.01.2.0(transitive)
+ Addedstatuses@1.5.0(transitive)
+ Addedutils-merge@1.0.1(transitive)
- Removeddebug@2.2.0(transitive)
- Removedetag@1.7.0(transitive)
- Removedfinalhandler@0.5.1(transitive)
- Removedfresh@0.3.0(transitive)
- Removedhttp-errors@1.5.1(transitive)
- Removedms@0.7.1(transitive)
- Removedqs@6.2.0(transitive)
- Removedrouter@1.1.5(transitive)
- Removedsend@0.14.2(transitive)
- Removedserve-static@1.11.2(transitive)
- Removedsetprototypeof@1.0.2(transitive)
Updateddebug@2.6.1
Updatedetag@~1.8.0
Updatedfinalhandler@~1.0.0
Updatedfresh@0.5.0
Updatedqs@6.3.1
Updatedrouter@~1.3.0
Updatedsend@0.15.0
Updatedserve-static@1.12.0