mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
* [Fizz] Add Flow/Jest/Rollup build infra Add a new package for react-stream which allows for custom server renderer outputs. I picked the name because it's a reasonable name but also because the npm name is currently owned by a friend of the project. The react-dom build has its own inlined server renderer under the name `react-dom/fizz`. There is also a noop renderer to be used for testing. At some point we might add a public one to test-renderer but for now I don't want to have to think about public API design for the tests. * Add FormatConfig too We need to separate the format (DOM, React Native, etc) from the host running the server (Node, Browser, etc). * Basic wiring between Node, Noop and DOM configs The Node DOM API is pipeToNodeStream which accepts a writable stream. * Merge host and format config in dynamic react-stream entry point Simpler API this way but also avoids having to fork the wrapper config. Fixes noop builds. * Add setImmediate/Buffer globals to lint config Used by the server renderer * Properly include fizz.node.js Also use forwarding to it from fizz.js in builds so that tests covers this. * Make react-stream private since we're not ready to publish or even name it yet * Rename Renderer -> Streamer * Prefix react-dom/fizz with react-dom/unstable-fizz * Add Fizz Browser host config This lets Fizz render to WHATWG streams. E.g. for rendering in a Service Worker. I added react-dom/unstable-fizz.browser as the entry point for this. Since we now have two configurations of DOM. I had to add another inlinedHostConfigs configuration called `dom-browser`. The reconciler treats this configuration the same as `dom`. For stream it checks against the ReactFizzHostConfigBrowser instead of the Node one. * Add Fizz Browser Fixture This is for testing server rendering - on the client. * Lower version number to detach it from react-reconciler version
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
// This entry point is intentionally not typed. It exists only for third-party
|
|
// renderers. The renderers we ship (such as React DOM) instead import a named
|
|
// "inline" entry point (for example, `react-stream/inline.dom`). It uses
|
|
// the same code, but the Flow configuration redirects the host config to its
|
|
// real implementation so we can check it against exact intended host types.
|
|
//
|
|
// Only one renderer (the one you passed to `yarn flow <renderer>`) is fully
|
|
// type-checked at any given time. The Flow config maps the
|
|
// `react-stream/inline.<renderer>` import (which is *not* Flow typed) to
|
|
// `react-stream/inline-typed` (which *is*) for the current renderer.
|
|
// On CI, we run Flow checks for each renderer separately.
|
|
|
|
'use strict';
|
|
|
|
const ReactFizzStreamer = require('./src/ReactFizzStreamer');
|
|
|
|
// TODO: decide on the top-level export form.
|
|
// This is hacky but makes it work with both Rollup and Jest.
|
|
module.exports = ReactFizzStreamer.default || ReactFizzStreamer;
|