Commit Graph

10 Commits

Author SHA1 Message Date
Andrey Goncharov
b025cda861 Stop doing eval to load server add-ons
Summary:
Closes https://github.com/facebook/flipper/issues/4203

CHANGELOG: Stop doing eval to load server add-ons

On Windows `details.path`  contains backslashes. When we interpolate it, it loses one of the backslashes and subsequently `require` fails to load it. If we do not interpolate it (by ditching eval) it has the double backslash and work just fine.

Reviewed By: lblasa

Differential Revision: D40715523

fbshipit-source-id: 50c52f2a53690b585a32d3009f1692cf0b0d8428
2022-10-26 05:00:00 -07:00
Andrey Goncharov
97b8b8a1c4 Split flipper-plugin package
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
2022-09-15 10:02:19 -07:00
Lorenzo Blasa
9cc8e4076f flipper-server refactor
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
2022-06-07 02:42:16 -07:00
Andrey Goncharov
ba9a80545d Support globally installed React DevTools
Summary:
- Support loading globally installed DevTools

Background:
1. Initially, I wanted to use react-devtools-core as before. react-devtools-core standalone contains quite a few imports of node.js APIs. After [a conversation with Brian](https://fb.workplace.com/groups/react.devtools/permalink/3131548550392044), I pivoted to react-devtools-inline
2. Technical design doc of react-devtools-inline integration: https://docs.google.com/document/d/1STUSUhXzrW_KkvqSu7Ge-rxjVFF7oU3_NbwzimkO_Z4
3. We support usage of globally installed devtools. Code of react-devtools-inline is not ready to be used by the browser as is. We need to bundle it and substitute React and ReactDOM imports with the globals.
4. As we can't pre-compile what users install globally, we need to bundle global devtools on demand,
5. I tried re-using our Metro bundling pipeline initially, but gave up after fighting it for 2 days. Included, `rollup` instead.
6. Size of a `tgz` archive with a plugin is 2.1MB

allow-large-files

Reviewed By: mweststrate

Differential Revision: D34968770

fbshipit-source-id: 352299964ccc195b8677dbda47db84ffaf38737b
2022-03-31 04:01:33 -07:00
Andrey Goncharov
aec05533d7 Expose a subset of flipper-plugin to flipper server
Summary: Flipper plugins rely on 'flipper-plugin' package being accessible from 'global'. Expose a subset (without UI stuff) of flipper-plugin to server add-ons

Reviewed By: mweststrate

Differential Revision: D34400811

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

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

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

Reviewed By: lawrencelomax

Differential Revision: D33124441

fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
2021-12-17 07:36:07 -08:00
Andrey Goncharov
9436c32ce9 Add unit tests for 'download-file' command
Reviewed By: mweststrate

Differential Revision: D32926830

fbshipit-source-id: fbd4dcb910ffdcdc365f5f0b4c401423f0256824
2021-12-10 06:36:12 -08:00
Michel Weststrate
2480ed30c5 Move flipper-doctor check running to flipper-server-core
Summary: Per title. Two new server API's: get-healthchecks, and run-healtcheck. Types have all been moved to flipper-common, so that they can be used by doctor, server-core and ui-core packages. Since it were quite some, moved them into a FlipperDoctor namespace.

Reviewed By: nikoant

Differential Revision: D32720510

fbshipit-source-id: 37aa35cde6ebd58479cf0dffec5b7b2da6d22198
2021-12-08 04:30:56 -08:00
Michel Weststrate
64747dc417 move plugin management from ui-core to server-core
Summary:
Follow up of D32665064, this diff moves all plugin management logic from flipper-ui to flipper-server. Things like downloading, installing, querying new plugins.

Loading plugins is handled separately in the next diff.

Reviewed By: nikoant

Differential Revision: D32666537

fbshipit-source-id: 9786b82987f00180bb26200e38735b334dc4d5c3
2021-12-08 04:30:56 -08:00
Michel Weststrate
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