babel-preset-expo 55.0.21 → 55.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/common.js +12 -4
  2. package/package.json +3 -3
package/build/common.js CHANGED
@@ -149,11 +149,19 @@ function getBabelRuntimeVersion(caller) {
149
149
  function getExpoRouterAbsoluteAppRoot(caller) {
150
150
  assertExpoBabelCaller(caller);
151
151
  const rootModuleId = caller?.routerRoot ?? './app';
152
- if (node_path_1.default.isAbsolute(rootModuleId)) {
153
- return rootModuleId;
152
+ const projectRoot = getPossibleProjectRoot(caller);
153
+ const resolved = node_path_1.default.isAbsolute(rootModuleId)
154
+ ? rootModuleId
155
+ : node_path_1.default.join(projectRoot || '/', rootModuleId);
156
+ // Silently fall back to the default if the configured router root escapes the project root, as a safety net
157
+ if (projectRoot && !isPathInside(resolved, projectRoot)) {
158
+ return node_path_1.default.join(projectRoot, 'app');
154
159
  }
155
- const projectRoot = getPossibleProjectRoot(caller) || '/';
156
- return node_path_1.default.join(projectRoot, rootModuleId);
160
+ return resolved;
161
+ }
162
+ function isPathInside(child, parent) {
163
+ const relative = node_path_1.default.relative(parent, child);
164
+ return !!relative && !relative.startsWith('..') && !node_path_1.default.isAbsolute(relative);
157
165
  }
158
166
  function getInlineEnvVarsEnabled(caller) {
159
167
  assertExpoBabelCaller(caller);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-expo",
3
- "version": "55.0.21",
3
+ "version": "55.0.22",
4
4
  "description": "The Babel preset for Expo projects",
5
5
  "main": "build/index.js",
6
6
  "files": [
@@ -44,7 +44,7 @@
44
44
  "@babel/runtime": "^7.20.0",
45
45
  "react-refresh": ">=0.14.0 <1.0.0",
46
46
  "expo": "*",
47
- "expo-widgets": "^55.0.17"
47
+ "expo-widgets": "^55.0.19"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@babel/runtime": {
@@ -90,5 +90,5 @@
90
90
  "jest": "^29.2.1",
91
91
  "react-refresh": "^0.14.2"
92
92
  },
93
- "gitHead": "7c081282cf88968f81732feb67a71840e769a40f"
93
+ "gitHead": "fcb091766242d53248cd3c5949965961dbc5ec1d"
94
94
  }