Socket
Socket
Sign inDemoInstall

express

Package Overview
Dependencies
Maintainers
0
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express - npm Package Compare versions

Comparing version 2.3.4 to 2.3.5

6

History.md
2.3.5 / 2011-05-19
==================
* Added; export `.view` as alias for `.View`
* Misc refactoring
2.3.4 / 2011-05-08

@@ -3,0 +9,0 @@ ==================

5

lib/express.js

@@ -31,3 +31,3 @@

exports.version = '2.3.4';
exports.version = '2.3.5';

@@ -62,3 +62,4 @@ /**

require('./view');
exports.View =
exports.view = require('./view');

@@ -65,0 +66,0 @@ /**

9

lib/http.js

@@ -15,3 +15,3 @@

, router = require('./router')
, methods = router.methods.concat(['del', 'all'])
, methods = router.methods.concat('del', 'all')
, view = require('./view')

@@ -479,3 +479,3 @@ , url = require('url')

function generateMethod(method){
methods.forEach(function(method){
app[method] = function(path){

@@ -498,9 +498,6 @@ var self = this;

};
return arguments.callee;
}
});
methods.forEach(generateMethod);
// Alias delete as "del"
app.del = app.delete;

@@ -272,3 +272,3 @@

}
return ~contentType.indexOf(type);
return !! ~contentType.indexOf(type);
};

@@ -275,0 +275,0 @@

@@ -20,4 +20,5 @@

, send = connect.static.send
, join = require('path').join
, mime = require('mime');
, mime = require('mime')
, basename = path.basename
, join = path.join;

@@ -184,3 +185,3 @@ /**

this.header('Content-Disposition', filename
? 'attachment; filename="' + path.basename(filename) + '"'
? 'attachment; filename="' + basename(filename) + '"'
: 'attachment');

@@ -187,0 +188,0 @@ return this;

@@ -241,2 +241,4 @@

router.routes = routes;
return router;

@@ -243,0 +245,0 @@ }

@@ -37,2 +37,87 @@

/**
* Lookup and compile `view` with cache support by supplying
* both the `cache` object and `cid` string,
* followed by `options` passed to `exports.lookup()`.
*
* @param {String} view
* @param {Object} cache
* @param {Object} cid
* @param {Object} options
* @return {View}
* @api private
*/
exports.compile = function(view, cache, cid, options){
if (cache && cid && cache[cid]) return cache[cid];
// lookup
view = exports.lookup(view, options);
// hints
if (!view.exists) {
if (options.hint) hintAtViewPaths(view.original, options);
var err = new Error('failed to locate view "' + view.original.view + '"');
err.view = view.original;
throw err;
}
// compile
view.fn = view.templateEngine.compile(view.contents, options);
cache[cid] = view;
return view;
};
/**
* Lookup `view`, returning an instanceof `View`.
*
* Options:
*
* - `root` root directory path
* - `defaultEngine` default template engine
* - `parentView` parent `View` object
* - `cache` cache object
* - `cacheid` optional cache id
*
* Lookup:
*
* - partial `_<name>`
* - any `<name>/index`
* - non-layout `../<name>/index`
* - any `<root>/<name>`
* - partial `<root>/_<name>`
*
* @param {String} view
* @param {Object} options
* @return {View}
* @api private
*/
exports.lookup = function(view, options){
var orig = view = new View(view, options);
// Try _ prefix ex: ./views/_<name>.jade
if (partial) {
view = new View(orig.prefixPath, options);
if (!view.exists) view = orig;
}
// Try index ex: ./views/user/index.jade
if (!view.exists) view = new View(orig.indexPath, options);
// Try ../<name>/index ex: ../user/index.jade
// when calling partial('user') within the same dir
if (!view.exists && !options.isLayout) view = new View(orig.upIndexPath, options);
// Try root ex: <root>/user.jade
if (!view.exists) view = new View(orig.rootPath, options);
// Try root _ prefix ex: <root>/_user.jade
if (!view.exists && partial) view = new View(view.prefixPath, options);
view.original = orig;
return view;
};
/**
* Partial render helper.

@@ -175,2 +260,3 @@ *

, options = options || {}
, viewEngine = app.set('view engine')
, parent = {};

@@ -188,5 +274,3 @@

// utilize "view engine" option
if (app.set('view engine')) {
parent.extension = '.' + app.set('view engine');
}
if (viewEngine) parent.extension = '.' + viewEngine;

@@ -334,43 +418,7 @@ // render the partial

// cached view
if (app.cache[cid]) {
view = app.cache[cid];
options.filename = view.path;
// resolve view
} else {
var orig = view = new View(view, options);
// View lookup
options.hint = app.enabled('hints');
view = exports.compile(view, app.cache, cid, options);
options.filename = view.path;
// Try _ prefix ex: ./views/_<name>.jade
if (partial) {
view = new View(orig.prefixPath, options);
if (!view.exists) view = orig;
}
// Try index ex: ./views/user/index.jade
if (!view.exists) view = new View(orig.indexPath, options);
// Try ../<name>/index ex: ../user/index.jade
// when calling partial('user') within the same dir
if (!view.exists && !options.isLayout) view = new View(orig.upIndexPath, options);
// Try root ex: <root>/user.jade
if (!view.exists) view = new View(orig.rootPath, options);
// Try root _ prefix ex: <root>/_user.jade
if (!view.exists && partial) view = new View(view.prefixPath, options);
// Does not exist
if (!view.exists) {
if (app.enabled('hints')) hintAtViewPaths(orig, options);
var err = new Error('failed to locate view "' + orig.view + '"');
err.view = orig;
throw err;
}
options.filename = view.path;
var engine = view.templateEngine;
view.fn = engine.compile(view.contents, options)
if (cacheViews) app.cache[cid] = view;
}
// layout helper

@@ -377,0 +425,0 @@ options.layout = function(path){

@@ -52,3 +52,6 @@

this.dirname = dirname(this.path);
if (options.attempts) options.attempts.push(this.path);
if (options.attempts) {
if (!~options.attempts.indexOf(this.path))
options.attempts.push(this.path);
}
};

@@ -55,0 +58,0 @@

{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "2.3.4",
"version": "2.3.5",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -6,0 +6,0 @@ "contributors": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc