Summary:
^
Basically, update Jest and fix any raised issues. Mainly:
- Update necessary dependencies
- Update snapshots
- `useFakeTimers` caused a few issues which meant that the way we hook into the performance object had to be tweaked. The main code change is: `//fbsource/xplat/sonar/desktop/scripts/jest-setup-after.tsx`
- `mocked` -> `jest.mocked`
Changelog: Update Jest to v29.5.1
Reviewed By: antonk52
Differential Revision: D46319818
fbshipit-source-id: d218ca8f7e43abac6b00844953ddeb7f4e1010a2
Summary:
It seems the available binary for macOS arm64 is not signed:
```
codesign -dv --verbose=4 ./node-v16.16.0-macos-arm64
./node-v16.16.0-macos-arm64: code object is not signed
```
This is an issue as it crashes for our flipper server releases.
This can be compared to a binary downloaded from the Node distribution page:
```
codesign -dv --verbose=4 ./node
Executable=/Users/realpassy/Downloads/node-v16.15.0-darwin-arm64/bin/node
Identifier=node
Format=Mach-O thin (arm64)
CodeDirectory v=20500 size=597360 flags=0x10000(runtime) hashes=18657+7 location=embedded
VersionPlatform=1
VersionMin=720896
VersionSDK=721152
Hash type=sha256 size=32
CandidateCDHash sha256=31cdf84cac42a622c1a68558376700a2dd12d40d
CandidateCDHashFull sha256=31cdf84cac42a622c1a68558376700a2dd12d40d81c5118f3b0e0370c414eb69
Hash choices=sha256
CMSDigest=31cdf84cac42a622c1a68558376700a2dd12d40d81c5118f3b0e0370c414eb69
CMSDigestType=2
Executable Segment base=0
Executable Segment limit=56082432
Executable Segment flags=0x1
Page size=4096
Launch Constraints:
None
CDHash=31cdf84cac42a622c1a68558376700a2dd12d40d
Signature size=8986
Authority=Developer ID Application: Node.js Foundation (HX7739G8FX)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=26 Apr 2022 at 23:00:57
Info.plist=not bound
TeamIdentifier=HX7739G8FX
Runtime Version=11.1.0
Sealed Resources=none
Internal requirements count=1 size=164
```
For additional context:
Node binary by using pkg-fetch. We just get the binary from this release page: https://github.com/vercel/pkg-fetch/releases/tag/v3.4
The exact binary we're downloading is https://github.com/vercel/pkg-fetch/releases/download/v3.4/node-v16.15.0-macos-arm64
If you just download that via Chrome, it will trigger Gatekeeper and you need to manually click "Allow" in the system privacy settings. You can also do the same by just running:
xattr -c ./node-v16*
Afterwards you can:
chmod +x ./node*
It will crash in the same way that it does after our distribution.
Reviewed By: passy
Differential Revision: D46225503
fbshipit-source-id: f0ae2d5101b99c9db7fe80333573caef52c787a2
Summary:
The file manifest.json is injected with the auth token and it happens with every launch.
Because the file is tracked, these changes will always get picked no matter what the .gitignore file specifies, because is a tracked file.
So, the solution is to have a template with a different name, that gets copied into the right location during build time.
Reviewed By: LukeDefeo
Differential Revision: D46184772
fbshipit-source-id: 938b9433045485d9846a6a50c1c955ebe7925581
Summary:
Replace an existing running instance, if any.
This is useful for:
- Applying updates
- Ensuring freshness of server
Reviewed By: passy
Differential Revision: D46146814
fbshipit-source-id: bfb760f3ab26b7632510773609f1c6ca3a97c4ec
Summary:
I've just packaged Flipper for Gentoo Linux and I wanted to use the system electron instead of bundling its own copy into the flipper executable. To do so I use my custom `electron-builder` and `app-builder` versions, which also allows me to support otherwise unsupported architectures like ppc64. That means skipping the downloading/unzipping/bundling steps for electron, which greatly shortens the overall build process.
Being that fast resulted in countless hours of debugging, because the resulting `app.asar` wouldn't work. At some point I noticed that electron-builder cli was working flawlessly while processing the same exact config through the Javascript API resulted in failure, so I started digging into your scripts and I've noticed that you didn't await `stripSourceMapComment` into `desktop/scripts/build-utils.ts`.
In particular the `compile` function was returning before `stripSourceMapComment` had finished doing its stuff, which ended up messing with electron-builder later.
You didn't notice because you download electron, unzip it, etc which takes enough time to let `stripSourceMapComment` finish its stuff before the actual build starts, but since I skip these steps in order to use system electron I've been able to notice it.
## Changelog
I simply await `stripSourceMapComment` promises in `build-utils`.
Pull Request resolved: https://github.com/facebook/flipper/pull/4586
Test Plan:
`cd desktop && yarn && yarn build` is enough to test this.
## Additional Suggestions
I also suggest to enable the [no-floating-promises](https://typescript-eslint.io/rules/no-floating-promises/) eslint rule in order to ensure similar mistakes won't happen in the future.
Reviewed By: ivanmisuno, mweststrate
Differential Revision: D43974442
Pulled By: passy
fbshipit-source-id: 5acfa3d1479828e9373070c40fe3dd865a862561
Summary: Currently, Flipper server cannot be used with Flipper Launcher on Linux because there is no `flipper` binary in the root of the directory. Adding a quick shell script bridges the call from the checked-in node binary and the server JS file.
Reviewed By: ardavank
Differential Revision: D43837781
fbshipit-source-id: d954ae21d5330aa549d4bc76aefb1d76af8e2c84
Summary:
Bumps [metro-minify-terser](https://github.com/facebook/metro) from 0.70.2 to 0.75.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/facebook/metro/releases">metro-minify-terser's releases</a>.</em></p>
<blockquote>
<h2>Release v0.75.0</h2>
<ul>
<li><strong>[Breaking]</strong>: Formalise minimum Node JS requirement at 14.17.0 via <code>package.json#engines</code>. (<a href="c3e453ede5</a>)</li>
<li><strong>[Breaking]</strong>: Filter untyped context properties passed to custom resolvers. (<a href="cb01ec09c6</a>)</li>
<li><strong>[Breaking]</strong>: Change default <code>context.redirectModulePath</code> implementation to return absolute path in all cases. (<a href="acbfe63d83</a>)</li>
<li><strong>[Feature]</strong>: Add <code>mainFields</code>, <code>getPackage</code>, and <code>getPackageForModule</code> to custom resolver context. (<a href="adfb59329f</a>)</li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/facebook/metro/compare/v0.74.1...v0.75.0">https://github.com/facebook/metro/compare/v0.74.1...v0.75.0</a></p>
<h2>Release v0.74.1</h2>
<ul>
<li><strong>[Feature]</strong>: Add <code>babel/plugin-proposal-numeric-separator</code> to <code>metro-react-native-babel-preset</code> (<a href="https://github-redirect.dependabot.com/facebook/metro/pull/681">facebook/metro#681</a> by <a href="https://github.com/SConaway"><code>@SConaway</code></a>)</li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/facebook/metro/compare/v0.74.0...v0.74.1">https://github.com/facebook/metro/compare/v0.74.0...v0.74.1</a></p>
<h2>Release v0.74.0</h2>
<ul>
<li><strong>[Breaking]</strong> Remove <code>@babel/plugin-transform-template-literals</code> from metro-react-native-babel-preset (<a href="322dea8dc7</a>)</li>
<li><strong>[Breaking]</strong> Remove <code>postProcessBundleSourcemap</code> from config (<a href="339794e434</a>)</li>
<li><strong>[Fix]</strong> Don't log ENOENT errors to console for expected URL stack frames (<a href="1031ae6713</a>)</li>
<li><strong>[Fix]</strong> Don't attempt to use the <code>find</code> crawler on Windows (<a href="735aa9f523</a>)</li>
<li><strong>[Performance]</strong> Improve AST processing during transformation (<a href="https://github-redirect.dependabot.com/facebook/metro/pull/854">facebook/metro#854</a> by <a href="https://github.com/EvanBacon"><code>@EvanBacon</code></a>)</li>
<li><strong>[Performance]</strong> Improve Fast Refresh responsiveness when watching a large number of files (<a href="b942eca551</a>)</li>
</ul>
<p><strong>Full Changelog:</strong> <a href="https://github.com/facebook/metro/compare/v0.73.6...v0.74.0">https://github.com/facebook/metro/compare/v0.73.6...v0.74.0</a></p>
<h2>Release v0.73.7</h2>
<p><em>This is a hotfix on the <code>0.73.x</code> branch.</em></p>
<ul>
<li><strong>[Fix]</strong> Don't attempt to use the <code>find</code> crawler on Windows (<a href="370301981b</a>)</li>
</ul>
<h2>Release v0.73.6</h2>
<ul>
<li><strong>[Fix]</strong> Fix duplicate 'add' events, reduce dropped events on new subtrees in <code>NodeWatcher</code> (non-Watchman, non-macOS).(<a href="51fb7e349c</a>)</li>
</ul>
<blockquote>
<p>NOTE: Experimental features are not covered by semver and can change at any time.</p>
</blockquote>
<ul>
<li><strong>[Experimental]</strong> <code>experimentalImportBundleSupport</code>: Move bundle path hints into serialised dependency map(<a href="https://github-redirect.dependabot.com/facebook/metro/pull/901">facebook/metro#901</a>)</li>
</ul>
<p><strong>Full Changelog:</strong> <a href="https://github.com/facebook/metro/compare/v0.73.5...v0.73.6">https://github.com/facebook/metro/compare/v0.73.5...v0.73.6</a></p>
<h2>Release v0.73.5</h2>
<ul>
<li><strong>[Fix]</strong>: Make all <code>getTransformOptions</code> result properties optional. (<a href="a07c8235a3</a>)</li>
<li><strong>[Fix]</strong>: Bug that can lead to "unknown module" errors at runtime after an incremental build. (<a href="b1be263f7d</a>)</li>
<li><strong>[Fix]</strong>: <code>metro-runtime</code>: Re-throw cached module errors without wrapping. (<a href="032c4a1e03</a>)</li>
<li><strong>[Fix]</strong> Bump <code>babel/types</code> dependency to <code>^7.20.0</code> for more consistent exposed AST Bump <code>babel/types</code> dependency to <code>^7.20.0</code> for more consistent exposed AST</li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/facebook/metro/compare/v0.73.4...v0.73.5">https://github.com/facebook/metro/compare/v0.73.4...v0.73.5</a></p>
<h2>Release v0.73.4</h2>
<ul>
<li><strong>[Feature]:</strong> Expose <code>watch</code> option in <code>RunServerOptions</code> (<a href="https://github-redirect.dependabot.com/facebook/metro/pull/889">facebook/metro#889</a> by <a href="https://github.com/EvanBacon"><code>@EvanBacon</code></a>)</li>
<li><strong>[Feature]:</strong> <code>metro-runtime</code>: Emit additional context on WebSocket <code>'close'</code> events (<a href="d54986c49c</a>)</li>
</ul>
<blockquote>
<p>NOTE: Experimental features are not covered by semver and can change at any time.</p>
</blockquote>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="a110931489"><code>a110931</code></a> Release 0.75.0</li>
<li><a href="28b38bb0af"><code>28b38bb</code></a> Remove duplicated engines entry from metro-symbolicate package.json</li>
<li><a href="acbfe63d83"><code>acbfe63</code></a> Refactor subpath matching logic in browser spec resolution</li>
<li><a href="c3e453ede5"><code>c3e453e</code></a> Add "engines" field to all packages to indicate minimum Node JS version</li>
<li><a href="e890c997d0"><code>e890c99</code></a> Back out "Process files before adding them to <code>FileSystem</code>"</li>
<li><a href="1a81060c6c"><code>1a81060</code></a> Process files before adding them to <code>FileSystem</code></li>
<li><a href="aa442cacdb"><code>aa442ca</code></a> Move default redirectModulePath implementation into metro-resolver</li>
<li><a href="adfb59329f"><code>adfb593</code></a> Add getPackageForModule function to resolution context</li>
<li><a href="11a468140c"><code>11a4681</code></a> Document unstable_perfLoggerFactory (<a href="https://github-redirect.dependabot.com/facebook/metro/issues/920">https://github.com/facebook/flipper/issues/920</a>)</li>
<li><a href="7acb686f28"><code>7acb686</code></a> allow passing config for unstable_perfLoggerFactory without warning</li>
<li>Additional commits viewable in <a href="https://github.com/facebook/metro/compare/v0.70.2...v0.75.0">compare view</a></li>
</ul>
</details>
<br />
[](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/4493
Reviewed By: ivanmisuno
Differential Revision: D43117867
Pulled By: mweststrate
fbshipit-source-id: b842b25da921f1ca0cee563365c58f6f1c881791
Summary: Combining a bunch of individual tasks for dep upgrades into one diff.
Reviewed By: ivanmisuno
Differential Revision: D42706074
fbshipit-source-id: 054b2545ad1295699f47f4c6eb5065b7b9a1d6a0
Summary:
In our organization, Flipper is distributed in a version controlled way. As a result, we do not want users to manually update or receive prompts to update when a new version is available. There is already a `--updater` flag in the command line arguments for flipper.exe, but it isn't piped through. This change pipes it through and disables all update related UI when `--no-updater` is passed in.
## Changelog
Support --updater and --no-updater options for flipper.exe
Pull Request resolved: https://github.com/facebook/flipper/pull/4277
Test Plan: Ran `yarn build --win` in flipper/desktop, and launched flipper.exe from flipper/dist/win-unpacked with the `--updater`, `--no-updater` and no flags and ensured the proper behavior was observed (update UI shows by default or when `--updater` is specified, and doesn't show when `--no-updater` is specified).
Reviewed By: passy
Differential Revision: D41298321
Pulled By: mweststrate
fbshipit-source-id: 5ddfede2700954f0fdd6a111b20d0836fab25565
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
Summary: Currently, if we publish a new shared plugin lib in a separate diff, the compatibility check fails for it while it should exit with a warning only
Reviewed By: antonk52
Differential Revision: D39731259
fbshipit-source-id: 7651642ebfb5e18ace047d36b52907bca65c4462
Summary: Some plugins import from shared directories. These directories are not plugins themselves, therefore the current plugin root searching mechanism does nto work for them. To support plugin reloading for this scenario, we start re-building all plugins if we fail to find a plugin root.
Reviewed By: lblasa
Differential Revision: D39693820
fbshipit-source-id: 33dd7de4121bd5665a39b0ea96adce4603dc7df0
Summary:
We would like to version control Flipper and some of our custom plugins that are installed on developers' systems.
Flipper by default prompts users to upgrade so they sometimes do the update and then all our custom plugins break because they were compiled for an older version.
See https://github.com/facebook/flipper/issues/3947 for feature request info.
## Changelog
Adds notifyAvailable flag to config.json to disable prompting for users that "an update is available"
Pull Request resolved: https://github.com/facebook/flipper/pull/3992
Test Plan:
Tested by running locally.
Had to comment out the isProduction() check to confirm this it worked properly because this flag is false on dev versions.
Couldn't figure out how to manually test the handleOpenPluginDeeplink.tsx change but made a similar change there; happy to test that if you can tell me how to exercise that path.
Reviewed By: antonk52
Differential Revision: D39654481
Pulled By: antonk52
fbshipit-source-id: cef6b48d870915c48f620269c42d24b8ef1f4c29
Summary: Now that we build all plugins at all times and it is super-fast, these options are redundant
Reviewed By: lblasa
Differential Revision: D39542723
fbshipit-source-id: 1b30ba384267ec4fd0c35b4dc14f0223ffe414c9
Summary: Restart electron app if we had any server-code changes
Reviewed By: lblasa
Differential Revision: D39542169
fbshipit-source-id: fb8e335f3e3fe0cf34e57a79b96e9cc8377e9fda
Summary: Watch source plugin folders and notify frontend that any of them changed. In subsequent diffs, we will start reloading plugins that changed.
Reviewed By: lblasa
Differential Revision: D39539443
fbshipit-source-id: 726916c0bce336a2c0179558526bcb1b74e35b93
Summary: Now, once we build all plugins before we start Flipper, we need to rebuild some of them when they change. Previously, it was handled by Metro when we included plugins int he bundle, but we no longer include them in the bundle.
Reviewed By: lblasa
Differential Revision: D39510213
fbshipit-source-id: a352d78946f844a25d9127ac09c26e43e6739ca9
Summary: Make flipper-server link local flipper-* deps for intern prod build. Update flipper-* deps versions for public builds so `npx` pulls them from npm
Reviewed By: lblasa
Differential Revision: D39497944
fbshipit-source-id: ca2674a4ac8f5b6c3efa9546b631f2526bf48f8e
Summary: Move flipper local deps to prod deps, so yarn installs them later when we build a bundle
Reviewed By: lblasa
Differential Revision: D39475545
fbshipit-source-id: 5b61d15b45ee315c3b35d8e6836c114b90503b1a
Summary: prepareDefaultPlugins builds all plugins now. We no longer need extra helpers
Reviewed By: lblasa
Differential Revision: D39308098
fbshipit-source-id: 4f12a0bdbc2afd2b306565fff3494daa630e1a20
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
Summary: With esbuild bundling all plugins takes a couple of seconds instead of 3-5 minutes with metro. As a result, we can stop including plugins into Flipper's bundle for development and always bundle them separately. It reduces complexity of our build pipeline and makes the dev build work more like our prod build. It also allows us to stop bundling flipper-server code and just compile it instead.
Reviewed By: lblasa
Differential Revision: D39262048
fbshipit-source-id: c4da0f2ea2807015d98e0d070349c39b2118e189
Summary: Stop bundling plugins into Flipper Server bundles. In later diffs, we will start building all plugins even in dev mode which removes the need to bundle them.
Reviewed By: lblasa
Differential Revision: D39276249
fbshipit-source-id: 091405cfcf58aa7e1bd2b382da40f8d9841ae6b1
Summary: Flipper server itself requires no babel transforms. We applied extra transforms only for the bundled plugins. However, we pack and ship all plugins in the /static folder. They are always available on the FS. Therefore we could stop bundling any plugins into flipper-server's source code.
Reviewed By: lblasa
Differential Revision: D38910251
fbshipit-source-id: b3e9fe5ae2ab69ce5579b01b6793ebf7e88baf66
Summary: prepareDefaultPlugins and prepareHeadlessPlugins should come before compileServerMain to bundle plugins
Reviewed By: passy
Differential Revision: D38862132
fbshipit-source-id: 952a2f6d4f857f4faacfc952bebb4e59afcbc5b0
Summary:
This is the first diff to implement the feature for the Flipper logs plugin to have an option to persist logs in the table between crashes, disconnections, etc.
Since this is not a local change, the UI option for persistence will be located in the settings for the Flipper UI(as seen in the test plan). The setting is associated with the Redux Store `Settings` and is stored globally to be used across all plugins. So the plan is making the persistence pertain to all plugins.
Reviewed By: mweststrate
Differential Revision: D37786988
fbshipit-source-id: 7ffc6077cbca559b3401b16770eda657a6c45620
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
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
Summary: This was lost when I changed from `pkg-fetch` writing it to copying the file.
Reviewed By: mweststrate, aigoncharov
Differential Revision: D36682861
fbshipit-source-id: 23822d4cc75720a83282de949d28029a05a2a7f9
Summary: Allows to attribute errors to flipper server or flipper electron
Reviewed By: passy
Differential Revision: D36698504
fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
Summary:
Provide the same build parameters as for the main build and move
the two bundles to a folder where we can pick them up.
For consistency, I'm keeping the naming scheme with the main build.
Reviewed By: antonk52
Differential Revision: D36521046
fbshipit-source-id: 9ea992d6e5dc299d88083d751ca8e84eadb1430b
Summary:
pkg-fetch is a bit weird in that it doesn't use the offline cache
if an output path is defined. That makes building in Sandcastle a lot harder.
Reviewed By: lawrencelomax, aigoncharov
Differential Revision: D36485283
fbshipit-source-id: 27596999c69441bc25e341db77b409ed0caaf0fe
Summary: Seems to have improvements to the cache which we need in Sandcastle
Reviewed By: lawrencelomax
Differential Revision: D36483459
fbshipit-source-id: 4dfe1dcccddd21c3966508b1260644630c1082f5
Summary: Current temporary limitations: all headless plugins are bundled with Flipper.
Reviewed By: antonk52
Differential Revision: D36098168
fbshipit-source-id: c58abe41776157258a5c39a80a5c1a33cf3f42c5
Summary:
This bundles up the Flipper Server in a Mac App Bundle which is identically in shape to a regular Desktop bundle. That means we can swap them out transparently without having to keep the layout in sync with Flipper Launcher.
It bundles nodeJS binary which we can later also provide for aarch64.
Reviewed By: aigoncharov
Differential Revision: D36140809
fbshipit-source-id: fb3410626ab172ce0da48f1a4a1489da68450369
Summary: Taking care of the remaining dependabot tasks In my queue.
Reviewed By: mweststrate
Differential Revision: D36131782
fbshipit-source-id: f8a5ce18bfab7c5d50a88d64f9516d67bba4bd6d