babel-helper-builder-react-jsx
Advanced tools
Comparing version 6.9.0 to 6.18.0
@@ -1,2 +0,2 @@ | ||
/*istanbul ignore next*/"use strict"; | ||
"use strict"; | ||
@@ -12,3 +12,3 @@ exports.__esModule = true; | ||
visitor.JSXElement = { /*istanbul ignore next*/ | ||
visitor.JSXElement = { | ||
exit: function exit(path, file) { | ||
@@ -33,3 +33,3 @@ var callExpr = buildElementCall(path.get("openingElement"), file); | ||
return t.thisExpression(); | ||
} else if ( /*istanbul ignore next*/_esutils2.default.keyword.isIdentifierNameES6(node.name)) { | ||
} else if (_esutils2.default.keyword.isIdentifierNameES6(node.name)) { | ||
node.type = "Identifier"; | ||
@@ -76,3 +76,3 @@ } else { | ||
var tagName = /*istanbul ignore next*/void 0; | ||
var tagName = void 0; | ||
if (t.isIdentifier(tagExpr)) { | ||
@@ -110,9 +110,2 @@ tagName = tagExpr.name; | ||
/** | ||
* The logic for this is quite terse. It's because we need to | ||
* support spread elements. We loop over all attributes, | ||
* breaking on spreads, we then push a new object containg | ||
* all prior attributes to an array for later processing. | ||
*/ | ||
function buildOpeningElementAttributes(attribs, file) { | ||
@@ -122,2 +115,7 @@ var _props = []; | ||
var useBuiltIns = file.opts.useBuiltIns || false; | ||
if (typeof useBuiltIns !== "boolean") { | ||
throw new Error("transform-react-jsx currently only accepts a boolean option for useBuiltIns (defaults to false)"); | ||
} | ||
function pushProps() { | ||
@@ -143,6 +141,4 @@ if (!_props.length) return; | ||
if (objs.length === 1) { | ||
// only one object | ||
attribs = objs[0]; | ||
} else { | ||
// looks like we have multiple objects | ||
if (!t.isObjectExpression(objs[0])) { | ||
@@ -152,4 +148,5 @@ objs.unshift(t.objectExpression([])); | ||
// spread it | ||
attribs = t.callExpression(file.addHelper("extends"), objs); | ||
var helper = useBuiltIns ? t.memberExpression(t.identifier("Object"), t.identifier("assign")) : file.addHelper("extends"); | ||
attribs = t.callExpression(helper, objs); | ||
} | ||
@@ -161,13 +158,10 @@ | ||
var /*istanbul ignore next*/_esutils = require("esutils"); | ||
var _esutils = require("esutils"); | ||
/*istanbul ignore next*/ | ||
var _esutils2 = _interopRequireDefault(_esutils); | ||
var /*istanbul ignore next*/_babelTypes = require("babel-types"); | ||
var _babelTypes = require("babel-types"); | ||
/*istanbul ignore next*/ | ||
var t = _interopRequireWildcard(_babelTypes); | ||
/*istanbul ignore next*/ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -177,2 +171,2 @@ | ||
module.exports = exports["default"]; // function called with (state: ElementState) after building attribs | ||
module.exports = exports["default"]; |
{ | ||
"name": "babel-helper-builder-react-jsx", | ||
"version": "6.9.0", | ||
"description": "", | ||
"version": "6.18.0", | ||
"description": "Helper function to build react jsx", | ||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
"babel-runtime": "^6.9.0", | ||
"babel-types": "^6.9.0", | ||
"babel-types": "^6.18.0", | ||
"esutils": "^2.0.0", | ||
@@ -13,0 +13,0 @@ "lodash": "^4.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5482
121
Updatedbabel-types@^6.18.0