Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@babel/helper-builder-react-jsx

Package Overview
Dependencies
5
Maintainers
4
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.0-alpha.2 to 8.0.0-alpha.3

55

lib/index.js

@@ -1,4 +0,2 @@

import * as _t from '@babel/types';
import annotateAsPure from '@babel/helper-annotate-as-pure';
import * as _t from "@babel/types";
const {

@@ -28,3 +26,4 @@ booleanLiteral,

} = _t;
function index (opts) {
import annotateAsPure from "@babel/helper-annotate-as-pure";
export default function (opts) {
const visitor = {};

@@ -140,2 +139,49 @@ visitor.JSXNamespacedName = function (path) {

}
function pushProps(_props, objs) {
if (!_props.length) return _props;
objs.push(objectExpression(_props));
return [];
}
function buildOpeningElementAttributes(attribs, pass) {
let _props = [];
const objs = [];
const {
useSpread = false
} = pass.opts;
if (typeof useSpread !== "boolean") {
throw new Error("transform-react-jsx currently only accepts a boolean option for " + "useSpread (defaults to false)");
}
const useBuiltIns = pass.opts.useBuiltIns || false;
if (typeof useBuiltIns !== "boolean") {
throw new Error("transform-react-jsx currently only accepts a boolean option for " + "useBuiltIns (defaults to false)");
}
if (useSpread && useBuiltIns) {
throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread " + "but not both");
}
if (useSpread) {
const props = attribs.map(convertAttribute);
return objectExpression(props);
}
while (attribs.length) {
const prop = attribs.shift();
if (isJSXSpreadAttribute(prop)) {
_props = pushProps(_props, objs);
objs.push(prop.argument);
} else {
_props.push(convertAttribute(prop));
}
}
pushProps(_props, objs);
let convertedAttribs;
if (objs.length === 1) {
convertedAttribs = objs[0];
} else {
if (!isObjectExpression(objs[0])) {
objs.unshift(objectExpression([]));
}
const helper = useBuiltIns ? memberExpression(identifier("Object"), identifier("assign")) : pass.addHelper("extends");
convertedAttribs = callExpression(helper, objs);
}
return convertedAttribs;
}
function buildFragmentCall(path, pass) {

@@ -167,3 +213,2 @@ if (opts.filter && !opts.filter(path.node, pass)) return;

export { index as default };
//# sourceMappingURL=index.js.map

10

package.json
{
"name": "@babel/helper-builder-react-jsx",
"version": "8.0.0-alpha.2",
"version": "8.0.0-alpha.3",
"description": "Helper function to build react jsx",

@@ -17,8 +17,8 @@ "repository": {

"dependencies": {
"@babel/helper-annotate-as-pure": "^8.0.0-alpha.2",
"@babel/types": "^8.0.0-alpha.2"
"@babel/helper-annotate-as-pure": "^8.0.0-alpha.3",
"@babel/types": "^8.0.0-alpha.3"
},
"devDependencies": {
"@babel/core": "^8.0.0-alpha.2",
"@babel/traverse": "^8.0.0-alpha.2"
"@babel/core": "^8.0.0-alpha.3",
"@babel/traverse": "^8.0.0-alpha.3"
},

@@ -25,0 +25,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc