New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

monkberry

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

monkberry - npm Package Compare versions

Comparing version 3.8.0 to 3.8.1

50

lib/compiler/element/custom.js

@@ -17,3 +17,3 @@ 'use strict';

var placeholder;
var placeholder = undefined;
var parentNode = (0, _utils.lookUpOnlyOneChild)(this);

@@ -24,8 +24,8 @@ if (parentNode) {

placeholder = 'custom' + figure.uniqid('placeholder');
figure.declare(["var ", placeholder, " = document.createComment('" + customNodeName + "');"]);
figure.declare(['var ' + placeholder + ' = document.createComment(\'' + customNodeName + '\');']);
}
figure.declare(["var ", childName, " = {};"]);
figure.declare(['var ' + childName + ' = {};']);
var defaultData = [];
var hasUpdater = false;
var data = [];
var variables = [];

@@ -46,27 +46,13 @@ // Collect info about variables and attributes.

});
hasUpdater = true;
} else {
(function () {
// TODO: Add support for default value in custom tag attributes attr={{ value || 'default' }}.
var _attr$compileToExpres = attr.compileToExpression();
var _attr$compileToExpres = attr.compileToExpression();
var _attr$compileToExpres2 = _slicedToArray(_attr$compileToExpres, 1);
var _attr$compileToExpres2 = _slicedToArray(_attr$compileToExpres, 1);
var expr = _attr$compileToExpres2[0]; // TODO: Add support for default value in custom tag attributes attr={{ value || 'default' }}.
var expr = _attr$compileToExpres2[0];
variables = variables.concat((0, _variable.collectVariables)(expr));
var variables = (0, _variable.collectVariables)(expr);
var data = (0, _sourceNode.sourceNode)(_this.loc, ['\'' + attr.name + '\': ' + expr.compile()]);
if (variables.length == 0) {
defaultData.push(data);
} else {
figure.addUpdater(_this.loc, variables, function () {
return (0, _sourceNode.sourceNode)(_this.loc, [' monkberry.insert(view, ' + placeholder + ', ' + childName + ', \'' + templateName + '\', {' + data + '}, true)']);
});
hasUpdater = true;
}
})();
var property = (0, _sourceNode.sourceNode)(_this.loc, ['\'' + attr.name + '\': ' + expr.compile()]);
data.push(property);
}

@@ -93,9 +79,13 @@ };

if (!hasUpdater || defaultData.length > 0) {
var data = '{}';
variables = (0, _utils.unique)(variables);
data = '{' + data.join(', ') + '}';
if (defaultData.length > 0) {
data = '{' + defaultData.join(', ') + '}';
}
// Add complex/caching updater for custom attribute or insert on render if no variables in attributes.
if (variables.length > 0) {
figure.addUpdater(this.loc, variables, function () {
return (0, _sourceNode.sourceNode)(_this.loc, [' monkberry.insert(view, ' + placeholder + ', ' + childName + ', \'' + templateName + '\', ' + data + ', true)']);
});
} else {
figure.renderActions.push((0, _sourceNode.sourceNode)(this.loc, [' monkberry.insert(view, ' + placeholder + ', ' + childName + ', \'' + templateName + '\', ' + data + ', true);']));

@@ -102,0 +92,0 @@ }

6

lib/compiler/if.js

@@ -76,3 +76,3 @@ 'use strict';

return figure.addUpdater(loc, variablesOfExpression, function () {
return (0, _sourceNode.sourceNode)(loc, [" ", prepend, "monkberry.insert(view, ", placeholder, ", ", childName, ", ", '\'' + templateName + '\', ', "__data__, ", result, ")"]);
return (0, _sourceNode.sourceNode)(loc, [' ', prepend + 'monkberry.insert(view, ' + placeholder + ', ' + childName + ', \'' + templateName + '\', __data__, ' + result + ')']);
});

@@ -92,4 +92,6 @@ }

variablesOfBody.forEach(function (variable) {
figure.onUpdater(variable).add((0, _sourceNode.sourceNode)(loc, [" ", childName, ".ref && ", childName, ".ref.__update__.", variable, "(__data__, ", variable, ")"]));
figure.onUpdater(variable).add((0, _sourceNode.sourceNode)(loc, [' ',
// TODO: Properly collect local variables in templates and delete `hasOwnProperty` check in `if` refs.
childName + '.ref && ' + childName + '.ref.__update__.hasOwnProperty(\'' + variable + '\') && ' + childName + '.ref.__update__.' + variable + '(__data__, ' + variable + ')']));
});
}

@@ -284,2 +284,4 @@ /** _ _

this.onRemove = null; // Function to call on remove.
this.__update__ = null;
this.__cache__ = null;
};

@@ -298,3 +300,3 @@

// Clear cache to prevent double updating.
if (_this.__cache__) {
if (this.__cache__) {
keys.forEach(function (key) {

@@ -308,3 +310,3 @@ if (key in _this.__cache__) {

// Update view.
if (_this.__update__) {
if (this.__update__) {
keys.forEach(function (key) {

@@ -311,0 +313,0 @@ if (_this.__update__.hasOwnProperty(key)) {

{
"name": "monkberry",
"version": "3.8.0",
"version": "3.8.1",
"description": "JavaScript DOM Template Engine",

@@ -5,0 +5,0 @@ "bin": "bin/monkberry",

@@ -706,3 +706,4 @@ # Monkberry - JavaScript template engine

* Atom Text Editor: [language-monkberry](https://atom.io/packages/language-monkberry)
* [Atom Package](https://atom.io/packages/language-monkberry)
* [Sublime Text Package](https://github.com/monkberry/language-monkberry)

@@ -709,0 +710,0 @@ ## Benchmarks

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