Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-expo

Package Overview
Dependencies
Maintainers
28
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-expo - npm Package Compare versions

Comparing version 12.0.0-preview.1 to 12.0.0-preview.2

20

build/use-dom-directive-plugin.js

@@ -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(`

6

package.json
{
"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"
}
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