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

babel-plugin-jsx-dom-expressions

Package Overview
Dependencies
Maintainers
1
Versions
376
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-jsx-dom-expressions - npm Package Compare versions

Comparing version 0.0.25 to 0.0.26

115

dist/createRuntime.js

@@ -413,3 +413,3 @@ var NOINSERT, NOMATCH, RECONCILE_ARRAY_BATCH, RECONCILE_ARRAY_BITS, RECONCILE_ARRAY_INC, RECONCILE_ARRAY_MASK, equable, findGreatestIndexLEQ, insertOrAppend, longestPositiveIncreasingSubsequence, reconcileArrays;

var applySpread, multipleExpressions, normalizeIncomingArray, singleExpression;
var normalizeIncomingArray;

@@ -436,9 +436,9 @@ normalizeIncomingArray = function(normalized, array) {

singleExpression = function() {
var current;
current = null;
return function(parent, value) {
var createRuntime = function(options) {
var multipleExpressions, singleExpression, wrap;
({wrap} = options);
singleExpression = function(parent, value, current) {
var array, child, j, l, len1, len2, t;
if (value === current) {
return;
return current;
}

@@ -459,2 +459,6 @@ t = typeof value;

return current = parent.textContent = '';
} else if (t === 'function') {
return wrap(function() {
return current = singleExpression(parent, value(), current);
});
} else if (value instanceof Node) {

@@ -504,8 +508,3 @@ if (Array.isArray(current)) {

};
};
multipleExpressions = function() {
var nodes;
nodes = [];
return function(parent, value) {
multipleExpressions = function(parent, value, nodes) {
var array, child, i, j, len1, marker, node, ref, ref1, ref2, t;

@@ -528,2 +527,6 @@ marker = null;

}
} else if (t === 'function') {
wrap(function() {
return nodes = multipleExpressions(parent, value(), nodes);
});
} else if (value instanceof Node) {

@@ -580,36 +583,4 @@ if (nodes[0]) {

}
return nodes;
};
};
applySpread = function(node, props) {
var className, info, k, prop, value;
for (prop in props) {
value = props[prop];
if (prop === 'style') {
for (k in value) {
node.style[k] = value[k];
}
continue;
}
if (prop === 'classList') {
for (className in value) {
node.classList.toggle(className, prop[className]);
}
continue;
}
if (info = Attributes[prop]) {
if (info.type === 'attribute') {
node.setAttribute(prop, value);
continue;
} else {
prop = info.alias;
}
}
node[prop] = value;
}
};
var createRuntime = function(options) {
var wrap;
({wrap} = options);
return Object.assign({

@@ -627,22 +598,50 @@ assign: function(a) {

insert: function(parent, accessor) {
if (typeof accessor === 'function') {
return wrap(parent, accessor, false, singleExpression());
var current;
if (typeof accessor !== 'function') {
return singleExpression(parent, accessor);
}
return singleExpression()(parent, accessor);
current = null;
return wrap(() => {
current = singleExpression(parent, accessor(), current);
});
},
insertM: function(parent, accessor) {
if (typeof accessor === 'function') {
return wrap(parent, accessor, false, multipleExpressions());
var current;
if (typeof accessor !== 'function') {
return multipleExpressions(parent, accessor);
}
return multipleExpressions()(parent, accessor);
current = null;
return wrap(() => {
current = expr(parent, accessor(), current);
});
},
spread: function(elem, accessor) {
return wrap(elem, function() {
var k, props, v;
spread: function(node, accessor) {
return wrap(function() {
var className, info, k, prop, props, value;
props = accessor();
for (k in props) {
v = props[k];
for (prop in props) {
value = props[prop];
if (prop === 'style') {
for (k in value) {
node.style[k] = value[k];
}
continue;
}
if (prop === 'classList') {
for (className in value) {
node.classList.toggle(className, value[className]);
}
continue;
}
if (info = Attributes[prop]) {
if (info.type === 'attribute') {
node.setAttribute(prop, value);
continue;
} else {
prop = info.alias;
}
}
node[prop] = value;
}
return props;
}, true, applySpread);
});
}

@@ -649,0 +648,0 @@ }, options);

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

var applySpread, multipleExpressions, normalizeIncomingArray, singleExpression;
var normalizeIncomingArray;

@@ -444,9 +444,9 @@ normalizeIncomingArray = function(normalized, array) {

singleExpression = function() {
var current;
current = null;
return function(parent, value) {
var createRuntime = function(options) {
var multipleExpressions, singleExpression, wrap;
({wrap} = options);
singleExpression = function(parent, value, current) {
var array, child, j, l, len1, len2, t;
if (value === current) {
return;
return current;
}

@@ -467,2 +467,6 @@ t = typeof value;

return current = parent.textContent = '';
} else if (t === 'function') {
return wrap(function() {
return current = singleExpression(parent, value(), current);
});
} else if (value instanceof Node) {

@@ -512,8 +516,3 @@ if (Array.isArray(current)) {

};
};
multipleExpressions = function() {
var nodes;
nodes = [];
return function(parent, value) {
multipleExpressions = function(parent, value, nodes) {
var array, child, i, j, len1, marker, node, ref, ref1, ref2, t;

@@ -536,2 +535,6 @@ marker = null;

}
} else if (t === 'function') {
wrap(function() {
return nodes = multipleExpressions(parent, value(), nodes);
});
} else if (value instanceof Node) {

@@ -588,36 +591,4 @@ if (nodes[0]) {

}
return nodes;
};
};
applySpread = function(node, props) {
var className, info, k, prop, value;
for (prop in props) {
value = props[prop];
if (prop === 'style') {
for (k in value) {
node.style[k] = value[k];
}
continue;
}
if (prop === 'classList') {
for (className in value) {
node.classList.toggle(className, prop[className]);
}
continue;
}
if (info = Attributes[prop]) {
if (info.type === 'attribute') {
node.setAttribute(prop, value);
continue;
} else {
prop = info.alias;
}
}
node[prop] = value;
}
};
var createRuntime = function(options) {
var wrap;
({wrap} = options);
return Object.assign({

@@ -635,22 +606,50 @@ assign: function(a) {

insert: function(parent, accessor) {
if (typeof accessor === 'function') {
return wrap(parent, accessor, false, singleExpression());
var current;
if (typeof accessor !== 'function') {
return singleExpression(parent, accessor);
}
return singleExpression()(parent, accessor);
current = null;
return wrap(() => {
current = singleExpression(parent, accessor(), current);
});
},
insertM: function(parent, accessor) {
if (typeof accessor === 'function') {
return wrap(parent, accessor, false, multipleExpressions());
var current;
if (typeof accessor !== 'function') {
return multipleExpressions(parent, accessor);
}
return multipleExpressions()(parent, accessor);
current = null;
return wrap(() => {
current = expr(parent, accessor(), current);
});
},
spread: function(elem, accessor) {
return wrap(elem, function() {
var k, props, v;
spread: function(node, accessor) {
return wrap(function() {
var className, info, k, prop, props, value;
props = accessor();
for (k in props) {
v = props[k];
for (prop in props) {
value = props[prop];
if (prop === 'style') {
for (k in value) {
node.style[k] = value[k];
}
continue;
}
if (prop === 'classList') {
for (className in value) {
node.classList.toggle(className, value[className]);
}
continue;
}
if (info = Attributes[prop]) {
if (info.type === 'attribute') {
node.setAttribute(prop, value);
continue;
} else {
prop = info.alias;
}
}
node[prop] = value;
}
return props;
}, true, applySpread);
});
}

@@ -699,3 +698,3 @@ }, options);

var e;
e = path.hub.file.code.slice(jsx.start + 1, +(jsx.end - 1) + 1 || 9e9).trim();
e = path.hub.file.code.slice(jsx.start + 1, jsx.end - 1).trim();
return e[0] === '(' && e[1] === '(' && e[e.length - 2] === ')' && e[e.length - 1] === ')';

@@ -732,11 +731,9 @@ };

switch (name) {
case 'fn':
return [elem, t.arrowFunctionExpression([], value), t.booleanLiteral(true), t.arrowFunctionExpression([t.identifier('_el$'), t.identifier('value')], t.callExpression(t.identifier(`${moduleName}.assign`), [t.memberExpression(t.identifier('_el$'), t.identifier(name)), t.identifier('value')]))];
case 'style':
return [elem, t.arrowFunctionExpression([], value), t.booleanLiteral(true), t.arrowFunctionExpression([t.identifier('_el$'), t.identifier('value')], t.callExpression(t.identifier(`${moduleName}.assign`), [t.memberExpression(t.identifier('_el$'), t.identifier(name)), t.identifier('value')]))];
return [t.arrowFunctionExpression([], t.callExpression(t.identifier(`${moduleName}.assign`), [t.memberExpression(elem, t.identifier(name)), value]))];
case 'classList':
iter = t.identifier("className");
return [elem, t.arrowFunctionExpression([], value), t.booleanLiteral(true), t.arrowFunctionExpression([t.identifier('_el$'), t.identifier('value')], t.blockStatement([t.forInStatement(declare(iter), t.identifier('value'), t.ifStatement(t.callExpression(t.memberExpression(t.identifier('value'), hasOwnProperty), [iter]), t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('_el$'), t.identifier("classList.toggle")), [iter, t.memberExpression(t.identifier('value'), iter, true)]))))]))];
return [t.arrowFunctionExpression([], t.blockStatement([t.forInStatement(declare(iter), value, t.ifStatement(t.callExpression(t.memberExpression(value, hasOwnProperty), [iter]), t.expressionStatement(t.callExpression(t.memberExpression(elem, t.identifier("classList.toggle")), [iter, t.memberExpression(value, iter, true)]))))]))];
default:
return [elem, t.arrowFunctionExpression([], value), t.booleanLiteral(true), t.arrowFunctionExpression([t.identifier('_el$'), t.identifier('value')], setAttr(t.identifier('_el$'), name, t.identifier('value')))];
return [t.arrowFunctionExpression([], setAttr(elem, name, value))];
}

@@ -743,0 +740,0 @@ })();

{
"name": "babel-plugin-jsx-dom-expressions",
"description": "A JSX to DOM plugin that wraps expressions for fine grained change detection",
"version": "0.0.25",
"version": "0.0.26",
"author": "Ryan Carniato",

@@ -19,3 +19,3 @@ "license": "MIT",

"coffeescript": "2.2.3",
"rollup": "^0.58.1",
"rollup": "^0.64.0",
"rollup-plugin-coffee2": "^0.1.15",

@@ -25,4 +25,4 @@ "rollup-plugin-node-resolve": "^3.3.0"

"dependencies": {
"@babel/plugin-syntax-jsx": "^7.0.0-beta.49"
"@babel/plugin-syntax-jsx": "^7.0.0-beta.56"
}
}

@@ -28,5 +28,5 @@ # Babel Plugin JSX DOM Expressions

### wrap(valueAccessor, element, isAttr, fn) : void
### wrap(fn) : void
This is called around all expressions. This is typically where you wrap the expression with a computation in the desired library and handle any value preparsing. Call fn with the resolved value and element.
This is called around all expressions. This is typically where you wrap the expression with a computation in the desired library and handle any value preparsing.

@@ -33,0 +33,0 @@ ## Special Binding

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