Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

hbs

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hbs - npm Package Compare versions

Comparing version 4.0.4 to 4.0.5

11

HISTORY.md

@@ -0,1 +1,12 @@

4.0.5 / 2019-09-27
==================
* Fix async helpers not working when cache enabled
* Fix handling of exceptions from layout
* Fix handling of exceptions when cache enabled
* deps: handlebars@4.3.3
- Block calling `helperMissing` and `blockHelperMissing` from templates
- Fix work-around for `constructor` blocking
* deps: walk@2.3.14
4.0.4 / 2019-04-14

@@ -2,0 +13,0 @@ ==================

3

lib/async.js

@@ -98,3 +98,3 @@ /// provides the async helper functionality

})
fn.apply(null, args);

@@ -109,2 +109,1 @@

};

@@ -49,3 +49,16 @@ var fs = require('fs');

if (template) {
return cb(null, template(locals, handlebarsOpts));
try {
var res = template(locals, handlebarsOpts)
self.async.done(function (values) {
Object.keys(values).forEach(function (id) {
res = res.replace(id, values[id])
})
cb(null, res)
})
} catch (err) {
cb(prependFilenameToError(filename, err))
}
return
}

@@ -73,4 +86,3 @@

} catch (err) {
err.message = filename + ': ' + err.message;
cb(err);
cb(prependFilenameToError(filename, err))
}

@@ -81,3 +93,3 @@ });

// render with a layout
function render_with_layout(template, locals, cb) {
function render_with_layout (filename, template, locals, cb) {
render_file(locals, function(err, str) {

@@ -90,10 +102,14 @@ if (err) {

var res = template(locals, handlebarsOpts);
self.async.done(function(values) {
Object.keys(values).forEach(function(id) {
res = res.replace(id, values[id]);
});
try {
var res = template(locals, handlebarsOpts)
self.async.done(function (values) {
Object.keys(values).forEach(function (id) {
res = res.replace(id, values[id])
})
cb(null, res);
});
cb(null, res)
})
} catch (err) {
cb(prependFilenameToError(filename, err))
}
});

@@ -129,22 +145,28 @@ }

var layout_template = layout_filename.reduce(function (cached, filename) {
if (cached) {
return cached;
for (var i = 0; i < layout_filename.length; i++) {
var layout_template = cache[layout_filename[i]]
if (layout_template) {
return render_with_layout(layout_filename[i], layout_template, options, cb)
}
}
var cached_file = cache[filename];
// TODO check if layout path has .hbs extension
if (cached_file) {
return cache[filename];
function prependFilenameToError (filename, err) {
// prepend to the message
err.message = filename + ': ' + err.message
// restore error message on stack (https://github.com/wycats/handlebars.js/issues/1562)
if (typeof err.stack === 'string' && err.stack.indexOf(err.name + '\n') === 0 && err.stack.indexOf(err.message) === -1) {
Object.defineProperty(err, 'stack', {
configurable: true,
value: err.name + ': ' + err.message,
writable: true
})
}
return undefined;
}, undefined);
if (layout_template) {
return render_with_layout(layout_template, options, cb);
return err
}
// TODO check if layout path has .hbs extension
function cacheAndCompile(filename, str) {

@@ -156,3 +178,3 @@ var layout_template = handlebars.compile(str);

render_with_layout(layout_template, options, cb);
render_with_layout(filename, layout_template, options, cb)
}

@@ -159,0 +181,0 @@

{
"name": "hbs",
"description": "Express.js template engine plugin for Handlebars",
"version": "4.0.4",
"version": "4.0.5",
"author": "Don Park <donpark@docuverse.com> (http://blog.docuverse.com)",

@@ -9,23 +9,31 @@ "contributors": [

],
"license": "MIT",
"repository": "pillarjs/hbs",
"main": "lib/hbs.js",
"directories": {
"lib": "./lib"
},
"dependencies": {
"handlebars": "4.0.14",
"walk": "2.3.9"
"handlebars": "4.3.3",
"walk": "2.3.14"
},
"devDependencies": {
"istanbul": "0.4.5",
"mocha": "1.21.5",
"supertest": "1.1.0"
"eslint": "5.16.0",
"mocha": "6.2.0",
"nyc": "14.1.1",
"rimraf": "2.7.1",
"supertest": "4.0.2"
},
"license": "MIT",
"files": [
"lib/",
"HISTORY.md",
"LICENSE",
"README.md"
],
"engines": {
"node": ">= 0.8.0"
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
},
"scripts": {
"test": "istanbul cover node_modules/mocha/bin/_mocha"
"lint": "eslint .",
"test": "mocha --reporter spec test/*/index.js",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
}
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