Commit Graph

653 Commits

Author SHA1 Message Date
Jan Kassens
187dd6a7a2 Replace NodeJS 21 with 22 in devEngines field (#30598)
21 is EOL and 22 is stable now.

Homebrew installs 22 by default as well which is the practical reason
for me to update this.
2024-08-06 11:06:14 -04:00
Hendrik Liebau
47069f0e80 Build all bundles required by flight fixture with build-for-flight-dev (#30534) 2024-07-31 15:02:36 +02:00
Lauren Tan
d98f1a4bc6 [ci] Deprecate yarn publish-prereleases
Added instructions on the new workflow. Let's keep this short around for
now as it may be used again due to muscle memory and emit a helpful
message instead.

ghstack-source-id: 3f840a3d4319309d31cefeae028f97d280b0c09a
Pull Request resolved: https://github.com/facebook/react/pull/30510
2024-07-29 19:18:04 -04:00
Lauren Tan
fe68112240 [ci] Temporarily always build from source for codesandbox
We need a GitHub token to download artifacts from GitHub so
unfortunately codesandboxci will need to revert to the slower process
of building from source for now until it's possible to pass secrets to
codesandboxci.

ghstack-source-id: edab979084
Pull Request resolved: https://github.com/facebook/react/pull/30511
2024-07-29 16:16:09 -04:00
Jan Kassens
70484844bf [BE] switch to hermes parser for prettier (#30421)
This will allow us to parse new flow syntax since the `flow` parser is
no longer updated.

I had to exclude some files and have them fall back to `flow` parser
since they contain invalid graphql syntax that makes the plugin crash.
2024-07-22 19:16:13 -04:00
Jan Kassens
b7e7f1a3fa [BE] upgrade prettier to 3.3.3 (#30420)
Mostly just changes in ternary formatting.
2024-07-22 16:09:01 -04:00
Sebastian Markbåge
127a0fbf1a Add build-for-flight-dev script to package.json (#30326)
Similar to the build-for-devtools script. I often have to build locally
for the flight fixture. This builds a subset that makes it work (in
DEV).
2024-07-12 18:03:10 -04:00
Jan Kassens
21129d34a5 Upgrade flow to 0.235.0 (#30118)
See [Flow
changelog](https://github.com/facebook/flow/blob/main/Changelog.md) for
changes in this version.
2024-07-08 14:11:11 -04:00
Jan Kassens
094041495b Upgrade flow to 0.234.0 (#30117)
See [Flow
changelog](https://github.com/facebook/flow/blob/main/Changelog.md) for
changes in this version.
2024-07-08 14:00:00 -04:00
Jan Kassens
b0f51f7e5e Upgrade flow to 0.233.0 (#30116)
See [Flow
changelog](https://github.com/facebook/flow/blob/main/Changelog.md) for
changes in this version.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/30116).
* #30118
* #30117
* __->__ #30116
2024-07-08 13:48:24 -04:00
Lauren Tan
49c37048de [prettier] Combine compiler and runtime configs
Merges the existing config to the root one so we can have a single
configuration file. I've tried to keep the compiler config as much as
possible in this PR so that no formatting changes occur.

ghstack-source-id: 8bbfc9f269
Pull Request resolved: https://github.com/facebook/react/pull/30021
2024-06-21 12:05:29 -04:00
Ricky
d172bdaf95 Add jest lint rules (#29760)
## Overview

Updates `eslint-plugin-jest` and enables the recommended rules with some
turned off that are unhelpful.

The main motivations is:
a) we have a few duplicated tests, which this found an I deleted 
b) making sure we don't accidentally commit skipped tests
2024-06-10 14:31:37 -04:00
Risto Keravuori
ff60b11b1c Add packageManager fields for Corepack compat (#29114) 2024-05-18 10:21:41 -04:00
Jon Jensen
04b058868c Upgrade jest and jsdom (#29026)
## Summary

This brings:
 - jest* up from 29.4.2 -> 29.7.0
 - jsdom up from 20.0.0 -> 22.1.0

While the latest version of jest-dom-environment still wants
`jsdom@^20.0.0`, it can safely use at least up to `jsdom@22.1.0`. See
https://github.com/jestjs/jest/pull/13825#issuecomment-1564015010 for
details.

Upgrading to latest versions lets us improve some WheelEvent tests and
will make it possible to test a much simpler FormData construction
approach (see #29018)

## How did you test this change?

Ran `yarn test` and `yarn test --prod` successfully
2024-05-08 13:57:25 -04:00
Ruslan Lesiutin
e150a32425 fix[react-devtools/ci]: fix configurations for e2e testing (#29016)
This should fix failing DevTools e2e tests on `main`.

With these changes, running tests locally successfully passes all cases.
2024-05-08 12:04:51 +01:00
Sebastian Markbåge
5fcfd71638 Use undici polyfill for tests in old Node versions (#28887)
We currently don't test FormData / File dependent features in CI because
we use an old Node.js version in CI. We should probably upgrade to 18
since that's really the minimum version that supports all the features
out of the box.

JSDOM is not a faithful/compatible implementation of these APIs. The
recommended way to use Flight together with FormData/Blob/File in older
Node.js versions, is to polyfill using the `undici` library.

However, even in these versions the Blob implementation isn't quite
faithful so the Reply client needs a slight tweak for multi-byte typed
arrays.
2024-05-03 16:29:09 -04:00
Sebastian Silbermann
14f71db6b6 Devtools: Fix build-for-devtools (#28976) 2024-05-02 21:58:51 +02:00
Andrew Clark
857ee8cdf9 Don't minify symbols in production builds (#28881)
This disables symbol renaming in production builds. The original
variable and function names are preserved. All other forms of
compression applied by Closure (dead code elimination, inlining, etc)
are unchanged — the final program is identical to what we were producing
before, just in a more readable form.

The motivation is to make it easier to debug React issues that only
occur in production — the same reason we decided to start shipping
sourcemaps in #28827 and #28827.

However, because most apps run their own minification step on their npm
dependencies, it's not necessary for us to minify the symbols before
publishing — it'll be handled the app, if desired.

This is the same strategy Meta has used to ship React for years. The
React build itself has unminified symbols, but they get minified as part
of Meta's regular build pipeline.

Even if an app does not minify their npm dependencies, gzip covers most
of the cost of symbol renaming anyway.

This saves us from having to ship sourcemaps, which means even apps that
don't have sourcemaps configured will be able to debug the React build
as easily as they would any other npm dependency.
2024-04-20 11:23:46 -04:00
Andrew Clark
0e0b69321a Run Closure on non-minified prod builds, too (#28827)
In #26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of the
optimizations that are in the final build, like dead code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds for
Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser. This
is when the source maps are generated.
2024-04-19 14:22:38 -04:00
Josh Story
da6ba53b10 [UMD] Remove umd builds (#28735)
In React 19 React will finally stop publishing UMD builds. This is
motivated primarily by the lack of use of UMD format and the added
complexity of maintaining build infra for these releases. Additionally
with ESM becoming more prevalent in browsers and services like esm.sh
which can host React as an ESM module there are other options for doing
script tag based react loading.

This PR removes all the UMD build configs and forks.

There are some fixtures that still have references to UMD builds however
many of them already do not work (for instance they are using legacy
features like ReactDOM.render) and rather than block the removal on
these fixtures being brought up to date we'll just move forward and fix
or removes fixtures as necessary in the future.
2024-04-17 11:15:27 -07:00
Jan Kassens
c97564d7ac Upgrade flow to 0.232.0 (#28697)
Upgrade flow to 0.232.0
2024-04-02 10:40:03 -04:00
Jan Kassens
7959a1dd28 Upgrade flow to 0.231.0 (#28576)
Upgrade flow to 0.231.0
2024-03-18 13:23:07 -04:00
Jan Kassens
71c4699de3 Upgrade flow to 0.230.0 (#28528)
Upgrade flow to 0.230.0

Ran
```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```
2024-03-08 17:39:27 -05:00
Ricky
32df74dba6 Fix jest inline snapshots (#28308)
Prettier 3 is not supported for jest inline snapshots:
https://jestjs.io/docs/configuration#prettierpath-string
2024-02-12 22:03:50 -05:00
Jan Kassens
d27c1ac112 Upgrade flow to 0.228.0 (#28294)
Upgrade flow to 0.228.0
2024-02-09 11:17:00 -05:00
Ruslan Lesiutin
65d95b837e fix: gate react/jsx-runtime upgrade only for React >= 17 tests (#28256)
https://github.com/facebook/react/pull/28252 broke RDT tests with React
16.x.

These changes gate the `jsx-runtime` upgrade only for cases when we are
testing against React >= 17.

Validated with:
```
 ./scripts/circleci/download_devtools_regression_build.js 16.0 --replaceBuild && node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion 16.0 --ci && ./scripts/circleci/download_devtools_regression_build.js 16.5 --replaceBuild && node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion 16.5 --ci && ./scripts/circleci/download_devtools_regression_build.js 16.8 --replaceBuild && node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion 16.8 --ci && ./scripts/circleci/download_devtools_regression_build.js 17.0 --replaceBuild && node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion 17.0 --ci && ./scripts/circleci/download_devtools_regression_build.js 18.0 --replaceBuild && node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion 18.0 --ci
 ```
2024-02-06 15:03:36 +00:00
Andrew Clark
952aa74f8e Upgrade tests to use react/jsx-runtime (#28252)
Instead of createElement.

We should have done this when we initially released jsx-runtime but
better late than never. The general principle is that our tests should
be written using the most up-to-date idioms that we recommend for users,
except when explicitly testing an edge case or legacy behavior, like for
backwards compatibility.

Most of the diff is related to tweaking test output and isn't very
interesting.

I did have to workaround an issue related to component stacks. The
component stack logic depends on shared state that lives in the React
module. The problem is that most of our tests reset the React module
state and re-require a fresh instance of React, React DOM, etc. However,
the JSX runtime is not re-required because it's injected by the compiler
as a static import. This means its copy of the shared state is no longer
the same as the one used by React, causing any warning logged by the JSX
runtime to not include a component stack. (This same issue also breaks
string refs, but since we're removing those soon I'm not so concerned
about that.) The solution I went with for now is to mock the JSX runtime
with a proxy that re-requires the module on every function invocation. I
don't love this but it will have to do for now. What we should really do
is migrate our tests away from manually resetting the module state and
use import syntax instead.
2024-02-05 23:07:41 -05:00
Ruslan Lesiutin
f7ce4164c9 chore: remove eslint-plugin-flowtype from dev dependencies (#28157)
While trying to resolve some issues with Flow in ESLint, noticed that we
are still listing `eslint-plugin-flowtype` as dev dependency, but it has
been deprecated in favour of `eslint-plugin-ft-flow`.
2024-01-31 14:52:52 +00:00
Ricky
45582c6c4d Add script to output flag values (#28115)
## Overview

Depends on: https://github.com/facebook/react/pull/28116

Add `yarn flags` to output at table of all feature flags. 

Provides options to output a csv file, diff two or more builds, and
sort.

### Options
<img width="1154" alt="Screenshot 2024-01-26 at 4 06 53 PM"
src="https://github.com/facebook/react/assets/2440089/c3dbd632-adb9-4416-9488-1c603ee4e789">

### `yarn flags --diff next canary`
<img width="637" alt="Screenshot 2024-01-26 at 4 15 03 PM"
src="https://github.com/facebook/react/assets/2440089/1a681ae8-ce33-42d0-9d1f-3f415a8e1c3d">


### `yarn flags --diff canary experimental`
<img width="637" alt="Screenshot 2024-01-26 at 4 14 51 PM"
src="https://github.com/facebook/react/assets/2440089/c66f66cb-3cee-4df6-a1d1-b24600ebd4b3">


### `yarn flags` (all flags)

<img width="1054" alt="Screenshot 2024-01-26 at 4 16 30 PM"
src="https://github.com/facebook/react/assets/2440089/4ce99c7c-825e-4bca-9b83-ca5d6e2bc1a9">
2024-01-30 23:15:50 -05:00
Jan Kassens
991b72a392 Upgrade flow to 0.227.0 (#28094)
Upgrade flow to 0.227.0
2024-01-25 16:01:40 -05:00
Jan Kassens
49439b4db8 Upgrade Flow to 0.216.0 (#27922)
Upgrade Flow to 0.216.0

```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```
2024-01-10 13:43:04 -05:00
Jan Kassens
1d5667a127 [churn] remove Node 19 from dev engines, add 21 (#27870)
This allows running `yarn` with Node 21 installed, also removes Node 19
which is no longer supported according to
https://nodejs.org/en/about/previous-releases
2024-01-02 14:39:25 -05:00
Jan Kassens
45d61cf7ef [flow] upgrade to 0.225.1 (#27871)
This Flow upgrade includes 2 fixes:
- Remove `React$StatelessFunctionalComponent` as that was replaced by
just `React$AbstractComponent` as Flow doesn't make any guarantees, see
the Flow change here:
521317c48f
- Flow no longer allows `number` type indexing into objects which
discovered an incorrect type that is actually an array of the data.

Used this command to upgrade
```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```
and ran `yarn flow-ci` to check for errors in different configurations.
2024-01-02 14:39:14 -05:00
Jan Kassens
aba93acb6c [easy] remove unused deps coveralls and @actuallyworks/node-fetch (#27792)
I do not see references to these modules. Unless there's some dynamic
loading going on (hopefully we should see that in CI) these seem like
they can be removed.
2023-12-05 14:15:23 -05:00
Jan Kassens
5ab6bbb4b0 package.json: cleanup deprecated scripts (#26852)
I think these have been dead for a while now. If the purpose is
documentation, we should see if we need to improve `yarn test --help` or
something instead.
2023-12-04 16:20:49 -05:00
Jan Kassens
e3fb6ac862 [flow] upgrade to 0.213.2 (#27784)
No significant changes from Flow, just keeping us current.

[Changelog](https://github.com/facebook/flow/blob/main/Changelog.md)
2023-12-04 11:35:27 -05:00
PrathamLalwani
2c338b16fd Added windows powershell syntax to build scripts (#27692)
## Summary

I had to change the commands to be windows specific so that it doesn't
cause any crashes

## How did you test this change?

I successfully built the different types of devtools extenstions on my
personal computer. In future may need to add a github action with
windows config to test these errors

 #27193
2023-11-16 11:35:43 +00:00
Jan Kassens
432b9f1d97 Upgrade Flow to 0.221.0 (#27689)
Upgrades Flow and dependencies
```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```
2023-11-10 14:14:53 -05:00
Jan Kassens
7bdd7cc2d8 Upgrade Flow to 0.220.1 (#27680)
Upgrade Flow to latest using
```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```

This also updates `createFlowConfigs.js` to get the Flow version from
`package.json` to avoid needing to bump the version there in the future.
2023-11-09 10:53:08 -05:00
Andrew Clark
77c4ac2ce8 [useFormState] Allow sync actions (#27571)
Updates useFormState to allow a sync function to be passed as an action.

A form action is almost always async, because it needs to talk to the
server. But since we support client-side actions, too, there's no reason
we can't allow sync actions, too.

I originally chose not to allow them to keep the implementation simpler
but it's not really that much more complicated because we already
support this for actions passed to startTransition. So now it's
consistent: anywhere an action is accepted, a sync client function is a
valid input.
2023-10-31 23:32:31 -04:00
Jan Kassens
d803f519ea Upgrade to Flow 0.219.0 (#27542)
This upgrade made the `React$Element` type opaque, which is good for
product code where accessing props of elements is code smell, but React
needs to use that internally. I overrode the type to restore it.
2023-10-20 11:09:44 -04:00
Jan Kassens
9ba1bbd656 Upgrade to Flow 0.217.0 (#27407)
Just keeping React up to date.

[Changelog](https://github.com/facebook/flow/blob/main/Changelog.md)
2023-09-22 11:40:36 -04:00
Jan Kassens
29556a6b0a Flow: upgrade to 0.215.0 (#27264)
Simple bump of Flow and Hermes parser to keep us current.
2023-08-22 10:41:04 -04:00
Jan Kassens
b277259232 [flow] upgrade to 0.214.0 (#27187)
Simple upgrade without any code changes required.

Changelog: https://github.com/facebook/flow/blob/main/Changelog.md
2023-08-21 11:23:47 -04:00
Anatolii Kurochkin
fdb368d9e7 Uninstall unused Webpack 4 packages (#27058)
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

 - Remove unused webpack 4 dependencies

## How did you test this change?

 - Ran `yarn test --prod`
 - Ran `yarn test`

## Related PRs:
 - https://github.com/facebook/react/pull/26887
2023-07-25 18:55:05 +01:00
Jan Kassens
3ff846d106 Flow: upgrade to 0.213.0 (#27142)
Simple upgrade that doesn't require changes.
2023-07-24 11:50:00 -04:00
Andrew Clark
47385f8fa4 Don't transpile async/await in tests (#27029)
Modern runtimes support native async/await, as does the version of Node
we use for our tests. To match how most of our users run React, this
disables the transpilation of async/await in our test suite.
2023-06-30 16:29:23 -04:00
Jan Kassens
613e6f5fca [flow] upgrade to 0.209.0 (#26958)
Small update keeping us current with the latest version of Flow.

Flow changelog: https://github.com/facebook/flow/blob/main/Changelog.md
2023-06-16 09:57:03 -04:00
Jan Kassens
18dedde6a7 [flow] upgrade to 0.206.0 (#26850)
Small upgrade. The one impact was deprecation of `$Shape` where it seems
like we can just use a plain object with optional key.
2023-05-25 13:37:31 -04:00
Jan Kassens
fda1f0b902 Flow upgrade to 0.205.1 (#26796)
Just a small upgrade to keep us current and remove unused suppressions
(probably fixed by some upgrade since).

- `*` is no longer allowed and has been an alias for `any` for a while
now.
2023-05-09 10:45:50 -04:00