babel-plugin-transform-react-jsx-source
Advanced tools
Comparing version 6.8.0 to 6.9.0
@@ -17,2 +17,18 @@ /*istanbul ignore next*/"use strict"; | ||
JSXOpeningElement: function JSXOpeningElement(path, state) { | ||
var id = t.jSXIdentifier(TRACE_ID); | ||
var location = path.container.openingElement.loc; | ||
if (!location) { | ||
// the element was generated and doesn't have location information | ||
return; | ||
} | ||
var attributes = path.container.openingElement.attributes; | ||
for (var i = 0; i < attributes.length; i++) { | ||
var name = attributes[i].name; | ||
if (name && name.name === TRACE_ID) { | ||
// The __source attibute already exists | ||
return; | ||
} | ||
} | ||
if (!state.fileNameIdentifier) { | ||
@@ -26,8 +42,4 @@ var fileName = state.file.log.filename !== "unknown" ? state.file.log.filename : null; | ||
var id = t.jSXIdentifier(TRACE_ID); | ||
var location = path.container.openingElement.loc; // undefined for generated elements | ||
if (location) { | ||
var trace = makeTrace(state.fileNameIdentifier, location.start.line); | ||
path.container.openingElement.attributes.push(t.jSXAttribute(id, t.jSXExpressionContainer(trace))); | ||
} | ||
var trace = makeTrace(state.fileNameIdentifier, location.start.line); | ||
attributes.push(t.jSXAttribute(id, t.jSXExpressionContainer(trace))); | ||
} | ||
@@ -34,0 +46,0 @@ }; |
{ | ||
"name": "babel-plugin-transform-react-jsx-source", | ||
"version": "6.8.0", | ||
"version": "6.9.0", | ||
"description": "Add a __source prop to all JSX Elements", | ||
@@ -12,3 +12,3 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source", | ||
"dependencies": { | ||
"babel-runtime": "^6.0.0", | ||
"babel-runtime": "^6.9.0", | ||
"babel-plugin-syntax-jsx": "^6.8.0" | ||
@@ -15,0 +15,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
3334
56
Updatedbabel-runtime@^6.9.0