babel-preset-expo
Advanced tools
Comparing version 11.1.0-canary-20240628-1ba8152 to 11.1.0-canary-20240719-83ee47b
@@ -76,3 +76,3 @@ "use strict"; | ||
} | ||
else if (!['InterfaceDeclaration', 'TypeAlias'].includes(exportPath.node.declaration.type)) { | ||
else if (!['InterfaceDeclaration', 'TSTypeAliasDeclaration', 'TypeAlias'].includes(exportPath.node.declaration.type)) { | ||
// TODO: What is this type? | ||
@@ -79,0 +79,0 @@ console.warn('[babel-preset-expo] Unsupported export specifier for "use client":', exportPath.node.declaration.type); |
@@ -10,4 +10,4 @@ "use strict"; | ||
const { types: t } = api; | ||
const isReactServer = api.caller(common_1.getIsReactServer); | ||
const forbiddenPackages = isReactServer | ||
const isAnyServerEnvironment = api.caller(common_1.getIsReactServer) || api.caller(common_1.getIsServer); | ||
const forbiddenPackages = isAnyServerEnvironment | ||
? FORBIDDEN_REACT_SERVER_IMPORTS | ||
@@ -18,3 +18,3 @@ : FORBIDDEN_CLIENT_IMPORTS; | ||
if (source === forbiddenImport) { | ||
if (isReactServer) { | ||
if (isAnyServerEnvironment) { | ||
throw path.buildCodeFrameError(`Importing '${forbiddenImport}' module is not allowed in a React server bundle. Add the "use client" directive to this file or one of the parent modules to allow importing this module.`); | ||
@@ -21,0 +21,0 @@ } |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Copyright © 2024 650 Industries. | ||
*/ | ||
import { ConfigAPI, types } from '@babel/core'; | ||
@@ -2,0 +5,0 @@ /** |
@@ -7,2 +7,5 @@ "use strict"; | ||
exports.expoRouterBabelPlugin = void 0; | ||
/** | ||
* Copyright © 2024 650 Industries. | ||
*/ | ||
const core_1 = require("@babel/core"); | ||
@@ -9,0 +12,0 @@ const path_1 = __importDefault(require("path")); |
@@ -92,7 +92,9 @@ "use strict"; | ||
} | ||
else if (!isServerEnv) { | ||
// This is added back on hermes to ensure the react-jsx-dev plugin (`@babel/preset-react`) works as expected when | ||
// JSX is used in a function body. This is technically not required in production, but we | ||
// should retain the same behavior since it's hard to debug the differences. | ||
extraPlugins.push(require('@babel/plugin-transform-parameters')); | ||
else { | ||
if (platform !== 'web' && !isServerEnv) { | ||
// This is added back on hermes to ensure the react-jsx-dev plugin (`@babel/preset-react`) works as expected when | ||
// JSX is used in a function body. This is technically not required in production, but we | ||
// should retain the same behavior since it's hard to debug the differences. | ||
extraPlugins.push(require('@babel/plugin-transform-parameters')); | ||
} | ||
} | ||
@@ -102,2 +104,3 @@ const inlines = { | ||
// 'typeof document': isServerEnv ? 'undefined' : 'object', | ||
'process.env.EXPO_SERVER': !!isServerEnv, | ||
}; | ||
@@ -167,2 +170,5 @@ // `typeof window` is left in place for native + client environments. | ||
} | ||
if (platformOptions.disableImportExportTransform) { | ||
extraPlugins.push([require('./detect-dynamic-exports').detectDynamicExports]); | ||
} | ||
// Use the simpler babel preset for web and server environments (both web and native SSR). | ||
@@ -169,0 +175,0 @@ const isModernEngine = platform === 'web' || isServerEnv; |
{ | ||
"name": "babel-preset-expo", | ||
"version": "11.1.0-canary-20240628-1ba8152", | ||
"version": "11.1.0-canary-20240719-83ee47b", | ||
"description": "The Babel preset for Expo projects", | ||
@@ -58,6 +58,6 @@ "main": "build/index.js", | ||
"@babel/core": "^7.20.0", | ||
"expo-module-scripts": "3.6.0-canary-20240628-1ba8152", | ||
"expo-module-scripts": "3.6.0-canary-20240719-83ee47b", | ||
"jest": "^29.2.1" | ||
}, | ||
"gitHead": "1ba815237ed606c5ee8488f68e49773fc9735cc3" | ||
"gitHead": "83ee47b5c89c7f1b1a5101189580eaf3555f5962" | ||
} |
82194
30
1542