babel-preset-expo
Advanced tools
Comparing version 12.0.0-preview.1 to 12.0.0-preview.2
@@ -20,2 +20,3 @@ "use strict"; | ||
const platform = api.caller((caller) => caller?.platform); | ||
const projectRoot = api.caller(common_1.getPossibleProjectRoot); | ||
return { | ||
@@ -63,2 +64,19 @@ name: 'expo-use-dom-directive', | ||
} | ||
// Assert that _layout routes cannot be used in DOM components. | ||
const fileBasename = (0, path_1.basename)(filePath); | ||
if (projectRoot && | ||
// Detecting if the file is in the router root would be extensive as it would cause a more complex | ||
// cache key for each file. Instead, let's just check if the file is in the project root and is not a node_module, | ||
// then we can assert that users should not use `_layout` or `+api` with "use dom". | ||
filePath.includes(projectRoot) && | ||
!filePath.match(/node_modules/)) { | ||
if (fileBasename.match(/^_layout\.[jt]sx?$/)) { | ||
throw path.buildCodeFrameError('Layout routes cannot be marked as DOM components because they cannot render native views.'); | ||
} | ||
else if ( | ||
// No API routes | ||
fileBasename.match(/\+api\.[jt]sx?$/)) { | ||
throw path.buildCodeFrameError('API routes cannot be marked as DOM components.'); | ||
} | ||
} | ||
const outputKey = url_1.default.pathToFileURL(filePath).href; | ||
@@ -86,3 +104,3 @@ const proxyModule = [ | ||
// Add the basename to improve the Safari debug preview option. | ||
`const source = { uri: new URL("/_expo/@dom/${(0, path_1.basename)(filePath)}?file=" + ${JSON.stringify(outputKey)}, require("react-native/Libraries/Core/Devtools/getDevServer")().url).toString() };`); | ||
`const source = { uri: new URL("/_expo/@dom/${fileBasename}?file=" + ${JSON.stringify(outputKey)}, require("react-native/Libraries/Core/Devtools/getDevServer")().url).toString() };`); | ||
} | ||
@@ -89,0 +107,0 @@ proxyModule.push(` |
{ | ||
"name": "babel-preset-expo", | ||
"version": "12.0.0-preview.1", | ||
"version": "12.0.0-preview.2", | ||
"description": "The Babel preset for Expo projects", | ||
@@ -50,3 +50,3 @@ "main": "build/index.js", | ||
"@babel/preset-typescript": "^7.23.0", | ||
"@react-native/babel-preset": "0.76.0", | ||
"@react-native/babel-preset": "0.76.1", | ||
"babel-plugin-react-native-web": "~0.19.13", | ||
@@ -74,3 +74,3 @@ "react-refresh": "^0.14.2" | ||
}, | ||
"gitHead": "0a07b965c4bef67e7718355a0dc770d524ad3cee" | ||
"gitHead": "71f25de1d8fe12c0b91242fd6e882ccfb4698e17" | ||
} |
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
118335
2255
+ Added@react-native/babel-plugin-codegen@0.76.1(transitive)
+ Added@react-native/babel-preset@0.76.1(transitive)
+ Added@react-native/codegen@0.76.1(transitive)
- Removed@react-native/babel-plugin-codegen@0.76.0(transitive)
- Removed@react-native/babel-preset@0.76.0(transitive)
- Removed@react-native/codegen@0.76.0(transitive)