babel-plugin-transform-react-jsx-source
Advanced tools
Comparing version 6.9.0 to 6.22.0
@@ -1,7 +0,7 @@ | ||
/*istanbul ignore next*/"use strict"; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = function ( /*istanbul ignore next*/_ref) { | ||
/*istanbul ignore next*/var t = _ref.types; | ||
exports.default = function (_ref) { | ||
var t = _ref.types; | ||
@@ -15,3 +15,3 @@ function makeTrace(fileNameIdentifier, lineNumber) { | ||
var visitor = { /*istanbul ignore next*/ | ||
var visitor = { | ||
JSXOpeningElement: function JSXOpeningElement(path, state) { | ||
@@ -21,3 +21,2 @@ var id = t.jSXIdentifier(TRACE_ID); | ||
if (!location) { | ||
// the element was generated and doesn't have location information | ||
return; | ||
@@ -30,3 +29,2 @@ } | ||
if (name && name.name === TRACE_ID) { | ||
// The __source attibute already exists | ||
return; | ||
@@ -54,20 +52,5 @@ } | ||
/** | ||
* This adds {fileName, lineNumber} annotations to React component definitions | ||
* and to jsx tag literals. | ||
* | ||
* | ||
* == JSX Literals == | ||
* | ||
* <sometag /> | ||
* | ||
* becomes: | ||
* | ||
* var __jsxFileName = 'this/file.js'; | ||
* <sometag __source={{fileName: __jsxFileName, lineNumber: 10}}/> | ||
*/ | ||
var TRACE_ID = "__source"; | ||
var FILE_NAME_VAR = "_jsxFileName"; | ||
/*istanbul ignore next*/module.exports = exports["default"]; | ||
module.exports = exports["default"]; |
{ | ||
"name": "babel-plugin-transform-react-jsx-source", | ||
"version": "6.9.0", | ||
"version": "6.22.0", | ||
"description": "Add a __source prop to all JSX Elements", | ||
@@ -12,8 +12,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source", | ||
"dependencies": { | ||
"babel-runtime": "^6.9.0", | ||
"babel-runtime": "^6.22.0", | ||
"babel-plugin-syntax-jsx": "^6.8.0" | ||
}, | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "^6.8.0" | ||
"babel-helper-plugin-test-runner": "^6.22.0" | ||
} | ||
} |
# babel-plugin-transform-react-jsx-source | ||
Adds source file and line number to JSX elements. | ||
> Adds source file and line number to JSX elements. | ||
## Example | ||
###In | ||
**In** | ||
@@ -12,6 +12,7 @@ ``` | ||
``` | ||
###Out | ||
**Out** | ||
``` | ||
<sometag __source={{fileName: 'this/file.js', lineNumber: 10}}/> | ||
<sometag __source={ { fileName: 'this/file.js', lineNumber: 10 } } /> | ||
``` | ||
@@ -22,3 +23,3 @@ | ||
```sh | ||
$ npm install babel-plugin-transform-react-jsx-source | ||
npm install --save-dev babel-plugin-transform-react-jsx-source | ||
``` | ||
@@ -41,3 +42,3 @@ | ||
```sh | ||
$ babel --plugins transform-react-jsx-source script.js | ||
babel --plugins transform-react-jsx-source script.js | ||
``` | ||
@@ -44,0 +45,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
50
2834
40
Updatedbabel-runtime@^6.22.0