react/scripts/jest
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
..
matchers Revert "Add regression test for #18497 (#18538)" (#19215) 2020-06-30 13:38:31 +01:00
spec-equivalence-reporter Interaction tracing works across hidden and SSR hydration boundaries (#15872) 2019-06-14 18:08:23 -07:00
typescript [DevTools] Add DevTools forked Feature flags (#18994) 2020-10-12 13:07:10 -04:00
TestFlags.js Land Lanes implementation in old fork (#19108) 2020-06-11 20:05:15 -07:00
config.base.js Parallelize Jest in CI (#19552) 2020-08-07 16:32:59 -04:00
config.build-devtools.js [DevTools] Add DevTools forked Feature flags (#18994) 2020-10-12 13:07:10 -04:00
config.build.js Fix test_build_devtools CI job to run test-build-devtools (#17631) 2019-12-16 16:03:12 -08:00
config.source-persistent.js Export React as Named Exports instead of CommonJS (#18106) 2020-02-25 13:54:27 -08:00
config.source-www.js Add test run that uses www feature flags (#18234) 2020-03-06 09:29:05 -08:00
config.source.js Export React as Named Exports instead of CommonJS (#18106) 2020-02-25 13:54:27 -08:00
dont-run-jest-directly.js Add error when running jest directly (#12726) 2018-05-01 12:46:17 -07:00
jest-cli.js Deprecate old test script commands (#19893) 2020-10-14 08:54:34 -04:00
jest.js Add new test cli (#19184) 2020-06-25 20:39:50 -04:00
jestSequencer.js Parallelize Jest in CI (#19552) 2020-08-07 16:32:59 -04:00
noHaste.js Forbid Haste in Jest (#11647) 2017-11-23 18:02:47 +00:00
preprocessor.js Add pragma for feature testing: @gate (#18581) 2020-04-13 10:14:34 -07:00
setupEnvironment.js [DevTools] Add DevTools forked Feature flags (#18994) 2020-10-12 13:07:10 -04:00
setupHostConfigs.js [Flight] Add support for Module References in transport protocol (#20121) 2020-10-29 17:57:31 -07:00
setupTests.build.js Add new mock build of Scheduler with flush, yield API (#14964) 2019-02-26 20:51:17 -08:00
setupTests.js Codemod it.experimental to gate pragma (#18582) 2020-04-13 10:28:59 -07:00
setupTests.persistent.js Run persistent mode tests in CI (#15029) 2019-03-11 10:56:34 -07:00
setupTests.www.js Remove the deprecated React Flare event system (#19520) 2020-08-05 15:13:29 +01:00
shouldIgnoreConsoleError.js warn if you try to use act() in prod (#16282) 2019-08-05 13:01:05 -07:00