Summary: Per title, processed some pending review comments made earlier in this stack
Reviewed By: aigoncharov
Differential Revision: D32916920
fbshipit-source-id: 01db85883596b5c85b77efc9cddadeac23cc4ef5
Summary: This diff makes sure that when the client starts, it fetches all known devices and clients first, as it might have missed the 'connect' events for those. For Electron this wasn't needed, since the server starts with the UI, but this makes sure that a browser reload or a second connection sees the same devices & apps
Reviewed By: aigoncharov
Differential Revision: D32881589
fbshipit-source-id: 7b1cb3d296044f83dedcf3f3d8d02864690b6666
Summary: This diff moves send intern request from the browser to the server. The reason to make this change is that making such requests from a browser environment causes CORS restrictions to kick in.
Reviewed By: nikoant
Differential Revision: D32835449
fbshipit-source-id: e8e92e51ca963aa50b3c859bb61c2381171e85ae
Summary: This diff stubs all node modules when running in the browser, so that, albeit with a lot of errors and without plugins, the UI loads in a browser. To be continued in the rest of this diff
Reviewed By: antonk52
Differential Revision: D32665705
fbshipit-source-id: 4632e241f59c5b9712a41d01a26878afb01f69b5
Summary: Define unload module on RenderHost. Not sure how to do that the browser and not sure how meaning full it is in a browser context.
Reviewed By: nikoant
Differential Revision: D32827050
fbshipit-source-id: 87025c6f5c2b950880712bff8df1c92a044a222e
Summary: This diff replaces the WebView we use to render plugin docs with an Iframe.
Reviewed By: nikoant, aigoncharov
Differential Revision: D32797111
fbshipit-source-id: 8ea0e0bd1cbea33dd7e389600951c020a88e4267
Summary:
This diff splits Facebook management into a ui-core and electron part:
* Cleaned up code and introduces a uniform Icon type to describe a requested icon
* Computing icon urls is done in the ui-core
* Introduced a RenderHost hook that can transform the request icon into a different url, in this case, a url to load icons from disk in production builds
For the browser UI, the urls are currently no rewritten since we have only dev builds (which always used only FB urls already). We could do the same rewrite in the future and download the static assets during build time. But for now this means that in the browser implementation we depend on normal browser caching, with the biggest downside that icons might not appear if the user has no internet connections.
With this change we lost our last usage of staticPath computations in ui-core
Reviewed By: aigoncharov
Differential Revision: D32767426
fbshipit-source-id: d573b6a373e649c7dacd380cf63a50c2dbbd9e70
Summary: Introduced an API that converts a filepath, relatively to the `desktop/static/` folder in a url that can be resolved by the render environment. This will generate `file://` urls in Electron, and root relative `/` urls in browser envs
Reviewed By: aigoncharov
Differential Revision: D32767427
fbshipit-source-id: 378da7709bcb19449873358a8703b9c5a5809c57
Summary: Added a command to let a file be opened by the OS, and some other small bits and pieces to make Flipper browser compatible.
Reviewed By: lblasa
Differential Revision: D32721748
fbshipit-source-id: a4ad1c2f662f4651ddf6c20c57e5af1e123914a8
Summary:
Remove crypto dep, which was only used by NUX, to hash the elements that has been confirmed.
Sadly trickier than hoped; there is no uniform api in both browser and Node available that can take a sha-256 hash, and the browser APIs are async.
Reviewed By: aigoncharov
Differential Revision: D32721204
fbshipit-source-id: 32625f83bf6c60cedc4fb7096240c2fa0d8434a7
Summary: Per title. Two new server API's: get-healthchecks, and run-healtcheck. Types have all been moved to flipper-common, so that they can be used by doctor, server-core and ui-core packages. Since it were quite some, moved them into a FlipperDoctor namespace.
Reviewed By: nikoant
Differential Revision: D32720510
fbshipit-source-id: 37aa35cde6ebd58479cf0dffec5b7b2da6d22198
Summary: This diff makes most stuff that is read from the `os` package, and version info etc available from the `serverConfig` object, so that flipper-ui-core no longer needs the `os` package.
Reviewed By: passy
Differential Revision: D32694848
fbshipit-source-id: 93af1e95d898da9aaf351a6970b5a7652ee835c8
Summary: This diff makes plugin loading async, which we'd need in a browser env (either because we'd use `import()` or we need to fetch the source and than eval it), and deals with all the fallout of that
Reviewed By: timur-valiev
Differential Revision: D32669995
fbshipit-source-id: 73babf38a6757c451b8200c3b320409f127b8b5b
Summary:
Follow up of D32665064, this diff moves all plugin management logic from flipper-ui to flipper-server. Things like downloading, installing, querying new plugins.
Loading plugins is handled separately in the next diff.
Reviewed By: nikoant
Differential Revision: D32666537
fbshipit-source-id: 9786b82987f00180bb26200e38735b334dc4d5c3
Summary:
This diff moves RenderHost initialisation to jest, which is thereby treated as just another 'Host' like flipper-ui, the electron app etc. A benefit is that it provides a mocked flipperServer by default that can be used to mock or intercept requests. See LaunchEmulator.spec as example.
Also made the jest setup scripts strongly typed by converting them to TS.
This change allows the test stub configuration, which was OS dependent, out of flipper-ui-core.
Reviewed By: nikoant
Differential Revision: D32668632
fbshipit-source-id: fac0c09812b000fd7d1acb75010c35573087c99f
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.
Reviewed By: nikoant, aigoncharov
Differential Revision: D32665064
fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
Summary:
perf_hooks is no longer needed as these APIs are widely available in both browser and electron.
Still needed in unit tests, as they run from Node
Reviewed By: lblasa, aigoncharov
Differential Revision: D32648253
fbshipit-source-id: 5718ea99b57f96f6858311fd0815ad18c476c99e
Summary:
Notice during debugging that devices keep unregistering. Doesn't lead to any practical issues, but still incorrect.
Also noticed that the server didn't restart when changing flipper-server-core, or recompile its deps, so fixed that as well.
Reviewed By: passy
Differential Revision: D32644276
fbshipit-source-id: 5384a30c9d293acda04b6e6f940268ddcd65a870
Summary:
This diff sets up the socket connection between flipper-browser and flipper-server, and verifies that the initial UI initialisation work (e.g. `get-config` command works). The initial RenderHost is initialised as well based on the config and browser APIs.
Note that flipper-ui-core itself isn't started yet, as that has still a plethora of node imports, so Metro will correctly refuse to bundle
Not in this diff
* remove Node usage from flipper-ui-core
* implement all RenderHost APIs
Reviewed By: aigoncharov
Differential Revision: D32644074
fbshipit-source-id: 2c8065caf0191771a3867b69a431ca50eeb7a5a3
Summary: 'events' doesn't exist in the browser, so picked a popular package with the same API
Reviewed By: lblasa, aigoncharov
Differential Revision: D32643057
fbshipit-source-id: 91309e53e16f3279048aa976cdb098eaa4a7d7db
Summary: The previous started up a dev / web server for bundling in flipper-server, this diff starts the flipper server itself, so that we can connect the client to it (done in next diffs)
Reviewed By: passy, aigoncharov
Differential Revision: D32627390
fbshipit-source-id: b48de20f076e1e13842368d16a090708d533b69e
Summary:
This sets up the metro bundler for flipper-server, to be able to serve the front end.
Note that this is a setup that is only relevant for development purposes
Done in this diff:
* setup metro
* setup fast refresh
* setup nodemon to be able to refresh on server changes
Not done in this diff
* Setup FlipperServerImpl in the flipper-server
* Load flipper-ui-core in flipper-ui-browser
* Load plugins
* Support options, env vars etc etc
* Make flipper-server stand alone (it is largely self contained, but still requires some static resources like theming)
Reviewed By: passy, aigoncharov
Differential Revision: D32626137
fbshipit-source-id: 47f580356ddf0993392d3b583082b187661727e9
Summary:
Watch folders weren't updated for cross plugin/flipper boundaries that have recently been removed
Fix changes in several source folders not being picked up when fast refresh wasn't enabled
Reviewed By: passy, aigoncharov
Differential Revision: D32626139
fbshipit-source-id: 2c830ec8154ff859ce1e3ee101e5963162d2e0a2
Summary: This diff moves keychain storage to the server. Figured to leave request logic itself in the UI-core, as basically all use cases happen there, except for streaming download for mobile build plugin, so sending the requests from the backend doesn't really seem to add value, unless we run into some CORS issues later.
Reviewed By: passy
Differential Revision: D32596715
fbshipit-source-id: f5ab9d794f91a6eb8a8dc07ae723bf2890726771
Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).
This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.
Reviewed By: passy, aigoncharov
Differential Revision: D32498649
fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
Summary: This diff makes sure flipper-ui-core no longer depends on flipper-server-core. Currently server config is still transferred from UI to server, which doesn't really make sense in future scenarios where server might start before client, but will address that separately
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D32462835
fbshipit-source-id: 498a944256ba1aabbf963b896953e64d11e27214
Summary:
Removed loadGKs and loadDistilleryGKs from the `flipper` API, as it leaked implementation details of GK that didn't work well with decapitation later in this diff, and refactored it to using `getFlipperLib().GK`.
After that discovered that those APIs are actuallly only used by nt-shared's performGKcheck, which was already removed from all usages in D27736036, so just removed the code altogether. But left loading distillery GKs in place, since that is good infra structure to provide anyway(?), although we don't have active use cases atm
Reviewed By: jknoxville
Differential Revision: D32529600
fbshipit-source-id: a03fb14ada21018d329eea78a59f1b20610b2fd3
Summary: Uses the new statuses emitted by DevTools in https://github.com/facebook/react/pull/22848 to better handle the connection state when connecting to DevTools from Flipper.
Reviewed By: bvaughn
Differential Revision: D32891240
fbshipit-source-id: 142d9996e05b5113e6dca28074c461d5a5acd38f
Summary:
This commit makes it so when we load DevTools from within Flipper we log it as a Flipper load and not a regular standalone app load.
Note that the logging only applies internally.
Reviewed By: bvaughn
Differential Revision: D32884616
fbshipit-source-id: 90d0962bac9c1abdde36a70fd361251d7e607b57
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3139
This commit adds new UI in the top level toolbar to allow internal FB users to switch between the internal build of devtools and the OSS one.
## Scenarios
**Internal (when `client.isFB`)**
- DevTools version will default to the internal version, and will render a `Select` component with option to switch to the OSS version.
- If a global install of DevTools is present, the selection menu will also offer the option to switch to the global DevTools version.
**External (when `!client.isFB`)**
Will preserve previous behavior:
- Uses the OSS version by default, and doesn't provide option to switch to internal version.
- If a global installation is present, will render a `Switch` component that allows switching between OSS and global installation.
### Implementation
This commit refactors some parts of the DevTools plugin to provide a bit more clarity in the loading sequence by renaming and modifying some of the messaging, and fixing lint warnings.
A change introduced here is that when switching or loading devtools, when we attempt to reload the device via Metro, don't immediately show a "Retry" button, since at that point nothing has gone wrong, and the Retry button will only occur if the Metro reload doesn't occur after a few seconds.
In a future commit, this [PR in Devtools](https://github.com/facebook/react/pull/22848) will allow us to clear any loading messages once DevTools has successfully connected.
Reviewed By: lunaruan, mweststrate
Differential Revision: D32773200
fbshipit-source-id: aa15ffecba7b2b2ea74e109e9f16334d47bf5868
Summary:
This commit update the React DevTools Flipper plugin to use the internal build of `react-devtools-core/standalone`.
The internal build of `react-devtools-core/standalone` is generated by the new sync script: `js1 upgrade react-devtools-core`, which places the build under `xplat/sonar/desktop/plugins/public/reactdevtools/fb`.
As a follow up, we can add a dropdown to allow users to select which version of React DevTools they'd like to use.
Reviewed By: mweststrate
Differential Revision: D31904288
fbshipit-source-id: ce0880284bd7f9ccaa6258a7c2956f20771e81a9
Summary: This build was created from git revision 90e5d3638844414e1b9df0fe66c3fc46b211d210.
Reviewed By: lunaruan
Differential Revision: D31866508
fbshipit-source-id: 104cc38647f9a43d1cd2862c0ae412ecabe05bdf
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3125
Better stream creation and disposal.
A report was generated with the following error:
StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
Changelog: Close input stream after use which was causing strict mode policy violation crashes and possibly leaking resources.
Reviewed By: passy
Differential Revision: D32830690
fbshipit-source-id: de3ffaf1b600590c4060a381fae66e73e08745cb
Summary:
When a client disconnects while it's still initialising, we get a critical error.
But this is expected to happen now and again, so adding a specific error for it, and handling it accordingly.
It doesn't change the control flow, just the logging.
Reviewed By: nikoant
Differential Revision: D32794062
fbshipit-source-id: cf27fb9c345aa6369d338838a46e75a6b7afde41
Summary:
{F684271717}
^
This is causing the error being reported quite a lot. The identifier doesn't provide much information to the person analysing the error. Only ever useful if debugging.
Reviewed By: antonk52, mweststrate
Differential Revision: D32828150
fbshipit-source-id: f29fbf6bfe389fec6ef888fc01be6c058193709d
Summary:
Bit off an odd one but according to the crash report in T107008330,
the screenshot can sometimes be not a real buffer. This may not actually
fix things but should give us some more insights into what's up.
Changelog: Better handling of screenshot taking in navigation
Reviewed By: mweststrate
Differential Revision: D32797863
fbshipit-source-id: 6d16ccb82fb8258591f9bc5f79c00811b18b9c51
Summary:
Currently, we register global error handlers inside of ErrorReporter. To make these global error visible to the user we pipe them to `console.error`. All console methods are monkey-patched in our Logger. Logger uses ErrorReporter to report errors to LogView. It leads to duplicate errors in LogView.
In this diff, we extract startGlobalErrorHandling which should help us avoid duplication.
Reviewed By: passy
Differential Revision: D32759909
fbshipit-source-id: 6376e193c0ba6f0b46aaccc139ecf5066a04da11
Summary:
1. Add `path` replacement
1. Remove Node's path for all plugins but MobileBuildsPluginContainer (it is probably going to be moved to the server)
Reviewed By: mweststrate
Differential Revision: D32766327
fbshipit-source-id: e636f273842506e752b97cf1b28ce7ac51ce9a12
Summary: Starting just with Android On Demand. iOS will follow shortly.
Reviewed By: antonk52
Differential Revision: D32724229
fbshipit-source-id: b4276aae2a7349815d691b854adcfc531b702ae7
Summary: The errors files for this aren't actionable and cannot be deduplicated because of the information included. Better to treat this as a warning.
Reviewed By: nikoant
Differential Revision: D32758656
fbshipit-source-id: 5255d694b8783b7bb49f981933741063d012df98
Summary: We can't action tasks based on this report, so better to raise it as a warning.
Reviewed By: nikoant
Differential Revision: D32758850
fbshipit-source-id: 2e8ff984f40d2d0431db192e8f2d983d52b77ccd