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: Register shortcuts only for Flipper application instead of globally. Fixes https://github.com/facebook/flipper/issues/3090
As reported, during decapitation we accidentally started registering shortcuts globally, rather per app as it used to be in the menu's. This diff fixes that and also makes sure shortcuts are supported in the browser version of flipper
Reviewed By: lawrencelomax
Differential Revision: D33158445
fbshipit-source-id: 8371e5b96e772152eeb93ba990e1f5edb9e67085
Summary: Added a command to let a file be opened by the OS, and some other small bits and pieces to make Flipper browser compatible.
Reviewed By: lblasa
Differential Revision: D32721748
fbshipit-source-id: a4ad1c2f662f4651ddf6c20c57e5af1e123914a8
Summary:
I can't recall seeing anybody use Redux DevTools in the last 2 years. I don't think it adds much (most data in it is not serializable anyway), and disabling hopefully makes memory leaks / OOMs less likely on long debug sessions :)
If someone misses it, feel free to bring it back.
Reviewed By: passy
Differential Revision: D31827421
fbshipit-source-id: 3c3836d4620a1ae431116df2de19a606672a6cd7
Summary:
Follow up on D29436059 (014e571f74), another place where the old format was leaked.
Fixes https://github.com/facebook/flipper/issues/2842 + some mentions on WP
Changelog: Fixed JavaScript exception on main thread occurring after loading Flipper
Reviewed By: nikoant
Differential Revision: D30928768
fbshipit-source-id: 083731e18230825738466b34368c2b5f730e386c
Summary:
Changelog: Fixed startup error when loading default theme
The theme defaulted to `auto`, instead of `system`, causing an startup exception. Fixed by adding types and having a more defensive startup check.
Fixes https://github.com/facebook/flipper/issues/2835
Reviewed By: jknoxville
Differential Revision: D30866648
fbshipit-source-id: 83b6d9fc235eaa0a7e959df4276d3f378eed7d1f
Summary:
Add an setting option to allow automatic dark theme
A feature requested by swrobel https://github.com/facebook/flipper/issues/2708
## Changelog
### UI change
Replace the `Enable Dark Theme` Toggle button with a Radio group containing three Radio buttons.
The available options are `Dark`, `Light` and `Use System Default`, of which `Use System Default` is the default value
<img width="548" alt="Screenshot 2021-08-31 at 3 32 44 PM" src="https://user-images.githubusercontent.com/410850/131462798-4e74f757-41fc-4a3f-ba28-53d00fc1cf03.png">
### Data structure change
The `darkMode` property of [Settings](c0cd32564a/desktop/app/src/reducers/settings.tsx (L20)) is changed from `boolean` to `string`, the available values are `dark`, `light` and `auto`
Pull Request resolved: https://github.com/facebook/flipper/pull/2759
Test Plan:
### Test 1
- Step: Choose `Dark` in the Settings page and click on `Apply and Restart` button
- Expect: The application is displayed in Dark mode
### Test 2
- Step: Choose `Light` in the Settings page and click on `Apply and Restart` button
- Expect: The application is displayed in Light mode
### Test 3
- Step: Choose `Use System Default` in the Settings page and click on `Apply and Restart` button
- Expect: The application is displayed in System Default mode
Reviewed By: mweststrate
Differential Revision: D30666966
Pulled By: passy
fbshipit-source-id: a63e91f2d0dbff96890e267062cb75bffd0007f4
Summary: Intercept click to links in the embedded documentation and redirect them to the default browser.
Reviewed By: passy
Differential Revision: D29426270
fbshipit-source-id: 1d3d9613ff827f80287883768452b93701e95d96
Summary:
Changelog: Improved dark mode support!
This diff makes sure that the dark mode preference is written to the Flipper config, and applied during startup, so that the ugly light/dark flash when starting Flipper in dark mode disappears
Reviewed By: passy
Differential Revision: D29436059
fbshipit-source-id: 0f762149848298512026fbd216d9a9e0bf4276db
Summary:
This diff adds OS support for dark mode (at least on Mac), by making sure system elements are styled according to system dark theme.
For some unknown reason, this does apply to all system dialogs, titlebars etc, but not for scrollbars, so they got custom themed.
Differential Revision: D29436058
fbshipit-source-id: bac649b6cd81f0142c607ed567eeb00f41625041
Summary: This diff fixed the issue when deep link handled multiple times in case Flipper window reloaded. See test plan for videos.
Reviewed By: fabiomassimo
Differential Revision: D29100221
fbshipit-source-id: 0ff6f1a645d5488d205b4fba44942f4d39f59088
Summary:
Added rules to ensure we properly propagate errors from promises.
Also found and fixed a place where promise function parameter was mismatched.
Reviewed By: mweststrate
Differential Revision: D28537820
fbshipit-source-id: b93f44274fc76544049813f645508cb78e432880
Summary:
When trying to run some React component performance profiles, the updates registered made absolutely no sense (components rerendering without any parent or other cause causing them to render etc). That turned out to be caused by having an outdated version of the React devTools in Flipper.
Sadly the newer version of the React DevTools didn't work with our current Electron version anymore. Some horrible hacking is needed to work around that.
To help with updating the tools in the future (they are by default cached forever on the local machine), I've introduced the `FLIPPER_UPDATE_DEV_TOOLS` variable.
The plugin loading work around is inspired by https://github.com/electron/electron/issues/23662#issuecomment-787420799
Reviewed By: passy
Differential Revision: D27685981
fbshipit-source-id: c35e49aff9b2457b63122eeee0d5c042ddd3b08b
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1816
Now that Sandy is the default in OSS builds as well, we can remove the temporarily title bar and switch to small topbar windows in Electron.
This diff removes any remaining elements in the titlebar
- version number went into the title bar
- the update check warning is shown on top of the bottom section of the left rail (orange triangle)
- the development only perf graphs are moved to the left bar as well and are now aligned vertically.
Reviewed By: jknoxville
Differential Revision: D25805957
fbshipit-source-id: fba4b60c246b8f5d99a93087af31af9ac55defe8
Summary: Allow using of .env file to pass env vars to be used in dev mode. Currently this allow to configure defaults for enabling fast refresh, automatic opening of dev tools and plugins to load.
Reviewed By: passy
Differential Revision: D24398938
fbshipit-source-id: 30a5d86b7906a7723a404cf84a1b8d50ae497dbc
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1532
Upgrade to Electron 10, in an attempt to fix random hard Electron crashes. Didn't fix it, but given the changelog of Electron with all the bug fixes, seems to be a good idea nonetheless :)
Changelog: Flipper now uses Electron 10
Reviewed By: nikoant
Differential Revision: D23565000
fbshipit-source-id: 3f07b8cf8c438147bde5314698d20046ac9f94cf
Summary:
- Removed compilation on startup which is not required anymore after switching to plugin spec v2.
- Removed from Node process ("static" package) all the dependencies which are not required anymore: e.g. metro, babel etc.
- Plugin loading code from node process moved to browser process and made asyncronous.
Some expected benefits after these changes:
1) Reduced size of Flipper bundle (~4.5MB reduction for lzma package in my tests) as well as startup time. It's hard to say the exact startup time difference as it is very machine-dependent, and on my machine it was already fast ~1500ms (vs 5500ms for p95) and decreased by just 100ms. But I think we should definitely see some improvements on "launch time" analytics graph for p95/p99.
2) Plugin loading is async now and happens when UI is already shown, so perceptive startup time should be also better now.
3) All plugin loading code is now consolidated in "app/dispatcher/plugins.tsx" instead of being splitted between Node and Browser processes as before. So it will be easier to debug plugin loading.
4) Now it is possible to apply updates of plugins by simple refresh of browser window instead of full Electron process restart as before.
5) 60% less code in Node process. This is good because it is harder to debug changes in Node process than in Browser process, especially taking in account differences between dev/release builds. Because of this Node process often ended up broken after changes. Hopefully now it will be more stable.
Changelog: changed the way of plugin loading, and removed obsolete dependencies, which should reduce bundle size and startup time.
Reviewed By: passy
Differential Revision: D23682756
fbshipit-source-id: 8445c877234b41c73853cebe585e2fdb1638b2c9
Summary:
We've disabled web security in `BrowserWindow` (https://fburl.com/diffusion/0l0q669m). However, there is a bug in Electron 9 that makes this doesn't work as expected (https://github.com/electron/electron/issues/23664). Earlier, we've resolved this problem by specifying `no-cors` mode in requests. This strikes again in other plugin.
This diff applies a workaround commented inside the issue to allow to make CORS requests.
Reviewed By: nikoant
Differential Revision: D22306977
fbshipit-source-id: ea0f5e3f1c4080037df258a6c5ce1fc89d433c3b
Summary:
Install plugins to pending directory first to enable installing new versions of existing plugins. On startup Flipper moves all the plugins from pending directory into installed plugins directory.
Auto-update, after downloading a plugin package, will also extract it to "pending", so after restart update will automatically be applied.
Reviewed By: mweststrate
Differential Revision: D21929713
fbshipit-source-id: 141b106415e941156ae598cf810ab3bed8c76ced
Summary:
Just a convenient feature: `yarn start --open-dev-tools` opens Dev Tools window alongside with Flipper window.
Changelog: new command-line flag "--open-dev-tools" to automatically open Chrome Dev Tools for Flipper debugging.
Reviewed By: mweststrate
Differential Revision: D21074769
fbshipit-source-id: 12ae33ab74a3d35c54051321396d8701d72c7e32
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/998
After this diff all the default plugins (which are distributed with Flipper) will be included into the main app bundle instead of bundling each of them separately and then loading from file system. This is done by auto-generating plugins index in build-time and importing it from Flipper app bundle, so Metro can follow these imports and bundle all the plugins to the app bundle.
This provides several benefits:
1) reduced Flipper bundle size (~10% reduction of zipped Flipper archive), because Metro bundles each of re-used dependencies only once instead of bundling them for each plugin where such dependency used.
2) Faster Flipper startup because of reduced bundle and the fact that we don't need to load each plugin bundle from disk - just need to load the single bundle where everything is already included.
3) Metro dev server for plugins works in the same way as for Flipper app itself, e.g. simple refresh automatically recompiles bundled plugins too if there are changes. This also potentially should allow us to enable "fast refresh" for quicker iterations while developing plugins.
4) Faster build ("yarn build --mac" is 2 times faster on my machine after this change)
Potential downsides:
1) Currently all the plugins are identically loaded from disk. After this change some of plugins will be bundled, and some of them (third-party) will be loaded from disk.
2) In future when it will be possible to publish new versions of default plugins separately, installing new version of such plugin (e.g. with some urgent fix) will mean the "default" pre-built version will still be bundled (we cannot "unbundle" it :)), but we'll skip it and instead load new version from disk.
Changelog: Internals: include default plugins into the main bundle instead producing separate bundles for them.
Reviewed By: passy
Differential Revision: D20864002
fbshipit-source-id: 2968f3b786cdd1767d6223996090143d03894b92
Summary:
This adds another field to the exit data to record whether we had a clean exit where the app was closed as it should.
Note that doing a reload inside Flipper will be recorded as an unclean exit.
Reviewed By: passy
Differential Revision: D20915481
fbshipit-source-id: 240192d7a69bf620bfaa316e3e5cb0f45d6a34cc
Summary:
SORRY FOR BIG DIFF, but it's really hard to split it as all these changes are cross-dependent and should be made at once:
1. Moved transformations to separate package "flipper-babel-transformer" and linked it using yarn workspaces to "static" and "pkg" packages where they are re-used. Removed double copies of transformations we had before int these two packages.
2. Converted transformations to typescript
3. Refactored transformations to avoid relying on file system paths for customisation (FB stubs and Electron stubs for headless build)
4. As babel transformations must be built before other builds - enabled incremental build for them and changed scripts to invoke the transformations build before other build scripts
5. As we need to deploy all the dependencies including the fresh "flipper-babel-transformer" as a part of "static" - implemented script which copies package with all the dependencies taking in account yarn workspaces (hoisting and symlinks)
Reviewed By: passy, mweststrate
Differential Revision: D20690662
fbshipit-source-id: 38a275b60d3c91e01ec21d1dbd72d03c05cfac0b
Summary:
Quick notes:
- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.
Close https://github.com/facebook/flipper/pull/915
Reviewed By: jknoxville
Differential Revision: D20594929
fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
Summary:
Follow up of D20454562
We now set an origin header, but use https instead of http, which is currently not supported by the public RN version (for the internal RN version support was added in D20526486).
However, not promoting ourselves as running on a secured connection seems like the more trustworthy thing to do, and better reflects reality.
Reviewed By: nikoant
Differential Revision: D20534363
fbshipit-source-id: e26fabd77013920e4c58fdbf552bb909f0499cae
Summary:
In this diff we persist data about the state of the app when exiting, and to make sure we capture it in crashes, do that as part of track-usage events as well.
with the exit data we also capture what kind of device and plugin the user was using, so that we can detect anomalies like flipper needing restarting more often for certain plugins
during startup, we will always send an event how long it was since the last startup, including the above information
Reviewed By: passy
Differential Revision: D20515200
fbshipit-source-id: ead971e05542e0ef58ed5e5b204af70b51a15b9b
Summary:
Currenty in the prod version of Flipper the endpoints of media upload and flipper trace fail with status code 400. Reason being different origin and refferer as compared to the dev version. This diff matches the origin and the refferer with the dev one.
I referenced Anton's diff D20278701.
Reviewed By: nikoant
Differential Revision: D20454562
fbshipit-source-id: 20f80a731878fb491d08a208d64fc9260e442fa3
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/872
Move all the JS code related to desktop app to "desktop" subfolder.
The structure of "desktop" folder:
- `src` - JS code of Flipper desktop app executing in Electron Renderer (Chrome) process. This folder also contains all the Flipper plugins in subfolder "src/plugins".
- `static` - JS code of Flipper desktop app bootstrapping executing in Electron Main (Node.js) process
- `pkg` - Flipper packaging lib and CLI tool
- `doctor` - Flipper diagnostics lib and CLI tool
- `scripts` - Build scripts for Flipper desktop app
- `headless` - Headless version of Flipper app
- `headless-tests` - Integration tests running agains Flipper headless version
Reviewed By: passy
Differential Revision: D20249304
fbshipit-source-id: 9a51c63b51b92b758a02fc8ebf7d3d116770efe9