Better require paths
Before adoption: this commit came in with the history the project adopted, so no landing records it.
to pave the way for having a node package manager resolve dependencies
authored by visionmedia · committed by visionmedia · parent 7afb895 · Browse files · 5 files·+64 added−59 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+64 added−59 removed
- other:+64 added−59 removed
Provenance
- Commit
83fcf8b- Tree
871b10b- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
7afb895
5 files changed+64 added−59 removed
modified:benchmarks/views.js+2 added-2 removed
6 unmodified lines78910111211121314151619 unmodified lines6 unmodified lines
print = puts
engine = { ejs: require('support/ejs/ejs'), haml: require('support/haml/lib/haml') ejs: require('ejs'), haml: require('haml')}
options = { locals: { article: { title: 'Foo', body: 'bar' }}}
19 unmodified linesmodified:lib/express/plugins/view.js+3 added-3 removed
10 unmodified lines111213141516171516171819202177 unmodified lines10 unmodified lines * Supported template engines. */
var engine = { ejs: require('support/ejs/ejs'), haml: require('support/haml/lib/haml'), sass: require('support/sass/lib/sass') ejs: require('ejs'), haml: require('haml'), sass: require('sass')}
// --- View
77 unmodified linesadded:lib/support/ejs/lib/ejs.js+53 added
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253/* Ejs template parser for CommonJS * * Copyright (c) 2009, Howard Rauscher * Licensed under the MIT License * * base on: * Simple JavaScript Templating (http://ejohn.org/blog/javascript-micro-templating/) * John Resig - http://ejohn.org/ - MIT Licensed */ (function(){ var cache = {}; var ejs = this.ejs = {}; ejs.parse = function tmpl(str, options) { options = options || {}; options.context = options.context || {}; options.locals = options.locals || {}; // Figure out if we're getting a template, or if we need to // load the template - and be sure to cache the result. var fn = cache[str] || // Generate a reusable function that will serve as a template // generator (and which will be cached). new Function("obj", "var p=[];" + // Introduce the data as local variables using with(){} "with(obj){p.push('" + // Convert the template into pure JavaScript str .replace(/\-%>(\n|\r)/g, "%>") .replace(/[\t\b\f]/g, " ") .replace(/[\n\r]/g, "\f") .split("<%").join("\t") .replace(/((^|%>)[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)%>/g, "',$1,'") .split("\t").join("');") .split("%>").join("p.push('") .split("\r").join("\\'").replace(/\f+/g, '\\n') + "');}return p.join('');"); cache[str] = fn; // Provide some basic currying to the user return fn.call(options.context, options.locals); };})(); exports.render = ejs.parse;No newline at end of filedeleted:lib/support/ejs/ejs.js-53 removed
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253/* Ejs template parser for CommonJS * * Copyright (c) 2009, Howard Rauscher * Licensed under the MIT License * * base on: * Simple JavaScript Templating (http://ejohn.org/blog/javascript-micro-templating/) * John Resig - http://ejohn.org/ - MIT Licensed */ (function(){ var cache = {}; var ejs = this.ejs = {}; ejs.parse = function tmpl(str, options) { options = options || {}; options.context = options.context || {}; options.locals = options.locals || {}; // Figure out if we're getting a template, or if we need to // load the template - and be sure to cache the result. var fn = cache[str] || // Generate a reusable function that will serve as a template // generator (and which will be cached). new Function("obj", "var p=[];" + // Introduce the data as local variables using with(){} "with(obj){p.push('" + // Convert the template into pure JavaScript str .replace(/\-%>(\n|\r)/g, "%>") .replace(/[\t\b\f]/g, " ") .replace(/[\n\r]/g, "\f") .split("<%").join("\t") .replace(/((^|%>)[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)%>/g, "',$1,'") .split("\t").join("');") .split("%>").join("p.push('") .split("\r").join("\\'").replace(/\f+/g, '\\n') + "');}return p.join('');"); cache[str] = fn; // Provide some basic currying to the user return fn.call(options.context, options.locals); };})(); exports.render = ejs.parse;No newline at end of filemodified:lib/express.js+6 added-1 removed
122345678
require('support/js-oo/lib/oo')var path = require('path')require.paths.unshift(path.dirname(__filename) + '/support/js-oo/lib')require.paths.unshift(path.dirname(__filename) + '/support/ejs/lib')require.paths.unshift(path.dirname(__filename) + '/support/haml/lib')require.paths.unshift(path.dirname(__filename) + '/support/sass/lib')require('oo')require('express/core')