@babel/plugin-transform-react-pure-annotations
Advanced tools
Comparing version 7.21.4-esm.3 to 7.21.4-esm.4
@@ -1,12 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure"); | ||
var _core = require("@babel/core"); | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import annotateAsPure from "@babel/helper-annotate-as-pure"; | ||
import { types as t } from "@babel/core"; | ||
const PURE_CALLS = [["react", new Set(["cloneElement", "createContext", "createElement", "createFactory", "createRef", "forwardRef", "isValidElement", "memo", "lazy"])], ["react-dom", new Set(["createPortal"])]]; | ||
var _default = (0, _helperPluginUtils.declare)(api => { | ||
export default declare(api => { | ||
api.assertVersion(7); | ||
@@ -18,3 +12,3 @@ return { | ||
if (isReactCall(path)) { | ||
(0, _helperAnnotateAsPure.default)(path); | ||
annotateAsPure(path); | ||
} | ||
@@ -25,3 +19,2 @@ } | ||
}); | ||
exports.default = _default; | ||
function isReactCall(path) { | ||
@@ -41,3 +34,3 @@ const calleePath = path.get("callee"); | ||
const callee = calleePath.node; | ||
if (!callee.computed && _core.types.isIdentifier(callee.property)) { | ||
if (!callee.computed && t.isIdentifier(callee.property)) { | ||
const propertyName = callee.property.name; | ||
@@ -44,0 +37,0 @@ for (const [module, methods] of PURE_CALLS) { |
{ | ||
"name": "@babel/plugin-transform-react-pure-annotations", | ||
"version": "7.21.4-esm.3", | ||
"version": "7.21.4-esm.4", | ||
"description": "Mark top-level React method calls as pure for tree shaking", | ||
@@ -19,4 +19,4 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-annotate-as-pure": "7.21.4-esm.3", | ||
"@babel/helper-plugin-utils": "7.21.4-esm.3" | ||
"@babel/helper-annotate-as-pure": "7.21.4-esm.4", | ||
"@babel/helper-plugin-utils": "7.21.4-esm.4" | ||
}, | ||
@@ -27,4 +27,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.21.4-esm.3", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.3" | ||
"@babel/core": "7.21.4-esm.4", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.4" | ||
}, | ||
@@ -31,0 +31,0 @@ "engines": { |
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
6
8048
42
+ Added@babel/helper-annotate-as-pure@7.21.4-esm.4(transitive)
+ Added@babel/helper-plugin-utils@7.21.4-esm.4(transitive)
+ Added@babel/helper-string-parser@7.21.4-esm.4(transitive)
+ Added@babel/helper-validator-identifier@7.21.4-esm.4(transitive)
+ Added@babel/types@7.21.4-esm.4(transitive)
- Removed@babel/helper-annotate-as-pure@7.21.4-esm.3(transitive)
- Removed@babel/helper-plugin-utils@7.21.4-esm.3(transitive)
- Removed@babel/helper-string-parser@7.21.4-esm.3(transitive)
- Removed@babel/helper-validator-identifier@7.21.4-esm.3(transitive)
- Removed@babel/types@7.21.4-esm.3(transitive)