babel-helper-builder-react-jsx
Advanced tools
Comparing version 7.0.0-beta.1 to 7.0.0-beta.2
@@ -14,5 +14,7 @@ "use strict"; | ||
exit: function exit(path, file) { | ||
var callExpr = buildElementCall(path.get("openingElement"), file); | ||
callExpr.arguments = callExpr.arguments.concat(path.node.children); | ||
path.replaceWith(t.inherits(callExpr, path.node)); | ||
var callExpr = buildElementCall(path, file); | ||
if (callExpr) { | ||
path.replaceWith(t.inherits(callExpr, path.node)); | ||
} | ||
} | ||
@@ -67,4 +69,6 @@ }; | ||
function buildElementCall(path, file) { | ||
path.parent.children = t.react.buildChildren(path.parent); | ||
var tagExpr = convertJSXIdentifier(path.node.name, path.node); | ||
if (opts.filter && !opts.filter(path.node, file)) return; | ||
var openingPath = path.get("openingElement"); | ||
openingPath.parent.children = t.react.buildChildren(openingPath.parent); | ||
var tagExpr = convertJSXIdentifier(openingPath.node.name, openingPath.node); | ||
var args = []; | ||
@@ -89,3 +93,3 @@ var tagName = void 0; | ||
var attribs = path.node.attributes; | ||
var attribs = openingPath.node.attributes; | ||
@@ -98,3 +102,3 @@ if (attribs.length) { | ||
args.push(attribs); | ||
args.push.apply(args, [attribs].concat(path.node.children)); | ||
@@ -101,0 +105,0 @@ if (opts.post) { |
{ | ||
"name": "babel-helper-builder-react-jsx", | ||
"version": "7.0.0-beta.1", | ||
"version": "7.0.0-beta.2", | ||
"description": "Helper function to build react jsx", | ||
@@ -9,5 +9,5 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", | ||
"dependencies": { | ||
"babel-types": "7.0.0-beta.1", | ||
"babel-types": "7.0.0-beta.2", | ||
"esutils": "^2.0.0" | ||
} | ||
} |
@@ -16,2 +16,6 @@ # babel-helper-builder-react-jsx | ||
require("babel-helper-builder-react-jsx")({ | ||
filter: function (element: JSXElement) { | ||
// if returns false, the element isn't transformed | ||
}, | ||
pre: function (state: ElementState) { | ||
@@ -18,0 +22,0 @@ // called before building the element |
5643
123
29
+ Addedbabel-types@7.0.0-beta.2(transitive)
- Removedbabel-types@7.0.0-beta.1(transitive)
Updatedbabel-types@7.0.0-beta.2