Socket
Socket
Sign inDemoInstall

bemc

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bemc - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

36

lib/bemc.js

@@ -6,3 +6,4 @@ var ometajs = require('ometajs'),

BEMCParser = bemc.BEMCParser,
BEMCToXJST = bemc.BEMCToXJST;
BEMCToXJST = bemc.BEMCToXJST,
BEMCLogLocal = bemc.BEMCLogLocal;

@@ -19,3 +20,12 @@ //

var tree = BEMCParser.matchAll(source, 'topLevel'),
xjstTree = xjst.translate(BEMCToXJST.match(tree, 'topLevel')),
xjstPre = BEMCToXJST.match(tree, 'topLevel'),
vars = [];
if (options.cache === true) {
var xjstCached = BEMCLogLocal.match(xjstPre, 'topLevel');
vars = xjstCached[0];
xjstPre = xjstCached[1];
}
var xjstTree = xjst.translate(xjstPre),
exportName = options.exportName || 'TEMPLATES',

@@ -30,10 +40,16 @@ xjstOpts = options.devMode? { 'no-opt': true } : { engine: 'sort-group' };

return 'var ' + exportName + ' = ' + xjstJS + ';\n' +
exportName + ' = (function(xjst) {\n' +
' return function() {\n' +
' return xjst.apply.call(\n' +
(options.raw ? 'this' : '[this]') + '\n' +
' ); };\n' +
'}(' + exportName + '));\n' +
'typeof exports === "undefined" || (exports.' + exportName + ' = ' + exportName + ');';
return 'var ' + exportName + ' = function() {\n' +
' var cache,\n' +
' xjst = ' + xjstJS + ';\n' +
' return function(options) {\n' +
' if (!options) options = {};\n' +
' cache = options.cache;\n' +
(vars.length > 0 ? ' var ' + vars.join(', ') + ';\n' : '') +
' return xjst.apply.call(\n' +
(options.raw ? 'this' : '[this]') + '\n' +
' );\n' +
' };\n' +
'}();\n' +
'typeof exports === "undefined" || ' +
'(exports.' + exportName + ' = ' + exportName + ');';
};

@@ -40,0 +56,0 @@

{
"name": "bemc",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "http://github.com/bem/bemc",

@@ -19,4 +19,4 @@ "author": "Fedor Indutny <fedor.indutny@gmail.com> (http://github.com/indutny)",

"coa": "*",
"xjst": "~0.3.3",
"ometajs": "~3.1.4",
"xjst": "~0.3.16",
"ometajs": "~3.1.17",
"q-fs": "~0.1.33"

@@ -23,0 +23,0 @@ },

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