Commit Graph

71 Commits

Author SHA1 Message Date
Anton Nikolaev
dd4d7bbe7f API for creating pastes without showing notifications
Reviewed By: mweststrate

Differential Revision: D33277470

fbshipit-source-id: 2ec9ad7d9fc48d7d2da64be3bfc1a66bb5b3a347
2021-12-22 15:34:11 -08:00
Andrey Goncharov
debf872806 Allow to start only one instance of log listener and crash watcher
Summary:
Changelog: Allow only a single crash watcher and a single log listener per device. Start log listener and crash watcher for every device upon connection. Remove commands to start/stop them externally.

Monitored CPU load for a physical Android device with the log listener on and off. Did not notice any real difference.

Resolved crashing adbkit-logcat by forcing the usage of 2.0.1. A proper fix would be to unify babel transforms for browser flipper and electron flipper, but we might re-think how we distribute flipper in the next half, so a simple hot fix might be a better use of time and resources.

Reviewed By: mweststrate

Differential Revision: D33132506

fbshipit-source-id: 39d422682a10a64830ac516e30f43f32f416819d
2021-12-20 11:39:01 -08:00
Andrey Goncharov
731749b41f Move crash reporting listener to the server
Summary: Changelog: Move crash watcher to the server. Add 'device-crash' event. Add 'device-start-crash-watcher', 'device-stop-crash-watcher' commands. Add 'onDeviceCrash' method to Plugin Client.

Reviewed By: mweststrate

Differential Revision: D33089810

fbshipit-source-id: ed62ee7c1129e5e25af18b444744b0796f567b72
2021-12-20 11:39:00 -08:00
Andrey Goncharov
3f771c05dd Remove fs usage from Navigator plugin
Reviewed By: mweststrate

Differential Revision: D33019873

fbshipit-source-id: 6d48971dc04161b64fdd32ac4e658b56aa98b7ec
2021-12-20 11:39:00 -08:00
dependabot[bot]
9085fc6f72 Bump immer from 9.0.6 to 9.0.7 in /desktop (#3138)
Summary:
Bumps [immer](https://github.com/immerjs/immer) from 9.0.6 to 9.0.7.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/immerjs/immer/releases">immer's releases</a>.</em></p>
<blockquote>
<h2>v9.0.7</h2>
<h2><a href="https://github.com/immerjs/immer/compare/v9.0.6...v9.0.7">9.0.7</a> (2021-11-24)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Append to array when key is &quot;-&quot; (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/872">https://github.com/facebook/flipper/issues/872</a>) (<a href="2afdb1b37d">2afdb1b</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="8507692c72"><code>8507692</code></a> chore(deps): bump prismjs from 1.24.0 to 1.25.0 in /website (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/853">https://github.com/facebook/flipper/issues/853</a>)</li>
<li><a href="5e71d58499"><code>5e71d58</code></a> chore(deps): bump tmpl from 1.0.4 to 1.0.5 (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/854">https://github.com/facebook/flipper/issues/854</a>)</li>
<li><a href="26355d7531"><code>26355d7</code></a> chore: typo (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/857">https://github.com/facebook/flipper/issues/857</a>)</li>
<li><a href="4e062c4292"><code>4e062c4</code></a> docs: Fix typo (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/862">https://github.com/facebook/flipper/issues/862</a>)</li>
<li><a href="fb28e8835d"><code>fb28e88</code></a> docs: Update produce.mdx (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/868">https://github.com/facebook/flipper/issues/868</a>)</li>
<li><a href="6e7cd9aaf9"><code>6e7cd9a</code></a> docs: fix mobile navbar menu styles (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/870">https://github.com/facebook/flipper/issues/870</a>)</li>
<li><a href="437e745258"><code>437e745</code></a> chore(deps): bump ws from 5.2.2 to 5.2.3</li>
<li><a href="2afdb1b37d"><code>2afdb1b</code></a> fix: Append to array when key is &quot;-&quot; (<a href="https://github-redirect.dependabot.com/immerjs/immer/issues/872">https://github.com/facebook/flipper/issues/872</a>)</li>
<li><a href="2794576206"><code>2794576</code></a> chore: fix release job</li>
<li><a href="e6aa92c141"><code>e6aa92c</code></a> chore: fix tests on master</li>
<li>Additional commits viewable in <a href="https://github.com/immerjs/immer/compare/v9.0.6...v9.0.7">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=immer&package-manager=npm_and_yarn&previous-version=9.0.6&new-version=9.0.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/3138

Reviewed By: aigoncharov

Differential Revision: D33234026

Pulled By: mweststrate

fbshipit-source-id: 95134c207a685125e1eaab4a6c9bc565a3077828
2021-12-20 03:26:23 -08:00
Michel Weststrate
e46fcba0b2 Make sure that test stuff doesn't end up in bundles
Summary: When bundling a production bundle of flipper-ui / flipper-server, noticed that a lot of irrelevant stuff ends up. Like: `jest`, `metro`, `testing-library`. The whole jungle basically. Will add safety checks in the next diffs that this no longer happens

Reviewed By: passy

Differential Revision: D33186531

fbshipit-source-id: 1e2034153c8c4a3fac02cd9ce27d99224223df7a
2021-12-17 14:12:50 -08:00
Michel Weststrate
d9488f06ac Clean up flipper-ui-core deps
Summary: Noticed that flipper-ui-core bundled quite some unused / node based deps. No longer

Reviewed By: aigoncharov

Differential Revision: D33184489

fbshipit-source-id: a180f9b8f3eb00ffa6c91e0cca654d4b9b609692
2021-12-17 10:04:23 -08:00
Michel Weststrate
cea7be7fde Clean up globals
Summary: This diff is some boyscouting on cleaning up our globals, and stop using them inconsistently icmw global or window

Reviewed By: aigoncharov

Differential Revision: D33171108

fbshipit-source-id: 400893e5f31523631a7ab6fda428524c751901f1
2021-12-17 10:04:23 -08:00
Michel Weststrate
8f40949bb0 clean slate package resolutions
Summary:
Over time we collected a lot of harcoded resolutions, but it is really hard to get signal about their sanity:
* some resolutions generate a lot of yarn warnings as they resolve with a different major than required, and it's really hard to tell whether they actually make things worse or better
* some resolutions are for package we don't even use any more
* some resolutions were there to fix type incompatibilities which have been solved now by keeping them uniquely required
* some resolutions are there to fix "security issues" or security issues in transient dependencies that might have been upgraded int he mean time

So this diff radically removes all of them, trusting Github to propose restoring the sane ones of them :). In terms of functionality everything seems to be working at least

Reviewed By: timur-valiev

Differential Revision: D33158981

fbshipit-source-id: 83e74cdbc8e47ccbf554b97620cf7caa2c6599ce
2021-12-17 07:36:07 -08:00
Michel Weststrate
5df34a337c Unshare global types
Summary:
This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package.

This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup.

As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same.

Reviewed By: lawrencelomax

Differential Revision: D33124441

fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
2021-12-17 07:36:07 -08:00
Andrey Goncharov
af3757dcae Add left margin for app names in app selector
Summary: Changelog: Add left margin for app names in app selector

Reviewed By: timur-valiev

Differential Revision: D33162189

fbshipit-source-id: 4eb1a565e5cbcdfb44b0dfcaa4b0988c8a69d200
2021-12-17 05:01:54 -08:00
Michel Weststrate
dcfeb4a4d5 Clean up packages and types
Summary:
This diff removes most deps from the root package.json, which now only contains electron and shared build / test infra structure: lint, prettier, jest, typescript.

This makes it possible to control much better which packages are used where, as all sub packages now have their deps explicitly in their package.json instead of incidentally shared. This allows for example to disable DOM types for all packages by default (flipper-plugin, ui(-core) and app still request it), and in the next diff I hope to add to this that nodeJS types are no longer shared either, so that UI oriented packages will generate compile errors when using Node built-ins

This diff removes most deps that were currently unused, and dedupes a bunch of other ones, so the build should probably be a bit smaller now as well:

{F686704253}

{F686704295}

Reviewed By: antonk52

Differential Revision: D33062859

fbshipit-source-id: 5afaa4f2103d055188382a3370c1fffa295a298a
2021-12-16 14:54:59 -08:00
Michel Weststrate
78413c1ecf Register shortcuts on window instead of globally
Summary:
Changelog: Register shortcuts only for Flipper application instead of globally. Fixes https://github.com/facebook/flipper/issues/3090

As reported, during decapitation we accidentally started registering shortcuts globally, rather per app as it used to be in the menu's. This diff fixes that and also makes sure shortcuts are supported in the browser version of flipper

Reviewed By: lawrencelomax

Differential Revision: D33158445

fbshipit-source-id: 8371e5b96e772152eeb93ba990e1f5edb9e67085
2021-12-16 14:51:08 -08:00
Anton Nikolaev
2c976546c7 Redirect to Support Entry Point
Reviewed By: mweststrate

Differential Revision: D33091179

fbshipit-source-id: da0c3e5fc21eef1693f7da2d00d90347bf2e0b51
2021-12-14 09:04:19 -08:00
Michel Weststrate
5ce5d897c8 Make loading of bundled plugins working and robust
Summary:
Bundled plugins so far didn't load because the defaultPlugins was not generated yet. Fixed follow up errors that resulted from node modules not being available in the browser, and made the process more robust so that one plugin that fails to initialise doesn't kill all bundled plugins from being loaded.

Cleaned up the server scripts, and reused the BUILTINS list that is already maintained in the babel transformer.

Report errors during the build process if modules are referred that are stubbed out (later on we could maybe error on that)

Reviewed By: aigoncharov

Differential Revision: D33020243

fbshipit-source-id: 3ce13b0049664b5fb19c1f45f0b33c1d7fdbea4c
2021-12-13 05:48:17 -08:00
Michel Weststrate
9e09c0d5f7 Stop exposing adbkit and crc32 as globals
Summary: Since no plugin directly uses adbkit or crc32 anymore, we removed them from the globals. They wouldn't work in the browser anyway

Reviewed By: aigoncharov

Differential Revision: D33019084

fbshipit-source-id: 66ab0756399fdb401c63f5e8271bdd62cb79ab4a
2021-12-13 05:48:17 -08:00
Michel Weststrate
ac9080abac Remove 'process' usage
Summary: Removed process, adbkit and electron usages that were still remaining. Verified changes by disabling the built-in module stubbing (will be cleaned up further later in this stack).

Reviewed By: aigoncharov

Differential Revision: D33019083

fbshipit-source-id: 8bfce31f4b5ed349cb4fd86d34c9b41b9b8b8360
2021-12-13 05:48:17 -08:00
Michel Weststrate
accef856fc Remove remaining Node imports from core
Summary:
Removed remaining path / fs imports from Flipper core.

`expand-tide` needed replacement too, but noticed that it never actually rewrites paths since all use cases were already using absolute paths, so removed it instead.

Reviewed By: aigoncharov

Differential Revision: D33017654

fbshipit-source-id: e12f66ef68b5f9e4279411c94445a2fb87249e9a
2021-12-13 05:48:17 -08:00
Michel Weststrate
d95b15094f Implement fs.readFile / fs.writeFile
Summary: Per title. Made an explicit distinction between binary and non binary files, since they need to be encoded differently. This keeps both the implementation and API simpler (in terms of overloading / type checking)

Reviewed By: aigoncharov

Differential Revision: D33016031

fbshipit-source-id: 3c99956eb016849a908a171d88a7a64a88b76268
2021-12-13 05:48:17 -08:00
Michel Weststrate
34a1da3345 Implement fs.stat and fs.readlink
Summary: Fixes issue for the stackTraceMapper

Reviewed By: aigoncharov

Differential Revision: D32987161

fbshipit-source-id: 660f49a1bdf61b2fd2963874ef23dfd284f71128
2021-12-13 05:48:17 -08:00
Michel Weststrate
0510786dec Fixed relilability issues in running health checks
Summary: Run doctor checks remained pending when the socket disonnected during a check. This

Reviewed By: aigoncharov

Differential Revision: D32984539

fbshipit-source-id: 277005e78803afaaa220cc5ca7fdc9cca6254453
2021-12-13 05:48:16 -08:00
Michel Weststrate
c1f6ca84b6 Fix overflow issue in WelcomeScreen
Summary: Noticed that the welcome screen started bleeding in the sidebar when the screen is too small. Unlike the plugin container it lacked an overflow: hidden.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32987160

fbshipit-source-id: be324247cdb4abfeec12c40624d65f9fa1e86eff
2021-12-10 17:59:33 -08:00
Michel Weststrate
fa67c21def Fix bug where client plugins weren't always started
Summary:
Changelog: Fixed issue where occasionally a plugin wouldn't open after starting Flipper

This fixes a long standing issue where rarely Flipper wouldn't show the selected plugin. This turned out to be a raise condition, that was easy to reproduce in the Flipper browser version; if a client register before all the plugins are loaded, the plugins that are enabled for that client, but not loaded yet, will not instantiate and hence not show up. This diff fixes that

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32987162

fbshipit-source-id: f3179cd9b6f2e4e79d05be1f2236f63acdf50495
2021-12-10 17:59:33 -08:00
Michel Weststrate
bb23b36051 Fixed flipper settings not being loaded / saved on fresh install
Summary:
I was running flipper-server on a fresh machine without Flipper installed and discovered that reading / writing settings failed since `~/.flipper` wasn't existing, due to using `access` instead of `pathExists`.

Added a warning about needing to restart the server after making changes, since that is tricky to do from the UI.

Fixed an issue in the settings screen, which would fs.stat as part of rendering, causing the Settings UI not to load.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32984538

fbshipit-source-id: 2b2011ad9d84c72ac824d92a8c96f636237b8771
2021-12-10 17:59:33 -08:00
Andrey Goncharov
c96558a524 Remove fs and os usage from Mobile Builds plugin
Summary: Changelog: Expose env info and FS rm command to flipper plugins.

Reviewed By: mweststrate

Differential Revision: D32988478

fbshipit-source-id: 3d0233f9eb34d3478b07e39b9401c0e30ca95135
2021-12-10 06:36:13 -08:00
Andrey Goncharov
adb2573a1f Forbid imports from nested directories of flipper-common, flipper-plugin, flipper-ui-core
Summary:
Forbid imports from nested directories of flipper-common, flipper-plugin, flipper-ui-core

In the stack of D32926830 I occasionally imported from flipper-plugin/src/... which is not allowed. This should fix any auto-import related issues once and for all.

Reviewed By: timur-valiev

Differential Revision: D32987054

fbshipit-source-id: f19f6278219961ad283cacfec094a6c703ca93f8
2021-12-10 06:36:12 -08:00
Andrey Goncharov
92f0ed67f4 Add download file API
Summary: Changelog: Expose "downloadFile" API to Flipper plugins. Allow them to download files form the web to Flipper Server.

Reviewed By: mweststrate

Differential Revision: D32950685

fbshipit-source-id: 7b7f666e165ff7bf209230cdc96078272ede3616
2021-12-10 06:36:12 -08:00
Andrey Goncharov
4cb80a452f Rename RemoteNodeAPI tp RemoteServerContext
Reviewed By: mweststrate

Differential Revision: D32921160

fbshipit-source-id: 9d6b723427d7a819f2fc1b7168f6d1077dc56bd9
2021-12-10 06:36:12 -08:00
Andrey Goncharov
0e785fb18d Add remote fs API
Summary: Changelog: Expose Flipper Server FS access to Flipper plugins

Reviewed By: lblasa

Differential Revision: D32883144

fbshipit-source-id: 47637b61849ef60a2d8fe91a0a28d2a358e0b8c4
2021-12-10 06:36:12 -08:00
Andrey Goncharov
e458ae76f9 Add exec Node API to FlipperLib
Summary: Changelog: Allow flipper plugins to run "exec" Node API on Flipper server.

Reviewed By: mweststrate

Differential Revision: D32881149

fbshipit-source-id: 46486a47ee9824ca68897c19fd86b4afc7f8bf1d
2021-12-10 06:36:12 -08:00
Michel Weststrate
3c6668a8b9 Make sure devices and clients are registered on session startup
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
943d535e86 Move sending intern requests from client to server
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
ad4a55f263 move node types, stub node modules
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
d0402d7268 Move unloadModule to RenderHost
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
6c7a139554 Replace WebView with Iframe
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
2b2cbb1103 Move offline icon storage to app/
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
86995e0d11 Introduce static resource URLs
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
2021-12-08 04:30:57 -08:00
Michel Weststrate
129cbd6f7b Move changelog loading to server
Summary: per title

Reviewed By: aigoncharov

Differential Revision: D32723706

fbshipit-source-id: ce5108da9f5da6fdfa7d1a66a31a4f8f430eb78d
2021-12-08 04:30:56 -08:00
Michel Weststrate
eab4f0d3d3 Bits & pieces
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
2021-12-08 04:30:56 -08:00
Michel Weststrate
058785a509 Remove remaining process.env
Summary: Per title

Reviewed By: passy

Differential Revision: D32721205

fbshipit-source-id: 8e8a7fcac7d73f32d7fb59f852a8099cfe20e542
2021-12-08 04:30:56 -08:00
Michel Weststrate
2b4981c7cb Remove remaing from 'os' imports
Summary: Per title.

Reviewed By: passy

Differential Revision: D32721206

fbshipit-source-id: 9e465d0ed60c0c6da33c462aa76468faac620626
2021-12-08 04:30:56 -08:00
Michel Weststrate
2480ed30c5 Move flipper-doctor check running to flipper-server-core
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
2021-12-08 04:30:56 -08:00
Michel Weststrate
2a4fe77404 Extract environment config initialisation to server-core
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
2021-12-08 04:30:56 -08:00
Michel Weststrate
de59bbedd2 Make plugin loading async
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
2021-12-08 04:30:56 -08:00
Michel Weststrate
64747dc417 move plugin management from ui-core to server-core
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
2021-12-08 04:30:56 -08:00
Michel Weststrate
f9b72ac69e Move RenderHost initialisation to Jest
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
2021-12-08 04:30:55 -08:00
Michel Weststrate
e7f841b6d2 Move flipper plugin from flipper-lib types to flipper-common
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
2021-12-08 04:30:55 -08:00
Michel Weststrate
2bf8ae2364 Get rid of perf_hooks package in Flipper UI
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
2021-12-08 04:30:55 -08:00
Michel Weststrate
5d45bd741b Initialise flipper-ui-browser with socket connection
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
2021-12-08 04:30:55 -08:00
Michel Weststrate
29a907c733 Remove usage of 'events' package
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
2021-12-08 04:30:55 -08:00