Summary:
While trying to find a simple fix for the broken source maps when unit testing (see previous diff), I noticed that control flow in the transformer was unnecessarily complicated.
This doesn't fix the sourcemap issue btw
Reviewed By: passy
Differential Revision: D19158367
fbshipit-source-id: 7dfe4b28eabd4534a32dcb655e534d0f418f0db4
Summary:
When the CPU or kaois plugins are started, they show a buffer deprecated warning, caused by the fact that they ship their own adbkit version, which is unpatched.
This diff makes sure that the adbkit as shipped with Flipper is used instead.
Reviewed By: jknoxville
Differential Revision: D18327441
fbshipit-source-id: 9cab23b9701adc070210cc4133fc8760031bd1d7
Summary:
Replacing our custom electron-stubs transform with a mocked module.
This will now be the default impl for tests, and we can override it by mocking as needed.
Reviewed By: passy
Differential Revision: D17979659
fbshipit-source-id: a26994158d439fa7dc1ca38225294106fc4e1559
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: Tests were failing as they were not being transformed correctly. Class properties (proposed syntax) was only partially added for Typescript files. This fixes the issue.
Reviewed By: passy
Differential Revision: D16686613
fbshipit-source-id: 2108cf77eb688bb6825d016960480ea55fcc2620
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: as per title. see explanation in code comment
Reviewed By: jknoxville
Differential Revision: D14125820
fbshipit-source-id: 9b8e31214a65a184397852544cebd7b69ea0aadb
Summary:
Upgrading to flow 0.91, fixing a bunch of `$FloxFixMe`s that were introduced by upgrading to 0.86.
Also fixing some linting issues.
Reviewed By: priteshrnandgaonkar
Differential Revision: D13900794
fbshipit-source-id: 5d0a1b62371f3b5d34b909bae0876583acb6f977
Summary:
We were using `window.performance` to measure performance. This was because the equivalent node.js API `perf_hooks` wasn't available in the electron version we were using back then.
However, `perf_hooks` has landed in electron meanwhile, so I am moving to this API, as it works for the headless version and jest tests, too.
This allows us to delete the babel transform that was used for node-based tests, where the browser API was replaced with the node API
Reviewed By: jknoxville
Differential Revision: D13860133
fbshipit-source-id: cf1395004fac046dd55751ff465af494173b2cbf
Summary:
Fixes required to be able to run Flipper in node.js:
* Adds checks if the `window`-object exists before using it, to allow running in node.
* Imports from within Flipper should directly reference the file they are requiring instead of `import from 'flipper'`. This was done in most of the places. Fixed a few occurrences where this wasn't the case. This is to prevent cyclic dependencies in node.
* shared packages (React, ReactDOM and Flipper) were exposed on the `window` before, changed this to `global` as this works in browser and node.
* Adds some missing methods to our electron stubs (used for testing and headless Flipper)
Reviewed By: passy
Differential Revision: D13786577
fbshipit-source-id: 145d560f1446e7d0bdec2acd8dd54dae983d7b36
Summary:
* Adds `build-headless.js` to bundle the app using metro
* the build script replaces the prelude code added by metro with our own to make it work in node. Metro will add an API to add custom prelude code in the next version.
* Pins down metro's dependency of `temp` to `v0.9.0` (instead of `0.8.3`) to be compatible with node 10. (This will be fixed in a metro upgrade)
Reviewed By: passy
Differential Revision: D13786574
fbshipit-source-id: bddb3542c370c068d90a90c4b59337f995e4fa3f
Summary: The fb-stubs transform is getting applied when it shouldn't. Fix it by only applying it if src/fb exists.
Reviewed By: danielbuechele
Differential Revision: D13236217
fbshipit-source-id: 940def377839d16f34c49504948cb062916a3d6a
Summary:
I tried switching Flipper to use the node.js module: https://nodejs.org/api/perf_hooks.html instead of electrons window.performance. But the module couldn't be found.
So instead, I'm just replacing it in the pure node tests.
This means tests without node can work without issues.
Reviewed By: danielbuechele
Differential Revision: D10302114
fbshipit-source-id: b3b8aa5fb350a8246fcdfc2a80cc72daec2448d7
Summary:
The idea behind this is to enable tests running in pure node, without electron, because electron requires display drivers and complicated things.
I've been lazy and only added the bare minimum electron api's for the connection test to pass.
It would be awesome to auto generate it properly.
Reviewed By: danielbuechele
Differential Revision: D10238132
fbshipit-source-id: d4a2da2baf5f8964184b532a581c3a75ee33ef06
Summary:
Disallowing plugins from requiring anything but flipper or their own package broke lots of plugins at yarn start.
The ones that broke, require from the static directory.
Allowing them for now to unblock people.
Reviewed By: passy
Differential Revision: D10358733
fbshipit-source-id: 37077c806e022a6eb7ecf9bc95a455bf6f9a34d8
Summary:
Plugins can not require files outside their folder, to make sure they don't pull in any dependencies from Flipper which are not exported by the main app.
However, those imports simply resolve to `undefined`. This diff adds a check in the babel-transform for plugins and throws an error if something from outside the plugin is required.
Reviewed By: passy
Differential Revision: D10297980
fbshipit-source-id: 1606f3211103281f9f4aa7bb2f3ca4d085d0ea1b
Summary:
Adds a test runner for jest test and adds three simple test cases:
- render the app
- start a server
- client connecting to the app
Test can be run using `yarn test`.
To make the test runner work, some changes needed to be made:
- remove the export of `init()` from `'flipper'`, because it was a cyclic dependency
- updating Button.js to the new ref-API
Reviewed By: jknoxville
Differential Revision: D10027078
fbshipit-source-id: 49107b0dd4dec666b92ecd841422fe7e6b3a7756
Summary: Adds support for optional chaining to the codebase, enables flow and eslint support for it.
Reviewed By: passy
Differential Revision: D9940732
fbshipit-source-id: 730aa76653bd22a8fa17a73e72b3a7329de0226c
Summary: upgrading to babel 7 and upgrading all presets and plugins as well
Reviewed By: passy
Differential Revision: D9940733
fbshipit-source-id: 24f45c78a9452899e6fb140a56028dd9fa0b5ea3