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

templates

Package Overview
Dependencies
Maintainers
3
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

templates - npm Package Compare versions

Comparing version 0.11.3 to 0.11.4

7

index.js

@@ -10,2 +10,3 @@ /*!

var debug = require('debug')('templates');
var helpers = require('./lib/helpers');

@@ -53,2 +54,3 @@ var plugin = require('./lib/plugins/');

utils.define(this, 'isApp', true);
debug('Initializing templates');
this.is('Templates');

@@ -134,5 +136,2 @@

this.on('option', function(key, value) {
if (key === 'mixins') {
app.visit('mixin', value);
}
utils.updateOptions(app, key, value);

@@ -250,2 +249,3 @@ });

Templates.prototype.create = function(name, opts) {
debug('creating view collection: "%s"', name);
opts = opts || {};

@@ -330,2 +330,3 @@

if (utils.isRenderable(view)) {
debug('resolving layout for "%s"', view.key);
var views = this[view.options.collection];

@@ -332,0 +333,0 @@ return views.resolveLayout(view) || this.option('layout');

'use strict';
var debug = require('debug')('templates:helpers');
var List = require('./list');

@@ -116,2 +117,3 @@ var utils = require('./utils');

app.emit('helper', single + ' helper > rendering "' + name + '"');
debug('"%s" searching for "%s"', single, name);

@@ -136,5 +138,8 @@ if (typeof locals === 'function') {

var ctx = helperContext.call(this, view, locals, opts);
debug('"%s" pre-rendering "%s"', single, name);
this.app.render(view, ctx, function(err, res) {
if (err) return cb(err);
debug('"%s" post-rendering "%s"', single, name);
cb(null, res.content);

@@ -141,0 +146,0 @@ });

'use strict';
var path = require('path');
var debug = require('debug')('templates:list');
var plugin = require('./plugins');

@@ -37,3 +37,3 @@ var utils = require('./utils');

utils.define(this, 'isCollection', true);
utils.isName(this, 'List');
this.is('List');

@@ -123,2 +123,3 @@ Base.call(this);

utils.isName(item, 'Item', true);
debug('adding item "%s"', item.key);

@@ -125,0 +126,0 @@ if (this.options.pager === true) {

'use strict';
var debug = require('debug')('templates:context');
var utils = require('../utils');

@@ -52,5 +53,8 @@

app.define('context', function(view, locals) {
debug('merging context for view "%s"', view.path);
if (typeof this.options.mergeContext === 'function') {
return this.options.mergeContext.apply(this, arguments);
}
var obj = {};

@@ -71,2 +75,4 @@ obj = utils.merge({}, obj, this.cache.data);

debug('binding helpers for view "%s"', view.path);
var helpers = {};

@@ -104,2 +110,4 @@ var obj = this._.helpers;

app.define('mergePartials', function(options) {
debug('merging partials');
var opts = utils.extend({}, this.options, options);

@@ -111,2 +119,4 @@ var names = opts.mergeTypes || this.viewTypes.partial;

names.forEach(function(name) {
debug('merging partials for collection "%s"', name);
var collection = self.views[name];

@@ -113,0 +123,0 @@ for (var key in collection) {

'use strict';
var debug = require('debug')('templates:engine');
var utils = require('../utils');

@@ -57,3 +58,5 @@

proto.setEngine = function(ext, fn, settings) {
this._.engines.setEngine(utils.formatExt(ext), fn, settings);
ext = utils.formatExt(ext);
debug('registering engine "%s"', ext);
this._.engines.setEngine(ext, fn, settings);
return this;

@@ -70,2 +73,3 @@ };

ext = ext ? utils.formatExt(ext) : null;
debug('getting engine "%s"', ext);

@@ -72,0 +76,0 @@ var engine = this._.engines.getEngine(ext);

'use strict';
var debug = require('debug')('templates:helper');
var utils = require('../utils');

@@ -23,3 +24,4 @@

app.define('helper', function() {
app.define('helper', function(name) {
debug('registering sync helper "%s"', name);
sync.apply(sync, arguments);

@@ -64,2 +66,3 @@ return this;

app.define('getHelper', function(name, async) {
debug('getting "%s"', name);
return this.get(['_.helpers', async ? 'async' : 'sync', name]);

@@ -82,3 +85,4 @@ });

app.define('asyncHelper', function() {
app.define('asyncHelper', function(name) {
debug('registering async helper "%s"', name);
async.apply(async, arguments);

@@ -128,2 +132,3 @@ return this;

app.define('helperGroup', function(name, helpers, isAsync) {
debug('registering helper group "%s"', name);
helpers = utils.arrayify(helpers);

@@ -130,0 +135,0 @@ var type = isAsync ? 'async' : 'sync';

@@ -66,3 +66,2 @@ 'use strict';

item.key = this.renameKey.call(this, item.key || key, item);

@@ -69,0 +68,0 @@

'use strict';
var debug = require('debug')('templates:layout');
var utils = require('../utils');

@@ -16,2 +17,3 @@

proto.applyLayout = function(view) {
debug('applying layout to view "%s"', view.path);
if (view.options.layoutApplied) {

@@ -45,3 +47,6 @@ return view;

// Handle each layout before it's applied to a view
function handleLayout(obj, stats/*, depth*/) {
function handleLayout(obj, stats, depth) {
var layoutName = obj.layout.basename;
debug('applied layout (#%d) "%s", to view "%s"', depth, layoutName, view.path);
view.currentLayout = obj.layout;

@@ -48,0 +53,0 @@ view.define('layoutStack', stats.history);

'use strict';
var debug = require('debug')('templates:render');
var utils = require('../utils');

@@ -95,2 +96,8 @@

if (typeof view === 'undefined') {
throw new Error('Templates#compile cannot find view: ' + view);
}
debug('compiling view "%s"', view.path);
// handle `preCompile` middleware

@@ -101,2 +108,4 @@ this.handleView('preCompile', view);

var ext = utils.resolveEngine(view, locals, this.options);
debug('pre-compile, getting engine "%s"', ext);
// get the actual engine (object)

@@ -128,2 +137,3 @@ var engine = this.getEngine(ext);

view.fn = engine.compile(view.content, settings);
debug('compiled view "%s"', view.path);

@@ -178,2 +188,4 @@ // handle `postCompile` middleware

debug('pre-rendering "%s"', view.path);
// handle `preRender` middleware

@@ -185,4 +197,5 @@ this.handleView('preRender', view, function(err) {

var ext = utils.resolveEngine(view, locals, this.options);
debug('pre-render, getting engine "%s"', ext);
var engine = this.getEngine(ext);
if (!engine) {

@@ -210,2 +223,4 @@ cb(this.formatError('render', 'engine', formatExtError(view, ext)));

debug('rendering view: "%s"', view.key);
// render the view

@@ -221,3 +236,5 @@ engine.render(view.fn, context, function(err, res) {

debug('rendered view "%s"', view.key);
view.content = res;
// handle `postRender` middleware

@@ -224,0 +241,0 @@ this.handle('postRender', view, cb);

'use strict';
var debug = require('debug')('templates:routes');
var utils = require('../utils');

@@ -46,2 +47,4 @@

proto.handle = function(method, view, locals, cb) {
debug('handling method "%s", for view "%s"', method, view.key);
if (typeof locals === 'function') {

@@ -48,0 +51,0 @@ cb = locals;

'use strict';
var fs = require('fs');
var debug = require('debug')('templates:views');
var plugin = require('./plugins');

@@ -110,2 +111,3 @@ var utils = require('./utils');

var view = this.view(key, value);
debug('adding view "%s"', view.path);

@@ -181,2 +183,3 @@ // if `view is not an instance of `View`, it will still

}
debug('deleting view "%s"', view.key);
delete this.views[view.key];

@@ -273,2 +276,3 @@ return this;

debug('getting view "%s"', name);
if (typeof options === 'function') {

@@ -275,0 +279,0 @@ fn = options;

{
"name": "templates",
"description": "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.",
"version": "0.11.3",
"version": "0.11.4",
"homepage": "https://github.com/jonschlinkert/templates",

@@ -31,2 +31,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"clone-stats": "0.0.1",
"debug": "^2.2.0",
"deep-bind": "^0.2.1",

@@ -33,0 +34,0 @@ "define-property": "^0.2.5",

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