Summary: Really nothing interesting to see here , just moved pluginStats out of messageQueue, as it started there and kept growing
Reviewed By: nikoant
Differential Revision: D22257318
fbshipit-source-id: 26be7efb4629fcef1b14de96a2b60f17f7d76785
Summary: Sandy plugins can now send messages to plugins. The methods and params are strongly typed in implementation and unit tests, based on the <Methods> generic of FlipperClient.
Reviewed By: nikoant
Differential Revision: D22256972
fbshipit-source-id: 549523a402949b3eb6bb4b4ca160dedb5c5e722d
Summary:
Upgrading to TypeScript 3.9 so that we can use `// ts-expect-error`, that allows us to basically write unit tests for typings.
Fixed the typescript path in `settings.json`, because otherwise VSCode kept picking the built-in version (3.8.3 atm) of ts when opening the `sonar` folder as workspace.
Reviewed By: passy
Differential Revision: D22255818
fbshipit-source-id: ae54aedb237445f32f1797b4290656dbfb0e528f
Summary:
This sets up the initial infra that is to be used by plugin devs to test plugins.
There is not much yet to see, as there is no state or message sending yet. But at least the life cycle of plugins can be test, things are strongly typed and everything is in the place where it should be :)
N.b. the import difference with these utils and the createFlipperMock utilities in Flipper are
1. this testing infra is entirely inside flipper-plugin package, so that plugin devs don't need flipper as a dependency
2. this testing infra doesn't provide abstractions for plugin / device / client switching; it tests plugins purely in isolation of the rest of the world (except for firing `onConnect` / `onDisconnect` which is normally the effect of switching plugins)
Reviewed By: nikoant
Differential Revision: D22255262
fbshipit-source-id: b94ccbab720d2b49428a646aed3c55af71a5bc80
Summary:
Scaffolded some internal Sandy notes and made them only internally available.
Since most of the pipeline was already set up by jknoxville, it is unclear to me if something needs to be done to set up the auto redirect from fbflipper.com
Reviewed By: jknoxville
Differential Revision: D22233534
fbshipit-source-id: 4bdf5535f5745e7e4d335647759c6cf1b7cc73c6
Summary:
Introduced hooks that are called whenever the plugin is connected / disconnected to it's counter part on the device.
There is some logic duplication between `PluginContainer` for old plugins, and `PluginRenderer` for new plugins, mostly caused by the fact that those lifecycles are triggered from the UI rather than from the reducers, but I figured refactoring that to be too risky.
Reviewed By: jknoxville
Differential Revision: D22232337
fbshipit-source-id: a384c45731a4c8d9b8b532a83e2becf49ce807c2
Summary:
When running unit tests, every unit would try to make a graphql request (since promises always kick off immediately, even when not being awaited) and print an error. Fixed that by lazily choosing the preferred whatever it is.
Before:
{F241368814}
After:
(crickets)
Reviewed By: passy
Differential Revision: D22208422
fbshipit-source-id: b290d528d94dbed7ae867e07694d8d4cd85d8376
Summary: PluginContainer will now wrap Sandy plugins in PluginRenderer. PluginRenderer will also be used by plugin unit tests in the future
Reviewed By: jknoxville
Differential Revision: D22159359
fbshipit-source-id: 69f9c8f4bec9392022c1d7a14957f5aca0339d97
Summary: This diff introduces the `onDestroy` hook that can be used by plugins to listen to the event where a plugin is cleaned up (either because it is disabled, or because the client is being cleaned up)
Reviewed By: jknoxville
Differential Revision: D22208121
fbshipit-source-id: 9c4951ae671be611f21da171c548d4054c481166
Summary: Replaced `instanceof` checks with `isSandyPlugin` utility. That is cleaner to read and makes it easier to find places where we make exceptions for Sandy plugins
Reviewed By: jknoxville
Differential Revision: D22206707
fbshipit-source-id: b44a1b585424f3b9bf0d7ce200c34107f03ed55e
Summary:
This diff makes sure sandy plugins are initialized.
Sandy plugins are stored directly in the client for two reasons
1. we want to decouple any plugin state updates from our central redux store, as redux is particularly bad in handling high frequency updates.
2. The lifecycle of a plugin is now bound to the lifecycle of a client. This means that we don't need 'persistedStore' to make sure state is preserved; that is now the default. Switching plugins will no longer reinitialize them (but only run specific hooks, see later diffs).
3. PersistedState will be introduced for sandy plugins as well later, but primarily for import / export / debug reasons.
A significant difference with the current persistent state, is that if a client crashes and reconnects, plugins will loose their state. We can prevent this (again, since state persisting will be reintroduced), but I'm not sure we need that for the specific reconnect scenario. Because
1. we should fix reconnecting clients anyway, and from stats it looks to happen less already
2. reconnects are usually caused by plugins that aggregate a lot of data and get slower over time. Restoring old state also restores those unstabilites.
For the overview bringing back the archi picture of earlier diff:
{F241508042}
Also fixed a bug where enabling background plugins didn't enable them on all devices with that app.
Reviewed By: jknoxville
Differential Revision: D22186276
fbshipit-source-id: 3fd42b577f86920e5280aa8cce1a0bc4d5564ed9
Summary: Unit tests tend to randomly bail out once FBLogger is (indirectly) required by some module under test. This makes sure FBLogger is stubbed by default. We might want to do the same for `User` in the future.
Reviewed By: jknoxville
Differential Revision: D22186274
fbshipit-source-id: 2ede364c4b691d69826781355592226b075d8367
Summary: The test mock utilities now return a promise, rather than taking a callback, which makes tests slightly nicer to read (similar to react-testing-library). No semantic changes.
Reviewed By: jknoxville
Differential Revision: D22186278
fbshipit-source-id: ec5b9f4e6bfeee9160e331f8c20a1d4fdcbfeede
Summary: Make sure Sandy plugins are loaded properly from disk
Reviewed By: jknoxville
Differential Revision: D22186275
fbshipit-source-id: fd2f560a7bed959b18e05db2a087909ad876ab9d
Summary:
So far there were 2 types of plugins: `FlipperPlugin` and `FlipperDevicePlugin`. This introduces a third kind: `SandyPluginDefinition`.
Unlike with the old plugins, the export of the module is not directly exposed as the plugin definition. Rather, we use class `SandyPluginDefinition` (instance) that holds a loaded definition and its meta data separately (`PluginDetails`). This means that we don't have to mix in and mutate loaded definitions, and that for unit tests we can avoid needing to provide a bunch of meta data. This also prevents a bunch of meta data existing on two places: on the loaded classes as static fields, and in the meta data field of the loaded class as well. Finally, we can now freely extends the `PluginDetails` interface in flipper, without needing to store it on the loaded classes and we are sure that no naming conflicts are caused by this in the future.
For compatibility with the existing code base, common fields are delegated from the `SandyPluginDefinition` class to the meta data.
Also cleaned up types around plugins a little bit and removed some unnecessary casts.
For all features that reason about plugins in general (such as exports), sandy plugins are ignored for now.
`SandyPluginInstance` is worked out in further diffs
The `instanceof` calls are replaced by a utility function in later diffs.
{F241363645}
Reviewed By: jknoxville
Differential Revision: D22091432
fbshipit-source-id: 3aa6b12fda5925268913779f3c3c9e84494438f8
Summary:
To know whether plugins should be mounted with the old setup or new setup (with a Provided / context based api), we need to be able to recognize whether a plugin is written with the old or new setup.
We do this by checking if the flipper-plugin dependency is declared as peer dependency. This we can to check for SDK compatibility as well.
Reviewed By: jknoxville
Differential Revision: D22043085
fbshipit-source-id: 21afabb6e58d86253a464470f4690c51cced87ab
Summary: Set up an initial library which can (should) be used by plugins in the future.
Reviewed By: jknoxville
Differential Revision: D22019554
fbshipit-source-id: 502b14b34b2c9c117cea377ab6ebbf150e6faee9
Summary:
`CKComponentAccessibilityContext::operator==` can be extremely expensive; it may invoke the `accessibilityLazyTextBlock` for its `CKComponentAccessibilityTextAttribute` members, and that can do a lot of string construction.
I could refactor this to make it cheaper, e.g. by migrating to a function-pointer-and-context-object approach. But the easiest thing to do is to simply remove it; I don't think it's meaningfully used.
Reviewed By: kevin0571
Differential Revision: D22322108
fbshipit-source-id: 82a0548d6dd28ec4adf2f3ba85705eabf665d100
Summary:
Fix for https://github.com/facebook/flipper/issues/1300
The weak refs were not being cleared in two cases:
- On config changes, isFinishing() would be false in onPause()
- When calling finish() from Activity.onCreate(), onPause() isn't guaranteed to be called.
## Changelog
Pull Request resolved: https://github.com/facebook/flipper/pull/1301
Reviewed By: mweststrate
Differential Revision: D22286182
Pulled By: passy
fbshipit-source-id: 948d1d9b2145b6526c0030cf537330409ff7f8c4
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:
Instead of relying on system blocks used, we use the file size reported by ls.
Android 11 seems to be more lazy when it comes to fsync'ing so there's a pretty
good chance that if we just check for with `du` or `ls -ls` we will see an "empty" file
because it hasn't been written to disk yet. By the normal `ls` output instead, we'll
just read the file and see how many bytes it's long, which should be more
accurate in all cases.
Changelog: Fix screen recording for Android 11 beta
Reviewed By: jknoxville
Differential Revision: D22283092
fbshipit-source-id: 6d33ca297f1c0734ab4ffc466d9e483aa1a1bdb5
Summary: Script to list all plugins included into Flipper desktop workspaces.
Reviewed By: passy
Differential Revision: D22256917
fbshipit-source-id: a3d8a0f9faea6e462a2f22be155d99eb22eb59d8
Summary: Translated all cases where we had a parent-relative link to use the base URL instead.
Reviewed By: jknoxville
Differential Revision: D22256229
fbshipit-source-id: 81ee6fecb77dbaa19d112cb319771c22ff66d02a
Summary: Changelog: Added command `flipper-pkg checksum` for computing the total checksum of all the files included into plugin package.
Reviewed By: passy
Differential Revision: D22255125
fbshipit-source-id: a4f91370b4ab16ea4ce4a60e29f9d20fdd5f4331
Summary: `forwardedRef` was always triggered, so it forced the container to scroll to the selected element. This diff stores element id so that it scrolls only once.
Reviewed By: mweststrate
Differential Revision: D22235284
fbshipit-source-id: 0eb7aaf2b484d345865db4da66d0f555dc314710
Summary:
This is an automated PR to update the Podfile.lock.
- Make sure that the Podfile.lock contains latest FlipperKit and Flipper pod versions.
- Also make sure that all the dependencies are updated to the latest one.
- This is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
Pull Request resolved: https://github.com/facebook/flipper/pull/1295
Reviewed By: mweststrate
Differential Revision: D22233104
Pulled By: passy
fbshipit-source-id: b98e49249b9783fe4170232eadba9060b7686743
Summary: Still got four warnings up for this on GitHub. Let's do the same we do in the rest of the repo.
Reviewed By: mweststrate
Differential Revision: D22233188
fbshipit-source-id: eb76409b1e5ff5735e354bdbd93f875d22f2add2
Summary: Only download plugins with "engine" version less or equal to the current Flipper version
Reviewed By: mweststrate
Differential Revision: D22211546
fbshipit-source-id: 52cf51badcd1e7041214d2a09ba6b6fc9c331b8f
Summary: This diff adds abilist and sdk version information in the AndroidDevice.
Reviewed By: mweststrate
Differential Revision: D22210225
fbshipit-source-id: cda3dea9d89fdaa62a08aa000c93e39177c67bdd
Summary: Should saved some bytes. Wanted to do this after seeing Christoph's talk. Used Atlassian's yarn-dedupe. Sadly, didn't find much.
Reviewed By: mweststrate
Differential Revision: D22207392
fbshipit-source-id: b2f7700f738c054af5e64b030e48185d3789ae12
Summary:
This should fix https://github.com/facebook/flipper/issues/1274
I had some cleaning up to do to get to this point.
Changelog:
Fix `react-native-flipper` dependency pulling in debug-only artifacts into release builds.
Reviewed By: mweststrate
Differential Revision: D22160304
fbshipit-source-id: 0ebc0ed942427f2966bccd721bf01aafa38ba400
Summary: After some testing I found file source map does not work as expected when prod version of Flipper is used to debug plugin. So returning back inline source maps. Note that this only affects debug builds, for production builds no source maps will be produced anyway.
Reviewed By: passy
Differential Revision: D22161927
fbshipit-source-id: 068b9da09da4dcb6c31aff4e5a15bd6438f686b3
Summary: This diff enables the installation for iOS simulators. This also fixes the error view created when there is an error. Right now there is a bug on my machine where idb doesn't detect my physical device. But once it is detected, it will work.
Reviewed By: mweststrate
Differential Revision: D22137831
fbshipit-source-id: b6d6f77318c6baef78c35af73db3969b7dd1b907
Summary: Added "build-plugin" command. Can be used like this: `yarn build-plugin fresco` which produces package to 'sonar/dist/plugins/fresco.tgz'
Reviewed By: mweststrate
Differential Revision: D22160253
fbshipit-source-id: 48b202984b0f515bf253b595be1f59953a9ce411
Summary: Removed back "prepack" script from every plugin package to keep it simple. Instead we will use `build-plugin` command defined in the root package.json (see next diff in the stack).
Reviewed By: mweststrate
Differential Revision: D22160252
fbshipit-source-id: cffb5df65b89df3fe390c051da0df797b3d16d2d
Summary: Disabled producing inline source maps for debug builds. Source maps are already writte to "map" files, so this does not make sense to also inline them to the js bundle. Passing "sourceMapUrl" parameter to Metro fixed this.
Reviewed By: mweststrate
Differential Revision: D22159501
fbshipit-source-id: f06225cd43f44a7f93afcc32bb0501323b35d0c3