react/scripts
Sebastian Markbåge ffd8423356
[Flight] Add support for Module References in transport protocol (#20121)
* Refactor Flight to require a module reference to be brand checked

This exposes a host environment (bundler) specific hook to check if an
object is a module reference. This will be used so that they can be passed
directly into Flight without needing additional wrapper objects.

* Emit module references as a special type of value

We already have JSON and errors as special types of "rows". This encodes
module references as a special type of row value. This was always the
intention because it allows those values to be emitted first in the stream
so that as a large models stream down, we can start preloading as early
as possible.

We preload the module when they resolve but we lazily require them as they
are referenced.

* Emit module references where ever they occur

This emits module references where ever they occur. In blocks or even
directly in elements.

* Don't special case the root row

I originally did this so that a simple stream is also just plain JSON.

However, since we might want to emit things like modules before the root
module in the stream, this gets unnecessarily complicated. We could add
this back as a special case if it's the first byte written but meh.

* Update the protocol

* Add test for using a module reference as a client component

* Relax element type check

Since Flight now accepts a module reference as returned by any bundler
system, depending on the renderer running. We need to drastically relax
the check to include all of them. We can add more as we discover them.

* Move flow annotation

Seems like our compiler is not happy with stripping this.

* Some bookkeeping bug

* Can't use the private field to check
2020-10-29 17:57:31 -07:00
..
babel Fix "missing flag" error for non-boolean types (#18592) 2020-04-13 12:57:31 -07:00
bench make link https (#19147) 2020-06-30 12:43:52 +01:00
circleci Remove /dist/ UMD builds (#18473) 2020-04-02 17:52:32 -07:00
error-codes [Flight] Don't warn for key, but error for ref (#19986) 2020-10-08 17:02:23 -07:00
eslint Revert autofix lint (#19040) 2020-05-28 20:32:34 -07:00
eslint-rules Rename effect fields (#19755) 2020-09-04 14:34:07 -07:00
flow [Flight] Add support for Module References in transport protocol (#20121) 2020-10-29 17:57:31 -07:00
git Remove leftover env variable logic in pre-commit hook 2015-09-01 14:35:47 -07:00
jest [Flight] Add support for Module References in transport protocol (#20121) 2020-10-29 17:57:31 -07:00
merge-fork Land Lanes implementation in old fork (#19108) 2020-06-11 20:05:15 -07:00
perf-counters Drop the year from Facebook copyright headers and the LICENSE file. (#13593) 2018-09-07 15:11:23 -07:00
prettier Fixture: Legacy JSX Runtimes (#20012) 2020-10-14 18:28:03 +01:00
print-warnings Update Flow to 0.84 (#17805) 2020-01-09 14:50:44 +00:00
release Release script: allow preparing RC from npm 2020-09-22 14:27:50 +01:00
rollup [Flight] Add support for Module References in transport protocol (#20121) 2020-10-29 17:57:31 -07:00
shared Fork legacy-events folder into react-dom and react-native (#19228) 2020-07-01 16:37:13 +01:00
tasks Change ReactVersion from CJS to ES module (#18181) 2020-02-28 13:09:02 -08:00
yarn chore: upgrade to jest 24 (#15778) 2019-10-03 22:44:18 +05:30
authors AUTHORS 2013-09-09 23:42:54 -07:00