Files
flipper/js/js-flipper
dependabot[bot] 9605df8365 Bump eslint-plugin-import from 2.24.2 to 2.25.4 in /js/js-flipper (#3269)
Summary:
Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.24.2 to 2.25.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/import-js/eslint-plugin-import/releases">eslint-plugin-import's releases</a>.</em></p>
<blockquote>
<h2>v2.25.2</h2>
<p><strong>Full Changelog</strong>: <a href="https://github.com/import-js/eslint-plugin-import/compare/v2.25.1...v2.25.2">https://github.com/import-js/eslint-plugin-import/compare/v2.25.1...v2.25.2</a></p>
<h2>v2.25.1</h2>
<p><strong>Full Changelog</strong>: <a href="https://github.com/import-js/eslint-plugin-import/compare/v2.25.0...v2.25.1">https://github.com/import-js/eslint-plugin-import/compare/v2.25.0...v2.25.1</a></p>
<h2>v2.25.0</h2>
<h2>What's Changed</h2>
<ul>
<li>[Tests] use ESLint class in <code>cli</code> test by <a href="https://github.com/ota-meshi"><code>@​ota-meshi</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2208">import-js/eslint-plugin-import#2208</a></li>
<li>[New] <code>no-unused-modules</code>: add eslint v8 support by <a href="https://github.com/coderaiser"><code>@​coderaiser</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2194">import-js/eslint-plugin-import#2194</a></li>
<li><code>no-restricted-paths</code> support glob patterns by <a href="https://github.com/stropho"><code>@​stropho</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2219">import-js/eslint-plugin-import#2219</a></li>
<li>[New] <code>no-unresolved</code>: add <code>caseSensitiveStrict</code> option by <a href="https://github.com/sergei-startsev"><code>@​sergei-startsev</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/1262">import-js/eslint-plugin-import#1262</a></li>
<li>[New] no-unused-modules: support dynamic imports [2] by <a href="https://github.com/Hypnosphi"><code>@​Hypnosphi</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2212">import-js/eslint-plugin-import#2212</a></li>
<li>[New] <code>no-unused-modules</code>: support dynamic imports  by <a href="https://github.com/maxkomarychev"><code>@​maxkomarychev</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/1660">import-js/eslint-plugin-import#1660</a></li>
<li>[Refactor] switch to an internal replacement for <code>pkg-up</code> and <code>read-pkg-up</code> by <a href="https://github.com/mgwalker"><code>@​mgwalker</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2047">import-js/eslint-plugin-import#2047</a></li>
<li>[Fix] no-unresolved: ignore type-only imports by <a href="https://github.com/jablko"><code>@​jablko</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2220">import-js/eslint-plugin-import#2220</a></li>
<li>[Fix] <code>order</code>: Fix import ordering in TypeScript module declarations by <a href="https://github.com/remcohaszing"><code>@​remcohaszing</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2226">import-js/eslint-plugin-import#2226</a></li>
<li>[Tests] fix skip usage by <a href="https://github.com/jablko"><code>@​jablko</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2232">import-js/eslint-plugin-import#2232</a></li>
<li>[Refactor] <code>no-unresolved</code>, <code>no-extraneous-dependencies</code>: moduleVisitor usage by <a href="https://github.com/jablko"><code>@​jablko</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2233">import-js/eslint-plugin-import#2233</a></li>
<li>Resolve extended TypeScript configuration files by <a href="https://github.com/mrmckeb"><code>@​mrmckeb</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2240">import-js/eslint-plugin-import#2240</a></li>
<li>[New] Support for ESLint v8 by <a href="https://github.com/ota-meshi"><code>@​ota-meshi</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2191">import-js/eslint-plugin-import#2191</a></li>
<li>Release 2.25.0 by <a href="https://github.com/ljharb"><code>@​ljharb</code></a> in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2253">import-js/eslint-plugin-import#2253</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/coderaiser"><code>@​coderaiser</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2194">import-js/eslint-plugin-import#2194</a></li>
<li><a href="https://github.com/sergei-startsev"><code>@​sergei-startsev</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/1262">import-js/eslint-plugin-import#1262</a></li>
<li><a href="https://github.com/maxkomarychev"><code>@​maxkomarychev</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/1660">import-js/eslint-plugin-import#1660</a></li>
<li><a href="https://github.com/mgwalker"><code>@​mgwalker</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2047">import-js/eslint-plugin-import#2047</a></li>
<li><a href="https://github.com/jablko"><code>@​jablko</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2220">import-js/eslint-plugin-import#2220</a></li>
<li><a href="https://github.com/remcohaszing"><code>@​remcohaszing</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2226">import-js/eslint-plugin-import#2226</a></li>
<li><a href="https://github.com/mrmckeb"><code>@​mrmckeb</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/pull/2240">import-js/eslint-plugin-import#2240</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/import-js/eslint-plugin-import/compare/v2.24.2...v2.25.0">https://github.com/import-js/eslint-plugin-import/compare/v2.24.2...v2.25.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md">eslint-plugin-import's changelog</a>.</em></p>
<blockquote>
<h2>[2.25.4] - 2022-01-02</h2>
<h3>Fixed</h3>
<ul>
<li><code>importType</code>: avoid crashing on a non-string' (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2305">https://github.com/facebook/flipper/issues/2305</a>, thanks [<a href="https://github.com/ljharb"><code>@​ljharb</code></a>])</li>
<li>[<code>first</code>]: prevent crash when parsing angular templates (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2210">https://github.com/facebook/flipper/issues/2210</a>, thanks [<a href="https://github.com/ljharb"><code>@​ljharb</code></a>])</li>
<li><code>importType</code>: properly resolve <code>@/*</code>-aliased imports as internal (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2334">https://github.com/facebook/flipper/issues/2334</a>, thanks [<a href="https://github.com/ombene"><code>@​ombene</code></a>])</li>
<li>[<code>named</code>]/<code>ExportMap</code>: handle named imports from CJS modules that use dynamic import (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2341">https://github.com/facebook/flipper/issues/2341</a>, thanks [<a href="https://github.com/ludofischer"><code>@​ludofischer</code></a>])</li>
</ul>
<h3>Changed</h3>
<ul>
<li>[<code>no-default-import</code>]: report on the token &quot;default&quot; instead of the entire node (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2299">https://github.com/facebook/flipper/issues/2299</a>, thanks [<a href="https://github.com/pmcelhaney"><code>@​pmcelhaney</code></a>])</li>
<li>[Docs] [<code>order</code>]: Remove duplicate mention of default (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2280">https://github.com/facebook/flipper/issues/2280</a>, thanks [<a href="https://github.com/johnthagen"><code>@​johnthagen</code></a>])</li>
<li>[Deps] update <code>eslint-module-utils</code></li>
</ul>
<h2>[2.25.3] - 2021-11-09</h2>
<h3>Fixed</h3>
<ul>
<li>[<code>extensions</code>]: ignore unresolveable type-only imports (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2270">https://github.com/facebook/flipper/issues/2270</a>, <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2271">https://github.com/facebook/flipper/issues/2271</a>, thanks [<a href="https://github.com/jablko"><code>@​jablko</code></a>])</li>
<li><code>importType</code>: fix <code>isExternalModule</code> calculation (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2282">https://github.com/facebook/flipper/issues/2282</a>, thanks [<a href="https://github.com/mx-bernhard"><code>@​mx-bernhard</code></a>])</li>
<li>[<code>no-import-module-exports</code>]: avoid false positives with a shadowed <code>module</code> or <code>exports</code> (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2297">https://github.com/facebook/flipper/issues/2297</a>, thanks [<a href="https://github.com/ljharb"><code>@​ljharb</code></a>])</li>
</ul>
<h3>Changed</h3>
<ul>
<li>[Docs] [<code>order</code>]: add type to the default groups (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2272">https://github.com/facebook/flipper/issues/2272</a>, thanks [<a href="https://github.com/charpeni"><code>@​charpeni</code></a>])</li>
<li>[readme] Add note to TypeScript docs to install appropriate resolver (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2279">https://github.com/facebook/flipper/issues/2279</a>, thanks [<a href="https://github.com/johnthagen"><code>@​johnthagen</code></a>])</li>
<li>[Refactor] <code>importType</code>: combine redundant <code>isScoped</code> and <code>isScopedModule</code> (thanks [<a href="https://github.com/ljharb"><code>@​ljharb</code></a>])</li>
<li>[Docs] HTTP =&gt; HTTPS (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2287">https://github.com/facebook/flipper/issues/2287</a>, thanks [<a href="https://github.com/Schweinepriester"><code>@​Schweinepriester</code></a>])</li>
</ul>
<h2>[2.25.2] - 2021-10-12</h2>
<h3>Fixed</h3>
<ul>
<li>[Deps] update <code>eslint-module-utils</code> for real this time (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2255">https://github.com/facebook/flipper/issues/2255</a>, thanks [<a href="https://github.com/ljharb"><code>@​ljharb</code></a>])</li>
</ul>
<h2>[2.25.1] - 2021-10-11</h2>
<h3>Fixed</h3>
<ul>
<li>[Deps] update <code>eslint-module-utils</code></li>
</ul>
<h2>[2.25.0] - 2021-10-11</h2>
<h3>Added</h3>
<ul>
<li>Support <code>eslint</code> v8 (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2191">https://github.com/facebook/flipper/issues/2191</a>, thanks [<a href="https://github.com/ota-meshi"><code>@​ota-meshi</code></a>])</li>
<li>[<code>no-unresolved</code>]: add <code>caseSensitiveStrict</code> option (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/1262">https://github.com/facebook/flipper/issues/1262</a>, thanks [<a href="https://github.com/sergei-startsev"><code>@​sergei-startsev</code></a>])</li>
<li>[<code>no-unused-modules</code>]: add eslint v8 support (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2194">https://github.com/facebook/flipper/issues/2194</a>, thanks [<a href="https://github.com/coderaiser"><code>@​coderaiser</code></a>])</li>
<li>[<code>no-restricted-paths</code>]: add/restore glob pattern support (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2219">https://github.com/facebook/flipper/issues/2219</a>, thanks [<a href="https://github.com/stropho"><code>@​stropho</code></a>])</li>
<li>[<code>no-unused-modules</code>]: support dynamic imports (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/1660">https://github.com/facebook/flipper/issues/1660</a>, <a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2212">https://github.com/facebook/flipper/issues/2212</a>, thanks [<a href="https://github.com/maxkomarychev"><code>@​maxkomarychev</code></a>], [<a href="https://github.com/aladdin-add"><code>@​aladdin-add</code></a>], [<a href="https://github.com/Hypnosphi"><code>@​Hypnosphi</code></a>])</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>[<code>no-unresolved</code>]: ignore type-only imports (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2220">https://github.com/facebook/flipper/issues/2220</a>, thanks [<a href="https://github.com/jablko"><code>@​jablko</code></a>])</li>
<li>[<code>order</code>]: fix sorting imports inside TypeScript module declarations (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2226">https://github.com/facebook/flipper/issues/2226</a>, thanks [<a href="https://github.com/remcohaszing"><code>@​remcohaszing</code></a>])</li>
<li>[<code>default</code>], <code>ExportMap</code>: Resolve extended TypeScript configuration files (<a href="https://github-redirect.dependabot.com/import-js/eslint-plugin-import/issues/2240">https://github.com/facebook/flipper/issues/2240</a>, thanks [<a href="https://github.com/mrmckeb"><code>@​mrmckeb</code></a>])</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="68cea3e6b6"><code>68cea3e</code></a> Bump to v2.25.4</li>
<li><a href="dbf668e990"><code>dbf668e</code></a> [Dev Deps] update <code>safe-publish-latest</code></li>
<li><a href="ef9368150b"><code>ef93681</code></a> [Deps] update <code>eslint-module-utils</code></li>
<li><a href="de8873973a"><code>de88739</code></a> utils: v2.7.2</li>
<li><a href="9e06effc70"><code>9e06eff</code></a> [utils] [Refactor] inline <code>pkgDir</code> implementation; remove <code>pkg-dir</code></li>
<li><a href="210e40a118"><code>210e40a</code></a> [utils] [patch] Fix <code>babel/eslint-parser</code> 8 compatibility</li>
<li><a href="e3ca68edaf"><code>e3ca68e</code></a> [Fix] <code>named</code>/<code>ExportMap</code>: handle named imports from CJS modules that use dyn...</li>
<li><a href="ef980d4b11"><code>ef980d4</code></a> [Fix] <code>importType</code>: properly resolve <code>@/*</code>-aliased imports as internal</li>
<li><a href="e156316964"><code>e156316</code></a> [Docs] <code>prefer-default-export</code>: fix typo</li>
<li><a href="e8d79b5abe"><code>e8d79b5</code></a> [Tests] fix OSX tests</li>
<li>Additional commits viewable in <a href="https://github.com/import-js/eslint-plugin-import/compare/v2.24.2...v2.25.4">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-import&package-manager=npm_and_yarn&previous-version=2.24.2&new-version=2.25.4)](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/3269

Reviewed By: aigoncharov

Differential Revision: D33565478

Pulled By: passy

fbshipit-source-id: 085d103561ce73491335d5f0ea1ff019ad59d187
2022-01-17 06:51:31 -08:00
..
2021-10-21 04:28:21 -07:00
2021-10-21 04:28:21 -07:00
2021-10-21 04:28:21 -07:00
2021-10-21 04:28:21 -07:00
2021-10-21 04:28:21 -07:00

js-flipper

This package exposes JavaScript bindings to talk from web / Node.js directly to flipper.

Installation

yarn add js-flipper

Usage

How to build Flipper plugins is explained in the flipper documentation: Creating a Flipper plugin. Building a Flipper plugin involves building a plugin for the Desktop app, and a plugin that runs on a Device (web or Node.js). This package is only needed for the plugin that runs on the device (web / Node.js), and wants to use the WebSocket connection to communicate to Flipper.

This package exposes a flipperClient. It has:

  • addPlugin method. It accepts a plugin parameter, that registers a client plugin and will fire the relevant callbacks if the corresponding desktop plugin is selected in the Flipper Desktop. The full plugin API is documented here.
  • start method. It starts the client. It has two arguments:
    • appName - (required) the name dsplayed in Flipper
    • options which conforms to the infterface
      interface FlipperClientOptions {
        // Make the client connect to a different URL
        urlBase?: string;
        // Override WebSocket implementation (Node.js folks, it is for you!)
        websocketFactory?: (url: string) => FlipperWebSocket;
        // Override how errors are handled (it is simple `console.error` by default)
        onError?: (e: unknown) => void;
        // Timeout after which client tries to reconnect to Flipper
        reconnectTimeout?: number;
      }
      

Example (web)

An example plugin can be found in FlipperTicTacToe.js.

The corresponding Desktop plugin ships by default in Flipper, so importing the above file and dropping the <FlipperTicTacToe /> component somewhere in your application should work out of the box.

The sources of the corresponding Desktop plugin can be found here.

Node.js

Node.js does not have a built-in WebSocket implementation. You need to install any implmentation of WebSockets for Node.js that is compatible with the interface of the web version.

import flipperClient from 'js-flipper';
// Say, you decided to go with 'ws'
// https://github.com/websockets/ws
import WebSocket from 'ws';

// Start the client and pass some options
// You might ask yourself why there is the second argument `{ origin: 'localhost:' }`
// Flipper Desktop verifies the `Origin` header for every WS connection. You need to set it to one of the whitelisted values (see `VALID_WEB_SOCKET_REQUEST_ORIGIN_PREFIXES`).
flipperClient.start('My cool nodejs app', { websocketFactory: url => new WebSocket(url, {origin: 'localhost:'}) });

An example plugin should be somewhat similar to what we have for React. It is currently WIP (do not confuse with RIP!).