Summary: Flipper server itself requires no babel transforms. We applied extra transforms only for the bundled plugins. However, we pack and ship all plugins in the /static folder. They are always available on the FS. Therefore we could stop bundling any plugins into flipper-server's source code.
Reviewed By: lblasa
Differential Revision: D38910251
fbshipit-source-id: b3e9fe5ae2ab69ce5579b01b6793ebf7e88baf66
Summary:
flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle.
As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8.
Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs
Reviewed By: lblasa
Differential Revision: D38658285
fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
Summary:
^
There may be cases whereas the process exits but leaks the socket descriptors.
There's already a hook to close flipper-server.
Reviewed By: passy
Differential Revision: D37550940
fbshipit-source-id: 35004969834bb92bb7cf0f56bda8d7b43c11d6bf
Summary:
CHANGELOG: Rotate flipper-server logs
Otherwise, they re going to eat up all space eventually in a one monstrous file
Reviewed By: passy
Differential Revision: D37516868
fbshipit-source-id: 478a61c56ec007e4a3d695f7e6df2a61cb33c33a
Summary:
Provide an option to enable/disable TCP connections on flipper-server.
The only change at this stage is that Flipper Desktop will use UDS to connect to flipper-server.
Reviewed By: passy
Differential Revision: D37519656
fbshipit-source-id: 3d02084666fde532ec76134edf8cf6a231060a48
Summary: CHANGELOG: Open Flipper Server at /
Reviewed By: lawrencelomax
Differential Revision: D37517406
fbshipit-source-id: 71043c3df75d9436020da477c937795671fa15a9
Summary:
^
This is an effort to capture and log these errors as to gain visibility when failures occur.
Reviewed By: passy
Differential Revision: D37412861
fbshipit-source-id: 09687a31797aac4c377aa98944ab0701bdf45466
Summary:
There's one setting: to enable or disable flipper-server.
However, I've added some current running state to it. If there's a better way of doing this, please do let me know.
Reviewed By: aigoncharov
Differential Revision: D37276670
fbshipit-source-id: f6c941cf0cfe55c267b9bcb9f799934fba1e28ef
Summary:
This change attaches our event handlers as soon as the ws is created.
As a consequence, we need to wait until the server has created any necessary instances required to process incoming requests.
To achieve this, I created a type called `Lazy`.
This type wraps around a value and a promise to that value. Callers can check if the value is set. If not, callers can wait for it.
Ultimately, the value can be set outside of the promise itself.
Reviewed By: passy
Differential Revision: D37284939
fbshipit-source-id: 17dec548d7155a3d65440c9584cec07cbb826c37
Summary:
This changes moves most of the functionality found in flipper-server to flipper-server-core.
flipper-server will mostly be a package that wraps around flipper-server-core. Staying in flipper-server:
- Command line args
- Orchestration to start the necessary servers
Reviewed By: aigoncharov
Differential Revision: D36807087
fbshipit-source-id: f29002c7cc5d08b8c5184fdaaa02ba22562a9f45
Summary:
This change extracts logging logic out from startFlipperServer.
Logs will also be written to disk.
Reviewed By: passy
Differential Revision: D36473768
fbshipit-source-id: b1df9df79b4aced0d3ba2e8c243aa8d44cf83703
Summary:
These are utility methods that are not specific to startServer.
They will be reused by other components needing to check if something is listening to a port.
Make socket path is also extracted.
Reviewed By: passy
Differential Revision: D36473641
fbshipit-source-id: 73ed67912052896696b59670cb757d22761eeaa1
Summary: Allows to attribute errors to flipper server or flipper electron
Reviewed By: passy
Differential Revision: D36698504
fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
Summary:
^
flipper-server verifies the origin of incoming connections as a way of preventing any host from connecting to flipper.
That's good.
This change expand the list of allowed origins to include localhost:3000 which is the default origin for Electron apps.
Error without this change:
```
Refused socket connection from cross domain request, origin: http://localhost:3000, host: localhost:52342. Expected origins: http://localhost:52342 or http://[::1]:52342 or http://::1:52342. Expected hosts: localhost:52342 or [::1]:52342 or ::1:52342
```
Reviewed By: passy
Differential Revision: D36440363
fbshipit-source-id: 883cadb49f245bca5d0a53a4f58c08cf45dd0189
Summary:
Currently, Flipper Server has a few productions dependencies (mac-ca, node-fetch) that are not bundled with the Flipper Server. It makes it harder to distribute Flipper Server, as now all potential consumers need not only to download the bundle, but also install these additional dependencies.
This diff makes it possible to bundle `mac-ca` and `node-fetch` with Flipper Server. As a result, Flipper Server becomes dependency-free in production.
Reviewed By: lblasa
Differential Revision: D36345213
fbshipit-source-id: 2cd6ba1b3301b45dc2295891964ba020fd107586
Summary:
Same as with the previous diff.
The function doesn't really start a server. Instead it attaches the routing of messages from the existing server into FlipperServer.
Reviewed By: passy
Differential Revision: D36310703
fbshipit-source-id: 7ac9a742fb36c3806597382c9aadcf96f4770484
Summary:
^
Instead of 'start' use 'attach' as it seems closer to what the function actually does.
Reviewed By: passy
Differential Revision: D36310846
fbshipit-source-id: db90efc6ec3207b1a5a38139a3ba01d2f7d2aebd
Summary:
^
BaseServer doesn't really have any meaning. So, change it to just Server as it really creates the Express app and HTTP server attached to it.
Reviewed By: passy
Differential Revision: D36310822
fbshipit-source-id: eee5a2a395ca726679c1c4756ed58d4bc6be3cb8
Summary:
Rename 'startWebServerDev' to just 'startDevServer'.
It isn't really starting a web server though, more like installing routings and middleware to the existing created server.
Reviewed By: passy
Differential Revision: D36310765
fbshipit-source-id: 0af772012525fd7ad19e2aa6fa73cb3e7dcf2bef
Summary: Slight changes to the URL and port logging.
Reviewed By: passy
Differential Revision: D36310796
fbshipit-source-id: 553b9ce932792c471f8e0e2c1a0c7d79897ad59d
Summary: These safeguards were added based on a discussion in D35088208 (56e94394ca) but turned out to be counter-productive. Every time a client disconnects now, we're tearing down the socket and the server, allowing for no future connections.
Reviewed By: lblasa
Differential Revision: D36252605
fbshipit-source-id: c3b6f85dea4054505a47d24a72a4aac403371c0f
Summary: Start flipper-server-companion whenever a client connects to flipper-server and sets `server_companion` query parameter in a connection URL to true
Reviewed By: mweststrate
Differential Revision: D36098169
fbshipit-source-id: eb953e7d680b30aef1340f059264112387264c05
Summary: Taking care of the remaining dependabot tasks In my queue.
Reviewed By: mweststrate
Differential Revision: D36131782
fbshipit-source-id: f8a5ce18bfab7c5d50a88d64f9516d67bba4bd6d
Summary: Bunch of dependabot PRs showed that the signal is green, but still wanted to have all in one diff.
Reviewed By: aigoncharov
Differential Revision: D36102480
fbshipit-source-id: 88d472fdc2a910a7441a9e8164fe8af0f2d90f7b
Summary: Caused some inconsistencies when running `tsc`. This brings them back in line.
Reviewed By: aigoncharov
Differential Revision: D36101548
fbshipit-source-id: b8f757c59f879911c9b0920fe11396246ffa37e2
Summary:
Before:
```
flipper-server/src/startBaseServer.tsx(222,30): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
flipper-ui-browser/src/flipperServerConnection.tsx(25,9): error TS2322: Type 'Timeout' is not assignable to type 'number'.
```
Reviewed By: nikoant
Differential Revision: D36100188
fbshipit-source-id: 1913a43109a0e068394a188d362f6a9e473e7904
Summary: Be more aggressive in cleaning up after ourselves. Using a tiny library by Sindre that handles standard exit events, SIGTERM and SIGINT.
Reviewed By: aigoncharov
Differential Revision: D35281772
fbshipit-source-id: a789f90f172b3aa3e187739cf2b7fefa75405891
Summary: lawrencelomax helpfully pointed out that there's a legacy limit for the path length of unix domain sockets. Checking here and falling back to `/tmp` in case we're going over. This could have caused some gnarly support issues, so I'm glad we caught this before it went live.
Reviewed By: aigoncharov
Differential Revision: D35257794
fbshipit-source-id: 68a7b62d6d6863efa4b3ce84d7735b1c1a45a174
Summary: Instead of just deleting, we first check if it's already in use. The behaviour in case it *is* in use, is not great but mirrors what happens when the port is occupied.
Reviewed By: aigoncharov
Differential Revision: D35188965
fbshipit-source-id: 9bb5a7a9bacec6987ea72bbd084e40d5b30f9796
Summary: Open a domain socket by default and proxy all browser requests via TCP to it. That allows us to connect to a running server regardless of its local port.
Reviewed By: aigoncharov
Differential Revision: D35088208
fbshipit-source-id: d167852162e63f68c804c379b4421f5cc0d33df2
Summary: Add a simple endpoint to the server to check if it's up and running.
Reviewed By: aigoncharov
Differential Revision: D35087344
fbshipit-source-id: ec490fdb11042e7a7e4b9b944b018c4c9853ed49
Summary:
Another kind of error that can easily be triggered during testing that will kill the server otherwise.
Changelog: Make it possible to recover from malformed JSON in server requests
Reviewed By: timur-valiev
Differential Revision: D34932896
fbshipit-source-id: 7c6acfd53ffbd85a54a786d74c99bcccb64d85cb
Summary: Following up on D34787674 (f85def32fb).
Reviewed By: aigoncharov
Differential Revision: D34930249
fbshipit-source-id: f209a638c1281957fd2b03b6fc50389bd98bc5f6
Summary:
There appears to be an issue with login on M1 Macs right now. To address this, this resolves the native binary based on a `(platform, arch)` tuple.
The binaries are from here: https://github.com/atom/node-keytar/releases/tag/v7.9.0
The binary size increase here is notable so as a follow-up we could remove the non-relevant binaries as part of the packing process.
Reviewed By: aigoncharov
Differential Revision: D34685236
fbshipit-source-id: d860a59517a769a59055dfca24d01baecd8d1430
Summary: Socket.io-client sends the host as ::1 instead of [::1] when using IPV6 to communicate with Flipper, that is the reason the communication was always being refused.
Reviewed By: mweststrate
Differential Revision: D34679825
fbshipit-source-id: b7431ad23f743276c11619d7cdb5c83594dee43a
Summary:
Combining a bunch of dependabot PRs.
N.B. I had to manually clean up the `yarn.lock` a few times because some dependencies resolved to multiple version numbers, catching tsc off-guard.
allow-large-files
Reviewed By: nikoant
Differential Revision: D34579180
fbshipit-source-id: a4848e1010ff240d9b0e721d3878585e7b4bd078
Summary: Add support for binding the same port in flipper in both the IPv6 and IPv4 interfaces
Reviewed By: mweststrate
Differential Revision: D34591022
fbshipit-source-id: e28239c24425885ee442d93b84bb38902d521a0c
Summary: This change gives priority to a user option settingsString to set up the flipper-server configuration and load them from a json string. Also giving the user the chance to avoid flipper-server looking at the launcher config files in the computer
Reviewed By: mweststrate
Differential Revision: D34210110
fbshipit-source-id: 9e852b79da106b5140c59116fd7d0c0f3155e620
Summary:
Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.17.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/expressjs/express/releases">express's releases</a>.</em></p>
<blockquote>
<h2>4.17.2</h2>
<ul>
<li>Fix handling of <code>undefined</code> in <code>res.jsonp</code></li>
<li>Fix handling of <code>undefined</code> when <code>"json escape"</code> is enabled</li>
<li>Fix incorrect middleware execution with unanchored <code>RegExp</code>s</li>
<li>Fix <code>res.jsonp(obj, status)</code> deprecation message</li>
<li>Fix typo in <code>res.is</code> JSDoc</li>
<li>deps: body-parser@1.19.1
<ul>
<li>deps: bytes@3.1.1</li>
<li>deps: http-errors@1.8.1</li>
<li>deps: qs@6.9.6</li>
<li>deps: raw-body@2.4.2</li>
<li>deps: safe-buffer@5.2.1</li>
<li>deps: type-is@~1.6.18</li>
</ul>
</li>
<li>deps: content-disposition@0.5.4
<ul>
<li>deps: safe-buffer@5.2.1</li>
</ul>
</li>
<li>deps: cookie@0.4.1
<ul>
<li>Fix <code>maxAge</code> option to reject invalid values</li>
</ul>
</li>
<li>deps: proxy-addr@~2.0.7
<ul>
<li>Use <code>req.socket</code> over deprecated <code>req.connection</code></li>
<li>deps: forwarded@0.2.0</li>
<li>deps: ipaddr.js@1.9.1</li>
</ul>
</li>
<li>deps: qs@6.9.6</li>
<li>deps: safe-buffer@5.2.1</li>
<li>deps: send@0.17.2
<ul>
<li>deps: http-errors@1.8.1</li>
<li>deps: ms@2.1.3</li>
<li>pref: ignore empty http tokens</li>
</ul>
</li>
<li>deps: serve-static@1.14.2
<ul>
<li>deps: send@0.17.2</li>
</ul>
</li>
<li>deps: setprototypeof@1.2.0</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/expressjs/express/blob/master/History.md">express's changelog</a>.</em></p>
<blockquote>
<h1>4.17.2 / 2021-12-16</h1>
<ul>
<li>Fix handling of <code>undefined</code> in <code>res.jsonp</code></li>
<li>Fix handling of <code>undefined</code> when <code>"json escape"</code> is enabled</li>
<li>Fix incorrect middleware execution with unanchored <code>RegExp</code>s</li>
<li>Fix <code>res.jsonp(obj, status)</code> deprecation message</li>
<li>Fix typo in <code>res.is</code> JSDoc</li>
<li>deps: body-parser@1.19.1
<ul>
<li>deps: bytes@3.1.1</li>
<li>deps: http-errors@1.8.1</li>
<li>deps: qs@6.9.6</li>
<li>deps: raw-body@2.4.2</li>
<li>deps: safe-buffer@5.2.1</li>
<li>deps: type-is@~1.6.18</li>
</ul>
</li>
<li>deps: content-disposition@0.5.4
<ul>
<li>deps: safe-buffer@5.2.1</li>
</ul>
</li>
<li>deps: cookie@0.4.1
<ul>
<li>Fix <code>maxAge</code> option to reject invalid values</li>
</ul>
</li>
<li>deps: proxy-addr@~2.0.7
<ul>
<li>Use <code>req.socket</code> over deprecated <code>req.connection</code></li>
<li>deps: forwarded@0.2.0</li>
<li>deps: ipaddr.js@1.9.1</li>
</ul>
</li>
<li>deps: qs@6.9.6</li>
<li>deps: safe-buffer@5.2.1</li>
<li>deps: send@0.17.2
<ul>
<li>deps: http-errors@1.8.1</li>
<li>deps: ms@2.1.3</li>
<li>pref: ignore empty http tokens</li>
</ul>
</li>
<li>deps: serve-static@1.14.2
<ul>
<li>deps: send@0.17.2</li>
</ul>
</li>
<li>deps: setprototypeof@1.2.0</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="ea537d907d"><code>ea537d9</code></a> 4.17.2</li>
<li><a href="eee93a2760"><code>eee93a2</code></a> build: update example dependencies</li>
<li><a href="b35773cf19"><code>b35773c</code></a> build: eslint@7.32.0</li>
<li><a href="c8a42006b8"><code>c8a4200</code></a> build: mocha@9.1.3</li>
<li><a href="21cf522dcd"><code>21cf522</code></a> examples: improve 404 message wording</li>
<li><a href="a24f27aba7"><code>a24f27a</code></a> deps: serve-static@1.14.2</li>
<li><a href="a33266a206"><code>a33266a</code></a> build: support Node.js 14.x</li>
<li><a href="6fe271e8aa"><code>6fe271e</code></a> build: support Node.js 13.x</li>
<li><a href="cbe25d66b3"><code>cbe25d6</code></a> deps: setprototypeof@1.2.0</li>
<li><a href="3bb6d96ba9"><code>3bb6d96</code></a> examples: demonstrate sub directory download</li>
<li>Additional commits viewable in <a href="https://github.com/expressjs/express/compare/4.17.1...4.17.2">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/3257
Reviewed By: antonk52
Differential Revision: D33511820
Pulled By: passy
fbshipit-source-id: 2f63202fb75cad2645d12387ce1238cb1cd2d502