metro-transform-plugins
Advanced tools
Comparing version 0.80.4 to 0.80.5
{ | ||
"name": "metro-transform-plugins", | ||
"version": "0.80.4", | ||
"version": "0.80.5", | ||
"description": "π Transform plugins for Metro.", | ||
@@ -29,3 +29,3 @@ "main": "src/index.js", | ||
"babel-plugin-tester": "^6.0.1", | ||
"metro": "0.80.4" | ||
"metro": "0.80.5" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
@@ -30,4 +30,11 @@ /** | ||
{ | ||
AssignmentExpression: unsafe, | ||
CallExpression: unsafe, | ||
AssignmentExpression: unsafe, | ||
/** | ||
* This will mark `foo?.()` as unsafe, so it is not replaced with `undefined` down the line. | ||
* | ||
* We saw this case in the wild, where the unary expression `void foo?.()` was replaced with `undefined` | ||
* resulting in the expression call being skipped. | ||
*/ | ||
OptionalCallExpression: unsafe, | ||
}, | ||
@@ -34,0 +41,0 @@ state |
@@ -66,6 +66,3 @@ /** | ||
isIdentifier(node, dev) && | ||
isGlobalOrFlowDeclared(scope.getBinding(dev.name)) && | ||
!isMemberExpression(parent) && | ||
// not { __DEV__: 'value'} | ||
(!isObjectProperty(parent) || parent.value === node); | ||
isGlobalOrFlowDeclared(scope.getBinding(dev.name)); | ||
function findProperty(objectExpression, key, fallback) { | ||
@@ -105,3 +102,3 @@ let value = null; | ||
visitor: { | ||
Identifier(path, state) { | ||
ReferencedIdentifier(path, state) { | ||
if (!state.opts.dev && isDev(path.node, path.parent, path.scope)) { | ||
@@ -108,0 +105,0 @@ path.replaceWith(t.booleanLiteral(state.opts.dev)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
83553
1357
1