Commit Graph

1134 Commits

Author SHA1 Message Date
Anton Kastritskiy
663380e721 mark unused vars as errors
Reviewed By: lblasa

Differential Revision: D50500690

fbshipit-source-id: 6f739fe25c232ecfe842337af4399681e85f6a13
2023-10-20 12:44:58 -07:00
Anton Kastritskiy
fd774a2d52 remove density mentions
Summary: removing dead code

Reviewed By: lblasa

Differential Revision: D50495989

fbshipit-source-id: 769f853b50bf6ec48705dbcec03977ec6a5bffa3
2023-10-20 07:23:34 -07:00
Anton Kastritskiy
a978c96987 large fb icons only, no density
Summary:
Currently we download a bunch of FB icons and we normally use the smallest one available.

In this diff I change the download logic so we try to download from the largest to the smallest icon and use the first one available. One the client we no longer provide the icon of the same size that is requested, instead we provide the only one we have which will typically be larger than needed. This is a good thing because

1. flipper is a local application and we do not need to worry about icons take up broadband and downloading
2. People have high density displayed

I also stopped using density(rest of related code removed in the next diff) for icons as it the icons themselves did not support it.

Reviewed By: lblasa

Differential Revision: D50495194

fbshipit-source-id: f569c2f3b8ee424a67c6d21136e7e113868b8f6a
2023-10-20 07:23:34 -07:00
Lorenzo Blasa
a8be443670 Fixes an issue whereas token was only obtained if one exists
Summary: The token will be generated if one doesn't exist, so always call get token.

Reviewed By: antonk52

Differential Revision: D50494884

fbshipit-source-id: b93ba8ab5ba0c8b48766af3b06e8de94944d08e7
2023-10-20 04:59:41 -07:00
Lorenzo Blasa
bdf5065f10 Expose info endpoint
Summary:
Expose an endpoint to retrieve server environment information.

We can use version information and process number to aid engineers with troubleshooting Flipper.

Reviewed By: antonk52

Differential Revision: D49537325

fbshipit-source-id: 511fe4441638f91cd35f13706ceeeb515051416b
2023-09-22 08:17:48 -07:00
Lorenzo Blasa
b856180530 Use HTTP shutdown instead
Summary: Use the newly exposed HTTP shutdown API. It is simpler.

Reviewed By: antonk52

Differential Revision: D49499264

fbshipit-source-id: 2d81db1d1a66c0b7550ee1245e51d8f1a8671aa6
2023-09-21 06:59:22 -07:00
Lorenzo Blasa
0540d240c0 Remove usage of server enabled
Summary: Used last year to GK server usage. This is obsolete so is safe to remove.

Reviewed By: ivanmisuno

Differential Revision: D49414625

fbshipit-source-id: 9eeff932c59c90dff829e4c6c83bad43a0fd74e3
2023-09-20 04:10:39 -07:00
Pascal Hartig
cd392929e0 FLIPPER_DISABLE_KEYTAR env var to use in-memory impl
Summary: Changelog: FLIPPER_DISABLE_KEYTAR env var can be used to force in-memory implementation

Reviewed By: lblasa

Differential Revision: D49183501

fbshipit-source-id: 4ce886303678485673750417b09f272dd3f66623
2023-09-12 04:21:41 -07:00
Pascal Hartig
554d2f9b83 Bump ES level to 2021
Summary: Updating the remaining tsconfigs to build for an ES2021 target.

Reviewed By: antonk52

Differential Revision: D48687661

fbshipit-source-id: 2761704d251f701594ca5d362a17731f287088ed
2023-08-29 05:06:18 -07:00
Lorenzo Blasa
1360e906f8 Centralise sessionId to a dedicated place
Summary:
The sessionId is just uuid() which is held by the config. This changes moves that to a single place.

This achieves two goals:
1) Makes it very clear where is created and what value it holds
2) It allows us to know the sessionId even before the config is available. This becomes useful as we can start logging to Scribe earlier.

Reviewed By: passy

Differential Revision: D48601829

fbshipit-source-id: c54d86d76f0b58d2b59f8dd1c45d7f345c4a84c3
2023-08-24 06:18:39 -07:00
Lorenzo Blasa
17cfa0e571 Session Id moved to server config
Summary:
Session Id should be shared between client and server, but it was defined deep in the client (redux store).

The proposed solution presented below is to move the session id to the server configuration. By doing this, it becomes available to both server and client VERY early in the application life-cycle for both Electron and non-Electron builds.

Reviewed By: LukeDefeo

Differential Revision: D48520367

fbshipit-source-id: ca959b27ab18b1a2e4cd2fac1d28545664f1b514
2023-08-22 05:16:20 -07:00
Pascal Hartig
160b05a5bd Bump deps
Summary:
This updates minor and patch level dependencies. Frustratingly, I had to revert a bunch
of changes in that version range that still caused incompatibilities and test failures.

If I find time, I'll dig a bit deeper.

Reviewed By: ivanmisuno

Differential Revision: D48433210

fbshipit-source-id: 9ab12e774c1992d4f22cc1428d34f102ce820b75
2023-08-21 03:03:30 -07:00
Lorenzo Blasa
ff6f98fc0d Import File implementation
Summary: Implementation was missing for the browser. This provides a default implementation.

Reviewed By: aigoncharov

Differential Revision: D48311198

fbshipit-source-id: fd067600f571234e0fbccfb90853b62f175ff8fb
2023-08-14 11:33:06 -07:00
Lorenzo Blasa
b5ed57b7d0 Remove UDS and thus the need for a proxy server
Summary: This change removes the UDS support and thus the need for having a proxy server.

Reviewed By: antonk52

Differential Revision: D48265244

fbshipit-source-id: c76bb4afba63959ddd17901b3887aa278b000beb
2023-08-11 08:19:51 -07:00
Lorenzo Blasa
7f3f1c0507 TCP is the only option so remove unused branches
Summary: As TCP is the only option, remove all branches.

Reviewed By: passy

Differential Revision: D48265093

fbshipit-source-id: 174527f05d8a841797fd95256e77fdeb9b2e6ad5
2023-08-11 08:19:51 -07:00
Sanjaiyan Parthipan
7cef8286f9 Concurrent Function Upgrade for Enhanced Performance (#4918)
Summary:
Republishing sanjaiyan-dev's PR https://github.com/facebook/flipper/pull/4889 running `git rebase` because of a conflict.

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

Reviewed By: lblasa

Differential Revision: D47294545

Pulled By: passy

fbshipit-source-id: 74904ec6179ed5a3bab6f9b701c3cd769ecad3bf
2023-07-17 04:43:14 -07:00
Lorenzo Blasa
2f617d5eab Fix Windows
Summary: For Windows, we cannot use UDS, so use TCP instead.

Reviewed By: antonk52

Differential Revision: D47436314

fbshipit-source-id: ee2454f9f77b3642f4988957eefc250a64bf02b6
2023-07-13 06:44:19 -07:00
Lorenzo Blasa
165a989cc6 Use setProcessState
Summary:
`setProcessState` does some adjusting to PATH. This was only ever done for Electron.

This change moves that functionality to FlipperServerImpl which is the one what orchestrates. By doing this, flipper server also benefits from getting these adjustments.

Reviewed By: antonk52

Differential Revision: D46836659

fbshipit-source-id: f98291d320cf9b7f3808223af8745c068b1318ce
2023-06-19 04:05:07 -07:00
Michel Weststrate
56694b441e Use assets_DO_NOT_HARDCODE in public as well
Summary: Since ~couple of days to last week we cannot download image assets anymore from facebook.com during build, which is worked around in previous diff. This diff fixes it also in the development environment (`yarn start`)

Reviewed By: lblasa

Differential Revision: D46556075

fbshipit-source-id: ee5d912fb06d1632c41ff6d536b64a55608f5848
2023-06-09 04:01:17 -07:00
Lorenzo Blasa
2815ba0fb8 Copy/Paste implementation
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D46515194

fbshipit-source-id: 0ee6931569d5248d5643b391683e230e0c095e41
2023-06-07 06:04:46 -07:00
Lorenzo Blasa
98f376ec69 Use auth token when connecting to existing server from Electron
Summary:
All clients need to provide an authentication token before connecting. Electron app is no different.

This change adds the authentication token whether we are connecting over UDS or TCP.

Before this change, if Flipper server was already running, launching the Electron app would look similar to this:

{F1016961594}

Reviewed By: antonk52

Differential Revision: D46418758

fbshipit-source-id: f00ffe675df78403d5921250e3e9ed9331a55bde
2023-06-05 05:26:10 -07:00
Lorenzo Blasa
353e51e2ea Better error message format
Summary:
The existing error message was not in the centre and didn't give any possible remediation steps.

{F1015240268}

Reviewed By: passy

Differential Revision: D46394149

fbshipit-source-id: 09d450bef9df83c5b3af3ba49c7e0fafb81bfdce
2023-06-02 09:35:32 -07:00
Lorenzo Blasa
a96caacb2b EnvironmentInfo as argument to start server
Summary:
Clean initialisation by passing down the environment info to start server.

(Also rename dir to path as that's the name used in other places)

Reviewed By: passy

Differential Revision: D45731751

fbshipit-source-id: a60fdd49c567fc312d1f8da72db3a46a0828c140
2023-05-11 04:10:16 -07:00
Lorenzo Blasa
b94f6b6152 Set the right environment info for headless builds
Summary: The isHeadlessBuild flag was not properly set.

Reviewed By: antonk52

Differential Revision: D45728435

fbshipit-source-id: 3616c4358114d4f3d96372766dabf48b27b44333
2023-05-10 04:35:17 -07:00
dependabot[bot]
075de45076 Bump react-refresh from 0.11.0 to 0.14.0 in /desktop (#4540)
Summary:
Bumps [react-refresh](https://github.com/facebook/react/tree/HEAD/packages/react) from 0.11.0 to 0.14.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/facebook/react/releases">react-refresh's releases</a>.</em></p>
<blockquote>
<h2>v0.14.0</h2>
<p>See <a href="http://facebook.github.io/react/blog/2015/10/07/react-v0.14.html">http://facebook.github.io/react/blog/2015/10/07/react-v0.14.html</a>.</p>
<h2>v0.13.3</h2>
<h3>React Core</h3>
<h4>New Features</h4>
<ul>
<li>Added <code>clipPath</code> element and attribute for SVG</li>
<li>Improved warnings for deprecated methods in plain JS classes</li>
</ul>
<h4>Bug Fixes</h4>
<ul>
<li>Loosened <code>dangerouslySetInnerHTML</code> restrictions so <code>{__html: undefined}</code> will no longer throw</li>
<li>Fixed extraneous context warning with non-pure <code>getChildContext</code></li>
<li>Ensure <code>replaceState(obj)</code> retains prototype of <code>obj</code></li>
</ul>
<h3>React with Add-ons</h3>
<h3>Bug Fixes</h3>
<ul>
<li>Test Utils: Ensure that shallow rendering works when components define <code>contextTypes</code></li>
</ul>
<h2>v0.13.2</h2>
<h3>React Core</h3>
<h4>New Features</h4>
<ul>
<li>Added <code>strokeDashoffset</code>, <code>flexPositive</code>, <code>flexNegative</code> to the list of unitless CSS properties</li>
<li>Added support for more DOM properties:
<ul>
<li><code>scoped</code> - for <code>&lt;style&gt;</code> elements</li>
<li><code>high</code>, <code>low</code>, <code>optimum</code> - for <code>&lt;meter&gt;</code> elements</li>
<li><code>unselectable</code> - IE-specific property to prevent user selection</li>
</ul>
</li>
</ul>
<h4>Bug Fixes</h4>
<ul>
<li>Fixed a case where re-rendering after rendering null didn't properly pass context</li>
<li>Fixed a case where re-rendering after rendering with <code>style={null}</code> didn't properly update <code>style</code></li>
<li>Update <code>uglify</code> dependency to prevent a bug in IE8</li>
<li>Improved warnings</li>
</ul>
<h3>React with Add-Ons</h3>
<h4>Bug Fixes</h4>
<ul>
<li>Immutabilty Helpers: Ensure it supports <code>hasOwnProperty</code> as an object key</li>
</ul>
<h3>React Tools</h3>
<ul>
<li>Improve documentation for new options</li>
</ul>
<h2>v0.13.1</h2>
<h3>React Core</h3>
<h4>Bug Fixes</h4>
<ul>
<li>Don't throw when rendering empty <code>&lt;select&gt;</code> elements</li>
<li>Ensure updating <code>style</code> works when transitioning from <code>null</code></li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/facebook/react/blob/main/CHANGELOG.md">react-refresh's changelog</a>.</em></p>
<blockquote>
<h2>0.14.0 (October 7, 2015)</h2>
<h3>Major changes</h3>
<ul>
<li>Split the main <code>react</code> package into two: <code>react</code> and <code>react-dom</code>.  This paves the way to writing components that can be shared between the web version of React and React Native.  This means you will need to include both files and some functions have been moved from <code>React</code> to <code>ReactDOM</code>.</li>
<li>Addons have been moved to separate packages (<code>react-addons-clone-with-props</code>, <code>react-addons-create-fragment</code>, <code>react-addons-css-transition-group</code>, <code>react-addons-linked-state-mixin</code>, <code>react-addons-perf</code>, <code>react-addons-pure-render-mixin</code>, <code>react-addons-shallow-compare</code>, <code>react-addons-test-utils</code>, <code>react-addons-transition-group</code>, <code>react-addons-update</code>, <code>ReactDOM.unstable_batchedUpdates</code>).</li>
<li>Stateless functional components - React components were previously created using React.createClass or using ES6 classes.  This release adds a <a href="https://reactjs.org/docs/reusable-components.html#stateless-functions">new syntax</a> where a user defines a single <a href="https://reactjs.org/docs/reusable-components.html#stateless-functions">stateless render function</a> (with one parameter: <code>props</code>) which returns a JSX element, and this function may be used as a component.</li>
<li>Refs to DOM components as the DOM node itself. Previously the only useful thing you can do with a DOM component is call <code>getDOMNode()</code> to get the underlying DOM node. Starting with this release, a ref to a DOM component <em>is</em> the actual DOM node. <strong>Note that refs to custom (user-defined) components work exactly as before; only the built-in DOM components are affected by this change.</strong></li>
</ul>
<h3>Breaking changes</h3>
<ul>
<li><code>React.initializeTouchEvents</code> is no longer necessary and has been removed completely. Touch events now work automatically.</li>
<li>Add-Ons: Due to the DOM node refs change mentioned above, <code>TestUtils.findAllInRenderedTree</code> and related helpers are no longer able to take a DOM component, only a custom component.</li>
<li>The <code>props</code> object is now frozen, so mutating props after creating a component element is no longer supported. In most cases, <a href="https://reactjs.org/docs/react-api.html#cloneelement"><code>React.cloneElement</code></a> should be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.</li>
<li>Plain objects are no longer supported as React children; arrays should be used instead. You can use the <a href="https://reactjs.org/docs/create-fragment.html"><code>createFragment</code></a> helper to migrate, which now returns an array.</li>
<li>Add-Ons: <code>classSet</code> has been removed. Use <a href="https://github.com/JedWatson/classnames">classnames</a> instead.</li>
<li>Web components (custom elements) now use native property names.  Eg: <code>class</code> instead of <code>className</code>.</li>
</ul>
<h3>Deprecations</h3>
<ul>
<li><code>this.getDOMNode()</code> is now deprecated and <code>ReactDOM.findDOMNode(this)</code> can be used instead. Note that in the common case, <code>findDOMNode</code> is now unnecessary since a ref to the DOM component is now the actual DOM node.</li>
<li><code>setProps</code> and <code>replaceProps</code> are now deprecated. Instead, call ReactDOM.render again at the top level with the new props.</li>
<li>ES6 component classes must now extend <code>React.Component</code> in order to enable stateless function components. The <a href="https://reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.html#other-languages">ES3 module pattern</a> will continue to work.</li>
<li>Reusing and mutating a <code>style</code> object between renders has been deprecated. This mirrors our change to freeze the <code>props</code> object.</li>
<li>Add-Ons: <code>cloneWithProps</code> is now deprecated. Use <a href="https://reactjs.org/docs/react-api.html#cloneelement"><code>React.cloneElement</code></a> instead (unlike <code>cloneWithProps</code>, <code>cloneElement</code> does not merge <code>className</code> or <code>style</code> automatically; you can merge them manually if needed).</li>
<li>Add-Ons: To improve reliability, <code>CSSTransitionGroup</code> will no longer listen to transition events. Instead, you should specify transition durations manually using props such as <code>transitionEnterTimeout={500}</code>.</li>
</ul>
<h3>Notable enhancements</h3>
<ul>
<li>Added <code>React.Children.toArray</code> which takes a nested children object and returns a flat array with keys assigned to each child. This helper makes it easier to manipulate collections of children in your <code>render</code> methods, especially if you want to reorder or slice <code>this.props.children</code> before passing it down. In addition, <code>React.Children.map</code> now returns plain arrays too.</li>
<li>React uses <code>console.error</code> instead of <code>console.warn</code> for warnings so that browsers show a full stack trace in the console. (Our warnings appear when you use patterns that will break in future releases and for code that is likely to behave unexpectedly, so we do consider our warnings to be “must-fix” errors.)</li>
<li>Previously, including untrusted objects as React children <a href="http://danlec.com/blog/xss-via-a-spoofed-react-element">could result in an XSS security vulnerability</a>. This problem should be avoided by properly validating input at the application layer and by never passing untrusted objects around your application code. As an additional layer of protection, <a href="https://github-redirect.dependabot.com/facebook/react/pull/4832">React now tags elements</a> with a specific <a href="http://www.2ality.com/2014/12/es6-symbols.html">ES2015 (ES6) <code>Symbol</code></a> in browsers that support it, in order to ensure that React never considers untrusted JSON to be a valid element. If this extra security protection is important to you, you should add a <code>Symbol</code> polyfill for older browsers, such as the one included by <a href="https://babeljs.io/docs/usage/polyfill/">Babel’s polyfill</a>.</li>
<li>When possible, React DOM now generates XHTML-compatible markup.</li>
<li>React DOM now supports these standard HTML attributes: <code>capture</code>, <code>challenge</code>, <code>inputMode</code>, <code>is</code>, <code>keyParams</code>, <code>keyType</code>, <code>minLength</code>, <code>summary</code>, <code>wrap</code>. It also now supports these non-standard attributes: <code>autoSave</code>, <code>results</code>, <code>security</code>.</li>
<li>React DOM now supports these SVG attributes, which render into namespaced attributes: <code>xlinkActuate</code>, <code>xlinkArcrole</code>, <code>xlinkHref</code>, <code>xlinkRole</code>, <code>xlinkShow</code>, <code>xlinkTitle</code>, <code>xlinkType</code>, <code>xmlBase</code>, <code>xmlLang</code>, <code>xmlSpace</code>.</li>
<li>The <code>image</code> SVG tag is now supported by React DOM.</li>
<li>In React DOM, arbitrary attributes are supported on custom elements (those with a hyphen in the tag name or an <code>is=&quot;...&quot;</code> attribute).</li>
<li>React DOM now supports these media events on <code>audio</code> and <code>video</code> tags: <code>onAbort</code>, <code>onCanPlay</code>, <code>onCanPlayThrough</code>, <code>onDurationChange</code>, <code>onEmptied</code>, <code>onEncrypted</code>, <code>onEnded</code>, <code>onError</code>, <code>onLoadedData</code>, <code>onLoadedMetadata</code>, <code>onLoadStart</code>, <code>onPause</code>, <code>onPlay</code>, <code>onPlaying</code>, <code>onProgress</code>, <code>onRateChange</code>, <code>onSeeked</code>, <code>onSeeking</code>, <code>onStalled</code>, <code>onSuspend</code>, <code>onTimeUpdate</code>, <code>onVolumeChange</code>, <code>onWaiting</code>.</li>
<li>Many small performance improvements have been made.</li>
<li>Many warnings show more context than before.</li>
<li>Add-Ons: A <a href="https://github-redirect.dependabot.com/facebook/react/pull/3355"><code>shallowCompare</code></a> add-on has been added as a migration path for <code>PureRenderMixin</code> in ES6 classes.</li>
<li>Add-Ons: <code>CSSTransitionGroup</code> can now use <a href="https://github.com/facebook/react/blob/48942b85/docs/docs/10.1-animation.md#custom-classes">custom class names</a> instead of appending <code>-enter-active</code> or similar to the transition name.</li>
</ul>
<h3>New helpful warnings</h3>
<ul>
<li>React DOM now warns you when nesting HTML elements invalidly, which helps you avoid surprising errors during updates.</li>
<li>Passing <code>document.body</code> directly as the container to <code>ReactDOM.render</code> now gives a warning as doing so can cause problems with browser extensions that modify the DOM.</li>
<li>Using multiple instances of React together is not supported, so we now warn when we detect this case to help you avoid running into the resulting problems.</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="3603d45157"><code>3603d45</code></a> v0.14.0</li>
<li><a href="693dd3567b"><code>693dd35</code></a> Update to fbjs@0.3</li>
<li><a href="4a4174b9e8"><code>4a4174b</code></a> 0.14.0-rc1</li>
<li><a href="c04d02e5e8"><code>c04d02e</code></a> Add warnings to React module</li>
<li><a href="52b4c9eabf"><code>52b4c9e</code></a> Upgrade to fbjs, fbjs-scripts @ 0.2</li>
<li><a href="b38509cade"><code>b38509c</code></a> Merge pull request <a href="https://github.com/facebook/react/tree/HEAD/packages/react/issues/4540">https://github.com/facebook/flipper/issues/4540</a> from scottburch/ie8-fix</li>
<li><a href="ecb34de574"><code>ecb34de</code></a> Upgrade ESLint, fix code</li>
<li><a href="3f6bca7b16"><code>3f6bca7</code></a> 0.14.0-beta3</li>
<li><a href="5f01a90954"><code>5f01a90</code></a> Update addons.js</li>
<li><a href="1da2b29897"><code>1da2b29</code></a> added suggested comment to get file to pass es-lint</li>
<li>Additional commits viewable in <a href="https://github.com/facebook/react/commits/v0.14.0/packages/react">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~gnoff">gnoff</a>, a new releaser for react-refresh since your current version.</p>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=react-refresh&package-manager=npm_and_yarn&previous-version=0.11.0&new-version=0.14.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/4540

Reviewed By: ivanmisuno

Differential Revision: D44215184

Pulled By: mweststrate

fbshipit-source-id: e8f33dfbfbe887d49c27f2dabbbc1548de3d10e9
2023-03-24 04:04:16 -07:00
Pascal Hartig
18b6ce6f24 Dep bump
Summary: Combining a bunch of individual tasks for dep upgrades into one diff.

Reviewed By: ivanmisuno

Differential Revision: D42706074

fbshipit-source-id: 054b2545ad1295699f47f4c6eb5065b7b9a1d6a0
2023-01-25 04:35:09 -08:00
Andrey Goncharov
226ccf91f6 Create flipper-server-client package
Summary:
FlipperServerClient is a useful abstraction for any JS-based client of headless Flipper. No need to bundle it with flipper-frontend-core, as the rest is not useful for external clients.
Currently, I am planning to add it to jest-e2e to send commands to Flipper

Reviewed By: lblasa

Differential Revision: D40765668

fbshipit-source-id: af48710bb15444ac1ecd649fe9a2ab252f3088f3
2022-10-31 04:26:43 -07:00
Lorenzo Blasa
587f428cf8 Allow plugins to use css
Summary:
Flipper plugins fail when importing css from third-party dependencies. This diff tries to fix that.

Effectively, the plugin can import the css and export it when is bundled.

When we load the plugin, we check if there's a css file for it. If there's one, we return it and try to use it.

Reviewed By: aigoncharov

Differential Revision: D40758178

fbshipit-source-id: e53afffcc481504905d5eeb1aea1f9114ee2a86b
2022-10-27 22:50:30 -07:00
Andrey Goncharov
3e88a53a3f Fix WebSocket server not starting on Windows
Summary: When Flipper starts with Flipper Server enabled, on Windows we forgot to attach the WebSocket handler. It led to a white screen on Electron or to connection timeout messages on Flipper Server.

Reviewed By: passy, lblasa

Differential Revision: D40679781

fbshipit-source-id: 1c8df8012efc54077409eb8891b1d82ddaf16689
2022-10-26 03:36:04 -07:00
Andrey Goncharov
3314c77ce9 Add exportFileBinary to FlipperLib
Reviewed By: antonk52

Differential Revision: D39692937

fbshipit-source-id: 7b3c78d004a9734cd8ae660d5782be1f02c00009
2022-09-21 09:26:19 -07:00
Andrey Goncharov
8716761cb3 Fix require monkey-patching in electron build
Summary:
In D39311893 (094c5bdfdd) we started monkey-patching `require` to resolve global dependencies in the plugins. Apparently, patching `globalThis.require` did not work in the electron env. On my local machine it kept working because I had the experimental `flipper-server` feature enabled which embeds flipper-server into the electron build. In flipper-server we properly patch `require` via `Module.prototype.require` which affected the global require in electron.
With this fix we now properly patch require in electron via Module.prototype.require all the time

Changelog: Fix plugin loading with experimental flipper-server disabled

Reviewed By: nikoant

Differential Revision: D39633821

fbshipit-source-id: 9554f643c625620d116075ae87f573d8447850f6
2022-09-20 01:36:56 -07:00
Andrey Goncharov
9fc9d6f9b5 Remove redundant exports from 'flipper'
Summary: Prevent getRenderHostInstance leaking into 'flipper' types

Reviewed By: lblasa

Differential Revision: D39574678

fbshipit-source-id: 43932d73fed8b37a2a0791a312ee3d5129a4923f
2022-09-16 06:33:18 -07:00
Andrey Goncharov
642a3ebf81 Remove default plugin entrypoints for hot-reloading
Summary: As we stopped bundling plugins in D39276249, we no longer need the entry points for the bundled plugins (these entry points are always going to be empty)

Reviewed By: lblasa

Differential Revision: D39307565

fbshipit-source-id: 43751fe31c8bd962677c226b27cfe52093d3f2d4
2022-09-15 10:02:19 -07:00
Andrey Goncharov
5515b27499 Fix importing large Flipper exports
Reviewed By: lblasa

Differential Revision: D38945105

fbshipit-source-id: ba78ccfc82b65013b79c6c962de7bdef5ae41a60
2022-08-23 09:46:29 -07:00
Lorenzo Blasa
fbbb793497 Shutdown flipper-server on Flipper Desktop launch
Summary: At launch, if flipper-server is running, send the shutdown message.

Reviewed By: passy

Differential Revision: D38861178

fbshipit-source-id: 4aab5f2b50938cb70a2dfae0d9056df337baecc3
2022-08-19 06:41:38 -07:00
Pascal Hartig
c90ab4ed7b Change author from Facebook Inc to Meta
Reviewed By: mweststrate

Differential Revision: D38828665

fbshipit-source-id: b9beb1f445a0caeed536f2119694da00df825005
2022-08-19 04:31:32 -07:00
Andrey Goncharov
8c2ef5738e Remove Tail
Summary: We no longer need to Tail the logs as we stream the logs over WebSockets (see D37459924 (dcbc7c40bb))

Reviewed By: lblasa

Differential Revision: D37550482

fbshipit-source-id: 92a87f2ba1ecec140bbbb9e71df107341765ad46
2022-06-30 07:50:06 -07:00
Lorenzo Blasa
646b9d5a5d UDS/TCP options
Summary:
Provide an option to enable/disable TCP connections on flipper-server.

The only change at this stage is that Flipper Desktop will use UDS to connect to flipper-server.

Reviewed By: passy

Differential Revision: D37519656

fbshipit-source-id: 3d02084666fde532ec76134edf8cf6a231060a48
2022-06-29 15:01:05 -07:00
Lorenzo Blasa
d1561075bb Shutdown flipper-server, if necessary
Summary:
There are some cases in which we may want to shutdown flipper-server:

- If launching Flipper Desktop and not in GK
- If launching Flipper Desktop and flipper-server usage is disabled via settings

Reviewed By: passy

Differential Revision: D37377059

fbshipit-source-id: 86c11f2726abe47df4aeaca2fd2a9285b112a565
2022-06-24 05:41:46 -07:00
Lorenzo Blasa
335dec1a08 Adds some settings to check flipper-server state
Summary:
There's one setting: to enable or disable flipper-server.

However, I've added some current running state to it. If there's a better way of doing this, please do let me know.

Reviewed By: aigoncharov

Differential Revision: D37276670

fbshipit-source-id: f6c941cf0cfe55c267b9bcb9f799934fba1e28ef
2022-06-22 05:26:11 -07:00
Lorenzo Blasa
8c67b049ab Attach connection handler earlier
Summary:
This change attaches our event handlers as soon as the ws is created.

As a consequence, we need to wait until the server has created any necessary instances required to process incoming requests.

To achieve this, I created a type called `Lazy`.

This type wraps around a value and a promise to that value. Callers can check if the value is set. If not, callers can wait for it.

Ultimately, the value can be set outside of the promise itself.

Reviewed By: passy

Differential Revision: D37284939

fbshipit-source-id: 17dec548d7155a3d65440c9584cec07cbb826c37
2022-06-21 12:48:43 -07:00
Lorenzo Blasa
4b396e1ef3 Use flipper-server if running, otherwise initiate one
Summary:
Provided that GK passes:

- If a flipper-server instance is running, use and connect.

- If not, start flipper-server and connect.

Reviewed By: passy

Differential Revision: D37034960

fbshipit-source-id: ff79e56e80e74415373f84b78305b4fc3e31f7d0
2022-06-09 14:26:17 -07:00
Lorenzo Blasa
054fbf1298 Aggregate existing logs from the ones generated by flipper-server
Summary:
This change aggregates/redirects flipper-server logs with logs generated by the app.

This is a great approach, why:

As we tail the file, we deserialise the logs, and re-log them using console. This means, that they will be intercepted by the logging infrastructure flipper already has in place which will make these logs go to scribe, error reporting, etc.

Reviewed By: passy

Differential Revision: D36473790

fbshipit-source-id: a3547c5c8733217c61bb2d9b94990626bbf0a492
2022-06-01 04:37:36 -07:00
Andrey Goncharov
92cdb81096 Upgrade electron version
Summary:
CHANGELOG: Upgrade electron to 18.2.0.

In Electron 18.2.0 we no longer have access to `remote`. Instead, we are recommended to implement IPC communications. We re-implement `remote` methods used before as IPC commands. To support type-safe execution of the commands, we create electron IPC clients on both sides: the main process and renderer process. We also move the main menu creation to the main process and track its usage via sending IPC messages to the renderer process where the logging happens.

Reviewed By: mweststrate

Differential Revision: D36593625

fbshipit-source-id: 6dcf531461ef2edceb9cac372a650f84f3370953
2022-05-31 06:52:14 -07:00
Andrey Goncharov
4eca8d1088 Add isHeadlessBuild to EnvironmentInfo
Summary: Allows to attribute errors to flipper server or flipper electron

Reviewed By: passy

Differential Revision: D36698504

fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
2022-05-27 02:37:53 -07:00
Lorenzo Blasa
eabc1c556e Extract flipper server instantiation
Summary:
^

This is a very small refactoring and addition to the Flipper Desktop app.

The instantiation of FlipperServer was extracted to a separate function.

This a very tiny change that allows to switch the implementation we use for FlipperServer in a more convenient way.

In this same change, an unused function is added which will create a separate FlipperServer instance that uses a web-socket underneath which makes it possible to use with flipper-server.

So, if interested, it is enough to call that function instead of the one currently in use and it will make Flipper connect to flipper-server instead.

https://pxl.cl/24j8R

Reviewed By: passy

Differential Revision: D36440574

fbshipit-source-id: 94ea2ab7208b898a82ac5e7fd7edd9cb824b4810
2022-05-17 04:20:30 -07:00
Lorenzo Blasa
d4e623c376 Use right path for icons (static)
Summary:
^

I noticed this issue whilst using the Desktop app connected to flipper-server.

So, Flipper Desktop should run as usual with icons being displayed. If connected to flipper-server, behaviour should be the same.

https://pxl.cl/24j73

Reviewed By: passy

Differential Revision: D36440268

fbshipit-source-id: 4c79852d94c8bde95c6e82e2a56bef35a337599d
2022-05-17 04:20:30 -07:00
Andrey Goncharov
d1ed676a48 Remove dynamic dependencies from flipper-server
Summary:
Currently, Flipper Server has a few productions dependencies (mac-ca, node-fetch) that are not bundled with the Flipper Server. It makes it harder to distribute Flipper Server, as now all potential consumers need not only to download the bundle, but also install these additional dependencies.
This diff makes it possible to bundle `mac-ca` and `node-fetch` with Flipper Server. As a result, Flipper Server becomes dependency-free in production.

Reviewed By: lblasa

Differential Revision: D36345213

fbshipit-source-id: 2cd6ba1b3301b45dc2295891964ba020fd107586
2022-05-13 03:19:47 -07:00
Pascal Hartig
342e22bd87 Upgrade more /desktop deps
Summary: More bumps for patch and minor releases. allow-large-files

Reviewed By: aigoncharov

Differential Revision: D36104098

fbshipit-source-id: 6db995e660afbe4febd72aa70ed8150cc16a8c93
2022-05-04 04:03:19 -07:00
Pascal Hartig
ef19d06239 Upgrade metro
Summary: Bunch of dependabot PRs showed that the signal is green, but still wanted to have all in one diff.

Reviewed By: aigoncharov

Differential Revision: D36102480

fbshipit-source-id: 88d472fdc2a910a7441a9e8164fe8af0f2d90f7b
2022-05-04 04:03:19 -07:00