Summary: A first simple version of pre-bundled plugin installation. Currently both pre-bundled and source-only plugins are supported. Pre-bundled plugins should have folder "dist" inside and package.json's "main" field should point to the entry point script there.
Reviewed By: passy
Differential Revision: D19834020
fbshipit-source-id: 7e0b495fb9666acbb22fc32ca2382339cd9dc72f
Summary: Launch without plugin hot reload in case plugin change detection failed to start
Reviewed By: mweststrate
Differential Revision: D19264418
fbshipit-source-id: 089f818b9101d924c504c7d96f71ebca11c9422f
Summary:
On Windows VM when "yarn start" is executed and compilation is in progress for some plugin, fs.watch randomly fires "changed" events for different files of other plugins. This leads to infinite attempts to rebuild the same plugin again and again, and this process never ends, so "yarn start" is almost unusable:
{F225467225}
I've tried to fix this by using watchman instead of fs.watch and on my tests with Windows build it works well:
{F225467508}
Also as watchman is more careful about opening file handles, hopefully this change will fix "too many files opened" problem as Michel suggested here https://fb.workplace.com/groups/flippersupport/permalink/764157990731528/ and here https://github.com/facebook/flipper/issues/699.
Reviewed By: mweststrate
Differential Revision: D19216026
fbshipit-source-id: acc53ae0d003a7936730e6423ac4dbca84f089c8
Summary:
This is a preparation diff to address performance issues in the GraphQL plugin, by making sure we can detect functional regressions and measure performance changes.
For reference, current performance impact: `Reducer took 6338ms. to process 42 events` on my machine with this data snapshot (~10sec of recorinding graphQL events on FB4a)
See D18907455 for some background.
Reviewed By: passy
Differential Revision: D18930652
fbshipit-source-id: 58c832f21ae60954bbd7a60c088479aef29ab874
Summary: Fixed doctor module resolution on github by adding doctor src folder into the metro bundler blacklist
Reviewed By: cekkaewnumchai, mweststrate
Differential Revision: D19020038
fbshipit-source-id: a6ab95383b5016fd5e2180d72883a42c63745ec9
Summary: Fix module resolution for flipper-doctor and return it to sonar directory and effectively to GitHub
Reviewed By: mweststrate
Differential Revision: D18963720
fbshipit-source-id: 61ea78ecbb154de79c7a2d348f347c64325e794c
Summary: Make sure that `.native.js` modules resolutions are _NOT_ prefered over `.js` modules when building flipper or flipper plugins
Reviewed By: jknoxville
Differential Revision: D18297580
fbshipit-source-id: 73f9114d19eb0934cdf69d9668b582966aedc756
Summary: `compilePlugins.js` was still flow typed, but our current formatting setup breaks the file as soon as it is changed. This diff removes the (minimal) flow types and applies prettier
Reviewed By: jknoxville
Differential Revision: D18297696
fbshipit-source-id: 4af2318083188d8758981183f10ccd80e14feea2
Summary:
D18169584 introduced state error which I didn't notice. This diff reverted the diff.
`hg backout D18169584`
Original commit changeset: 77a8b034c5e4
Reviewed By: jknoxville
Differential Revision: D18203354
fbshipit-source-id: 3e281f1e8c7e1d2bf41665adfa5ce5f13daca3a1
Summary: Update and include `react-redux` to Greenkeeper
Reviewed By: passy
Differential Revision: D18169584
fbshipit-source-id: 77a8b034c5e4a13a2ba6c82895e1aee9d852375e
Summary:
In the previous implementation plugins were downloaded from npm, but dependencies weren't. This diff uses the `live-plugin-manager` which does mostly what we want. It install a package from NPM with all its dependencies.
live-plugin-manager puts the plugin and its dependencies in the same folder. We expect the plugins to be in `node_modules`. For this reason, we are installing the plugin into `$pluginName/node_modules` and move the plugin after the installation out of the `node_modules` folder.
* Fixed plugin loading path for thirdparty plugins.
* Disabled hot reloading for plugins in the flipper folder to prevent reloads when moving around files and installing dependencies here.
* an empty `.watchmanconfig` is created, because metro requires it
* tsx files are added to the list of supported extensions for metro
Reviewed By: passy
Differential Revision: D17570413
fbshipit-source-id: ecbedc60841b36188fec9c83da41ef1f27e5e155
Summary:
My MBP just crashed again during startup. I would like to
understand why every plugin compilation appears to start
up a new electron process, but until that's understood
and hopefully fixed, it's probably best to limit the number
of processes we spawn by setting an upper bound here.
N.B. My Linux box doesn't mind this at all.
Reviewed By: jknoxville, danielbuechele
Differential Revision: D17419289
fbshipit-source-id: a11562a21a984059dc35e826eb20d869df218546
Summary:
Compilation is a mixture of I/O and CPU work, so there's some good optimisation potential even on a single thread by running the promises concurrently. The downside is that the output is a bit garbled, but it's quite a bit faster for me.
To test this, I applied this diff so I could just `time yarn start` for an entire run.
```
diff --git a/xplat/sonar/src/init.js b/xplat/sonar/src/init.js
--- a/xplat/sonar/src/init.js
+++ b/xplat/sonar/src/init.js
@@ -80,4 +80,5 @@
dispatcher(store, logger);
// make init function callable from outside
window.Flipper.init = init;
+ window.close();
});
```
## Before
**Cold Start**
```
696.89user 93.21system 4:21.44elapsed 302%CPU (0avgtext+0avgdata 1111448maxresident)k
1416inputs+372824outputs (3major+28155897minor)pagefaults 0swaps
```
**Hot Start**
```
6.87user 1.62system 0:17.32elapsed 49%CPU (0avgtext+0avgdata 249264maxresident)k
216inputs+182912outputs (0major+251426minor)pagefaults 0swaps
```
## After
**Cold Start**
```
736.86user 95.47system 1:53.13elapsed 735%CPU (0avgtext+0avgdata 970616maxresident)k
42864inputs+356776outputs (42major+25299531minor)pagefaults 0swaps
```
**Hot Start**
```
6.85user 1.60system 0:15.93elapsed 53%CPU (0avgtext+0avgdata 269420maxresident)k
2592inputs+197904outputs (0major+260099minor)pagefaults 0swaps
```
## Summary
It's beneficial in both cases, but the wall clock time for cold start goes from *4:21.44* to *1:53.13* for me (mind that this is a single sample). This is a 2.3x speed-up!
Reviewed By: jknoxville
Differential Revision: D16359215
fbshipit-source-id: 62257ec3bdefbf98356f5ac9418c4906f7cb4b1b
Summary: This one snuck in while rebasing my new rules onto master.
Reviewed By: bnelo12
Differential Revision: D16180472
fbshipit-source-id: b715c218ff1886c1901c7730a6b8dac67beb3968
Summary:
Non-final identifiers make code harder to understand.
This is particularly true for JavaScript where even the *type*
can change as a value gets reassigned later.
This enforces to use `const` whereever possible, but doesn't
"outlaw" `let`. Mixed destructuring is also still allowed.
Used `eslint --fix` to change all existing cases.
Reviewed By: jknoxville
Differential Revision: D16131329
fbshipit-source-id: 2eceaca7c603b71b36e005be5d135e1849f2518d
Summary:
On Windows fs.watch fires multiple times after a single edit causing multiple instances of plugin compilation threads to start bogging down system resources.
This diff delays compilation by 1 second, soaking additional watch events fired for that plugin in that time window.
Reviewed By: danielbuechele
Differential Revision: D16109076
fbshipit-source-id: bc4f89d83f04487a3d32ee5cc2105fe0a8b7366c
Summary:
Builds in flipper-public are failing, because duplicate imports: https://our.intern.facebook.com/intern/sandcastle/job/22517998213713260
That's most likely because the `flipper-public` is not blacklisted in metro, so let's add it!
Reviewed By: passy
Differential Revision: D14134423
fbshipit-source-id: 52f87196957c8578b8ac7f578efa74e3c13fe1bb
Summary: Plugin files in subfolders were not watched. Adding recursive flag to reload plugins, even when there are changes in any of the plugin's subdirectories.
Reviewed By: jknoxville
Differential Revision: D14100394
fbshipit-source-id: 2a0b5e35df4bbbfe6cf8a0fafd5271222d99a46c
Summary:
- create a zip-file when building the headless version of Flipper
- restore pkg cache in Sandcastle from pantri
- run build script in sandcastle.
Changes need to go together with D13942919
Reviewed By: passy
Differential Revision: D13942701
fbshipit-source-id: caac7d6cda99fec2a6836c652957ff609a0bf8bb
Summary:
Instead of replacing the tilde with home-dirs on an incomplete, ad-hoc
basis, let's use a package for this. It also supports `~USER` resolution
which someone might reasonbly expect to work if `~/DIR` is working.
Reviewed By: jknoxville
Differential Revision: D13940956
fbshipit-source-id: 5bfa9b8b2540fed8c05c856ff736e48e925f985d
Summary:
First add a Flow Strict config, then enable Flow Strict Local for 13 files in xplat/sonar.
each change can land seperately:
drop-conflicts
Reviewed By: passy
Differential Revision: D13368791
fbshipit-source-id: 5bc1f9d3a179f4b9a554cc8cc629db0fda468a36
Summary:
This adds an option to the compilePlugin function that
allows specifying whether or not to throw an exception
if compiling a plugin fails.
While this seems like a sensible default while development,
it seems like a pretty bad idea when building releases.
Reviewed By: jknoxville
Differential Revision: D12904570
fbshipit-source-id: aee365074af129296a9d493804b959cb9513f9cc
Summary:
Metro's new version using `jest-haste-map` wants to access files inside our ASAR bundle, not using electron's require function. This fails, because it can not read from inside the ASAR bundle. For this reason we are disabeling ASAR for now.
Additionally, we are disabling reloads when a hidden file changes. This is because watchman creates a `.watchman-cookie` which shoudln't triggers a reload. But in general I think it's safe to not reload when hidden files are changed, as they are unlikely to have actual code in them.
Reviewed By: passy
Differential Revision: D10426715
fbshipit-source-id: 6ad9dcf88c62d5b65a9736eff28aadaf89c6af7a
Summary: The minifier removed `debugger` statements from the plugins. We don't need to minify the plugins, because we don't care about bundle size, so we can just disable minification for plugins.
Reviewed By: alangenfeld
Differential Revision: D10334694
fbshipit-source-id: 0b3e23db107f960a3dbeb6a79aa24bacca41c230
Summary: Inline sourcemaps were broken in Metro until 0.47.1, so now we can debug flipper plugins again!
Reviewed By: passy
Differential Revision: D10200221
fbshipit-source-id: 919c1bc4f7aee720f25f2375ffbd8a786ebd0017
Summary: Use inline source maps for plugins and main bundle, both in production and development.
Reviewed By: passy
Differential Revision: D9967235
fbshipit-source-id: 245e65c6fea94b93dc34a65ae572b7fc98ad56e1
Summary: Upgrading to metro@0.45.3 and adapting to API changes made by metro.
Reviewed By: passy
Differential Revision: D9940734
fbshipit-source-id: 34b07cc70c9654d9e07755816aba703a826dcae9
Summary:
Disabling `atime` on Linux is quite common. (I don't have data to back this up,
but with my sample size of n=1, 100% fall into this bucket.) In that case,
the plugins will be cached indefinitely.
Using `ctime` on the directory doesn't really mean anything because it is
only affected by changes *to* the directory, not the files inside.
So, let's do this right and use the most recent change to any of the files
*inside* the directory instead.
Reviewed By: danielbuechele
Differential Revision: D9479491
fbshipit-source-id: 6945d7bf87defa67679cacdaf0a978d8ff1770c3
Summary:
There are 3 sources where plugins can be loaded from:
* `src/plugins`
* `src/fb/plugins`
* any path specified in `~/.sonar/config.json`
Plugins found in the first two directories are bundled with the app when building.
Reviewed By: jknoxville
Differential Revision: D8636061
fbshipit-source-id: 2064090d43d11695ffd99df195e5b594559fe087