-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feature(cli): add custom inspector proxy based on metro-inspector-proxy
#21449
Conversation
ENG-7467 [network][dev-server] extend metro-inspector-proxy
To support more CDP commands, we should extend metro-inspector-proxy. Also to support inspector network requests body, we should store requestId<->body map in dev-server. https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getResponseBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving some nit comments. most of code looks good to me. thanks Cedric!
packages/@expo/cli/src/start/server/metro/inspector-proxy/index.ts
Outdated
Show resolved
Hide resolved
Hold off on merging until #21475 is merged |
packages/@expo/cli/src/start/server/metro/inspector-proxy/proxy.ts
Outdated
Show resolved
Hide resolved
0b9f403
to
cdf1f78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving two problems from my testing. you could also test it on bare-expo with #21490.
be sure to set USE_DEV_CLIENT = true
in MainApplication or useDevClient = true
in AppDelegate.mm
packages/@expo/cli/src/start/server/metro/inspector-proxy/proxy.ts
Outdated
Show resolved
Hide resolved
packages/@expo/cli/src/start/server/metro/inspector-proxy/device.ts
Outdated
Show resolved
Hide resolved
faad89a
to
63cd040
Compare
63cd040
to
142a2c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested this pr a little bit and it works like a charm. i don't have any further comments and leave the remaining code style/testability for Evan to review.
packages/@expo/cli/src/start/server/metro/inspector-proxy/proxy.ts
Outdated
Show resolved
Hide resolved
packages/@expo/cli/src/start/server/metro/inspector-proxy/proxy.ts
Outdated
Show resolved
Hide resolved
packages/@expo/cli/src/start/server/metro/inspector-proxy/proxy.ts
Outdated
Show resolved
Hide resolved
packages/@expo/cli/src/start/server/metro/inspector-proxy/proxy.ts
Outdated
Show resolved
Hide resolved
# Why Builds upon #21449 This adds a handler that makes sure the `vscode-js-debug` extension can be used with the custom inspector proxy. These changes should NOT interfere with the other debuggers. # How - Added vscode compatibility handler - Add missing `description` to function nodes, as required by vscode-js-debug _(before microsoft/vscode-js-debug#1583 - Respond to `Debugger.getPossibleBreakpoints`, Hermes doesn't respond to this message - ~~Filter out "useless" `callFrames` when debugging~~ **Moved back to PR, we need to limit filtering** → #21663 - Avoid Hermes binding breakpoints to wrong locations, before sourcemap is loaded → #21631 - Avoid Hermes crashing by disabling `Runtime.getProperties` on `symbol` types → #21639 # Test Plan - See tests - ~~Test project with vscode, see [this repository](https://github.com/byCedric/vscode-js-debug-issue-1583) for a test project.~~ - See #21641 to test `apps/bare-expo` # 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 <34669131+expo-bot@users.noreply.github.com>
…oxy` (#21449) Fixes ENG-7467 Related #21265 This is an initial draft to extend the CDP functionality of `metro-inspector-proxy`. The implementation is slightly wonky around the `ExpoInspectorDevice`. We want to reuse as much as possible from `metro-inspector-proxy`, but we need to add stateful data per device. In order to achieve that, we generate a new class type, based on the user's installed `metro-inspector-proxy`. This makes everything less readable but should include future updates in these classes. As for the `ExpoInspectorProxy`, to avoid having to do the same thing, we just wrap the whole inspector class and reuse what we can. The device map is "linked" within the original inspector proxy instance, making the data available to all methods that need it. Enable this feature with `EXPO_USE_CUSTOM_INSPECTOR_PROXY=1` - [x] See tests for the actual CDP events we handle. - [ ] See tests on the "bootstrapping code" to create the inspector and devices. <!-- 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: Evan Bacon <bacon@expo.io>
# Why Builds upon #21449 This adds a handler that makes sure the `vscode-js-debug` extension can be used with the custom inspector proxy. These changes should NOT interfere with the other debuggers. # How - Added vscode compatibility handler - Add missing `description` to function nodes, as required by vscode-js-debug _(before microsoft/vscode-js-debug#1583 - Respond to `Debugger.getPossibleBreakpoints`, Hermes doesn't respond to this message - ~~Filter out "useless" `callFrames` when debugging~~ **Moved back to PR, we need to limit filtering** → #21663 - Avoid Hermes binding breakpoints to wrong locations, before sourcemap is loaded → #21631 - Avoid Hermes crashing by disabling `Runtime.getProperties` on `symbol` types → #21639 # Test Plan - See tests - ~~Test project with vscode, see [this repository](https://github.com/byCedric/vscode-js-debug-issue-1583) for a test project.~~ - See #21641 to test `apps/bare-expo` # 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 <34669131+expo-bot@users.noreply.github.com>
Why
Fixes ENG-7467
Related #21265
This is an initial draft to extend the CDP functionality of
metro-inspector-proxy
.How
The implementation is slightly wonky around the
ExpoInspectorDevice
. We want to reuse as much as possible frommetro-inspector-proxy
, but we need to add stateful data per device.In order to achieve that, we generate a new class type, based on the user's installed
metro-inspector-proxy
. This makes everything less readable but should include future updates in these classes.As for the
ExpoInspectorProxy
, to avoid having to do the same thing, we just wrap the whole inspector class and reuse what we can. The device map is "linked" within the original inspector proxy instance, making the data available to all methods that need it.Test Plan
Enable this feature with
EXPO_USE_CUSTOM_INSPECTOR_PROXY=1
Checklist
expo prebuild
& EAS Build (eg: updated a module plugin).