Files
flipper/js/js-flipper
dependabot[bot] 920dfac3e7 Bump jest from 29.3.1 to 29.4.2 in /js/js-flipper (#4504)
Summary:
Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 29.3.1 to 29.4.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/facebook/jest/releases">jest's releases</a>.</em></p>
<blockquote>
<h2>v29.4.2</h2>
<h2>Features</h2>
<ul>
<li><code>[jest/core]</code> Instrument significant lifecycle events with <a href="https://nodejs.org/docs/latest-v16.x/api/perf_hooks.html#performancemarkname-options"><code>performance.mark()</code></a> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13859">#13859</a>)</li>
</ul>
<h2>Fixes</h2>
<ul>
<li><code>[expect, jest/expect]</code> Provide type of <code>actual</code> as a generic argument to <code>Matchers</code> to allow better-typed extensions (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13848">#13848</a>)</li>
<li><code>[jest-circus]</code> Added explicit mention of test failing because <code>done()</code> is not being called in error message (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13847">#13847</a>)</li>
<li><code>[jest-runtime]</code> Handle CJS re-exports of node core modules from ESM (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13856">#13856</a>)</li>
<li><code>[jest-transform]</code> Downgrade <code>write-file-atomic</code> to v4 (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13853">#13853</a>)</li>
<li><code>[jest-worker]</code> Ignore IPC messages not intended for Jest (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13543">#13543</a>)</li>
</ul>
<h2>Chore &amp; Maintenance</h2>
<ul>
<li><code>[*]</code> make sure to exclude <code>.eslintcache</code> from published module (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13832">#13832</a>)</li>
<li><code>[docs]</code> Cleanup incorrect links in CHANGELOG.md (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13857">#13857</a>)</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/benjaminjkraft"><code>@​benjaminjkraft</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13848">facebook/jest#13848</a></li>
<li><a href="https://github.com/LinusU"><code>@​LinusU</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13543">facebook/jest#13543</a></li>
<li><a href="https://github.com/SuperSodaSea"><code>@​SuperSodaSea</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13857">facebook/jest#13857</a></li>
<li><a href="https://github.com/kowalski"><code>@​kowalski</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13856">facebook/jest#13856</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/facebook/jest/compare/v29.4.1...v29.4.2">https://github.com/facebook/jest/compare/v29.4.1...v29.4.2</a></p>
<h2>v29.4.1</h2>
<h2>Features</h2>
<ul>
<li><code>[expect, jest-circus, jest/types]</code> Implement <code>numPassingAsserts</code> of testResults to track the number of passing asserts in a test (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13795">#13795</a>)</li>
<li><code>[jest-core]</code> Add newlines to JSON output (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13817">#13817</a>)</li>
<li><code>[jest/reporters]</code> Automatic log folding in GitHub Actions Reporter (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13626">#13626</a>)</li>
</ul>
<h2>Fixes</h2>
<ul>
<li><code>[jest/expect-utils]</code> <code>toMatchObject</code> diffs should include <code>Symbol</code> properties (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13810">#13810</a>)</li>
<li><code>[jest-runtime]</code> Handle missing <code>replaceProperty</code> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13823">#13823</a>)</li>
<li><code>[jest/types]</code> Add partial support for <code>done</code> callbacks in typings of <code>each</code> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13756">#13756</a>)</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/jessevanassen"><code>@​jessevanassen</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13817">facebook/jest#13817</a></li>
<li><a href="https://github.com/ymqy"><code>@​ymqy</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13795">facebook/jest#13795</a></li>
<li><a href="https://github.com/MatteoH2O1999"><code>@​MatteoH2O1999</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13626">facebook/jest#13626</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/facebook/jest/compare/v29.4.0...v29.4.1">https://github.com/facebook/jest/compare/v29.4.0...v29.4.1</a></p>
<h2>v29.4.0</h2>
<h2>Features</h2>
<ul>
<li><code>[expect, jest/expect-utils]</code> Support custom equality testers (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13654">#13654</a>)</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/facebook/jest/blob/main/CHANGELOG.md">jest's changelog</a>.</em></p>
<blockquote>
<h2>29.4.2</h2>
<h3>Features</h3>
<ul>
<li><code>[jest/core]</code> Instrument significant lifecycle events with <a href="https://nodejs.org/docs/latest-v16.x/api/perf_hooks.html#performancemarkname-options"><code>performance.mark()</code></a> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13859">#13859</a>)</li>
</ul>
<h3>Fixes</h3>
<ul>
<li><code>[expect, jest/expect]</code> Provide type of <code>actual</code> as a generic argument to <code>Matchers</code> to allow better-typed extensions (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13848">#13848</a>)</li>
<li><code>[jest-circus]</code> Added explicit mention of test failing because <code>done()</code> is not being called in error message (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13847">#13847</a>)</li>
<li><code>[jest-runtime]</code> Handle CJS re-exports of node core modules from ESM (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13856">#13856</a>)</li>
<li><code>[jest-transform]</code> Downgrade <code>write-file-atomic</code> to v4 (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13853">#13853</a>)</li>
<li><code>[jest-worker]</code> Ignore IPC messages not intended for Jest (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13543">#13543</a>)</li>
</ul>
<h3>Chore &amp; Maintenance</h3>
<ul>
<li><code>[*]</code> make sure to exclude <code>.eslintcache</code> from published module (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13832">#13832</a>)</li>
<li><code>[docs]</code> Cleanup incorrect links in CHANGELOG.md (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13857">#13857</a>)</li>
</ul>
<h2>29.4.1</h2>
<h3>Features</h3>
<ul>
<li><code>[expect, jest-circus, jest/types]</code> Implement <code>numPassingAsserts</code> of testResults to track the number of passing asserts in a test (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13795">#13795</a>)</li>
<li><code>[jest-core]</code> Add newlines to JSON output (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13817">#13817</a>)</li>
<li><code>[jest/reporters]</code> Automatic log folding in GitHub Actions Reporter (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13626">#13626</a>)</li>
</ul>
<h3>Fixes</h3>
<ul>
<li><code>[jest/expect-utils]</code> <code>toMatchObject</code> diffs should include <code>Symbol</code> properties (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13810">#13810</a>)</li>
<li><code>[jest-runtime]</code> Handle missing <code>replaceProperty</code> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13823">#13823</a>)</li>
<li><code>[jest/types]</code> Add partial support for <code>done</code> callbacks in typings of <code>each</code> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13756">#13756</a>)</li>
</ul>
<h2>29.4.0</h2>
<h3>Features</h3>
<ul>
<li><code>[expect, jest/expect-utils]</code> Support custom equality testers (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13654">#13654</a>)</li>
<li><code>[jest-config, jest-worker]</code> Use <code>os.availableParallelism</code> if available to calculate number of workers to spawn (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13738">#13738</a>)</li>
<li><code>[jest/globals, jest-mock]</code> Add <code>jest.replaceProperty()</code> that replaces property value (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13496">#13496</a>)</li>
<li><code>[jest-haste-map]</code> ignore Sapling vcs directories (<code>.sl/</code>) (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13674">#13674</a>)</li>
<li><code>[jest-resolve]</code> Support subpath imports (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13705">#13705</a>, <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13723">#13723</a>, <a href="https://github-redirect.dependabot.com/facebook/jest/pull/13777">#13777</a>)</li>
<li><code>[jest-runtime]</code> Add <code>jest.isolateModulesAsync</code> for scoped module initialization of asynchronous functions (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13680">#13680</a>)</li>
<li><code>[jest-runtime]</code> Add <code>jest.isEnvironmentTornDown</code> function (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13741">#13741</a>)</li>
<li><code>[jest-test-result]</code> Added <code>skipped</code> and <code>focused</code> status to <code>FormattedTestResult</code> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13700">#13700</a>)</li>
<li><code>[jest-transform]</code> Support for asynchronous <code>createTransformer</code> (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13762">#13762</a>)</li>
</ul>
<h3>Fixes</h3>
<ul>
<li><code>[jest-environment-node]</code> Fix non-configurable globals (<a href="https://github-redirect.dependabot.com/facebook/jest/pull/13687">#13687</a>)</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="f0fc92e844"><code>f0fc92e</code></a> v29.4.2</li>
<li><a href="bc7b20c9d4"><code>bc7b20c</code></a> chore: make sure to exclude .eslintcache from published module (<a href="https://github.com/facebook/jest/tree/HEAD/packages/jest/issues/13832">#13832</a>)</li>
<li><a href="bc84c8a156"><code>bc84c8a</code></a> v29.4.1</li>
<li><a href="4bc0e8acaf"><code>4bc0e8a</code></a> v29.4.0</li>
<li><a href="6e5b1d60a1"><code>6e5b1d6</code></a> chore: update typescript (<a href="https://github.com/facebook/jest/tree/HEAD/packages/jest/issues/13616">#13616</a>)</li>
<li>See full diff in <a href="https://github.com/facebook/jest/commits/v29.4.2/packages/jest">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=jest&package-manager=npm_and_yarn&previous-version=29.3.1&new-version=29.4.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/4504

Reviewed By: ivanmisuno

Differential Revision: D43117831

Pulled By: mweststrate

fbshipit-source-id: 7a6a96abb313d6a1e935f0324c651a65ec742641
2023-02-09 03:22:18 -08:00
..
2021-10-21 04:28:21 -07:00
2022-01-18 07:46:05 -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
2023-02-07 10:23:53 -08:00
2022-06-01 02:49:25 -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 displayed in Flipper
    • options which conforms to the interface
      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;
        // Set device ID. Default: random ID persisted to local storage.
        getDeviceId?: () => Promise<string> | string
      }
      

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 implementation 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!).