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.15 to 0.0.16

37

lib/index.js

@@ -699,3 +699,16 @@ 'use strict';

setAttrExpr = function(path, elem, name, value) {
var iter;
var c, i, iter, j, len, ref;
if (value.comments) {
ref = value.comments;
for (i = j = 0, len = ref.length; j < len; i = ++j) {
c = ref[i];
if (c.value.indexOf('@skip') > -1) {
break;
}
}
if (i < value.comments.length) {
value.comments.splice(i, 1);
return t.expressionStatement(setAttr(elem, name, value));
}
}
if (name.startsWith("on")) {

@@ -717,3 +730,3 @@ return t.expressionStatement(t.callExpression(t.memberExpression(elem, t.identifier("addEventListener")), [t.stringLiteral(toEventName(name)), value]));

generateHTMLNode = function(path, jsx, opts) {
var attribute, call, child, children, decl, elems, i, j, k, l, len, len1, len2, len3, len4, m, name, namespace, nativeExtension, props, propsId, ref, ref1, ref2, ref3, ref4, spreads, tagName, value;
var attribute, call, child, children, decl, elems, j, k, l, len, len1, len2, len3, len4, m, n, name, namespace, nativeExtension, props, propsId, ref, ref1, ref2, ref3, ref4, spreads, tagName, value;
if (t.isJSXElement(jsx)) {

@@ -727,4 +740,4 @@ name = path.scope.generateUidIdentifier("elem");

ref = jsx.openingElement.attributes;
for (i = 0, len = ref.length; i < len; i++) {
attribute = ref[i];
for (j = 0, len = ref.length; j < len; j++) {
attribute = ref[j];
if (t.isJSXSpreadAttribute(attribute)) {

@@ -743,4 +756,4 @@ spreads.push(attribute.argument);

ref1 = jsx.children;
for (j = 0, len1 = ref1.length; j < len1; j++) {
child = ref1[j];
for (k = 0, len1 = ref1.length; k < len1; k++) {
child = ref1[k];
child = generateHTMLNode(path, child, opts);

@@ -776,4 +789,4 @@ if (child === null) {

ref2 = jsx.openingElement.attributes;
for (k = 0, len2 = ref2.length; k < len2; k++) {
attribute = ref2[k];
for (l = 0, len2 = ref2.length; l < len2; l++) {
attribute = ref2[l];
if (t.isJSXSpreadAttribute(attribute)) {

@@ -808,4 +821,4 @@ elems.push(t.expressionStatement(t.callExpression(t.identifier(`${moduleName}.spread`), [name, t.arrowFunctionExpression([], attribute.argument)])));

ref3 = jsx.children;
for (l = 0, len3 = ref3.length; l < len3; l++) {
child = ref3[l];
for (m = 0, len3 = ref3.length; m < len3; m++) {
child = ref3[m];
child = generateHTMLNode(path, child, opts);

@@ -833,4 +846,4 @@ if (child === null) {

ref4 = jsx.children;
for (m = 0, len4 = ref4.length; m < len4; m++) {
child = ref4[m];
for (n = 0, len4 = ref4.length; n < len4; n++) {
child = ref4[n];
child = generateHTMLNode(path, child, opts);

@@ -837,0 +850,0 @@ if (child === null) {

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

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -32,4 +32,12 @@ # Babel Plugin JSX DOM Expressions

This called whenever a value is going to be assigned to a element property. It lets you clean up the value (like remove nested observables etc..) before you pass it to element. This is optional.
This is called whenever a value is going to be assigned to a element property. It lets you clean up the value (like remove nested observables etc..) before you pass it to element. This is optional.
## Pragma Comments
In order to optimize certain situations the compiler supports pragma comments.
### @skip
This skips wrapping the attribute expression in a function and just writes it straight out. Keep in mind if the element is in a parent expression it may unintentionally trigger it. So keep that in mind.
## Work in Progress

@@ -45,3 +53,3 @@

Multi-nested Fragments
Boolean Attribute handling
Better Boolean Attribute handling

@@ -48,0 +56,0 @@ ## Acknowledgements

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