Commit Graph

5 Commits

Author SHA1 Message Date
Michel Weststrate
845c9b67f5 Read flipper-plugin from peer deps
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
2020-07-01 09:12:35 -07:00
Anton Nikolaev
339b786fb5 Added new package "flipper-plugin-lib" which contains re-usable code related to plugin installation
Summary: No functional changes, just refactoring for easier implementation of plugin updates installation

Reviewed By: passy

Differential Revision: D21902525

fbshipit-source-id: fbfa221a89b879b0d08127676b27df65ef63307d
2020-06-05 06:16:19 -07:00
Anton Nikolaev
e65b355fb6 Load either installed or bundled version of plugin depending on which is newer
Summary: Load either installed or bundled version of plugin depending on which is newer.

Reviewed By: mweststrate

Differential Revision: D21858965

fbshipit-source-id: aa46eafe0b5137134fadad827749672441f2c9e5
2020-06-03 07:42:12 -07:00
Anton Nikolaev
ca2d04a5da Versioning for plugin format
Summary:
Added versioning for plugin format.

The first version is where "main" points to source code entry and plugins are bundled by Flipper in run-time on loading them.

The second version is where "main" points to the already existing bundle and Flipper just loads it without bundling. The plugins of version 2 must be bundled using "flipper-pkg" tool before publishing.

Changelog: Support new packaging format for plugins.

Reviewed By: mweststrate

Differential Revision: D21074173

fbshipit-source-id: 7b70250e48e5bd5d359c96149fb5b14e67783c4d
2020-04-20 06:03:16 -07:00
Anton Nikolaev
553c54b63e Include default plugins into app bundle (#998)
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
2020-04-14 07:20:39 -07:00