Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-react-jsx-source

Package Overview
Dependencies
Maintainers
6
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-react-jsx-source - npm Package Compare versions

Comparing version 6.9.0 to 6.22.0

27

lib/index.js

@@ -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"];

6

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc