Commit Graph

564 Commits

Author SHA1 Message Date
Jan Kassens afe664d9d7
Flow: upgrade to 0.142 (#25255) 2022-09-13 18:39:26 -04:00
Jan Kassens 5fdcd23aaa
Flow: upgrade to 0.140 (#25252)
This update range includes:

- `types_first` ([blog](https://flow.org/en/docs/lang/types-first/), all exports need annotated types) is default. I disabled this for now to make that change incremental.
- Generics that escape the scope they are defined in are an error. I fixed some with explicit type annotations and some are suppressed that I didn't easily figure out.
2022-09-13 13:33:43 -04:00
Jan Kassens ba7b6f4183
Flow: upgrade to 0.132 (#25244) 2022-09-12 14:36:02 -04:00
Jan Kassens d5ddc6543e
Flow: upgrade to 0.131 (#25224)
This also downgrades the new lint warning to avoid new suppressions with this upgrade.
2022-09-09 16:21:32 -04:00
Jan Kassens 492c6e29e7
Flow: upgrade to 0.127 (#25221)
A smaller incremental update as some next version was changing more.
2022-09-09 12:21:44 -04:00
Jan Kassens a473d08fce
Update to Flow from 0.97 to 0.122 (#25204)
* flow 0.122
* update ReactModel type
2022-09-08 11:46:07 -04:00
Mengdi Chen d6255f0ac4
[DevTool] fix build-for-devtools script (#24764) 2022-06-20 15:06:40 -04:00
Luna Ruan ddb1ab1e97
Rename react-dom/testing to react-dom/unstable_testing in yarn build-for-devtools (#24364)
The shell package wasn't compiling because yarn build-for-devtools was incorrect. The react-dom/test package was renamed to react-dom/unstable_testing. This PR fixes this in the package.json.

Note: Adding packages to the yarn build-for-devtools command isn't great in the long run. Eventually we should make devtools have its own build script.
2022-04-13 11:07:26 -07:00
Mengdi "Monday" Chen 27199d7567
fix build script for react dev tools (#24193) 2022-03-30 09:26:14 -04:00
Dan Abramov 4072bdfd6d Add Node 17 to devEngines 2022-03-25 04:20:39 +00:00
Sebastian Silbermann 3f89908983
Fix test-build-devtools if build was generated by build-for-devtools (#24088)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2022-03-23 09:51:59 -04:00
Sebastian Markbåge 1ad8d81292
Remove object-assign polyfill (#23351)
* Remove object-assign polyfill

We really rely on a more modern environment where this is typically
polyfilled anyway and we don't officially support IE with more extensive
polyfilling anyway. So all environments should have the native version
by now.

* Use shared/assign instead of Object.assign in code

This is so that we have one cached local instance in the bundle.

Ideally we should have a compile do this for us but we already follow
this pattern with hasOwnProperty, isArray, Object.is etc.

* Transform Object.assign to now use shared/assign

We need this to use the shared instance when Object.spread is used.
2022-02-23 19:34:24 -05:00
Ives van Hoorne 3fba8d64f1
Include other build types when building for CodeSandbox CI (#23152) 2022-01-20 15:20:02 +00:00
Andrew Clark 06f403481f
Add CI job to check npm dependencies (#22881)
Checks that if one React package depends on another, the current
version satisfies the given dependency range.

That way we don't forget to bump dependencies when we release a
new version.
2021-12-07 23:09:00 -08:00
jstejada a04795c89c
Ensure react-is version used for resolution for playwright is installed (#22813) 2021-11-23 13:29:47 -05:00
Sebastian Silbermann 149b420f63
Ensure devtools e2e test use a compatible react-is version (#22790)
* Update lockfile by running `yarn install`

* Ensure devtools e2e test use a compatible react-is version
2021-11-19 10:18:02 -05:00
Brian Vaughn aa19d569b2
Add test selectors to experimental build (#22760)
This change adds a new "react-dom/unstable_testing" entry point but I believe its contents will exactly match "react-dom/index" for the stable build. (The experimental build will have the added new selector APIs.)
2021-11-16 16:27:10 -05:00
irinakk ff9897d23e
[React Refresh] support typescript namespace syntax (#22621)
* [React Refresh] support typescript namespace syntax

* [React Refresh] handle nested namespace

Co-authored-by: Wang Yilin <wang_yil@worksap.co.jp>
2021-11-09 20:22:19 +00:00
Andrew Clark 7034408ff7
Follow-up improvements to error code extraction infra (#22516)
* Output FIXME during build for unminified errors

The invariant Babel transform used to output a FIXME comment if it
could not find a matching error code. This could happen if there were
a configuration mistake that caused an unminified message to
slip through.

Linting the compiled bundles is the most reliable way to do it because
there's not a one-to-one mapping between source modules and bundles. For
example, the same source module may appear in multiple bundles, some
which are minified and others which aren't.

This updates the transform to output the same messages for Error calls.

The source lint rule is still useful for catching mistakes during
development, to prompt you to update the error codes map before pushing
the PR to CI.

* Don't run error transform in development

We used to run the error transform in both production and development,
because in development it was used to convert `invariant` calls into
throw statements.

Now that don't use `invariant` anymore, we only have to run the
transform for production builds.

* Add ! to FIXME comment so Closure doesn't strip it

Don't love this solution because Closure could change this heuristic,
or we could switch to a differnt compiler that doesn't support it. But
it works.

Could add a bundle that contains an unminified error solely for the
purpose of testing it, but that seems like overkill.

* Alternate extract-errors that scrapes artifacts

The build script outputs a special FIXME comment when it fails to minify
an error message. CI will detect these comments and fail the workflow.

The comments also include the expected error message. So I added an
alternate extract-errors that scrapes unminified messages from the
build artifacts and updates `codes.json`.

This is nice because it works on partial builds. And you can also run it
after the fact, instead of needing build all over again.

* Disable error minification in more bundles

Not worth it because the number of errors does not outweight the size
of the formatProdErrorMessage runtime.

* Run extract-errors script in CI

The lint_build job already checks for unminified errors, but the output
isn't super helpful.

Instead I've added a new job that runs the extract-errors script and
fails the build if `codes.json` changes. It also outputs the expected
diff so you can easily see which messages were missing from the map.

* Replace old extract-errors script with new one

Deletes the old extract-errors in favor of extract-errors2
2021-10-31 15:37:32 -07:00
Andrew Clark 7d38e4fd89
CodeSandbox CI: Fall back to local build (#22473)
The `download-experimental-build` script has been flaky on CodeSandbox
CI, I think because of GitHub rate limiting.

Until we figure out how to fix that, I've updated it to fall back to a
local build.
2021-09-30 08:12:25 -07:00
Sebastian Markbåge eba248c390
[Fizz/Flight] Remove reentrancy hack (#22446)
* Remove reentrant check from Fizz/Flight

* Make startFlowing explicit in Flight

This is already an explicit call in Fizz. This moves flowing to be explicit.

That way we can avoid calling it in start() for web streams and therefore
avoid the reentrant call.

* Add regression test

This test doesn't actually error due to the streams polyfill not behaving
like Chrome but rather according to spec.

* Update the Web Streams polyfill

Not that we need this but just in case there are differences that are fixed.
2021-09-27 17:47:56 -07:00
Brian Vaughn a01cdbf813
Update Yarn build-for-devtools script to account for build/build2 changes (#22418) 2021-09-24 10:54:57 -04:00
Andrew Clark 95502f7b25
Update CodeSandbox to pull build artifacts from CI (#22400)
Instead of building them from source.

The `download-experimental-build` script polls CI until the build
has finished.
2021-09-22 11:35:56 -07:00
Andrew Clark bb0d069359
[build2 -> build] Local scripts
Update all our local scripts to use `build` instead of `build2`.

There are still downstream scripts that depend on `build2`, though, so
we can't remove it yet.
2021-09-21 15:14:09 -04:00
Michaël De Boey 0c0d1ddae4
feat(eslint-plugin-react-hooks): support ESLint 8.x (#22248) 2021-09-06 20:17:51 +01:00
Brian Vaughn b5fbf5464b
Automated DevTools release process (#22161) 2021-08-24 14:05:50 -04:00
Brian Vaughn 07e58658c9
Add script to generate DevTools changelog text (#22077) 2021-08-12 10:43:56 -04:00
Brian Vaughn c5cfa71948
DevTools: Show hook names based on variable usage (#21641)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
Co-authored-by: Saphal Patro <saphal1998@gmail.com>
Co-authored-by: VibhorCodecianGupta <vibhordelgupta@gmail.com>
2021-07-01 14:39:18 -04:00
Sebastian Silbermann 3c2341416a
Update jest to v26 (#21574)
* Install jest 26

* jsdom env now uses 16 by default

* require.requireActual -> jest.requireActual

* deduplicate added deps
2021-05-27 16:33:57 +01:00
Sebastian Silbermann 4edbcdc327
Update supported devEngines (#21364) 2021-04-27 12:03:25 -04:00
Brian Vaughn d778518998
Update build-for-devtools script to prepare unit tests too (#21182) 2021-04-06 09:24:33 -04:00
Sebastian Markbåge cf485e6f6b
[Fizz] Expose a method to abort a pending request (#21027)
* Track all suspended work while it's still pending

This allows us to abort work and put everything into client rendered mode
if we don't want to wait for further I/O.

It also allows us to cancel fallbacks if we complete the main content
before the fallback.

* Expose abort API to the browser streams

Since this API already returns a value, we need to use destructuring to
expose more options.

* Add a test including the client actually client rendering it

* Use AbortSignal option for W3C streams instead of external control

* Clean up listener after it's used once
2021-03-18 09:46:15 -07:00
Brian Vaughn 533aed8de6
Speed up DevTools local build script (#21018) 2021-03-16 14:02:24 -04:00
Andrew Clark c1cfa734fd
Add command to publish preleases via CI (#20728)
```
yarn publish-prereleases
```

Script to trigger a CircleCI workflow that publishes preleases.

**The CI workflow doesn't actually publish yet; it just runs and logs
its inputs.**
2021-02-03 15:42:34 -08:00
Brian Vaughn af16f755dc
Update DevTools to use getCacheForType API (#20548)
DevTools was built with a fork of an early idea for how Suspense cache might work. This idea is incompatible with newer APIs like `useTransition` which unfortunately prevented me from making certain UX improvements. This PR swaps out the primary usage of this cache (there are a few) in favor of the newer `unstable_getCacheForType` and `unstable_useCacheRefresh` APIs. We can go back and update the others in follow up PRs.

### Messaging changes

I've refactored the way the frontend loads component props/state/etc to hopefully make it better match the Suspense+cache model. Doing this gave up some of the small optimizations I'd added but hopefully the actual performance impact of that is minor and the overall ergonomic improvements of working with the cache API make this worth it.

The backend no longer remembers inspected paths. Instead, the frontend sends them every time and the backend sends a response with those paths. I've also added a new "force" parameter that the frontend can use to tell the backend to send a response even if the component hasn't rendered since the last time it asked. (This is used to get data for newly inspected paths.)

_Initial inspection..._
```
front |                                                      | back
      | -- "inspect" (id:1, paths:[], force:true) ---------> |
      | <------------------------ "inspected" (full-data) -- |
```
_1 second passes with no updates..._
```
      | -- "inspect" (id:1, paths:[], force:false) --------> |
      | <------------------------ "inspected" (no-change) -- |
```
_User clicks to expand a path, aka hydrate..._
```
      | -- "inspect" (id:1, paths:['foo'], force:true) ----> |
      | <------------------------ "inspected" (full-data) -- |
```
_1 second passes during which there is an update..._
```
      | -- "inspect" (id:1, paths:['foo'], force:false) ---> |
      | <----------------- "inspectedElement" (full-data) -- |
```

### Clear errors/warnings transition
Previously this meant there would be a delay after clicking the "clear" button. The UX after this change is much improved.

### Hydrating paths transition
I also added a transition to hydration (expanding "dehyrated" paths).

### Better error boundaries
I also added a lower-level error boundary in case the new suspense operation ever failed. It provides a better "retry" mechanism (select a new element) so DevTools doesn't become entirely useful. Here I'm intentionally causing an error every time I select an element.

### Improved snapshot tests
I also migrated several of the existing snapshot tests to use inline snapshots and added a new serializer for dehydrated props. Inline snapshots are easier to verify and maintain and the new serializer means dehydrated props will be formatted in a way that makes sense rather than being empty (in external snapshots) or super verbose (default inline snapshot format).
2021-01-19 09:51:32 -05:00
Andrew Clark eb0fb38230
Build stable and experimental with same command (#20573)
The goal is to simplify our CI pipeline so that all configurations
are built and tested in a single workflow.

As a first step, this adds a new build script entry point that builds
both the experimental and stable release channels into a single
artifacts directory.

The script works by wrapping the existing build script (which only
builds a single release channel at a time), then post-processing the
results to match the desired filesystem layout. A future version of the
build script would output the files directly without post-processing.

Because many parts of our infra depend on the existing layout of the
build artifacts directory, I have left the old workflows untouched.
We can incremental migrate to the new layout, then delete the old
workflows after we've finished.
2021-01-12 09:32:32 -08:00
Brian Vaughn dd16b78990 Tweaked DevTools build command slightly 2020-12-07 10:10:43 -05:00
Brian Vaughn a2a025537d
Fixed invalid DevTools work tags (#20362)
* Fixed invalid DevTools work tags

Work tags changed recently (PR #13902) but we didn't bump React versions. This meant that DevTools has valid work tags only for master (and FB www sync) but invalid work tags for the latest open source releases. To fix this, I incremneted React's version in Git (without an actual release) and added a new fork to the work tags detection branch.

This commit also adds tags for the experimental Scope and Fundamental APIs to DevTools so component names will at least display correctly. Technically these new APIs were first introduced to experimental builds ~16.9 but I didn't add a new branch to the work tags fork because I don't they're used commonly. I've just added them to the 17+ branches.

* Removed FundamentalComponent from DevTools tag defs
2020-12-01 10:33:32 -05:00
Brian Vaughn 2cf8f7f61c
Speed up local "build-for-detools" target (#20307) 2020-11-20 12:31:29 -05:00
Sebastian Markbåge e41fd1fc06
Support ESM module loaders in Flight fixture (#20229)
This lets the Flight fixture run as "type": "module" or "commonjs".

Experimental loaders can be used similar to require.extensions to do the
transpilation and replacement of .client.js references.
2020-11-12 08:11:05 -08:00
Justus Hämäläinen 06a4615be2
Allow Node 15.x (#20108)
Co-authored-by: Justus Hämäläinen <me@justushamalainen.fi>
2020-10-27 15:16:16 +00:00
oltrep f668b6c351
Bump to latest eslint-config-fbjs (#20029)
* bump package to latest

* update files to respect lint

* disable object-type-delimiter rule to work with prettier

* disable rule to let flow check pass
2020-10-16 16:06:08 +01:00
Ricky 880587366d
Deprecate old test script commands (#19893)
* Deprecate old test script commands

* Update PR template test script

* Add test-stable and test-www-classic

* Update circle test names

* Rename test-www-classic to test-classic

* Missed some job renames

* Missed some more job renames
2020-10-14 08:54:34 -04:00
E-Liang Tan 9340083395
Scheduling Profiler: Add Fast Refresh (#19757) 2020-09-03 09:17:57 -04:00
Bhumij Gupta 53e622ca7f
Fix instances of function declaration after return (#19733)
* Add ESLint plugin to check for any function declare after return
* Refactor code to move function declarations before return and fix failing lint
2020-09-01 08:55:10 -04:00
Pascal Fong Kye 1396e4a8f5
Fixes eslint warning when node type is ChainExpression (#19680)
* Add babel parser which supports ChainExpression

* Add and fix tests for new babel eslint parser

* extract function to mark node

* refactor for compatibility with eslint v7.7.0+

* Update eslint to v7.7.0
Update hook test since eslint now supports nullish coalescing
2020-08-29 21:03:23 +01:00
E-Liang Tan c641b611c4
Upgrade all @babel/* packages to fix DevTools builds on newer Node versions (#19647) 2020-08-20 11:47:16 -04:00
Ricky bc4cd92cd5
Use jest-environment-jsdom-sixteen (#19288)
* Use jest-environment-jsdom-sixteen

* Update yarn.lock

* Dedupe new jest packages in yarn.lock

* Pull upstream changes
2020-07-16 10:17:31 -04:00
Dan Abramov c7805b8d57
Use a custom jsdom fork (#19284) 2020-07-08 21:26:54 +01:00
Ricky 72bbcad160
Add new test cli (#19184)
* Add new test cli

* Remove --variant accidentally added to test-persist

* s/test/tests

* Updates from review

* Update package.json tests

* Missed a release channel in circle.yaml

* Update config.yml to use just run: with test commands

* Update release-channel options and add build dir checks

* Update test args to use the new release-channel options

* Fix error in circle config.yml

* Fix a wrong condition for the --variant check

* Fix a wrong condition for the --persistent check

* Prettier

* Require build check for devtool tests as well
2020-06-25 20:39:50 -04:00