Skip to content

Commit

Permalink
[Fizz] Move /static build into /server builds (#27327)
Browse files Browse the repository at this point in the history
This joins the static (prerender) builds with the server builds but
doesn't change the public entry points.

The idea of two separate bundles is that we'd have a specialized build
for Fizz just for the prerender that could do a lot more. However, in
practice the code is implemented with a dynamic check so it's in both.
It's also not a lot of code.

At the same time if you do have a set up that includes both the
prerender and the render in the same build output, this just doubles the
server bundle size for no reason.

So we might as well merge them into one build. However, I don't expose
the `prerender` from `/server`. Instead it's just exposed from the
public `/static` entry point. This leaves us with the option to go back
to separate builds later if it diverges more in the future.

DiffTrain build for [2c2bdd0](2c2bdd0)
  • Loading branch information
sebmarkbage committed Sep 5, 2023
1 parent 7aeecfd commit 3be7229
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 123 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b70a0d70224ceb4e277bd8ac535a2caafa5c075a
2c2bdd0ffe54df60201ee93b29de5cb7b93ff029
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-5ec21dc5";
var ReactVersion = "18.3.0-www-modern-1275e069";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,4 +615,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-feef7178";
exports.version = "18.3.0-www-modern-54369a40";
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-90201c21";
var ReactVersion = "18.3.0-www-modern-dcc12554";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9780,7 +9780,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-a89096af",
version: "18.3.0-www-modern-ca0ea9bc",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1282 = {
Expand Down Expand Up @@ -9811,7 +9811,7 @@ var internals$jscomp$inline_1282 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-a89096af"
reconcilerVersion: "18.3.0-www-modern-ca0ea9bc"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1283 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -33853,7 +33853,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-90201c21";
var ReactVersion = "18.3.0-www-modern-73585f43";

function createPortal$1(
children,
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16219,7 +16219,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1741 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-a89096af",
version: "18.3.0-www-modern-3501ad4f",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2103 = {
Expand Down Expand Up @@ -16250,7 +16250,7 @@ var internals$jscomp$inline_2103 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-a89096af"
reconcilerVersion: "18.3.0-www-modern-3501ad4f"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2104 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16417,4 +16417,4 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-a89096af";
exports.version = "18.3.0-www-modern-3501ad4f";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16988,7 +16988,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1826 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-ff6bf6ef",
version: "18.3.0-www-modern-b6acedfc",
rendererPackageName: "react-dom"
};
(function (internals) {
Expand Down Expand Up @@ -17033,7 +17033,7 @@ var devToolsConfig$jscomp$inline_1826 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-ff6bf6ef"
reconcilerVersion: "18.3.0-www-modern-b6acedfc"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function (children, container) {
Expand Down Expand Up @@ -17187,7 +17187,7 @@ exports.unstable_createEventHandle = function (type, options) {
return eventHandle;
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-modern-ff6bf6ef";
exports.version = "18.3.0-www-modern-b6acedfc";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
35 changes: 20 additions & 15 deletions compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-b794beee";
var ReactVersion = "18.3.0-www-classic-9855f7ea";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -9889,6 +9889,7 @@ function createRequest(
rootSegment,
abortSet,
null,
rootFormatContext,
emptyContextObject,
rootContextSnapshot,
emptyTreeContext
Expand Down Expand Up @@ -9939,6 +9940,7 @@ function createTask(
blockedSegment,
abortSet,
keyPath,
formatContext,
legacyContext,
context,
treeContext
Expand All @@ -9960,6 +9962,7 @@ function createTask(
blockedSegment: blockedSegment,
abortSet: abortSet,
keyPath: keyPath,
formatContext: formatContext,
legacyContext: legacyContext,
context: context,
treeContext: treeContext,
Expand All @@ -9978,7 +9981,7 @@ function createPendingSegment(
request,
index,
boundary,
formatContext,
parentFormatContext,
lastPushedText,
textEmbedded
) {
Expand All @@ -9990,7 +9993,7 @@ function createPendingSegment(
parentFlushed: false,
chunks: [],
children: [],
formatContext: formatContext,
parentFormatContext: parentFormatContext,
boundary: boundary,
lastPushedText: lastPushedText,
textEmbedded: textEmbedded
Expand Down Expand Up @@ -10131,7 +10134,7 @@ function renderSuspenseBoundary(request, task, props) {
request,
insertionIndex,
newBoundary,
parentSegment.formatContext, // boundaries never require text embedding at their edges because comment nodes bound them
task.formatContext, // boundaries never require text embedding at their edges because comment nodes bound them
false,
false
);
Expand All @@ -10143,7 +10146,7 @@ function renderSuspenseBoundary(request, task, props) {
request,
0,
null,
parentSegment.formatContext, // boundaries never require text embedding at their edges because comment nodes bound them
task.formatContext, // boundaries never require text embedding at their edges because comment nodes bound them
false,
false
); // We mark the root segment as having its parent flushed. It's not really flushed but there is
Expand Down Expand Up @@ -10224,6 +10227,7 @@ function renderSuspenseBoundary(request, task, props) {
boundarySegment,
fallbackAbortSet,
task.keyPath,
task.formatContext,
task.legacyContext,
task.context,
task.treeContext
Expand All @@ -10247,18 +10251,18 @@ function renderHostElement(request, task, type, props) {
props,
request.resumableState,
request.renderState,
segment.formatContext,
task.formatContext,
segment.lastPushedText
);
segment.lastPushedText = false;
var prevContext = segment.formatContext;
segment.formatContext = getChildFormatContext(prevContext, type, props); // We use the non-destructive form because if something suspends, we still
var prevContext = task.formatContext;
task.formatContext = getChildFormatContext(prevContext, type, props); // We use the non-destructive form because if something suspends, we still
// need to pop back up and finish this subtree of HTML.

renderNode(request, task, children, 0); // We expect that errors will fatal the whole task and that we don't need
// the correct context. Therefore this is not in a finally.

segment.formatContext = prevContext;
task.formatContext = prevContext;
pushEndInstance(
segment.chunks,
type,
Expand Down Expand Up @@ -11077,7 +11081,7 @@ function spawnNewSuspendedTask(request, task, thenableState, x) {
request,
insertionIndex,
null,
segment.formatContext, // Adopt the parent segment's leading text embed
task.formatContext, // Adopt the parent segment's leading text embed
segment.lastPushedText, // Assume we are text embedded at the trailing edge
true
);
Expand All @@ -11092,6 +11096,7 @@ function spawnNewSuspendedTask(request, task, thenableState, x) {
newSegment,
task.abortSet,
task.keyPath,
task.formatContext,
task.legacyContext,
task.context,
task.treeContext
Expand All @@ -11118,7 +11123,7 @@ function renderNode(request, task, node, childIndex) {
var chunkLength = segment.chunks.length; // Snapshot the current context in case something throws to interrupt the
// process.

var previousFormatContext = task.blockedSegment.formatContext;
var previousFormatContext = task.formatContext;
var previousLegacyContext = task.legacyContext;
var previousContext = task.context;
var previousKeyPath = task.keyPath;
Expand Down Expand Up @@ -11152,7 +11157,7 @@ function renderNode(request, task, node, childIndex) {
spawnNewSuspendedTask(request, task, thenableState, wakeable); // Restore the context. We assume that this will be restored by the inner
// functions in case nothing throws so we don't use "finally" here.

task.blockedSegment.formatContext = previousFormatContext;
task.formatContext = previousFormatContext;
task.legacyContext = previousLegacyContext;
task.context = previousContext;
task.keyPath = previousKeyPath; // Restore all active ReactContexts to what they were before.
Expand All @@ -11168,7 +11173,7 @@ function renderNode(request, task, node, childIndex) {
} // Restore the context. We assume that this will be restored by the inner
// functions in case nothing throws so we don't use "finally" here.

task.blockedSegment.formatContext = previousFormatContext;
task.formatContext = previousFormatContext;
task.legacyContext = previousLegacyContext;
task.context = previousContext;
task.keyPath = previousKeyPath; // Restore all active ReactContexts to what they were before.
Expand Down Expand Up @@ -11712,11 +11717,11 @@ function flushSegmentContainer(request, destination, segment) {
writeStartSegment(
destination,
request.renderState,
segment.formatContext,
segment.parentFormatContext,
segment.id
);
flushSegment(request, destination, segment);
return writeEndSegment(destination, segment.formatContext);
return writeEndSegment(destination, segment.parentFormatContext);
}

function flushCompletedBoundary(request, destination, boundary) {
Expand Down
Loading

0 comments on commit 3be7229

Please sign in to comment.