-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose unstable_InspectorProxy and unstable_Device from dev-middleware #41370
Expose unstable_InspectorProxy and unstable_Device from dev-middleware #41370
Conversation
Hey @gabrieldonadel, let's talk about alternatives to this PR. Generally speaking, strengthening the encapsulation of these packages was an intentional change to allow us to iterate faster, and removing Expo CLI should have a plan for moving off its dependencies on the internals of these packages, unless we make them intentionally public. Short term, we can be pragmatic here and create You mentioned Can you elaborate on other specific use cases for deep imports from these packages, and the plan for moving away from them? |
For all dev tools packages (minus CLIs), I'd prefer if we could reach the internals as the iteration cycles would cause us potentially weeks/months of delay to get changes out to users, which would cause us to either delay react native upgrades or need to fork more code away from the community packages. Since debugging is fairly stable in Expo CLI at the moment and we're currently in the middle of the react-native upgrade process, we could update this PR to expose all of the internal APIs we're using, either through the main export or package exports. |
I can speak for the use case of customizing the
For the network inspector, we can only move off our extended proxy when the new native Hermes CDP backend is ready and we re-implemented the network inspector in the new system. For the workaround / fixes, we need Hermes to stop crashing apps on any CDP message. Even when the CDP message content is malformed. E.g. I think the best path forward on our end would be to keep extending these classes until the newer Hermes CDP backend is in place, and we migrated or upstreamed the network inspector. For now, I think having access to the |
Regarding |
4e11575
to
324def9
Compare
ac137df
to
2061b6d
Compare
@byCedric's updates to this PR (exposing For 0.74 onwards, can we be proactive about moving away from these unstable mechanisms, and addressing the underlying problems in a sustainable way? Specifically:
If this is a bug in Hermes's CDP handler, let's just fix it (cc @dannysu) and put unit tests around it - this doesn't have to be blocked on shipping the entire new CDP stack, and doesn't warrant keeping around a monkey-patched version of
Let's derisk this. Adding a native network inspector inside RN is still an important goal for us, but it's likely the new CDP stack will ship without it at first. In that world, continuing to use a monkey-patched |
@blakef has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @gabrieldonadel in 1a61afd. When will my fix make it into a release? | Upcoming Releases |
#41370) Summary: Recently, both `metro-inspector-proxy`(#39045) and `react-native-community/cli-plugin-metro`(#38795) were moved to this repo and in the process of moving these packages, the `exports` field inside package.json was added, only exporting the `index.js` file. The problem is that Expo CLI (and possibly other community packages) rely on functions and classes that are not exported in the `index.js` file, e.g. Importing the InspectorProxy class from `react-native/dev-middleware/dist/inspector-proxy/InspectorProxy`. Normally this wouldn't be a problem and we would just import from `dist/` but due to the `exports` field, attempting to import from any other file not specified on this field will result in a `ERR_PACKAGE_PATH_NOT_EXPORTED` error. As a short-term fix, we should create `unstable_`-prefixed exports of individual features Expo currently depends on. ## Changelog: [INTERNAL] [CHANGED] - Expose unstable_InspectorProxy and unstable_Device from `react-native/dev-middleware` Pull Request resolved: #41370 Test Plan: N / A Reviewed By: robhogan Differential Revision: D51163134 Pulled By: blakef fbshipit-source-id: e67adaedc4fc64131e4c9dd8383c9877b8202283
# Why upgrade react-native 0.73 for sdk 50 Closes ENG-9739 # How - update package versions - `react-native 0.72.5 -> 0.73.0-rc.4` - `@react-native/assets-registry 0.72.0 -> 0.73.1` - `metro-react-native-babel-preset 0.76.8 -> @react-native/babel-preset 0.73.18` - upgrade project templates based on [upgrade-helper](https://react-native-community.github.io/upgrade-helper/?from=0.72.5&to=0.73.0-rc.2) - Backport folly_version bump to v2022.05.16.00 - Expo Go - Add Agp configurator plugin in order to make sure `buildConfig` is turned on for all the 3rd party libraries and ensure namespace is specified for all the 3rd party libraries - Migrate go to version catalogs - Temporarily patched @react-native/dev-middleware while `react-native@0.73.0-rc.5` is not out (check facebook/react-native#41370 for more context) - cli - Migrate metro-inspector-proxy to @react-native/dev-middleware - remove runInspectorProxy logic - [gesture-handler] Temporarily patched patch before software-mansion/react-native-gesture-handler@4efaebc is released - [modules][dev-menu] Update import paths for fabric - [html-elements] Update Style types - for other details, please check the commit histories one by one. # Next steps Part 2 -> #25453 - Upgrade react-native to 0.73.0 when the official release is out - Remove all patches - Part 2 - Move AgpConfiguratorPlugin to a different file - Migrate MainApplication / MainActivity to kotlin # Test Plan - bare-expo ios / android - Expo Go - fabric ios / android - ci passed # Checklist - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
facebook#41370) Summary: Recently, both `metro-inspector-proxy`(facebook#39045) and `react-native-community/cli-plugin-metro`(facebook#38795) were moved to this repo and in the process of moving these packages, the `exports` field inside package.json was added, only exporting the `index.js` file. The problem is that Expo CLI (and possibly other community packages) rely on functions and classes that are not exported in the `index.js` file, e.g. Importing the InspectorProxy class from `react-native/dev-middleware/dist/inspector-proxy/InspectorProxy`. Normally this wouldn't be a problem and we would just import from `dist/` but due to the `exports` field, attempting to import from any other file not specified on this field will result in a `ERR_PACKAGE_PATH_NOT_EXPORTED` error. As a short-term fix, we should create `unstable_`-prefixed exports of individual features Expo currently depends on. ## Changelog: [INTERNAL] [CHANGED] - Expose unstable_InspectorProxy and unstable_Device from `react-native/dev-middleware` Pull Request resolved: facebook#41370 Test Plan: N / A Reviewed By: robhogan Differential Revision: D51163134 Pulled By: blakef fbshipit-source-id: e67adaedc4fc64131e4c9dd8383c9877b8202283
# Why upgrade react-native 0.73 for sdk 50 Closes ENG-9739 # How - update package versions - `react-native 0.72.5 -> 0.73.0-rc.4` - `@react-native/assets-registry 0.72.0 -> 0.73.1` - `metro-react-native-babel-preset 0.76.8 -> @react-native/babel-preset 0.73.18` - upgrade project templates based on [upgrade-helper](https://react-native-community.github.io/upgrade-helper/?from=0.72.5&to=0.73.0-rc.2) - Backport folly_version bump to v2022.05.16.00 - Expo Go - Add Agp configurator plugin in order to make sure `buildConfig` is turned on for all the 3rd party libraries and ensure namespace is specified for all the 3rd party libraries - Migrate go to version catalogs - Temporarily patched @react-native/dev-middleware while `react-native@0.73.0-rc.5` is not out (check facebook/react-native#41370 for more context) - cli - Migrate metro-inspector-proxy to @react-native/dev-middleware - remove runInspectorProxy logic - [gesture-handler] Temporarily patched patch before software-mansion/react-native-gesture-handler@4efaebc is released - [modules][dev-menu] Update import paths for fabric - [html-elements] Update Style types - for other details, please check the commit histories one by one. # Next steps Part 2 -> expo#25453 - Upgrade react-native to 0.73.0 when the official release is out - Remove all patches - Part 2 - Move AgpConfiguratorPlugin to a different file - Migrate MainApplication / MainActivity to kotlin # Test Plan - bare-expo ios / android - Expo Go - fabric ios / android - ci passed # Checklist - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
# Why upgrade react-native 0.73 for sdk 50 Closes ENG-9739 # How - update package versions - `react-native 0.72.5 -> 0.73.0-rc.4` - `@react-native/assets-registry 0.72.0 -> 0.73.1` - `metro-react-native-babel-preset 0.76.8 -> @react-native/babel-preset 0.73.18` - upgrade project templates based on [upgrade-helper](https://react-native-community.github.io/upgrade-helper/?from=0.72.5&to=0.73.0-rc.2) - Backport folly_version bump to v2022.05.16.00 - Expo Go - Add Agp configurator plugin in order to make sure `buildConfig` is turned on for all the 3rd party libraries and ensure namespace is specified for all the 3rd party libraries - Migrate go to version catalogs - Temporarily patched @react-native/dev-middleware while `react-native@0.73.0-rc.5` is not out (check facebook/react-native#41370 for more context) - cli - Migrate metro-inspector-proxy to @react-native/dev-middleware - remove runInspectorProxy logic - [gesture-handler] Temporarily patched patch before software-mansion/react-native-gesture-handler@4efaebc is released - [modules][dev-menu] Update import paths for fabric - [html-elements] Update Style types - for other details, please check the commit histories one by one. # Next steps Part 2 -> expo/expo#25453 - Upgrade react-native to 0.73.0 when the official release is out - Remove all patches - Part 2 - Move AgpConfiguratorPlugin to a different file - Migrate MainApplication / MainActivity to kotlin # Test Plan - bare-expo ios / android - Expo Go - fabric ios / android - ci passed # Checklist - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
Summary:
Recently, both
metro-inspector-proxy
(#39045) and@react-native-community/cli-plugin-metro
(#38795) were moved to this repo and in the process of moving these packages, theexports
field inside package.json was added, only exporting theindex.js
file.The problem is that Expo CLI (and possibly other community packages) rely on functions and classes that are not exported in the
index.js
file, e.g. Importing the InspectorProxy class from@react-native/dev-middleware/dist/inspector-proxy/InspectorProxy
. Normally this wouldn't be a problem and we would just import fromdist/
but due to theexports
field, attempting to import from any other file not specified on this field will result in aERR_PACKAGE_PATH_NOT_EXPORTED
error.As a short-term fix, we should create
unstable_
-prefixed exports of individual features Expo currently depends on.Changelog:
[INTERNAL] [CHANGED] - Expose unstable_InspectorProxy and unstable_Device from
@react-native/dev-middleware
Test Plan:
N / A