Socket
Socket
Sign inDemoInstall

metro-transform-plugins

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-transform-plugins - npm Package Compare versions

Comparing version 0.76.2 to 0.76.3

4

package.json
{
"name": "metro-transform-plugins",
"version": "0.76.2",
"version": "0.76.3",
"description": "🚇 Transform plugins for Metro.",

@@ -27,3 +27,3 @@ "main": "src/index.js",

"@babel/types": "^7.20.0",
"metro": "0.76.2"
"metro": "0.76.3"
},

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

@@ -64,39 +64,45 @@ /**

};
const FunctionExpression = {
exit(path, state) {
const parentPath = path.parentPath;
const parentNode = parentPath?.node;
if (isVariableDeclarator(parentNode) && parentNode.id.name != null) {
const binding = parentPath?.scope.getBinding(parentNode.id.name);
if (binding && !binding.referenced) {
const FunctionExpression =
// $FlowFixMe[incompatible-type]
{
exit(path, state) {
const parentPath = path.parentPath;
const parentNode = parentPath?.node;
if (isVariableDeclarator(parentNode) && parentNode.id.name != null) {
const binding = parentPath?.scope.getBinding(parentNode.id.name);
if (binding && !binding.referenced) {
state.stripped = true;
parentPath?.remove();
}
}
},
};
const Conditional =
// $FlowFixMe[incompatible-type]
{
exit(path, state) {
const node = path.node;
const result = evaluate(path.get("test"));
if (result.confident) {
state.stripped = true;
parentPath?.remove();
if (result.value || node.alternate) {
// $FlowFixMe Flow error uncovered by typing Babel more strictly
path.replaceWith(result.value ? node.consequent : node.alternate);
} else if (!result.value) {
path.remove();
}
}
}
},
};
const Conditional = {
exit(path, state) {
const node = path.node;
const result = evaluate(path.get("test"));
if (result.confident) {
state.stripped = true;
if (result.value || node.alternate) {
// $FlowFixMe Flow error uncovered by typing Babel more strictly
path.replaceWith(result.value ? node.consequent : node.alternate);
} else if (!result.value) {
path.remove();
},
};
const Expression =
// $FlowFixMe[incompatible-type]
{
exit(path) {
const result = evaluate(path);
if (result.confident) {
path.replaceWith(t.valueToNode(result.value));
path.skip();
}
}
},
};
const Expression = {
exit(path) {
const result = evaluate(path);
if (result.confident) {
path.replaceWith(t.valueToNode(result.value));
path.skip();
}
},
};
},
};
const LogicalExpression = {

@@ -131,2 +137,3 @@ exit(path) {

ConditionalExpression: Conditional,
// $FlowFixMe[incompatible-call]
FunctionDeclaration,

@@ -154,2 +161,3 @@ FunctionExpression,

BinaryExpression: Expression,
// $FlowFixMe[incompatible-type]
LogicalExpression,

@@ -156,0 +164,0 @@ Program: {

Sorry, the diff of this file is not supported yet

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