Summary:
There's no need for us to have a property that can be undefined, since we can use the magic of *passing arguments* to achieve the same end result.
The unit test a bit more precarious, but it's left here for posterity or until we decide to kill it otherwise.
Reviewed By: passy
Differential Revision: D33892407
fbshipit-source-id: 3b499511189862e2265d8d6d29f849a7b813050e
Summary:
Bulding on the work from prior diffs we can use the created bridge directly. No need to have if statements calling out to sub-functions, just use the base type itself which will use the appropriate implementation.
There's no behavioural change here. Either idb was queried for sims/devices or simctl was queried for just sims, they were always mutually exclusive.
Reviewed By: passy
Differential Revision: D33842604
fbshipit-source-id: 0bf63ffc34368c70df31c105ea0ba5df941e72cc
Summary:
We perform this *repeatedly* (every 2s!!!). Which is clearly excessive.
Let's perform this check once to avoid noise and a waste of system resources
Reviewed By: passy
Differential Revision: D33844194
fbshipit-source-id: 226dc9d67bb83b167afa8e28ade8e1911470ef8a
Summary:
This runs in a very hot loop (which I will change shortly)
However, there's also some simplification that we can do here:
- Only look for `Simulator.app` processes instead of all the processes. This limits the amount of string comparison to do. If there's a `Simulator.app` running, then we know a sim is running for that Xcode.
- Use piping to extract the launch path of the process, instead of then regex'ing this out.
- Use a simpler substring match to determine if paths have a different start.
Reviewed By: passy
Differential Revision: D33891296
fbshipit-source-id: e37d5f260fc6c6113be9c5268b7c8cffb4057b9a
Summary:
Again this is just a code move for now.
However, we now have a common method between simctl and idb cases. This means that the next diff can call an `IOSBridge` with polymorpism taking over. This is still delegated out, but there's an argument to be made to move `iosUtil` functionality back so that this all lives in the same place.
Reviewed By: passy
Differential Revision: D33843093
fbshipit-source-id: 5cd884140817df851cccf63e5780582b16d4231c
Summary:
Extracts `getSimulator` interrnals to `SimctlBridge`. This allows this functionality to be used independently of things like the the flipper server.
For now this just moves the functionality, but future diffs will build on top of this.
Reviewed By: passy
Differential Revision: D33842986
fbshipit-source-id: bae26a9bd5c21c9813f8a2b10c3b3e3efc1c5929
Summary:
This is related to `simctl` functionality, so can be extracted there.
This will aid in future changes whereby we can hide `getDeviceSetPath` in the IOSBridge module
Reviewed By: passy
Differential Revision: D33842987
fbshipit-source-id: de292ce5afba3e7d79d8ba27c2b8852909d7e6f3
Summary:
We pass the `idbPath` to only the log listener function, when in reality it should be used by all of these functions that call out to idb.
This could result in some bizzare inconsistencies where some idb functions to fail as they are not using the supplied path
Reviewed By: passy
Differential Revision: D33818298
fbshipit-source-id: f0fb7f26579c646a0d5265364d539dfded711c2e
Summary: This allows us to change the way that the command is itself exec'd (for instance to change the idb exec'ing in D33818298)
Reviewed By: passy
Differential Revision: D33818822
fbshipit-source-id: c90b7e58c7476f5db08da0e74e9791230ff97f6f
Summary: Similar to D33818267, but for simctl. Brings logical ordering of methods as well as consistency
Reviewed By: passy
Differential Revision: D33818687
fbshipit-source-id: 3fbcea128d06c900b49b83ad583ec8a7a07cae2c
Summary:
This isn't that important right now, but will help as the `IOSBridge` is expanded in the future. There's also an argument for logical ordering of functions within a container (a class!), but that's not the real motivation here.
The existence of `bind` shows that this free function is effectively closing over this argument anyway.
Reviewed By: passy, lblasa
Differential Revision: D33818267
fbshipit-source-id: e7b83f013121cedbd31cb28746b69c1fa76a0803
Summary: CertificateProvider initializes too early, and set abd and idb to undefined, before adb and idb are initialized by android and ios manager.
Reviewed By: lawrencelomax
Differential Revision: D33792854
fbshipit-source-id: b6bba32dead7edf62e360b2e2563f2b67243b1b8
Summary:
Previously CertificateProvider initialized ADB and provided config to IDB. As result, AndroidDeviceManager and iOSDeviceManager indirectly depended on CertificateProvider.
With this diff we:
1. Make idbConfig resemble adbClient.
2. Make AndroidDeviceManager and iOSDeviceManager initialize their own clients
3. Fix server crash when one of the clients couldn't be initialized. The reason for the crash is CertificateProvider.prototype.init which is no longer needed.
Reviewed By: passy
Differential Revision: D33711652
fbshipit-source-id: 055b5625ed993827b65396f4af5157808479242b
Summary: Prior to this diff, an empty env var FLIPPER_BROWSER_PORT resulted in an error
Reviewed By: passy
Differential Revision: D33712720
fbshipit-source-id: 760fc92bbf44268ec428a3d2947735d5cf8567b7
Summary:
1. Remove GK.get('comet_enable_flipper_connection') which does not seem to be needed anymore
2. Support custom ports for the insecure connection flow
Reviewed By: lblasa
Differential Revision: D33632891
fbshipit-source-id: 045d6886ea94e15bff38f2f61c7d5a2c56c39859
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3240
Bumps [ws](https://github.com/websockets/ws) from 7.5.6 to 8.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/websockets/ws/releases">ws's releases</a>.</em></p>
<blockquote>
<h2>8.4.0</h2>
<h1>Features</h1>
<ul>
<li>Added ability to generate custom masking keys (<a href="https://github-redirect.dependabot.com/websockets/ws/issues/1990">https://github.com/facebook/flipper/issues/1990</a>).</li>
</ul>
<h2>8.3.0</h2>
<h1>Features</h1>
<ul>
<li>Added ability to pause and resume a <code>WebSocket</code> (0a8c7a9c).</li>
</ul>
<h1>Bug fixes</h1>
<ul>
<li>Fixed a bug that could prevent the connection from being closed cleanly when
using the stream API (ed2b8039).</li>
<li>When following redirects, an error is now emitted and not thrown if the
redirect URL is invalid (<a href="https://github-redirect.dependabot.com/websockets/ws/issues/1980">https://github.com/facebook/flipper/issues/1980</a>).</li>
</ul>
<h2>8.2.3</h2>
<h1>Bug fixes</h1>
<ul>
<li>When context takeover is enabled, messages are now compressed even if their size
is below the value of the <code>perMessageDeflate.threshold</code> option (41ae5631).</li>
</ul>
<h2>8.2.2</h2>
<h1>Bug fixes</h1>
<ul>
<li>Some closing operations are now run only if needed (ec9377ca).</li>
</ul>
<h2>8.2.1</h2>
<h1>Bug fixes</h1>
<ul>
<li>Fixed an issue where the socket was not resumed, preventing the connection
from being closed cleanly (869c9892).</li>
</ul>
<h2>8.2.0</h2>
<h1>Features</h1>
<ul>
<li>Added <code>WebSocket.WebSocket</code> as an alias for <code>WebSocket</code> and
<code>WebSocket.WebSocketServer</code> as an alias for <code>WebSocket.Server</code> to fix name
consistency and improve interoperability with the ES module wrapper (<a href="https://github-redirect.dependabot.com/websockets/ws/issues/1935">https://github.com/facebook/flipper/issues/1935</a>).</li>
</ul>
<h2>8.1.0</h2>
<h1>Features</h1>
<ul>
<li>Added ability to skip UTF-8 validation (<a href="https://github-redirect.dependabot.com/websockets/ws/issues/1928">https://github.com/facebook/flipper/issues/1928</a>).</li>
</ul>
<h1>Bug fixes</h1>
<ul>
<li>Fixed an issue with a breaking change in Node.js master (6a72da3e).</li>
<li>Fixed a misleading error message (c95e695d).</li>
</ul>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="00c34d726d"><code>00c34d7</code></a> [dist] 8.4.0</li>
<li><a href="35d45c2a4f"><code>35d45c2</code></a> [perf] Skip masking and unmasking if the masking key is zero</li>
<li><a href="eb2e3a84a1"><code>eb2e3a8</code></a> [feature] Introduce the <code>generateMask</code> option</li>
<li><a href="c82b08737f"><code>c82b087</code></a> [dist] 8.3.0</li>
<li><a href="0a8c7a9c4f"><code>0a8c7a9</code></a> [api] Add <code>WebSocket#pause()</code> and <code>WebSocket#resume()</code></li>
<li><a href="ed2b803905"><code>ed2b803</code></a> [fix] Resume the socket in the <code>CLOSING</code> state</li>
<li><a href="b8186dd115"><code>b8186dd</code></a> [fix] Do not throw if the redirect URL is invalid (<a href="https://github-redirect.dependabot.com/websockets/ws/issues/1980">https://github.com/facebook/flipper/issues/1980</a>)</li>
<li><a href="5a905e49be"><code>5a905e4</code></a> [minor] Add missing label to the issue form</li>
<li><a href="89d81e8670"><code>89d81e8</code></a> [minor] Fix nit</li>
<li><a href="4916d03ad8"><code>4916d03</code></a> [minor] Allow to write frames with up to 2^48 - 1 bytes of data (<a href="https://github-redirect.dependabot.com/websockets/ws/issues/1973">https://github.com/facebook/flipper/issues/1973</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/websockets/ws/compare/7.5.6...8.4.0">compare view</a></li>
</ul>
</details>
<br />
[](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/3218
Reviewed By: antonk52, timur-valiev
Differential Revision: D33348279
Pulled By: nikoant
fbshipit-source-id: c245f53556e8f58ba1df619d3d0e106e8e5b1911
Summary:
This diff makes sure that errors are propagated similarly in flipper desktop and browser version, and that they are shown in either case.
Since in the browser version, the UI loads after the error happened, we'll store the error so that any client connecting in the future will read and report it.
Also added a `--failFast` flag to flipper-server, so that the process exits immediately if misconfigured, which is convenient in CI use cases and such
Reviewed By: nikoant
Differential Revision: D33348922
fbshipit-source-id: 0f584104f881141fde38da3f0031748415343ea2
Summary:
If openssl is not available, this would lead to an unhandled rejection exception. That is because a lot initialization logic generates promises that don't get a catch chained on immediately. Changed the flipper server startup flow to be more idiomatically async
Fixes https://github.com/facebook/flipper/issues/2766
Changelog: More clearly communicate if flipper server failed to start (e.d. due to port already taken, openssl not being available)
This change fixes it only for desktop flipper, will make sure the browser UI will support this as well (the error will fire correctly there, but there are no listeners during startup)
Reviewed By: nikoant
Differential Revision: D33348923
fbshipit-source-id: f561bb27b18a3041c514b37f7aed11435a49647f
Summary:
This refactors the flipper-server release script in such a way that it works the same as the normal release script, which solves two problems:
1) the official release script modifies versioned files, as it touches the package.json
2) it was slightly confusing that `flipper-server/static` was filled for release builds only, but not used in dev builds
3) running test:npx without running a release build before it, would fail with hard to comprehend errors. this has been solved now by removing that script and make it an arg of `build:flipper-server`
Also some further minor changes to prepare running a corresponding build / release job from SandCastle (later in this stack)
Reviewed By: nikoant
Differential Revision: D33297214
fbshipit-source-id: f6299aa982c3e59d1cc6479a93c56cbe4b57f85c
Summary:
This diff fixes several issues around loading plugin, such as:
* make suresource maps work in the flipper-server production build
* make sure default plugins are no symlinked, which wouldn't work anywhere else but on the the system where it was build
* support release channel param for flipper-server
Bundled flipper-server is now 42MB (with icons (see later diffs) and plugins
```
ll flipper-server-v0.0.0.tgz
-rw-r--r-- 1 mweststrate staff 42M 23 Dec 15:29 flipper-server-v0.0.0.tgz
```
Reviewed By: nikoant
Differential Revision: D33294677
fbshipit-source-id: 63538dc8127f883fee6a3608673ad11ce239b350
Summary: Make sure flipper-server is bundled in such a way that it is self-contained NPX-able. Also added some checks to make sure that dev dependencies don't accidentallly end up in in Flipper buidls
Reviewed By: nikoant
Differential Revision: D33190254
fbshipit-source-id: 443162e537d8ca9f956acac2d7bd52cbf0c92172
Summary:
Changelog: Work-around for missing `origin` header problem https://github.com/facebook/flipper/issues/3189; causing Metro to crash when Flipper tries to connect
Will follow up with separate fix in React Native itself as well
Reviewed By: nikoant
Differential Revision: D33276414
fbshipit-source-id: 34d1510262ac24172ac1c6660799bb755b0f1f11
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
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3188
Fixes failing typescript issue (probably case sensitivity thing, on windows it was complaining about `Metro` not being resolvable while we use `metro` everywhere). Put a `ts-ignore` on it, since the metro typings we use are empty anyway
Disabled a test that failed consistently on GH CI. Maybe timing or Node version issue?
Reviewed By: fabiomassimo
Differential Revision: D33191515
fbshipit-source-id: 18a143024824eeeafaffe4941df474591fb7b70a
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
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
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
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
Summary:
Changelog: Fixed issue where a missing ANDROID_SDK_ROOT env var made it impossible to launch emulators
Run into an issue where ANDROID_SDK_ROOT wasn't set for my user, causing Flipper not to be able to launch emulator, which was looked up from the path rather than using the flipper settings.
Fixes: https://github.com/facebook/flipper/issues/3119
Reviewed By: timur-valiev
Differential Revision: D33158280
fbshipit-source-id: ea5616b10265ed43f1012c58da081be275ff1d5b
Summary: During startup the socket connection would close a few times, among others because Scribe dumps 1.3 MB of data after startup, and the maximum payload of `socket.io` defaults to 1MB. This diff changes it to 100MB (the max size used by `ws` library). We know that we need at least > 10 MB, as that is what plugins like Network cap at.
Reviewed By: aigoncharov
Differential Revision: D33017653
fbshipit-source-id: 1233af6fbdc4b9eed42786ee418cfd6d43b2b433
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
Summary: Even with the `--no-bundled-plugins` flag, still a hundred plugins were loaded when running flipper-server
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D32987158
fbshipit-source-id: 19e51e7e5f8ec9e664eb48cf2f2b8936f2f5ed73
Summary: Run doctor checks remained pending when the socket disonnected during a check. This
Reviewed By: aigoncharov
Differential Revision: D32984539
fbshipit-source-id: 277005e78803afaaa220cc5ca7fdc9cca6254453
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
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
Summary:
Facenook:
Use downloadFile API in Mobile Builds plugin
Reviewed By: mweststrate
Differential Revision: D32922041
fbshipit-source-id: d554ed9287af3bda4329e87732ab4de67136c0d2
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