chore(expo-dev-menu): Drop support for configuring SDK 44 and below with Prebuild. (#24504)# Why Config plugins are versioned with versioned packages, meaning they shouldn't need to be SDK vers
chore(expo-dev-menu): Drop support for configuring SDK 44 and below with Prebuild. (#24504)# Why Config plugins are versioned with versioned packages, meaning they shouldn't need to be SDK versioned at all. Even if they were, SDK 44 is pretty far back. On top of that, these checks don't support UNVERSIONED. <!-- Please describe the motivation for this PR, and link to relevant GitHub issues, forums posts, or feature requests. --> # How <!-- How did you build this feature or fix this bug and why? --> # Test Plan <!-- Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction. --> # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Expo Bot <[email protected]>
show more ...
feat(metro-config): support any entry file in development builds that don't use Expo dev client (#21643)# Why - React Native enforces that apps must use `index.js` as the entry file, this is hi
feat(metro-config): support any entry file in development builds that don't use Expo dev client (#21643)# Why - React Native enforces that apps must use `index.js` as the entry file, this is highly inconvenient and forces us to change the app entry on `expo prebuild` (cite: [prebuild side effects](https://github.com/expo/expo/blob/4d2795e/docs/pages/workflow/prebuild.mdx#side-effects) (`index.js` and `package.json` `scripts`)). - In #14964 I added support for production Android apps to use any entry point. - In #18381 I added the same support to iOS apps in production. - Development builds using `expo-dev-client` and Expo Go both use a manifest which support arbitrary entry points. - This just leaves development builds that don't have Expo code-loading support (e.g. no manifest/index.html where the script can be changed dynamically). # How - This PR introduces the virtual entry file `.expo/.virtual-metro-entry` which should never physically exist. When this endpoint is pinged, Expo CLI will rewrite the the URL to the correct entry point based on the project configuration. This enables us to fully drop the prebuild side-effect as no case will require an `index.js` (`index.bundle`) as the entry file. - The rewrite means Metro will never support a physical file located at `.expo/.virtual-metro-entry.js` as this will always be ignored. We could support forwarding the request if this file exists but we'll probably go the other way and assert if this file exists to mitigate possible confusion. - The name `.expo/.virtual-metro-entry.js` was chosen to be clear and long enough that users wouldn't try to actually create this file. - I originally tried using a middleware to perform the redirect but this wouldn't work with the HMR server which emulates pinging the endpoint in-memory. Because of this, I went with the metro `server.rewriteRequestUrl` function. > This feature is implemented in Expo's Metro configuration, meaning it should apply to `npx react-native start` (but this is untested and not officially supported). ## New Setup Instructions for non-prebuild users Non-prebuild projects will need to modify their `AppDelegate.mm` as follows: ```diff - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } ``` And their `android/app/src/main/java/***/MainApplication.java`: ```diff @Override protected String getJSMainModuleName() { - return "index"; + return ".expo/.virtual-metro-entry"; } ``` This is of course in addition to the `android/app/build.gradle`: ```groovy entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim()) ``` And iOS production change: ``` shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" $PROJECT_ROOT ios relative | tail -n 1)\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n\n"; ``` # Test Plan ### Continuous(-ish) - Updated the templates to use this new format. ### Quick test - Start the dev server and ping the entry URL directly: - `http://localhost:8081/.expo/.virtual-metro-entry.bundle?platform=web&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true` - The redirected URL should show in the `sourceURL` at the end of the file. ### E2E - Prebuild, then apply the native changes in a local projects - Use the following `metro.config.js` (you don't need to use the latest Expo CLI for this to work): ```js // Learn more https://docs.expo.io/guides/customizing-metro const { getDefaultConfig } = require("../../expo/packages/@expo/metro-config"); // const { getDefaultConfig } = require('expo/metro-config'); module.exports = getDefaultConfig(__dirname); ``` - `npx expo run:ios` and `npx expo run:android` should point to `index.bundle` - Changing the `main` field in the package.json or deleting `index.js` should continue to work when you reload the app. # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Expo Bot <[email protected]>
[2/3] upgrade react native 0.71 (#20832)# Why follow up #20799 for react-native 0.71 upgrade. this pr aims for jest upgrade and fix all broken tests. close ENG-7192 # How - upgrade packag
[2/3] upgrade react native 0.71 (#20832)# Why follow up #20799 for react-native 0.71 upgrade. this pr aims for jest upgrade and fix all broken tests. close ENG-7192 # How - upgrade packages - `jest: ^26.0.24 -> ^29.2.1` - `jest-watch-typeahead: 0.6.4 -> 2.2.1` - `@types/jest: ^26.0.24 -> ^29.2.1` - `babel-jest: ^26.6.3 -> ^29.2.1` - `@jest/create-cache-key-function: ^27.0.1 -> ^29.2.1` - `@babel/preset-env: ^7.12.9 -> ^7.14.0` - `eslint: ^8.20.0 -> ^8.29.0` - add `jest-environment-jsdom` because new jest does not include it by default - [core] fix `SyntheticPlatformEmitter` type error. originally it refers to `react-native/Libraries/EventEmitter/RCTDeviceEventEmitter` internal file which has incorrect type setup in 0.71. we could use the `react-native.DeviceEventEmitter` instead. - [expo-linking]: remove the deprecated `Linking.removeEventListener` (which is also removed from upstream) - [firebase-recaptcha] remove broken web test because firebase ESM which is not supported by jest. this pr simply remove the test case because the package is deprecated. - [jest-expo-enzyme] remove this package and move to [the archived repo](https://github.com/expo/jest-expo-enzyme). enzyme cannot upgrade to jest 29. - remove `@types/react-native` and the versioned cli package check. because 0.71 ships the types directly. - [ncl] workaround `@react-native-community/slider`, `@react-native-segmented-control/segmented-control`, and `@react-native-masked-view/masked-view` type errors in the `react-native-71-fix.d.ts`. - for other details, please check the commit histories one by one. # Test Plan - ci passed - for test-suite ios ci error, i've mentioned in #20799
Re-export config-plugins from expo package and update docs (#18855)
[expo-dev-launcher][expo-dev-menu] gate config plugin mods by SDK version (#16495)
[packages][apps][docs] Update source code to reference main
[dev-client][plugins] Link to installation instructions in config plugin error messages (#14307)# Why Closes ENG-1839. # How Add a link to the installation instructions in the error messag
[dev-client][plugins] Link to installation instructions in config plugin error messages (#14307)# Why Closes ENG-1839. # How Add a link to the installation instructions in the error message.
[eslint-config] remove `arrowParens` overwrite, reformat files (#14232)
[dev-client][plugin] Use Node module resolution to find package paths for Podfile (#13382)
[dev-client][plugin] Update installation plugin (#12875)# Why Makes the installation plugins up-to-date. # How - expo-dev-menu should be initialized by the dev-launcher if it's present. We
[dev-client][plugin] Update installation plugin (#12875)# Why Makes the installation plugins up-to-date. # How - expo-dev-menu should be initialized by the dev-launcher if it's present. We need to remove the initialization of the menu if the dev-launcher is also installed. Otherwise, the app menu delegate will override the one from dev-launcher. - add a new command which compiles the plugin in each package. # Test Plan - run `expo-eject` ✅
[dev-menu] Created versioned plugins (#12715)* Created versioned plugins * changelog
[dev menu] add AppDelegate unit tests (#12651)* Added tests for expo-dev-launcher AppDelegate plugin * Added tests for expo-dev-menu AppDelegate plugin * changelog
[expo-dev-menu][plugin] skip adding the cocoapod if rubocop format import is used (#12480)* match rubocop format * changelog
[dev] Add config plugins for `expo-dev-menu` and `expo-dev-launcher` (#11770)# Why Adds config plugins for `expo-dev-menu` and `expo-dev-launcher`. # How Added plugins according to https:/
[dev] Add config plugins for `expo-dev-menu` and `expo-dev-launcher` (#11770)# Why Adds config plugins for `expo-dev-menu` and `expo-dev-launcher`. # How Added plugins according to https://github.com/expo/expo-cli/tree/master/packages/config-plugins. # Test Plan - expo init - add plugins to `app.config.json` - expo eject