consolidate
Advanced tools
Comparing version 0.13.1 to 0.14.0
@@ -0,1 +1,10 @@ | ||
0.14.0 / 2016-01-24 | ||
=================== | ||
* add slm support | ||
* add vash support | ||
* add twig support | ||
* fixes lodash 4 options | ||
* fixes liquid file extensions and path resolving | ||
0.13.0 / 2015-05-26 | ||
@@ -2,0 +11,0 @@ =================== |
@@ -1,6 +0,3 @@ | ||
/*! | ||
* consolidate | ||
* Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca> | ||
* MIT Licensed | ||
* | ||
'use strict'; | ||
/* | ||
* Engines which do not support caching of their file contents | ||
@@ -90,3 +87,3 @@ * should use the `read()` function defined in consolidate.js | ||
var str = readCache[path]; | ||
var cached = options.cache && str && 'string' == typeof str; | ||
var cached = options.cache && str && typeof str === 'string'; | ||
@@ -122,3 +119,3 @@ // cached (only if cached is a string and not a compiled template function) | ||
function next(index) { | ||
if (index == keys.length) return fn(null); | ||
if (index === keys.length) return fn(null); | ||
var key = keys[index]; | ||
@@ -237,5 +234,4 @@ var file = join(dirname(path), partials[key] + extname(path)); | ||
context.onInclude(function (name, callback) { | ||
var basename = path.basename(name); | ||
var extname = path.extname(name) || '.liquid'; | ||
var filename = path.join(includeDir, basename + extname); | ||
var extname = path.extname(name) ? '' : '.liquid'; | ||
var filename = path.resolve(includeDir, name + extname); | ||
@@ -386,3 +382,3 @@ fs.readFile(filename, {encoding: 'utf8'}, function (err, data){ | ||
engine.onLoad = function(path, callback){ | ||
if ('' == extname(path)) path += '.' + ext; | ||
if ('' === extname(path)) path += '.' + ext; | ||
if ('/' !== path[0]) path = views + '/' + path; | ||
@@ -471,2 +467,27 @@ read(path, options, callback); | ||
/** | ||
* Twig support. | ||
*/ | ||
exports.twig = fromStringRenderer('twig'); | ||
/** | ||
* Twig string support. | ||
*/ | ||
exports.twig.render = function(str, options, fn){ | ||
return promisify(fn, function(fn) { | ||
var engine = requires.twig || (requires.twig = require('twig').twig); | ||
var templateData = { | ||
data: str | ||
}; | ||
try { | ||
var tmpl = cache(templateData) || cache(templateData, engine(templateData)); | ||
fn(null, tmpl.render(options)); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}); | ||
}; | ||
/** | ||
* EJS support. | ||
@@ -573,3 +594,3 @@ */ | ||
return promisify(fn, function(fn) { | ||
var engine = requires.hamljs || (requires.hamljs = require('hamljs')); | ||
var engine = requires.haml || (requires.haml = require('hamljs')); | ||
try { | ||
@@ -644,3 +665,3 @@ options.locals = options; | ||
return promisify(fn, function(fn) { | ||
var engine = requires.HAMLCoffee || (requires.HAMLCoffee = require('haml-coffee')); | ||
var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee')); | ||
try { | ||
@@ -725,3 +746,3 @@ var tmpl = cache(options) || cache(options, engine.compile(str, options)); | ||
}); | ||
} | ||
}; | ||
@@ -765,3 +786,3 @@ /** | ||
try { | ||
var tmpl = cache(options) || cache(options, engine.template(str, null, options)); | ||
var tmpl = cache(options) || cache(options, engine.template(str, options)); | ||
fn(null, tmpl(options).replace(/\n$/, '')); | ||
@@ -1072,3 +1093,3 @@ } catch (err) { | ||
return module._compile(compiled, filename); | ||
}; | ||
} | ||
@@ -1207,2 +1228,57 @@ exports.requireReact = requireReact; | ||
/** | ||
* Vash support | ||
*/ | ||
exports.vash = fromStringRenderer('vash'); | ||
/** | ||
* Vash string support | ||
*/ | ||
exports.vash.render = function(str, options, fn) { | ||
return promisify(fn, function(fn) { | ||
var engine = requires.vash || (requires.vash = require('vash')); | ||
try { | ||
// helper system : https://github.com/kirbysayshi/vash#helper-system | ||
if (options.helpers) { | ||
for (var key in options.helpers) { | ||
if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') { | ||
continue; | ||
} | ||
engine.helpers[key] = options.helpers[key]; | ||
} | ||
} | ||
var tmpl = cache(options) || cache(options, engine.compile(str, options)); | ||
fn(null, tmpl(options).replace(/\n$/, '')); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}); | ||
}; | ||
/** | ||
* Slm support. | ||
*/ | ||
exports.slm = fromStringRenderer('slm'); | ||
/** | ||
* Slm string support. | ||
*/ | ||
exports.slm.render = function(str, options, fn) { | ||
return promisify(fn, function (fn) { | ||
var engine = requires.slm || (requires.slm = require('slm')); | ||
try { | ||
var tmpl = cache(options) || cache(options, engine.compile(str, options)); | ||
fn(null, tmpl(options)); | ||
} catch (err) { | ||
fn(err); | ||
} | ||
}); | ||
}; | ||
/** | ||
* expose the instance of the engine | ||
@@ -1209,0 +1285,0 @@ */ |
{ | ||
"name": "consolidate", | ||
"version": "0.13.1", | ||
"version": "0.14.0", | ||
"description": "Template engine consolidation library", | ||
@@ -13,37 +13,40 @@ "keywords": [ | ||
"atpl": ">=0.7.6", | ||
"dot": "1.0.1", | ||
"dust": "0.3.0", | ||
"dustjs-helpers": "1.1.1", | ||
"dustjs-linkedin": "1.2", | ||
"eco": "1.1.0-rc-3", | ||
"ect": "0.3.5", | ||
"ejs": "0.7.1", | ||
"haml-coffee": "1.4.0", | ||
"hamlet": "0.3.3", | ||
"hamljs": "0.6.1", | ||
"handlebars": "1.0.7", | ||
"hogan.js": "2.0.0", | ||
"htmling": "0.0.3", | ||
"jade": "1.9.1", | ||
"jazz": "0.0.18", | ||
"jqtpl": "1.1.0", | ||
"just": "0.1.8", | ||
"liquor": "0.0.4", | ||
"lodash": "1.2.0", | ||
"mocha": "*", | ||
"mote": "0.2.0", | ||
"mustache": "0.4.0", | ||
"nunjucks": "~1.0.0", | ||
"qejs": "3.0.5", | ||
"dot": "^1.0.1", | ||
"dust": "^0.3.0", | ||
"dustjs-helpers": "^1.1.1", | ||
"dustjs-linkedin": "^2.7.2", | ||
"eco": "^1.1.0-rc-3", | ||
"ect": "^0.5.9", | ||
"ejs": "^2.3.4", | ||
"haml-coffee": "^1.4.0", | ||
"hamlet": "^0.3.3", | ||
"hamljs": "^0.6.1", | ||
"handlebars": "^4.0.5", | ||
"hogan.js": "^3.0.2", | ||
"htmling": "^0.0.7", | ||
"jade": "^1.9.1", | ||
"jazz": "^0.0.18", | ||
"jqtpl": "^1.1.0", | ||
"just": "^0.1.8", | ||
"liquor": "^0.0.5", | ||
"lodash": "^4.0.0", | ||
"mocha": "^2.3.4", | ||
"mote": "^0.2.0", | ||
"mustache": "^2.2.1", | ||
"nunjucks": "^2.3.0", | ||
"qejs": "^3.0.5", | ||
"ractive": "^0.6.1", | ||
"react": "^0.13.0", | ||
"react": "^0.14.6", | ||
"react-tools": "^0.13.0", | ||
"should": "*", | ||
"swig": "1.4.1", | ||
"slm": "^0.5.0", | ||
"swig": "^1.4.1", | ||
"templayed": ">=0.2.3", | ||
"tinyliquid": "~0.2.22", | ||
"toffee": "0.0.52", | ||
"underscore": "1.3.3", | ||
"walrus": "0.9.0", | ||
"whiskers": "0.2.2" | ||
"twig": "^0.8.2", | ||
"tinyliquid": "^0.2.22", | ||
"toffee": "^0.1.12", | ||
"underscore": "^1.3.3", | ||
"vash": "^0.8.7", | ||
"walrus": "^0.10.1", | ||
"whiskers": "^0.3.3" | ||
}, | ||
@@ -60,4 +63,4 @@ "main": "index", | ||
"dependencies": { | ||
"bluebird": "^2.9.26" | ||
"bluebird": "^3.1.1" | ||
} | ||
} |
@@ -18,4 +18,4 @@ # Consolidate.js | ||
- [ejs](https://github.com/visionmedia/ejs) | ||
- [haml](https://github.com/visionmedia/haml.js) [(website)](http://haml-lang.com/) | ||
- [haml-coffee](https://github.com/9elements/haml-coffee) [(website)](http://haml-lang.com/) | ||
- [haml](https://github.com/visionmedia/haml.js) | ||
- [haml-coffee](https://github.com/9elements/haml-coffee) | ||
- [hamlet](https://github.com/gregwebs/hamlet.js) | ||
@@ -27,3 +27,3 @@ - [handlebars](https://github.com/wycats/handlebars.js/) [(website)](http://handlebarsjs.com/) | ||
- [jazz](https://github.com/shinetech/jazz) | ||
- [jqtpl](https://github.com/kof/node-jqtpl) [(website)](http://api.jquery.com/category/plugins/templates/) | ||
- [jqtpl](https://github.com/kof/jqtpl) | ||
- [JUST](https://github.com/baryshev/just) | ||
@@ -38,7 +38,10 @@ - [liquor](https://github.com/chjj/liquor) | ||
- [react](https://github.com/facebook/react) | ||
- [slm](https://github.com/slm-lang/slm) | ||
- [swig](https://github.com/paularmstrong/swig) [(website)](http://paularmstrong.github.com/swig/) | ||
- [templayed](http://archan937.github.com/templayed.js/) | ||
- [twig](https://github.com/justjohn/twig.js) | ||
- [liquid](https://github.com/leizongmin/tinyliquid) [(website)](http://liquidmarkup.org/) | ||
- [toffee](https://github.com/malgorithms/toffee) | ||
- [underscore](https://github.com/documentcloud/underscore) [(website)](http://documentcloud.github.com/underscore/) | ||
- [vash](https://github.com/kirbysayshi/vash) | ||
- [walrus](https://github.com/jeremyruppel/walrus) [(website)](http://documentup.com/jeremyruppel/walrus/) | ||
@@ -190,3 +193,3 @@ - [whiskers](https://github.com/gsf/whiskers.js) | ||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> | ||
Copyright (c) 2011-2016 TJ Holowaychuk <tj@vision-media.ca> | ||
@@ -193,0 +196,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
40243
1040
210
39
1
+ Addedbluebird@3.7.2(transitive)
- Removedbluebird@2.11.0(transitive)
Updatedbluebird@^3.1.1