Commit Graph

312 Commits

Author SHA1 Message Date
Michel Weststrate
5df34a337c Unshare global types
Summary:
This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package.

This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup.

As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same.

Reviewed By: lawrencelomax

Differential Revision: D33124441

fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
2021-12-17 07:36:07 -08:00
Michel Weststrate
dcfeb4a4d5 Clean up packages and types
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
2021-12-16 14:54:59 -08:00
Michel Weststrate
accef856fc Remove remaining Node imports from core
Summary:
Removed remaining path / fs imports from Flipper core.

`expand-tide` needed replacement too, but noticed that it never actually rewrites paths since all use cases were already using absolute paths, so removed it instead.

Reviewed By: aigoncharov

Differential Revision: D33017654

fbshipit-source-id: e12f66ef68b5f9e4279411c94445a2fb87249e9a
2021-12-13 05:48:17 -08:00
Michel Weststrate
d95b15094f Implement fs.readFile / fs.writeFile
Summary: Per title. Made an explicit distinction between binary and non binary files, since they need to be encoded differently. This keeps both the implementation and API simpler (in terms of overloading / type checking)

Reviewed By: aigoncharov

Differential Revision: D33016031

fbshipit-source-id: 3c99956eb016849a908a171d88a7a64a88b76268
2021-12-13 05:48:17 -08:00
Michel Weststrate
34a1da3345 Implement fs.stat and fs.readlink
Summary: Fixes issue for the stackTraceMapper

Reviewed By: aigoncharov

Differential Revision: D32987161

fbshipit-source-id: 660f49a1bdf61b2fd2963874ef23dfd284f71128
2021-12-13 05:48:17 -08:00
Andrey Goncharov
c96558a524 Remove fs and os usage from Mobile Builds plugin
Summary: Changelog: Expose env info and FS rm command to flipper plugins.

Reviewed By: mweststrate

Differential Revision: D32988478

fbshipit-source-id: 3d0233f9eb34d3478b07e39b9401c0e30ca95135
2021-12-10 06:36:13 -08:00
Andrey Goncharov
92f0ed67f4 Add download file API
Summary: Changelog: Expose "downloadFile" API to Flipper plugins. Allow them to download files form the web to Flipper Server.

Reviewed By: mweststrate

Differential Revision: D32950685

fbshipit-source-id: 7b7f666e165ff7bf209230cdc96078272ede3616
2021-12-10 06:36:12 -08:00
Andrey Goncharov
4cb80a452f Rename RemoteNodeAPI tp RemoteServerContext
Reviewed By: mweststrate

Differential Revision: D32921160

fbshipit-source-id: 9d6b723427d7a819f2fc1b7168f6d1077dc56bd9
2021-12-10 06:36:12 -08:00
Andrey Goncharov
0e785fb18d Add remote fs API
Summary: Changelog: Expose Flipper Server FS access to Flipper plugins

Reviewed By: lblasa

Differential Revision: D32883144

fbshipit-source-id: 47637b61849ef60a2d8fe91a0a28d2a358e0b8c4
2021-12-10 06:36:12 -08:00
Andrey Goncharov
e458ae76f9 Add exec Node API to FlipperLib
Summary: Changelog: Allow flipper plugins to run "exec" Node API on Flipper server.

Reviewed By: mweststrate

Differential Revision: D32881149

fbshipit-source-id: 46486a47ee9824ca68897c19fd86b4afc7f8bf1d
2021-12-10 06:36:12 -08:00
Michel Weststrate
f5f9608098 Remove crypto dependency
Summary:
Remove crypto dep, which was only used by NUX, to hash the elements that has been confirmed.

Sadly trickier than hoped; there is no uniform api in both browser and Node available that can take a sha-256 hash, and the browser APIs are async.

Reviewed By: aigoncharov

Differential Revision: D32721204

fbshipit-source-id: 32625f83bf6c60cedc4fb7096240c2fa0d8434a7
2021-12-08 04:30:56 -08:00
Michel Weststrate
f9b72ac69e Move RenderHost initialisation to Jest
Summary:
This diff moves RenderHost initialisation to jest, which is thereby treated as just another 'Host' like flipper-ui, the electron app etc. A benefit is that it provides a mocked flipperServer by default that can be used to mock or intercept requests. See LaunchEmulator.spec as example.

Also made the jest setup scripts strongly typed by converting them to TS.

This change allows the test stub configuration, which was OS dependent, out of flipper-ui-core.

Reviewed By: nikoant

Differential Revision: D32668632

fbshipit-source-id: fac0c09812b000fd7d1acb75010c35573087c99f
2021-12-08 04:30:55 -08:00
Michel Weststrate
e7f841b6d2 Move flipper plugin from flipper-lib types to flipper-common
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.

Reviewed By: nikoant, aigoncharov

Differential Revision: D32665064

fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
2021-12-08 04:30:55 -08:00
Michel Weststrate
29a907c733 Remove usage of 'events' package
Summary: 'events' doesn't exist in the browser, so picked a popular package with the same API

Reviewed By: lblasa, aigoncharov

Differential Revision: D32643057

fbshipit-source-id: 91309e53e16f3279048aa976cdb098eaa4a7d7db
2021-12-08 04:30:55 -08:00
Michel Weststrate
bca169df73 Move settings, launcherSettings, GKs to app / flipper-server-core
Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).

This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.

Reviewed By: passy, aigoncharov

Differential Revision: D32498649

fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
2021-12-08 04:30:54 -08:00
Michel Weststrate
eed19b3a3d Move FlipperServer initialisation out of flipper-core
Summary: This diff makes sure flipper-ui-core no longer depends on flipper-server-core. Currently server config is still transferred from UI to server, which doesn't really make sense in future scenarios where server might start before client, but will address that separately

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32462835

fbshipit-source-id: 498a944256ba1aabbf963b896953e64d11e27214
2021-12-08 04:30:54 -08:00
Andrey Goncharov
5610f8f058 Remove 'path' from plugins
Summary:
1. Add `path` replacement
1. Remove Node's path for all plugins but MobileBuildsPluginContainer (it is probably going to be moved to the server)

Reviewed By: mweststrate

Differential Revision: D32766327

fbshipit-source-id: e636f273842506e752b97cf1b28ce7ac51ce9a12
2021-12-02 04:14:51 -08:00
Kyle Mathews
090dc5e30b Fix typo (#3116)
Summary:
## Changelog

Pull Request resolved: https://github.com/facebook/flipper/pull/3116

Reviewed By: jknoxville

Differential Revision: D32698504

Pulled By: passy

fbshipit-source-id: 0a8b5cb837179315def1298c10a22384572ce644
2021-11-30 05:32:48 -08:00
Andrey Goncharov
225a2a7e34 Refactor Stella plugin
Summary:
1. Replace old FileSelector with the new FileSelector
2. Remove showOpenDialog from FlipperLib

Reviewed By: mweststrate

Differential Revision: D32667103

fbshipit-source-id: be8da034c2695f83b397b6c7d35bc6aee78d66e5
2021-11-26 08:30:13 -08:00
Andrey Goncharov
b82c41eedd Add FileSelector shared component
Summary: Add shared FileSelector component compatibe with the new FlipperLib API

Reviewed By: mweststrate

Differential Revision: D32667100

fbshipit-source-id: dca1e8b7693d134a99617e916c7cfd30432cef78
2021-11-26 08:30:13 -08:00
Andrey Goncharov
3491926d17 Support importing multiple files and encoding
Summary:
1. Support importing multiple files
2. Support file encoding

Reviewed By: mweststrate

Differential Revision: D32540132

fbshipit-source-id: 7c2a96ac585f58d01457cb487527940e333da615
2021-11-26 08:30:13 -08:00
Daniel Kohli
4d381a094b Update SidebarInteractiveContainer Flex Parameter to Allow for Both Grow and Shrink
Summary:
- Per the title, we're explicitly setting the `flex-basis` to 0 and `flex-grow` and `flex-shrink` to 1.
- We've noticed that the `Sidebar` does not allow shrinking less than half the page when `flex-basis` is 1.
- With this change, we can now resize the `Sidebar` component without issue.
- ** We're taking this approach because the linter has issues with us using `styled` with `Sidebar` **

#nocancel

Differential Revision: D32477863

fbshipit-source-id: 99a50bc047d59add833c1fc113ab159c08767e05
2021-11-19 07:28:11 -08:00
Andrey Goncharov
a279b9bc43 Remove fs.readFile from some plugins
Summary:
1. Remove fs.readFile from some plugins
2. Add "importFile" to FlipperLib and RenderHost

See D32492149 for context

Followups:

1. Decapitate Stella's sendToPhone
2. Decapitate crash reporter
3. Figure out how to approach navigation
4. Figure out how to approach FileSelector

Reviewed By: mweststrate

Differential Revision: D32496775

fbshipit-source-id: e150aa56a2c2c1eb12a4c03c801f76cd76485a9d
2021-11-18 09:15:30 -08:00
Andrey Goncharov
2c7bc0a952 Remove fs.write from plugins
Summary:
1. Remove "fs.writeFile" from plugins
2. Remove "showSaveDialog" from "FlipperLib"
3. Add "exportFile" to "FlipperLib" and "RenderHost"

As we are going to use Flipper in a browser as well, instead of providing low-level abstraction like "showSaveDialog", we should provide more high-level ones like "exportFile". In browsers it does not make too much sense to expose "showSaveDialog" as there is not way to use the returned file path to write to it.
In the end, "exportFile" is going to trigger a file download for browsers and show the save dialog and write to the returned file path for Electron.

Reviewed By: mweststrate

Differential Revision: D32492149

fbshipit-source-id: 0673119bdb7670a5872f5982c7d82dfc44eb7906
2021-11-18 09:15:30 -08:00
3rdp
c4577bfee2 Fix dark diff background colors (#3065)
Summary:
Bug fix. Currenty Flipper provides incorrect red and green diff colors in Dark theme, this PR fixes the issue. Light theme colors are the same.

Closes https://github.com/facebook/flipper/issues/3011

## Changelog

Color theme fix: make diff background colors be defined in theme LESS files

Pull Request resolved: https://github.com/facebook/flipper/pull/3065

Test Plan:
I used [redux-debugger](https://github.com/jk-gan/flipper-plugin-redux-debugger) plugin to test this as this is what I actually use for debugging Redux in React Native projects with Flipper. Here's a [React Native app](https://github.com/3rdp/flipper-redux-debugger-app) that I put together for testing purposes.

Light theme:
![lime2 light](https://user-images.githubusercontent.com/8898635/141799686-8b94655f-2501-46f9-9b28-d9ba8aeee222.png)

Dark theme:
![lime2](https://user-images.githubusercontent.com/8898635/141799710-fbd008a5-28cc-46f3-abf7-6b90fd85facb.png)

Reviewed By: mweststrate

Differential Revision: D32529276

Pulled By: passy

fbshipit-source-id: 3d11edaf1112444bb106521b6b30db4a4c2b8202
2021-11-18 06:22:17 -08:00
Pascal Hartig
c0a0fa5dd8 Bump deps
Summary: Preempting dependabot by bumping a few patch and minor releases.

Reviewed By: timur-valiev

Differential Revision: D32434931

fbshipit-source-id: 77a3ec760f08262a118e12318d7601e031730a9a
2021-11-16 10:33:14 -08:00
Andrey Goncharov
ed5c2bd39f Add plugin actions menu
Summary: See D32311662 for details

Reviewed By: mweststrate

Differential Revision: D32329804

fbshipit-source-id: 26670353fdf8580643afcb8bc3493384146f5574
2021-11-12 07:13:56 -08:00
dependabot[bot]
34a09a3096 Bump react-virtual from 2.8.0 to 2.8.2 in /desktop (#2999)
Summary:
Bumps [react-virtual](https://github.com/tannerlinsley/react-virtual) from 2.8.0 to 2.8.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/tannerlinsley/react-virtual/releases">react-virtual's releases</a>.</em></p>
<blockquote>
<h2>v2.8.2</h2>
<h2><a href="https://github.com/tannerlinsley/react-virtual/compare/v2.8.1...v2.8.2">2.8.2</a> (2021-09-30)</h2>
<h3>Performance Improvements</h3>
<ul>
<li>reuse already measure items, include key into virtualItem (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/179">https://github.com/facebook/flipper/issues/179</a>) (<a href="8cb22fb46f">8cb22fb</a>)</li>
</ul>
<h2>v2.8.1</h2>
<h2><a href="https://github.com/tannerlinsley/react-virtual/compare/v2.8.0...v2.8.1">2.8.1</a> (2021-08-05)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Page Title (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/177">https://github.com/facebook/flipper/issues/177</a>) (<a href="38726c8a7d">38726c8</a>)</li>
<li>range calculated only on scroll (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/166">https://github.com/facebook/flipper/issues/166</a>) (<a href="adf60b3f31">adf60b3</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="8cb22fb46f"><code>8cb22fb</code></a> perf: reuse already measure items, include key into virtualItem (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/179">https://github.com/facebook/flipper/issues/179</a>)</li>
<li><a href="433d9663ce"><code>433d966</code></a> Update CarbonAds.js</li>
<li><a href="121a5dfad7"><code>121a5df</code></a> docs(index): Fix typo in 'dyanmically' (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/176">https://github.com/facebook/flipper/issues/176</a>)</li>
<li><a href="adf60b3f31"><code>adf60b3</code></a> fix: range calculated only on scroll (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/166">https://github.com/facebook/flipper/issues/166</a>)</li>
<li><a href="38726c8a7d"><code>38726c8</code></a> fix: Page Title (<a href="https://github-redirect.dependabot.com/tannerlinsley/react-virtual/issues/177">https://github.com/facebook/flipper/issues/177</a>)</li>
<li><a href="80207b716a"><code>80207b7</code></a> Update index.js</li>
<li><a href="7c2501ee08"><code>7c2501e</code></a> new gh header</li>
<li><a href="36d57d323c"><code>36d57d3</code></a> Update README.md</li>
<li><a href="b72c0291a5"><code>b72c029</code></a> Update overview.md</li>
<li><a href="31ed0e323a"><code>31ed0e3</code></a> docs: fix links</li>
<li>Additional commits viewable in <a href="https://github.com/tannerlinsley/react-virtual/compare/v2.8.0...v2.8.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=react-virtual&package-manager=npm_and_yarn&previous-version=2.8.0&new-version=2.8.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/2999

Reviewed By: passy

Differential Revision: D31991577

Pulled By: mweststrate

fbshipit-source-id: b81c96b80478c4ae92aac26e809eabec8dbe90e9
2021-11-11 12:21:58 -08:00
almouro
5b603ab976 Ensure desktop plugin template tests run (#3039)
Summary:
I've decided to migrate [a desktop plugin](https://github.com/bamlab/react-native-performance) to Sandy.
When doing so, I decided to rise to the challenge from the [Flipper docs](https://fbflipper.com/docs/tutorial/js-custom#testing-plugin-logic):  `we are going to pretend that we always write unit tests first` 😅

However, I've realized that when creating a plugin with `npx flipper-pkg init`, running `yarn jest` directly after creation actually fails.

There are 3 issues solved in the different commits:
1. an absolute import seem to not be resolved, since all the other imports were relative in the file, I changed it as well

2. some dependencies are missing.
They used to be included in the `flipper` dependency but when migrating to use `flipper-plugin` instead, they're not present anymore.
I don't think this is an ideal fix, I would believe a dependency like a `flipper-dev-environment` including all of those would be more appropriate. So I'm open to suggestions to fix/remove of course

3. jest.config needs to be fixed to run in jsdom environment and ensure we can test the react component

## Changelog

Fix: ensure desktop plugin template tests run

Pull Request resolved: https://github.com/facebook/flipper/pull/3039

Test Plan:
I've cloned the repo and run:

```
cd flipper/desktop/pkg
yarn
cd ../../..
./flipper/desktop/pkg/bin/run init
```
I run the tests on the newly package created, but it actually still failed because of the first issue (since it still installed `flipper-plugin` from npm`)

However, by adding this patch, it now runs!
```patch
 diff --git a/node_modules/flipper-plugin/lib/ui/data-table/DataTable.js b/node_modules/flipper-plugin/lib/ui/data-table/DataTable.js
index 2e07ff5..ff3181d 100644
 --- a/node_modules/flipper-plugin/lib/ui/data-table/DataTable.js
+++ b/node_modules/flipper-plugin/lib/ui/data-table/DataTable.js
@@ -39,7 +39,7 @@ const useAssertStableRef_1 = require("../../utils/useAssertStableRef");
 const PluginContext_1 = require("../../plugin/PluginContext");
 const lodash_1 = require("lodash");
 const useInUnitTest_1 = require("../../utils/useInUnitTest");
-const createDataSource_1 = require("flipper-plugin/src/state/createDataSource");
+const createDataSource_1 = require("../../state/createDataSource");
 function DataTable(props) {
     var _a, _b;
     const { onRowStyle, onSelect, onCopyRows, onContextMenu } = props;
```

Reviewed By: aigoncharov

Differential Revision: D32358207

Pulled By: mweststrate

fbshipit-source-id: 7761b4150c24dd5379a24c3c1deeb78bf3dda4ee
2021-11-11 12:07:49 -08:00
Michel Weststrate
96cd25fcc1 Fix NPE in Interactive.tsx
Summary: Fixed some incorrect non-null assertions that showed up in monitoring.

Reviewed By: timur-valiev

Differential Revision: D32278433

fbshipit-source-id: afe4913d8aef38c371461b4d0b817b2625153de1
2021-11-09 05:23:07 -08:00
dependabot[bot]
b9e41cc787 Bump @emotion/css from 11.1.3 to 11.5.0 in /desktop (#3020)
Summary:
Bumps [emotion/css](https://github.com/emotion-js/emotion) from 11.1.3 to 11.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/emotion-js/emotion/releases"><code>@​emotion/css</code>'s releases</a>.</em></p>
<blockquote>
<h2><code>@​emotion/css</code><a href="https://github.com/11"><code>@​11</code></a>.5.0</h2>
<h3>Patch Changes</h3>
<ul>
<li>
<p><a href="https://github-redirect.dependabot.com/emotion-js/emotion/pull/2498">https://github.com/facebook/flipper/issues/2498</a> <a href="e5beae8e32"><code>e5beae8e</code></a> Thanks <a href="https://github.com/Andarist"><code>@​Andarist</code></a>! - Fixed an edge case issue with incorrect rules being generated. When a context selector (<code>&amp;</code>) was used not at the beginning of a selector (which is not valid SCSS but is allowed by the Stylis parser that we are using) within a group of selectors containing a pseudoclass then it was not replaced correctly with the current context selector.</p>
</li>
<li>
<p>Updated dependencies [<a href="e5beae8e32"><code>e5beae8e</code></a>, <a href="9ae4a91a08"><code>9ae4a91a</code></a>, <a href="f2eda82954"><code>f2eda829</code></a>]:</p>
<ul>
<li><code>@​emotion/cache</code><a href="https://github.com/11"><code>@​11</code></a>.5.0</li>
<li><code>@​emotion/sheet</code><a href="https://github.com/1"><code>@​1</code></a>.0.3</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="4be3391914"><code>4be3391</code></a> Version Packages (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2495">https://github.com/facebook/flipper/issues/2495</a>)</li>
<li><a href="f2eda82954"><code>f2eda82</code></a> Prevent flush from raising error on detached tag (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2447">https://github.com/facebook/flipper/issues/2447</a>)</li>
<li><a href="d7d768e056"><code>d7d768e</code></a> Implement automatic adding of jsxImportSource pragma definition (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2353">https://github.com/facebook/flipper/issues/2353</a>)</li>
<li><a href="685bbec099"><code>685bbec</code></a> Improve readability of the <code>extractCriticalToChunks</code> example in the docs (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2460">https://github.com/facebook/flipper/issues/2460</a>)</li>
<li><a href="218e4f78ca"><code>218e4f7</code></a> Add <code>RegExp</code> as a valid type for the <code>target</code> option accepted by `toHaveStyle...</li>
<li><a href="eda5e687c0"><code>eda5e68</code></a> Fix error in alternative JS environments (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2500">https://github.com/facebook/flipper/issues/2500</a>)</li>
<li><a href="84522ded6e"><code>84522de</code></a> fix: update docs references (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2497">https://github.com/facebook/flipper/issues/2497</a>)</li>
<li><a href="500cdd828b"><code>500cdd8</code></a> Support typings for Jest v27 (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2456">https://github.com/facebook/flipper/issues/2456</a>)</li>
<li><a href="e5beae8e32"><code>e5beae8</code></a> Fixed an issue with context selector not at the beginning (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2498">https://github.com/facebook/flipper/issues/2498</a>)</li>
<li><a href="63a0a6c5d1"><code>63a0a6c</code></a> Fix URLs in the <code>docs/extract-static.mdx</code> (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2496">https://github.com/facebook/flipper/issues/2496</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/emotion-js/emotion/compare/emotion/css@11.1.3...@emotion/css@11.5.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@emotion/css&package-manager=npm_and_yarn&previous-version=11.1.3&new-version=11.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/3020

Reviewed By: passy

Differential Revision: D32202498

Pulled By: mweststrate

fbshipit-source-id: bcc677dad5e218a72a2e58b55632f93509ecde99
2021-11-05 05:29:55 -07:00
dependabot[bot]
b98eddd82f Bump jest-mock-console from 1.1.0 to 1.2.3 in /desktop (#2989)
Summary:
Bumps [jest-mock-console](https://github.com/bpedersen/jest-mock-console) from 1.1.0 to 1.2.3.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/bpedersen/jest-mock-console/commits">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=jest-mock-console&package-manager=npm_and_yarn&previous-version=1.1.0&new-version=1.2.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/2989

Reviewed By: passy

Differential Revision: D32202558

Pulled By: mweststrate

fbshipit-source-id: c8a21d7639f66d2825558b7ee4e01b58a86aac83
2021-11-05 05:29:55 -07:00
dependabot[bot]
199b14a4eb Bump @emotion/react from 11.4.1 to 11.5.0 in /desktop (#3022)
Summary:
Bumps [emotion/react](https://github.com/emotion-js/emotion) from 11.4.1 to 11.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/emotion-js/emotion/releases"><code>@​emotion/react</code>'s releases</a>.</em></p>
<blockquote>
<h2><code>@​emotion/react</code><a href="https://github.com/11"><code>@​11</code></a>.5.0</h2>
<h3>Patch Changes</h3>
<ul>
<li>
<p><a href="https://github-redirect.dependabot.com/emotion-js/emotion/pull/2498">https://github.com/facebook/flipper/issues/2498</a> <a href="e5beae8e32"><code>e5beae8e</code></a> Thanks <a href="https://github.com/Andarist"><code>@​Andarist</code></a>! - Fixed an edge case issue with incorrect rules being generated. When a context selector (<code>&amp;</code>) was used not at the beginning of a selector (which is not valid SCSS but is allowed by the Stylis parser that we are using) within a group of selectors containing a pseudoclass then it was not replaced correctly with the current context selector.</p>
</li>
<li>
<p><a href="https://github-redirect.dependabot.com/emotion-js/emotion/pull/2500">https://github.com/facebook/flipper/issues/2500</a> <a href="eda5e687c0"><code>eda5e687</code></a> Thanks <a href="https://github.com/Jarred-Sumner"><code>@​Jarred-Sumner</code></a>! - Fix error loading <code>@​emotion/react</code> in alternative JS environments</p>
</li>
<li>
<p>Updated dependencies [<a href="e5beae8e32"><code>e5beae8e</code></a>, <a href="9ae4a91a08"><code>9ae4a91a</code></a>, <a href="f2eda82954"><code>f2eda829</code></a>]:</p>
<ul>
<li><code>@​emotion/cache</code><a href="https://github.com/11"><code>@​11</code></a>.5.0</li>
<li><code>@​emotion/sheet</code><a href="https://github.com/1"><code>@​1</code></a>.0.3</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="4be3391914"><code>4be3391</code></a> Version Packages (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2495">https://github.com/facebook/flipper/issues/2495</a>)</li>
<li><a href="f2eda82954"><code>f2eda82</code></a> Prevent flush from raising error on detached tag (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2447">https://github.com/facebook/flipper/issues/2447</a>)</li>
<li><a href="d7d768e056"><code>d7d768e</code></a> Implement automatic adding of jsxImportSource pragma definition (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2353">https://github.com/facebook/flipper/issues/2353</a>)</li>
<li><a href="685bbec099"><code>685bbec</code></a> Improve readability of the <code>extractCriticalToChunks</code> example in the docs (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2460">https://github.com/facebook/flipper/issues/2460</a>)</li>
<li><a href="218e4f78ca"><code>218e4f7</code></a> Add <code>RegExp</code> as a valid type for the <code>target</code> option accepted by `toHaveStyle...</li>
<li><a href="eda5e687c0"><code>eda5e68</code></a> Fix error in alternative JS environments (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2500">https://github.com/facebook/flipper/issues/2500</a>)</li>
<li><a href="84522ded6e"><code>84522de</code></a> fix: update docs references (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2497">https://github.com/facebook/flipper/issues/2497</a>)</li>
<li><a href="500cdd828b"><code>500cdd8</code></a> Support typings for Jest v27 (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2456">https://github.com/facebook/flipper/issues/2456</a>)</li>
<li><a href="e5beae8e32"><code>e5beae8</code></a> Fixed an issue with context selector not at the beginning (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2498">https://github.com/facebook/flipper/issues/2498</a>)</li>
<li><a href="63a0a6c5d1"><code>63a0a6c</code></a> Fix URLs in the <code>docs/extract-static.mdx</code> (<a href="https://github-redirect.dependabot.com/emotion-js/emotion/issues/2496">https://github.com/facebook/flipper/issues/2496</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/emotion-js/emotion/compare/emotion/react@11.4.1...@emotion/react@11.5.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@emotion/react&package-manager=npm_and_yarn&previous-version=11.4.1&new-version=11.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/3022

Reviewed By: passy

Differential Revision: D32202484

Pulled By: mweststrate

fbshipit-source-id: 85c7df21741e7e19108039199c8c3671258a7c87
2021-11-05 05:29:54 -07:00
Daniel Kohli
67b4b53c20 Rotate Styling for Vertical Sidebar
Summary: - We are using the `Sidebar` component in our `LogViewer` implementation and we noticed that it needed some styling updates to be used properly as a vertical `Sidebar`.

Reviewed By: mweststrate

Differential Revision: D32083159

fbshipit-source-id: 441f3972ae900b5d5f353d3c7b56117c489850ba
2021-11-03 09:48:38 -07:00
Michel Weststrate
2e7015388c Remove remaining Electron imports from product code: paths & env
Summary:
This diff removes most remaining Electron imports, by storing env and path constants on the RenderHost. As nice side effect those paths are all cached now as well.

To make sure RenderHost is initialised before Flipper itself, forced loading Flipper through a require. Otherwise the setup is super sensitive to circular import statements, since a lot of module initialisation code depends on those paths / env vars.

Reviewed By: nikoant

Differential Revision: D31992230

fbshipit-source-id: 91beb430902272aaf4b051b35cdf12d2fc993347
2021-11-03 07:01:21 -07:00
Michel Weststrate
72ce759e61 Remove some unhandled rejections in tests
Summary: Fixed several tests that caused uncaught promise rejects to fire after the tests finished. This caused jest to fail if there are too many of them.

Reviewed By: aigoncharov

Differential Revision: D32118124

fbshipit-source-id: 50734dab6dee2efec7f056940af72858b27b1707
2021-11-03 03:14:08 -07:00
Anton Kastritskiy
4a4cc21d89 Refine DataSource id to use actual key type instead of a wide string type
Summary: Current implementation uses type `string` as a key for indexing items stored in datasource. However, users can provide any key as an index which means that the type of index item can be anything, not only string. This diff introduces a more refined types for the key. It adds another requirement to provide a key property to a generic which is used to infer the index type.

Reviewed By: mweststrate, aigoncharov

Differential Revision: D31895751

fbshipit-source-id: 19ba907bd6f35df87e3fa442db5fc5cec6af174d
2021-10-28 10:44:01 -07:00
Pascal Hartig
0f9698312a Fix capitalization of method reference
Summary: Docs only.

Reviewed By: jknoxville

Differential Revision: D31928323

fbshipit-source-id: 14be8bf89215054e6561fc38f73040ccfae229c4
2021-10-27 02:48:07 -07:00
Michel Weststrate
9763af4c96 Decouple open/save dialogs, reload, shouldUseDarkColors from Electron
Summary: Per title. Less imports from Electron.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D31923504

fbshipit-source-id: dc7557cf7c88c0c8168ba22f7dca7b3e2d339a09
2021-10-26 12:07:22 -07:00
Daniel Kohli
fa7e8a6b37 Add max-width Style Prop to Tabs.tsx
Summary:
- We're using the `Tabs` component from `flipper-plugin` and upon adding them, we noticed that our view being displayed within the tabs no longer scrolled and the tab internally was being stretched far off the screen. (D31538124)
- After egp did some digging, he discovered that by adding the `maxWidth` style property to the inner `Layout.Container`, the tab no longer stretched and the scrolling was restored.
- We played around by adding wrapper elements around the contents of our Tab and adding the same style prop, but this did not yield the same result.

***Would Love some input from the Flipper team as to the best way to ensure that this won't break other's plugins.  Thank you!***

Reviewed By: mweststrate

Differential Revision: D31672790

fbshipit-source-id: 99cab1873f359f4c1827e4c94f2527636884c237
2021-10-25 14:13:35 -07:00
Pascal Hartig
b3fa8dd6c1 Dep bump
Summary:
Took a few iterations to make offline mirror happy, but everything is green now.

allow-large-files

Reviewed By: nikoant

Differential Revision: D31690614

fbshipit-source-id: 38d0d6cb5e3f63b3707d917a1ed6fc6144762731
2021-10-19 09:21:36 -07:00
Michel Weststrate
91d96774f6 Move files to flipper-common
Summary: Moved Logger, sleep, timeout and server contract types to flipper-common packages.

Reviewed By: passy

Differential Revision: D31475790

fbshipit-source-id: 42d2147698875f9e919ad5250f9953f3bff3ec2d
2021-10-12 16:00:52 -07:00
Michel Weststrate
cfd44b592a Further decouple server from UI
Summary: Further decoupling of `server/` from the rest of the code base. Also fixed a problem with promise chaining causing promises to create unhandled rejection errors.

Reviewed By: passy

Differential Revision: D31474919

fbshipit-source-id: 027cccbe9b57d856c94d63c093d39b6cb3e53312
2021-10-12 16:00:52 -07:00
Pascal Hartig
dd190ef2e0 Big dep bump
Summary: Conservatively bumping only patch versions (except the ones we know break stuff).

Reviewed By: nikoant

Differential Revision: D31511737

fbshipit-source-id: 5b55b4689e71975824577f0ac43d806ca37ea232
2021-10-11 02:32:44 -07:00
Michel Weststrate
c3ff0ff355 Set up Flipper decapitated packages
Summary:
This diff introduces the packages necessary for Flipper decapitated.

* flipper-common: utilities & types shared between client, server, flipper-plugin
* flipper-server-core: all device & client management goes in here. Basically flipper's backend
* flipper-ui-core: all UI goes in here, as far as it doesn't depend on Electron
* desktop: the Electron app, will load server-core and ui-core, and glue them together, providing implementations for some electron specific stuff like dialgos
* flipper-server: A node process hosting flipper-server-core, that can be connected to over websockets. And probably can serve a browser version of the UI as well.
* flipper-ui-browser: thin wrapper around flipper-ui-core, providing some browser specific behavior / stubs.
* flipper-dump: (might remove later), but want to hack a quick and dirt flipper dump in here, as alternative way to test flipper-server-core.

This diff just creates the packages, but doesn't move any code, so it can be summarized as:

restoftheowl

Reviewed By: nikoant

Differential Revision: D30218646

fbshipit-source-id: 735598a1261a98e584f52504b5eba01ec0afa162
2021-10-08 01:33:03 -07:00
Michel Weststrate
d56375970d Cleaning up sheet abstraction to use Ant/flipper-plugin dialogs instead
Summary:
This diff cleans up order remaining dialogs, the ones involved in exporting to file or url. Includes some legacy component cleanup boyscouting, but not too much.

This removes a lot of code where state of the wizard was stored globally, and makes it locally instead.

Other code that was removed involves interaction with the old UI, which allowed import / export to be running in the background as well. (which is no longer needed since we optimised the process)

Reviewed By: timur-valiev

Differential Revision: D30192000

fbshipit-source-id: 13be883c5bf217a3d58b610b78516359e9bd0ebc
2021-10-06 09:10:19 -07:00
Michel Weststrate
9e5575cf69 Dialog management cleanup
Summary:
This diff moves the dialogs

* Settings
* Plugin Manager
* Doctor
* Sign in
* Changelog

To use the imperative dialog APIs, rather then organising them through reducers which adds a lot of indirection which isn't really needed but hard to follow.

Reviewed By: passy

Differential Revision: D30192002

fbshipit-source-id: ba38b2e700da3e442653786448fcbf85074981ad
2021-10-06 09:10:19 -07:00
Michel Weststrate
740093d0d9 Separate Client in server and client part
Summary: This diff separates the concept of a Client as now on the UI, from the concept of a Client as known on the server, and makes all interactions with client and vice versa async.

Reviewed By: timur-valiev

Differential Revision: D31235682

fbshipit-source-id: 99089e9b390b4c5359f97f6f2b15bf4b182b6cb9
2021-10-06 09:10:19 -07:00
Pascal Hartig
4aa7439fbf Fix Flipper lints #10
Summary:
Grey -> gray. "Cancelled" seems quite common in APIs though, so I disabled that.
A few promise cleanups

Reviewed By: aigoncharov

Differential Revision: D31323610

fbshipit-source-id: c8863d995936f451c24eb408fe5c26677187f089
2021-10-01 08:08:35 -07:00
Michel Weststrate
ef6e802244 Some Client related cleanups
Summary:
Client up `client.device` (which had no code references anymore) / `client.deviceSync`. Cleaned up feature code for old SDKs (pre 2, which is 3 years old).

This makes decapitating Client a little simpler in the rest of the stack.

Reviewed By: passy

Differential Revision: D31235436

fbshipit-source-id: 919679c1830e2b9368d0787d7b363c090305edb8
2021-09-29 07:01:18 -07:00