babel-plugin-vasille 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/jsx.js +5 -0
- package/package.json +1 -1
package/lib/jsx.js
CHANGED
|
@@ -221,6 +221,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
221
221
|
const classStatic = [];
|
|
222
222
|
const styleObject = [];
|
|
223
223
|
const styleStatic = [];
|
|
224
|
+
let callback = null;
|
|
224
225
|
for (const attrPath of opening.get("attributes")) {
|
|
225
226
|
const attr = attrPath.node;
|
|
226
227
|
if (t.isJSXAttribute(attr)) {
|
|
@@ -388,6 +389,9 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
388
389
|
attrs.push(t.objectProperty(t.identifier("style"), expressionPath.node));
|
|
389
390
|
}
|
|
390
391
|
}
|
|
392
|
+
else if (name.name === "callback" && expressionPath && expressionPath.isExpression()) {
|
|
393
|
+
callback = expressionPath.node;
|
|
394
|
+
}
|
|
391
395
|
else {
|
|
392
396
|
/* istanbul ignore else */
|
|
393
397
|
if (expressionPath && expressionPath.isExpression()) {
|
|
@@ -455,6 +459,7 @@ function transformJsxElement(path, conditions, internal) {
|
|
|
455
459
|
]
|
|
456
460
|
: []),
|
|
457
461
|
...(styleObject.length > 0 ? [t.objectProperty(t.identifier("style"), t.objectExpression(styleObject))] : []),
|
|
462
|
+
...(callback ? [t.objectProperty(t.identifier("callback"), callback)] : []),
|
|
458
463
|
]),
|
|
459
464
|
...(statements.length > 0 ? [t.arrowFunctionExpression([internal_js_1.ctx], t.blockStatement(statements))] : []),
|
|
460
465
|
]);
|