Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update React from 2983249dd to 7508dcd5c #58216

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-canary-2983249dd-20231107",
"react-builtin": "npm:react@18.3.0-canary-7508dcd5c-20231108",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-canary-2983249dd-20231107",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-2983249dd-20231107",
"react-experimental-builtin": "npm:react@0.0.0-experimental-2983249dd-20231107",
"react-server-dom-turbopack": "18.3.0-canary-2983249dd-20231107",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-2983249dd-20231107",
"react-server-dom-webpack": "18.3.0-canary-2983249dd-20231107",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-2983249dd-20231107",
"react-dom-builtin": "npm:react-dom@18.3.0-canary-7508dcd5c-20231108",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-7508dcd5c-20231108",
"react-experimental-builtin": "npm:react@0.0.0-experimental-7508dcd5c-20231108",
"react-server-dom-turbopack": "18.3.0-canary-7508dcd5c-20231108",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-7508dcd5c-20231108",
"react-server-dom-webpack": "18.3.0-canary-7508dcd5c-20231108",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-7508dcd5c-20231108",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -212,8 +212,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.6",
"scheduler-builtin": "npm:scheduler@0.24.0-canary-2983249dd-20231107",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-2983249dd-20231107",
"scheduler-builtin": "npm:scheduler@0.24.0-canary-7508dcd5c-20231108",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-7508dcd5c-20231108",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require("next/dist/compiled/react-experimental");
var ReactDOM = require('react-dom');

var ReactVersion = '18.3.0-experimental-2983249dd-20231107';
var ReactVersion = '18.3.0-experimental-7508dcd5c-20231108';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -1736,11 +1736,14 @@ var DEFAULT_HEADERS_CAPACITY_IN_UTF16_CODE_UNITS = 2000; // Allows us to keep tr
// if passed externalRuntimeConfig and the enableFizzExternalRuntime feature flag
// is set, the server will send instructions via data attributes (instead of inline scripts)

function createRenderState$1(resumableState, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules, externalRuntimeConfig, importMap, onHeaders, maxHeadersLength) {
function createRenderState$1(resumableState, nonce, externalRuntimeConfig, importMap, onHeaders, maxHeadersLength) {
var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk('<script nonce="' + escapeTextForBrowser(nonce) + '">');
var idPrefix = resumableState.idPrefix;
var bootstrapChunks = [];
var externalRuntimeScript = null;
var bootstrapScriptContent = resumableState.bootstrapScriptContent,
bootstrapScripts = resumableState.bootstrapScripts,
bootstrapModules = resumableState.bootstrapModules;

if (bootstrapScriptContent !== undefined) {
bootstrapChunks.push(inlineScriptWithNonce, stringToChunk(escapeBootstrapAndImportMapScriptContent(bootstrapScriptContent)), endInlineScript);
Expand Down Expand Up @@ -1929,7 +1932,7 @@ function createRenderState$1(resumableState, nonce, bootstrapScriptContent, boot

return renderState;
}
function createResumableState(identifierPrefix, externalRuntimeConfig) {
function createResumableState(identifierPrefix, externalRuntimeConfig, bootstrapScriptContent, bootstrapScripts, bootstrapModules) {
var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix;
var streamingFormat = ScriptStreamingFormat;

Expand All @@ -1943,6 +1946,9 @@ function createResumableState(identifierPrefix, externalRuntimeConfig) {
idPrefix: idPrefix,
nextFormID: 0,
streamingFormat: streamingFormat,
bootstrapScriptContent: bootstrapScriptContent,
bootstrapScripts: bootstrapScripts,
bootstrapModules: bootstrapModules,
instructions: NothingSent,
hasBody: false,
hasHtml: false,
Expand Down Expand Up @@ -4409,7 +4415,10 @@ function pushEndInstance(target, type, props, resumableState, formatContext) {
target.push(endChunkForTag(type));
}

function writeBootstrap(destination, renderState) {
function writeBootstrap(destination, renderState, resumableState) {
resumableState.bootstrapScriptContent = undefined;
resumableState.bootstrapScripts = undefined;
resumableState.bootstrapModules = undefined;
var bootstrapChunks = renderState.bootstrapChunks;
var i = 0;

Expand All @@ -4426,8 +4435,8 @@ function writeBootstrap(destination, renderState) {
return true;
}

function writeCompletedRoot(destination, renderState) {
return writeBootstrap(destination, renderState);
function writeCompletedRoot(destination, renderState, resumableState) {
return writeBootstrap(destination, renderState, resumableState);
} // Structural Nodes
// A placeholder is a node inside a hidden partial tree that can be filled in later, but before
// display. It's never visible to users. We use the template tag because it can be used in every
Expand Down Expand Up @@ -4784,7 +4793,7 @@ function writeCompletedBoundaryInstruction(destination, resumableState, renderSt
writeMore = writeChunkAndReturn(destination, completeBoundaryDataEnd);
}

return writeBootstrap(destination, renderState) && writeMore;
return writeBootstrap(destination, renderState, resumableState) && writeMore;
}
var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderBoundary + ';$RX("');
var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
Expand Down Expand Up @@ -6520,7 +6529,7 @@ function emitEarlyPreloads(renderState, resumableState, shellComplete) {
}

function createRenderState(resumableState, generateStaticMarkup) {
var renderState = createRenderState$1(resumableState, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
var renderState = createRenderState$1(resumableState, undefined, undefined, undefined, undefined, undefined);
return {
// Keep this in sync with ReactFizzConfigDOM
placeholderPrefix: renderState.placeholderPrefix,
Expand Down Expand Up @@ -6876,6 +6885,18 @@ var componentFrameCache;
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
componentFrameCache = new PossiblyWeakMap();
}
/**
* Leverages native browser/VM stack frames to get proper details (e.g.
* filename, line + col number) for a single component in a component stack. We
* do this by:
* (1) throwing and catching an error in the function - this will be our
* control error.
* (2) calling the component which will eventually throw an error that we'll
* catch - this will be our sample error.
* (3) diffing the control and sample error stacks to find the stack frame
* which represents our component.
*/


function describeNativeComponentFrame(fn, construct) {
// If something asked for a stack inside a fake render, it should get ignored.
Expand All @@ -6891,7 +6912,6 @@ function describeNativeComponentFrame(fn, construct) {
}
}

var control;
reentry = true;
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined.

Expand All @@ -6905,81 +6925,140 @@ function describeNativeComponentFrame(fn, construct) {
ReactCurrentDispatcher$1.current = null;
disableLogs();
}
/**
* Finding a common stack frame between sample and control errors can be
* tricky given the different types and levels of stack trace truncation from
* different JS VMs. So instead we'll attempt to control what that common
* frame should be through this object method:
* Having both the sample and control errors be in the function under the
* `DescribeNativeComponentFrameRoot` property, + setting the `name` and
* `displayName` properties of the function ensures that a stack
* frame exists that has the method name `DescribeNativeComponentFrameRoot` in
* it for both control and sample stacks.
*/

try {
// This should throw.
if (construct) {
// Something should be setting the props in the constructor.
var Fake = function () {
throw Error();
}; // $FlowFixMe[prop-missing]

var RunInRootFrame = {
DetermineComponentFrameRoot: function () {
var control;

Object.defineProperty(Fake.prototype, 'props', {
set: function () {
// We use a throwing setter instead of frozen or non-writable props
// because that won't throw in a non-strict mode function.
throw Error();
}
});
try {
// This should throw.
if (construct) {
// Something should be setting the props in the constructor.
var Fake = function () {
throw Error();
}; // $FlowFixMe[prop-missing]


Object.defineProperty(Fake.prototype, 'props', {
set: function () {
// We use a throwing setter instead of frozen or non-writable props
// because that won't throw in a non-strict mode function.
throw Error();
}
});

if (typeof Reflect === 'object' && Reflect.construct) {
// We construct a different control for this case to include any extra
// frames added by the construct call.
try {
Reflect.construct(Fake, []);
} catch (x) {
control = x;
}
if (typeof Reflect === 'object' && Reflect.construct) {
// We construct a different control for this case to include any extra
// frames added by the construct call.
try {
Reflect.construct(Fake, []);
} catch (x) {
control = x;
}

Reflect.construct(fn, [], Fake);
} else {
try {
Fake.call();
} catch (x) {
control = x;
} // $FlowFixMe[prop-missing] found when upgrading Flow
Reflect.construct(fn, [], Fake);
} else {
try {
Fake.call();
} catch (x) {
control = x;
} // $FlowFixMe[prop-missing] found when upgrading Flow


fn.call(Fake.prototype);
}
} else {
try {
throw Error();
} catch (x) {
control = x;
} // TODO(luna): This will currently only throw if the function component
// tries to access React/ReactDOM/props. We should probably make this throw
// in simple components too
fn.call(Fake.prototype);
}
} else {
try {
throw Error();
} catch (x) {
control = x;
} // TODO(luna): This will currently only throw if the function component
// tries to access React/ReactDOM/props. We should probably make this throw
// in simple components too


var maybePromise = fn(); // If the function component returns a promise, it's likely an async
// component, which we don't yet support. Attach a noop catch handler to
// silence the error.
// TODO: Implement component stacks for async client components?
var maybePromise = fn(); // If the function component returns a promise, it's likely an async
// component, which we don't yet support. Attach a noop catch handler to
// silence the error.
// TODO: Implement component stacks for async client components?

if (maybePromise && typeof maybePromise.catch === 'function') {
maybePromise.catch(function () {});
if (maybePromise && typeof maybePromise.catch === 'function') {
maybePromise.catch(function () {});
}
}
} catch (sample) {
// This is inlined manually because closure doesn't do it for us.
if (sample && control && typeof sample.stack === 'string') {
return [sample.stack, control.stack];
}
}

return [null, null];
}
} catch (sample) {
// This is inlined manually because closure doesn't do it for us.
if (sample && control && typeof sample.stack === 'string') {
}; // $FlowFixMe[prop-missing]

RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot';
var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable.

if (namePropDescriptor && namePropDescriptor.configurable) {
// V8 utilizes a function's `name` property when generating a stack trace.
Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor
// is set to `false`.
// $FlowFixMe[cannot-write]
'name', {
value: 'DetermineComponentFrameRoot'
});
}

try {
var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(),
sampleStack = _RunInRootFrame$Deter[0],
controlStack = _RunInRootFrame$Deter[1];

if (sampleStack && controlStack) {
// This extracts the first frame from the sample that isn't also in the control.
// Skipping one frame that we assume is the frame that calls the two.
var sampleLines = sample.stack.split('\n');
var controlLines = control.stack.split('\n');
var s = sampleLines.length - 1;
var c = controlLines.length - 1;

while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
// We expect at least one stack frame to be shared.
// Typically this will be the root most one. However, stack frames may be
// cut off due to maximum stack limits. In this case, one maybe cut off
// earlier than the other. We assume that the sample is longer or the same
// and there for cut off earlier. So we should find the root most frame in
// the sample somewhere in the control.
c--;
var sampleLines = sampleStack.split('\n');
var controlLines = controlStack.split('\n');
var s = 0;
var c = 0;

while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) {
s++;
}

while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) {
c++;
} // We couldn't find our intentionally injected common root frame, attempt
// to find another common root frame by search from the bottom of the
// control stack...


if (s === sampleLines.length || c === controlLines.length) {
s = sampleLines.length - 1;
c = controlLines.length - 1;

while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
// We expect at least one stack frame to be shared.
// Typically this will be the root most one. However, stack frames may be
// cut off due to maximum stack limits. In this case, one maybe cut off
// earlier than the other. We assume that the sample is longer or the same
// and there for cut off earlier. So we should find the root most frame in
// the sample somewhere in the control.
c--;
}
}

for (; s >= 1 && c >= 0; s--, c--) {
Expand Down Expand Up @@ -7008,7 +7087,7 @@ function describeNativeComponentFrame(fn, construct) {
_frame = _frame.replace('<anonymous>', fn.displayName);
}

{
if (true) {
if (typeof fn === 'function') {
componentFrameCache.set(fn, _frame);
}
Expand Down Expand Up @@ -11612,7 +11691,7 @@ function flushCompletedQueues(request, destination) {

flushSegment(request, destination, completedRootSegment);
request.completedRootSegment = null;
writeCompletedRoot(destination, request.renderState);
writeCompletedRoot(destination, request.renderState, request.resumableState);
} else {
// We haven't flushed the root yet so we don't need to check any other branches further down
return;
Expand Down
Loading
Loading