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

@babel/plugin-transform-react-jsx

Package Overview
Dependencies
Maintainers
5
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-react-jsx - npm Package Compare versions

Comparing version 7.0.0-beta.46 to 7.0.0-beta.47

66

lib/index.js

@@ -9,3 +9,3 @@ "use strict";

function _helperPluginUtils() {
var data = require("@babel/helper-plugin-utils");
const data = require("@babel/helper-plugin-utils");

@@ -20,3 +20,3 @@ _helperPluginUtils = function _helperPluginUtils() {

function _pluginSyntaxJsx() {
var data = _interopRequireDefault(require("@babel/plugin-syntax-jsx"));
const data = _interopRequireDefault(require("@babel/plugin-syntax-jsx"));

@@ -31,3 +31,3 @@ _pluginSyntaxJsx = function _pluginSyntaxJsx() {

function _helperBuilderReactJsx() {
var data = _interopRequireDefault(require("@babel/helper-builder-react-jsx"));
const data = _interopRequireDefault(require("@babel/helper-builder-react-jsx"));

@@ -42,3 +42,3 @@ _helperBuilderReactJsx = function _helperBuilderReactJsx() {

function _core() {
var data = require("@babel/core");
const data = require("@babel/core");

@@ -54,24 +54,18 @@ _core = function _core() {

var _default = (0, _helperPluginUtils().declare)(function (api, options) {
var _default = (0, _helperPluginUtils().declare)((api, options) => {
api.assertVersion(7);
var THROW_IF_NAMESPACE = options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace;
var PRAGMA_DEFAULT = options.pragma || "React.createElement";
var PRAGMA_FRAG_DEFAULT = options.pragmaFrag || "React.Fragment";
var JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
var JSX_FRAG_ANNOTATION_REGEX = /\*?\s*@jsxFrag\s+([^\s]+)/;
const THROW_IF_NAMESPACE = options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace;
const PRAGMA_DEFAULT = options.pragma || "React.createElement";
const PRAGMA_FRAG_DEFAULT = options.pragmaFrag || "React.Fragment";
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
const JSX_FRAG_ANNOTATION_REGEX = /\*?\s*@jsxFrag\s+([^\s]+)/;
var createIdentifierParser = function createIdentifierParser(id) {
return function () {
return id.split(".").map(function (name) {
return _core().types.identifier(name);
}).reduce(function (object, property) {
return _core().types.memberExpression(object, property);
});
};
const createIdentifierParser = id => () => {
return id.split(".").map(name => _core().types.identifier(name)).reduce((object, property) => _core().types.memberExpression(object, property));
};
var visitor = (0, _helperBuilderReactJsx().default)({
pre: function pre(state) {
var tagName = state.tagName;
var args = state.args;
const visitor = (0, _helperBuilderReactJsx().default)({
pre(state) {
const tagName = state.tagName;
const args = state.args;

@@ -84,19 +78,21 @@ if (_core().types.react.isCompatTag(tagName)) {

},
post: function post(state, pass) {
post(state, pass) {
state.callee = pass.get("jsxIdentifier")();
},
throwIfNamespace: THROW_IF_NAMESPACE
});
visitor.Program = {
enter: function enter(path, state) {
var file = state.file;
var pragma = PRAGMA_DEFAULT;
var pragmaFrag = PRAGMA_FRAG_DEFAULT;
var pragmaSet = !!options.pragma;
var pragmaFragSet = !!options.pragmaFrag;
enter(path, state) {
const file = state.file;
let pragma = PRAGMA_DEFAULT;
let pragmaFrag = PRAGMA_FRAG_DEFAULT;
let pragmaSet = !!options.pragma;
let pragmaFragSet = !!options.pragmaFrag;
var _arr = file.ast.comments;
for (var _i = 0; _i < _arr.length; _i++) {
var comment = _arr[_i];
var jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value);
const comment = _arr[_i];
const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value);

@@ -108,3 +104,3 @@ if (jsxMatches) {

var jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value);
const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value);

@@ -123,3 +119,4 @@ if (jsxFragMatches) {

},
exit: function exit(path, state) {
exit(path, state) {
if (state.get("pragmaSet") && state.get("usedFragment") && !state.get("pragmaFragSet")) {

@@ -129,2 +126,3 @@ throw new Error("transform-react-jsx: pragma has been set but " + "pragmafrag has not been set");

}
};

@@ -140,3 +138,3 @@

inherits: _pluginSyntaxJsx().default,
visitor: visitor
visitor
};

@@ -143,0 +141,0 @@ });

{
"name": "@babel/plugin-transform-react-jsx",
"version": "7.0.0-beta.46",
"version": "7.0.0-beta.47",
"description": "Turn JSX into React function calls",

@@ -12,13 +12,13 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx",

"dependencies": {
"@babel/helper-builder-react-jsx": "7.0.0-beta.46",
"@babel/helper-plugin-utils": "7.0.0-beta.46",
"@babel/plugin-syntax-jsx": "7.0.0-beta.46"
"@babel/helper-builder-react-jsx": "7.0.0-beta.47",
"@babel/helper-plugin-utils": "7.0.0-beta.47",
"@babel/plugin-syntax-jsx": "7.0.0-beta.47"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.46"
"@babel/core": "7.0.0-beta.47"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.46",
"@babel/helper-plugin-test-runner": "7.0.0-beta.46"
"@babel/core": "7.0.0-beta.47",
"@babel/helper-plugin-test-runner": "7.0.0-beta.47"
}
}
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