mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
This is basically the implementation for the prerender pass. Instead of forking basically the whole implementation for prerender, I just add a conditional field on the request. If it's `null` it behaves like before. If it's non-`null` then instead of triggering client rendered boundaries it triggers those into a "postponed" state which is basically just a variant of "pending". It's supposed to be filled in later. It also builds up a serializable tree of which path can be followed to find the holes. This is basically a reverse `KeyPath` tree. It is unfortunate that this approach adds more code to the regular Fizz builds but in practice. It seems like this side is not going to add much code and we might instead just want to merge the builds so that it's smaller when you have `prerender` and `resume` in the same bundle - which I think will be common in practice. This just implements the prerender side, and not the resume side, which is why the tests have a TODO. That's in a follow up PR.
21 lines
741 B
JavaScript
21 lines
741 B
JavaScript
'use strict';
|
|
|
|
var l, s;
|
|
if (process.env.NODE_ENV === 'production') {
|
|
l = require('./cjs/react-dom-server-legacy.node.production.min.js');
|
|
s = require('./cjs/react-dom-server.node.production.min.js');
|
|
} else {
|
|
l = require('./cjs/react-dom-server-legacy.node.development.js');
|
|
s = require('./cjs/react-dom-server.node.development.js');
|
|
}
|
|
|
|
exports.version = l.version;
|
|
exports.renderToString = l.renderToString;
|
|
exports.renderToStaticMarkup = l.renderToStaticMarkup;
|
|
exports.renderToNodeStream = l.renderToNodeStream;
|
|
exports.renderToStaticNodeStream = l.renderToStaticNodeStream;
|
|
exports.renderToPipeableStream = s.renderToPipeableStream;
|
|
if (s.resumeToPipeableStream) {
|
|
exports.resumeToPipeableStream = s.resumeToPipeableStream;
|
|
}
|