@babel/plugin-transform-react-constant-elements
Advanced tools
Comparing version 8.0.0-alpha.12 to 8.0.0-alpha.13
@@ -6,4 +6,4 @@ import * as _babel_core from '@babel/core'; | ||
} | ||
declare const _default: (api: _babel_core.PluginAPI, options: Options, dirname: string) => _babel_core.PluginObject<object & _babel_core.PluginPass>; | ||
declare const _default: (api: _babel_core.PluginAPI, options: Options, dirname: string) => _babel_core.PluginObject<object & _babel_core.PluginPass<object>>; | ||
export { type Options, _default as default }; |
@@ -5,3 +5,3 @@ import { declare } from '@babel/helper-plugin-utils'; | ||
var index = declare((api, options) => { | ||
api.assertVersion("8.0.0-alpha.12"); | ||
api.assertVersion("8.0.0-alpha.13"); | ||
const { | ||
@@ -119,13 +119,18 @@ allowMutablePropsOnTags | ||
visitor: { | ||
JSXElement(path) { | ||
"JSXElement|JSXFragment"(path) { | ||
if (HOISTED.has(path.node)) return; | ||
const name = path.node.openingElement.name; | ||
let mutablePropsAllowed = false; | ||
if (allowMutablePropsOnTags != null) { | ||
let lastSegment = name; | ||
while (types.isJSXMemberExpression(lastSegment)) { | ||
lastSegment = lastSegment.property; | ||
let name; | ||
if (path.isJSXElement()) { | ||
name = path.node.openingElement.name; | ||
if (allowMutablePropsOnTags != null) { | ||
let lastSegment = name; | ||
while (types.isJSXMemberExpression(lastSegment)) { | ||
lastSegment = lastSegment.property; | ||
} | ||
const elementName = lastSegment.name; | ||
mutablePropsAllowed = allowMutablePropsOnTags.includes(elementName); | ||
} | ||
const elementName = lastSegment.name; | ||
mutablePropsAllowed = allowMutablePropsOnTags.includes(elementName); | ||
} else { | ||
name = path.node; | ||
} | ||
@@ -167,3 +172,3 @@ let jsxScope; | ||
`; | ||
if (path.parentPath.isJSXElement() || path.parentPath.isJSXAttribute()) { | ||
if (path.parentPath.isJSXElement() || path.parentPath.isJSXAttribute() || path.parentPath.isJSXFragment()) { | ||
replacement = types.jsxExpressionContainer(replacement); | ||
@@ -170,0 +175,0 @@ } |
{ | ||
"name": "@babel/plugin-transform-react-constant-elements", | ||
"version": "8.0.0-alpha.12", | ||
"version": "8.0.0-alpha.13", | ||
"description": "Treat React JSX elements as value types and hoist them to the highest scope", | ||
@@ -20,13 +20,13 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.12" | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.13" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^8.0.0-alpha.12" | ||
"@babel/core": "^8.0.0-alpha.13" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^8.0.0-alpha.12", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.12" | ||
"@babel/core": "^8.0.0-alpha.13", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.13" | ||
}, | ||
"engines": { | ||
"node": "^18.20.0 || ^20.10.0 || >=21.0.0" | ||
"node": "^18.20.0 || ^20.17.0 || >=22.8.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "author": "The Babel Team (https://babel.dev/team)", |
Sorry, the diff of this file is not supported yet
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
24932
6
184