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

@babel/helper-builder-react-jsx

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-builder-react-jsx - npm Package Compare versions

Comparing version 7.0.0-beta.5 to 7.0.0-beta.31

40

lib/index.js

@@ -32,2 +32,15 @@ "use strict";

};
visitor.JSXFragment = {
exit: function exit(path, file) {
if (opts.compat) {
throw path.buildCodeFrameError("Fragment tags are only supported in React 16 and up.");
}
var callExpr = buildFragmentCall(path, file);
if (callExpr) {
path.replaceWith(t.inherits(callExpr, path.node));
}
}
};
return visitor;

@@ -163,2 +176,29 @@

}
function buildFragmentCall(path, file) {
if (opts.filter && !opts.filter(path.node, file)) return;
var openingPath = path.get("openingElement");
openingPath.parent.children = t.react.buildChildren(openingPath.parent);
var args = [];
var tagName = null;
var tagExpr = file.get("jsxFragIdentifier")();
var state = {
tagExpr: tagExpr,
tagName: tagName,
args: args
};
if (opts.pre) {
opts.pre(state, file);
}
args.push.apply(args, [t.nullLiteral()].concat(path.node.children));
if (opts.post) {
opts.post(state, file);
}
file.set("usedFragment", true);
return state.call || t.callExpression(state.callee, args);
}
}

4

package.json
{
"name": "@babel/helper-builder-react-jsx",
"version": "7.0.0-beta.5",
"version": "7.0.0-beta.31",
"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.5",
"@babel/types": "7.0.0-beta.31",
"esutils": "^2.0.0"
}
}

@@ -11,4 +11,2 @@ # @babel/helper-builder-react-jsx

call?: Object; // optional call property that can be set to override the call expression returned
pre?: Function; // function called with (state: ElementState) before building attribs
post?: Function; // function called with (state: ElementState) after building attribs
};

@@ -22,9 +20,11 @@

pre: function (state: ElementState) {
// called before building the element
// function called with (state: ElementState) before building attribs
},
post: function (state: ElementState) {
// called after building the element
}
// function called with (state: ElementState) after building attribs
},
compat?: boolean // true if React is in compat mode
});
```
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