@babel/plugin-transform-react-constant-elements
Advanced tools
Comparing version 7.21.4-esm.4 to 7.22.0
@@ -1,4 +0,10 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import { types as t, template } from "@babel/core"; | ||
export default declare((api, options) => { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _core = require("@babel/core"); | ||
var _default = (0, _helperPluginUtils.declare)((api, options) => { | ||
api.assertVersion(7); | ||
@@ -13,9 +19,9 @@ const { | ||
function declares(node, scope) { | ||
if (t.isJSXIdentifier(node, { | ||
if (_core.types.isJSXIdentifier(node, { | ||
name: "this" | ||
}) || t.isJSXIdentifier(node, { | ||
}) || _core.types.isJSXIdentifier(node, { | ||
name: "arguments" | ||
}) || t.isJSXIdentifier(node, { | ||
}) || _core.types.isJSXIdentifier(node, { | ||
name: "super" | ||
}) || t.isJSXIdentifier(node, { | ||
}) || _core.types.isJSXIdentifier(node, { | ||
name: "new" | ||
@@ -61,2 +67,3 @@ })) { | ||
enter(path, state) { | ||
var _expressionResult$deo; | ||
const stop = () => { | ||
@@ -109,3 +116,3 @@ state.isImmutable = false; | ||
} | ||
} else if (t.isIdentifier(expressionResult.deopt)) { | ||
} else if ((_expressionResult$deo = expressionResult.deopt) != null && _expressionResult$deo.isIdentifier()) { | ||
return; | ||
@@ -127,3 +134,3 @@ } | ||
let lastSegment = name; | ||
while (t.isJSXMemberExpression(lastSegment)) { | ||
while (_core.types.isJSXMemberExpression(lastSegment)) { | ||
lastSegment = lastSegment.property; | ||
@@ -163,10 +170,10 @@ } | ||
targetScope.push({ | ||
id: t.identifier(id) | ||
id: _core.types.identifier(id) | ||
}); | ||
HOISTED.set(path.node, targetScope); | ||
let replacement = template.expression.ast` | ||
${t.identifier(id)} || (${t.identifier(id)} = ${path.node}) | ||
let replacement = _core.template.expression.ast` | ||
${_core.types.identifier(id)} || (${_core.types.identifier(id)} = ${path.node}) | ||
`; | ||
if (path.parentPath.isJSXElement() || path.parentPath.isJSXAttribute()) { | ||
replacement = t.jsxExpressionContainer(replacement); | ||
replacement = _core.types.jsxExpressionContainer(replacement); | ||
} | ||
@@ -178,3 +185,4 @@ path.replaceWith(replacement); | ||
}); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
{ "type": "module" } | ||
{ "type": "script" } |
{ | ||
"name": "@babel/plugin-transform-react-constant-elements", | ||
"version": "7.21.4-esm.4", | ||
"version": "7.22.0", | ||
"description": "Treat React JSX elements as value types and hoist them to the highest scope", | ||
@@ -20,10 +20,10 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.21.4-esm.4" | ||
"@babel/helper-plugin-utils": "^7.21.5" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.0.0-0 || ^7.21.4-esm.2" | ||
"@babel/core": "^7.0.0-0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.21.4-esm.4", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.4" | ||
"@babel/core": "^7.22.0", | ||
"@babel/helper-plugin-test-runner": "^7.18.6" | ||
}, | ||
@@ -34,3 +34,3 @@ "engines": { | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
"type": "module" | ||
"type": "commonjs" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23443
180
0
No
+ Added@babel/helper-plugin-utils@7.24.8(transitive)
- Removed@babel/helper-plugin-utils@7.21.4-esm.4(transitive)