Summary: Get ahead of dependabot by bundling a few small bumps.
Reviewed By: nikoant
Differential Revision: D33739602
fbshipit-source-id: 1482c062493a4214da81cbf5daf408aa382fb0ac
Summary:
As mentioned in D33427938 (b05219d09c), we need to keep this way higher for now
as there's something strange going on with the assets endpoint.
Reviewed By: lblasa, mweststrate, aigoncharov
Differential Revision: D33565547
fbshipit-source-id: 6ce9e3371c9fa8f1bf74dd0fd5f3353d99dc2a58
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
Summary:
This diff fixes the issue where flipper-server didn't properly build when creating a release build, due to plugins being resolved from both source `desktop/plugins` and `desktop/static/defaultPlugins` folders.
The `desktop/plugins` folder should not be included in the build, but wasn't sure why not, as it isn't a problem for desktop release either?
Anyway solved it for now to unblock releasing by using bundled-plugins, which might actually be better anyway for a bunch of use cases of flipper-server (e.g. when installed to an OD). So I think this is fine for now.
It does increase the build to ~40 MB, which is still halve of our unbundled electron build.
Reviewed By: aigoncharov
Differential Revision: D33427938
fbshipit-source-id: c931c2d1bea1e04c7b1603a488dcb76a41488740
Summary: Build flipper-server as normal build job. Note that `--no-rebuild-plugins` is used to save a lot of time, and
Reviewed By: passy
Differential Revision: D33361569
fbshipit-source-id: 55e97f81dbcfa98901ddc21e2f35f4d1134c74ef
Summary: This diff fixes an issue where the `scripts` folder wasn't automatically type checked by TypeScript, and as a result `yarn flipper-server` was broken atm.
Reviewed By: nikoant
Differential Revision: D33348825
fbshipit-source-id: 059a834cacb881d45ae4b0933af3f1feabb90182
Summary: When packaging plugins into flipper-server package, we assume an idiomatic plugin structure, warn and skip if a plugin doesn't conform to it.
Reviewed By: antonk52
Differential Revision: D33308367
fbshipit-source-id: fd6d1dbc66739b0867034930579429e97d9e2bfa
Summary:
Improved `flipper:build-release` command with several options as suggested in earlier reviews. Flags added:
* `--npx` install using npx and start
* `--start` run directly from the build folder
* `--open` icmw previous two, spawn a browser
This should generally benefit developing from for example an on-demand server (although current socket access is currently only open to local host, so a port forward or remote entry point needs to be set up)
Reviewed By: antonk52
Differential Revision: D33308198
fbshipit-source-id: fb905647c8d9fbda9d3efc2bfdcbd4d03be84938
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:
Pull Request resolved: https://github.com/facebook/flipper/pull/3212
Fix a build error caused by missing types for metro-resolver. For some reason it triggers only on windows, but we don't have typings for those indeed.
Reviewed By: nikoant
Differential Revision: D33308474
fbshipit-source-id: 1bd4354ee3c4df54a0a8e65d890721dd9dbac013
Summary: Make sure icons are prefetched for flipper-server prod builds, like we do for electron, so that the user doesn't need an internet connection to see icons
Reviewed By: nikoant
Differential Revision: D33296389
fbshipit-source-id: bfa92d78d8d77030238e5cca10d7aa6dcfb88e8b
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:
This diff makes flipper-server stand-alone servable as a single package.
It basically works as follows:
- (default) plugins are build as usually into static folder
- static folder is copied into flipper-server/static (as far as relevant)
- `flipper-server/src/index.tsx` is bundled into `flipper-server/dist/index.js`
- `flipper-ui-browser/src/index.tsx` is bundled into `flipper-server/static/bundle.js`
If flipper-server is started without the `--bundler` config, the `bundle.js` will be served statically, rather than starting up the Metro bundler with all the typical transforms (in a distributed version of the package those all wouldn't resolve)
Things to be done in next diffs:
* make sure plugins actually load in the non bundled setup
* make sure flipper-server gets published properly
* make sure build is created as part of CI
At the end of this stack, running `npx flipper-server` on any machine should basically be a viable approach to get flipper up and running locally :)
Reviewed By: nikoant
Differential Revision: D33171107
fbshipit-source-id: 4af8ac2699467a0b55283fe084640482700744c2
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
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:
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:
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
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: 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: As a convenience, open the browser by default when starting up
Reviewed By: timur-valiev
Differential Revision: D32984536
fbshipit-source-id: 540abf594f2f2553880f587bcd7d4811ea36fe74
Summary: This diffs adds debugging support to flipper server, by adding VSCode config for it
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D32982874
fbshipit-source-id: 8e187ad05a05566a598db04b97e8b08e3de7e835
Summary:
The build process for the server was a simple ts-node that compiled all deps. However, that didn't do any source transformations we need, like replacing `fb-stubs` with `fb` in facebook builds.
This diff works out the dev build process to align more with how other parts of the code base is build, by starting metro to build and bundle the server (only the sources of flipper-server, flipper-server-core and other flipper packages are bundled, node-deps are left as is).
To achieve this, since metro doesn't have support for 'external' packages like any arbitrarily other bundler, we recycle the electronRequire work around that is used in the desktop app as well
Reviewed By: aigoncharov
Differential Revision: D32949677
fbshipit-source-id: 00d326bb17b68aece6fb43af98d0def13b335e74
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:
This diff splits Facebook management into a ui-core and electron part:
* Cleaned up code and introduces a uniform Icon type to describe a requested icon
* Computing icon urls is done in the ui-core
* Introduced a RenderHost hook that can transform the request icon into a different url, in this case, a url to load icons from disk in production builds
For the browser UI, the urls are currently no rewritten since we have only dev builds (which always used only FB urls already). We could do the same rewrite in the future and download the static assets during build time. But for now this means that in the browser implementation we depend on normal browser caching, with the biggest downside that icons might not appear if the user has no internet connections.
With this change we lost our last usage of staticPath computations in ui-core
Reviewed By: aigoncharov
Differential Revision: D32767426
fbshipit-source-id: d573b6a373e649c7dacd380cf63a50c2dbbd9e70
Summary: Introduced an API that converts a filepath, relatively to the `desktop/static/` folder in a url that can be resolved by the render environment. This will generate `file://` urls in Electron, and root relative `/` urls in browser envs
Reviewed By: aigoncharov
Differential Revision: D32767427
fbshipit-source-id: 378da7709bcb19449873358a8703b9c5a5809c57
Summary: This diff makes most stuff that is read from the `os` package, and version info etc available from the `serverConfig` object, so that flipper-ui-core no longer needs the `os` package.
Reviewed By: passy
Differential Revision: D32694848
fbshipit-source-id: 93af1e95d898da9aaf351a6970b5a7652ee835c8
Summary: This diff makes plugin loading async, which we'd need in a browser env (either because we'd use `import()` or we need to fetch the source and than eval it), and deals with all the fallout of that
Reviewed By: timur-valiev
Differential Revision: D32669995
fbshipit-source-id: 73babf38a6757c451b8200c3b320409f127b8b5b
Summary:
Follow up of D32665064, this diff moves all plugin management logic from flipper-ui to flipper-server. Things like downloading, installing, querying new plugins.
Loading plugins is handled separately in the next diff.
Reviewed By: nikoant
Differential Revision: D32666537
fbshipit-source-id: 9786b82987f00180bb26200e38735b334dc4d5c3
Summary:
This diff moves RenderHost initialisation to jest, which is thereby treated as just another 'Host' like flipper-ui, the electron app etc. A benefit is that it provides a mocked flipperServer by default that can be used to mock or intercept requests. See LaunchEmulator.spec as example.
Also made the jest setup scripts strongly typed by converting them to TS.
This change allows the test stub configuration, which was OS dependent, out of flipper-ui-core.
Reviewed By: nikoant
Differential Revision: D32668632
fbshipit-source-id: fac0c09812b000fd7d1acb75010c35573087c99f
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.
Reviewed By: nikoant, aigoncharov
Differential Revision: D32665064
fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
Summary:
perf_hooks is no longer needed as these APIs are widely available in both browser and electron.
Still needed in unit tests, as they run from Node
Reviewed By: lblasa, aigoncharov
Differential Revision: D32648253
fbshipit-source-id: 5718ea99b57f96f6858311fd0815ad18c476c99e
Summary:
Watch folders weren't updated for cross plugin/flipper boundaries that have recently been removed
Fix changes in several source folders not being picked up when fast refresh wasn't enabled
Reviewed By: passy, aigoncharov
Differential Revision: D32626139
fbshipit-source-id: 2c830ec8154ff859ce1e3ee101e5963162d2e0a2
Summary:
1. Replace old FileSelector with the new FileSelector
2. Remove showOpenDialog from FlipperLib
Reviewed By: mweststrate
Differential Revision: D32667103
fbshipit-source-id: be8da034c2695f83b397b6c7d35bc6aee78d66e5
Summary:
Don't print console.debug logs during unit tests
These diffs together reduce the amounts of logs printed during unit tests from 6000 to 3000.
Reviewed By: passy
Differential Revision: D32557595
fbshipit-source-id: eef2b742157f16638d9ce270cf8b3d8d0f4e2952
Summary: In the next diff, tests started to fail suddenly, probably as side effect of a changed module loading order or smthg, and started showing DOMs of different tests in test results. Figured that testing-library/react + jest doesn't automatically doesn't clean up the DOM as I hoped it would
Reviewed By: timur-valiev
Differential Revision: D32463402
fbshipit-source-id: 48d26badf774482e7320632e486dfc6358946484