Commit Graph

25 Commits

Author SHA1 Message Date
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
Michel Weststrate
e742322eb1 Move keychain storage to server, some constants cleanup
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
2021-12-08 04:30:54 -08:00
Michel Weststrate
bca169df73 Move settings, launcherSettings, GKs to app / flipper-server-core
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
2021-12-08 04:30:54 -08:00
Michel Weststrate
eed19b3a3d Move FlipperServer initialisation out of flipper-core
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
2021-12-08 04:30:54 -08:00
Michel Weststrate
d48f22b8dc Factor out GK fetch logic
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
2021-12-08 04:30:54 -08:00
John Knox
b7a29ac0b3 Fix disconnect during init logging
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
2021-12-03 06:28:19 -08:00
Andrey Goncharov
0799edbca0 Fix excessive error reporting
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
2021-12-02 10:08:18 -08:00
dependabot[bot]
6313a3da3a Bump mock-fs from 5.0.0 to 5.1.2 in /desktop (#3114)
Summary:
Bumps [mock-fs](https://github.com/tschaub/mock-fs) from 5.0.0 to 5.1.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/tschaub/mock-fs/blob/main/changelog.md">mock-fs's changelog</a>.</em></p>
<blockquote>
<h2>5.1.2</h2>
<ul>
<li>Avoid open <code>FSREQCALLBACK</code> file handles (thanks <a href="https://github.com/jloleysens"><code>@​jloleysens</code></a>, see <a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/342">https://github.com/facebook/flipper/issues/342</a><a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/342">https://github.com/facebook/flipper/issues/342</a>)</li>
</ul>
<h2>5.1.1</h2>
<ul>
<li>Added <code>engines</code> to <code>package.json</code> to clarify that Node &gt;= 12 is required (thanks <a href="https://github.com/tillig"><code>@​tillig</code></a>, see <a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/337">https://github.com/facebook/flipper/issues/337</a><a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/337">https://github.com/facebook/flipper/issues/337</a>)</li>
</ul>
<h2>5.1.0</h2>
<ul>
<li>Added support for Node &gt;= 16.3 (thanks <a href="https://github.com/Rugvip"><code>@​Rugvip</code></a>, see <a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/335">https://github.com/facebook/flipper/issues/335</a><a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/335">https://github.com/facebook/flipper/issues/335</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="ebfc4b7aa9"><code>ebfc4b7</code></a> 5.1.2</li>
<li><a href="7e3a746e26"><code>7e3a746</code></a> Log changes</li>
<li><a href="abd285a86e"><code>abd285a</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/342">https://github.com/facebook/flipper/issues/342</a> from jloleysens/fix/call-original-fsBinding-open</li>
<li><a href="9bbd98719f"><code>9bbd987</code></a> also return the result of originalOpen</li>
<li><a href="2d48c6cd58"><code>2d48c6c</code></a> call original fsBinding.open when collecting ReadFileContext proto to avoid c...</li>
<li><a href="313cd08c4a"><code>313cd08</code></a> 5.1.1</li>
<li><a href="69283aa62c"><code>69283aa</code></a> Log changes</li>
<li><a href="31d901796c"><code>31d9017</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/tschaub/mock-fs/issues/337">https://github.com/facebook/flipper/issues/337</a> from tillig/patch-1</li>
<li><a href="0b8d63e77c"><code>0b8d63e</code></a> <code>engines</code> block to specify min requirements</li>
<li><a href="8a6ad90999"><code>8a6ad90</code></a> 5.1.0</li>
<li>Additional commits viewable in <a href="https://github.com/tschaub/mock-fs/compare/v5.0.0...v5.1.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mock-fs&package-manager=npm_and_yarn&previous-version=5.0.0&new-version=5.1.2)](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/3114

Reviewed By: jknoxville

Differential Revision: D32698511

Pulled By: passy

fbshipit-source-id: 0e1a698bab4ffdf01186184176848d8180789400
2021-11-30 23:11:39 -08:00
dependabot[bot]
8a2d99b592 Bump reselect from 4.0.0 to 4.1.5 in /desktop (#3111)
Summary:
Bumps [reselect](https://github.com/reduxjs/reselect) from 4.0.0 to 4.1.5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/reduxjs/reselect/releases">reselect's releases</a>.</em></p>
<blockquote>
<h2>v4.1.5</h2>
<p>This release updates the TS types to correctly infer selector parameters when input selectors have <code>undefined</code> or <code>null</code> as a parameter type or have optional parameters, and exports the <code>CreateSelectorFunction</code> type to fix uses of <code>createStructuredSelector</code>.</p>
<p>(The types fixes feel like playing whack-a-mole, but they keep getting better!</p>
<h2>What's Changed</h2>
<ul>
<li>Fix intersection of parameters that are undefined by <a href="https://github.com/markerikson"><code>@​markerikson</code></a> in <a href="https://github-redirect.dependabot.com/reduxjs/reselect/pull/556">reduxjs/reselect#556</a></li>
<li>Export CreateSelectorFunction to fix createStructuredSelector usage by <a href="https://github.com/markerikson"><code>@​markerikson</code></a> in <a href="https://github-redirect.dependabot.com/reduxjs/reselect/pull/557">reduxjs/reselect#557</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/reduxjs/reselect/compare/v4.1.4...v4.1.5">https://github.com/reduxjs/reselect/compare/v4.1.4...v4.1.5</a></p>
<h2>v4.1.4</h2>
<p>This release has (you guessed it) more fixes to the TS types: a change to parameter merging that fixes breakage with selectors and RTK Query's API state, a simplification of the <code>OutputSelectorFields</code> type to improve selector variable readability, another update to parameter merging to flag nested <code>never</code> fields as compile errors, and a fix to <code>createStructuredSelector</code> parameters to resolve a lib compilation problem.</p>
<h2>Changelog</h2>
<h3>More TS Fixes</h3>
<p>The parameter merging fixes in 4.1.3 tried to &quot;unwrap/expand&quot; the parameter types to make them more readable, such as showing intersected objects as <code>{a, b, c}</code> instead of <code>{a} &amp; {b} &amp; {c}</code>.  This was done with a recursive expansion type. That turned out to break with the complex state types used by RTK Query.  We've updated the type expansion to only be a single level instead, which fixes the compilation issue.</p>
<p>The <code>OutputSelectorFields</code> type previously took two generics: the <code>Combiner</code> function, and a <code>Result</code> type. This led to extra values being shown in hover previews for selectors. By inferring <code>Result = ReturnType&lt;Combiner&gt;</code>, we were able to drop the second generic and cut down on the amount of types shown in previews.</p>
<p>A user noted that intersected objects with top-level incompatible fields (like <code>{a: string} &amp; {a: number}</code>) resulted in empty objects, but no compile error. We've updated the parameter merging to flag those as <code>never</code> and catch the problem at compile time. Deeper nested incompatible fields should already be caught by TS.</p>
<p>The previous fix to <code>createStructuredSelector</code> missed a step in the spreading process, which has now been fixed.</p>
<h2>What's Changed</h2>
<ul>
<li>Switch package management to Yarn v3 by <a href="https://github.com/markerikson"><code>@​markerikson</code></a> in <a href="https://github-redirect.dependabot.com/reduxjs/reselect/pull/551">reduxjs/reselect#551</a></li>
<li>Fix parameter expansion and improve OutputSelector readability by <a href="https://github.com/markerikson"><code>@​markerikson</code></a> in <a href="https://github-redirect.dependabot.com/reduxjs/reselect/pull/552">reduxjs/reselect#552</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/reduxjs/reselect/compare/v4.1.3...v4.1.4">https://github.com/reduxjs/reselect/compare/v4.1.3...v4.1.4</a></p>
<h2>v4.1.3</h2>
<p>This release rewrites the TS type inference of input selector parameters for correctness, fixes inference of <code>createStructuredSelector</code> inputs, and fixes an issue with the <code>OutputSelectorFields</code> type not being exported.</p>
<h2>Changelog</h2>
<h3>Input Selector Parameter Inference Improvements</h3>
<p>Reselect's types have always been extremely tricky, because it involves passing multiple input selectors with potentially heterogeneous, and then nested function composition of multiple selectors.  Additionally, the input selectors can be passed as individual arguments or a single array of input selectors.</p>
<p>The <a href="https://github.com/reduxjs/reselect/blob/v4.0.0/src/index.d.ts">4.0.0 typedefs</a> dealt with this by hand-writing dozens of overloads, which was absolutely impossible to maintain.</p>
<p>In 4.1, we took advantage of TS's improved abilities to infer array/tuple types to consolidate the typedefs.</p>
<p>One of the issues that happened as a result was that arguments at the same input parameter index were being &quot;unioned&quot; together, rather than &quot;intersectioned&quot;.  For example, in this complex selector:</p>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/reduxjs/reselect/blob/master/CHANGELOG.md">reselect's changelog</a>.</em></p>
<blockquote>
<h1>Change log</h1>
<p>All notable changes to this project will be documented in this file.
This project adheres to <a href="http://semver.org/">Semantic Versioning</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="2f892bb92e"><code>2f892bb</code></a> 4.1.5</li>
<li><a href="901dab0a56"><code>901dab0</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/reduxjs/reselect/issues/557">https://github.com/facebook/flipper/issues/557</a> from reduxjs/feature/csf-export</li>
<li><a href="9f5998e727"><code>9f5998e</code></a> Include 4.5 in the TS test matrix</li>
<li><a href="ad1eb084af"><code>ad1eb08</code></a> Export CreateSelectorFunction to fix createStructuredSelector usage</li>
<li><a href="71e6cb6bce"><code>71e6cb6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/reduxjs/reselect/issues/556">https://github.com/facebook/flipper/issues/556</a> from reduxjs/feature/param-undefined-intersections</li>
<li><a href="8b920d58ab"><code>8b920d5</code></a> Remove leftover TODO typetest comments and fix Selector usage</li>
<li><a href="0f4e2d249d"><code>0f4e2d2</code></a> Update param inference to handle undefined and unions correctly</li>
<li><a href="d7131c0fb3"><code>d7131c0</code></a> 4.1.4</li>
<li><a href="42b63810fb"><code>42b6381</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/reduxjs/reselect/issues/552">https://github.com/facebook/flipper/issues/552</a> from reduxjs/feature/413-ts-checks</li>
<li><a href="7ed20fc036"><code>7ed20fc</code></a> Fix issues with createStructuredSelector parameters</li>
<li>Additional commits viewable in <a href="https://github.com/reduxjs/reselect/compare/v4.0.0...v4.1.5">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~acemarke">acemarke</a>, a new releaser for reselect since your current version.</p>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=reselect&package-manager=npm_and_yarn&previous-version=4.0.0&new-version=4.1.5)](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/3111

Reviewed By: jknoxville

Differential Revision: D32698523

Pulled By: passy

fbshipit-source-id: 0272e28e796e04ed5df604d63307bacaaab35229
2021-11-30 23:11:39 -08:00
dependabot[bot]
4df4af0fb1 Bump open from 8.3.0 to 8.4.0 in /desktop (#3110)
Summary:
Bumps [open](https://github.com/sindresorhus/open) from 8.3.0 to 8.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/sindresorhus/open/releases">open's releases</a>.</em></p>
<blockquote>
<h2>v8.4.0</h2>
<ul>
<li>Improve ArchLinux support (<a href="https://github-redirect.dependabot.com/sindresorhus/open/issues/265">https://github.com/facebook/flipper/issues/265</a>)  b58fb1f</li>
</ul>
<p><a href="https://github.com/sindresorhus/open/compare/v8.3.0...v8.4.0">https://github.com/sindresorhus/open/compare/v8.3.0...v8.4.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="7579417bbd"><code>7579417</code></a> 8.4.0</li>
<li><a href="b58fb1fb74"><code>b58fb1f</code></a> Improve ArchLinux support (<a href="https://github-redirect.dependabot.com/sindresorhus/open/issues/265">https://github.com/facebook/flipper/issues/265</a>)</li>
<li>See full diff in <a href="https://github.com/sindresorhus/open/compare/v8.3.0...v8.4.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=open&package-manager=npm_and_yarn&previous-version=8.3.0&new-version=8.4.0)](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/3110

Reviewed By: jknoxville

Differential Revision: D32698526

Pulled By: passy

fbshipit-source-id: 1e5421eb9b73b3d8c083562568cc8c0c0f1c64f8
2021-11-30 05:35:48 -08:00
Andrey Goncharov
225a2a7e34 Refactor Stella plugin
Summary:
1. Replace old FileSelector with the new FileSelector
2. Remove showOpenDialog from FlipperLib

Reviewed By: mweststrate

Differential Revision: D32667103

fbshipit-source-id: be8da034c2695f83b397b6c7d35bc6aee78d66e5
2021-11-26 08:30:13 -08:00
Andrey Goncharov
3491926d17 Support importing multiple files and encoding
Summary:
1. Support importing multiple files
2. Support file encoding

Reviewed By: mweststrate

Differential Revision: D32540132

fbshipit-source-id: 7c2a96ac585f58d01457cb487527940e333da615
2021-11-26 08:30:13 -08:00
John Knox
2d948fe4f4 Dedupe server error notifications
Summary:
These notifications, when emit, don't get deduped, so if connection timeouts keep happening, like in [this](https://fb.workplace.com/groups/flippersupport/posts/1257144721432850), then you get tons of notifications.

This dedupes them if all the info is the same.

Reviewed By: mweststrate

Differential Revision: D32560073

fbshipit-source-id: beb4d67e2a97841bb91add7847157176dee4a5f4
2021-11-19 06:56:47 -08:00
Michel Weststrate
52fca0859e Fix debug output in unit tests
Summary:
unit tests for deeplinks were logging full device / client objects instances, changed it to log the meta data only (description resp. query).

Since Jest buffers console output, this might even help test stability

Maybe console.debug shouldn't even be printed in Jest? See next diff

Reviewed By: passy

Differential Revision: D32557412

fbshipit-source-id: ff7fbf0cb5d8684d5333a62dac02fd5a59a6e358
2021-11-19 04:01:02 -08:00
Michel Weststrate
35c482ac92 Fix emotion cache output garbage in unit tests
Summary:
emotion/cache started generating nonsense warnings about SSR again when running unit tests. This is because atm emotion/cache is 3(!) times in our dep tree, and the wrong one got patched. Tried to dedupe that, but it seems inevitable:

- emotion/react requires v. 11.6.0 of it
- emotion/css requires v. 11.5.0 because a newer version of that package hasn't been released
- console-feed still uses emotion 10.

So instead, just added an other patch

Reviewed By: passy

Differential Revision: D32557413

fbshipit-source-id: 8a61a8065d21123453b3345b25ff87a9865094ed
2021-11-19 04:01:02 -08:00
John Knox
8af1e816bc Fix client-switching bug
Summary:
When a new client connects, we dispatch the NEW_CLIENT event.

The reducer of this event contains logic for determining if flipper should switch to display the newly connected client or not, and if so, it will dispatch SELECT_CLIENT.

For that reason, flipperServer always dispatching SELECT_CLIENT bypasses the "should switch?" logic and always switches whenever a new client connects. This is disruptive to working and not desired.

Removing this dispatch so that we rely on the NEW_CLIENT reducer to decide.

Bug report: https://fb.workplace.com/groups/flippersupport/posts/1255964631550859

Reviewed By: aigoncharov

Differential Revision: D32532942

fbshipit-source-id: 0ff2693745e37378362254053ae5fd6fc0d11de2
2021-11-19 03:36:51 -08:00
Andrey Goncharov
a279b9bc43 Remove fs.readFile from some plugins
Summary:
1. Remove fs.readFile from some plugins
2. Add "importFile" to FlipperLib and RenderHost

See D32492149 for context

Followups:

1. Decapitate Stella's sendToPhone
2. Decapitate crash reporter
3. Figure out how to approach navigation
4. Figure out how to approach FileSelector

Reviewed By: mweststrate

Differential Revision: D32496775

fbshipit-source-id: e150aa56a2c2c1eb12a4c03c801f76cd76485a9d
2021-11-18 09:15:30 -08:00
Andrey Goncharov
2c7bc0a952 Remove fs.write from plugins
Summary:
1. Remove "fs.writeFile" from plugins
2. Remove "showSaveDialog" from "FlipperLib"
3. Add "exportFile" to "FlipperLib" and "RenderHost"

As we are going to use Flipper in a browser as well, instead of providing low-level abstraction like "showSaveDialog", we should provide more high-level ones like "exportFile". In browsers it does not make too much sense to expose "showSaveDialog" as there is not way to use the returned file path to write to it.
In the end, "exportFile" is going to trigger a file download for browsers and show the save dialog and write to the returned file path for Electron.

Reviewed By: mweststrate

Differential Revision: D32492149

fbshipit-source-id: 0673119bdb7670a5872f5982c7d82dfc44eb7906
2021-11-18 09:15:30 -08:00
dependabot[bot]
32a58f0fec Bump redux from 4.1.1 to 4.1.2 in /desktop (#3057)
Summary:
Bumps [redux](https://github.com/reduxjs/redux) from 4.1.1 to 4.1.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/reduxjs/redux/releases">redux's releases</a>.</em></p>
<blockquote>
<h2>v4.1.2</h2>
<p>This release fixes a small specific TS types issue where state types that had a nested <code>unknown</code> field inside would cause compilation failures when used as the <code>preloadedState</code> argument.</p>
<h2>What's Changed</h2>
<ul>
<li>Fix preloaded state type by <a href="https://github.com/phryneas"><code>@​phryneas</code></a> in <a href="https://github-redirect.dependabot.com/reduxjs/redux/pull/4078">reduxjs/redux#4078</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/reduxjs/redux/compare/v4.1.1...v4.1.2">https://github.com/reduxjs/redux/compare/v4.1.1...v4.1.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="795a11c823"><code>795a11c</code></a> 4.1.2</li>
<li><a href="a03a79bc9e"><code>a03a79b</code></a> Merge commit '4d0730e9df2b23e88a588ba7f82f45ee7a642817' into 4.x</li>
<li><a href="ef5e57ea62"><code>ef5e57e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/reduxjs/redux/issues/4078">#4078</a> from phryneas/fix-preloadedState</li>
<li><a href="cf2f265574"><code>cf2f265</code></a> Apply kindOf fix from <a href="https://github-redirect.dependabot.com/reduxjs/redux/issues/4160">#4160</a></li>
<li><a href="9ab0a70012"><code>9ab0a70</code></a> Update test/typescript/store.ts</li>
<li><a href="83af794b06"><code>83af794</code></a> small fix to PreloadedState</li>
<li>See full diff in <a href="https://github.com/reduxjs/redux/compare/v4.1.1...v4.1.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=redux&package-manager=npm_and_yarn&previous-version=4.1.1&new-version=4.1.2)](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/3057

Reviewed By: mweststrate

Differential Revision: D32529287

Pulled By: passy

fbshipit-source-id: 5fe0c0c4e9b71f912b0e2d024465b0bdca9af303
2021-11-18 06:22:40 -08:00
Pascal Hartig
c0a0fa5dd8 Bump deps
Summary: Preempting dependabot by bumping a few patch and minor releases.

Reviewed By: timur-valiev

Differential Revision: D32434931

fbshipit-source-id: 77a3ec760f08262a118e12318d7601e031730a9a
2021-11-16 10:33:14 -08:00
Michel Weststrate
7e50c0466a Move app/src (mostly) to flipper-ui-core/src
Summary:
This diff moves all UI code from app/src to app/flipper-ui-core. That is now slightly too much (e.g. node deps are not removed yet), but from here it should be easier to move things out again, as I don't want this diff to be open for too long to avoid too much merge conflicts.

* But at least flipper-ui-core is Electron free :)
* Killed all cross module imports as well, as they where now even more in the way
* Some unit test needed some changes, most not too big (but emotion hashes got renumbered in the snapshots, feel free to ignore that)
* Found some files that were actually meaningless (tsconfig in plugins, WatchTools files, that start generating compile errors, removed those

Follow up work:
* make flipper-ui-core configurable, and wire up flipper-server-core in Electron instead of here
* remove node deps (aigoncharov)
* figure out correct place to load GKs, plugins, make intern requests etc., and move to the correct module
* clean up deps

Reviewed By: aigoncharov

Differential Revision: D32427722

fbshipit-source-id: 14fe92e1ceb15b9dcf7bece367c8ab92df927a70
2021-11-16 05:29:21 -08:00
Michel Weststrate
c3ff0ff355 Set up Flipper decapitated packages
Summary:
This diff introduces the packages necessary for Flipper decapitated.

* flipper-common: utilities & types shared between client, server, flipper-plugin
* flipper-server-core: all device & client management goes in here. Basically flipper's backend
* flipper-ui-core: all UI goes in here, as far as it doesn't depend on Electron
* desktop: the Electron app, will load server-core and ui-core, and glue them together, providing implementations for some electron specific stuff like dialgos
* flipper-server: A node process hosting flipper-server-core, that can be connected to over websockets. And probably can serve a browser version of the UI as well.
* flipper-ui-browser: thin wrapper around flipper-ui-core, providing some browser specific behavior / stubs.
* flipper-dump: (might remove later), but want to hack a quick and dirt flipper dump in here, as alternative way to test flipper-server-core.

This diff just creates the packages, but doesn't move any code, so it can be summarized as:

restoftheowl

Reviewed By: nikoant

Differential Revision: D30218646

fbshipit-source-id: 735598a1261a98e584f52504b5eba01ec0afa162
2021-10-08 01:33:03 -07:00