metro-transform-plugins
Advanced tools
Comparing version 0.76.8 to 0.76.9
{ | ||
"name": "metro-transform-plugins", | ||
"version": "0.76.8", | ||
"version": "0.76.9", | ||
"description": "🚇 Transform plugins for Metro.", | ||
@@ -27,3 +27,3 @@ "main": "src/index.js", | ||
"@babel/types": "^7.20.0", | ||
"metro": "0.76.8" | ||
"metro": "0.76.9" | ||
}, | ||
@@ -30,0 +30,0 @@ "engines": { |
@@ -16,3 +16,2 @@ /** | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
function constantFoldingPlugin(context) { | ||
@@ -31,4 +30,11 @@ const t = context.types; | ||
{ | ||
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, | ||
}, | ||
@@ -35,0 +41,0 @@ state |
@@ -16,3 +16,2 @@ /** | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const template = require("@babel/template").default; | ||
@@ -19,0 +18,0 @@ const nullthrows = require("nullthrows"); |
@@ -16,3 +16,2 @@ /** | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const createInlinePlatformChecks = require("./utils/createInlinePlatformChecks"); | ||
@@ -63,6 +62,3 @@ const env = { | ||
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) { | ||
@@ -102,3 +98,3 @@ let value = null; | ||
visitor: { | ||
Identifier(path, state) { | ||
ReferencedIdentifier(path, state) { | ||
if (!state.opts.dev && isDev(path.node, path.parent, path.scope)) { | ||
@@ -105,0 +101,0 @@ path.replaceWith(t.booleanLiteral(state.opts.dev)); |
@@ -16,3 +16,2 @@ /** | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
const importMap = new Map([["ReactNative", "react-native"]]); | ||
@@ -19,0 +18,0 @@ function createInlinePlatformChecks(t, requireName = "require") { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74794
1103